@wazir-dev/cli 1.2.0 → 1.4.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 (161) hide show
  1. package/CHANGELOG.md +54 -44
  2. package/README.md +13 -13
  3. package/assets/demo.cast +47 -0
  4. package/assets/demo.gif +0 -0
  5. package/docs/anti-patterns/AP-23-skipping-enabled-workflows.md +28 -0
  6. package/docs/anti-patterns/AP-24-clarifier-deciding-scope.md +34 -0
  7. package/docs/concepts/architecture.md +1 -1
  8. package/docs/concepts/why-wazir.md +1 -1
  9. package/docs/readmes/INDEX.md +1 -1
  10. package/docs/readmes/features/expertise/README.md +1 -1
  11. package/docs/readmes/features/hooks/pre-compact-summary.md +1 -1
  12. package/docs/reference/hooks.md +1 -0
  13. package/docs/reference/launch-checklist.md +3 -3
  14. package/docs/reference/review-loop-pattern.md +3 -2
  15. package/docs/reference/skill-tiers.md +2 -2
  16. package/docs/research/2026-03-20-agents/a18fb002157904af5.txt +187 -0
  17. package/docs/research/2026-03-20-agents/a1d0ac79ac2f11e6f.txt +2 -0
  18. package/docs/research/2026-03-20-agents/a324079de037abd7c.txt +198 -0
  19. package/docs/research/2026-03-20-agents/a357586bccfafb0e5.txt +256 -0
  20. package/docs/research/2026-03-20-agents/a4365394e4d753105.txt +137 -0
  21. package/docs/research/2026-03-20-agents/a492af28bc52d3613.txt +136 -0
  22. package/docs/research/2026-03-20-agents/a4984db0b6a8eee07.txt +124 -0
  23. package/docs/research/2026-03-20-agents/a5b30e59d34bbb062.txt +214 -0
  24. package/docs/research/2026-03-20-agents/a5cf7829dab911586.txt +165 -0
  25. package/docs/research/2026-03-20-agents/a607157c30dd97c9e.txt +96 -0
  26. package/docs/research/2026-03-20-agents/a60b68b1e19d1e16b.txt +115 -0
  27. package/docs/research/2026-03-20-agents/a722af01c5594aba0.txt +166 -0
  28. package/docs/research/2026-03-20-agents/a787bdc516faa5829.txt +181 -0
  29. package/docs/research/2026-03-20-agents/a7c46d1bba1056ed2.txt +132 -0
  30. package/docs/research/2026-03-20-agents/a7e5abbab2b281a0d.txt +100 -0
  31. package/docs/research/2026-03-20-agents/a8dbadc66cd0d7d5a.txt +95 -0
  32. package/docs/research/2026-03-20-agents/a904d9f45d6b86a6d.txt +75 -0
  33. package/docs/research/2026-03-20-agents/a927659a942ee7f60.txt +102 -0
  34. package/docs/research/2026-03-20-agents/a962cb569191f7583.txt +125 -0
  35. package/docs/research/2026-03-20-agents/aab6decea538aac41.txt +148 -0
  36. package/docs/research/2026-03-20-agents/abd58b853dd938a1b.txt +295 -0
  37. package/docs/research/2026-03-20-agents/ac009da573eff7f65.txt +100 -0
  38. package/docs/research/2026-03-20-agents/ac1bc783364405e5f.txt +190 -0
  39. package/docs/research/2026-03-20-agents/aca5e2b57fde152a0.txt +132 -0
  40. package/docs/research/2026-03-20-agents/ad849b8c0a7e95b8b.txt +176 -0
  41. package/docs/research/2026-03-20-agents/adc2b12a4da32c962.txt +258 -0
  42. package/docs/research/2026-03-20-agents/af97caaaa9a80e4cb.txt +146 -0
  43. package/docs/research/2026-03-20-agents/afc5faceee368b3ca.txt +111 -0
  44. package/docs/research/2026-03-20-agents/afdb282d866e3c1e4.txt +164 -0
  45. package/docs/research/2026-03-20-agents/afe9d1f61c02b1e8d.txt +299 -0
  46. package/docs/research/2026-03-20-agents/b4hmkwril.txt +1856 -0
  47. package/docs/research/2026-03-20-agents/b80ptk89g.txt +1856 -0
  48. package/docs/research/2026-03-20-agents/bf54s1jss.txt +1150 -0
  49. package/docs/research/2026-03-20-agents/bhd6kq2kx.txt +1856 -0
  50. package/docs/research/2026-03-20-agents/bmb2fodyr.txt +988 -0
  51. package/docs/research/2026-03-20-agents/bmmsrij8i.txt +826 -0
  52. package/docs/research/2026-03-20-agents/bn4t2ywpu.txt +2175 -0
  53. package/docs/research/2026-03-20-agents/bu22t9f1z.txt +0 -0
  54. package/docs/research/2026-03-20-agents/bwvl98v2p.txt +738 -0
  55. package/docs/research/2026-03-20-agents/psych-a3697a7fd06eb64fd.txt +135 -0
  56. package/docs/research/2026-03-20-agents/psych-a37776fabc870feae.txt +123 -0
  57. package/docs/research/2026-03-20-agents/psych-a5b1fe05c0589efaf.txt +2 -0
  58. package/docs/research/2026-03-20-agents/psych-a95c15b1f29424435.txt +76 -0
  59. package/docs/research/2026-03-20-agents/psych-a9c26f4d9172dde7c.txt +2 -0
  60. package/docs/research/2026-03-20-agents/psych-aa19c69f0ca2c5ad3.txt +2 -0
  61. package/docs/research/2026-03-20-agents/psych-aa4e4cb70e1be5ecb.txt +95 -0
  62. package/docs/research/2026-03-20-agents/psych-ab5b302f26a554663.txt +102 -0
  63. package/docs/research/2026-03-20-deep-research-complete.md +101 -0
  64. package/docs/research/2026-03-20-deep-research-status.md +38 -0
  65. package/docs/research/2026-03-20-enforcement-research.md +107 -0
  66. package/expertise/antipatterns/process/ai-coding-antipatterns.md +117 -0
  67. package/expertise/composition-map.yaml +27 -8
  68. package/expertise/digests/reviewer/ai-coding-digest.md +83 -0
  69. package/expertise/digests/reviewer/architectural-thinking-digest.md +63 -0
  70. package/expertise/digests/reviewer/architecture-antipatterns-digest.md +49 -0
  71. package/expertise/digests/reviewer/code-smells-digest.md +53 -0
  72. package/expertise/digests/reviewer/coupling-cohesion-digest.md +54 -0
  73. package/expertise/digests/reviewer/ddd-digest.md +60 -0
  74. package/expertise/digests/reviewer/dependency-risk-digest.md +40 -0
  75. package/expertise/digests/reviewer/error-handling-digest.md +55 -0
  76. package/expertise/digests/reviewer/review-methodology-digest.md +49 -0
  77. package/exports/hosts/claude/.claude/commands/learn.md +61 -8
  78. package/exports/hosts/claude/.claude/commands/plan-review.md +3 -1
  79. package/exports/hosts/claude/.claude/commands/verify.md +30 -1
  80. package/exports/hosts/claude/.claude/settings.json +7 -6
  81. package/exports/hosts/claude/export.manifest.json +8 -5
  82. package/exports/hosts/claude/host-package.json +3 -0
  83. package/exports/hosts/codex/export.manifest.json +8 -5
  84. package/exports/hosts/codex/host-package.json +3 -0
  85. package/exports/hosts/cursor/.cursor/hooks.json +6 -6
  86. package/exports/hosts/cursor/export.manifest.json +8 -5
  87. package/exports/hosts/cursor/host-package.json +3 -0
  88. package/exports/hosts/gemini/export.manifest.json +8 -5
  89. package/exports/hosts/gemini/host-package.json +3 -0
  90. package/hooks/definitions/pretooluse_dispatcher.yaml +26 -0
  91. package/hooks/definitions/pretooluse_pipeline_guard.yaml +22 -0
  92. package/hooks/definitions/stop_pipeline_gate.yaml +22 -0
  93. package/hooks/hooks.json +7 -6
  94. package/hooks/pretooluse-dispatcher +84 -0
  95. package/hooks/pretooluse-pipeline-guard +9 -0
  96. package/hooks/stop-pipeline-gate +9 -0
  97. package/llms-full.txt +48 -18
  98. package/package.json +2 -3
  99. package/schemas/decision.schema.json +15 -0
  100. package/schemas/hook.schema.json +4 -1
  101. package/schemas/phase-report.schema.json +9 -0
  102. package/skills/TEMPLATE-3-ZONE.md +160 -0
  103. package/skills/brainstorming/SKILL.md +137 -21
  104. package/skills/clarifier/SKILL.md +364 -53
  105. package/skills/claude-cli/SKILL.md +91 -12
  106. package/skills/codex-cli/SKILL.md +91 -12
  107. package/skills/debugging/SKILL.md +133 -38
  108. package/skills/design/SKILL.md +173 -37
  109. package/skills/dispatching-parallel-agents/SKILL.md +129 -31
  110. package/skills/executing-plans/SKILL.md +113 -25
  111. package/skills/executor/SKILL.md +252 -21
  112. package/skills/finishing-a-development-branch/SKILL.md +107 -18
  113. package/skills/gemini-cli/SKILL.md +91 -12
  114. package/skills/humanize/SKILL.md +92 -13
  115. package/skills/init-pipeline/SKILL.md +90 -18
  116. package/skills/prepare-next/SKILL.md +93 -24
  117. package/skills/receiving-code-review/SKILL.md +90 -16
  118. package/skills/requesting-code-review/SKILL.md +100 -24
  119. package/skills/requesting-code-review/code-reviewer.md +29 -17
  120. package/skills/reviewer/SKILL.md +270 -57
  121. package/skills/run-audit/SKILL.md +92 -15
  122. package/skills/scan-project/SKILL.md +93 -14
  123. package/skills/self-audit/SKILL.md +133 -39
  124. package/skills/skill-research/SKILL.md +275 -0
  125. package/skills/subagent-driven-development/SKILL.md +129 -30
  126. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +30 -2
  127. package/skills/subagent-driven-development/implementer-prompt.md +40 -27
  128. package/skills/subagent-driven-development/spec-reviewer-prompt.md +25 -12
  129. package/skills/tdd/SKILL.md +125 -20
  130. package/skills/using-git-worktrees/SKILL.md +118 -28
  131. package/skills/using-skills/SKILL.md +116 -29
  132. package/skills/verification/SKILL.md +160 -17
  133. package/skills/wazir/SKILL.md +750 -120
  134. package/skills/writing-plans/SKILL.md +134 -28
  135. package/skills/writing-skills/SKILL.md +91 -13
  136. package/skills/writing-skills/anthropic-best-practices.md +104 -64
  137. package/skills/writing-skills/persuasion-principles.md +100 -34
  138. package/tooling/src/capture/command.js +46 -2
  139. package/tooling/src/capture/decision.js +40 -0
  140. package/tooling/src/capture/store.js +33 -0
  141. package/tooling/src/capture/user-input.js +66 -0
  142. package/tooling/src/checks/security-sensitivity.js +69 -0
  143. package/tooling/src/cli.js +28 -26
  144. package/tooling/src/config/depth-table.js +60 -0
  145. package/tooling/src/export/compiler.js +7 -8
  146. package/tooling/src/guards/guardrail-functions.js +131 -0
  147. package/tooling/src/guards/phase-prerequisite-guard.js +97 -3
  148. package/tooling/src/hooks/pretooluse-dispatcher.js +300 -0
  149. package/tooling/src/hooks/pretooluse-pipeline-guard.js +141 -0
  150. package/tooling/src/hooks/stop-pipeline-gate.js +92 -0
  151. package/tooling/src/init/auto-detect.js +0 -2
  152. package/tooling/src/init/command.js +3 -95
  153. package/tooling/src/learn/pipeline.js +177 -0
  154. package/tooling/src/state/db.js +251 -2
  155. package/tooling/src/state/pipeline-state.js +262 -0
  156. package/tooling/src/status/command.js +6 -1
  157. package/tooling/src/verify/proof-collector.js +299 -0
  158. package/wazir.manifest.yaml +3 -0
  159. package/workflows/learn.md +61 -8
  160. package/workflows/plan-review.md +3 -1
  161. package/workflows/verify.md +30 -1
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "hooks": [
3
3
  {
4
- "name": "protected-path-write-guard",
5
- "command": "./hooks/protected-path-write-guard"
4
+ "name": "pretooluse-dispatcher",
5
+ "command": "./hooks/pretooluse-dispatcher"
6
6
  },
7
7
  {
8
8
  "name": "loop-cap-guard",
9
9
  "command": "./hooks/loop-cap-guard"
10
10
  },
11
- {
12
- "name": "context-mode-router",
13
- "command": "./hooks/context-mode-router"
14
- },
15
11
  {
16
12
  "name": "session-start",
17
13
  "command": "./hooks/session-start"
14
+ },
15
+ {
16
+ "name": "stop-pipeline-gate",
17
+ "command": "./hooks/stop-pipeline-gate"
18
18
  }
19
19
  ]
