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.
Files changed (47) hide show
  1. package/README.md +239 -214
  2. package/agents/auditor.md +189 -184
  3. package/agents/debugger.md +201 -204
  4. package/agents/implementer.md +150 -149
  5. package/agents/investigator.md +80 -89
  6. package/agents/proposer.md +219 -124
  7. package/agents/tester.md +140 -144
  8. package/agents/validator.md +153 -145
  9. package/bin/cli.js +158 -116
  10. package/lib/bus/askFulfillment.js +17 -17
  11. package/lib/bus/broker.js +599 -599
  12. package/lib/bus/ui/app.js +318 -318
  13. package/lib/commands/sdd.js +447 -0
  14. package/lib/hooks.js +236 -236
  15. package/lib/installer.js +58 -2
  16. package/lib/methodology-migration-pending.js +101 -136
  17. package/package.json +4 -6
  18. package/skills/apply/SKILL.md +139 -120
  19. package/skills/archive/SKILL.md +105 -107
  20. package/skills/ask/SKILL.md +78 -78
  21. package/skills/attend/SKILL.md +70 -70
  22. package/skills/bug/SKILL.md +121 -128
  23. package/skills/explore/SKILL.md +73 -63
  24. package/skills/guide/SKILL.md +79 -79
  25. package/skills/inbox/SKILL.md +43 -43
  26. package/skills/join/SKILL.md +82 -82
  27. package/skills/prereqs/BUS-CROSS-REPO.md +55 -55
  28. package/skills/prereqs/METHODOLOGY-CONTRACT.md +122 -115
  29. package/skills/prereqs/SKILL.md +30 -37
  30. package/skills/propose/SKILL.md +103 -102
  31. package/skills/reply/SKILL.md +44 -44
  32. package/skills/review/SKILL.md +163 -126
  33. package/skills/review/checklist-back.md +92 -92
  34. package/skills/review/checklist-front.md +72 -72
  35. package/skills/review/checklist.md +114 -114
  36. package/skills/say/SKILL.md +38 -38
  37. package/skills/setup/SKILL.md +85 -141
  38. package/skills/setup/troubleshooting.md +38 -35
  39. package/skills/test/SKILL.md +104 -94
  40. package/skills/test/testing-patterns.md +63 -63
  41. package/skills/up-code/SKILL.md +108 -108
  42. package/skills/update/SKILL.md +109 -132
  43. package/skills/verify/SKILL.md +159 -132
  44. package/templates/compact-guidance.md +45 -45
  45. package/templates/methodology-guide.md +46 -42
  46. package/config/openspec-config.yaml +0 -8
  47. package/skills/prereqs/OPENSPEC-DELTAS.md +0 -51
@@ -1,207 +1,151 @@
1
1
  ---
2
2
  name: refacil:setup
3
- description: Verificar e instalar OpenSpec, generar AGENTS.md y configurar el repositorio para la metodologia SDD-AI
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 — Configuracion del Repositorio
7
+ # refacil:setup — Repository Configuration
8
8
 
9
- Guia al desarrollador **paso a paso**. Tras cada paso, informa resultado; si falla, **detente** y da el error. Fallos de instalacion o PATH: ver [troubleshooting.md](troubleshooting.md) en esta skill (`refacil-setup`).
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
- ## Proceso
11
+ ## Process
12
12
 
13
- ### Paso 1: Node.js
13
+ ### Step 1: Node.js
14
14
 
15
- `node --version` >= 20.19.0. Si no: indicar requisito y detener.
15
+ `node --version` >= 20.19.0. If not: indicate the requirement and stop.
16
16
 
17
- ### Paso 2: OpenSpec
17
+ ### Step 2: Verify refacil-sdd-ai
18
18
 
19
19
  ```bash
20
- openspec --version 2>&1
20
+ refacil-sdd-ai --version 2>&1
21
21
  ```
22
22
 
23
- Version minima requerida: **1.3.0**. Si falla o es inferior: `npm install -g @fission-ai/openspec@latest`, re-verificar. Si sigue fallando: **troubleshooting.md**.
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
- ### Paso 3: Configurar todos los workflows de OpenSpec
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
- node -e "
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
- Debe verse `profile: custom` y exactamente estos 5 workflows: `propose`, `explore`, `apply`, `archive`, `verify` los unicos que usan los comandos `refacil:*`.
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
- `openspec init` instala `opsx:*` en `.claude/` y `.cursor/`; convive con `refacil:*` — el equipo usa **refacil:*** como interfaz principal.
33
+ ### Step 3: Create changes directory
52
34
 
53
- `openspec init` no elimina skills ni commands de instalaciones anteriores. Después del init, ejecuta este script para limpiar todo lo sobrante:
35
+ If `refacil-sdd/changes/` does not exist, create it:
54
36
 
55
37
  ```bash
56
- node -e "
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
- ### Paso 5: `openspec/config.yaml`
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
- ### Paso 6: Generar `.agents/` y `AGENTS.md`
43
+ ### Step 4: Generate `.agents/` and `AGENTS.md`
100
44
 
101
- Analiza el repo y genera la estructura de documentacion. Si ya existen, pregunta si regenerar.
45
+ Analyze the repo and generate the documentation structure. If they already exist, ask whether to regenerate.
102
46
 
103
- **6.1 Analisis** — Lee si existen: `package.json`, `tsconfig*.json`, `nest-cli.json`, `angular.json`, `README.md`, eslint, jest, `ls` raiz, Docker, `.env.example`.
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
- **6.2 Arquitectura obligatoria: carpeta `.agents/` + indice `AGENTS.md`**
49
+ **4.2 Mandatory architecture: `.agents/` folder + `AGENTS.md` index**
106
50
 
107
- Siempre genera esta estructuranunca un archivo monolitico:
51
+ Always generate this structurenever a monolithic file:
108
52
 
109
- Crea la carpeta `.agents/` con un archivo `.md` por area tematica. Archivos tipicos (adaptar al proyecto real):
110
- - `.agents/summary.md` — descripcion breve, tabla (lenguaje, framework, tests, package manager), scripts esenciales con una frase, reglas criticas condensadas (Siempre / Nunca / Preguntar, max 5 bullets cada bloque).
111
- - `.agents/architecture.md` — modulos, servicios, flujos principales, patrones clave.
112
- - `.agents/stack.md` — dependencias, variables de entorno, bases de datos, integraciones.
113
- - `.agents/testing.md` — estrategia, comandos, convenciones, fixtures.
114
- - `.agents/commands.md` — comandos de desarrollo, alias, scripts de CI/CD.
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
- Un monorepo puede agregar `.agents/services.md`; una libreria puede combinar testing en stack. Adaptar segun el proyecto.
60
+ A monorepo may add `.agents/services.md`; a library may combine testing in stack. Adapt to the project.
117
61
 
118
- `AGENTS.md` es el **indice puro** — no contiene detalle de proyecto, solo:
119
- 1. Una linea de descripcion del proyecto.
120
- 2. Por cada archivo en `.agents/`: nombre del area + enlace relativo + cuando leer ese archivo (una frase).
121
- 3. Seccion `## Metodología SDD-AI` con la tabla completa de comandos `refacil:*` — siempre en `AGENTS.md`, nunca en `.agents/`. Si ya existe, sobreescribirla con el contenido actualizado; si no existe, crearla.
122
- 4. Bloque `compact-guidance` (auto-gestionado por `refacil-sdd-ai`, no editar).
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
- **Contenido obligatorio de `## Metodología SDD-AI`** (insertar literalmente, antes del bloque `compact-guidance`):
68
+ **Mandatory content of `## SDD-AI Methodology`** (insert literally, before the `compact-guidance` block):
125
69
 
