substrate-ai 0.1.30 → 0.1.32

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,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { AdapterRegistry, ConfigError, ConfigIncompatibleFormatError, DatabaseWrapper, MonitorDatabaseImpl, ParseError, RecommendationEngine, TaskGraphFileSchema, ValidationError, computeChangedKeys, createConfigWatcher, createDatabaseService, createEventBus, createGitWorktreeManager, createLogger, createMonitorAgent, createMonitorDatabase, createRoutingEngine, createTaskGraphEngine, createTuiApp, createWorkerPoolManager, deepMask, detectCycle, getAllTasks, getLatestSessionId, getLogByEvent, getSession, getSessionLog, getTaskLog, isTuiCapable, parseGraphFile, printNonTtyWarning, queryLogFiltered, runMigrations, validateDependencies, validateGraph } from "../app-CY3MaJtP.js";
3
3
  import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema, SUPPORTED_CONFIG_FORMAT_VERSIONS, SubstrateConfigSchema } from "../config-schema-C9tTMcm1.js";
4
- import { defaultConfigMigrator } from "../version-manager-impl-D7klVqyj.js";
5
- import { registerUpgradeCommand } from "../upgrade-RK_VoMg3.js";
4
+ import { defaultConfigMigrator } from "../version-manager-impl-mBbvaQL2.js";
5
+ import { registerUpgradeCommand } from "../upgrade-4j5rZskl.js";
6
6
  import { createRequire } from "module";
7
7
  import { Command } from "commander";
8
8
  import { fileURLToPath } from "url";
