codebase-explorer 2.2.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.
Files changed (47) hide show
  1. cbe/__init__.py +9 -0
  2. cbe/__main__.py +4 -0
  3. cbe/aggregation.py +183 -0
  4. cbe/api_completion.py +410 -0
  5. cbe/batching.py +283 -0
  6. cbe/catalog_query.py +376 -0
  7. cbe/checks.py +390 -0
  8. cbe/cli.py +434 -0
  9. cbe/concrete_facts.py +321 -0
  10. cbe/data/LICENSE.tiktoken +30 -0
  11. cbe/data/o200k_base.tiktoken +199998 -0
  12. cbe/declarations.py +537 -0
  13. cbe/docs.py +929 -0
  14. cbe/generate.py +316 -0
  15. cbe/grammars.py +741 -0
  16. cbe/graph.py +857 -0
  17. cbe/graph_backends/__init__.py +43 -0
  18. cbe/graph_backends/_calls.py +262 -0
  19. cbe/graph_backends/_paths.py +42 -0
  20. cbe/graph_backends/identity.py +93 -0
  21. cbe/graph_backends/imports.py +256 -0
  22. cbe/graph_backends/joern.py +1021 -0
  23. cbe/graph_backends/resolution.py +288 -0
  24. cbe/graph_backends/toolchain.py +396 -0
  25. cbe/grounding.py +57 -0
  26. cbe/host_run.py +1752 -0
  27. cbe/model_settings.py +80 -0
  28. cbe/projection.py +305 -0
  29. cbe/prompts.py +316 -0
  30. cbe/records.py +200 -0
  31. cbe/skeleton.py +474 -0
  32. cbe/source_context.py +709 -0
  33. cbe/symbols.py +136 -0
  34. cbe/token_budget.py +68 -0
  35. cbe/treename.py +398 -0
  36. cbe/usage.py +300 -0
  37. cbe_install/__init__.py +11 -0
  38. cbe_install/cli.py +434 -0
  39. cbe_install/resources/agents/cbe-writer.md +16 -0
  40. cbe_install/resources/codebase-explorer/SKILL.md +101 -0
  41. cbe_install/resources/codebase-explorer/references/claude-code.md +63 -0
  42. cbe_install/resources/codebase-explorer/references/codex.md +37 -0
  43. codebase_explorer-2.2.0.dist-info/METADATA +233 -0
  44. codebase_explorer-2.2.0.dist-info/RECORD +47 -0
  45. codebase_explorer-2.2.0.dist-info/WHEEL +4 -0
  46. codebase_explorer-2.2.0.dist-info/entry_points.txt +3 -0
  47. codebase_explorer-2.2.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,37 @@
