codecortex 0.11.1__tar.gz → 0.12.1__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 (81) hide show
  1. {codecortex-0.11.1/src/codecortex.egg-info → codecortex-0.12.1}/PKG-INFO +103 -6
  2. {codecortex-0.11.1 → codecortex-0.12.1}/README.md +102 -5
  3. {codecortex-0.11.1 → codecortex-0.12.1/src/codecortex.egg-info}/PKG-INFO +103 -6
  4. {codecortex-0.11.1 → codecortex-0.12.1}/src/codecortex.egg-info/SOURCES.txt +7 -1
  5. codecortex-0.12.1/src/codeintel/__init__.py +1 -0
  6. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/__main__.py +174 -14
  7. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/cache.py +7 -0
  8. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/doctor.py +172 -5
  9. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/gateway.py +40 -0
  10. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/http_server.py +7 -0
  11. codecortex-0.12.1/src/codeintel/installer.py +369 -0
  12. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/providers/lsp.py +35 -11
  13. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/server.py +114 -43
  14. codecortex-0.12.1/src/codeintel/verify.py +316 -0
  15. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/viewer/graph_template.html +54 -6
  16. codecortex-0.12.1/tests/test_cli_help.py +136 -0
  17. codecortex-0.12.1/tests/test_engine_adoption.py +206 -0
  18. codecortex-0.12.1/tests/test_installer.py +516 -0
  19. codecortex-0.12.1/tests/test_mcp_handshake.py +215 -0
  20. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_rbac.py +10 -0
  21. codecortex-0.12.1/tests/test_verify.py +172 -0
  22. codecortex-0.12.1/tests/test_verify_call.py +141 -0
  23. codecortex-0.11.1/src/codeintel/__init__.py +0 -1
  24. codecortex-0.11.1/src/codeintel/installer.py +0 -120
  25. codecortex-0.11.1/tests/test_installer.py +0 -97
  26. {codecortex-0.11.1 → codecortex-0.12.1}/LICENSE +0 -0
  27. {codecortex-0.11.1 → codecortex-0.12.1}/pyproject.toml +0 -0
  28. {codecortex-0.11.1 → codecortex-0.12.1}/setup.cfg +0 -0
  29. {codecortex-0.11.1 → codecortex-0.12.1}/src/codecortex.egg-info/dependency_links.txt +0 -0
  30. {codecortex-0.11.1 → codecortex-0.12.1}/src/codecortex.egg-info/entry_points.txt +0 -0
  31. {codecortex-0.11.1 → codecortex-0.12.1}/src/codecortex.egg-info/requires.txt +0 -0
  32. {codecortex-0.11.1 → codecortex-0.12.1}/src/codecortex.egg-info/top_level.txt +0 -0
  33. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/auth.py +0 -0
  34. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/config.py +0 -0
  35. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/grapher.py +0 -0
  36. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/indexer.py +0 -0
  37. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/injector.py +0 -0
  38. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/logconfig.py +0 -0
  39. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/mapper.py +0 -0
  40. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/metrics.py +0 -0
  41. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/onboarding.py +0 -0
  42. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/policy.py +0 -0
  43. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/provider.py +0 -0
  44. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/providers/__init__.py +0 -0
  45. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/providers/graph.py +0 -0
  46. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/providers/none.py +0 -0
  47. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/providers/semantic.py +0 -0
  48. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/reindexer.py +0 -0
  49. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/reset.py +0 -0
  50. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/searcher.py +0 -0
  51. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/semantic_db.py +0 -0
  52. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/term.py +0 -0
  53. {codecortex-0.11.1 → codecortex-0.12.1}/src/codeintel/viewer/__init__.py +0 -0
  54. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_cache.py +0 -0
  55. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_chunking.py +0 -0
  56. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_config.py +0 -0
  57. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_doctor.py +0 -0
  58. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_e2e.py +0 -0
  59. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_enterprise.py +0 -0
  60. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_gateway.py +0 -0
  61. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_graph_provider.py +0 -0
  62. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_graph_real.py +0 -0
  63. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_graph_stdin.py +0 -0
  64. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_grapher.py +0 -0
  65. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_hardening.py +0 -0
  66. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_http_auth.py +0 -0
  67. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_http_server.py +0 -0
  68. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_integration.py +0 -0
  69. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_lsp_provider.py +0 -0
  70. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_lsp_real.py +0 -0
  71. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_mapper.py +0 -0
  72. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_mcp_server.py +0 -0
  73. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_model_dimension.py +0 -0
  74. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_never_raise.py +0 -0
  75. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_onboarding.py +0 -0
  76. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_reindexer.py +0 -0
  77. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_rerank.py +0 -0
  78. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_reset.py +0 -0
  79. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_semantic_provider.py +0 -0
  80. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_term.py +0 -0
  81. {codecortex-0.11.1 → codecortex-0.12.1}/tests/test_treesitter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecortex
