@sabaiway/agent-workflow-kit 5.5.0 → 5.6.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.
@@ -168,6 +168,19 @@ export const KIT_WRITER_PREVIEW_TOOLS = Object.freeze([
168
168
  'tools/cheap-agents.mjs',
169
169
  'tools/gate-hook.mjs',
170
170
  ]);
171
+ // The source-size checker: a WRITER tool (--write-baseline, --adopt) whose ONE read-only mode is
172
+ // seeded, and only in that exact byte-form. It joins neither list above on purpose — a wildcard
173
+ // would cover its writers, and its arg-free invocation is a usage error rather than a dry-run, so
174
+ // the writer-preview class does not describe it either.
175
+ //
176
+ // What this rule covers, stated exactly because the near-miss is easy to assume: the AGENT's own
177
+ // direct `node <abs> --check`. It is NOT the byte-string a declared gate carries — gates-init emits
178
+ // the path DOUBLE-QUOTED (a kit path with a space must survive), while a seedable allow rule may
179
+ // carry no quotes at all, so the two spellings cannot be one string. The DECLARED gate's
180
+ // promptlessness is the gate-approval hook's job, byte-exact against gates.json; this rule exists
181
+ // for the invocation an agent types itself, which no declaration covers.
182
+ export const KIT_SOURCE_SIZE_TOOL = 'tools/source-size-check.mjs';
183
+ const SOURCE_SIZE_CHECK_FLAG = '--check';
171
184
  const KIT_WILDCARD_TOOLS = Object.freeze(KIT_READONLY_TOOLS.filter((rel) => rel !== KIT_RUN_GATES_TOOL));
172
185
  // The kit root this tool runs from (tools/..) — the tier's seed-time path anchor.
173
186
  const KIT_ROOT = fileURLToPath(new URL('..', import.meta.url));
@@ -363,8 +376,9 @@ Allowlist mode (default): seeds the fixed read-only Claude Code allowlist into .
363
376
  Default is --dry-run. --apply writes; --accept-edits only sets defaultMode when applying.
364
377
  --kit-tools additionally seeds the audited kit-tool tier: ${KIT_WILDCARD_TOOLS.length} read-only kit tools by resolved
365
378
  absolute path (args wildcard), run-gates.mjs as ONE exact project-root-pinned byte-string
366
- (project-exec - it runs YOUR declared gates.json), and the writers' exact arg-free dry-run
367
- preview byte-strings. Never touches settings.local.json.
379
+ (project-exec - it runs YOUR declared gates.json), source-size-check.mjs as ONE exact --check
380
+ byte-string (its read-only mode only - its writers keep prompting), and the writers' exact arg-free
381
+ dry-run preview byte-strings. Never touches settings.local.json.
368
382
  --bridge-tier (own consent) seeds the bridge REVIEW wrappers' CODE mode for PLACED bridges
369
383
  (codex-review code, agy-review code - never the execution/probe wrappers, never plan/diff modes)
370
384
  + the quoted grounding pre-step rule, and the wrapper names into sandbox.excludedCommands (they
@@ -663,7 +677,7 @@ const formatAllowlist = (result) => [
663
677
  // The tier's honest posture, printed on every --kit-tools run: run-gates is project-exec (never
664
678
  // "read-only"), previews stay dry-run-only, and the tier gets none of the hook's residual ask-net.
665
679
  const KIT_TIER_NOTICE =
666
- 'kit-tools tier: paths are resolved absolute at seed time (fail-safe - a moved skill or stale path simply prompts again); run-gates.mjs is seeded as ONE exact byte-string pinned to this project root and is project-exec - it runs YOUR declared gates.json commands, never "read-only"; writer previews are exact dry-run byte-strings - every --apply/--write/--yes still prompts; tier entries get NO PreToolUse-hook residual coverage EXCEPT repo-search.mjs and path-inventory.mjs, whose invocations the hook scans because they take caller-supplied argument bytes (settings-level posture only for the rest - see the velocity mode notes).';
680
+ 'kit-tools tier: paths are resolved absolute at seed time (fail-safe - a moved skill or stale path simply prompts again); run-gates.mjs is seeded as ONE exact byte-string pinned to this project root and is project-exec - it runs YOUR declared gates.json commands, never "read-only"; source-size-check.mjs is seeded as ONE exact --check byte-string - its --write-baseline/--adopt writers are NOT covered and still prompt; writer previews are exact dry-run byte-strings - every --apply/--write/--yes still prompts; tier entries get NO PreToolUse-hook residual coverage EXCEPT repo-search.mjs and path-inventory.mjs, whose invocations the hook scans because they take caller-supplied argument bytes (settings-level posture only for the rest - see the velocity mode notes).';
667
681
 
668
682
  const formatKitTier = (result) =>
669
683
  result.kitTools
@@ -763,6 +777,12 @@ export const screenAllowlistEntry = (pattern) => {
763
777
  if (tokens[0] !== KIT_TOOL_INVOKER) return false;
764
778
  // Writer preview: the arg-free dry-run byte-string of a preview-class writer.
765
779
  if (tokens.length === 2) return isKitToolPathToken(tokens[1], KIT_WRITER_PREVIEW_TOOLS);
780
+ // source-size: EXACTLY `node <abs source-size-check> --check` — its read-only mode and nothing
781
+ // else, and no --cwd, because this rule covers the invocation an AGENT types directly. It is not
782
+ // the declared gate's byte-string (the fill quotes that path); see the tier constant above.
783
+ if (tokens.length === 3) {
784
+ return isKitToolPathToken(tokens[1], [KIT_SOURCE_SIZE_TOOL]) && tokens[2] === SOURCE_SIZE_CHECK_FLAG;
785
+ }
766
786
  // run-gates: EXACTLY `node <abs run-gates> --cwd <abs root>` — any other form keeps prompting.
767
787
  return (
768
788
  tokens.length === 4 &&
@@ -803,6 +823,7 @@ export const deriveKitToolsAllowlist = ({ projectDir } = {}) => {
803
823
  return Object.freeze([
804
824
  ...KIT_WILDCARD_TOOLS.map((rel) => `Bash(${KIT_TOOL_INVOKER} ${join(KIT_ROOT, rel)}:*)`),
805
825
  `Bash(${KIT_TOOL_INVOKER} ${join(KIT_ROOT, KIT_RUN_GATES_TOOL)} ${RUN_GATES_CWD_FLAG} ${projectRoot})`,
826
+ `Bash(${KIT_TOOL_INVOKER} ${join(KIT_ROOT, KIT_SOURCE_SIZE_TOOL)} ${SOURCE_SIZE_CHECK_FLAG})`,
806
827
  ...KIT_WRITER_PREVIEW_TOOLS.map((rel) => `Bash(${KIT_TOOL_INVOKER} ${join(KIT_ROOT, rel)})`),
807
828
  ]);
808
829
  };