Skip to content

Commit 93d8b64

Browse files
authored
feat(claude-plugin): add remaining CLI adapters as slash commands (#1428)
Wire ask, context, symbol, why, and export into Claude Code, document them on the website CLI reference, and fold Raghav's review fixes (include health, drop export -f, plugin.json eleven tools) into one PR.
1 parent 90d1b6b commit 93d8b64

13 files changed

Lines changed: 500 additions & 6 deletions

File tree

plugins/claude-code/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "repowise",
3-
"description": "Codebase intelligence for Claude Code. Indexes your codebase into five layers (Graph, Git, Docs, Decisions, Code Health) and exposes them through ten task-shaped MCP tools — so Claude understands architecture, ownership, hotspots, why code is built the way it is, and where the defect risk lives.",
3+
"description": "Codebase intelligence for Claude Code. Indexes your codebase into five layers (Graph, Git, Docs, Decisions, Code Health) and exposes them through eleven task-shaped MCP tools — so Claude understands architecture, ownership, hotspots, why code is built the way it is, and where the defect risk lives.",
44
"version": "0.40.0",
55
"author": {
66
"name": "Repowise",

plugins/claude-code/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
All notable changes to the Repowise Claude Code plugin are documented here.
44

5+
## Unreleased
6+
7+
### Added
8+
- `/repowise:ask`, `/repowise:context`, `/repowise:symbol`, `/repowise:why`, and
9+
`/repowise:export` — slash commands for the remaining CLI adapters so Claude
10+
can synthesise answers, pull triage cards, read live-verified symbol bodies,
11+
query decisions/archaeology, and export the wiki or a Structurizr model
12+
without MCP-only flows.
13+
514
## 0.40.0
615

716
### Added

plugins/claude-code/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ defect-validated score from deterministic markers).
5050
| `/repowise:status` | Health check — sync state, page counts, provider info |
5151
| `/repowise:update` | Incremental update — sync the index with recent code changes |
5252
| `/repowise:search` | Search the codebase wiki (fulltext, semantic, or symbol) |
53+
| `/repowise:ask` | Cited, synthesised answer to a codebase question (LLM call) |
54+
| `/repowise:context` | Triage card for files/modules/symbols (layer, hotspot, freshness) |
55+
| `/repowise:symbol` | Read one symbol body with live-verified line bounds |
5356
| `/repowise:reindex` | Rebuild the vector store (re-embed; no LLM calls) |
5457
| `/repowise:health` | Code-health KPIs, lowest-scoring files, refactoring targets, trends |
5558
| `/repowise:coverage` | Ingest or inspect coverage reports (lights up untested hotspots + per-test map) |
5659
| `/repowise:impacted-tests` | Tests whose coverage intersects a change (commit / range / staged) |
5760
| `/repowise:risk` | Defect-risk score for a change (commit or `base..head` range) |
5861
| `/repowise:security` | Full-history secret scan (`repowise security scan --history`) |
5962
| `/repowise:dead-code` | Unreachable files, unused exports, zombie packages by confidence |
63+
| `/repowise:export` | Export wiki pages or a Structurizr architecture model |
6064
| `/repowise:decision` | List, inspect, add, or confirm architectural decisions |
65+
| `/repowise:why` | Why the code is shaped this way (decisions + archaeology) |
6166
| `/repowise:doctor` | Diagnose (and optionally repair) the setup, keys, and index drift |
6267

6368
### Automatic skills
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
description: Ask a codebase question and get a cited, synthesised answer with a confidence rating (costs an LLM call).
3+
allowed-tools: Bash, Read
4+
---
5+
6+
# Repowise Ask
7+
8+
Answer a question about this codebase with citations. This is the same
9+
synthesis the `get_answer` MCP tool performs: hybrid retrieval followed by an
10+
LLM answer over what it found. Unlike `/repowise:search`, this **costs an LLM
11+
call** — use it when the user wants an answer, not a hit list.
12+
13+
## Steps
14+
15+
1. If `.repowise/` doesn't exist: "This repo isn't indexed yet. Run `/repowise:init` first." Stop.
16+
2. Resolve the question from `$ARGUMENTS`. If empty, ask: "What do you want to know about this codebase?"
17+
3. Run the command and present the answer, confidence, and retrieval quality.
18+
Prefer citing the paths the answer names. Do not invent citations.
19+
20+
## Choosing the invocation
21+
22+
- Question only → `repowise ask "<question>"`
23+
- Restrict retrieval to a subtree → `repowise ask "<question>" --scope packages/cli/`
24+
- Machine-readable → `repowise ask "<question>" --format json`
25+
- Raw MCP payload (including dropped blocks) → `repowise ask "<question>" --full`
26+
27+
```
28+
repowise ask "how does the retry backoff work?"
29+
repowise ask "where is the session cookie set?" --format json
30+
repowise ask "how is width resolved?" --scope packages/cli/
31+
repowise ask "why is auth split across two modules?" --full
32+
```
33+
34+
Shared targeting flags (`--path`, `--repo`, `--no-workspace`) work the same as
35+
the other tool-adapter commands.
36+
37+
## How to present the result
38+
39+
- `confidence: high` is content-grounded — cite it directly.
40+
- `medium` / `low` — say so, and follow any `best_guesses` / `fallback_targets`
41+
into `/repowise:context` or `get_context` rather than inventing detail.
42+
- If a `note` warns that numbers may be synthesised, surface that caveat.
43+
- Prefer this over `/repowise:search` when the user asked a *question*. Prefer
44+
search when they want a list of matching pages / symbols.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
description: Triage card for files, modules, or symbols — layer, hotspot, fix history, freshness (relationships, not source bytes).
3+
allowed-tools: Bash, Read
4+
---
5+
6+
# Repowise Context
7+
8+
Pull a triage card for one or more files, modules, or symbols. This is the CLI
9+
adapter over `get_context`: title, summary, architectural layer, hotspot /
10+
bug-fix history, doc freshness, and optional relationship blocks. Relationships
11+
and risk signals — **not** source bytes by default.
12+
13+
## Steps
14+
15+
1. If `.repowise/` doesn't exist: "This repo isn't indexed yet. Run `/repowise:init` first." Stop.
16+
2. Resolve targets from `$ARGUMENTS`. If empty, ask which file / module /
17+
`path::Symbol` to inspect.
18+
3. Run `repowise context` and present each card: layer, stale bit, hotspot,
19+
summary. Call out fix history when present.
20+
21+
## Choosing the invocation
22+
23+
TARGETS are file paths, module paths, or `path/to/file.py::Symbol` ids. Batch
24+
them in one call.
25+
26+
- Default triage → `repowise context <targets…>`
27+
- Opt-in blocks (repeatable) → `--include callers|callees|ownership|metrics|decisions|skeleton|…`
28+
- Richer card → `repowise context <targets…> --no-compact`
29+
- Machine-readable / raw payload → `--format json` / `--full`
30+
31+
```
32+
repowise context src/api/routes.py src/api/auth.py
33+
repowise context src/api/routes.py::login --include callers --include metrics
34+
repowise context src/api/routes.py --include skeleton
35+
```
36+
37+
`--include skeleton` adds the body-elided, line-verified file shape. For the
38+
exact function body, prefer `/repowise:symbol` (or `get_symbol`) with a
39+
`symbol_id` from the card.
40+
41+
Shared targeting flags (`--path`, `--repo`, `--no-workspace`) work the same as
42+
the other tool-adapter commands.
43+
44+
## Notes
45+
46+
- Prefer this before opening many files with Read — one call batches cards.
47+
- A target the index cannot resolve returns an `error` card; report that
48+
plainly instead of inventing structure.
49+
- For a synthesised Q&A answer, use `/repowise:ask`. For "why is it shaped
50+
this way", use `/repowise:why`.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
description: Export the wiki (or architecture model) to markdown, HTML, JSON, or Structurizr DSL.
3+
allowed-tools: Bash, Read
4+
---
5+
6+
# Repowise Export
7+
8+
Export indexed wiki pages to files, or emit a Structurizr DSL architecture
9+
model. Use this when the user wants a shareable dump, a static site, a JSON
10+
archive, or a C4/Structurizr model — not when they need an interactive Q&A
11+
answer (`/repowise:ask`).
12+
13+
## Steps
14+
15+
1. If `.repowise/` doesn't exist: "This repo isn't indexed yet. Run `/repowise:init` first." Stop.
16+
2. Resolve format and output from `$ARGUMENTS` (see below).
17+
3. Run `repowise export` and report where files were written (page count /
18+
output path). Do not invent page content.
19+
20+
## Choosing the invocation
21+
22+
Default — markdown under `.repowise/export`:
23+
```
24+
repowise export
25+
```
26+
27+
Handle `$ARGUMENTS`:
28+
- "html" / "site" → `repowise export --format html`
29+
- "json" → `repowise export --format json`
30+
- "json full" / "archive" → `repowise export --format json --full`
31+
(`--full` keeps tombstones and adds decisions / dead code / hotspots)
32+
- "structurizr" / "c4" / "dsl" → `repowise export --format structurizr`
33+
- "structurizr standalone" → `repowise export --format structurizr --standalone`
34+
- "structurizr components" → add `--components`
35+
- "to <dir>" / "-o <dir>" → pass `--output <dir>`
36+
(for structurizr, a path ending in `.dsl` names the file itself)
37+
- A repo path → `repowise export <path> …`
38+
39+
```
40+
repowise export
41+
repowise export --format html -o ./site
42+
repowise export --format json --full
43+
repowise export --format structurizr --standalone --components
44+
repowise export --format structurizr -o architecture.dsl
45+
```
46+
47+
## Structurizr notes
48+
49+
- Default structurizr output is a **model fragment** to include from your own
50+
`workspace.dsl`. Pass `--standalone` for a complete workspace with default
51+
views.
52+
- `--force` overwrites an output file even if Repowise did not write it
53+
(`--standalone` often targets `workspace.dsl`).
54+
- `--no-externals` leaves third-party dependencies out of the model.
55+
56+
## Notes
57+
58+
- Markdown / HTML / JSON write a directory of pages; structurizr writes DSL.
59+
- Never fabricate export contents. If the command reports no pages, say so and
60+
suggest `/repowise:init`.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
description: Read one symbol's body with live-verified line bounds (path::Name, live range, or distill omission ref).
3+
allowed-tools: Bash, Read
4+
---
5+
6+
# Repowise Symbol
7+
8+
Read one function, class, or constant with live-verified line bounds. This is
9+
the CLI adapter over `get_symbol`. Prefer it over a raw file Read when you
10+
already have a `symbol_id` from `/repowise:context` or `search_codebase`.
11+
12+
## Steps
13+
14+
1. If `.repowise/` doesn't exist: "This repo isn't indexed yet. Run `/repowise:init` first." Stop.
15+
2. Resolve the symbol id from `$ARGUMENTS`. If empty, ask for
16+
`path/to/file.py::Name`, a live range (`path:start-end`), or a
17+
`repowise#<hex>` omission ref from distill.
18+
3. Run `repowise symbol` and present the body. Report `verified: true/false`
19+
when shown. If the id is ambiguous, show every matching body — do not
20+
silently pick one.
21+
22+
## Choosing the invocation
23+
24+
- Named symbol → `repowise symbol "src/api/routes.py::login"`
25+
- Live range read → `repowise symbol "src/api/routes.py:140-180"`
26+
- Distill omission ref → `repowise symbol "repowise#a1b2c3d4e5f6"`
27+
- Extra surrounding lines → `--context-lines N` (0–50)
28+
- Filter restored omission lines → `--query <regex-or-substring>`
29+
- Machine-readable / raw payload → `--format json` / `--full`
30+
31+
```
32+
repowise symbol "src/api/routes.py::login"
33+
repowise symbol "src/api/routes.py:140-180"
34+
repowise symbol "repowise#a1b2c3d4e5f6"
35+
repowise symbol "src/api/routes.py::login" --context-lines 3
36+
```
37+
38+
A truncated body carries a `continuation` you can pass straight back to
39+
`repowise symbol`. Shared targeting flags (`--path`, `--repo`,
40+
`--no-workspace`) match the other tool-adapter commands.
41+
42+
## Notes
43+
44+
- Cheaper and more precise than Read + offset math when you have a
45+
`symbol_id`.
46+
- For triage (layer / hotspot / callers) without bytes, use
47+
`/repowise:context`.
48+
- Never invent source — if the command errors or returns no body, say so.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
description: Why the code is shaped this way — decisions, rationale, and git archaeology (question, path, or decision-health dashboard).
3+
allowed-tools: Bash, Read
4+
---
5+
6+
# Repowise Why
7+
8+
Answer *why* the code looks the way it does: decision records, rationale, and
9+
git archaeology. This is the CLI adapter over `get_why`. Worth running before a
10+
refactor or a deliberate divergence from a pattern.
11+
12+
`/repowise:decision` manages decision records (list / add / confirm). This
13+
command **queries** why something is shaped a certain way.
14+
15+
## Steps
16+
17+
1. If `.repowise/` doesn't exist: "This repo isn't indexed yet. Run `/repowise:init` first." Stop.
18+
2. Map `$ARGUMENTS` to a mode (below), run `repowise why`, and present
19+
decisions, alignment, and archaeology. Never invent rationale — if the
20+
command falls back to git archaeology, say that plainly.
21+
22+
## Modes
23+
24+
- Question → `repowise why "why is auth using JWT?"`
25+
- File path (governing decisions + origin story) → `repowise why src/api/auth.py`
26+
- Target-anchored search → `repowise why "why the retry cap?" --target src/api/client.py`
27+
(`--target` is repeatable)
28+
- No args → `repowise why` (decision-health dashboard: stale / proposed /
29+
ungoverned hotspots)
30+
- Machine-readable / raw payload → `--format json` / `--full`
31+
32+
```
33+
repowise why "why is auth using JWT?"
34+
repowise why src/api/auth.py
35+
repowise why "why the retry cap?" --target src/api/client.py
36+
repowise why
37+
```
38+
39+
Shared targeting flags (`--path`, `--repo`, `--no-workspace`) match the other
40+
tool-adapter commands.
41+
42+
## Notes
43+
44+
- Falls back to git archaeology when a path has no decisions, so it is never
45+
empty — call that out so the user knows it is reconstructed, not recorded.
46+
- For *managing* ADR records (add / confirm / deprecate), use
47+
`/repowise:decision`.
48+
- Before contradicting an existing decision, surface it to the user first.

plugins/claude-code/skills/architectural-decisions/SKILL.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ Call `get_why()` with no arguments to get the decision-health dashboard:
4545
- Proposed decisions awaiting confirmation
4646
- Ungoverned hotspots (high-churn files with no recorded decisions)
4747

48-
The same signals surface in the CLI via `repowise decision health`, and you can
49-
review auto-proposed decisions with `repowise decision confirm`.
48+
The same signals surface in the CLI via `repowise decision health` /
49+
`/repowise:decision`, and you can query *why* mid-task with `repowise why` /
50+
`/repowise:why` (the `get_why` adapter). Review auto-proposed decisions with
51+
`repowise decision confirm`.
5052

5153
## When a file has decision markers
5254

plugins/claude-code/skills/codebase-exploration/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ Otherwise the response is current — act on it.
5555
Add `--no-editor-setup` if this repo is a scratch clone, a fixture, or a
5656
worktree: `init` otherwise repoints the user's single global `repowise` MCP
5757
entry at it.
58+
- MCP tools unavailable → prefer the matching CLI slash commands when the
59+
plugin is installed (`/repowise:ask`, `/repowise:context`, `/repowise:symbol`,
60+
`/repowise:search`) rather than grepping blind.
5861
- `get_answer`/`search_codebase` come back empty → the repo may have a
5962
template-rendered wiki. Fall back to `get_context` with explicit paths, and note
6063
that model-written pages (`repowise generate`, or `/repowise:init` with an LLM

0 commit comments

Comments
 (0)