@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/ensure-ops.mjs
CHANGED
|
@@ -38,6 +38,7 @@ import { VEHICLES_REL } from './vehicle-settings.mjs';
|
|
|
38
38
|
import { ENSURE_TOKENS, FAILURE_CAUSES } from './ensure-vocabulary.mjs';
|
|
39
39
|
import { readDeployedScripts, NODE_EVIDENCE, describeNodeProbes, probeNodeEvidence } from './node-evidence.mjs';
|
|
40
40
|
import { classifyDeployedScript } from './script-priors.mjs';
|
|
41
|
+
import { INDEX } from '../references/scripts/shared/index.mjs';
|
|
41
42
|
import { parseFrontmatter } from '../references/scripts/docs-size/index.mjs';
|
|
42
43
|
|
|
43
44
|
// The closed vocabulary lives in its own PURE leaf so the read-only doc-parity lint can bind the
|
|
@@ -230,7 +231,6 @@ export const nodeEvidenceRefusal = (op, cwd, lstat) => {
|
|
|
230
231
|
// the ensure framework is synchronous, and a second index implementation here would be the drift
|
|
231
232
|
// the one-generator rule exists to prevent. Under a hook module that is not the bundled one, the
|
|
232
233
|
// project's own checker judges the navigator and a write it rejects is put back (spec docs-navigator).
|
|
233
|
-
const INDEX_REL = 'docs/ai/index.md';
|
|
234
234
|
// The docs checker is the docs-size module's one deployed entry: bundled, it is the generator; deployed,
|
|
235
235
|
// the kept probe. A flat scripts/check-docs-size.mjs is no deployed checker (story S4 reads it).
|
|
236
236
|
const readChecker = () => readDeployedScripts().find(({ module }) => module === 'docs-size');
|
|
@@ -313,7 +313,7 @@ const judgeKept = ({ cwd, spawn, read, lstat, deps }) => {
|
|
|
313
313
|
const result = spawn(process.execPath, [pathIn(cwd, readChecker().deployed), '--check-index'], { cwd, encoding: 'utf8', timeout: deps.keptProbeTimeoutMs ?? KEPT_PROBE_TIMEOUT_MS, killSignal: 'SIGKILL' });
|
|
314
314
|
if (result.error) return { error: `${causeOf(result.error)}${result.signal ? `, killed on signal ${result.signal}` : ''}` };
|
|
315
315
|
if (result.status !== 0) return { accepted: false, said: describeExitWithOutput(result), half: 'its index check' };
|
|
316
|
-
const text = lstatNoFollow(join(cwd,
|
|
316
|
+
const text = lstatNoFollow(join(cwd, INDEX), lstat)?.isFile() ? String(read(join(cwd, INDEX), 'utf8')) : null;
|
|
317
317
|
const cap = text === null ? undefined : readStampedCap(text);
|
|
318
318
|
if (cap !== undefined && countLines(text) <= Number(cap)) return { accepted: true };
|
|
319
319
|
const why = text === null ? 'no navigator file stands' : cap === undefined ? 'the navigator stamps no maxLines' : `${countLines(text)} lines against the maxLines ${cap} it stamps`;
|
|
@@ -322,7 +322,7 @@ const judgeKept = ({ cwd, spawn, read, lstat, deps }) => {
|
|
|
322
322
|
|
|
323
323
|
const removeIndexIfPresent = (cwd, deps) => {
|
|
324
324
|
try {
|
|
325
|
-
(deps.unlink ?? unlinkSync)(join(cwd,
|
|
325
|
+
(deps.unlink ?? unlinkSync)(join(cwd, INDEX));
|
|
326
326
|
} catch (err) {
|
|
327
327
|
if (err?.code !== 'ENOENT') throw err;
|
|
328
328
|
}
|
|
@@ -330,7 +330,7 @@ const removeIndexIfPresent = (cwd, deps) => {
|
|
|
330
330
|
|
|
331
331
|
const putBackIndex = (cwd, found, deps) => {
|
|
332
332
|
try {
|
|
333
|
-
if (found !== null) writeDocsAiFileAtomic(cwd,
|
|
333
|
+
if (found !== null) writeDocsAiFileAtomic(cwd, INDEX, found, deps, { noun: 'the navigator' });
|
|
334
334
|
else removeIndexIfPresent(cwd, deps);
|
|
335
335
|
} catch (err) {
|
|
336
336
|
return causeOf(err);
|
|
@@ -340,28 +340,28 @@ const putBackIndex = (cwd, found, deps) => {
|
|
|
340
340
|
|
|
341
341
|
const ensureKeptIndex = ({ cwd, drive, spawn, read, lstat, deps }) => {
|
|
342
342
|
const judge = () => judgeKept({ cwd, spawn, read, lstat, deps });
|
|
343
|
-
const reportUnanswered = (verdict, after) => loud('index', 'index-probe-failed', `${
|
|
343
|
+
const reportUnanswered = (verdict, after) => loud('index', 'index-probe-failed', `${INDEX}: ${describeKeptJudge()} could not be launched or did not answer in time (${verdict.error}) — ${after}`);
|
|
344
344
|
const first = judge();
|
|
345
345
|
if (first.error) return reportUnanswered(first, 'nothing was written');
|
|
346
|
-
if (first.accepted) return ok('index', 'already-current', `${
|
|
347
|
-
const found = lstatNoFollow(join(cwd,
|
|
346
|
+
if (first.accepted) return ok('index', 'already-current', `${INDEX}: ${describeKeptFits()} — nothing written`);
|
|
347
|
+
const found = lstatNoFollow(join(cwd, INDEX), lstat) === null ? null : read(join(cwd, INDEX));
|
|
348
348
|
const restored = found === null ? 'the navigator was put back: found absent, it was removed again' : 'the navigator was put back byte for byte';
|
|
349
349
|
const restoreThen = (failure, compose) => {
|
|
350
350
|
const refused = putBackIndex(cwd, found, deps);
|
|
351
|
-
return refused === null ? compose() : loud('index', 'write-refused', `${
|
|
351
|
+
return refused === null ? compose() : loud('index', 'write-refused', `${INDEX}: putting the navigator back failed (${refused})${failure ? ` after ${failure}` : ''} — a navigator ${describeKeptJudge()} rejects may stand; re-read it before re-running`);
|
|
352
352
|
};
|
|
353
353
|
const run = drive('--ensure-index');
|
|
354
354
|
const refusal = String(run.stderr ?? '').match(ENSURE_INDEX_REFUSAL);
|
|
355
355
|
if (run.error || run.status !== 0 || !String(run.stdout ?? '').match(ENSURE_INDEX_OUTCOME)) {
|
|
356
356
|
const cause = run.error ? 'generator-unlaunchable' : run.status === 2 && refusal ? (refusal[1] === 'write-refused' ? 'write-refused' : 'index-probe-failed') : 'generator-failed';
|
|
357
357
|
const what = run.error ? `the bundled generator could not be started (${causeOf(run.error)})` : describeExitWithOutput(run, 'the bundled generator');
|
|
358
|
-
return restoreThen(what, () => loud('index', cause, `${
|
|
358
|
+
return restoreThen(what, () => loud('index', cause, `${INDEX}: ${what} — ${restored}`));
|
|
359
359
|
}
|
|
360
360
|
let second;
|
|
361
|
-
try { second = judge(); } catch (err) { return restoreThen(`the navigator could not be read back (${causeOf(err)})`, () => loud('index', 'unexpected-error', `${
|
|
361
|
+
try { second = judge(); } catch (err) { return restoreThen(`the navigator could not be read back (${causeOf(err)})`, () => loud('index', 'unexpected-error', `${INDEX}: the navigator could not be read back after the bundled write (${causeOf(err)}) — ${restored}`)); }
|
|
362
362
|
if (second.error) return restoreThen(`${describeKeptJudge()} could not answer (${second.error})`, () => reportUnanswered(second, restored));
|
|
363
|
-
if (second.accepted) return ok('index', 'regenerated', `${
|
|
364
|
-
return restoreThen(null, () => ok('index', 'customized-preserved', `${
|
|
363
|
+
if (second.accepted) return ok('index', 'regenerated', `${INDEX}: written by the bundled generator — ${describeKeptFits()}`);
|
|
364
|
+
return restoreThen(null, () => ok('index', 'customized-preserved', `${INDEX}: ${describeKeptJudge()} rejected the bundled render on ${second.half} (${second.said}), and the navigator as found did not pass it either (${first.half}) — ${restored}. The route: ${KEPT_ROUTE}`));
|
|
365
365
|
};
|
|
366
366
|
|
|
367
367
|
const buildKeptDryRunNote = (hook) =>
|
|
@@ -374,11 +374,11 @@ export const ensureIndex = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
|
374
374
|
const generator = pathIn(kitRoot, readChecker().bundled);
|
|
375
375
|
const drive = (mode) => spawn(process.execPath, [generator, mode, `--root=${cwd}`], { encoding: 'utf8' });
|
|
376
376
|
const unlaunchable = (result) =>
|
|
377
|
-
loud('index', 'generator-unlaunchable', `${
|
|
377
|
+
loud('index', 'generator-unlaunchable', `${INDEX}: the bundled generator could not be started, so nothing was probed or written — reinstall the kit. ${causeOf(result.error)}`);
|
|
378
378
|
|
|
379
|
-
const probe = probeSeedTarget(join(cwd,
|
|
379
|
+
const probe = probeSeedTarget(join(cwd, INDEX), lstat);
|
|
380
380
|
if (probe.wrongKind) {
|
|
381
|
-
return loud('index', 'wrong-node-kind', `${
|
|
381
|
+
return loud('index', 'wrong-node-kind', `${INDEX}: exists but is ${probe.wrongKind} — the navigator is a generated file and this is not one; nothing was read or written, resolve it by hand and re-run`);
|
|
382
382
|
}
|
|
383
383
|
const hook = surveyHook(cwd, kitRoot, read, lstat);
|
|
384
384
|
const wrong = hook.find((entry) => entry.state === 'wrong-kind');
|
|
@@ -392,9 +392,9 @@ export const ensureIndex = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
|
392
392
|
const check = drive('--check-index');
|
|
393
393
|
if (check.error) return unlaunchable(check);
|
|
394
394
|
const out = bothStreams(check);
|
|
395
|
-
if (check.status === 0 && PROBE_FRESH.test(out)) return ok('index', 'already-current', `${
|
|
396
|
-
if (check.status === 1 && PROBE_STALE.test(out)) return ok('index', 'would-regenerate', `${
|
|
397
|
-
return loud('index', 'index-probe-failed', `${
|
|
395
|
+
if (check.status === 0 && PROBE_FRESH.test(out)) return ok('index', 'already-current', `${INDEX}: in sync with the source frontmatter — nothing would be written`, ...dryNote);
|
|
396
|
+
if (check.status === 1 && PROBE_STALE.test(out)) return ok('index', 'would-regenerate', `${INDEX}: missing or stale — would be written from the source frontmatter`, ...dryNote);
|
|
397
|
+
return loud('index', 'index-probe-failed', `${INDEX}: the freshness probe answered neither fresh nor stale (exited ${describeExit(check)}), so nothing was written. ${out}`, ...dryNote);
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
const run = drive('--ensure-index');
|
|
@@ -405,12 +405,12 @@ export const ensureIndex = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
|
405
405
|
// The generator's OWN closed refusals: a write it would not publish, and a probe that could not
|
|
406
406
|
// answer. Each keeps its identity here rather than collapsing into "the generator failed".
|
|
407
407
|
const cause = refusal[1] === 'write-refused' ? 'write-refused' : 'index-probe-failed';
|
|
408
|
-
return loud('index', cause, `${
|
|
408
|
+
return loud('index', cause, `${INDEX}: ${bothStreams(run)}`);
|
|
409
409
|
}
|
|
410
410
|
if (run.status !== 0 || !outcome) {
|
|
411
|
-
return loud('index', 'generator-failed', `${
|
|
411
|
+
return loud('index', 'generator-failed', `${INDEX}: the generator exited ${describeExit(run)} without a recognized outcome line — ${MAY_HAVE_WRITTEN}. ${bothStreams(run)}`);
|
|
412
412
|
}
|
|
413
|
-
if (outcome[1] === 'already-current') return ok('index', 'already-current', `${
|
|
413
|
+
if (outcome[1] === 'already-current') return ok('index', 'already-current', `${INDEX}: in sync with the source frontmatter — nothing written`);
|
|
414
414
|
|
|
415
415
|
// A claimed regeneration is not a verified one: re-probe, so `regenerated` names a state this run
|
|
416
416
|
// PROVED rather than a line the generator printed. The verdict is read from the probe's own two
|
|
@@ -419,12 +419,12 @@ export const ensureIndex = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
|
419
419
|
const verify = drive('--check-index');
|
|
420
420
|
const verdict = verify.error ? '' : bothStreams(verify);
|
|
421
421
|
if (!verify.error && verify.status === 0 && PROBE_FRESH.test(verdict)) {
|
|
422
|
-
return ok('index', 'regenerated', `${
|
|
422
|
+
return ok('index', 'regenerated', `${INDEX}: written from the source frontmatter — the navigator is in sync again`);
|
|
423
423
|
}
|
|
424
424
|
if (!verify.error && verify.status === 1 && PROBE_STALE.test(verdict)) {
|
|
425
|
-
return loud('index', 'index-stale-after-write', `${
|
|
425
|
+
return loud('index', 'index-stale-after-write', `${INDEX}: the generator reported a regeneration, but the re-probe still reads the navigator as missing or stale — ${MAY_HAVE_WRITTEN}. ${verdict}`);
|
|
426
426
|
}
|
|
427
|
-
return loud('index', 'index-probe-failed', `${
|
|
427
|
+
return loud('index', 'index-probe-failed', `${INDEX}: the generator reported a regeneration, but the verifying probe answered neither fresh nor stale — ${MAY_HAVE_WRITTEN}. ${verify.error ? causeOf(verify.error) : verdict}`);
|
|
428
428
|
};
|
|
429
429
|
|
|
430
430
|
// The ops this module owns, by name. The CLI composes the full ENSURE_OPS table from these plus
|
package/tools/ensure-specs.mjs
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import { readFileSync, lstatSync } from 'node:fs';
|
|
25
25
|
import { join } from 'node:path';
|
|
26
|
+
import { SPEC_STORE_INDEX } from '../references/scripts/shared/index.mjs';
|
|
26
27
|
import { lstatNoFollow, writeContainedFileAtomic, writeProjectFileCreateOnly } from './atomic-write.mjs';
|
|
27
28
|
import { readDeployedScripts } from './node-evidence.mjs';
|
|
28
29
|
import { SCRIPT_PRIORS, classifyDeployedScript } from './script-priors.mjs';
|
|
@@ -30,7 +31,6 @@ import { bundledImportsOf, composeFailure, composeOutcome, dependenciesFirst, no
|
|
|
30
31
|
import { fileLine, hookLine } from './distribution-files/index.mjs';
|
|
31
32
|
|
|
32
33
|
const OP = 'specs';
|
|
33
|
-
const STORE_ROOT_REL = 'docs/ai/specs/index.md';
|
|
34
34
|
const STORE_ROOT_TEMPLATE = ['references', 'templates', 'specs', 'index.md'];
|
|
35
35
|
const DATE_PLACEHOLDER = '{{DATE}}';
|
|
36
36
|
|
|
@@ -87,9 +87,9 @@ const surveyScript = (cwd, f, deps, read, lstat) => {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
const surveyStoreRoot = (cwd, lstat) => {
|
|
90
|
-
const probe = probeSeedTarget(join(cwd,
|
|
91
|
-
if (probe.wrongKind) return { rel:
|
|
92
|
-
return { rel:
|
|
90
|
+
const probe = probeSeedTarget(join(cwd, SPEC_STORE_INDEX), lstat);
|
|
91
|
+
if (probe.wrongKind) return { rel: SPEC_STORE_INDEX, state: 'wrong-kind', wrongKind: probe.wrongKind };
|
|
92
|
+
return { rel: SPEC_STORE_INDEX, state: probe.present ? 'present' : 'absent' };
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
// ── the lines (composed from what HAPPENED: each file's state and the fate of its write) ─────────
|
|
@@ -107,7 +107,7 @@ const STORE_LINES = {
|
|
|
107
107
|
};
|
|
108
108
|
const composeLines = ({ files, store, fates, dryRun }) => [
|
|
109
109
|
...files.map((f) => (f.state === 'current' ? `${f.rel}: ${CURRENT}` : fileLine(f, fates.get(f.rel), dryRun))),
|
|
110
|
-
`${
|
|
110
|
+
`${SPEC_STORE_INDEX}: ${STORE_LINES[store.state === 'present' ? 'present' : fates.get(SPEC_STORE_INDEX) ?? (dryRun ? 'would' : 'stopped')]}`,
|
|
111
111
|
];
|
|
112
112
|
|
|
113
113
|
// A per-file loop can stop partway; the run says which files already landed — never "nothing happened".
|
|
@@ -128,7 +128,7 @@ const writeAll = ({ cwd, due, storeBody, deps, read }) => {
|
|
|
128
128
|
const fates = new Map();
|
|
129
129
|
const notes = [];
|
|
130
130
|
for (const f of due) {
|
|
131
|
-
const isStore = f.rel ===
|
|
131
|
+
const isStore = f.rel === SPEC_STORE_INDEX;
|
|
132
132
|
let result;
|
|
133
133
|
try {
|
|
134
134
|
result = isStore ? writeProjectFileCreateOnly(cwd, f.rel, storeBody, deps, { noun: 'the spec store root' })
|
|
@@ -182,7 +182,7 @@ export const ensureSpecs = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
|
182
182
|
try {
|
|
183
183
|
storeBody = renderStoreRoot(kitRoot, read, deps.today ?? todayIso());
|
|
184
184
|
} catch (err) {
|
|
185
|
-
return composeFailure(OP, 'template-unreadable', `${
|
|
185
|
+
return composeFailure(OP, 'template-unreadable', `${SPEC_STORE_INDEX}: ${causeOf(err)}`, ...composeLines({ files, store, fates: new Map(), dryRun }));
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
const { fates, notes, failure } = writeAll({ cwd, due, storeBody, deps, read });
|
package/tools/epic-shape-cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { constants, openSync, closeSync, fstatSync, writeSync, ftruncateSync } from 'node:fs';
|
|
3
3
|
import { basename, dirname, resolve } from 'node:path';
|
|
4
|
-
import { fail } from '../references/scripts/shared/index.mjs';
|
|
4
|
+
import { EPIC_STORE, fail } from '../references/scripts/shared/index.mjs';
|
|
5
5
|
import { isDirectRun } from './direct-run.mjs';
|
|
6
6
|
import { readRegularFileNoFollow } from './fs-read-nofollow.mjs';
|
|
7
7
|
import { readEpicEntries } from './epic-store.mjs';
|
|
@@ -21,7 +21,7 @@ const VERB_ARITY = 2;
|
|
|
21
21
|
const FIRST_LINE = 1;
|
|
22
22
|
const PREFIX = 'epic-shape:';
|
|
23
23
|
const INFO = 'info';
|
|
24
|
-
const STORE_TO_PROJECT = '
|
|
24
|
+
const STORE_TO_PROJECT = EPIC_STORE.split('/').map(() => '..').join('/');
|
|
25
25
|
const LANDED_BYTES = Buffer.from('landed');
|
|
26
26
|
const HELP = `Usage:
|
|
27
27
|
node epic-shape-cli.mjs --check <epic>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { posix } from 'node:path';
|
|
2
|
-
import { tokenizeMarkdown } from '../references/scripts/shared/index.mjs';
|
|
2
|
+
import { EPIC_STORE, QUEUE, tokenizeMarkdown } from '../references/scripts/shared/index.mjs';
|
|
3
3
|
import { parseHeader, checkEpic } from './epic-shape.mjs';
|
|
4
4
|
import { auditQueue } from './queue-audit.mjs';
|
|
5
5
|
import { hasPathOverlap, findReachable, listStories, unique } from './claim-relation.mjs';
|
|
6
|
+
import { escapeRegExp } from './repo-lex.mjs';
|
|
6
7
|
|
|
7
8
|
const FIRST_LINE = 1;
|
|
8
9
|
const ERROR = 'error';
|
|
@@ -15,10 +16,9 @@ const OWN = 'owns';
|
|
|
15
16
|
const FRONT_DELIMITER = '---';
|
|
16
17
|
const CR_END = /\r$/;
|
|
17
18
|
const MARKDOWN_SUFFIX = '.md';
|
|
18
|
-
export const STORE_PATH =
|
|
19
|
-
export const QUEUE_PATH =
|
|
19
|
+
export const STORE_PATH = new RegExp(`^(?:(.*)/)?${escapeRegExp(EPIC_STORE)}/([^/]+)\\.md$`);
|
|
20
|
+
export const QUEUE_PATH = QUEUE;
|
|
20
21
|
const TOKEN_EDGE = '[\\p{L}\\p{N}_-]';
|
|
21
|
-
const REGEX_BYTES = /[.*+?^${}()|[\]\\]/g;
|
|
22
22
|
const PARSE_REFUSALS = Object.freeze([1, 2]);
|
|
23
23
|
const makeFinding = (path, line, code, message, severity = ERROR) => ({ path, line, code, message: `${path}: ${message}`, severity });
|
|
24
24
|
const finishJudgement = (findings, data = {}) => ({ ...data, ok: !findings.some((finding) => finding.severity === ERROR), findings });
|
|
@@ -120,7 +120,7 @@ export const sweepSiblings = (entries, root) => {
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
const carriesToken = (title, id) => {
|
|
123
|
-
const escaped = id
|
|
123
|
+
const escaped = escapeRegExp(id);
|
|
124
124
|
return new RegExp(`(?<!${TOKEN_EDGE})${escaped}(?!${TOKEN_EDGE})`, 'u').test(title);
|
|
125
125
|
};
|
|
126
126
|
const describeQueue = (queue) => [queue?.outcome, queue?.reason].filter((part) => part !== undefined).join(': ')
|
package/tools/epic-shape.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { PLANS, QUEUE as QUEUE_LOCATION, tokenizeMarkdown } from '../references/scripts/shared/index.mjs';
|
|
2
3
|
import { bulletBlocks, getLineCount, unique } from './plan-shape.mjs';
|
|
4
|
+
import { escapeRegExp } from './repo-lex.mjs';
|
|
3
5
|
|
|
4
6
|
export const EPIC_SECTIONS = Object.freeze([
|
|
5
7
|
'## Intent', '## Value', '## Non-goals', '## Acceptance', '## Specs', '## Stories ledger', '## Queue',
|
|
@@ -29,8 +31,8 @@ const STATE_FIELD = /^state: (planned|in-flight|landed (\d{4}-\d{2}-\d{2}))$/;
|
|
|
29
31
|
const HEADER_FIELD = /^([A-Za-z][A-Za-z0-9]*):([ \t]*)(.*?)[ \t]*\r?$/;
|
|
30
32
|
const QUEUE_LINE = /^Row (\S+) in (\S(?:.*\S)?)$/;
|
|
31
33
|
const RESULT_LINE = /^Result line: (\d{4}-\d{2}-\d{2})$/;
|
|
32
|
-
const PLAN_PATH = /
|
|
33
|
-
const QUEUE_NAME =
|
|
34
|
+
const PLAN_PATH = new RegExp(`${escapeRegExp(PLANS)}/([^\\s\`()[\\]{}<>|,:;"']+\\.md)(?=$|[\\s\`()[\\]{}<>|,:;"'.!?])`, 'g');
|
|
35
|
+
const QUEUE_NAME = posix.basename(QUEUE_LOCATION);
|
|
34
36
|
const FENCE_LINE = /^\s*(?:`{3,}[^`]*|~{3,}.*)$/;
|
|
35
37
|
const BACKTICK_RUN = /`+/g;
|
|
36
38
|
const CITATION = /[^\s`()[\]{}<>|:;,"'!?]+[./][^\s`()[\]{}<>|:;,"'!?]+:\d+(?![\dA-Za-z_])/;
|
package/tools/epic-store.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { lstatSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { EPIC_STORE } from '../references/scripts/shared/index.mjs';
|
|
3
4
|
import { describeNonRegular, readRegularFileNoFollow } from './fs-read-nofollow.mjs';
|
|
4
5
|
|
|
5
|
-
export const EPICS_REL =
|
|
6
|
+
export const EPICS_REL = EPIC_STORE;
|
|
6
7
|
const MARKDOWN_SUFFIX = '.md';
|
|
7
8
|
const ABSENT_CODE = 'ENOENT';
|
|
8
9
|
const REGULAR_FILE = 'regular file';
|
package/tools/family-members.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// family-members.mjs — the
|
|
1
|
+
// family-members.mjs — the one authoritative table of agent-workflow family members.
|
|
2
2
|
//
|
|
3
3
|
// Extracted from family-registry.mjs so the two consumers that only need the static table — the npx
|
|
4
4
|
// installer (bin/install.mjs, which derives its init-refresh cascade from it) and family-registry
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
// (detect-backends, the manifest validator, hide-footprint, engine-source, recipes, the renderers …).
|
|
7
7
|
// install.mjs runs on the npx cold-start hot path, so the leaner import matters; single-source-of-truth
|
|
8
8
|
// + the drift-guard (family-registry.test.mjs pins FAMILY_MEMBERS to the 6 in-repo capability.json)
|
|
9
|
-
// are preserved
|
|
9
|
+
// are preserved.
|
|
10
10
|
//
|
|
11
|
-
// Pure data
|
|
11
|
+
// Pure data with stamps from the shared index, no side effects, Node >= 22.
|
|
12
|
+
|
|
13
|
+
import { MEMORY_STAMP, WORKFLOW_STAMP } from '../references/scripts/shared/index.mjs';
|
|
12
14
|
|
|
13
15
|
// ── the unified registry ───────────────────────────────────────────────────────
|
|
14
16
|
// One entry per family member. `installed` is the detect.installed spec (env + home-relative default
|
|
@@ -24,7 +26,7 @@ export const FAMILY_MEMBERS = [
|
|
|
24
26
|
name: 'agent-workflow-kit',
|
|
25
27
|
kind: 'composition-root',
|
|
26
28
|
installed: { env: 'AGENT_WORKFLOW_KIT_DIR', default: '~/.claude/skills/agent-workflow-kit', file: 'SKILL.md' },
|
|
27
|
-
deployed: { file:
|
|
29
|
+
deployed: { file: WORKFLOW_STAMP },
|
|
28
30
|
npm: '@sabaiway/agent-workflow-kit',
|
|
29
31
|
wrapperCmds: [],
|
|
30
32
|
},
|
|
@@ -32,7 +34,7 @@ export const FAMILY_MEMBERS = [
|
|
|
32
34
|
name: 'agent-workflow-memory',
|
|
33
35
|
kind: 'memory-substrate',
|
|
34
36
|
installed: { env: 'AGENT_WORKFLOW_MEMORY_DIR', default: '~/.claude/skills/agent-workflow-memory', file: 'SKILL.md' },
|
|
35
|
-
deployed: { file:
|
|
37
|
+
deployed: { file: MEMORY_STAMP },
|
|
36
38
|
npm: '@sabaiway/agent-workflow-memory',
|
|
37
39
|
wrapperCmds: [],
|
|
38
40
|
},
|
|
@@ -52,10 +52,10 @@ import { HOOK_FILE_REL as GATE_HOOK_FILE_REL, isHookWired } from './gate-hook.mj
|
|
|
52
52
|
// writer, which pulls in the atomic-write core) so the status survey stays a pure reader.
|
|
53
53
|
import { settingsSnapshot } from './bridge-settings-read.mjs';
|
|
54
54
|
import { GATES_REL, loadDeclaration } from './run-gates.mjs';
|
|
55
|
-
// The cheap-agents READ core's bundle reader, placement planner and executor
|
|
55
|
+
// The cheap-agents READ core's bundle reader, placement planner and executor and author vehicle surveys —
|
|
56
56
|
// reused by the settings survey (one implementation, never a drifting copy; the read core imports
|
|
57
57
|
// only node builtins, no cycle).
|
|
58
|
-
import { readBundledAgents, planPlacement, surveyExecutorVehicle, EXECUTOR_VEHICLE, assertDirSafe, readFsDeps, CLAUDE_DIR, AGENTS_DIR } from './cheap-agents-read.mjs';
|
|
58
|
+
import { readBundledAgents, planPlacement, surveyExecutorVehicle, surveyAuthorVehicle, EXECUTOR_VEHICLE, AUTHOR_VEHICLE, assertDirSafe, readFsDeps, CLAUDE_DIR, AGENTS_DIR } from './cheap-agents-read.mjs';
|
|
59
59
|
// The status vocabulary (manifestState constants, internal→public maps, display names, the no-leak
|
|
60
60
|
// forbidden set) lives in the frozen labels.mjs LEAF (Plan §4.2 B1) so the import graph is acyclic —
|
|
61
61
|
// nothing imports family-registry for vocabulary. Imported here for internal use; the public subset is
|
|
@@ -87,6 +87,7 @@ import { render } from './renderers.mjs';
|
|
|
87
87
|
import { ADOPTION, readDeclineAck, surveySpecAdoption } from './spec-adoption.mjs';
|
|
88
88
|
import { KIT_COMMANDS } from '../references/scripts/run.mjs';
|
|
89
89
|
import { KIT_SCRIPTS_DIR } from './node-evidence.mjs';
|
|
90
|
+
import { ADR_STORE, DECISIONS, DECISIONS_ARCHIVE, DECISIONS_ARCHIVE_EARLY, DOCS_TREE, GIT_EXCLUDE } from '../references/scripts/shared/index.mjs';
|
|
90
91
|
|
|
91
92
|
// ── manifestState values — re-export the EXACT public subset family-registry exported before B1 ─────
|
|
92
93
|
// (the 7 state constants + DISPLAY_NAMES) so every existing importer (uninstall.mjs, the test suites)
|
|
@@ -104,7 +105,7 @@ export {
|
|
|
104
105
|
|
|
105
106
|
// ── the unified registry ───────────────────────────────────────────────────────
|
|
106
107
|
// FAMILY_MEMBERS (+ isGlobalSkill) is the one authoritative member table. It moved to the
|
|
107
|
-
//
|
|
108
|
+
// data module family-members.mjs (shared index only) so the npx installer can derive its init-refresh cascade
|
|
108
109
|
// from the table WITHOUT importing this whole status/presenter graph (a leaner npx cold-start path).
|
|
109
110
|
// Re-exported here so every existing importer (uninstall.mjs, the test suites) stays green, and the
|
|
110
111
|
// drift-guard (family-registry.test.mjs) still pins the table to the 5 in-repo capability.json.
|
|
@@ -334,7 +335,7 @@ const hasHiddenFence = (projectDir, deps = {}) => {
|
|
|
334
335
|
try {
|
|
335
336
|
return excludePath(deps, projectDir);
|
|
336
337
|
} catch {
|
|
337
|
-
return join(projectDir,
|
|
338
|
+
return join(projectDir, GIT_EXCLUDE);
|
|
338
339
|
}
|
|
339
340
|
})();
|
|
340
341
|
try {
|
|
@@ -347,18 +348,18 @@ const hasHiddenFence = (projectDir, deps = {}) => {
|
|
|
347
348
|
// The retired 3-tier ADR monoliths (AD-051): their presence is the old-layout signal the status
|
|
348
349
|
// view reports; the upgrade's run of the kit's rotator moves it. Stable relative paths (a status
|
|
349
350
|
// probe never imports the rotator).
|
|
350
|
-
// The ADR-layout probe
|
|
351
|
-
// `status` view
|
|
352
|
-
//
|
|
351
|
+
// The ADR-layout probe shares its paths with the rotator through the shared index. The read-only
|
|
352
|
+
// `status` view reads the deployed rotator as text. A drift guard in family-registry.test.mjs
|
|
353
|
+
// checks the paths against the rotator's exports and the scheme marker against its declaration.
|
|
353
354
|
export const ADR_LAYOUT_PATHS = Object.freeze({
|
|
354
|
-
hot:
|
|
355
|
-
monoliths: Object.freeze([
|
|
356
|
-
store:
|
|
357
|
-
// The DEPLOYED rotator
|
|
358
|
-
//
|
|
355
|
+
hot: DECISIONS,
|
|
356
|
+
monoliths: Object.freeze([DECISIONS_ARCHIVE, DECISIONS_ARCHIVE_EARLY]),
|
|
357
|
+
store: ADR_STORE,
|
|
358
|
+
// The DEPLOYED rotator identifies the new scheme by a line starting with the ADR_DIR_REL export.
|
|
359
|
+
// Never "has decisions.md, lacks adr/" — that shape false-positives a
|
|
359
360
|
// tree whose NEW rotator already reds its own gate, and every No-Node project.
|
|
360
361
|
rotator: posix.join(KIT_SCRIPTS_DIR, KIT_COMMANDS['archive-decisions']),
|
|
361
|
-
storeMarker: '
|
|
362
|
+
storeMarker: 'export const ADR_DIR_REL',
|
|
362
363
|
});
|
|
363
364
|
const ENOENT = 'ENOENT';
|
|
364
365
|
|
|
@@ -396,13 +397,14 @@ export const surveyAdrLayoutStrict = (dir, deps = {}) => {
|
|
|
396
397
|
|
|
397
398
|
if (ADR_LAYOUT_PATHS.monoliths.some((rel) => isA(rel, PATH_FILE))) return 'old';
|
|
398
399
|
|
|
399
|
-
//
|
|
400
|
-
//
|
|
401
|
-
//
|
|
400
|
+
// Without a monolith, the rotator's scheme decides the answer for an existing store too: an
|
|
401
|
+
// old-scheme rotator beside a store is not finished — until `upgrade` replaces it with the
|
|
402
|
+
// bundled rotator, it will write a monolith again the next time it rotates.
|
|
402
403
|
const rotatorScheme = (() => {
|
|
403
404
|
if (!isA(ADR_LAYOUT_PATHS.rotator, PATH_FILE)) return null;
|
|
404
405
|
try {
|
|
405
|
-
|
|
406
|
+
const rotatorSource = String(read(join(dir, ADR_LAYOUT_PATHS.rotator), 'utf8'));
|
|
407
|
+
return rotatorSource.split('\n').some((line) => line.startsWith(ADR_LAYOUT_PATHS.storeMarker)) ? 'new' : 'old';
|
|
406
408
|
} catch (err) {
|
|
407
409
|
if (absent(err)) return null;
|
|
408
410
|
throw err;
|
|
@@ -465,7 +467,7 @@ export const surveyProject = (projectDir, deps = {}) => {
|
|
|
465
467
|
.map((m) => ({ name: m.name, file: m.deployed.file, version: readStamp(join(dir, m.deployed.file), deps) }));
|
|
466
468
|
const docsAiPresent = (() => {
|
|
467
469
|
try {
|
|
468
|
-
return exists(join(dir,
|
|
470
|
+
return exists(join(dir, DOCS_TREE));
|
|
469
471
|
} catch {
|
|
470
472
|
return false;
|
|
471
473
|
}
|
|
@@ -525,7 +527,7 @@ export const surveyVisibility = (dir, deps = {}) => {
|
|
|
525
527
|
|
|
526
528
|
// orchestration recipes: the EFFECTIVE recipe per slot (config · default · effective), engine-free —
|
|
527
529
|
// shared loadConfig + resolveActivityRecipe + the ONE readiness composition (detected backends +
|
|
528
|
-
// the executor
|
|
530
|
+
// the executor and author vehicles). A malformed config → a localized error field; a detection failure floors
|
|
529
531
|
// at solo (a corrupt bridge must not break the view) but is surfaced as `detectError`, so the
|
|
530
532
|
// render says "couldn't check backends" instead of letting a real solo-default look identical.
|
|
531
533
|
export const surveyRecipes = (dir, deps = {}) => {
|
|
@@ -615,33 +617,37 @@ export const surveyGateHook = (dir, deps = {}) => {
|
|
|
615
617
|
};
|
|
616
618
|
|
|
617
619
|
// cheap agents: the kit-placed .claude/agents/ vehicles (Mode: agents) — how many of the bundled
|
|
618
|
-
// definitions
|
|
619
|
-
// copy counts as PLACED (it exists; the writer
|
|
620
|
-
// zero placed, so the counts span every vehicle, the executor included.
|
|
621
|
-
// from the read core's
|
|
622
|
-
//
|
|
620
|
+
// definitions count as placed in the project, plus the author and executor vehicles' own states. A customized executor
|
|
621
|
+
// copy counts as PLACED (it exists; the agents writer writes it current) — the welcome-mat agents rung keys on
|
|
622
|
+
// zero placed, so the counts span every vehicle, the author and executor included. Their states come
|
|
623
|
+
// from the read core's surveys (the subagent carrier's instrument per role — one implementation each), which
|
|
624
|
+
// answer a state instead of throwing; each reason rides along when the survey carries one.
|
|
623
625
|
export const surveyCheapAgents = (dir, deps = {}) => {
|
|
624
626
|
try {
|
|
625
627
|
const projectDir = resolve(dir);
|
|
626
628
|
const templates = readBundledAgents(deps);
|
|
627
629
|
const vehicle = (deps.surveyVehicle ?? surveyExecutorVehicle)(projectDir, deps);
|
|
628
|
-
|
|
629
|
-
//
|
|
630
|
+
const authorVehicle = (deps.surveyAuthorVehicle ?? surveyAuthorVehicle)(projectDir, deps);
|
|
631
|
+
// The author and executor are judged by their own surveys (which answer a state where the placement plan
|
|
632
|
+
// would throw); the plan covers the read-only vehicles, so a broken author or executor never hides them,
|
|
630
633
|
// and it never follows a symlinked ancestor — the writer's own guard refuses first.
|
|
631
634
|
const executor = { executor: vehicle.state, ...(vehicle.reason ? { executorReason: safeLine(vehicle.reason) } : {}) };
|
|
635
|
+
const author = { author: authorVehicle.state, ...(authorVehicle.reason ? { authorReason: safeLine(authorVehicle.reason) } : {}) };
|
|
632
636
|
try {
|
|
633
637
|
const fs = readFsDeps(deps);
|
|
634
638
|
assertDirSafe(join(projectDir, CLAUDE_DIR), CLAUDE_DIR, fs);
|
|
635
639
|
assertDirSafe(join(projectDir, AGENTS_DIR), AGENTS_DIR, fs);
|
|
636
|
-
const
|
|
640
|
+
const readOnly = templates.filter((t) => t.name !== EXECUTOR_VEHICLE && t.name !== AUTHOR_VEHICLE);
|
|
641
|
+
const plan = planPlacement(readOnly, projectDir, deps);
|
|
637
642
|
return {
|
|
638
643
|
bundled: templates.length,
|
|
639
|
-
readOnly:
|
|
640
|
-
placed: plan.filter((p) => p.action !== 'place').length + (['placed', 'customized'].includes(vehicle.state) ? 1 : 0),
|
|
644
|
+
readOnly: readOnly.length,
|
|
645
|
+
placed: plan.filter((p) => p.action !== 'place').length + (['placed', 'customized'].includes(vehicle.state) ? 1 : 0) + (authorVehicle.state === 'placed' ? 1 : 0),
|
|
646
|
+
...author,
|
|
641
647
|
...executor,
|
|
642
648
|
};
|
|
643
649
|
} catch (err) {
|
|
644
|
-
return { error: localizeError(err), ...executor };
|
|
650
|
+
return { error: localizeError(err), ...author, ...executor };
|
|
645
651
|
}
|
|
646
652
|
} catch (err) {
|
|
647
653
|
return { error: localizeError(err) };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { spawnSync } from 'node:child_process';
|
|
6
6
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
7
|
-
import { fail } from '../references/scripts/shared/index.mjs';
|
|
7
|
+
import { fail, GATES } from '../references/scripts/shared/index.mjs';
|
|
8
8
|
import { isDirectRun } from './direct-run.mjs';
|
|
9
9
|
import { readFileBytesNoFollowCapped } from './fs-read-nofollow.mjs';
|
|
10
10
|
import { GIT_MAX_BUFFER, resolveGitLocation, stripGitLocationEnv, withGitPath } from './git-env.mjs';
|
|
@@ -13,7 +13,6 @@ import { judgeAnchors, parseRecord, ratchetLine, REFUSALS, renderExcerpts, rende
|
|
|
13
13
|
|
|
14
14
|
const RECORD_MAX_BYTES = 1024 * 1024;
|
|
15
15
|
export const EXCERPTS_FRAMING_RESERVE_BYTES = 4096;
|
|
16
|
-
const GATES_REL = 'docs/ai/gates.json';
|
|
17
16
|
const QUEUE_GATE_TOKEN = 'queue-audit-cli.mjs';
|
|
18
17
|
const MODE_FLAGS = Object.freeze(['--check', '--rows']);
|
|
19
18
|
const FATAL_PARSE_REFUSALS = Object.freeze(REFUSALS.slice(0, 4));
|
|
@@ -217,13 +216,13 @@ const inspectGit = ({ cwd, env, spawn, head, headLine, anchors }) => {
|
|
|
217
216
|
};
|
|
218
217
|
|
|
219
218
|
const readRatchet = (cwd, rows) => {
|
|
220
|
-
const path = join(cwd,
|
|
219
|
+
const path = join(cwd, GATES);
|
|
221
220
|
const parsed = (() => {
|
|
222
221
|
try { return { value: JSON.parse(readFileSync(path, 'utf8')), error: null }; }
|
|
223
222
|
catch (err) { return { value: null, error: err }; }
|
|
224
223
|
})();
|
|
225
|
-
if (parsed.error?.code === 'ENOENT') return `ratchet: ${
|
|
226
|
-
if (parsed.error) return `ratchet: ${
|
|
224
|
+
if (parsed.error?.code === 'ENOENT') return `ratchet: ${GATES} is absent`;
|
|
225
|
+
if (parsed.error) return `ratchet: ${GATES} cannot be read (${parsed.error.message})`;
|
|
227
226
|
const gate = Array.isArray(parsed.value?.gates)
|
|
228
227
|
? parsed.value.gates.find((entry) => typeof entry?.cmd === 'string' && entry.cmd.includes(QUEUE_GATE_TOKEN))
|
|
229
228
|
: null;
|