substrate-ai 0.21.6 → 0.21.8
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/dist/cli/index.js +111 -13
- package/dist/{health-Chn5HCft.js → health-CTdPQfSH.js} +2 -2
- package/dist/{health-HpFVnRU0.js → health-QOH__JNf.js} +2 -2
- package/dist/{interactive-prompt-j4H9HnfF.js → interactive-prompt-CT_vtUGk.js} +2 -2
- package/dist/{manifest-read-D7HcgX21.js → manifest-read-9xd4yEkp.js} +273 -2
- package/dist/modules/interactive-prompt/index.js +2 -2
- package/dist/{run-BrltNj0g.js → run-D3Idemy0.js} +4 -4
- package/dist/{run-BbBSwrqC.js → run-iZqvCT-f.js} +818 -505
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { FileKvStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-
|
|
2
|
+
import { FileKvStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-QOH__JNf.js";
|
|
3
3
|
import { createLogger } from "../logger-KeHncl-f.js";
|
|
4
4
|
import { createEventBus } from "../helpers-CElYrONe.js";
|
|
5
5
|
import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createGitWorktreeManager, createPipelineRun, createStderrLogger, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initWorkGraphSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-DeyV_vqU.js";
|
|
6
6
|
import "../adapter-registry-DXLMTmfD.js";
|
|
7
|
-
import { ACCEPTANCE_CONTRACT_PROFILE_PATH, JOURNEY_DEFERRALS_PATH, JOURNEY_REGISTRY_PATH, RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, loadAcceptanceContractFromTrustedTree, loadJourneyRegistryFromFile, loadJourneyRegistryFromTrustedTree, parseAcceptanceContract, parseJourneyDeferrals, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-
|
|
8
|
-
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-
|
|
7
|
+
import { ACCEPTANCE_CONTRACT_PROFILE_PATH, JOURNEY_DEFERRALS_PATH, JOURNEY_REGISTRY_PATH, RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, loadAcceptanceContractFromTrustedTree, loadJourneyRegistryFromFile, loadJourneyRegistryFromTrustedTree, parseAcceptanceContract, parseJourneyDeferrals, parseJourneyRegistry, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-9xd4yEkp.js";
|
|
8
|
+
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAcceptanceJudge, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-iZqvCT-f.js";
|
|
9
9
|
import "../errors-BgV6pqUZ.js";
|
|
10
10
|
import "../routing-DFxoKHDt.js";
|
|
11
11
|
import { WorkGraphRepository } from "../work-graph-repository-DZyJv5pV.js";
|
|
12
12
|
import "../decisions-CzSIEeGP.js";
|
|
13
13
|
import "../decision-router-BAPpON_C.js";
|
|
14
|
-
import "../interactive-prompt-
|
|
14
|
+
import "../interactive-prompt-CT_vtUGk.js";
|
|
15
15
|
import "../recovery-engine-BKGBeBnW.js";
|
|
16
16
|
import "../version-manager-impl-qFBiO4Eh.js";
|
|
17
17
|
import { registerUpgradeCommand } from "../upgrade-lE_GIvWv.js";
|
|
@@ -7130,7 +7130,7 @@ async function runStatusAction(options) {
|
|
|
7130
7130
|
logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
|
|
7131
7131
|
}
|
|
7132
7132
|
if (run === void 0) {
|
|
7133
|
-
const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-
|
|
7133
|
+
const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-CTdPQfSH.js");
|
|
7134
7134
|
const substrateDirPath = join(projectRoot, ".substrate");
|
|
7135
7135
|
const processInfo = inspectProcessTree$1({
|
|
7136
7136
|
projectRoot,
|
|
@@ -8659,7 +8659,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
8659
8659
|
await initSchema(expAdapter);
|
|
8660
8660
|
const { runRunAction: runPipeline } = await import(
|
|
8661
8661
|
/* @vite-ignore */
|
|
8662
|
-
"../run-
|
|
8662
|
+
"../run-D3Idemy0.js"
|
|
8663
8663
|
);
|
|
8664
8664
|
const runStoryFn = async (opts) => {
|
|
8665
8665
|
const exitCode = await runPipeline({
|
|
@@ -13484,7 +13484,22 @@ function renderHuman(result, source) {
|
|
|
13484
13484
|
return ACCEPTANCE_EXIT_ERROR;
|
|
13485
13485
|
}
|
|
13486
13486
|
}
|
|
13487
|
-
function
|
|
13487
|
+
async function listFilesRecursive(root, base = root) {
|
|
13488
|
+
const out = [];
|
|
13489
|
+
let entries;
|
|
13490
|
+
try {
|
|
13491
|
+
entries = await readdir$1(root, { withFileTypes: true });
|
|
13492
|
+
} catch {
|
|
13493
|
+
return out;
|
|
13494
|
+
}
|
|
13495
|
+
for (const entry of entries) {
|
|
13496
|
+
const abs = join$1(root, entry.name);
|
|
13497
|
+
if (entry.isDirectory()) out.push(...await listFilesRecursive(abs, base));
|
|
13498
|
+
else out.push(relative(base, abs));
|
|
13499
|
+
}
|
|
13500
|
+
return out.sort();
|
|
13501
|
+
}
|
|
13502
|
+
function registerAcceptanceCommand(program, version, registry) {
|
|
13488
13503
|
const acceptanceCmd = program.command("acceptance").description("Acceptance Gate — journey registry tools (the missing sprint demo)");
|
|
13489
13504
|
acceptanceCmd.command("validate").description(`Lint ${JOURNEY_REGISTRY_PATH} with actionable, pathed errors`).option("--ref <ref>", "validate the COMMITTED registry at a git ref (trusted-tree read) instead of the working tree").option("--output-format <format>", "Output format: text (default) or json", "text").action(async (opts) => {
|
|
13490
13505
|
const projectRoot = process.cwd();
|
|
@@ -13520,13 +13535,13 @@ function registerAcceptanceCommand(program, version) {
|
|
|
13520
13535
|
});
|
|
13521
13536
|
acceptanceCmd.command("defer <journeyId>").description("Record an operator deferral for a journey — the coverage audit reports it `deferred` instead of unclaimed/unwalked. Writes to the working tree; COMMIT the file for the audit (trusted tree) to honor it.").requiredOption("--reason <text>", "why this journey is deferred (the operator ack is the point)").action(async (journeyId, opts) => {
|
|
13522
13537
|
const projectRoot = process.cwd();
|
|
13523
|
-
const registry = await loadJourneyRegistryFromFile(projectRoot);
|
|
13524
|
-
if (registry.status !== "ok") {
|
|
13525
|
-
process.stdout.write(`cannot defer: journey registry is ${registry.status} at ${JOURNEY_REGISTRY_PATH} — fix it first (substrate acceptance validate)\n`);
|
|
13538
|
+
const registry$1 = await loadJourneyRegistryFromFile(projectRoot);
|
|
13539
|
+
if (registry$1.status !== "ok") {
|
|
13540
|
+
process.stdout.write(`cannot defer: journey registry is ${registry$1.status} at ${JOURNEY_REGISTRY_PATH} — fix it first (substrate acceptance validate)\n`);
|
|
13526
13541
|
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13527
13542
|
}
|
|
13528
|
-
if (!registry.registry.journeys.some((j) => j.id === journeyId)) {
|
|
13529
|
-
process.stdout.write(`cannot defer: journey "${journeyId}" is not in the registry. Known ids: ${registry.registry.journeys.map((j) => j.id).join(", ")}\n`);
|
|
13543
|
+
if (!registry$1.registry.journeys.some((j) => j.id === journeyId)) {
|
|
13544
|
+
process.stdout.write(`cannot defer: journey "${journeyId}" is not in the registry. Known ids: ${registry$1.registry.journeys.map((j) => j.id).join(", ")}\n`);
|
|
13530
13545
|
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13531
13546
|
}
|
|
13532
13547
|
const deferralsPath = join$1(projectRoot, JOURNEY_DEFERRALS_PATH);
|
|
@@ -13561,6 +13576,89 @@ function registerAcceptanceCommand(program, version) {
|
|
|
13561
13576
|
`);
|
|
13562
13577
|
process.exit(ACCEPTANCE_EXIT_SUCCESS);
|
|
13563
13578
|
});
|
|
13579
|
+
acceptanceCmd.command("judge").description("Dispatch the acceptance judge over a rendered-artifacts directory (ad-hoc; retro-fit + canary surface)").requiredOption("--journey <id>", "journey id from the registry").requiredOption("--artifacts-dir <path>", "directory of rendered artifacts to judge").option("--registry-file <path>", `registry YAML (default: ${JOURNEY_REGISTRY_PATH} in cwd)`).option("--agent <id>", "agent adapter id", "claude-code").option("--pack <name>", "methodology pack carrying the judge prompt", "bmad").action(async (opts) => {
|
|
13580
|
+
if (registry === void 0) {
|
|
13581
|
+
process.stdout.write("acceptance judge: adapter registry unavailable in this invocation context\n");
|
|
13582
|
+
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13583
|
+
}
|
|
13584
|
+
const registryPath = opts.registryFile !== void 0 ? resolve$1(opts.registryFile) : join$1(process.cwd(), JOURNEY_REGISTRY_PATH);
|
|
13585
|
+
let registryContent;
|
|
13586
|
+
try {
|
|
13587
|
+
registryContent = await readFile$1(registryPath, "utf-8");
|
|
13588
|
+
} catch (err) {
|
|
13589
|
+
process.stdout.write(`acceptance judge: cannot read registry at ${registryPath}: ${String(err)}\n`);
|
|
13590
|
+
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13591
|
+
return;
|
|
13592
|
+
}
|
|
13593
|
+
const parsed = parseJourneyRegistry(registryContent);
|
|
13594
|
+
if (!parsed.ok) {
|
|
13595
|
+
process.stdout.write(`acceptance judge: registry invalid:\n${parsed.issues.map((i) => ` ${i.path}: ${i.message}`).join("\n")}\n`);
|
|
13596
|
+
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13597
|
+
return;
|
|
13598
|
+
}
|
|
13599
|
+
const journey = parsed.registry.journeys.find((j) => j.id === opts.journey);
|
|
13600
|
+
if (journey === void 0) {
|
|
13601
|
+
process.stdout.write(`acceptance judge: journey "${opts.journey}" not in registry (known: ${parsed.registry.journeys.map((j) => j.id).join(", ")})\n`);
|
|
13602
|
+
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13603
|
+
return;
|
|
13604
|
+
}
|
|
13605
|
+
const artifactsDir = resolve$1(opts.artifactsDir);
|
|
13606
|
+
const artifacts = await listFilesRecursive(artifactsDir);
|
|
13607
|
+
if (artifacts.length === 0) {
|
|
13608
|
+
process.stdout.write(`acceptance judge: no artifacts under ${artifactsDir}\n`);
|
|
13609
|
+
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13610
|
+
return;
|
|
13611
|
+
}
|
|
13612
|
+
const eventBus = createEventBus();
|
|
13613
|
+
const adapter = new InMemoryDatabaseAdapter();
|
|
13614
|
+
const packLoader = createPackLoader();
|
|
13615
|
+
let pack;
|
|
13616
|
+
try {
|
|
13617
|
+
pack = await packLoader.load(join$1(process.cwd(), "packs", opts.pack));
|
|
13618
|
+
} catch (err) {
|
|
13619
|
+
process.stdout.write(`acceptance judge: failed to load pack '${opts.pack}' from ${join$1(process.cwd(), "packs", opts.pack)}: ${String(err)}\n`);
|
|
13620
|
+
process.exit(ACCEPTANCE_EXIT_ERROR);
|
|
13621
|
+
return;
|
|
13622
|
+
}
|
|
13623
|
+
const contextCompiler = createContextCompiler({ db: adapter });
|
|
13624
|
+
const stderrLogger = {
|
|
13625
|
+
debug: () => {},
|
|
13626
|
+
info: (...args) => {
|
|
13627
|
+
process.stderr.write(`[acceptance-judge] ${JSON.stringify(args[0] ?? "")}\n`);
|
|
13628
|
+
},
|
|
13629
|
+
warn: (...args) => {
|
|
13630
|
+
process.stderr.write(`[acceptance-judge][warn] ${JSON.stringify(args[0] ?? "")}\n`);
|
|
13631
|
+
},
|
|
13632
|
+
error: (...args) => {
|
|
13633
|
+
process.stderr.write(`[acceptance-judge][error] ${JSON.stringify(args[0] ?? "")}\n`);
|
|
13634
|
+
}
|
|
13635
|
+
};
|
|
13636
|
+
const dispatcher = createDispatcher({
|
|
13637
|
+
eventBus,
|
|
13638
|
+
adapterRegistry: registry,
|
|
13639
|
+
logger: stderrLogger
|
|
13640
|
+
});
|
|
13641
|
+
const result = await runAcceptanceJudge({
|
|
13642
|
+
db: adapter,
|
|
13643
|
+
pack,
|
|
13644
|
+
contextCompiler,
|
|
13645
|
+
dispatcher,
|
|
13646
|
+
agentId: opts.agent
|
|
13647
|
+
}, {
|
|
13648
|
+
journey,
|
|
13649
|
+
artifactsDir,
|
|
13650
|
+
artifacts
|
|
13651
|
+
});
|
|
13652
|
+
await dispatcher.shutdown();
|
|
13653
|
+
const output = buildJsonOutput("substrate acceptance judge", {
|
|
13654
|
+
journey: journey.id,
|
|
13655
|
+
artifactsDir,
|
|
13656
|
+
artifacts,
|
|
13657
|
+
...result
|
|
13658
|
+
}, version);
|
|
13659
|
+
process.stdout.write(JSON.stringify(output, null, 2) + "\n");
|
|
13660
|
+
process.exit(result.result === "success" ? ACCEPTANCE_EXIT_SUCCESS : ACCEPTANCE_EXIT_ERROR);
|
|
13661
|
+
});
|
|
13564
13662
|
}
|
|
13565
13663
|
|
|
13566
13664
|
//#endregion
|
|
@@ -13622,7 +13720,7 @@ async function createProgram() {
|
|
|
13622
13720
|
registerMonitorCommand(program, version);
|
|
13623
13721
|
registerMergeCommand(program);
|
|
13624
13722
|
registerWorktreesCommand(program, version);
|
|
13625
|
-
registerAcceptanceCommand(program, version);
|
|
13723
|
+
registerAcceptanceCommand(program, version, registry);
|
|
13626
13724
|
registerBrainstormCommand(program, version);
|
|
13627
13725
|
registerExportCommand(program, version);
|
|
13628
13726
|
registerIngestEpicCommand(program);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-
|
|
1
|
+
import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-QOH__JNf.js";
|
|
2
2
|
import "./logger-KeHncl-f.js";
|
|
3
3
|
import "./dist-DeyV_vqU.js";
|
|
4
|
-
import "./manifest-read-
|
|
4
|
+
import "./manifest-read-9xd4yEkp.js";
|
|
5
5
|
import "./work-graph-repository-DZyJv5pV.js";
|
|
6
6
|
import "./decisions-CzSIEeGP.js";
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "./logger-KeHncl-f.js";
|
|
2
2
|
import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-DeyV_vqU.js";
|
|
3
|
-
import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-
|
|
3
|
+
import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-9xd4yEkp.js";
|
|
4
4
|
import { createRequire } from "module";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -1000,4 +1000,4 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
|
|
|
1000
1000
|
|
|
1001
1001
|
//#endregion
|
|
1002
1002
|
export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, FileKvStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, runHealthAction, validateStoryKey };
|
|
1003
|
-
//# sourceMappingURL=health-
|
|
1003
|
+
//# sourceMappingURL=health-QOH__JNf.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLogger } from "./logger-KeHncl-f.js";
|
|
2
|
-
import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-
|
|
2
|
+
import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-9xd4yEkp.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import * as readline from "node:readline";
|
|
@@ -180,4 +180,4 @@ async function runInteractivePrompt(decisionContext) {
|
|
|
180
180
|
|
|
181
181
|
//#endregion
|
|
182
182
|
export { runInteractivePrompt };
|
|
183
|
-
//# sourceMappingURL=interactive-prompt-
|
|
183
|
+
//# sourceMappingURL=interactive-prompt-CT_vtUGk.js.map
|
|
@@ -2907,6 +2907,51 @@ function parseAcceptanceContract(profileYamlContent) {
|
|
|
2907
2907
|
contract: result.data
|
|
2908
2908
|
};
|
|
2909
2909
|
}
|
|
2910
|
+
const PLACEHOLDER_RE = /\{([a-z]+)\}/g;
|
|
2911
|
+
/**
|
|
2912
|
+
* Build the argv for a render command template.
|
|
2913
|
+
*
|
|
2914
|
+
* The template is whitespace-split into tokens BEFORE `{placeholder}`
|
|
2915
|
+
* substitution, and the result is executed with `spawn(argv[0], argv.slice(1))`
|
|
2916
|
+
* — no shell, ever. Substituted values cannot change the token count or
|
|
2917
|
+
* introduce shell metacharacter evaluation by construction.
|
|
2918
|
+
*
|
|
2919
|
+
* Unknown placeholders and placeholders without a value are HARD errors —
|
|
2920
|
+
* a typo'd `{fixtrues}` reaching the product as a literal string is a silent
|
|
2921
|
+
* misconfiguration this gate exists to make loud.
|
|
2922
|
+
*/
|
|
2923
|
+
function buildRenderArgv(template, values) {
|
|
2924
|
+
const tokens = template.trim().split(/\s+/);
|
|
2925
|
+
if (tokens.length === 0 || tokens[0] === "") return {
|
|
2926
|
+
ok: false,
|
|
2927
|
+
error: "render command is empty"
|
|
2928
|
+
};
|
|
2929
|
+
const valueMap = new Map();
|
|
2930
|
+
if (values.fixtures !== void 0) valueMap.set("fixtures", values.fixtures);
|
|
2931
|
+
valueMap.set("artifacts", values.artifacts);
|
|
2932
|
+
if (values.port !== void 0) valueMap.set("port", String(values.port));
|
|
2933
|
+
const argv = [];
|
|
2934
|
+
for (const token of tokens) {
|
|
2935
|
+
let error;
|
|
2936
|
+
const substituted = token.replace(PLACEHOLDER_RE, (_match, name) => {
|
|
2937
|
+
const value = valueMap.get(name);
|
|
2938
|
+
if (value === void 0) {
|
|
2939
|
+
error = `unknown or unavailable placeholder {${name}} in render command (known: ${[...valueMap.keys()].map((k) => `{${k}}`).join(", ")})`;
|
|
2940
|
+
return "";
|
|
2941
|
+
}
|
|
2942
|
+
return value;
|
|
2943
|
+
});
|
|
2944
|
+
if (error !== void 0) return {
|
|
2945
|
+
ok: false,
|
|
2946
|
+
error
|
|
2947
|
+
};
|
|
2948
|
+
argv.push(substituted);
|
|
2949
|
+
}
|
|
2950
|
+
return {
|
|
2951
|
+
ok: true,
|
|
2952
|
+
argv
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2910
2955
|
|
|
2911
2956
|
//#endregion
|
|
2912
2957
|
//#region packages/sdlc/dist/verification/checks/acceptance-spec-check.js
|
|
@@ -5476,6 +5521,232 @@ async function loadJourneyRegistryFromFile(projectRoot) {
|
|
|
5476
5521
|
};
|
|
5477
5522
|
}
|
|
5478
5523
|
|
|
5524
|
+
//#endregion
|
|
5525
|
+
//#region packages/sdlc/dist/acceptance/render.js
|
|
5526
|
+
/** H4.1 mirror (not exported from core's dispatcher): ambient git/location state. */
|
|
5527
|
+
const GIT_STATE_ENV_KEYS = [
|
|
5528
|
+
"PWD",
|
|
5529
|
+
"OLDPWD",
|
|
5530
|
+
"INIT_CWD",
|
|
5531
|
+
"GIT_DIR",
|
|
5532
|
+
"GIT_WORK_TREE",
|
|
5533
|
+
"GIT_INDEX_FILE",
|
|
5534
|
+
"GIT_COMMON_DIR"
|
|
5535
|
+
];
|
|
5536
|
+
const DEFAULT_RENDER_TIMEOUT_MS = 12e4;
|
|
5537
|
+
const STDERR_TAIL_CHARS = 4e3;
|
|
5538
|
+
async function listFilesRecursive(root, base = root) {
|
|
5539
|
+
const out = [];
|
|
5540
|
+
let entries;
|
|
5541
|
+
try {
|
|
5542
|
+
entries = await readdir$1(root, { withFileTypes: true });
|
|
5543
|
+
} catch {
|
|
5544
|
+
return out;
|
|
5545
|
+
}
|
|
5546
|
+
for (const entry of entries) {
|
|
5547
|
+
const abs = join$1(root, entry.name);
|
|
5548
|
+
if (entry.isDirectory()) out.push(...await listFilesRecursive(abs, base));
|
|
5549
|
+
else out.push(relative(base, abs));
|
|
5550
|
+
}
|
|
5551
|
+
return out.sort();
|
|
5552
|
+
}
|
|
5553
|
+
/**
|
|
5554
|
+
* Render one surface per the contract. Returns a structured result — never
|
|
5555
|
+
* throws for render failures (spawn errors, timeouts, non-zero exits all
|
|
5556
|
+
* come back as `status: 'failed'` with forensics attached).
|
|
5557
|
+
*/
|
|
5558
|
+
async function renderSurface(opts) {
|
|
5559
|
+
const { surface, contract, workingDirectory, artifactsDir } = opts;
|
|
5560
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_RENDER_TIMEOUT_MS;
|
|
5561
|
+
const started = Date.now();
|
|
5562
|
+
const fail = (partial) => ({
|
|
5563
|
+
status: "failed",
|
|
5564
|
+
surface,
|
|
5565
|
+
exitCode: null,
|
|
5566
|
+
artifactsDir,
|
|
5567
|
+
artifacts: [],
|
|
5568
|
+
durationMs: Date.now() - started,
|
|
5569
|
+
...partial
|
|
5570
|
+
});
|
|
5571
|
+
const surfaceDef = contract.surfaces[surface];
|
|
5572
|
+
if (surfaceDef === void 0) return fail({ error: `contract declares no ${surface} surface` });
|
|
5573
|
+
const fixturesAbs = contract.fixtures !== void 0 ? resolve$1(workingDirectory, contract.fixtures) : void 0;
|
|
5574
|
+
const argvResult = buildRenderArgv(surfaceDef.render, {
|
|
5575
|
+
...fixturesAbs !== void 0 ? { fixtures: fixturesAbs } : {},
|
|
5576
|
+
artifacts: artifactsDir
|
|
5577
|
+
});
|
|
5578
|
+
if (!argvResult.ok) return fail({ error: argvResult.error });
|
|
5579
|
+
const argv = argvResult.argv;
|
|
5580
|
+
try {
|
|
5581
|
+
await mkdir$1(artifactsDir, { recursive: true });
|
|
5582
|
+
} catch (err) {
|
|
5583
|
+
return fail({
|
|
5584
|
+
argv,
|
|
5585
|
+
error: `could not create artifacts dir: ${String(err)}`
|
|
5586
|
+
});
|
|
5587
|
+
}
|
|
5588
|
+
const env = { ...process.env };
|
|
5589
|
+
for (const key of GIT_STATE_ENV_KEYS) delete env[key];
|
|
5590
|
+
env["GIT_CEILING_DIRECTORIES"] = dirname$1(workingDirectory);
|
|
5591
|
+
const outcome = await new Promise((resolvePromise) => {
|
|
5592
|
+
let stdout = "";
|
|
5593
|
+
let stderr = "";
|
|
5594
|
+
let timedOut = false;
|
|
5595
|
+
const child = spawn(argv[0], argv.slice(1), {
|
|
5596
|
+
cwd: workingDirectory,
|
|
5597
|
+
env,
|
|
5598
|
+
stdio: [
|
|
5599
|
+
"ignore",
|
|
5600
|
+
"pipe",
|
|
5601
|
+
"pipe"
|
|
5602
|
+
],
|
|
5603
|
+
detached: true
|
|
5604
|
+
});
|
|
5605
|
+
const timer = setTimeout(() => {
|
|
5606
|
+
timedOut = true;
|
|
5607
|
+
try {
|
|
5608
|
+
if (child.pid !== void 0) process.kill(-child.pid, "SIGKILL");
|
|
5609
|
+
} catch {
|
|
5610
|
+
child.kill("SIGKILL");
|
|
5611
|
+
}
|
|
5612
|
+
}, timeoutMs);
|
|
5613
|
+
child.stdout?.on("data", (chunk) => {
|
|
5614
|
+
stdout += chunk.toString("utf-8");
|
|
5615
|
+
});
|
|
5616
|
+
child.stderr?.on("data", (chunk) => {
|
|
5617
|
+
stderr += chunk.toString("utf-8");
|
|
5618
|
+
});
|
|
5619
|
+
child.on("error", (err) => {
|
|
5620
|
+
clearTimeout(timer);
|
|
5621
|
+
resolvePromise({
|
|
5622
|
+
code: null,
|
|
5623
|
+
stdout,
|
|
5624
|
+
stderr,
|
|
5625
|
+
spawnError: err.message,
|
|
5626
|
+
timedOut
|
|
5627
|
+
});
|
|
5628
|
+
});
|
|
5629
|
+
child.on("close", (code) => {
|
|
5630
|
+
clearTimeout(timer);
|
|
5631
|
+
resolvePromise({
|
|
5632
|
+
code,
|
|
5633
|
+
stdout,
|
|
5634
|
+
stderr,
|
|
5635
|
+
timedOut
|
|
5636
|
+
});
|
|
5637
|
+
});
|
|
5638
|
+
});
|
|
5639
|
+
if (outcome.spawnError !== void 0) return fail({
|
|
5640
|
+
argv,
|
|
5641
|
+
error: `render command could not be spawned: ${outcome.spawnError}`
|
|
5642
|
+
});
|
|
5643
|
+
if (outcome.timedOut) return fail({
|
|
5644
|
+
argv,
|
|
5645
|
+
error: `render timed out after ${String(timeoutMs)}ms (process group killed)`,
|
|
5646
|
+
stderrTail: outcome.stderr.slice(-STDERR_TAIL_CHARS)
|
|
5647
|
+
});
|
|
5648
|
+
if (outcome.code !== 0) return fail({
|
|
5649
|
+
argv,
|
|
5650
|
+
exitCode: outcome.code,
|
|
5651
|
+
stderrTail: outcome.stderr.slice(-STDERR_TAIL_CHARS)
|
|
5652
|
+
});
|
|
5653
|
+
if (outcome.stdout.length > 0) try {
|
|
5654
|
+
await writeFile$1(join$1(artifactsDir, `${surface}-stdout.txt`), outcome.stdout, "utf-8");
|
|
5655
|
+
} catch {}
|
|
5656
|
+
return {
|
|
5657
|
+
status: "rendered",
|
|
5658
|
+
surface,
|
|
5659
|
+
argv,
|
|
5660
|
+
exitCode: 0,
|
|
5661
|
+
artifactsDir,
|
|
5662
|
+
artifacts: await listFilesRecursive(artifactsDir),
|
|
5663
|
+
durationMs: Date.now() - started
|
|
5664
|
+
};
|
|
5665
|
+
}
|
|
5666
|
+
|
|
5667
|
+
//#endregion
|
|
5668
|
+
//#region packages/sdlc/dist/acceptance/verdict-artifact.js
|
|
5669
|
+
/**
|
|
5670
|
+
* Acceptance Gate — minutes-scale verdict artifact (A2.2).
|
|
5671
|
+
*
|
|
5672
|
+
* One self-contained HTML page per audit: journey × end-state verdict table,
|
|
5673
|
+
* every FAIL/UNREACHABLE anchored to its cited evidence. Target: an operator
|
|
5674
|
+
* verdicts it in under a minute (the morning-review surface for
|
|
5675
|
+
* journey-critical PASS branches).
|
|
5676
|
+
*
|
|
5677
|
+
* SECURITY: evidence excerpts are UNTRUSTED product output rendered into
|
|
5678
|
+
* HTML — everything is escaped; a hostile artifact cannot script the
|
|
5679
|
+
* operator's review page.
|
|
5680
|
+
*/
|
|
5681
|
+
function esc(s) {
|
|
5682
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5683
|
+
}
|
|
5684
|
+
const STATE_COLORS = {
|
|
5685
|
+
"walked-pass": "#1a7f37",
|
|
5686
|
+
"walked-fail": "#cf222e",
|
|
5687
|
+
deferred: "#9a6700",
|
|
5688
|
+
unclaimed: "#cf222e",
|
|
5689
|
+
unwalked: "#9a6700",
|
|
5690
|
+
unknown: "#6e7781"
|
|
5691
|
+
};
|
|
5692
|
+
const VERDICT_COLORS = {
|
|
5693
|
+
PASS: "#1a7f37",
|
|
5694
|
+
FAIL: "#cf222e",
|
|
5695
|
+
UNREACHABLE: "#a40e26"
|
|
5696
|
+
};
|
|
5697
|
+
/** Render the verdict page. Pure — caller writes it wherever it belongs. */
|
|
5698
|
+
function renderVerdictHtml(input) {
|
|
5699
|
+
const rows = input.journeys.map((j) => {
|
|
5700
|
+
const stateColor = STATE_COLORS[j.state] ?? "#6e7781";
|
|
5701
|
+
const verdictRows = j.verdicts.length > 0 ? j.verdicts.map((v) => `
|
|
5702
|
+
<tr>
|
|
5703
|
+
<td><code>${esc(v.end_state_id)}</code></td>
|
|
5704
|
+
<td style="color:${VERDICT_COLORS[v.verdict] ?? "#000"};font-weight:bold">${esc(v.verdict)}${v.verdict === "UNREACHABLE" ? " ⚠ never wired" : ""}</td>
|
|
5705
|
+
<td><code>${esc(v.artifact)}</code></td>
|
|
5706
|
+
<td><pre>${esc(v.excerpt)}</pre>${v.reasoning !== void 0 ? `<div class="why">${esc(v.reasoning)}</div>` : ""}</td>
|
|
5707
|
+
</tr>`).join("") : `
|
|
5708
|
+
<tr><td colspan="4" class="nowalk">not walked — no judge verdicts recorded</td></tr>`;
|
|
5709
|
+
return `
|
|
5710
|
+
<section>
|
|
5711
|
+
<h2>${esc(j.journeyId)} <small>[${esc(j.criticality)}]</small> — ${esc(j.title)}</h2>
|
|
5712
|
+
<p>state: <strong style="color:${stateColor}">${esc(j.state)}</strong>${j.ownerStories.length > 0 ? ` · claimed by ${esc(j.ownerStories.join(", "))}` : " · <strong>NO story claims this journey</strong>"}</p>
|
|
5713
|
+
<table>
|
|
5714
|
+
<thead><tr><th>end-state</th><th>verdict</th><th>artifact</th><th>evidence</th></tr></thead>
|
|
5715
|
+
<tbody>${verdictRows}
|
|
5716
|
+
</tbody>
|
|
5717
|
+
</table>
|
|
5718
|
+
</section>`;
|
|
5719
|
+
}).join("\n");
|
|
5720
|
+
const counts = input.journeys.reduce((acc, j) => {
|
|
5721
|
+
acc[j.state] = (acc[j.state] ?? 0) + 1;
|
|
5722
|
+
return acc;
|
|
5723
|
+
}, {});
|
|
5724
|
+
const summary = Object.entries(counts).map(([state, n]) => `${esc(state)}: ${String(n)}`).join(" · ");
|
|
5725
|
+
return `<!doctype html>
|
|
5726
|
+
<html lang="en">
|
|
5727
|
+
<head>
|
|
5728
|
+
<meta charset="utf-8">
|
|
5729
|
+
<title>Acceptance verdicts — ${esc(input.scope)}</title>
|
|
5730
|
+
<style>
|
|
5731
|
+
body { font-family: system-ui, sans-serif; margin: 2rem auto; max-width: 70rem; padding: 0 1rem; color: #1f2328; }
|
|
5732
|
+
table { border-collapse: collapse; width: 100%; margin-bottom: 1.5rem; }
|
|
5733
|
+
th, td { border: 1px solid #d0d7de; padding: .4rem .6rem; text-align: left; vertical-align: top; }
|
|
5734
|
+
th { background: #f6f8fa; }
|
|
5735
|
+
pre { margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 8rem; overflow-y: auto; background: #f6f8fa; padding: .3rem; }
|
|
5736
|
+
.why { color: #57606a; font-size: .85rem; margin-top: .25rem; }
|
|
5737
|
+
.nowalk { color: #9a6700; font-style: italic; }
|
|
5738
|
+
h1 small, h2 small { color: #57606a; font-weight: normal; }
|
|
5739
|
+
</style>
|
|
5740
|
+
</head>
|
|
5741
|
+
<body>
|
|
5742
|
+
<h1>Acceptance verdicts <small>${esc(input.scope)} · ${esc(input.generatedAt)}</small></h1>
|
|
5743
|
+
<p>${summary}</p>
|
|
5744
|
+
${rows}
|
|
5745
|
+
</body>
|
|
5746
|
+
</html>
|
|
5747
|
+
`;
|
|
5748
|
+
}
|
|
5749
|
+
|
|
5479
5750
|
//#endregion
|
|
5480
5751
|
//#region packages/sdlc/dist/run-model/cli-flags.js
|
|
5481
5752
|
/**
|
|
@@ -6920,5 +7191,5 @@ async function resolveRunManifest(dbRoot, runId) {
|
|
|
6920
7191
|
}
|
|
6921
7192
|
|
|
6922
7193
|
//#endregion
|
|
6923
|
-
export { ACCEPTANCE_CONTRACT_PROFILE_PATH, FindingsInjector, JOURNEY_DEFERRALS_PATH, JOURNEY_REGISTRY_PATH, RunManifest, RuntimeProbeListSchema, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, applyConfigToGraph, computeJourneyCoverage, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, loadAcceptanceContractFromTrustedTree, loadJourneyDeferralsFromTrustedTree, loadJourneyRegistryFromFile, loadJourneyRegistryFromTrustedTree, parseAcceptanceContract, parseJourneyDeferrals, parseRuntimeProbes, parseStoryFrontmatter, readCurrentRunId, renderFindings, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck, runStaleVerificationRecovery, summarizeCoverage };
|
|
6924
|
-
//# sourceMappingURL=manifest-read-
|
|
7194
|
+
export { ACCEPTANCE_CONTRACT_PROFILE_PATH, FindingsInjector, JOURNEY_DEFERRALS_PATH, JOURNEY_REGISTRY_PATH, RunManifest, RuntimeProbeListSchema, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, applyConfigToGraph, computeJourneyCoverage, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, loadAcceptanceContractFromTrustedTree, loadJourneyDeferralsFromTrustedTree, loadJourneyRegistryFromFile, loadJourneyRegistryFromTrustedTree, parseAcceptanceContract, parseJourneyDeferrals, parseJourneyRegistry, parseRuntimeProbes, parseStoryFrontmatter, readCurrentRunId, renderFindings, renderSurface, renderVerdictHtml, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck, runStaleVerificationRecovery, summarizeCoverage };
|
|
7195
|
+
//# sourceMappingURL=manifest-read-9xd4yEkp.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../logger-KeHncl-f.js";
|
|
2
2
|
import "../../dist-DeyV_vqU.js";
|
|
3
|
-
import "../../manifest-read-
|
|
4
|
-
import { runInteractivePrompt } from "../../interactive-prompt-
|
|
3
|
+
import "../../manifest-read-9xd4yEkp.js";
|
|
4
|
+
import { runInteractivePrompt } from "../../interactive-prompt-CT_vtUGk.js";
|
|
5
5
|
|
|
6
6
|
export { runInteractivePrompt };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import "./health-
|
|
1
|
+
import "./health-QOH__JNf.js";
|
|
2
2
|
import "./logger-KeHncl-f.js";
|
|
3
3
|
import "./helpers-CElYrONe.js";
|
|
4
4
|
import "./dist-DeyV_vqU.js";
|
|
5
|
-
import "./manifest-read-
|
|
6
|
-
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-
|
|
5
|
+
import "./manifest-read-9xd4yEkp.js";
|
|
6
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-iZqvCT-f.js";
|
|
7
7
|
import "./routing-DFxoKHDt.js";
|
|
8
8
|
import "./work-graph-repository-DZyJv5pV.js";
|
|
9
9
|
import "./decisions-CzSIEeGP.js";
|
|
10
10
|
import "./decision-router-BAPpON_C.js";
|
|
11
|
-
import "./interactive-prompt-
|
|
11
|
+
import "./interactive-prompt-CT_vtUGk.js";
|
|
12
12
|
import "./recovery-engine-BKGBeBnW.js";
|
|
13
13
|
|
|
14
14
|
export { runRunAction };
|