@construct-space/cli 1.1.0 → 1.1.2
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/index.js
CHANGED
|
@@ -7566,6 +7566,41 @@ function bundleAgentDir(srcDir, distDir) {
|
|
|
7566
7566
|
}
|
|
7567
7567
|
|
|
7568
7568
|
// src/commands/build.ts
|
|
7569
|
+
function extractActionMetadata(actionsPath) {
|
|
7570
|
+
try {
|
|
7571
|
+
const source = readFileSync4(actionsPath, "utf-8");
|
|
7572
|
+
const result = {};
|
|
7573
|
+
const actionPattern = /(\w+)\s*:\s*\{[^}]*description\s*:\s*['"`]([^'"`]+)['"`]/g;
|
|
7574
|
+
let match;
|
|
7575
|
+
while ((match = actionPattern.exec(source)) !== null) {
|
|
7576
|
+
const actionId = match[1];
|
|
7577
|
+
const description = match[2];
|
|
7578
|
+
result[actionId] = { description };
|
|
7579
|
+
}
|
|
7580
|
+
for (const actionId of Object.keys(result)) {
|
|
7581
|
+
const paramBlockPattern = new RegExp(`${actionId}\\s*:\\s*\\{[\\s\\S]*?params\\s*:\\s*\\{([\\s\\S]*?)\\}\\s*,?\\s*(?:run|\\})`);
|
|
7582
|
+
const paramMatch = source.match(paramBlockPattern);
|
|
7583
|
+
if (paramMatch?.[1]) {
|
|
7584
|
+
const params = {};
|
|
7585
|
+
const paramEntryPattern = /(\w+)\s*:\s*\{\s*type\s*:\s*['"`](\w+)['"`](?:\s*,\s*description\s*:\s*['"`]([^'"`]*)['"`])?(?:\s*,\s*required\s*:\s*(true|false))?\s*\}/g;
|
|
7586
|
+
let pm;
|
|
7587
|
+
while ((pm = paramEntryPattern.exec(paramMatch[1])) !== null) {
|
|
7588
|
+
params[pm[1]] = {
|
|
7589
|
+
type: pm[2],
|
|
7590
|
+
...pm[3] ? { description: pm[3] } : {},
|
|
7591
|
+
...pm[4] === "true" ? { required: true } : {}
|
|
7592
|
+
};
|
|
7593
|
+
}
|
|
7594
|
+
if (Object.keys(params).length > 0) {
|
|
7595
|
+
result[actionId].params = params;
|
|
7596
|
+
}
|
|
7597
|
+
}
|
|
7598
|
+
}
|
|
7599
|
+
return Object.keys(result).length > 0 ? result : null;
|
|
7600
|
+
} catch {
|
|
7601
|
+
return null;
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7569
7604
|
async function build(options) {
|
|
7570
7605
|
const root = process.cwd();
|
|
7571
7606
|
if (!exists(root)) {
|
|
@@ -7614,6 +7649,14 @@ async function build(options) {
|
|
|
7614
7649
|
const bundleData = readFileSync4(bundlePath);
|
|
7615
7650
|
const checksum = createHash("sha256").update(bundleData).digest("hex");
|
|
7616
7651
|
const raw = readRaw(root);
|
|
7652
|
+
const actionsPath = join6(root, "src", "actions.ts");
|
|
7653
|
+
if (existsSync6(actionsPath)) {
|
|
7654
|
+
const actionMeta = extractActionMetadata(actionsPath);
|
|
7655
|
+
if (actionMeta && Object.keys(actionMeta).length > 0) {
|
|
7656
|
+
raw.actions = actionMeta;
|
|
7657
|
+
console.log(source_default.blue(` Actions: ${Object.keys(actionMeta).join(", ")}`));
|
|
7658
|
+
}
|
|
7659
|
+
}
|
|
7617
7660
|
writeWithBuild(distDir, raw, {
|
|
7618
7661
|
checksum,
|
|
7619
7662
|
size: bundleData.length,
|
|
@@ -10386,7 +10429,7 @@ function parseModelFields(content, fileName) {
|
|
|
10386
10429
|
}
|
|
10387
10430
|
|
|
10388
10431
|
// src/index.ts
|
|
10389
|
-
var VERSION = "1.1.
|
|
10432
|
+
var VERSION = "1.1.2";
|
|
10390
10433
|
var program2 = new Command;
|
|
10391
10434
|
program2.name("construct").description("Construct CLI — scaffold, build, develop, and publish spaces").version(VERSION);
|
|
10392
10435
|
program2.command("scaffold [name]").alias("new").alias("create").description("Create a new Construct space project").option("--with-tests", "Include E2E testing boilerplate").option("--full", "Full preset: multiple pages, extra skills, widget templates").action(async (name, opts) => scaffold(name, opts));
|
package/package.json
CHANGED