substrate-ai 0.1.30 → 0.1.31

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";
@@ -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) {
@@ -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.31",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",