specbox 6.35.0 → 6.37.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.
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * uc-state-marker.mjs — PostToolUse de las tools de SpecBox: el estado de la UC queda en el proyecto (UC-12216).
4
+ *
5
+ * Con el MCP remoto, `start_uc` no puede escribir .quality/active_uc.json en el disco del proyecto:
6
+ * lo devuelve como `active_uc_marker` y este hook lo escribe. `complete_uc` y `release_uc` lo borran
7
+ * si es de esa UC. Con el MCP local el servidor ya lo escribe; repetirlo deja el mismo fichero.
8
+ *
9
+ * UC-12206: también deja lo que mira uc-lifecycle-guard al hacer push: ac_marked.json tras
10
+ * mark_ac_batch (criterios cumplidos y no cumplidos) y uc_moved_to_review.json tras move_uc a
11
+ * revisión; el marcador guarda los criterios de la UC para saber cuáles faltan.
12
+ *
13
+ * Nunca bloquea ni escribe al agente: si no puede, se calla.
14
+ */
15
+
16
+ import { execFileSync } from 'node:child_process';
17
+ import { parseToolName } from './lib/freeform-fragment.mjs';
18
+ import { acIdsFrom, clearMarker, isError, markerFrom, recordMarkedAcs, recordMove, writeMarker } from './lib/uc-state.mjs';
19
+ import { readHookInput } from './lib/utils.mjs';
20
+
21
+ const { event, toolName, toolInput, cwd, payload } = readHookInput();
22
+ const parsed = parseToolName(toolName);
23
+ if (event !== 'PostToolUse' || !parsed) process.exit(0);
24
+
25
+ const root = (() => {
26
+ try {
27
+ return (
28
+ execFileSync('git', ['-C', cwd, 'rev-parse', '--show-toplevel'], {
29
+ encoding: 'utf-8',
30
+ stdio: ['ignore', 'pipe', 'ignore'],
31
+ }).trim() || cwd
32
+ );
33
+ } catch {
34
+ return cwd;
35
+ }
36
+ })();
37
+
38
+ const response = payload.tool_response;
39
+ try {
40
+ if (parsed.tool === 'start_uc') {
41
+ const marker = markerFrom(response);
42
+ if (marker) {
43
+ const acIds = acIdsFrom(response);
44
+ writeMarker(root, acIds.length ? { ...marker, ac_ids: acIds } : marker);
45
+ recordMove(root, marker.uc_id, 'in_progress'); // la UC vuelve a estar en curso
46
+ }
47
+ } else if (parsed.tool === 'mark_ac_batch') {
48
+ if (!isError(response) && toolInput.uc_id) recordMarkedAcs(root, toolInput.uc_id, response);
49
+ } else if (parsed.tool === 'move_uc') {
50
+ if (!isError(response) && toolInput.uc_id) recordMove(root, toolInput.uc_id, toolInput.target);
51
+ } else if (parsed.tool === 'complete_uc' || parsed.tool === 'release_uc') {
52
+ if (!isError(response)) clearMarker(root, toolInput.uc_id);
53
+ }
54
+ } catch {
55
+ // el marcador es una ayuda para los hooks: nunca la razón de que falle una tool
56
+ }
57
+ process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specbox",
3
- "version": "6.35.0",
3
+ "version": "6.37.0",
4
4
  "description": "Conecta este ordenador a SpecBox sin copiar tokens (specbox login, status y logout) y actualiza los hooks del proyecto sin pisar los tuyos (specbox hooks).",
5
5
  "type": "module",
6
6
  "bin": {