codegraph-engine 2.1.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.
- codegraph_engine-2.1.1/LICENSE +21 -0
- codegraph_engine-2.1.1/PKG-INFO +334 -0
- codegraph_engine-2.1.1/README.md +314 -0
- codegraph_engine-2.1.1/pyproject.toml +45 -0
- codegraph_engine-2.1.1/setup.cfg +4 -0
- codegraph_engine-2.1.1/src/codegraph/__init__.py +37 -0
- codegraph_engine-2.1.1/src/codegraph/agent.py +26 -0
- codegraph_engine-2.1.1/src/codegraph/architecture.py +328 -0
- codegraph_engine-2.1.1/src/codegraph/audit.py +106 -0
- codegraph_engine-2.1.1/src/codegraph/cache.py +95 -0
- codegraph_engine-2.1.1/src/codegraph/cli.py +854 -0
- codegraph_engine-2.1.1/src/codegraph/config.py +43 -0
- codegraph_engine-2.1.1/src/codegraph/constraints.py +238 -0
- codegraph_engine-2.1.1/src/codegraph/context.py +1228 -0
- codegraph_engine-2.1.1/src/codegraph/epistemic.py +90 -0
- codegraph_engine-2.1.1/src/codegraph/errors.py +275 -0
- codegraph_engine-2.1.1/src/codegraph/evidence/__init__.py +15 -0
- codegraph_engine-2.1.1/src/codegraph/evidence/citations.py +397 -0
- codegraph_engine-2.1.1/src/codegraph/frameworks.py +434 -0
- codegraph_engine-2.1.1/src/codegraph/freshness.py +295 -0
- codegraph_engine-2.1.1/src/codegraph/git.py +278 -0
- codegraph_engine-2.1.1/src/codegraph/graph/__init__.py +46 -0
- codegraph_engine-2.1.1/src/codegraph/graph/models.py +41 -0
- codegraph_engine-2.1.1/src/codegraph/graph/traversal.py +1291 -0
- codegraph_engine-2.1.1/src/codegraph/indexing/__init__.py +4 -0
- codegraph_engine-2.1.1/src/codegraph/indexing/classifier.py +274 -0
- codegraph_engine-2.1.1/src/codegraph/indexing/indexer.py +943 -0
- codegraph_engine-2.1.1/src/codegraph/indexing/models.py +338 -0
- codegraph_engine-2.1.1/src/codegraph/indexing/parser.py +1240 -0
- codegraph_engine-2.1.1/src/codegraph/indexing/scanner.py +200 -0
- codegraph_engine-2.1.1/src/codegraph/indexing/test_framework.py +116 -0
- codegraph_engine-2.1.1/src/codegraph/interrogation.py +1582 -0
- codegraph_engine-2.1.1/src/codegraph/llm/__init__.py +3 -0
- codegraph_engine-2.1.1/src/codegraph/llm/base.py +15 -0
- codegraph_engine-2.1.1/src/codegraph/llm/context.py +20 -0
- codegraph_engine-2.1.1/src/codegraph/mcp/__init__.py +3 -0
- codegraph_engine-2.1.1/src/codegraph/mcp/server.py +736 -0
- codegraph_engine-2.1.1/src/codegraph/memory/__init__.py +3 -0
- codegraph_engine-2.1.1/src/codegraph/memory/store.py +46 -0
- codegraph_engine-2.1.1/src/codegraph/models.py +289 -0
- codegraph_engine-2.1.1/src/codegraph/observability.py +151 -0
- codegraph_engine-2.1.1/src/codegraph/optimizer.py +372 -0
- codegraph_engine-2.1.1/src/codegraph/planner.py +417 -0
- codegraph_engine-2.1.1/src/codegraph/py.typed +1 -0
- codegraph_engine-2.1.1/src/codegraph/query_expansion.py +199 -0
- codegraph_engine-2.1.1/src/codegraph/ranking.py +363 -0
- codegraph_engine-2.1.1/src/codegraph/resolver.py +843 -0
- codegraph_engine-2.1.1/src/codegraph/resources/__init__.py +45 -0
- codegraph_engine-2.1.1/src/codegraph/resources/cache.py +117 -0
- codegraph_engine-2.1.1/src/codegraph/resources/coalescer.py +83 -0
- codegraph_engine-2.1.1/src/codegraph/resources/debouncer.py +98 -0
- codegraph_engine-2.1.1/src/codegraph/resources/governor.py +232 -0
- codegraph_engine-2.1.1/src/codegraph/resources/policy.py +123 -0
- codegraph_engine-2.1.1/src/codegraph/retrieval_policy.py +220 -0
- codegraph_engine-2.1.1/src/codegraph/search/__init__.py +23 -0
- codegraph_engine-2.1.1/src/codegraph/search/hybrid.py +301 -0
- codegraph_engine-2.1.1/src/codegraph/search/semantic.py +28 -0
- codegraph_engine-2.1.1/src/codegraph/security/__init__.py +3 -0
- codegraph_engine-2.1.1/src/codegraph/security/paths.py +35 -0
- codegraph_engine-2.1.1/src/codegraph/target_resolver.py +348 -0
- codegraph_engine-2.1.1/src/codegraph/task.py +637 -0
- codegraph_engine-2.1.1/src/codegraph_engine.egg-info/PKG-INFO +334 -0
- codegraph_engine-2.1.1/src/codegraph_engine.egg-info/SOURCES.txt +110 -0
- codegraph_engine-2.1.1/src/codegraph_engine.egg-info/dependency_links.txt +1 -0
- codegraph_engine-2.1.1/src/codegraph_engine.egg-info/entry_points.txt +2 -0
- codegraph_engine-2.1.1/src/codegraph_engine.egg-info/requires.txt +11 -0
- codegraph_engine-2.1.1/src/codegraph_engine.egg-info/top_level.txt +1 -0
- codegraph_engine-2.1.1/tests/test_active_coding_protection.py +49 -0
- codegraph_engine-2.1.1/tests/test_adaptive_planning.py +152 -0
- codegraph_engine-2.1.1/tests/test_adversarial_edge_cases.py +128 -0
- codegraph_engine-2.1.1/tests/test_agent_ux_hardening.py +457 -0
- codegraph_engine-2.1.1/tests/test_benchmark_infra.py +114 -0
- codegraph_engine-2.1.1/tests/test_bounded_caches.py +45 -0
- codegraph_engine-2.1.1/tests/test_cli_doctor_privacy.py +73 -0
- codegraph_engine-2.1.1/tests/test_context_budget.py +99 -0
- codegraph_engine-2.1.1/tests/test_context_cache.py +73 -0
- codegraph_engine-2.1.1/tests/test_context_compiler_v2.py +142 -0
- codegraph_engine-2.1.1/tests/test_core.py +59 -0
- codegraph_engine-2.1.1/tests/test_database_integrity.py +87 -0
- codegraph_engine-2.1.1/tests/test_debouncer.py +38 -0
- codegraph_engine-2.1.1/tests/test_determinism_and_soak.py +62 -0
- codegraph_engine-2.1.1/tests/test_developer_audit.py +98 -0
- codegraph_engine-2.1.1/tests/test_evaluation_framework.py +326 -0
- codegraph_engine-2.1.1/tests/test_framework_analyzers.py +163 -0
- codegraph_engine-2.1.1/tests/test_git_intelligence.py +118 -0
- codegraph_engine-2.1.1/tests/test_hardening.py +160 -0
- codegraph_engine-2.1.1/tests/test_interrogation_contracts.py +438 -0
- codegraph_engine-2.1.1/tests/test_latency_modes_and_parallel.py +119 -0
- codegraph_engine-2.1.1/tests/test_mcp_integration.py +79 -0
- codegraph_engine-2.1.1/tests/test_phase2.py +863 -0
- codegraph_engine-2.1.1/tests/test_ranking_engine.py +70 -0
- codegraph_engine-2.1.1/tests/test_reference_resolution.py +114 -0
- codegraph_engine-2.1.1/tests/test_request_coalescer.py +45 -0
- codegraph_engine-2.1.1/tests/test_resource_governor.py +73 -0
- codegraph_engine-2.1.1/tests/test_retrieval_planner.py +132 -0
- codegraph_engine-2.1.1/tests/test_scanner_security.py +106 -0
- codegraph_engine-2.1.1/tests/test_single_pass_parser.py +102 -0
- codegraph_engine-2.1.1/tests/test_symbol_identity.py +83 -0
- codegraph_engine-2.1.1/tests/test_task_ambiguity.py +126 -0
- codegraph_engine-2.1.1/tests/test_task_mcp_tools.py +86 -0
- codegraph_engine-2.1.1/tests/test_task_normalization.py +77 -0
- codegraph_engine-2.1.1/tests/test_task_spec.py +97 -0
- codegraph_engine-2.1.1/tests/test_v211_factory_resolution.py +102 -0
- codegraph_engine-2.1.1/tests/test_v211_features.py +452 -0
- codegraph_engine-2.1.1/tests/test_v211_imports_dependents_cli.py +67 -0
- codegraph_engine-2.1.1/tests/test_v211_recursive_frameworks.py +62 -0
- codegraph_engine-2.1.1/tests/test_v21_diagnostics.py +249 -0
- codegraph_engine-2.1.1/tests/test_v21_hard_exclusions.py +135 -0
- codegraph_engine-2.1.1/tests/test_v21_query_expansion.py +149 -0
- codegraph_engine-2.1.1/tests/test_v21_retrieval_policy.py +134 -0
- codegraph_engine-2.1.1/tests/test_v21_target_resolver.py +162 -0
- codegraph_engine-2.1.1/tests/test_verify_evidence.py +143 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CodeGraph contributors
|
|
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,334 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codegraph-engine
|
|
3
|
+
Version: 2.1.1
|
|
4
|
+
Summary: Evidence-backed local codebase intelligence for MCP clients
|
|
5
|
+
Author: CodeGraph contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pydantic>=2.7
|
|
11
|
+
Requires-Dist: typer>=0.12
|
|
12
|
+
Provides-Extra: mcp
|
|
13
|
+
Requires-Dist: mcp<2,>=1.0; extra == "mcp"
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
18
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# CodeGraph MCP
|
|
22
|
+
|
|
23
|
+
> **The AI understands the developer. CodeGraph interrogates the repository.**
|
|
24
|
+
> **The claim comes from the AI; the proof comes from CodeGraph.**
|
|
25
|
+
|
|
26
|
+
CodeGraph MCP is an open-source, deterministic codebase intelligence server built on the Model Context Protocol (MCP). It is not a conversational AI, a natural-language interpreter, a vector database, or an autonomous agent.
|
|
27
|
+
|
|
28
|
+
Antigravity and your AI agents handle natural-language reasoning, intent interpretation, and answer synthesis. CodeGraph interrogates the local repository to deliver deterministic, evidence-backed AST facts, call and import graphs, verified line citations, architecture structure, and Git impact.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Architectural Separation of Responsibilities
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
USER
|
|
36
|
+
│
|
|
37
|
+
│ natural-language request ("how does authetication wrks in my app?")
|
|
38
|
+
▼
|
|
39
|
+
ANTIGRAVITY / AI
|
|
40
|
+
│
|
|
41
|
+
├── understands intent and context
|
|
42
|
+
├── corrects spelling and informal language
|
|
43
|
+
├── identifies candidate code targets
|
|
44
|
+
├── resolves conceptual ambiguity
|
|
45
|
+
├── decomposes complex queries into precise tool invocations
|
|
46
|
+
└── decides which MCP tools to call
|
|
47
|
+
│
|
|
48
|
+
│ precise, deterministic MCP request (e.g., list_routes(), resolve_symbol("authenticate"))
|
|
49
|
+
▼
|
|
50
|
+
CODEGRAPH MCP
|
|
51
|
+
│
|
|
52
|
+
├── deterministic repository retrieval
|
|
53
|
+
├── exact symbol and canonical ID resolution
|
|
54
|
+
├── graph traversal and path tracing
|
|
55
|
+
├── caller and callee analysis
|
|
56
|
+
├── route and framework discovery
|
|
57
|
+
├── architecture and dependency extraction
|
|
58
|
+
├── Git diff and blast-radius impact analysis
|
|
59
|
+
└── first-class evidence generation
|
|
60
|
+
│
|
|
61
|
+
▼
|
|
62
|
+
STRUCTURED EVIDENCE
|
|
63
|
+
│
|
|
64
|
+
├── canonical IDs (path::Symbol.method)
|
|
65
|
+
├── file paths and exact line ranges
|
|
66
|
+
├── verified relationship edges (CALLS, IMPORTS, HANDLED_BY)
|
|
67
|
+
├── index generation and freshness state
|
|
68
|
+
└── repository commit hash
|
|
69
|
+
│
|
|
70
|
+
▼
|
|
71
|
+
ANTIGRAVITY / AI
|
|
72
|
+
│
|
|
73
|
+
└── synthesizes the final human-readable answer with verified source citations
|
|
74
|
+
▼
|
|
75
|
+
USER
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Core Invariants
|
|
81
|
+
|
|
82
|
+
1. **Deterministic Execution**:
|
|
83
|
+
$$\text{Repository State} + \text{Index Generation} + \text{MCP Request} \Longrightarrow \text{Identical Deterministic Result}$$
|
|
84
|
+
Collections are deterministically sorted; results never change between identical invocations.
|
|
85
|
+
2. **Zero Natural-Language Guessing**: CodeGraph never guesses developer intent or infers vague concepts. If a symbol name is ambiguous across files, CodeGraph returns `status: "ambiguous"` with candidate canonical IDs for the AI to choose.
|
|
86
|
+
3. **No Hallucinations / UNKNOWN Handling**: Facts are backed by AST analysis and verified references. If a target does not exist or cannot be proven statically, CodeGraph reports `status: "not_found"` or `UNKNOWN`.
|
|
87
|
+
4. **Structured Evidence**: Every claim or relation is tied to `{ file, start_line, end_line, type, canonical_id }`.
|
|
88
|
+
5. **Completely Local & Resource-Bounded**: Zero LLM API calls, zero external vector databases, zero telemetry. Execution runs inside a strict resource governor with thread and memory bounds.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Minimal Orthogonal 13-Tool MCP API
|
|
93
|
+
|
|
94
|
+
CodeGraph MCP exposes 13 core interrogation tools under `profile="core"`. Every tool returns structured data, an explicit `status` code (`"ok"`, `"not_found"`, `"ambiguous"`, `"invalid_request"`), index metadata, and verified evidence.
|
|
95
|
+
|
|
96
|
+
| Tool | Purpose | Key Inputs | Key Output Fields |
|
|
97
|
+
| :--- | :--- | :--- | :--- |
|
|
98
|
+
| `resolve_symbol` | Ground an exact or qualified symbol name | `name: str` | `status`, `symbol` (canonical ID, file, line), `candidates` (if ambiguous) |
|
|
99
|
+
| `search_symbols` | Deterministic token search over non-generated symbols | `query: str`, `top_k: int` | `status`, `results` (canonical ID, kind, score), `count` |
|
|
100
|
+
| `get_symbol` | Retrieve authoritative AST details for a canonical symbol | `canonical_id: str` | `status`, `symbol` (kind, signature, docstring, lines, decorators, parent, children) |
|
|
101
|
+
| `get_file` | Structural AST representation of an indexed file | `path: str`, `include_content: bool` | `status`, `file`, `hash`, `size`, `classes`, `functions`, `imports`, `routes` |
|
|
102
|
+
| `get_references` | Return verified call sites and references | `canonical_id: str` | `status`, `references` (file, start_line, end_line, type) |
|
|
103
|
+
| `get_callers` | Return functions and methods that call the target | `canonical_id: str` | `status`, `callers` (caller canonical ID, file, line, call site) |
|
|
104
|
+
| `get_callees` | Return functions and methods called by the target | `canonical_id: str` | `status`, `callees` (resolved, unresolved, and external calls) |
|
|
105
|
+
| `trace_path` | Deterministic BFS execution path between two symbols | `source_symbol: str`, `target_symbol: str`, `max_depth: int` | `status`, `path` (steps with from/to symbols, relationship, evidence), `reachable` |
|
|
106
|
+
| `get_imports` | Return imports for a file or canonical symbol | `file: str \| None`, `canonical_id: str \| None` | `status`, `imports` (module, imported_name, alias, line, evidence) |
|
|
107
|
+
| `get_dependents` | Reverse dependency query (files/symbols depending on target) | `canonical_id: str \| None`, `file: str \| None` | `status`, `dependents` (source, relationship, evidence) |
|
|
108
|
+
| `list_routes` | Discovered framework routes (FastAPI, Flask, Django, Express) | `framework: str \| None`, `method: str \| None`, `path: str \| None` | `status`, `routes` (method, route_path, framework, handler_name, canonical_id) |
|
|
109
|
+
| `get_architecture` | High-level repository structural overview | _none_ | `status`, `languages`, `directories`, `entrypoints`, `routes`, `dependencies` |
|
|
110
|
+
| `get_git_impact` | Git diff blast-radius impact analysis | `base: str`, `head: str` | `status`, `changed_files`, `modified_symbols`, `affected_callers`, `affected_callees`, `affected_routes` |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Response Envelope & Evidence Format
|
|
115
|
+
|
|
116
|
+
Every response adheres to a predictable structure:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"status": "ok",
|
|
121
|
+
"symbol": {
|
|
122
|
+
"canonical_id": "src/auth/service.py::AuthService.authenticate",
|
|
123
|
+
"name": "authenticate",
|
|
124
|
+
"kind": "METHOD",
|
|
125
|
+
"file": "src/auth/service.py",
|
|
126
|
+
"start_line": 42,
|
|
127
|
+
"end_line": 68
|
|
128
|
+
},
|
|
129
|
+
"evidence": [
|
|
130
|
+
{
|
|
131
|
+
"file": "src/auth/service.py",
|
|
132
|
+
"start_line": 42,
|
|
133
|
+
"end_line": 68,
|
|
134
|
+
"type": "DEFINES",
|
|
135
|
+
"canonical_id": "src/auth/service.py::AuthService.authenticate"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"index": {
|
|
139
|
+
"generation": 1,
|
|
140
|
+
"created_at": "2026-10-01T12:00:00Z",
|
|
141
|
+
"freshness": "FRESH"
|
|
142
|
+
},
|
|
143
|
+
"repository": {
|
|
144
|
+
"commit": "a1b2c3d"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Ambiguous Resolution Example
|
|
150
|
+
|
|
151
|
+
When a query matches multiple symbols across different modules, CodeGraph will never guess:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"status": "ambiguous",
|
|
156
|
+
"symbol": null,
|
|
157
|
+
"candidates": [
|
|
158
|
+
{
|
|
159
|
+
"canonical_id": "src/admin/views.py::duplicate_helper",
|
|
160
|
+
"file": "src/admin/views.py",
|
|
161
|
+
"line": 15
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"canonical_id": "src/auth/views.py::duplicate_helper",
|
|
165
|
+
"file": "src/auth/views.py",
|
|
166
|
+
"line": 18
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"message": "Multiple symbols match 'duplicate_helper'. Provide a qualified name or canonical ID."
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## End-to-End Walkthrough
|
|
176
|
+
|
|
177
|
+
### 1. Developer asks:
|
|
178
|
+
> *"how does authetication wrks in my app?"*
|
|
179
|
+
|
|
180
|
+
### 2. Antigravity / AI decomposes the request:
|
|
181
|
+
- Recognizes query about authentication flows and routing.
|
|
182
|
+
- Calls `list_routes(path="auth")` to locate entrypoints.
|
|
183
|
+
- Calls `resolve_symbol("authenticate")` to identify the service handler.
|
|
184
|
+
- Calls `trace_path(source_symbol="src/auth/views.py::login_view", target_symbol="src/auth/service.py::AuthService.authenticate")`.
|
|
185
|
+
- Calls `get_callees(canonical_id="src/auth/service.py::AuthService.authenticate")`.
|
|
186
|
+
|
|
187
|
+
### 3. CodeGraph interrogates the repository:
|
|
188
|
+
- Returns exact route definitions (`POST /api/v1/auth/login` handled by `src/auth/views.py::login_view`).
|
|
189
|
+
- Proves BFS execution path from `login_view` $\to$ `AuthService.authenticate` with line evidence.
|
|
190
|
+
- Lists callees (`verify_password`, `create_jwt_token`, `log_audit_event`) with file citations.
|
|
191
|
+
|
|
192
|
+
### 4. Antigravity / AI synthesizes the answer:
|
|
193
|
+
> "Authentication in your application begins at the `POST /api/v1/auth/login` endpoint handled by [`login_view`](file:///src/auth/views.py#L25). It invokes [`AuthService.authenticate`](file:///src/auth/service.py#L42), which validates credentials via [`verify_password`](file:///src/auth/crypto.py#L12) and generates a JWT token via [`create_jwt_token`](file:///src/auth/token.py#L55)."
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Installation & Usage
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
pip install 'codegraph-engine[mcp]'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Configure in MCP Client (Claude Desktop, Cursor, Gemini)
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"mcpServers": {
|
|
208
|
+
"codegraph": {
|
|
209
|
+
"command": "codegraph",
|
|
210
|
+
"args": ["serve", "-r", "/path/to/your/repo", "--profile", "core"]
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### CLI Inspection
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Index repository
|
|
220
|
+
codegraph index ./my-repo
|
|
221
|
+
|
|
222
|
+
# Search symbols
|
|
223
|
+
codegraph search "authenticate" -r ./my-repo
|
|
224
|
+
|
|
225
|
+
# Trace execution path
|
|
226
|
+
codegraph trace "login_view" -r ./my-repo
|
|
227
|
+
|
|
228
|
+
# Benchmark verification
|
|
229
|
+
codegraph benchmark -r ./my-repo
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## AI Agent Usage
|
|
235
|
+
|
|
236
|
+
AI agents querying CodeGraph MCP should follow this deterministic lifecycle:
|
|
237
|
+
|
|
238
|
+
1. **Initialize repository if required**: Execute `codegraph init` or verify index status.
|
|
239
|
+
2. **Check freshness**: Verify `index.freshness == "FRESH"`. If stale, execute `codegraph index`.
|
|
240
|
+
3. **Resolve symbols**: Use `resolve_symbol` or `codegraph resolve-symbol <name>` before querying graphs.
|
|
241
|
+
4. **Query relationships**: Use `get_callers`, `get_callees`, or `trace_path` with canonical IDs.
|
|
242
|
+
5. **Use returned evidence**: Cite source file and exact line spans from `{ file, start_line, end_line, type, canonical_id }`.
|
|
243
|
+
6. **Handle UNKNOWN explicitly**: If a target is not found, report UNKNOWN rather than hallucinating facts.
|
|
244
|
+
7. **Handle AMBIGUOUS explicitly**: When multiple candidates match, present the candidates or request qualification. Never guess.
|
|
245
|
+
8. **Never infer unsupported repository facts**: Only make assertions backed by static AST evidence.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## CLI Path Defaults & Invocation
|
|
250
|
+
|
|
251
|
+
All repository inspection commands support optional repository paths defaulting to the current directory (`.`):
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
codegraph <command> [PATH] [--repo PATH]
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Examples:
|
|
258
|
+
```bash
|
|
259
|
+
# Equivalent commands resolving to the current directory:
|
|
260
|
+
codegraph status
|
|
261
|
+
codegraph status .
|
|
262
|
+
codegraph status -r .
|
|
263
|
+
codegraph status --repo .
|
|
264
|
+
|
|
265
|
+
# Indexing:
|
|
266
|
+
codegraph index
|
|
267
|
+
codegraph index .
|
|
268
|
+
codegraph index /path/to/repo
|
|
269
|
+
|
|
270
|
+
# Explicit symbol commands:
|
|
271
|
+
codegraph get-symbol AuthService
|
|
272
|
+
codegraph resolve-symbol duplicate_action
|
|
273
|
+
codegraph trace AuthService -d 2
|
|
274
|
+
codegraph search "authenticate"
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Machine-Readable Error Contract & Stable Error Codes
|
|
280
|
+
|
|
281
|
+
Expected operational failures emit structured JSON without raw Python tracebacks. Every error includes actionable agent recovery instructions:
|
|
282
|
+
|
|
283
|
+
```json
|
|
284
|
+
{
|
|
285
|
+
"status": "error",
|
|
286
|
+
"error": {
|
|
287
|
+
"code": "INDEX_NOT_FOUND",
|
|
288
|
+
"message": "No CodeGraph index exists for this repository.",
|
|
289
|
+
"next_action": {
|
|
290
|
+
"command": "codegraph init",
|
|
291
|
+
"reason": "Initialize the repository before querying it."
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Stable Error Codes
|
|
298
|
+
|
|
299
|
+
| Code | Meaning | Agent Next Action |
|
|
300
|
+
| :--- | :--- | :--- |
|
|
301
|
+
| `INDEX_NOT_FOUND` | Repository has not been indexed | `codegraph init` |
|
|
302
|
+
| `INDEX_STALE` | Repository modified after last indexing | `codegraph index` |
|
|
303
|
+
| `REPOSITORY_NOT_INITIALIZED` | Missing CodeGraph configuration | `codegraph init` |
|
|
304
|
+
| `INVALID_PATH` | Non-existent or invalid directory path | Check directory path |
|
|
305
|
+
| `PATH_OUTSIDE_REPOSITORY` | Path traversal attempt blocked | Keep paths within repo root |
|
|
306
|
+
| `SYMBOL_NOT_FOUND` | Symbol does not exist in AST index | `codegraph search <query>` |
|
|
307
|
+
| `SYMBOL_AMBIGUOUS` | Multiple candidates match query | `codegraph resolve <canonical_id>` |
|
|
308
|
+
| `INVALID_ARGUMENT` | Missing or empty required argument | Check command syntax |
|
|
309
|
+
| `INVALID_DEPTH` | Traversal depth outside 1..5 range | Clamped to 1..5 |
|
|
310
|
+
| `SENSITIVE_FILE_ACCESS_DENIED` | File is protected (e.g. `.env`) | Check privacy boundaries |
|
|
311
|
+
| `PARSE_FAILURE` | File contains syntax errors | Fix syntax and re-index |
|
|
312
|
+
| `UNSUPPORTED_LANGUAGE` | Language parser not supported | Check `codegraph doctor` |
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Verification & Release Gates
|
|
317
|
+
|
|
318
|
+
All releases are verified against rigorous gates:
|
|
319
|
+
|
|
320
|
+
- **Ruff**: 0 lint errors
|
|
321
|
+
- **Mypy**: 0 issues under strict typing
|
|
322
|
+
- **Pytest**: 344 unit, integration, and contract tests passing
|
|
323
|
+
- **Benchmarks**: 50 tasks across 10 categories:
|
|
324
|
+
- Unsupported Claims: 0.0%
|
|
325
|
+
- FACT Correctness: 100.0%
|
|
326
|
+
- UNKNOWN Correctness: 98.0%
|
|
327
|
+
- AMBIGUITY Correctness: 100.0%
|
|
328
|
+
- STALE Handling: Verified
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## License
|
|
333
|
+
|
|
334
|
+
MIT
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# CodeGraph MCP
|
|
2
|
+
|
|
3
|
+
> **The AI understands the developer. CodeGraph interrogates the repository.**
|
|
4
|
+
> **The claim comes from the AI; the proof comes from CodeGraph.**
|
|
5
|
+
|
|
6
|
+
CodeGraph MCP is an open-source, deterministic codebase intelligence server built on the Model Context Protocol (MCP). It is not a conversational AI, a natural-language interpreter, a vector database, or an autonomous agent.
|
|
7
|
+
|
|
8
|
+
Antigravity and your AI agents handle natural-language reasoning, intent interpretation, and answer synthesis. CodeGraph interrogates the local repository to deliver deterministic, evidence-backed AST facts, call and import graphs, verified line citations, architecture structure, and Git impact.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Architectural Separation of Responsibilities
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
USER
|
|
16
|
+
│
|
|
17
|
+
│ natural-language request ("how does authetication wrks in my app?")
|
|
18
|
+
▼
|
|
19
|
+
ANTIGRAVITY / AI
|
|
20
|
+
│
|
|
21
|
+
├── understands intent and context
|
|
22
|
+
├── corrects spelling and informal language
|
|
23
|
+
├── identifies candidate code targets
|
|
24
|
+
├── resolves conceptual ambiguity
|
|
25
|
+
├── decomposes complex queries into precise tool invocations
|
|
26
|
+
└── decides which MCP tools to call
|
|
27
|
+
│
|
|
28
|
+
│ precise, deterministic MCP request (e.g., list_routes(), resolve_symbol("authenticate"))
|
|
29
|
+
▼
|
|
30
|
+
CODEGRAPH MCP
|
|
31
|
+
│
|
|
32
|
+
├── deterministic repository retrieval
|
|
33
|
+
├── exact symbol and canonical ID resolution
|
|
34
|
+
├── graph traversal and path tracing
|
|
35
|
+
├── caller and callee analysis
|
|
36
|
+
├── route and framework discovery
|
|
37
|
+
├── architecture and dependency extraction
|
|
38
|
+
├── Git diff and blast-radius impact analysis
|
|
39
|
+
└── first-class evidence generation
|
|
40
|
+
│
|
|
41
|
+
▼
|
|
42
|
+
STRUCTURED EVIDENCE
|
|
43
|
+
│
|
|
44
|
+
├── canonical IDs (path::Symbol.method)
|
|
45
|
+
├── file paths and exact line ranges
|
|
46
|
+
├── verified relationship edges (CALLS, IMPORTS, HANDLED_BY)
|
|
47
|
+
├── index generation and freshness state
|
|
48
|
+
└── repository commit hash
|
|
49
|
+
│
|
|
50
|
+
▼
|
|
51
|
+
ANTIGRAVITY / AI
|
|
52
|
+
│
|
|
53
|
+
└── synthesizes the final human-readable answer with verified source citations
|
|
54
|
+
▼
|
|
55
|
+
USER
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Core Invariants
|
|
61
|
+
|
|
62
|
+
1. **Deterministic Execution**:
|
|
63
|
+
$$\text{Repository State} + \text{Index Generation} + \text{MCP Request} \Longrightarrow \text{Identical Deterministic Result}$$
|
|
64
|
+
Collections are deterministically sorted; results never change between identical invocations.
|
|
65
|
+
2. **Zero Natural-Language Guessing**: CodeGraph never guesses developer intent or infers vague concepts. If a symbol name is ambiguous across files, CodeGraph returns `status: "ambiguous"` with candidate canonical IDs for the AI to choose.
|
|
66
|
+
3. **No Hallucinations / UNKNOWN Handling**: Facts are backed by AST analysis and verified references. If a target does not exist or cannot be proven statically, CodeGraph reports `status: "not_found"` or `UNKNOWN`.
|
|
67
|
+
4. **Structured Evidence**: Every claim or relation is tied to `{ file, start_line, end_line, type, canonical_id }`.
|
|
68
|
+
5. **Completely Local & Resource-Bounded**: Zero LLM API calls, zero external vector databases, zero telemetry. Execution runs inside a strict resource governor with thread and memory bounds.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Minimal Orthogonal 13-Tool MCP API
|
|
73
|
+
|
|
74
|
+
CodeGraph MCP exposes 13 core interrogation tools under `profile="core"`. Every tool returns structured data, an explicit `status` code (`"ok"`, `"not_found"`, `"ambiguous"`, `"invalid_request"`), index metadata, and verified evidence.
|
|
75
|
+
|
|
76
|
+
| Tool | Purpose | Key Inputs | Key Output Fields |
|
|
77
|
+
| :--- | :--- | :--- | :--- |
|
|
78
|
+
| `resolve_symbol` | Ground an exact or qualified symbol name | `name: str` | `status`, `symbol` (canonical ID, file, line), `candidates` (if ambiguous) |
|
|
79
|
+
| `search_symbols` | Deterministic token search over non-generated symbols | `query: str`, `top_k: int` | `status`, `results` (canonical ID, kind, score), `count` |
|
|
80
|
+
| `get_symbol` | Retrieve authoritative AST details for a canonical symbol | `canonical_id: str` | `status`, `symbol` (kind, signature, docstring, lines, decorators, parent, children) |
|
|
81
|
+
| `get_file` | Structural AST representation of an indexed file | `path: str`, `include_content: bool` | `status`, `file`, `hash`, `size`, `classes`, `functions`, `imports`, `routes` |
|
|
82
|
+
| `get_references` | Return verified call sites and references | `canonical_id: str` | `status`, `references` (file, start_line, end_line, type) |
|
|
83
|
+
| `get_callers` | Return functions and methods that call the target | `canonical_id: str` | `status`, `callers` (caller canonical ID, file, line, call site) |
|
|
84
|
+
| `get_callees` | Return functions and methods called by the target | `canonical_id: str` | `status`, `callees` (resolved, unresolved, and external calls) |
|
|
85
|
+
| `trace_path` | Deterministic BFS execution path between two symbols | `source_symbol: str`, `target_symbol: str`, `max_depth: int` | `status`, `path` (steps with from/to symbols, relationship, evidence), `reachable` |
|
|
86
|
+
| `get_imports` | Return imports for a file or canonical symbol | `file: str \| None`, `canonical_id: str \| None` | `status`, `imports` (module, imported_name, alias, line, evidence) |
|
|
87
|
+
| `get_dependents` | Reverse dependency query (files/symbols depending on target) | `canonical_id: str \| None`, `file: str \| None` | `status`, `dependents` (source, relationship, evidence) |
|
|
88
|
+
| `list_routes` | Discovered framework routes (FastAPI, Flask, Django, Express) | `framework: str \| None`, `method: str \| None`, `path: str \| None` | `status`, `routes` (method, route_path, framework, handler_name, canonical_id) |
|
|
89
|
+
| `get_architecture` | High-level repository structural overview | _none_ | `status`, `languages`, `directories`, `entrypoints`, `routes`, `dependencies` |
|
|
90
|
+
| `get_git_impact` | Git diff blast-radius impact analysis | `base: str`, `head: str` | `status`, `changed_files`, `modified_symbols`, `affected_callers`, `affected_callees`, `affected_routes` |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Response Envelope & Evidence Format
|
|
95
|
+
|
|
96
|
+
Every response adheres to a predictable structure:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"status": "ok",
|
|
101
|
+
"symbol": {
|
|
102
|
+
"canonical_id": "src/auth/service.py::AuthService.authenticate",
|
|
103
|
+
"name": "authenticate",
|
|
104
|
+
"kind": "METHOD",
|
|
105
|
+
"file": "src/auth/service.py",
|
|
106
|
+
"start_line": 42,
|
|
107
|
+
"end_line": 68
|
|
108
|
+
},
|
|
109
|
+
"evidence": [
|
|
110
|
+
{
|
|
111
|
+
"file": "src/auth/service.py",
|
|
112
|
+
"start_line": 42,
|
|
113
|
+
"end_line": 68,
|
|
114
|
+
"type": "DEFINES",
|
|
115
|
+
"canonical_id": "src/auth/service.py::AuthService.authenticate"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"index": {
|
|
119
|
+
"generation": 1,
|
|
120
|
+
"created_at": "2026-10-01T12:00:00Z",
|
|
121
|
+
"freshness": "FRESH"
|
|
122
|
+
},
|
|
123
|
+
"repository": {
|
|
124
|
+
"commit": "a1b2c3d"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Ambiguous Resolution Example
|
|
130
|
+
|
|
131
|
+
When a query matches multiple symbols across different modules, CodeGraph will never guess:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"status": "ambiguous",
|
|
136
|
+
"symbol": null,
|
|
137
|
+
"candidates": [
|
|
138
|
+
{
|
|
139
|
+
"canonical_id": "src/admin/views.py::duplicate_helper",
|
|
140
|
+
"file": "src/admin/views.py",
|
|
141
|
+
"line": 15
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"canonical_id": "src/auth/views.py::duplicate_helper",
|
|
145
|
+
"file": "src/auth/views.py",
|
|
146
|
+
"line": 18
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"message": "Multiple symbols match 'duplicate_helper'. Provide a qualified name or canonical ID."
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## End-to-End Walkthrough
|
|
156
|
+
|
|
157
|
+
### 1. Developer asks:
|
|
158
|
+
> *"how does authetication wrks in my app?"*
|
|
159
|
+
|
|
160
|
+
### 2. Antigravity / AI decomposes the request:
|
|
161
|
+
- Recognizes query about authentication flows and routing.
|
|
162
|
+
- Calls `list_routes(path="auth")` to locate entrypoints.
|
|
163
|
+
- Calls `resolve_symbol("authenticate")` to identify the service handler.
|
|
164
|
+
- Calls `trace_path(source_symbol="src/auth/views.py::login_view", target_symbol="src/auth/service.py::AuthService.authenticate")`.
|
|
165
|
+
- Calls `get_callees(canonical_id="src/auth/service.py::AuthService.authenticate")`.
|
|
166
|
+
|
|
167
|
+
### 3. CodeGraph interrogates the repository:
|
|
168
|
+
- Returns exact route definitions (`POST /api/v1/auth/login` handled by `src/auth/views.py::login_view`).
|
|
169
|
+
- Proves BFS execution path from `login_view` $\to$ `AuthService.authenticate` with line evidence.
|
|
170
|
+
- Lists callees (`verify_password`, `create_jwt_token`, `log_audit_event`) with file citations.
|
|
171
|
+
|
|
172
|
+
### 4. Antigravity / AI synthesizes the answer:
|
|
173
|
+
> "Authentication in your application begins at the `POST /api/v1/auth/login` endpoint handled by [`login_view`](file:///src/auth/views.py#L25). It invokes [`AuthService.authenticate`](file:///src/auth/service.py#L42), which validates credentials via [`verify_password`](file:///src/auth/crypto.py#L12) and generates a JWT token via [`create_jwt_token`](file:///src/auth/token.py#L55)."
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Installation & Usage
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pip install 'codegraph-engine[mcp]'
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Configure in MCP Client (Claude Desktop, Cursor, Gemini)
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"mcpServers": {
|
|
188
|
+
"codegraph": {
|
|
189
|
+
"command": "codegraph",
|
|
190
|
+
"args": ["serve", "-r", "/path/to/your/repo", "--profile", "core"]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### CLI Inspection
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Index repository
|
|
200
|
+
codegraph index ./my-repo
|
|
201
|
+
|
|
202
|
+
# Search symbols
|
|
203
|
+
codegraph search "authenticate" -r ./my-repo
|
|
204
|
+
|
|
205
|
+
# Trace execution path
|
|
206
|
+
codegraph trace "login_view" -r ./my-repo
|
|
207
|
+
|
|
208
|
+
# Benchmark verification
|
|
209
|
+
codegraph benchmark -r ./my-repo
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## AI Agent Usage
|
|
215
|
+
|
|
216
|
+
AI agents querying CodeGraph MCP should follow this deterministic lifecycle:
|
|
217
|
+
|
|
218
|
+
1. **Initialize repository if required**: Execute `codegraph init` or verify index status.
|
|
219
|
+
2. **Check freshness**: Verify `index.freshness == "FRESH"`. If stale, execute `codegraph index`.
|
|
220
|
+
3. **Resolve symbols**: Use `resolve_symbol` or `codegraph resolve-symbol <name>` before querying graphs.
|
|
221
|
+
4. **Query relationships**: Use `get_callers`, `get_callees`, or `trace_path` with canonical IDs.
|
|
222
|
+
5. **Use returned evidence**: Cite source file and exact line spans from `{ file, start_line, end_line, type, canonical_id }`.
|
|
223
|
+
6. **Handle UNKNOWN explicitly**: If a target is not found, report UNKNOWN rather than hallucinating facts.
|
|
224
|
+
7. **Handle AMBIGUOUS explicitly**: When multiple candidates match, present the candidates or request qualification. Never guess.
|
|
225
|
+
8. **Never infer unsupported repository facts**: Only make assertions backed by static AST evidence.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## CLI Path Defaults & Invocation
|
|
230
|
+
|
|
231
|
+
All repository inspection commands support optional repository paths defaulting to the current directory (`.`):
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
codegraph <command> [PATH] [--repo PATH]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Examples:
|
|
238
|
+
```bash
|
|
239
|
+
# Equivalent commands resolving to the current directory:
|
|
240
|
+
codegraph status
|
|
241
|
+
codegraph status .
|
|
242
|
+
codegraph status -r .
|
|
243
|
+
codegraph status --repo .
|
|
244
|
+
|
|
245
|
+
# Indexing:
|
|
246
|
+
codegraph index
|
|
247
|
+
codegraph index .
|
|
248
|
+
codegraph index /path/to/repo
|
|
249
|
+
|
|
250
|
+
# Explicit symbol commands:
|
|
251
|
+
codegraph get-symbol AuthService
|
|
252
|
+
codegraph resolve-symbol duplicate_action
|
|
253
|
+
codegraph trace AuthService -d 2
|
|
254
|
+
codegraph search "authenticate"
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Machine-Readable Error Contract & Stable Error Codes
|
|
260
|
+
|
|
261
|
+
Expected operational failures emit structured JSON without raw Python tracebacks. Every error includes actionable agent recovery instructions:
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"status": "error",
|
|
266
|
+
"error": {
|
|
267
|
+
"code": "INDEX_NOT_FOUND",
|
|
268
|
+
"message": "No CodeGraph index exists for this repository.",
|
|
269
|
+
"next_action": {
|
|
270
|
+
"command": "codegraph init",
|
|
271
|
+
"reason": "Initialize the repository before querying it."
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Stable Error Codes
|
|
278
|
+
|
|
279
|
+
| Code | Meaning | Agent Next Action |
|
|
280
|
+
| :--- | :--- | :--- |
|
|
281
|
+
| `INDEX_NOT_FOUND` | Repository has not been indexed | `codegraph init` |
|
|
282
|
+
| `INDEX_STALE` | Repository modified after last indexing | `codegraph index` |
|
|
283
|
+
| `REPOSITORY_NOT_INITIALIZED` | Missing CodeGraph configuration | `codegraph init` |
|
|
284
|
+
| `INVALID_PATH` | Non-existent or invalid directory path | Check directory path |
|
|
285
|
+
| `PATH_OUTSIDE_REPOSITORY` | Path traversal attempt blocked | Keep paths within repo root |
|
|
286
|
+
| `SYMBOL_NOT_FOUND` | Symbol does not exist in AST index | `codegraph search <query>` |
|
|
287
|
+
| `SYMBOL_AMBIGUOUS` | Multiple candidates match query | `codegraph resolve <canonical_id>` |
|
|
288
|
+
| `INVALID_ARGUMENT` | Missing or empty required argument | Check command syntax |
|
|
289
|
+
| `INVALID_DEPTH` | Traversal depth outside 1..5 range | Clamped to 1..5 |
|
|
290
|
+
| `SENSITIVE_FILE_ACCESS_DENIED` | File is protected (e.g. `.env`) | Check privacy boundaries |
|
|
291
|
+
| `PARSE_FAILURE` | File contains syntax errors | Fix syntax and re-index |
|
|
292
|
+
| `UNSUPPORTED_LANGUAGE` | Language parser not supported | Check `codegraph doctor` |
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Verification & Release Gates
|
|
297
|
+
|
|
298
|
+
All releases are verified against rigorous gates:
|
|
299
|
+
|
|
300
|
+
- **Ruff**: 0 lint errors
|
|
301
|
+
- **Mypy**: 0 issues under strict typing
|
|
302
|
+
- **Pytest**: 344 unit, integration, and contract tests passing
|
|
303
|
+
- **Benchmarks**: 50 tasks across 10 categories:
|
|
304
|
+
- Unsupported Claims: 0.0%
|
|
305
|
+
- FACT Correctness: 100.0%
|
|
306
|
+
- UNKNOWN Correctness: 98.0%
|
|
307
|
+
- AMBIGUITY Correctness: 100.0%
|
|
308
|
+
- STALE Handling: Verified
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## License
|
|
313
|
+
|
|
314
|
+
MIT
|