substrate-ai 0.2.30 → 0.2.33
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 +8 -8
- package/dist/{experimenter-f_Y1rreV.js → experimenter-Br1-vzYv.js} +2 -2
- package/dist/index.d.ts +51 -1
- package/dist/{operational-CnMlvWqc.js → operational-Bovj4fS-.js} +16 -2
- package/dist/{run-KBcR3Jpi.js → run-Cd7sfXzo.js} +2 -2
- package/dist/{run-Ajt187oE.js → run-XNRFAHEx.js} +598 -80
- package/package.json +5 -2
- package/packs/bmad/manifest.yaml +2 -0
- package/packs/bmad/prompts/code-review.md +7 -2
- package/packs/bmad/prompts/create-story.md +20 -0
- package/packs/bmad/prompts/test-plan.md +10 -4
package/dist/cli/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createConfigSystem, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-
|
|
2
|
+
import { DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createConfigSystem, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-XNRFAHEx.js";
|
|
3
3
|
import { createLogger } from "../logger-D2fS2ccL.js";
|
|
4
4
|
import { AdapterRegistry } from "../adapter-registry-PsWhP_1Q.js";
|
|
5
5
|
import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-DSi8KhQC.js";
|
|
6
6
|
import { ConfigError, createEventBus } from "../helpers-RL22dYtn.js";
|
|
7
7
|
import { addTokenUsage, createDecision, createPipelineRun, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestRun, getTokenUsageSummary, listRequirements, updatePipelineRun } from "../decisions-Dq4cAA2L.js";
|
|
8
|
-
import { ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, OPERATIONAL_FINDING, STORY_METRICS, aggregateTokenUsageForRun, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline } from "../operational-
|
|
8
|
+
import { ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, OPERATIONAL_FINDING, STORY_METRICS, aggregateTokenUsageForRun, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline } from "../operational-Bovj4fS-.js";
|
|
9
9
|
import { abortMerge, createWorktree, getConflictingFiles, getMergedFiles, getOrphanedWorktrees, performMerge, removeBranch, removeWorktree, simulateMerge, verifyGitVersion } from "../git-utils-CtmrZrHS.js";
|
|
10
10
|
import "../version-manager-impl-CizNmmLT.js";
|
|
11
11
|
import { registerUpgradeCommand } from "../upgrade-Cvwtnwl4.js";
|
|
@@ -1336,8 +1336,8 @@ async function runStatusAction(options) {
|
|
|
1336
1336
|
});
|
|
1337
1337
|
let pipelineWallClockMs = 0;
|
|
1338
1338
|
try {
|
|
1339
|
-
const createdAt = parseDbTimestampAsUtc(run.created_at);
|
|
1340
|
-
const endTimestamp = run.status === "running" ? new Date() : parseDbTimestampAsUtc(run.updated_at);
|
|
1339
|
+
const createdAt = parseDbTimestampAsUtc(run.created_at ?? "");
|
|
1340
|
+
const endTimestamp = run.status === "running" ? new Date() : parseDbTimestampAsUtc(run.updated_at ?? "");
|
|
1341
1341
|
pipelineWallClockMs = Math.max(0, endTimestamp.getTime() - createdAt.getTime());
|
|
1342
1342
|
} catch {}
|
|
1343
1343
|
const totalReviewCycles = storyMetricsRows.reduce((sum, r) => sum + (r.review_cycles ?? 0), 0);
|
|
@@ -2158,7 +2158,7 @@ function defaultSupervisorDeps() {
|
|
|
2158
2158
|
const dbPath = join(dbRoot, ".substrate", "substrate.db");
|
|
2159
2159
|
cachedDbWrapper = new DatabaseWrapper(dbPath);
|
|
2160
2160
|
}
|
|
2161
|
-
incrementRunRestarts(cachedDbWrapper.
|
|
2161
|
+
incrementRunRestarts(cachedDbWrapper.db, runId);
|
|
2162
2162
|
} catch {
|
|
2163
2163
|
try {
|
|
2164
2164
|
cachedDbWrapper?.close();
|
|
@@ -2571,7 +2571,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
2571
2571
|
try {
|
|
2572
2572
|
const { createExperimenter } = await import(
|
|
2573
2573
|
/* @vite-ignore */
|
|
2574
|
-
"../experimenter-
|
|
2574
|
+
"../experimenter-Br1-vzYv.js"
|
|
2575
2575
|
);
|
|
2576
2576
|
const { getLatestRun: getLatest } = await import(
|
|
2577
2577
|
/* @vite-ignore */
|
|
@@ -2585,7 +2585,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
2585
2585
|
const expDb = expDbWrapper.db;
|
|
2586
2586
|
const { runRunAction: runPipeline } = await import(
|
|
2587
2587
|
/* @vite-ignore */
|
|
2588
|
-
"../run-
|
|
2588
|
+
"../run-Cd7sfXzo.js"
|
|
2589
2589
|
);
|
|
2590
2590
|
const runStoryFn = async (opts) => {
|
|
2591
2591
|
const exitCode = await runPipeline({
|
|
@@ -2596,7 +2596,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
2596
2596
|
projectRoot: opts.projectRoot
|
|
2597
2597
|
});
|
|
2598
2598
|
const latestRun = getLatest(expDb);
|
|
2599
|
-
const newRunId = latestRun?.
|
|
2599
|
+
const newRunId = latestRun?.id ?? `experiment-${Date.now()}`;
|
|
2600
2600
|
return {
|
|
2601
2601
|
runId: newRunId,
|
|
2602
2602
|
exitCode
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./logger-D2fS2ccL.js";
|
|
2
2
|
import { createDecision } from "./decisions-Dq4cAA2L.js";
|
|
3
|
-
import { EXPERIMENT_RESULT, getRunMetrics, getStoryMetricsForRun } from "./operational-
|
|
3
|
+
import { EXPERIMENT_RESULT, getRunMetrics, getStoryMetricsForRun } from "./operational-Bovj4fS-.js";
|
|
4
4
|
import { spawnGit } from "./git-utils-CtmrZrHS.js";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { join } from "node:path";
|
|
@@ -500,4 +500,4 @@ function createExperimenter(config, deps) {
|
|
|
500
500
|
|
|
501
501
|
//#endregion
|
|
502
502
|
export { createExperimenter };
|
|
503
|
-
//# sourceMappingURL=experimenter-
|
|
503
|
+
//# sourceMappingURL=experimenter-Br1-vzYv.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,19 @@ interface StoryZeroDiffEscalationEvent {
|
|
|
185
185
|
/** Always "zero-diff-on-complete" */
|
|
186
186
|
reason: string;
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Emitted when the pre-flight build check fails before any story is dispatched (Story 25-2).
|
|
190
|
+
* Pipeline aborts immediately — no stories are processed.
|
|
191
|
+
*/
|
|
192
|
+
interface PipelinePreFlightFailureEvent {
|
|
193
|
+
type: 'pipeline:pre-flight-failure';
|
|
194
|
+
/** ISO-8601 timestamp generated at emit time */
|
|
195
|
+
ts: string;
|
|
196
|
+
/** Exit code from the build command (-1 for timeout) */
|
|
197
|
+
exitCode: number;
|
|
198
|
+
/** Combined stdout+stderr output, truncated to 2000 chars */
|
|
199
|
+
output: string;
|
|
200
|
+
}
|
|
188
201
|
/**
|
|
189
202
|
* Emitted when the build verification command exits with a non-zero code
|
|
190
203
|
* or times out, before code-review is dispatched (Story 24-2).
|
|
@@ -501,6 +514,26 @@ interface SupervisorExperimentErrorEvent {
|
|
|
501
514
|
/** Error message describing why the experiment failed */
|
|
502
515
|
error: string;
|
|
503
516
|
}
|
|
517
|
+
/**
|
|
518
|
+
* Emitted when post-sprint contract verification finds a mismatch between
|
|
519
|
+
* declared export/import contracts (Story 25-6).
|
|
520
|
+
*
|
|
521
|
+
* Failures are warnings only — stories already completed. The user should
|
|
522
|
+
* inspect the mismatch and fix manually.
|
|
523
|
+
*/
|
|
524
|
+
interface PipelineContractMismatchEvent {
|
|
525
|
+
type: 'pipeline:contract-mismatch';
|
|
526
|
+
/** ISO-8601 timestamp generated at emit time */
|
|
527
|
+
ts: string;
|
|
528
|
+
/** Story key that declared the export for this contract */
|
|
529
|
+
exporter: string;
|
|
530
|
+
/** Story key that declared the import for this contract (null if no importer found) */
|
|
531
|
+
importer: string | null;
|
|
532
|
+
/** TypeScript interface or Zod schema name (e.g., "JudgeResult") */
|
|
533
|
+
contractName: string;
|
|
534
|
+
/** Human-readable description of the mismatch (e.g., missing file, type error) */
|
|
535
|
+
mismatchDescription: string;
|
|
536
|
+
}
|
|
504
537
|
/**
|
|
505
538
|
* Discriminated union of all pipeline event types.
|
|
506
539
|
*
|
|
@@ -513,7 +546,7 @@ interface SupervisorExperimentErrorEvent {
|
|
|
513
546
|
* }
|
|
514
547
|
* ```
|
|
515
548
|
*/
|
|
516
|
-
type PipelineEvent = PipelineStartEvent | PipelineCompleteEvent | StoryPhaseEvent | StoryDoneEvent | StoryEscalationEvent | StoryWarnEvent | StoryLogEvent | PipelineHeartbeatEvent | StoryStallEvent | StoryZeroDiffEscalationEvent | StoryBuildVerificationFailedEvent | StoryBuildVerificationPassedEvent | StoryInterfaceChangeWarningEvent | StoryMetricsEvent | SupervisorPollEvent | SupervisorKillEvent | SupervisorRestartEvent | SupervisorAbortEvent | SupervisorSummaryEvent | SupervisorAnalysisCompleteEvent | SupervisorAnalysisErrorEvent | SupervisorExperimentStartEvent | SupervisorExperimentSkipEvent | SupervisorExperimentRecommendationsEvent | SupervisorExperimentCompleteEvent | SupervisorExperimentErrorEvent; //#endregion
|
|
549
|
+
type PipelineEvent = PipelineStartEvent | PipelineCompleteEvent | PipelinePreFlightFailureEvent | PipelineContractMismatchEvent | StoryPhaseEvent | StoryDoneEvent | StoryEscalationEvent | StoryWarnEvent | StoryLogEvent | PipelineHeartbeatEvent | StoryStallEvent | StoryZeroDiffEscalationEvent | StoryBuildVerificationFailedEvent | StoryBuildVerificationPassedEvent | StoryInterfaceChangeWarningEvent | StoryMetricsEvent | SupervisorPollEvent | SupervisorKillEvent | SupervisorRestartEvent | SupervisorAbortEvent | SupervisorSummaryEvent | SupervisorAnalysisCompleteEvent | SupervisorAnalysisErrorEvent | SupervisorExperimentStartEvent | SupervisorExperimentSkipEvent | SupervisorExperimentRecommendationsEvent | SupervisorExperimentCompleteEvent | SupervisorExperimentErrorEvent; //#endregion
|
|
517
550
|
//#region src/core/errors.d.ts
|
|
518
551
|
|
|
519
552
|
/**
|
|
@@ -1160,6 +1193,23 @@ interface OrchestratorEvents {
|
|
|
1160
1193
|
affected_items: string[];
|
|
1161
1194
|
}>;
|
|
1162
1195
|
};
|
|
1196
|
+
/** Pre-flight build check failed before any stories were dispatched */
|
|
1197
|
+
'pipeline:pre-flight-failure': {
|
|
1198
|
+
exitCode: number;
|
|
1199
|
+
/** Build output (stdout+stderr), truncated to 2000 chars */
|
|
1200
|
+
output: string;
|
|
1201
|
+
};
|
|
1202
|
+
/** Contract verification found a mismatch between declared export/import contracts */
|
|
1203
|
+
'pipeline:contract-mismatch': {
|
|
1204
|
+
/** Story key that declared the export for this contract */
|
|
1205
|
+
exporter: string;
|
|
1206
|
+
/** Story key that declared the import for this contract (null if no importer found) */
|
|
1207
|
+
importer: string | null;
|
|
1208
|
+
/** TypeScript interface or Zod schema name (e.g., "JudgeResult") */
|
|
1209
|
+
contractName: string;
|
|
1210
|
+
/** Human-readable description of the mismatch */
|
|
1211
|
+
mismatchDescription: string;
|
|
1212
|
+
};
|
|
1163
1213
|
/** Build verification command failed with non-zero exit or timeout */
|
|
1164
1214
|
'story:build-verification-failed': {
|
|
1165
1215
|
storyKey: string;
|
|
@@ -339,7 +339,21 @@ const TEST_EXPANSION_FINDING = "test-expansion-finding";
|
|
|
339
339
|
* ```
|
|
340
340
|
*/
|
|
341
341
|
const TEST_PLAN = "test-plan";
|
|
342
|
+
/**
|
|
343
|
+
* Category for advisory notes persisted when a code review returns LGTM_WITH_NOTES.
|
|
344
|
+
*
|
|
345
|
+
* Key schema: "{storyKey}:{runId}"
|
|
346
|
+
*
|
|
347
|
+
* Value shape:
|
|
348
|
+
* ```json
|
|
349
|
+
* {
|
|
350
|
+
* "storyKey": "25-3",
|
|
351
|
+
* "notes": "Consider extracting the helper into a shared module for reuse."
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
const ADVISORY_NOTES = "advisory-notes";
|
|
342
356
|
|
|
343
357
|
//#endregion
|
|
344
|
-
export { ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, OPERATIONAL_FINDING, STORY_METRICS, STORY_OUTCOME, TEST_EXPANSION_FINDING, TEST_PLAN, aggregateTokenUsageForRun, aggregateTokenUsageForStory, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline, writeRunMetrics, writeStoryMetrics };
|
|
345
|
-
//# sourceMappingURL=operational-
|
|
358
|
+
export { ADVISORY_NOTES, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, OPERATIONAL_FINDING, STORY_METRICS, STORY_OUTCOME, TEST_EXPANSION_FINDING, TEST_PLAN, aggregateTokenUsageForRun, aggregateTokenUsageForStory, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline, writeRunMetrics, writeStoryMetrics };
|
|
359
|
+
//# sourceMappingURL=operational-Bovj4fS-.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { registerRunCommand, runRunAction } from "./run-
|
|
1
|
+
import { registerRunCommand, runRunAction } from "./run-XNRFAHEx.js";
|
|
2
2
|
import "./logger-D2fS2ccL.js";
|
|
3
3
|
import "./config-migrator-DSi8KhQC.js";
|
|
4
4
|
import "./helpers-RL22dYtn.js";
|
|
5
5
|
import "./decisions-Dq4cAA2L.js";
|
|
6
|
-
import "./operational-
|
|
6
|
+
import "./operational-Bovj4fS-.js";
|
|
7
7
|
|
|
8
8
|
export { runRunAction };
|