java-codebase-rag 0.6.7__py3-none-any.whl → 0.8.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 (33) hide show
  1. ast_java.py +8 -3
  2. build_ast_graph.py +72 -16
  3. graph_enrich.py +2 -1
  4. graph_types.py +133 -0
  5. java_codebase_rag/_fdlimit.py +10 -2
  6. java_codebase_rag/_stdio.py +32 -0
  7. java_codebase_rag/cli.py +135 -24
  8. java_codebase_rag/config.py +128 -9
  9. java_codebase_rag/install_data/agents/explorer-rag-cli.md +291 -0
  10. java_codebase_rag/install_data/agents/explorer-rag-enhanced.md +8 -8
  11. java_codebase_rag/install_data/skills/explore-codebase/SKILL.md +8 -8
  12. java_codebase_rag/install_data/skills/explore-codebase-cli/SKILL.md +251 -0
  13. java_codebase_rag/installer.py +438 -103
  14. java_codebase_rag/jrag.py +4300 -0
  15. java_codebase_rag/jrag_envelope.py +1085 -0
  16. java_codebase_rag/jrag_hints.py +204 -0
  17. java_codebase_rag/jrag_render.py +688 -0
  18. java_codebase_rag/pipeline.py +20 -0
  19. {java_codebase_rag-0.6.7.dist-info → java_codebase_rag-0.8.0.dist-info}/METADATA +137 -94
  20. java_codebase_rag-0.8.0.dist-info/RECORD +43 -0
  21. {java_codebase_rag-0.6.7.dist-info → java_codebase_rag-0.8.0.dist-info}/WHEEL +1 -1
  22. {java_codebase_rag-0.6.7.dist-info → java_codebase_rag-0.8.0.dist-info}/entry_points.txt +1 -0
  23. {java_codebase_rag-0.6.7.dist-info → java_codebase_rag-0.8.0.dist-info}/top_level.txt +2 -0
  24. java_index_flow_lancedb.py +34 -19
  25. java_ontology.py +12 -0
  26. ladybug_queries.py +233 -52
  27. mcp_hints.py +6 -6
  28. mcp_v2.py +205 -617
  29. resolve_service.py +649 -0
  30. search_lancedb.py +10 -1
  31. server.py +20 -12
  32. java_codebase_rag-0.6.7.dist-info/RECORD +0 -34
  33. {java_codebase_rag-0.6.7.dist-info → java_codebase_rag-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -180,6 +180,26 @@ def _maybe_run_serialized_optimize(
180
180
  print(f"java-codebase-rag: optimize failed: {exc}", file=sys.stderr)
181
181
 
182
182
 
183
+ def is_cocoindex_preflight_blocker(proc: subprocess.CompletedProcess[str]) -> bool:
184
+ """True when ``run_cocoindex_update`` returned a pre-spawn stub, not a real cocoindex run.
185
+
186
+ The stubs are emitted by ``_run_cocoindex_update_impl`` just below:
187
+ * returncode 127, args=[exe] -> cocoindex binary not installed (graph-only install,
188
+ e.g. macOS Intel where the vector extra is gated off).
189
+ * returncode 126, args=[] -> ``java_index_flow_lancedb.py`` missing from the bundle.
190
+ A real cocoindex run has ``args`` = the full command list (length > 1), so the
191
+ ``len(args) <= 1`` guard distinguishes a stub from a genuine non-zero exit. This is the
192
+ single authoritative detector — ``cli.py`` and ``installer.py`` both call it so the
193
+ "treat as skip, not failure" decision stays aligned with the stub shapes here.
194
+ """
195
+ return bool(proc.returncode in (126, 127) and len(getattr(proc, "args", ()) or ()) <= 1)
196
+
197
+
198
+ def is_graph_preflight_blocker(proc: subprocess.CompletedProcess[str]) -> bool:
199
+ """True when ``run_build_ast_graph`` returned a pre-spawn stub (builder missing)."""
200
+ return bool(proc.returncode in (126, 127) and len(getattr(proc, "args", ()) or ()) <= 1)
201
+
202
+
183
203
  def _run_cocoindex_update_impl(
184
204
  env: dict[str, str],
185
205
  *,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: java-codebase-rag
3
- Version: 0.6.7
3
+ Version: 0.8.0
4
4
  Summary: MCP server for semantic + structural search over Java codebases
5
5
  Author: HumanBean17
6
6
  License-Expression: MIT
@@ -15,12 +15,15 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Operating System :: MacOS :: MacOS X
20
+ Classifier: Operating System :: Microsoft :: Windows
18
21
  Requires-Python: >=3.11
19
22
  Description-Content-Type: text/markdown
20
23
  License-File: LICENSE
21
- Requires-Dist: cocoindex[lancedb]<2,>=1.0.7
24
+ Requires-Dist: cocoindex[lancedb]<2,>=1.0.7; sys_platform != "darwin" or platform_machine != "x86_64"
22
25
  Requires-Dist: ladybug<0.18,>=0.17.1
23
- Requires-Dist: lancedb<0.31,>=0.25.3
26
+ Requires-Dist: lancedb<0.31,>=0.25.3; sys_platform != "darwin" or platform_machine != "x86_64"
24
27
  Requires-Dist: mcp<2,>=1.27.0
25
28
  Requires-Dist: numpy<2.5,>=1.26.4
26
29
  Requires-Dist: pathspec<2,>=1.0.4
@@ -29,7 +32,7 @@ Requires-Dist: pydantic<3,>=2.0
29
32
  Requires-Dist: PyYAML<7,>=6.0.3
30
33
  Requires-Dist: questionary<3,>=2.0
31
34
  Requires-Dist: rich<15,>=14
32
- Requires-Dist: sentence-transformers<6,>=5.4.0
35
+ Requires-Dist: sentence-transformers<6,>=5.4.0; sys_platform != "darwin" or platform_machine != "x86_64"
33
36
  Requires-Dist: tree-sitter<0.26,>=0.25.2
34
37
  Requires-Dist: tree-sitter-java<0.24,>=0.23.5
35
38
  Requires-Dist: unidiff<1,>=0.7.3
@@ -42,9 +45,9 @@ Dynamic: license-file
42
45
 
43
46
  # java-codebase-rag
44
47
 
45
- A graph-native code intelligence layer for Java microservice estates, exposed to LLM agents via the **Model Context Protocol (MCP)**.
48
+ A graph-native code intelligence layer for Java microservice estates usable as an **MCP server** or a **CLI** (`jrag`), two surfaces over the same graph.
46
49
 
47
- The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **LadybugDB** (graph) alongside a **LanceDB** vector index (chunks), and exposes a deliberately small MCP surface **five tools**: `search`, `find`, `describe`, `neighbors`, `resolve` — that collapse onto three primitive agent operations: **locate**, **inspect**, **walk**.
50
+ The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **LadybugDB** (graph) alongside a **LanceDB** vector index (chunks), and exposes two agent surfaces, picked at install time (`java-codebase-rag install --surface mcp|cli`): the **MCP** surface ships five tools `search`, `find`, `describe`, `neighbors`, `resolve` — over stdio; the **CLI** surface ships `jrag`, one command per engineering intent. Both collapse onto three primitive operations: **locate**, **inspect**, **walk**.
48
51
 
49
52
  > **What this MCP is:** a **GPS for code navigation**, not a reasoning engine.
50
53
  > Agents use a simple loop:
@@ -73,7 +76,7 @@ Generic code-search tools (grep, ctags, vector-only RAG) hit a ceiling on real J
73
76
 
74
77
  - **Brownfield annotations as a first-class override.** Real Java estates have hand-rolled HTTP clients, dynamic topic names, reflection-heavy routing. `@CodebaseHttpRoute`, `@CodebaseAsyncRoute`, `@CodebaseHttpClient`, and `@CodebaseProducer` let you pin the truth in source. They have **exclusive priority** — when a symbol is annotated, framework-convention inference is skipped entirely. You get a correct graph on legacy code without rewriting it.
75
78
 
76
- The rest of this README is the install, walkthrough, and tool cheat sheet for putting that to work.
79
+ The rest of this README is the install, the tool/command orientation, and the reference for putting that to work.
77
80
 
78
81
  ---
79
82
 
@@ -83,8 +86,8 @@ The rest of this README is the install, walkthrough, and tool cheat sheet for pu
83
86
  pip install java-codebase-rag
84
87
  ```
85
88
 
86
- Python **3.11+** required. After install, `java-codebase-rag --help` should print the CLI groups.
87
- The package includes the CocoIndex lifecycle dependency used by `init`, `increment`, `reprocess`, and `erase`.
89
+ Python **3.11+** required, on **Linux, macOS, and Windows**. On Linux, Windows, and **Apple Silicon** Macs every native dependency (LanceDB, LadybugDB/kuzu, CocoIndex) ships a wheel and you get the full semantic + graph search. **Intel Macs (x86_64) install graph-only**: PyTorch ≥2.3 and LanceDB ≥0.26 dropped macOS Intel wheels, so the vector stack is auto-excluded via PEP 508 markers — `pip install java-codebase-rag` works out of the box, the graph layer (`find` / `describe` / `neighbors` / `resolve`) is fully usable, and the `search` (semantic) tool reports it is unavailable rather than failing. After install, `java-codebase-rag --help` should print the CLI groups.
90
+ The package includes the CocoIndex lifecycle dependency used by `init`, `increment`, `reprocess`, and `erase` on platforms that have it (it is absent on Intel Mac).
88
91
 
89
92
  ### Interactive setup (recommended)
90
93
 
@@ -117,89 +120,11 @@ If you prefer manual configuration, see [`docs/JAVA-CODEBASE-RAG-CLI.md`](./docs
117
120
 
118
121
  ---
119
122
 
120
- ## 5-minute walkthrough index this repo's bank-chat fixture
123
+ ## Tools & commands at a glance
121
124
 
122
- This repo ships a small multi-module Spring fixture under [`tests/bank-chat-system/`](./tests/bank-chat-system/) (`chat-core` + `chat-assign`) that the test suite uses for calibration. You can index it and confirm the install works end-to-end in under five minutes — no agent host required.
125
+ Pick a surface once at install time `java-codebase-rag install --surface mcp|cli` (default `mcp`). Both surfaces walk the same LanceDB vectors + LadybugDB graph.
123
126
 
124
- ```bash
125
- # 1. Clone the repo to get the fixture (the published package doesn't include tests/)
126
- git clone https://github.com/HumanBean17/java-codebase-rag
127
- cd java-codebase-rag
128
-
129
- # 2. Build the index (Lance vectors + LadybugDB graph). First run downloads the
130
- # embedding model (~90 MB) and takes ~30-60s on the fixture.
131
- java-codebase-rag init --source-root tests/bank-chat-system --index-dir /tmp/bank-chat-index
132
-
133
- # 3. Inspect what landed (resolved config, edge counts, ontology version)
134
- java-codebase-rag meta --source-root tests/bank-chat-system --index-dir /tmp/bank-chat-index
135
- ```
136
-
137
- Smoke-test the index with two checks (`search_lancedb` ships with the package):
138
-
139
- ```bash
140
- # Vector search — proves the LanceDB side works
141
- JAVA_CODEBASE_RAG_INDEX_DIR=/tmp/bank-chat-index \
142
- python -m search_lancedb "chat ingress controller" --table java --limit 3
143
-
144
- # Vector + graph expansion — proves LadybugDB is wired in
145
- JAVA_CODEBASE_RAG_INDEX_DIR=/tmp/bank-chat-index \
146
- python -m search_lancedb "chat ingress controller" --table java --limit 3 \
147
- --graph-expand --expand-depth 2
148
- ```
149
-
150
- If vector hits come back and graph expansion adds neighbor symbols, the install works end-to-end. Wire it into your agent next — the five MCP tools (`search`, `find`, `describe`, `neighbors`, `resolve`) are reachable over stdio.
151
-
152
- ---
153
-
154
- ## Wire into an MCP host
155
-
156
- > **Quick setup:** Run `java-codebase-rag install` from your Java project root. The interactive wizard handles MCP registration, skill deployment, and configuration for Claude Code, Qwen Code, and GigaCode in one step.
157
-
158
- ### Claude Code (manual)
159
-
160
- With the package installed, the console script `java-codebase-rag-mcp` is on your `PATH`. Register it project-scoped:
161
-
162
- ```bash
163
- claude mcp add --transport stdio java-codebase-rag -- java-codebase-rag-mcp
164
- ```
165
-
166
- **Zero-env-var configuration:** The tool automatically walks up the directory tree to find `.java-codebase-rag.yml`, so you don't need to set `JAVA_CODEBASE_RAG_SOURCE_ROOT` when working from within a project. Just place the config file at your project root and the tool will find it. See [`mcp.json.example`](./mcp.json.example) for the minimal configuration.
167
-
168
- If you need to override defaults, you can set env vars (`JAVA_CODEBASE_RAG_INDEX_DIR`, `JAVA_CODEBASE_RAG_SOURCE_ROOT`, `SBERT_MODEL`, …) in `.mcp.json` or your shell profile. For a full configuration template, see [`mcp.json.example`](./mcp.json.example). Official docs: [Claude Code settings](https://docs.anthropic.com/en/docs/claude-code/settings).
169
-
170
- ### Claude Desktop
171
-
172
- Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`) and add under `mcpServers`:
173
-
174
- ```json
175
- {
176
- "mcpServers": {
177
- "java-codebase-rag": {
178
- "command": "java-codebase-rag-mcp",
179
- "env": {
180
- "JAVA_CODEBASE_RAG_INDEX_DIR": "/ABSOLUTE/PATH/TO/.java-codebase-rag",
181
- "JAVA_CODEBASE_RAG_SOURCE_ROOT": "/ABSOLUTE/PATH/TO/your-java-project"
182
- }
183
- }
184
- }
185
- }
186
- ```
187
-
188
- See [`mcp.json.example`](./mcp.json.example) for the same shape in `.mcp.json` (Claude Code project-scoped) form.
189
-
190
- ### Driving the MCP from an agent
191
-
192
- Pick **one** of two options (not both — they cover the same navigation intents):
193
-
194
- 1. **[`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md)** (recommended for most) — standalone MCP operating manual. Copy-paste the `BEGIN`/`END` block into your project's `QWEN.md`, `CLAUDE.md`, or `AGENTS.md`. Contains: five-tool reference, `NodeFilter` / edge taxonomy, ontology glossary, recovery playbook, and navigation patterns. Self-contained — no external file dependencies.
195
-
196
- 2. **[`/explore-codebase`](./skills/explore-codebase/SKILL.md)** (for hosts with skill discovery) — single self-contained skill with the complete operating manual. If your MCP host supports skill discovery (Claude Code, Qwen Code, Cursor), load `/explore-codebase` to get the full tool reference, edge taxonomy, decision tree, and recovery playbook in one shot.
197
-
198
- Also: **[`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHECKLIST.md)** — 7-phase agent-driven verification you run after indexing your real project.
199
-
200
- ---
201
-
202
- ## The five tools, at a glance
127
+ **MCP surface — five tools over stdio**
203
128
 
204
129
  | Tool | Purpose | Required args |
205
130
  |---|---|---|
@@ -211,9 +136,63 @@ Also: **[`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHE
211
136
 
212
137
  Full schemas, `NodeFilter` / `EdgeFilter` semantics, and the hints contract live in [`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md). Edge types and traversal directions are listed in [`docs/EDGE-NAVIGATION.md`](./docs/EDGE-NAVIGATION.md).
213
138
 
139
+ **CLI surface — `jrag`, one command per engineering intent**
140
+
141
+ ```bash
142
+ # Orientation
143
+ jrag status # index health (ontology version, freshness, counts)
144
+ jrag microservices # microservices with resolved type counts
145
+ jrag map # counts per kind per service/module
146
+ jrag map --module # group by module instead
147
+ jrag conventions # dominant roles + framework tallies
148
+ jrag overview chat-core # bundle for a microservice
149
+ jrag overview /chat/assign # route flow (inbound callers + outbound CALLS)
150
+ jrag overview banking.chat # topic producers + consumers
151
+ jrag overview chat-core --as microservice # override auto-detection
152
+
153
+ # Locate
154
+ jrag find ChatService # exact name/FQN lookup (symbols)
155
+ jrag find --role CONTROLLER # filter mode (NodeFilter flags)
156
+ jrag inspect ChatService # full node details + edge_summary
157
+ jrag outline src/main/.../Foo.java # all symbols declared in a file
158
+ jrag imports src/main/.../Foo.java # imports resolved to graph nodes
159
+
160
+ # Listings
161
+ jrag http-routes # HTTP routes
162
+ jrag http-clients # HTTP clients (Feign / RestTemplate / WebClient)
163
+ jrag producers # async message producers (Kafka / StreamBridge)
164
+ jrag topics # message topics grouped by producer
165
+ jrag jobs # scheduled tasks (@Scheduled)
166
+ jrag listeners # message listeners (@KafkaListener etc.)
167
+ jrag entities # JPA entities
168
+
169
+ # Traversals (all resolve-first)
170
+ jrag callers ChatService#assign(Request) # who calls me?
171
+ jrag callees ChatService#assign(Request) # what do I call?
172
+ jrag hierarchy AbstractBase # type tree (parents + children)
173
+ jrag implementations PaymentProcessor # classes implementing an interface
174
+ jrag subclasses AbstractRepository # classes extending a type
175
+ jrag overrides Impl#run() # methods this overrides (dispatch UP)
176
+ jrag overridden-by Iface#run() # methods overriding this (dispatch DOWN)
177
+ jrag dependents PaymentGateway # who injects this type?
178
+ jrag dependencies ChatService # types this injects
179
+ jrag impact PaymentGateway # fleet-wide blast radius
180
+ jrag decompose ChatIngressController#assign # role-waterfall flow
181
+ jrag flow /chat/assign # request flow through a route
182
+ jrag connection chat-core # cross-service connections
183
+
184
+ # Semantic search
185
+ jrag search "assign a chat agent" # semantic over Lance (java table)
186
+ jrag search "kafka" --table all # java + sql + yaml tables
187
+ jrag search "audit" --hybrid # vector + keyword hybrid
188
+ jrag search "audit" --offset 5 # paginated
189
+ ```
190
+
191
+ Every `<query>` command takes human-readable identifiers (FQN / simple name / route path / topic) — never raw node IDs. Output contract, flags, and the resolve-first rule are in [`jrag` — agent CLI](#jrag--agent-cli) below.
192
+
214
193
  ### Three-layer architecture
215
194
 
216
- Layer 1 (storage) → Layer 2 (5 MCP tools) → Layer 3 (skill). The [`/explore-codebase`](./skills/explore-codebase/SKILL.md) skill provides the full operating manual for Layer 2. See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
195
+ Layer 1 (storage) → Layer 2 (5 MCP tools **or** the `jrag` CLI) → Layer 3 (skill). The MCP-surface skill **[`/explore-codebase`](./skills/explore-codebase/SKILL.md)** documents the 5-tool MCP; the CLI-surface skill **[`/explore-codebase-cli`](./skills/explore-codebase-cli/SKILL.md)** documents the `jrag` CLI (PR-JRAG-5). See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
217
196
 
218
197
  ---
219
198
 
@@ -249,6 +228,71 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
249
228
 
250
229
  ---
251
230
 
231
+ ## jrag — agent CLI
232
+
233
+ `jrag` is a separate console script (alongside `java-codebase-rag`) built for AI
234
+ coding agents. It gives the agent **one command per engineering intent** and
235
+ takes human-readable identifiers (FQN / simple name / route path / topic) —
236
+ never raw node IDs. Every `<query>` command resolves the identifier via
237
+ `resolve_v2` as the first step; on `many` it returns candidates and stops, on
238
+ `none` it returns `not_found`. Auto-pick is forbidden.
239
+
240
+ The default output is compact text (a deliberate divergence from the operator
241
+ CLI's TTY heuristic — `jrag` is agent-facing/non-TTY). `--format json` emits the
242
+ shared envelope verbatim. Every command emits the same envelope shape:
243
+
244
+ ```json
245
+ {
246
+ "status": "ok",
247
+ "nodes": {"com.example.Foo": {"kind": "symbol", "fqn": "com.example.Foo"}},
248
+ "edges": [{"edge_type": "CALLS", "confidence": 0.9, "target": "com.example.Bar#baz()"}],
249
+ "root": "com.example.Foo",
250
+ "agent_next_actions": ["jrag callees com.example.Foo#bar()"],
251
+ "truncated": false
252
+ }
253
+ ```
254
+
255
+ No raw graph node id ever appears on either surface: `nodes` is keyed by each
256
+ node's natural identifier (FQN for symbols, `METHOD path` for routes,
257
+ `member_fqn->target` for clients, `topic:<name>` for topics), `root` is the
258
+ root's natural identifier, and each edge carries `target` (the referenced node's
259
+ identifier) instead of a graph id. The agent reuses these identifiers directly
260
+ as the next command's `<query>` — there is nothing else to pass.
261
+
262
+ `agent_next_actions` carries up to 5 contextual next-step hints (e.g. after
263
+ `inspect`, the agent sees `jrag callers <fqn>`, `jrag callees <fqn>`, etc. for
264
+ the edges the root actually has). Omitted from JSON when empty.
265
+
266
+ The full command catalog lives in [Tools & commands at a glance](#tools--commands-at-a-glance).
267
+
268
+ ### Flags
269
+
270
+ | Flag | Scope | Effect |
271
+ |------|-------|--------|
272
+ | `--format text\|json` | all | output format (default: text) |
273
+ | `--service <name>` | listings/traversals | filter by microservice |
274
+ | `--module <name>` | listings/traversals | filter by module |
275
+ | `--limit <n>` | listings/traversals | cap results (default 20; `limit+1` fetch detects truncation) |
276
+ | `--offset <n>` | `find`, `search` only | paginate (other commands reject it) |
277
+ | `--kind symbol\|route\|client\|producer` | `<query>` commands | resolve hint |
278
+ | `--java-kind`, `--role`, `--fqn-contains` | `<query>` commands | client-side post-filters |
279
+ | `--index-dir <path>` | all | override index directory |
280
+
281
+ `--offset` is intentionally NOT a global flag: only `find` and `search` route
282
+ through backends that accept it. Every other command rejects it.
283
+
284
+ A missing or stale index produces an actionable `status: error` envelope (exit
285
+ 2) rather than a traceback:
286
+
287
+ ```
288
+ error: No index at /path/to/code_graph.lbug. Run: java-codebase-rag init --source-root <root>
289
+ ```
290
+
291
+ See [`plans/active/PLAN-JRAG-CLI.md`](./plans/active/PLAN-JRAG-CLI.md) for the
292
+ full design and per-PR breakdown.
293
+
294
+ ---
295
+
252
296
  ## Further reading
253
297
 
254
298
  | Document | What's in it |
@@ -258,10 +302,9 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
258
302
  | [`docs/CONFIGURATION.md`](./docs/CONFIGURATION.md) | Environment variables, project YAML, graph ontology, brownfield overrides, ignore patterns. |
259
303
  | [`docs/JAVA-CODEBASE-RAG-CLI.md`](./docs/JAVA-CODEBASE-RAG-CLI.md) | CLI operator playbook: workflows, exit codes, env alignment. |
260
304
  | [`docs/EDGE-NAVIGATION.md`](./docs/EDGE-NAVIGATION.md) | MCP-traversable edges, directions, dot-key composition. |
261
- | [`skills/`](./skills/) | Single `/explore-codebase` skill complete MCP operating manual for hosts with skill discovery (alternative to copy-pasting AGENT-GUIDE). See [`skills/README.md`](./skills/README.md). |
305
+ | [`skills/`](./skills/) | `/explore-codebase` (MCP surface) + `/explore-codebase-cli` (CLI surface) skills operating manuals for hosts with skill discovery (alternative to copy-pasting AGENT-GUIDE). See [`skills/README.md`](./skills/README.md). |
262
306
  | [`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHECKLIST.md) | 7-phase agent-driven verification after indexing your project. |
263
307
  | [`docs/CODEBASE_REQUIREMENTS.md`](./docs/CODEBASE_REQUIREMENTS.md) | Assumptions about your Java repo + per-file edit map for non-conforming codebases. |
264
- | [`automation/cursor_propose_only/README.md`](./automation/cursor_propose_only/README.md) | Optional proposal orchestration workflow (single-command autopilot, planning bundles, automated execution/review loops). |
265
308
  | [`docs/PRODUCT-VISION.md`](./docs/PRODUCT-VISION.md) | Long-term product direction. |
266
309
 
267
310
  ---
@@ -272,7 +315,7 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
272
315
  git clone https://github.com/HumanBean17/java-codebase-rag
273
316
  cd java-codebase-rag
274
317
  python3 -m venv .venv
275
- .venv/bin/pip install -r requirements.txt
318
+ .venv/bin/pip install -e ".[dev]"
276
319
  ```
277
320
 
278
321
  The `cocoindex` package powers lifecycle commands that run the indexer (`init`, `increment`, `reprocess`, `erase`). Search and MCP navigation do not invoke it directly.
@@ -0,0 +1,43 @@
1
+ ast_java.py,sha256=ZGykRdcVeLFBxTPFyUfUeAKXxlo6sf82GbyV4tuDuHg,99419
2
+ brownfield_events.py,sha256=yxXkKDgMb3VPtaiakGzncHM_EGnda8xIue6w90yYp8s,2055
3
+ build_ast_graph.py,sha256=wo5BwVf2JCwLEnZhMlpPPNozt59V1cVvsIhP9cuOFPs,172655
4
+ chunk_heuristics.py,sha256=aQk2NOKxzUdqoUAJUO3G3LE0MN_bYZWNLQ0tkmj5uts,1813
5
+ graph_enrich.py,sha256=Fxp7JurH9wWTOTX1nErjH4H6Jw5bB68YCqR17rsX6gw,62829
6
+ graph_types.py,sha256=P6RVdEiqZlaSgTyXepnGbtMoZq0m_MaP2q6M6i7Uxlc,4539
7
+ index_common.py,sha256=HT6FKHFJ084eFvd3fR1j8z8gf4eWoPHVW8GXLpw464I,285
8
+ java_index_flow_lancedb.py,sha256=OFrvOV2xWPvBkQ1kS6nxcOjdJbYAGcEirzeevrOU1PM,25598
9
+ java_index_v1_common.py,sha256=nF1KrSqboF_RRvWerG9knRRFmWwsrG_CvhgnsoZ8KqA,1154
10
+ java_ontology.py,sha256=ooqr8GucOINpzhdEQ3QzVe5A9GfiR0nUTlySDehn9GA,17129
11
+ ladybug_queries.py,sha256=rVnVEHwWwE4USeX7tICYEl1SSiSxJGnBNe1VX66R3Xk,100531
12
+ mcp_hints.py,sha256=zp-4cnOmbYD0YovmZiLS2oGcvWcWE7n8jKVz4_xifno,42512
13
+ mcp_v2.py,sha256=_pSZrbbImgLOrq8RxBhggoaKHP8oOroUiqh3jz86gG0,66084
14
+ path_filtering.py,sha256=R--XzI51LXBu5IBKMCnJWbkNr6I5d-SDmltyQQnWco0,17674
15
+ pr_analysis.py,sha256=zrmZZD5yotJtM02Kif6_jgI_oeformOao793akp0N6Y,18394
16
+ resolve_service.py,sha256=tC5FQsGmqhqn0EOexVDlRq5egnzKDTrI7CMzk0nPpG8,25135
17
+ search_lancedb.py,sha256=MKnrRpRQnZNbp5oAFHMBFILoKcQEMaJBouTXakXPSXM,37390
18
+ server.py,sha256=o5TQTO76CEK0SngU5JwGfd8MPn1wyPQODf2zNfbfBTw,35406
19
+ java_codebase_rag/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
20
+ java_codebase_rag/_fdlimit.py,sha256=vkwjsPbZfxzZ2DZTPWO5DxtuNlLzOADzIq07iYX7GCU,2465
21
+ java_codebase_rag/_stdio.py,sha256=TDNbpt2EP0_Zd622ihdlKwlMfxkKHWOfgLVcU6TcNbo,1458
22
+ java_codebase_rag/cli.py,sha256=0W14fsod0ZJSfSD15BRE4A16V5f5hy_bZ_A1-jZPO4w,44738
23
+ java_codebase_rag/cli_format.py,sha256=CT7-xdwZ0bMCdP68_UOwkvm-mnLluU3LutlM-mDNk60,1839
24
+ java_codebase_rag/cli_progress.py,sha256=q6Wh97yzLGs1B8UFk_WAKivfQu7Y5RnUUE-T2YHWkIs,3237
25
+ java_codebase_rag/config.py,sha256=Yl7Nf0O_ZOZTPtyPMap83jRM7qNhWwfbVJTKSEdERi4,24916
26
+ java_codebase_rag/installer.py,sha256=NgOdsML1BOmqIoIXyoDDLg4r3JxQ9hqqYGCwVW6FHQs,67582
27
+ java_codebase_rag/jrag.py,sha256=K1_QNMO2mRWSeatJIEJ0esVZztraiA8VB6Pkphg6ITU,187655
28
+ java_codebase_rag/jrag_envelope.py,sha256=mvAgoZm5XIpmV-J1ntlBzwJW62Fs71RGcpxFQa-l0lc,47484
29
+ java_codebase_rag/jrag_hints.py,sha256=k2PFE4s3lZgBYHMdZcTjx1-w28nfQcBtQEVsSxI_DvE,9262
30
+ java_codebase_rag/jrag_render.py,sha256=tIKdOQOO1-uimS2MBxrLma5tjiid0nG0OcaPRgR7uEk,31611
31
+ java_codebase_rag/lance_optimize.py,sha256=25Rwj7HNO8F-35MxhFK6naqgbjd3H-T0zKb3pXB4H0s,9268
32
+ java_codebase_rag/pipeline.py,sha256=4o5SdvHC4z4PTtzkjnhmkolODXnlibndCorI6gDUyPI,15903
33
+ java_codebase_rag/progress.py,sha256=2IxdMALDM0wAQCyJrrfZ975zM_85C-4BfHxf4AtYifE,23212
34
+ java_codebase_rag/install_data/agents/explorer-rag-cli.md,sha256=Ahjq39Kgyydgr_Vno-gFj02DZQQX-a65AvzEl1K1nss,12923
35
+ java_codebase_rag/install_data/agents/explorer-rag-enhanced.md,sha256=O8twSh5aOVe2s_8HdwFKBTl_VxgwiVPm2YlyQAPXhh0,14614
36
+ java_codebase_rag/install_data/skills/explore-codebase/SKILL.md,sha256=7SQSC0sHD_2F64QdEiwgSyVWHQXLxsOBxWWqJpIGPbk,12485
37
+ java_codebase_rag/install_data/skills/explore-codebase-cli/SKILL.md,sha256=qSGsC90LpjTZSUV6v3YtgFSHVb_hd4S1QlOedKm2NnU,14319
38
+ java_codebase_rag-0.8.0.dist-info/licenses/LICENSE,sha256=gxvtiHtuviR_q8ZAjWw-QTcF3DyPzg6ZY-lQrr8OPpw,1068
39
+ java_codebase_rag-0.8.0.dist-info/METADATA,sha256=VnPaESLzcc1V_ltQw6U1Ehyk6HV1TbTZjgGphLO6tWQ,19996
40
+ java_codebase_rag-0.8.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
41
+ java_codebase_rag-0.8.0.dist-info/entry_points.txt,sha256=cj3QTc11UYVQnj9T3orc4daiIGaCYrXP149vKbH2R4U,168
42
+ java_codebase_rag-0.8.0.dist-info/top_level.txt,sha256=8vC-VN3cMwz5vhkSTaeJ1a1bDeqLWEfrTks1CvEvIg0,273
43
+ java_codebase_rag-0.8.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.1)
2
+ Generator: setuptools (83.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,3 +1,4 @@
1
1
  [console_scripts]
2
2
  java-codebase-rag = java_codebase_rag.cli:_console_script_main
3
3
  java-codebase-rag-mcp = server:main
4
+ jrag = java_codebase_rag.jrag:_console_script_main
@@ -3,6 +3,7 @@ brownfield_events
3
3
  build_ast_graph
4
4
  chunk_heuristics
5
5
  graph_enrich
6
+ graph_types
6
7
  index_common
7
8
  java_codebase_rag
8
9
  java_index_flow_lancedb
@@ -13,5 +14,6 @@ mcp_hints
13
14
  mcp_v2
14
15
  path_filtering
15
16
  pr_analysis
17
+ resolve_service
16
18
  search_lancedb
17
19
  server
@@ -291,9 +291,23 @@ async def coco_lifespan(builder: coco.EnvironmentBuilder) -> AsyncIterator[None]
291
291
  root = Path(".").resolve()
292
292
  builder.provide(PROJECT_ROOT, root)
293
293
 
294
+ # Default to Apple Metal (MPS) when available: ~1.7x faster encode on
295
+ # all-MiniLM-L6-v2 (measured), and the win grows with repo size since
296
+ # embedding dominates on large trees. torch is already on the import path
297
+ # here (sentence-transformers pulls it), so the availability check is free
298
+ # in this child process — and it keeps the CLI parent (config.py) from ever
299
+ # paying a torch import. Operators force CPU with SBERT_DEVICE=cpu.
300
+ device = os.environ.get("SBERT_DEVICE") or None
301
+ if device is None:
302
+ try:
303
+ import torch # noqa: WPS433 (local import: avoid parent-import cost)
304
+ if torch.backends.mps.is_available():
305
+ device = "mps"
306
+ except Exception:
307
+ pass
294
308
  embedder = SentenceTransformerEmbedder(
295
309
  resolved_sbert_model_for_process_env(SBERT_MODEL),
296
- device=os.environ.get("SBERT_DEVICE") or None,
310
+ device=device,
297
311
  trust_remote_code=True,
298
312
  )
299
313
  builder.provide(EMBEDDER, embedder)
@@ -619,24 +633,25 @@ async def app_main() -> None:
619
633
  ),
620
634
  )
621
635
 
622
- await coco.mount_each(
623
- coco.component_subpath(coco.Symbol("java_files")),
624
- process_java_file,
625
- java_files.items(),
626
- java_table,
627
- )
628
- await coco.mount_each(
629
- coco.component_subpath(coco.Symbol("sql_files")),
630
- process_sql_file,
631
- sql_files.items(),
632
- sql_table,
633
- )
634
- await coco.mount_each(
635
- coco.component_subpath(coco.Symbol("yaml_files")),
636
- process_yaml_file,
637
- yaml_files.items(),
638
- yaml_table,
639
- )
636
+ # PERF: declare all rows in ONE component (app_main) instead of one
637
+ # component per file via coco.mount_each. cocoindex flushes target writes
638
+ # once per processing component, and all declare_row calls inside a
639
+ # component batch into a single Lance merge_insert (see _RowHandler.
640
+ # _apply_actions). mount_each created one component PER FILE → ~1167
641
+ # merge_insert transactions (one fragment + manifest commit each) → ~91s
642
+ # of kernel I/O on a 1167-file repo. The single-component loop collapses
643
+ # that to ONE merge_insert per table. cocoindex does not yet batch across
644
+ # mount_each components natively (open issue cocoindex#2219), so the loop
645
+ # is the supported workaround. process_*_file stay @coco.fn(memo=True), so
646
+ # unchanged files still skip re-embedding on incremental; _RowHandler.
647
+ # reconcile skips rows whose fingerprint is unchanged → increment carries
648
+ # only changed rows in its single merge_insert.
649
+ async for _key, _file in java_files.items():
650
+ await process_java_file(_file, java_table)
651
+ async for _key, _file in sql_files.items():
652
+ await process_sql_file(_file, sql_table)
653
+ async for _key, _file in yaml_files.items():
654
+ await process_yaml_file(_file, yaml_table)
640
655
 
641
656
 
642
657
  app = coco.App(
java_ontology.py CHANGED
@@ -49,6 +49,11 @@ VALID_CLIENT_KINDS: frozenset[str] = frozenset((
49
49
  "rest_template",
50
50
  "web_client",
51
51
  ))
52
+ # Named members of VALID_CLIENT_KINDS — reference these at emit/match sites so a
53
+ # rename in the set above cannot silently desync callers (issue #359).
54
+ CLIENT_KIND_FEIGN_METHOD = "feign_method"
55
+ CLIENT_KIND_REST_TEMPLATE = "rest_template"
56
+ CLIENT_KIND_WEB_CLIENT = "web_client"
52
57
 
53
58
  VALID_PRODUCER_KINDS: frozenset[str] = frozenset((
54
59
  "kafka_send",
@@ -87,6 +92,8 @@ VALID_RESOLVE_REASONS: frozenset[str] = frozenset((
87
92
  "route_method_path",
88
93
  "client_target",
89
94
  "client_target_path",
95
+ "client_name",
96
+ "client_fqn",
90
97
  "producer_topic",
91
98
  "producer_topic_prefix",
92
99
  ))
@@ -423,6 +430,8 @@ ResolveReason = Literal[
423
430
  "route_method_path",
424
431
  "client_target",
425
432
  "client_target_path",
433
+ "client_name",
434
+ "client_fqn",
426
435
  "producer_topic",
427
436
  "producer_topic_prefix",
428
437
  ]
@@ -433,6 +442,9 @@ __all__ = [
433
442
  "VALID_ROUTE_FRAMEWORKS",
434
443
  "VALID_ROUTE_KINDS",
435
444
  "VALID_CLIENT_KINDS",
445
+ "CLIENT_KIND_FEIGN_METHOD",
446
+ "CLIENT_KIND_REST_TEMPLATE",
447
+ "CLIENT_KIND_WEB_CLIENT",
436
448
  "VALID_PRODUCER_KINDS",
437
449
  "VALID_HTTP_CALL_STRATEGIES",
438
450
  "VALID_ASYNC_CALL_STRATEGIES",