@sabaiway/agent-workflow-kit 2.1.0 → 3.1.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/CHANGELOG.md +94 -1
  2. package/README.md +7 -5
  3. package/SKILL.md +16 -8
  4. package/bin/install.mjs +11 -2
  5. package/bridges/antigravity-cli-bridge/SKILL.md +8 -1
  6. package/bridges/antigravity-cli-bridge/bin/agy-review-honesty.test.mjs +163 -0
  7. package/bridges/antigravity-cli-bridge/bin/agy-review-model-screen.test.mjs +76 -0
  8. package/bridges/antigravity-cli-bridge/bin/agy-review.sh +80 -15
  9. package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +171 -22
  10. package/bridges/antigravity-cli-bridge/bin/agy.test.mjs +59 -41
  11. package/bridges/antigravity-cli-bridge/capability.json +3 -2
  12. package/bridges/codex-cli-bridge/SKILL.md +8 -1
  13. package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +67 -22
  14. package/bridges/codex-cli-bridge/bin/codex-review-honesty.test.mjs +156 -0
  15. package/bridges/codex-cli-bridge/bin/codex-review.sh +71 -10
  16. package/bridges/codex-cli-bridge/bin/codex-review.test.mjs +158 -27
  17. package/bridges/codex-cli-bridge/capability.json +3 -2
  18. package/capability.json +1 -1
  19. package/migrations/3.0.0-hardened-core-loop.md +44 -0
  20. package/migrations/README.md +1 -1
  21. package/package.json +2 -2
  22. package/references/hooks/gate-approve.mjs +1 -1
  23. package/references/modes/bootstrap.md +3 -3
  24. package/references/modes/commit-guard.md +19 -0
  25. package/references/modes/core-evidence.md +15 -0
  26. package/references/modes/coverage-check.md +12 -0
  27. package/references/modes/doc-parity.md +7 -6
  28. package/references/modes/gates.md +7 -6
  29. package/references/modes/grounding.md +1 -2
  30. package/references/modes/hook.md +1 -1
  31. package/references/modes/recommendations.md +1 -0
  32. package/references/modes/review-state.md +3 -3
  33. package/references/modes/upgrade.md +6 -6
  34. package/references/modes/velocity.md +2 -2
  35. package/references/modes/worktrees.md +120 -0
  36. package/references/scripts/archive-decisions.mjs +3 -3
  37. package/references/scripts/archive-decisions.test.mjs +5 -5
  38. package/references/scripts/check-docs-size-cli.test.mjs +41 -0
  39. package/references/scripts/check-docs-size.mjs +46 -29
  40. package/references/scripts/install-git-hooks-repo-exec.test.mjs +82 -0
  41. package/references/scripts/install-git-hooks.mjs +90 -18
  42. package/references/scripts/install-git-hooks.test.mjs +102 -0
  43. package/references/scripts/migrate-gates-branches.test.mjs +157 -0
  44. package/references/scripts/migrate-gates.mjs +395 -0
  45. package/references/scripts/migrate-gates.test.mjs +284 -0
  46. package/references/templates/agent_rules.md +2 -2
  47. package/tools/ack-write.mjs +1 -1
  48. package/tools/atomic-write.mjs +2 -2
  49. package/tools/autonomy-config.mjs +1 -1
  50. package/tools/autonomy-doctor.mjs +2 -2
  51. package/tools/autonomy-write.mjs +1 -1
  52. package/tools/bridge-settings-read.mjs +1 -1
  53. package/tools/bridge-settings.mjs +1 -1
  54. package/tools/changed-surface.mjs +16 -77
  55. package/tools/cheap-agents.mjs +2 -2
  56. package/tools/commands.mjs +26 -10
  57. package/tools/commit-guard.mjs +167 -0
  58. package/tools/core-evidence.mjs +914 -0
  59. package/tools/coverage-check.mjs +260 -0
  60. package/tools/delegation.mjs +1 -1
  61. package/tools/detect-backends.mjs +3 -3
  62. package/tools/doc-parity.mjs +11 -27
  63. package/tools/engine-source.mjs +1 -1
  64. package/tools/family-members.mjs +1 -1
  65. package/tools/family-registry.mjs +1 -1
  66. package/tools/fs-safe.mjs +1 -1
  67. package/tools/gate-hook.mjs +1 -1
  68. package/tools/{seed-gates.mjs → gates-init.mjs} +58 -52
  69. package/tools/grounding.mjs +19 -96
  70. package/tools/hide-footprint.mjs +1 -1
  71. package/tools/inject-methodology.mjs +72 -41
  72. package/tools/known-footprint.mjs +1 -1
  73. package/tools/labels.mjs +1 -1
  74. package/tools/lcov.mjs +6 -10
  75. package/tools/lens-region.mjs +1 -1
  76. package/tools/manifest/validate.mjs +19 -0
  77. package/tools/migrate-adr-store.mjs +5 -5
  78. package/tools/orchestration-config.mjs +1 -1
  79. package/tools/orchestration-write.mjs +1 -1
  80. package/tools/presentation.mjs +1 -1
  81. package/tools/procedures.mjs +3 -3
  82. package/tools/recipes.mjs +62 -11
  83. package/tools/recommendations.mjs +97 -14
  84. package/tools/release-scan.mjs +10 -3
  85. package/tools/renderers.mjs +1 -1
  86. package/tools/review-state.mjs +291 -343
  87. package/tools/run-gates.mjs +216 -92
  88. package/tools/sandbox-masks.mjs +14 -14
  89. package/tools/semver-lite.mjs +1 -1
  90. package/tools/set-autonomy.mjs +1 -1
  91. package/tools/set-recipe.mjs +2 -2
  92. package/tools/setup-backends.mjs +1 -1
  93. package/tools/surface.mjs +1 -1
  94. package/tools/uninstall.mjs +1 -1
  95. package/tools/velocity-profile.mjs +9 -9
  96. package/tools/view-model.mjs +1 -1
  97. package/tools/worktrees.mjs +2292 -0
  98. package/references/modes/fold-completeness.md +0 -30
  99. package/references/modes/review-ledger.md +0 -34
  100. package/references/templates/verification-profile.json +0 -10
  101. package/tools/fold-completeness-run.mjs +0 -1120
  102. package/tools/fold-completeness.mjs +0 -672
  103. package/tools/review-ledger-core.mjs +0 -428
  104. package/tools/review-ledger-write.mjs +0 -647
  105. package/tools/review-ledger.mjs +0 -630
  106. package/tools/sarif.mjs +0 -52
  107. package/tools/verification-profile.mjs +0 -219