1
+ # Codex host
2
+
3
+ ## Install
4
+
5
+ Install a CBE build that ships with this Skill (the CLI and Skill are one build), then the skill. From an unpublished checkout:
6
+
7
+ ```sh
8
+ uv tool install --python 3.13 /path/to/codebase-explorer
9
+ "$(uv tool dir --bin)/cbe-install" install --host codex --scope project # .agents/skills/codebase-explorer
10
+ ```
11
+
12
+ Use `--scope user` for `~/.agents/skills`. Codex discovers skills in `.agents/skills` from the working directory up to the repository root and in `~/.agents/skills`; invoke it with `$codebase-explorer` or let Codex select it. To make it visible to every session in a repository, add one line to `AGENTS.md`: "For repository documentation maps, use the codebase-explorer skill."
13
+
14
+ `cbe host` writes only inside the run directory, by default `<repo>/.codebase-analysis/runs/`, so the `workspace-write` sandbox is enough. Subagents inherit the session's sandbox and approval mode.
15
+
16
+ ## Dispatch with subagents
17
+
18
+ Codex's multi-agent tools start subagents (`multi_agent` feature, on by default). For each task from `cbe host next`:
19
+
20
+ - call `spawn_agent` with `task_name` set to the task's `codex_task_name` (`cbe_<run_tag>_<task>`), `message` set to the task's `dispatch_message`, and `fork_turns: "none"` so the subagent starts with a clean context.
21
+ - after spawning the whole batch, wait for the subagents (`wait_agent`), then `submit` each task. Submit every finished task before you call `next` again, because `next` counts a task as running until it is submitted.
22
+ - `next` also returns a re-ask of a rejected task. Spawn a new subagent for it like any other task.
23
+
24
+ Codex caps open subagent threads with `agents.max_concurrent_threads_per_session` (alias `agents.max_threads`) in `config.toml`; keep `--jobs` at or below it. `agents.default_subagent_model` sets the subagent model when the user wants a cheaper one.
25
+
26
+ If subagents are disabled, run each task with a separate non-interactive Codex process instead, for example `codex exec --json --sandbox workspace-write "<dispatch_message>"`; its `turn.completed` events carry `usage` for that process.
27
+
28
+ ## Exact usage
29
+
30
+ Each subagent thread has its own rollout file under `$CODEX_HOME/sessions` (default `~/.codex/sessions`). Its first line names the spawn (`agent_path` ends with the `task_name`), and its `token_count` events carry cumulative `total_token_usage` (input including cached input, cached input, output, reasoning output).
31
+
32
+ ```sh
33
+ cbe host import-usage --run-dir RUN --harness codex
34
+ cbe host cost --run-dir RUN --price INPUT,OUTPUT,CACHE_WRITE,CACHE_READ
35
+ ```
36
+
37
+ CBE stores uncached input and cached input separately, so the tokens are exact. CBE has no built-in OpenAI price table: pass the current API list price of the subagent model with `--price` (USD per million tokens), or report tokens only and say that dollars are unknown. `--price` applies to every row, so `--model` is not needed here. On a ChatGPT plan the run spends plan quota, not per-token charges. For the session total, quote `/status`.
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.5
2
+ Name: codebase-explorer
3
+ Version: 2.2.0
4
+ Summary: Source-grounded, navigable documentation for software repositories
5
+ Project-URL: Homepage, https://github.com/zlxdengtianhei/codebase-explorer
6
+ Project-URL: Documentation, https://github.com/zlxdengtianhei/codebase-explorer/blob/main/docs/running.md
7
+ Project-URL: Online example, https://zlxdengtianhei.github.io/codebase-explorer/?data=flask
8
+ Project-URL: Changelog, https://github.com/zlxdengtianhei/codebase-explorer/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/zlxdengtianhei/codebase-explorer/issues
10
+ Author: zlxdengtianhei
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: agent-skills,call-graph,claude-code,code-documentation,code-understanding,developer-tools,tree-sitter
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Documentation
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: <3.14,>=3.12
25
+ Requires-Dist: networkx>=3.2
26
+ Requires-Dist: tiktoken<1,>=0.9
27
+ Requires-Dist: tree-sitter-c==0.24.2
28
+ Requires-Dist: tree-sitter-cpp==0.23.4
29
+ Requires-Dist: tree-sitter-go==0.25.0
30
+ Requires-Dist: tree-sitter-java==0.23.5
31
+ Requires-Dist: tree-sitter-javascript==0.25.0
32
+ Requires-Dist: tree-sitter-python==0.25.0
33
+ Requires-Dist: tree-sitter-typescript==0.23.2
34
+ Requires-Dist: tree-sitter==0.26.0
35
+ Provides-Extra: graphs
36
+ Requires-Dist: grimp==3.17; extra == 'graphs'
37
+ Provides-Extra: languages
38
+ Requires-Dist: tree-sitter-c-sharp==0.23.5; extra == 'languages'
39
+ Requires-Dist: tree-sitter-php==0.25.1; extra == 'languages'
40
+ Requires-Dist: tree-sitter-ruby==0.23.1; extra == 'languages'
41
+ Requires-Dist: tree-sitter-rust==0.24.2; extra == 'languages'
42
+ Provides-Extra: languages-community
43
+ Requires-Dist: tree-sitter-kotlin==1.1.0; extra == 'languages-community'
44
+ Requires-Dist: tree-sitter-swift==0.7.4; extra == 'languages-community'
45
+ Description-Content-Type: text/markdown
46
+
47
+ <h1 align="center"><img src="https://raw.githubusercontent.com/zlxdengtianhei/codebase-explorer/v2.2.0/docs/media/logo.svg" width="40" height="40" alt="" align="absmiddle">&nbsp;Codebase Explorer</h1>
48
+ <p align="center">Codebase Explorer turns a source repository into a one-page module map and per-module explanations that people and coding agents can read and query.</p>
49
+ <p align="center"><b>English</b> | <a href="https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/README.zh-CN.md">简体中文</a></p>
50
+ <p align="center">
51
+ <a href="https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
52
+ <a href="https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/pyproject.toml"><img alt="Python 3.12 and 3.13" src="https://img.shields.io/badge/python-3.12%20%7C%203.13-blue.svg"></a>
53
+ <a href="https://github.com/zlxdengtianhei/codebase-explorer/actions/workflows/wheel-install.yml"><img alt="CI" src="https://github.com/zlxdengtianhei/codebase-explorer/actions/workflows/wheel-install.yml/badge.svg"></a>
54
+ </p>
55
+
56
+ https://github.com/user-attachments/assets/f0c3cc47-d0c2-4727-820e-65508c19408c
57
+
58
+ <p align="center">Two minutes, narrated: Flask from its source files to the module map, the eight top-level modules, one module page, then <code>cbe find</code> and <code>cbe source</code>.<br><a href="https://zlxdengtianhei.github.io/codebase-explorer/?data=flask">Try the interactive map</a> · <a href="https://zlxdengtianhei.github.io/codebase-explorer/film.html">The same video with its transcript (English and Chinese)</a></p>
59
+
60
+ A file tree shows where files are, not what each part is for. CBE (Codebase Explorer) reads a repository and writes what the tree lacks: one page that lists the whole module tree with a line on what each module is responsible for, and a page per module that explains each function and class and links to the exact source lines. You read it. A coding agent can look things up in it with three commands.
61
+
62
+ **To try it:** `uv tool install codebase-explorer` (Python 3.12 or 3.13). Then generate inside Claude Code on your own subscription, or from the command line with any OpenAI-compatible endpoint (you name the model with `--model`). The steps are in [Quickstart](#quickstart).
63
+
64
+ ## What you get
65
+
66
+ - **A one-page map.** `docs/INDEX.md` shows the whole module tree, one line per module. Its size is capped at the larger of 2,000 tokens and 3% of the source's token count.
67
+ - **A tree without gaps, the same every time.** A program builds it: units that call or import each other, sit close together and use similar words are grouped. The same input gives the same tree. There are no empty nodes and no duplicate modules.
68
+ - **A page per module.** Each unit has its signature, a source link, and an explanation written by a model. The explanations are written for people to read.
69
+ - **Facts from commands, not from the model.** Signatures, calls and source lines come from `cbe find`, `cbe query` and `cbe source`. `cbe source` prints from the frozen snapshot and checks each file's SHA-256 against the digest recorded at freeze time before printing anything.
70
+
71
+ The start of a real `docs/INDEX.md`, generated for flask (unedited):
72
+
73
+ ```markdown
74
+ ## Modules
75
+
76
+ - [**Request Serving Application Runtime**](nodes/request-serving-application-runtime.md) — Combines the concrete WSGI Flask application with request and response wrappers, templating, context lifecycle, and view-facing helpers needed to serve live requests. (136 units; `flask/app.py`, `helpers.py`, `wrappers.py`)
77
+ - [**Request Helper Utilities and Tests**](nodes/request-helper-utilities-and-tests.md) — Provides view-facing helpers for files, flashing, redirects, streaming, and URL building, plus proxy globals and signal definitions, with focused behavioral tests. (42 units; `helpers.py`, `test_helpers.py`, `flask/blueprints.py`)
78
+ - [**Helpers, globals, and signals**](nodes/helpers-globals-and-signals.md) — Provides view-facing helpers for sending files, flashing messages, redirecting, streaming, and URL building, plus proxy globals and Flask's blinker signal definitions. (26 units; `helpers.py`, `flask/blueprints.py`, `globals.py`)
79
+ - [**Helper behavior tests**](nodes/helper-behavior-tests.md) — Verifies aborter selection and dispatch, app redirect delegation, open_resource read modes and encoding, and context-free redirect fallback behavior. (11 units; `test_helpers.py`)
80
+ - [**File and URL tests**](nodes/file-and-url-tests.md) — Tests custom URL converters, send_file family behavior with path-like objects, stream_with_context lifetime, and url_for inside request contexts. (5 units; `test_helpers.py`, `test_converters.py`)
81
+ - [**WSGI Request Dispatch Core**](nodes/wsgi-request-dispatch-core.md) — Implements the WSGI-callable Flask class and its pipeline: request entry, URL-to-view matching, response finalization, error handler resolution, and test and async wiring. (35 units; `flask/app.py`, `test_async.py`, `sansio/app.py`)
82
+ ```
83
+
84
+ Full example: [flask](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/flask/docs/INDEX.md). More in [Examples and docs](#examples-and-docs).
85
+
86
+ ## Quickstart
87
+
88
+ CBE is on PyPI as `codebase-explorer`. It needs Python 3.12 or 3.13. There are two ways to run it. Both end in the same `docs/` folder. The usual one is A: your coding agent loads the skill and does the work on your own subscription. B is for scripts and batch runs.
89
+
90
+ **A. The usual way: inside your coding agent, on your own subscription.** The steps below use Claude Code; the skill makes its subagents write the explanations.
91
+
92
+ 1. Install CBE: `uv tool install codebase-explorer` (or `pipx install codebase-explorer`).
93
+ 2. Optional, for the call graph: `cbe graph setup` downloads Joern and a Java runtime into your user cache directory (about 1.9 GB; Linux x86_64 and macOS).
94
+ 3. In your project, install the skill: `cbe-install install --host claude-code`.
95
+ 4. Start Claude Code there and ask: "Use the codebase-explorer skill to generate documentation for this repository."
96
+ 5. The agent prints the planned file, token, module and task counts, runs the subagents, and verifies the result.
97
+ 6. Open `<run_dir>/docs/INDEX.md`. The agent reports `run_dir`.
98
+
99
+ Other agents load the same skill: `cbe-install install --host` takes `claude-code`, `opencode`, `pi`, `codex` and `dsh`. What has run end to end: Claude Code (see [What it costs](#what-it-costs)); OpenCode and Pi, once each on a 22-file sample repository (in the Pi run the tasks were handed to separate Pi sessions by a dispatch skill on our machine; Pi has no subagents of its own). `codex` and `dsh` install the skill, and we have not run them end to end. Details: [docs/running.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/running.md#generate-through-a-host-agent).
100
+
101
+ **B. For scripts and batch runs: from the command line, with any OpenAI-compatible endpoint.** There is no default model: you must pass `--model`.
102
+
103
+ 1. Install CBE as in step 1 above.
104
+ 2. Put the key in an environment variable: `export CBE_API_KEY=...`
105
+ 3. Optional: build the call graph (`cbe graph setup`, then `cbe graph build /abs/repo --output /abs/graph.json`).
106
+ 4. Generate. Paths must be absolute:
107
+
108
+ ```sh
109
+ cbe generate /abs/repo --model MODEL --base-url https://your-endpoint.example/v1 \
110
+ --api-key-env CBE_API_KEY --graph /abs/graph.json --run-dir /abs/run
111
+ ```
112
+
113
+ 5. Open `/abs/run/docs/INDEX.md`. Drop `--graph` to run without a call graph.
114
+
115
+ Then look things up. `RUN` is the absolute run directory, and the ID is the second column of the `find` output:
116
+
117
+ ```sh
118
+ cbe find --run-dir "$RUN" --term url_for
119
+ cbe query --run-dir "$RUN" --id 'src/flask/helpers.py::function::url_for::6511'
120
+ cbe source --run-dir "$RUN" --id 'src/flask/helpers.py::function::url_for::6511' --context 2
121
+ ```
122
+
123
+ Every other command and option is in [docs/reference.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/reference.md).
124
+
125
+ ## How it works
126
+
127
+ ```mermaid
128
+ flowchart LR
129
+ A["Freeze the source"] --> B["Tree-sitter splits it at syntax boundaries"]
130
+ B --> C["Joern builds call and import graph (optional)"]
131
+ C --> D["Model explains each code unit"]
132
+ D --> E["Program groups units into a module tree"]
133
+ E --> F["Model names each module"]
134
+ F --> G["Render INDEX.md, module pages, catalog.json"]
135
+ classDef program fill:#dff7f3,stroke:#0f9b8e,color:#0f1b2d
136
+ classDef model fill:#fff0cc,stroke:#c98a00,color:#0f1b2d
137
+ class A,B,C,E,G program
138
+ class D,F model
139
+ ```
140
+
141
+ Teal steps are ordinary code and make no model call. Amber steps are model calls.
142
+
143
+ - **Freeze.** CBE keeps a hashed copy of the source, so every line number and quote can be checked later.
144
+ - **Split.** Tree-sitter cuts each file at syntax boundaries. Every byte lands in some chunk.
145
+ - **Explain.** The model writes the explanations batch by batch. It names symbols by the short numbers in a list, so it cannot invent an ID. The program asks again only for the symbols the model skipped.
146
+ - **Check.** A second model reads one batch's source and checks its explanations against it: wrong behaviour, a wrong condition or error, or an explanation of the wrong symbol. It does not judge style. Findings are sent back for one rewrite. `--review` chooses how many batches are read: `none`; `sample` (the default: the largest batch, and every batch if that one has any finding); or `all`. On flask a sampled review was 14% of the run's input tokens; reading every batch adds about 80%. Where batches have many errors the rewrites cost more than the reading: on six examples whose sample had findings, reviewing every batch and rewriting the flagged ones added 51–176% to the run's input tokens and made its output tokens 4 to 10 times as large, because a flagged batch is written again in full. A clean sample leaves the other batches unread, so use `--review all` for a repository that matters. `RUN.md` says which batches were read and what was found. A rewrite after review, like any new run, can regroup the map: module pages and their names may change. Symbol IDs (`cbe find`, `cbe query`) depend only on the source, so link to code by ID, not by page name.
147
+ - **Group.** The program, not the model, builds the module tree from calls and imports, location, and wording. The same input gives the same tree.
148
+ - **Name.** The model gives each module a name, one line on what it is responsible for, and two or three sentences on how to read it. It cannot add, drop or move a node.
149
+ - **Render.** The program writes `docs/INDEX.md`, one page per module, `DEPENDENCIES.md` and `RUN.md`, and the `catalog.json` that `find`, `query` and `source` read.
150
+
151
+ ## Code graph
152
+
153
+ Without a graph, CBE still works. With one, the explanation tasks and the dependency view also get static import, call and control-flow evidence. The graph comes from [Joern](https://joern.io/), which needs Java 21 or newer. `cbe graph setup` downloads the pinned Joern and, if no suitable Java is found, a Java runtime into your user cache directory (about 1.9 GB in total). `cbe graph setup --check` downloads nothing and reports what is installed. `cbe graph build` then writes the graph file that `--graph` takes. It does not export dataflow unless you pass `--with-dataflow`, because a generation run does not read it and it was over half of the graph file on flask (23 of 41 MB). To install Joern by hand, see [docs/reference.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/reference.md#optional-graph-analyzers).
154
+
155
+ | Status | Languages | Conditions |
156
+ |---|---|---|
157
+ | Works on real repositories | C, C++, Python, JavaScript, TypeScript, Java, Go, Ruby | Python imports use Grimp (the `graphs` extra); JavaScript and TypeScript imports use dependency-cruiser (Node.js). Go calls across packages can stay unresolved. Ruby's dynamic dispatch can bind a call to a method of the same name on another class: CBE marks such calls ambiguous, and some wrong bindings remain. |
158
+ | Needs an extra tool | Rust, PHP | Rust needs `cargo` and a Cargo project layout. PHP needs `php` (7 or later). |
159
+ | Builds, calls partly resolved | C# | On a 55-file repository the graph builds (declarations, control flow, imports). Of its 2,322 calls, 689 resolve to one repository method and 394 to a set of overloads (Joern's C# frontend does not type arguments well enough to pick the overload); 246 point outside the repository and 993 stay unresolved. |
160
+ | Fails on real repositories | Kotlin | Joern 4.0.654 failed on a 146-file Kotlin repository. Two-file examples work, so small inputs may succeed. |
161
+ | Not tested | Swift, TSX | |
162
+
163
+ `cbe languages` prints the same status for each language as `call_graph`. Source parsing and chunking work for every language in the table whatever the call-graph status is. Tree-sitter grammars for 13 languages come with the default install and two extras. More on analyzers and graph options: [docs/reference.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/reference.md#optional-graph-analyzers).
164
+
165
+ ## What it costs
166
+
167
+ Measured on flask, tests included: 65 files, 125k tokens. Model: GLM-5.3-Flash, called through `cbe generate`. One run to completion.
168
+
169
+ | Measure | Reading |
170
+ |---|---|
171
+ | Prompt tokens | 3.2–3.4 times the source tokens |
172
+ | Output tokens | about 0.9 times the source tokens |
173
+ | Explanation text the model wrote | about 30% of the source tokens |
174
+ | Prompt tokens spent on re-asks after a rejected answer | about 22% (43% before the answer-format change; that earlier run also stopped midway on upstream rate limiting) |
175
+
176
+ These readings come from calls through an OpenAI-compatible gateway to GLM-5.3-Flash. CBE ships default settings (for example `reasoning_effort: low`) only for model names it knows. For any other model name, pass the settings you need with `--config`; [docs/running.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/running.md#api-configuration-keys) lists every key.
177
+
178
+ The host-agent path, measured once on flask's `src/` (24 files, about 75k tokens) with headless Claude Code (`claude -p`) and Sonnet subagents:
179
+
180
+ | Measure | Reading |
181
+ |---|---|
182
+ | Subagent tasks | 8: 4 explanation batches, 1 sampled review, 2 tree-naming tasks, 1 overview. All were accepted on the first answer |
183
+ | Wall clock | 293 seconds |
184
+ | `cbe host verify` | all 15 checks passed |
185
+ | Tokens | not collected for this run |
186
+
187
+ Each table is one repository and one run. A host-agent run uses your subscription instead of an API key. Building the graph makes no model call. An older cost table for repositories up to 1.7 million tokens is in [docs/running.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/running.md#what-a-run-costs-the-earlier-table); it was measured before the answer-format change, so do not compare it with the table above.
188
+
189
+ ## How well does it work
190
+
191
+ What we measured, and what it shows. Everything here has conditions; the files in [`evaluation/tree/results/`](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/evaluation/tree/results/) hold the tables.
192
+
193
+ The page you read first got smaller. Size of that page in `o200k_base` tokens, on three full runs (the earlier version's tree is in the "before" column):
194
+
195
+ | Repository | Before | Now | Empty tree nodes before / now |
196
+ |---|---:|---:|---:|
197
+ | flask | 16,076 | 3,078 | 22 / 0 |
198
+ | ruby_llm | 15,938 | 2,074 | 8 / 0 |
199
+ | gson | 12,643 | 2,514 | 16 / 0 |
200
+
201
+ - **Tree structure.** The new trees have no empty nodes and no duplicate modules on the three repositories above. The earlier trees had 22, 8 and 16 empty nodes.
202
+ - **Call labels.** In seven repositories we took 10 edges of each status and checked them back against the source. For example, all 307 "unresolved" calls in cJSON were macros; they are no longer counted as calls. In fmt, "external" calls fell from 2,748 to 22.
203
+ - **Does the tree help find the code to read?** We took 30 real commits from each of five repositories and asked three models which three modules to look at for the change. The new tree and the earlier tree could not be told apart. Against a plain directory listing, the module tree made no clear difference in repositories whose directories already have levels. It narrowed the reading only where directories are flat (flask, fmt): the three chosen modules held about 40% of the source and about 0.75–0.8 of the changed lines.
204
+ - **How far to trust that ruler.** It is noisy: asked the same question again, the model gave an identical answer in only 9 to 23 of 30 cases.
205
+ - **Earlier question-answering rounds** (CBE before the program-built tree). On flask and pytest (48 questions each), an agent with CBE documents and commands scored no differently from a source-only agent, and rarely ran the commands. One exploratory reading on curl scored higher with CBE (+5.60 rubric points, interval [+0.90, +10.82]) and comes with caveats listed in [evaluation/README.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/evaluation/README.md).
206
+
207
+ What we do not claim: that grouping by function lets an agent locate code more accurately than a directory tree does, or that CBE improves an agent's answers. The measurements above do not show either.
208
+
209
+ ## Known limitations
210
+
211
+ - The call graph needs Joern and Java 21 or newer. `cbe graph setup` downloads both (about 1.9 GB).
212
+ - C# calls to overloaded methods resolve only to the set of overloads, and about 43% of the calls in the one real repository measured stay unresolved. Kotlin graphs fail on real repositories under the pinned Joern version; two-file examples work.
213
+ - Ruby's dynamic dispatch can bind a call to the wrong class's method. CBE marks many of these as ambiguous, and some wrong bindings remain.
214
+ - C and C++ files are not preprocessed. A header with many macros is cut into coarse chunks, and a macro can be taken for a function name.
215
+ - A model writes the explanations. `cbe host verify` passing shows that the structure and references are consistent. It does not show that an explanation is correct. Check explanations against the source (`cbe source`).
216
+ - There are no incremental updates: when the source changes, generate again.
217
+
218
+ ## Examples and docs
219
+
220
+ - Generated documents: [flask](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/flask/docs/INDEX.md), [cJSON](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/cjson/), [fmt](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/fmt/), [gson](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/gson/), [ruby_llm](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/ruby_llm/), [tsdown](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/tsdown/), [polyglot](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/examples/polyglot/). Each example's README names the CBE commit that generated it; most were generated by an earlier version.
221
+ - [docs/reference.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/reference.md): install options, languages, graph analyzers, `find`, `query`, `source`, named declaration coverage.
222
+ - [docs/running.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/running.md): host-agent and API runs, the run directory, resume and verify, cost details, troubleshooting.
223
+ - [docs/videos.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/docs/videos.md): walkthrough videos.
224
+ - [evaluation/README.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/evaluation/README.md) and [CHANGELOG.md](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/CHANGELOG.md).
225
+
226
+ ## Development and license
227
+
228
+ ```sh
229
+ uv sync --python 3.13 --group dev
230
+ uv run pytest -q
231
+ ```
232
+
233
+ Tests that need a real analyzer need that analyzer configured. The product license is [MIT](https://github.com/zlxdengtianhei/codebase-explorer/blob/v2.2.0/LICENSE); external analyzers and grammar packages keep their own licenses.
@@ -0,0 +1,47 @@
1
+ cbe/__init__.py,sha256=qc3m9kNlweWH6G9_SDEe0QnfnV3L-Dd52kA0OasP_Ms,290
2
+ cbe/__main__.py,sha256=8-_-efvyRid5xcqhfdSQSWow-LA26u8WBQNuEp5GXYM,82
3
+ cbe/aggregation.py,sha256=6c2liFQsFRA0Z6cX3qxjz54T3XCG21r0vaJp5AM6Ug8,9649
4
+ cbe/api_completion.py,sha256=FLWk8AvCKHG-hTrDdmS4xRp0SBZG_ILMNozyxqFELoA,18329
5
+ cbe/batching.py,sha256=Hy1A6vzA__Gp778GT9a4il1xdM_jIRq_7mGuHh8d9GY,12203
6
+ cbe/catalog_query.py,sha256=MPigHwEBaIozuGoV6XD7LKnx0RCMT7KitKEUtmxIR3g,20965
7
+ cbe/checks.py,sha256=M6BL-hlvVAQND-MNpzahgbCa9LX4PwQUO2KVuF1NtJY,18583
8
+ cbe/cli.py,sha256=UwImWbOnM3SSz85F-6JyR_40WxAg3IYBzHzSEMXv-MM,26935
9
+ cbe/concrete_facts.py,sha256=ryAdCCq_SLpg8kn-Fk3ASajm2OZahR96K-1OWwH2PSs,13346
10
+ cbe/declarations.py,sha256=WXQ_JCIOzyqrL0guEIvP7LlJNClXBkip48dO6vUXi-0,25869
11
+ cbe/docs.py,sha256=8SodOo0MuxRqsv3TBoDEn75ACPT3T33RQW23Hj4erc0,49197
12
+ cbe/generate.py,sha256=V3F6FtW7x7SHn-AXruCOYr1mtnADvmElcORGq6zUNTc,16227
13
+ cbe/grammars.py,sha256=DD-ZQYsNH92a29N7kGvNW1fD02LDqaGp59rzQnxc9QA,27404
14
+ cbe/graph.py,sha256=MpweV1IiYhLn_n6W2-wdOAgdLIpLpGWRcCLnvFIwkt0,41577
15
+ cbe/grounding.py,sha256=WTeChevOjIQ1ymzOiEhlreSVexR71HBTQKRn4A0FDaY,2325
16
+ cbe/host_run.py,sha256=Q9SlNmLbZkLgJ5V1vdoSf1snElXGVRxRLgd-PUn18Kw,95520
17
+ cbe/model_settings.py,sha256=lxzZrh_X-1asxDLU4DlM4Li8cw5YoJkiWTZjiOwtxE8,3330
18
+ cbe/projection.py,sha256=keFsd_LncRerXMx_HVNCdGPV5g51nwkZtNrx5xsGbxQ,15418
19
+ cbe/prompts.py,sha256=b_Ga0JF-0W9vEZhuoom-_7RRwOk5yHwj1WQ3A1P8SBM,21147
20
+ cbe/records.py,sha256=n2vEV_Dg14lFUxYqxXu9wi4dIWo9UZQvpaJzQ56nD30,10289
21
+ cbe/skeleton.py,sha256=BGpfyX27HCtoAZY31FSiSl1ss-AiUTZP3_YylzJPhR8,19839
22
+ cbe/source_context.py,sha256=RswrGr3yQDdQgtFuuednOqnqsBS0IfZP-IZ92R5I02o,27569
23
+ cbe/symbols.py,sha256=mRb_GkiXtsXUI-QIt6UhRgzEMCVIGRmz4QBqtbhkXaE,6701
24
+ cbe/token_budget.py,sha256=Up1BV-GjMLtAbmxy40n1G2csoB_jJkd0_dzMlAZM-ds,2909
25
+ cbe/treename.py,sha256=Axok0dZ5GQvdLuApDyvkruNO2uR45bwYYARLzC-ZhAU,19283
26
+ cbe/usage.py,sha256=i-tMmQMx6c730_J5CEXNzUfDqre2o_nGrGPVsDRVAwU,16840
27
+ cbe/data/LICENSE.tiktoken,sha256=pFsSpWW86yXO2vbYQXh0E2UNGHN1w2zpbdR1427ihzw,1597
28
+ cbe/data/o200k_base.tiktoken,sha256=RGqVOMtsNI41FhINfAiwn1fDZJXirP_-WaW_iwz7Gi0,3613922
29
+ cbe/graph_backends/__init__.py,sha256=-RSi_FvoGKpcSQh_8Tc8MBLn8A-3fVdOT72H8rN6CMA,1058
30
+ cbe/graph_backends/_calls.py,sha256=BFVp3eaSoaDpd0PHuOdTYvY4Zxo9GexauUW7goHOfcE,14408
31
+ cbe/graph_backends/_paths.py,sha256=C985lCr7W3i4802hXKp2ESSP7apkMksrEZj1ixLMwRo,1219
32
+ cbe/graph_backends/identity.py,sha256=XQcXkUME31rWU8qTFN33aT5NmPho6k4PyKyJt6aSHJ4,4060
33
+ cbe/graph_backends/imports.py,sha256=DEqGjI8WIznVBTYVDqsxs4XjV5oo8kHPifYQQH_7kKY,11521
34
+ cbe/graph_backends/joern.py,sha256=YShSpjTH_4str1-NEMJE17s8ZWFchWnKIocVRMdOcWo,47623
35
+ cbe/graph_backends/resolution.py,sha256=zv1TXPMbQ2s3728INtmPUWelPMHXzw5BU_Gpv1aG4W0,15312
36
+ cbe/graph_backends/toolchain.py,sha256=Be0qsgQMpbIhILt9FwiRTeBTL9EYSpoJSWzNV-9byh8,17191
37
+ cbe_install/__init__.py,sha256=GvoToT2bT_zwHevuNoGlajFB-4wlCBLOpp3evhhVCzk,376
38
+ cbe_install/cli.py,sha256=q2w7fSetH_pIMWXJxdhx0pZG_H3L5WEgqZGSPqFBihI,19265
39
+ cbe_install/resources/agents/cbe-writer.md,sha256=1prvHYeNh2U7566uizF_cHlw-rPsCt7hI7Ve-5EGwhA,1669
40
+ cbe_install/resources/codebase-explorer/SKILL.md,sha256=ExNkhthvJAb9jUtA-p7D8mNMKJUUkN0tWdCUEs1cDv0,16242
41
+ cbe_install/resources/codebase-explorer/references/claude-code.md,sha256=mZjSnATdeI9o2V0wA5Cbf1BZsQ6lbIqWq3vbvsHP0BA,5279
42
+ cbe_install/resources/codebase-explorer/references/codex.md,sha256=jxV5nmEXF_6J-thhvcCGCskaBb9UOIkZDqY_fQSxU2g,2995
43
+ codebase_explorer-2.2.0.dist-info/METADATA,sha256=_x2HoVWYpPcdodf9qqsWOFWDZXLrYMduvHoyX5zgAIk,22322
44
+ codebase_explorer-2.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
45
+ codebase_explorer-2.2.0.dist-info/entry_points.txt,sha256=mP4zE52utWTvXhyj40R1J9gM0Z3_rbSdRqqR6kyTINA,72
46
+ codebase_explorer-2.2.0.dist-info/licenses/LICENSE,sha256=irhLq6ragBExqX5PRg2SFNP2wVWEujnP_3k81SN9bDs,1106
47
+ codebase_explorer-2.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ cbe = cbe.cli:main
3
+ cbe-install = cbe_install.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 zlxdengtianhei and Codebase Explorer 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.