20
20
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "host": "cursor",
3
3
  "source_hashes": {
4
- "wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
4
+ "wazir.manifest.yaml": "48a188248faf429807b241eb57fbb99afae3c6ddfdf71b24c5c532ca0bc2d33f",
5
5
  "roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
6
6
  "roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
7
7
  "roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
@@ -18,23 +18,26 @@
18
18
  "workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
19
19
  "workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
20
20
  "workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
21
- "workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
22
- "workflows/plan-review.md": "8696c472cb4605a171fd4ac8a9c51b7cf337807c4881ed163515dc56e61fd818",
21
+ "workflows/learn.md": "450bbfbfaa9143365284e13c608f800e94caea47210c57d252d1c9a720160035",
22
+ "workflows/plan-review.md": "1dfe76dfe4fd9c32409d508e47654ad3b985b5429bd4616adde719b19fd606ac",
23
23
  "workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
24
24
  "workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
25
25
  "workflows/review.md": "aaeaf7ab4515e325084a77e75e18b325295f8d16799f71f8b7cd0ec67c52c0d6",
26
26
  "workflows/run-audit.md": "e582f767967dc3fb6aaeb938ad1672e7bed18bf044055ce8c45c2114251b787a",
27
27
  "workflows/spec-challenge.md": "dc99137c28c49a6f8312924709afb6077754d128e90466dc911150ce15737897",
28
28
  "workflows/specify.md": "53b84e74871f6dbd93cae22a881cc5907e398b29501d0a1fa08c7ed69df705cb",
29
- "workflows/verify.md": "45f9c189520dfe9d24c0bc340a15e6a80c988fca1b84dc187627032a6dbaee16",
29
+ "workflows/verify.md": "4eff7b9b1c94b9a2c4a6f65cae076a3cd5a278a86430109b6033cd958e1e8ab8",
30
30
  "hooks/definitions/context_mode_router.yaml": "a10dc927418bc130b447eb33faf0f45669ecd9c7917f56947ddd74850a4e0e37",
31
31
  "hooks/definitions/loop_cap_guard.yaml": "f0fd220e028ab6fad3d8fd650602884fe500ca4899eff6e428cf217af058618d",
32
32
  "hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
33
33
  "hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml": "5b0646ab17704e6f4665bb4c08ead5bcfe2aa6e71395fa5694cb0debcbce69da",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml": "ac89617b91093ff0a39da0e8c48affbcaa71054666fa316a42c32f73f656ae69",
35
37
  "hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
36
38
  "hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
38
- "hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
40
+ "hooks/definitions/stop_pipeline_gate.yaml": "f27dde7605809aae56ac566b93b8692f5d40db1e11b569010e32d2878b677fcf",
41
+ "hooks/hooks.json": "65e022a151aa9546a6988581ee62ec853f0df5580aeed4b164e3ccc3dc2e72de"
39
42
  }
