codecompass-mcp 4.0.0__tar.gz → 5.0.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 (38) hide show
  1. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/PKG-INFO +19 -35
  2. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/README.md +18 -34
  3. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/codecompass_mcp.egg-info/PKG-INFO +19 -35
  4. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/codecompass_mcp.egg-info/SOURCES.txt +4 -3
  5. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/codecompass_mcp.egg-info/top_level.txt +1 -0
  6. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/graph/code_graph_client.py +1 -1
  7. codecompass_mcp-4.0.0/graph/code_query_cli.py → codecompass_mcp-5.0.0/graph/code_queries.py +3 -444
  8. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/ingestion/enricher.py +1 -0
  9. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/main.py +219 -144
  10. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/mcp_server.py +20 -9
  11. codecompass_mcp-5.0.0/pi_setup.py +161 -0
  12. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/pyproject.toml +2 -2
  13. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/tests/test_block_hook.py +14 -2
  14. codecompass_mcp-5.0.0/tests/test_enrich_preserve.py +137 -0
  15. codecompass_mcp-5.0.0/tests/test_init.py +46 -0
  16. codecompass_mcp-4.0.0/tests/test_batch_impact.py +0 -198
  17. codecompass_mcp-4.0.0/tests/test_blast_radius.py +0 -168
  18. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/LICENSE +0 -0
  19. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/codecompass_mcp.egg-info/dependency_links.txt +0 -0
  20. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/codecompass_mcp.egg-info/entry_points.txt +0 -0
  21. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/codecompass_mcp.egg-info/requires.txt +0 -0
  22. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/config.py +0 -0
  23. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/graph/__init__.py +0 -0
  24. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/ingestion/__init__.py +0 -0
  25. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/ingestion/code_normalizer.py +0 -0
  26. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/ingestion/code_parser.py +0 -0
  27. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/ingestion/file_watcher.py +0 -0
  28. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/ingestion/hierarchy_builder.py +0 -0
  29. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/ingestion/source_context.py +0 -0
  30. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/models/__init__.py +0 -0
  31. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/models/code_types.py +0 -0
  32. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/setup.cfg +0 -0
  33. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/tests/test_accuracy_fixes.py +0 -0
  34. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/tests/test_code_parser.py +0 -0
  35. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/tests/test_enricher.py +0 -0
  36. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/tests/test_lit_css_parser.py +0 -0
  37. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/tests/test_mcp_server.py +0 -0
  38. {codecompass_mcp-4.0.0 → codecompass_mcp-5.0.0}/tests/test_php_parser.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecompass-mcp
3
- Version: 4.0.0
3
+ Version: 5.0.0
4
4
  Summary: Structural code context for AI coding agents — a local code knowledge graph for blast radius, impact, deps, dead code, and flow tracing
5
5
  Author: CodeCompass contributors
6
6
  License: MIT
@@ -111,13 +111,10 @@ Gives you the `codecompass` CLI and the `codecompass-mcp` MCP server.
111
111
 
112
112
  ### Index a project
113
113
 
114
- ```bash
115
- cd /path/to/your/project
116
- codecompass init # creates .codecompass/, writes AGENTS.md
117
- codecompass ingest-code # parses source and builds the graph
118
- ```
119
-
120
- `ingest-code` runs `init` automatically if needed. Re-ingest after refactors (or run `codecompass watch` to keep the graph live).
114
+ Indexing is an MCP operation, not a CLI one. Start the server in your project
115
+ (`codecompass mcp` — it auto-runs `init` on first use) and the agent calls the
116
+ `ingest` tool to build the graph. Re-`ingest` after refactors, or run
117
+ `codecompass watch` to keep the graph live.
121
118
 
122
119
  ### Connect an MCP client
123
120
 
@@ -133,34 +130,20 @@ The server speaks stdio MCP and defaults to the working directory.
133
130
 
134
131
  ---
135
132
 
136
- ## Queries (CLI)
137
-
138
- ```bash
139
- # discover
140
- codecompass query --grep "^get_" # regex over graph entities
141
-
142
- # trace
143
- codecompass query --impact "Session.send" # callers (disambiguated), with file:line
144
- codecompass query --blast-radius src/app.py # what depends on this file
145
- codecompass query --deps src/api/routes.py # what this file imports
146
- codecompass query --flow "Session.request" # lean call-flow structure
147
- codecompass query --flow-summary "main" # flow + mermaid + narration
148
- codecompass query --dead-code # unreferenced candidates
149
- codecompass query --tree # full hierarchy
150
- ```
133
+ ## Queries
151
134
 
