substrate-ai 0.6.7 → 0.6.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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDatabaseAdapter, createDispatcher, createDoltClient, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, createTelemetryAdvisor, detectCycles, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-
|
|
2
|
+
import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDatabaseAdapter, createDispatcher, createDoltClient, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, createTelemetryAdvisor, detectCycles, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-tB6yG6o8.js";
|
|
3
3
|
import { createLogger } from "../logger-D2fS2ccL.js";
|
|
4
4
|
import { AdapterRegistry } from "../adapter-registry-D2zdMwVu.js";
|
|
5
5
|
import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-DtZW1maj.js";
|
|
@@ -3486,7 +3486,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
3486
3486
|
await initSchema(expAdapter);
|
|
3487
3487
|
const { runRunAction: runPipeline } = await import(
|
|
3488
3488
|
/* @vite-ignore */
|
|
3489
|
-
"../run-
|
|
3489
|
+
"../run-ME16n4N_.js"
|
|
3490
3490
|
);
|
|
3491
3491
|
const runStoryFn = async (opts) => {
|
|
3492
3492
|
const exitCode = await runPipeline({
|
|
@@ -1922,8 +1922,8 @@ function resolveBmadMethodVersion(fromDir = __dirname) {
|
|
|
1922
1922
|
const BMAD_BASELINE_TOKENS_FULL = 56800;
|
|
1923
1923
|
/** BMAD baseline token total for create+dev+review comparison */
|
|
1924
1924
|
const BMAD_BASELINE_TOKENS = 23800;
|
|
1925
|
-
/** Story key pattern:
|
|
1926
|
-
const STORY_KEY_PATTERN$1 = /^[A-Za-z0-9]
|
|
1925
|
+
/** Story key pattern: e.g. "10-1", "1-1a", "NEW-26", "E6" */
|
|
1926
|
+
const STORY_KEY_PATTERN$1 = /^[A-Za-z0-9]+(-[A-Za-z0-9]+)?$/;
|
|
1927
1927
|
/**
|
|
1928
1928
|
* Top-level keys in .claude/settings.json that substrate owns.
|
|
1929
1929
|
* On init, these are set/updated unconditionally.
|
|
@@ -7266,6 +7266,30 @@ function detectPackageManager(projectRoot) {
|
|
|
7266
7266
|
/** Default timeout in milliseconds for the build verification gate */
|
|
7267
7267
|
const DEFAULT_VERIFY_TIMEOUT_MS = 6e4;
|
|
7268
7268
|
/**
|
|
7269
|
+
* Derive turbo --filter flags from changed file paths.
|
|
7270
|
+
*
|
|
7271
|
+
* Maps file paths like "apps/web/src/foo.ts" or "packages/db/src/bar.ts"
|
|
7272
|
+
* to turbo package filters like "--filter=web" or "--filter=@nextgen/db".
|
|
7273
|
+
* Falls back to reading package.json in each directory to get the real
|
|
7274
|
+
* package name. Returns empty array if no turbo-scoped packages detected.
|
|
7275
|
+
*/
|
|
7276
|
+
function deriveTurboFilters(changedFiles, projectRoot) {
|
|
7277
|
+
const packageDirs = new Set();
|
|
7278
|
+
for (const file of changedFiles) {
|
|
7279
|
+
const match$1 = file.match(/^((?:apps|packages)\/[^/]+)\//);
|
|
7280
|
+
if (match$1) packageDirs.add(match$1[1]);
|
|
7281
|
+
}
|
|
7282
|
+
if (packageDirs.size === 0) return [];
|
|
7283
|
+
const filters = [];
|
|
7284
|
+
for (const dir of packageDirs) try {
|
|
7285
|
+
const pkgJsonPath = join$1(projectRoot, dir, "package.json");
|
|
7286
|
+
const raw = readFileSync$1(pkgJsonPath, "utf-8");
|
|
7287
|
+
const pkg = JSON.parse(raw);
|
|
7288
|
+
if (pkg.name) filters.push(`--filter=${pkg.name}`);
|
|
7289
|
+
} catch {}
|
|
7290
|
+
return filters;
|
|
7291
|
+
}
|
|
7292
|
+
/**
|
|
7269
7293
|
* Run the build verification gate synchronously.
|
|
7270
7294
|
*
|
|
7271
7295
|
* Executes the configured verifyCommand (default: "npm run build") in the
|
|
@@ -7273,12 +7297,16 @@ const DEFAULT_VERIFY_TIMEOUT_MS = 6e4;
|
|
|
7273
7297
|
* returns { status: 'passed' }. On failure or timeout, returns a structured
|
|
7274
7298
|
* result with status, exitCode, output, and reason.
|
|
7275
7299
|
*
|
|
7300
|
+
* When changedFiles is provided and the command is a turbo build, the build
|
|
7301
|
+
* is scoped to only the affected packages via --filter flags. This prevents
|
|
7302
|
+
* cascading failures from other concurrent stories' modifications.
|
|
7303
|
+
*
|
|
7276
7304
|
* AC4/5: reads verifyCommand from options (or defaults to 'npm run build').
|
|
7277
7305
|
* AC6: if verifyCommand is empty string or false, returns { status: 'skipped' }.
|
|
7278
7306
|
* AC8: timeout is configurable via verifyTimeoutMs (default 60 s).
|
|
7279
7307
|
*/
|
|
7280
7308
|
function runBuildVerification(options) {
|
|
7281
|
-
const { verifyCommand, verifyTimeoutMs, projectRoot } = options;
|
|
7309
|
+
const { verifyCommand, verifyTimeoutMs, projectRoot, changedFiles } = options;
|
|
7282
7310
|
let cmd;
|
|
7283
7311
|
if (verifyCommand === void 0) {
|
|
7284
7312
|
const detection = detectPackageManager(projectRoot);
|
|
@@ -7290,6 +7318,16 @@ function runBuildVerification(options) {
|
|
|
7290
7318
|
cmd = detection.command;
|
|
7291
7319
|
} else cmd = verifyCommand;
|
|
7292
7320
|
if (!cmd) return { status: "skipped" };
|
|
7321
|
+
if (changedFiles && changedFiles.length > 0 && typeof cmd === "string" && cmd.includes("turbo")) {
|
|
7322
|
+
const filters = deriveTurboFilters(changedFiles, projectRoot);
|
|
7323
|
+
if (filters.length > 0) {
|
|
7324
|
+
cmd = `${cmd} ${filters.join(" ")}`;
|
|
7325
|
+
logger$23.info({
|
|
7326
|
+
filters,
|
|
7327
|
+
originalCmd: options.verifyCommand ?? "(auto-detected)"
|
|
7328
|
+
}, "Build verification: scoped turbo build to affected packages");
|
|
7329
|
+
}
|
|
7330
|
+
}
|
|
7293
7331
|
const timeoutMs = verifyTimeoutMs ?? DEFAULT_VERIFY_TIMEOUT_MS;
|
|
7294
7332
|
try {
|
|
7295
7333
|
const stdout = execSync(cmd, {
|
|
@@ -7805,12 +7843,12 @@ var FileStateStore = class {
|
|
|
7805
7843
|
//#region src/modules/state/dolt-store.ts
|
|
7806
7844
|
const log = createLogger("modules:state:dolt");
|
|
7807
7845
|
/**
|
|
7808
|
-
* Validate that a story key matches the expected pattern (e.g. "26-7", "1-1a", "NEW-26").
|
|
7846
|
+
* Validate that a story key matches the expected pattern (e.g. "26-7", "1-1a", "NEW-26", "E6").
|
|
7809
7847
|
* Prevents SQL injection via string-interpolated identifiers.
|
|
7810
7848
|
*/
|
|
7811
|
-
const STORY_KEY_PATTERN = /^[A-Za-z0-9]
|
|
7849
|
+
const STORY_KEY_PATTERN = /^[A-Za-z0-9]+(-[A-Za-z0-9]+)?$/;
|
|
7812
7850
|
function assertValidStoryKey(storyKey) {
|
|
7813
|
-
if (!STORY_KEY_PATTERN.test(storyKey)) throw new DoltQueryError("assertValidStoryKey", `Invalid story key: '${storyKey}'. Must match pattern <
|
|
7851
|
+
if (!STORY_KEY_PATTERN.test(storyKey)) throw new DoltQueryError("assertValidStoryKey", `Invalid story key: '${storyKey}'. Must match pattern <key> or <epic>-<story> (e.g. "E6", "10-1", "1-1a", "NEW-26").`);
|
|
7814
7852
|
}
|
|
7815
7853
|
/**
|
|
7816
7854
|
* Dolt-backed implementation of the StateStore interface.
|
|
@@ -17179,7 +17217,8 @@ function createImplementationOrchestrator(deps) {
|
|
|
17179
17217
|
const buildVerifyResult = config.skipBuildVerify === true ? { status: "skipped" } : runBuildVerification({
|
|
17180
17218
|
verifyCommand: pack.manifest.verifyCommand,
|
|
17181
17219
|
verifyTimeoutMs: pack.manifest.verifyTimeoutMs,
|
|
17182
|
-
projectRoot: projectRoot ?? process.cwd()
|
|
17220
|
+
projectRoot: projectRoot ?? process.cwd(),
|
|
17221
|
+
changedFiles: gitDiffFiles
|
|
17183
17222
|
});
|
|
17184
17223
|
if (buildVerifyResult.status === "passed") {
|
|
17185
17224
|
eventBus.emit("story:build-verification-passed", { storyKey });
|
|
@@ -17211,7 +17250,8 @@ function createImplementationOrchestrator(deps) {
|
|
|
17211
17250
|
const retryResult = runBuildVerification({
|
|
17212
17251
|
verifyCommand: pack.manifest.verifyCommand,
|
|
17213
17252
|
verifyTimeoutMs: pack.manifest.verifyTimeoutMs,
|
|
17214
|
-
projectRoot: resolvedRoot
|
|
17253
|
+
projectRoot: resolvedRoot,
|
|
17254
|
+
changedFiles: gitDiffFiles
|
|
17215
17255
|
});
|
|
17216
17256
|
if (retryResult.status === "passed") {
|
|
17217
17257
|
retryPassed = true;
|
|
@@ -17993,24 +18033,20 @@ function createImplementationOrchestrator(deps) {
|
|
|
17993
18033
|
*/
|
|
17994
18034
|
async function runWithConcurrency(groups, maxConcurrency) {
|
|
17995
18035
|
const queue = [...groups];
|
|
17996
|
-
const running =
|
|
18036
|
+
const running = new Set();
|
|
17997
18037
|
function enqueue() {
|
|
17998
18038
|
const group = queue.shift();
|
|
17999
18039
|
if (group === void 0) return;
|
|
18000
18040
|
const p = processConflictGroup(group).finally(() => {
|
|
18001
|
-
|
|
18002
|
-
|
|
18041
|
+
running.delete(p);
|
|
18042
|
+
while (running.size < maxConcurrency && queue.length > 0) enqueue();
|
|
18003
18043
|
});
|
|
18004
|
-
running.
|
|
18005
|
-
if (running.
|
|
18044
|
+
running.add(p);
|
|
18045
|
+
if (running.size > _maxConcurrentActual) _maxConcurrentActual = running.size;
|
|
18006
18046
|
}
|
|
18007
18047
|
const initial = Math.min(maxConcurrency, queue.length);
|
|
18008
18048
|
for (let i = 0; i < initial; i++) enqueue();
|
|
18009
|
-
while (
|
|
18010
|
-
await Promise.race(running);
|
|
18011
|
-
enqueue();
|
|
18012
|
-
}
|
|
18013
|
-
await Promise.all(running);
|
|
18049
|
+
while (running.size > 0) await Promise.race(running);
|
|
18014
18050
|
}
|
|
18015
18051
|
async function run(storyKeys) {
|
|
18016
18052
|
if (_state === "RUNNING" || _state === "PAUSED") {
|
|
@@ -22667,7 +22703,7 @@ async function runRunAction(options) {
|
|
|
22667
22703
|
if (storiesArg !== void 0 && storiesArg !== "") {
|
|
22668
22704
|
parsedStoryKeys = storiesArg.split(",").map((k) => k.trim()).filter((k) => k.length > 0);
|
|
22669
22705
|
for (const key of parsedStoryKeys) if (!validateStoryKey(key)) {
|
|
22670
|
-
const errorMsg = `Story key '${key}' is not a valid format. Expected: <epic>-<story> (e.g., 10-1, 1-1a, NEW-26)`;
|
|
22706
|
+
const errorMsg = `Story key '${key}' is not a valid format. Expected: <key> or <epic>-<story> (e.g., E6, 10-1, 1-1a, NEW-26)`;
|
|
22671
22707
|
if (outputFormat === "json") process.stdout.write(formatOutput(null, "json", false, errorMsg) + "\n");
|
|
22672
22708
|
else process.stderr.write(`Error: ${errorMsg}\n`);
|
|
22673
22709
|
return 1;
|
|
@@ -23808,4 +23844,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
23808
23844
|
|
|
23809
23845
|
//#endregion
|
|
23810
23846
|
export { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDatabaseAdapter, createDispatcher, createDoltClient, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, createTelemetryAdvisor, detectCycles, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
|
|
23811
|
-
//# sourceMappingURL=run-
|
|
23847
|
+
//# sourceMappingURL=run-tB6yG6o8.js.map
|