substrate-ai 0.19.45 → 0.19.47

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,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest } from "../health-BbsWlD8o.js";
2
+ import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest } from "../health-DrZiqv4h.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, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-sNh9XQ6V.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-BekA_Ns3.js";
7
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-DI5SzKf5.js";
8
8
  import "../errors-RupuC-ES.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
@@ -1282,6 +1282,88 @@ async function detectNodeBuildTool(dir) {
1282
1282
  installCommand: "npm install <package>"
1283
1283
  };
1284
1284
  }
1285
+ const TASK_RUNNER_MARKERS = [
1286
+ {
1287
+ file: "justfile",
1288
+ runner: "just",
1289
+ listCommand: ["just", "--list"]
1290
+ },
1291
+ {
1292
+ file: "Justfile",
1293
+ runner: "just",
1294
+ listCommand: ["just", "--list"]
1295
+ },
1296
+ {
1297
+ file: "Makefile",
1298
+ runner: "make",
1299
+ listCommand: []
1300
+ },
1301
+ {
1302
+ file: "Taskfile.yml",
1303
+ runner: "task",
1304
+ listCommand: ["task", "--list"]
1305
+ }
1306
+ ];
1307
+ /** Known build-related target names, in preference order. */
1308
+ const BUILD_TARGETS = [
1309
+ "build-skip-tests",
1310
+ "build-no-tests",
1311
+ "compile",
1312
+ "build"
1313
+ ];
1314
+ /** Known unit-test target names, in preference order. */
1315
+ const TEST_TARGETS = [
1316
+ "test-unit",
1317
+ "test-fast",
1318
+ "test"
1319
+ ];
1320
+ /**
1321
+ * Detect a task runner (justfile, Makefile, Taskfile.yml) in the given directory
1322
+ * and extract build/test command overrides from its available targets.
1323
+ *
1324
+ * Returns overrides for buildCommand and testCommand, or null if no task runner found.
1325
+ */
1326
+ async function detectTaskRunner(dir) {
1327
+ for (const marker of TASK_RUNNER_MARKERS) {
1328
+ if (!await fileExists(path$1.join(dir, marker.file))) continue;
1329
+ if (marker.runner === "just") return detectJustTargets(dir, marker.file);
1330
+ if (marker.runner === "make") return detectMakeTargets(dir);
1331
+ return { runner: "task" };
1332
+ }
1333
+ return null;
1334
+ }
1335
+ async function detectJustTargets(dir, filename) {
1336
+ const result = { runner: "just" };
1337
+ try {
1338
+ const content = await fs.readFile(path$1.join(dir, filename), "utf-8");
1339
+ const recipes = content.split("\n").map((line) => line.match(/^([a-zA-Z_][\w-]*)\s*(?:[:=]|$)/)).filter((m) => m !== null).map((m) => m[1]);
1340
+ for (const target of BUILD_TARGETS) if (recipes.includes(target)) {
1341
+ result.buildCommand = `just ${target}`;
1342
+ break;
1343
+ }
1344
+ for (const target of TEST_TARGETS) if (recipes.includes(target)) {
1345
+ result.testCommand = `just ${target}`;
1346
+ break;
1347
+ }
1348
+ } catch {}
1349
+ return result;
1350
+ }
1351
+ async function detectMakeTargets(dir) {
1352
+ const result = { runner: "make" };
1353
+ try {
1354
+ const content = await fs.readFile(path$1.join(dir, "Makefile"), "utf-8");
1355
+ const targets = content.split("\n").map((line) => line.match(/^([a-zA-Z_][\w-]*):/)).filter((m) => m !== null).map((m) => m[1]);
1356
+ for (const target of BUILD_TARGETS) if (targets.includes(target)) {
1357
+ result.buildCommand = `make ${target}`;
1358
+ break;
1359
+ }
1360
+ for (const target of TEST_TARGETS) if (targets.includes(target)) {
1361
+ result.testCommand = `make ${target}`;
1362
+ break;
1363
+ }
1364
+ } catch {}
1365
+ return result;
1366
+ }
1285
1367
  /**
1286
1368
  * Detects the language and build tool for a single project directory.
1287
1369
  *
@@ -1293,12 +1375,13 @@ async function detectNodeBuildTool(dir) {
1293
1375
  * @returns A `PackageEntry` describing the detected stack.
1294
1376
  */