152
- Add `--hops N` for traversal depth (start at 1 and follow the one path you need). Add `--rich` for tables.
135
+ Agents query the graph through the MCP tools (see the table below) there is
136
+ no agent-facing query CLI. `grep`, `impact`, `blast_radius`, `deps`, `flow`,
137
+ `flow_summary`, `dead_code`, `tree` and friends are all MCP tools; pass
138
+ `hops` for traversal depth (start at 1 and follow the one path you need).
153
139
 
154
140
  ### Enrichment (agent-in-the-loop)
155
141
 
156
- ```bash
157
- codecompass enrich # stage entities for an agent swarm: one-line descriptions + missing call edges
158
- codecompass enrich --apply # merge the swarm's results into the graph
159
- codecompass add-entity <name> --file src/a.py --line 9 --description "Async helper"
160
- codecompass add-call caller callee --line 2
161
- ```
142
+ Via the MCP tools: `enrich` stages entities for an agent swarm (one-line
143
+ descriptions + missing call edges), `enrich(apply=True)` merges the swarm's
144
+ results, and `add_entity` / `add_call` record single parser-missed entries.
162
145
 
163
- `enrich` is a bulk, user-triggered pass. `add-entity`/`add-call` are the
146
+ `enrich` is a bulk, user-triggered pass. `add_entity`/`add_call` are the
164
147
  opportunistic version: as an agent reads code and spots something the parser
165
148
  missed, it records it immediately. Everything agent-written is marked
166
149
  `agent_inferred` and **preserved across re-ingests** — the graph gets better
@@ -169,7 +152,7 @@ with use. Ambiguous call targets are skipped, never guessed.
169
152
  ### Flow: `flow` vs `flow-summary`
170
153
 
171
154
  - **`flow`** — lean structure only (node name/kind/file/depth, edge from/to/order/line). What an agent needs to navigate; no embedded source.
172
- - **`flow-summary`** — the trace rendered for a human: a mermaid flowchart with prose narration (`--format mermaid`, default), or source-embedded JSON (`--format json`), or a draw.io diagram (`--format drawio`). Written to `.codecompass/flow_<entry>.*`.
155
+ - **`flow_summary`** — the trace rendered for a human: a mermaid flowchart with prose narration (`format="mermaid"`, default), or source-embedded JSON (`format="json"`), or a draw.io diagram (`format="drawio"`).
173
156
 
174
157
  ---
175
158
 
@@ -225,7 +208,7 @@ registered repo pass through: no graph exists there, so nothing is blocked.
225
208
  point is to change the default reflex to graph-first, not to remove reads.
226
209
  Each project's Claude hook lives under its own `.claude/hooks/` with the
227
210
  project root baked in — edit or delete it to adjust. Block messages point the
228
- agent at the right repo's graph: `codecompass query \"<repo>\" --grep …`.
211
+ agent at the codecompass MCP tools (`grep`, `flow`, `impact`, `deps`, …).
229
212
 
230
213
  ---
231
214
 
@@ -237,8 +220,9 @@ Source files
237
220
  ▼ code_parser tree-sitter extraction (no API calls) → typed CodeTriples
238
221
  ▼ graph.json NetworkX MultiDiGraph as JSON; file+class-qualified nodes,
239
222
  typed edges (CALLS/IMPORTS/INHERITS/STYLES/…), resolved calls
240
- code_query_cli traversal: grep / impact / blast-radius /
241
- deps / flow / dead-code / tree
223
+ code_queries traversal helpers: grep / impact / blast_radius /
224
+ deps / flow / dead_code / tree
225
+ ▼ mcp_server FastMCP server — the only query surface for agents
242
226
  ▼ enricher agent-in-the-loop: enrich batches (descriptions +
243
227
  missing calls) and opportunistic add_entity/add_call
244
228
  writes — agent_inferred, preserved across re-ingest
@@ -75,13 +75,10 @@ Gives you the `codecompass` CLI and the `codecompass-mcp` MCP server.
75
75
 
76
76
  ### Index a project
77
77
 
