descry-codegraph 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,345 @@
1
+ Metadata-Version: 2.4
2
+ Name: descry-codegraph
3
+ Version: 0.1.0
4
+ Summary: Codebase knowledge graph: polyglot indexer, semantic search, call-graph analysis
5
+ Project-URL: Homepage, https://github.com/06chaynes/descry
6
+ Project-URL: Repository, https://github.com/06chaynes/descry
7
+ Project-URL: Issues, https://github.com/06chaynes/descry/issues
8
+ Author: Christian Haynes
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: call-graph,code-analysis,codegraph,knowledge-graph,mcp,scip
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Topic :: Software Development :: Quality Assurance
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: protobuf>=6.33.4
22
+ Provides-Extra: all
23
+ Requires-Dist: mcp>=1.6.0; extra == 'all'
24
+ Requires-Dist: numpy>=1.24.0; extra == 'all'
25
+ Requires-Dist: pyjwt>=2.12.0; extra == 'all'
26
+ Requires-Dist: python-multipart>=0.0.26; extra == 'all'
27
+ Requires-Dist: sentence-transformers>=3.0.0; extra == 'all'
28
+ Requires-Dist: starlette>=0.47.2; extra == 'all'
29
+ Requires-Dist: tree-sitter-javascript>=0.25.0; extra == 'all'
30
+ Requires-Dist: tree-sitter-typescript>=0.23.0; extra == 'all'
31
+ Requires-Dist: tree-sitter>=0.25.0; extra == 'all'
32
+ Requires-Dist: uvicorn>=0.32.0; extra == 'all'
33
+ Provides-Extra: ast
34
+ Requires-Dist: tree-sitter-javascript>=0.25.0; extra == 'ast'
35
+ Requires-Dist: tree-sitter-typescript>=0.23.0; extra == 'ast'
36
+ Requires-Dist: tree-sitter>=0.25.0; extra == 'ast'
37
+ Provides-Extra: dev
38
+ Requires-Dist: httpx>=0.27.0; extra == 'dev'
39
+ Requires-Dist: mcp>=1.6.0; extra == 'dev'
40
+ Requires-Dist: numpy>=1.24.0; extra == 'dev'
41
+ Requires-Dist: pip-audit>=2.9.0; extra == 'dev'
42
+ Requires-Dist: pygments>=2.20.0; extra == 'dev'
43
+ Requires-Dist: pyjwt>=2.12.0; extra == 'dev'
44
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
45
+ Requires-Dist: pytest>=9.0.3; extra == 'dev'
46
+ Requires-Dist: python-multipart>=0.0.26; extra == 'dev'
47
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
48
+ Requires-Dist: sentence-transformers>=3.0.0; extra == 'dev'
49
+ Requires-Dist: starlette>=0.47.2; extra == 'dev'
50
+ Requires-Dist: tree-sitter-javascript>=0.25.0; extra == 'dev'
51
+ Requires-Dist: tree-sitter-typescript>=0.23.0; extra == 'dev'
52
+ Requires-Dist: tree-sitter>=0.25.0; extra == 'dev'
53
+ Requires-Dist: uvicorn>=0.32.0; extra == 'dev'
54
+ Provides-Extra: embeddings
55
+ Requires-Dist: numpy>=1.24.0; extra == 'embeddings'
56
+ Requires-Dist: sentence-transformers>=3.0.0; extra == 'embeddings'
57
+ Provides-Extra: mcp
58
+ Requires-Dist: mcp>=1.6.0; extra == 'mcp'
59
+ Requires-Dist: pyjwt>=2.12.0; extra == 'mcp'
60
+ Requires-Dist: python-multipart>=0.0.26; extra == 'mcp'
61
+ Provides-Extra: web
62
+ Requires-Dist: starlette>=0.47.2; extra == 'web'
63
+ Requires-Dist: uvicorn>=0.32.0; extra == 'web'
64
+ Description-Content-Type: text/markdown
65
+
66
+ # Descry
67
+
68
+ Polyglot codebase knowledge graph with call-graph analysis, semantic search, and SCIP integration. Built for AI coding agents (MCP), with CLI and Web UI interfaces.
69
+
70
+ Descry indexes your codebase into a knowledge graph of symbols (functions, classes, constants) and their relationships (calls, imports, defines). It supports Rust, Python, TypeScript, JavaScript, Svelte, Go, Java, and more — with type-aware resolution via SCIP for Rust and TypeScript.
71
+
72
+ > ### ⚠️ Disclaimer — please read
73
+ >
74
+ > **Descry was built with heavy assistance from AI coding agents.** While
75
+ > the codebase has been through an internal security and correctness
76
+ > review, AI-authored code can still contain subtle defects, missed edge
77
+ > cases, or security assumptions that weren't obvious to the reviewer.
78
+ > Treat this tool as experimental pre-1.0 software: **do not rely on it
79
+ > for safety-critical analysis, and do not point it at code or
80
+ > repositories you don't trust.**
81
+ >
82
+ > **This tool is designed to run locally on your own machine.** The web
83
+ > UI (`descry-web`) binds to `127.0.0.1` and is unauthenticated by design —
84
+ > the threat model assumes a single trusted user on the host.
85
+ >
86
+ > - **Do not expose `descry-web` to a network.** No reverse proxy, no
87
+ > public tunnel, no `--host 0.0.0.0`. If you need remote access, put
88
+ > it behind your own authenticated reverse proxy and understand that
89
+ > any browser tab on the host machine can still reach it via
90
+ > `localhost`.
91
+ > - **Do not run Descry on untrusted repositories.** Indexing a
92
+ > repository executes configuration from its `.descry.toml`, walks
93
+ > its file tree, and feeds its docstrings/source to your LLM (if you
94
+ > use the MCP server). The same trust boundary that applies to
95
+ > `cargo build`, `npm install`, and opening the repo in your IDE
96
+ > applies here.
97
+ > - **Report security issues privately** — see [SECURITY.md](SECURITY.md).
98
+
99
+ ## Quick Start
100
+
101
+ ```bash
102
+ # Install with all optional features
103
+ pip install descry-codegraph[all]
104
+
105
+ # Index your project
106
+ cd your-project
107
+ descry index
108
+
109
+ # Search for symbols
110
+ descry search authenticate
111
+
112
+ # Find callers of a function
113
+ descry callers validate_token
114
+
115
+ # One-step lookup (search + full context)
116
+ descry quick handle_request
117
+ ```
118
+
119
+ ## Interfaces
120
+
121
+ | Interface | Command | Use Case |
122
+ |-----------|---------|----------|
123
+ | **CLI** | `descry <command>` | Interactive terminal use |
124
+ | **MCP Server** | `descry-mcp` | AI coding agents (Claude Code, etc.) |
125
+ | **Web UI** | `descry-web` | Visual exploration at `http://127.0.0.1:8787` |
126
+ | **Pi Extension** | See `pi-extension/` | Pi coding agent integration |
127
+
128
+ ## MCP Setup
129
+
130
+ ### Claude Code
131
+
132
+ Add to your Claude Code MCP settings (`.claude/settings.json` or global):
133
+
134
+ ```json
135
+ {
136
+ "mcpServers": {
137
+ "descry": {
138
+ "command": "descry-mcp",
139
+ "args": []
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ Or with a specific Python path:
146
+
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "descry": {
151
+ "command": "/path/to/venv/bin/descry-mcp",
152
+ "args": []
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ ### Other MCP Hosts
159
+
160
+ Descry uses the standard MCP stdio transport. Any MCP-compatible host can spawn `descry-mcp` as a subprocess.
161
+
162
+ ## Tools
163
+
164
+ Descry provides 18 tools, available through all interfaces:
165
+
166
+ | Tool | Description |
167
+ |------|-------------|
168
+ | `health` | Diagnostic check — version, graph status, feature availability |
169
+ | `status` | Graph existence and freshness |
170
+ | `ensure` | Ensure graph exists and is fresh (regenerates if stale) |
171
+ | `index` | Regenerate graph, SCIP indices, and embeddings |
172
+ | `search` | Search symbol names and docstrings (keyword + semantic) |
173
+ | `semantic` | Pure semantic search using embeddings only |
174
+ | `quick` | Find symbol and show full context in one step |
175
+ | `callers` | Find all callers of a symbol |
176
+ | `callees` | Find what a symbol calls |
177
+ | `context` | Full context for a symbol — source, callers, callees, tests |
178
+ | `flow` | Trace call flow from a starting symbol (forward/backward) |
179
+ | `path` | Find shortest call path between two symbols |
180
+ | `structure` | Show file structure — imports, classes, functions |
181
+ | `flatten` | Show effective API of a class including inherited methods |
182
+ | `impls` | Find all implementations of a trait/interface method |
183
+ | `cross-lang` | Trace frontend API calls to backend handlers via OpenAPI |
184
+ | `churn` | Find code churn hotspots (symbols, files, or co-change pairs) |
185
+ | `evolution` | Track how a symbol has changed over time |
186
+ | `changes` | Analyze change impact for a commit range |
187
+
188
+ ## Configuration
189
+
190
+ Descry works zero-config by auto-detecting your project root (looks for `.git`, `Cargo.toml`, `package.json`, `pyproject.toml`). For customization, add a `.descry.toml` to your project root:
191
+
192
+ ```toml
193
+ [project]
194
+ excluded_dirs = ["target", "node_modules", "dist", ".git", "__pycache__", "build", "vendor"]
195
+ max_stale_hours = 48
196
+
197
+ [features]
198
+ enable_scip = true # Type-aware resolution (requires rust-analyzer or scip-typescript)
199
+ enable_embeddings = true # Semantic search (requires sentence-transformers)
200
+
201
+ [embeddings]
202
+ model = "jinaai/jina-code-embeddings-0.5b"
203
+
204
+ [test_detection]
205
+ path_patterns = ["/tests/", "/test/", "/__tests__/"]
206
+ file_suffixes = ["_test.rs", ".test.ts", ".spec.ts", "_test.py"]
207
+
208
+ [code_files]
209
+ extensions = [".rs", ".py", ".ts", ".tsx", ".js", ".jsx", ".svelte", ".go", ".java"]
210
+
211
+ [git]
212
+ churn_exclusions = [".descry_cache/", "Cargo.lock", "package-lock.json"]
213
+ timeout = 30
214
+
215
+ [timeouts]
216
+ scip_minutes = 0 # 0 = unlimited
217
+ embedding_seconds = 60
218
+ query_ms = 4000
219
+
220
+ [query]
221
+ max_depth = 3
222
+ max_nodes = 100
223
+ max_children_per_level = 10
224
+ max_callers_shown = 15
225
+
226
+ [scip]
227
+ extra_args = ["--exclude-vendored-libraries"]
228
+ skip_crates = [] # Crate names to skip during SCIP indexing
229
+
230
+ [scip.rust]
231
+ toolchain = "1.92.0" # Pin rust-analyzer version via rustup
232
+
233
+ [syntax.lang_map]
234
+ ".svelte" = "svelte"
235
+ ".proto" = "protobuf"
236
+ ```
237
+
238
+ ### Environment Variables
239
+
240
+ | Variable | Default | Description |
241
+ |----------|---------|-------------|
242
+ | `DESCRY_LOG_LEVEL` | `WARNING` | Log level (DEBUG, INFO, WARNING, ERROR) |
243
+ | `DESCRY_CACHE_DIR` | `.descry_cache/` | Override cache directory location |
244
+ | `DESCRY_NO_SCIP` | `false` | Disable SCIP indexing |
245
+ | `DESCRY_NO_EMBEDDINGS` | `false` | Disable semantic search |
246
+
247
+ Configuration precedence: defaults < `.descry.toml` < environment variables.
248
+
249
+ ## Language Support
250
+
251
+ | Language | Parsing | SCIP (Type-Aware) | Requirements |
252
+ |----------|---------|-------------------|--------------|
253
+ | Rust | Regex + AST | Yes | `rust-analyzer` via rustup |
254
+ | TypeScript | Regex (+ Tree-sitter opt-in) | Yes | `scip-typescript` via npm; `descry-codegraph[ast]` for tree-sitter |
255
+ | Python | Regex + AST | Yes | `scip-python` via npm |
256
+ | JavaScript | Regex (+ Tree-sitter opt-in) | — | `descry-codegraph[ast]` for tree-sitter |
257
+ | Svelte | Regex | — | — |
258
+ | Go | Regex | — | — |
259
+ | Java | Regex | — | — |
260
+
261
+ The tree-sitter TS/TSX/JS parser is currently extractor-only (symbol discovery) and ships behind the `ast` extra + `[features] use_tree_sitter_ts = true` in `.descry.toml`. It runs alongside the regex parser and is a stepping stone toward full AST-driven extraction in a future release.
262
+
263
+ SCIP provides precise call-graph resolution (resolving which specific function is called through traits, generics, etc.). Without SCIP, Descry falls back to regex-based name matching which handles most cases but may produce false positives on overloaded names.
264
+
265
+ ## Installation
266
+
267
+ ### Minimal (graph + CLI only)
268
+
269
+ ```bash
270
+ pip install descry-codegraph
271
+ ```
272
+
273
+ ### With MCP server
274
+
275
+ ```bash
276
+ pip install descry-codegraph[mcp]
277
+ ```
278
+
279
+ ### With Web UI
280
+
281
+ ```bash
282
+ pip install descry-codegraph[web]
283
+ ```
284
+
285
+ ### With semantic search
286
+
287
+ ```bash
288
+ pip install descry-codegraph[embeddings]
289
+ ```
290
+
291
+ ### Everything
292
+
293
+ ```bash
294
+ pip install descry-codegraph[all]
295
+ ```
296
+
297
+ ### Development
298
+
299
+ ```bash
300
+ git clone https://github.com/06chaynes/descry.git
301
+ cd descry
302
+ just install # Creates venv and installs with dev deps
303
+ just test # Run tests
304
+ just lint # Ruff linting
305
+ just fmt # Ruff formatting
306
+ ```
307
+
308
+ Requires [uv](https://github.com/astral-sh/uv) and [just](https://github.com/casey/just).
309
+
310
+ ## How It Works
311
+
312
+ 1. **Index** — Descry walks your codebase, parses source files into an AST-like representation, and builds a graph of symbols and their relationships. If SCIP is available, it overlays type-aware call resolution.
313
+
314
+ 2. **Cache** — The graph is cached as JSON in `.descry_cache/codebase_graph.json`. Embeddings are cached separately. SCIP indices are cached per-crate/package.
315
+
316
+ 3. **Query** — All tools query the cached graph. Keyword search uses TF-IDF scoring. Semantic search uses sentence-transformer embeddings. Call-graph traversal follows edges in the graph.
317
+
318
+ 4. **Freshness** — `ensure` checks graph age against `max_stale_hours` and regenerates if needed. The MCP server pre-warms the graph on startup.
319
+
320
+ ## Design Notes
321
+
322
+ ### Web UI is local-only (CORS + auth)
323
+
324
+ `descry-web` is designed as a single-user local development tool. It binds to `127.0.0.1` by default, allows cross-origin requests (`allow_origins=["*"]`), and does not require authentication. This is deliberate:
325
+
326
+ - The UI is served by the same process that reads your repository; any authentication layer would be a shared-secret between your browser and your own terminal.
327
+ - Path traversal and file-serving endpoints are hardened independently of CORS: `/api/source` enforces project-root containment, rejects non-regular files, caps size at 10 MiB, and refuses non-text content (with `O_NOFOLLOW` on the final open to defeat symlink swaps).
328
+ - The reindex endpoints accept no path parameter; they always index the configured project root.
329
+
330
+ **Do not expose `descry-web` to an untrusted network.** If you need remote access, put it behind your own authenticated reverse proxy.
331
+
332
+ ## Versioning
333
+
334
+ Descry is pre-1.0. Minor version bumps (`0.1.x` → `0.2.x`) may include breaking changes to the library API, graph schema, CLI, or MCP tool signatures. Patch releases (`0.1.0` → `0.1.1`) will not introduce breaking changes. Once we reach `1.0.0`, the project will follow [semver](https://semver.org/) strictly.
335
+
336
+ The public library API in v0.1 is limited to `descry.__version__`. Submodules (`descry.handlers`, `descry.query`, etc.) are not considered stable API yet.
337
+
338
+ ## Further Reading
339
+
340
+ - [CHANGELOG](CHANGELOG.md) — release notes.
341
+ - [SECURITY](SECURITY.md) — security policy and disclosure.
342
+
343
+ ## License
344
+
345
+ MIT
@@ -0,0 +1,27 @@
1
+ descry/__init__.py,sha256=ryuGghUXshdQakq7HmH84xZ8QqY3YeDbP7sqbB7EeNw,148
2
+ descry/_env.py,sha256=V9_yOnCt_QJQDNigphkoWI0aQYrDq0hZ1E2byOV4nvw,984
3
+ descry/_graph.py,sha256=gVCrMr4jD3hgpeXHocAKfmlQdFCQdL3dFdUTe4sR1-E,1070
4
+ descry/ast_grep.py,sha256=Y8SjTvhsFqU7vP9Tsezi6qMLi4vnPwf-SuyI93MnldY,13503
5
+ descry/cli.py,sha256=gf3QCohOpvik-oixDMYo-sZa8Le6cAPlvlamXU511Lc,13813
6
+ descry/cross_lang.py,sha256=gRgCEkjz4U3OtL9UP_xjlLu6ugBpC-Fo_K4EAbNCcdo,15408
7
+ descry/embeddings.py,sha256=d7sLZF4bZylOPdBhl2bGg2qUDdI7CQzvZVMI8GRYXpM,20991
8
+ descry/generate.py,sha256=S6qWrjjs9pQmYDCnAST6PDI-AF2KuHVMa3X_SSUesas,123791
9
+ descry/git_history.py,sha256=zaJJm6LqrZ7tNpMKzn5Zy1qni_Iu5s3BJrdk69N3fdE,61255
10
+ descry/handlers.py,sha256=GsHDB2KKdeGepBB20Ar-nb5Vb0UQ_Dtvw5FlA7dosq4,69259
11
+ descry/mcp_server.py,sha256=dj6wsxcK8OYPOhuI3iPGecLP8ufcmFx2eHoCMw48yt8,12819
12
+ descry/query.py,sha256=6SuGGGDJReMKcfbv7z75JhbzU1hKnQ7O2wxUeUIZDrs,92472
13
+ descry/tree_sitter_parser.py,sha256=XJi0kCKl7Fyq3md1XGofkAg0EQszmglUx7I_Ib1_aMQ,12360
14
+ descry/scip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ descry/scip/cache.py,sha256=sBLAmtg-gVH6r57UmQGjLqqLmJWSAaxN0z4Wjpsuyjs,38974
16
+ descry/scip/parser.py,sha256=UiJls5NEM3pneE0rN8jQQUuB0ox9tFMWvkrkzMeLx6Y,19311
17
+ descry/scip/pb2.py,sha256=_4B4wMr8RvnXQdgHKA-LZ7u4lGsY-efAjqEdg-dVrS8,15329
18
+ descry/scip/support.py,sha256=5BBWyzeBizbAZq7_oJ53iePYkjd4pRJihpqpLsm0vpQ,5341
19
+ descry/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ descry/web/server.py,sha256=07eeu_nJ1mNpvXk7MKoxz99w37BXWHq7qBNXpahU4QQ,48105
21
+ descry/web/web/index.html,sha256=0Z2nQuwOnSCb2WAtuurO0YPLuGxc0npwTWU-pSbFg-I,146462
22
+ descry/web/web/style.css,sha256=VTQ1mC-n0BYuDlI1ghozfDG-azLqhJcpWnA0eZtts1o,35816
23
+ descry_codegraph-0.1.0.dist-info/METADATA,sha256=J50m2e8JVCzWSFstSWovvy5uOM0WOXFYagUGLjzo5lE,13316
24
+ descry_codegraph-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
25
+ descry_codegraph-0.1.0.dist-info/entry_points.txt,sha256=qz8s4CwO8y8SAryD9PibrMPDgAbFV2L3sIafvl91_HQ,154
26
+ descry_codegraph-0.1.0.dist-info/licenses/LICENSE,sha256=V8lsocOdIekq2MluAKSu-wGZBsWPBNHCgG7OBfUMlt0,1073
27
+ descry_codegraph-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ descry = descry.cli:main
3
+ descry-generate = descry.generate:main
4
+ descry-mcp = descry.mcp_server:main
5
+ descry-web = descry.web.server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Christian Haynes
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.