3
- Version: 0.11.1
3
+ Version: 0.12.1
4
4
  Summary: Local-first, MCP-native code-intelligence server — graph, LSP, and semantic search behind one safe code.query tool for coding agents.
5
5
  Author: Shammai Hamilton
6
6
  License-Expression: MIT
@@ -110,7 +110,7 @@ The agent hands `result` straight to the model. If the graph backend isn't insta
110
110
  - **Degrades instead of breaking.** No graph backend installed? That engine returns `null` and the agent falls back to grep. The semantic engine needs nothing external, so codeintel is useful the moment it's installed and only gets sharper as you add backends.
111
111
  - **Fast on repeat, never stale.** A content-hash cache returns instantly for unchanged code and self-invalidates when a background reindex advances the index — answers stay both quick *and* fresh. The cache is bounded (LRU), so a long-running server holds steady memory.
112
112
  - **Concurrency-safe.** The HTTP transport handles requests on threads, so one slow query (an LSP session warming, a first-time index) can't block every other agent.
113
- - **Honest about its own health.** `codeintel doctor` reports exactly which engines are ready for a repo and the single command to fix each gap no guessing why a query came back empty.
113
+ - **Honest about its own health.** `codeintel doctor` answers three separate questions per engine *installed?* *runnable?* *is this repo indexed?* — with the single command to fix each gap, so "installed" is never mistaken for "working". And a readiness claim is one a query can actually honor: install a missing backend mid-session and the running server picks it up on the next call, rather than reporting the engine healthy while quietly routing around it until you restart the host.
114
114
 
115
115
  ## Quickstart
116
116
 
@@ -144,10 +144,94 @@ pip install -e .
144
144
  Register with your AI agent(s), then query:
145
145
 
146
146
  ```bash
147
- codeintel install # registers with Claude, Codex, Gemini, Zed
147
+ codeintel install # registers with the agents you actually have installed
148
148
  codeintel query --op search --target "authentication middleware"
149
149
  ```
150
150
 
151
+ ### Enable native Codex integration
152
+
153
+ `codeintel` is an MCP server, so Codex can call its tools directly rather than invoking the CLI.
154
+ After installing the package, explicitly register it with Codex:
155
+
156
+ ```bash
157
+ codeintel install --agent codex
158
+ ```
159
+
160
+ This safely adds a `[mcp_servers.codeintel]` entry to `~/.codex/config.toml` (or `$CODEX_HOME/config.toml`
161
+ when that is set) without changing your other Codex settings. Registration is deliberately opt-in:
162
+ installing a Python package should not silently modify an agent's configuration. Start a new Codex
163
+ task (or restart Codex) after registration; the refreshed task will have native `code.query`,
164
+ `code.status`, `code.doctor`, and `code.map` MCP tools available.
165
+
166
+ For a fully prepared local setup, run:
167
+
168
+ ```bash
169
+ codeintel setup --all /path/to/your/project && codeintel install --agent codex
170
+ ```
171
+
172
+ ### Enable native Claude Code integration
173
+
174
+ After installing the package, explicitly register it with Claude Code:
175
+
176
+ ```bash
177
+ codeintel install --agent claude
178
+ ```
179
+
180
+ This adds the `codeintel` MCP server to `~/.claude.json` (or `$CLAUDE_CONFIG_DIR/.claude.json`)
181
+ while preserving your existing configuration — that is the file Claude Code reads for user-scope
182
+ MCP servers, and you can confirm the entry with `claude mcp list`. Start a new Claude Code session
183
+ after registration so it can load the native `code.query`, `code.status`, `code.doctor`, and
184
+ `code.map` MCP tools.
185
+
186
+ > **Upgrading from ≤ 0.11.1?** Earlier versions wrote this block to `~/.claude/settings.json`,
187
+ > which Claude Code ignores for MCP registration — so codeintel never actually loaded. Re-run
188
+ > `codeintel install --agent claude`; it registers in the right place and points out the stale
189
+ > entry so you can delete it.
190
+
191
+ For a fully prepared local setup, run:
192
+
193
+ ```bash
194
+ codeintel setup --all /path/to/your/project && codeintel install --agent claude
195
+ ```
196
+
197
+ ### Registration is verified, not assumed
198
+
199
+ **It only touches agents you have.** `codeintel install` defaults to `--agent auto`: it registers
200
+ the hosts whose config root already exists on this machine and *names the ones it skipped*.
201
+ Installing a Python package should not create `~/.gemini/` and `~/.config/zed/` for someone who has
202
+ neither. Force a specific host with `--agent claude|codex|gemini|zed`, or every supported host with
203
+ `--agent all`.
204
+
205
+ **It registers an absolute path.** The bare name `codeintel` is resolved by the *host*, not by the
206
+ shell you ran `install` in — and a GUI-launched desktop agent does not source your shell profile, so
207
+ a command your terminal finds is routinely invisible to the app. That is the one failure a handshake
208
+ run in your terminal cannot catch, because it inherits the PATH that works. Pass
209
+ `--relative-command` for the bare name. If a later upgrade moves the binary, re-running
210
+ `codeintel install` repairs the stale path in place, leaving the rest of your config untouched.
211
+
212
+ Then it launches the exact command it registered and drives a real MCP handshake —
213
+ `initialize` → `tools/list` — and reports what came back:
214
+
215
+ ```text
216
+ v claude: registered at /Users/you/.claude.json
217
+
218
+ v verified: codeintel 0.11.2 — 4 tools (code.query, code.status, code.doctor, code.map)
219
+ ```
220
+
221
+ If the command is not on `PATH`, or the server fails to start, install says so and exits non-zero
222
+ instead of reporting a success your agent cannot use. Pass `--no-verify` to skip the handshake.
223
+
224
+ The same principle gates releases. Because every result is a safe envelope with `ok: true` and the
225
+ CLI never throws, an exit-code smoke test passes against a build that boots cleanly and answers
226
+ nothing — so **[`scripts/release_canary.py`](scripts/release_canary.py)** runs before every publish
227
+ against the built wheel in a clean environment: it registers Codex and Claude Code into a throwaway
228
+ `HOME`, launches the command those config files name, and asserts on the **answer text** of a real
229
+ `code.query` over a fixture repo. A release that writes a config no host reads, or that returns
230
+ `ok: true` with nothing in it, fails there instead of on your machine.
231
+
232
+ > Full reference — what each host reads, the absolute-path rationale, and troubleshooting:
233
+ > **[docs/install.md](docs/install.md)**.
234
+
151
235
  ## How it works
