@sabaiway/agent-workflow-kit 5.8.0 → 5.10.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 (35) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/SKILL.md +1 -1
  3. package/bridges/antigravity-cli-bridge/SKILL.md +32 -11
  4. package/bridges/antigravity-cli-bridge/bin/agy-envelope.mjs +160 -0
  5. package/bridges/antigravity-cli-bridge/bin/agy-envelope.test.mjs +235 -0
  6. package/bridges/antigravity-cli-bridge/bin/agy-review-honesty.test.mjs +23 -1
  7. package/bridges/antigravity-cli-bridge/bin/agy-review.sh +242 -38
  8. package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +482 -38
  9. package/bridges/antigravity-cli-bridge/capability.json +3 -2
  10. package/bridges/antigravity-cli-bridge/references/models-and-flags.md +45 -12
  11. package/bridges/antigravity-cli-bridge/references/review-prompt.md +6 -3
  12. package/bridges/antigravity-cli-bridge/setup/README.md +18 -5
  13. package/bridges/codex-cli-bridge/bin/codex-review.test.mjs +1 -1
  14. package/capability.json +1 -1
  15. package/package.json +1 -1
  16. package/references/hooks/state-block-guard.mjs +107 -45
  17. package/references/modes/bootstrap.md +6 -2
  18. package/references/modes/set-recipe.md +8 -5
  19. package/references/modes/state-block-guard.md +39 -31
  20. package/references/modes/upgrade.md +8 -5
  21. package/references/scripts/check-docs-size-cli.test.mjs +7 -6
  22. package/references/scripts/check-docs-size-ensure.test.mjs +332 -0
  23. package/references/scripts/check-docs-size.mjs +181 -30
  24. package/references/shared/composition-handoff.md +10 -0
  25. package/references/shared/report-footer.md +2 -2
  26. package/references/templates/agent_rules.md +1 -0
  27. package/tools/detect-backends.mjs +1 -0
  28. package/tools/doc-parity.mjs +5 -1
  29. package/tools/ensure-configs.mjs +37 -19
  30. package/tools/ensure-ops.mjs +79 -1
  31. package/tools/ensure-vocabulary.mjs +17 -3
  32. package/tools/known-footprint.mjs +10 -0
  33. package/tools/lens-region.mjs +13 -1
  34. package/tools/source-size-scope.mjs +3 -1
  35. package/tools/upgrade-runlist.mjs +1 -0
@@ -8,12 +8,12 @@
8
8
  // read-only tool's import graph. Vocabulary here, behaviour in ensure-ops.mjs.
9
9
 
10
10
  // The FIXED order the CLI runs them in — the order references/modes/upgrade.md already prescribed.
11
- export const ENSURE_OPS = Object.freeze(['orchestration', 'gates', 'autonomy', 'scripts']);
11
+ export const ENSURE_OPS = Object.freeze(['orchestration', 'gates', 'autonomy', 'scripts', 'index']);
12
12
 
13
13
  // Tokens that assert a WRITE happened. --dry-run may never emit one of these (the CLI's contract test
14
14
  // walks this set), and each has exactly one `would-` counterpart below.
15
- export const WRITE_TOKENS = Object.freeze(['seeded', 'note-refreshed']);
16
- export const DRY_RUN_TOKENS = Object.freeze(['would-seed', 'would-refresh-note']);
15
+ export const WRITE_TOKENS = Object.freeze(['seeded', 'note-refreshed', 'regenerated']);
16
+ export const DRY_RUN_TOKENS = Object.freeze(['would-seed', 'would-refresh-note', 'would-regenerate']);
17
17
 
18
18
  // The CLOSED outcome vocabulary. Closed at RUNTIME, not by convention: composing an outcome with a
19
19
  // token outside this list throws, so an op cannot quietly invent a word the mode doc has never heard
