@warmhub/cli 0.71.0 → 0.73.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.
Files changed (2) hide show
  1. package/dist/wh.js +980 -748
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -1,9 +1,678 @@
1
1
  #!/usr/bin/env node
2
2
  // @bun
3
3
  import { createRequire } from "node:module";
4
+ var __defProp = Object.defineProperty;
4
5
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
6
+ var __returnValue = (v) => v;
7
+ function __exportSetter(name, newValue) {
8
+ this[name] = __returnValue.bind(null, newValue);
9
+ }
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true,
15
+ configurable: true,
16
+ set: __exportSetter.bind(all, name)
17
+ });
18
+ };
19
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
5
20
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
6
21
 
22
+ // ../../node_modules/.bun/is-docker@3.0.0/node_modules/is-docker/index.js
23
+ import fs from "node:fs";
24
+ function hasDockerEnv() {
25
+ try {
26
+ fs.statSync("/.dockerenv");
27
+ return true;
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+ function hasDockerCGroup() {
33
+ try {
34
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
35
+ } catch {
36
+ return false;
37
+ }
38
+ }
39
+ function isDocker() {
40
+ if (isDockerCached === undefined) {
41
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
42
+ }
43
+ return isDockerCached;
44
+ }
45
+ var isDockerCached;
46
+ var init_is_docker = () => {};
47
+
48
+ // ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
49
+ import fs2 from "node:fs";
50
+ function isInsideContainer() {
51
+ if (cachedResult === undefined) {
52
+ cachedResult = hasContainerEnv() || isDocker();
53
+ }
54
+ return cachedResult;
55
+ }
56
+ var cachedResult, hasContainerEnv = () => {
57
+ try {
58
+ fs2.statSync("/run/.containerenv");
59
+ return true;
60
+ } catch {
61
+ return false;
62
+ }
63
+ };
64
+ var init_is_inside_container = __esm(() => {
65
+ init_is_docker();
66
+ });
67
+
68
+ // ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
69
+ import process2 from "node:process";
70
+ import os from "node:os";
71
+ import fs3 from "node:fs";
72
+ var isWsl = () => {
73
+ if (process2.platform !== "linux") {
74
+ return false;
75
+ }
76
+ if (os.release().toLowerCase().includes("microsoft")) {
77
+ if (isInsideContainer()) {
78
+ return false;
79
+ }
80
+ return true;
81
+ }
82
+ try {
83
+ if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
84
+ return !isInsideContainer();
85
+ }
86
+ } catch {}
87
+ if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
88
+ return !isInsideContainer();
89
+ }
90
+ return false;
91
+ }, is_wsl_default;
92
+ var init_is_wsl = __esm(() => {
93
+ init_is_inside_container();
94
+ is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
95
+ });
96
+
97
+ // ../../node_modules/.bun/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
98
+ import process3 from "node:process";
99
+ import { Buffer as Buffer2 } from "node:buffer";
100
+ import { promisify } from "node:util";
101
+ import childProcess from "node:child_process";
102
+ var execFile, powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {}) => {
103
+ const {
104
+ powerShellPath: psPath,
105
+ ...execFileOptions
106
+ } = options;
107
+ const encodedCommand = executePowerShell.encodeCommand(command);
108
+ return execFile(psPath ?? powerShellPath(), [
109
+ ...executePowerShell.argumentsPrefix,
110
+ encodedCommand
111
+ ], {
112
+ encoding: "utf8",
113
+ ...execFileOptions
114
+ });
115
+ };
116
+ var init_powershell_utils = __esm(() => {
117
+ execFile = promisify(childProcess.execFile);
118
+ executePowerShell.argumentsPrefix = [
119
+ "-NoProfile",
120
+ "-NonInteractive",
121
+ "-ExecutionPolicy",
122
+ "Bypass",
123
+ "-EncodedCommand"
124
+ ];
125
+ executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
126
+ executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
127
+ });
128
+
129
+ // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
130
+ function parseMountPointFromConfig(content) {
131
+ for (const line of content.split(`
132
+ `)) {
133
+ if (/^\s*#/.test(line)) {
134
+ continue;
135
+ }
136
+ const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
137
+ if (!match) {
138
+ continue;
139
+ }
140
+ return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
141
+ }
142
+ }
143
+
144
+ // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
145
+ import { promisify as promisify2 } from "node:util";
146
+ import childProcess2 from "node:child_process";
147
+ import fs4, { constants as fsConstants } from "node:fs/promises";
148
+ var execFile2, wslDrivesMountPoint, powerShellPathFromWsl = async () => {
149
+ const mountPoint = await wslDrivesMountPoint();
150
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
151
+ }, powerShellPath2, canAccessPowerShellPromise, canAccessPowerShell = async () => {
152
+ canAccessPowerShellPromise ??= (async () => {
153
+ try {
154
+ const psPath = await powerShellPath2();
155
+ await fs4.access(psPath, fsConstants.X_OK);
156
+ return true;
157
+ } catch {
158
+ return false;
159
+ }
160
+ })();
161
+ return canAccessPowerShellPromise;
162
+ }, wslDefaultBrowser = async () => {
163
+ const psPath = await powerShellPath2();
164
+ const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
165
+ const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
166
+ return stdout.trim();
167
+ }, convertWslPathToWindows = async (path) => {
168
+ if (/^[a-z]+:\/\//i.test(path)) {
169
+ return path;
170
+ }
171
+ try {
172
+ const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
173
+ return stdout.trim();
174
+ } catch {
175
+ return path;
176
+ }
177
+ };
178
+ var init_wsl_utils = __esm(() => {
179
+ init_is_wsl();
180
+ init_powershell_utils();
181
+ init_is_wsl();
182
+ execFile2 = promisify2(childProcess2.execFile);
183
+ wslDrivesMountPoint = (() => {
184
+ const defaultMountPoint = "/mnt/";
185
+ let mountPoint;
186
+ return async function() {
187
+ if (mountPoint) {
188
+ return mountPoint;
189
+ }
190
+ const configFilePath = "/etc/wsl.conf";
191
+ let isConfigFileExists = false;
192
+ try {
193
+ await fs4.access(configFilePath, fsConstants.F_OK);
194
+ isConfigFileExists = true;
195
+ } catch {}
196
+ if (!isConfigFileExists) {
197
+ return defaultMountPoint;
198
+ }
199
+ const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
200
+ const parsedMountPoint = parseMountPointFromConfig(configContent);
201
+ if (parsedMountPoint === undefined) {
202
+ return defaultMountPoint;
203
+ }
204
+ mountPoint = parsedMountPoint;
205
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
206
+ return mountPoint;
207
+ };
208
+ })();
209
+ powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
210
+ });
211
+
212
+ // ../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
213
+ function defineLazyProperty(object, propertyName, valueGetter) {
214
+ const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
215
+ Object.defineProperty(object, propertyName, {
216
+ configurable: true,
217
+ enumerable: true,
218
+ get() {
219
+ const result = valueGetter();
220
+ define(result);
221
+ return result;
222
+ },
223
+ set(value) {
224
+ define(value);
225
+ }
226
+ });
227
+ return object;
228
+ }
229
+
230
+ // ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
231
+ import { promisify as promisify3 } from "node:util";
232
+ import process4 from "node:process";
233
+ import { execFile as execFile3 } from "node:child_process";
234
+ async function defaultBrowserId() {
235
+ if (process4.platform !== "darwin") {
236
+ throw new Error("macOS only");
237
+ }
238
+ const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
239
+ const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
240
+ const browserId = match?.groups.id ?? "com.apple.Safari";
241
+ if (browserId === "com.apple.safari") {
242
+ return "com.apple.Safari";
243
+ }
244
+ return browserId;
245
+ }
246
+ var execFileAsync;
247
+ var init_default_browser_id = __esm(() => {
248
+ execFileAsync = promisify3(execFile3);
249
+ });
250
+
251
+ // ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
252
+ import process5 from "node:process";
253
+ import { promisify as promisify4 } from "node:util";
254
+ import { execFile as execFile4, execFileSync } from "node:child_process";
255
+ async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
256
+ if (process5.platform !== "darwin") {
257
+ throw new Error("macOS only");
258
+ }
259
+ const outputArguments = humanReadableOutput ? [] : ["-ss"];
260
+ const execOptions = {};
261
+ if (signal) {
262
+ execOptions.signal = signal;
263
+ }
264
+ const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
265
+ return stdout.trim();
266
+ }
267
+ var execFileAsync2;
268
+ var init_run_applescript = __esm(() => {
269
+ execFileAsync2 = promisify4(execFile4);
270
+ });
271
+
272
+ // ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
273
+ async function bundleName(bundleId) {
274
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
275
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
276
+ }
277
+ var init_bundle_name = __esm(() => {
278
+ init_run_applescript();
279
+ });
280
+
281
+ // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
282
+ import { promisify as promisify5 } from "node:util";
283
+ import { execFile as execFile5 } from "node:child_process";
284
+ async function defaultBrowser(_execFileAsync = execFileAsync3) {
285
+ const { stdout } = await _execFileAsync("reg", [
286
+ "QUERY",
287
+ " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
288
+ "/v",
289
+ "ProgId"
290
+ ]);
291
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
292
+ if (!match) {
293
+ throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
294
+ }
295
+ const { id } = match.groups;
296
+ const dotIndex = id.lastIndexOf(".");
297
+ const hyphenIndex = id.lastIndexOf("-");
298
+ const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
299
+ const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
300
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
301
+ }
302
+ var execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
303
+ var init_windows = __esm(() => {
304
+ execFileAsync3 = promisify5(execFile5);
305
+ windowsBrowserProgIds = {
306
+ MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
307
+ MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
308
+ MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
309
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
310
+ ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
311
+ ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
312
+ ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
313
+ ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
314
+ BraveHTML: { name: "Brave", id: "com.brave.Browser" },
315
+ BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
316
+ BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
317
+ BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
318
+ FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
319
+ OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
320
+ VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
321
+ "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
322
+ };
323
+ _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
324
+ UnknownBrowserError = class UnknownBrowserError extends Error {
325
+ };
326
+ });
327
+
328
+ // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
329
+ import { promisify as promisify6 } from "node:util";
330
+ import process6 from "node:process";
331
+ import { execFile as execFile6 } from "node:child_process";
332
+ async function defaultBrowser2() {
333
+ if (process6.platform === "darwin") {
334
+ const id = await defaultBrowserId();
335
+ const name = await bundleName(id);
336
+ return { name, id };
337
+ }
338
+ if (process6.platform === "linux") {
339
+ const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
340
+ const id = stdout.trim();
341
+ const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
342
+ return { name, id };
343
+ }
344
+ if (process6.platform === "win32") {
345
+ return defaultBrowser();
346
+ }
347
+ throw new Error("Only macOS, Linux, and Windows are supported");
348
+ }
349
+ var execFileAsync4, titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
350
+ var init_default_browser = __esm(() => {
351
+ init_default_browser_id();
352
+ init_bundle_name();
353
+ init_windows();
354
+ init_windows();
355
+ execFileAsync4 = promisify6(execFile6);
356
+ });
357
+
358
+ // ../../node_modules/.bun/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
359
+ import process7 from "node:process";
360
+ var isInSsh, is_in_ssh_default;
361
+ var init_is_in_ssh = __esm(() => {
362
+ isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
363
+ is_in_ssh_default = isInSsh;
364
+ });
365
+
366
+ // ../../node_modules/.bun/open@11.0.0/node_modules/open/index.js
367
+ var exports_open = {};
368
+ __export(exports_open, {
369
+ openApp: () => openApp,
370
+ default: () => open_default,
371
+ apps: () => apps
372
+ });
373
+ import process8 from "node:process";
374
+ import path from "node:path";
375
+ import { fileURLToPath } from "node:url";
376
+ import childProcess3 from "node:child_process";
377
+ import fs5, { constants as fsConstants2 } from "node:fs/promises";
378
+ function detectArchBinary(binary) {
379
+ if (typeof binary === "string" || Array.isArray(binary)) {
380
+ return binary;
381
+ }
382
+ const { [arch]: archBinary } = binary;
383
+ if (!archBinary) {
384
+ throw new Error(`${arch} is not supported`);
385
+ }
386
+ return archBinary;
387
+ }
388
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
389
+ if (wsl && is_wsl_default) {
390
+ return detectArchBinary(wsl);
391
+ }
392
+ if (!platformBinary) {
393
+ throw new Error(`${platform} is not supported`);
394
+ }
395
+ return detectArchBinary(platformBinary);
396
+ }
397
+ var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform, arch, tryEachApp = async (apps, opener) => {
398
+ if (apps.length === 0) {
399
+ return;
400
+ }
401
+ const errors = [];
402
+ for (const app of apps) {
403
+ try {
404
+ return await opener(app);
405
+ } catch (error) {
406
+ errors.push(error);
407
+ }
408
+ }
409
+ throw new AggregateError(errors, "Failed to open in all supported apps");
410
+ }, baseOpen = async (options) => {
411
+ options = {
412
+ wait: false,
413
+ background: false,
414
+ newInstance: false,
415
+ allowNonzeroExitCode: false,
416
+ ...options
417
+ };
418
+ const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
419
+ delete options[fallbackAttemptSymbol];
420
+ if (Array.isArray(options.app)) {
421
+ return tryEachApp(options.app, (singleApp) => baseOpen({
422
+ ...options,
423
+ app: singleApp,
424
+ [fallbackAttemptSymbol]: true
425
+ }));
426
+ }
427
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
428
+ appArguments = [...appArguments];
429
+ if (Array.isArray(app)) {
430
+ return tryEachApp(app, (appName) => baseOpen({
431
+ ...options,
432
+ app: {
433
+ name: appName,
434
+ arguments: appArguments
435
+ },
436
+ [fallbackAttemptSymbol]: true
437
+ }));
438
+ }
439
+ if (app === "browser" || app === "browserPrivate") {
440
+ const ids = {
441
+ "com.google.chrome": "chrome",
442
+ "google-chrome.desktop": "chrome",
443
+ "com.brave.browser": "brave",
444
+ "org.mozilla.firefox": "firefox",
445
+ "firefox.desktop": "firefox",
446
+ "com.microsoft.msedge": "edge",
447
+ "com.microsoft.edge": "edge",
448
+ "com.microsoft.edgemac": "edge",
449
+ "microsoft-edge.desktop": "edge",
450
+ "com.apple.safari": "safari"
451
+ };
452
+ const flags = {
453
+ chrome: "--incognito",
454
+ brave: "--incognito",
455
+ firefox: "--private-window",
456
+ edge: "--inPrivate"
457
+ };
458
+ let browser;
459
+ if (is_wsl_default) {
460
+ const progId = await wslDefaultBrowser();
461
+ const browserInfo = _windowsBrowserProgIdMap.get(progId);
462
+ browser = browserInfo ?? {};
463
+ } else {
464
+ browser = await defaultBrowser2();
465
+ }
466
+ if (browser.id in ids) {
467
+ const browserName = ids[browser.id.toLowerCase()];
468
+ if (app === "browserPrivate") {
469
+ if (browserName === "safari") {
470
+ throw new Error("Safari doesn't support opening in private mode via command line");
471
+ }
472
+ appArguments.push(flags[browserName]);
473
+ }
474
+ return baseOpen({
475
+ ...options,
476
+ app: {
477
+ name: apps[browserName],
478
+ arguments: appArguments
479
+ }
480
+ });
481
+ }
482
+ throw new Error(`${browser.name} is not supported as a default browser`);
483
+ }
484
+ let command;
485
+ const cliArguments = [];
486
+ const childProcessOptions = {};
487
+ let shouldUseWindowsInWsl = false;
488
+ if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
489
+ shouldUseWindowsInWsl = await canAccessPowerShell();
490
+ }
491
+ if (platform === "darwin") {
492
+ command = "open";
493
+ if (options.wait) {
494
+ cliArguments.push("--wait-apps");
495
+ }
496
+ if (options.background) {
497
+ cliArguments.push("--background");
498
+ }
499
+ if (options.newInstance) {
500
+ cliArguments.push("--new");
501
+ }
502
+ if (app) {
503
+ cliArguments.push("-a", app);
504
+ }
505
+ } else if (platform === "win32" || shouldUseWindowsInWsl) {
506
+ command = await powerShellPath2();
507
+ cliArguments.push(...executePowerShell.argumentsPrefix);
508
+ if (!is_wsl_default) {
509
+ childProcessOptions.windowsVerbatimArguments = true;
510
+ }
511
+ if (is_wsl_default && options.target) {
512
+ options.target = await convertWslPathToWindows(options.target);
513
+ }
514
+ const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
515
+ if (options.wait) {
516
+ encodedArguments.push("-Wait");
517
+ }
518
+ if (app) {
519
+ encodedArguments.push(executePowerShell.escapeArgument(app));
520
+ if (options.target) {
521
+ appArguments.push(options.target);
522
+ }
523
+ } else if (options.target) {
524
+ encodedArguments.push(executePowerShell.escapeArgument(options.target));
525
+ }
526
+ if (appArguments.length > 0) {
527
+ appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
528
+ encodedArguments.push("-ArgumentList", appArguments.join(","));
529
+ }
530
+ options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
531
+ if (!options.wait) {
532
+ childProcessOptions.stdio = "ignore";
533
+ }
534
+ } else {
535
+ if (app) {
536
+ command = app;
537
+ } else {
538
+ const isBundled = !__dirname2 || __dirname2 === "/";
539
+ let exeLocalXdgOpen = false;
540
+ try {
541
+ await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
542
+ exeLocalXdgOpen = true;
543
+ } catch {}
544
+ const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
545
+ command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
546
+ }
547
+ if (appArguments.length > 0) {
548
+ cliArguments.push(...appArguments);
549
+ }
550
+ if (!options.wait) {
551
+ childProcessOptions.stdio = "ignore";
552
+ childProcessOptions.detached = true;
553
+ }
554
+ }
555
+ if (platform === "darwin" && appArguments.length > 0) {
556
+ cliArguments.push("--args", ...appArguments);
557
+ }
558
+ if (options.target) {
559
+ cliArguments.push(options.target);
560
+ }
561
+ const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
562
+ if (options.wait) {
563
+ return new Promise((resolve, reject) => {
564
+ subprocess.once("error", reject);
565
+ subprocess.once("close", (exitCode) => {
566
+ if (!options.allowNonzeroExitCode && exitCode !== 0) {
567
+ reject(new Error(`Exited with code ${exitCode}`));
568
+ return;
569
+ }
570
+ resolve(subprocess);
571
+ });
572
+ });
573
+ }
574
+ if (isFallbackAttempt) {
575
+ return new Promise((resolve, reject) => {
576
+ subprocess.once("error", reject);
577
+ subprocess.once("spawn", () => {
578
+ subprocess.once("close", (exitCode) => {
579
+ subprocess.off("error", reject);
580
+ if (exitCode !== 0) {
581
+ reject(new Error(`Exited with code ${exitCode}`));
582
+ return;
583
+ }
584
+ subprocess.unref();
585
+ resolve(subprocess);
586
+ });
587
+ });
588
+ });
589
+ }
590
+ subprocess.unref();
591
+ return new Promise((resolve, reject) => {
592
+ subprocess.once("error", reject);
593
+ subprocess.once("spawn", () => {
594
+ subprocess.off("error", reject);
595
+ resolve(subprocess);
596
+ });
597
+ });
598
+ }, open = (target, options) => {
599
+ if (typeof target !== "string") {
600
+ throw new TypeError("Expected a `target`");
601
+ }
602
+ return baseOpen({
603
+ ...options,
604
+ target
605
+ });
606
+ }, openApp = (name, options) => {
607
+ if (typeof name !== "string" && !Array.isArray(name)) {
608
+ throw new TypeError("Expected a valid `name`");
609
+ }
610
+ const { arguments: appArguments = [] } = options ?? {};
611
+ if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
612
+ throw new TypeError("Expected `appArguments` as Array type");
613
+ }
614
+ return baseOpen({
615
+ ...options,
616
+ app: {
617
+ name,
618
+ arguments: appArguments
619
+ }
620
+ });
621
+ }, apps, open_default;
622
+ var init_open = __esm(() => {
623
+ init_wsl_utils();
624
+ init_powershell_utils();
625
+ init_default_browser();
626
+ init_is_inside_container();
627
+ init_is_in_ssh();
628
+ fallbackAttemptSymbol = Symbol("fallbackAttempt");
629
+ __dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
630
+ localXdgOpenPath = path.join(__dirname2, "xdg-open");
631
+ ({ platform, arch } = process8);
632
+ apps = {
633
+ browser: "browser",
634
+ browserPrivate: "browserPrivate"
635
+ };
636
+ defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
637
+ darwin: "google chrome",
638
+ win32: "chrome",
639
+ linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
640
+ }, {
641
+ wsl: {
642
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
643
+ x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
644
+ }
645
+ }));
646
+ defineLazyProperty(apps, "brave", () => detectPlatformBinary({
647
+ darwin: "brave browser",
648
+ win32: "brave",
649
+ linux: ["brave-browser", "brave"]
650
+ }, {
651
+ wsl: {
652
+ ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
653
+ x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
654
+ }
655
+ }));
656
+ defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
657
+ darwin: "firefox",
658
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
659
+ linux: "firefox"
660
+ }, {
661
+ wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
662
+ }));
663
+ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
664
+ darwin: "microsoft edge",
665
+ win32: "msedge",
666
+ linux: ["microsoft-edge", "microsoft-edge-dev"]
667
+ }, {
668
+ wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
669
+ }));
670
+ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
671
+ darwin: "Safari"
672
+ }));
673
+ open_default = open;
674
+ });
675
+
7
676
  // ../../node_modules/.bun/undici@6.27.0/node_modules/undici/lib/core/symbols.js