78
- ```bash
79
- cd /path/to/your/project
80
- codecompass init # creates .codecompass/, writes AGENTS.md
81
- codecompass ingest-code # parses source and builds the graph
82
- ```
83
-
84
- `ingest-code` runs `init` automatically if needed. Re-ingest after refactors (or run `codecompass watch` to keep the graph live).
78
+ Indexing is an MCP operation, not a CLI one. Start the server in your project
79
+ (`codecompass mcp` — it auto-runs `init` on first use) and the agent calls the
80
+ `ingest` tool to build the graph. Re-`ingest` after refactors, or run
81
+ `codecompass watch` to keep the graph live.
85
82
 
86
83
  ### Connect an MCP client
87
84
 
@@ -97,34 +94,20 @@ The server speaks stdio MCP and defaults to the working directory.
97
94
 
98
95
  ---
99
96
 
100
- ## Queries (CLI)
101
-
102
- ```bash
103
- # discover
104
- codecompass query --grep "^get_" # regex over graph entities
105
-
106
- # trace
107
- codecompass query --impact "Session.send" # callers (disambiguated), with file:line
108
- codecompass query --blast-radius src/app.py # what depends on this file
109
- codecompass query --deps src/api/routes.py # what this file imports
110
- codecompass query --flow "Session.request" # lean call-flow structure
111
- codecompass query --flow-summary "main" # flow + mermaid + narration
112
- codecompass query --dead-code # unreferenced candidates
113
- codecompass query --tree # full hierarchy
114
- ```
97
+ ## Queries
115
98
 
116
- Add `--hops N` for traversal depth (start at 1 and follow the one path you need). Add `--rich` for tables.
99
+ Agents query the graph through the MCP tools (see the table below) there is
100
+ no agent-facing query CLI. `grep`, `impact`, `blast_radius`, `deps`, `flow`,
101
+ `flow_summary`, `dead_code`, `tree` and friends are all MCP tools; pass
102
+ `hops` for traversal depth (start at 1 and follow the one path you need).
117
103
 
118
104
  ### Enrichment (agent-in-the-loop)
119
105
 
120
- ```bash
121
- codecompass enrich # stage entities for an agent swarm: one-line descriptions + missing call edges
122
- codecompass enrich --apply # merge the swarm's results into the graph
123
- codecompass add-entity <name> --file src/a.py --line 9 --description "Async helper"
124
- codecompass add-call caller callee --line 2
125
- ```
106
+ Via the MCP tools: `enrich` stages entities for an agent swarm (one-line
107
+ descriptions + missing call edges), `enrich(apply=True)` merges the swarm's
108
+ results, and `add_entity` / `add_call` record single parser-missed entries.
126
109
 
127
- `enrich` is a bulk, user-triggered pass. `add-entity`/`add-call` are the
110
+ `enrich` is a bulk, user-triggered pass. `add_entity`/`add_call` are the
128
111
  opportunistic version: as an agent reads code and spots something the parser
129
112
  missed, it records it immediately. Everything agent-written is marked
130
113
  `agent_inferred` and **preserved across re-ingests** — the graph gets better
@@ -133,7 +116,7 @@ with use. Ambiguous call targets are skipped, never guessed.
133
116
  ### Flow: `flow` vs `flow-summary`
134
117
 
135
118
  - **`flow`** — lean structure only (node name/kind/file/depth, edge from/to/order/line). What an agent needs to navigate; no embedded source.
136
- - **`flow-summary`** — the trace rendered for a human: a mermaid flowchart with prose narration (`--format mermaid`, default), or source-embedded JSON (`--format json`), or a draw.io diagram (`--format drawio`). Written to `.codecompass/flow_<entry>.*`.
119
+ - **`flow_summary`** — the trace rendered for a human: a mermaid flowchart with prose narration (`format="mermaid"`, default), or source-embedded JSON (`format="json"`), or a draw.io diagram (`format="drawio"`).
137
120
 
138
121
  ---
139
122
 
@@ -189,7 +172,7 @@ registered repo pass through: no graph exists there, so nothing is blocked.
189
172
  point is to change the default reflex to graph-first, not to remove reads.
190
173
  Each project's Claude hook lives under its own `.claude/hooks/` with the
191
174
  project root baked in — edit or delete it to adjust. Block messages point the
192
- agent at the right repo's graph: `codecompass query \"<repo>\" --grep …`.
175
+ agent at the codecompass MCP tools (`grep`, `flow`, `impact`, `deps`, …).
193
176
 
