Skip to content

Commit 2e8a2cf

Browse files
HumanBean17claude
andcommitted
feat(cli): --detail orthogonality (brief|normal|full) for text+json (PR-JRAG-6)
Split the concern conflated by --format {text,json} into two orthogonal axes: --format picks representation, --detail picks how much of each node/edge. Both modes honor the same detail level through one projection seam (project_envelope), invoked once in render() before JSON and text dispatch. - jrag_envelope: project_node/project_edge/project_envelope + _drop_empty + _compose_file; category key-sets (_BRIEF/_NORMAL/full). to_dict/to_json stay verbatim — projection is a separate transform. - jrag_render: render() projects once; listing shows inline module/role/file/ score at normal, per-row block at full; edges append mechanism/all attrs. - jrag: --detail flag (default normal); inspect + orientation subparsers set_defaults(detail="full"); all 45 render calls thread detail=args.detail; _symbol_hit_to_dict carries the full SymbolHit (file at normal, signature/ annotations/capabilities at full). - Fixes "text too terse" (normal shows file/score) and "json dumps 50-line snippet + 10 empty fields" (_drop_empty inside node dicts; snippet is full-only). - Tests: 8 projector + 6 orthogonality/text-level tests; existing render tests updated for the new default. 142 jrag tests + 86 skill/operator tests green; ruff clean; token-budget re-pinned under normal. - skill/agent docs document --detail; install_data synced; drift test green. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f30fe75 commit 2e8a2cf

10 files changed

Lines changed: 963 additions & 89 deletions

File tree

agents/explorer-rag-cli.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Run `jrag --help` for the canonical list. Groups:
5656
--module <name> Filter by module
5757
--limit <N> Cap on results (default 20; 10 for fan-out commands)
5858
--format text|json Output format (default: text)
59+
--detail brief|normal|full Output detail (default: normal) — orthogonal to --format;
60+
both modes honor it. brief=name @service; normal=+module/role/
61+
file/score; full=+signature/annotations/snippet. inspect and the
62+
orientation commands default to full.
5963
--index-dir <path> Index directory override
6064
```
6165

@@ -123,7 +127,11 @@ Only `--kind` is a true resolve input. `--role`, `--java-kind`, `--fqn-prefix`,
123127

124128
## Output envelope
125129

126-
Default is compact text. `--format json` emits the envelope verbatim:
130+
`--format` (text|json) and `--detail` (brief|normal|full) are **orthogonal**:
131+
`--format` picks the representation, `--detail` picks how much of each node/edge is
132+
shown, and both modes honor the same detail level. Default is `text` + `normal`
133+
(name @service + module/role/file/score); `inspect` and orientation commands default
134+
to `full`. `--format json` emits the projected envelope (empty fields dropped).
127135

128136
```json
129137
{

java_codebase_rag/install_data/agents/explorer-rag-cli.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Run `jrag --help` for the canonical list. Groups:
5656
--module <name> Filter by module
5757
--limit <N> Cap on results (default 20; 10 for fan-out commands)
5858
--format text|json Output format (default: text)
59+
--detail brief|normal|full Output detail (default: normal) — orthogonal to --format;
60+
both modes honor it. brief=name @service; normal=+module/role/
61+
file/score; full=+signature/annotations/snippet. inspect and the
62+
orientation commands default to full.
5963
--index-dir <path> Index directory override
6064
```
6165

@@ -123,7 +127,11 @@ Only `--kind` is a true resolve input. `--role`, `--java-kind`, `--fqn-prefix`,
123127

124128
## Output envelope
125129

126-
Default is compact text. `--format json` emits the envelope verbatim:
130+
`--format` (text|json) and `--detail` (brief|normal|full) are **orthogonal**:
131+
`--format` picks the representation, `--detail` picks how much of each node/edge is
132+
shown, and both modes honor the same detail level. Default is `text` + `normal`
133+
(name @service + module/role/file/score); `inspect` and orientation commands default
134+
to `full`. `--format json` emits the projected envelope (empty fields dropped).
127135

128136
```json
129137
{

java_codebase_rag/install_data/skills/explore-codebase-cli/SKILL.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Any time you need to search, locate, navigate, or explore the codebase. **Do NOT
2424
| --- | --- | --- |
2525
| Surface | Shell — one command per intent | 5 stdio MCP tools (`search` / `find` / `describe` / `neighbors` / `resolve`) |
2626
| Resolve | **Internalized** — every `<query>` command runs `resolve_v2` first | Explicit — agent calls `resolve` then `describe` / `neighbors` |
27-
| Output | Compact text by default; `--format json` for the envelope | JSON-RPC envelope |
27+
| Output | Compact text by default; `--format json` for the envelope; `--detail brief\|normal\|full` (orthogonal to format) | JSON-RPC envelope |
2828
| Host fit | Any agent that can run shell commands | MCP-aware hosts (Claude Code, Claude Desktop, Qwen Code, GigaCode) |
2929
| Index | Reuses the operator's `~/.java-codebase-rag` / `.java-codebase-rag/` index | Same |
3030

@@ -62,6 +62,11 @@ Run `jrag --help` for the canonical list. Groups (PR-JRAG-1a..4):
6262
--module <name> Filter by module
6363
--limit <N> Cap on results (default 20; 10 for fan-out commands)
6464
--format text|json Output format (default: text)
65+
--detail brief|normal|full Output detail (default: normal) — orthogonal to --format;
66+
both modes honor it. brief=name @service; normal=+module/role/
67+
file/score; full=+signature/annotations/snippet. inspect and the
68+
orientation commands (status/microservices/map/conventions/overview)
69+
default to full.
6570
--index-dir <path> Index directory override (default: discovered from cwd)
6671
```
6772

@@ -136,7 +141,20 @@ Only `--kind` is a true resolve input (`hint_kind`). The other narrowing flags (
136141

137142
## Output envelope
138143

139-
Default is compact text. `--format json` emits the envelope verbatim:
144+
`--format` (text|json) and `--detail` (brief|normal|full) are **orthogonal**:
145+
`--format` picks the representation, `--detail` picks how much of each node/edge is
146+
shown, and **both modes honor the same detail level** through one projection seam.
147+
148+
- Default is `text` + `normal`: a one-line-per-row listing that includes
149+
`name @service module=… role=… file=… score=…` (the cheap, high-value fields).
150+
`inspect` and the orientation commands default to `full` (their purpose is detail).
151+
- `--detail brief` reproduces the ultra-terse `name @service` line (escape hatch).
152+
- `--detail full` adds an indented block per row (`signature`, `annotations`,
153+
`snippet` for search, `data`/`edge_summary` for inspect).
154+
- `--format json` emits the **projected** envelope (same field set as the text at
155+
that detail level). Empty fields are dropped at every level (no `null` noise).
156+
157+
`--format json` envelope shape (fields omitted when empty):
140158

141159
```json
142160
{

0 commit comments

Comments
 (0)