refacil-sdd-ai 5.2.3 → 5.3.1
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.
- package/NOTICE.md +46 -0
- package/README.md +210 -42
- package/agents/auditor.md +46 -0
- package/agents/debugger.md +41 -1
- package/agents/implementer.md +76 -10
- package/agents/investigator.md +36 -0
- package/agents/proposer.md +56 -2
- package/agents/tester.md +45 -8
- package/agents/validator.md +67 -13
- package/bin/cli.js +396 -84
- package/lib/bus/broker.js +121 -3
- package/lib/bus/spawn.js +189 -121
- package/lib/check-review.js +102 -0
- package/lib/codegraph-telemetry.js +135 -0
- package/lib/codegraph.js +273 -0
- package/lib/commands/autopilot.js +120 -0
- package/lib/commands/bus.js +29 -36
- package/lib/commands/compact.js +185 -46
- package/lib/commands/read-spec.js +352 -0
- package/lib/commands/sdd.js +600 -47
- package/lib/compact-guidance.js +122 -77
- package/lib/config.js +136 -0
- package/lib/global-paths.js +56 -20
- package/lib/hooks.js +26 -4
- package/lib/ide-detection.js +1 -1
- package/lib/ignore-files.js +5 -1
- package/lib/installer.js +196 -19
- package/lib/kapso.js +308 -0
- package/lib/methodology-migration-pending.js +13 -0
- package/lib/open-browser.js +32 -0
- package/lib/opencode-migrate.js +148 -0
- package/lib/opencode-plugin/index.js +84 -104
- package/lib/opencode-plugin/rules.js +236 -0
- package/lib/project-root.js +154 -0
- package/lib/repo-ide-sync.js +5 -0
- package/lib/spec-reader/lang.js +72 -0
- package/lib/spec-reader/md-parser.js +299 -0
- package/lib/spec-reader/session.js +139 -0
- package/lib/spec-reader/ui/app.js +685 -0
- package/lib/spec-reader/ui/index.html +59 -0
- package/lib/spec-reader/ui/mixed-lang.js +200 -0
- package/lib/spec-reader/ui/model-cache.js +117 -0
- package/lib/spec-reader/ui/style.css +294 -0
- package/lib/spec-reader/ui/supertonic-helper.js +565 -0
- package/lib/spec-sync.js +258 -0
- package/lib/test-scope.js +713 -0
- package/lib/testing-policy-sync.js +14 -2
- package/package.json +5 -3
- package/skills/apply/SKILL.md +50 -65
- package/skills/archive/SKILL.md +84 -50
- package/skills/ask/SKILL.md +43 -8
- package/skills/autopilot/SKILL.md +505 -0
- package/skills/bug/SKILL.md +52 -53
- package/skills/explore/SKILL.md +48 -1
- package/skills/guide/SKILL.md +35 -13
- package/skills/inbox/SKILL.md +9 -0
- package/skills/join/SKILL.md +1 -1
- package/skills/prereqs/BUS-CROSS-REPO.md +33 -16
- package/skills/prereqs/METHODOLOGY-CONTRACT.md +96 -17
- package/skills/prereqs/SKILL.md +1 -1
- package/skills/propose/SKILL.md +82 -19
- package/skills/read-spec/SKILL.md +76 -0
- package/skills/reply/SKILL.md +42 -9
- package/skills/review/SKILL.md +71 -25
- package/skills/review/checklist.md +2 -2
- package/skills/say/SKILL.md +40 -4
- package/skills/setup/SKILL.md +59 -5
- package/skills/setup/troubleshooting.md +11 -3
- package/skills/stats/SKILL.md +160 -0
- package/skills/status/SKILL.md +116 -0
- package/skills/test/SKILL.md +38 -11
- package/skills/up-code/SKILL.md +20 -13
- package/skills/update/SKILL.md +32 -1
- package/skills/verify/SKILL.md +85 -40
- package/templates/compact-guidance.md +10 -0
- package/templates/methodology-guide.md +5 -0
package/skills/verify/SKILL.md
CHANGED
|
@@ -8,7 +8,7 @@ user-invocable: true
|
|
|
8
8
|
|
|
9
9
|
This skill is a **wrapper** that builds a **structured briefing** with the test command and criteria already extracted, delegates the analysis to the `refacil-validator` sub-agent, and handles the interaction with the user to apply corrections.
|
|
10
10
|
|
|
11
|
-
**Prerequisites**: `sdd` profile from `refacil-prereqs/SKILL.md` + rules from `METHODOLOGY-CONTRACT.md` (including **§3.
|
|
11
|
+
**Prerequisites**: `sdd` profile from `refacil-prereqs/SKILL.md` + rules from `METHODOLOGY-CONTRACT.md` (including **§3.2** — `/refacil:test` owns full test+coverage; verify defaults to **no re-run** when test memory exists).
|
|
12
12
|
|
|
13
13
|
## Flow
|
|
14
14
|
|
|
@@ -19,15 +19,18 @@ Determine the scope before invoking the sub-agent. Prioritize in this order:
|
|
|
19
19
|
2. Active change in `refacil-sdd/changes/`.
|
|
20
20
|
3. If there are multiple active changes and no `$ARGUMENTS`, **stop** and ask the user to explicitly select which change to validate.
|
|
21
21
|
|
|
22
|
-
**
|
|
22
|
+
**Autopilot mode detection**: once `changeName` is resolved, try to read `refacil-sdd/.autopilot-active`. If the file exists and its `changeName` field matches → `autopilotMode = true`. Otherwise `autopilotMode = false` (normal mode, ask user as usual).
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**Test execution intent** — see **§3.2**:
|
|
25
25
|
|
|
26
|
-
-
|
|
26
|
+
- **Default**: `testExecution: none` when `get-memory` has `commandsRun` and `lastStep` is `test` (or later) — verify validates CA/CR **without** re-running the test pipeline.
|
|
27
27
|
|
|
28
|
-
- **`
|
|
28
|
+
- **`testExecution: full`** if the user explicitly asked to re-run tests (`full`, `all tests`, `re-run`, `run tests`, `ejecutar tests`, `whole suite`, `suite completa`, `todas`) — then also set `testScope` / `runCoverage` like **`/refacil:test`**:
|
|
29
|
+
- **`testScope: full`** for whole-suite tokens above.
|
|
30
|
+
- **`runCoverage: false`** for `no coverage`, `nocoverage`, `skip coverage`, `sin cobertura`, `quick`, `solo tests`.
|
|
31
|
+
- **`full` + `no coverage`**: `testScope: full`, `runCoverage: false`.
|
|
29
32
|
|
|
30
|
-
-
|
|
33
|
+
- **No test memory** (`commandsRun` empty): emit WARNING, set `testExecution: full` (CR-01) unless only `changedFiles` allow a minimal scoped run.
|
|
31
34
|
|
|
32
35
|
Do not invoke the sub-agent with ambiguous scope.
|
|
33
36
|
|
|
@@ -41,19 +44,28 @@ If **this session** inspects the change directory before or after delegating, ap
|
|
|
41
44
|
|
|
42
45
|
Before invoking the sub-agent, extract the context that the validator would otherwise calculate on its own:
|
|
43
46
|
|
|
47
|
+
0. **CodeGraph detection** — run `refacil-sdd-ai codegraph status --json` and extract:
|
|
48
|
+
- `codegraphAvailable = true` if `installed === true` AND `initialized === true`
|
|
49
|
+
- `codegraphAvailable = false` otherwise
|
|
50
|
+
- Include `codegraphAvailable` as a field in the briefing so the validator can use CodeGraph for Dimension 3 (Coherence) analysis when available (see `METHODOLOGY-CONTRACT.md §3C`).
|
|
51
|
+
|
|
44
52
|
1. **Scope files** — run `git diff --name-only HEAD` to populate `changedFiles`.
|
|
45
53
|
|
|
46
|
-
2. **Cross-skill memory** — when `changeName` is known, run `refacil-sdd-ai sdd get-memory <changeName> --json`. Parse `commandsRun` and `
|
|
54
|
+
2. **Cross-skill memory** — when `changeName` is known, run `refacil-sdd-ai sdd get-memory <changeName> --json`. Parse `commandsRun`, `criteriaRun`, and `lastStep`. If the output is `{}` or the command fails, omit those fields — do not block verification (CR-04).
|
|
55
|
+
|
|
56
|
+
3. **Resolve `testExecution`** (§3.2) from Step 0 and memory:
|
|
57
|
+
- User forced re-run → `testExecution: full`.
|
|
58
|
+
- `commandsRun` non-empty and `lastStep` is `test` (or `verify`/`review` after test) and user did **not** force re-run → `testExecution: none`.
|
|
59
|
+
- Otherwise → `testExecution: full` with WARNING (no test phase recorded).
|
|
47
60
|
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
- If you cannot build any scoped command, fall back to baseline §3 and add a one-line WARNING in the handoff that the run may be heavy.
|
|
61
|
+
4. **Test commands** — only when `testExecution` is `full` or `smoke`:
|
|
62
|
+
- **`full`**: follow §3.1 — set `testScope` and `runCoverage` from Step 0; build `testCommand` (scoped from `changedFiles` or baseline if `full`); set `coverageCommand` when `runCoverage: true`.
|
|
63
|
+
- **`smoke`**: build `smokeTestCommand` for companion tests of `correctionTouchedFiles` only; `runCoverage: false`, `coverageCommand: null`.
|
|
64
|
+
- **`none`**: omit `testCommand` and `coverageCommand`; set `testsDelegatedFrom: test` and include `commandsRun` for the report.
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
5. **Coverage command** — only when `testExecution: full` and `runCoverage: true`; otherwise `coverageCommand: null`.
|
|
55
67
|
|
|
56
|
-
|
|
68
|
+
6. **CA/CR criteria** — if there is an active change, read the specification in `refacil-sdd/changes/<changeName>/`:
|
|
57
69
|
- `specs.md` if it exists, and/or files under `specs/` (recursively).
|
|
58
70
|
- Extract the list of CA-XX (acceptance criteria) and CR-XX (rejection criteria) with their descriptions.
|
|
59
71
|
- If there are no specs or the scope is `git-diff`, omit this field.
|
|
@@ -63,10 +75,14 @@ Build the BRIEFING block:
|
|
|
63
75
|
```
|
|
64
76
|
BRIEFING:
|
|
65
77
|
changeName: <name or null if scope=git-diff>
|
|
66
|
-
|
|
78
|
+
testExecution: none | smoke | full
|
|
79
|
+
testCommand: <required when full; omit when none>
|
|
80
|
+
smokeTestCommand: <required when smoke; omit otherwise>
|
|
67
81
|
testScope: scoped | full
|
|
68
82
|
runCoverage: true | false
|
|
69
|
-
coverageCommand: <project coverage entrypoint or null>
|
|
83
|
+
coverageCommand: <project coverage entrypoint or null when full+runCoverage>
|
|
84
|
+
testsDelegatedFrom: test | null
|
|
85
|
+
correctionTouchedFiles: [...] # only on re-verify after Step 5 corrections
|
|
70
86
|
criteria:
|
|
71
87
|
acceptance:
|
|
72
88
|
- CA-01: <description>
|
|
@@ -75,6 +91,7 @@ criteria:
|
|
|
75
91
|
- CR-01: <description>
|
|
76
92
|
changedFiles: [path/file-1, ...]
|
|
77
93
|
mode: concise | detailed
|
|
94
|
+
codegraphAvailable: true | false # from CodeGraph detection in Step 1.0
|
|
78
95
|
commandsRun: [<command>, ...] # from memory.yaml — omit if not present
|
|
79
96
|
criteriaRun: [CA-01, CR-01, ...] # from memory.yaml — omit if not present
|
|
80
97
|
```
|
|
@@ -84,15 +101,29 @@ criteriaRun: [CA-01, CR-01, ...] # from memory.yaml — omit if not presen
|
|
|
84
101
|
Invoke `refacil-validator` passing it the BRIEFING from the previous step.
|
|
85
102
|
|
|
86
103
|
The sub-agent:
|
|
87
|
-
-
|
|
88
|
-
-
|
|
104
|
+
- Applies **`testExecution`** from the briefing (§3.2) — **does not** run tests when `none`.
|
|
105
|
+
- When `full`, uses `testCommand` / coverage per §3.1; when `smoke`, runs only `smokeTestCommand` (no coverage).
|
|
89
106
|
- Uses `criteria` from the briefing for verification (without re-reading specs from scratch).
|
|
90
107
|
- Uses `changedFiles` to focus the 3D verification on those files.
|
|
91
|
-
- Applies the 3D framework (Completeness/Correctness/Coherence)
|
|
92
|
-
-
|
|
108
|
+
- Applies the **3D framework (Completeness/Correctness/Coherence)** per **`METHODOLOGY-CONTRACT.md §3C — 3C Criterion`** — including the severity table and graceful degradation rule.
|
|
109
|
+
- If `codegraphAvailable: true` is in the briefing, uses CodeGraph on `changedFiles` for Dimension 3 (Coherence) analysis.
|
|
93
110
|
- Optionally consults the bus cross-repo for ambiguities.
|
|
94
111
|
- Returns combined report + JSON block fenced as ` ```refacil-verify-result `.
|
|
95
112
|
|
|
113
|
+
### Step 2.5: Log CodeGraph telemetry (silent)
|
|
114
|
+
|
|
115
|
+
After the sub-agent completes, run **once** (do not mention it to the user unless it fails):
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
refacil-sdd-ai compact log-codegraph-event --skill validator --has-graph <true|false> --tool-calls <N> --tokens <N>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- `--has-graph`: the `codegraphAvailable` value from Step 1.0 of this skill.
|
|
122
|
+
- `--tool-calls`: number of `codegraph_*` tool calls the sub-agent made (0 if it did not use the graph).
|
|
123
|
+
- `--tokens`: conservative estimate of tokens saved (~800–1500 per useful tool call; 0 if no graph or no calls).
|
|
124
|
+
|
|
125
|
+
Estimate `--tool-calls` and `--tokens` from the sub-agent's `<usage>` block using the same criteria as `explore/SKILL.md` Step 1.5. If the command fails, ignore it; it must not block the flow.
|
|
126
|
+
|
|
96
127
|
### Step 3: Present the report
|
|
97
128
|
|
|
98
129
|
Show the user the **combined report** (everything before the `refacil-verify-result` block). Do not show the JSON block — it is internal metadata.
|
|
@@ -117,28 +148,38 @@ Parse the ` ```refacil-verify-result ` block from the sub-agent.
|
|
|
117
148
|
|
|
118
149
|
#### If `result` is APPROVED:
|
|
119
150
|
|
|
120
|
-
|
|
121
|
-
RESULT: APPROVED
|
|
151
|
+
Record that verification completed successfully:
|
|
122
152
|
|
|
123
|
-
|
|
124
|
-
|
|
153
|
+
```bash
|
|
154
|
+
refacil-sdd-ai sdd set-memory <changeName> --state verified --actor verify-skill
|
|
125
155
|
```
|
|
126
156
|
|
|
127
|
-
|
|
157
|
+
If the command fails, continue silently — it must not block the flow.
|
|
128
158
|
|
|
129
|
-
|
|
159
|
+
- `autopilotMode = false` (normal): ask the user:
|
|
160
|
+
```
|
|
161
|
+
RESULT: APPROVED
|
|
130
162
|
|
|
131
|
-
|
|
132
|
-
|
|
163
|
+
The next step is the quality review with the team checklist.
|
|
164
|
+
Do you want me to continue with `/refacil:review`?
|
|
165
|
+
```
|
|
166
|
+
- `autopilotMode = true`: proceed to `/refacil:review` immediately without asking.
|
|
133
167
|
|
|
134
|
-
|
|
135
|
-
1. [CRITICAL/WARNING] [description] — [suggested fix]
|
|
136
|
-
2. ...
|
|
168
|
+
#### If `result` is REQUIRES_CORRECTIONS:
|
|
137
169
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
170
|
+
- `autopilotMode = false` (normal): present the issues and ask:
|
|
171
|
+
```
|
|
172
|
+
RESULT: REQUIRES_CORRECTIONS
|
|
173
|
+
|
|
174
|
+
Required corrections:
|
|
175
|
+
1. [CRITICAL/WARNING] [description] — [suggested fix]
|
|
176
|
+
2. ...
|
|
177
|
+
|
|
178
|
+
Do you want me to apply these corrections? (yes/no)
|
|
179
|
+
- Yes: I will apply the fixes and automatically re-verify
|
|
180
|
+
- No: you can fix them manually and then continue with /refacil:verify
|
|
181
|
+
```
|
|
182
|
+
- `autopilotMode = true`: apply corrections automatically (yes internally) without asking, then re-verify. If still failing after 2 rounds → abort (return failure to the autopilot pipeline without asking the user).
|
|
142
183
|
|
|
143
184
|
### Step 5: Apply corrections (if the user accepts)
|
|
144
185
|
|
|
@@ -146,16 +187,20 @@ Do you want me to apply these corrections? (yes/no)
|
|
|
146
187
|
|
|
147
188
|
1. Apply ONLY the listed corrections — do not add new functionality, do not refactor unrelated code.
|
|
148
189
|
2. If there are tests that need adjustment, adjust them as well.
|
|
149
|
-
3. Show summary of modified files
|
|
150
|
-
4. **
|
|
190
|
+
3. Show summary of modified files; record paths in `correctionTouchedFiles`.
|
|
191
|
+
4. **Re-verify** (max 2 rounds): rebuild briefing with `testExecution: smoke` on companion tests of `correctionTouchedFiles`, **or** `testExecution: none` and tell the user:
|
|
192
|
+
```
|
|
193
|
+
Corrections applied. Run /refacil:test before the next full verify to refresh the test suite.
|
|
194
|
+
```
|
|
195
|
+
**Never** set `testExecution: full` in autofix re-verify unless the user explicitly requested re-run in this invocation.
|
|
151
196
|
5. Maximum **2 rounds** of automatic correction. If issues persist, list them for manual correction.
|
|
152
197
|
|
|
153
|
-
**If the user does not accept:** list the issues for manual correction. Suggest `/refacil:
|
|
198
|
+
**If the user does not accept:** list the issues for manual correction. Suggest `/refacil:test` then `/refacil:verify`.
|
|
154
199
|
|
|
155
200
|
## Rules
|
|
156
201
|
|
|
157
202
|
- **Always build the briefing (Step 1) before delegating** — reduces the sub-agent tool calls.
|
|
158
|
-
- **Defaults**: `
|
|
203
|
+
- **Defaults**: `testExecution: none` when test memory exists; **`testExecution: full`** only when Step 0 forces re-run or CR-01 applies. Smoke only after corrections; never full suite in autofix rounds.
|
|
159
204
|
- **Always delegate to the sub-agent** for the analysis. Do not replicate spec reading or test execution logic here.
|
|
160
205
|
- **Dotfiles in `refacil-sdd/changes/`**: never assert absence of `.review-passed` without `-a`; see §8.
|
|
161
206
|
- **Corrections are ONLY applied by this wrapper** (Step 5), after explicit approval.
|
|
@@ -164,4 +209,4 @@ Do you want me to apply these corrections? (yes/no)
|
|
|
164
209
|
- **Sub-agent failsafe (CA-01)**: if the validator fails to load (tool error) or returns no response — stop and inform the user. Do NOT escalate to any other agent.
|
|
165
210
|
- **Unstructured output (CA-02)**: if the validator responds but without a `refacil-verify-result` block — show the raw report and stop. Do NOT re-invoke another agent.
|
|
166
211
|
- **SCOPE_ERROR (CR-03)**: if the validator returns `SCOPE_ERROR: <reason>` — propagate and ask for clarification. CA-01 does NOT apply here.
|
|
167
|
-
- **Flow continuity**: if the result is APPROVED and the user confirms affirmatively, immediately
|
|
212
|
+
- **Flow continuity**: if the result is APPROVED and the user confirms affirmatively, immediately execute `/refacil:review`. (See `METHODOLOGY-CONTRACT.md §5`.)
|
|
@@ -41,5 +41,15 @@ Rules to minimize context consumption when working in this repository.
|
|
|
41
41
|
- `docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"`.
|
|
42
42
|
- `docker logs --tail 100` always; never full logs.
|
|
43
43
|
|
|
44
|
+
**CodeGraph (when available)**
|
|
45
|
+
When `codegraph_*` MCP tools are present in the session, prefer them over `Grep`, `Read`, and `Glob` for all structural queries:
|
|
46
|
+
- Symbol lookup → `codegraph_search` before `Grep`
|
|
47
|
+
- Tracing flows → `codegraph_callers` / `codegraph_callees`
|
|
48
|
+
- Module context → `codegraph_context` (replaces reading multiple files)
|
|
49
|
+
- Impact analysis → `codegraph_impact` before touching shared code
|
|
50
|
+
- Fall back to native tools only for literal text search or when CodeGraph returns empty results.
|
|
51
|
+
|
|
52
|
+
If the session context contains a `[refacil-sdd-ai] CodeGraph` message (CLI not installed or repo not indexed): relay it to the user in the first response and offer to run `/refacil:update`.
|
|
53
|
+
|
|
44
54
|
**General rule**
|
|
45
55
|
When in doubt between verbosity and conciseness, choose conciseness. The user can request detail on demand.
|
|
@@ -18,9 +18,14 @@ Skills are identical in `.claude/skills/refacil-*/` (Claude Code) and `.cursor/s
|
|
|
18
18
|
| `/refacil:up-code` | Push code and create PR |
|
|
19
19
|
| `/refacil:bug` | Guided bugfix flow |
|
|
20
20
|
| `/refacil:update` | Apply pending **methodology** migrations (same engine as `notify-update`; e.g. `AGENTS.md` → `.agents/` index pattern) |
|
|
21
|
+
| `/refacil:stats` | Show change progress, task status, review gate, and test commands from SDD artifacts |
|
|
22
|
+
| `/refacil:read-spec` | Listen to a change's specs in the browser with on-device TTS |
|
|
23
|
+
| `/refacil:autopilot` | Autonomous pipeline: chains `apply → test → verify → review → archive` in one invocation; `up-code` (push + PR) optional via pre-flight. Optional WhatsApp notification via Kapso |
|
|
21
24
|
|
|
22
25
|
**Typical feature flow:** `setup` → `explore` (optional) → `propose` → `apply` → `test` → `verify` → `review` → `archive` → `up-code`.
|
|
23
26
|
|
|
27
|
+
**Autonomous alternative:** after `propose` is approved, `/refacil:autopilot` chains `apply → test → verify → review → archive` (and optionally `up-code`) in a single invocation instead of running each step manually.
|
|
28
|
+
|
|
24
29
|
**Bug flow:** `bug` replaces `propose`/`apply` for the fix path; then `test` / `review` / `archive` / `up-code` as appropriate (see skill `refacil:bug`).
|
|
25
30
|
|
|
26
31
|
**Legacy layout:** if the repo still has **`openspec/changes/`**, run any **`refacil-sdd-ai sdd …`** command or open a session ( **`check-update`** ) to migrate into **`refacil-sdd/`**; then remove **`openspec/`** when no longer referenced. Optional OpenSpec CLI (**`opsx:*`**) may coexist; SDD-AI uses **`refacil-sdd/`** and **`/refacil:*`** as the primary interface.
|