maestro-flow 0.3.9 → 0.3.11

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 (281) hide show
  1. package/.claude/agents/workflow-collab-planner.md +1 -1
  2. package/.claude/agents/workflow-executor.md +1 -1
  3. package/.claude/agents/workflow-plan-checker.md +1 -1
  4. package/.claude/agents/workflow-planner.md +1 -1
  5. package/.claude/commands/learn-decompose.md +176 -176
  6. package/.claude/commands/learn-follow.md +167 -167
  7. package/.claude/commands/learn-retro.md +1 -1
  8. package/.claude/commands/maestro-analyze.md +46 -3
  9. package/.claude/commands/maestro-coordinate.md +1 -3
  10. package/.claude/commands/maestro-execute.md +14 -0
  11. package/.claude/commands/maestro-plan.md +16 -0
  12. package/.claude/commands/manage-harvest.md +131 -131
  13. package/.claude/commands/manage-issue-discover.md +2 -2
  14. package/.claude/commands/manage-issue.md +5 -5
  15. package/.claude/commands/spec-add.md +67 -56
  16. package/.claude/commands/spec-load.md +66 -64
  17. package/.claude/commands/spec-setup.md +5 -9
  18. package/.codex/skills/learn-decompose/SKILL.md +119 -0
  19. package/.codex/skills/learn-follow/SKILL.md +83 -0
  20. package/.codex/skills/learn-investigate/SKILL.md +83 -0
  21. package/.codex/skills/learn-retro/SKILL.md +83 -0
  22. package/.codex/skills/learn-second-opinion/SKILL.md +86 -0
  23. package/.codex/skills/maestro/SKILL.md +335 -0
  24. package/.codex/skills/maestro-analyze/SKILL.md +84 -75
  25. package/.codex/skills/maestro-brainstorm/SKILL.md +452 -463
  26. package/.codex/skills/maestro-chain/SKILL.md +233 -0
  27. package/.codex/skills/maestro-coordinate/SKILL.md +167 -278
  28. package/.codex/skills/maestro-execute/SKILL.md +435 -438
  29. package/.codex/skills/maestro-fork/SKILL.md +68 -0
  30. package/.codex/skills/maestro-init/SKILL.md +171 -167
  31. package/.codex/skills/maestro-learn/SKILL.md +80 -0
  32. package/.codex/skills/maestro-link-coordinate/SKILL.md +224 -220
  33. package/.codex/skills/maestro-merge/SKILL.md +62 -0
  34. package/.codex/skills/maestro-milestone-audit/SKILL.md +108 -103
  35. package/.codex/skills/maestro-milestone-complete/SKILL.md +155 -149
  36. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -0
  37. package/.codex/skills/maestro-overlay/SKILL.md +188 -185
  38. package/.codex/skills/maestro-plan/SKILL.md +66 -69
  39. package/.codex/skills/maestro-quick/SKILL.md +26 -23
  40. package/.codex/skills/maestro-roadmap/SKILL.md +65 -73
  41. package/.codex/skills/maestro-spec-generate/SKILL.md +66 -74
  42. package/.codex/skills/maestro-ui-design/SKILL.md +34 -31
  43. package/.codex/skills/maestro-verify/SKILL.md +556 -566
  44. package/.codex/skills/manage-codebase-rebuild/SKILL.md +397 -405
  45. package/.codex/skills/manage-codebase-refresh/SKILL.md +93 -82
  46. package/.codex/skills/manage-harvest/SKILL.md +82 -0
  47. package/.codex/skills/manage-issue/SKILL.md +80 -65
  48. package/.codex/skills/manage-issue-discover/SKILL.md +491 -503
  49. package/.codex/skills/manage-learn/SKILL.md +190 -186
  50. package/.codex/skills/manage-memory/SKILL.md +95 -72
  51. package/.codex/skills/manage-memory-capture/SKILL.md +99 -86
  52. package/.codex/skills/manage-status/SKILL.md +102 -89
  53. package/.codex/skills/quality-business-test/SKILL.md +228 -223
  54. package/.codex/skills/quality-debug/SKILL.md +54 -66
  55. package/.codex/skills/quality-integration-test/SKILL.md +532 -544
  56. package/.codex/skills/quality-refactor/SKILL.md +197 -191
  57. package/.codex/skills/quality-retrospective/SKILL.md +512 -505
  58. package/.codex/skills/quality-review/SKILL.md +93 -105
  59. package/.codex/skills/quality-sync/SKILL.md +101 -89
  60. package/.codex/skills/quality-test/SKILL.md +202 -198
  61. package/.codex/skills/quality-test-gen/SKILL.md +93 -104
  62. package/.codex/skills/spec-add/SKILL.md +58 -39
  63. package/.codex/skills/spec-load/SKILL.md +45 -40
  64. package/.codex/skills/spec-map/SKILL.md +180 -182
  65. package/.codex/skills/spec-setup/SKILL.md +94 -76
  66. package/.codex/skills/team-coordinate/SKILL.md +346 -357
  67. package/.codex/skills/team-executor/SKILL.md +70 -112
  68. package/.codex/skills/team-lifecycle-v4/SKILL.md +311 -299
  69. package/.codex/skills/team-quality-assurance/SKILL.md +234 -227
  70. package/.codex/skills/team-review/SKILL.md +232 -225
  71. package/.codex/skills/team-tech-debt/SKILL.md +78 -100
  72. package/.codex/skills/team-testing/SKILL.md +242 -235
  73. package/.codex/skills/wiki-connect/SKILL.md +75 -0
  74. package/.codex/skills/wiki-digest/SKILL.md +87 -0
  75. package/README.md +14 -11
  76. package/README.zh-CN.md +14 -11
  77. package/chains/issue-lifecycle.json +13 -13
  78. package/chains/singles/issue-analyze.json +3 -3
  79. package/chains/singles/issue-execute.json +3 -3
  80. package/chains/singles/issue-plan.json +3 -3
  81. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
  82. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  83. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  84. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  85. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
  86. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +1 -1
  88. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +75 -30
  89. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  90. package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +5 -0
  91. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +5 -0
  92. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
  93. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
  94. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  95. package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
  96. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  97. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
  98. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  99. package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
  100. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
  101. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
  102. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +21 -0
  103. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/shared/types.d.ts +3 -2
  105. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +1 -1
  106. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  107. package/dashboard/dist-server/src/hooks/constants.d.ts +92 -12
  108. package/dashboard/dist-server/src/hooks/constants.js +151 -16
  109. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  110. package/dashboard/dist-server/src/types/index.d.ts +5 -0
  111. package/dist/src/commands/collab.d.ts +1 -34
  112. package/dist/src/commands/collab.d.ts.map +1 -1
  113. package/dist/src/commands/collab.js +8 -76
  114. package/dist/src/commands/collab.js.map +1 -1
  115. package/dist/src/commands/hooks.d.ts +5 -1
  116. package/dist/src/commands/hooks.d.ts.map +1 -1
  117. package/dist/src/commands/hooks.js +115 -10
  118. package/dist/src/commands/hooks.js.map +1 -1
  119. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
  120. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  121. package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
  122. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  123. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  124. package/dist/src/commands/install-ui/InstallExecution.js +5 -1
  125. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  126. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  127. package/dist/src/commands/install-ui/InstallFlow.js +7 -3
  128. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  129. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
  130. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  131. package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
  132. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  133. package/dist/src/commands/spec.d.ts.map +1 -1
  134. package/dist/src/commands/spec.js +7 -2
  135. package/dist/src/commands/spec.js.map +1 -1
  136. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
  137. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
  138. package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
  139. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
  140. package/dist/src/hooks/constants.d.ts +92 -12
  141. package/dist/src/hooks/constants.d.ts.map +1 -1
  142. package/dist/src/hooks/constants.js +151 -16
  143. package/dist/src/hooks/constants.js.map +1 -1
  144. package/dist/src/hooks/guards/index.d.ts +2 -0
  145. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  146. package/dist/src/hooks/guards/index.js +2 -0
  147. package/dist/src/hooks/guards/index.js.map +1 -1
  148. package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
  149. package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
  150. package/dist/src/hooks/guards/preflight-guard.js +95 -0
  151. package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
  152. package/dist/src/hooks/guards/spec-validator.d.ts +25 -0
  153. package/dist/src/hooks/guards/spec-validator.d.ts.map +1 -0
  154. package/dist/src/hooks/guards/spec-validator.js +66 -0
  155. package/dist/src/hooks/guards/spec-validator.js.map +1 -0
  156. package/dist/src/hooks/index.d.ts +1 -0
  157. package/dist/src/hooks/index.d.ts.map +1 -1
  158. package/dist/src/hooks/index.js +1 -0
  159. package/dist/src/hooks/index.js.map +1 -1
  160. package/dist/src/hooks/keyword-spec-injector.d.ts +21 -0
  161. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -0
  162. package/dist/src/hooks/keyword-spec-injector.js +96 -0
  163. package/dist/src/hooks/keyword-spec-injector.js.map +1 -0
  164. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts +2 -1
  165. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
  166. package/dist/src/hooks/plugins/spec-injection-plugin.js +21 -12
  167. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  168. package/dist/src/hooks/preflight-core.d.ts +37 -0
  169. package/dist/src/hooks/preflight-core.d.ts.map +1 -0
  170. package/dist/src/hooks/preflight-core.js +86 -0
  171. package/dist/src/hooks/preflight-core.js.map +1 -0
  172. package/dist/src/hooks/spec-bridge.d.ts +40 -0
  173. package/dist/src/hooks/spec-bridge.d.ts.map +1 -0
  174. package/dist/src/hooks/spec-bridge.js +97 -0
  175. package/dist/src/hooks/spec-bridge.js.map +1 -0
  176. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  177. package/dist/src/hooks/spec-injector.js +18 -12
  178. package/dist/src/hooks/spec-injector.js.map +1 -1
  179. package/dist/src/hooks/statusline.d.ts +8 -17
  180. package/dist/src/hooks/statusline.d.ts.map +1 -1
  181. package/dist/src/hooks/statusline.js +269 -112
  182. package/dist/src/hooks/statusline.js.map +1 -1
  183. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  184. package/dist/src/i18n/locales/en.js +5 -0
  185. package/dist/src/i18n/locales/en.js.map +1 -1
  186. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  187. package/dist/src/i18n/locales/zh.js +5 -0
  188. package/dist/src/i18n/locales/zh.js.map +1 -1
  189. package/dist/src/i18n/types.d.ts +5 -0
  190. package/dist/src/i18n/types.d.ts.map +1 -1
  191. package/dist/src/team/phase-orchestrator.d.ts +52 -0
  192. package/dist/src/team/phase-orchestrator.d.ts.map +1 -0
  193. package/dist/src/team/phase-orchestrator.js +165 -0
  194. package/dist/src/team/phase-orchestrator.js.map +1 -0
  195. package/dist/src/team/phase-types.d.ts +51 -0
  196. package/dist/src/team/phase-types.d.ts.map +1 -0
  197. package/dist/src/team/phase-types.js +41 -0
  198. package/dist/src/team/phase-types.js.map +1 -0
  199. package/dist/src/tools/collab-adapter.d.ts +17 -0
  200. package/dist/src/tools/collab-adapter.d.ts.map +1 -1
  201. package/dist/src/tools/collab-adapter.js +138 -0
  202. package/dist/src/tools/collab-adapter.js.map +1 -1
  203. package/dist/src/tools/index.d.ts.map +1 -1
  204. package/dist/src/tools/index.js +6 -0
  205. package/dist/src/tools/index.js.map +1 -1
  206. package/dist/src/tools/merge-validator.d.ts +24 -0
  207. package/dist/src/tools/merge-validator.d.ts.map +1 -0
  208. package/dist/src/tools/merge-validator.js +220 -0
  209. package/dist/src/tools/merge-validator.js.map +1 -0
  210. package/dist/src/tools/spec-entry-parser.d.ts +56 -0
  211. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -0
  212. package/dist/src/tools/spec-entry-parser.js +196 -0
  213. package/dist/src/tools/spec-entry-parser.js.map +1 -0
  214. package/dist/src/tools/spec-init.d.ts.map +1 -1
  215. package/dist/src/tools/spec-init.js +66 -92
  216. package/dist/src/tools/spec-init.js.map +1 -1
  217. package/dist/src/tools/spec-keyword-index.d.ts +30 -0
  218. package/dist/src/tools/spec-keyword-index.d.ts.map +1 -0
  219. package/dist/src/tools/spec-keyword-index.js +101 -0
  220. package/dist/src/tools/spec-keyword-index.js.map +1 -0
  221. package/dist/src/tools/spec-loader.d.ts +3 -3
  222. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  223. package/dist/src/tools/spec-loader.js +49 -23
  224. package/dist/src/tools/spec-loader.js.map +1 -1
  225. package/dist/src/tools/team-agents.d.ts +27 -0
  226. package/dist/src/tools/team-agents.d.ts.map +1 -0
  227. package/dist/src/tools/team-agents.js +362 -0
  228. package/dist/src/tools/team-agents.js.map +1 -0
  229. package/dist/src/tools/team-mailbox.d.ts +40 -0
  230. package/dist/src/tools/team-mailbox.d.ts.map +1 -0
  231. package/dist/src/tools/team-mailbox.js +384 -0
  232. package/dist/src/tools/team-mailbox.js.map +1 -0
  233. package/dist/src/tools/team-msg.d.ts +17 -8
  234. package/dist/src/tools/team-msg.d.ts.map +1 -1
  235. package/dist/src/tools/team-msg.js +110 -13
  236. package/dist/src/tools/team-msg.js.map +1 -1
  237. package/dist/src/tools/team-tasks-mcp.d.ts +27 -0
  238. package/dist/src/tools/team-tasks-mcp.d.ts.map +1 -0
  239. package/dist/src/tools/team-tasks-mcp.js +408 -0
  240. package/dist/src/tools/team-tasks-mcp.js.map +1 -0
  241. package/dist/src/types/index.d.ts +5 -0
  242. package/dist/src/types/index.d.ts.map +1 -1
  243. package/package.json +2 -1
  244. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
  245. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
  246. package/templates/search-tools.md +1 -1
  247. package/workflows/analyze.md +816 -816
  248. package/workflows/brainstorm.md +471 -471
  249. package/workflows/cli-tools-usage.md +44 -27
  250. package/workflows/codebase-rebuild.md +332 -332
  251. package/workflows/codebase-refresh.md +240 -240
  252. package/workflows/delegate-usage.md +3 -3
  253. package/workflows/execute.md +1 -1
  254. package/workflows/harvest.md +420 -420
  255. package/workflows/integration-test.md +343 -343
  256. package/workflows/issue-analyze.md +6 -2
  257. package/workflows/issue-discover.md +414 -414
  258. package/workflows/issue-execute.md +6 -3
  259. package/workflows/issue-plan.md +5 -2
  260. package/workflows/maestro-coordinate.codex.md +281 -470
  261. package/workflows/maestro-coordinate.md +14 -14
  262. package/workflows/maestro-link-coordinate.md +2 -2
  263. package/workflows/maestro.codex.md +710 -0
  264. package/workflows/maestro.md +10 -11
  265. package/workflows/map.md +111 -111
  266. package/workflows/milestone-complete.md +176 -176
  267. package/workflows/plan.md +1 -1
  268. package/workflows/quick.md +497 -497
  269. package/workflows/refactor.md +300 -300
  270. package/workflows/retrospective.md +1 -1
  271. package/workflows/roadmap.md +335 -335
  272. package/workflows/spec-generate.md +640 -640
  273. package/workflows/specs-add.md +46 -81
  274. package/workflows/specs-load.md +15 -17
  275. package/workflows/specs-setup.md +40 -161
  276. package/.claude/commands/manage-issue-analyze.md +0 -62
  277. package/.claude/commands/manage-issue-execute.md +0 -73
  278. package/.claude/commands/manage-issue-plan.md +0 -62
  279. package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
  280. package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
  281. package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