@@ -43,8 +43,21 @@ export const FAILURE_CAUSES = Object.freeze([
43
43
  'wrong-node-kind',
44
44
  'write-refused',
45
45
  'unexpected-error',
46
+ // The navigator ensure drives a SEPARATE PROCESS (the bundled generator), so its failures split by
47
+ // how far that process got: it never launched · it launched and did not succeed · the freshness
48
+ // probe itself could not answer · it claimed a regeneration the re-probe still finds stale. Only
49
+ // the first and third are provably pre-mutation; the other two DISCLOSE a possible partial write.
50
+ 'generator-unlaunchable',
51
+ 'generator-failed',
52
+ 'index-probe-failed',
53
+ 'index-stale-after-write',
46
54
  ]);
47
55
 
56
+ // The causes the mode doc must TEACH, so an agent relaying a `failed` line knows every word that can
57
+ // open one. Bound into references/modes/upgrade.md by doc-parity — the executable half of "a failed
58
+ // line names its cause": a cause the tool can print but the doc never named fails the lint.
59
+ export const RELAYED_FAILURE_CAUSES = FAILURE_CAUSES;
60
+
48
61
  // The subset references/modes/upgrade.md enumerates, so the agent relaying an upgrade knows every
49
62
  // outcome by name. doc-parity binds each of these into that doc: a reworded doc that drops one fails
50
63
  // the check instead of silently teaching an outcome set the tool no longer has. The dry-run pair is