40
43
  }
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml",
33
33
  "hooks/definitions/pre_compact_summary.yaml",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml",
35
37
  "hooks/definitions/protected_path_write_guard.yaml",
36
38
  "hooks/definitions/session_start.yaml",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml",
40
+ "hooks/definitions/stop_pipeline_gate.yaml",
38
41
  "hooks/hooks.json"
39
42
  ],
40
43
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "host": "gemini",
3
3
  "source_hashes": {
4
- "wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
4
+ "wazir.manifest.yaml": "48a188248faf429807b241eb57fbb99afae3c6ddfdf71b24c5c532ca0bc2d33f",
5
5
  "roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
6
6
  "roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
7
7
  "roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
@@ -18,23 +18,26 @@
18
18
  "workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
19
19
  "workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
20
20
  "workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
21
- "workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
22
- "workflows/plan-review.md": "8696c472cb4605a171fd4ac8a9c51b7cf337807c4881ed163515dc56e61fd818",
21
+ "workflows/learn.md": "450bbfbfaa9143365284e13c608f800e94caea47210c57d252d1c9a720160035",
22
+ "workflows/plan-review.md": "1dfe76dfe4fd9c32409d508e47654ad3b985b5429bd4616adde719b19fd606ac",
23
23
  "workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
24
24
  "workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
25
25
  "workflows/review.md": "aaeaf7ab4515e325084a77e75e18b325295f8d16799f71f8b7cd0ec67c52c0d6",
26
26
  "workflows/run-audit.md": "e582f767967dc3fb6aaeb938ad1672e7bed18bf044055ce8c45c2114251b787a",
27
27
  "workflows/spec-challenge.md": "dc99137c28c49a6f8312924709afb6077754d128e90466dc911150ce15737897",
28
28
  "workflows/specify.md": "53b84e74871f6dbd93cae22a881cc5907e398b29501d0a1fa08c7ed69df705cb",
29
- "workflows/verify.md": "45f9c189520dfe9d24c0bc340a15e6a80c988fca1b84dc187627032a6dbaee16",
29
+ "workflows/verify.md": "4eff7b9b1c94b9a2c4a6f65cae076a3cd5a278a86430109b6033cd958e1e8ab8",
30
30
  "hooks/definitions/context_mode_router.yaml": "a10dc927418bc130b447eb33faf0f45669ecd9c7917f56947ddd74850a4e0e37",
31
31
  "hooks/definitions/loop_cap_guard.yaml": "f0fd220e028ab6fad3d8fd650602884fe500ca4899eff6e428cf217af058618d",
32
32
  "hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
33
33
  "hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml": "5b0646ab17704e6f4665bb4c08ead5bcfe2aa6e71395fa5694cb0debcbce69da",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml": "ac89617b91093ff0a39da0e8c48affbcaa71054666fa316a42c32f73f656ae69",
35
37
  "hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
36
38
  "hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
38
- "hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
40
+ "hooks/definitions/stop_pipeline_gate.yaml": "f27dde7605809aae56ac566b93b8692f5d40db1e11b569010e32d2878b677fcf",
41
+ "hooks/hooks.json": "65e022a151aa9546a6988581ee62ec853f0df5580aeed4b164e3ccc3dc2e72de"
39
42
  }