194
177
  ---
195
178
 
@@ -201,8 +184,9 @@ Source files
201
184
  ▼ code_parser tree-sitter extraction (no API calls) → typed CodeTriples
202
185
  ▼ graph.json NetworkX MultiDiGraph as JSON; file+class-qualified nodes,
203
186
  typed edges (CALLS/IMPORTS/INHERITS/STYLES/…), resolved calls
204
- code_query_cli traversal: grep / impact / blast-radius /
205
- deps / flow / dead-code / tree
187
+ code_queries traversal helpers: grep / impact / blast_radius /
188
+ deps / flow / dead_code / tree
189
+ ▼ mcp_server FastMCP server — the only query surface for agents
206
190
  ▼ enricher agent-in-the-loop: enrich batches (descriptions +
207
191
  missing calls) and opportunistic add_entity/add_call
208
192
  writes — agent_inferred, preserved across re-ingest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecompass-mcp
3
- Version: 4.0.0
3
+ Version: 5.0.0
4
4
  Summary: Structural code context for AI coding agents — a local code knowledge graph for blast radius, impact, deps, dead code, and flow tracing
5
5
  Author: CodeCompass contributors
6
6
  License: MIT
@@ -111,13 +111,10 @@ Gives you the `codecompass` CLI and the `codecompass-mcp` MCP server.
111
111
 
112
112
  ### Index a project
113
113
 
114
- ```bash
115
- cd /path/to/your/project
116
- codecompass init # creates .codecompass/, writes AGENTS.md
117
- codecompass ingest-code # parses source and builds the graph
118
- ```
119
-
120
- `ingest-code` runs `init` automatically if needed. Re-ingest after refactors (or run `codecompass watch` to keep the graph live).
114
+ Indexing is an MCP operation, not a CLI one. Start the server in your project
115
+ (`codecompass mcp` — it auto-runs `init` on first use) and the agent calls the
116
+ `ingest` tool to build the graph. Re-`ingest` after refactors, or run
117
+ `codecompass watch` to keep the graph live.
121
118
 
122
119
  ### Connect an MCP client
123
120
 
@@ -133,34 +130,20 @@ The server speaks stdio MCP and defaults to the working directory.
133
130
 
134
131
  ---
135
132
 
136
- ## Queries (CLI)
137
-
138
- ```bash
139
- # discover
140
- codecompass query --grep "^get_" # regex over graph entities
141
-
142
- # trace
143
- codecompass query --impact "Session.send" # callers (disambiguated), with file:line
144
- codecompass query --blast-radius src/app.py # what depends on this file
145
- codecompass query --deps src/api/routes.py # what this file imports
146
- codecompass query --flow "Session.request" # lean call-flow structure
147
- codecompass query --flow-summary "main" # flow + mermaid + narration
148
- codecompass query --dead-code # unreferenced candidates
149
- codecompass query --tree # full hierarchy
150
- ```
133
+ ## Queries
151
134
 
152
- Add `--hops N` for traversal depth (start at 1 and follow the one path you need). Add `--rich` for tables.
135
+ Agents query the graph through the MCP tools (see the table below) there is
136
+ no agent-facing query CLI. `grep`, `impact`, `blast_radius`, `deps`, `flow`,
137
+ `flow_summary`, `dead_code`, `tree` and friends are all MCP tools; pass
138
+ `hops` for traversal depth (start at 1 and follow the one path you need).
153
139
 
154
140
  ### Enrichment (agent-in-the-loop)
155
141
 
156
- ```bash
157
- codecompass enrich # stage entities for an agent swarm: one-line descriptions + missing call edges
158
- codecompass enrich --apply # merge the swarm's results into the graph
159
- codecompass add-entity <name> --file src/a.py --line 9 --description "Async helper"
160
- codecompass add-call caller callee --line 2
161
- ```
142
+ Via the MCP tools: `enrich` stages entities for an agent swarm (one-line
143
+ descriptions + missing call edges), `enrich(apply=True)` merges the swarm's
144
+ results, and `add_entity` / `add_call` record single parser-missed entries.
162
145
 
163
- `enrich` is a bulk, user-triggered pass. `add-entity`/`add-call` are the
146
+ `enrich` is a bulk, user-triggered pass. `add_entity`/`add_call` are the
164
147
  opportunistic version: as an agent reads code and spots something the parser