@@ -14,16 +14,102 @@ export declare const BRIDGE_PREFIX = "maestro-ctx-";
14
14
  export declare const NOTIFY_PREFIX = "maestro-notify-";
15
15
  /** Coordinator tracker bridge file prefix in os.tmpdir() */
16
16
  export declare const COORD_BRIDGE_PREFIX = "maestro-coord-";
17
+ /** Spec keyword injection dedup bridge file prefix in os.tmpdir() */
18
+ export declare const SPEC_KW_BRIDGE_PREFIX = "maestro-spec-kw-";
17
19
  /** Max ms to wait for stdin before exiting (Windows pipe safety) */
18
20
  export declare const STDIN_TIMEOUT_MS = 3000;
21
+ /** Powerline right-arrow separator (E0B0 needs Powerline font, fallback to triangle) */
22
+ export declare const PL_SEP: string;
23
+ /** Select icon set based on config */
24
+ export declare const ICONS: {
25
+ readonly model: "󰮩";
26
+ readonly milestone: "󰽎";
27
+ readonly phase: "";
28
+ readonly coord: "󰑌";
29
+ readonly task: "";
30
+ readonly team: "󰡉";
31
+ readonly dir: "";
32
+ readonly git: "";
33
+ readonly ctx: "󰐥";
34
+ } | {
35
+ readonly model: "✎";
36
+ readonly milestone: "⚑";
37
+ readonly phase: "◆";
38
+ readonly coord: "⚙";
39
+ readonly task: "▸";
40
+ readonly team: "👥";
41
+ readonly dir: "■";
42
+ readonly git: "◆";
43
+ readonly ctx: "◔";
44
+ };
45
+ /** Git status icons */
46
+ export declare const GIT_ICONS: {
47
+ readonly clean: "✓";
48
+ readonly dirty: "●";
49
+ readonly conflict: "⚠";
50
+ readonly ahead: "↑";
51
+ readonly behind: "↓";
52
+ };
19
53
  /**
20
- * ASCII faces by severity level.
21
- *
22
- * ^_^ — plenty of context (used < 50%)
23
- * -_- — getting used (used 50–65%)
24
- * O_O — running low (used 65–80%)
25
- * X_X — critical (used >= 80%)
54
+ * RGB background colors muted Notion-inspired palette.
55
+ * Each entry: [R, G, B]
26
56
  */
57
+ export declare const SEGMENT_BG: {
58
+ readonly model: readonly [63, 75, 91];
59
+ readonly milestone: readonly [160, 82, 45];
60
+ readonly phase: readonly [180, 142, 46];
61
+ readonly coord: readonly [58, 126, 200];
62
+ readonly task: readonly [55, 55, 60];
63
+ readonly team: readonly [123, 94, 167];
64
+ readonly dir: readonly [45, 134, 89];
65
+ readonly ctxOk: readonly [45, 134, 89];
66
+ readonly ctxWarn: readonly [180, 142, 46];
67
+ readonly ctxAlert: readonly [200, 122, 42];
68
+ readonly ctxCrit: readonly [196, 64, 64];
69
+ };
70
+ export declare const SEGMENT_FG: {
71
+ readonly model: readonly [255, 255, 255];
72
+ readonly milestone: readonly [255, 255, 255];
73
+ readonly phase: readonly [30, 30, 30];
74
+ readonly coord: readonly [255, 255, 255];
75
+ readonly task: readonly [224, 224, 224];
76
+ readonly team: readonly [255, 255, 255];
77
+ readonly dir: readonly [255, 255, 255];
78
+ readonly ctxOk: readonly [255, 255, 255];
79
+ readonly ctxWarn: readonly [30, 30, 30];
80
+ readonly ctxAlert: readonly [255, 255, 255];
81
+ readonly ctxCrit: readonly [255, 255, 255];
82
+ };
83
+ export type CtxLevel = 'ok' | 'warn' | 'alert' | 'crit';
84
+ export declare function getCtxLevel(usedPct: number): CtxLevel;
85
+ export declare function ansiBg(rgb: readonly [number, number, number]): string;
86
+ export declare function ansiFg(rgb: readonly [number, number, number]): string;
87
+ export declare const ANSI_RESET = "\u001B[0m";
88
+ export declare const ANSI_DIM = "\u001B[2m";
89
+ export declare const ANSI_BOLD = "\u001B[1m";
90
+ export declare const ANSI_CYAN = "\u001B[36m";
91
+ export declare const ANSI_BLINK = "\u001B[5m";
92
+ export type StatuslineStyle = 'powerline' | 'text';
93
+ export declare function getStatuslineStyle(): StatuslineStyle;
94
+ /**
95
+ * Text-mode segment colors — used as foreground on transparent background.
96
+ * Each color is the "accent" for that segment type.
97
+ */
98
+ export declare const TEXT_COLORS: {
99
+ readonly model: readonly [86, 182, 194];
100
+ readonly milestone: readonly [224, 175, 104];
101
+ readonly phase: readonly [166, 209, 137];
102
+ readonly coord: readonly [137, 180, 250];
103
+ readonly task: readonly [205, 214, 244];
104
+ readonly team: readonly [203, 166, 247];
105
+ readonly dir: readonly [249, 226, 175];
106
+ readonly git: readonly [166, 227, 161];
107
+ readonly ctxOk: readonly [166, 227, 161];
108
+ readonly ctxWarn: readonly [249, 226, 175];
109
+ readonly ctxAlert: readonly [250, 179, 135];
110
+ readonly ctxCrit: readonly [243, 139, 168];
111
+ readonly separator: readonly [88, 91, 112];
112
+ };
27
113
  export declare const FACES: {
28
114
  readonly happy: "^_^";
29
115
  readonly neutral: "-_-";
@@ -31,12 +117,6 @@ export declare const FACES: {
31
117
  readonly critical: "X_X";
32
118
  };
33
119
  export type FaceLevel = keyof typeof FACES;
34
- /** Map used% to face level */
35
120
  export declare function getFaceLevel(usedPct: number): FaceLevel;
36
- /** ANSI color codes by face level */
37
121
  export declare const FACE_COLORS: Record<FaceLevel, string>;
38
- export declare const ANSI_RESET = "\u001B[0m";
39
- export declare const ANSI_DIM = "\u001B[2m";
40
- export declare const ANSI_BOLD = "\u001B[1m";
41
- export declare const ANSI_CYAN = "\u001B[36m";
42
122
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/constants.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,uDAAuD;AACvD,eAAO,MAAM,k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AKR,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,KAAK,CAAC;AAE3C,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAKvD;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAKjD,CAAC"}
@@ -1,4 +1,33 @@
1
1
  // Shared constants for maestro hooks
2
+ import { readFileSync, existsSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { homedir } from 'node:os';
5
+ /**
6
+ * Read statusline config from maestro config file.
7
+ * Falls back to env vars, then defaults.
8
+ */
9
+ function readStatuslineConfig() {
10
+ // 1. Try maestro config file
11
+ try {
12
+ const configPath = join(process.env.MAESTRO_HOME || join(homedir(), '.maestro'), 'config.json');
13
+ if (existsSync(configPath)) {
14
+ const cfg = JSON.parse(readFileSync(configPath, 'utf8'));
15
+ if (cfg.statusline) {
16
+ return {
17
+ style: cfg.statusline.style === 'powerline' ? 'powerline' : 'text',
18
+ nerdFont: cfg.statusline.nerdFont === true,
19
+ };
20
+ }
21
+ }
22
+ }
23
+ catch { /* ignore */ }
24
+ // 2. Fall back to env vars
25
+ const envStyle = process.env.MAESTRO_STATUSLINE_STYLE?.toLowerCase();
26
+ const style = (envStyle === 'powerline' || envStyle === 'pl') ? 'powerline' : 'text';
27
+ const nerdFont = process.env.MAESTRO_NERD_FONT === '1';
28
+ return { style, nerdFont };
29
+ }
30
+ const _slConfig = readStatuslineConfig();
2
31
  /** Remaining context % at which WARNING is emitted */
3
32
  export const WARNING_THRESHOLD = 35;
4
33
  /** Remaining context % at which CRITICAL is emitted */
@@ -15,23 +44,134 @@ export const BRIDGE_PREFIX = 'maestro-ctx-';
15
44
  export const NOTIFY_PREFIX = 'maestro-notify-';
16
45
  /** Coordinator tracker bridge file prefix in os.tmpdir() */
17
46
  export const COORD_BRIDGE_PREFIX = 'maestro-coord-';
47
+ /** Spec keyword injection dedup bridge file prefix in os.tmpdir() */
48
+ export const SPEC_KW_BRIDGE_PREFIX = 'maestro-spec-kw-';
18
49
  /** Max ms to wait for stdin before exiting (Windows pipe safety) */
19
50
  export const STDIN_TIMEOUT_MS = 3000;
51
+ // ---------------------------------------------------------------------------
52
+ // Powerline statusline — Notion-inspired muted palette
53
+ // ---------------------------------------------------------------------------
54
+ /** Powerline right-arrow separator (E0B0 needs Powerline font, fallback to triangle) */
55
+ export const PL_SEP = _slConfig.nerdFont ? '\uE0B0' : '\u25B6';
56
+ /** Icon sets — Nerd Font (rich) vs Unicode (safe fallback) */
57
+ const ICONS_NERD = {
58
+ model: '\u{F0BA9}', // 󰮩 nf-md-robot
59
+ milestone: '\u{F0F4E}', // 󰽎 nf-md-flag_checkered
60
+ phase: '\uF0E3', // nf-oct-milestone
61
+ coord: '\u{F044C}', // 󰑌 nf-md-check_circle_outline
62
+ task: '\uEACB', // nf-cod-terminal_cmd
63
+ team: '\u{F0849}', // 󰡉 nf-md-account_group
64
+ dir: '\uEA83', // nf-cod-folder
65
+ git: '\uE725', // nf-dev-git_branch
66
+ ctx: '\u{F0425}', // 󰐥 nf-md-gauge
67
+ };
68
+ const ICONS_UNICODE = {
69
+ model: '\u270E', // ✎ pencil
70
+ milestone: '\u2691', // ⚑ flag
71
+ phase: '\u25C6', // ◆ diamond
72
+ coord: '\u2699', // ⚙ gear
73
+ task: '\u25B8', // ▸ triangle
74
+ team: '\u{1F465}', // 👥 people
75
+ dir: '\u25A0', // ■ square
76
+ git: '\u25C6', // ◆ diamond (git branch)
77
+ ctx: '\u25D4', // ◔ circle with quarter
78
+ };
79
+ /** Select icon set based on config */
80
+ export const ICONS = _slConfig.nerdFont ? ICONS_NERD : ICONS_UNICODE;
81
+ /** Git status icons */
82
+ export const GIT_ICONS = {
83
+ clean: '✓',
84
+ dirty: '●',
85
+ conflict: '⚠',
86
+ ahead: '↑',
87
+ behind: '↓',
88
+ };
20
89
  /**
21
- * ASCII faces by severity level.
22
- *
23
- * ^_^ — plenty of context (used < 50%)
24
- * -_- — getting used (used 50–65%)
25
- * O_O — running low (used 65–80%)
26
- * X_X — critical (used >= 80%)
90
+ * RGB background colors muted Notion-inspired palette.
91
+ * Each entry: [R, G, B]
27
92
  */
93
+ export const SEGMENT_BG = {
94
+ model: [63, 75, 91], // slate
95
+ milestone: [160, 82, 45], // warm brown
96
+ phase: [180, 142, 46], // gold (muted)
97
+ coord: [58, 126, 200], // blue
98
+ task: [55, 55, 60], // charcoal
99
+ team: [123, 94, 167], // purple
100
+ dir: [45, 134, 89], // green
101
+ ctxOk: [45, 134, 89], // green (0–49%)
102
+ ctxWarn: [180, 142, 46], // gold (50–64%)
103
+ ctxAlert: [200, 122, 42], // orange (65–79%)
104
+ ctxCrit: [196, 64, 64], // red (80%+)
105
+ };
106
+ /** Foreground color per segment: white or dark */
107
+ const WHITE = [255, 255, 255];
108
+ const DARK = [30, 30, 30];
109
+ const LIGHT = [224, 224, 224];
110
+ export const SEGMENT_FG = {
111
+ model: WHITE,
112
+ milestone: WHITE,
113
+ phase: DARK,
114
+ coord: WHITE,
115
+ task: LIGHT,
116
+ team: WHITE,
117
+ dir: WHITE,
118
+ ctxOk: WHITE,
119
+ ctxWarn: DARK,
120
+ ctxAlert: WHITE,
121
+ ctxCrit: WHITE,
122
+ };
123
+ export function getCtxLevel(usedPct) {
124
+ if (usedPct < 50)
125
+ return 'ok';
126
+ if (usedPct < 65)
127
+ return 'warn';
128
+ if (usedPct < 80)
129
+ return 'alert';
130
+ return 'crit';
131
+ }
132
+ // ---------------------------------------------------------------------------
133
+ // ANSI helpers (true-color / 24-bit)
134
+ // ---------------------------------------------------------------------------
135
+ export function ansiBg(rgb) {
136
+ return `\x1b[48;2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
137
+ }
138
+ export function ansiFg(rgb) {
139
+ return `\x1b[38;2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
140
+ }
141
+ export const ANSI_RESET = '\x1b[0m';
142
+ export const ANSI_DIM = '\x1b[2m';
143
+ export const ANSI_BOLD = '\x1b[1m';
144
+ export const ANSI_CYAN = '\x1b[36m';
145
+ export const ANSI_BLINK = '\x1b[5m';
146
+ export function getStatuslineStyle() {
147
+ return _slConfig.style;
148
+ }
149
+ /**
150
+ * Text-mode segment colors — used as foreground on transparent background.
151
+ * Each color is the "accent" for that segment type.
152
+ */
153
+ export const TEXT_COLORS = {
154
+ model: [86, 182, 194], // cyan
155
+ milestone: [224, 175, 104], // warm gold
156
+ phase: [166, 209, 137], // soft green
157
+ coord: [137, 180, 250], // light blue
158
+ task: [205, 214, 244], // white-ish
159
+ team: [203, 166, 247], // lavender
160
+ dir: [249, 226, 175], // yellow
161
+ git: [166, 227, 161], // green
162
+ ctxOk: [166, 227, 161], // green
163
+ ctxWarn: [249, 226, 175], // yellow
164
+ ctxAlert: [250, 179, 135], // peach
165
+ ctxCrit: [243, 139, 168], // red/pink
166
+ separator: [88, 91, 112], // dim gray for |
167
+ };
168
+ // Legacy face exports (kept for context-monitor compatibility)
28
169
  export const FACES = {
29
170
  happy: '^_^',
30
171
  neutral: '-_-',
31
172
  alert: 'O_O',
32
173
  critical: 'X_X',
33
174
  };
34
- /** Map used% to face level */
35
175
  export function getFaceLevel(usedPct) {
36
176
  if (usedPct < 50)
37
177
  return 'happy';
@@ -41,15 +181,10 @@ export function getFaceLevel(usedPct) {
41
181
  return 'alert';
42
182
  return 'critical';
43
183
  }
44
- /** ANSI color codes by face level */
45
184
  export const FACE_COLORS = {
46
- happy: '\x1b[32m', // green
47
- neutral: '\x1b[33m', // yellow
48
- alert: '\x1b[38;5;208m', // orange
49
- critical: '\x1b[5;31m', // blinking red
185
+ happy: '\x1b[32m',
186
+ neutral: '\x1b[33m',
187
+ alert: '\x1b[38;5;208m',
188
+ critical: '\x1b[5;31m',
50
189
  };
51
- export const ANSI_RESET = '\x1b[0m';
52
- export const ANSI_DIM = '\x1b[2m';
53
- export const ANSI_BOLD = '\x1b[1m';
54
- export const ANSI_CYAN = '\x1b[36m';
55
190
  //# sourceMappingURL=const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IAC1B,QAAQ,EAAE,YAAY;CACvB,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { WorkflowGuard } from './workflow-guard.js';
2
2
  export { PromptGuard } from './prompt-guard.js';
3
+ export { evaluatePreflightGuard, loadPreflightConfig } from './preflight-guard.js';
4
+ export { evaluateSpecValidator } from './spec-validator.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { WorkflowGuard } from './workflow-guard.js';
2
2
  export { PromptGuard } from './prompt-guard.js';
3
+ export { evaluatePreflightGuard, loadPreflightConfig } from './preflight-guard.js';
4
+ export { evaluateSpecValidator } from './spec-validator.js';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,29 @@
1
+ export interface PreflightGuardResult {
2
+ /** True if the guard wants to block (only when mode = 'block'). */
3
+ blocked: boolean;
4
+ /** Warning lines (always populated when conflicts exist). */
5
+ warnings: string[];
6
+ /** Number of conflicting teammates. */
7
+ conflictCount: number;
8
+ }
9
+ export interface PreflightGuardConfig {
10
+ /** 'warn' = emit warnings, 'block' = reject the operation. Default: 'warn' */
11
+ mode: 'warn' | 'block';
12
+ /** Activity look-back window in minutes. Default: 30 */
13
+ windowMin: number;
14
+ /** Whether to run automatically. Default: true */
15
+ enabled: boolean;
16
+ }
17
+ /**
18
+ * Load preflight guard config from `.workflow/config.json` → `collab` section.
19
+ * Returns defaults on any error.
20
+ */
21
+ export declare function loadPreflightConfig(projectRoot: string): PreflightGuardConfig;
22
+ /**
23
+ * Evaluate whether the current phase has active teammates.
24
+ *
25
+ * Pure function — takes explicit dependencies for testability.
26
+ * Never throws.
27
+ */
28
+ export declare function evaluatePreflightGuard(projectRoot: string, config?: Partial<PreflightGuardConfig>): PreflightGuardResult;
29
+ //# sourceMappingURL=preflight-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight-guard.d.ts","sourceRoot":"","sources":["../../../../src/hooks/guards/preflight-guard.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uCAAuC;IACvC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB;AAYD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,oBAAoB,CAiB7E;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACrC,oBAAoB,CA6BtB"}
@@ -0,0 +1,95 @@
1
+ // ---------------------------------------------------------------------------
2
+ // PreflightGuard — Warns when teammates are active on the same phase
3
+ //
4
+ // Runs as a PreToolUse hook on write operations (Bash|Write|Edit|Agent).
5
+ // Advisory by default (emits warning context), configurable to block.
6
+ //
7
+ // Namespace: reads `.workflow/collab/activity.jsonl` (never writes).
8
+ // ---------------------------------------------------------------------------
9
+ import { existsSync, readFileSync } from 'node:fs';
10
+ import { join } from 'node:path';
11
+ import { resolveSelf } from '../../tools/team-members.js';
12
+ import { runPreflight } from '../preflight-core.js';
13
+ // ---------------------------------------------------------------------------
14
+ // Config loading
15
+ // ---------------------------------------------------------------------------
16
+ const DEFAULT_CONFIG = {
17
+ mode: 'warn',
18
+ windowMin: 30,
19
+ enabled: true,
20
+ };
21
+ /**
22
+ * Load preflight guard config from `.workflow/config.json` → `collab` section.
23
+ * Returns defaults on any error.
24
+ */
25
+ export function loadPreflightConfig(projectRoot) {
26
+ try {
27
+ const configPath = join(projectRoot, '.workflow', 'config.json');
28
+ if (!existsSync(configPath))
29
+ return DEFAULT_CONFIG;
30
+ const raw = JSON.parse(readFileSync(configPath, 'utf-8'));
31
+ const collab = raw?.collab;
32
+ if (!collab)
33
+ return DEFAULT_CONFIG;
34
+ return {
35
+ mode: collab.preflight_mode === 'block' ? 'block' : 'warn',
36
+ windowMin: typeof collab.preflight_window_min === 'number'
37
+ ? collab.preflight_window_min
38
+ : DEFAULT_CONFIG.windowMin,
39
+ enabled: collab.auto_preflight !== false,
40
+ };
41
+ }
42
+ catch {
43
+ return DEFAULT_CONFIG;
44
+ }
45
+ }
46
+ // ---------------------------------------------------------------------------
47
+ // Core evaluation
48
+ // ---------------------------------------------------------------------------
49
+ /**
50
+ * Evaluate whether the current phase has active teammates.
51
+ *
52
+ * Pure function — takes explicit dependencies for testability.
53
+ * Never throws.
54
+ */
55
+ export function evaluatePreflightGuard(projectRoot, config) {
56
+ const cfg = { ...DEFAULT_CONFIG, ...config };
57
+ if (!cfg.enabled) {
58
+ return { blocked: false, warnings: [], conflictCount: 0 };
59
+ }
60
+ const self = resolveSelf();
61
+ if (!self) {
62
+ return { blocked: false, warnings: [], conflictCount: 0 };
63
+ }
64
+ // Read current phase from state.json
65
+ const phase = readCurrentPhase(projectRoot);
66
+ if (phase === null) {
67
+ return { blocked: false, warnings: [], conflictCount: 0 };
68
+ }
69
+ const result = runPreflight(phase, { force: cfg.mode !== 'block' });
70
+ if (result.conflicts.length === 0) {
71
+ return { blocked: false, warnings: [], conflictCount: 0 };
72
+ }
73
+ return {
74
+ blocked: cfg.mode === 'block' && result.exitCode !== 0,
75
+ warnings: result.warnings,
76
+ conflictCount: result.conflicts.length,
77
+ };
78
+ }
79
+ // ---------------------------------------------------------------------------
80
+ // Helpers
81
+ // ---------------------------------------------------------------------------
82
+ function readCurrentPhase(projectRoot) {
83
+ try {
84
+ const statePath = join(projectRoot, '.workflow', 'state.json');
85
+ if (!existsSync(statePath))
86
+ return null;
87
+ const state = JSON.parse(readFileSync(statePath, 'utf-8'));
88
+ const phase = state?.current_phase;
89
+ return typeof phase === 'number' ? phase : null;
90
+ }
91
+ catch {
92
+ return null;
93
+ }
94
+ }
95
+ //# sourceMappingURL=preflight-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight-guard.js","sourceRoot":"","sources":["../../../../src/hooks/guards/preflight-guard.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,qEAAqE;AACrE,EAAE;AACF,yEAAyE;AACzE,sEAA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8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,KAAK,EAAE,aAAa,CAAC;QACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Spec Validator Guard — PreToolUse: Write|Edit
3
+ *
4
+ * Validates that spec file entries use the <spec-entry> closed-tag format.
5
+ * Pure evaluation function — no I/O, follows workflow-guard.ts pattern.
6
+ *
7
+ * Only activates when the file path targets .workflow/specs/.
8
+ */
9
+ export interface SpecValidatorResult {
10
+ valid: boolean;
11
+ mode: 'warn' | 'block';
12
+ errors: Array<{
13
+ line: number;
14
+ message: string;
15
+ }>;
16
+ }
17
+ /**
18
+ * Evaluate spec file content for format compliance.
19
+ *
20
+ * @param filePath Absolute or relative file path being written
21
+ * @param content The full file content after the write/edit
22
+ * @param mode 'warn' (advisory) or 'block' (reject write)
23
+ */
24
+ export declare function evaluateSpecValidator(filePath: string, content: string, mode?: 'warn' | 'block'): SpecValidatorResult;
25
+ //# sourceMappingURL=spec-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-validator.d.ts","sourceRoot":"","sources":["../../../../src/hooks/guards/spec-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAMD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,GAAG,OAAgB,GAC9B,mBAAmB,CA2CrB"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Spec Validator Guard — PreToolUse: Write|Edit
3
+ *
4
+ * Validates that spec file entries use the <spec-entry> closed-tag format.
5
+ * Pure evaluation function — no I/O, follows workflow-guard.ts pattern.
6
+ *
7
+ * Only activates when the file path targets .workflow/specs/.
8
+ */
9
+ import { parseSpecEntries, validateCategoryMatch } from '../../tools/spec-entry-parser.js';
10
+ import { CATEGORY_MAP } from '../../tools/spec-loader.js';
11
+ import { basename } from 'node:path';
12
+ // ============================================================================
13
+ // Public API
14
+ // ============================================================================
15
+ /**
16
+ * Evaluate spec file content for format compliance.
17
+ *
18
+ * @param filePath Absolute or relative file path being written
19
+ * @param content The full file content after the write/edit
20
+ * @param mode 'warn' (advisory) or 'block' (reject write)
21
+ */
22
+ export function evaluateSpecValidator(filePath, content, mode = 'warn') {
23
+ // Only validate files in .workflow/specs/
24
+ if (!isSpecFile(filePath)) {
25
+ return { valid: true, mode, errors: [] };
26
+ }
27
+ const errors = [];
28
+ // Determine expected category from filename
29
+ const fileName = basename(filePath);
30
+ const expectedCategory = CATEGORY_MAP[fileName];
31
+ // Parse entries
32
+ const result = parseSpecEntries(content);
33
+ // Collect parser-level errors
34
+ errors.push(...result.errors);
35
+ // Validate category match per entry
36
+ if (expectedCategory) {
37
+ for (const entry of result.entries) {
38
+ const mismatch = validateCategoryMatch(entry, expectedCategory);
39
+ if (mismatch) {
40
+ errors.push({ line: entry.lineStart, message: mismatch });
41
+ }
42
+ }
43
+ }
44
+ // Check for unclosed tags
45
+ const openCount = (content.match(/<spec-entry\b/g) || []).length;
46
+ const closeCount = (content.match(/<\/spec-entry>/g) || []).length;
47
+ if (openCount !== closeCount) {
48
+ errors.push({
49
+ line: 1,
50
+ message: `Unbalanced tags: ${openCount} opening <spec-entry> vs ${closeCount} closing </spec-entry>`,
51
+ });
52
+ }
53
+ return {
54
+ valid: errors.length === 0,
55
+ mode,
56
+ errors,
57
+ };
58
+ }
59
+ // ============================================================================
60
+ // Internal
61
+ // ============================================================================
62
+ function isSpecFile(filePath) {
63
+ const normalized = filePath.replace(/\\/g, '/');
64
+ return normalized.includes('.workflow/specs/') && normalized.endsWith('.md');
65
+ }
66
+ //# sourceMappingURL=spec-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-validator.js","sourceRoot":"","sources":["../../../../src/hooks/guards/spec-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAqB,qBAAqB,EAAoB,MAAM,kCAAkC,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAYrC,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAgB,EAChB,OAAe,EACf,OAAyB,MAAM;IAE/B,0CAA0C;IAC1C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,MAAM,GAA6C,EAAE,CAAC;IAE5D,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,gBAAgB,GAAG,YAAY,CAAC,QAAQ,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AC,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC"}
@@ -4,5 +4,6 @@ export { FACES, getFaceLevel, WARNING_THRESHOLD, CRITICAL_THRESHOLD } from './co
4
4
  export { SyncHook, AsyncSeriesHook, AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from './hook-engine.js';
5
5
  export { WorkflowHookRegistry } from './workflow-hooks.js';
6
6
  export { HookManager } from './hook-manager.js';
7
+ export { runPreflight, type PreflightResult, type PreflightDeps } from './preflight-core.js';
7
8
  export type { RunContext, NodeContext, CommandContext, CommandResultContext, ErrorContext, DecisionContext, } from './workflow-hooks.js';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7F,YAAY,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
@@ -4,4 +4,5 @@ export { FACES, getFaceLevel, WARNING_THRESHOLD, CRITICAL_THRESHOLD } from './co
4
4
  export { SyncHook, AsyncSeriesHook, AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from './hook-engine.js';
5
5
  export { WorkflowHookRegistry } from './workflow-hooks.js';
6
6
  export { HookManager } from './hook-manager.js';
7
+ export { runPreflight } from './preflight-core.js';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAA4C,MAAM,qBAAqB,CAAC"}