40
43
  }
@@ -32,9 +32,12 @@
32
32
  "hooks/definitions/post_tool_capture.yaml",
33
33
  "hooks/definitions/pre_compact_summary.yaml",
34
34
  "hooks/definitions/pre_tool_capture_route.yaml",
35
+ "hooks/definitions/pretooluse_dispatcher.yaml",
36
+ "hooks/definitions/pretooluse_pipeline_guard.yaml",
35
37
  "hooks/definitions/protected_path_write_guard.yaml",
36
38
  "hooks/definitions/session_start.yaml",
37
39
  "hooks/definitions/stop_handoff_harvest.yaml",
40
+ "hooks/definitions/stop_pipeline_gate.yaml",
38
41
  "hooks/hooks.json"
39
42
  ],
40
43
  "files": [
@@ -0,0 +1,26 @@
1
+ id: pretooluse_dispatcher
2
+ trigger: pretooluse_dispatcher
3
+ description: Consolidated PreToolUse dispatcher. Evaluates protected paths, phase restrictions, and context-mode routing in a single hook. Replaces protected_path_write_guard, pretooluse_pipeline_guard, and context_mode_router.
4
+ input_contract:
5
+ required:
6
+ - tool
7
+ optional:
8
+ - input
9
+ allowed_side_effects:
10
+ - read_pipeline_state
11
+ - read_manifest
12
+ - read_routing_matrix
13
+ - append_routing_log
14
+ output_contract:
15
+ produces:
16
+ - decision (allow|deny)
17
+ - reason
18
+ - routing_decision
19
+ failure_behavior:
20
+ mode: block
21
+ exit_code: 1
22
+ host_fallback:
23
+ claude: native_hook
24
+ codex: wrapper_command
25
+ gemini: wrapper_command
26
+ cursor: native_or_wrapper
@@ -0,0 +1,22 @@
1
+ id: pretooluse_pipeline_guard
2
+ trigger: pretooluse_pipeline_guard
3
+ description: Enforces phase-specific tool restrictions by reading pipeline-state.json. Blocks Write/Edit in read-only phases and git mutations outside execute phase.
4
+ input_contract:
5
+ required:
6
+ - tool
7
+ optional:
8
+ - input
9
+ allowed_side_effects:
10
+ - read_pipeline_state
11
+ output_contract:
12
+ produces:
13
+ - decision (allow|deny)
14
+ - reason
15
+ failure_behavior:
16
+ mode: block
17
+ exit_code: 1
18
+ host_fallback:
19
+ claude: native_hook
20
+ codex: wrapper_command
21
+ gemini: wrapper_command
22
+ cursor: native_or_wrapper
@@ -0,0 +1,22 @@
1
+ id: stop_pipeline_gate
2
+ trigger: stop_pipeline_gate
3
+ description: Blocks conversation completion when the pipeline has incomplete phases. Reads pipeline-state.json and returns block/allow decision.
4
+ input_contract:
5
+ required: []
6
+ optional:
7
+ - stop_reason
8
+ allowed_side_effects:
9
+ - read_pipeline_state
10
+ - write_stop_hook_active_flag
11
+ output_contract:
12
+ produces:
13
+ - decision (allow|block)
14
+ - reason
15
+ failure_behavior:
16
+ mode: block
17
+ exit_code: 1
18
+ host_fallback:
19
+ claude: native_hook
20
+ codex: wrapper_command
21
+ gemini: wrapper_command
22
+ cursor: native_or_wrapper
package/hooks/hooks.json CHANGED
@@ -1,21 +1,22 @@
1
1
  {
2
2
  "hooks": {
3
- "PreToolUse": [
3
+ "Stop": [
4
4
  {
5
- "matcher": "Write|Edit",
6
5
  "hooks": [
7
6
  {
8
7
  "type": "command",
9
- "command": "./hooks/protected-path-write-guard"
8
+ "command": "./hooks/stop-pipeline-gate"
10
9
  }
11
10
  ]
12
- },
11
+ }
12
+ ],
13
+ "PreToolUse": [
13
14
  {
14
- "matcher": "Bash",
15
+ "matcher": "Write|Edit|Bash",
15
16
  "hooks": [
16
17
  {
17
18
  "type": "command",
18
- "command": "./hooks/context-mode-router"
19
+ "command": "./hooks/pretooluse-dispatcher"
19
20
  }
20
21
  ]
21
22
  }
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { readFileSync, existsSync } from 'node:fs';
5
+ import { homedir } from 'node:os';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { appendFileSync, mkdirSync } from 'node:fs';
8
+
9
+ import { evaluateDispatch } from '../tooling/src/hooks/pretooluse-dispatcher.js';
10
+
11
+ const hooksDir = dirname(fileURLToPath(import.meta.url));
12
+ const projectRoot = dirname(hooksDir);
13
+
14
+ // ---------------------------------------------------------------------------
15
+ // Derive state root from manifest (same logic as context-mode-router)
16
+ // ---------------------------------------------------------------------------
17
+
18
+ function deriveStateRoot() {
19
+ if (process.env.WAZIR_STATE_ROOT) return process.env.WAZIR_STATE_ROOT;
20
+ try {
21
+ const manifestPath = join(projectRoot, 'wazir.manifest.yaml');
22
+ const raw = readFileSync(manifestPath, 'utf8');
23
+ const nameMatch = raw.match(/^\s+name:\s*(.+)$/m);
24
+ const templateMatch = raw.match(/state_root_default:\s*(.+)$/m);
25
+ if (nameMatch && templateMatch) {
26
+ const slug = nameMatch[1].trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'wazir-project';
27
+ const template = templateMatch[1].trim();
28
+ const expanded = template.startsWith('~/') ? join(homedir(), template.slice(2)) : template;
29
+ return resolve(expanded.replace('{project_slug}', slug));
30
+ }
31
+ } catch { /* fall through */ }
32
+ return join(homedir(), '.wazir', 'projects', '_default');
33
+ }
34
+
35
+ // ---------------------------------------------------------------------------
36
+ // Logging (preserves context-mode routing log)
37
+ // ---------------------------------------------------------------------------
38
+
39
+ function logDecision(stateRoot, decision) {
40
+ const logDir = join(stateRoot, 'logs');
41
+ try {
42
+ if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true });
43
+ const entry = JSON.stringify({
44
+ ts: new Date().toISOString(),
45
+ hook: 'pretooluse_dispatcher',
46
+ ...decision,
47
+ });
48
+ appendFileSync(join(logDir, 'routing.ndjson'), entry + '\n');
49
+ } catch {
50
+ // Logging is best-effort
51
+ }
52
+ }
53
+
54
+ // ---------------------------------------------------------------------------
55
+ // Main
56
+ // ---------------------------------------------------------------------------
57
+
58
+ try {
59
+ const stdin = readFileSync(0, 'utf8');
60
+ const hookInput = stdin.trim() ? JSON.parse(stdin) : {};
61
+
62
+ const stateRoot = deriveStateRoot();
63
+ const result = evaluateDispatch(stateRoot, projectRoot, hookInput);
64
+
65
+ logDecision(stateRoot, {
66
+ tool: hookInput.tool,
67
+ decision: result.decision,
68
+ reason: result.reason,
69
+ routing: result.routing_decision,
70
+ });
71
+
72
+ process.stdout.write(JSON.stringify(result) + '\n');
73
+
74
+ // Exit non-zero when context-mode routing is active (preserves old
75
+ // context-mode-router behavior where exit 1 = route to context-mode)
76
+ if (result.routing_decision?.route === 'context-mode') {
77
+ process.exit(1);
78
+ }
79
+ process.exit(0);
80
+ } catch (error) {
81
+ process.stderr.write(`[pretooluse-dispatcher] ${error.message}\n`);
82
+ process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'deny' }, systemMessage: `[pretooluse-dispatcher] Hook error: ${error.message}. Blocking to be safe.` }) + '\n');
83
+ process.exit(2); // fail-closed on errors
84
+ }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ # PreToolUse hook: enforces phase-specific tool restrictions.
3
+ # Reads pipeline-state.json for current phase, blocks disallowed tools.
4
+ set -euo pipefail
5
+
6
+ STATE_ROOT="${WAZIR_STATE_ROOT:-$HOME/.wazir/projects/wazir}"
7
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8
+
9
+ node "$SCRIPT_DIR/../tooling/src/hooks/pretooluse-pipeline-guard.js" "$STATE_ROOT"
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ # Stop hook: blocks conversation completion when pipeline is incomplete.
3
+ # Reads pipeline-state.json to determine if all phases are done.
4
+ set -euo pipefail
5
+
6
+ STATE_ROOT="${WAZIR_STATE_ROOT:-$HOME/.wazir/projects/wazir}"
7
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8
+
9
+ node "$SCRIPT_DIR/../tooling/src/hooks/stop-pipeline-gate.js" "$STATE_ROOT"