165
148
  missed, it records it immediately. Everything agent-written is marked
166
149
  `agent_inferred` and **preserved across re-ingests** — the graph gets better
@@ -169,7 +152,7 @@ with use. Ambiguous call targets are skipped, never guessed.
169
152
  ### Flow: `flow` vs `flow-summary`
170
153
 
171
154
  - **`flow`** — lean structure only (node name/kind/file/depth, edge from/to/order/line). What an agent needs to navigate; no embedded source.
172
- - **`flow-summary`** — the trace rendered for a human: a mermaid flowchart with prose narration (`--format mermaid`, default), or source-embedded JSON (`--format json`), or a draw.io diagram (`--format drawio`). Written to `.codecompass/flow_<entry>.*`.
155
+ - **`flow_summary`** — the trace rendered for a human: a mermaid flowchart with prose narration (`format="mermaid"`, default), or source-embedded JSON (`format="json"`), or a draw.io diagram (`format="drawio"`).
173
156
 
174
157
  ---
175
158
 
@@ -225,7 +208,7 @@ registered repo pass through: no graph exists there, so nothing is blocked.
225
208
  point is to change the default reflex to graph-first, not to remove reads.
226
209
  Each project's Claude hook lives under its own `.claude/hooks/` with the
227
210
  project root baked in — edit or delete it to adjust. Block messages point the
228
- agent at the right repo's graph: `codecompass query \"<repo>\" --grep …`.
211
+ agent at the codecompass MCP tools (`grep`, `flow`, `impact`, `deps`, …).
229
212
 
230
213
  ---
231
214
 
@@ -237,8 +220,9 @@ Source files
237
220
  ▼ code_parser tree-sitter extraction (no API calls) → typed CodeTriples
238
221
  ▼ graph.json NetworkX MultiDiGraph as JSON; file+class-qualified nodes,
239
222
  typed edges (CALLS/IMPORTS/INHERITS/STYLES/…), resolved calls
240
- code_query_cli traversal: grep / impact / blast-radius /
241
- deps / flow / dead-code / tree
223
+ code_queries traversal helpers: grep / impact / blast_radius /
224
+ deps / flow / dead_code / tree
225
+ ▼ mcp_server FastMCP server — the only query surface for agents
242
226
  ▼ enricher agent-in-the-loop: enrich batches (descriptions +
243
227
  missing calls) and opportunistic add_entity/add_call
244
228
  writes — agent_inferred, preserved across re-ingest
@@ -3,6 +3,7 @@ README.md
3
3
  config.py
4
4
  main.py
5
5
  mcp_server.py
6
+ pi_setup.py
6
7
  pyproject.toml
7
8
  codecompass_mcp.egg-info/PKG-INFO
8
9
  codecompass_mcp.egg-info/SOURCES.txt
@@ -12,7 +13,7 @@ codecompass_mcp.egg-info/requires.txt
12
13
  codecompass_mcp.egg-info/top_level.txt
13
14
  graph/__init__.py
14
15
  graph/code_graph_client.py
15
- graph/code_query_cli.py
16
+ graph/code_queries.py
16
17
  ingestion/__init__.py
17
18
  ingestion/code_normalizer.py
18
19
  ingestion/code_parser.py
@@ -23,11 +24,11 @@ ingestion/source_context.py
23
24
  models/__init__.py
24
25
  models/code_types.py
25
26
  tests/test_accuracy_fixes.py
26
- tests/test_batch_impact.py
27
- tests/test_blast_radius.py
28
27
  tests/test_block_hook.py
29
28
  tests/test_code_parser.py
29
+ tests/test_enrich_preserve.py
30
30
  tests/test_enricher.py
31
+ tests/test_init.py
31
32
  tests/test_lit_css_parser.py
32
33
  tests/test_mcp_server.py
33
34
  tests/test_php_parser.py
@@ -4,3 +4,4 @@ ingestion
4
4
  main
5
5
  mcp_server
6
6
  models
7
+ pi_setup
@@ -377,7 +377,7 @@ class LocalGraphClient:
377
377
  self.save()
378
378
 
379
379
  # ------------------------------------------------------------------
380
- # Traversal queries used by code_query_cli
380
+ # Traversal queries used by graph/code_queries.py
381
381
  # ------------------------------------------------------------------
382
382
 
383
383
  def _resolve_query_nodes(self, entity_name: str, project: str) -> list[str]: