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,63 +1,63 @@
1
- # Patrones de Testing Referencia
2
-
3
- > **NOTA**: Este archivo es una referencia generica. Los tests generados deben seguir
4
- > los patrones reales del proyecto (detectados automaticamente). Si el proyecto ya tiene
5
- > tests, esos patrones tienen prioridad sobre los de este archivo.
6
-
7
- ## Estructura de archivos de test
8
-
9
- La ubicacion de los tests depende del proyecto. Patrones comunes:
10
-
11
- ```
12
- # Mismo directorio (comun en JS/TS, Go, Rust)
13
- archivo.ts → archivo.spec.ts / archivo.test.ts
14
- archivo.go → archivo_test.go
15
-
16
- # Directorio separado (comun en Java, Python, algunos JS/TS)
17
- src/servicio.java → test/servicio_test.java
18
- src/modulo.py → tests/test_modulo.py
19
- ```
20
-
21
- ## Principios universales
22
-
23
- ### Arrange-Act-Assert (AAA)
24
- ```
25
- // Arrange — preparar datos y mocks
26
- // Act — ejecutar la operacion
27
- // Assert — verificar resultado
28
- ```
29
-
30
- ### Naming conventions
31
- ```
32
- # Formato recomendado (adaptar al idioma/framework):
33
- should [verbo] [resultado] when [condicion]
34
-
35
- # Ejemplos:
36
- "should return product when valid id is provided"
37
- "should throw error when input is empty"
38
- "should update status when payment is confirmed"
39
- ```
40
-
41
- ## Anti-patrones a evitar
42
-
43
- - NO testear propiedades/metodos privados directamente
44
- - NO testear implementacion interna (orden de llamadas) a menos que sea critico
45
- - NO crear tests sin assertions
46
- - NO crear tests que dependan del orden de ejecucion
47
- - NO mockear todosolo los limites del sistema (DB, APIs externas, filesystem)
48
- - NO crear tests fragiles que se rompen con cambios cosmeticos
49
- - NO duplicar la logica del codigo en el test (el test debe verificar comportamiento, no reimplementar)
50
-
51
- ## Mocks y Stubs
52
-
53
- Mockear solo lo que esta fuera del control del test:
54
- - Llamadas a bases de datos
55
- - APIs externas / servicios HTTP
56
- - Sistema de archivos (si aplica)
57
- - Colas de mensajes
58
- - Loggers (cuando interfieren con output)
59
-
60
- No mockear:
61
- - Funciones puras del propio modulo
62
- - DTOs, mappers, utilidades sin side effects
63
- - Constantes o configuracion estatica
1
+ # Testing PatternsReference
2
+
3
+ > **NOTE**: This file is a generic reference. Generated tests must follow
4
+ > the actual project patterns (detected automatically). If the project already has
5
+ > tests, those patterns take priority over the ones in this file.
6
+
7
+ ## Test file structure
8
+
9
+ The location of tests depends on the project. Common patterns:
10
+
11
+ ```
12
+ # Same directory (common in JS/TS, Go, Rust)
13
+ file.ts → file.spec.ts / file.test.ts
14
+ file.go → file_test.go
15
+
16
+ # Separate directory (common in Java, Python, some JS/TS)
17
+ src/service.java → test/service_test.java
18
+ src/module.py → tests/test_module.py
19
+ ```
20
+
21
+ ## Universal principles
22
+
23
+ ### Arrange-Act-Assert (AAA)
24
+ ```
25
+ // Arrange — prepare data and mocks
26
+ // Act — execute the operation
27
+ // Assert — verify the result
28
+ ```
29
+
30
+ ### Naming conventions
31
+ ```
32
+ # Recommended format (adapt to language/framework):
33
+ should [verb] [result] when [condition]
34
+
35
+ # Examples:
36
+ "should return product when valid id is provided"
37
+ "should throw error when input is empty"
38
+ "should update status when payment is confirmed"
39
+ ```
40
+
41
+ ## Anti-patterns to avoid
42
+
43
+ - Do NOT test private properties/methods directly
44
+ - Do NOT test internal implementation (call order) unless critical
45
+ - Do NOT create tests without assertions
46
+ - Do NOT create tests that depend on execution order
47
+ - Do NOT mock everything only system boundaries (DB, external APIs, filesystem)
48
+ - Do NOT create brittle tests that break with cosmetic changes
49
+ - Do NOT duplicate the code logic in the test (the test must verify behavior, not re-implement)
50
+
51
+ ## Mocks and Stubs
52
+
53
+ Mock only what is outside the test's control:
54
+ - Database calls
55
+ - External APIs / HTTP services
56
+ - File system (if applicable)
57
+ - Message queues
58
+ - Loggers (when they interfere with output)
59
+
60
+ Do not mock:
61
+ - Pure functions of the module itself
62
+ - DTOs, mappers, utilities without side effects
63
+ - Constants or static configuration
@@ -1,108 +1,108 @@
1
- ---
2
- name: refacil:up-code
3
- description: Subir codigo y crear PR para integracion — git add, commit, push y PR a la rama destino
4
- user-invocable: true
5
- ---
6
-
7
- # refacil:up-code — Integrar Codigo y Publicar Cambios
8
-
9
- Sube los cambios al repositorio remoto y genera el PR para integracion.
10
- Aplica la politica de ramas e integracion definida en `refacil-prereqs/METHODOLOGY-CONTRACT.md` (sin excepciones).
11
-
12
- **Prerequisitos**: perfil `agents` de `refacil-prereqs/SKILL.md` + reglas de `METHODOLOGY-CONTRACT.md` (politica de ramas aplica sin excepciones).
13
-
14
- ## Instrucciones
15
-
16
- ### Paso 1: Detectar y validar rama actual
17
-
18
- Ejecuta `git branch --show-current` para obtener el nombre de la rama.
19
-
20
- - Si la rama actual es protegida (segun `METHODOLOGY-CONTRACT.md`), **detente** e informa al usuario:
21
- ```
22
- No se puede subir codigo desde una rama protegida ([nombre]).
23
- La validacion de rama se hace en /refacil:apply o /refacil:bug antes de escribir codigo.
24
- Cambia a tu rama de trabajo (feature/*, fix/*, etc.) y vuelve a ejecutar /refacil:up-code.
25
- ```
26
- - Si la rama es de trabajo (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.), continua.
27
-
28
- ### Paso 2: Verificar review (obligatorio)
29
-
30
- Antes de continuar, verifica si hay cambios activos en `openspec/changes/` (excluir carpeta `archive/`).
31
-
32
- Si hay cambios activos:
33
- 1. Para cada carpeta activa, verifica si existe el archivo `.review-passed` (marcador oculto: **`METHODOLOGY-CONTRACT.md` §8** — no concluyas por `ls` sin `-a`).
34
- 2. Si **todas** tienen `.review-passed` → continua al paso 3.
35
- 3. Si hay **una sola** carpeta sin `.review-passed`:
36
- - Informa al usuario cual es.
37
- - Ejecuta `/refacil:review <nombre-cambio>` automaticamente sobre ese cambio.
38
- - Si el review aprueba (crea `.review-passed`) → continua al paso 3.
39
- - Si el review requiere correccionesdetente e informa los hallazgos al usuario.
40
- 4. Si hay **multiples** carpetas sin `.review-passed`:
41
- - Deten el flujo y pide al usuario seleccionar explicitamente que cambio quiere subir.
42
- - Ejecuta `/refacil:review <nombre-cambio-seleccionado>` solo para ese cambio.
43
- - No ejecutes review automatico masivo en este caso.
44
-
45
- **IMPORTANTE**: `/refacil:review` verifica internamente si `.review-passed` existe y si hay cambios posteriores. Solo re-ejecuta si detecta cambios nuevos despues del ultimo review aprobado.
46
-
47
- Si no hay carpeta `openspec/changes/` o no hay cambios activos continua al paso 3 (no hay nada que revisar).
48
-
49
- ### Paso 3: Verificar cambios pendientes
50
-
51
- Ejecuta `git status` para verificar si hay cambios para subir.
52
-
53
- - Si no hay cambios pendientes ni commits sin push, informa al usuario y detente.
54
- - Si hay cambios sin commitear, continua al paso 4.
55
- - Si solo hay commits sin push (nada que commitear), salta directo al paso 5.
56
-
57
- ### Paso 4: Commit de cambios
58
-
59
- 1. Ejecuta `git status --short` y muestra al usuario la lista de archivos detectados.
60
- 2. Pide confirmacion explicita antes de stagear todo.
61
- 3. Si el usuario confirma stage global, usa `git add -A`.
62
- 4. Si el usuario pide stage parcial, agrega solo las rutas indicadas.
63
- 5. Si el usuario proporciono un mensaje como argumento (`$ARGUMENTS`), usalo como mensaje del commit.
64
- 6. Si no se proporciono mensaje, genera uno descriptivo basado en los cambios detectados con `git diff --staged --stat`.
65
- 7. Ejecuta `git commit -m "[mensaje]"`.
66
-
67
- ### Paso 5: Push a remoto
68
-
69
- Ejecuta `git push -u origin [rama-actual]` para subir los cambios.
70
-
71
- ### Paso 6: Confirmar y crear PR
72
-
73
- 1. Muestra el resumen del push:
74
- ```
75
- === Codigo subido ===
76
- Rama: [nombre-rama]
77
- Commit: [hash-corto] [mensaje]
78
- Remote: origin/[nombre-rama]
79
- ```
80
-
81
- 2. **Pregunta al usuario** a que rama quiere crear el PR. Sugiere `testing` como destino por defecto:
82
- ```
83
- A que rama quieres crear el PR? (recomendado: testing)
84
- ```
85
-
86
- Si el usuario indica una rama distinta a `testing`, verifica que exista en el remoto con `git branch -r | grep <rama-indicada>` antes de generar el link. Si no existe, informa al usuario y pide que confirme o corrija el nombre.
87
-
88
- 3. Obtén la URL del repositorio remoto con `git remote get-url origin` y determina el hosting para generar el link correcto:
89
- - **GitHub** (url contiene `github.com`): `https://github.com/[owner]/[repo]/compare/[rama-destino]...[rama-actual]?expand=1`
90
- - **Bitbucket** (url contiene `bitbucket.org`): `https://bitbucket.org/[workspace]/[repo]/pull-requests/new?source=[rama-actual]&dest=[rama-destino]`
91
- - Si no se puede determinar el hosting, muestra ambos formatos para que el usuario elija.
92
- - Nota: para URLs SSH (`git@github.com:owner/repo.git` o `git@bitbucket.org:workspace/repo.git`), extrae owner/workspace y repo del path tras el `:`.
93
-
94
- 4. Muestra el link al usuario y recomienda PR a `testing`:
95
- ```
96
- Crea tu PR aqui: [link]
97
-
98
- Tip: Se recomienda PR a testing para habilitar pruebas integradas
99
- antes de promover a otras ramas protegidas.
100
- ```
101
-
102
- **Este es el paso terminal del flujo SDD.** No preguntes por siguiente skill — el ciclo se cierra aqui. Aplica la regla de paso terminal de `METHODOLOGY-CONTRACT.md §5`.
103
-
104
- ## Reglas
105
-
106
- - Respetar estrictamente la politica de ramas protegidas e integracion por PR del `METHODOLOGY-CONTRACT.md`
107
- - Si la rama actual es protegida, **detener** — la validacion/cambio de rama se hace en `/refacil:apply` o `/refacil:bug`, no aqui
108
- - No forzar push (--force) a menos que el usuario lo pida explicitamente
1
+ ---
2
+ name: refacil:up-code
3
+ description: Push code and create PR for integration — git add, commit, push, and PR to the target branch
4
+ user-invocable: true
5
+ ---
6
+
7
+ # refacil:up-code — Integrate Code and Publish Changes
8
+
9
+ Pushes changes to the remote repository and generates the PR for integration.
10
+ Applies the branch and integration policy defined in `refacil-prereqs/METHODOLOGY-CONTRACT.md` (no exceptions).
11
+
12
+ **Prerequisites**: `agents` profile from `refacil-prereqs/SKILL.md` + rules from `METHODOLOGY-CONTRACT.md` (branch policy applies without exceptions).
13
+
14
+ ## Instructions
15
+
16
+ ### Step 1: Detect and validate current branch
17
+
18
+ Run `git branch --show-current` to get the branch name.
19
+
20
+ - If the current branch is protected (according to `METHODOLOGY-CONTRACT.md`), **stop** and inform the user:
21
+ ```
22
+ Cannot push code from a protected branch ([name]).
23
+ Branch validation is done in /refacil:apply or /refacil:bug before writing code.
24
+ Switch to your working branch (feature/*, fix/*, etc.) and run /refacil:up-code again.
25
+ ```
26
+ - If the branch is a working branch (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.), continue.
27
+
28
+ ### Step 2: Verify review (mandatory)
29
+
30
+ Before continuing, verify if there are active changes in `refacil-sdd/changes/` (exclude the `archive/` folder).
31
+
32
+ If there are active changes:
33
+ 1. For each active folder, verify if the `.review-passed` file exists (hidden marker: **`METHODOLOGY-CONTRACT.md` §8** — do not conclude from `ls` without `-a`).
34
+ 2. If **all** have `.review-passed` → continue to step 3.
35
+ 3. If there is **one single** folder without `.review-passed`:
36
+ - Inform the user which one.
37
+ - Automatically run `/refacil:review <change-name>` on that change.
38
+ - If the review approves (creates `.review-passed`) → continue to step 3.
39
+ - If the review requires correctionsstop and inform the user of the findings.
40
+ 4. If there are **multiple** folders without `.review-passed`:
41
+ - Stop the flow and ask the user to explicitly select which change to push.
42
+ - Run `/refacil:review <selected-change-name>` only for that change.
43
+ - Do not run automatic bulk review in this case.
44
+
45
+ **IMPORTANT**: `/refacil:review` internally verifies if `.review-passed` exists and if there are changes after it. It only re-runs if it detects new changes after the last approved review.
46
+
47
+ If there is no `refacil-sdd/changes/` folder or no active changescontinue to step 3 (nothing to review).
48
+
49
+ ### Step 3: Verify pending changes
50
+
51
+ Run `git status` to verify if there are changes to push.
52
+
53
+ - If there are no pending changes or unpushed commits, inform the user and stop.
54
+ - If there are uncommitted changes, continue to step 4.
55
+ - If there are only unpushed commits (nothing to commit), jump directly to step 5.
56
+
57
+ ### Step 4: Commit changes
58
+
59
+ 1. Run `git status --short` and show the user the list of detected files.
60
+ 2. Ask for explicit confirmation before staging everything.
61
+ 3. If the user confirms global staging, use `git add -A`.
62
+ 4. If the user requests partial staging, add only the indicated paths.
63
+ 5. If the user provided a message as argument (`$ARGUMENTS`), use it as the commit message.
64
+ 6. If no message was provided, generate a descriptive one based on the detected changes with `git diff --staged --stat`.
65
+ 7. Run `git commit -m "[message]"`.
66
+
67
+ ### Step 5: Push to remote
68
+
69
+ Run `git push -u origin [current-branch]` to push the changes.
70
+
71
+ ### Step 6: Confirm and create PR
72
+
73
+ 1. Show the push summary:
74
+ ```
75
+ === Code pushed ===
76
+ Branch: [branch-name]
77
+ Commit: [short-hash] [message]
78
+ Remote: origin/[branch-name]
79
+ ```
80
+
81
+ 2. **Ask the user** which branch they want to create the PR to. Suggest `testing` as the default target:
82
+ ```
83
+ Which branch do you want to create the PR to? (recommended: testing)
84
+ ```
85
+
86
+ If the user indicates a different branch than `testing`, verify it exists on the remote with `git branch -r | grep <indicated-branch>` before generating the link. If it does not exist, inform the user and ask them to confirm or correct the name.
87
+
88
+ 3. Get the remote repository URL with `git remote get-url origin` and determine the hosting to generate the correct link:
89
+ - **GitHub** (url contains `github.com`): `https://github.com/[owner]/[repo]/compare/[target-branch]...[current-branch]?expand=1`
90
+ - **Bitbucket** (url contains `bitbucket.org`): `https://bitbucket.org/[workspace]/[repo]/pull-requests/new?source=[current-branch]&dest=[target-branch]`
91
+ - If hosting cannot be determined, show both formats for the user to choose.
92
+ - Note: for SSH URLs (`git@github.com:owner/repo.git` or `git@bitbucket.org:workspace/repo.git`), extract owner/workspace and repo from the path after `:`.
93
+
94
+ 4. Show the link to the user and recommend PR to `testing`:
95
+ ```
96
+ Create your PR here: [link]
97
+
98
+ Tip: PR to testing is recommended to enable integrated testing
99
+ before promoting to other protected branches.
100
+ ```
101
+
102
+ **This is the terminal step of the SDD flow.** Do not ask for a next skill — the cycle closes here. Apply the terminal step rule from `METHODOLOGY-CONTRACT.md §5`.
103
+
104
+ ## Rules
105
+
106
+ - Strictly respect the protected branch and PR integration policy from `METHODOLOGY-CONTRACT.md`
107
+ - If the current branch is protected, **stop** — branch validation/change is done in `/refacil:apply` or `/refacil:bug`, not here
108
+ - Do not force push (--force) unless the user explicitly asks for it
@@ -1,132 +1,109 @@
1
- ---
2
- name: refacil:update
3
- description: Detectar y aplicar migraciones pendientes de la metodologia SDD-AI al proyecto actual
4
- user-invocable: true
5
- ---
6
-
7
- # refacil:update — Migraciones de la Metodologia
8
-
9
- Detecta el estado actual del repo y aplica solo lo que este pendiente. No repite pasos de instalacion (OpenSpec, hooks, skills).
10
-
11
- El hook `notify-update` usa el **mismo motor** que este comando; no re-evalues a mano el repo para decidir si hay trabajo.
12
-
13
- ## Paso 1: Validar con el CLI (obligatorio)
14
-
15
- En la **raiz del repo** (donde esta `AGENTS.md` o `.claude/`), ejecuta con `Bash`:
16
-
17
- ```bash
18
- refacil-sdd-ai migration-pending
19
- ```
20
-
21
- - **Codigo de salida 0**: no hay migraciones de metodologia pendientes informa al usuario que todo esta al dia respecto a este criterio y **termina** (sin tocar archivos).
22
- - **Codigo de salida 1**: hay al menos una razon listada en stdout → continua al Paso 2.
23
-
24
- Opcional para parseo estable: `refacil-sdd-ai migration-pending --json` → objeto `{ "pending": bool, "reasons": string[] }`.
25
-
26
- No sustituyas este paso por inspeccion manual del arbol salvo que el comando falle (error de entorno); en ese caso documenta el error y pide reintentar.
27
-
28
- ### Referencia (mapeo razon accion en Paso 3)
29
-
30
- La implementacion vive en `lib/methodology-migration-pending.js` del paquete; la tabla resume lo que detecta:
31
-
32
- | # | Condicion (resumen) | Migracion en Paso 3 |
33
- |---|---|---|
34
- | 1 | `AGENTS.md` existe y no existe carpeta `.agents/` | Reestructurar en `.agents/` + reescribir como indice |
35
- | 2 | `CLAUDE.md` tiene mas de 5 lineas o no apunta a `AGENTS.md` | Reemplazar por indice minimo |
36
- | 3 | `.cursorrules` tiene mas de 5 lineas o no apunta a `AGENTS.md` | Reemplazar por indice minimo |
37
- | 4 | Skills `openspec-*` o commands `opsx-*` fuera del conjunto requerido | Eliminar sobrantes y reconfigurar OpenSpec |
38
-
39
- ## Paso 2: Confirmar con el usuario
40
-
41
- Mostrar al usuario las mismas lineas que imprimio `migration-pending` (o el array `reasons` del JSON) y pedir confirmacion antes de aplicar cualquier cambio.
42
-
43
- ## Paso 3: Aplicar migraciones confirmadas
44
-
45
- Ejecutar solo las migraciones que correspondan a las razones detectadas (ver tabla de referencia arriba).
46
-
47
- ### Migracion 1 — AGENTS.md → `.agents/` + indice
48
-
49
- 1. Lee el contenido completo de `AGENTS.md`.
50
- 2. Identifica y separa el contenido que NO debe moverse a `.agents/`:
51
- - Bloque `compact-guidance`: entre `<!-- refacil-sdd-ai:compact-guidance:start -->` y `<!-- refacil-sdd-ai:compact-guidance:end -->`
52
- - Bloque de presentacion del bus: entre `<!-- refacil-bus:presentation:start -->` y `<!-- refacil-bus:presentation:end -->`
53
- - Seccion `## Metodología SDD-AI`: tabla de comandos `refacil:*` — siempre permanece en `AGENTS.md`. Si existe, sobreescribirla con la tabla actualizada (ver Paso 6.2 de `refacil:setup`); si no existe, crearla.
54
- 3. Crea la carpeta `.agents/`.
55
- 4. Distribuye el contenido de proyecto (todo excepto los bloques gestionados) en archivos por area. Reglas:
56
- - **`.agents/summary.md` es siempre obligatorio** descripcion del proyecto, tabla mini de stack, scripts esenciales, reglas criticas condensadas. Si el AGENTS.md original no tiene resumen claro, sintetizalo a partir del contenido disponible.
57
- - Los demas archivos se crean **solo si hay contenido relevante que redistribuir**. No crear archivos vacios:
58
- - `.agents/architecture.md` — modulos, servicios, flujos principales, patrones clave.
59
- - `.agents/stack.md` — dependencias, variables de entorno, bases de datos, integraciones.
60
- - `.agents/testing.md` — estrategia de tests, comandos, convenciones, fixtures.
61
- - `.agents/commands.md` comandos de desarrollo, alias, scripts de CI/CD.
62
- - Adaptar al tipo de proyecto: un monorepo puede necesitar `.agents/services.md`; una libreria simple puede combinar testing y stack en un solo archivo. Usar el mismo criterio que `/refacil:setup`.
63
- 5. Reescribe `AGENTS.md` como indice puro en este orden:
64
- - Primera linea: descripcion breve del proyecto.
65
- - Por cada archivo en `.agents/`: nombre del area + enlace relativo + cuando leerlo (una frase).
66
- - Seccion `## Metodología SDD-AI` con la tabla actualizada de comandos `refacil:*` (ver Paso 6.2 de `refacil:setup` para el contenido exacto).
67
- - Bloques gestionados que ya existian (compact-guidance, bus presentation) al final, intactos.
68
- - Si no existian, el bloque compact-guidance se re-inyectara automaticamente en el proximo SessionStart.
69
-
70
- ### Migracion 2 y 3 — CLAUDE.md / .cursorrules → indice minimo
71
-
72
- Sobreescribir con exactamente este contenido:
73
-
74
- **CLAUDE.md:**
75
- ```
76
- # CLAUDE.md
77
-
78
- Contexto completo del proyecto: ver `AGENTS.md`.
79
- Si no existe, ejecuta `/refacil:setup`.
80
- ```
81
-
82
- **`.cursorrules`:**
83
- ```
84
- # Cursor Rules
85
-
86
- Contexto completo del proyecto: ver `AGENTS.md`.
87
- Si no existe, ejecuta `/refacil:setup`.
88
- ```
89
-
90
- ### Migracion 4 — Skills y commands OpenSpec sobrantes
91
-
92
- Conjunto requerido de skills: `openspec-propose`, `openspec-explore`, `openspec-apply-change`, `openspec-archive-change`, `openspec-verify-change`.
93
- Conjunto requerido de commands: `.claude/commands/opsx/` → `apply.md`, `archive.md`, `explore.md`, `propose.md`, `verify.md`; `.cursor/commands/` → `opsx-apply.md`, `opsx-archive.md`, `opsx-explore.md`, `opsx-propose.md`, `opsx-verify.md`.
94
-
95
- 1. Detecta skills `openspec-*` en `.claude/skills/` y `.cursor/skills/` fuera del conjunto requerido.
96
- 2. Detecta commands `opsx-*.md` en `.cursor/commands/` y archivos `.md` en `.claude/commands/opsx/` fuera del conjunto requerido.
97
- 3. Reconfigura OpenSpec con solo los 5 workflows necesarios:
98
- ```bash
99
- node -e "
100
- const fs=require('fs');
101
- const {execSync}=require('child_process');
102
- const p=execSync('openspec config path',{encoding:'utf8'}).trim();
103
- const c=JSON.parse(fs.readFileSync(p,'utf8'));
104
- c.profile='custom';
105
- c.workflows=['propose','explore','apply','archive','verify'];
106
- fs.writeFileSync(p,JSON.stringify(c,null,2));
107
- "
108
- ```
109
- 4. Elimina skills y commands sobrantes.
110
- 5. Ejecuta `openspec init --tools claude,cursor` para dejar el estado limpio.
111
-
112
- ## Paso 4: Limpiar flag de actualizacion pendiente
113
-
114
- Tras migrar, elimina el flag en la raiz del repo si sigue existiendo:
115
-
116
- ```bash
117
- rm -f .refacil-pending-update
118
- ```
119
-
120
- Si no hubo cambios (Paso 1 dio exit 0), el flag obsoleto suele borrarse solo al proximo `check-update` (SessionStart) o al ejecutar `refacil-sdd-ai migration-pending` con exit 0; el `rm` manual solo hace falta si aplicaste migraciones a mano o quedo un vestigio.
121
-
122
- ## Paso 5: Resumen
123
-
124
- Informar que archivos se crearon o modificaron. Mencionar que el bloque `compact-guidance` se sincronizara automaticamente en el proximo SessionStart.
125
-
126
- ## Reglas
127
-
128
- - **Deteccion**: confiar en `refacil-sdd-ai migration-pending` (mismo criterio que `check-update` / `notify-update`).
129
- - Solo aplica lo que este pendiente — no toca archivos que ya cumplen el patron.
130
- - No inventa contenido: distribuye lo que ya existe en AGENTS.md sin agregar ni eliminar informacion.
131
- - No ejecuta pasos de OpenSpec, hooks ni instalacion de skills.
132
- - Extensible: nuevas reglas de deteccion se agregan en el paquete (`methodology-migration-pending.js`); esta skill actualiza la tabla de referencia y los pasos de aplicacion cuando cambie el contrato.
1
+ ---
2
+ name: refacil:update
3
+ description: Detect and apply pending migrations of the SDD-AI methodology to the current project
4
+ user-invocable: true
5
+ ---
6
+
7
+ # refacil:update — Methodology Migrations
8
+
9
+ Detects the current repo state and applies only what is pending. Does not repeat full setup (hooks/skills install, `/refacil:setup` steps).
10
+
11
+ The `notify-update` hook uses the **same engine** as this command; do not manually re-evaluate the repo to decide if there is work to do.
12
+
13
+ ## Step 1: Validate with the CLI (mandatory)
14
+
15
+ In the **repo root** (where `AGENTS.md` or `.claude/` is), run with `Bash`:
16
+
17
+ ```bash
18
+ refacil-sdd-ai migration-pending
19
+ ```
20
+
21
+ - **Exit code 0**: no pending methodology migrationsinform the user that everything is up to date regarding this criterion and **finish** (without touching files).
22
+ - **Exit code 1**: at least one reason listed in stdout → continue to Step 2.
23
+
24
+ Optional for stable parsing: `refacil-sdd-ai migration-pending --json` → object `{ "pending": bool, "reasons": string[] }`.
25
+
26
+ Do not substitute this step with manual tree inspection unless the command fails (environment error); in that case document the error and ask to retry.
27
+
28
+ ### Reference (reasonaction mapping in Step 3)
29
+
30
+ The implementation lives in `lib/methodology-migration-pending.js` of the package; the table summarizes what it detects:
31
+
32
+ | # | Condition (summary) | Migration in Step 3 |
33
+ |---|---|---|
34
+ | 1 | `AGENTS.md` exists and `.agents/` folder does not | Restructure into `.agents/` + rewrite as index |
35
+ | 2 | `CLAUDE.md` has more than 5 lines or does not point to `AGENTS.md` | Replace with minimal index |
36
+ | 3 | `.cursorrules` has more than 5 lines or does not point to `AGENTS.md` | Replace with minimal index |
37
+
38
+ ## Step 2: Confirm with the user
39
+
40
+ Show the user the same lines printed by `migration-pending` (or the `reasons` array from the JSON) and ask for confirmation before applying any changes.
41
+
42
+ ## Step 3: Apply confirmed migrations
43
+
44
+ Run only the migrations that correspond to the detected reasons (see reference table above).
45
+
46
+ ### Migration 1 — AGENTS.md → `.agents/` + index
47
+
48
+ 1. Read the full content of `AGENTS.md`.
49
+ 2. Identify and separate content that must NOT move to `.agents/`:
50
+ - `compact-guidance` block: between `<!-- refacil-sdd-ai:compact-guidance:start -->` and `<!-- refacil-sdd-ai:compact-guidance:end -->`
51
+ - Bus presentation block: between `<!-- refacil-bus:presentation:start -->` and `<!-- refacil-bus:presentation:end -->`
52
+ - Section `## SDD-AI Methodology`: table of `refacil:*` commands always stays in `AGENTS.md`. If it exists, overwrite it with the updated table (see Step 6.2 of `refacil:setup`); if not, create it.
53
+ 3. Create the `.agents/` folder.
54
+ 4. Distribute the project content (everything except managed blocks) into files by area. Rules:
55
+ - **`.agents/summary.md` is always mandatory** project description, mini stack table, essential scripts, critical rules condensed. If the original AGENTS.md does not have a clear summary, synthesize it from the available content.
56
+ - Other files are created **only if there is relevant content to redistribute**. Do not create empty files:
57
+ - `.agents/architecture.md` modules, services, main flows, key patterns.
58
+ - `.agents/stack.md` — dependencies, environment variables, databases, integrations.
59
+ - `.agents/testing.md` — testing strategy, commands, conventions, fixtures.
60
+ - `.agents/commands.md` — development commands, aliases, CI/CD scripts.
61
+ - Adapt to the project type: a monorepo may need `.agents/services.md`; a simple library may combine testing and stack in one file. Use the same criterion as `/refacil:setup`.
62
+ 5. Rewrite `AGENTS.md` as a pure index in this order:
63
+ - First line: brief project description.
64
+ - For each file in `.agents/`: area name + relative link + when to read it (one sentence).
65
+ - Section `## SDD-AI Methodology` with the updated `refacil:*` command table (see Step 6.2 of `refacil:setup` for the exact content).
66
+ - Managed blocks that already existed (compact-guidance, bus presentation) at the end, intact.
67
+ - If they did not exist, the compact-guidance block will be re-injected automatically at the next SessionStart.
68
+
69
+ ### Migration 2 and 3 — CLAUDE.md / .cursorrules → minimal index
70
+
71
+ Overwrite with exactly this content:
72
+
73
+ **CLAUDE.md:**
74
+ ```
75
+ # CLAUDE.md
76
+
77
+ Full project context: see `AGENTS.md`.
78
+ If it does not exist, run `/refacil:setup`.
79
+ ```
80
+
81
+ **`.cursorrules`:**
82
+ ```
83
+ # Cursor Rules
84
+
85
+ Full project context: see `AGENTS.md`.
86
+ If it does not exist, run `/refacil:setup`.
87
+ ```
88
+
89
+ ## Step 4: Clear the pending update flag
90
+
91
+ After migrating, delete the flag in the repo root if it still exists:
92
+
93
+ ```bash
94
+ rm -f .refacil-pending-update
95
+ ```
96
+
97
+ If there were no changes (Step 1 gave exit 0), the obsolete flag usually clears itself at the next `check-update` (SessionStart) or when running `refacil-sdd-ai migration-pending` with exit 0; the manual `rm` is only needed if you applied migrations manually or there is a leftover.
98
+
99
+ ## Step 5: Summary
100
+
101
+ Report which files were created or modified. Mention that the `compact-guidance` block will be synced automatically at the next SessionStart.
102
+
103
+ ## Rules
104
+
105
+ - **Detection**: trust `refacil-sdd-ai migration-pending` (same criterion as `check-update` / `notify-update`).
106
+ - Only apply what is pending — do not touch files that already meet the pattern.
107
+ - Do not invent content: distribute what already exists in AGENTS.md without adding or removing information.
108
+ - Does not re-run `refacil-sdd-ai init`, package hooks installation, or `/refacil:setup`-style scaffolding.
109
+ - Extensible: new detection rules are added in the package (`methodology-migration-pending.js`); this skill updates the reference table and application steps when the contract changes.