Metadata-Version: 2.4
Name: forgeoptimizer
Version: 1.0.0
Summary: Forge — AI optimization runtime. Fast prompt and token optimization for Claude Code, Codex, Cursor, OpenCode, and CommandCode CLI.
Project-URL: Homepage, https://github.com/mdshzb04/ForgeCli
Project-URL: Repository, https://github.com/mdshzb04/ForgeCli
Project-URL: Documentation, https://github.com/mdshzb04/ForgeCli#readme
Project-URL: Issues, https://github.com/mdshzb04/ForgeCli/issues
Author: Forge Authors
License: MIT License
        
        Copyright (c) 2025 Forge Authors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: ai,claude,cli,codex,cursor,developer-tools
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development
Requires-Python: >=3.12
Requires-Dist: aiofiles>=23.2.1
Requires-Dist: click>=8.1.7
Requires-Dist: cryptography>=42.0.5
Requires-Dist: gitpython>=3.1.42
Requires-Dist: httpx>=0.27.0
Requires-Dist: keyring>=25.2.0
Requires-Dist: platformdirs>=4.2.0
Requires-Dist: pydantic-settings>=2.2.0
Requires-Dist: pydantic>=2.6.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.7.0
Requires-Dist: tree-sitter-languages>=1.10.0
Requires-Dist: tree-sitter>=0.21.0
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == 'dev'
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest-timeout>=2.3.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: respx>=0.21.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Requires-Dist: twine>=5.0.0; extra == 'dev'
Requires-Dist: types-pyyaml; extra == 'dev'
Description-Content-Type: text/markdown

# Forge

Forge is an AI optimization runtime. It prepares your repository context at light speed — prompt optimization and token compression — then launches the AI CLI you already use.

Install:

```bash
uv tool install forgectx
```

The command is `forge`.

## What it does

When you run `forge claude`, `forge codex`, `forge cursor`, `forge opencode`, or `forge commandcode`, Forge:

1. Detects your git repository (or current directory)
2. Builds a **shallow** repo snapshot — it does **not** index your whole codebase
3. Runs prompt optimization (Ponytail ruleset) and token compression
4. Reuses cached results when nothing important changed
5. Launches the selected CLI with `FORGE_CONTEXT` and `FORGE_CONTEXT_FILE` set

Wrappers feel instant because Forge skips full graph builds during normal use.

## Commands

| Command | Description |
| -------- | ------------ |
| `forge claude` | Launch Claude Code with optimized context |
| `forge codex` | Launch Codex CLI with optimized context |
| `forge cursor` | Launch Cursor CLI with optimized context |
| `forge opencode` | Launch OpenCode CLI with optimized context |
| `forge commandcode` | Launch CommandCode CLI with optimized context |
| `forge graph build` | Optionally build a full knowledge graph via Graphify |
| `forge --version` | Show version |

Pass through any flags your CLI supports:

```bash
forge claude -- "fix the failing test in tests/test_foo.py"
forge codex --help
forge cursor --refresh
```

Use `--refresh` to bypass Forge's context cache.

## Optional: knowledge graph

If you want a full codebase knowledge graph (separate from the fast wrapper path):

```bash
uv tool install graphifyy
forge graph build
```

Graphify runs only when you ask for it — not on every `forge claude` / `codex` / `cursor` invocation.

## Environment variables

Wrappers export:

| Variable | Purpose |
| -------- | -------- |
| `FORGE_CONTEXT` | Optimized text context |
| `FORGE_CONTEXT_FILE` | Path to the optimized context file |
| `FORGE_REPO_ROOT` | Detected repository root |

## Development

```bash
git clone https://github.com/mdshzb04/ForgeCli
cd ForgeCli
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check forgecli tests
```

## Release

Push a version tag to publish to TestPyPI and PyPI:

```bash
git tag v1.0.0
git push origin v1.0.0
```

Publish jobs run **only on `v*` tags**. On regular pushes to `main`, those jobs show as **Skipped** — that is expected, not a failure.

Configure GitHub environments `testpypi` and `pypi` with PyPI trusted publishing for package name `forgectx`.

---

<img width="1854" height="1005" alt="image" src="https://github.com/user-attachments/assets/03f3c2e2-424c-4784-8a59-b2b0f4b99447" />

<img width="1854" height="1005" alt="image" src="https://github.com/user-attachments/assets/6eb06d10-6f1f-4648-b679-028368362c24" />

## License

[MIT](LICENSE)
