@sabaiway/agent-workflow-kit 23.11.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.
- package/CHANGELOG.md +87 -0
- package/README.md +4 -4
- package/SKILL.md +1 -1
- package/bridges/codex-cli-bridge/SKILL.md +7 -2
- package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +11 -6
- package/bridges/codex-cli-bridge/bin/codex-exec.sh +72 -33
- package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +111 -3
- package/bridges/codex-cli-bridge/bin/codex-fixtures-harness.test.mjs +16 -1
- package/bridges/codex-cli-bridge/bin/codex-model-posture.test.mjs +5 -3
- package/bridges/codex-cli-bridge/bin/codex-review.sh +1 -1
- package/bridges/codex-cli-bridge/capability.json +2 -2
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/advisor-writers.md +2 -0
- package/references/agents/author.md +21 -0
- package/references/agents/executor.md +12 -6
- package/references/contracts.md +4 -4
- package/references/hooks/gate-approve.mjs +7 -8
- package/references/hooks/stage-write-guard.mjs +314 -0
- package/references/modes/agents.md +6 -4
- package/references/modes/bootstrap.md +1 -1
- package/references/modes/control-bytes.md +38 -32
- package/references/modes/flow-writer.md +10 -2
- package/references/modes/hook.md +4 -1
- package/references/modes/now.md +1 -1
- package/references/modes/procedures.md +49 -10
- package/references/modes/recipes.md +7 -7
- package/references/modes/recommendations.md +5 -4
- package/references/modes/robustness-brief.md +9 -8
- package/references/modes/set-recipe.md +1 -1
- package/references/modes/state-block-guard.md +4 -3
- package/references/modes/status.md +1 -1
- package/references/modes/upgrade.md +1 -1
- package/references/modes/worktrees.md +28 -5
- package/references/rules/story-sessions.md +2 -2
- package/references/scripts/archives/archive-caps.mjs +1 -1
- package/references/scripts/archives/archive-changelog.mjs +8 -8
- package/references/scripts/archives/archive-decisions.mjs +7 -7
- package/references/scripts/archives/archive-issues.mjs +5 -5
- package/references/scripts/archives/rotation-conservation.mjs +2 -1
- package/references/scripts/docs-size/check-docs-size.mjs +15 -15
- package/references/scripts/family.json +2 -0
- package/references/scripts/gates/kit-command-gates.mjs +7 -8
- package/references/scripts/gates/migrate-gates.mjs +10 -10
- package/references/scripts/git-hooks/install-git-hooks.mjs +13 -13
- package/references/scripts/run.mjs +1 -2
- package/references/scripts/shared/index.mjs +2 -0
- package/references/scripts/shared/locations.mjs +103 -0
- package/references/scripts/spec-schema/spec-schema.mjs +2 -1
- package/references/templates/orchestration.json +1 -1
- package/tools/ack-store.mjs +2 -1
- package/tools/advisor-matrix.mjs +2 -1
- package/tools/advisor-skip/index.mjs +73 -0
- package/tools/apply-danger-check.mjs +20 -6
- package/tools/atomic-write.mjs +3 -2
- package/tools/attribution.mjs +2 -1
- package/tools/autonomy-config.mjs +2 -1
- package/tools/bridge-wiring.mjs +13 -11
- package/tools/carriers.mjs +54 -14
- package/tools/cheap-agents-read.mjs +28 -7
- package/tools/cheap-agents.mjs +15 -10
- package/tools/checker-gates-read.mjs +6 -5
- package/tools/commands.mjs +2 -2
- package/tools/control-bytes.mjs +43 -20
- package/tools/coverage-declared/config.mjs +2 -1
- package/tools/coverage-producer.mjs +10 -9
- package/tools/delegation.mjs +7 -6
- package/tools/detect-backends.mjs +1 -1
- package/tools/dispatch-baseline.mjs +2 -1
- package/tools/distribution-files/scripts.mjs +4 -4
- package/tools/doc-parity/index.mjs +46 -0
- package/tools/doc-parity.mjs +27 -47
- package/tools/ensure-configs.mjs +2 -2
- package/tools/ensure-ops.mjs +24 -24
- package/tools/ensure-specs.mjs +7 -7
- package/tools/epic-shape-cli.mjs +2 -2
- package/tools/epic-shape-ledger.mjs +5 -5
- package/tools/epic-shape.mjs +5 -3
- package/tools/epic-store.mjs +2 -1
- package/tools/family-members.mjs +7 -5
- package/tools/family-registry.mjs +36 -30
- package/tools/feedback-record-cli.mjs +4 -5
- package/tools/flow-writer.mjs +26 -15
- package/tools/gate-hook.mjs +33 -28
- package/tools/gates-declaration.mjs +2 -1
- package/tools/gates-init.mjs +6 -5
- package/tools/git-hooks.mjs +64 -41
- package/tools/grounding.mjs +3 -2
- package/tools/hide-footprint.mjs +2 -1
- package/tools/hook-writer/index.mjs +147 -0
- package/tools/init-preflight.mjs +5 -4
- package/tools/init-project.mjs +12 -11
- package/tools/inject-methodology.mjs +3 -2
- package/tools/jev-guide.mjs +2 -2
- package/tools/known-footprint.mjs +27 -25
- package/tools/mcp-registration.mjs +6 -5
- package/tools/migration-blocks.mjs +2 -1
- package/tools/migration-notes.mjs +2 -2
- package/tools/node-evidence.mjs +4 -4
- package/tools/now-facts.mjs +5 -5
- package/tools/now-status.mjs +1 -5
- package/tools/orchestration-config.mjs +2 -1
- package/tools/orchestration-readme.mjs +7 -2
- package/tools/plan-approval/cli.mjs +45 -0
- package/tools/plan-approval/entries.mjs +109 -0
- package/tools/plan-approval/index.mjs +2 -0
- package/tools/plan-approval/record.mjs +198 -0
- package/tools/plan-files.mjs +6 -4
- package/tools/plan-shape-cli.mjs +10 -64
- package/tools/plan-shape-facts.mjs +240 -83
- package/tools/plan-shape.mjs +173 -160
- package/tools/plan-structure/cli.mjs +79 -0
- package/tools/plan-structure/index.mjs +67 -0
- package/tools/procedures.mjs +21 -17
- package/tools/profile-gaps.mjs +4 -6
- package/tools/project-rules/rules-priors.mjs +2 -0
- package/tools/project-rules/themes.mjs +6 -4
- package/tools/recipes.mjs +44 -29
- package/tools/recommendations.mjs +90 -39
- package/tools/reference-profile.mjs +2 -2
- package/tools/release-scan/index.mjs +30 -0
- package/tools/release-scan.mjs +46 -25
- package/tools/renderers.mjs +14 -8
- package/tools/repo-lex.mjs +84 -0
- package/tools/robustness-brief.mjs +14 -11
- package/tools/sandbox-masks.mjs +6 -4
- package/tools/satellite-locator.mjs +3 -2
- package/tools/script-priors.mjs +3 -2
- package/tools/session-close-check.mjs +71 -15
- package/tools/set-flow.mjs +2 -2
- package/tools/set-recipe.mjs +17 -9
- package/tools/source-size/help.mjs +4 -4
- package/tools/source-size/layout.mjs +2 -1
- package/tools/source-size/piles.mjs +2 -2
- package/tools/source-size-config.mjs +3 -3
- package/tools/source-size-refusal.mjs +4 -3
- package/tools/source-size-report.mjs +41 -13
- package/tools/spec-check-cli.mjs +159 -21
- package/tools/spec-check-ops.mjs +74 -5
- package/tools/spec-check.mjs +54 -45
- package/tools/spec-coverage-cli.mjs +3 -2
- package/tools/stage-render/cli.mjs +231 -0
- package/tools/stage-render/index.mjs +340 -0
- package/tools/stage-render/stages.json +115 -0
- package/tools/stage-write-guard/cli.mjs +64 -0
- package/tools/stage-write-guard/index.mjs +56 -0
- package/tools/state-block-hook.mjs +38 -163
- package/tools/task-brief.mjs +8 -13
- package/tools/task-thread.mjs +3 -1
- package/tools/tier-guide-facts.mjs +23 -9
- package/tools/tier-preview.mjs +15 -19
- package/tools/transition/index.mjs +10 -9
- package/tools/uninstall.mjs +26 -12
- package/tools/vehicle-settings.mjs +2 -1
- package/tools/velocity-profile.mjs +5 -6
- package/tools/view-model.mjs +7 -4
- package/tools/worktree-prompt.mjs +7 -3
- package/tools/worktrees.mjs +235 -159
- package/tools/write-lanes.mjs +20 -14
package/tools/uninstall.mjs
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import { existsSync, statSync, lstatSync, readlinkSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
|
|
26
26
|
import { join, resolve, dirname, basename, isAbsolute } from 'node:path';
|
|
27
27
|
import os from 'node:os';
|
|
28
|
+
import { AGENTS_FILE, CLAUDE_FILE, DOCS_TREE, GIT_EXCLUDE, PLANS, PRE_COMMIT, SETTINGS, SETTINGS_LOCAL, STAGE_GUARD_HOOK } from '../references/scripts/shared/index.mjs';
|
|
28
29
|
import { isDirectRun } from './direct-run.mjs';
|
|
29
30
|
import { surveyFamily, surveyProject, FAMILY_MEMBERS, classifyMember, OK } from './family-registry.mjs';
|
|
30
31
|
import { assertContainedRealPath, removeTreeManaged, unlinkManaged, MANAGED_LINK_CONFLICT } from './fs-safe.mjs';
|
|
@@ -63,7 +64,7 @@ const DEFAULT_BINDIR_REL = '.local/bin';
|
|
|
63
64
|
// the name (never remove an unmarked / user-authored hook).
|
|
64
65
|
const HOOK_MARKER_SUFFIX = ':install-git-hooks.mjs';
|
|
65
66
|
// User-authored / kit-deployed-but-now-owned-by-the-user surfaces — REPORTED, never deleted.
|
|
66
|
-
const REPORT_PATHS = [
|
|
67
|
+
const REPORT_PATHS = [DOCS_TREE, AGENTS_FILE, CLAUDE_FILE, PLANS];
|
|
67
68
|
|
|
68
69
|
// ── injectable fs ────────────────────────────────────────────────────────────────
|
|
69
70
|
const fsOf = (deps = {}) => ({
|
|
@@ -182,7 +183,7 @@ export const buildPlan = ({ family, project = null, projectDir = null, member =
|
|
|
182
183
|
|
|
183
184
|
if (project.hiddenFence) {
|
|
184
185
|
// Display the git-path-resolved exclude file (worktree/submodule-safe), guarded → conventional path.
|
|
185
|
-
const fencePath = (() => { try { return excludePath(deps, dir); } catch { return join(dir,
|
|
186
|
+
const fencePath = (() => { try { return excludePath(deps, dir); } catch { return join(dir, GIT_EXCLUDE); } })();
|
|
186
187
|
items.push({ surface: 'fence', path: fencePath, class: MANAGED_MARKER, reason: 'hidden-mode managed block (removed via the existing unhide path; only the fenced lines)' });
|
|
187
188
|
}
|
|
188
189
|
|
|
@@ -200,7 +201,7 @@ export const buildPlan = ({ family, project = null, projectDir = null, member =
|
|
|
200
201
|
return false;
|
|
201
202
|
}
|
|
202
203
|
};
|
|
203
|
-
const hookPath = join(dir,
|
|
204
|
+
const hookPath = join(dir, PRE_COMMIT);
|
|
204
205
|
// `reachable` answers for the PARENT CHAIN only (by design — walking the leaf dropped surfaces
|
|
205
206
|
// from the plan). The leaf therefore needs its own no-follow classification before any read: a
|
|
206
207
|
// symlinked hook would expose an out-of-tree file, and a FIFO would block planning outright.
|
|
@@ -258,7 +259,7 @@ export const buildPlan = ({ family, project = null, projectDir = null, member =
|
|
|
258
259
|
}
|
|
259
260
|
// A settings file the tool will not read is REPORTED rather than dropped: the seams it may hold
|
|
260
261
|
// are exactly what a teardown owes the maintainer, and silence about them is the worse answer.
|
|
261
|
-
const settingsPath = join(dir,
|
|
262
|
+
const settingsPath = join(dir, SETTINGS);
|
|
262
263
|
const settingsStat = claudeDirForeign || !reachable(settingsPath) ? null : lstatNoFollow(settingsPath, fs.lstat);
|
|
263
264
|
const settingsUnread = !claudeDirForeign && reachable(settingsPath) && settingsStat !== null
|
|
264
265
|
&& (settingsStat.isSymbolicLink() || !settingsStat.isFile());
|
|
@@ -271,7 +272,7 @@ export const buildPlan = ({ family, project = null, projectDir = null, member =
|
|
|
271
272
|
}
|
|
272
273
|
const settings = claudeDirForeign || !reachable(settingsPath) || settingsUnread ? null : readRaw(settingsPath);
|
|
273
274
|
const settingsSeams = detectSettingsSeams(settings);
|
|
274
|
-
if (settingsSeams.attribution || settingsSeams.permissions || settingsSeams.gateHook || settingsSeams.mcp) {
|
|
275
|
+
if (settingsSeams.attribution || settingsSeams.permissions || settingsSeams.gateHook || settingsSeams.stageGuard || settingsSeams.mcp) {
|
|
275
276
|
items.push({
|
|
276
277
|
surface: 'settings',
|
|
277
278
|
path: settingsPath,
|
|
@@ -288,7 +289,7 @@ export const buildPlan = ({ family, project = null, projectDir = null, member =
|
|
|
288
289
|
// byte-identical to the current bundle — never create the wired-but-missing state this tool
|
|
289
290
|
// itself would warn about; while any entry is present, all surfaces are reported as one bundle
|
|
290
291
|
// (edit settings first, re-run to remove the file).
|
|
291
|
-
const localSettingsPath = join(dir,
|
|
292
|
+
const localSettingsPath = join(dir, SETTINGS_LOCAL);
|
|
292
293
|
// Same leaf discipline as the hook: classified no-follow before any read, so a symlinked local
|
|
293
294
|
// settings file is not followed out of the tree and a non-regular one is never opened.
|
|
294
295
|
const localStat = !claudeDirForeign && reachable(localSettingsPath) ? lstatNoFollow(localSettingsPath, fs.lstat) : null;
|
|
@@ -303,6 +304,12 @@ export const buildPlan = ({ family, project = null, projectDir = null, member =
|
|
|
303
304
|
hand: `edit ${shq(localSettingsPath)} → remove the PreToolUse entry whose command runs ${GATE_HOOK_FILE_REL} (keep the rest of your settings)`,
|
|
304
305
|
});
|
|
305
306
|
}
|
|
307
|
+
if (localSeams.stageGuard) {
|
|
308
|
+
items.push({
|
|
309
|
+
surface: 'settings', path: localSettingsPath, class: REPORT_ONLY,
|
|
310
|
+
reason: STAGE_GUARD_SEAM_REASON, hand: `edit ${shq(localSettingsPath)} → ${STAGE_GUARD_SEAM_HAND} (keep the rest of your settings)`,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
306
313
|
const gateHookPath = join(dir, GATE_HOOK_FILE_REL);
|
|
307
314
|
// The placed hook lives INSIDE `.claude` too, so a foreign container blinds this probe as well —
|
|
308
315
|
// its own no-follow lstat guards the leaf, never the path that reaches it.
|
|
@@ -699,7 +706,7 @@ const gateHookWiredNow = (projectDir, fs) => {
|
|
|
699
706
|
return true;
|
|
700
707
|
}
|
|
701
708
|
};
|
|
702
|
-
return probe(join(projectDir,
|
|
709
|
+
return probe(join(projectDir, SETTINGS)) || probe(join(projectDir, SETTINGS_LOCAL));
|
|
703
710
|
};
|
|
704
711
|
|
|
705
712
|
// ── report ───────────────────────────────────────────────────────────────────
|
|
@@ -725,12 +732,13 @@ const jsonStringContains = (value, needle) => {
|
|
|
725
732
|
// substring probe. Deliberately BROADER than the writer's exact-command check (any string mentioning
|
|
726
733
|
// the placed path counts): over-detection preserves the hook file, under-detection could remove a
|
|
727
734
|
// still-wired one — so the fallback errs toward wired.
|
|
728
|
-
const
|
|
735
|
+
const settingsMentionsPath = (settings, rel) => {
|
|
729
736
|
const parsed = (() => { try { return JSON.parse(settings); } catch { return null; } })();
|
|
730
737
|
return parsed !== null && typeof parsed === 'object'
|
|
731
|
-
? jsonStringContains(parsed,
|
|
732
|
-
: settings.includes(
|
|
738
|
+
? jsonStringContains(parsed, rel)
|
|
739
|
+
: settings.includes(rel);
|
|
733
740
|
};
|
|
741
|
+
const settingsMentionsGateHook = (settings) => settingsMentionsPath(settings, GATE_HOOK_FILE_REL);
|
|
734
742
|
|
|
735
743
|
// Detect the three settings.json seams the family may have written: the attribution edit
|
|
736
744
|
// (`includeCoAuthoredBy`), the velocity profile (`permissions.defaultMode` / `permissions.allow`),
|
|
@@ -757,8 +765,9 @@ const settingsMentionsMcp = (settings, parsed) => {
|
|
|
757
765
|
};
|
|
758
766
|
|
|
759
767
|
const detectSettingsSeams = (settings) => {
|
|
760
|
-
if (settings == null) return { attribution: false, permissions: false, gateHook: false, mcp: false, parsed: true };
|
|
768
|
+
if (settings == null) return { attribution: false, permissions: false, gateHook: false, stageGuard: false, mcp: false, parsed: true };
|
|
761
769
|
const gateHook = settingsMentionsGateHook(settings);
|
|
770
|
+
const stageGuard = settingsMentionsPath(settings, STAGE_GUARD_HOOK);
|
|
762
771
|
const parsed = (() => { try { return JSON.parse(settings); } catch { return null; } })();
|
|
763
772
|
const mcp = settingsMentionsMcp(settings, parsed);
|
|
764
773
|
if (parsed == null || typeof parsed !== 'object') {
|
|
@@ -768,6 +777,7 @@ const detectSettingsSeams = (settings) => {
|
|
|
768
777
|
attribution: settings.includes('includeCoAuthoredBy'),
|
|
769
778
|
permissions: settings.includes('"permissions"') && (settings.includes('"defaultMode"') || settings.includes('"allow"')),
|
|
770
779
|
gateHook,
|
|
780
|
+
stageGuard,
|
|
771
781
|
mcp,
|
|
772
782
|
parsed: false,
|
|
773
783
|
};
|
|
@@ -775,12 +785,14 @@ const detectSettingsSeams = (settings) => {
|
|
|
775
785
|
const perms = parsed.permissions;
|
|
776
786
|
const permissions = perms != null && typeof perms === 'object'
|
|
777
787
|
&& (Object.prototype.hasOwnProperty.call(perms, 'defaultMode') || Object.prototype.hasOwnProperty.call(perms, 'allow'));
|
|
778
|
-
return { attribution: Object.prototype.hasOwnProperty.call(parsed, 'includeCoAuthoredBy'), permissions, gateHook, mcp, parsed: true };
|
|
788
|
+
return { attribution: Object.prototype.hasOwnProperty.call(parsed, 'includeCoAuthoredBy'), permissions, gateHook, stageGuard, mcp, parsed: true };
|
|
779
789
|
};
|
|
780
790
|
|
|
781
791
|
const ATTRIBUTION_REASON = 'we set "includeCoAuthoredBy": false here — review/remove that key by hand (the file may hold your own settings)';
|
|
782
792
|
const PERMISSIONS_REASON = 'a "permissions.defaultMode" and/or "permissions.allow" key is present in this file — if the velocity profile seeded them, review/remove by hand (no ownership marker is stored); otherwise leave them';
|
|
783
793
|
const GATE_HOOK_SEAM_REASON = `a PreToolUse entry wiring the kit-placed gate-approval hook (${GATE_HOOK_FILE_REL}) is present — remove that entry by hand to unwire it (the tool never edits settings)`;
|
|
794
|
+
const STAGE_GUARD_SEAM_REASON = `this settings file mentions the kit-placed stage write guard (${STAGE_GUARD_HOOK}) — if a PreToolUse entry runs it, the guard keeps refusing code writes in a stage recorded as writing no code, kit or no kit; verify and remove that entry by hand (the tool never edits settings)`;
|
|
795
|
+
const STAGE_GUARD_SEAM_HAND = `remove the PreToolUse entry whose command runs ${STAGE_GUARD_HOOK}`;
|
|
784
796
|
|
|
785
797
|
const MCP_SEAM_REASON = `the MCP registration keys for "${MCP_SERVER_NAME}" are present in this file ("${MCP_ENABLED_KEY}" and/or the ${MCP_ALLOW_RULES.join(' / ')} allow rules) — remove them by hand to unregister the typed channel (the tool never edits settings)`;
|
|
786
798
|
// Over a file that could not be PARSED, the same seams are probed by substring — so any string or
|
|
@@ -794,6 +806,7 @@ const settingsSeamReason = (seams) =>
|
|
|
794
806
|
...(seams.attribution ? [ATTRIBUTION_REASON] : []),
|
|
795
807
|
...(seams.permissions ? [PERMISSIONS_REASON] : []),
|
|
796
808
|
...(seams.gateHook ? [GATE_HOOK_SEAM_REASON] : []),
|
|
809
|
+
...(seams.stageGuard ? [STAGE_GUARD_SEAM_REASON] : []),
|
|
797
810
|
...(seams.mcp ? [MCP_SEAM_REASON] : []),
|
|
798
811
|
].join('. Also: ');
|
|
799
812
|
|
|
@@ -806,6 +819,7 @@ const settingsSeamHand = (seams, p) => {
|
|
|
806
819
|
: 'if the velocity profile seeded "permissions.defaultMode"/"permissions.allow", review/remove them by hand']
|
|
807
820
|
: []),
|
|
808
821
|
...(seams.gateHook ? [`remove the PreToolUse entry whose command runs ${GATE_HOOK_FILE_REL}`] : []),
|
|
822
|
+
...(seams.stageGuard ? [STAGE_GUARD_SEAM_HAND] : []),
|
|
809
823
|
...(seams.mcp ? [`remove "${MCP_SERVER_NAME}" from "${MCP_ENABLED_KEY}" and the ${MCP_ALLOW_RULES.join(" / ")} allow rules`] : []),
|
|
810
824
|
];
|
|
811
825
|
return `edit ${shq(p)} → ${clauses.join(' and ')} (keep the rest of your settings)`;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readFileSync, lstatSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { VEHICLES } from '../references/scripts/shared/index.mjs';
|
|
3
4
|
|
|
4
|
-
export const VEHICLES_REL =
|
|
5
|
+
export const VEHICLES_REL = VEHICLES;
|
|
5
6
|
export const EXECUTOR_DEFAULTS = Object.freeze({ model: 'opus', effort: 'high', fallback: 'sonnet' });
|
|
6
7
|
export const REVIEW_LENS_DEFAULTS = Object.freeze({ model: 'opus', effort: 'high' });
|
|
7
8
|
|
|
@@ -2,6 +2,7 @@ import { accessSync, constants, existsSync, lstatSync, mkdirSync, readdirSync, r
|
|
|
2
2
|
import { basename, dirname, join, relative, resolve } from 'node:path';
|
|
3
3
|
import { homedir, tmpdir } from 'node:os';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { CLAUDE_DIR, PACKAGE_JSON, SETTINGS, SETTINGS_LOCAL, WORKFLOW_STAMP } from '../references/scripts/shared/index.mjs';
|
|
5
6
|
// The --autonomy render reads the per-project autonomy policy through the read-only autonomy core
|
|
6
7
|
// (AD-044). This file is the family's one .claude/settings.json writer, so the policy render lives here;
|
|
7
8
|
// it never imports the policy fs-writer (autonomy-write.mjs) — the render owns the settings file, not
|
|
@@ -33,10 +34,9 @@ import { resolveDeclaredDir, dirCovers, isResolvableDeclaredEntry } from './decl
|
|
|
33
34
|
// Deployment-lineage head this velocity build targets; bump together with agent-workflow-memory
|
|
34
35
|
// LINEAGE_HEAD when the deployed docs/ai structure changes.
|
|
35
36
|
export const EXPECTED_WORKFLOW_VERSION = '5.0.0';
|
|
36
|
-
export const SETTINGS_FILE =
|
|
37
|
-
export const SETTINGS_LOCAL_FILE =
|
|
38
|
-
export
|
|
39
|
-
export const WORKFLOW_STAMP = 'docs/ai/.workflow-version';
|
|
37
|
+
export const SETTINGS_FILE = SETTINGS;
|
|
38
|
+
export const SETTINGS_LOCAL_FILE = SETTINGS_LOCAL;
|
|
39
|
+
export { CLAUDE_DIR, WORKFLOW_STAMP } from '../references/scripts/shared/index.mjs';
|
|
40
40
|
export const SAFE_DEFAULT_MODES = Object.freeze(['default', 'acceptEdits', 'plan']);
|
|
41
41
|
export const UNSAFE_BYPASS_MODE = 'bypassPermissions';
|
|
42
42
|
export const ACCEPT_EDITS_MODE = 'acceptEdits';
|
|
@@ -285,7 +285,6 @@ const WHITESPACE_PATTERN = /\s+/u;
|
|
|
285
285
|
const GIT_COMMAND = 'git';
|
|
286
286
|
const NPM_COMMAND = 'npm';
|
|
287
287
|
const NPM_RUN_COMMAND = 'npm run';
|
|
288
|
-
const PACKAGE_FILE = 'package.json';
|
|
289
288
|
const SETTINGS_JSON_INDENT = 2;
|
|
290
289
|
const EXIT_USAGE = 2;
|
|
291
290
|
const EXIT_PRECONDITION = 1;
|
|
@@ -522,7 +521,7 @@ const readStamp = (absPath, deps = {}) => {
|
|
|
522
521
|
|
|
523
522
|
const readPackageJson = (cwd, deps = {}) => {
|
|
524
523
|
const fs = fsDeps(deps);
|
|
525
|
-
const absPath = join(cwd,
|
|
524
|
+
const absPath = join(cwd, PACKAGE_JSON);
|
|
526
525
|
if (!fs.exists(absPath)) return null;
|
|
527
526
|
// package.json feeds ONLY the read-only gate advisory — a malformed one degrades to "no
|
|
528
527
|
// candidates"; it must NEVER block the settings write.
|
package/tools/view-model.mjs
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// Pure, no side effects, Node >= 22.
|
|
10
10
|
|
|
11
11
|
import { STATE_PHRASING, VISIBILITY_PHRASING } from './presentation.mjs';
|
|
12
|
+
import { slotRole } from './carriers.mjs';
|
|
12
13
|
|
|
13
14
|
const memberVm = (m) => {
|
|
14
15
|
const refresh = m.refresh ?? { behind: false, recommend: null };
|
|
@@ -57,7 +58,7 @@ const recipesVm = (r) => {
|
|
|
57
58
|
// source + degradedFrom ride along: an effective recipe alone cannot tell a chosen value from a
|
|
58
59
|
// computed default, nor a degrade from a configuration that really names the resolved recipe.
|
|
59
60
|
for (const [slot, v] of Object.entries(slots)) {
|
|
60
|
-
pairs.push({ key: `${activity}.${slot}`, recipe: v.recipe, source: v.source ?? null, degradedFrom: v.degradedFrom ?? null });
|
|
61
|
+
pairs.push({ key: `${activity}.${slot}`, recipe: v.recipe, source: v.source ?? null, degradedFrom: v.degradedFrom ?? null, role: slotRole(activity, slot) });
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
return { pairs, detectError: r.detectError ?? null };
|
|
@@ -80,15 +81,17 @@ const velocityVm = (v) => {
|
|
|
80
81
|
|
|
81
82
|
const agentsVm = (a) => {
|
|
82
83
|
if (!a) return null;
|
|
83
|
-
if (a.error) return { error: a.error, executor: a.executor ?? null, executorReason: a.executorReason ?? null };
|
|
84
|
+
if (a.error) return { error: a.error, author: a.author ?? null, authorReason: a.authorReason ?? null, executor: a.executor ?? null, executorReason: a.executorReason ?? null };
|
|
84
85
|
const bundled = a.bundled ?? 0;
|
|
85
86
|
return {
|
|
86
87
|
bundled,
|
|
87
88
|
placed: a.placed ?? 0,
|
|
88
|
-
// The envelope counts the read-only vehicles; an envelope predating the executor
|
|
89
|
+
// The envelope counts the read-only vehicles; an envelope predating the author and executor fields bundled
|
|
89
90
|
// only read-only ones.
|
|
90
|
-
readOnly: a.readOnly ?? (a.executor
|
|
91
|
+
readOnly: a.readOnly ?? Math.max(bundled - Number(a.executor != null) - Number(a.author != null), 0),
|
|
91
92
|
// null = an envelope predating the field (unknown), never a state.
|
|
93
|
+
author: a.author ?? null,
|
|
94
|
+
authorReason: a.authorReason ?? null,
|
|
92
95
|
executor: a.executor ?? null,
|
|
93
96
|
executorReason: a.executorReason ?? null,
|
|
94
97
|
};
|
|
@@ -19,7 +19,7 @@ export { WORKTREES_STOP } from './worktrees-record.mjs';
|
|
|
19
19
|
|
|
20
20
|
// The command grammar. Every command this prompt puts in front of a reader is a marked line naming
|
|
21
21
|
// WHO runs it — ` MAIN $ …` or ` HERE $ …` — so the runnable set is enumerable AND attributed.
|
|
22
|
-
// The actor is not decoration: the
|
|
22
|
+
// The actor is not decoration: the landing command the prompt carries runs from MAIN and mutates
|
|
23
23
|
// MAIN, which is precisely what the satellite is forbidden to do, and an unattributed `$` line reads
|
|
24
24
|
// as an instruction to whoever is holding the prompt.
|
|
25
25
|
export const PROMPT_ACTORS = Object.freeze({ main: 'MAIN', here: 'HERE' });
|
|
@@ -107,7 +107,8 @@ const MAIN_CAUSE = 'a moved MAIN, or a hand edit';
|
|
|
107
107
|
const INSTALL_CAUSE = 'this checkout answers differently now, most often because its dependency declaration or its node_modules changed since provision';
|
|
108
108
|
|
|
109
109
|
// live: { sharedQueue, landingRule, landingCommand, installPosture, installDescription,
|
|
110
|
-
// installCommand } — derived by the caller at print time.
|
|
110
|
+
// installCommand } — derived by the caller at print time. `renderCommand` is the stage renderer's
|
|
111
|
+
// command for this checkout's slot file, the one command this session runs first. The landing pair and the checkout identity
|
|
111
112
|
// have no "cannot answer" state and are REQUIRED; the series index and the install trio may be
|
|
112
113
|
// absent and then render by omission. The install arrives in THREE parts on purpose: the posture is
|
|
113
114
|
// the record's field and the divergence key and is never printed, the description is its prose half,
|
|
@@ -115,7 +116,7 @@ const INSTALL_CAUSE = 'this checkout answers differently now, most often because
|
|
|
115
116
|
// case, and printing it as prose would offer an instruction nothing attributes. `record` is the
|
|
116
117
|
// parsed provision record and is required too — a caller that could not read it must say so, not
|
|
117
118
|
// hand in an empty object that renders as "nothing diverged".
|
|
118
|
-
export const composeSatellitePrompt = ({ slug, branch, worktreePath, plan, live, record }) => {
|
|
119
|
+
export const composeSatellitePrompt = ({ slug, branch, worktreePath, plan, renderCommand, live, record }) => {
|
|
119
120
|
if (live == null || typeof live !== 'object') {
|
|
120
121
|
throw stop('the satellite cold-start prompt cannot be composed: the live orientation is missing — every value the prompt states is derived at print time, so there is nothing to state without it');
|
|
121
122
|
}
|
|
@@ -126,6 +127,7 @@ export const composeSatellitePrompt = ({ slug, branch, worktreePath, plan, live,
|
|
|
126
127
|
const safeBranch = promptValue('branch', required('branch', branch));
|
|
127
128
|
const safePath = promptValue('worktree path', required('worktree path', worktreePath));
|
|
128
129
|
const safePlan = promptValue('seeded plan', required('seeded plan', plan));
|
|
130
|
+
const render = promptValue('render command', required('render command', renderCommand));
|
|
129
131
|
const rule = promptValue('live.landingRule', required('live.landingRule', live.landingRule));
|
|
130
132
|
const command = promptValue('live.landingCommand', required('live.landingCommand', live.landingCommand));
|
|
131
133
|
const queue = promptValue('live.sharedQueue', live.sharedQueue);
|
|
@@ -150,6 +152,8 @@ export const composeSatellitePrompt = ({ slug, branch, worktreePath, plan, live,
|
|
|
150
152
|
`- branch: ${safeBranch}`,
|
|
151
153
|
`- seeded plan: ${PLANS_REL}/${safePlan}`,
|
|
152
154
|
`- handoff: ${handoffRel}`,
|
|
155
|
+
'- the stage of this session, rendered from the installed kit before any other step:',
|
|
156
|
+
commandLine(PROMPT_ACTORS.here, render),
|
|
153
157
|
'',
|
|
154
158
|
'## MAIN orientation — derived LIVE from MAIN, never replayed from the provision record',
|
|
155
159
|
];
|