@@ -18,7 +18,7 @@ import { findOnPath } from './detect-backends.mjs';
18
18
 
19
19
  // Deployment-lineage head this velocity build targets; bump together with agent-workflow-memory
20
20
  // LINEAGE_HEAD when the deployed docs/ai structure changes.
21
- export const EXPECTED_WORKFLOW_VERSION = '2.0.0';
21
+ export const EXPECTED_WORKFLOW_VERSION = '3.0.0';
22
22
  export const SETTINGS_FILE = '.claude/settings.json';
23
23
  export const SETTINGS_LOCAL_FILE = '.claude/settings.local.json';
24
24
  export const CLAUDE_DIR = '.claude';
@@ -170,7 +170,7 @@ const RUN_GATES_CWD_FLAG = '--cwd';
170
170
  // final council: a blanket exclusion at opt-in contradicts «never a preemptive blanket»), guided by
171
171
  // codex-exec.sh's own nested-sandbox detection hint.
172
172
  export const BRIDGE_REVIEW_WRAPPERS = Object.freeze(['codex-review', 'agy-review']);
173
- // Only the `code` review mode is auto-allowed (codex R2, Segment A): a bare `Bash(<wrapper>:*)`
173
+ // Only the `code` review mode is auto-allowed (Segment A): a bare `Bash(<wrapper>:*)`
174
174
  // prefix would also cover the plan/diff file-argument modes, whose targets can point OUTSIDE the
175
175
  // repo — the tier's stated surface is the unattended council CODE review, so the seeded prefix is
176
176
  // `<wrapper> code`. Plan/diff invocations keep their prompt.