1295
1377
  async function detectSingleProjectStack(dir) {
1378
+ let baseEntry;
1296
1379
  for (const marker of STACK_MARKERS) {
1297
1380
  const markerPath = path$1.join(dir, marker.file);
1298
1381
  if (!await fileExists(markerPath)) continue;
1299
1382
  if (marker.file === "package.json") {
1300
1383
  const nodeInfo = await detectNodeBuildTool(dir);
1301
- return {
1384
+ baseEntry = {
1302
1385
  path: dir,
1303
1386
  language: "typescript",
1304
1387
  buildTool: nodeInfo.buildTool,
@@ -1306,20 +1389,24 @@ async function detectSingleProjectStack(dir) {
1306
1389
  testCommand: nodeInfo.testCommand,
1307
1390
  installCommand: nodeInfo.installCommand
1308
1391
  };
1392
+ break;
1309
1393
  }
1310
1394
  if (marker.file === "pyproject.toml") {
1311
1395
  const hasPoetry = await fileExists(path$1.join(dir, "poetry.lock"));
1312
- if (hasPoetry) return {
1313
- path: dir,
1314
- language: "python",
1315
- buildTool: "poetry",
1316
- buildCommand: "poetry build",
1317
- testCommand: "poetry run pytest",
1318
- installCommand: "poetry add <package>"
1319
- };
1396
+ if (hasPoetry) {
1397
+ baseEntry = {
1398
+ path: dir,
1399
+ language: "python",
1400
+ buildTool: "poetry",
1401
+ buildCommand: "poetry build",
1402
+ testCommand: "poetry run pytest",
1403
+ installCommand: "poetry add <package>"
1404
+ };
1405
+ break;
1406
+ }
1320
1407
  const hasVenv = await fileExists(path$1.join(dir, ".venv", "bin", "activate"));
1321
1408
  const venvPrefix = hasVenv ? "source .venv/bin/activate && " : "";
1322
- return {
1409
+ baseEntry = {
1323
1410
  path: dir,
1324
1411
  language: "python",
1325
1412
  buildTool: "pip",
@@ -1327,8 +1414,9 @@ async function detectSingleProjectStack(dir) {
1327
1414
  testCommand: `${venvPrefix}pytest`,
1328
1415
  installCommand: `${venvPrefix}pip install <package>`
1329
1416
  };
1417
+ break;
1330
1418
  }
1331
- return {
1419
+ baseEntry = {
1332
1420
  path: dir,
1333
1421
  language: marker.language,
1334
1422
  buildTool: marker.buildTool,
@@ -1336,8 +1424,9 @@ async function detectSingleProjectStack(dir) {
1336
1424
  testCommand: marker.testCommand,
1337
1425
  installCommand: marker.installCommand
1338
1426
  };
1427
+ break;
1339
1428
  }
1340
- return {
1429
+ if (!baseEntry) baseEntry = {
1341
1430
  path: dir,
1342
1431
  language: "typescript",
1343
1432
  buildTool: "npm",
@@ -1345,6 +1434,21 @@ async function detectSingleProjectStack(dir) {
1345
1434
  testCommand: "npm test",
1346
1435
  installCommand: "npm install <package>"
1347
1436
  };
1437
+ return applyTaskRunnerOverlay(dir, baseEntry);
1438
+ }
1439
+ /**
1440
+ * Apply task runner overlay to a detected PackageEntry.
1441
+ * If a justfile/Makefile/Taskfile.yml exists with matching targets,
1442
+ * override the buildCommand and testCommand with task runner commands.
1443
+ */
1444
+ async function applyTaskRunnerOverlay(dir, entry) {
1445
+ const runner = await detectTaskRunner(dir);
1446
+ if (!runner) return entry;
1447
+ return {
1448
+ ...entry,
1449
+ ...runner.buildCommand && { buildCommand: runner.buildCommand },
1450
+ ...runner.testCommand && { testCommand: runner.testCommand }
1451
+ };
1348
1452
  }
1349
1453
  /**
1350
1454
  * Detects if the project root is a Turborepo monorepo.
@@ -3307,7 +3411,7 @@ async function runStatusAction(options) {
3307
3411
  logger$12.debug({ err }, "Work graph query failed, continuing without work graph data");
3308
3412
  }
3309
3413
  if (run === void 0) {
3310
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-Cpjwxo7a.js");
3414
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-clhFh2zr.js");
3311
3415
  const substrateDirPath = join(projectRoot, ".substrate");
3312
3416
  const processInfo = inspectProcessTree$1({
3313
3417
  projectRoot,
@@ -4833,7 +4937,7 @@ async function runSupervisorAction(options, deps = {}) {
4833
4937
  await initSchema(expAdapter);
4834
4938
  const { runRunAction: runPipeline } = await import(
4835
4939
  /* @vite-ignore */
4836
- "../run-D4Ivv2xD.js"
4940
+ "../run-zENUXBXk.js"
4837
4941
  );
4838
4942
  const runStoryFn = async (opts) => {
4839
4943
  const exitCode = await runPipeline({
@@ -3810,8 +3810,8 @@ function inspectProcessTree(opts) {
3810
3810
  timeout: 5e3
3811
3811
  });
3812
3812
  else {
3813
- const { execFileSync } = __require("node:child_process");
3814
- psOutput = execFileSync("ps", ["-eo", "pid,ppid,stat,command"], {
3813
+ const { execFileSync: execFileSync$1 } = __require("node:child_process");
3814
+ psOutput = execFileSync$1("ps", ["-eo", "pid,ppid,stat,command"], {
3815
3815
  encoding: "utf-8",
3816
3816
  timeout: 5e3
3817
3817
  });
@@ -3872,8 +3872,8 @@ function getAllDescendantPids(rootPids, execFileSyncOverride) {
3872
3872
  timeout: 5e3
3873
3873
  });
3874
3874
  else {
3875
- const { execFileSync } = __require("node:child_process");
3876
- psOutput = execFileSync("ps", ["-eo", "pid,ppid"], {
3875
+ const { execFileSync: execFileSync$1 } = __require("node:child_process");
3876
+ psOutput = execFileSync$1("ps", ["-eo", "pid,ppid"], {
3877
3877
  encoding: "utf-8",
3878
3878
  timeout: 5e3
3879
3879
  });
@@ -4253,4 +4253,4 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
4253
4253
 
4254
4254
  //#endregion
4255
4255
  export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, createStateStore, detectCycles, extractTargetFilesFromStoryContent, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, runHealthAction, validateStoryKey };
4256
- //# sourceMappingURL=health-BbsWlD8o.js.map
4256
+ //# sourceMappingURL=health-DrZiqv4h.js.map
@@ -1,4 +1,4 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-BbsWlD8o.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-DrZiqv4h.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./dist-sNh9XQ6V.js";
4
4
  import "./decisions-C0pz9Clx.js";