@construct-space/cli 1.1.8 → 1.1.11

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/index.js +270 -202
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
20
38
  var __export = (target, all) => {
21
39
  for (var name in all)
22
40
  __defProp(target, name, {
23
41
  get: all[name],
24
42
  enumerable: true,
25
43
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
44
+ set: __exportSetter.bind(all, name)
27
45
  });
28
46
  };
29
47
  var __require = import.meta.require;
@@ -2789,7 +2807,6 @@ Object.defineProperties(createChalk.prototype, styles2);
2789
2807
  var chalk = createChalk();
2790
2808
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
2791
2809
  var source_default = chalk;
2792
-
2793
2810
  // node_modules/@inquirer/core/dist/lib/key.js
2794
2811
  var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
2795
2812
  var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
@@ -2934,7 +2951,7 @@ var effectScheduler = {
2934
2951
  // node_modules/@inquirer/core/dist/lib/use-state.js
2935
2952
  function useState(defaultValue) {
2936
2953
  return withPointer((pointer) => {
2937
- const setState = AsyncResource2.bind(function setState(newValue) {
2954
+ const setState = AsyncResource2.bind(function setState2(newValue) {
2938
2955
  if (pointer.get() !== newValue) {
2939
2956
  pointer.set(newValue);
2940
2957
  handleChange();
@@ -4590,9 +4607,10 @@ function watchCmd(root, _rt) {
4590
4607
  return spawn("bun", ["run", "vite", "build", "--watch"], { cwd: root, stdio: "pipe" });
4591
4608
  }
4592
4609
  function runHook(hooks, hookName, root) {
4593
- if (!hooks || !hooks[hookName])
4610
+ const cmd = hooks?.[hookName];
4611
+ if (!cmd)
4594
4612
  return;
4595
- execSync2(hooks[hookName], { cwd: root, stdio: "inherit" });
4613
+ execSync2(cmd, { cwd: root, stdio: "inherit" });
4596
4614
  }
4597
4615
 
4598
4616
  // src/commands/scaffold.ts
@@ -4709,7 +4727,7 @@ async function scaffold(nameArg, options) {
4709
4727
  }
4710
4728
 
4711
4729
  // src/commands/build.ts
4712
- import { existsSync as existsSync6, readFileSync as readFileSync4, readdirSync as readdirSync3, renameSync, statSync as statSync3 } from "fs";
4730
+ import { existsSync as existsSync6, readFileSync as readFileSync4, readdirSync as readdirSync2, renameSync, statSync as statSync2 } from "fs";
4713
4731
  import { join as join6 } from "path";
4714
4732
  import { createHash } from "crypto";
4715
4733
 
@@ -7390,84 +7408,30 @@ function exists(dir) {
7390
7408
  }
7391
7409
 
7392
7410
  // src/lib/entry.ts
7393
- import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, existsSync as existsSync4, readdirSync, statSync } from "fs";
7394
- import { join as join4, basename, extname, relative } from "path";
7411
+ import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, existsSync as existsSync4 } from "fs";
7412
+ import { join as join4, basename, extname } from "path";
7395
7413
  function capitalize(s) {
7396
7414
  if (!s)
7397
7415
  return s;
7398
7416
  return s.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
7399
7417
  }
7400
- function scanPagesDir(pagesDir) {
7401
- const results = [];
7402
- function walk(dir, routeSegments) {
7403
- if (!existsSync4(dir))
7404
- return;
7405
- const entries = readdirSync(dir).sort();
7406
- for (const entry of entries) {
7407
- const fullPath = join4(dir, entry);
7408
- const stat = statSync(fullPath);
7409
- if (stat.isDirectory()) {
7410
- const segment = entry.replace(/^\[(.+)\]$/, ":$1");
7411
- walk(fullPath, [...routeSegments, segment]);
7412
- } else if (stat.isFile() && entry.endsWith(".vue")) {
7413
- const nameWithoutExt = entry.replace(/\.vue$/, "");
7414
- const relFile = relative(join4(pagesDir, ".."), fullPath).replace(/\\/g, "/");
7415
- let routePath;
7416
- if (nameWithoutExt === "index") {
7417
- routePath = routeSegments.join("/");
7418
- } else {
7419
- const segment = nameWithoutExt.replace(/^\[(.+)\]$/, ":$1");
7420
- routePath = [...routeSegments, segment].join("/");
7421
- }
7422
- results.push({ filePath: relFile, routePath });
7423
- }
7424
- }
7425
- }
7426
- walk(pagesDir, []);
7427
- return results;
7428
- }
7429
- function varNameFromFile(filePath) {
7430
- let cleaned = filePath.replace(/^pages\//, "").replace(/\.vue$/, "");
7431
- cleaned = cleaned.replace(/\[([^\]]+)\]/g, "$1");
7432
- const segments = cleaned.split(/[\/-]/).filter(Boolean);
7433
- const name = segments.map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
7434
- return (name || "Index") + "Page";
7435
- }
7436
- function resolvePages(m, root, prefix) {
7437
- const pagesDir = join4(root, "src", "pages");
7438
- const fsPages = scanPagesDir(pagesDir);
7439
- const fsMap = new Map;
7440
- for (const fp of fsPages) {
7441
- fsMap.set(fp.routePath, fp);
7442
- }
7418
+ function resolvePages(m, prefix) {
7443
7419
  return m.pages.map((p) => {
7444
- if (p.component) {
7445
- const base = basename(p.component);
7446
- const nameWithoutExt = base.replace(extname(base), "").replace(/[\[\]]/g, "");
7447
- const dir = p.component.replace(/^pages\//, "").replace(/\/[^/]+$/, "");
7448
- let varName;
7449
- if (dir && dir !== p.component.replace(/^pages\//, "")) {
7450
- varName = capitalize(dir.split("/").map((s) => s.replace(/[\[\]]/g, "")).join("-")) + capitalize(nameWithoutExt) + "Page";
7451
- } else {
7452
- varName = capitalize(nameWithoutExt) + "Page";
7453
- }
7454
- return { varName, importPath: prefix + p.component, path: p.path };
7420
+ let component = p.component;
7421
+ if (!component) {
7422
+ component = p.path === "" ? "pages/index.vue" : `pages/${p.path}.vue`;
7455
7423
  }
7456
- const fsPage = fsMap.get(p.path);
7457
- if (fsPage) {
7458
- const varName = varNameFromFile(fsPage.filePath);
7459
- return { varName, importPath: prefix + fsPage.filePath, path: p.path };
7460
- }
7461
- const legacyComponent = p.path === "" ? "pages/index.vue" : `pages/${p.path}.vue`;
7462
- const legacyFullPath = join4(root, "src", legacyComponent);
7463
- if (existsSync4(legacyFullPath)) {
7464
- let varName = "IndexPage";
7465
- if (p.path) {
7466
- varName = capitalize(p.path.replace(/[\/:]/g, "-").replace(/-+/g, "-")) + "Page";
7424
+ let varName = "IndexPage";
7425
+ if (p.path) {
7426
+ let cleanPath = p.path.replace(/:/g, "");
7427
+ if (p.component) {
7428
+ let base = basename(p.component);
7429
+ base = base.replace(extname(base), "").replace(/[\[\]]/g, "");
7430
+ cleanPath = base;
7467
7431
  }
7468
- return { varName, importPath: prefix + legacyComponent, path: p.path };
7432
+ varName = capitalize(cleanPath) + "Page";
7469
7433
  }
7470
- throw new Error(`[entry] Could not resolve component for page "${p.path}". ` + `Checked: manifest component field, filesystem scan of src/pages/, ` + `and legacy fallback at ${legacyComponent}. ` + `Ensure a .vue file exists for this route.`);
7434
+ return { varName, importPath: prefix + component, path: p.path };
7471
7435
  });
7472
7436
  }
7473
7437
  function resolveWidgets(m, prefix) {
@@ -7486,7 +7450,7 @@ function resolveWidgets(m, prefix) {
7486
7450
  }
7487
7451
  function generate(root, m) {
7488
7452
  const pagePrefix = existsSync4(join4(root, "src", "pages")) ? "./" : "../";
7489
- const pages = resolvePages(m, root, pagePrefix);
7453
+ const pages = resolvePages(m, pagePrefix);
7490
7454
  const widgets = resolveWidgets(m, "../");
7491
7455
  const actionsPath = join4(root, "src", "actions.ts");
7492
7456
  const hasActions = existsSync4(actionsPath);
@@ -7542,7 +7506,7 @@ function writeEntry(root, m) {
7542
7506
  }
7543
7507
 
7544
7508
  // src/lib/agent.ts
7545
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync4, readdirSync as readdirSync2, existsSync as existsSync5 } from "fs";
7509
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync4, readdirSync, existsSync as existsSync5 } from "fs";
7546
7510
  import { join as join5, extname as extname2, basename as basename2 } from "path";
7547
7511
  var AGENT_KEY = "construct-agent-obfuscate-v1";
7548
7512
  function encode(content) {
@@ -7558,7 +7522,7 @@ function readMdFiles(dir) {
7558
7522
  const result = {};
7559
7523
  if (!existsSync5(dir))
7560
7524
  return result;
7561
- for (const f of readdirSync2(dir)) {
7525
+ for (const f of readdirSync(dir)) {
7562
7526
  if (extname2(f) !== ".md")
7563
7527
  continue;
7564
7528
  result[basename2(f, ".md")] = readFileSync3(join5(dir, f), "utf-8");
@@ -7569,7 +7533,7 @@ function readJsonFiles(dir) {
7569
7533
  const result = {};
7570
7534
  if (!existsSync5(dir))
7571
7535
  return result;
7572
- for (const f of readdirSync2(dir)) {
7536
+ for (const f of readdirSync(dir)) {
7573
7537
  if (extname2(f) !== ".json")
7574
7538
  continue;
7575
7539
  result[basename2(f, ".json")] = readFileSync3(join5(dir, f), "utf-8");
@@ -7659,7 +7623,7 @@ async function build(options) {
7659
7623
  }
7660
7624
  runHook(m.hooks, "postBuild", root);
7661
7625
  const agentDir = join6(root, "agent");
7662
- if (existsSync6(agentDir) && statSync3(agentDir).isDirectory()) {
7626
+ if (existsSync6(agentDir) && statSync2(agentDir).isDirectory()) {
7663
7627
  const distDir2 = join6(root, "dist");
7664
7628
  bundleAgentDir(agentDir, distDir2);
7665
7629
  bundleAgentDir(agentDir, root);
@@ -7668,7 +7632,7 @@ async function build(options) {
7668
7632
  const expectedBundle = `space-${m.id}.iife.js`;
7669
7633
  let bundlePath = join6(distDir, expectedBundle);
7670
7634
  if (!existsSync6(bundlePath)) {
7671
- const matches = readdirSync3(distDir).filter((f) => f.startsWith("space-") && f.endsWith(".iife.js"));
7635
+ const matches = readdirSync2(distDir).filter((f) => f.startsWith("space-") && f.endsWith(".iife.js"));
7672
7636
  if (matches.length === 1) {
7673
7637
  renameSync(join6(distDir, matches[0]), bundlePath);
7674
7638
  const oldCSS = join6(distDir, matches[0].replace(".iife.js", ".css"));
@@ -7702,16 +7666,16 @@ import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
7702
7666
  import { join as join9 } from "path";
7703
7667
  import { createHash as createHash2 } from "crypto";
7704
7668
 
7705
- // node_modules/chokidar/index.js
7669
+ // node_modules/chokidar/esm/index.js
7670
+ import { stat as statcb } from "fs";
7671
+ import { stat as stat3, readdir as readdir2 } from "fs/promises";
7706
7672
  import { EventEmitter } from "events";
7707
- import { stat as statcb, Stats } from "fs";
7708
- import { readdir as readdir2, stat as stat3 } from "fs/promises";
7709
- import * as sp2 from "path";
7673
+ import * as sysPath2 from "path";
7710
7674
 
7711
- // node_modules/readdirp/index.js
7712
- import { lstat, readdir, realpath, stat } from "fs/promises";
7713
- import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "path";
7675
+ // node_modules/readdirp/esm/index.js
7676
+ import { stat, lstat, readdir, realpath } from "fs/promises";
7714
7677
  import { Readable } from "stream";
7678
+ import { resolve as presolve, relative as prelative, join as pjoin, sep as psep } from "path";
7715
7679
  var EntryTypes = {
7716
7680
  FILE_TYPE: "files",
7717
7681
  DIR_TYPE: "directories",
@@ -7767,20 +7731,6 @@ var normalizeFilter = (filter) => {
7767
7731
  };
7768
7732
 
7769
7733
  class ReaddirpStream extends Readable {
7770
- parents;
7771
- reading;
7772
- parent;
7773
- _stat;
7774
- _maxDepth;
7775
- _wantsDir;
7776
- _wantsFile;
7777
- _wantsEverything;
7778
- _root;
7779
- _isDirent;
7780
- _statsProp;
7781
- _rdOptions;
7782
- _fileFilter;
7783
- _directoryFilter;
7784
7734
  constructor(options = {}) {
7785
7735
  super({
7786
7736
  objectMode: true,
@@ -7797,7 +7747,7 @@ class ReaddirpStream extends Readable {
7797
7747
  } else {
7798
7748
  this._stat = statMethod;
7799
7749
  }
7800
- this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
7750
+ this._maxDepth = opts.depth ?? defaultOptions.depth;
7801
7751
  this._wantsDir = type ? DIR_TYPES.has(type) : false;
7802
7752
  this._wantsFile = type ? FILE_TYPES.has(type) : false;
7803
7753
  this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
@@ -7942,11 +7892,11 @@ function readdirp(root, options = {}) {
7942
7892
  return new ReaddirpStream(options);
7943
7893
  }
7944
7894
 
7945
- // node_modules/chokidar/handler.js
7946
- import { watch as fs_watch, unwatchFile, watchFile } from "fs";
7947
- import { realpath as fsrealpath, lstat as lstat2, open, stat as stat2 } from "fs/promises";
7895
+ // node_modules/chokidar/esm/handler.js
7896
+ import { watchFile, unwatchFile, watch as fs_watch } from "fs";
7897
+ import { open, stat as stat2, lstat as lstat2, realpath as fsrealpath } from "fs/promises";
7898
+ import * as sysPath from "path";
7948
7899
  import { type as osType } from "os";
7949
- import * as sp from "path";
7950
7900
  var STR_DATA = "data";
7951
7901
  var STR_END = "end";
7952
7902
  var STR_CLOSE = "close";
@@ -8238,7 +8188,7 @@ var binaryExtensions = new Set([
8238
8188
  "zip",
8239
8189
  "zipx"
8240
8190
  ]);
8241
- var isBinaryPath = (filePath) => binaryExtensions.has(sp.extname(filePath).slice(1).toLowerCase());
8191
+ var isBinaryPath = (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase());
8242
8192
  var foreach = (val, fn) => {
8243
8193
  if (val instanceof Set) {
8244
8194
  val.forEach(fn);
@@ -8276,7 +8226,7 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
8276
8226
  listener(path);
8277
8227
  emitRaw(rawEvent, evPath, { watchedPath: path });
8278
8228
  if (evPath && path !== evPath) {
8279
- fsWatchBroadcast(sp.resolve(path, evPath), KEY_LISTENERS, sp.join(path, evPath));
8229
+ fsWatchBroadcast(sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath));
8280
8230
  }
8281
8231
  };
8282
8232
  try {
@@ -8391,19 +8341,17 @@ var setFsWatchFileListener = (path, fullPath, options, handlers) => {
8391
8341
  };
8392
8342
 
8393
8343
  class NodeFsHandler {
8394
- fsw;
8395
- _boundHandleError;
8396
8344
  constructor(fsW) {
8397
8345
  this.fsw = fsW;
8398
8346
  this._boundHandleError = (error2) => fsW._handleError(error2);
8399
8347
  }
8400
8348
  _watchWithNodeFs(path, listener) {
8401
8349
  const opts = this.fsw.options;
8402
- const directory = sp.dirname(path);
8403
- const basename4 = sp.basename(path);
8350
+ const directory = sysPath.dirname(path);
8351
+ const basename4 = sysPath.basename(path);
8404
8352
  const parent = this.fsw._getWatchedDir(directory);
8405
8353
  parent.add(basename4);
8406
- const absolutePath = sp.resolve(path);
8354
+ const absolutePath = sysPath.resolve(path);
8407
8355
  const options = {
8408
8356
  persistent: opts.persistent
8409
8357
  };
@@ -8430,8 +8378,8 @@ class NodeFsHandler {
8430
8378
  if (this.fsw.closed) {
8431
8379
  return;
8432
8380
  }
8433
- const dirname3 = sp.dirname(file);
8434
- const basename4 = sp.basename(file);
8381
+ const dirname3 = sysPath.dirname(file);
8382
+ const basename4 = sysPath.basename(file);
8435
8383
  const parent = this.fsw._getWatchedDir(dirname3);
8436
8384
  let prevStats = stats;
8437
8385
  if (parent.has(basename4))
@@ -8514,9 +8462,8 @@ class NodeFsHandler {
8514
8462
  this.fsw._symlinkPaths.set(full, true);
8515
8463
  }
8516
8464
  _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
8517
- directory = sp.join(directory, "");
8518
- const throttleKey = target ? `${directory}:${target}` : directory;
8519
- throttler = this.fsw._throttle("readdir", throttleKey, 1000);
8465
+ directory = sysPath.join(directory, "");
8466
+ throttler = this.fsw._throttle("readdir", directory, 1000);
8520
8467
  if (!throttler)
8521
8468
  return;
8522
8469
  const previous = this.fsw._getWatchedDir(wh.path);
@@ -8533,7 +8480,7 @@ class NodeFsHandler {
8533
8480
  return;
8534
8481
  }
8535
8482
  const item = entry.path;
8536
- let path = sp.join(directory, item);
8483
+ let path = sysPath.join(directory, item);
8537
8484
  current.add(item);
8538
8485
  if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) {
8539
8486
  return;
@@ -8544,7 +8491,7 @@ class NodeFsHandler {
8544
8491
  }
8545
8492
  if (item === target || !target && !previous.has(item)) {
8546
8493
  this.fsw._incrReadyCount();
8547
- path = sp.join(dir, sp.relative(dir, path));
8494
+ path = sysPath.join(dir, sysPath.relative(dir, path));
8548
8495
  this._addToNodeFs(path, initialAdd, wh, depth + 1);
8549
8496
  }
8550
8497
  }).on(EV.ERROR, this._boundHandleError);
@@ -8570,12 +8517,12 @@ class NodeFsHandler {
8570
8517
  });
8571
8518
  }
8572
8519
  async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath2) {
8573
- const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
8574
- const tracked = parentDir.has(sp.basename(dir));
8520
+ const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
8521
+ const tracked = parentDir.has(sysPath.basename(dir));
8575
8522
  if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
8576
8523
  this.fsw._emit(EV.ADD_DIR, dir, stats);
8577
8524
  }
8578
- parentDir.add(sp.basename(dir));
8525
+ parentDir.add(sysPath.basename(dir));
8579
8526
  this.fsw._getWatchedDir(dir);
8580
8527
  let throttler;
8581
8528
  let closer;
@@ -8616,7 +8563,7 @@ class NodeFsHandler {
8616
8563
  const follow = this.fsw.options.followSymlinks;
8617
8564
  let closer;
8618
8565
  if (stats.isDirectory()) {
8619
- const absPath = sp.resolve(path);
8566
+ const absPath = sysPath.resolve(path);
8620
8567
  const targetPath = follow ? await fsrealpath(path) : path;
8621
8568
  if (this.fsw.closed)
8622
8569
  return;
@@ -8630,14 +8577,14 @@ class NodeFsHandler {
8630
8577
  const targetPath = follow ? await fsrealpath(path) : path;
8631
8578
  if (this.fsw.closed)
8632
8579
  return;
8633
- const parent = sp.dirname(wh.watchPath);
8580
+ const parent = sysPath.dirname(wh.watchPath);
8634
8581
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
8635
8582
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
8636
8583
  closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
8637
8584
  if (this.fsw.closed)
8638
8585
  return;
8639
8586
  if (targetPath !== undefined) {
8640
- this.fsw._symlinkPaths.set(sp.resolve(path), targetPath);
8587
+ this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
8641
8588
  }
8642
8589
  } else {
8643
8590
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
@@ -8655,7 +8602,7 @@ class NodeFsHandler {
8655
8602
  }
8656
8603
  }
8657
8604
 
8658
- // node_modules/chokidar/index.js
8605
+ // node_modules/chokidar/esm/index.js
8659
8606
  /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
8660
8607
  var SLASH = "/";
8661
8608
  var SLASH_SLASH = "//";
@@ -8663,7 +8610,7 @@ var ONE_DOT = ".";
8663
8610
  var TWO_DOTS = "..";
8664
8611
  var STRING_TYPE = "string";
8665
8612
  var BACK_SLASH_RE = /\\/g;
8666
- var DOUBLE_SLASH_RE = /\/\//g;
8613
+ var DOUBLE_SLASH_RE = /\/\//;
8667
8614
  var DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
8668
8615
  var REPLACER_RE = /^\.[/\\]/;
8669
8616
  function arrify(item) {
@@ -8682,11 +8629,11 @@ function createPattern(matcher) {
8682
8629
  if (matcher.path === string)
8683
8630
  return true;
8684
8631
  if (matcher.recursive) {
8685
- const relative4 = sp2.relative(matcher.path, string);
8686
- if (!relative4) {
8632
+ const relative3 = sysPath2.relative(matcher.path, string);
8633
+ if (!relative3) {
8687
8634
  return false;
8688
8635
  }
8689
- return !relative4.startsWith("..") && !sp2.isAbsolute(relative4);
8636
+ return !relative3.startsWith("..") && !sysPath2.isAbsolute(relative3);
8690
8637
  }
8691
8638
  return false;
8692
8639
  };
@@ -8696,12 +8643,14 @@ function createPattern(matcher) {
8696
8643
  function normalizePath(path) {
8697
8644
  if (typeof path !== "string")
8698
8645
  throw new Error("string expected");
8699
- path = sp2.normalize(path);
8646
+ path = sysPath2.normalize(path);
8700
8647
  path = path.replace(/\\/g, "/");
8701
8648
  let prepend = false;
8702
8649
  if (path.startsWith("//"))
8703
8650
  prepend = true;
8704
- path = path.replace(DOUBLE_SLASH_RE, "/");
8651
+ const DOUBLE_SLASH_RE2 = /\/\//;
8652
+ while (path.match(DOUBLE_SLASH_RE2))
8653
+ path = path.replace(DOUBLE_SLASH_RE2, "/");
8705
8654
  if (prepend)
8706
8655
  path = "/" + path;
8707
8656
  return path;
@@ -8742,32 +8691,31 @@ var toUnix = (string) => {
8742
8691
  if (str.startsWith(SLASH_SLASH)) {
8743
8692
  prepend = true;
8744
8693
  }
8745
- str = str.replace(DOUBLE_SLASH_RE, SLASH);
8694
+ while (str.match(DOUBLE_SLASH_RE)) {
8695
+ str = str.replace(DOUBLE_SLASH_RE, SLASH);
8696
+ }
8746
8697
  if (prepend) {
8747
8698
  str = SLASH + str;
8748
8699
  }
8749
8700
  return str;
8750
8701
  };
8751
- var normalizePathToUnix = (path) => toUnix(sp2.normalize(toUnix(path)));
8702
+ var normalizePathToUnix = (path) => toUnix(sysPath2.normalize(toUnix(path)));
8752
8703
  var normalizeIgnored = (cwd = "") => (path) => {
8753
8704
  if (typeof path === "string") {
8754
- return normalizePathToUnix(sp2.isAbsolute(path) ? path : sp2.join(cwd, path));
8705
+ return normalizePathToUnix(sysPath2.isAbsolute(path) ? path : sysPath2.join(cwd, path));
8755
8706
  } else {
8756
8707
  return path;
8757
8708
  }
8758
8709
  };
8759
8710
  var getAbsolutePath = (path, cwd) => {
8760
- if (sp2.isAbsolute(path)) {
8711
+ if (sysPath2.isAbsolute(path)) {
8761
8712
  return path;
8762
8713
  }
8763
- return sp2.join(cwd, path);
8714
+ return sysPath2.join(cwd, path);
8764
8715
  };
8765
8716
  var EMPTY_SET = Object.freeze(new Set);
8766
8717
 
8767
8718
  class DirEntry {
8768
- path;
8769
- _removeWatcher;
8770
- items;
8771
8719
  constructor(dir, removeWatcher) {
8772
8720
  this.path = dir;
8773
8721
  this._removeWatcher = removeWatcher;
@@ -8792,7 +8740,7 @@ class DirEntry {
8792
8740
  await readdir2(dir);
8793
8741
  } catch (err) {
8794
8742
  if (this._removeWatcher) {
8795
- this._removeWatcher(sp2.dirname(dir), sp2.basename(dir));
8743
+ this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
8796
8744
  }
8797
8745
  }
8798
8746
  }
@@ -8820,19 +8768,12 @@ var STAT_METHOD_F = "stat";
8820
8768
  var STAT_METHOD_L = "lstat";
8821
8769
 
8822
8770
  class WatchHelper {
8823
- fsw;
8824
- path;
8825
- watchPath;
8826
- fullWatchPath;
8827
- dirParts;
8828
- followSymlinks;
8829
- statMethod;
8830
8771
  constructor(path, follow, fsw) {
8831
8772
  this.fsw = fsw;
8832
8773
  const watchPath = path;
8833
8774
  this.path = path = path.replace(REPLACER_RE, "");
8834
8775
  this.watchPath = watchPath;
8835
- this.fullWatchPath = sp2.resolve(watchPath);
8776
+ this.fullWatchPath = sysPath2.resolve(watchPath);
8836
8777
  this.dirParts = [];
8837
8778
  this.dirParts.forEach((parts) => {
8838
8779
  if (parts.length > 1)
@@ -8842,7 +8783,7 @@ class WatchHelper {
8842
8783
  this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
8843
8784
  }
8844
8785
  entryPath(entry) {
8845
- return sp2.join(this.watchPath, sp2.relative(this.watchPath, entry.fullPath));
8786
+ return sysPath2.join(this.watchPath, sysPath2.relative(this.watchPath, entry.fullPath));
8846
8787
  }
8847
8788
  filterPath(entry) {
8848
8789
  const { stats } = entry;
@@ -8857,24 +8798,6 @@ class WatchHelper {
8857
8798
  }
8858
8799
 
8859
8800
  class FSWatcher extends EventEmitter {
8860
- closed;
8861
- options;
8862
- _closers;
8863
- _ignoredPaths;
8864
- _throttled;
8865
- _streams;
8866
- _symlinkPaths;
8867
- _watched;
8868
- _pendingWrites;
8869
- _pendingUnlinks;
8870
- _readyCount;
8871
- _emitReady;
8872
- _closePromise;
8873
- _userIgnored;
8874
- _readyEmitted;
8875
- _emitRaw;
8876
- _boundRemove;
8877
- _nodeFsHandler;
8878
8801
  constructor(_opts = {}) {
8879
8802
  super();
8880
8803
  this.closed = false;
@@ -8983,7 +8906,7 @@ class FSWatcher extends EventEmitter {
8983
8906
  return;
8984
8907
  results.forEach((item) => {
8985
8908
  if (item)
8986
- this.add(sp2.dirname(item), sp2.basename(_origAdd || item));
8909
+ this.add(sysPath2.dirname(item), sysPath2.basename(_origAdd || item));
8987
8910
  });
8988
8911
  });
8989
8912
  return this;
@@ -8994,10 +8917,10 @@ class FSWatcher extends EventEmitter {
8994
8917
  const paths = unifyPaths(paths_);
8995
8918
  const { cwd } = this.options;
8996
8919
  paths.forEach((path) => {
8997
- if (!sp2.isAbsolute(path) && !this._closers.has(path)) {
8920
+ if (!sysPath2.isAbsolute(path) && !this._closers.has(path)) {
8998
8921
  if (cwd)
8999
- path = sp2.join(cwd, path);
9000
- path = sp2.resolve(path);
8922
+ path = sysPath2.join(cwd, path);
8923
+ path = sysPath2.resolve(path);
9001
8924
  }
9002
8925
  this._closePath(path);
9003
8926
  this._addIgnoredPath(path);
@@ -9041,7 +8964,7 @@ class FSWatcher extends EventEmitter {
9041
8964
  getWatched() {
9042
8965
  const watchList = {};
9043
8966
  this._watched.forEach((entry, dir) => {
9044
- const key = this.options.cwd ? sp2.relative(this.options.cwd, dir) : dir;
8967
+ const key = this.options.cwd ? sysPath2.relative(this.options.cwd, dir) : dir;
9045
8968
  const index = key || ONE_DOT;
9046
8969
  watchList[index] = entry.getChildren().sort();
9047
8970
  });
@@ -9057,9 +8980,9 @@ class FSWatcher extends EventEmitter {
9057
8980
  return;
9058
8981
  const opts = this.options;
9059
8982
  if (isWindows)
9060
- path = sp2.normalize(path);
8983
+ path = sysPath2.normalize(path);
9061
8984
  if (opts.cwd)
9062
- path = sp2.relative(opts.cwd, path);
8985
+ path = sysPath2.relative(opts.cwd, path);
9063
8986
  const args = [path];
9064
8987
  if (stats != null)
9065
8988
  args.push(stats);
@@ -9110,7 +9033,7 @@ class FSWatcher extends EventEmitter {
9110
9033
  return this;
9111
9034
  }
9112
9035
  if (opts.alwaysStat && stats === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
9113
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path) : path;
9036
+ const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path) : path;
9114
9037
  let stats2;
9115
9038
  try {
9116
9039
  stats2 = await stat3(fullPath);
@@ -9166,8 +9089,8 @@ class FSWatcher extends EventEmitter {
9166
9089
  const pollInterval = awf.pollInterval;
9167
9090
  let timeoutHandler;
9168
9091
  let fullPath = path;
9169
- if (this.options.cwd && !sp2.isAbsolute(path)) {
9170
- fullPath = sp2.join(this.options.cwd, path);
9092
+ if (this.options.cwd && !sysPath2.isAbsolute(path)) {
9093
+ fullPath = sysPath2.join(this.options.cwd, path);
9171
9094
  }
9172
9095
  const now = new Date;
9173
9096
  const writes = this._pendingWrites;
@@ -9224,7 +9147,7 @@ class FSWatcher extends EventEmitter {
9224
9147
  return new WatchHelper(path, this.options.followSymlinks, this);
9225
9148
  }
9226
9149
  _getWatchedDir(directory) {
9227
- const dir = sp2.resolve(directory);
9150
+ const dir = sysPath2.resolve(directory);
9228
9151
  if (!this._watched.has(dir))
9229
9152
  this._watched.set(dir, new DirEntry(dir, this._boundRemove));
9230
9153
  return this._watched.get(dir);
@@ -9235,8 +9158,8 @@ class FSWatcher extends EventEmitter {
9235
9158
  return Boolean(Number(stats.mode) & 256);
9236
9159
  }
9237
9160
  _remove(directory, item, isDirectory) {
9238
- const path = sp2.join(directory, item);
9239
- const fullPath = sp2.resolve(path);
9161
+ const path = sysPath2.join(directory, item);
9162
+ const fullPath = sysPath2.resolve(path);
9240
9163
  isDirectory = isDirectory != null ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
9241
9164
  if (!this._throttle("remove", path, 100))
9242
9165
  return;
@@ -9254,7 +9177,7 @@ class FSWatcher extends EventEmitter {
9254
9177
  }
9255
9178
  let relPath = path;
9256
9179
  if (this.options.cwd)
9257
- relPath = sp2.relative(this.options.cwd, path);
9180
+ relPath = sysPath2.relative(this.options.cwd, path);
9258
9181
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
9259
9182
  const event = this._pendingWrites.get(relPath).cancelWait();
9260
9183
  if (event === EVENTS.ADD)
@@ -9269,8 +9192,8 @@ class FSWatcher extends EventEmitter {
9269
9192
  }
9270
9193
  _closePath(path) {
9271
9194
  this._closeFile(path);
9272
- const dir = sp2.dirname(path);
9273
- this._getWatchedDir(dir).remove(sp2.basename(path));
9195
+ const dir = sysPath2.dirname(path);
9196
+ this._getWatchedDir(dir).remove(sysPath2.basename(path));
9274
9197
  }
9275
9198
  _closeFile(path) {
9276
9199
  const closers = this._closers.get(path);
@@ -9439,17 +9362,51 @@ function install() {
9439
9362
  }
9440
9363
 
9441
9364
  // src/commands/publish.ts
9442
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync6, statSync as statSync5, unlinkSync as unlinkSync2 } from "fs";
9365
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync6, statSync as statSync4, unlinkSync as unlinkSync2 } from "fs";
9443
9366
  import { join as join14, basename as basename6 } from "path";
9444
9367
 
9445
9368
  // src/lib/auth.ts
9446
9369
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync, existsSync as existsSync9 } from "fs";
9447
9370
  import { join as join12, dirname as dirname4 } from "path";
9448
9371
  var CREDENTIALS_FILE = "credentials.json";
9372
+ var APP_PROFILES_FILE = "profiles.json";
9449
9373
  var DEFAULT_PORTAL = "https://developer.construct.space";
9450
9374
  function credentialsPath() {
9451
9375
  return join12(dataDir(), CREDENTIALS_FILE);
9452
9376
  }
9377
+ function appProfilesPath() {
9378
+ return join12(dataDir(), APP_PROFILES_FILE);
9379
+ }
9380
+ function appProfileAuthPath(profileId) {
9381
+ return join12(dataDir(), "profiles", profileId, "auth.json");
9382
+ }
9383
+ function loadFromApp() {
9384
+ try {
9385
+ const profilesPath = appProfilesPath();
9386
+ if (!existsSync9(profilesPath))
9387
+ return null;
9388
+ const profiles = JSON.parse(readFileSync6(profilesPath, "utf-8"));
9389
+ if (!profiles?.active_profile)
9390
+ return null;
9391
+ const authPath = appProfileAuthPath(profiles.active_profile);
9392
+ if (!existsSync9(authPath))
9393
+ return null;
9394
+ const auth = JSON.parse(readFileSync6(authPath, "utf-8"));
9395
+ if (!auth?.authenticated || !auth?.token)
9396
+ return null;
9397
+ return {
9398
+ token: auth.token,
9399
+ portal: DEFAULT_PORTAL,
9400
+ user: {
9401
+ id: auth.user.id,
9402
+ name: auth.user.name || [auth.user.first_name, auth.user.last_name].filter(Boolean).join(" ") || auth.user.email,
9403
+ email: auth.user.email
9404
+ }
9405
+ };
9406
+ } catch {
9407
+ return null;
9408
+ }
9409
+ }
9453
9410
  function store(creds) {
9454
9411
  const path = credentialsPath();
9455
9412
  mkdirSync4(dirname4(path), { recursive: true });
@@ -9457,9 +9414,12 @@ function store(creds) {
9457
9414
  `, { mode: 384 });
9458
9415
  }
9459
9416
  function load2() {
9417
+ const fromApp = loadFromApp();
9418
+ if (fromApp)
9419
+ return fromApp;
9460
9420
  const path = credentialsPath();
9461
9421
  if (!existsSync9(path)) {
9462
- throw new Error("not logged in \u2014 run 'construct login' first");
9422
+ throw new Error("not logged in \u2014 run 'construct login' first (or sign in to the Construct app)");
9463
9423
  }
9464
9424
  const data = JSON.parse(readFileSync6(path, "utf-8"));
9465
9425
  if (!data.token) {
@@ -9482,7 +9442,7 @@ function clear() {
9482
9442
  }
9483
9443
 
9484
9444
  // src/lib/pack.ts
9485
- import { readdirSync as readdirSync4, statSync as statSync4, existsSync as existsSync10 } from "fs";
9445
+ import { readdirSync as readdirSync3, statSync as statSync3, existsSync as existsSync10 } from "fs";
9486
9446
  import { join as join13 } from "path";
9487
9447
  import { tmpdir } from "os";
9488
9448
  import { execSync as execSync3 } from "child_process";
@@ -9524,8 +9484,8 @@ async function packSource(root) {
9524
9484
  if (existsSync10(join13(root, name)))
9525
9485
  entries.push(name);
9526
9486
  }
9527
- for (const entry of readdirSync4(root)) {
9528
- if (statSync4(join13(root, entry)).isDirectory())
9487
+ for (const entry of readdirSync3(root)) {
9488
+ if (statSync3(join13(root, entry)).isDirectory())
9529
9489
  continue;
9530
9490
  if (allowedRootFiles.includes(entry))
9531
9491
  continue;
@@ -9545,7 +9505,7 @@ async function packSource(root) {
9545
9505
  const excludes = "--exclude=node_modules --exclude=dist --exclude=.git --exclude=*.env --exclude=*.log --exclude=*.lock --exclude=*.lockb";
9546
9506
  const cmd = `tar czf "${tarballPath}" ${excludes} ${validEntries.join(" ")}`;
9547
9507
  execSync3(cmd, { cwd: root });
9548
- const size = statSync4(tarballPath).size;
9508
+ const size = statSync3(tarballPath).size;
9549
9509
  if (size > MAX_SIZE) {
9550
9510
  throw new Error(`Source exceeds maximum size of ${MAX_SIZE / 1024 / 1024}MB`);
9551
9511
  }
@@ -9602,6 +9562,24 @@ async function publish(options) {
9602
9562
  console.log(source_default.dim(" Run 'construct login' to authenticate."));
9603
9563
  process.exit(1);
9604
9564
  }
9565
+ const publishers = creds.publishers || [];
9566
+ if (publishers.length === 0) {
9567
+ console.log(source_default.yellow(" No publisher linked to this session. The upload will likely be rejected."));
9568
+ console.log(source_default.dim(" Run 'construct login' after enrolling at developer.construct.space."));
9569
+ } else {
9570
+ const primary = publishers[0];
9571
+ const kindLabel = primary.kind === "org" ? source_default.cyan("org") : primary.kind === "user" ? source_default.blue("personal") : source_default.dim("legacy");
9572
+ console.log(source_default.dim(` Publishing as ${primary.name} (${kindLabel})`));
9573
+ if (publishers.length > 1 && !yes) {
9574
+ const proceed = await dist_default4({
9575
+ message: `You have ${publishers.length} publisher identities. Publish under ${primary.name}?`
9576
+ });
9577
+ if (!proceed) {
9578
+ console.log("Cancelled.");
9579
+ return;
9580
+ }
9581
+ }
9582
+ }
9605
9583
  const status = gitSafe(root, "status", "--porcelain");
9606
9584
  if (status) {
9607
9585
  console.log(source_default.yellow("You have uncommitted changes."));
@@ -9685,7 +9663,7 @@ async function publish(options) {
9685
9663
  let tarballPath;
9686
9664
  try {
9687
9665
  tarballPath = await packSource(root);
9688
- const size = statSync5(tarballPath).size;
9666
+ const size = statSync4(tarballPath).size;
9689
9667
  spinner.succeed(`Source packed (${formatBytes(size)})`);
9690
9668
  } catch (err) {
9691
9669
  spinner.fail("Pack failed");
@@ -9867,6 +9845,12 @@ function clean(options) {
9867
9845
  import { createServer } from "http";
9868
9846
  async function login(options) {
9869
9847
  const portalURL = options?.portal || DEFAULT_PORTAL;
9848
+ const fromApp = loadFromApp();
9849
+ if (fromApp) {
9850
+ console.log(source_default.green(`Using Construct app profile: ${fromApp.user?.name || fromApp.user?.email}`));
9851
+ console.log(source_default.dim(" To use a different identity, sign out of the app or run `construct logout` after login."));
9852
+ return;
9853
+ }
9870
9854
  if (isAuthenticated()) {
9871
9855
  const creds = load2();
9872
9856
  const name = creds.user?.name || "unknown";
@@ -9932,18 +9916,101 @@ async function login(options) {
9932
9916
  const resp = await fetch(`${portalURL}/api/auth/cli-verify`, {
9933
9917
  headers: { Authorization: `Bearer ${token}` }
9934
9918
  });
9935
- const { user } = await resp.json();
9936
- store({ token, portal: portalURL, user });
9919
+ const { user, publishers } = await resp.json();
9920
+ store({ token, portal: portalURL, user, publishers });
9937
9921
  console.log();
9938
9922
  console.log(source_default.green(`Logged in as ${user?.name || "there"}`));
9923
+ const list = publishers || [];
9924
+ if (list.length === 0) {
9925
+ console.log(source_default.yellow(" No publisher yet. Run developer enrollment to publish spaces."));
9926
+ } else {
9927
+ for (const p of list) {
9928
+ const label = p.kind === "org" ? source_default.cyan("org") : p.kind === "user" ? source_default.blue("personal") : source_default.dim("legacy");
9929
+ console.log(source_default.dim(` Publisher: ${p.name} (${label})`));
9930
+ }
9931
+ }
9939
9932
  } catch (err) {
9940
9933
  console.error(source_default.red(`Login failed: ${err.message}`));
9941
9934
  process.exit(1);
9942
9935
  }
9943
9936
  }
9944
9937
  function logout() {
9938
+ const wasCli = isAuthenticated();
9945
9939
  clear();
9946
- console.log(source_default.green("Logged out."));
9940
+ if (wasCli) {
9941
+ console.log(source_default.green("Logged out of CLI credentials."));
9942
+ } else {
9943
+ console.log(source_default.dim("No CLI credentials to clear."));
9944
+ }
9945
+ const appStill = loadFromApp();
9946
+ if (appStill) {
9947
+ console.log();
9948
+ console.log(source_default.yellow("Note: the Construct app is still signed in as ") + source_default.white(appStill.user?.name || appStill.user?.email || ""));
9949
+ console.log(source_default.dim(" The CLI will continue to use the app profile. Sign out of the app to fully disconnect."));
9950
+ }
9951
+ }
9952
+
9953
+ // src/commands/whoami.ts
9954
+ async function whoami() {
9955
+ const fromApp = loadFromApp();
9956
+ let creds = null;
9957
+ let source = "none";
9958
+ if (fromApp) {
9959
+ creds = fromApp;
9960
+ source = "app";
9961
+ } else {
9962
+ try {
9963
+ creds = load2();
9964
+ source = "cli";
9965
+ } catch {
9966
+ source = "none";
9967
+ }
9968
+ }
9969
+ if (source === "none" || !creds) {
9970
+ console.log(source_default.yellow("Not signed in."));
9971
+ console.log(source_default.dim(" Run ") + source_default.white("construct login") + source_default.dim(" or sign in to the Construct app."));
9972
+ return;
9973
+ }
9974
+ const user = creds.user;
9975
+ const sourceLabel = source === "app" ? source_default.cyan("Construct app profile") : source_default.blue("CLI login");
9976
+ console.log();
9977
+ console.log(source_default.bold(user?.name || "Signed in"));
9978
+ console.log(source_default.dim(" " + (user?.email || "")));
9979
+ console.log(source_default.dim(" id: ") + source_default.dim(user?.id || "\u2014"));
9980
+ console.log(source_default.dim(" source: ") + sourceLabel);
9981
+ console.log(source_default.dim(" portal: ") + (creds.portal || DEFAULT_PORTAL));
9982
+ try {
9983
+ const resp = await fetch(`${creds.portal || DEFAULT_PORTAL}/api/auth/cli-verify`, {
9984
+ headers: { Authorization: `Bearer ${creds.token}` }
9985
+ });
9986
+ if (!resp.ok) {
9987
+ console.log(source_default.dim(" publishers: ") + source_default.red(`error (${resp.status})`));
9988
+ return;
9989
+ }
9990
+ const body = await resp.json();
9991
+ const list = body.publishers || [];
9992
+ if (list.length === 0) {
9993
+ console.log(source_default.dim(" publishers: ") + source_default.yellow("none yet \u2014 enroll at developer.construct.space"));
9994
+ return;
9995
+ }
9996
+ console.log();
9997
+ console.log(source_default.bold("Publishers"));
9998
+ for (const p of list) {
9999
+ const kindLabel = p.kind === "org" ? source_default.cyan("org") : p.kind === "user" ? source_default.blue("personal") : source_default.dim("legacy");
10000
+ const verified = p.verified ? source_default.green(" \u2713") : "";
10001
+ console.log(` ${source_default.white(p.name)} (${kindLabel})${verified}`);
10002
+ if (p.orgId)
10003
+ console.log(source_default.dim(` org: ${p.orgId}`));
10004
+ }
10005
+ } catch (err) {
10006
+ console.log(source_default.dim(" publishers: ") + source_default.red("could not reach portal"));
10007
+ }
10008
+ console.log();
10009
+ if (source === "app") {
10010
+ console.log(source_default.dim("To switch identities, change the active profile in the Construct app."));
10011
+ } else {
10012
+ console.log(source_default.dim("To switch identities, run 'construct logout' then 'construct login'."));
10013
+ }
9947
10014
  }
9948
10015
 
9949
10016
  // src/commands/update.ts
@@ -10218,7 +10285,7 @@ function updateBarrel(modelsDir, modelName) {
10218
10285
  }
10219
10286
 
10220
10287
  // src/commands/graph/push.ts
10221
- import { existsSync as existsSync16, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "fs";
10288
+ import { existsSync as existsSync16, readdirSync as readdirSync4, readFileSync as readFileSync12 } from "fs";
10222
10289
  import { join as join20, basename as basename7 } from "path";
10223
10290
  async function graphPush() {
10224
10291
  const root = process.cwd();
@@ -10232,7 +10299,7 @@ async function graphPush() {
10232
10299
  console.error(source_default.red("No src/models/ directory found. Run 'construct graph init' first."));
10233
10300
  process.exit(1);
10234
10301
  }
10235
- const modelFiles = readdirSync5(modelsDir).filter((f) => f.endsWith(".ts") && f !== "index.ts");
10302
+ const modelFiles = readdirSync4(modelsDir).filter((f) => f.endsWith(".ts") && f !== "index.ts");
10236
10303
  if (modelFiles.length === 0) {
10237
10304
  console.error(source_default.red("No model files found in src/models/"));
10238
10305
  console.log(source_default.dim(" Generate one: construct graph g User name:string email:string"));
@@ -10357,7 +10424,7 @@ function parseModelFile(content, fileName) {
10357
10424
  }
10358
10425
 
10359
10426
  // src/commands/graph/migrate.ts
10360
- import { existsSync as existsSync17, readdirSync as readdirSync6, readFileSync as readFileSync13 } from "fs";
10427
+ import { existsSync as existsSync17, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
10361
10428
  import { join as join21, basename as basename8 } from "path";
10362
10429
  async function graphMigrate(options) {
10363
10430
  const root = process.cwd();
@@ -10394,7 +10461,7 @@ async function graphMigrate(options) {
10394
10461
  spinner.fail("Could not fetch schema");
10395
10462
  process.exit(1);
10396
10463
  }
10397
- const modelFiles = readdirSync6(modelsDir).filter((f) => f.endsWith(".ts") && f !== "index.ts");
10464
+ const modelFiles = readdirSync5(modelsDir).filter((f) => f.endsWith(".ts") && f !== "index.ts");
10398
10465
  const localModels = [];
10399
10466
  for (const file of modelFiles) {
10400
10467
  const content = readFileSync13(join21(modelsDir, file), "utf-8");
@@ -10501,7 +10568,7 @@ function parseModelFields(content, fileName) {
10501
10568
  }
10502
10569
 
10503
10570
  // src/index.ts
10504
- var VERSION = "1.1.8";
10571
+ var VERSION = "1.1.11";
10505
10572
  var program2 = new Command;
10506
10573
  program2.name("construct").description("Construct CLI \u2014 scaffold, build, develop, and publish spaces").version(VERSION);
10507
10574
  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));
@@ -10514,6 +10581,7 @@ program2.command("check").description("Run type-check (vue-tsc) and linter (esli
10514
10581
  program2.command("clean").description("Remove build artifacts").option("--all", "Also remove node_modules and lockfiles").action((opts) => clean(opts));
10515
10582
  program2.command("login").description("Authenticate with Construct").option("--portal <url>", "Portal URL").action(async (opts) => login(opts));
10516
10583
  program2.command("logout").description("Sign out").action(() => logout());
10584
+ program2.command("whoami").alias("status").description("Show the active profile, its source (app or CLI), and linked publishers").action(() => whoami());
10517
10585
  program2.command("update").description("Update the CLI to the latest version").action(() => update());
10518
10586
  var graph = program2.command("graph").description("Construct Graph \u2014 data models and GraphQL");
10519
10587
  graph.command("init").description("Initialize Graph in a space project").action(() => graphInit());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@construct-space/cli",
3
- "version": "1.1.8",
3
+ "version": "1.1.11",
4
4
  "description": "Construct CLI — scaffold, build, develop, and publish spaces",
5
5
  "type": "module",
6
6
  "bin": {