126
70
  ```markdown
127
- ## Metodología SDD-AI
71
+ ## SDD-AI Methodology
128
72
 
129
- | Comando | Descripcion |
73
+ | Command | Description |
130
74
  |---------|-------------|
131
- | `/refacil:setup` | Instalar y configurar la metodologia en el repo |
132
- | `/refacil:guide` | Ver guia de flujo y elegir siguiente paso |
133
- | `/refacil:explore` | Explorar el codebase sin modificar archivos |
134
- | `/refacil:propose` | Crear propuesta de cambio (proposal, specs, design, tasks) |
135
- | `/refacil:apply` | Implementar las tasks de una propuesta aprobada |
136
- | `/refacil:test` | Ejecutar y revisar tests del cambio actual |
137
- | `/refacil:verify` | Verificar implementacion contra las specs |
138
- | `/refacil:review` | Auditoria de calidad del codigo implementado |
139
- | `/refacil:archive` | Archivar el cambio y sincronizar specs al historico |
140
- | `/refacil:up-code` | Actualizar codigo existente a patrones actuales |
141
- | `/refacil:bug` | Crear propuesta de fix para un bug detectado |
142
- | `/refacil:update` | Migrar documentacion al patron actual de la metodologia |
143
- | `/refacil:join` | Unirse al bus cross-repo (primer setup del servicio) |
144
- | `/refacil:say` | Enviar mensaje a otro agente via bus |
145
- | `/refacil:ask` | Hacer consulta a otro agente y esperar respuesta |
146
- | `/refacil:reply` | Responder a una consulta recibida via bus |
147
- | `/refacil:attend` | Atender y responder mensajes pendientes del bus |
148
- | `/refacil:inbox` | Ver mensajes pendientes en el bus |
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
- **6.3 Fallback** — Si el analisis falla: crear `.agents/summary.md` con resumen minimo + tabla refacil + TODOs, y `AGENTS.md` como indice apuntando a ese unico archivo.
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
- **6.4** — Muestra el resultado al usuario; si aprueba, escribe los archivos.
97
+ **4.4** — Show the result to the user; if they approve, write the files.
154
98
 
155
- **6.5 Bloque compact-guidance**:
156
- - `refacil-sdd-ai` inyecta en `AGENTS.md` un bloque entre marcadores `compact-guidance` con reglas de salida compacta.
157
- - Se sincroniza automaticamente en cada `SessionStart`. No editar el contenido entre marcadores.
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
- ### Paso 6b: Sobreescribir `CLAUDE.md` y `.cursorrules`
103
+ ### Step 4b: Overwrite `CLAUDE.md` and `.cursorrules`
160
104
 
161
- Siempre **sobreescribe** ambos archivos aunque ya existanson indices delgados hacia `AGENTS.md`, no deben contener detalle de proyecto.
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`** — indice minimo, sin contenido de proyecto:
107
+ **`CLAUDE.md`** — minimal index, no project content:
164
108
 
165
109
  ```
166
110
  # CLAUDE.md
167
111
 
168
- Contexto completo del proyecto: ver `AGENTS.md` (indice) y `.agents/` (detalle por area).
169
- Si `AGENTS.md` no existe, ejecuta `/refacil:setup`.
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`** — contenido identico con header `# Cursor Rules`.
116
+ **`.cursorrules`** — identical content with header `# Cursor Rules`.
173
117
 
174
- Todo el detalle de proyecto, stack, reglas y comandos `refacil:*` vive en `.agents/` y se indexa desde `AGENTS.md`. No duplicar nada en CLAUDE.md ni en .cursorrules.
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
- ### Paso 7: Archivos de exclusion de contexto
120
+ ### Step 5: Context exclusion files
177
121
 
178
- `refacil-sdd-ai init` crea o actualiza automaticamente `.claudeignore` y `.cursorignore` con entradas estandar (node_modules/, dist/, logs, binarios, secretos, etc.).
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
- Si los archivos ya existen, solo se agregan las entradas faltantes no se sobreescribe contenido personalizado.
124
+ If the files already exist, only missing entries are addedcustom content is not overwritten.
181
125
 
182
- Informa el resultado al usuario:
183
- - **Creados**: ambos archivos fueron creados desde cero.
184
- - **Actualizados**: se agregaron entradas faltantes.
185
- - **Sin cambios**: ya tenian todas las entradas.
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
- Si el usuario quiere personalizar exclusiones adicionales, puede editarlos directamente despues del setup.
131
+ If the user wants to customize additional exclusions, they can edit them directly after setup.
188
132
 
189
- ### Paso 8: Verificar skills
133
+ ### Step 6: Verify skills
190
134
 
191
- - OpenSpec: 5 carpetas bajo `.claude/skills/` y `.cursor/skills/`: `openspec-propose`, `openspec-explore`, `openspec-apply-change`, `openspec-archive-change`, `openspec-verify-change`. Si falta alguna: re-ejecutar el Paso 3 y luego `openspec init --tools claude,cursor`.
192
- - Refacil: carpetas `refacil-*` en esas rutas. Si no: `refacil-sdd-ai init` + reiniciar sesion.
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
- ### Paso 9: Resumen final
138
+ ### Step 7: Final summary
195
139
 
