@sabaiway/agent-workflow-kit 23.12.0 → 24.0.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 (150) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +4 -4
  3. package/SKILL.md +1 -1
  4. package/bridges/codex-cli-bridge/SKILL.md +7 -2
  5. package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +11 -6
  6. package/bridges/codex-cli-bridge/bin/codex-exec.sh +72 -33
  7. package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +111 -3
  8. package/bridges/codex-cli-bridge/bin/codex-fixtures-harness.test.mjs +16 -1
  9. package/bridges/codex-cli-bridge/bin/codex-model-posture.test.mjs +5 -3
  10. package/bridges/codex-cli-bridge/bin/codex-review.sh +1 -1
  11. package/bridges/codex-cli-bridge/capability.json +2 -2
  12. package/capability.json +1 -1
  13. package/package.json +1 -1
  14. package/references/advisor-writers.md +2 -0
  15. package/references/agents/author.md +21 -0
  16. package/references/agents/executor.md +12 -6
  17. package/references/contracts.md +4 -4
  18. package/references/hooks/gate-approve.mjs +7 -8
  19. package/references/hooks/stage-write-guard.mjs +314 -0
  20. package/references/modes/agents.md +6 -4
  21. package/references/modes/bootstrap.md +1 -1
  22. package/references/modes/flow-writer.md +10 -2
  23. package/references/modes/hook.md +4 -1
  24. package/references/modes/now.md +1 -1
  25. package/references/modes/procedures.md +49 -10
  26. package/references/modes/recipes.md +7 -7
  27. package/references/modes/recommendations.md +4 -3
  28. package/references/modes/robustness-brief.md +9 -8
  29. package/references/modes/set-recipe.md +1 -1
  30. package/references/modes/state-block-guard.md +4 -3
  31. package/references/modes/status.md +1 -1
  32. package/references/modes/upgrade.md +1 -1
  33. package/references/modes/worktrees.md +28 -5
  34. package/references/rules/story-sessions.md +2 -2
  35. package/references/scripts/archives/archive-caps.mjs +1 -1
  36. package/references/scripts/archives/archive-changelog.mjs +8 -8
  37. package/references/scripts/archives/archive-decisions.mjs +7 -7
  38. package/references/scripts/archives/archive-issues.mjs +5 -5
  39. package/references/scripts/archives/rotation-conservation.mjs +2 -1
  40. package/references/scripts/docs-size/check-docs-size.mjs +15 -15
  41. package/references/scripts/family.json +2 -0
  42. package/references/scripts/gates/kit-command-gates.mjs +7 -8
  43. package/references/scripts/gates/migrate-gates.mjs +10 -10
  44. package/references/scripts/git-hooks/install-git-hooks.mjs +13 -13
  45. package/references/scripts/run.mjs +1 -2
  46. package/references/scripts/shared/index.mjs +2 -0
  47. package/references/scripts/shared/locations.mjs +103 -0
  48. package/references/scripts/spec-schema/spec-schema.mjs +2 -1
  49. package/references/templates/orchestration.json +1 -1
  50. package/tools/ack-store.mjs +2 -1
  51. package/tools/apply-danger-check.mjs +20 -6
  52. package/tools/atomic-write.mjs +3 -2
  53. package/tools/attribution.mjs +2 -1
  54. package/tools/autonomy-config.mjs +2 -1
  55. package/tools/bridge-wiring.mjs +13 -11
  56. package/tools/carriers.mjs +54 -14
  57. package/tools/cheap-agents-read.mjs +28 -7
  58. package/tools/cheap-agents.mjs +15 -10
  59. package/tools/checker-gates-read.mjs +6 -5
  60. package/tools/commands.mjs +2 -2
  61. package/tools/coverage-declared/config.mjs +2 -1
  62. package/tools/coverage-producer.mjs +10 -9
  63. package/tools/delegation.mjs +7 -6
  64. package/tools/detect-backends.mjs +1 -1
  65. package/tools/dispatch-baseline.mjs +2 -1
  66. package/tools/distribution-files/scripts.mjs +4 -4
  67. package/tools/ensure-configs.mjs +2 -2
  68. package/tools/ensure-ops.mjs +24 -24
  69. package/tools/ensure-specs.mjs +7 -7
  70. package/tools/epic-shape-cli.mjs +2 -2
  71. package/tools/epic-shape-ledger.mjs +5 -5
  72. package/tools/epic-shape.mjs +5 -3
  73. package/tools/epic-store.mjs +2 -1
  74. package/tools/family-members.mjs +7 -5
  75. package/tools/family-registry.mjs +36 -30
  76. package/tools/feedback-record-cli.mjs +4 -5
  77. package/tools/flow-writer.mjs +26 -15
  78. package/tools/gate-hook.mjs +33 -28
  79. package/tools/gates-declaration.mjs +2 -1
  80. package/tools/gates-init.mjs +6 -5
  81. package/tools/git-hooks.mjs +64 -41
  82. package/tools/grounding.mjs +3 -2
  83. package/tools/hide-footprint.mjs +2 -1
  84. package/tools/hook-writer/index.mjs +147 -0
  85. package/tools/init-preflight.mjs +5 -4
  86. package/tools/init-project.mjs +12 -11
  87. package/tools/inject-methodology.mjs +3 -2
  88. package/tools/jev-guide.mjs +2 -2
  89. package/tools/known-footprint.mjs +27 -25
  90. package/tools/mcp-registration.mjs +6 -5
  91. package/tools/migration-blocks.mjs +2 -1
  92. package/tools/migration-notes.mjs +2 -2
  93. package/tools/node-evidence.mjs +4 -4
  94. package/tools/now-facts.mjs +5 -5
  95. package/tools/now-status.mjs +1 -5
  96. package/tools/orchestration-config.mjs +2 -1
  97. package/tools/orchestration-readme.mjs +7 -2
  98. package/tools/plan-approval/cli.mjs +45 -0
  99. package/tools/plan-approval/entries.mjs +109 -0
  100. package/tools/plan-approval/index.mjs +2 -0
  101. package/tools/plan-approval/record.mjs +198 -0
  102. package/tools/plan-files.mjs +6 -4
  103. package/tools/plan-shape-cli.mjs +10 -64
  104. package/tools/plan-shape-facts.mjs +240 -83
  105. package/tools/plan-shape.mjs +173 -160
  106. package/tools/plan-structure/cli.mjs +79 -0
  107. package/tools/plan-structure/index.mjs +67 -0
  108. package/tools/procedures.mjs +21 -17
  109. package/tools/profile-gaps.mjs +4 -6
  110. package/tools/project-rules/rules-priors.mjs +2 -0
  111. package/tools/project-rules/themes.mjs +6 -4
  112. package/tools/recipes.mjs +44 -29
  113. package/tools/recommendations.mjs +84 -33
  114. package/tools/reference-profile.mjs +2 -2
  115. package/tools/renderers.mjs +14 -8
  116. package/tools/repo-lex.mjs +84 -0
  117. package/tools/robustness-brief.mjs +14 -11
  118. package/tools/satellite-locator.mjs +3 -2
  119. package/tools/script-priors.mjs +3 -2
  120. package/tools/session-close-check.mjs +71 -15
  121. package/tools/set-flow.mjs +2 -2
  122. package/tools/set-recipe.mjs +17 -9
  123. package/tools/source-size/help.mjs +4 -4
  124. package/tools/source-size/layout.mjs +2 -1
  125. package/tools/source-size/piles.mjs +2 -2
  126. package/tools/source-size-config.mjs +3 -3
  127. package/tools/source-size-refusal.mjs +4 -3
  128. package/tools/source-size-report.mjs +41 -13
  129. package/tools/spec-check-cli.mjs +159 -21
  130. package/tools/spec-check-ops.mjs +74 -5
  131. package/tools/spec-check.mjs +54 -45
  132. package/tools/spec-coverage-cli.mjs +3 -2
  133. package/tools/stage-render/cli.mjs +231 -0
  134. package/tools/stage-render/index.mjs +340 -0
  135. package/tools/stage-render/stages.json +115 -0
  136. package/tools/stage-write-guard/cli.mjs +64 -0
  137. package/tools/stage-write-guard/index.mjs +56 -0
  138. package/tools/state-block-hook.mjs +38 -163
  139. package/tools/task-brief.mjs +8 -13
  140. package/tools/task-thread.mjs +3 -1
  141. package/tools/tier-guide-facts.mjs +23 -9
  142. package/tools/tier-preview.mjs +15 -19
  143. package/tools/transition/index.mjs +10 -9
  144. package/tools/uninstall.mjs +26 -12
  145. package/tools/vehicle-settings.mjs +2 -1
  146. package/tools/velocity-profile.mjs +5 -6
  147. package/tools/view-model.mjs +7 -4
  148. package/tools/worktree-prompt.mjs +7 -3
  149. package/tools/worktrees.mjs +235 -159
  150. package/tools/write-lanes.mjs +20 -14