152
236
 
153
237
  A `Gateway` receives every query and dispatches it to one of three providers — graph (structural relationships), LSP (precise symbol resolution), or semantic (embedding-based search) — based on the operation type. Each provider is fully isolated: if it is unavailable or raises an exception, the gateway catches it and returns a safe-null envelope. The caller always gets a well-formed response with no exception to catch.
@@ -194,6 +278,7 @@ Pass `--engine auto` (the default) and codeintel chooses the best engine per ope
194
278
  Full system docs live in [`docs/`](docs/) — start with the index:
195
279
 
196
280
  - **[Architecture](docs/architecture.md)** — layers, the `CodeProvider` protocol, the safe-null contract, caching, freshness (ASCII + Mermaid).
281
+ - **[Install & registration](docs/install.md)** — what each agent host actually reads, why the registered command is an absolute path, and the three levels of proof that registration worked.
197
282
  - **[Query flow](docs/query-flow.md)** — request lifecycle, engine selection, fan-out & merge, and why it never throws.
198
283
  - **[Map file](docs/map-file.md)** — the static `CODE_INTEL.md` orientation layer for hosts with no MCP support.
199
284
  - **[Benchmarks](docs/benchmarks.md)** — real numbers at scale: 25 k chunks indexed in ~8 min, ~235 ms warm queries, 60 MB index.
@@ -203,7 +288,8 @@ Full system docs live in [`docs/`](docs/) — start with the index:
203
288
 
204
289
  | Command | Purpose |
205
290
  |---|---|
206
- | `codeintel install [--agent claude\|codex\|gemini\|zed\|all]` | Register codeintel with AI agent(s) |
291
+ | `codeintel help` | Every command grouped by task, with descriptions and examples (also the bare `codeintel`). A mistyped command suggests what you meant. |
292
+ | `codeintel install [--agent auto\|claude\|codex\|gemini\|zed\|all] [--no-verify] [--relative-command]` | Register codeintel with the agents installed on this machine (`auto`, the default), then prove it by completing a real MCP handshake against the registered command |
207
293
  | `codeintel setup [project_root] [--all] [--index] [--warm] [--install-uv] [--install-deps] [--json]` | Prepare backends + index this repo (`--all` = one command: do everything automatable, idempotent); ends with a health report + **Next:** steps |
208
294
  | `codeintel index [project_root]` | Index a project for semantic search |
209
295
  | `codeintel serve` | Start the MCP server (stdio transport) |
@@ -271,7 +357,7 @@ Register codeintel as an MCP server (`codeintel install`) and the agent gets fou
271
357
  | MCP tool | HTTP equivalent | Purpose |
272
358
  |---|---|---|
273
359
  | `code.query` | `POST /code/query` | The main call — search, trace, understand (the `op` table above) |
274
- | `code.status` | `GET /code/status` | Which engines are live + whether an index exists |
360
+ | `code.status` | `GET /code/status` | Per-engine `installed` / `runnable` / `repo_indexed`, probed against the live engines a query actually hits |
275
361
  | `code.doctor` | `POST /code/doctor` | Per-engine health + repo index status, with a fix for each gap |
276
362
  | `code.map` | — | Generate/refresh `CODE_INTEL.md`, a static orientation file for hosts without MCP |
