refacil-sdd-ai 4.0.2 → 4.0.4

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 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` | (`UserPromptSubmit`) Notifica al LLM sobre migraciones pendientes en el primer mensaje del usuario |
75
+ | `refacil-sdd-ai notify-update` | (`UserPromptSubmit` / `beforeSubmitPrompt`) Pregunta al usuario si desea ejecutar `/refacil:update` cuando hay migraciones pendientes |
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` | `UserPromptSubmit` | Lee el flag de actualizacion pendiente. Si existe, lo inyecta como `[ACCION REQUERIDA]` en el contexto del primer mensaje del usuario para que el LLM lo procese y ofrezca ejecutar `/refacil:update`. El flag se borra tras notificar. |
237
+ | `notify-update` | `UserPromptSubmit` (Claude Code) / `beforeSubmitPrompt` (Cursor) | Antes de procesar el siguiente mensaje del usuario, lee el flag de actualizacion pendiente. Si existe, inyecta la instruccion para que el agente pregunte al usuario si desea ejecutar `/refacil:update`. 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, pero el LLM no genera respuesta hasta que el usuario escribe algo. `notify-update` en `UserPromptSubmit` garantiza que la notificacion llegue pegada al primer mensaje real del usuario y no sea ignorada.
243
+ > **Por que dos hooks para el update?** `SessionStart` hace el sync silencioso al abrir la sesion sin interaccion del usuario. `notify-update` en `UserPromptSubmit` / `beforeSubmitPrompt` inyecta la instruccion justo antes de que el agente procese el siguiente mensaje del usuario, garantizando que no se ignore.
244
244
 
245
245
  ### Gate de review en el push
246
246
 
package/bin/cli.js CHANGED
@@ -57,8 +57,9 @@ function notifyUpdate() {
57
57
 
58
58
  const fromLabel = info.from ? `v${info.from}` : 'version desconocida';
59
59
  console.log(
60
- `[refacil-sdd-ai] ACCION REQUERIDA: La metodologia fue actualizada (${fromLabel} → v${info.to}). ` +
61
- 'Antes de responder al usuario, informa del cambio y ofrece ejecutar /refacil:update para aplicar las migraciones pendientes.',
60
+ `[refacil-sdd-ai] La metodologia SDD-AI fue actualizada (${fromLabel} → v${info.to}). ` +
61
+ 'IMPORTANTE: antes de continuar, pregunta al usuario si desea aplicar las migraciones pendientes ' +
62
+ 'y, si confirma, ejecuta /refacil:update.',
62
63
  );
63
64
  }
64
65
 
package/lib/hooks.js CHANGED
@@ -31,11 +31,13 @@ function installHooks(ideDir, projectRoot) {
31
31
  changed = true;
32
32
  }
33
33
 
34
- if (!settings.hooks.UserPromptSubmit) settings.hooks.UserPromptSubmit = [];
34
+ // Claude Code usa "UserPromptSubmit"; Cursor usa "beforeSubmitPrompt"
35
+ const notifyEvent = ideDir === '.cursor' ? 'beforeSubmitPrompt' : 'UserPromptSubmit';
36
+ if (!settings.hooks[notifyEvent]) settings.hooks[notifyEvent] = [];
35
37
 
36
- const hasNotifyHook = settings.hooks.UserPromptSubmit.some((h) => h._sdd_notify === true);
38
+ const hasNotifyHook = settings.hooks[notifyEvent].some((h) => h._sdd_notify === true);
37
39
  if (!hasNotifyHook) {
38
- settings.hooks.UserPromptSubmit.push({
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
- if (Array.isArray(settings.hooks.UserPromptSubmit)) {
103
- const original = settings.hooks.UserPromptSubmit.length;
104
- settings.hooks.UserPromptSubmit = settings.hooks.UserPromptSubmit.filter(
105
- (h) => h._sdd_notify !== true,
106
- );
107
- if (settings.hooks.UserPromptSubmit.length !== original) changed = true;
108
- if (settings.hooks.UserPromptSubmit.length === 0) delete settings.hooks.UserPromptSubmit;
104
+ for (const notifyEvent of ['UserPromptSubmit', 'beforeSubmitPrompt', '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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "refacil-sdd-ai",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "SDD-AI: Specification-Driven Development with AI — metodologia de desarrollo con IA usando OpenSpec, Claude Code y Cursor",
5
5
  "bin": {
6
6
  "refacil-sdd-ai": "./bin/cli.js"