@construct-space/cli 1.6.5 → 1.7.0
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/LICENSE +21 -0
- package/dist/index.js +227 -56
- package/dist/templates/space/vite.config.ts.tmpl +0 -9
- package/package.json +1 -1
- package/templates/space/vite.config.ts.tmpl +0 -9
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Construct
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -2845,14 +2845,14 @@ function spaceDir(spaceId) {
|
|
|
2845
2845
|
var init_appdir = () => {};
|
|
2846
2846
|
|
|
2847
2847
|
// src/lib/auth.ts
|
|
2848
|
-
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync, existsSync as existsSync10, readdirSync as
|
|
2848
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync, existsSync as existsSync10, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
|
|
2849
2849
|
import { join as join12, dirname as dirname4 } from "path";
|
|
2850
2850
|
function listDesktopProfiles() {
|
|
2851
2851
|
const dir = profilesDir();
|
|
2852
2852
|
if (!existsSync10(dir))
|
|
2853
2853
|
return [];
|
|
2854
2854
|
const results = [];
|
|
2855
|
-
for (const entry of
|
|
2855
|
+
for (const entry of readdirSync5(dir)) {
|
|
2856
2856
|
const full = join12(dir, entry);
|
|
2857
2857
|
try {
|
|
2858
2858
|
if (!statSync4(full).isDirectory())
|
|
@@ -5169,10 +5169,9 @@ var dist_default6 = createPrompt((config, done) => {
|
|
|
5169
5169
|
return `${lines}${cursorHide}`;
|
|
5170
5170
|
});
|
|
5171
5171
|
// src/lib/utils.ts
|
|
5172
|
-
import {
|
|
5172
|
+
import { execFileSync } from "child_process";
|
|
5173
5173
|
function git(dir, ...args) {
|
|
5174
|
-
|
|
5175
|
-
return execSync(`git ${quoted.join(" ")}`, { cwd: dir, encoding: "utf-8" }).trim();
|
|
5174
|
+
return execFileSync("git", args, { cwd: dir, encoding: "utf-8" }).trim();
|
|
5176
5175
|
}
|
|
5177
5176
|
function gitSafe(dir, ...args) {
|
|
5178
5177
|
try {
|
|
@@ -5205,12 +5204,12 @@ function toDisplayName(name) {
|
|
|
5205
5204
|
}
|
|
5206
5205
|
|
|
5207
5206
|
// src/lib/runtime.ts
|
|
5208
|
-
import { execSync
|
|
5207
|
+
import { execSync, spawn } from "child_process";
|
|
5209
5208
|
import { existsSync } from "fs";
|
|
5210
5209
|
import { join } from "path";
|
|
5211
5210
|
function detect() {
|
|
5212
5211
|
try {
|
|
5213
|
-
const version =
|
|
5212
|
+
const version = execSync("bun --version", { encoding: "utf-8" }).trim().replace(/^v/, "");
|
|
5214
5213
|
return { name: "bun", version, exec: "bun" };
|
|
5215
5214
|
} catch {
|
|
5216
5215
|
throw new Error("Bun is required. Install it: https://bun.sh");
|
|
@@ -5220,7 +5219,7 @@ function ensureDeps(root, _rt) {
|
|
|
5220
5219
|
const nmDir = join(root, "node_modules");
|
|
5221
5220
|
if (existsSync(nmDir))
|
|
5222
5221
|
return;
|
|
5223
|
-
|
|
5222
|
+
execSync("bun install", { cwd: root, stdio: "inherit" });
|
|
5224
5223
|
}
|
|
5225
5224
|
function buildCmd(root, _rt) {
|
|
5226
5225
|
const child = spawn("bun", ["run", "vite", "build"], { cwd: root, stdio: "inherit" });
|
|
@@ -5240,7 +5239,7 @@ function runHook(hooks, hookName, root) {
|
|
|
5240
5239
|
const cmd = hooks?.[hookName];
|
|
5241
5240
|
if (!cmd)
|
|
5242
5241
|
return;
|
|
5243
|
-
|
|
5242
|
+
execSync(cmd, { cwd: root, stdio: "inherit" });
|
|
5244
5243
|
}
|
|
5245
5244
|
|
|
5246
5245
|
// src/commands/scaffold.ts
|
|
@@ -8012,8 +8011,13 @@ function validate2(m) {
|
|
|
8012
8011
|
errors2.push("author: must be an object with a name");
|
|
8013
8012
|
if (!m.icon)
|
|
8014
8013
|
errors2.push("icon: must be a string");
|
|
8015
|
-
|
|
8016
|
-
|
|
8014
|
+
const allowedScopes = ["app", "org"];
|
|
8015
|
+
if (!Array.isArray(m.scopes) || m.scopes.length === 0 || !m.scopes.every((s) => allowedScopes.includes(s))) {
|
|
8016
|
+
errors2.push('scopes: must be a non-empty array of "app" or "org"');
|
|
8017
|
+
}
|
|
8018
|
+
if (m.projectAware !== undefined && typeof m.projectAware !== "boolean") {
|
|
8019
|
+
errors2.push("projectAware: must be a boolean");
|
|
8020
|
+
}
|
|
8017
8021
|
if (!m.pages?.length)
|
|
8018
8022
|
errors2.push("pages: must be a non-empty array");
|
|
8019
8023
|
if (!m.navigation?.label)
|
|
@@ -8252,41 +8256,179 @@ function bundleAgentDir(srcDir, distDir) {
|
|
|
8252
8256
|
}
|
|
8253
8257
|
|
|
8254
8258
|
// src/commands/build.ts
|
|
8255
|
-
var ASSET_DIRS = ["icons", "assets", "media", "public"];
|
|
8259
|
+
var ASSET_DIRS = ["icons", "assets", "media", "public", "bin"];
|
|
8256
8260
|
function copyAssetDirs(root, distDir) {
|
|
8257
8261
|
const copied = [];
|
|
8258
8262
|
for (const name of ASSET_DIRS) {
|
|
8259
8263
|
const src = join6(root, name);
|
|
8260
8264
|
if (!existsSync6(src) || !statSync3(src).isDirectory())
|
|
8261
8265
|
continue;
|
|
8262
|
-
cpSync(src, join6(distDir, name), { recursive: true });
|
|
8266
|
+
cpSync(src, join6(distDir, name), { recursive: true, verbatimSymlinks: true });
|
|
8263
8267
|
copied.push(name);
|
|
8264
8268
|
}
|
|
8265
8269
|
return copied;
|
|
8266
8270
|
}
|
|
8271
|
+
function stripTsComments(source) {
|
|
8272
|
+
let out = "";
|
|
8273
|
+
let i = 0;
|
|
8274
|
+
let quote = null;
|
|
8275
|
+
let escaped = false;
|
|
8276
|
+
while (i < source.length) {
|
|
8277
|
+
const ch = source[i];
|
|
8278
|
+
const next = source[i + 1];
|
|
8279
|
+
if (quote) {
|
|
8280
|
+
out += ch;
|
|
8281
|
+
if (escaped) {
|
|
8282
|
+
escaped = false;
|
|
8283
|
+
} else if (ch === "\\") {
|
|
8284
|
+
escaped = true;
|
|
8285
|
+
} else if (ch === quote) {
|
|
8286
|
+
quote = null;
|
|
8287
|
+
}
|
|
8288
|
+
i += 1;
|
|
8289
|
+
continue;
|
|
8290
|
+
}
|
|
8291
|
+
if (ch === '"' || ch === "'" || ch === "`") {
|
|
8292
|
+
quote = ch;
|
|
8293
|
+
out += ch;
|
|
8294
|
+
i += 1;
|
|
8295
|
+
continue;
|
|
8296
|
+
}
|
|
8297
|
+
if (ch === "/" && next === "/") {
|
|
8298
|
+
while (i < source.length && source[i] !== `
|
|
8299
|
+
`)
|
|
8300
|
+
i += 1;
|
|
8301
|
+
out += `
|
|
8302
|
+
`;
|
|
8303
|
+
continue;
|
|
8304
|
+
}
|
|
8305
|
+
if (ch === "/" && next === "*") {
|
|
8306
|
+
i += 2;
|
|
8307
|
+
while (i < source.length && !(source[i] === "*" && source[i + 1] === "/")) {
|
|
8308
|
+
out += source[i] === `
|
|
8309
|
+
` ? `
|
|
8310
|
+
` : " ";
|
|
8311
|
+
i += 1;
|
|
8312
|
+
}
|
|
8313
|
+
i += 2;
|
|
8314
|
+
continue;
|
|
8315
|
+
}
|
|
8316
|
+
out += ch;
|
|
8317
|
+
i += 1;
|
|
8318
|
+
}
|
|
8319
|
+
return out;
|
|
8320
|
+
}
|
|
8321
|
+
function findMatchingBrace(source, openIndex) {
|
|
8322
|
+
let depth = 0;
|
|
8323
|
+
let quote = null;
|
|
8324
|
+
let escaped = false;
|
|
8325
|
+
for (let i = openIndex;i < source.length; i += 1) {
|
|
8326
|
+
const ch = source[i];
|
|
8327
|
+
if (quote) {
|
|
8328
|
+
if (escaped) {
|
|
8329
|
+
escaped = false;
|
|
8330
|
+
} else if (ch === "\\") {
|
|
8331
|
+
escaped = true;
|
|
8332
|
+
} else if (ch === quote) {
|
|
8333
|
+
quote = null;
|
|
8334
|
+
}
|
|
8335
|
+
continue;
|
|
8336
|
+
}
|
|
8337
|
+
if (ch === '"' || ch === "'" || ch === "`") {
|
|
8338
|
+
quote = ch;
|
|
8339
|
+
continue;
|
|
8340
|
+
}
|
|
8341
|
+
if (ch === "{")
|
|
8342
|
+
depth += 1;
|
|
8343
|
+
if (ch === "}") {
|
|
8344
|
+
depth -= 1;
|
|
8345
|
+
if (depth === 0)
|
|
8346
|
+
return i;
|
|
8347
|
+
}
|
|
8348
|
+
}
|
|
8349
|
+
return -1;
|
|
8350
|
+
}
|
|
8351
|
+
function readObjectEntries(source) {
|
|
8352
|
+
const entries = [];
|
|
8353
|
+
let i = 0;
|
|
8354
|
+
while (i < source.length) {
|
|
8355
|
+
while (i < source.length && /[\s,]/.test(source[i]))
|
|
8356
|
+
i += 1;
|
|
8357
|
+
if (i >= source.length)
|
|
8358
|
+
break;
|
|
8359
|
+
let key = "";
|
|
8360
|
+
const quote = source[i];
|
|
8361
|
+
if (quote === '"' || quote === "'" || quote === "`") {
|
|
8362
|
+
i += 1;
|
|
8363
|
+
const start = i;
|
|
8364
|
+
while (i < source.length && source[i] !== quote) {
|
|
8365
|
+
if (source[i] === "\\")
|
|
8366
|
+
i += 1;
|
|
8367
|
+
i += 1;
|
|
8368
|
+
}
|
|
8369
|
+
key = source.slice(start, i);
|
|
8370
|
+
i += 1;
|
|
8371
|
+
} else {
|
|
8372
|
+
const match = /^[A-Za-z_$][\w$-]*/.exec(source.slice(i));
|
|
8373
|
+
if (!match) {
|
|
8374
|
+
i += 1;
|
|
8375
|
+
continue;
|
|
8376
|
+
}
|
|
8377
|
+
key = match[0];
|
|
8378
|
+
i += key.length;
|
|
8379
|
+
}
|
|
8380
|
+
while (i < source.length && /\s/.test(source[i]))
|
|
8381
|
+
i += 1;
|
|
8382
|
+
if (source[i] !== ":")
|
|
8383
|
+
continue;
|
|
8384
|
+
i += 1;
|
|
8385
|
+
while (i < source.length && /\s/.test(source[i]))
|
|
8386
|
+
i += 1;
|
|
8387
|
+
if (source[i] !== "{")
|
|
8388
|
+
continue;
|
|
8389
|
+
const close = findMatchingBrace(source, i);
|
|
8390
|
+
if (close === -1)
|
|
8391
|
+
break;
|
|
8392
|
+
entries.push({ key, body: source.slice(i + 1, close) });
|
|
8393
|
+
i = close + 1;
|
|
8394
|
+
}
|
|
8395
|
+
return entries;
|
|
8396
|
+
}
|
|
8397
|
+
function getNamedObjectBody(source, name) {
|
|
8398
|
+
return readObjectEntries(source).find((entry) => entry.key === name)?.body ?? null;
|
|
8399
|
+
}
|
|
8267
8400
|
function extractActionMetadata(actionsPath) {
|
|
8268
8401
|
try {
|
|
8269
|
-
const source = readFileSync4(actionsPath, "utf-8");
|
|
8402
|
+
const source = stripTsComments(readFileSync4(actionsPath, "utf-8"));
|
|
8403
|
+
const actionsMatch = /export\s+const\s+actions\s*=\s*\{/.exec(source);
|
|
8404
|
+
if (!actionsMatch)
|
|
8405
|
+
return null;
|
|
8406
|
+
const actionsOpen = source.indexOf("{", actionsMatch.index);
|
|
8407
|
+
const actionsClose = findMatchingBrace(source, actionsOpen);
|
|
8408
|
+
if (actionsClose === -1)
|
|
8409
|
+
return null;
|
|
8410
|
+
const actionsBody = source.slice(actionsOpen + 1, actionsClose);
|
|
8270
8411
|
const result = {};
|
|
8271
|
-
const
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
const
|
|
8412
|
+
for (const entry of readObjectEntries(actionsBody)) {
|
|
8413
|
+
const descriptionMatch = /\bdescription\s*:\s*['"`]([^'"`]+)['"`]/.exec(entry.body);
|
|
8414
|
+
if (!descriptionMatch)
|
|
8415
|
+
continue;
|
|
8416
|
+
const actionId = entry.key;
|
|
8417
|
+
const description = descriptionMatch[1];
|
|
8276
8418
|
result[actionId] = { description };
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
const paramBlockPattern = new RegExp(`${actionId}\\s*:\\s*\\{[\\s\\S]*?params\\s*:\\s*\\{([\\s\\S]*?)\\}\\s*,?\\s*(?:run|\\})`);
|
|
8280
|
-
const paramMatch = source.match(paramBlockPattern);
|
|
8281
|
-
if (paramMatch?.[1]) {
|
|
8419
|
+
const paramsBody = getNamedObjectBody(entry.body, "params");
|
|
8420
|
+
if (paramsBody) {
|
|
8282
8421
|
const params = {};
|
|
8283
|
-
const
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8422
|
+
for (const paramEntry of readObjectEntries(paramsBody)) {
|
|
8423
|
+
const typeMatch = /\btype\s*:\s*['"`](\w+)['"`]/.exec(paramEntry.body);
|
|
8424
|
+
if (!typeMatch)
|
|
8425
|
+
continue;
|
|
8426
|
+
const paramDescriptionMatch = /\bdescription\s*:\s*['"`]([^'"`]*)['"`]/.exec(paramEntry.body);
|
|
8427
|
+
const requiredMatch = /\brequired\s*:\s*(true|false)/.exec(paramEntry.body);
|
|
8428
|
+
params[paramEntry.key] = {
|
|
8429
|
+
type: typeMatch[1],
|
|
8430
|
+
...paramDescriptionMatch?.[1] ? { description: paramDescriptionMatch[1] } : {},
|
|
8431
|
+
...requiredMatch?.[1] === "true" ? { required: true } : {}
|
|
8290
8432
|
};
|
|
8291
8433
|
}
|
|
8292
8434
|
if (Object.keys(params).length > 0) {
|
|
@@ -10015,9 +10157,30 @@ async function dev() {
|
|
|
10015
10157
|
|
|
10016
10158
|
// src/commands/run.ts
|
|
10017
10159
|
init_source();
|
|
10018
|
-
import { existsSync as existsSync9, cpSync as cpSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
10160
|
+
import { existsSync as existsSync9, cpSync as cpSync2, mkdirSync as mkdirSync3, readdirSync as readdirSync4, chmodSync, lstatSync } from "fs";
|
|
10019
10161
|
import { join as join11 } from "path";
|
|
10020
10162
|
init_appdir();
|
|
10163
|
+
function ensureBinExecutable(installDir) {
|
|
10164
|
+
if (process.platform === "win32")
|
|
10165
|
+
return;
|
|
10166
|
+
const binRoot = join11(installDir, "bin");
|
|
10167
|
+
if (!existsSync9(binRoot))
|
|
10168
|
+
return;
|
|
10169
|
+
const walk = (dir) => {
|
|
10170
|
+
for (const name of readdirSync4(dir)) {
|
|
10171
|
+
const path = join11(dir, name);
|
|
10172
|
+
const st = lstatSync(path);
|
|
10173
|
+
if (st.isSymbolicLink())
|
|
10174
|
+
continue;
|
|
10175
|
+
if (st.isDirectory()) {
|
|
10176
|
+
walk(path);
|
|
10177
|
+
} else if (st.isFile()) {
|
|
10178
|
+
chmodSync(path, st.mode | 73);
|
|
10179
|
+
}
|
|
10180
|
+
}
|
|
10181
|
+
};
|
|
10182
|
+
walk(binRoot);
|
|
10183
|
+
}
|
|
10021
10184
|
function install() {
|
|
10022
10185
|
const root = process.cwd();
|
|
10023
10186
|
if (!exists(root)) {
|
|
@@ -10036,7 +10199,8 @@ function install() {
|
|
|
10036
10199
|
}
|
|
10037
10200
|
const installDir = spaceDir(m.id);
|
|
10038
10201
|
mkdirSync3(installDir, { recursive: true });
|
|
10039
|
-
cpSync2(distDir, installDir, { recursive: true });
|
|
10202
|
+
cpSync2(distDir, installDir, { recursive: true, verbatimSymlinks: true });
|
|
10203
|
+
ensureBinExecutable(installDir);
|
|
10040
10204
|
console.log(source_default.green(`Installed ${m.name} \u2192 ${installDir}`));
|
|
10041
10205
|
console.log(source_default.dim(" Restart Construct to load the updated space."));
|
|
10042
10206
|
}
|
|
@@ -10048,10 +10212,10 @@ import { join as join14, basename as basename6 } from "path";
|
|
|
10048
10212
|
init_auth();
|
|
10049
10213
|
|
|
10050
10214
|
// src/lib/pack.ts
|
|
10051
|
-
import { readdirSync as
|
|
10215
|
+
import { readdirSync as readdirSync6, statSync as statSync5, existsSync as existsSync11 } from "fs";
|
|
10052
10216
|
import { join as join13 } from "path";
|
|
10053
10217
|
import { tmpdir } from "os";
|
|
10054
|
-
import {
|
|
10218
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
10055
10219
|
var allowedDirs = [
|
|
10056
10220
|
"pages",
|
|
10057
10221
|
"components",
|
|
@@ -10090,7 +10254,7 @@ async function packSource(root) {
|
|
|
10090
10254
|
if (existsSync11(join13(root, name)))
|
|
10091
10255
|
entries.push(name);
|
|
10092
10256
|
}
|
|
10093
|
-
for (const entry of
|
|
10257
|
+
for (const entry of readdirSync6(root)) {
|
|
10094
10258
|
if (statSync5(join13(root, entry)).isDirectory())
|
|
10095
10259
|
continue;
|
|
10096
10260
|
if (allowedRootFiles.includes(entry))
|
|
@@ -10108,9 +10272,16 @@ async function packSource(root) {
|
|
|
10108
10272
|
if (validEntries.length === 0) {
|
|
10109
10273
|
throw new Error("No files to pack");
|
|
10110
10274
|
}
|
|
10111
|
-
const excludes =
|
|
10112
|
-
|
|
10113
|
-
|
|
10275
|
+
const excludes = [
|
|
10276
|
+
"--exclude=node_modules",
|
|
10277
|
+
"--exclude=dist",
|
|
10278
|
+
"--exclude=.git",
|
|
10279
|
+
"--exclude=*.env",
|
|
10280
|
+
"--exclude=*.log",
|
|
10281
|
+
"--exclude=*.lock",
|
|
10282
|
+
"--exclude=*.lockb"
|
|
10283
|
+
];
|
|
10284
|
+
execFileSync2("tar", ["czf", tarballPath, ...excludes, ...validEntries], { cwd: root });
|
|
10114
10285
|
const size = statSync5(tarballPath).size;
|
|
10115
10286
|
if (size > MAX_SIZE) {
|
|
10116
10287
|
throw new Error(`Source exceeds maximum size of ${MAX_SIZE / 1024 / 1024}MB`);
|
|
@@ -10389,7 +10560,7 @@ function validate3() {
|
|
|
10389
10560
|
|
|
10390
10561
|
// src/commands/check.ts
|
|
10391
10562
|
init_source();
|
|
10392
|
-
import { execSync as
|
|
10563
|
+
import { execSync as execSync2 } from "child_process";
|
|
10393
10564
|
import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
|
|
10394
10565
|
import { join as join16 } from "path";
|
|
10395
10566
|
function check() {
|
|
@@ -10433,7 +10604,7 @@ function check() {
|
|
|
10433
10604
|
const exec2 = rt.name === "bun" ? "bun" : "npx";
|
|
10434
10605
|
console.log(source_default.blue("Running type check..."));
|
|
10435
10606
|
try {
|
|
10436
|
-
|
|
10607
|
+
execSync2(`${exec2} vue-tsc --noEmit`, { cwd: root, stdio: "inherit" });
|
|
10437
10608
|
console.log(source_default.green("\u2713 Type check passed"));
|
|
10438
10609
|
} catch {
|
|
10439
10610
|
console.error(source_default.red("\u2717 Type check failed"));
|
|
@@ -10441,7 +10612,7 @@ function check() {
|
|
|
10441
10612
|
}
|
|
10442
10613
|
console.log(source_default.blue("Running linter..."));
|
|
10443
10614
|
try {
|
|
10444
|
-
|
|
10615
|
+
execSync2(`${exec2} eslint .`, { cwd: root, stdio: "inherit" });
|
|
10445
10616
|
console.log(source_default.green("\u2713 Lint passed"));
|
|
10446
10617
|
} catch {
|
|
10447
10618
|
console.error(source_default.red("\u2717 Lint failed"));
|
|
@@ -10576,13 +10747,13 @@ function logout() {
|
|
|
10576
10747
|
|
|
10577
10748
|
// src/commands/update.ts
|
|
10578
10749
|
init_source();
|
|
10579
|
-
import { execSync as
|
|
10750
|
+
import { execSync as execSync3 } from "child_process";
|
|
10580
10751
|
var PKG_NAME = "@construct-space/cli";
|
|
10581
10752
|
function update() {
|
|
10582
10753
|
console.log(source_default.blue(`Current version: ${VERSION}`));
|
|
10583
10754
|
let latest = VERSION;
|
|
10584
10755
|
try {
|
|
10585
|
-
latest =
|
|
10756
|
+
latest = execSync3(`npm view ${PKG_NAME} version`, { encoding: "utf-8" }).trim();
|
|
10586
10757
|
} catch {}
|
|
10587
10758
|
if (latest === VERSION) {
|
|
10588
10759
|
console.log(source_default.green("Already on the latest version."));
|
|
@@ -10593,18 +10764,18 @@ function update() {
|
|
|
10593
10764
|
try {
|
|
10594
10765
|
if (rt.name === "bun") {
|
|
10595
10766
|
try {
|
|
10596
|
-
|
|
10767
|
+
execSync3("bun pm cache rm", { stdio: "inherit" });
|
|
10597
10768
|
} catch {}
|
|
10598
|
-
|
|
10769
|
+
execSync3(`bun install -g ${PKG_NAME}@${latest}`, { stdio: "inherit" });
|
|
10599
10770
|
} else {
|
|
10600
|
-
|
|
10771
|
+
execSync3(`npm install -g --prefer-online ${PKG_NAME}@${latest}`, { stdio: "inherit" });
|
|
10601
10772
|
}
|
|
10602
10773
|
} catch (err) {
|
|
10603
10774
|
console.error(source_default.red(`Update failed: ${err.message}`));
|
|
10604
10775
|
process.exit(1);
|
|
10605
10776
|
}
|
|
10606
10777
|
try {
|
|
10607
|
-
const installed =
|
|
10778
|
+
const installed = execSync3(`${rt.name === "bun" ? "bun" : "npm"} ${rt.name === "bun" ? "pm ls -g" : "ls -g --depth=0"} ${PKG_NAME}`, { encoding: "utf-8" });
|
|
10608
10779
|
const match = installed.match(new RegExp(PKG_NAME.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "@(\\d[^\\s]*)"));
|
|
10609
10780
|
const resolved = match ? match[1] : "unknown";
|
|
10610
10781
|
if (resolved && resolved !== latest) {
|
|
@@ -10622,7 +10793,7 @@ function update() {
|
|
|
10622
10793
|
init_source();
|
|
10623
10794
|
import { existsSync as existsSync15, readFileSync as readFileSync11, writeFileSync as writeFileSync7, mkdirSync as mkdirSync5 } from "fs";
|
|
10624
10795
|
import { join as join18 } from "path";
|
|
10625
|
-
import { execSync as
|
|
10796
|
+
import { execSync as execSync4 } from "child_process";
|
|
10626
10797
|
function graphInit() {
|
|
10627
10798
|
const root = process.cwd();
|
|
10628
10799
|
if (!exists(root)) {
|
|
@@ -10649,7 +10820,7 @@ function graphInit() {
|
|
|
10649
10820
|
if (!pkg.dependencies["@construct-space/graph"]) {
|
|
10650
10821
|
let version = "0.1.0";
|
|
10651
10822
|
try {
|
|
10652
|
-
version =
|
|
10823
|
+
version = execSync4("npm view @construct-space/graph version", { encoding: "utf-8" }).trim();
|
|
10653
10824
|
} catch {}
|
|
10654
10825
|
pkg.dependencies["@construct-space/graph"] = `^${version}`;
|
|
10655
10826
|
writeFileSync7(pkgPath, JSON.stringify(pkg, null, 2) + `
|
|
@@ -10660,7 +10831,7 @@ function graphInit() {
|
|
|
10660
10831
|
}
|
|
10661
10832
|
const rt = detect();
|
|
10662
10833
|
console.log(source_default.dim(` Installing dependencies with ${rt.name}...`));
|
|
10663
|
-
|
|
10834
|
+
execSync4(rt.name === "bun" ? "bun install" : "npm install", { cwd: root, stdio: "inherit" });
|
|
10664
10835
|
console.log();
|
|
10665
10836
|
console.log(source_default.green("Graph initialized!"));
|
|
10666
10837
|
console.log();
|
|
@@ -10865,7 +11036,7 @@ function updateBarrel(modelsDir, modelName) {
|
|
|
10865
11036
|
|
|
10866
11037
|
// src/commands/graph/push.ts
|
|
10867
11038
|
init_source();
|
|
10868
|
-
import { existsSync as existsSync17, readdirSync as
|
|
11039
|
+
import { existsSync as existsSync17, readdirSync as readdirSync7, readFileSync as readFileSync13 } from "fs";
|
|
10869
11040
|
import { join as join20, basename as basename7 } from "path";
|
|
10870
11041
|
init_auth();
|
|
10871
11042
|
async function graphPush() {
|
|
@@ -10880,7 +11051,7 @@ async function graphPush() {
|
|
|
10880
11051
|
console.error(source_default.red("No src/models/ directory found. Run 'construct graph init' first."));
|
|
10881
11052
|
process.exit(1);
|
|
10882
11053
|
}
|
|
10883
|
-
const modelFiles =
|
|
11054
|
+
const modelFiles = readdirSync7(modelsDir).filter((f) => f.endsWith(".ts") && f !== "index.ts");
|
|
10884
11055
|
if (modelFiles.length === 0) {
|
|
10885
11056
|
console.error(source_default.red("No model files found in src/models/"));
|
|
10886
11057
|
console.log(source_default.dim(" Generate one: construct graph g User name:string email:string"));
|
|
@@ -11065,7 +11236,7 @@ function parseModelFile(content, fileName) {
|
|
|
11065
11236
|
|
|
11066
11237
|
// src/commands/graph/migrate.ts
|
|
11067
11238
|
init_source();
|
|
11068
|
-
import { existsSync as existsSync18, readdirSync as
|
|
11239
|
+
import { existsSync as existsSync18, readdirSync as readdirSync8, readFileSync as readFileSync14 } from "fs";
|
|
11069
11240
|
import { join as join21, basename as basename8 } from "path";
|
|
11070
11241
|
init_auth();
|
|
11071
11242
|
async function graphMigrate(options) {
|
|
@@ -11103,7 +11274,7 @@ async function graphMigrate(options) {
|
|
|
11103
11274
|
spinner.fail("Could not fetch schema");
|
|
11104
11275
|
process.exit(1);
|
|
11105
11276
|
}
|
|
11106
|
-
const modelFiles =
|
|
11277
|
+
const modelFiles = readdirSync8(modelsDir).filter((f) => f.endsWith(".ts") && f !== "index.ts");
|
|
11107
11278
|
const localModels = [];
|
|
11108
11279
|
for (const file of modelFiles) {
|
|
11109
11280
|
const content = readFileSync14(join21(modelsDir, file), "utf-8");
|
|
@@ -11242,7 +11413,7 @@ function graphFork(newSpaceID) {
|
|
|
11242
11413
|
// package.json
|
|
11243
11414
|
var package_default = {
|
|
11244
11415
|
name: "@construct-space/cli",
|
|
11245
|
-
version: "1.
|
|
11416
|
+
version: "1.7.0",
|
|
11246
11417
|
description: "Construct CLI \u2014 scaffold, build, develop, and publish spaces",
|
|
11247
11418
|
type: "module",
|
|
11248
11419
|
bin: {
|
|
@@ -14,15 +14,6 @@ const hostExternals = [
|
|
|
14
14
|
'pinia',
|
|
15
15
|
'@vueuse/core',
|
|
16
16
|
'@vueuse/integrations',
|
|
17
|
-
'@tauri-apps/api',
|
|
18
|
-
'@tauri-apps/api/core',
|
|
19
|
-
'@tauri-apps/api/path',
|
|
20
|
-
'@tauri-apps/api/event',
|
|
21
|
-
'@tauri-apps/api/webview',
|
|
22
|
-
'@tauri-apps/plugin-fs',
|
|
23
|
-
'@tauri-apps/plugin-shell',
|
|
24
|
-
'@tauri-apps/plugin-dialog',
|
|
25
|
-
'@tauri-apps/plugin-process',
|
|
26
17
|
'lucide-vue-next',
|
|
27
18
|
'date-fns',
|
|
28
19
|
'dexie',
|
package/package.json
CHANGED
|
@@ -14,15 +14,6 @@ const hostExternals = [
|
|
|
14
14
|
'pinia',
|
|
15
15
|
'@vueuse/core',
|
|
16
16
|
'@vueuse/integrations',
|
|
17
|
-
'@tauri-apps/api',
|
|
18
|
-
'@tauri-apps/api/core',
|
|
19
|
-
'@tauri-apps/api/path',
|
|
20
|
-
'@tauri-apps/api/event',
|
|
21
|
-
'@tauri-apps/api/webview',
|
|
22
|
-
'@tauri-apps/plugin-fs',
|
|
23
|
-
'@tauri-apps/plugin-shell',
|
|
24
|
-
'@tauri-apps/plugin-dialog',
|
|
25
|
-
'@tauri-apps/plugin-process',
|
|
26
17
|
'lucide-vue-next',
|
|
27
18
|
'date-fns',
|
|
28
19
|
'dexie',
|