refacil-sdd-ai 4.2.4 → 4.4.0
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/README.md +239 -214
- package/agents/auditor.md +189 -184
- package/agents/debugger.md +201 -204
- package/agents/implementer.md +150 -149
- package/agents/investigator.md +80 -89
- package/agents/proposer.md +219 -124
- package/agents/tester.md +140 -144
- package/agents/validator.md +153 -145
- package/bin/cli.js +158 -116
- package/lib/bus/askFulfillment.js +17 -17
- package/lib/bus/broker.js +599 -599
- package/lib/bus/ui/app.js +318 -318
- package/lib/commands/sdd.js +447 -0
- package/lib/hooks.js +236 -236
- package/lib/installer.js +58 -2
- package/lib/methodology-migration-pending.js +101 -136
- package/package.json +4 -6
- package/skills/apply/SKILL.md +139 -120
- package/skills/archive/SKILL.md +105 -107
- package/skills/ask/SKILL.md +78 -78
- package/skills/attend/SKILL.md +70 -70
- package/skills/bug/SKILL.md +121 -128
- package/skills/explore/SKILL.md +73 -63
- package/skills/guide/SKILL.md +79 -79
- package/skills/inbox/SKILL.md +43 -43
- package/skills/join/SKILL.md +82 -82
- package/skills/prereqs/BUS-CROSS-REPO.md +55 -55
- package/skills/prereqs/METHODOLOGY-CONTRACT.md +122 -115
- package/skills/prereqs/SKILL.md +30 -37
- package/skills/propose/SKILL.md +103 -102
- package/skills/reply/SKILL.md +44 -44
- package/skills/review/SKILL.md +163 -126
- package/skills/review/checklist-back.md +92 -92
- package/skills/review/checklist-front.md +72 -72
- package/skills/review/checklist.md +114 -114
- package/skills/say/SKILL.md +38 -38
- package/skills/setup/SKILL.md +85 -141
- package/skills/setup/troubleshooting.md +38 -35
- package/skills/test/SKILL.md +104 -94
- package/skills/test/testing-patterns.md +63 -63
- package/skills/up-code/SKILL.md +108 -108
- package/skills/update/SKILL.md +109 -132
- package/skills/verify/SKILL.md +159 -132
- package/templates/compact-guidance.md +45 -45
- package/templates/methodology-guide.md +46 -42
- package/config/openspec-config.yaml +0 -8
- package/skills/prereqs/OPENSPEC-DELTAS.md +0 -51
package/skills/setup/SKILL.md
CHANGED
|
@@ -1,207 +1,151 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: refacil:setup
|
|
3
|
-
description:
|
|
3
|
+
description: Configure the repository for SDD-AI — refacil-sdd layout, AGENTS.md / .agents/, IDE indexes, and methodology hooks
|
|
4
4
|
user-invocable: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# refacil:setup —
|
|
7
|
+
# refacil:setup — Repository Configuration
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Guides the developer **step by step**. After each step, report the result; if it fails, **stop** and give the error. Installation or PATH failures: see [troubleshooting.md](troubleshooting.md) in this skill (`refacil-setup`).
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Process
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Step 1: Node.js
|
|
14
14
|
|
|
15
|
-
`node --version` >= 20.19.0.
|
|
15
|
+
`node --version` >= 20.19.0. If not: indicate the requirement and stop.
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### Step 2: Verify refacil-sdd-ai
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
20
|
+
refacil-sdd-ai --version 2>&1
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Verify the CLI is installed. If it fails: `npm install -g refacil-sdd-ai`, re-verify. If it still fails: indicate the user to install Node.js >= 20.19.0 and retry.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`openspec config set workflows` no acepta arrays por CLI. La unica forma de configurar los workflows es editando el archivo de config directamente:
|
|
25
|
+
Verify the `sdd` subcommand is available:
|
|
28
26
|
|
|
29
27
|
```bash
|
|
30
|
-
|
|
31
|
-
const fs=require('fs');
|
|
32
|
-
const {execSync}=require('child_process');
|
|
33
|
-
const p=execSync('openspec config path',{encoding:'utf8'}).trim();
|
|
34
|
-
const c=JSON.parse(fs.readFileSync(p,'utf8'));
|
|
35
|
-
c.profile='custom';
|
|
36
|
-
c.workflows=['propose','explore','apply','archive','verify'];
|
|
37
|
-
fs.writeFileSync(p,JSON.stringify(c,null,2));
|
|
38
|
-
console.log('Workflows configurados:',c.workflows.join(', '));
|
|
39
|
-
"
|
|
40
|
-
openspec config list
|
|
28
|
+
refacil-sdd-ai sdd 2>&1 || true
|
|
41
29
|
```
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Paso 4: Init en el repo
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
openspec init --tools claude,cursor
|
|
49
|
-
```
|
|
31
|
+
Confirm that the subcommands `status`, `mark-reviewed`, `tasks-update`, and `archive` appear in the help.
|
|
50
32
|
|
|
51
|
-
|
|
33
|
+
### Step 3: Create changes directory
|
|
52
34
|
|
|
53
|
-
|
|
35
|
+
If `refacil-sdd/changes/` does not exist, create it:
|
|
54
36
|
|
|
55
37
|
```bash
|
|
56
|
-
|
|
57
|
-
const fs=require('fs');
|
|
58
|
-
const path=require('path');
|
|
59
|
-
const requiredSkills=new Set(['openspec-propose','openspec-explore','openspec-apply-change','openspec-archive-change','openspec-verify-change']);
|
|
60
|
-
const requiredCmdsOpsx=new Set(['apply.md','archive.md','explore.md','propose.md','verify.md']);
|
|
61
|
-
const requiredCmdsCursor=new Set(['opsx-apply.md','opsx-archive.md','opsx-explore.md','opsx-propose.md','opsx-verify.md']);
|
|
62
|
-
// Skills sobrantes
|
|
63
|
-
for(const base of ['.claude/skills','.cursor/skills']){
|
|
64
|
-
if(!fs.existsSync(base)) continue;
|
|
65
|
-
for(const d of fs.readdirSync(base)){
|
|
66
|
-
if(d.startsWith('openspec-') && !requiredSkills.has(d)){
|
|
67
|
-
fs.rmSync(path.join(base,d),{recursive:true,force:true});
|
|
68
|
-
console.log('Eliminada skill:',path.join(base,d));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Commands sobrantes — .claude/commands/opsx/ (archivos .md)
|
|
73
|
-
const claudeCmds='.claude/commands/opsx';
|
|
74
|
-
if(fs.existsSync(claudeCmds)){
|
|
75
|
-
for(const f of fs.readdirSync(claudeCmds)){
|
|
76
|
-
if(f.endsWith('.md') && !requiredCmdsOpsx.has(f)){
|
|
77
|
-
fs.rmSync(path.join(claudeCmds,f),{force:true});
|
|
78
|
-
console.log('Eliminado command:',path.join(claudeCmds,f));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Commands sobrantes — .cursor/commands/ (archivos opsx-*.md)
|
|
83
|
-
const cursorCmds='.cursor/commands';
|
|
84
|
-
if(fs.existsSync(cursorCmds)){
|
|
85
|
-
for(const f of fs.readdirSync(cursorCmds)){
|
|
86
|
-
if(f.startsWith('opsx-') && f.endsWith('.md') && !requiredCmdsCursor.has(f)){
|
|
87
|
-
fs.rmSync(path.join(cursorCmds,f),{force:true});
|
|
88
|
-
console.log('Eliminado command:',path.join(cursorCmds,f));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
"
|
|
38
|
+
mkdir -p refacil-sdd/changes
|
|
93
39
|
```
|
|
94
40
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Si no existe, crear con `language: spanish` (y comentario de terminos tecnicos en ingles). Si existe, asegurar `language: spanish`.
|
|
41
|
+
Inform the user that SDD artifacts will be stored in `refacil-sdd/changes/<change-name>/`.
|
|
98
42
|
|
|
99
|
-
###
|
|
43
|
+
### Step 4: Generate `.agents/` and `AGENTS.md`
|
|
100
44
|
|
|
101
|
-
|
|
45
|
+
Analyze the repo and generate the documentation structure. If they already exist, ask whether to regenerate.
|
|
102
46
|
|
|
103
|
-
**
|
|
47
|
+
**4.1 Analysis** — Read if they exist: `package.json`, `tsconfig*.json`, `nest-cli.json`, `angular.json`, `README.md`, eslint, jest, `ls` root, Docker, `.env.example`.
|
|
104
48
|
|
|
105
|
-
**
|
|
49
|
+
**4.2 Mandatory architecture: `.agents/` folder + `AGENTS.md` index**
|
|
106
50
|
|
|
107
|
-
|
|
51
|
+
Always generate this structure — never a monolithic file:
|
|
108
52
|
|
|
109
|
-
|
|
110
|
-
- `.agents/summary.md` —
|
|
111
|
-
- `.agents/architecture.md` —
|
|
112
|
-
- `.agents/stack.md` —
|
|
113
|
-
- `.agents/testing.md` —
|
|
114
|
-
- `.agents/commands.md` —
|
|
53
|
+
Create the `.agents/` folder with one `.md` file per thematic area. Typical files (adapt to the actual project):
|
|
54
|
+
- `.agents/summary.md` — brief description, table (language, framework, tests, package manager), essential scripts with one sentence each, critical rules condensed (Always / Never / Ask, max 5 bullets each block).
|
|
55
|
+
- `.agents/architecture.md` — modules, services, main flows, key patterns.
|
|
56
|
+
- `.agents/stack.md` — dependencies, environment variables, databases, integrations.
|
|
57
|
+
- `.agents/testing.md` — strategy, commands, conventions, fixtures.
|
|
58
|
+
- `.agents/commands.md` — development commands, aliases, CI/CD scripts.
|
|
115
59
|
|
|
116
|
-
|
|
60
|
+
A monorepo may add `.agents/services.md`; a library may combine testing in stack. Adapt to the project.
|
|
117
61
|
|
|
118
|
-
`AGENTS.md`
|
|
119
|
-
1.
|
|
120
|
-
2.
|
|
121
|
-
3.
|
|
122
|
-
4.
|
|
62
|
+
`AGENTS.md` is the **pure index** — it does not contain project detail, only:
|
|
63
|
+
1. One line describing the project.
|
|
64
|
+
2. For each file in `.agents/`: area name + relative link + when to read that file (one sentence).
|
|
65
|
+
3. Section `## SDD-AI Methodology` with the complete table of `refacil:*` commands — always in `AGENTS.md`, never in `.agents/`. If it already exists, overwrite it with the updated content; if not, create it.
|
|
66
|
+
4. `compact-guidance` block (auto-managed by `refacil-sdd-ai`, do not edit).
|
|
123
67
|
|
|
124
|
-
**
|
|
68
|
+
**Mandatory content of `## SDD-AI Methodology`** (insert literally, before the `compact-guidance` block):
|
|
125
69
|
|
|
126
70
|
```markdown
|
|
127
|
-
##
|
|
71
|
+
## SDD-AI Methodology
|
|
128
72
|
|
|
129
|
-
|
|
|
73
|
+
| Command | Description |
|
|
130
74
|
|---------|-------------|
|
|
131
|
-
| `/refacil:setup` |
|
|
132
|
-
| `/refacil:guide` |
|
|
133
|
-
| `/refacil:explore` |
|
|
134
|
-
| `/refacil:propose` |
|
|
135
|
-
| `/refacil:apply` |
|
|
136
|
-
| `/refacil:test` |
|
|
137
|
-
| `/refacil:verify` |
|
|
138
|
-
| `/refacil:review` |
|
|
139
|
-
| `/refacil:archive` |
|
|
140
|
-
| `/refacil:up-code` |
|
|
141
|
-
| `/refacil:bug` |
|
|
142
|
-
| `/refacil:update` |
|
|
143
|
-
| `/refacil:join` |
|
|
144
|
-
| `/refacil:say` |
|
|
145
|
-
| `/refacil:ask` |
|
|
146
|
-
| `/refacil:reply` |
|
|
147
|
-
| `/refacil:attend` |
|
|
148
|
-
| `/refacil:inbox` |
|
|
75
|
+
| `/refacil:setup` | Install and configure the methodology in the repo |
|
|
76
|
+
| `/refacil:guide` | View flow guide and choose next step |
|
|
77
|
+
| `/refacil:explore` | Explore the codebase without modifying files |
|
|
78
|
+
| `/refacil:propose` | Create a change proposal (proposal, specs, design, tasks) |
|
|
79
|
+
| `/refacil:apply` | Implement the tasks of an approved proposal |
|
|
80
|
+
| `/refacil:test` | Run and review tests for the current change |
|
|
81
|
+
| `/refacil:verify` | Verify implementation against the specs |
|
|
82
|
+
| `/refacil:review` | Quality audit of the implemented code |
|
|
83
|
+
| `/refacil:archive` | Archive the change and sync specs to the historical record |
|
|
84
|
+
| `/refacil:up-code` | Update existing code to current patterns |
|
|
85
|
+
| `/refacil:bug` | Create a fix proposal for a detected bug |
|
|
86
|
+
| `/refacil:update` | Migrate documentation to the current methodology pattern |
|
|
87
|
+
| `/refacil:join` | Join the cross-repo bus (first service setup) |
|
|
88
|
+
| `/refacil:say` | Send a message to another agent via bus |
|
|
89
|
+
| `/refacil:ask` | Make a query to another agent and wait for response |
|
|
90
|
+
| `/refacil:reply` | Reply to a query received via bus |
|
|
91
|
+
| `/refacil:attend` | Attend and respond to pending bus messages |
|
|
92
|
+
| `/refacil:inbox` | View pending messages on the bus |
|
|
149
93
|
```
|
|
150
94
|
|
|
151
|
-
**
|
|
95
|
+
**4.3 Fallback** — If the analysis fails: create `.agents/summary.md` with minimal summary + refacil table + TODOs, and `AGENTS.md` as an index pointing to that single file.
|
|
152
96
|
|
|
153
|
-
**
|
|
97
|
+
**4.4** — Show the result to the user; if they approve, write the files.
|
|
154
98
|
|
|
155
|
-
**
|
|
156
|
-
- `refacil-sdd-ai`
|
|
157
|
-
-
|
|
99
|
+
**4.5 compact-guidance block**:
|
|
100
|
+
- `refacil-sdd-ai` injects into `AGENTS.md` a block between `compact-guidance` markers with compact output rules.
|
|
101
|
+
- Automatically synced on each `SessionStart`. Do not edit the content between markers.
|
|
158
102
|
|
|
159
|
-
###
|
|
103
|
+
### Step 4b: Overwrite `CLAUDE.md` and `.cursorrules`
|
|
160
104
|
|
|
161
|
-
|
|
105
|
+
Always **overwrite** both files even if they already exist — they are thin indexes toward `AGENTS.md`, they must not contain project detail.
|
|
162
106
|
|
|
163
|
-
**`CLAUDE.md`** —
|
|
107
|
+
**`CLAUDE.md`** — minimal index, no project content:
|
|
164
108
|
|
|
165
109
|
```
|
|
166
110
|
# CLAUDE.md
|
|
167
111
|
|
|
168
|
-
|
|
169
|
-
|
|
112
|
+
Full project context: see `AGENTS.md` (index) and `.agents/` (detail by area).
|
|
113
|
+
If `AGENTS.md` does not exist, run `/refacil:setup`.
|
|
170
114
|
```
|
|
171
115
|
|
|
172
|
-
**`.cursorrules`** —
|
|
116
|
+
**`.cursorrules`** — identical content with header `# Cursor Rules`.
|
|
173
117
|
|
|
174
|
-
|
|
118
|
+
All project detail, stack, rules and `refacil:*` commands live in `.agents/` and are indexed from `AGENTS.md`. Do not duplicate anything in CLAUDE.md or .cursorrules.
|
|
175
119
|
|
|
176
|
-
###
|
|
120
|
+
### Step 5: Context exclusion files
|
|
177
121
|
|
|
178
|
-
`refacil-sdd-ai init`
|
|
122
|
+
`refacil-sdd-ai init` automatically creates or updates `.claudeignore` and `.cursorignore` with standard entries (node_modules/, dist/, logs, binaries, secrets, etc.).
|
|
179
123
|
|
|
180
|
-
|
|
124
|
+
If the files already exist, only missing entries are added — custom content is not overwritten.
|
|
181
125
|
|
|
182
|
-
|
|
183
|
-
- **
|
|
184
|
-
- **
|
|
185
|
-
- **
|
|
126
|
+
Inform the user of the result:
|
|
127
|
+
- **Created**: both files were created from scratch.
|
|
128
|
+
- **Updated**: missing entries were added.
|
|
129
|
+
- **No changes**: they already had all the entries.
|
|
186
130
|
|
|
187
|
-
|
|
131
|
+
If the user wants to customize additional exclusions, they can edit them directly after setup.
|
|
188
132
|
|
|
189
|
-
###
|
|
133
|
+
### Step 6: Verify skills
|
|
190
134
|
|
|
191
|
-
-
|
|
192
|
-
-
|
|
135
|
+
- Refacil: `refacil-*` folders under `.claude/skills/` and `.cursor/skills/`. If not: `refacil-sdd-ai init` + restart session.
|
|
136
|
+
- Verify `sdd` subcommand: `refacil-sdd-ai sdd 2>&1 || true` — must show subcommands `status`, `mark-reviewed`, `tasks-update`, `archive`.
|
|
193
137
|
|
|
194
|
-
###
|
|
138
|
+
### Step 7: Final summary
|
|
195
139
|
|
|
196
140
|
```
|
|
197
|
-
=== refacil:setup
|
|
198
|
-
Node.js /
|
|
141
|
+
=== refacil:setup completed ===
|
|
142
|
+
Node.js / refacil-sdd-ai / refacil-sdd/changes/ / AGENTS.md / CLAUDE.md / .cursorrules / .claudeignore / .cursorignore / skills OK
|
|
199
143
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
144
|
+
Restart Claude Code or Cursor session if this is the first skills installation.
|
|
145
|
+
The next step is to review the available flow.
|
|
146
|
+
Do you want me to continue with /refacil:guide?
|
|
203
147
|
```
|
|
204
148
|
|
|
205
|
-
##
|
|
149
|
+
## Rules
|
|
206
150
|
|
|
207
|
-
- **
|
|
151
|
+
- **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 7, immediately invoke the **Skill tool** with `skill: "refacil:guide"`. Do not describe it in text or wait for the user to type `/refacil:guide`. (See `METHODOLOGY-CONTRACT.md §5`.)
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
# refacil:setup —
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
# refacil:setup — Troubleshooting
|
|
2
|
+
|
|
3
|
+
Consult this file **only** if a setup step fails. It is not part of the happy path.
|
|
4
|
+
|
|
5
|
+
## `refacil-sdd-ai` command not found after `npm install -g`
|
|
6
|
+
|
|
7
|
+
- Check where npm installs binaries: `npm config get prefix`, then add `[prefix]/bin` (Linux/Mac) or `[prefix]` (Windows) to **PATH** and reopen the terminal / IDE.
|
|
8
|
+
- On Linux/Mac `sudo` is sometimes needed for global installs; it is preferable to fix npm prefix permissions (`npm config set prefix ~/.npm-global`) instead of using sudo.
|
|
9
|
+
|
|
10
|
+
## Skills `refacil-*` do not appear in the IDE
|
|
11
|
+
|
|
12
|
+
- Run `refacil-sdd-ai init` at the repo root and **restart** the Claude Code or Cursor session.
|
|
13
|
+
- If the skills are present in `.claude/skills/` but the IDE does not pick them up, restart the IDE (not just the session).
|
|
14
|
+
|
|
15
|
+
## `refacil-sdd-ai init` creates files inside the wrong directory
|
|
16
|
+
|
|
17
|
+
- Always run `refacil-sdd-ai init` from the **repo root** (where `package.json` lives), not from inside a subdirectory.
|
|
18
|
+
- If you accidentally ran it from a subdirectory, delete the mistakenly created `.claude/`, `.cursor/`, `.claudeignore`, `.cursorignore`, `.cursorrules`, and `CLAUDE.md` from that subdirectory, then re-run from the correct location.
|
|
19
|
+
|
|
20
|
+
## AGENTS.md is missing after init
|
|
21
|
+
|
|
22
|
+
- `refacil-sdd-ai init` does not generate `AGENTS.md` automatically — it is created by `/refacil:setup` inside the IDE.
|
|
23
|
+
- Run `/refacil:setup` after restarting the session.
|
|
24
|
+
|
|
25
|
+
## compact-guidance block not appearing in AGENTS.md
|
|
26
|
+
|
|
27
|
+
- The block is injected by the `check-update` hook (SessionStart). Restart the session to trigger it.
|
|
28
|
+
- If it still does not appear, run `refacil-sdd-ai update` manually.
|
|
29
|
+
|
|
30
|
+
## Hook `check-update` not running at session start
|
|
31
|
+
|
|
32
|
+
- Verify the hook is registered: check `.claude/settings.json` or `.cursor/settings.json` for a `hooks.SessionStart` entry that calls `refacil-sdd-ai check-update`.
|
|
33
|
+
- If missing, run `refacil-sdd-ai init` again (it is idempotent).
|
|
34
|
+
|
|
35
|
+
## `refacil-sdd/` not created after using SDD commands
|
|
36
|
+
|
|
37
|
+
- `refacil-sdd/` is created automatically when you first run `/refacil:propose`.
|
|
38
|
+
- If you had an `openspec/` directory from a previous version, it is migrated to `refacil-sdd/` automatically on the next `refacil-sdd-ai sdd *` command or at session start via `check-update`.
|
package/skills/test/SKILL.md
CHANGED
|
@@ -1,94 +1,104 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: refacil:test
|
|
3
|
-
description:
|
|
4
|
-
user-invocable: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# refacil:test —
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
###
|
|
16
|
-
|
|
17
|
-
**
|
|
18
|
-
- `targetFile` =
|
|
19
|
-
|
|
20
|
-
**
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
###
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
1. **
|
|
31
|
-
2. **
|
|
32
|
-
3. **
|
|
33
|
-
4. **
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
BRIEFING:
|
|
39
|
-
changeName: <
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- CA-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
---
|
|
2
|
+
name: refacil:test
|
|
3
|
+
description: Generate unit tests based on SDD artifacts or for specific files — builds a briefing with CA/CR and file scope, and delegates to the refacil-tester sub-agent for generation and execution in isolated context
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# refacil:test — Test Generation Entrypoint
|
|
8
|
+
|
|
9
|
+
This skill is a **thin wrapper** that resolves the scope, extracts CA/CR criteria and the list of files to test, and delegates to the `refacil-tester` sub-agent with a **structured briefing**. The sub-agent starts with the criteria already extracted — it does not re-read specs from scratch.
|
|
10
|
+
|
|
11
|
+
**Prerequisites**: `sdd` profile from `refacil-prereqs/SKILL.md` + test command from `METHODOLOGY-CONTRACT.md §3`.
|
|
12
|
+
|
|
13
|
+
## Flow
|
|
14
|
+
|
|
15
|
+
### Step 0: Resolve scope
|
|
16
|
+
|
|
17
|
+
**File mode** — if `$ARGUMENTS` contains a file path:
|
|
18
|
+
- `targetFile` = the received path. Continue directly to Step 2 (no spec briefing needed).
|
|
19
|
+
|
|
20
|
+
**Change mode** — if `$ARGUMENTS` is empty or a change name:
|
|
21
|
+
- List the folders in `refacil-sdd/changes/`.
|
|
22
|
+
- If there is exactly one active folder, use it as `changeName`.
|
|
23
|
+
- If there are multiple active folders, **stop** and ask the user to select which one to test.
|
|
24
|
+
- If there are no active changes, inform to run `/refacil:propose` and stop.
|
|
25
|
+
|
|
26
|
+
### Step 1: Build briefing (change mode only)
|
|
27
|
+
|
|
28
|
+
Before invoking the sub-agent, extract the key context:
|
|
29
|
+
|
|
30
|
+
1. **Criteria** — read the change specification (`refacil-sdd/changes/<changeName>/specs.md` and/or `specs/**/*.md` if they exist). Extract the list of acceptance criteria (CA-XX) and rejection criteria (CR-XX) with their descriptions.
|
|
31
|
+
2. **Files to test** — read `refacil-sdd/changes/<changeName>/design.md`. Extract the list of created/modified files.
|
|
32
|
+
3. **Test command** — read `refacil-prereqs/METHODOLOGY-CONTRACT.md §3`. Extract the exact command.
|
|
33
|
+
4. **Test pattern** — find an existing relevant test file (1 example file, not multiple). If `testing-patterns.md` exists in this directory, include it.
|
|
34
|
+
|
|
35
|
+
Build the BRIEFING block to include in the delegation prompt:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
BRIEFING:
|
|
39
|
+
changeName: <name>
|
|
40
|
+
criteria:
|
|
41
|
+
acceptance:
|
|
42
|
+
- CA-01: <description>
|
|
43
|
+
- CA-02: <description>
|
|
44
|
+
rejection:
|
|
45
|
+
- CR-01: <description>
|
|
46
|
+
filesToTest: [path/file-1.ts, path/file-2.ts, ...]
|
|
47
|
+
testCommand: <exact command>
|
|
48
|
+
testPatternFile: <path of an existing test file as reference, or null>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Step 2: Delegate to the refacil-tester sub-agent
|
|
52
|
+
|
|
53
|
+
Invoke the `refacil-tester` sub-agent passing it the BRIEFING (change mode) or directly:
|
|
54
|
+
- `changeName` / `targetFile` as appropriate
|
|
55
|
+
- Full BRIEFING (change mode)
|
|
56
|
+
- If the user explicitly requested detailed mode, indicate it. Default: concise.
|
|
57
|
+
|
|
58
|
+
The sub-agent will use the briefing to generate tests directly without re-reading specs.
|
|
59
|
+
|
|
60
|
+
Returns ONE single message with the report + JSON block fenced as ` ```refacil-test-result `.
|
|
61
|
+
|
|
62
|
+
### Step 3: Present the report and process result
|
|
63
|
+
|
|
64
|
+
Show the user the **report** (everything before the `refacil-test-result` block). Do not show the JSON block — it is internal metadata.
|
|
65
|
+
|
|
66
|
+
If the sub-agent returned something out of format, inform the user: "The tester returned an unstructured report — review the tests manually." and stop.
|
|
67
|
+
|
|
68
|
+
Parse the `refacil-test-result` block from the sub-agent:
|
|
69
|
+
- **If `passed: false`** (tests failed): present the `issues` from the JSON and ask the user how to proceed. **Do not continue to Step 4** until the tests pass.
|
|
70
|
+
- **If `passed: true`**: continue to Step 4.
|
|
71
|
+
|
|
72
|
+
### Step 3.5: Write memory.yaml (CA-16 — cross-skill state)
|
|
73
|
+
|
|
74
|
+
After parsing the `refacil-test-result` block and only if `passed: true`:
|
|
75
|
+
- Extract from the result or from the briefing: `commandsRun` (list of test commands executed), `criteriaRun` (list of CA-XX/CR-XX covered by tests), `stackDetected` (if the tester identified the stack).
|
|
76
|
+
- Write or update `refacil-sdd/changes/<changeName>/memory.yaml` preserving any existing fields:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
lastStep: test
|
|
80
|
+
stackDetected: <detected stack or omit>
|
|
81
|
+
commandsRun:
|
|
82
|
+
- <test command used>
|
|
83
|
+
criteriaRun:
|
|
84
|
+
- CA-01
|
|
85
|
+
- CR-01
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If the file already exists, merge: update `lastStep`, `stackDetected`, `commandsRun`, `criteriaRun`; preserve fields from other steps (e.g. `touchedFiles` from apply).
|
|
89
|
+
|
|
90
|
+
### Step 4: Flow continuity (only if tests passed)
|
|
91
|
+
|
|
92
|
+
Add:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
The next step is to validate the implementation against the specs.
|
|
96
|
+
Do you want me to continue with /refacil:verify?
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Rules
|
|
100
|
+
|
|
101
|
+
- **Always build the briefing in change mode (Step 1) before delegating** — reduces the sub-agent tool calls.
|
|
102
|
+
- **Always delegate to the sub-agent**. Do not replicate stack detection or generation logic here.
|
|
103
|
+
- **Do not invoke with ambiguous scope**. If there are multiple active changes, ask for selection first.
|
|
104
|
+
- **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question **and tests passed (`passed: true`)**, immediately invoke the **Skill tool** with `skill: "refacil:verify"`. Do not describe it in text or wait for the user to type `/refacil:verify`. (See `METHODOLOGY-CONTRACT.md §5`.)
|