@@ -1,4 +1,5 @@
1
- import { join, resolve } from 'node:path';
1
+ import { join, posix, resolve } from 'node:path';
2
+ import { AGENTS_DIR, GATE_HOOK, GIT_CONFIG, GIT_HOOKS, HOOKS_DIR, MCP_FILE, PRE_COMMIT, SETTINGS, SETTINGS_LOCAL, SKILLS_DIR, STAGE_GUARD_HOOK, STOP_HOOK } from '../references/scripts/shared/index.mjs';
2
3
  import { dirCovers } from './declared-paths.mjs';
3
4
  import { claudeDirOf, quoteArg, skillTargets } from './jev-facts.mjs';
4
5
  import { targetsFor } from './jev-connect.mjs';
@@ -43,6 +44,8 @@ export const VARIANT_LANES = Object.freeze({
43
44
  'read-lane': LANE_CHAT,
44
45
  'state-block': LANE_HARNESS,
45
46
  'state-block.not-current': LANE_KIT,
47
+ 'stage-guard': LANE_HARNESS,
48
+ 'stage-guard.not-current': LANE_KIT,
46
49
  'mcp-channel': LANE_HARNESS,
47
50
  'mcp-channel.differing': LANE_HARNESS,
48
51
  agents: LANE_HARNESS,
@@ -70,14 +73,14 @@ export const laneOf = (variant) => {
70
73
  return VARIANT_LANES[variant];
71
74
  };
72
75
 
73
- const SETTINGS_PATH = join('.claude', 'settings.json');
76
+ const SETTINGS_PATH = join(SETTINGS);
74
77
  const PROTECTED_FILES = [
75
78
  SETTINGS_PATH,
76
- join('.claude', 'settings.local.json'),
77
- '.mcp.json',
78
- join('.git', 'config'),
79
+ join(SETTINGS_LOCAL),
80
+ MCP_FILE,
81
+ join(GIT_CONFIG),
79
82
  ];
80
- const PROTECTED_DIRS = ['agents', 'hooks', 'skills'].map((name) => join('.claude', name));
83
+ const PROTECTED_DIRS = [AGENTS_DIR, HOOKS_DIR, SKILLS_DIR].map((dir) => join(dir));
81
84
 
82
85
  export const isProtectedPath = (abs, { root, home, hooksDir }) => {
83
86
  const project = resolve(root);
@@ -92,11 +95,12 @@ export const isProtectedPath = (abs, { root, home, hooksDir }) => {
92
95
  };
93
96
 
94
97
  const SETTINGS_WRITES = [SETTINGS_PATH];
95
- const LOCAL_SETTINGS_WRITES = [join('.claude', 'settings.local.json')];
96
- const GATE_HOOK_FILE = [join('.claude', 'hooks', 'agent-workflow-gates.mjs')];
97
- const STOP_HOOK_FILE = [join('.claude', 'hooks', 'state-block-guard.mjs')];
98
- const MCP_WRITES = ['.mcp.json', ...SETTINGS_WRITES];
99
- const AGENT_WRITES = [join('.claude', 'agents')];
98
+ const LOCAL_SETTINGS_WRITES = [join(SETTINGS_LOCAL)];
99
+ const GATE_HOOK_FILE = [join(GATE_HOOK)];
100
+ const STOP_HOOK_FILE = [join(STOP_HOOK)];
101
+ const STAGE_GUARD_FILE = [join(STAGE_GUARD_HOOK)];
102
+ const MCP_WRITES = [MCP_FILE, ...SETTINGS_WRITES];
103
+ const AGENT_WRITES = [join(AGENTS_DIR)];
100
104
 
101
105
  const getSkillPaths = ({ env, home, platform }) => {
102
106
  const claudeDir = claudeDirOf(env, home, platform).dir;
@@ -111,7 +115,7 @@ const getStartupPaths = ({ env, home, platform }) => targetsFor({
111
115
  platform,
112
116
  }).filter(({ path }) => path !== null).map(({ path }) => path);
113
117
 
114
- const preCommitOf = (facts) => join(facts.hooksDir ?? join(facts.root, '.git', 'hooks'), 'pre-commit');
118
+ const preCommitOf = (facts) => join(facts.hooksDir ?? join(facts.root, GIT_HOOKS), posix.basename(PRE_COMMIT));
115
119
  const getEnforcementPaths = (facts) => [...readDeployedScripts().map(({ deployed }) => join(facts.root, deployed)), preCommitOf(facts)];
116
120
  const getGuardPaths = (facts) => [preCommitOf(facts), join(facts.root, INSTALLER_REL)];
117
121
 
@@ -156,6 +160,8 @@ const FORMS = Object.freeze({
156
160
  'gate-hook.not-current': hookForm('gate-hook.mjs', GATE_HOOK_FILE),
157
161
  'state-block': hookForm('state-block-hook.mjs', [...STOP_HOOK_FILE, ...SETTINGS_WRITES]),
158
162
  'state-block.not-current': hookForm('state-block-hook.mjs', STOP_HOOK_FILE),
163
+ 'stage-guard': hookForm('stage-write-guard/cli.mjs', [...STAGE_GUARD_FILE, ...SETTINGS_WRITES]),
164
+ 'stage-guard.not-current': hookForm('stage-write-guard/cli.mjs', STAGE_GUARD_FILE),
159
165
  'mcp-channel': createForm('mcp.mjs', ['--cwd', '<root>'], ['--apply', '--cwd', '<root>'], MCP_WRITES),
160
166
  'mcp-channel.differing': createForm('mcp.mjs',
161
167
  ['--replace', '--cwd', '<root>'], ['--replace', '--apply', '--cwd', '<root>'], MCP_WRITES),
@@ -183,9 +189,9 @@ const FORMS = Object.freeze({
183
189
  enforcement: createForm('git-hooks.mjs',
184
190
  ['--enforcement', '--cwd', '<root>'], ['--apply', '--enforcement', '--cwd', '<root>'], getEnforcementPaths),
185
191
  'commit-guard': createForm('git-hooks.mjs',
186
- ['--commit-guard', '--cwd', '<root>'], ['--apply', '--commit-guard', '--cwd', '<root>'], getGuardPaths),
192
+ ['--commit-guard', '--cwd', '<root>'], ['--apply', '--commit-guard', '--cwd', '<root>'], getGuardPaths, false, null, true),
187
193
  'hook-checks': createForm('git-hooks.mjs',
188
- ['--hook-checks', '--cwd', '<root>'], ['--apply', '--hook-checks', '--cwd', '<root>'], getGuardPaths),
194
+ ['--hook-checks', '--cwd', '<root>'], ['--apply', '--hook-checks', '--cwd', '<root>'], getGuardPaths, false, null, true),
189
195
  'worktrees-dir': createForm('velocity-profile.mjs',
190
196
  ['--worktrees', '--cwd', '<root>'], ['--apply', '--worktrees', '--cwd', '<root>'], LOCAL_SETTINGS_WRITES, false, null, true),
191
197
  'worktrees-dir.home': Object.freeze({