@@ -52,6 +65,7 @@ export const FAILURE_CAUSES = Object.freeze([
52
65
  export const RELAYED_ENSURE_TOKENS = Object.freeze([
53
66
  'seeded',
54
67
  'note-refreshed',
68
+ 'regenerated',
55
69
  'already-current',
56
70
  'customized-preserved',
57
71
  'malformed-preserved',
@@ -36,6 +36,9 @@ export const stop = (message, fields = {}) =>
36
36
  // never a silent un-track. `/docs/plans/` + both `.claude/settings*.json` are listed because a pure
37
37
  // hidden deploy has no tracked `.gitignore`; the classifier drops any candidate a tracked `.gitignore`
38
38
  // already covers, so in a repo that DOES track those ignores they are never re-written.
39
+ // The enumeration must cover EVERY file the deploy copies into `scripts/` (bootstrap step 8 copies
40
+ // `references/scripts/*.mjs` + `*.test.mjs` wholesale): a name missing here is a file a hidden
41
+ // deployment leaves visible in `git status` — the exact leak this registry exists to prevent.
39
42
  export const KIT_OWN_PATHS = [
40
43
  '/AGENTS.md',
41
44
  '/CLAUDE.md',
@@ -49,11 +52,18 @@ export const KIT_OWN_PATHS = [
49
52
  '/scripts/archive-issues.mjs',
50
53
  '/scripts/archive-issues.test.mjs',
51
54
  '/scripts/archiver-structure.test.mjs',
55
+ '/scripts/check-docs-size-cli.test.mjs',
56
+ '/scripts/check-docs-size-ensure.test.mjs',
52
57
  '/scripts/check-docs-size.mjs',
53
58
  '/scripts/check-docs-size.test.mjs',
59
+ '/scripts/install-git-hooks-repo-exec.test.mjs',
54
60
  '/scripts/install-git-hooks.mjs',
61
+ '/scripts/install-git-hooks.test.mjs',
55
62
  '/scripts/markdown-blocks.mjs',
56
63
  '/scripts/markdown-blocks.test.mjs',
64
+ '/scripts/migrate-gates-branches.test.mjs',
65
+ '/scripts/migrate-gates.mjs',
66
+ '/scripts/migrate-gates.test.mjs',
57
67
  '/docs/plans/',
58
68
  '/.claude/settings.local.json',
59
69
  '/.claude/settings.json',
@@ -49,7 +49,19 @@ Apply this as part of §2 before any user-facing summary:
49
49
  - **Large artifact (≈>100 lines):** deliver a real summary or the key excerpt inline **and** link the file — never flood the reader with a 2000-line paste, never hide the answer behind a bare pointer.`;
50
50
  const COMMS_PRIOR_AD054 = `${COMMS_PRIOR_PRE_AD054}
51
51
  - **Live host/session facts are tool-composed only.** Any claim about the current host or session state (prompts fired, sandbox scope, whether a bypass was needed, network reachability, approval counts) must trace to **live tool output** from **this session**; a memory/handover snapshot is **context, never report facts**, and a claim with no live signal is **omitted or explicitly marked unverified** — never asserted from recollection.`;
52
- export const COMMS_PRIORS = [COMMS_PRIOR_PRE_AD054, COMMS_PRIOR_AD054];
52
+ // The canon that shipped between the plain-language bullet and the closing-state-block contract.
53
+ // Written out in full rather than composed from the constant above: the plain-language bullet LEADS
54
+ // the block, so an append-based composition would produce a body that never shipped and would then
55
+ // match no deployed file at all.
56
+ const COMMS_PRIOR_PLAIN_LANGUAGE = `### 2.x. Communication (user-facing messages)
57
+ Apply this as part of §2 before any user-facing summary:
58
+ - **Plain language.** User-facing narration is short, clear, plain words of the dialogue language; when the dialogue language is not English, transliterated English jargon is banned — an English term survives only as the NAME of a thing (a flag / command / file / test), glossed in plain words when helpful; plain English stays plain for English-dialogue users.
59
+ - **Deliver the artifact IN the message** — paste the prompt / diff / version / command inline; never "see §X / open the file / run it and you'll see" as a *substitute* for showing what was asked.
60
+ - **Lead with the result**, then the details; show exactly what was asked — no deflection, no "almost done" when the ask was the finished thing.
61
+ - **No condescension, no filler.** Own a miss plainly and fix it in the same message.
62
+ - **Large artifact (≈>100 lines):** deliver a real summary or the key excerpt inline **and** link the file — never flood the reader with a 2000-line paste, never hide the answer behind a bare pointer.
63
+ - **Live host/session facts are tool-composed only.** Any claim about the current host or session state (prompts fired, sandbox scope, whether a bypass was needed, network reachability, approval counts) must trace to **live tool output** from **this session**; a memory/handover snapshot is **context, never report facts**, and a claim with no live signal is **omitted or explicitly marked unverified** — never asserted from recollection.`;
64
+ export const COMMS_PRIORS = [COMMS_PRIOR_PRE_AD054, COMMS_PRIOR_AD054, COMMS_PRIOR_PLAIN_LANGUAGE];
53
65
 
54
66
  const stripCr = (line) => (line.endsWith('\r') ? line.slice(0, -1) : line);
55
67
  const isBoundary = (bareLine) => bareLine === '---' || /^#{2,3} /.test(bareLine);
@@ -31,6 +31,8 @@ const GITLINK_MODE = '160000';
31
31
  // Raw bytes in, raw bytes out: `ls-files -s -z` emits mode, object and stage, then a TAB, then the
32
32
  // path, then a NUL — and the path half is never decoded before it has been matched, so a name
33
33
  // carrying a tab or a newline survives intact (splitting on lines would mangle it).
34
+ // The object id is carried through rather than dropped: the record already holds it, and a consumer
35
+ // that must read what the index HOLDS (not what the worktree happens to show) needs exactly that.
34
36
  const parseIndexEntries = (buf) => {
35
37
  const entries = [];
36
38
  let start = 0;
@@ -41,7 +43,7 @@ const parseIndexEntries = (buf) => {
41
43
  const tab = record.indexOf(TAB);
42
44
  if (tab !== -1) {
43
45
  const head = record.subarray(0, tab).toString('utf8').split(' ');
44
- entries.push({ mode: head[0], stage: Number(head[2]), path: record.subarray(tab + 1) });
46
+ entries.push({ mode: head[0], sha: head[1], stage: Number(head[2]), path: record.subarray(tab + 1) });
45
47
  }
46
48
  start = end + 1;
47
49
  }
@@ -38,6 +38,7 @@ export const UPGRADE_RUNLIST = Object.freeze([
38
38
  [
39
39
  'seeded',
40
40
  'note-refreshed',
41
+ 'regenerated',
41
42
  'already-current',
42
43
  'customized-preserved',
43
44
  'malformed-preserved',