277
363
 
@@ -328,5 +414,16 @@ docker build -t codeintel . && docker run -p 127.0.0.1:8766:8766 \
328
414
  git clone https://github.com/hamilton-sky/codeintel.git
329
415
  cd codeintel
330
416
  pip install -e .[dev]
331
- pytest tests/ -q # full suite (~15s — includes live graph/LSP backend tests)
417
+ pytest tests/ -q # ~410 tests, ~35s (live graph/LSP backend tests skip when absent)
332
418
  ```
419
+
420
+ **Release gate.** The unit suite runs against the source tree, so it cannot see a packaging break, a
421
+ missing entry point, a host config written where nobody reads it, or a server that boots and answers
422
+ nothing. Run the canary against the built wheel in a clean environment — the same check CI runs
423
+ before publishing:
424
+
425
+ ```bash
426
+ python -m build && python -m venv /tmp/canary && /tmp/canary/bin/python -m pip install dist/*.whl && /tmp/canary/bin/python scripts/release_canary.py
427
+ ```
428
+
429
+ It exits non-zero on the first failed check and cleans up the temporary `HOME` it installs into.
@@ -76,7 +76,7 @@ The agent hands `result` straight to the model. If the graph backend isn't insta
76
76
  - **Degrades instead of breaking.** No graph backend installed? That engine returns `null` and the agent falls back to grep. The semantic engine needs nothing external, so codeintel is useful the moment it's installed and only gets sharper as you add backends.
77
77
  - **Fast on repeat, never stale.** A content-hash cache returns instantly for unchanged code and self-invalidates when a background reindex advances the index — answers stay both quick *and* fresh. The cache is bounded (LRU), so a long-running server holds steady memory.
78
78
  - **Concurrency-safe.** The HTTP transport handles requests on threads, so one slow query (an LSP session warming, a first-time index) can't block every other agent.
79
- - **Honest about its own health.** `codeintel doctor` reports exactly which engines are ready for a repo and the single command to fix each gap no guessing why a query came back empty.
79
+ - **Honest about its own health.** `codeintel doctor` answers three separate questions per engine *installed?* *runnable?* *is this repo indexed?* — with the single command to fix each gap, so "installed" is never mistaken for "working". And a readiness claim is one a query can actually honor: install a missing backend mid-session and the running server picks it up on the next call, rather than reporting the engine healthy while quietly routing around it until you restart the host.
80
80
 
81
81
  ## Quickstart
82
82
 
@@ -110,10 +110,94 @@ pip install -e .
110
110
  Register with your AI agent(s), then query:
111
111
 
112
112
  ```bash
113
- codeintel install # registers with Claude, Codex, Gemini, Zed
113
+ codeintel install # registers with the agents you actually have installed
114
114
  codeintel query --op search --target "authentication middleware"
115
115
  ```
116
116
 
117
+ ### Enable native Codex integration
118
+
119
+ `codeintel` is an MCP server, so Codex can call its tools directly rather than invoking the CLI.
120
+ After installing the package, explicitly register it with Codex:
121
+
122
+ ```bash
123
+ codeintel install --agent codex
124
+ ```
125
+
126
+ This safely adds a `[mcp_servers.codeintel]` entry to `~/.codex/config.toml` (or `$CODEX_HOME/config.toml`
127
+ when that is set) without changing your other Codex settings. Registration is deliberately opt-in:
128
+ installing a Python package should not silently modify an agent's configuration. Start a new Codex
129
+ task (or restart Codex) after registration; the refreshed task will have native `code.query`,
130
+ `code.status`, `code.doctor`, and `code.map` MCP tools available.
131
+
132
+ For a fully prepared local setup, run:
133
+
134
+ ```bash
135
+ codeintel setup --all /path/to/your/project && codeintel install --agent codex
136
+ ```
137
+
138
+ ### Enable native Claude Code integration
139
+
140
+ After installing the package, explicitly register it with Claude Code:
141
+
142
+ ```bash
143
+ codeintel install --agent claude
144
+ ```
145
+
146
+ This adds the `codeintel` MCP server to `~/.claude.json` (or `$CLAUDE_CONFIG_DIR/.claude.json`)
147
+ while preserving your existing configuration — that is the file Claude Code reads for user-scope
148
+ MCP servers, and you can confirm the entry with `claude mcp list`. Start a new Claude Code session
149
+ after registration so it can load the native `code.query`, `code.status`, `code.doctor`, and
150
+ `code.map` MCP tools.
151
+
152
+ > **Upgrading from ≤ 0.11.1?** Earlier versions wrote this block to `~/.claude/settings.json`,
153
+ > which Claude Code ignores for MCP registration — so codeintel never actually loaded. Re-run
154
+ > `codeintel install --agent claude`; it registers in the right place and points out the stale
155
+ > entry so you can delete it.
156
+
157
+ For a fully prepared local setup, run:
158
+
159
+ ```bash
160
+ codeintel setup --all /path/to/your/project && codeintel install --agent claude
161
+ ```
162
+
163
+ ### Registration is verified, not assumed
164
+
165
+ **It only touches agents you have.** `codeintel install` defaults to `--agent auto`: it registers
166
+ the hosts whose config root already exists on this machine and *names the ones it skipped*.
167
+ Installing a Python package should not create `~/.gemini/` and `~/.config/zed/` for someone who has
168
+ neither. Force a specific host with `--agent claude|codex|gemini|zed`, or every supported host with
169
+ `--agent all`.
170
+
171
+ **It registers an absolute path.** The bare name `codeintel` is resolved by the *host*, not by the
172
+ shell you ran `install` in — and a GUI-launched desktop agent does not source your shell profile, so
173
+ a command your terminal finds is routinely invisible to the app. That is the one failure a handshake
174
+ run in your terminal cannot catch, because it inherits the PATH that works. Pass
175
+ `--relative-command` for the bare name. If a later upgrade moves the binary, re-running
176
+ `codeintel install` repairs the stale path in place, leaving the rest of your config untouched.
177
+
178
+ Then it launches the exact command it registered and drives a real MCP handshake —
179
+ `initialize` → `tools/list` — and reports what came back:
180
+
181
+ ```text
182
+ v claude: registered at /Users/you/.claude.json
183
+
184
+ v verified: codeintel 0.11.2 — 4 tools (code.query, code.status, code.doctor, code.map)
185
+ ```
186
+
187
+ If the command is not on `PATH`, or the server fails to start, install says so and exits non-zero
188
+ instead of reporting a success your agent cannot use. Pass `--no-verify` to skip the handshake.
189
+
190
+ The same principle gates releases. Because every result is a safe envelope with `ok: true` and the
191
+ CLI never throws, an exit-code smoke test passes against a build that boots cleanly and answers
192
+ nothing — so **[`scripts/release_canary.py`](scripts/release_canary.py)** runs before every publish
193
+ against the built wheel in a clean environment: it registers Codex and Claude Code into a throwaway
194
+ `HOME`, launches the command those config files name, and asserts on the **answer text** of a real
195
+ `code.query` over a fixture repo. A release that writes a config no host reads, or that returns
196
+ `ok: true` with nothing in it, fails there instead of on your machine.
197
+
198
+ > Full reference — what each host reads, the absolute-path rationale, and troubleshooting:
199
+ > **[docs/install.md](docs/install.md)**.
200
+
117
201
  ## How it works
118
202
 
119
203
  A `Gateway` receives every query and dispatches it to one of three providers — graph (structural relationships), LSP (precise symbol resolution), or semantic (embedding-based search) — based on the operation type. Each provider is fully isolated: if it is unavailable or raises an exception, the gateway catches it and returns a safe-null envelope. The caller always gets a well-formed response with no exception to catch.
@@ -160,6 +244,7 @@ Pass `--engine auto` (the default) and codeintel chooses the best engine per ope
160
244
  Full system docs live in [`docs/`](docs/) — start with the index:
161
245
 
162
246
  - **[Architecture](docs/architecture.md)** — layers, the `CodeProvider` protocol, the safe-null contract, caching, freshness (ASCII + Mermaid).
247
+ - **[Install & registration](docs/install.md)** — what each agent host actually reads, why the registered command is an absolute path, and the three levels of proof that registration worked.
163
248
  - **[Query flow](docs/query-flow.md)** — request lifecycle, engine selection, fan-out & merge, and why it never throws.
164
249
  - **[Map file](docs/map-file.md)** — the static `CODE_INTEL.md` orientation layer for hosts with no MCP support.
165
250
  - **[Benchmarks](docs/benchmarks.md)** — real numbers at scale: 25 k chunks indexed in ~8 min, ~235 ms warm queries, 60 MB index.
@@ -169,7 +254,8 @@ Full system docs live in [`docs/`](docs/) — start with the index:
169
254
 
170
255
  | Command | Purpose |
171
256
  |---|---|
172
- | `codeintel install [--agent claude\|codex\|gemini\|zed\|all]` | Register codeintel with AI agent(s) |
257
+ | `codeintel help` | Every command grouped by task, with descriptions and examples (also the bare `codeintel`). A mistyped command suggests what you meant. |
258
+ | `codeintel install [--agent auto\|claude\|codex\|gemini\|zed\|all] [--no-verify] [--relative-command]` | Register codeintel with the agents installed on this machine (`auto`, the default), then prove it by completing a real MCP handshake against the registered command |
173
259
  | `codeintel setup [project_root] [--all] [--index] [--warm] [--install-uv] [--install-deps] [--json]` | Prepare backends + index this repo (`--all` = one command: do everything automatable, idempotent); ends with a health report + **Next:** steps |
174
260
  | `codeintel index [project_root]` | Index a project for semantic search |
175
261
  | `codeintel serve` | Start the MCP server (stdio transport) |
@@ -237,7 +323,7 @@ Register codeintel as an MCP server (`codeintel install`) and the agent gets fou
237
323
  | MCP tool | HTTP equivalent | Purpose |
238
324
  |---|---|---|
239
325
  | `code.query` | `POST /code/query` | The main call — search, trace, understand (the `op` table above) |
240
- | `code.status` | `GET /code/status` | Which engines are live + whether an index exists |
326
+ | `code.status` | `GET /code/status` | Per-engine `installed` / `runnable` / `repo_indexed`, probed against the live engines a query actually hits |
241
327
  | `code.doctor` | `POST /code/doctor` | Per-engine health + repo index status, with a fix for each gap |
242
328
  | `code.map` | — | Generate/refresh `CODE_INTEL.md`, a static orientation file for hosts without MCP |
243
329
 
@@ -294,5 +380,16 @@ docker build -t codeintel . && docker run -p 127.0.0.1:8766:8766 \
294
380
  git clone https://github.com/hamilton-sky/codeintel.git
295
381
  cd codeintel
296
382
  pip install -e .[dev]
297
- pytest tests/ -q # full suite (~15s — includes live graph/LSP backend tests)
383
+ pytest tests/ -q # ~410 tests, ~35s (live graph/LSP backend tests skip when absent)
298
384
  ```
385
+
386
+ **Release gate.** The unit suite runs against the source tree, so it cannot see a packaging break, a
387
+ missing entry point, a host config written where nobody reads it, or a server that boots and answers
388
+ nothing. Run the canary against the built wheel in a clean environment — the same check CI runs
389
+ before publishing:
390
+
391
+ ```bash
392
+ python -m build && python -m venv /tmp/canary && /tmp/canary/bin/python -m pip install dist/*.whl && /tmp/canary/bin/python scripts/release_canary.py
393
+ ```
394
+
395
+ It exits non-zero on the first failed check and cleans up the temporary `HOME` it installs into.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecortex
3
- Version: 0.11.1
3
+ Version: 0.12.1
4
4
  Summary: Local-first, MCP-native code-intelligence server — graph, LSP, and semantic search behind one safe code.query tool for coding agents.
5
5
  Author: Shammai Hamilton
6
6
  License-Expression: MIT
@@ -110,7 +110,7 @@ The agent hands `result` straight to the model. If the graph backend isn't insta
110
110
  - **Degrades instead of breaking.** No graph backend installed? That engine returns `null` and the agent falls back to grep. The semantic engine needs nothing external, so codeintel is useful the moment it's installed and only gets sharper as you add backends.
111
111
  - **Fast on repeat, never stale.** A content-hash cache returns instantly for unchanged code and self-invalidates when a background reindex advances the index — answers stay both quick *and* fresh. The cache is bounded (LRU), so a long-running server holds steady memory.
112
112
  - **Concurrency-safe.** The HTTP transport handles requests on threads, so one slow query (an LSP session warming, a first-time index) can't block every other agent.
113
- - **Honest about its own health.** `codeintel doctor` reports exactly which engines are ready for a repo and the single command to fix each gap no guessing why a query came back empty.
113
+ - **Honest about its own health.** `codeintel doctor` answers three separate questions per engine *installed?* *runnable?* *is this repo indexed?* — with the single command to fix each gap, so "installed" is never mistaken for "working". And a readiness claim is one a query can actually honor: install a missing backend mid-session and the running server picks it up on the next call, rather than reporting the engine healthy while quietly routing around it until you restart the host.
114
114
 
115
115
  ## Quickstart
116
116
 
@@ -144,10 +144,94 @@ pip install -e .
144
144
  Register with your AI agent(s), then query:
145
145
 
146
146
  ```bash
147
- codeintel install # registers with Claude, Codex, Gemini, Zed
147
+ codeintel install # registers with the agents you actually have installed
148
148
  codeintel query --op search --target "authentication middleware"
149
149
  ```
150
150
 
151
+ ### Enable native Codex integration
152
+
153
+ `codeintel` is an MCP server, so Codex can call its tools directly rather than invoking the CLI.
154
+ After installing the package, explicitly register it with Codex:
155
+
156
+ ```bash
157
+ codeintel install --agent codex
158
+ ```
159
+
160
+ This safely adds a `[mcp_servers.codeintel]` entry to `~/.codex/config.toml` (or `$CODEX_HOME/config.toml`
161
+ when that is set) without changing your other Codex settings. Registration is deliberately opt-in:
162
+ installing a Python package should not silently modify an agent's configuration. Start a new Codex
163
+ task (or restart Codex) after registration; the refreshed task will have native `code.query`,
164
+ `code.status`, `code.doctor`, and `code.map` MCP tools available.
165
+
166
+ For a fully prepared local setup, run:
167
+
168
+ ```bash
169
+ codeintel setup --all /path/to/your/project && codeintel install --agent codex
170
+ ```
171
+
172
+ ### Enable native Claude Code integration
173
+
174
+ After installing the package, explicitly register it with Claude Code:
175
+
176
+ ```bash
177
+ codeintel install --agent claude
178
+ ```
179
+
180
+ This adds the `codeintel` MCP server to `~/.claude.json` (or `$CLAUDE_CONFIG_DIR/.claude.json`)
181
+ while preserving your existing configuration — that is the file Claude Code reads for user-scope
182
+ MCP servers, and you can confirm the entry with `claude mcp list`. Start a new Claude Code session
183
+ after registration so it can load the native `code.query`, `code.status`, `code.doctor`, and
184
+ `code.map` MCP tools.
185
+
186
+ > **Upgrading from ≤ 0.11.1?** Earlier versions wrote this block to `~/.claude/settings.json`,
187
+ > which Claude Code ignores for MCP registration — so codeintel never actually loaded. Re-run
188
+ > `codeintel install --agent claude`; it registers in the right place and points out the stale
189
+ > entry so you can delete it.
190
+
191
+ For a fully prepared local setup, run:
192
+
193
+ ```bash
194
+ codeintel setup --all /path/to/your/project && codeintel install --agent claude
195
+ ```
196
+
197
+ ### Registration is verified, not assumed
198
+
199
+ **It only touches agents you have.** `codeintel install` defaults to `--agent auto`: it registers
200
+ the hosts whose config root already exists on this machine and *names the ones it skipped*.
201
+ Installing a Python package should not create `~/.gemini/` and `~/.config/zed/` for someone who has
202
+ neither. Force a specific host with `--agent claude|codex|gemini|zed`, or every supported host with
203
+ `--agent all`.
204
+
205
+ **It registers an absolute path.** The bare name `codeintel` is resolved by the *host*, not by the
206
+ shell you ran `install` in — and a GUI-launched desktop agent does not source your shell profile, so
207
+ a command your terminal finds is routinely invisible to the app. That is the one failure a handshake
208
+ run in your terminal cannot catch, because it inherits the PATH that works. Pass
209
+ `--relative-command` for the bare name. If a later upgrade moves the binary, re-running
210
+ `codeintel install` repairs the stale path in place, leaving the rest of your config untouched.
211
+
212
+ Then it launches the exact command it registered and drives a real MCP handshake —
213
+ `initialize` → `tools/list` — and reports what came back:
214
+
215
+ ```text
216
+ v claude: registered at /Users/you/.claude.json
217
+
218
+ v verified: codeintel 0.11.2 — 4 tools (code.query, code.status, code.doctor, code.map)
219
+ ```
220
+
221
+ If the command is not on `PATH`, or the server fails to start, install says so and exits non-zero
222
+ instead of reporting a success your agent cannot use. Pass `--no-verify` to skip the handshake.
223
+
224
+ The same principle gates releases. Because every result is a safe envelope with `ok: true` and the
225
+ CLI never throws, an exit-code smoke test passes against a build that boots cleanly and answers
226
+ nothing — so **[`scripts/release_canary.py`](scripts/release_canary.py)** runs before every publish
227
+ against the built wheel in a clean environment: it registers Codex and Claude Code into a throwaway
228
+ `HOME`, launches the command those config files name, and asserts on the **answer text** of a real
229
+ `code.query` over a fixture repo. A release that writes a config no host reads, or that returns
230
+ `ok: true` with nothing in it, fails there instead of on your machine.
231
+
232
+ > Full reference — what each host reads, the absolute-path rationale, and troubleshooting:
233
+ > **[docs/install.md](docs/install.md)**.
234
+
151
235
  ## How it works
152
236
 
153
237
  A `Gateway` receives every query and dispatches it to one of three providers — graph (structural relationships), LSP (precise symbol resolution), or semantic (embedding-based search) — based on the operation type. Each provider is fully isolated: if it is unavailable or raises an exception, the gateway catches it and returns a safe-null envelope. The caller always gets a well-formed response with no exception to catch.
@@ -194,6 +278,7 @@ Pass `--engine auto` (the default) and codeintel chooses the best engine per ope
194
278
  Full system docs live in [`docs/`](docs/) — start with the index:
195
279
 
196
280
  - **[Architecture](docs/architecture.md)** — layers, the `CodeProvider` protocol, the safe-null contract, caching, freshness (ASCII + Mermaid).
281
+ - **[Install & registration](docs/install.md)** — what each agent host actually reads, why the registered command is an absolute path, and the three levels of proof that registration worked.
197
282
  - **[Query flow](docs/query-flow.md)** — request lifecycle, engine selection, fan-out & merge, and why it never throws.
198
283
  - **[Map file](docs/map-file.md)** — the static `CODE_INTEL.md` orientation layer for hosts with no MCP support.
199
284
  - **[Benchmarks](docs/benchmarks.md)** — real numbers at scale: 25 k chunks indexed in ~8 min, ~235 ms warm queries, 60 MB index.
@@ -203,7 +288,8 @@ Full system docs live in [`docs/`](docs/) — start with the index:
203
288
 
204
289
  | Command | Purpose |
205
290
  |---|---|
206
- | `codeintel install [--agent claude\|codex\|gemini\|zed\|all]` | Register codeintel with AI agent(s) |
291
+ | `codeintel help` | Every command grouped by task, with descriptions and examples (also the bare `codeintel`). A mistyped command suggests what you meant. |
292
+ | `codeintel install [--agent auto\|claude\|codex\|gemini\|zed\|all] [--no-verify] [--relative-command]` | Register codeintel with the agents installed on this machine (`auto`, the default), then prove it by completing a real MCP handshake against the registered command |
207
293
  | `codeintel setup [project_root] [--all] [--index] [--warm] [--install-uv] [--install-deps] [--json]` | Prepare backends + index this repo (`--all` = one command: do everything automatable, idempotent); ends with a health report + **Next:** steps |
208
294
  | `codeintel index [project_root]` | Index a project for semantic search |
209
295
  | `codeintel serve` | Start the MCP server (stdio transport) |
@@ -271,7 +357,7 @@ Register codeintel as an MCP server (`codeintel install`) and the agent gets fou
271
357
  | MCP tool | HTTP equivalent | Purpose |
272
358
  |---|---|---|
273
359
  | `code.query` | `POST /code/query` | The main call — search, trace, understand (the `op` table above) |
274
- | `code.status` | `GET /code/status` | Which engines are live + whether an index exists |
360
+ | `code.status` | `GET /code/status` | Per-engine `installed` / `runnable` / `repo_indexed`, probed against the live engines a query actually hits |
275
361
  | `code.doctor` | `POST /code/doctor` | Per-engine health + repo index status, with a fix for each gap |
276
362
  | `code.map` | — | Generate/refresh `CODE_INTEL.md`, a static orientation file for hosts without MCP |
277
363
 
@@ -328,5 +414,16 @@ docker build -t codeintel . && docker run -p 127.0.0.1:8766:8766 \
328
414
  git clone https://github.com/hamilton-sky/codeintel.git
329
415
  cd codeintel
330
416
  pip install -e .[dev]
331
- pytest tests/ -q # full suite (~15s — includes live graph/LSP backend tests)
417
+ pytest tests/ -q # ~410 tests, ~35s (live graph/LSP backend tests skip when absent)
332
418
  ```
419
+
420
+ **Release gate.** The unit suite runs against the source tree, so it cannot see a packaging break, a
421
+ missing entry point, a host config written where nobody reads it, or a server that boots and answers
422
+ nothing. Run the canary against the built wheel in a clean environment — the same check CI runs
423
+ before publishing:
424
+
425
+ ```bash
426
+ python -m build && python -m venv /tmp/canary && /tmp/canary/bin/python -m pip install dist/*.whl && /tmp/canary/bin/python scripts/release_canary.py
427
+ ```
428
+
429
+ It exits non-zero on the first failed check and cleans up the temporary `HOME` it installs into.
@@ -31,6 +31,7 @@ src/codeintel/searcher.py
31
31
  src/codeintel/semantic_db.py
32
32
  src/codeintel/server.py
33
33
  src/codeintel/term.py
34
+ src/codeintel/verify.py
34
35
  src/codeintel/providers/__init__.py
35
36
  src/codeintel/providers/graph.py
36
37
  src/codeintel/providers/lsp.py
@@ -40,9 +41,11 @@ src/codeintel/viewer/__init__.py
40
41
  src/codeintel/viewer/graph_template.html
41
42
  tests/test_cache.py
42
43
  tests/test_chunking.py
44
+ tests/test_cli_help.py
43
45
  tests/test_config.py
44
46
  tests/test_doctor.py
45
47
  tests/test_e2e.py
48
+ tests/test_engine_adoption.py
46
49
  tests/test_enterprise.py
47
50
  tests/test_gateway.py
48
51
  tests/test_graph_provider.py
@@ -57,6 +60,7 @@ tests/test_integration.py
57
60
  tests/test_lsp_provider.py
58
61
  tests/test_lsp_real.py
59
62
  tests/test_mapper.py
63
+ tests/test_mcp_handshake.py
60
64
  tests/test_mcp_server.py
61
65
  tests/test_model_dimension.py
62
66
  tests/test_never_raise.py
@@ -67,4 +71,6 @@ tests/test_rerank.py
67
71
  tests/test_reset.py
68
72
  tests/test_semantic_provider.py
69
73
  tests/test_term.py
70
- tests/test_treesitter.py
74
+ tests/test_treesitter.py
75
+ tests/test_verify.py
76
+ tests/test_verify_call.py
@@ -0,0 +1 @@
1
+ __version__ = "0.12.1"