substrate-ai 0.19.47 → 0.19.49

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +32 -17
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -16,7 +16,7 @@ import { dirname, join, resolve } from "path";
16
16
  import { access, mkdir, readFile, writeFile } from "fs/promises";
17
17
  import yaml from "js-yaml";
18
18
  import { existsSync, readFileSync } from "node:fs";
19
- import { spawn } from "node:child_process";
19
+ import { execFile, spawn } from "node:child_process";
20
20
  import * as path$3 from "node:path";
21
21
  import * as path$2 from "node:path";
22
22
  import * as path$1 from "node:path";
@@ -1182,6 +1182,17 @@ const PartialSubstrateConfigSchema = z.object({
1182
1182
 
1183
1183
  //#endregion
1184
1184
  //#region src/modules/project-profile/detect.ts
1185
+ function execFileAsync(cmd, args, opts) {
1186
+ return new Promise((resolve$2, reject) => {
1187
+ execFile(cmd, args, {
1188
+ ...opts,
1189
+ timeout: 5e3
1190
+ }, (err, stdout) => {
1191
+ if (err) reject(err);
1192
+ else resolve$2(stdout);
1193
+ });
1194
+ });
1195
+ }
1185
1196
  /**
1186
1197
  * Ordered array of build system markers. Detection checks them in priority
1187
1198
  * order — the first matching marker wins at the single-project level.
@@ -1285,23 +1296,15 @@ async function detectNodeBuildTool(dir) {
1285
1296
  const TASK_RUNNER_MARKERS = [
1286
1297
  {
1287
1298
  file: "justfile",
1288
- runner: "just",
1289
- listCommand: ["just", "--list"]
1299
+ runner: "just"
1290
1300
  },
1291
1301
  {
1292
1302
  file: "Justfile",
1293
- runner: "just",
1294
- listCommand: ["just", "--list"]
1303
+ runner: "just"
1295
1304
  },
1296
1305
  {
1297
1306
  file: "Makefile",
1298
- runner: "make",
1299
- listCommand: []
1300
- },
1301
- {
1302
- file: "Taskfile.yml",
1303
- runner: "task",
1304
- listCommand: ["task", "--list"]
1307
+ runner: "make"
1305
1308
  }
1306
1309
  ];
1307
1310
  /** Known build-related target names, in preference order. */
@@ -1328,15 +1331,14 @@ async function detectTaskRunner(dir) {
1328
1331
  if (!await fileExists(path$1.join(dir, marker.file))) continue;
1329
1332
  if (marker.runner === "just") return detectJustTargets(dir, marker.file);
1330
1333
  if (marker.runner === "make") return detectMakeTargets(dir);
1331
- return { runner: "task" };
1332
1334
  }
1333
1335
  return null;
1334
1336
  }
1335
- async function detectJustTargets(dir, filename) {
1337
+ async function detectJustTargets(dir, _filename) {
1336
1338
  const result = { runner: "just" };
1337
1339
  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
+ const stdout = await execFileAsync("just", ["--summary"], { cwd: dir });
1341
+ const recipes = stdout.trim().split(/\s+/);
1340
1342
  for (const target of BUILD_TARGETS) if (recipes.includes(target)) {
1341
1343
  result.buildCommand = `just ${target}`;
1342
1344
  break;
@@ -1345,7 +1347,20 @@ async function detectJustTargets(dir, filename) {
1345
1347
  result.testCommand = `just ${target}`;
1346
1348
  break;
1347
1349
  }
1348
- } catch {}
1350
+ } catch {
1351
+ try {
1352
+ const content = await fs.readFile(path$1.join(dir, _filename), "utf-8");
1353
+ const recipes = content.split("\n").map((line) => line.match(/^([a-zA-Z_][\w-]*)(?:\s+[^:]*)?:(?!=)/)).filter((m) => m !== null).map((m) => m[1]);
1354
+ for (const target of BUILD_TARGETS) if (recipes.includes(target)) {
1355
+ result.buildCommand = `just ${target}`;
1356
+ break;
1357
+ }
1358
+ for (const target of TEST_TARGETS) if (recipes.includes(target)) {
1359
+ result.testCommand = `just ${target}`;
1360
+ break;
1361
+ }
1362
+ } catch {}
1363
+ }
1349
1364
  return result;
1350
1365
  }
1351
1366
  async function detectMakeTargets(dir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.19.47",
3
+ "version": "0.19.49",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",