forgeoptimizer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. forgeoptimizer-0.1.0/.cursor/mcp.json +10 -0
  2. forgeoptimizer-0.1.0/.github/workflows/ci.yml +197 -0
  3. forgeoptimizer-0.1.0/.gitignore +51 -0
  4. forgeoptimizer-0.1.0/.mcp.json +10 -0
  5. forgeoptimizer-0.1.0/Forge.toml +17 -0
  6. forgeoptimizer-0.1.0/LICENSE +21 -0
  7. forgeoptimizer-0.1.0/PKG-INFO +177 -0
  8. forgeoptimizer-0.1.0/README.md +106 -0
  9. forgeoptimizer-0.1.0/forgecli/__init__.py +4 -0
  10. forgeoptimizer-0.1.0/forgecli/build/__init__.py +135 -0
  11. forgeoptimizer-0.1.0/forgecli/build/apply.py +218 -0
  12. forgeoptimizer-0.1.0/forgecli/build/caveman_optimize.py +37 -0
  13. forgeoptimizer-0.1.0/forgecli/build/diff_extract.py +218 -0
  14. forgeoptimizer-0.1.0/forgecli/build/llm.py +167 -0
  15. forgeoptimizer-0.1.0/forgecli/build/optimize.py +37 -0
  16. forgeoptimizer-0.1.0/forgecli/build/pipeline.py +76 -0
  17. forgeoptimizer-0.1.0/forgecli/build/retrieval.py +157 -0
  18. forgeoptimizer-0.1.0/forgecli/build/summarize.py +76 -0
  19. forgeoptimizer-0.1.0/forgecli/build/test_run.py +75 -0
  20. forgeoptimizer-0.1.0/forgecli/builder/__init__.py +11 -0
  21. forgeoptimizer-0.1.0/forgecli/builder/builder.py +53 -0
  22. forgeoptimizer-0.1.0/forgecli/builder/editor.py +36 -0
  23. forgeoptimizer-0.1.0/forgecli/builder/formatter.py +31 -0
  24. forgeoptimizer-0.1.0/forgecli/cli/__init__.py +5 -0
  25. forgeoptimizer-0.1.0/forgecli/cli/bootstrap.py +281 -0
  26. forgeoptimizer-0.1.0/forgecli/cli/commands_graph.py +149 -0
  27. forgeoptimizer-0.1.0/forgecli/cli/commands_wrappers.py +80 -0
  28. forgeoptimizer-0.1.0/forgecli/cli/daemon.py +744 -0
  29. forgeoptimizer-0.1.0/forgecli/cli/main.py +234 -0
  30. forgeoptimizer-0.1.0/forgecli/cli/ui.py +56 -0
  31. forgeoptimizer-0.1.0/forgecli/config/__init__.py +28 -0
  32. forgeoptimizer-0.1.0/forgecli/config/loader.py +85 -0
  33. forgeoptimizer-0.1.0/forgecli/config/settings.py +206 -0
  34. forgeoptimizer-0.1.0/forgecli/config/writer.py +90 -0
  35. forgeoptimizer-0.1.0/forgecli/core/__init__.py +35 -0
  36. forgeoptimizer-0.1.0/forgecli/core/container.py +68 -0
  37. forgeoptimizer-0.1.0/forgecli/core/context.py +54 -0
  38. forgeoptimizer-0.1.0/forgecli/core/credentials.py +114 -0
  39. forgeoptimizer-0.1.0/forgecli/core/errors.py +27 -0
  40. forgeoptimizer-0.1.0/forgecli/core/events.py +67 -0
  41. forgeoptimizer-0.1.0/forgecli/core/logging.py +47 -0
  42. forgeoptimizer-0.1.0/forgecli/core/models.py +214 -0
  43. forgeoptimizer-0.1.0/forgecli/core/plugins.py +54 -0
  44. forgeoptimizer-0.1.0/forgecli/core/service.py +22 -0
  45. forgeoptimizer-0.1.0/forgecli/docs/__init__.py +5 -0
  46. forgeoptimizer-0.1.0/forgecli/docs/generator.py +115 -0
  47. forgeoptimizer-0.1.0/forgecli/engine/__init__.py +105 -0
  48. forgeoptimizer-0.1.0/forgecli/engine/context.py +163 -0
  49. forgeoptimizer-0.1.0/forgecli/engine/defaults.py +89 -0
  50. forgeoptimizer-0.1.0/forgecli/engine/events.py +185 -0
  51. forgeoptimizer-0.1.0/forgecli/engine/execution.py +519 -0
  52. forgeoptimizer-0.1.0/forgecli/engine/plugins.py +145 -0
  53. forgeoptimizer-0.1.0/forgecli/engine/runner.py +158 -0
  54. forgeoptimizer-0.1.0/forgecli/engine/stages/__init__.py +33 -0
  55. forgeoptimizer-0.1.0/forgecli/engine/stages/caveman_optimizer.py +47 -0
  56. forgeoptimizer-0.1.0/forgecli/engine/stages/context_optimizer.py +44 -0
  57. forgeoptimizer-0.1.0/forgecli/engine/stages/execution_engine_stage.py +102 -0
  58. forgeoptimizer-0.1.0/forgecli/engine/stages/git_engine.py +30 -0
  59. forgeoptimizer-0.1.0/forgecli/engine/stages/intent_analyzer.py +38 -0
  60. forgeoptimizer-0.1.0/forgecli/engine/stages/model_router.py +65 -0
  61. forgeoptimizer-0.1.0/forgecli/engine/stages/planning_engine.py +45 -0
  62. forgeoptimizer-0.1.0/forgecli/engine/stages/repository_analyzer.py +54 -0
  63. forgeoptimizer-0.1.0/forgecli/engine/stages/validation_engine.py +87 -0
  64. forgeoptimizer-0.1.0/forgecli/git/__init__.py +9 -0
  65. forgeoptimizer-0.1.0/forgecli/git/repo.py +55 -0
  66. forgeoptimizer-0.1.0/forgecli/git/service.py +45 -0
  67. forgeoptimizer-0.1.0/forgecli/graph/__init__.py +56 -0
  68. forgeoptimizer-0.1.0/forgecli/graph/backend_graphify.py +448 -0
  69. forgeoptimizer-0.1.0/forgecli/graph/edge.py +19 -0
  70. forgeoptimizer-0.1.0/forgecli/graph/graph.py +85 -0
  71. forgeoptimizer-0.1.0/forgecli/graph/graphify.py +405 -0
  72. forgeoptimizer-0.1.0/forgecli/graph/indexer.py +82 -0
  73. forgeoptimizer-0.1.0/forgecli/graph/node.py +47 -0
  74. forgeoptimizer-0.1.0/forgecli/graph/repository.py +164 -0
  75. forgeoptimizer-0.1.0/forgecli/memory/__init__.py +12 -0
  76. forgeoptimizer-0.1.0/forgecli/memory/cache.py +61 -0
  77. forgeoptimizer-0.1.0/forgecli/memory/history.py +136 -0
  78. forgeoptimizer-0.1.0/forgecli/memory/store.py +85 -0
  79. forgeoptimizer-0.1.0/forgecli/optimizer/__init__.py +13 -0
  80. forgeoptimizer-0.1.0/forgecli/optimizer/caveman/__init__.py +169 -0
  81. forgeoptimizer-0.1.0/forgecli/optimizer/caveman/cli.py +62 -0
  82. forgeoptimizer-0.1.0/forgecli/optimizer/caveman/decorator.py +67 -0
  83. forgeoptimizer-0.1.0/forgecli/optimizer/caveman/factory.py +51 -0
  84. forgeoptimizer-0.1.0/forgecli/optimizer/caveman/ruleset.py +156 -0
  85. forgeoptimizer-0.1.0/forgecli/optimizer/caveman/state.py +50 -0
  86. forgeoptimizer-0.1.0/forgecli/optimizer/chunker.py +85 -0
  87. forgeoptimizer-0.1.0/forgecli/optimizer/optimizer.py +81 -0
  88. forgeoptimizer-0.1.0/forgecli/optimizer/ponytail/__init__.py +181 -0
  89. forgeoptimizer-0.1.0/forgecli/optimizer/ponytail/cli.py +159 -0
  90. forgeoptimizer-0.1.0/forgecli/optimizer/ponytail/decorator.py +70 -0
  91. forgeoptimizer-0.1.0/forgecli/optimizer/ponytail/factory.py +51 -0
  92. forgeoptimizer-0.1.0/forgecli/optimizer/ponytail/ruleset.py +168 -0
  93. forgeoptimizer-0.1.0/forgecli/optimizer/ponytail/state.py +51 -0
  94. forgeoptimizer-0.1.0/forgecli/optimizer/ranker.py +37 -0
  95. forgeoptimizer-0.1.0/forgecli/optimizer/summarizer.py +44 -0
  96. forgeoptimizer-0.1.0/forgecli/orchestrator/__init__.py +706 -0
  97. forgeoptimizer-0.1.0/forgecli/planner/__init__.py +56 -0
  98. forgeoptimizer-0.1.0/forgecli/planner/agent.py +61 -0
  99. forgeoptimizer-0.1.0/forgecli/planner/plan.py +65 -0
  100. forgeoptimizer-0.1.0/forgecli/planner/planner.py +17 -0
  101. forgeoptimizer-0.1.0/forgecli/planner/render.py +267 -0
  102. forgeoptimizer-0.1.0/forgecli/planner/serialize.py +104 -0
  103. forgeoptimizer-0.1.0/forgecli/planner/software.py +832 -0
  104. forgeoptimizer-0.1.0/forgecli/platform/__init__.py +91 -0
  105. forgeoptimizer-0.1.0/forgecli/platform/core.py +201 -0
  106. forgeoptimizer-0.1.0/forgecli/platform/deps.py +361 -0
  107. forgeoptimizer-0.1.0/forgecli/platform/paths.py +234 -0
  108. forgeoptimizer-0.1.0/forgecli/platform/shell.py +176 -0
  109. forgeoptimizer-0.1.0/forgecli/platform/update.py +253 -0
  110. forgeoptimizer-0.1.0/forgecli/plugins/__init__.py +249 -0
  111. forgeoptimizer-0.1.0/forgecli/prompts/__init__.py +11 -0
  112. forgeoptimizer-0.1.0/forgecli/prompts/loader.py +28 -0
  113. forgeoptimizer-0.1.0/forgecli/prompts/registry.py +32 -0
  114. forgeoptimizer-0.1.0/forgecli/prompts/renderer.py +23 -0
  115. forgeoptimizer-0.1.0/forgecli/providers/__init__.py +39 -0
  116. forgeoptimizer-0.1.0/forgecli/providers/anthropic.py +207 -0
  117. forgeoptimizer-0.1.0/forgecli/providers/base.py +204 -0
  118. forgeoptimizer-0.1.0/forgecli/providers/builtin.py +26 -0
  119. forgeoptimizer-0.1.0/forgecli/providers/conversation.py +74 -0
  120. forgeoptimizer-0.1.0/forgecli/providers/google.py +290 -0
  121. forgeoptimizer-0.1.0/forgecli/providers/http_base.py +207 -0
  122. forgeoptimizer-0.1.0/forgecli/providers/mock.py +111 -0
  123. forgeoptimizer-0.1.0/forgecli/providers/openai.py +206 -0
  124. forgeoptimizer-0.1.0/forgecli/providers/openai_compatible.py +787 -0
  125. forgeoptimizer-0.1.0/forgecli/providers/router.py +340 -0
  126. forgeoptimizer-0.1.0/forgecli/providers/router_state.py +89 -0
  127. forgeoptimizer-0.1.0/forgecli/review/__init__.py +45 -0
  128. forgeoptimizer-0.1.0/forgecli/review/analyzer.py +124 -0
  129. forgeoptimizer-0.1.0/forgecli/review/analyzers/__init__.py +1 -0
  130. forgeoptimizer-0.1.0/forgecli/review/analyzers/architecture.py +255 -0
  131. forgeoptimizer-0.1.0/forgecli/review/analyzers/complexity.py +162 -0
  132. forgeoptimizer-0.1.0/forgecli/review/analyzers/dead_code.py +255 -0
  133. forgeoptimizer-0.1.0/forgecli/review/analyzers/duplicates.py +161 -0
  134. forgeoptimizer-0.1.0/forgecli/review/analyzers/performance.py +161 -0
  135. forgeoptimizer-0.1.0/forgecli/review/analyzers/security.py +244 -0
  136. forgeoptimizer-0.1.0/forgecli/review/finding.py +68 -0
  137. forgeoptimizer-0.1.0/forgecli/review/report.py +321 -0
  138. forgeoptimizer-0.1.0/forgecli/review/repository.py +130 -0
  139. forgeoptimizer-0.1.0/forgecli/review/suggestions.py +98 -0
  140. forgeoptimizer-0.1.0/forgecli/runtime/__init__.py +6 -0
  141. forgeoptimizer-0.1.0/forgecli/runtime/cache_store.py +75 -0
  142. forgeoptimizer-0.1.0/forgecli/runtime/mcp_config.py +118 -0
  143. forgeoptimizer-0.1.0/forgecli/runtime/prepare.py +203 -0
  144. forgeoptimizer-0.1.0/forgecli/runtime/wrappers.py +150 -0
  145. forgeoptimizer-0.1.0/forgecli/sdk/__init__.py +132 -0
  146. forgeoptimizer-0.1.0/forgecli/sdk/events.py +206 -0
  147. forgeoptimizer-0.1.0/forgecli/sdk/interfaces.py +282 -0
  148. forgeoptimizer-0.1.0/forgecli/sdk/loader.py +239 -0
  149. forgeoptimizer-0.1.0/forgecli/sdk/manager.py +678 -0
  150. forgeoptimizer-0.1.0/forgecli/sdk/manifest.py +395 -0
  151. forgeoptimizer-0.1.0/forgecli/sdk/sandbox.py +247 -0
  152. forgeoptimizer-0.1.0/forgecli/sdk/version.py +313 -0
  153. forgeoptimizer-0.1.0/forgecli/templates/__init__.py +9 -0
  154. forgeoptimizer-0.1.0/forgecli/templates/engine.py +37 -0
  155. forgeoptimizer-0.1.0/forgecli/templates/registry.py +32 -0
  156. forgeoptimizer-0.1.0/forgecli/utils/__init__.py +19 -0
  157. forgeoptimizer-0.1.0/forgecli/utils/fs.py +121 -0
  158. forgeoptimizer-0.1.0/forgecli/utils/ids.py +11 -0
  159. forgeoptimizer-0.1.0/forgecli/utils/io.py +27 -0
  160. forgeoptimizer-0.1.0/forgecli/utils/paths.py +78 -0
  161. forgeoptimizer-0.1.0/forgecli/utils/stats.py +179 -0
  162. forgeoptimizer-0.1.0/forgecli/utils/timing.py +25 -0
  163. forgeoptimizer-0.1.0/forgecli.toml +1 -0
  164. forgeoptimizer-0.1.0/packaging/scoop/forgecli.json +18 -0
  165. forgeoptimizer-0.1.0/packaging/winget/forgecli.ForgeCli.yaml +56 -0
  166. forgeoptimizer-0.1.0/pyproject.toml +106 -0
  167. forgeoptimizer-0.1.0/tests/__init__.py +1 -0
  168. forgeoptimizer-0.1.0/tests/conftest.py +56 -0
  169. forgeoptimizer-0.1.0/tests/test_build_pipeline.py +450 -0
  170. forgeoptimizer-0.1.0/tests/test_caveman_cli.py +121 -0
  171. forgeoptimizer-0.1.0/tests/test_caveman_ruleset.py +201 -0
  172. forgeoptimizer-0.1.0/tests/test_cli.py +247 -0
  173. forgeoptimizer-0.1.0/tests/test_config.py +36 -0
  174. forgeoptimizer-0.1.0/tests/test_container.py +55 -0
  175. forgeoptimizer-0.1.0/tests/test_engine.py +430 -0
  176. forgeoptimizer-0.1.0/tests/test_graph.py +41 -0
  177. forgeoptimizer-0.1.0/tests/test_graphify_client.py +173 -0
  178. forgeoptimizer-0.1.0/tests/test_memory.py +47 -0
  179. forgeoptimizer-0.1.0/tests/test_optimizer.py +44 -0
  180. forgeoptimizer-0.1.0/tests/test_orchestrator.py +318 -0
  181. forgeoptimizer-0.1.0/tests/test_planner.py +50 -0
  182. forgeoptimizer-0.1.0/tests/test_planner_render.py +120 -0
  183. forgeoptimizer-0.1.0/tests/test_platform.py +382 -0
  184. forgeoptimizer-0.1.0/tests/test_ponytail_cli.py +204 -0
  185. forgeoptimizer-0.1.0/tests/test_ponytail_ruleset.py +191 -0
  186. forgeoptimizer-0.1.0/tests/test_prompts.py +18 -0
  187. forgeoptimizer-0.1.0/tests/test_providers.py +98 -0
  188. forgeoptimizer-0.1.0/tests/test_providers_http.py +274 -0
  189. forgeoptimizer-0.1.0/tests/test_repository_graph.py +252 -0
  190. forgeoptimizer-0.1.0/tests/test_review.py +439 -0
  191. forgeoptimizer-0.1.0/tests/test_router.py +163 -0
  192. forgeoptimizer-0.1.0/tests/test_runtime.py +58 -0
  193. forgeoptimizer-0.1.0/tests/test_sdk.py +583 -0
  194. forgeoptimizer-0.1.0/tests/test_software_planner.py +188 -0
  195. forgeoptimizer-0.1.0/tests/test_stats.py +189 -0
  196. forgeoptimizer-0.1.0/tests/test_utils.py +66 -0
  197. forgeoptimizer-0.1.0/uv.lock +1366 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "forge": {
4
+ "command": "forge",
5
+ "args": [
6
+ "mcp"
7
+ ]
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,197 @@
1
+ name: ci
2
+ env:
3
+ PYTHONUTF8: "1"
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ tags:
8
+ - "v*"
9
+ pull_request:
10
+ branches: [main]
11
+ workflow_dispatch:
12
+
13
+ jobs:
14
+ test:
15
+ name: test (${{ matrix.os }} / py${{ matrix.python-version }})
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [ubuntu-latest, macos-latest, windows-latest]
21
+ python-version: ["3.12"]
22
+
23
+ steps:
24
+ - name: Check out
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ cache: pip
32
+
33
+ - name: Install
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ python -m pip install -e ".[dev]"
37
+
38
+ - name: Smoke test CLI
39
+ run: |
40
+ forge --version
41
+ forge --help
42
+ forge graph --help
43
+
44
+ - name: Lint
45
+ run: python -m ruff check forgecli tests
46
+
47
+ - name: Tests
48
+ run: python -m pytest -q
49
+
50
+ - name: Cross-platform shell smoke
51
+ if: runner.os != 'Windows'
52
+ shell: bash
53
+ run: |
54
+ python -c "from forgecli.platform import run; r = run(['echo', 'cross-platform']); print('OK' if r.ok else 'FAIL')"
55
+
56
+ - name: Cross-platform shell smoke (Windows)
57
+ if: runner.os == 'Windows'
58
+ shell: pwsh
59
+ run: |
60
+ python -c "from forgecli.platform import run; r = run(['cmd.exe', '/c', 'echo cross-platform']); print('OK' if r.ok else 'FAIL')"
61
+
62
+ build:
63
+ name: build sdist + wheel
64
+ runs-on: ubuntu-latest
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+ - uses: actions/setup-python@v5
68
+ with:
69
+ python-version: "3.12"
70
+ - name: Install build
71
+ run: python -m pip install --upgrade build twine
72
+ - name: Build
73
+ run: python -m build
74
+ - name: Verify package metadata
75
+ run: |
76
+ twine check dist/*
77
+ python - <<'PY'
78
+ import zipfile
79
+ from pathlib import Path
80
+ wheel = next(Path("dist").glob("*.whl"))
81
+ with zipfile.ZipFile(wheel) as zf:
82
+ names = zf.namelist()
83
+ assert any(n.startswith("forgecli/") for n in names), "missing forgecli package"
84
+ print(f"OK: {wheel.name}")
85
+ PY
86
+ - name: Upload artifacts
87
+ uses: actions/upload-artifact@v4
88
+ with:
89
+ name: dist
90
+ path: dist/
91
+
92
+ uv-install:
93
+ name: uv tool install (${{ matrix.os }})
94
+ needs: build
95
+ runs-on: ${{ matrix.os }}
96
+ strategy:
97
+ fail-fast: false
98
+ matrix:
99
+ os: [ubuntu-latest, macos-latest, windows-latest]
100
+ steps:
101
+ - name: Check out
102
+ uses: actions/checkout@v4
103
+
104
+ - name: Set up Python
105
+ uses: actions/setup-python@v5
106
+ with:
107
+ python-version: "3.12"
108
+
109
+ - name: Install uv
110
+ uses: astral-sh/setup-uv@v6
111
+
112
+ - uses: actions/download-artifact@v4
113
+ with:
114
+ name: dist
115
+ path: dist/
116
+
117
+ - name: Install forgectx via uv tool
118
+ shell: bash
119
+ run: |
120
+ uv tool install dist/*.whl
121
+
122
+ - name: Verify forge --help
123
+ run: forge --help
124
+
125
+ - name: Verify wrapper commands are registered
126
+ run: |
127
+ forge claude --help
128
+ forge codex --help
129
+ forge cursor --help
130
+ forge opencode --help
131
+ forge commandcode --help
132
+
133
+
134
+ publish-testpypi:
135
+ name: publish to TestPyPI (on tag or manual)
136
+ if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
137
+ needs: [test, build, uv-install]
138
+ runs-on: ubuntu-latest
139
+ environment: testpypi
140
+ permissions:
141
+ id-token: write
142
+ contents: read
143
+ steps:
144
+ - uses: actions/checkout@v4
145
+ - uses: actions/setup-python@v5
146
+ with:
147
+ python-version: "3.12"
148
+ - name: Rename package to match TestPyPI Trusted Publisher
149
+ run: |
150
+ python -c "
151
+ p = 'pyproject.toml'
152
+ content = open(p).read()
153
+ content = content.replace('name = \"forgectx\"', 'name = \"forgekit\"')
154
+ open(p, 'w').write(content)
155
+ "
156
+ - name: Build sdist and wheel
157
+ run: |
158
+ pip install --upgrade build
159
+ python -m build
160
+ - name: Publish
161
+ uses: pypa/gh-action-pypi-publish@release/v1
162
+ with:
163
+ repository-url: https://test.pypi.org/legacy/
164
+ skip-existing: true
165
+
166
+ publish-pypi:
167
+ name: publish to PyPI (on tag or manual)
168
+ if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
169
+ needs: [test, build, uv-install]
170
+ runs-on: ubuntu-latest
171
+ environment: pypi
172
+ permissions:
173
+ id-token: write
174
+ contents: read
175
+ steps:
176
+ - uses: actions/checkout@v4
177
+ - uses: actions/setup-python@v5
178
+ with:
179
+ python-version: "3.12"
180
+ - name: Rename package to match PyPI Trusted Publisher
181
+ run: |
182
+ python -c "
183
+ p = 'pyproject.toml'
184
+ content = open(p).read()
185
+ content = content.replace('name = \"forgectx\"', 'name = \"forgeoptimizer\"')
186
+ open(p, 'w').write(content)
187
+ "
188
+ - name: Build sdist and wheel
189
+ run: |
190
+ pip install --upgrade build
191
+ python -m build
192
+ - name: Publish
193
+ uses: pypa/gh-action-pypi-publish@release/v1
194
+ with:
195
+ skip-existing: true
196
+
197
+
@@ -0,0 +1,51 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ .commandcode/
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ build/
11
+ graphify-out/
12
+ dist/
13
+ *.egg-info/
14
+ *.egg
15
+
16
+ # But the in-tree `forgecli/build/` package is part of our source.
17
+ !forgecli/build/
18
+
19
+ # Virtual environments
20
+ .venv/
21
+ venv/
22
+ env/
23
+ .env
24
+
25
+ # Test / coverage
26
+ .pytest_cache/
27
+ .coverage
28
+ htmlcov/
29
+ .mypy_cache/
30
+ .ruff_cache/
31
+
32
+ # Editor
33
+ .idea/
34
+ .vscode/
35
+ *.swp
36
+ .DS_Store
37
+
38
+ # Local config / secrets
39
+ .env
40
+ .env.*
41
+ !.env.example
42
+ *.local.toml
43
+
44
+ # Local data
45
+ *.db
46
+ *.sqlite
47
+ *.sqlite3
48
+
49
+ # Test artifacts (prevent CI failures)
50
+ foo.py
51
+ main.go
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "forge": {
4
+ "command": "forge",
5
+ "args": [
6
+ "mcp"
7
+ ]
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,17 @@
1
+ [app]
2
+ log_level = "INFO"
3
+
4
+ [git]
5
+ default_branch = "main"
6
+
7
+ [graph]
8
+ enabled = true
9
+ languages = ["python", "typescript"]
10
+
11
+ [prompt_optimizer]
12
+ backend = "ruleset"
13
+ enabled = true
14
+ intensity = "lite"
15
+
16
+ [providers]
17
+ allowed = ["mock"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Forge Authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,177 @@
1
+ Metadata-Version: 2.4
2
+ Name: forgeoptimizer
3
+ Version: 0.1.0
4
+ Summary: Forge — AI optimization runtime. Fast prompt and token optimization for Claude Code, Codex, Cursor, OpenCode, and CommandCode CLI.
5
+ Project-URL: Homepage, https://github.com/mdshzb04/Forge
6
+ Project-URL: Repository, https://github.com/mdshzb04/Forge
7
+ Project-URL: Documentation, https://github.com/mdshzb04/Forge#readme
8
+ Project-URL: Issues, https://github.com/mdshzb04/Forge/issues
9
+ Author: Forge Authors
10
+ License: MIT License
11
+
12
+ Copyright (c) 2025 Forge Authors
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: ai,claude,cli,codex,cursor,developer-tools
33
+ Classifier: Development Status :: 5 - Production/Stable
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Programming Language :: Python :: 3.13
41
+ Classifier: Topic :: Software Development
42
+ Requires-Python: >=3.12
43
+ Requires-Dist: aiofiles>=23.2.1
44
+ Requires-Dist: click>=8.1.7
45
+ Requires-Dist: cryptography>=42.0.5
46
+ Requires-Dist: fastapi>=0.100.0
47
+ Requires-Dist: gitpython>=3.1.42
48
+ Requires-Dist: httpx>=0.27.0
49
+ Requires-Dist: keyring>=25.2.0
50
+ Requires-Dist: platformdirs>=4.2.0
51
+ Requires-Dist: pydantic-settings>=2.2.0
52
+ Requires-Dist: pydantic>=2.6.0
53
+ Requires-Dist: pyyaml>=6.0
54
+ Requires-Dist: rich>=13.7.0
55
+ Requires-Dist: tree-sitter-languages>=1.10.0
56
+ Requires-Dist: tree-sitter>=0.21.0
57
+ Requires-Dist: typer>=0.12.0
58
+ Requires-Dist: uvicorn>=0.20.0
59
+ Provides-Extra: dev
60
+ Requires-Dist: build>=1.0.0; extra == 'dev'
61
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
62
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
63
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
64
+ Requires-Dist: pytest-timeout>=2.3.0; extra == 'dev'
65
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
66
+ Requires-Dist: respx>=0.21.0; extra == 'dev'
67
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
68
+ Requires-Dist: twine>=5.0.0; extra == 'dev'
69
+ Requires-Dist: types-pyyaml; extra == 'dev'
70
+ Description-Content-Type: text/markdown
71
+
72
+ # Forge
73
+
74
+ 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.
75
+
76
+ Install:
77
+
78
+ **Development:**
79
+ ```bash
80
+ uv tool install .
81
+ ```
82
+
83
+ **Release:**
84
+ ```bash
85
+ uv tool install forgectx
86
+ ```
87
+
88
+ The command is `forge`.
89
+
90
+ ## Convenience Wrappers vs. Core MCP Runtime
91
+
92
+ Forge provides two primary interfaces to connect with your AI coding tools:
93
+ 1. **Convenience Wrappers** (`forge claude`, `forge cursor`, etc.): Commands that automatically prepare/optimize context, update local and global configurations, and launch the target AI CLI under an optimized environment.
94
+ 2. **Core MCP Runtime** (`forge mcp`): The standard Model Context Protocol (MCP) interface that compatible AI clients communicate with over stdio.
95
+
96
+ ## Commands
97
+
98
+ | Command | Type | Description |
99
+ | -------- | ---- | ----------- |
100
+ | `forge claude` | Wrapper | Launch Claude Code with optimized context and auto-registered MCP |
101
+ | `forge codex` | Wrapper | Launch Codex CLI with optimized context and auto-registered MCP |
102
+ | `forge cursor` | Wrapper | Launch Cursor CLI with optimized context and auto-registered MCP |
103
+ | `forge opencode` | Wrapper | Launch OpenCode CLI with optimized context and auto-registered MCP |
104
+ | `forge commandcode` | Wrapper | Launch CommandCode CLI with optimized context and auto-registered MCP |
105
+ | `forge antigravity` | Wrapper | Launch Antigravity CLI with optimized context and auto-registered MCP |
106
+ | `forge mcp` | Core Runtime | Start the stdio Model Context Protocol (MCP) server |
107
+ | `forge start` | Daemon | Start the background context optimization daemon |
108
+ | `forge graph build` | Tool | Build a full knowledge graph via Graphify (optional) |
109
+ | `forge --version` | Tool | Show version |
110
+
111
+ > [!NOTE]
112
+ > When launching convenience wrappers, prompts or extra positional arguments are not supported directly (e.g. `forge claude "some prompt"` is blocked). Run the wrapper command without arguments to launch the tool's interactive session directly. Use the `--refresh` option to bypass the cache:
113
+ > ```bash
114
+ > forge claude --refresh
115
+ > ```
116
+
117
+ ## Model Context Protocol (MCP) Integration
118
+
119
+ Forge automatically registers its MCP server globally and project-locally for launched clients (updating `~/.claude.json`, `~/.cursor/mcp.json`, and project `.mcp.json` files).
120
+
121
+ ### Exposed Tools
122
+ Forge exposes the following schema tools over MCP:
123
+ * `get_optimized_context` — Retrieve the fully optimized and token-compressed repository context.
124
+ * `get_summary` — Retrieve a summary of the repository layout, size, and file list.
125
+ * `get_dependency_graph` — Retrieve module/file import relationships.
126
+ * `file_lookup` — Query individual file contents.
127
+ * `symbol_lookup` — Find definition locations of symbols (classes/functions).
128
+ * `semantic_search` — Keyword/phrase search across codebase chunks.
129
+
130
+ > [!IMPORTANT]
131
+ > **Client Behavior Notice:** While Forge exposes these tools to the MCP client, whether and when they are invoked depends entirely on the AI client's internal orchestration logic. Forge makes these capabilities available, but the client decides which tool to call.
132
+
133
+
134
+
135
+ ## Environment variables
136
+
137
+ Wrappers export:
138
+
139
+ | Variable | Purpose |
140
+ | -------- | -------- |
141
+ | `FORGE_CONTEXT` | Optimized text context |
142
+ | `FORGE_CONTEXT_FILE` | Path to the optimized context file |
143
+ | `FORGE_REPO_ROOT` | Detected repository root |
144
+
145
+ ## Development
146
+
147
+ ```bash
148
+ git clone https://github.com/mdshzb04/Forge
149
+ cd Forge
150
+ python -m venv .venv && source .venv/bin/activate
151
+ pip install -e ".[dev]"
152
+ pytest
153
+ ruff check forgecli tests
154
+ ```
155
+
156
+ ## Release
157
+
158
+ Push a version tag to publish to TestPyPI and PyPI:
159
+
160
+ ```bash
161
+ git tag v0.1.0
162
+ git push origin v0.1.0
163
+ ```
164
+
165
+ Publish jobs run **only on `v*` tags**. On regular pushes to `main`, those jobs show as **Skipped** — that is expected, not a failure.
166
+
167
+ Configure GitHub environments `testpypi` and `pypi` with PyPI trusted publishing for package name `forgectx`.
168
+
169
+ ---
170
+
171
+ <img width="1854" height="1005" alt="image" src="https://github.com/user-attachments/assets/03f3c2e2-424c-4784-8a59-b2b0f4b99447" />
172
+
173
+ <img width="1854" height="1005" alt="image" src="https://github.com/user-attachments/assets/6eb06d10-6f1f-4648-b679-028368362c24" />
174
+
175
+ ## License
176
+
177
+ [MIT](LICENSE)
@@ -0,0 +1,106 @@
1
+ # Forge
2
+
3
+ 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.
4
+
5
+ Install:
6
+
7
+ **Development:**
8
+ ```bash
9
+ uv tool install .
10
+ ```
11
+
12
+ **Release:**
13
+ ```bash
14
+ uv tool install forgectx
15
+ ```
16
+
17
+ The command is `forge`.
18
+
19
+ ## Convenience Wrappers vs. Core MCP Runtime
20
+
21
+ Forge provides two primary interfaces to connect with your AI coding tools:
22
+ 1. **Convenience Wrappers** (`forge claude`, `forge cursor`, etc.): Commands that automatically prepare/optimize context, update local and global configurations, and launch the target AI CLI under an optimized environment.
23
+ 2. **Core MCP Runtime** (`forge mcp`): The standard Model Context Protocol (MCP) interface that compatible AI clients communicate with over stdio.
24
+
25
+ ## Commands
26
+
27
+ | Command | Type | Description |
28
+ | -------- | ---- | ----------- |
29
+ | `forge claude` | Wrapper | Launch Claude Code with optimized context and auto-registered MCP |
30
+ | `forge codex` | Wrapper | Launch Codex CLI with optimized context and auto-registered MCP |
31
+ | `forge cursor` | Wrapper | Launch Cursor CLI with optimized context and auto-registered MCP |
32
+ | `forge opencode` | Wrapper | Launch OpenCode CLI with optimized context and auto-registered MCP |
33
+ | `forge commandcode` | Wrapper | Launch CommandCode CLI with optimized context and auto-registered MCP |
34
+ | `forge antigravity` | Wrapper | Launch Antigravity CLI with optimized context and auto-registered MCP |
35
+ | `forge mcp` | Core Runtime | Start the stdio Model Context Protocol (MCP) server |
36
+ | `forge start` | Daemon | Start the background context optimization daemon |
37
+ | `forge graph build` | Tool | Build a full knowledge graph via Graphify (optional) |
38
+ | `forge --version` | Tool | Show version |
39
+
40
+ > [!NOTE]
41
+ > When launching convenience wrappers, prompts or extra positional arguments are not supported directly (e.g. `forge claude "some prompt"` is blocked). Run the wrapper command without arguments to launch the tool's interactive session directly. Use the `--refresh` option to bypass the cache:
42
+ > ```bash
43
+ > forge claude --refresh
44
+ > ```
45
+
46
+ ## Model Context Protocol (MCP) Integration
47
+
48
+ Forge automatically registers its MCP server globally and project-locally for launched clients (updating `~/.claude.json`, `~/.cursor/mcp.json`, and project `.mcp.json` files).
49
+
50
+ ### Exposed Tools
51
+ Forge exposes the following schema tools over MCP:
52
+ * `get_optimized_context` — Retrieve the fully optimized and token-compressed repository context.
53
+ * `get_summary` — Retrieve a summary of the repository layout, size, and file list.
54
+ * `get_dependency_graph` — Retrieve module/file import relationships.
55
+ * `file_lookup` — Query individual file contents.
56
+ * `symbol_lookup` — Find definition locations of symbols (classes/functions).
57
+ * `semantic_search` — Keyword/phrase search across codebase chunks.
58
+
59
+ > [!IMPORTANT]
60
+ > **Client Behavior Notice:** While Forge exposes these tools to the MCP client, whether and when they are invoked depends entirely on the AI client's internal orchestration logic. Forge makes these capabilities available, but the client decides which tool to call.
61
+
62
+
63
+
64
+ ## Environment variables
65
+
66
+ Wrappers export:
67
+
68
+ | Variable | Purpose |
69
+ | -------- | -------- |
70
+ | `FORGE_CONTEXT` | Optimized text context |
71
+ | `FORGE_CONTEXT_FILE` | Path to the optimized context file |
72
+ | `FORGE_REPO_ROOT` | Detected repository root |
73
+
74
+ ## Development
75
+
76
+ ```bash
77
+ git clone https://github.com/mdshzb04/Forge
78
+ cd Forge
79
+ python -m venv .venv && source .venv/bin/activate
80
+ pip install -e ".[dev]"
81
+ pytest
82
+ ruff check forgecli tests
83
+ ```
84
+
85
+ ## Release
86
+
87
+ Push a version tag to publish to TestPyPI and PyPI:
88
+
89
+ ```bash
90
+ git tag v0.1.0
91
+ git push origin v0.1.0
92
+ ```
93
+
94
+ Publish jobs run **only on `v*` tags**. On regular pushes to `main`, those jobs show as **Skipped** — that is expected, not a failure.
95
+
96
+ Configure GitHub environments `testpypi` and `pypi` with PyPI trusted publishing for package name `forgectx`.
97
+
98
+ ---
99
+
100
+ <img width="1854" height="1005" alt="image" src="https://github.com/user-attachments/assets/03f3c2e2-424c-4784-8a59-b2b0f4b99447" />
101
+
102
+ <img width="1854" height="1005" alt="image" src="https://github.com/user-attachments/assets/6eb06d10-6f1f-4648-b679-028368362c24" />
103
+
104
+ ## License
105
+
106
+ [MIT](LICENSE)
@@ -0,0 +1,4 @@
1
+ """Forge — AI optimization runtime."""
2
+
3
+ __version__ = "0.1.0"
4
+ __app_name__ = "Forge"