@@ -210,7 +210,7 @@ export const deriveBridgeTierAllowlist = ({ findWrapper, groundingAbsPath } = {}
210
210
  const allow = placed.map((cmd) => `Bash(${cmd} ${BRIDGE_REVIEW_MODE}:*)`);
211
211
  const excludedCommands = [...placed];
212
212
  // The grounding pre-step exists FOR agy (its grounded --facts reviews; codex grounds natively via
213
- // the AGENTS.md auto-merge) — a codex-only install must not auto-allow an unused writer (codex R9).
213
+ // the AGENTS.md auto-merge) — a codex-only install must not auto-allow an unused writer.
214
214
  if (placed.includes('agy-review')) {
215
215
  // groundingAbsPath is a TEST seam only (an unseedable kit path — spaces — is not constructible
216
216
  // from a test against the real checkout); production callers never pass it.
@@ -420,7 +420,7 @@ const validateSettingsShape = (data, relPath) => {
420
420
  }
421
421
  // The bridge tier merges into sandbox.excludedCommands — a malformed (non-array) value is a STOP
422
422
  // with ZERO writes (the same fail-closed posture as permissions.allow above), never a silent
423
- // treat-as-empty overwrite (codex R1, Segment A).
423
+ // treat-as-empty overwrite (Segment A).
424
424
  if (isJsonObject(data.sandbox) && data.sandbox.excludedCommands !== undefined && !Array.isArray(data.sandbox.excludedCommands)) {
425
425
  throw makeVelocityProfileError(VELOCITY_MALFORMED, `${relPath}: sandbox.excludedCommands must be an array`);
426
426
  }
@@ -490,7 +490,7 @@ const isScriptMap = (scripts) => Boolean(scripts) && typeof scripts === 'object'
490
490
  const isMutatingScriptName = (name) =>
491
491
  MUTATING_SCRIPT_NAME_PATTERN.test(name) || MUTATING_SCRIPT_HOOK_PATTERN.test(name);
492
492
 
493
- // `scriptName` is ADDITIVE (AD-042): the seed-gates offer layer maps a candidate to a
493
+ // `scriptName` is ADDITIVE (AD-042): the gates-init offer layer maps a candidate to a
494
494
  // package-manager-aware `{ id, title, cmd }` and needs the raw script name for that derivation;
495
495
  // `command` stays the advisory's own npm-run spelling (this fn is otherwise unchanged).
496
496
  const makeGateCandidate = (name) => ({
@@ -647,8 +647,8 @@ const formatKitTier = (result) =>
647
647
  ]
648
648
  : [];
649
649
 
650
- // The bridge tier's honest posture, printed on EVERY --bridge-tier run (test-pinned — the codex-R2
651
- // informed-consent resolution): the exfiltration surface is stated, never pretended away.
650
+ // The bridge tier's honest posture, printed on EVERY --bridge-tier run: the informed-consent
651
+ // resolution states the exfiltration surface, never pretends it away.
652
652
  export const KIT_BRIDGE_TIER_NOTICE =
653
653
  'bridge-wrappers tier: seeds the REVIEW wrappers only, and only their CODE mode (`codex-review code`, `agy-review code` — never codex-exec/agy-run: delegated execution keeps its human prompt; never the plan/diff modes: their file arguments can point outside the repo, so they keep their prompt), each derived ONLY when its bridge is PLACED on PATH, plus the grounding pre-step rule in its rendered quoted byte-form. POSTURE (what this consent covers): an auto-allowed review wrapper runs UNATTENDED — it reads any repo file it is pointed at and sends the assembled payload to its subscription backend, and prefix rules cannot inspect arguments, so a code-mode argument that names a readable file (agy\'s --facts/--decided) rides the same consent — the same documented residual class as the autonomy red-line rules; that is the tier\'s PURPOSE (unattended council review runs) and its residual — tier entries get NO PreToolUse-hook coverage. The grounding entry\'s writer surface is bounded by grounding.mjs\'s OWN scratch-destination guard (a tracked or in-repo-not-ignored --out is refused by the tool). The wrapper names are ALSO seeded into sandbox.excludedCommands IN THE PROJECT settings.json (an exclusion only in settings.local.json was live-observed NOT to route — the wrapper then runs sandboxed and dies on a read-only HOME): the harness runs an excluded command OUTSIDE the sandbox (the wrappers need network), so a plain allowlisted invocation triggers no sandbox-bypass approval. INVOCATION SHAPE: a prefix rule matches only a PLAIN invocation starting with the wrapper name — an env-var prefix or a compound chain never matches (redirects are fine).';
654
654
 
@@ -722,7 +722,7 @@ export const screenAllowlistEntry = (pattern) => {
722
722
  }
723
723
  // Bridge-review-wrapper class (AD-044 Plan 4): EXACTLY `<frozen-tier wrapper> code` + the args
724
724
  // wildcard — never codex-exec/agy-run, never the bare or plan/diff spellings (those file-argument
725
- // modes can read outside the repo; codex R2).
725
+ // modes can read outside the repo).
726
726
  if (BRIDGE_REVIEW_WRAPPERS.includes(tokens[0])) return tokens.length === 2 && tokens[1] === BRIDGE_REVIEW_MODE;
727
727
  return isSingleShellToken(wildcardCmd, tokens) && SHELL_READONLY.includes(wildcardCmd);
728
728
  }
@@ -1196,7 +1196,7 @@ const collectRedlineBypass = (sources) =>
1196
1196
  // sub-keys (merge-don't-clobber, never a silent clobber of the user's sandbox tuning), so a pre-existing
1197
1197
  // weakening sub-key is REPORTED loudly (remove it by hand) — never silently carried as security.
1198
1198
  const collectSandboxWeakenings = (sources) => {
1199
- // Tier-known PROOF (codex R4): an excludedCommands entry is downgraded to a note ONLY when it is
1199
+ // Tier-known PROOF: an excludedCommands entry is downgraded to a note ONLY when it is
1200
1200
  // demonstrably the consented tier's own output — it lives in the PROJECT settings.json (the file
1201
1201
  // the tier writes; a local-file exclusion is never tier output) AND the matching derived
1202
1202
  // code-mode allow rule is present there. A bare name match alone proves nothing.
@@ -6,7 +6,7 @@
6
6
  // filenames never reach them). This module resolves public tokens → English phrases (presentation.mjs)
7
7
  // and computes the headline counts; the renderers do layout + glyphs only.
8
8
  //
9
- // Pure, no side effects, Node >= 18.
9
+ // Pure, no side effects, Node >= 22.
10
10
 
11
11
  import { STATE_PHRASING, VISIBILITY_PHRASING } from './presentation.mjs';
12
12