refacil-sdd-ai 4.0.2 → 4.0.3
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 +3 -3
- package/bin/cli.js +2 -2
- package/lib/hooks.js +12 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ npm uninstall -g refacil-sdd-ai
|
|
|
72
72
|
| Comando | Descripcion |
|
|
73
73
|
|---|---|
|
|
74
74
|
| `refacil-sdd-ai check-update` | (`SessionStart`) Verifica nueva version, sincroniza skills y `compact-guidance` en AGENTS.md |
|
|
75
|
-
| `refacil-sdd-ai notify-update` | (`
|
|
75
|
+
| `refacil-sdd-ai notify-update` | (`Stop` / `afterAgentResponse`) Notifica al LLM sobre migraciones pendientes al finalizar la primera respuesta; el agente ejecuta `/refacil:update` automaticamente |
|
|
76
76
|
| `refacil-sdd-ai check-review` | (`PreToolUse`) Bloquea `git push` si falta `.review-passed` en algun cambio activo |
|
|
77
77
|
| `refacil-sdd-ai compact-bash` | (`PreToolUse`) Reescribe comandos Bash bare via `updatedInput` |
|
|
78
78
|
|
|
@@ -234,13 +234,13 @@ Se instalan en `.claude/settings.json` **y** `.cursor/settings.json` durante `in
|
|
|
234
234
|
| Hook | Evento | Que hace |
|
|
235
235
|
|---|---|---|
|
|
236
236
|
| `check-update` | `SessionStart` | Chequea nueva version en npm, la instala, sincroniza skills y **sincroniza el bloque `compact-guidance`** en `AGENTS.md`. Si hubo actualizacion, escribe un flag de notificacion para el siguiente hook. |
|
|
237
|
-
| `notify-update` | `
|
|
237
|
+
| `notify-update` | `Stop` (Claude Code) / `afterAgentResponse` (Cursor) | Al finalizar la primera respuesta del agente, lee el flag de actualizacion pendiente. Si existe, inyecta la instruccion de ejecutar `/refacil:update` — el agente la ejecuta automaticamente y el usuario ve el resultado al final. El flag se borra tras notificar. |
|
|
238
238
|
| `compact-bash` | `PreToolUse` (Bash) | Reescribe silenciosamente comandos Bash bare via `updatedInput`. Sin turnos extra, sin que el IDE vea el cambio. Requiere Claude Code >= 2.1.89. |
|
|
239
239
|
| `check-review` | `PreToolUse` (Bash) | Intercepta `git push` y bloquea si falta `.review-passed` en algun cambio activo. |
|
|
240
240
|
|
|
241
241
|
Los cuatro hooks se instalan en `.claude/settings.json` (Claude Code) y `.cursor/settings.json` (Cursor) con la misma logica parametrica.
|
|
242
242
|
|
|
243
|
-
> **Por que dos hooks para el update?** `SessionStart` hace el sync silencioso al abrir la sesion
|
|
243
|
+
> **Por que dos hooks para el update?** `SessionStart` hace el sync silencioso al abrir la sesion sin interaccion del usuario. `notify-update` en `Stop` se dispara al finalizar la primera respuesta del agente — la instruccion queda al final visible para el usuario y Claude la ejecuta automaticamente en el siguiente turno.
|
|
244
244
|
|
|
245
245
|
### Gate de review en el push
|
|
246
246
|
|
package/bin/cli.js
CHANGED
|
@@ -57,8 +57,8 @@ function notifyUpdate() {
|
|
|
57
57
|
|
|
58
58
|
const fromLabel = info.from ? `v${info.from}` : 'version desconocida';
|
|
59
59
|
console.log(
|
|
60
|
-
`[refacil-sdd-ai]
|
|
61
|
-
'
|
|
60
|
+
`[refacil-sdd-ai] La metodologia fue actualizada (${fromLabel} → v${info.to}). ` +
|
|
61
|
+
'Ejecuta /refacil:update ahora para aplicar las migraciones pendientes e informa el resultado al usuario.',
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
|
package/lib/hooks.js
CHANGED
|
@@ -31,11 +31,13 @@ function installHooks(ideDir, projectRoot) {
|
|
|
31
31
|
changed = true;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
// Claude Code usa "Stop"; Cursor usa "afterAgentResponse" (equivalente al fin de turno del agente)
|
|
35
|
+
const notifyEvent = ideDir === '.cursor' ? 'afterAgentResponse' : 'Stop';
|
|
36
|
+
if (!settings.hooks[notifyEvent]) settings.hooks[notifyEvent] = [];
|
|
35
37
|
|
|
36
|
-
const hasNotifyHook = settings.hooks.
|
|
38
|
+
const hasNotifyHook = settings.hooks[notifyEvent].some((h) => h._sdd_notify === true);
|
|
37
39
|
if (!hasNotifyHook) {
|
|
38
|
-
settings.hooks.
|
|
40
|
+
settings.hooks[notifyEvent].push({
|
|
39
41
|
_sdd_notify: true,
|
|
40
42
|
matcher: '',
|
|
41
43
|
hooks: [{ type: 'command', command: 'refacil-sdd-ai notify-update' }],
|
|
@@ -99,13 +101,13 @@ function uninstallHooks(ideDir, projectRoot) {
|
|
|
99
101
|
if (settings.hooks.SessionStart.length === 0) delete settings.hooks.SessionStart;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(h) => h._sdd_notify !== true
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
for (const notifyEvent of ['Stop', 'afterAgentResponse']) {
|
|
105
|
+
if (Array.isArray(settings.hooks[notifyEvent])) {
|
|
106
|
+
const original = settings.hooks[notifyEvent].length;
|
|
107
|
+
settings.hooks[notifyEvent] = settings.hooks[notifyEvent].filter((h) => h._sdd_notify !== true);
|
|
108
|
+
if (settings.hooks[notifyEvent].length !== original) changed = true;
|
|
109
|
+
if (settings.hooks[notifyEvent].length === 0) delete settings.hooks[notifyEvent];
|
|
110
|
+
}
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
if (Array.isArray(settings.hooks.PreToolUse)) {
|
package/package.json
CHANGED