substrate-ai 0.19.47 → 0.19.48
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 +29 -5
- 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.
|
|
@@ -1332,11 +1343,11 @@ async function detectTaskRunner(dir) {
|
|
|
1332
1343
|
}
|
|
1333
1344
|
return null;
|
|
1334
1345
|
}
|
|
1335
|
-
async function detectJustTargets(dir,
|
|
1346
|
+
async function detectJustTargets(dir, _filename) {
|
|
1336
1347
|
const result = { runner: "just" };
|
|
1337
1348
|
try {
|
|
1338
|
-
const
|
|
1339
|
-
const recipes =
|
|
1349
|
+
const stdout = await execFileAsync("just", ["--summary"], { cwd: dir });
|
|
1350
|
+
const recipes = stdout.trim().split(/\s+/);
|
|
1340
1351
|
for (const target of BUILD_TARGETS) if (recipes.includes(target)) {
|
|
1341
1352
|
result.buildCommand = `just ${target}`;
|
|
1342
1353
|
break;
|
|
@@ -1345,7 +1356,20 @@ async function detectJustTargets(dir, filename) {
|
|
|
1345
1356
|
result.testCommand = `just ${target}`;
|
|
1346
1357
|
break;
|
|
1347
1358
|
}
|
|
1348
|
-
} catch {
|
|
1359
|
+
} catch {
|
|
1360
|
+
try {
|
|
1361
|
+
const content = await fs.readFile(path$1.join(dir, _filename), "utf-8");
|
|
1362
|
+
const recipes = content.split("\n").map((line) => line.match(/^([a-zA-Z_][\w-]*)(?:\s+[^:]*)?:/)).filter((m) => m !== null).map((m) => m[1]);
|
|
1363
|
+
for (const target of BUILD_TARGETS) if (recipes.includes(target)) {
|
|
1364
|
+
result.buildCommand = `just ${target}`;
|
|
1365
|
+
break;
|
|
1366
|
+
}
|
|
1367
|
+
for (const target of TEST_TARGETS) if (recipes.includes(target)) {
|
|
1368
|
+
result.testCommand = `just ${target}`;
|
|
1369
|
+
break;
|
|
1370
|
+
}
|
|
1371
|
+
} catch {}
|
|
1372
|
+
}
|
|
1349
1373
|
return result;
|
|
1350
1374
|
}
|
|
1351
1375
|
async function detectMakeTargets(dir) {
|