@@ -1910,7 +1910,7 @@ function formatCostCsv(summary, taskEntries) {
1910
1910
  */
1911
1911
  async function runCostAction(options) {
1912
1912
  const { sessionId: explicitSessionId, outputFormat, byTask, byAgent, byBilling, includePlanning, projectRoot, version = "0.0.0" } = options;
1913
- const dbPath = join(projectRoot, ".substrate", "state.db");
1913
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
1914
1914
  if (!existsSync(dbPath)) {
1915
1915
  process.stderr.write(`Error: No Substrate database found at ${dbPath}. Run 'substrate init' first.\n`);
1916
1916
  return COST_EXIT_ERROR;
@@ -2270,7 +2270,7 @@ async function runStartAction(options) {
2270
2270
  return START_EXIT_ERROR;
2271
2271
  }
2272
2272
  }
2273
- const dbPath = join(projectRoot, ".substrate", "state.db");
2273
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
2274
2274
  const substrateDir = join(projectRoot, ".substrate");
2275
2275
  if (!existsSync(substrateDir)) mkdirSync(substrateDir, { recursive: true });
2276
2276
  const eventBus = createEventBus();
@@ -2715,7 +2715,7 @@ function isTerminalStatus(status) {
2715
2715
  */
2716
2716
  async function runStatusAction(options) {
2717
2717
  const { sessionId: explicitSessionId, watch: watch$1, outputFormat, showGraph, pollIntervalMs, projectRoot } = options;
2718
- const dbPath = join(projectRoot, ".substrate", "state.db");
2718
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
2719
2719
  if (!existsSync(dbPath)) {
2720
2720
  process.stderr.write(`Error: No Substrate database found at ${dbPath}. Run 'substrate init' first.\n`);
2721
2721
  return STATUS_EXIT_ERROR;
@@ -2846,7 +2846,7 @@ const PAUSE_EXIT_USAGE_ERROR = 2;
2846
2846
  */
2847
2847
  async function runPauseAction(options) {
2848
2848
  const { sessionId, outputFormat, projectRoot, version = "0.0.0" } = options;
2849
- const dbPath = join(projectRoot, ".substrate", "state.db");
2849
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
2850
2850
  if (!existsSync(dbPath)) {
2851
2851
  process.stderr.write(`Error: No Substrate database found at ${dbPath}. Run 'substrate init' first.\n`);
2852
2852
  return PAUSE_EXIT_ERROR;
@@ -2962,7 +2962,7 @@ async function runResumeAction(options) {
2962
2962
  };
2963
2963
  return runStartAction(startOptions);
2964
2964
  }
2965
- const dbPath = join(projectRoot, ".substrate", "state.db");
2965
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
2966
2966
  if (!existsSync(dbPath)) {
2967
2967
  process.stderr.write(`Error: No Substrate database found at ${dbPath}. Run 'substrate init' first.\n`);
2968
2968
  return RESUME_EXIT_ERROR;
@@ -3080,7 +3080,7 @@ async function promptConfirmation$1(sessionId) {
3080
3080
  */
3081
3081
  async function runCancelAction(options) {
3082
3082
  const { sessionId, outputFormat, yes, projectRoot, version = "0.0.0" } = options;
3083
- const dbPath = join(projectRoot, ".substrate", "state.db");
3083
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
3084
3084
  if (!existsSync(dbPath)) {
3085
3085
  process.stderr.write(`Error: No Substrate database found at ${dbPath}. Run 'substrate init' first.\n`);
3086
3086
  return CANCEL_EXIT_ERROR;
@@ -3293,7 +3293,7 @@ function validateTaskDependencies(db, _sessionId, taskId) {
3293
3293
  */
3294
3294
  async function runRetryAction(options) {
3295
3295
  const { sessionId, taskId: specificTaskId, dryRun, follow, outputFormat, maxRetries, projectRoot } = options;
3296
- const dbPath = join(projectRoot, ".substrate", "state.db");
3296
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
3297
3297
  if (!existsSync(dbPath)) {
3298
3298
  process.stderr.write(`Error: No Substrate database found at ${dbPath}. Run 'substrate init' first.\n`);
3299
3299
  return RETRY_EXIT_USAGE_ERROR;
@@ -3387,7 +3387,7 @@ async function runRetryAction(options) {
3387
3387
  */
3388
3388
  async function runFollowMode(opts) {
3389
3389
  const { sessionId, eligibleTaskIds, projectRoot, outputFormat } = opts;
3390
- const dbPath = join(projectRoot, ".substrate", "state.db");
3390
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
3391
3391
  const eventBus = createEventBus();
3392
3392
  const databaseService = createDatabaseService(dbPath);
3393
3393
  const configSystem = createConfigSystem({ projectRoot });
@@ -3807,7 +3807,7 @@ function formatLogTable(entries) {
3807
3807
  */
3808
3808
  async function runLogAction(options) {
3809
3809
  const { sessionId: explicitSessionId, taskId, event, limit, outputFormat, projectRoot, version = "0.0.0" } = options;
3810
- const dbPath = join(projectRoot, ".substrate", "state.db");
3810
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
3811
3811
  if (!existsSync(dbPath)) {
3812
3812
  process.stderr.write(`Error: No Substrate database found at ${dbPath}. Run 'substrate init' first.\n`);
3813
3813
  return LOG_EXIT_ERROR;
@@ -5084,7 +5084,7 @@ async function runPlanRefineAction(options) {
5084
5084
  process.stderr.write("Error: feedback text is required\n");
5085
5085
  return REFINE_EXIT_USAGE_ERROR;
5086
5086
  }
5087
- const dbPath = join(projectRoot, ".substrate", "state.db");
5087
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
5088
5088
  const dbWrapper = new DatabaseWrapper(dbPath);
5089
5089
  try {
5090
5090
  dbWrapper.open();
@@ -5190,7 +5190,7 @@ const DIFF_EXIT_NOT_FOUND = 2;
5190
5190
  */
5191
5191
  async function runPlanDiffAction(options) {
5192
5192
  const { planId, fromVersion, toVersion, projectRoot, outputFormat } = options;
5193
- const dbPath = join(projectRoot, ".substrate", "state.db");
5193
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
5194
5194
  const dbWrapper = new DatabaseWrapper(dbPath);
5195
5195
  try {
5196
5196
  dbWrapper.open();
@@ -5281,7 +5281,7 @@ const ROLLBACK_EXIT_USAGE_ERROR = 2;
5281
5281
  */
5282
5282
  async function runPlanRollbackAction(options, onEvent) {
5283
5283
  const { planId, toVersion, projectRoot, outputFormat, autoApprove = false } = options;
5284
- const dbPath = join(projectRoot, ".substrate", "state.db");
5284
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
5285
5285
  const dbWrapper = new DatabaseWrapper(dbPath);
5286
5286
  try {
5287
5287
  dbWrapper.open();
@@ -5588,7 +5588,7 @@ async function promptApproval() {
5588
5588
  }
5589
5589
  async function savePlan(input) {
5590
5590
  const { planId, goal, planningAgent, estimatedExecutionCost, taskCount, planYaml, projectRoot, status } = input;
5591
- const dbPath = join(projectRoot, ".substrate", "state.db");
5591
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
5592
5592
  const dbWrapper = new DatabaseWrapper(dbPath);
5593
5593
  try {
5594
5594
  dbWrapper.open();
@@ -5811,7 +5811,7 @@ async function runPlanReviewAction(options) {
5811
5811
  */
5812
5812
  async function runPlanListAction(options) {
5813
5813
  const { outputFormat, projectRoot } = options;
5814
- const dbPath = join(projectRoot, ".substrate", "state.db");
5814
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
5815
5815
  const dbWrapper = new DatabaseWrapper(dbPath);
5816
5816
  try {
5817
5817
  dbWrapper.open();
@@ -5840,7 +5840,7 @@ async function runPlanListAction(options) {
5840
5840
  */
5841
5841
  async function runPlanShowAction(planId, options) {
5842
5842
  const { outputFormat, projectRoot } = options;
5843
- const dbPath = join(projectRoot, ".substrate", "state.db");
5843
+ const dbPath = join(projectRoot, ".substrate", "substrate.db");
5844
5844
  const dbWrapper = new DatabaseWrapper(dbPath);
5845
5845
  try {
5846
5846
  dbWrapper.open();
@@ -16253,11 +16253,64 @@ function clearBmadCommandFiles(commandsDir) {
16253
16253
  } catch {}
16254
16254
  }
16255
16255
  /**
16256
+ * Compile .agent.yaml files to .md format using bmad-method's agent compiler.
16257
+ * The command generators only recognize compiled .md files with <agent> XML tags.
16258
+ * Scans _bmad/core/agents/ and _bmad/{module}/agents/ for uncompiled YAML files.
16259
+ *
16260
+ * @returns number of agents compiled
16261
+ */
16262
+ async function compileBmadAgents(bmadDir) {
16263
+ const _require = createRequire$1(join(__dirname, "synthetic.js"));
16264
+ let compilerPath;
16265
+ try {
16266
+ const pkgJsonPath = _require.resolve("bmad-method/package.json");
16267
+ compilerPath = join(dirname(pkgJsonPath), "tools", "cli", "lib", "agent", "compiler.js");
16268
+ } catch {
16269
+ return 0;
16270
+ }
16271
+ const { compileAgent } = _require(compilerPath);
16272
+ const agentDirs = [];
16273
+ const coreAgentsDir = join(bmadDir, "core", "agents");
16274
+ if (existsSync(coreAgentsDir)) agentDirs.push(coreAgentsDir);
16275
+ try {
16276
+ const entries = readdirSync(bmadDir, { withFileTypes: true });
16277
+ for (const entry of entries) {
16278
+ if (!entry.isDirectory() || entry.name === "core" || entry.name.startsWith(".") || entry.name.startsWith("_")) continue;
16279
+ const modAgentsDir = join(bmadDir, entry.name, "agents");
16280
+ if (existsSync(modAgentsDir)) agentDirs.push(modAgentsDir);
16281
+ }
16282
+ } catch {}
16283
+ let compiled = 0;
16284
+ for (const agentDir of agentDirs) try {
16285
+ const files = readdirSync(agentDir);
16286
+ for (const file of files) {
16287
+ if (!file.endsWith(".agent.yaml")) continue;
16288
+ const yamlPath = join(agentDir, file);
16289
+ const mdPath = join(agentDir, file.replace(".agent.yaml", ".md"));
16290
+ if (existsSync(mdPath)) continue;
16291
+ try {
16292
+ const yamlContent = readFileSync(yamlPath, "utf-8");
16293
+ const agentName = file.replace(".agent.yaml", "");
16294
+ const result = await compileAgent(yamlContent, {}, agentName, mdPath);
16295
+ writeFileSync(mdPath, result.xml, "utf-8");
16296
+ compiled++;
16297
+ } catch (compileErr) {
16298
+ logger$3.debug({
16299
+ err: compileErr,
16300
+ file
16301
+ }, "Failed to compile agent YAML");
16302
+ }
16303
+ }
16304
+ } catch {}
16305
+ return compiled;
16306
+ }
16307
+ /**
16256
16308
  * Generate .claude/commands/ files by calling bmad-method's command generators.
16257
16309
  *
16258
16310
  * Uses the installed bmad-method package's AgentCommandGenerator,
16259
16311
  * WorkflowCommandGenerator, and TaskToolCommandGenerator classes via createRequire.
16260
- * Generates CSV manifests first so workflow/task generators can discover content.
16312
+ * Compiles agent YAML to MD first, then generates CSV manifests so workflow/task
16313
+ * generators can discover content.
16261
16314
  *
16262
16315
  * Graceful degradation: warns but never fails init.
16263
16316
  */
@@ -16271,6 +16324,12 @@ async function scaffoldClaudeCommands(projectRoot, outputFormat) {
16271
16324
  }
16272
16325
  try {
16273
16326
  const _require = createRequire$1(join(__dirname, "synthetic.js"));
16327
+ try {
16328
+ const compiledCount = await compileBmadAgents(bmadDir);
16329
+ if (compiledCount > 0) logger$3.info({ compiledCount }, "Compiled agent YAML files to MD");
16330
+ } catch (compileErr) {
16331
+ logger$3.warn({ err: compileErr }, "Agent compilation failed; agent commands may be incomplete");
16332
+ }
16274
16333
  const { AgentCommandGenerator } = _require(join(installerLibPath, "ide", "shared", "agent-command-generator.js"));
16275
16334
  const { WorkflowCommandGenerator } = _require(join(installerLibPath, "ide", "shared", "workflow-command-generator.js"));
16276
16335
  const { TaskToolCommandGenerator } = _require(join(installerLibPath, "ide", "shared", "task-tool-command-generator.js"));
@@ -19617,8 +19676,8 @@ async function createProgram() {
19617
19676
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
19618
19677
  function checkForUpdatesInBackground(currentVersion) {
19619
19678
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
19620
- import("../upgrade-IVr1D46-.js").then(async () => {
19621
- const { createVersionManager } = await import("../version-manager-impl-vjZ6Bx9v.js");
19679
+ import("../upgrade-j7tWzbZ0.js").then(async () => {
19680
+ const { createVersionManager } = await import("../version-manager-impl-CJLdocS1.js");
19622
19681
  const vm = createVersionManager();
19623
19682
  const result = await vm.checkForUpdates();
19624
19683
  if (result.updateAvailable) {
package/dist/index.d.ts CHANGED
@@ -975,7 +975,7 @@ declare function createEventBus(): TypedEventBus;
975
975
  * Configuration required to initialize the orchestrator.
976
976
  */
977
977
  interface OrchestratorConfig {
978
- /** Path to the SQLite database file (e.g., ".substrate/state.db") */
978
+ /** Path to the SQLite database file (e.g., ".substrate/substrate.db") */
979
979
  databasePath: string;
980
980
  /** Working directory for the orchestrated project */
981
981
  projectRoot: string;
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./version-manager-impl-D7klVqyj.js";
1
+ import { createVersionManager } from "./version-manager-impl-mBbvaQL2.js";
2
2
  import { execSync, spawn } from "child_process";
3
3
  import * as readline from "readline";
4
4
 
@@ -123,4 +123,4 @@ function registerUpgradeCommand(program) {
123
123
 
124
124
  //#endregion
125
125
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
126
- //# sourceMappingURL=upgrade-RK_VoMg3.js.map
126
+ //# sourceMappingURL=upgrade-4j5rZskl.js.map
@@ -1,5 +1,5 @@
1
1
  import "./config-schema-C9tTMcm1.js";
2
- import "./version-manager-impl-D7klVqyj.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-RK_VoMg3.js";
2
+ import "./version-manager-impl-mBbvaQL2.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-4j5rZskl.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
1
  import "./config-schema-C9tTMcm1.js";
2
- import { VersionManagerImpl, createVersionManager } from "./version-manager-impl-D7klVqyj.js";
2
+ import { VersionManagerImpl, createVersionManager } from "./version-manager-impl-mBbvaQL2.js";
3
3
 
4
4
  export { createVersionManager };
@@ -1,6 +1,7 @@
1
1
  import { SUPPORTED_CONFIG_FORMAT_VERSIONS, SUPPORTED_TASK_GRAPH_VERSIONS } from "./config-schema-C9tTMcm1.js";
2
2
  import { createRequire } from "module";
3
- import path, { dirname } from "path";
3
+ import { fileURLToPath } from "url";
4
+ import path, { dirname, resolve } from "path";
4
5
  import { mkdirSync, readFileSync, writeFileSync } from "fs";
5
6
  import os from "os";
6
7
  import https from "https";
@@ -334,13 +335,25 @@ var VersionManagerImpl = class {
334
335
  }
335
336
  /**
336
337
  * Read the current package version from the bundled package.json.
338
+ * Tries multiple relative paths because the bundler may place this chunk
339
+ * at different depths (e.g. dist/version-manager-impl-xxx.js vs
340
+ * src/modules/version-manager/version-manager-impl.ts).
337
341
  * Falls back to '0.0.0' if the file is unreadable.
338
342
  */
339
343
  getCurrentVersion() {
340
344
  try {
341
- const _require = createRequire(import.meta.url);
342
- const pkg = _require("../../package.json");
343
- return typeof pkg.version === "string" && pkg.version.length > 0 ? pkg.version : "0.0.0";
345
+ const __dirname = dirname(fileURLToPath(import.meta.url));
346
+ const candidates = [
347
+ resolve(__dirname, "../package.json"),
348
+ resolve(__dirname, "../../package.json"),
349
+ resolve(__dirname, "../../../package.json")
350
+ ];
351
+ for (const candidate of candidates) try {
352
+ const raw = readFileSync(candidate, "utf-8");
353
+ const pkg = JSON.parse(raw);
354
+ if (pkg.name === "substrate-ai" && typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
355
+ } catch {}
356
+ return "0.0.0";
344
357
  } catch {
345
358
  return "0.0.0";
346
359
  }
@@ -377,12 +390,12 @@ var VersionManagerImpl = class {
377
390
  if (!forceRefresh) {
378
391
  const cached = this.cache.read();
379
392
  if (cached !== null) {
380
- const updateAvailable = cached.latestVersion !== cached.currentVersion;
393
+ const updateAvailable = cached.latestVersion !== currentVersion;
381
394
  return {
382
- currentVersion: cached.currentVersion,
395
+ currentVersion,
383
396
  latestVersion: cached.latestVersion,
384
397
  updateAvailable,
385
- isBreaking: this.updateChecker.isBreaking(cached.currentVersion, cached.latestVersion),
398
+ isBreaking: this.updateChecker.isBreaking(currentVersion, cached.latestVersion),
386
399
  changelog: this.updateChecker.getChangelog(cached.latestVersion)
387
400
  };
388
401
  }
@@ -482,4 +495,4 @@ function createVersionManager(deps = {}) {
482
495
 
483
496
  //#endregion
484
497
  export { VersionManagerImpl, createVersionManager, defaultConfigMigrator };
485
- //# sourceMappingURL=version-manager-impl-D7klVqyj.js.map
498
+ //# sourceMappingURL=version-manager-impl-mBbvaQL2.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",