196
140
  ```
197
- === refacil:setup completado ===
198
- Node.js / OpenSpec / perfil / openspec/ / config / AGENTS.md / CLAUDE.md / .cursorrules / .claudeignore / .cursorignore / skills OK
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
- Reiniciar sesion Claude Code o Cursor si es la primera instalacion de skills.
201
- El siguiente paso es revisar el flujo disponible.
202
- Quieres que continue con /refacil:guide?
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
- ## Reglas
149
+ ## Rules
206
150
 
207
- - **Continuidad del flujo**: si el usuario confirma afirmativamente ("si", "ok", "dale", "continua", etc.) la pregunta de continuidad del Paso 9, invocar inmediatamente el **Skill tool** con `skill: "refacil:guide"`. No describirlo en texto ni esperar que el usuario escriba `/refacil:guide`. (Ver `METHODOLOGY-CONTRACT.md §5`.)
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 — Resolucion de problemas
2
-
3
- Consulta este archivo **solo** si un paso de setup falla. No forma parte del flujo feliz.
4
-
5
- ## OpenSpec: comando no encontrado tras `npm install -g`
6
-
7
- - Comprueba donde instala npm los binarios: `npm config get prefix`, luego anade `[prefix]/bin` (Linux/Mac) o `[prefix]` (Windows) al **PATH** y abre de nuevo la terminal / el IDE.
8
- - En Linux/Mac a veces hace falta `sudo` para install global; preferible arreglar permisos de prefijo de npm (`npm config set prefix ~/.npm-global`) antes que usar sudo.
9
-
10
- ## `openspec --version` falla con error de Node
11
-
12
- - OpenSpec exige **Node >= 20.19.0**. Actualiza Node y vuelve a intentar.
13
-
14
- ## `openspec init` no crea las 5 skills requeridas
15
-
16
- - Ejecuta `openspec config list` y confirma `profile: custom` y los 5 workflows: `propose, explore, apply, archive, verify`.
17
- - Si faltan workflows, repite el Paso 3 del setup (script `node -e "..."`) y luego `openspec init --tools claude,cursor` desde la raiz del repo.
18
- - Las skills esperadas son: `openspec-propose`, `openspec-explore`, `openspec-apply-change`, `openspec-archive-change`, `openspec-verify-change`.
19
-
20
- ## `openspec config set workflows` falla con error de array
21
-
22
- - El CLI de OpenSpec no acepta arrays via `config set`. Usa el script `node -e "..."` del Paso 3 para editar el JSON de configuracion directamente.
23
- - La ruta del archivo de config se obtiene con `openspec config path`.
24
-
25
- ## Falta `openspec/config.yaml`
26
-
27
- - Crealo manualmente con al menos:
28
-
29
- ```yaml
30
- language: spanish
31
- ```
32
-
33
- ## Skills `refacil-*` no aparecen en el IDE
34
-
35
- - Ejecuta `refacil-sdd-ai init` en la raiz del repo y **reinicia** la sesion de Claude Code o Cursor.
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`.
@@ -1,94 +1,104 @@
1
- ---
2
- name: refacil:test
3
- description: Generar tests unitarios basados en los artefactos de OpenSpec o para archivos especificos construye un briefing con CA/CR y scope de archivos, y delega al sub-agente refacil-tester para la generacion y ejecucion en contexto aislado
4
- user-invocable: true
5
- ---
6
-
7
- # refacil:test — Entrypoint de Generacion de Tests
8
-
9
- Este skill es un **wrapper delgado** que resuelve el scope, extrae los criterios CA/CR y la lista de archivos a testear, y delega al sub-agente `refacil-tester` con un **briefing estructurado**. El sub-agente arranca con los criterios ya extraidosno re-lee specs desde cero.
10
-
11
- **Prerequisitos**: perfil `openspec` de `refacil-prereqs/SKILL.md` + comando de tests segun `METHODOLOGY-CONTRACT.md §3`.
12
-
13
- ## Flujo
14
-
15
- ### Paso 0: Resolver scope y modo
16
-
17
- **Modo file** — si `$ARGUMENTS` contiene una ruta de archivo:
18
- - `targetFile` = la ruta recibida. Continua al Paso 2 directamente (no se necesita briefing de specs).
19
-
20
- **Modo openspec** — si `$ARGUMENTS` esta vacio:
21
- - Lista las carpetas en `openspec/changes/`.
22
- - Si hay exactamente una carpeta activa, usarla como `changeName`.
23
- - Si hay multiples carpetas activas, **detente** y pide al usuario seleccionar cual testear.
24
- - Si no hay cambios activos, informa que ejecute `/refacil:propose` y detente.
25
-
26
- ### Paso 1 (solo modo openspec): Construir briefing
27
-
28
- Antes de invocar al sub-agente, extrae el contexto clave:
29
-
30
- 1. **Criterios** — lee la especificacion del cambio (`openspec/changes/<changeName>/specs.md` y/o `specs/**/*.md` si existen). Extrae la lista de criterios de aceptacion (CA-XX) y rechazo (CR-XX) con su descripcion.
31
- 2. **Archivos a testear** — lee `openspec/changes/<changeName>/design.md`. Extrae la lista de archivos creados/modificados.
32
- 3. **Comando de test** — lee `refacil-prereqs/METHODOLOGY-CONTRACT.md §3`. Extrae el comando exacto.
33
- 4. **Patron de tests** — busca un archivo de test existente relevante (1 archivo de ejemplo, no multiples). Si existe `testing-patterns.md` en este directorio, incluyelo.
34
-
35
- Construye el bloque BRIEFING que incluiras en el prompt de delegacion:
36
-
37
- ```
38
- BRIEFING:
39
- changeName: <nombre>
40
- mode: openspec
41
- criteria:
42
- acceptance:
43
- - CA-01: <descripcion>
44
- - CA-02: <descripcion>
45
- rejection:
46
- - CR-01: <descripcion>
47
- filesToTest: [ruta/archivo-1.ts, ruta/archivo-2.ts, ...]
48
- testCommand: <comando exacto>
49
- testPatternFile: <ruta de un archivo de test existente como referencia, o null>
50
- ```
51
-
52
- ### Paso 2: Delegar al sub-agente refacil-tester
53
-
54
- Invoca al sub-agente `refacil-tester` pasandole el BRIEFING (modo openspec) o directamente:
55
- - `mode`: `openspec` o `file`
56
- - `changeName` / `targetFile` segun corresponda
57
- - BRIEFING completo (modo openspec)
58
- - Si el usuario pidio modo detallado explicitamente, indicaselo. Default: conciso.
59
-
60
- El sub-agente usara el briefing para generar tests directamente sin re-leer specs.
61
-
62
- Retorna UN solo mensaje con el reporte + bloque JSON fenced como ` ```refacil-test-result `.
63
-
64
- ### Paso 3: Presentar el reporte y procesar resultado
65
-
66
- Muestra al usuario el **reporte** (todo lo anterior al bloque `refacil-test-result`). No muestres el bloque JSONes metadata interna.
67
-
68
- Si el sub-agente retorno algo fuera de formato, informa al usuario: "El tester retorno un reporte no estructurado — revisa los tests manualmente." y detente.
69
-
70
- Parsea el bloque `refacil-test-result` del sub-agente:
71
- - **Si `passed: false`** (tests fallaron): presenta los `issues` del JSON y pregunta al usuario como quiere proceder. **No continues al Paso 4** hasta que los tests pasen.
72
- - **Si `passed: true`**: continua al Paso 4.
73
-
74
- ### Paso 4: Continuidad del flujo (solo si tests pasaron)
75
-
76
- Agrega:
77
-
78
- ```
79
- El siguiente paso es validar la implementacion vs specs.
80
- Quieres que continue con /refacil:verify?
81
- ```
82
-
83
- ## Reglas
84
-
85
- - **Siempre construye el briefing en modo openspec (Paso 1) antes de delegar** — reduce los tool calls del sub-agente.
86
- - **Siempre delega al sub-agente**. No repliques aqui la logica de deteccion de stack ni de generacion.
87
- - **No invoques con scope ambiguo**. Si hay multiples cambios activos, pide seleccion primero.
88
- - **No muestres el bloque JSON al usuario**. Es solo metadata interna.
89
- - **Continuidad del flujo**: si el usuario confirma afirmativamente ("si", "ok", "dale", "continua", etc.) la pregunta de continuidad **y los tests pasaron (`passed: true`)**, invocar inmediatamente el **Skill tool** con `skill: "refacil:verify"`. No describirlo en texto ni esperar que el usuario escriba `/refacil:verify`. (Ver `METHODOLOGY-CONTRACT.md §5`.)
90
-
91
- ## Ver tambien
92
-
93
- - Sub-agente: `.claude/agents/refacil-tester.md` (fuente: `refacil-sdd-ai/agents/tester.md`)
94
- - Patrones de testing del proyecto: `testing-patterns.md` en este mismo directorio (si existe).
1
+ ---
2
+ name: refacil:test
3
+ description: Generate unit tests based on SDD artifacts or for specific filesbuilds 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 extractedit 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`.)