8
677
  var require_symbols = __commonJS((exports, module) => {
9
678
  module.exports = {
@@ -17001,7 +17670,7 @@ var require_eventsource = __commonJS((exports, module) => {
17001
17670
 
17002
17671
  // ../../node_modules/.bun/@trpc+client@11.17.0+f02ef5e6ba82b535/node_modules/@trpc/client/dist/objectSpread2-BvkFp-_Y.mjs
17003
17672
  var __create = Object.create;
17004
- var __defProp = Object.defineProperty;
17673
+ var __defProp2 = Object.defineProperty;
17005
17674
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
17006
17675
  var __getOwnPropNames = Object.getOwnPropertyNames;
17007
17676
  var __getProtoOf = Object.getPrototypeOf;
@@ -17014,14 +17683,14 @@ var __copyProps = (to, from, except, desc) => {
17014
17683
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;i < n; i++) {
17015
17684
  key = keys[i];
17016
17685
  if (!__hasOwnProp.call(to, key) && key !== except)
17017
- __defProp(to, key, {
17686
+ __defProp2(to, key, {
17018
17687
  get: ((k) => from[k]).bind(null, key),
17019
17688
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17020
17689
  });
17021
17690
  }
17022
17691
  return to;
17023
17692
  };
17024
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
17693
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", {
17025
17694
  value: mod,
17026
17695
  enumerable: true
17027
17696
  }) : target, mod));
@@ -17346,7 +18015,7 @@ var retryableRpcCodes = [
17346
18015
 
17347
18016
  // ../../node_modules/.bun/@trpc+server@11.17.0+1fb4c65d43e298b9/node_modules/@trpc/server/dist/getErrorShape-BPSzUA7W.mjs
17348
18017
  var __create2 = Object.create;
17349
- var __defProp2 = Object.defineProperty;
18018
+ var __defProp3 = Object.defineProperty;
17350
18019
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
17351
18020
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
17352
18021
  var __getProtoOf2 = Object.getPrototypeOf;
@@ -17359,14 +18028,14 @@ var __copyProps2 = (to, from, except, desc) => {
17359
18028
  for (var keys = __getOwnPropNames2(from), i = 0, n = keys.length, key;i < n; i++) {
17360
18029
  key = keys[i];
17361
18030
  if (!__hasOwnProp2.call(to, key) && key !== except)
17362
- __defProp2(to, key, {
18031
+ __defProp3(to, key, {
17363
18032
  get: ((k) => from[k]).bind(null, key),
17364
18033
  enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
17365
18034
  });
17366
18035
  }
17367
18036
  return to;
17368
18037
  };
17369
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", {
18038
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", {
17370
18039
  value: mod,
17371
18040
  enumerable: true
17372
18041
  }) : target, mod));
@@ -18478,7 +19147,13 @@ var import_awaitAsyncGenerator = __toESM(require_awaitAsyncGenerator(), 1);
18478
19147
  var import_wrapAsyncGenerator = __toESM(require_wrapAsyncGenerator(), 1);
18479
19148
  var import_objectSpread29 = __toESM(require_objectSpread2(), 1);
18480
19149
  // ../../packages/rules/src/builtin-shapes.ts
18481
- var BUILTIN_SHAPE_NAMES = ["Pair", "Set", "List"];
19150
+ var BUILTIN_SHAPE_NAMES = [
19151
+ "Arc",
19152
+ "Bond",
19153
+ "Pair",
19154
+ "Set",
19155
+ "List"
19156
+ ];
18482
19157
  var RETIRED_COLLECTION_SHAPE_NAMES = ["Triple"];
18483
19158
  var RESERVED_COLLECTION_SHAPE_NAMES = [
18484
19159
  ...BUILTIN_SHAPE_NAMES,
@@ -18503,6 +19178,25 @@ function isBuiltinShape(name) {
18503
19178
  return BUILTIN_SHAPE_NAMES.includes(name) || BUILTIN_CONTENT_SHAPE_NAMES.includes(name);
18504
19179
  }
18505
19180
  var BUILTIN_SHAPE_DEFS = {
19181
+ Arc: {
19182
+ fields: {
19183
+ from: {
19184
+ type: "wref",
19185
+ description: "Origin of the directed relationship"
19186
+ },
19187
+ to: {
19188
+ type: "wref",
19189
+ description: "Destination of the directed relationship"
19190
+ }
19191
+ },
19192
+ description: "A directed relationship between two things"
19193
+ },
19194
+ Bond: {
19195
+ fields: {
19196
+ ends: [{ type: "wref", description: "Endpoints of the relationship" }]
19197
+ },
19198
+ description: "A symmetric relationship between two things"
19199
+ },
18506
19200
  Pair: {
18507
19201
  fields: {
18508
19202
  first: { type: "wref", description: "First member of the pair" },
@@ -18618,6 +19312,11 @@ function stableJsonEquals(left, right) {
18618
19312
  return stableJson(left) === stableJson(right);
18619
19313
  }
18620
19314
 
19315
+ // ../../packages/rules/src/org-activity-events.ts
19316
+ var ORG_MEMBER_ADDED_EVENT_TYPE = "org.member_added";
19317
+ var ORG_REPO_CREATED_EVENT_TYPE = "org.repo_created";
19318
+ var ORG_REPO_PUBLISHED_EVENT_TYPE = "org.repo_published";
19319
+
18621
19320
  // ../../packages/rules/src/subscribable-events.ts
18622
19321
  var COMMIT_EVENT_TYPE = "commit";
18623
19322
  var REPO_RENAMED_EVENT_TYPE = "repo.renamed";
@@ -18628,6 +19327,9 @@ var SUBSCRIBABLE_EVENT_TYPES = [
18628
19327
  COMMIT_EVENT_TYPE,
18629
19328
  REPO_RENAMED_EVENT_TYPE,
18630
19329
  ORG_RENAMED_EVENT_TYPE,
19330
+ ORG_MEMBER_ADDED_EVENT_TYPE,
19331
+ ORG_REPO_CREATED_EVENT_TYPE,
19332
+ ORG_REPO_PUBLISHED_EVENT_TYPE,
18631
19333
  THING_RENAMED_EVENT_TYPE,
18632
19334
  SHAPE_RENAMED_EVENT_TYPE
18633
19335
  ];
@@ -18637,6 +19339,15 @@ var REPO_SCOPED_EVENT_TYPES = [
18637
19339
  THING_RENAMED_EVENT_TYPE,
18638
19340
  SHAPE_RENAMED_EVENT_TYPE
18639
19341
  ];
19342
+ var ORG_SCOPED_EVENT_TYPES = [
19343
+ ORG_RENAMED_EVENT_TYPE,
19344
+ ORG_MEMBER_ADDED_EVENT_TYPE,
19345
+ ORG_REPO_CREATED_EVENT_TYPE,
19346
+ ORG_REPO_PUBLISHED_EVENT_TYPE
19347
+ ];
19348
+ function isOrgScopedEventType(eventType) {
19349
+ return ORG_SCOPED_EVENT_TYPES.includes(eventType);
19350
+ }
18640
19351
 
18641
19352
  // ../../packages/rules/src/component-install.ts
18642
19353
  function manifestShapeData(shape) {
@@ -19735,7 +20446,9 @@ function preflightOpDiagnostics(op, operationIndex) {
19735
20446
  function builtinShapeGuard(op, operationIndex) {
19736
20447
  const errors = [];
19737
20448
  const name = op.name;
19738
- if (name && isRetiredCollectionShape(name)) {
20449
+ const isShapeRename = op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name));
20450
+ const reservedSourcePassThrough = isShapeRename && name !== undefined && isReservedCollectionShape(name) && op.newName !== undefined && !isReservedCollectionShape(op.newName) && !isBuiltinShape(op.newName);
20451
+ if (name && isRetiredCollectionShape(name) && !reservedSourcePassThrough) {
19739
20452
  errors.push({
19740
20453
  code: "RESERVED_NAME",
19741
20454
  operationIndex,
@@ -19749,8 +20462,7 @@ function builtinShapeGuard(op, operationIndex) {
19749
20462
  message: `Shape "${op.newName}" is a retired collection shape and cannot be written manually`
19750
20463
  });
19751
20464
  } else {
19752
- const isShapeRename = op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name));
19753
- const builtinShapeName = name && isBuiltinShape(name) ? name : isShapeRename && op.newName && isBuiltinShape(op.newName) ? op.newName : undefined;
20465
+ const builtinShapeName = name && isBuiltinShape(name) && !reservedSourcePassThrough ? name : isShapeRename && op.newName && isBuiltinShape(op.newName) ? op.newName : undefined;
19754
20466
  if (builtinShapeName && (isShapeRename || op.operation !== "retract" && op.kind === "shape")) {
19755
20467
  const action = op.operation === "add" ? "created" : op.operation === "rename" ? "renamed" : "revised";
19756
20468
  errors.push({
@@ -27136,7 +27848,7 @@ function findSystemComponent(componentId) {
27136
27848
  // ../../packages/sdk-ts/package.json
27137
27849
  var package_default = {
27138
27850
  name: "@warmhub/sdk-ts",
27139
- version: "0.69.1",
27851
+ version: "0.71.0",
27140
27852
  private: false,
27141
27853
  type: "module",
27142
27854
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -28501,6 +29213,15 @@ class WarmHubClient {
28501
29213
  throw toWarmHubError(error);
28502
29214
  }
28503
29215
  },
29216
+ leave: async (orgName) => {
29217
+ try {
29218
+ await this.trpc.org.leave.mutate({
29219
+ orgName
29220
+ });
29221
+ } catch (error) {
29222
+ throw toWarmHubError(error);
29223
+ }
29224
+ },
28504
29225
  changeMemberRole: async (orgName, email, role) => {
28505
29226
  try {
28506
29227
  return await this.trpc.org.changeMemberRole.mutate({
@@ -29107,7 +29828,9 @@ class WarmHubClient {
29107
29828
  repoName,
29108
29829
  subscriptionName: opts?.subscriptionName,
29109
29830
  status: opts?.status,
29831
+ outcome: opts?.outcome,
29110
29832
  since: opts?.since,
29833
+ cursor: opts?.cursor,
29111
29834
  limit: opts?.limit
29112
29835
  });
29113
29836
  } catch (error) {
@@ -30100,6 +30823,13 @@ function parseSseChunk(chunk) {
30100
30823
  function isAbortError2(error) {
30101
30824
  return error instanceof Error && error.name === "AbortError";
30102
30825
  }
30826
+ var _orgActivityNeedsNoFilter = ["org.member_added", "org.repo_created", "org.repo_published"].map((eventType) => ({
30827
+ orgName: "o",
30828
+ name: "n",
30829
+ kind: "webhook",
30830
+ eventType,
30831
+ webhookUrl: "https://x"
30832
+ }));
30103
30833
 
30104
30834
  // ../../packages/warmhub-cli/src/errors-classification.ts
30105
30835
  function unauthenticatedHint(message) {
@@ -30179,6 +30909,7 @@ var TOP_LEVEL_USER_INPUT_CODES = new Set([
30179
30909
  ]);
30180
30910
  var CONFLICT_SHAPED_CODES = new Set([
30181
30911
  "CONFLICT",
30912
+ "BUILTIN_SHAPE_CONFLICT",
30182
30913
  "ARCHIVED",
30183
30914
  "HAS_INBOUND_REFS",
30184
30915
  "REPO_PENDING_DELETE",
@@ -32648,10 +33379,11 @@ function formatTime(ts, now) {
32648
33379
  return d.toISOString().slice(0, 16).replace("T", " ");
32649
33380
  }
32650
33381
  function pinnedWref(c, wref, version) {
32651
- if (version == null)
32652
- return `${c.cyan}${wref}${c.reset}`;
33382
+ if (version == null) {
33383
+ return `${c.cyan}${escapeTerminalTextForDisplay(wref)}${c.reset}`;
33384
+ }
32653
33385
  const base = wref.replace(/@v\d+$/, "");
32654
- return `${c.cyan}${base}@v${version}${c.reset}`;
33386
+ return `${c.cyan}${escapeTerminalTextForDisplay(base)}@v${version}${c.reset}`;
32655
33387
  }
32656
33388
  function kindLabel(c, kind) {
32657
33389
  return `${c.dim}${kind}${c.reset}`;
@@ -32686,7 +33418,7 @@ function effectiveKind(kind, shapeName) {
32686
33418
  }
32687
33419
  function displayName(c, name) {
32688
33420
  if (name)
32689
- return `${c.cyan}${name}${c.reset}`;
33421
+ return `${c.cyan}${escapeTerminalTextForDisplay(name)}${c.reset}`;
32690
33422
  return `${c.dim}(unnamed)${c.reset}`;
32691
33423
  }
32692
33424
  function extractShapeName(name) {
@@ -33227,12 +33959,51 @@ function renderAboutAssertion(out, c, assertion, indent) {
33227
33959
  }
33228
33960
  }
33229
33961
 
33962
+ // ../../packages/warmhub-cli/src/json-object-input.ts
33963
+ import { readFile } from "node:fs/promises";
33964
+ function parseWithCommandHint(input, label, example) {
33965
+ try {
33966
+ return parseJsonObject(input, label);
33967
+ } catch (error) {
33968
+ if (error instanceof CliError && error.kind === "USER_INPUT") {
33969
+ throw new CliError(error.code, error.kind, error.message, error.cause, `Example: ${example}`, error.context, error.backendCode);
33970
+ }
33971
+ throw error;
33972
+ }
33973
+ }
33974
+ async function readJsonObjectInput({
33975
+ inline,
33976
+ file,
33977
+ inlineFlag,
33978
+ missingMessage,
33979
+ example
33980
+ }) {
33981
+ if (inline !== undefined && file !== undefined) {
33982
+ throw new CliError(2 /* UserInput */, "USER_INPUT", `${inlineFlag} cannot be combined with --file`, undefined, `Example: ${example}`);
33983
+ }
33984
+ if (inline !== undefined)
33985
+ return parseWithCommandHint(inline, inlineFlag, example);
33986
+ if (file === undefined) {
33987
+ throw new CliError(2 /* UserInput */, "USER_INPUT", missingMessage ?? `${inlineFlag} or --file is required`, undefined, `Example: ${example}`);
33988
+ }
33989
+ let contents;
33990
+ try {
33991
+ contents = await readFile(file, "utf8");
33992
+ } catch (error) {
33993
+ throw new CliError(2 /* UserInput */, "USER_INPUT", `Cannot read file '${file}': ${error instanceof Error ? error.message : String(error)}`, undefined, `Example: ${example}`);
33994
+ }
33995
+ return parseWithCommandHint(contents, "--file contents", example);
33996
+ }
33997
+
33230
33998
  // ../../packages/warmhub-cli/src/domains/thing/create.ts
33231
33999
  var createFlags2 = {
33232
34000
  shape: flag.string({ description: "Shape for the new thing" }),
33233
34001
  data: flag.string({
33234
34002
  description: `Thing data as a JSON object, e.g. '{"score":1}' (non-object payloads are rejected)`
33235
34003
  }),
34004
+ file: flag.string({
34005
+ description: "read thing data from a JSON object file (portable alternative to inline --data)"
34006
+ }),
33236
34007
  message: flag.string({ short: "m", description: "Commit message" }),
33237
34008
  committer: flag.string({
33238
34009
  description: "Committer wref (shape or shaped thing; e.g. Agent/bot-1)"
@@ -33242,7 +34013,7 @@ var handleCreate2 = async (ctx, { flags, args }) => {
33242
34013
  const rawName = args[0];
33243
34014
  const shape = flags.shape;
33244
34015
  if (!rawName || !shape && !rawName.includes("/")) {
33245
- usageError("Usage: wh thing create <name|Shape/name> [--shape <shape>] --data <json-object>", `wh thing create player-1 --shape Player --data '{"score":1}'`);
34016
+ usageError("Usage: wh thing create <name|Shape/name> [--shape <shape>] (--data <json-object> | --file <path>)", `wh thing create player-1 --shape Player --data '{"score":1}'`, "wh thing create player-1 --shape Player --file data.json");
33246
34017
  }
33247
34018
  if (shape && rawName.includes("/")) {
33248
34019
  usageError("Usage: wh thing create <name> --shape <shape> --data <json-object>", `wh thing create alice --shape Player --data '{"score":1}'`);
@@ -33250,10 +34021,13 @@ var handleCreate2 = async (ctx, { flags, args }) => {
33250
34021
  const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
33251
34022
  const committer = flags.committer;
33252
34023
  const message = flags.message;
33253
- if (flags.data === undefined) {
33254
- usageError("--data is required for create", `wh thing create player-1 --shape Player --data '{"score":1}'`);
33255
- }
33256
- const data = parseJsonObject(flags.data, "--data");
34024
+ const data = await readJsonObjectInput({
34025
+ inline: flags.data,
34026
+ file: flags.file,
34027
+ inlineFlag: "--data",
34028
+ missingMessage: "--data is required for create unless --file is provided",
34029
+ example: "wh thing create Profile/alice --file data.json"
34030
+ });
33257
34031
  const name = shape ? `${shape}/${rawName}` : rawName;
33258
34032
  const c = ctx.colors;
33259
34033
  const result = await ctx.client.commit.apply(org, repo, message ?? `create ${name}`, [
@@ -33468,15 +34242,15 @@ function renderHead(out, c, chars, result, org, repo, shape, kind) {
33468
34242
  const fields = shapeName && (item.kind === "thing" || item.kind === "collection") && item.data ? collectionFields(shapeName, item.data) : null;
33469
34243
  if (fields) {
33470
34244
  const allWrefs = fields.flatMap((f) => f.wrefs);
33471
- out(` ${allWrefs.map((w) => pinnedWref(c, escapeTerminalTextForDisplay(w))).join(`${c.dim},${c.reset} `)}`);
34245
+ out(` ${allWrefs.map((w) => pinnedWref(c, w)).join(`${c.dim},${c.reset} `)}`);
33472
34246
  } else if (item.data && typeof item.data === "object") {
33473
34247
  const preview = JSON.stringify(item.data);
33474
34248
  const truncated = preview.length > 80 ? `${preview.slice(0, 77)}...` : preview;
33475
- out(` ${c.dim}${truncated}${c.reset}`);
34249
+ out(` ${c.dim}${escapeTerminalTextForDisplay(truncated)}${c.reset}`);
33476
34250
  }
33477
34251
  const itemMeta = item.metadata;
33478
34252
  if (itemMeta?.durableId) {
33479
- out(` ${c.dim}durableId:${c.reset} ${styleDurableId(itemMeta.durableId, c)}`);
34253
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(itemMeta.durableId), c)}`);
33480
34254
  }
33481
34255
  }
33482
34256
  out(`${c.dim}${items.length} item(s)${c.reset}`);
@@ -33487,7 +34261,7 @@ function renderThing(out, c, result) {
33487
34261
  const displayKind = effectiveKind(result.kind ?? "thing", shapeName);
33488
34262
  const retractedTag = result.active === false ? ` ${c.red}[RETRACTED]${c.reset}` : "";
33489
34263
  out(`${pinnedWref(c, wref, result.version)} ${kindLabel(c, displayKind)}${retractedTag}`);
33490
- out(` ${c.dim}wref:${c.reset} ${wref}`);
34264
+ out(` ${c.dim}wref:${c.reset} ${escapeTerminalTextForDisplay(wref)}`);
33491
34265
  out(` ${c.dim}version:${c.reset} ${result.version ?? "-"}`);
33492
34266
  out(` ${c.dim}active:${c.reset} ${String(result.active)}`);
33493
34267
  if (result.committerWref) {
@@ -33495,13 +34269,13 @@ function renderThing(out, c, result) {
33495
34269
  }
33496
34270
  const aboutWref = result.aboutWref ?? result.about;
33497
34271
  if (aboutWref) {
33498
- out(` ${c.dim}about:${c.reset} ${String(aboutWref)}`);
34272
+ out(` ${c.dim}about:${c.reset} ${escapeTerminalTextForDisplay(String(aboutWref))}`);
33499
34273
  }
33500
34274
  const meta = result.metadata;
33501
34275
  if (meta?.durableId || meta?.createdOn || meta?.revisedOn) {
33502
34276
  const now = Date.now();
33503
34277
  if (meta.durableId) {
33504
- out(` ${c.dim}durableId:${c.reset} ${styleDurableId(meta.durableId, c)}`);
34278
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(meta.durableId), c)}`);
33505
34279
  }
33506
34280
  if (meta.createdOn) {
33507
34281
  out(` ${c.dim}createdOn:${c.reset} ${formatTime(meta.createdOn, now)}`);
@@ -33518,11 +34292,11 @@ function renderThing(out, c, result) {
33518
34292
  for (const field of fields) {
33519
34293
  if (field.wrefs.length === 1) {
33520
34294
  const pad = " ".repeat(Math.max(1, 9 - field.name.length));
33521
- out(` ${c.dim}${field.name}:${c.reset}${pad}${pinnedWref(c, escapeTerminalTextForDisplay(field.wrefs[0]))}`);
34295
+ out(` ${c.dim}${escapeTerminalTextForDisplay(field.name)}:${c.reset}${pad}${pinnedWref(c, field.wrefs[0])}`);
33522
34296
  } else {
33523
- out(` ${c.dim}${field.name}:${c.reset}`);
34297
+ out(` ${c.dim}${escapeTerminalTextForDisplay(field.name)}:${c.reset}`);
33524
34298
  for (const w of field.wrefs) {
33525
- out(` ${pinnedWref(c, escapeTerminalTextForDisplay(w))}`);
34299
+ out(` ${pinnedWref(c, w)}`);
33526
34300
  }
33527
34301
  }
33528
34302
  }
@@ -33531,7 +34305,7 @@ function renderThing(out, c, result) {
33531
34305
  const lines = JSON.stringify(result.data, null, 2).split(`
33532
34306
  `);
33533
34307
  for (const line of lines) {
33534
- out(` ${line}`);
34308
+ out(` ${escapeTerminalTextForDisplay(line)}`);
33535
34309
  }
33536
34310
  }
33537
34311
  }
@@ -33547,14 +34321,14 @@ function renderCollectionSummary(out, c, collection) {
33547
34321
  return;
33548
34322
  out(` ${c.dim}preview:${c.reset}`);
33549
34323
  for (const wref of preview) {
33550
- out(` ${pinnedWref(c, escapeTerminalTextForDisplay(wref))}`);
34324
+ out(` ${pinnedWref(c, wref)}`);
33551
34325
  }
33552
34326
  }
33553
34327
  function renderDataBlock(out, data, indent) {
33554
34328
  const lines = JSON.stringify(data, null, 2).split(`
33555
34329
  `);
33556
34330
  for (const line of lines) {
33557
- out(`${indent}${line}`);
34331
+ out(`${indent}${escapeTerminalTextForDisplay(line)}`);
33558
34332
  }
33559
34333
  }
33560
34334
  function renderGraphValue(out, c, value, indent) {
@@ -33594,7 +34368,7 @@ function renderGraphNode(out, c, result, indent = "") {
33594
34368
  if (resolvedEntries.length > 0) {
33595
34369
  out(`${indent} ${c.dim}resolved:${c.reset}`);
33596
34370
  for (const [fieldPath, value] of resolvedEntries) {
33597
- out(`${indent} ${c.dim}${fieldPath}:${c.reset}`);
34371
+ out(`${indent} ${c.dim}${escapeTerminalTextForDisplay(fieldPath)}:${c.reset}`);
33598
34372
  renderGraphValue(out, c, value, `${indent} `);
33599
34373
  }
33600
34374
  }
@@ -33620,7 +34394,7 @@ function renderHistory(out, c, result) {
33620
34394
  }
33621
34395
  const firstMeta = result.versions?.[0]?.metadata;
33622
34396
  if (firstMeta?.durableId) {
33623
- out(` ${c.dim}durableId:${c.reset} ${styleDurableId(firstMeta.durableId, c)}`);
34397
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(firstMeta.durableId), c)}`);
33624
34398
  }
33625
34399
  const versions = result.versions ?? [];
33626
34400
  const now = Date.now();
@@ -33629,7 +34403,7 @@ function renderHistory(out, c, result) {
33629
34403
  if (ver.operation === "add") {
33630
34404
  op = `${c.green}add${c.reset}`;
33631
34405
  } else if (ver.operation === "retract") {
33632
- const reason = ver.retractReason ? ` ${c.dim}'${ver.retractReason.length > 80 ? `${ver.retractReason.slice(0, 77)}...` : ver.retractReason}'${c.reset}` : "";
34406
+ const reason = ver.retractReason ? ` ${c.dim}'${escapeTerminalTextForDisplay(ver.retractReason.length > 80 ? `${ver.retractReason.slice(0, 77)}...` : ver.retractReason)}'${c.reset}` : "";
33633
34407
  op = `${c.red}retract${c.reset}${reason}`;
33634
34408
  } else {
33635
34409
  op = `${c.yellow}revise${c.reset}`;
@@ -33650,12 +34424,12 @@ function renderRefs(out, c, result, wref, direction) {
33650
34424
  return;
33651
34425
  }
33652
34426
  const label = direction === "inbound" ? "References to" : "Referenced by";
33653
- out(`${c.bold}${label}${c.reset} ${c.cyan}${wref}${c.reset}`);
34427
+ out(`${c.bold}${label}${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(wref)}${c.reset}`);
33654
34428
  out(`${c.dim}${"─".repeat(60)}${c.reset}`);
33655
34429
  for (const item of items) {
33656
34430
  const refWref = pinnedWref(c, item.wref, item.version);
33657
34431
  const kl = kindLabel(c, effectiveKind(item.kind ?? "thing", item.shapeName));
33658
- const field = `${c.dim}via ${c.reset}${item.fieldPath}`;
34432
+ const field = `${c.dim}via ${c.reset}${escapeTerminalTextForDisplay(item.fieldPath ?? "(unknown)")}`;
33659
34433
  out(` ${refWref} ${kl} ${field}`);
33660
34434
  }
33661
34435
  out(`${c.dim}${items.length} ref(s)${c.reset}`);
@@ -33685,7 +34459,7 @@ function renderBatchView(out, c, result, wrefs, flagsVersion) {
33685
34459
  if (event.kind === "miss")
33686
34460
  continue;
33687
34461
  if (event.kind === "desync") {
33688
- out(` ${event.requested} ${c.red}[no result]${c.reset}`);
34462
+ out(` ${escapeTerminalTextForDisplay(event.requested)} ${c.red}[no result]${c.reset}`);
33689
34463
  continue;
33690
34464
  }
33691
34465
  const { requested, item } = event;
@@ -33694,12 +34468,12 @@ function renderBatchView(out, c, result, wrefs, flagsVersion) {
33694
34468
  const base = requestedBase.length > 0 ? requestedBase : fallback.replace(/@v\d+$/, "");
33695
34469
  const kl = kindLabel(c, effectiveKind(item.kind ?? "thing", item.shapeName));
33696
34470
  const retractedTag = item.active === false ? ` ${c.red}[RETRACTED]${c.reset}` : "";
33697
- out(` ${base}@v${item.version} ${kl}${retractedTag}`);
34471
+ out(` ${escapeTerminalTextForDisplay(base)}@v${item.version} ${kl}${retractedTag}`);
33698
34472
  }
33699
34473
  if (result.missing.length > 0) {
33700
34474
  out("Missing:");
33701
34475
  for (const wref of result.missing) {
33702
- out(` ${wref}`);
34476
+ out(` ${escapeTerminalTextForDisplay(wref)}`);
33703
34477
  }
33704
34478
  }
33705
34479
  }
@@ -34459,7 +35233,7 @@ var handleResolve = async (ctx, { args }) => {
34459
35233
  writeOutput(ctx, result, () => {
34460
35234
  const wref2 = result.wref ?? result.name ?? "(unknown)";
34461
35235
  ctx.out(`${pinnedWref(c, wref2, result.version)} ${kindLabel(c, result.kind ?? "thing")}`);
34462
- ctx.out(` ${c.dim}wref:${c.reset} ${wref2}`);
35236
+ ctx.out(` ${c.dim}wref:${c.reset} ${escapeTerminalTextForDisplay(wref2)}`);
34463
35237
  ctx.out(` ${c.dim}version:${c.reset} ${result.version ?? "-"}`);
34464
35238
  ctx.out(` ${c.dim}active:${c.reset} ${String(result.active)}`);
34465
35239
  });
@@ -34700,8 +35474,8 @@ async function readContentInput(filePath, inline, stdinStream) {
34700
35474
  if (inline !== undefined)
34701
35475
  return inline;
34702
35476
  if (filePath && filePath !== "-") {
34703
- const { readFile } = await import("node:fs/promises");
34704
- return await readFile(filePath, "utf8");
35477
+ const { readFile: readFile2 } = await import("node:fs/promises");
35478
+ return await readFile2(filePath, "utf8");
34705
35479
  }
34706
35480
  const input = stdinStream ?? process.stdin;
34707
35481
  if (isTTY(input)) {
@@ -34971,6 +35745,7 @@ var THING_DOMAIN = defineDomain({
34971
35745
  flags: createFlags2,
34972
35746
  examples: [
34973
35747
  `wh thing create player-1 --shape Player --data '{"score":1}'`,
35748
+ "wh thing create player-1 --shape Player --file data.json",
34974
35749
  `wh thing create Player/player-1 --data '{"score":1}'`
34975
35750
  ],
34976
35751
  handler: handleCreate2
@@ -35428,616 +36203,6 @@ var ASSERTION_DOMAIN = defineDomain({
35428
36203
  }
35429
36204
  });
35430
36205
 
35431
- // ../../node_modules/.bun/open@11.0.0/node_modules/open/index.js
35432
- import process8 from "node:process";
35433
- import path from "node:path";
35434
- import { fileURLToPath } from "node:url";
35435
- import childProcess3 from "node:child_process";
35436
- import fs5, { constants as fsConstants2 } from "node:fs/promises";
35437
-
35438
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
35439
- import { promisify as promisify2 } from "node:util";
35440
- import childProcess2 from "node:child_process";
35441
- import fs4, { constants as fsConstants } from "node:fs/promises";
35442
-
35443
- // ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
35444
- import process2 from "node:process";
35445
- import os from "node:os";
35446
- import fs3 from "node:fs";
35447
-
35448
- // ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
35449
- import fs2 from "node:fs";
35450
-
35451
- // ../../node_modules/.bun/is-docker@3.0.0/node_modules/is-docker/index.js
35452
- import fs from "node:fs";
35453
- var isDockerCached;
35454
- function hasDockerEnv() {
35455
- try {
35456
- fs.statSync("/.dockerenv");
35457
- return true;
35458
- } catch {
35459
- return false;
35460
- }
35461
- }
35462
- function hasDockerCGroup() {
35463
- try {
35464
- return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
35465
- } catch {
35466
- return false;
35467
- }
35468
- }
35469
- function isDocker() {
35470
- if (isDockerCached === undefined) {
35471
- isDockerCached = hasDockerEnv() || hasDockerCGroup();
35472
- }
35473
- return isDockerCached;
35474
- }
35475
-
35476
- // ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
35477
- var cachedResult;
35478
- var hasContainerEnv = () => {
35479
- try {
35480
- fs2.statSync("/run/.containerenv");
35481
- return true;
35482
- } catch {
35483
- return false;
35484
- }
35485
- };
35486
- function isInsideContainer() {
35487
- if (cachedResult === undefined) {
35488
- cachedResult = hasContainerEnv() || isDocker();
35489
- }
35490
- return cachedResult;
35491
- }
35492
-
35493
- // ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
35494
- var isWsl = () => {
35495
- if (process2.platform !== "linux") {
35496
- return false;
35497
- }
35498
- if (os.release().toLowerCase().includes("microsoft")) {
35499
- if (isInsideContainer()) {
35500
- return false;
35501
- }
35502
- return true;
35503
- }
35504
- try {
35505
- if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
35506
- return !isInsideContainer();
35507
- }
35508
- } catch {}
35509
- if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
35510
- return !isInsideContainer();
35511
- }
35512
- return false;
35513
- };
35514
- var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
35515
-
35516
- // ../../node_modules/.bun/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
35517
- import process3 from "node:process";
35518
- import { Buffer as Buffer2 } from "node:buffer";
35519
- import { promisify } from "node:util";
35520
- import childProcess from "node:child_process";
35521
- var execFile = promisify(childProcess.execFile);
35522
- var powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
35523
- var executePowerShell = async (command, options = {}) => {
35524
- const {
35525
- powerShellPath: psPath,
35526
- ...execFileOptions
35527
- } = options;
35528
- const encodedCommand = executePowerShell.encodeCommand(command);
35529
- return execFile(psPath ?? powerShellPath(), [
35530
- ...executePowerShell.argumentsPrefix,
35531
- encodedCommand
35532
- ], {
35533
- encoding: "utf8",
35534
- ...execFileOptions
35535
- });
35536
- };
35537
- executePowerShell.argumentsPrefix = [
35538
- "-NoProfile",
35539
- "-NonInteractive",
35540
- "-ExecutionPolicy",
35541
- "Bypass",
35542
- "-EncodedCommand"
35543
- ];
35544
- executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
35545
- executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
35546
-
35547
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
35548
- function parseMountPointFromConfig(content) {
35549
- for (const line of content.split(`
35550
- `)) {
35551
- if (/^\s*#/.test(line)) {
35552
- continue;
35553
- }
35554
- const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
35555
- if (!match) {
35556
- continue;
35557
- }
35558
- return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
35559
- }
35560
- }
35561
-
35562
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
35563
- var execFile2 = promisify2(childProcess2.execFile);
35564
- var wslDrivesMountPoint = (() => {
35565
- const defaultMountPoint = "/mnt/";
35566
- let mountPoint;
35567
- return async function() {
35568
- if (mountPoint) {
35569
- return mountPoint;
35570
- }
35571
- const configFilePath = "/etc/wsl.conf";
35572
- let isConfigFileExists = false;
35573
- try {
35574
- await fs4.access(configFilePath, fsConstants.F_OK);
35575
- isConfigFileExists = true;
35576
- } catch {}
35577
- if (!isConfigFileExists) {
35578
- return defaultMountPoint;
35579
- }
35580
- const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
35581
- const parsedMountPoint = parseMountPointFromConfig(configContent);
35582
- if (parsedMountPoint === undefined) {
35583
- return defaultMountPoint;
35584
- }
35585
- mountPoint = parsedMountPoint;
35586
- mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
35587
- return mountPoint;
35588
- };
35589
- })();
35590
- var powerShellPathFromWsl = async () => {
35591
- const mountPoint = await wslDrivesMountPoint();
35592
- return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
35593
- };
35594
- var powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
35595
- var canAccessPowerShellPromise;
35596
- var canAccessPowerShell = async () => {
35597
- canAccessPowerShellPromise ??= (async () => {
35598
- try {
35599
- const psPath = await powerShellPath2();
35600
- await fs4.access(psPath, fsConstants.X_OK);
35601
- return true;
35602
- } catch {
35603
- return false;
35604
- }
35605
- })();
35606
- return canAccessPowerShellPromise;
35607
- };
35608
- var wslDefaultBrowser = async () => {
35609
- const psPath = await powerShellPath2();
35610
- const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
35611
- const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
35612
- return stdout.trim();
35613
- };
35614
- var convertWslPathToWindows = async (path) => {
35615
- if (/^[a-z]+:\/\//i.test(path)) {
35616
- return path;
35617
- }
35618
- try {
35619
- const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
35620
- return stdout.trim();
35621
- } catch {
35622
- return path;
35623
- }
35624
- };
35625
-
35626
- // ../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
35627
- function defineLazyProperty(object, propertyName, valueGetter) {
35628
- const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
35629
- Object.defineProperty(object, propertyName, {
35630
- configurable: true,
35631
- enumerable: true,
35632
- get() {
35633
- const result = valueGetter();
35634
- define(result);
35635
- return result;
35636
- },
35637
- set(value) {
35638
- define(value);
35639
- }
35640
- });
35641
- return object;
35642
- }
35643
-
35644
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
35645
- import { promisify as promisify6 } from "node:util";
35646
- import process6 from "node:process";
35647
- import { execFile as execFile6 } from "node:child_process";
35648
-
35649
- // ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
35650
- import { promisify as promisify3 } from "node:util";
35651
- import process4 from "node:process";
35652
- import { execFile as execFile3 } from "node:child_process";
35653
- var execFileAsync = promisify3(execFile3);
35654
- async function defaultBrowserId() {
35655
- if (process4.platform !== "darwin") {
35656
- throw new Error("macOS only");
35657
- }
35658
- const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
35659
- const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
35660
- const browserId = match?.groups.id ?? "com.apple.Safari";
35661
- if (browserId === "com.apple.safari") {
35662
- return "com.apple.Safari";
35663
- }
35664
- return browserId;
35665
- }
35666
-
35667
- // ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
35668
- import process5 from "node:process";
35669
- import { promisify as promisify4 } from "node:util";
35670
- import { execFile as execFile4, execFileSync } from "node:child_process";
35671
- var execFileAsync2 = promisify4(execFile4);
35672
- async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
35673
- if (process5.platform !== "darwin") {
35674
- throw new Error("macOS only");
35675
- }
35676
- const outputArguments = humanReadableOutput ? [] : ["-ss"];
35677
- const execOptions = {};
35678
- if (signal) {
35679
- execOptions.signal = signal;
35680
- }
35681
- const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
35682
- return stdout.trim();
35683
- }
35684
-
35685
- // ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
35686
- async function bundleName(bundleId) {
35687
- return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
35688
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
35689
- }
35690
-
35691
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
35692
- import { promisify as promisify5 } from "node:util";
35693
- import { execFile as execFile5 } from "node:child_process";
35694
- var execFileAsync3 = promisify5(execFile5);
35695
- var windowsBrowserProgIds = {
35696
- MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
35697
- MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
35698
- MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
35699
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
35700
- ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
35701
- ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
35702
- ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
35703
- ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
35704
- BraveHTML: { name: "Brave", id: "com.brave.Browser" },
35705
- BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
35706
- BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
35707
- BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
35708
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
35709
- OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
35710
- VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
35711
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
35712
- };
35713
- var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
35714
-
35715
- class UnknownBrowserError extends Error {
35716
- }
35717
- async function defaultBrowser(_execFileAsync = execFileAsync3) {
35718
- const { stdout } = await _execFileAsync("reg", [
35719
- "QUERY",
35720
- " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
35721
- "/v",
35722
- "ProgId"
35723
- ]);
35724
- const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
35725
- if (!match) {
35726
- throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
35727
- }
35728
- const { id } = match.groups;
35729
- const dotIndex = id.lastIndexOf(".");
35730
- const hyphenIndex = id.lastIndexOf("-");
35731
- const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
35732
- const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
35733
- return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
35734
- }
35735
-
35736
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
35737
- var execFileAsync4 = promisify6(execFile6);
35738
- var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
35739
- async function defaultBrowser2() {
35740
- if (process6.platform === "darwin") {
35741
- const id = await defaultBrowserId();
35742
- const name = await bundleName(id);
35743
- return { name, id };
35744
- }
35745
- if (process6.platform === "linux") {
35746
- const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
35747
- const id = stdout.trim();
35748
- const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
35749
- return { name, id };
35750
- }
35751
- if (process6.platform === "win32") {
35752
- return defaultBrowser();
35753
- }
35754
- throw new Error("Only macOS, Linux, and Windows are supported");
35755
- }
35756
-
35757
- // ../../node_modules/.bun/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
35758
- import process7 from "node:process";
35759
- var isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
35760
- var is_in_ssh_default = isInSsh;
35761
-
35762
- // ../../node_modules/.bun/open@11.0.0/node_modules/open/index.js
35763
- var fallbackAttemptSymbol = Symbol("fallbackAttempt");
35764
- var __dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
35765
- var localXdgOpenPath = path.join(__dirname2, "xdg-open");
35766
- var { platform, arch } = process8;
35767
- var tryEachApp = async (apps, opener) => {
35768
- if (apps.length === 0) {
35769
- return;
35770
- }
35771
- const errors = [];
35772
- for (const app of apps) {
35773
- try {
35774
- return await opener(app);
35775
- } catch (error) {
35776
- errors.push(error);
35777
- }
35778
- }
35779
- throw new AggregateError(errors, "Failed to open in all supported apps");
35780
- };
35781
- var baseOpen = async (options) => {
35782
- options = {
35783
- wait: false,
35784
- background: false,
35785
- newInstance: false,
35786
- allowNonzeroExitCode: false,
35787
- ...options
35788
- };
35789
- const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
35790
- delete options[fallbackAttemptSymbol];
35791
- if (Array.isArray(options.app)) {
35792
- return tryEachApp(options.app, (singleApp) => baseOpen({
35793
- ...options,
35794
- app: singleApp,
35795
- [fallbackAttemptSymbol]: true
35796
- }));
35797
- }
35798
- let { name: app, arguments: appArguments = [] } = options.app ?? {};
35799
- appArguments = [...appArguments];
35800
- if (Array.isArray(app)) {
35801
- return tryEachApp(app, (appName) => baseOpen({
35802
- ...options,
35803
- app: {
35804
- name: appName,
35805
- arguments: appArguments
35806
- },
35807
- [fallbackAttemptSymbol]: true
35808
- }));
35809
- }
35810
- if (app === "browser" || app === "browserPrivate") {
35811
- const ids = {
35812
- "com.google.chrome": "chrome",
35813
- "google-chrome.desktop": "chrome",
35814
- "com.brave.browser": "brave",
35815
- "org.mozilla.firefox": "firefox",
35816
- "firefox.desktop": "firefox",
35817
- "com.microsoft.msedge": "edge",
35818
- "com.microsoft.edge": "edge",
35819
- "com.microsoft.edgemac": "edge",
35820
- "microsoft-edge.desktop": "edge",
35821
- "com.apple.safari": "safari"
35822
- };
35823
- const flags = {
35824
- chrome: "--incognito",
35825
- brave: "--incognito",
35826
- firefox: "--private-window",
35827
- edge: "--inPrivate"
35828
- };
35829
- let browser;
35830
- if (is_wsl_default) {
35831
- const progId = await wslDefaultBrowser();
35832
- const browserInfo = _windowsBrowserProgIdMap.get(progId);
35833
- browser = browserInfo ?? {};
35834
- } else {
35835
- browser = await defaultBrowser2();
35836
- }
35837
- if (browser.id in ids) {
35838
- const browserName = ids[browser.id.toLowerCase()];
35839
- if (app === "browserPrivate") {
35840
- if (browserName === "safari") {
35841
- throw new Error("Safari doesn't support opening in private mode via command line");
35842
- }
35843
- appArguments.push(flags[browserName]);
35844
- }
35845
- return baseOpen({
35846
- ...options,
35847
- app: {
35848
- name: apps[browserName],
35849
- arguments: appArguments
35850
- }
35851
- });
35852
- }
35853
- throw new Error(`${browser.name} is not supported as a default browser`);
35854
- }
35855
- let command;
35856
- const cliArguments = [];
35857
- const childProcessOptions = {};
35858
- let shouldUseWindowsInWsl = false;
35859
- if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
35860
- shouldUseWindowsInWsl = await canAccessPowerShell();
35861
- }
35862
- if (platform === "darwin") {
35863
- command = "open";
35864
- if (options.wait) {
35865
- cliArguments.push("--wait-apps");
35866
- }
35867
- if (options.background) {
35868
- cliArguments.push("--background");
35869
- }
35870
- if (options.newInstance) {
35871
- cliArguments.push("--new");
35872
- }
35873
- if (app) {
35874
- cliArguments.push("-a", app);
35875
- }
35876
- } else if (platform === "win32" || shouldUseWindowsInWsl) {
35877
- command = await powerShellPath2();
35878
- cliArguments.push(...executePowerShell.argumentsPrefix);
35879
- if (!is_wsl_default) {
35880
- childProcessOptions.windowsVerbatimArguments = true;
35881
- }
35882
- if (is_wsl_default && options.target) {
35883
- options.target = await convertWslPathToWindows(options.target);
35884
- }
35885
- const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
35886
- if (options.wait) {
35887
- encodedArguments.push("-Wait");
35888
- }
35889
- if (app) {
35890
- encodedArguments.push(executePowerShell.escapeArgument(app));
35891
- if (options.target) {
35892
- appArguments.push(options.target);
35893
- }
35894
- } else if (options.target) {
35895
- encodedArguments.push(executePowerShell.escapeArgument(options.target));
35896
- }
35897
- if (appArguments.length > 0) {
35898
- appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
35899
- encodedArguments.push("-ArgumentList", appArguments.join(","));
35900
- }
35901
- options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
35902
- if (!options.wait) {
35903
- childProcessOptions.stdio = "ignore";
35904
- }
35905
- } else {
35906
- if (app) {
35907
- command = app;
35908
- } else {
35909
- const isBundled = !__dirname2 || __dirname2 === "/";
35910
- let exeLocalXdgOpen = false;
35911
- try {
35912
- await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
35913
- exeLocalXdgOpen = true;
35914
- } catch {}
35915
- const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
35916
- command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
35917
- }
35918
- if (appArguments.length > 0) {
35919
- cliArguments.push(...appArguments);
35920
- }
35921
- if (!options.wait) {
35922
- childProcessOptions.stdio = "ignore";
35923
- childProcessOptions.detached = true;
35924
- }
35925
- }
35926
- if (platform === "darwin" && appArguments.length > 0) {
35927
- cliArguments.push("--args", ...appArguments);
35928
- }
35929
- if (options.target) {
35930
- cliArguments.push(options.target);
35931
- }
35932
- const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
35933
- if (options.wait) {
35934
- return new Promise((resolve, reject) => {
35935
- subprocess.once("error", reject);
35936
- subprocess.once("close", (exitCode) => {
35937
- if (!options.allowNonzeroExitCode && exitCode !== 0) {
35938
- reject(new Error(`Exited with code ${exitCode}`));
35939
- return;
35940
- }
35941
- resolve(subprocess);
35942
- });
35943
- });
35944
- }
35945
- if (isFallbackAttempt) {
35946
- return new Promise((resolve, reject) => {
35947
- subprocess.once("error", reject);
35948
- subprocess.once("spawn", () => {
35949
- subprocess.once("close", (exitCode) => {
35950
- subprocess.off("error", reject);
35951
- if (exitCode !== 0) {
35952
- reject(new Error(`Exited with code ${exitCode}`));
35953
- return;
35954
- }
35955
- subprocess.unref();
35956
- resolve(subprocess);
35957
- });
35958
- });
35959
- });
35960
- }
35961
- subprocess.unref();
35962
- return new Promise((resolve, reject) => {
35963
- subprocess.once("error", reject);
35964
- subprocess.once("spawn", () => {
35965
- subprocess.off("error", reject);
35966
- resolve(subprocess);
35967
- });
35968
- });
35969
- };
35970
- var open = (target, options) => {
35971
- if (typeof target !== "string") {
35972
- throw new TypeError("Expected a `target`");
35973
- }
35974
- return baseOpen({
35975
- ...options,
35976
- target
35977
- });
35978
- };
35979
- function detectArchBinary(binary) {
35980
- if (typeof binary === "string" || Array.isArray(binary)) {
35981
- return binary;
35982
- }
35983
- const { [arch]: archBinary } = binary;
35984
- if (!archBinary) {
35985
- throw new Error(`${arch} is not supported`);
35986
- }
35987
- return archBinary;
35988
- }
35989
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
35990
- if (wsl && is_wsl_default) {
35991
- return detectArchBinary(wsl);
35992
- }
35993
- if (!platformBinary) {
35994
- throw new Error(`${platform} is not supported`);
35995
- }
35996
- return detectArchBinary(platformBinary);
35997
- }
35998
- var apps = {
35999
- browser: "browser",
36000
- browserPrivate: "browserPrivate"
36001
- };
36002
- defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
36003
- darwin: "google chrome",
36004
- win32: "chrome",
36005
- linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
36006
- }, {
36007
- wsl: {
36008
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
36009
- x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
36010
- }
36011
- }));
36012
- defineLazyProperty(apps, "brave", () => detectPlatformBinary({
36013
- darwin: "brave browser",
36014
- win32: "brave",
36015
- linux: ["brave-browser", "brave"]
36016
- }, {
36017
- wsl: {
36018
- ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
36019
- x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
36020
- }
36021
- }));
36022
- defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
36023
- darwin: "firefox",
36024
- win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
36025
- linux: "firefox"
36026
- }, {
36027
- wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
36028
- }));
36029
- defineLazyProperty(apps, "edge", () => detectPlatformBinary({
36030
- darwin: "microsoft edge",
36031
- win32: "msedge",
36032
- linux: ["microsoft-edge", "microsoft-edge-dev"]
36033
- }, {
36034
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
36035
- }));
36036
- defineLazyProperty(apps, "safari", () => detectPlatformBinary({
36037
- darwin: "Safari"
36038
- }));
36039
- var open_default = open;
36040
-
36041
36206
  // ../../packages/warmhub-cli/src/domains/auth-shared.ts
36042
36207
  async function loginWithToken(ctx, profile) {
36043
36208
  const c = ctx.colors;
@@ -36165,7 +36330,7 @@ function renderTokenInfo(ctx, info, profileName, apiUrl, identityWref) {
36165
36330
  ctx.status(`${c.dim}Check the value of your WH_TOKEN environment variable.${c.reset}`);
36166
36331
  } else if (info.source === "device") {
36167
36332
  if (info.canRefresh) {
36168
- ctx.status(`${prefix}${c.bold}${info.email ?? "unknown"}${c.reset} via ${via} ${c.dim}(token expired at ${expiry} — will auto-refresh)${c.reset}${endpoint}`);
36333
+ ctx.status(`${prefix}${c.bold}${info.email ?? "unknown"}${c.reset} via ${via} ${c.dim}(token expired at ${expiry} — refresh token available)${c.reset}${endpoint}`);
36169
36334
  } else {
36170
36335
  ctx.status(`${prefix}${c.red}Session expired${c.reset}${email} via ${via} ${c.dim}(expired at ${expiry})${c.reset}${endpoint}`);
36171
36336
  ctx.status(`${c.dim}Run: wh auth login${profileName && profileName !== "default" ? ` --profile ${profileName}` : ""}${c.reset}`);
@@ -36196,7 +36361,7 @@ async function fetchIdentityWref(ctx) {
36196
36361
  }
36197
36362
  }
36198
36363
  function openBrowser(url) {
36199
- open_default(url).catch(() => {});
36364
+ Promise.resolve().then(() => (init_open(), exports_open)).then(({ default: open2 }) => open2(url)).catch(() => {});
36200
36365
  }
36201
36366
 
36202
36367
  // ../../packages/warmhub-cli/src/domains/auth-handlers.ts
@@ -36212,6 +36377,26 @@ var loginFlags = {
36212
36377
  }),
36213
36378
  ...profileFlag
36214
36379
  };
36380
+ function authStatusEntry(info, options) {
36381
+ return {
36382
+ active: options.active,
36383
+ apiUrl: options.apiUrl ?? null,
36384
+ authenticated: !info.expired,
36385
+ canRefresh: info.canRefresh,
36386
+ email: info.email ?? null,
36387
+ expiresAt: info.expiresAt ?? null,
36388
+ identityWref: options.identityWref ?? null,
36389
+ profile: options.profile ?? null,
36390
+ source: info.source
36391
+ };
36392
+ }
36393
+ function authStatusOutput(activeProfile, entries) {
36394
+ return {
36395
+ activeProfile,
36396
+ authenticated: entries.some((entry) => entry.active && entry.authenticated),
36397
+ entries
36398
+ };
36399
+ }
36215
36400
  var handleLogin = async (ctx, { flags }) => {
36216
36401
  const profile = flags.profile ?? ctx.config.profile ?? "default";
36217
36402
  if (flags["with-token"]) {
@@ -36306,7 +36491,7 @@ var handleStatus = async (ctx, { flags }) => {
36306
36491
  if (selectedProfile) {
36307
36492
  const prof = getProfile(selectedProfile);
36308
36493
  if (!prof) {
36309
- ctx.status(`Not logged in for profile ${c.bold}${selectedProfile}${c.reset}. Run: wh auth login --profile ${selectedProfile}`);
36494
+ writeOutput(ctx, authStatusOutput(selectedProfile, []), () => ctx.status(`Not logged in for profile ${c.bold}${selectedProfile}${c.reset}. Run: wh auth login --profile ${selectedProfile}`));
36310
36495
  return;
36311
36496
  }
36312
36497
  const tokens = prof.tokens;
@@ -36320,17 +36505,26 @@ var handleStatus = async (ctx, { flags }) => {
36320
36505
  canRefresh: source === "device" && !!tokens.refreshToken
36321
36506
  };
36322
36507
  const identityWref = info.expired ? null : await fetchIdentityWref(ctx);
36323
- renderTokenInfo(ctx, info, selectedProfile, prof.apiUrl, identityWref);
36508
+ const entry = authStatusEntry(info, {
36509
+ active: true,
36510
+ apiUrl: prof.apiUrl,
36511
+ identityWref,
36512
+ profile: selectedProfile
36513
+ });
36514
+ writeOutput(ctx, authStatusOutput(selectedProfile, [entry]), () => renderTokenInfo(ctx, info, selectedProfile, prof.apiUrl, identityWref));
36324
36515
  return;
36325
36516
  }
36326
36517
  const envToken = process.env.WH_TOKEN;
36518
+ const activeProfile = ctx.config.profile ?? "default";
36519
+ const entries = [];
36520
+ const prettyEntries = [];
36327
36521
  if (envToken) {
36328
36522
  const envInfo = getTokenInfo();
36329
36523
  if (envInfo) {
36330
- renderTokenInfo(ctx, envInfo);
36524
+ entries.push(authStatusEntry(envInfo, { active: true }));
36525
+ prettyEntries.push(() => renderTokenInfo(ctx, envInfo));
36331
36526
  }
36332
36527
  }
36333
- const activeProfile = ctx.config.profile ?? "default";
36334
36528
  const profiles = listProfiles();
36335
36529
  for (const name of profiles) {
36336
36530
  const prof = getProfile(name);
@@ -36346,12 +36540,22 @@ var handleStatus = async (ctx, { flags }) => {
36346
36540
  canRefresh: source === "device" && !!tokens.refreshToken
36347
36541
  };
36348
36542
  const identityWref = !info.expired && name === activeProfile ? await fetchIdentityWref(ctx) : null;
36349
- renderTokenInfo(ctx, info, name, prof.apiUrl, identityWref);
36543
+ entries.push(authStatusEntry(info, {
36544
+ active: !envToken && name === activeProfile,
36545
+ apiUrl: prof.apiUrl,
36546
+ identityWref,
36547
+ profile: name
36548
+ }));
36549
+ prettyEntries.push(() => renderTokenInfo(ctx, info, name, prof.apiUrl, identityWref));
36350
36550
  }
36351
36551
  }
36352
- if (!envToken && profiles.length === 0) {
36353
- ctx.status("Not logged in. Run: wh auth login");
36354
- }
36552
+ writeOutput(ctx, authStatusOutput(envToken ? null : activeProfile, entries), () => {
36553
+ for (const render of prettyEntries)
36554
+ render();
36555
+ if (!envToken && profiles.length === 0) {
36556
+ ctx.status("Not logged in. Run: wh auth login");
36557
+ }
36558
+ });
36355
36559
  };
36356
36560
  var statusVerb = {
36357
36561
  prime: true,
@@ -37554,7 +37758,7 @@ var createFlags3 = {
37554
37758
  };
37555
37759
 
37556
37760
  // ../../packages/warmhub-cli/src/domains/commit-submit-handler.ts
37557
- import { readFile } from "node:fs/promises";
37761
+ import { readFile as readFile2 } from "node:fs/promises";
37558
37762
 
37559
37763
  // ../../packages/warmhub-cli/src/commit-payload-validate.ts
37560
37764
  var NUL = String.fromCharCode(0);
@@ -37799,6 +38003,10 @@ function buildAddOperations(input) {
37799
38003
  const rawAbout = pick(abouts, i, { allowBroadcast: true });
37800
38004
  const about = rawAbout ? parseCollectionAboutFlag(rawAbout) : rawAbout;
37801
38005
  const kindFlag = pick(kinds, i, { allowBroadcast: true });
38006
+ const addNameParts = addName.split("/");
38007
+ if (shape && addNameParts.length === 2 && addNameParts[0] === shape) {
38008
+ throw new CliError(2 /* UserInput */, "USER_INPUT", `--add value "${addName}" already includes the --shape prefix "${shape}/".`, undefined, "Pass a bare name with --shape (for example: wh commit submit --add item --shape Shape), or omit --shape and pass the full wref.");
38009
+ }
37802
38010
  const localName = shape ? `${shape}/${addName}` : addName;
37803
38011
  const kind = kindFlag ?? (about ? "assertion" : "thing");
37804
38012
  return { operation: "add", kind, name: localName, data, about };
@@ -38560,7 +38768,7 @@ var handleSubmit = async (ctx, { flags, args }) => {
38560
38768
  } else {
38561
38769
  let file;
38562
38770
  try {
38563
- file = await readFile(opsFile, "utf-8");
38771
+ file = await readFile2(opsFile, "utf-8");
38564
38772
  } catch (e) {
38565
38773
  throw new CliError(2 /* UserInput */, "USER_INPUT", `Cannot read file '${opsFile}': ${e instanceof Error ? e.message : String(e)}`, undefined, "Check that the file path is correct and the file exists.");
38566
38774
  }
@@ -39608,15 +39816,15 @@ function renderValidationResult(ctx, result) {
39608
39816
  if (result.errors.length > 0) {
39609
39817
  ctx.out(`${c.red}Validation failed${c.reset}`);
39610
39818
  for (const err of result.errors) {
39611
- ctx.out(` ${c.red}error${c.reset}: ${err}`);
39819
+ ctx.out(` ${c.red}error${c.reset}: ${escapeTerminalTextForDisplay(err)}`);
39612
39820
  }
39613
39821
  }
39614
39822
  for (const finding of result.findings) {
39615
39823
  const color = finding.level === "error" ? c.red : finding.level === "warning" ? c.yellow : c.dim;
39616
- ctx.out(` ${color}${finding.level}${c.reset} [${finding.code}]: ${finding.message}`);
39824
+ ctx.out(` ${color}${finding.level}${c.reset} [${escapeTerminalTextForDisplay(finding.code)}]: ${escapeTerminalTextForDisplay(finding.message)}`);
39617
39825
  }
39618
39826
  for (const warn of result.warnings) {
39619
- ctx.out(` ${c.yellow}warning${c.reset}: ${warn}`);
39827
+ ctx.out(` ${c.yellow}warning${c.reset}: ${escapeTerminalTextForDisplay(warn)}`);
39620
39828
  }
39621
39829
  if (result.valid && result.errors.length === 0) {
39622
39830
  ctx.out(`${c.green}Valid component package${c.reset}`);
@@ -39626,29 +39834,29 @@ function renderValidationResult(ctx, result) {
39626
39834
  function renderDoctorResult(ctx, result) {
39627
39835
  const c = ctx.colors;
39628
39836
  const stateColor = stateToColor(c, result.state);
39629
- ctx.out(`${c.bold}Doctor:${c.reset} ${c.cyan}${result.componentName}${c.reset} ${stateColor}${result.state}${c.reset}`);
39837
+ ctx.out(`${c.bold}Doctor:${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(result.componentName)}${c.reset} ${stateColor}${escapeTerminalTextForDisplay(result.state)}${c.reset}`);
39630
39838
  ctx.out("");
39631
39839
  for (const finding of result.findings) {
39632
39840
  const color = finding.status === "ok" ? c.green : finding.status === "missing" || finding.status === "error" ? c.red : finding.status === "inactive" ? c.yellow : c.dim;
39633
- ctx.out(` ${color}${finding.status}${c.reset} ${finding.resource} ${c.dim}${finding.message}${c.reset}`);
39841
+ ctx.out(` ${color}${escapeTerminalTextForDisplay(finding.status)}${c.reset} ${escapeTerminalTextForDisplay(finding.resource)} ${c.dim}${escapeTerminalTextForDisplay(finding.message)}${c.reset}`);
39634
39842
  }
39635
39843
  }
39636
39844
  function renderTeardownResult(ctx, result) {
39637
39845
  const c = ctx.colors;
39638
39846
  const stateColor = stateToColor(c, result.state);
39639
- ctx.out(`${c.bold}Teardown:${c.reset} ${c.cyan}${result.componentName}${c.reset} ${stateColor}${result.state}${c.reset}`);
39847
+ ctx.out(`${c.bold}Teardown:${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(result.componentName)}${c.reset} ${stateColor}${escapeTerminalTextForDisplay(result.state)}${c.reset}`);
39640
39848
  if (result.pausedSubscriptions.length > 0) {
39641
- ctx.out(` ${c.green}paused${c.reset} ${result.pausedSubscriptions.length} subscription(s): ${result.pausedSubscriptions.join(", ")}`);
39849
+ ctx.out(` ${c.green}paused${c.reset} ${result.pausedSubscriptions.length} subscription(s): ${result.pausedSubscriptions.map(escapeTerminalTextForDisplay).join(", ")}`);
39642
39850
  }
39643
39851
  if (result.releasedShapes.length > 0) {
39644
- ctx.out(` ${c.green}released${c.reset} ${result.releasedShapes.length} shape(s): ${result.releasedShapes.join(", ")}`);
39852
+ ctx.out(` ${c.green}released${c.reset} ${result.releasedShapes.length} shape(s): ${result.releasedShapes.map(escapeTerminalTextForDisplay).join(", ")}`);
39645
39853
  }
39646
39854
  if (result.tokensRevoked > 0) {
39647
39855
  ctx.out(` ${c.green}revoked${c.reset} ${result.tokensRevoked} token(s)`);
39648
39856
  }
39649
39857
  ctx.out(` uninstall callback: ${result.uninstallDispatched ? `${c.green}dispatched${c.reset}` : `${c.dim}not dispatched${c.reset}`}`);
39650
39858
  for (const warning of result.warnings) {
39651
- ctx.out(` ${c.yellow}warning${c.reset}: ${warning}`);
39859
+ ctx.out(` ${c.yellow}warning${c.reset}: ${escapeTerminalTextForDisplay(warning)}`);
39652
39860
  }
39653
39861
  }
39654
39862
  function redactRegistryEntryLifecycleUrls(entry, showSecrets) {
@@ -39668,26 +39876,26 @@ function redactRegistryEntryListLifecycleUrls(entries, showSecrets) {
39668
39876
  function renderRegistryList(ctx, orgName, result) {
39669
39877
  const c = ctx.colors;
39670
39878
  if (!result.items.length) {
39671
- ctx.status(`${c.dim}No registered components in ${orgName}${c.reset}`);
39879
+ ctx.status(`${c.dim}No registered components in ${escapeTerminalTextForDisplay(orgName)}${c.reset}`);
39672
39880
  return;
39673
39881
  }
39674
- ctx.out(`${c.bold}Registered Components${c.reset} ${c.cyan}${orgName}${c.reset}`);
39882
+ ctx.out(`${c.bold}Registered Components${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(orgName)}${c.reset}`);
39675
39883
  ctx.out("");
39676
39884
  for (const item of result.items) {
39677
39885
  const visibility = item.isPrivate ? `${c.yellow}private${c.reset}` : `${c.green}public${c.reset}`;
39678
- const description = item.description ? ` ${c.dim}${item.description}${c.reset}` : "";
39679
- ctx.out(` ${c.cyan}${orgName}/${item.componentName}${c.reset} ${visibility}${description}`);
39886
+ const description = item.description ? ` ${c.dim}${escapeTerminalTextForDisplay(item.description)}${c.reset}` : "";
39887
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(orgName)}/${escapeTerminalTextForDisplay(item.componentName)}${c.reset} ${visibility}${description}`);
39680
39888
  }
39681
39889
  }
39682
39890
  function renderRegistryEntry(ctx, entry) {
39683
39891
  const c = ctx.colors;
39684
- ctx.out(`${c.bold}${entry.ownerOrgName}/${entry.componentName}${c.reset} ${entry.isPrivate ? `${c.yellow}[private]${c.reset}` : `${c.green}[public]${c.reset}`}`);
39892
+ ctx.out(`${c.bold}${escapeTerminalTextForDisplay(entry.ownerOrgName)}/${escapeTerminalTextForDisplay(entry.componentName)}${c.reset} ${entry.isPrivate ? `${c.yellow}[private]${c.reset}` : `${c.green}[public]${c.reset}`}`);
39685
39893
  if (entry.description) {
39686
- ctx.out(` ${entry.description}`);
39894
+ ctx.out(` ${escapeTerminalTextForDisplay(entry.description)}`);
39687
39895
  }
39688
39896
  if (entry.sourceUrl) {
39689
- const suffix = entry.sourceDefaultRef ? ` @ ${entry.sourceDefaultRef}` : "";
39690
- ctx.out(` Source: ${entry.sourceUrl}${suffix}`);
39897
+ const suffix = entry.sourceDefaultRef ? ` @ ${escapeTerminalTextForDisplay(entry.sourceDefaultRef)}` : "";
39898
+ ctx.out(` Source: ${escapeTerminalTextForDisplay(entry.sourceUrl)}${suffix}`);
39691
39899
  } else {
39692
39900
  ctx.out(` Source: ${c.dim}(not installable — no source URL)${c.reset}`);
39693
39901
  }
@@ -39698,10 +39906,10 @@ function renderRegistryEntry(ctx, entry) {
39698
39906
  ctx.out(` Uninstall: ${formatLifecycleUrl(entry.uninstallUrl, c)}`);
39699
39907
  }
39700
39908
  if (entry.credentialSetName || entry.credentialSetId) {
39701
- ctx.out(` Credential set: ${entry.credentialSetName ?? entry.credentialSetId}`);
39909
+ ctx.out(` Credential set: ${escapeTerminalTextForDisplay(entry.credentialSetName ?? entry.credentialSetId ?? "")}`);
39702
39910
  }
39703
39911
  if (entry.allowedCallbackDomains.length > 0) {
39704
- ctx.out(` Allowed callback domains: ${entry.allowedCallbackDomains.join(", ")}`);
39912
+ ctx.out(` Allowed callback domains: ${entry.allowedCallbackDomains.map(escapeTerminalTextForDisplay).join(", ")}`);
39705
39913
  }
39706
39914
  ctx.out(` ${c.dim}Updated: ${new Date(entry.updatedAt).toISOString().slice(0, 16)}${c.reset}`);
39707
39915
  }
@@ -39737,13 +39945,13 @@ function redactSecretBearingUrl(rawUrl) {
39737
39945
  }
39738
39946
  function formatLifecycleUrl(url, colors) {
39739
39947
  if (url === REDACTED_LIFECYCLE_URL) {
39740
- return `${colors.dim}${url}${colors.reset}`;
39948
+ return `${colors.dim}${escapeTerminalTextForDisplay(url)}${colors.reset}`;
39741
39949
  }
39742
39950
  if (url.endsWith(REDACTED_LIFECYCLE_PATH_SUFFIX)) {
39743
39951
  const visiblePrefix = url.slice(0, -REDACTED_LIFECYCLE_PATH_SUFFIX.length);
39744
- return `${visiblePrefix}${colors.dim}${REDACTED_LIFECYCLE_PATH_SUFFIX}${colors.reset}`;
39952
+ return `${escapeTerminalTextForDisplay(visiblePrefix)}${colors.dim}${REDACTED_LIFECYCLE_PATH_SUFFIX}${colors.reset}`;
39745
39953
  }
39746
- return url;
39954
+ return escapeTerminalTextForDisplay(url);
39747
39955
  }
39748
39956
 
39749
39957
  // ../../packages/warmhub-cli/src/domains/component-utils.ts
@@ -40296,12 +40504,13 @@ var handleList2 = async (ctx, { flags }) => {
40296
40504
  ctx.out(`${c.bold}Installed Components${c.reset} ${c.cyan}${org}/${repo}${c.reset}`);
40297
40505
  ctx.out("");
40298
40506
  for (const item of items) {
40299
- const version = item.version ?? "unknown";
40300
- const state = item.state ?? "unknown";
40301
- const source = item.source ?? "-";
40302
- const stateColor = stateToColor2(c, state);
40303
- const update = item.updateAvailable && item.latestVersion ? ` ${c.yellow}(${item.latestVersion} available)${c.reset}` : "";
40304
- ctx.out(` ${c.cyan}${item.ref ?? item.componentName}${c.reset} ${stateColor}${state}${c.reset} ${c.dim}v${version}${c.reset}${update} ${source}`);
40507
+ const version = escapeTerminalTextForDisplay(item.version ?? "unknown");
40508
+ const rawState = item.state ?? "unknown";
40509
+ const state = escapeTerminalTextForDisplay(rawState);
40510
+ const source = escapeTerminalTextForDisplay(item.source ?? "-");
40511
+ const stateColor = stateToColor2(c, rawState);
40512
+ const update = item.updateAvailable && item.latestVersion ? ` ${c.yellow}(${escapeTerminalTextForDisplay(item.latestVersion)} available)${c.reset}` : "";
40513
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(item.ref ?? item.componentName)}${c.reset} ${stateColor}${state}${c.reset} ${c.dim}v${version}${c.reset}${update} ${source}`);
40305
40514
  }
40306
40515
  });
40307
40516
  };
@@ -40879,7 +41088,7 @@ var CREDENTIAL_DOMAIN = defineDomain({
40879
41088
  import { basename } from "node:path";
40880
41089
 
40881
41090
  // ../../packages/warmhub-cli/src/harness.ts
40882
- import { mkdir, readFile as readFile2, writeFile as writeFile3 } from "node:fs/promises";
41091
+ import { mkdir, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
40883
41092
  import { homedir as homedir4 } from "node:os";
40884
41093
  import { dirname as dirname6, join as join7 } from "node:path";
40885
41094
  var AGENTS_BEGIN_MARKER = "<!-- BEGIN WARMHUB CLI INTEGRATION -->";
@@ -40910,7 +41119,7 @@ function getHarnessPaths(opts) {
40910
41119
  async function readJsonFile(path2) {
40911
41120
  let data;
40912
41121
  try {
40913
- data = await readFile2(path2, "utf-8");
41122
+ data = await readFile3(path2, "utf-8");
40914
41123
  } catch (error) {
40915
41124
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
40916
41125
  return { exists: false };
@@ -41084,7 +41293,7 @@ ${AGENTS_STANZA}
41084
41293
  async function checkAgentsPrimeStanza(paths) {
41085
41294
  let content;
41086
41295
  try {
41087
- content = await readFile2(paths.agentsPath, "utf-8");
41296
+ content = await readFile3(paths.agentsPath, "utf-8");
41088
41297
  } catch (error) {
41089
41298
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
41090
41299
  return { fileExists: false, hasStanza: false };
@@ -41100,7 +41309,7 @@ async function ensureAgentsPrimeStanza(paths) {
41100
41309
  let current = "";
41101
41310
  let createdFile = false;
41102
41311
  try {
41103
- current = await readFile2(paths.agentsPath, "utf-8");
41312
+ current = await readFile3(paths.agentsPath, "utf-8");
41104
41313
  } catch (error) {
41105
41314
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
41106
41315
  createdFile = true;
@@ -42193,12 +42402,12 @@ var handleView5 = async (ctx, { args }) => {
42193
42402
  const c = ctx.colors;
42194
42403
  const result = await ctx.client.org.get(name);
42195
42404
  writeOutput(ctx, result, () => {
42196
- ctx.out(`${c.bold}${result.name}${c.reset}`);
42405
+ ctx.out(`${c.bold}${escapeTerminalTextForDisplay(result.name)}${c.reset}`);
42197
42406
  if (result.displayName) {
42198
- ctx.out(` ${result.displayName}`);
42407
+ ctx.out(` ${escapeTerminalTextForDisplay(result.displayName)}`);
42199
42408
  }
42200
42409
  if (result.description) {
42201
- ctx.out(` ${c.dim}${result.description}${c.reset}`);
42410
+ ctx.out(` ${c.dim}${escapeTerminalTextForDisplay(result.description)}${c.reset}`);
42202
42411
  }
42203
42412
  if (result.tier !== "free") {
42204
42413
  ctx.out(` ${c.cyan}Tier: ${result.tier}${c.reset}`);
@@ -42226,10 +42435,10 @@ var handleList4 = async (ctx, { flags }) => {
42226
42435
  }
42227
42436
  ctx.out(`${c.bold}Organizations:${c.reset}`);
42228
42437
  for (const org of result.items) {
42229
- const display = org.displayName ? ` ${c.dim}${org.displayName}${c.reset}` : "";
42230
- const desc = org.description ? ` ${c.dim}${org.description}${c.reset}` : "";
42438
+ const display = org.displayName ? ` ${c.dim}${escapeTerminalTextForDisplay(org.displayName)}${c.reset}` : "";
42439
+ const desc = org.description ? ` ${c.dim}${escapeTerminalTextForDisplay(org.description)}${c.reset}` : "";
42231
42440
  const archived = org.archivedAt ? ` ${c.yellow}[archived]${c.reset}` : "";
42232
- ctx.out(` ${c.cyan}${org.name}${c.reset}${display}${desc}${archived}`);
42441
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(org.name)}${c.reset}${display}${desc}${archived}`);
42233
42442
  }
42234
42443
  });
42235
42444
  };
@@ -42381,7 +42590,7 @@ var ORG_DOMAIN = defineDomain({
42381
42590
  });
42382
42591
 
42383
42592
  // ../../packages/warmhub-cli/src/domains/prime-content.md
42384
- var prime_content_default = "# WarmHub CLI Context\n> **Context Recovery**: Run `wh prime` after compaction or new session\n\n## Environment\n{{REPO_LINE}}\n\n## Core Concepts\n- **Thing**: A named entity versioned by writes. **Assertion**: A thing that makes a shape-validated claim about another thing.\n- **Shape**: A thing defining data structure; every other thing has one. **Write**: One or more add/revise/retract operations with per-operation results.\n- **wref**: A reference to a thing. Local: `Player` (the shape) or `Player/alice` (a thing with that shape). Cross-repo: `wh:org/repo/Shape` or `wh:org/repo/Shape/name`.\n\n## Versioned Wrefs\n- `Shape` addresses the shape itself; `Shape/name` addresses a thing with that shape. `@vN` pins either.\n- Floating write refs to retracted targets fail; existing pinned versions remain valid.\n- Rename invalidates old spellings, including `@vN`; the new name resolves history.\n- Untyped wrefs accept any thing. `wref<T>` requires the target's shape to be `T`; a shape has no shape, so never satisfies it. `wref?` coalesces only `thing_absent`, never a missing shape.\n\n## Key Workflows\n\n**Write data** (discover shapes → scaffold ops → submit):\n```bash\nwh shape list --repo org/repo # list available shapes\nwh shape view ShapeName --repo org/repo # inspect fields\nwh shape template ShapeName -o ops.json --repo org/repo # scaffold write ops (supports --kind assertion)\n# edit ops.json — fill FILL_IN placeholders — then:\nwh commit submit --file ops.json -m \"msg\" --repo org/repo # submit operations (bare `wh commit` also works)\n# or single assertion (no file needed):\nwh assertion create --shape ShapeName --about Target/name --name my-assertion --data '{\"field\":1}' --repo org/repo\n# Relay failed operation details when present. Never hand-guess ops JSON — use `wh shape template <Shape>`.\n```\n\n**Read data:**\n```bash\nwh thing list --repo org/repo # all things at HEAD\nwh thing view Shape/name --repo org/repo # inspect a thing\nwh thing query --shape MyShape --repo org/repo # find things by shape\nwh thing about Shape --repo org/repo # assertions about a shape\nwh assertion list --repo org/repo # all assertions at HEAD\nwh thing history Shape/name --repo org/repo # version history\n\n# Batch read — wh thing view is variadic (max 500 wrefs/call):\nwh thing view Player/alice Player/bob # variadic positionals\nwh thing view --file wrefs.txt --json # one wref per line\ncat wrefs.txt | wh thing view --format jsonl # one JSON line per *deduped* requested wref\n```\n\n## Wref Quick Reference\n\nWrites use explicit names and wrefs. Untyped fields, collection members,\nassertion `about`, and committers accept any thing. Create a deterministic\ntarget before referencing it in the same commit.\n\n## Command Reference\n\n**Global flags**: `--repo`, `--format`, `--json`, `--live`\n### thing — Thing operations\n- `wh thing list [--shape] [--kind] [--match] [--include-retracted]` — Current HEAD state\n- `wh thing view [<wref>...] [--file <path>] [--version] [--depth] [--include-retracted] [--data-mode auto|full]` — Thing details. Variadic (max 500). `--version` implies `--include-retracted`. Batch JSON returns `{ requested, items, missing }`; jsonl emits one row per deduped requested wref. Large Set/List bodies summarize by default; use `--data-mode full` for canonical collection JSON.\n- `wh thing history [wref] [--shape] [--about] [--include-retracted]` — Version history\n- `wh thing resolve <wref>` — Resolve a wref to its canonical thing identity\n- `wh thing create <name|Shape/name> --data <json-object> [--shape] [--message] [--committer]` — Create\n- `wh thing revise <name> [--data] [--message] [--committer] [--expected-version]` — Revise (CONFLICT if HEAD≠n)\n- `wh thing retract <wref> -m <message> [--reason] [--kind]` — Retract\n- `wh thing query [--shape] [--kind] [--about] [--match]` — Query by filters\n- `wh thing search <query> [--shape] [--kind] [--about] [--mode]` — Search text\n- `wh thing rename <Shape/oldName> <newName>` — Rename\n- `wh thing refs <wref> [--inbound] [--outbound] [--field]` — Show field references; use `wh thing about` for assertions about the target thing\n- `wh thing about <wref> [--shape] [--match] [--depth] [--resolve-collections] [--limit] [--include-retracted]` — Show assertions about the target identity; `--resolve-collections` expands collection members for bare/@HEAD/@ALL inputs, not pinned @vN\n\n### commit — Write operations\n- `wh commit submit [--ops|--file|--add|--revise|--retract] [--kind] [--data] [--reason] [--expected-version] [--chunk-size] [--skip-existing] [--progress] [--stream-id]` — Submit operations (bare `wh commit` is equivalent). Use `--file ops.jsonl --stream-id <id> --chunk-size 5000 --skip-existing` for bulk ingest.\n- `wh shape template <shape> [shape2 ...] [--kind] [--operation add|revise|retract] [-o file]` — Generate sample ops\n\n### assertion — Assertion operations\n- `wh assertion list [--about wref] [--shape] [--match] [--include-retracted]` — Browse assertions\n- `wh assertion view <wref> [--version] [--include-retracted]` — Assertion details\n- `wh assertion create --shape <s> --name <n> --about <wref> [--data] [-m] [--committer]` — Create assertion\n- `wh assertion revise <wref> --data <json> [--message] [--committer]` — Revise assertion\n- `wh assertion retract <wref> -m <message> [--reason] [--committer]` — Retract assertion\n- `wh assertion history <wref> [--include-retracted]` — Assertion history\n\n### shape — Shape management\n- `wh shape list [--match] [--include-retracted]` — List all shapes\n- `wh shape view <name> [--include-retracted]` — Shape details\n- `wh shape revise <name> [--fields]` — Revise shape\n- `wh shape create <name> [--fields]` — Create shape\n- `wh shape retract <name> -m <message> [--reason]` — Retract shape\n- `wh shape history <name> [--include-retracted]` — Shape history\n- `wh shape rename <oldName> <newName>` — Rename shape\n\n### repo — Repository management\n- `wh repo create <org/name> [--display-name] [--description] [--visibility]` — Create repo\n- `wh repo list [org]` — List repos\n- `wh repo view [org/repo]` — Repo details\n\n### org — Organization management\n- `wh org create <name> [--display-name]` — Create a new organization\n- `wh org view <name>` — View organization details (alias: info)\n- `wh org list` — List all organizations\n\n### sub — Subscription management\n- `wh sub create <name> [flags]` — Create a subscription\n- `wh sub view <name>` — View subscription details\n- `wh sub list` — List all subscriptions\n- `wh sub log <name>` — Tail subscription delivery feed\n- `wh sub attempts <runId>` — Show attempt history for a run\n- `wh sub pause <name>` — Pause a subscription\n- `wh sub resume <name>` — Resume a paused subscription\n- `wh sub bind <name> [--credentials]` — Bind a credential set to a subscription for webhook auth\n- `wh sub unbind <name>` — Remove credential binding from a subscription\n- `wh sub delete <name>` — Delete a subscription\n\n### notifications — Action notification listing\n- `wh notifications [--limit] [--since]` — List repo-scoped action notifications\n\n### credential — Credential set management\n- `wh credential create <name> [--repo org/repo | --org org] [--scope] [--description]` — Create an empty credential set\n- `wh credential list [--repo org/repo | --org org]` — List credential sets accessible from a repo or org\n- `wh credential view <name> [--repo org/repo | --org org]` — View a credential set (key names only, no values)\n- `wh credential delete <name> [--repo org/repo | --org org]` — Delete a credential set and its Vault object\n- `wh credential set <setName> [<keyName>] [--repo org/repo | --org org] [--value]` — Set credential key(s). With `<keyName>`: single-key form (reads value from `--value` or stdin). Without `<keyName>`: batch form (reads JSON object from stdin, e.g. `{\"KEY\":\"val\"}`)\n- `wh credential unset <setName> <keyName> [--repo org/repo | --org org]` — Remove a key from a credential set\n- `wh credential audit <setName> [--repo org/repo | --org org]` — View audit log for a credential set\n- `wh credential revoke <setName> [--repo org/repo | --org org] [--reason]` — Revoke a credential set (blocks new binds and stops bound webhook deliveries)\n\n### component — Component management\n- `wh component validate <path>` — Validate package\n- `wh component install <org/name>` — Install a registered component\n- `wh component register <name> --org <org> --manifest <path> [flags]` — Register component identity\n- `wh component unregister <org/name>` — Remove a registered component identity\n- `wh component registry list --org <org>` — List registered components\n- `wh component registry view <org/name>` — View a registered component\n- `wh component registry update <org/name> [flags]` — Update a registered component\n- `wh component list` — List installed components\n- `wh component update <org/name>` — Update installed component\n- `wh component view <org/name>` — Show component details (alias: show)\n- `wh component doctor <org/name>` — Run component health checks\n- `wh component teardown <org/name>` — Pause component subscriptions\n\n### Getting More Info\n- `wh help` — full help overview\n- `wh <domain>` — list verbs for a domain\n- `wh <domain> <verb> --help` — verb details with flags and examples\n- `wh help --format json` — full CLI spec as JSON (best for agents)\n\n## Common Workflows\n\n**Explore a repo:**\n```bash\nwh thing list --repo org/repo # see all things in HEAD\nwh thing view Shape/name --repo org/repo # inspect a specific thing\nwh thing history Shape/name --repo org/repo # inspect version history\nwh thing about Shape/name # assertions about thing/shape\n```\n\n**Create an assertion** (most common write):\n```bash\n# --about takes an untyped target wref: Shape or Shape/name.\nwh assertion create --shape MyShape --about TargetShape/target-name \\\n --name my-assertion --data '{\"field_a\":1,\"field_b\":\"value\"}' --repo org/repo\n# Output includes per-operation status; relay failures when present.\n```\n\n**Create via write entrypoint** (alternative, supports batches and streams):\n```bash\nwh commit submit --add my-item --shape MyShape --kind assertion \\\n --about TargetShape/target-name --data '{\"field_a\":1}' --repo org/repo\n```\n\n**Batch write via file** (generate template → edit → submit):\n```bash\nwh shape template Hypothesis Evidence -o ops.json # add --kind assertion --about TargetShape/name for assertions\n# edit ops.json — fill FILL_IN placeholders\nwh commit submit --file ops.json -m \"batch update\" # submit all operations (bare `wh commit` is equivalent)\n# --file format: docs.warmhub.ai/cli-reference/commit-operations\n```\n\n**Bulk write (JSONL stream, >1k ops)** — one chunked stream beats per-record commits (~60× faster):\n```bash\nwh shape template MyShape -o ops.jsonl # one op per line (.jsonl)\nID=\"bulk-$(date +%s)\" # choose your own; set it up front so reruns are safe\nwh commit submit --file ops.jsonl --stream-id \"$ID\" --chunk-size 5000 \\\n --skip-existing --progress -m \"bulk ingest\" --repo org/repo\n# --chunk-size: ops per append chunk (default 1000, max 10000); chunk≈1 is ~60× slower\n# --skip-existing: skips already-written add ops (drops per-row read-before-write)\n# Add-stream restart: rerun the WHOLE file with the SAME --stream-id.\n# Fixed-name adds are idempotent via --skip-existing. Mid-stream resume is not\n# a CLI mode. Mixed revise/retract JSONL streams are not full-rerun safe after\n# an ambiguous append; inspect repo state and reconcile explicitly.\n```\n\n**Create collections:**\n```bash\nwh commit submit --type pair --name location-distance --members Location,Location/a --repo org/repo\nwh assertion create --shape Distance --name location-distance-value --about Pair/location-distance --data '{\"value\":5}' --repo org/repo\n```\n\n**Modify data:**\n```bash\nwh thing revise Shape/name --data '{\"x\":5,\"y\":3}' -m \"update\" --repo org/repo\nwh thing retract Shape/old-item -m \"withdrawn\" --reason \"data feed contaminated\" --repo org/repo\n```\n\n**Query and filter:**\n```bash\nwh thing query --shape MyShape # by shape\nwh thing query --kind assertion --about Shape/name # by kind + target\nwh thing history Shape/name --limit 10 # version history\n```\n\n## Built-in Content shape\n\nWarmHub repos expose three well-known content wrefs:\n- `Content/Readme` — stored markdown for humans\n- `Content/Agents` — stored markdown guidance for AI agents\n- `Content/LlmsTxt` — synthesized per-request sitemap (read-only)\n\nFetch via `wh repo content get --kind readme|agents|llms-txt`,\n`client.repo.getReadme/getAgents/getLlmsTxt`, MCP `warmhub_repo_content_get`,\nor raw HTTP `GET /{org}/{repo}/readme.md|agents.md|llms.txt`.\nSee `wh repo describe` → `additionalInformation` for the discovery field.\n\n## Query Discipline\n- Plan the repo, shapes, and wrefs you need before the first query.\n- Gather the needed facts from one repo before switching to another.\n- Do the queries first, then write one complete answer.\n\n## Agent Tips\n- **Always run commands for live data** — this context describes the CLI, not repo contents\n- **Before writing, discover wrefs** — run `wh thing list` or `wh shape list`\n- **Shape field types**: `string`, `number`, `boolean`, `wref`, arrays, optionals, nested objects\n- **Write commands return per-operation results** — relay failures and affected wrefs to the user\n- **Pass data inline** with `--data '{...}'` — do NOT create temp files\n- Add `--json` to any command for machine-readable JSON output\n- **Aliases teach canonical commands** — executing aliases emit a status hint; misleading lifecycle aliases reject and point to `retract`\n- Writes go through `wh commit submit` (or bare `wh commit`) or wrappers (`create`, `revise`, `retract`, `assertion create`). `retract` irreversibly withdraws an identity and creates a history entry.\n- Use `wh doctor` to check environment health\n";
42593
+ var prime_content_default = "# WarmHub CLI Context\n> **Context Recovery**: Run `wh prime` after compaction or new session\n\n## Environment\n{{REPO_LINE}}\n\n## Core Concepts\n- **Thing**: A named entity versioned by writes. **Assertion**: A thing that makes a shape-validated claim about another thing.\n- **Shape**: A thing defining data structure; every other thing has one. **Write**: One or more add/revise/retract operations with per-operation results.\n- **wref**: A reference to a thing. Local: `Player` (the shape) or `Player/alice` (a thing with that shape). Cross-repo: `wh:org/repo/Shape` or `wh:org/repo/Shape/name`.\n\n## Versioned Wrefs\n- `Shape` addresses the shape itself; `Shape/name` addresses a thing with that shape. `@vN` pins either.\n- Floating write refs to retracted targets fail; existing pinned versions remain valid.\n- Rename invalidates old spellings, including `@vN`; the new name resolves history.\n- Untyped wrefs accept any thing. `wref<T>` requires the target's shape to be `T`; a shape has no shape, so never satisfies it. `wref?` coalesces only `thing_absent`, never a missing shape.\n\n## Key Workflows\n\n**Write data** (discover shapes → scaffold ops → submit):\n```bash\nwh shape list --repo org/repo # list available shapes\nwh shape view ShapeName --repo org/repo # inspect fields\nwh shape template ShapeName -o ops.json --repo org/repo # scaffold write ops (supports --kind assertion)\n# edit ops.json — fill FILL_IN placeholders — then:\nwh commit submit --file ops.json -m \"msg\" --repo org/repo # submit operations (bare `wh commit` also works)\n# or single assertion (no file needed):\nwh assertion create --shape ShapeName --about Target/name --name my-assertion --data '{\"field\":1}' --repo org/repo\n# Relay failed operation details when present. Never hand-guess ops JSON — use `wh shape template <Shape>`.\n```\n\n**Read data:**\n```bash\nwh thing list --repo org/repo # all things at HEAD\nwh thing view Shape/name --repo org/repo # inspect a thing\nwh thing query --shape MyShape --repo org/repo # find things by shape\nwh thing about Shape --repo org/repo # assertions about a shape\nwh assertion list --repo org/repo # all assertions at HEAD\nwh thing history Shape/name --repo org/repo # version history\n\n# Batch read — wh thing view is variadic (max 500 wrefs/call):\nwh thing view Player/alice Player/bob # variadic positionals\nwh thing view --file wrefs.txt --json # one wref per line\ncat wrefs.txt | wh thing view --format jsonl # one JSON line per *deduped* requested wref\n```\n\n## Wref Quick Reference\n\nWrites use explicit names and wrefs. Untyped fields, collection members,\nassertion `about`, and committers accept any thing. Create a deterministic\ntarget before referencing it in the same commit.\n\n## Command Reference\n\n**Global flags**: `--repo`, `--format`, `--json`, `--live`\n### thing — Thing operations\n- `wh thing list [--shape] [--kind] [--match] [--include-retracted]` — Current HEAD state\n- `wh thing view [<wref>...] [--file <path>] [--version] [--depth] [--include-retracted] [--data-mode auto|full]` — Thing details. Variadic (max 500). `--version` implies `--include-retracted`. Batch JSON returns `{ requested, items, missing }`; jsonl emits one row per deduped requested wref. Large Set/List bodies summarize by default; use `--data-mode full` for canonical collection JSON.\n- `wh thing history [wref] [--shape] [--about] [--include-retracted]` — Version history\n- `wh thing resolve <wref>` — Resolve a wref to its canonical thing identity\n- `wh thing create <name|Shape/name> (--data|--file) [--shape]` — Create\n- `wh thing revise <name> [--data] [--message] [--committer] [--expected-version]` — Revise (CONFLICT if HEAD≠n)\n- `wh thing retract <wref> -m <message> [--reason] [--kind]` — Retract\n- `wh thing query [--shape] [--kind] [--about] [--match]` — Query by filters\n- `wh thing search <query> [--shape] [--kind] [--about] [--mode]` — Search text\n- `wh thing rename <Shape/oldName> <newName>` — Rename\n- `wh thing refs <wref> [--inbound] [--outbound] [--field]` — Show field references; use `wh thing about` for assertions about the target thing\n- `wh thing about <wref> [--shape] [--match] [--depth] [--resolve-collections] [--limit] [--include-retracted]` — Show assertions about the target identity; `--resolve-collections` expands collection members for bare/@HEAD/@ALL inputs, not pinned @vN\n\n### commit — Write operations\n- `wh commit submit [--ops|--file|--add|--revise|--retract] [--kind] [--data] [--reason] [--expected-version] [--chunk-size] [--skip-existing] [--progress] [--stream-id]` — Submit operations (bare `wh commit` is equivalent). Use `--file ops.jsonl --stream-id <id> --chunk-size 5000 --skip-existing` for bulk ingest.\n- `wh shape template <shape> [shape2 ...] [--kind] [--operation add|revise|retract] [-o file]` — Generate sample ops\n\n### assertion — Assertion operations\n- `wh assertion list [--about wref] [--shape] [--match] [--include-retracted]` — Browse assertions\n- `wh assertion view <wref> [--version] [--include-retracted]` — Assertion details\n- `wh assertion create --shape <s> --name <n> --about <wref> [--data] [-m] [--committer]` — Create assertion\n- `wh assertion revise <wref> --data <json> [--message] [--committer]` — Revise assertion\n- `wh assertion retract <wref> -m <message> [--reason] [--committer]` — Retract assertion\n- `wh assertion history <wref> [--include-retracted]` — Assertion history\n\n### shape — Shape management\n- `wh shape list [--match] [--include-retracted]` — List all shapes\n- `wh shape view <name> [--include-retracted]` — Shape details\n- `wh shape revise <name> (--fields|--file)`\n- `wh shape create <name> (--fields|--file)`\n- `wh shape retract <name> -m <message> [--reason]` — Retract shape\n- `wh shape history <name> [--include-retracted]` — Shape history\n- `wh shape rename <oldName> <newName>` — Rename shape\n\n### repo — Repository management\n- `wh repo create <org/name> [--display-name] [--description] [--visibility]` — Create repo\n- `wh repo list [org]` — List repos\n- `wh repo view [org/repo]` — Repo details\n\n### org — Organization management\n- `wh org create <name> [--display-name]` — Create a new organization\n- `wh org view <name>` — View organization details (alias: info)\n- `wh org list` — List all organizations\n\n### sub — Subscription management\n- `wh sub create <name> [flags]` — Create a subscription\n- `wh sub view <name>` — View subscription details\n- `wh sub list` — List all subscriptions\n- `wh sub log <name>` — Tail subscription delivery feed\n- `wh sub attempts <runId>` — Show attempt history for a run\n- `wh sub pause <name>` — Pause a subscription\n- `wh sub resume <name>` — Resume a paused subscription\n- `wh sub bind <name> [--credentials]` — Bind a credential set to a subscription for webhook auth\n- `wh sub unbind <name>` — Remove credential binding from a subscription\n- `wh sub delete <name>` — Delete a subscription\n\n### notifications — Action notification listing\n- `wh notifications [--limit] [--since]` — List repo-scoped action notifications\n\n### credential — Credential set management\n- `wh credential create <name> [--repo org/repo | --org org] [--scope] [--description]` — Create an empty credential set\n- `wh credential list [--repo org/repo | --org org]` — List credential sets accessible from a repo or org\n- `wh credential view <name> [--repo org/repo | --org org]` — View a credential set (key names only, no values)\n- `wh credential delete <name> [--repo org/repo | --org org]` — Delete a credential set and its Vault object\n- `wh credential set <setName> [<keyName>] [--repo org/repo | --org org] [--value]` — Set credential key(s). With `<keyName>`: single-key form (reads value from `--value` or stdin). Without `<keyName>`: batch form (reads JSON object from stdin, e.g. `{\"KEY\":\"val\"}`)\n- `wh credential unset <setName> <keyName> [--repo org/repo | --org org]` — Remove a key from a credential set\n- `wh credential audit <setName> [--repo org/repo | --org org]` — View audit log for a credential set\n- `wh credential revoke <setName> [--repo org/repo | --org org] [--reason]` — Revoke a credential set (blocks new binds and stops bound webhook deliveries)\n\n### component — Component management\n- `wh component validate <path>` — Validate package\n- `wh component install <org/name>` — Install a registered component\n- `wh component register <name> --org <org> --manifest <path> [flags]` — Register component identity\n- `wh component unregister <org/name>` — Remove a registered component identity\n- `wh component registry list --org <org>` — List registered components\n- `wh component registry view <org/name>` — View a registered component\n- `wh component registry update <org/name> [flags]` — Update a registered component\n- `wh component list` — List installed components\n- `wh component update <org/name>` — Update installed component\n- `wh component view <org/name>` — Show component details (alias: show)\n- `wh component doctor <org/name>` — Run component health checks\n- `wh component teardown <org/name>` — Pause component subscriptions\n\n### Getting More Info\n- `wh help` — full help overview\n- `wh <domain>` — list verbs for a domain\n- `wh <domain> <verb> --help` — verb details with flags and examples\n- `wh help --format json` — full CLI spec as JSON (best for agents)\n\n## Common Workflows\n\n**Explore a repo:**\n```bash\nwh thing list --repo org/repo # see all things in HEAD\nwh thing view Shape/name --repo org/repo # inspect a specific thing\nwh thing history Shape/name --repo org/repo # inspect version history\nwh thing about Shape/name # assertions about thing/shape\n```\n\n**Create an assertion** (most common write):\n```bash\n# --about takes an untyped target wref: Shape or Shape/name.\nwh assertion create --shape MyShape --about TargetShape/target-name \\\n --name my-assertion --data '{\"field_a\":1,\"field_b\":\"value\"}' --repo org/repo\n# Output includes per-operation status; relay failures when present.\n```\n\n**Create via write entrypoint** (alternative, supports batches and streams):\n```bash\nwh commit submit --add my-item --shape MyShape --kind assertion \\\n --about TargetShape/target-name --data '{\"field_a\":1}' --repo org/repo\n```\n\n**Batch write via file** (generate template → edit → submit):\n```bash\nwh shape template Hypothesis Evidence -o ops.json # add --kind assertion --about TargetShape/name for assertions\n# edit ops.json — fill FILL_IN placeholders\nwh commit submit --file ops.json -m \"batch update\" # submit all operations (bare `wh commit` is equivalent)\n# --file format: docs.warmhub.ai/cli-reference/commit-operations\n```\n\n**Bulk write (JSONL stream, >1k ops)** — one chunked stream beats per-record commits (~60× faster):\n```bash\nwh shape template MyShape -o ops.jsonl # one op per line (.jsonl)\nID=\"bulk-$(date +%s)\" # choose your own; set it up front so reruns are safe\nwh commit submit --file ops.jsonl --stream-id \"$ID\" --chunk-size 5000 \\\n --skip-existing --progress -m \"bulk ingest\" --repo org/repo\n# --chunk-size: ops per append chunk (default 1000, max 10000); chunk≈1 is ~60× slower\n# --skip-existing: skips already-written add ops (drops per-row read-before-write)\n# Add-stream restart: rerun the WHOLE file with the SAME --stream-id.\n# Fixed-name adds are idempotent via --skip-existing. Mid-stream resume is not\n# a CLI mode. Mixed revise/retract JSONL streams are not full-rerun safe after\n# an ambiguous append; inspect repo state and reconcile explicitly.\n```\n\n**Create collections:**\n```bash\nwh commit submit --type pair --name location-distance --members Location,Location/a --repo org/repo\nwh assertion create --shape Distance --name location-distance-value --about Pair/location-distance --data '{\"value\":5}' --repo org/repo\n```\n\n**Modify data:**\n```bash\nwh thing revise Shape/name --data '{\"x\":5,\"y\":3}' -m \"update\" --repo org/repo\nwh thing retract Shape/old-item -m \"withdrawn\" --reason \"data feed contaminated\" --repo org/repo\n```\n\n**Query and filter:**\n```bash\nwh thing query --shape MyShape # by shape\nwh thing query --kind assertion --about Shape/name # by kind + target\nwh thing history Shape/name --limit 10 # version history\n```\n\n## Built-in Content shape\n\nWarmHub repos expose three well-known content wrefs:\n- `Content/Readme` — stored markdown for humans\n- `Content/Agents` — stored markdown guidance for AI agents\n- `Content/LlmsTxt` — synthesized per-request sitemap (read-only)\n\nFetch via `wh repo content get --kind readme|agents|llms-txt`,\n`client.repo.getReadme/getAgents/getLlmsTxt`, MCP `warmhub_repo_content_get`,\nor raw HTTP `GET /{org}/{repo}/readme.md|agents.md|llms.txt`.\nSee `wh repo describe` → `additionalInformation` for the discovery field.\n\n## Query Discipline\n- Plan the repo, shapes, and wrefs you need before the first query.\n- Gather the needed facts from one repo before switching to another.\n- Do the queries first, then write one complete answer.\n\n## Agent Tips\n- **Always run commands for live data** — this context describes the CLI, not repo contents\n- **Before writing, discover wrefs** — run `wh thing list` or `wh shape list`\n- **Shape field types**: `string`, `number`, `boolean`, `wref`, arrays, optionals, nested objects\n- **Write commands return per-operation results** — relay failures and affected wrefs to the user\n- **Pass data inline** with `--data '{...}'` — do NOT create temp files\n- Add `--json` to any command for machine-readable JSON output\n- **Aliases teach canonical commands** — executing aliases emit a status hint; misleading lifecycle aliases reject and point to `retract`\n- Writes go through `wh commit submit` (or bare `wh commit`) or wrappers (`create`, `revise`, `retract`, `assertion create`). `retract` irreversibly withdraws an identity and creates a history entry.\n- Use `wh doctor` to check environment health\n";
42385
42594
 
42386
42595
  // ../../packages/warmhub-cli/src/domains/prime.ts
42387
42596
  function buildMarkdown(config) {
@@ -42879,10 +43088,10 @@ var handleList5 = async (ctx, { flags, args }) => {
42879
43088
  }
42880
43089
  ctx.out(`${c.bold}Repos in ${orgName}:${c.reset}`);
42881
43090
  for (const r of items) {
42882
- const display = r.displayName && r.displayName !== r.name ? ` ${c.dim}${r.displayName}${c.reset}` : "";
42883
- const desc = r.description ? ` ${c.dim}${r.description}${c.reset}` : "";
43091
+ const display = r.displayName && r.displayName !== r.name ? ` ${c.dim}${escapeTerminalTextForDisplay(r.displayName)}${c.reset}` : "";
43092
+ const desc = r.description ? ` ${c.dim}${escapeTerminalTextForDisplay(r.description)}${c.reset}` : "";
42884
43093
  const archived = r.archivedAt ? ` ${c.yellow}[archived]${c.reset}` : "";
42885
- ctx.out(` ${c.cyan}${orgName}/${r.name}${c.reset}${display}${desc}${archived}`);
43094
+ ctx.out(` ${c.cyan}${orgName}/${escapeTerminalTextForDisplay(r.name)}${c.reset}${display}${desc}${archived}`);
42886
43095
  }
42887
43096
  });
42888
43097
  };
@@ -43015,7 +43224,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
43015
43224
  writeOutput(ctx, payload, () => {
43016
43225
  ctx.out(`${c.bold}${org}/${repo}${c.reset}`);
43017
43226
  if (repoInfo.description) {
43018
- ctx.out(` ${repoInfo.description}`);
43227
+ ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
43019
43228
  }
43020
43229
  ctx.out("");
43021
43230
  ctx.out(`${c.bold}Counts${c.reset} ${stats.byKind.shape} shapes, ${stats.byKind.thing} things, ${stats.byKind.assertion} assertions (${stats.total} total)`);
@@ -43023,7 +43232,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
43023
43232
  if (shapeCountEntries.length > 0) {
43024
43233
  const maxName = shapeCountEntries.reduce((max, [name]) => Math.max(max, name.length), 0);
43025
43234
  for (const [shapeName, count] of shapeCountEntries) {
43026
- ctx.out(` ${c.cyan}${shapeName.padEnd(maxName)}${c.reset} ${count}`);
43235
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(shapeName.padEnd(maxName))}${c.reset} ${count}`);
43027
43236
  }
43028
43237
  }
43029
43238
  ctx.out("");
@@ -43090,9 +43299,9 @@ var handleDescribe = async (ctx, { args, flags }) => {
43090
43299
  const maxField = allEntries.reduce((m, e) => Math.max(m, e.fieldPath.length), 0);
43091
43300
  const maxState = allEntries.reduce((m, e) => Math.max(m, e.state.length), 0);
43092
43301
  for (const entry of allEntries) {
43093
- const shapeLabel = entry.shapeName.padEnd(maxShape);
43094
- const fieldLabel = entry.fieldPath.padEnd(maxField);
43095
- const stateLabel = entry.state.padEnd(maxState);
43302
+ const shapeLabel = escapeTerminalTextForDisplay(entry.shapeName.padEnd(maxShape));
43303
+ const fieldLabel = escapeTerminalTextForDisplay(entry.fieldPath.padEnd(maxField));
43304
+ const stateLabel = escapeTerminalTextForDisplay(entry.state.padEnd(maxState));
43096
43305
  const sc = stateColor(entry.state);
43097
43306
  let line = ` ${c.cyan}${shapeLabel}${c.reset} ${c.dim}${fieldLabel}${c.reset} ${sc}${stateLabel}${c.reset}`;
43098
43307
  if (entry.state === "building" && entry.backfillTotal != null && entry.backfillTotal > 0) {
@@ -43101,7 +43310,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
43101
43310
  } else if (entry.state === "building") {
43102
43311
  line += ` ${c.dim}${entry.backfillDone} rows${c.reset}`;
43103
43312
  } else if (entry.state === "failed" && entry.failureReason) {
43104
- line += ` ${c.dim}${entry.failureReason}${c.reset}`;
43313
+ line += ` ${c.dim}${escapeTerminalTextForDisplay(entry.failureReason)}${c.reset}`;
43105
43314
  }
43106
43315
  ctx.out(line);
43107
43316
  }
@@ -43155,10 +43364,11 @@ var handleView6 = async (ctx, { args }) => {
43155
43364
  writeOutput(ctx, { ...repoInfo, stats, configureStats }, () => {
43156
43365
  ctx.out(`${c.bold}${org}/${repo}${c.reset}`);
43157
43366
  if (repoInfo.displayName && repoInfo.displayName !== repoInfo.name) {
43158
- ctx.out(` ${repoInfo.displayName}`);
43367
+ ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.displayName)}`);
43368
+ }
43369
+ if (repoInfo.description) {
43370
+ ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
43159
43371
  }
43160
- if (repoInfo.description)
43161
- ctx.out(` ${repoInfo.description}`);
43162
43372
  if (repoInfo.archivedAt) {
43163
43373
  ctx.out(`${c.yellow}ARCHIVED${c.reset} ${c.dim}${new Date(repoInfo.archivedAt).toISOString().slice(0, 16)}${c.reset}`);
43164
43374
  }
@@ -43515,14 +43725,19 @@ var handleView7 = async (ctx, { flags, args }) => {
43515
43725
  };
43516
43726
 
43517
43727
  // ../../packages/warmhub-cli/src/domains/shape/write.ts
43728
+ var fieldsFileFlag = flag.string({
43729
+ description: "read fields from a JSON object file (portable alternative to inline --fields)"
43730
+ });
43518
43731
  var createFlags7 = {
43519
43732
  fields: flag.string({ description: FIELDS_FLAG_DESCRIPTION }),
43733
+ file: fieldsFileFlag,
43520
43734
  description: flag.string({
43521
43735
  description: "Human-readable description of the shape"
43522
43736
  })
43523
43737
  };
43524
43738
  var reviseFlags3 = {
43525
43739
  fields: flag.string({ description: FIELDS_FLAG_DESCRIPTION }),
43740
+ file: fieldsFileFlag,
43526
43741
  description: flag.string({
43527
43742
  description: "Human-readable description of the shape"
43528
43743
  })
@@ -43536,13 +43751,18 @@ var retractFlags3 = {
43536
43751
  };
43537
43752
  var handleCreate6 = async (ctx, { flags, args }) => {
43538
43753
  const shapeName = args[0];
43539
- const fieldsJson = flags.fields;
43540
- if (!shapeName || fieldsJson === undefined) {
43541
- usageError("Usage: wh shape create <name> --fields '<json>'", `wh shape create Location --fields '{"x":"number","y":"number"}'`, `wh shape create Tags --fields '{"labels":["string"],"scores":["number"]}'`, `wh shape create Player --fields '{"name":"string","position":{"x":"number","y":"number"}}'`, `wh shape create Review --fields '{"score":"number","reason?":"string"}'`);
43754
+ if (!shapeName) {
43755
+ usageError("Usage: wh shape create <name> (--fields '<json>' | --file <path>)", `wh shape create Location --fields '{"x":"number","y":"number"}'`, "wh shape create Location --file fields.json", `wh shape create Tags --fields '{"labels":["string"],"scores":["number"]}'`, `wh shape create Player --fields '{"name":"string","position":{"x":"number","y":"number"}}'`, `wh shape create Review --fields '{"score":"number","reason?":"string"}'`);
43542
43756
  }
43757
+ const fields = await readJsonObjectInput({
43758
+ inline: flags.fields,
43759
+ file: flags.file,
43760
+ inlineFlag: "--fields",
43761
+ missingMessage: "Usage: wh shape create <name> (--fields '<json>' | --file <path>)",
43762
+ example: "wh shape create Location --file fields.json"
43763
+ });
43543
43764
  const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
43544
43765
  const c = ctx.colors;
43545
- const fields = parseJsonObject(fieldsJson, "--fields");
43546
43766
  const opts = {};
43547
43767
  if (flags.description !== undefined)
43548
43768
  opts.description = flags.description;
@@ -43557,13 +43777,18 @@ var handleCreate6 = async (ctx, { flags, args }) => {
43557
43777
  };
43558
43778
  var handleRevise3 = async (ctx, { flags, args }) => {
43559
43779
  const shapeName = args[0];
43560
- const fieldsJson = flags.fields;
43561
- if (!shapeName || fieldsJson === undefined) {
43562
- usageError("Usage: wh shape revise <name> --fields '<json>'", `wh shape revise Location --fields '{"x":"number","y":"number","z":"number"}'`, `wh shape revise Review --fields '{"score":"number","reason?":"string","tags":["string"]}'`);
43780
+ if (!shapeName) {
43781
+ usageError("Usage: wh shape revise <name> (--fields '<json>' | --file <path>)", `wh shape revise Location --fields '{"x":"number","y":"number","z":"number"}'`, "wh shape revise Location --file fields.json", `wh shape revise Review --fields '{"score":"number","reason?":"string","tags":["string"]}'`);
43563
43782
  }
43783
+ const newFields = await readJsonObjectInput({
43784
+ inline: flags.fields,
43785
+ file: flags.file,
43786
+ inlineFlag: "--fields",
43787
+ missingMessage: "Usage: wh shape revise <name> (--fields '<json>' | --file <path>)",
43788
+ example: "wh shape revise Location --file fields.json"
43789
+ });
43564
43790
  const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
43565
43791
  const c = ctx.colors;
43566
- const newFields = parseJsonObject(fieldsJson, "--fields");
43567
43792
  const opts = {};
43568
43793
  if (flags.description !== undefined)
43569
43794
  opts.description = flags.description;
@@ -43640,6 +43865,7 @@ var SHAPE_DOMAIN = defineDomain({
43640
43865
  flags: reviseFlags3,
43641
43866
  examples: [
43642
43867
  `wh shape revise location --fields '{"x":"number","y":"number"}'`,
43868
+ "wh shape revise location --file fields.json",
43643
43869
  `wh shape revise Player --fields '{"name":{"type":"string","maxLength":80},"tags":{"type":"array","items":"string","maxItems":10}}'`
43644
43870
  ],
43645
43871
  notes: [...FIELD_CONSTRAINTS_NOTES],
@@ -43652,6 +43878,7 @@ var SHAPE_DOMAIN = defineDomain({
43652
43878
  flags: createFlags7,
43653
43879
  examples: [
43654
43880
  `wh shape create GameConfig --repo org/repo --fields '{"x":"number"}'`,
43881
+ "wh shape create GameConfig --repo org/repo --file fields.json",
43655
43882
  `wh shape create Player --fields '{"name":{"type":"string","minLength":1,"maxLength":40},"role":{"type":"string","enum":["dm","player"]},"level":{"type":"number","minimum":1,"integer":true},"home":{"type":"wref","shape":"Location"},"tags":{"type":"array","items":"string","minItems":1}}'`
43656
43883
  ],
43657
43884
  notes: [...FIELD_CONSTRAINTS_NOTES],
@@ -43700,18 +43927,16 @@ var SHAPE_DOMAIN = defineDomain({
43700
43927
 
43701
43928
  // ../../packages/warmhub-cli/src/domains/sub/flags.ts
43702
43929
  var orgScopeFlag = flag.string({
43703
- description: "Org slug for an org-scoped subscription (org.renamed); use instead of --repo"
43930
+ description: `org slug for org-scoped events (${ORG_SCOPED_EVENT_TYPES.join(", ")}); use instead of --repo`
43704
43931
  });
43705
43932
  var createFlags8 = {
43706
43933
  on: flag.string({
43707
43934
  description: "Shape to subscribe to"
43708
43935
  }),
43709
43936
  event: flag.string({
43710
- description: "Event to watch: commit (default), repo.renamed, org.renamed, thing.renamed, or shape.renamed"
43711
- }),
43712
- org: flag.string({
43713
- description: "Org slug for an org-scoped subscription (org.renamed)"
43937
+ description: `event to watch: ${SUBSCRIBABLE_EVENT_TYPES.join(", ")} (commit is default)`
43714
43938
  }),
43939
+ org: orgScopeFlag,
43715
43940
  kind: flag.string({
43716
43941
  description: "Subscription kind (webhook; the default)"
43717
43942
  }),
@@ -43882,11 +44107,11 @@ function buildSubscriptionMutationArgs(flags, usage, example) {
43882
44107
  }
43883
44108
  return mutationArgs;
43884
44109
  }
43885
- function rejectCommitFlags(flags, eventType) {
44110
+ function rejectCommitOnlyFlags(flags, eventType) {
43886
44111
  for (const f of ["on", "filter", "source"]) {
43887
44112
  const v = flags[f];
43888
44113
  if (typeof v === "string" && v.length > 0) {
43889
- usageError(`--${f} is not valid for ${eventType} subscriptions — rename events have no shape or filter`, `wh sub create rename-hook --event ${eventType} --webhook-url https://example.com/hook`);
44114
+ usageError(`--${f} is not valid for ${eventType} subscriptions — metadata events have no shape, filter, or source`, `wh sub create metadata-hook ${isOrgScopedEventType(eventType) ? "--org myorg" : "--repo myorg/myrepo"} --event ${eventType} --webhook-url https://example.com/hook`);
43890
44115
  }
43891
44116
  }
43892
44117
  }
@@ -43904,7 +44129,7 @@ function scopeLabel(scope) {
43904
44129
  // ../../packages/warmhub-cli/src/domains/sub/handlers-create.ts
43905
44130
  var handleCreate7 = async (ctx, { flags, args }) => {
43906
44131
  const name = args[0] ?? flags.name;
43907
- const usage = "Usage: wh sub create <name> (--repo org/repo | --org org) [--event commit|repo.renamed|org.renamed|thing.renamed|shape.renamed] [options]";
44132
+ const usage = `Usage: wh sub create <name> (--repo org/repo | --org org) [--event ${SUBSCRIBABLE_EVENT_TYPES.join("|")}] [options]`;
43908
44133
  const example = `wh sub create signal-hook --repo myorg/myrepo --on Signal --filter '{"shape":"Signal"}' --webhook-url https://example.com/hook`;
43909
44134
  if (!name) {
43910
44135
  usageError(usage, example);
@@ -43918,33 +44143,36 @@ var handleCreate7 = async (ctx, { flags, args }) => {
43918
44143
  }
43919
44144
  const fallbackWebhookUrl = typeof flags["fallback-webhook-url"] === "string" ? flags["fallback-webhook-url"] : undefined;
43920
44145
  const allowTraceReentry = flags["allow-trace-reentry"] === true;
43921
- const renameExtras = {
44146
+ const metadataExtras = {
43922
44147
  ...fallbackWebhookUrl ? { fallbackWebhookUrl } : {},
43923
44148
  ...allowTraceReentry ? { allowTraceReentry: true } : {}
43924
44149
  };
43925
- if (eventType === "org.renamed") {
44150
+ if (isOrgScopedEventType(eventType)) {
43926
44151
  const orgName = typeof flags.org === "string" ? flags.org : undefined;
43927
44152
  if (!orgName) {
43928
- usageError("org.renamed subscriptions are org-scoped — pass --org <org> (not --repo)", "wh sub create org-rename-hook --org myorg --event org.renamed --webhook-url https://example.com/hook");
44153
+ usageError(`${eventType} subscriptions are org-scoped — pass --org <org> (not --repo)`, `wh sub create org-hook --org myorg --event ${eventType} --webhook-url https://example.com/hook`);
44154
+ }
44155
+ if (ctx.invocation.flags.repo !== undefined) {
44156
+ usageError(`--repo is not valid for ${eventType} subscriptions — use --org <org>`, `wh sub create org-hook --org ${orgName} --event ${eventType} --webhook-url https://example.com/hook`);
43929
44157
  }
43930
- rejectCommitFlags(flags, eventType);
44158
+ rejectCommitOnlyFlags(flags, eventType);
43931
44159
  const result2 = await ctx.client.subscription.create({
43932
44160
  orgName,
43933
44161
  name,
43934
44162
  eventType,
43935
44163
  kind,
43936
44164
  webhookUrl,
43937
- ...renameExtras
44165
+ ...metadataExtras
43938
44166
  });
43939
44167
  writeOutput(ctx, result2, () => {
43940
44168
  const c = ctx.colors;
43941
- ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on org ${c.cyan}${orgName}${c.reset} (org.renamed)`);
44169
+ ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on org ${c.cyan}${orgName}${c.reset} (${eventType})`);
43942
44170
  });
43943
44171
  return;
43944
44172
  }
43945
44173
  const { org, repo } = resolveRepoContext(ctx);
43946
44174
  if (eventType !== "commit") {
43947
- rejectCommitFlags(flags, eventType);
44175
+ rejectCommitOnlyFlags(flags, eventType);
43948
44176
  const result2 = await ctx.client.subscription.create({
43949
44177
  orgName: org,
43950
44178
  repoName: repo,
@@ -43952,7 +44180,7 @@ var handleCreate7 = async (ctx, { flags, args }) => {
43952
44180
  eventType,
43953
44181
  kind,
43954
44182
  webhookUrl,
43955
- ...renameExtras
44183
+ ...metadataExtras
43956
44184
  });
43957
44185
  writeOutput(ctx, result2, () => {
43958
44186
  const c = ctx.colors;
@@ -44023,6 +44251,7 @@ var handleView8 = async (ctx, { args, flags }) => {
44023
44251
  const c = ctx.colors;
44024
44252
  ctx.out(`${c.bold}${sub.name}${c.reset}`);
44025
44253
  ctx.out(` kind: ${c.cyan}${sub.kind}${c.reset}`);
44254
+ ctx.out(` eventType: ${c.cyan}${sub.eventType}${c.reset}`);
44026
44255
  ctx.out(` active: ${sub.active ? c.green : c.yellow}${sub.active}${c.reset}`);
44027
44256
  if (sub.sourceRepo) {
44028
44257
  ctx.out(` source repo: ${c.cyan}${sub.sourceRepo}${c.reset}`);
@@ -44143,7 +44372,7 @@ var handleList7 = async (ctx, { flags }) => {
44143
44372
  ctx.out(`${c.bold}Subscriptions:${c.reset} ${c.cyan}${label}${c.reset}`);
44144
44373
  for (const sub of items) {
44145
44374
  const active = sub.active ? `${c.green}active` : `${c.yellow}paused`;
44146
- let line = ` ${c.cyan}${sub.name}${c.reset} ${c.dim}[${sub.kind}]${c.reset} ${active}${c.reset}`;
44375
+ let line = ` ${c.cyan}${sub.name}${c.reset} ${c.dim}[${sub.kind}/${sub.eventType}]${c.reset} ${active}${c.reset}`;
44147
44376
  if (sub.sourceRepo) {
44148
44377
  line += ` ${c.dim}← ${sub.sourceRepo}${c.reset}`;
44149
44378
  }
@@ -44310,6 +44539,9 @@ var SUB_DOMAIN = defineDomain({
44310
44539
  "# Subscribe to org renames (org-scoped — use --org, not --repo)",
44311
44540
  " $ wh sub create org-rename-hook --org myorg --event org.renamed --webhook-url https://example.com/hook",
44312
44541
  "",
44542
+ "# Subscribe to repository creation activity in an organization",
44543
+ " $ wh sub create repo-feed --org myorg --event org.repo_created --webhook-url https://example.com/hook",
44544
+ "",
44313
44545
  "# Webhook auth: create a credential set with WEBHOOK_* keys, then bind it to the subscription.",
44314
44546
  "# See `wh credential set --help` for supported key names and `wh sub bind --help`.",
44315
44547
  " $ wh credential create webhook-keys --repo myorg/myrepo",
@@ -44327,7 +44559,7 @@ var SUB_DOMAIN = defineDomain({
44327
44559
  examples: [
44328
44560
  "# Update only the webhook URL",
44329
44561
  " $ wh sub update signal-hook --repo myorg/myrepo --webhook-url https://example.com/v2/hook",
44330
- "# Repoint an org-scoped (org.renamed) rename hook in place",
44562
+ "# Repoint an org-scoped metadata hook in place",
44331
44563
  " $ wh sub update org-rename-hook --org myorg --webhook-url https://example.com/v2/hook"
44332
44564
  ],
44333
44565
  handler: handleUpdate4
@@ -44341,7 +44573,7 @@ var SUB_DOMAIN = defineDomain({
44341
44573
  examples: [
44342
44574
  "wh sub view signal-hook --repo myorg/myrepo",
44343
44575
  "wh sub view signal-hook --show-secrets --repo myorg/myrepo",
44344
- "# Org-scoped (org.renamed) subscription",
44576
+ "# Org-scoped metadata subscription",
44345
44577
  " $ wh sub view org-rename-hook --org myorg"
44346
44578
  ],
44347
44579
  handler: handleView8
@@ -44355,7 +44587,7 @@ var SUB_DOMAIN = defineDomain({
44355
44587
  examples: [
44356
44588
  "wh sub list --repo myorg/myrepo",
44357
44589
  "wh sub list --limit 10",
44358
- "# Org-scoped (org.renamed) subscriptions",
44590
+ "# Org-scoped metadata subscriptions",
44359
44591
  " $ wh sub list --org myorg"
44360
44592
  ],
44361
44593
  handler: handleList7
@@ -44406,7 +44638,7 @@ var SUB_DOMAIN = defineDomain({
44406
44638
  flags: scopeFlags,
44407
44639
  examples: [
44408
44640
  "wh sub pause signal-hook --repo myorg/myrepo",
44409
- "# Org-scoped (org.renamed) subscription",
44641
+ "# Org-scoped metadata subscription",
44410
44642
  " $ wh sub pause org-rename-hook --org myorg"
44411
44643
  ],
44412
44644
  handler: handlePause
@@ -44432,7 +44664,7 @@ var SUB_DOMAIN = defineDomain({
44432
44664
  examples: [
44433
44665
  "# Bind credentials to inject auth headers on webhook delivery",
44434
44666
  " $ wh sub bind signal-hook --credentials webhook-keys --repo myorg/myrepo",
44435
- "# Org-scoped (org.renamed) subscription + org-scoped credential set",
44667
+ "# Org-scoped metadata subscription + org-scoped credential set",
44436
44668
  " $ wh sub bind org-rename-hook --credentials org-webhook-keys --org myorg"
44437
44669
  ],
44438
44670
  handler: handleBind
@@ -46421,7 +46653,7 @@ function resolveLogLevel(flags, env) {
46421
46653
  // package.json
46422
46654
  var package_default3 = {
46423
46655
  name: "@warmhub/cli",
46424
- version: "0.71.0",
46656
+ version: "0.73.0",
46425
46657
  private: false,
46426
46658
  type: "module",
46427
46659
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -47076,4 +47308,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
47076
47308
  var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
47077
47309
  process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
47078
47310
 
47079
- //# debugId=94B2C7EE252C64A264756E2164756E21
47311
+ //# debugId=D881F1662B4C6E3E64756E2164756E21