@trycore/spec-build-harness 0.8.5 → 0.11.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 (107) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/GOVERNANCE.md +27 -4
  3. package/INSTALL.md +27 -5
  4. package/METODOLOGIA.md +55 -5
  5. package/README.md +39 -6
  6. package/VERSION +1 -1
  7. package/agents/build/build-orchestrator.md +33 -7
  8. package/agents/build/dor-dod-gatekeeper.md +13 -5
  9. package/agents/build/wiring-adversarial-verifier.md +52 -5
  10. package/commands/build/architect.md +1 -1
  11. package/commands/build/claim.md +46 -0
  12. package/commands/build/escalate.md +36 -0
  13. package/commands/build/front.md +9 -3
  14. package/commands/build/onboard.md +75 -14
  15. package/commands/build/prototype.md +3 -2
  16. package/commands/build/reflect.md +60 -40
  17. package/commands/build/release.md +10 -7
  18. package/commands/build/resume.md +33 -13
  19. package/commands/build/slice.md +32 -27
  20. package/commands/build/status.md +35 -0
  21. package/commands/build/work.md +11 -8
  22. package/config/build-config.template.json +4 -0
  23. package/dist/cli.js +32 -0
  24. package/dist/commands/doctor.js +42 -0
  25. package/dist/commands/init.js +84 -1
  26. package/dist/commands/migrate.js +153 -0
  27. package/dist/commands/status.js +34 -0
  28. package/dist/lib/normalize.js +1123 -0
  29. package/dist/lib/paths.js +6 -0
  30. package/dist/lib/runtime-client.js +196 -0
  31. package/dist/lib/settings-merge.js +3 -3
  32. package/dist/lib/state-bundle.js +150 -0
  33. package/docs/commands.md +25 -8
  34. package/docs/getting-started.md +1 -0
  35. package/docs/hooks.md +114 -27
  36. package/docs/runtime/guia-modo-dual-y-migracion.md +143 -0
  37. package/docs/runtime/plan-migracion-harness-v0.9.md +11 -0
  38. package/docs/runtime/protocolo-cliente-runtime.md +120 -35
  39. package/hooks/build/build-gate-check.sh +21 -0
  40. package/hooks/build/context-monitor.sh +82 -15
  41. package/hooks/build/context-sync.sh +192 -0
  42. package/hooks/build/design-source-guard.sh +30 -2
  43. package/hooks/build/dual-compare.sh +92 -0
  44. package/hooks/build/event-emitter.sh +32 -0
  45. package/hooks/build/gitflow-guard.sh +164 -14
  46. package/hooks/build/heartbeat.sh +259 -0
  47. package/hooks/build/lib/agent-context.sh +139 -0
  48. package/hooks/build/lib/config.sh +27 -0
  49. package/hooks/build/lib/projection.sh +71 -0
  50. package/hooks/build/lib/runtime-client.sh +625 -0
  51. package/hooks/build/lib/runtime-ops.sh +227 -0
  52. package/hooks/build/lib/state-io.sh +5 -18
  53. package/hooks/build/load-build-state.sh +64 -2
  54. package/hooks/build/reflect-nudge.sh +15 -0
  55. package/hooks/build/release-gate-nudge.sh +15 -0
  56. package/hooks/build/release-ops.sh +171 -0
  57. package/hooks/build/scaffold-guard.sh +29 -2
  58. package/hooks/build/session-start.sh +103 -0
  59. package/hooks/build/session-stop.sh +22 -0
  60. package/hooks/build/slice-ops.sh +948 -0
  61. package/hooks/build/stack-guard.sh +8 -0
  62. package/hooks/build/statusline-bridge.sh +24 -3
  63. package/hooks/build-harness.json +16 -0
  64. package/package.json +3 -3
  65. package/scripts/check-agnostic.sh +3 -1
  66. package/scripts/check-pack-clean.sh +31 -0
  67. package/scripts/check-runtime-purity.sh +43 -0
  68. package/scripts/denylist.txt +4 -0
  69. package/scripts/lib/front-plan.py +4 -0
  70. package/scripts/lib/graph-bundle.py +181 -0
  71. package/scripts/runtime-purity-allow.txt +5 -0
  72. package/scripts/smoke-test.sh +1 -1
  73. package/scripts/tests/lib/http-stub.py +46 -0
  74. package/scripts/tests/test-baseline-verdict.sh +92 -0
  75. package/scripts/tests/test-config.sh +25 -0
  76. package/scripts/tests/test-hooks-runtime.sh +828 -0
  77. package/scripts/tests/test-install.sh +103 -0
  78. package/scripts/tests/test-runtime-client.sh +298 -0
  79. package/scripts/tests/test-schema.sh +29 -1
  80. package/scripts/tests/test-skill-ops.sh +1367 -0
  81. package/skills/building-a-micro-change/SKILL.md +22 -4
  82. package/skills/building-a-slice/SKILL.md +55 -21
  83. package/skills/building-a-slice/assets/baseline-verdict.sh +172 -0
  84. package/skills/building-a-slice/references/dod.md +12 -3
  85. package/skills/building-a-slice/references/dor.md +3 -2
  86. package/skills/building-a-slice/references/evidence-budget.md +51 -0
  87. package/skills/building-a-slice/references/exploration-fanout.md +1 -1
  88. package/skills/building-a-slice/references/gitflow.md +1 -1
  89. package/skills/building-a-slice/references/regression-baseline.md +67 -0
  90. package/skills/building-a-slice/references/runtime-protocol.md +75 -0
  91. package/skills/building-a-slice/references/state-protocol.md +12 -1
  92. package/skills/building-a-slice/workflows/README.md +7 -3
  93. package/skills/building-a-slice/workflows/explore-fanout.workflow.js +3 -3
  94. package/skills/building-a-slice/workflows/wiring-verify.workflow.js +26 -4
  95. package/skills/managing-parallel-front/SKILL.md +32 -16
  96. package/skills/openspec-archive-change/SKILL.md +15 -0
  97. package/skills/prototyping-screens/SKILL.md +9 -5
  98. package/skills/releasing-a-version/SKILL.md +26 -16
  99. package/skills/releasing-a-version/references/release-dod.md +7 -5
  100. package/skills/releasing-a-version/workflows/README.md +2 -1
  101. package/skills/releasing-a-version/workflows/release-gate.workflow.js +6 -5
  102. package/skills/setup-architecture/SKILL.md +4 -2
  103. package/state/README.md +16 -1
  104. package/state/build-state.schema.json +2 -1
  105. package/templates/CLAUDE.md.template +16 -0
  106. package/templates/settings-hooks.template.json +8 -4
  107. package/internal/skills/auditar-arnes/SKILL.md +0 -29
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env bash
2
+ # session-start.sh — SessionStart (startup|clear|compact) [EP-OR-08-B].
3
+ # La parte de RED del arranque de sesión: registro idempotente del agente (con el catálogo
4
+ # de asset types del paquete), hidratación de la caché de proyección desde /agent/context,
5
+ # sincronización de contexto por hash y aseguramiento del daemon de heartbeat.
6
+ # El RENDER del estado a `additionalContext` lo hace load-build-state.sh, que corre después.
7
+ # Fail-open absoluto: cualquier fallo imprime un aviso por stderr y sale 0 — un runtime
8
+ # caído jamás impide arrancar una sesión (RNF-6).
9
+ set -uo pipefail
10
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
+ source "$HERE/lib/runtime-client.sh"
12
+ source "$HERE/lib/projection.sh"
13
+ source "$HERE/lib/agent-context.sh"
14
+
15
+ cat >/dev/null 2>&1 # consumir el payload del hook (protocolo); no se usa aquí
16
+
17
+ MODE="$(runtime_mode)"
18
+ [ "$MODE" = "legacy" ] && exit 0
19
+ command -v python3 >/dev/null 2>&1 || exit 0
20
+ [ -n "$(runtime_url)" ] || exit 0 # sin `trycore-build init` (sub-slice D) no hay runtime
21
+
22
+ # sst_pkg_root — raíz del PAQUETE (no del proyecto). Los hooks se instalan como symlinks
23
+ # por fichero (linkChildren), así que hay que resolver la cadena de enlaces a mano:
24
+ # `readlink -f` no es portable al BSD readlink de macOS.
25
+ sst_pkg_root() {
26
+ local src="${BASH_SOURCE[0]}" target i=0
27
+ while [ -L "$src" ] && [ "$i" -lt 10 ]; do
28
+ target="$(readlink "$src" 2>/dev/null)" || break
29
+ case "$target" in
30
+ /*) src="$target" ;;
31
+ *) src="$(dirname "$src")/$target" ;;
32
+ esac
33
+ i=$((i + 1))
34
+ done
35
+ (cd "$(dirname "$src")/../.." >/dev/null 2>&1 && pwd -P) 2>/dev/null
36
+ }
37
+
38
+ # sst_harness_version — versión instalada en el consumidor; si no, la del paquete.
39
+ sst_harness_version() {
40
+ local f pkg
41
+ f="$(config_root)/.claude/.build-harness-version"
42
+ if [ -f "$f" ]; then
43
+ tr -d ' \n' < "$f"
44
+ return
45
+ fi
46
+ pkg="$(sst_pkg_root)"
47
+ if [ -n "$pkg" ] && [ -f "$pkg/VERSION" ]; then
48
+ tr -d ' \n' < "$pkg/VERSION"
49
+ return
50
+ fi
51
+ echo "0.0.0"
52
+ }
53
+
54
+ # sst_asset_types — el array `types` de asset-types.json del paquete (protocolo §6).
55
+ # Cadena de resolución: plugin > copia en .claude/ (la siembra es del sub-slice D) >
56
+ # paquete resuelto por symlink. Sin fichero: "[]" — el registro sigue funcionando.
57
+ sst_asset_types() {
58
+ local pkg candidates f
59
+ pkg="$(sst_pkg_root)"
60
+ candidates="${CLAUDE_PLUGIN_ROOT:-}/asset-types.json
61
+ $(config_root)/.claude/asset-types.json
62
+ ${pkg:-}/asset-types.json"
63
+ while IFS= read -r f; do
64
+ case "$f" in /asset-types.json|asset-types.json) continue ;; esac
65
+ [ -f "$f" ] || continue
66
+ python3 - "$f" <<'PY' 2>/dev/null && return
67
+ import json,sys
68
+ try:
69
+ d=json.load(open(sys.argv[1]))
70
+ t=d.get("types")
71
+ print(json.dumps(t if isinstance(t,list) else [],ensure_ascii=False))
72
+ except Exception:
73
+ raise SystemExit(1)
74
+ PY
75
+ done <<EOS
76
+ $candidates
77
+ EOS
78
+ echo "[]"
79
+ }
80
+
81
+ HV="$(sst_harness_version)"
82
+ AT="$(sst_asset_types)"
83
+
84
+ runtime_register "$HV" "$AT"
85
+ RC=$?
86
+ if [ "$RC" -eq 2 ]; then
87
+ echo "⛔ El runtime rechaza esta versión del arnés ($HV): incompatible_version." >&2
88
+ echo " Actualiza el paquete (npm i -g @trycore/spec-build-harness@latest) y reabre la sesión." >&2
89
+ echo " Mientras tanto se trabaja con la caché local: los guards siguen operando." >&2
90
+ exit 0
91
+ fi
92
+
93
+ if ! agent_context_fetch_and_cache; then
94
+ echo "⚠ El runtime no respondió: se trabaja con la caché de proyección local." >&2
95
+ fi
96
+
97
+ EXPECTED="$(projection_get context.manifest_hash "")"
98
+ [ -n "$EXPECTED" ] || EXPECTED="$(runtime_field manifest_hash)"
99
+ bash "$HERE/context-sync.sh" "$EXPECTED"
100
+
101
+ bash "$HERE/heartbeat.sh" --ensure "$PPID" >/dev/null 2>&1
102
+
103
+ exit 0
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bash
2
+ # session-stop.sh — Stop [EP-OR-08-B].
3
+ # Flush de la cola al cerrar el turno, pero SIN red en el hilo del hook: deja un sentinela
4
+ # en outbox/.flush-request y se asegura de que el daemon esté vivo. El daemon lo consume en
5
+ # su siguiente tick y despacha (protocolo §5, spec §11: «señal local al daemon»).
6
+ # Nunca bloquea el cierre: exit 0 siempre, sin stdout (en Stop, stdout inyecta contexto).
7
+ set -uo pipefail
8
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ source "$HERE/lib/runtime-client.sh"
10
+
11
+ cat >/dev/null 2>&1 # consumir el payload del hook
12
+
13
+ MODE="$(runtime_mode)"
14
+ [ "$MODE" = "legacy" ] && exit 0
15
+
16
+ DIR="$(runtime_outbox_dir)"
17
+ mkdir -p "$DIR" 2>/dev/null
18
+ : > "$DIR/.flush-request" 2>/dev/null
19
+
20
+ bash "$HERE/heartbeat.sh" --ensure "$PPID" >/dev/null 2>&1
21
+
22
+ exit 0