@warmhub/cli 0.72.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 +823 -664
  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));
@@ -18643,6 +19312,11 @@ function stableJsonEquals(left, right) {
18643
19312
  return stableJson(left) === stableJson(right);
18644
19313
  }
18645
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
+
18646
19320
  // ../../packages/rules/src/subscribable-events.ts
18647
19321
  var COMMIT_EVENT_TYPE = "commit";
18648
19322
  var REPO_RENAMED_EVENT_TYPE = "repo.renamed";
@@ -18653,6 +19327,9 @@ var SUBSCRIBABLE_EVENT_TYPES = [
18653
19327
  COMMIT_EVENT_TYPE,
18654
19328
  REPO_RENAMED_EVENT_TYPE,
18655
19329
  ORG_RENAMED_EVENT_TYPE,
19330
+ ORG_MEMBER_ADDED_EVENT_TYPE,
19331
+ ORG_REPO_CREATED_EVENT_TYPE,
19332
+ ORG_REPO_PUBLISHED_EVENT_TYPE,
18656
19333
  THING_RENAMED_EVENT_TYPE,
18657
19334
  SHAPE_RENAMED_EVENT_TYPE
18658
19335
  ];
@@ -18662,6 +19339,15 @@ var REPO_SCOPED_EVENT_TYPES = [
18662
19339
  THING_RENAMED_EVENT_TYPE,
18663
19340
  SHAPE_RENAMED_EVENT_TYPE
18664
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
+ }
18665
19351
 
18666
19352
  // ../../packages/rules/src/component-install.ts
18667
19353
  function manifestShapeData(shape) {
@@ -27162,7 +27848,7 @@ function findSystemComponent(componentId) {
27162
27848
  // ../../packages/sdk-ts/package.json
27163
27849
  var package_default = {
27164
27850
  name: "@warmhub/sdk-ts",
27165
- version: "0.70.0",
27851
+ version: "0.71.0",
27166
27852
  private: false,
27167
27853
  type: "module",
27168
27854
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -28527,6 +29213,15 @@ class WarmHubClient {
28527
29213
  throw toWarmHubError(error);
28528
29214
  }
28529
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
+ },
28530
29225
  changeMemberRole: async (orgName, email, role) => {
28531
29226
  try {
28532
29227
  return await this.trpc.org.changeMemberRole.mutate({
@@ -29133,7 +29828,9 @@ class WarmHubClient {
29133
29828
  repoName,
29134
29829
  subscriptionName: opts?.subscriptionName,
29135
29830
  status: opts?.status,
29831
+ outcome: opts?.outcome,
29136
29832
  since: opts?.since,
29833
+ cursor: opts?.cursor,
29137
29834
  limit: opts?.limit
29138
29835
  });
29139
29836
  } catch (error) {
@@ -30126,6 +30823,13 @@ function parseSseChunk(chunk) {
30126
30823
  function isAbortError2(error) {
30127
30824
  return error instanceof Error && error.name === "AbortError";
30128
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
+ }));
30129
30833
 
30130
30834
  // ../../packages/warmhub-cli/src/errors-classification.ts
30131
30835
  function unauthenticatedHint(message) {
@@ -33255,12 +33959,51 @@ function renderAboutAssertion(out, c, assertion, indent) {
33255
33959
  }
33256
33960
  }
33257
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
+
33258
33998
  // ../../packages/warmhub-cli/src/domains/thing/create.ts
33259
33999
  var createFlags2 = {
33260
34000
  shape: flag.string({ description: "Shape for the new thing" }),
33261
34001
  data: flag.string({
33262
34002
  description: `Thing data as a JSON object, e.g. '{"score":1}' (non-object payloads are rejected)`
33263
34003
  }),
34004
+ file: flag.string({
34005
+ description: "read thing data from a JSON object file (portable alternative to inline --data)"
34006
+ }),
33264
34007
  message: flag.string({ short: "m", description: "Commit message" }),
33265
34008
  committer: flag.string({
33266
34009
  description: "Committer wref (shape or shaped thing; e.g. Agent/bot-1)"
@@ -33270,7 +34013,7 @@ var handleCreate2 = async (ctx, { flags, args }) => {
33270
34013
  const rawName = args[0];
33271
34014
  const shape = flags.shape;
33272
34015
  if (!rawName || !shape && !rawName.includes("/")) {
33273
- 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");
33274
34017
  }
33275
34018
  if (shape && rawName.includes("/")) {
33276
34019
  usageError("Usage: wh thing create <name> --shape <shape> --data <json-object>", `wh thing create alice --shape Player --data '{"score":1}'`);
@@ -33278,10 +34021,13 @@ var handleCreate2 = async (ctx, { flags, args }) => {
33278
34021
  const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
33279
34022
  const committer = flags.committer;
33280
34023
  const message = flags.message;
33281
- if (flags.data === undefined) {
33282
- usageError("--data is required for create", `wh thing create player-1 --shape Player --data '{"score":1}'`);
33283
- }
33284
- 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
+ });
33285
34031
  const name = shape ? `${shape}/${rawName}` : rawName;
33286
34032
  const c = ctx.colors;
33287
34033
  const result = await ctx.client.commit.apply(org, repo, message ?? `create ${name}`, [
@@ -34728,8 +35474,8 @@ async function readContentInput(filePath, inline, stdinStream) {
34728
35474
  if (inline !== undefined)
34729
35475
  return inline;
34730
35476
  if (filePath && filePath !== "-") {
34731
- const { readFile } = await import("node:fs/promises");
34732
- return await readFile(filePath, "utf8");
35477
+ const { readFile: readFile2 } = await import("node:fs/promises");
35478
+ return await readFile2(filePath, "utf8");
34733
35479
  }
34734
35480
  const input = stdinStream ?? process.stdin;
34735
35481
  if (isTTY(input)) {
@@ -34999,6 +35745,7 @@ var THING_DOMAIN = defineDomain({
34999
35745
  flags: createFlags2,
35000
35746
  examples: [
35001
35747
  `wh thing create player-1 --shape Player --data '{"score":1}'`,
35748
+ "wh thing create player-1 --shape Player --file data.json",
35002
35749
  `wh thing create Player/player-1 --data '{"score":1}'`
35003
35750
  ],
35004
35751
  handler: handleCreate2
@@ -35456,616 +36203,6 @@ var ASSERTION_DOMAIN = defineDomain({
35456
36203
  }
35457
36204
  });
35458
36205
 
35459
- // ../../node_modules/.bun/open@11.0.0/node_modules/open/index.js
35460
- import process8 from "node:process";
35461
- import path from "node:path";
35462
- import { fileURLToPath } from "node:url";
35463
- import childProcess3 from "node:child_process";
35464
- import fs5, { constants as fsConstants2 } from "node:fs/promises";
35465
-
35466
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
35467
- import { promisify as promisify2 } from "node:util";
35468
- import childProcess2 from "node:child_process";
35469
- import fs4, { constants as fsConstants } from "node:fs/promises";
35470
-
35471
- // ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
35472
- import process2 from "node:process";
35473
- import os from "node:os";
35474
- import fs3 from "node:fs";
35475
-
35476
- // ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
35477
- import fs2 from "node:fs";
35478
-
35479
- // ../../node_modules/.bun/is-docker@3.0.0/node_modules/is-docker/index.js
35480
- import fs from "node:fs";
35481
- var isDockerCached;
35482
- function hasDockerEnv() {
35483
- try {
35484
- fs.statSync("/.dockerenv");
35485
- return true;
35486
- } catch {
35487
- return false;
35488
- }
35489
- }
35490
- function hasDockerCGroup() {
35491
- try {
35492
- return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
35493
- } catch {
35494
- return false;
35495
- }
35496
- }
35497
- function isDocker() {
35498
- if (isDockerCached === undefined) {
35499
- isDockerCached = hasDockerEnv() || hasDockerCGroup();
35500
- }
35501
- return isDockerCached;
35502
- }
35503
-
35504
- // ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
35505
- var cachedResult;
35506
- var hasContainerEnv = () => {
35507
- try {
35508
- fs2.statSync("/run/.containerenv");
35509
- return true;
35510
- } catch {
35511
- return false;
35512
- }
35513
- };
35514
- function isInsideContainer() {
35515
- if (cachedResult === undefined) {
35516
- cachedResult = hasContainerEnv() || isDocker();
35517
- }
35518
- return cachedResult;
35519
- }
35520
-
35521
- // ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
35522
- var isWsl = () => {
35523
- if (process2.platform !== "linux") {
35524
- return false;
35525
- }
35526
- if (os.release().toLowerCase().includes("microsoft")) {
35527
- if (isInsideContainer()) {
35528
- return false;
35529
- }
35530
- return true;
35531
- }
35532
- try {
35533
- if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
35534
- return !isInsideContainer();
35535
- }
35536
- } catch {}
35537
- if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
35538
- return !isInsideContainer();
35539
- }
35540
- return false;
35541
- };
35542
- var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
35543
-
35544
- // ../../node_modules/.bun/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
35545
- import process3 from "node:process";
35546
- import { Buffer as Buffer2 } from "node:buffer";
35547
- import { promisify } from "node:util";
35548
- import childProcess from "node:child_process";
35549
- var execFile = promisify(childProcess.execFile);
35550
- var powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
35551
- var executePowerShell = async (command, options = {}) => {
35552
- const {
35553
- powerShellPath: psPath,
35554
- ...execFileOptions
35555
- } = options;
35556
- const encodedCommand = executePowerShell.encodeCommand(command);
35557
- return execFile(psPath ?? powerShellPath(), [
35558
- ...executePowerShell.argumentsPrefix,
35559
- encodedCommand
35560
- ], {
35561
- encoding: "utf8",
35562
- ...execFileOptions
35563
- });
35564
- };
35565
- executePowerShell.argumentsPrefix = [
35566
- "-NoProfile",
35567
- "-NonInteractive",
35568
- "-ExecutionPolicy",
35569
- "Bypass",
35570
- "-EncodedCommand"
35571
- ];
35572
- executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
35573
- executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
35574
-
35575
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
35576
- function parseMountPointFromConfig(content) {
35577
- for (const line of content.split(`
35578
- `)) {
35579
- if (/^\s*#/.test(line)) {
35580
- continue;
35581
- }
35582
- const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
35583
- if (!match) {
35584
- continue;
35585
- }
35586
- return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
35587
- }
35588
- }
35589
-
35590
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
35591
- var execFile2 = promisify2(childProcess2.execFile);
35592
- var wslDrivesMountPoint = (() => {
35593
- const defaultMountPoint = "/mnt/";
35594
- let mountPoint;
35595
- return async function() {
35596
- if (mountPoint) {
35597
- return mountPoint;
35598
- }
35599
- const configFilePath = "/etc/wsl.conf";
35600
- let isConfigFileExists = false;
35601
- try {
35602
- await fs4.access(configFilePath, fsConstants.F_OK);
35603
- isConfigFileExists = true;
35604
- } catch {}
35605
- if (!isConfigFileExists) {
35606
- return defaultMountPoint;
35607
- }
35608
- const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
35609
- const parsedMountPoint = parseMountPointFromConfig(configContent);
35610
- if (parsedMountPoint === undefined) {
35611
- return defaultMountPoint;
35612
- }
35613
- mountPoint = parsedMountPoint;
35614
- mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
35615
- return mountPoint;
35616
- };
35617
- })();
35618
- var powerShellPathFromWsl = async () => {
35619
- const mountPoint = await wslDrivesMountPoint();
35620
- return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
35621
- };
35622
- var powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
35623
- var canAccessPowerShellPromise;
35624
- var canAccessPowerShell = async () => {
35625
- canAccessPowerShellPromise ??= (async () => {
35626
- try {
35627
- const psPath = await powerShellPath2();
35628
- await fs4.access(psPath, fsConstants.X_OK);
35629
- return true;
35630
- } catch {
35631
- return false;
35632
- }
35633
- })();
35634
- return canAccessPowerShellPromise;
35635
- };
35636
- var wslDefaultBrowser = async () => {
35637
- const psPath = await powerShellPath2();
35638
- const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
35639
- const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
35640
- return stdout.trim();
35641
- };
35642
- var convertWslPathToWindows = async (path) => {
35643
- if (/^[a-z]+:\/\//i.test(path)) {
35644
- return path;
35645
- }
35646
- try {
35647
- const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
35648
- return stdout.trim();
35649
- } catch {
35650
- return path;
35651
- }
35652
- };
35653
-
35654
- // ../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
35655
- function defineLazyProperty(object, propertyName, valueGetter) {
35656
- const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
35657
- Object.defineProperty(object, propertyName, {
35658
- configurable: true,
35659
- enumerable: true,
35660
- get() {
35661
- const result = valueGetter();
35662
- define(result);
35663
- return result;
35664
- },
35665
- set(value) {
35666
- define(value);
35667
- }
35668
- });
35669
- return object;
35670
- }
35671
-
35672
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
35673
- import { promisify as promisify6 } from "node:util";
35674
- import process6 from "node:process";
35675
- import { execFile as execFile6 } from "node:child_process";
35676
-
35677
- // ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
35678
- import { promisify as promisify3 } from "node:util";
35679
- import process4 from "node:process";
35680
- import { execFile as execFile3 } from "node:child_process";
35681
- var execFileAsync = promisify3(execFile3);
35682
- async function defaultBrowserId() {
35683
- if (process4.platform !== "darwin") {
35684
- throw new Error("macOS only");
35685
- }
35686
- const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
35687
- const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
35688
- const browserId = match?.groups.id ?? "com.apple.Safari";
35689
- if (browserId === "com.apple.safari") {
35690
- return "com.apple.Safari";
35691
- }
35692
- return browserId;
35693
- }
35694
-
35695
- // ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
35696
- import process5 from "node:process";
35697
- import { promisify as promisify4 } from "node:util";
35698
- import { execFile as execFile4, execFileSync } from "node:child_process";
35699
- var execFileAsync2 = promisify4(execFile4);
35700
- async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
35701
- if (process5.platform !== "darwin") {
35702
- throw new Error("macOS only");
35703
- }
35704
- const outputArguments = humanReadableOutput ? [] : ["-ss"];
35705
- const execOptions = {};
35706
- if (signal) {
35707
- execOptions.signal = signal;
35708
- }
35709
- const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
35710
- return stdout.trim();
35711
- }
35712
-
35713
- // ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
35714
- async function bundleName(bundleId) {
35715
- return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
35716
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
35717
- }
35718
-
35719
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
35720
- import { promisify as promisify5 } from "node:util";
35721
- import { execFile as execFile5 } from "node:child_process";
35722
- var execFileAsync3 = promisify5(execFile5);
35723
- var windowsBrowserProgIds = {
35724
- MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
35725
- MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
35726
- MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
35727
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
35728
- ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
35729
- ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
35730
- ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
35731
- ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
35732
- BraveHTML: { name: "Brave", id: "com.brave.Browser" },
35733
- BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
35734
- BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
35735
- BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
35736
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
35737
- OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
35738
- VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
35739
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
35740
- };
35741
- var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
35742
-
35743
- class UnknownBrowserError extends Error {
35744
- }
35745
- async function defaultBrowser(_execFileAsync = execFileAsync3) {
35746
- const { stdout } = await _execFileAsync("reg", [
35747
- "QUERY",
35748
- " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
35749
- "/v",
35750
- "ProgId"
35751
- ]);
35752
- const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
35753
- if (!match) {
35754
- throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
35755
- }
35756
- const { id } = match.groups;
35757
- const dotIndex = id.lastIndexOf(".");
35758
- const hyphenIndex = id.lastIndexOf("-");
35759
- const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
35760
- const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
35761
- return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
35762
- }
35763
-
35764
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
35765
- var execFileAsync4 = promisify6(execFile6);
35766
- var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
35767
- async function defaultBrowser2() {
35768
- if (process6.platform === "darwin") {
35769
- const id = await defaultBrowserId();
35770
- const name = await bundleName(id);
35771
- return { name, id };
35772
- }
35773
- if (process6.platform === "linux") {
35774
- const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
35775
- const id = stdout.trim();
35776
- const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
35777
- return { name, id };
35778
- }
35779
- if (process6.platform === "win32") {
35780
- return defaultBrowser();
35781
- }
35782
- throw new Error("Only macOS, Linux, and Windows are supported");
35783
- }
35784
-
35785
- // ../../node_modules/.bun/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
35786
- import process7 from "node:process";
35787
- var isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
35788
- var is_in_ssh_default = isInSsh;
35789
-
35790
- // ../../node_modules/.bun/open@11.0.0/node_modules/open/index.js
35791
- var fallbackAttemptSymbol = Symbol("fallbackAttempt");
35792
- var __dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
35793
- var localXdgOpenPath = path.join(__dirname2, "xdg-open");
35794
- var { platform, arch } = process8;
35795
- var tryEachApp = async (apps, opener) => {
35796
- if (apps.length === 0) {
35797
- return;
35798
- }
35799
- const errors = [];
35800
- for (const app of apps) {
35801
- try {
35802
- return await opener(app);
35803
- } catch (error) {
35804
- errors.push(error);
35805
- }
35806
- }
35807
- throw new AggregateError(errors, "Failed to open in all supported apps");
35808
- };
35809
- var baseOpen = async (options) => {
35810
- options = {
35811
- wait: false,
35812
- background: false,
35813
- newInstance: false,
35814
- allowNonzeroExitCode: false,
35815
- ...options
35816
- };
35817
- const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
35818
- delete options[fallbackAttemptSymbol];
35819
- if (Array.isArray(options.app)) {
35820
- return tryEachApp(options.app, (singleApp) => baseOpen({
35821
- ...options,
35822
- app: singleApp,
35823
- [fallbackAttemptSymbol]: true
35824
- }));
35825
- }
35826
- let { name: app, arguments: appArguments = [] } = options.app ?? {};
35827
- appArguments = [...appArguments];
35828
- if (Array.isArray(app)) {
35829
- return tryEachApp(app, (appName) => baseOpen({
35830
- ...options,
35831
- app: {
35832
- name: appName,
35833
- arguments: appArguments
35834
- },
35835
- [fallbackAttemptSymbol]: true
35836
- }));
35837
- }
35838
- if (app === "browser" || app === "browserPrivate") {
35839
- const ids = {
35840
- "com.google.chrome": "chrome",
35841
- "google-chrome.desktop": "chrome",
35842
- "com.brave.browser": "brave",
35843
- "org.mozilla.firefox": "firefox",
35844
- "firefox.desktop": "firefox",
35845
- "com.microsoft.msedge": "edge",
35846
- "com.microsoft.edge": "edge",
35847
- "com.microsoft.edgemac": "edge",
35848
- "microsoft-edge.desktop": "edge",
35849
- "com.apple.safari": "safari"
35850
- };
35851
- const flags = {
35852
- chrome: "--incognito",
35853
- brave: "--incognito",
35854
- firefox: "--private-window",
35855
- edge: "--inPrivate"
35856
- };
35857
- let browser;
35858
- if (is_wsl_default) {
35859
- const progId = await wslDefaultBrowser();
35860
- const browserInfo = _windowsBrowserProgIdMap.get(progId);
35861
- browser = browserInfo ?? {};
35862
- } else {
35863
- browser = await defaultBrowser2();
35864
- }
35865
- if (browser.id in ids) {
35866
- const browserName = ids[browser.id.toLowerCase()];
35867
- if (app === "browserPrivate") {
35868
- if (browserName === "safari") {
35869
- throw new Error("Safari doesn't support opening in private mode via command line");
35870
- }
35871
- appArguments.push(flags[browserName]);
35872
- }
35873
- return baseOpen({
35874
- ...options,
35875
- app: {
35876
- name: apps[browserName],
35877
- arguments: appArguments
35878
- }
35879
- });
35880
- }
35881
- throw new Error(`${browser.name} is not supported as a default browser`);
35882
- }
35883
- let command;
35884
- const cliArguments = [];
35885
- const childProcessOptions = {};
35886
- let shouldUseWindowsInWsl = false;
35887
- if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
35888
- shouldUseWindowsInWsl = await canAccessPowerShell();
35889
- }
35890
- if (platform === "darwin") {
35891
- command = "open";
35892
- if (options.wait) {
35893
- cliArguments.push("--wait-apps");
35894
- }
35895
- if (options.background) {
35896
- cliArguments.push("--background");
35897
- }
35898
- if (options.newInstance) {
35899
- cliArguments.push("--new");
35900
- }
35901
- if (app) {
35902
- cliArguments.push("-a", app);
35903
- }
35904
- } else if (platform === "win32" || shouldUseWindowsInWsl) {
35905
- command = await powerShellPath2();
35906
- cliArguments.push(...executePowerShell.argumentsPrefix);
35907
- if (!is_wsl_default) {
35908
- childProcessOptions.windowsVerbatimArguments = true;
35909
- }
35910
- if (is_wsl_default && options.target) {
35911
- options.target = await convertWslPathToWindows(options.target);
35912
- }
35913
- const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
35914
- if (options.wait) {
35915
- encodedArguments.push("-Wait");
35916
- }
35917
- if (app) {
35918
- encodedArguments.push(executePowerShell.escapeArgument(app));
35919
- if (options.target) {
35920
- appArguments.push(options.target);
35921
- }
35922
- } else if (options.target) {
35923
- encodedArguments.push(executePowerShell.escapeArgument(options.target));
35924
- }
35925
- if (appArguments.length > 0) {
35926
- appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
35927
- encodedArguments.push("-ArgumentList", appArguments.join(","));
35928
- }
35929
- options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
35930
- if (!options.wait) {
35931
- childProcessOptions.stdio = "ignore";
35932
- }
35933
- } else {
35934
- if (app) {
35935
- command = app;
35936
- } else {
35937
- const isBundled = !__dirname2 || __dirname2 === "/";
35938
- let exeLocalXdgOpen = false;
35939
- try {
35940
- await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
35941
- exeLocalXdgOpen = true;
35942
- } catch {}
35943
- const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
35944
- command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
35945
- }
35946
- if (appArguments.length > 0) {
35947
- cliArguments.push(...appArguments);
35948
- }
35949
- if (!options.wait) {
35950
- childProcessOptions.stdio = "ignore";
35951
- childProcessOptions.detached = true;
35952
- }
35953
- }
35954
- if (platform === "darwin" && appArguments.length > 0) {
35955
- cliArguments.push("--args", ...appArguments);
35956
- }
35957
- if (options.target) {
35958
- cliArguments.push(options.target);
35959
- }
35960
- const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
35961
- if (options.wait) {
35962
- return new Promise((resolve, reject) => {
35963
- subprocess.once("error", reject);
35964
- subprocess.once("close", (exitCode) => {
35965
- if (!options.allowNonzeroExitCode && exitCode !== 0) {
35966
- reject(new Error(`Exited with code ${exitCode}`));
35967
- return;
35968
- }
35969
- resolve(subprocess);
35970
- });
35971
- });
35972
- }
35973
- if (isFallbackAttempt) {
35974
- return new Promise((resolve, reject) => {
35975
- subprocess.once("error", reject);
35976
- subprocess.once("spawn", () => {
35977
- subprocess.once("close", (exitCode) => {
35978
- subprocess.off("error", reject);
35979
- if (exitCode !== 0) {
35980
- reject(new Error(`Exited with code ${exitCode}`));
35981
- return;
35982
- }
35983
- subprocess.unref();
35984
- resolve(subprocess);
35985
- });
35986
- });
35987
- });
35988
- }
35989
- subprocess.unref();
35990
- return new Promise((resolve, reject) => {
35991
- subprocess.once("error", reject);
35992
- subprocess.once("spawn", () => {
35993
- subprocess.off("error", reject);
35994
- resolve(subprocess);
35995
- });
35996
- });
35997
- };
35998
- var open = (target, options) => {
35999
- if (typeof target !== "string") {
36000
- throw new TypeError("Expected a `target`");
36001
- }
36002
- return baseOpen({
36003
- ...options,
36004
- target
36005
- });
36006
- };
36007
- function detectArchBinary(binary) {
36008
- if (typeof binary === "string" || Array.isArray(binary)) {
36009
- return binary;
36010
- }
36011
- const { [arch]: archBinary } = binary;
36012
- if (!archBinary) {
36013
- throw new Error(`${arch} is not supported`);
36014
- }
36015
- return archBinary;
36016
- }
36017
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
36018
- if (wsl && is_wsl_default) {
36019
- return detectArchBinary(wsl);
36020
- }
36021
- if (!platformBinary) {
36022
- throw new Error(`${platform} is not supported`);
36023
- }
36024
- return detectArchBinary(platformBinary);
36025
- }
36026
- var apps = {
36027
- browser: "browser",
36028
- browserPrivate: "browserPrivate"
36029
- };
36030
- defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
36031
- darwin: "google chrome",
36032
- win32: "chrome",
36033
- linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
36034
- }, {
36035
- wsl: {
36036
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
36037
- x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
36038
- }
36039
- }));
36040
- defineLazyProperty(apps, "brave", () => detectPlatformBinary({
36041
- darwin: "brave browser",
36042
- win32: "brave",
36043
- linux: ["brave-browser", "brave"]
36044
- }, {
36045
- wsl: {
36046
- ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
36047
- x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
36048
- }
36049
- }));
36050
- defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
36051
- darwin: "firefox",
36052
- win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
36053
- linux: "firefox"
36054
- }, {
36055
- wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
36056
- }));
36057
- defineLazyProperty(apps, "edge", () => detectPlatformBinary({
36058
- darwin: "microsoft edge",
36059
- win32: "msedge",
36060
- linux: ["microsoft-edge", "microsoft-edge-dev"]
36061
- }, {
36062
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
36063
- }));
36064
- defineLazyProperty(apps, "safari", () => detectPlatformBinary({
36065
- darwin: "Safari"
36066
- }));
36067
- var open_default = open;
36068
-
36069
36206
  // ../../packages/warmhub-cli/src/domains/auth-shared.ts
36070
36207
  async function loginWithToken(ctx, profile) {
36071
36208
  const c = ctx.colors;
@@ -36224,7 +36361,7 @@ async function fetchIdentityWref(ctx) {
36224
36361
  }
36225
36362
  }
36226
36363
  function openBrowser(url) {
36227
- open_default(url).catch(() => {});
36364
+ Promise.resolve().then(() => (init_open(), exports_open)).then(({ default: open2 }) => open2(url)).catch(() => {});
36228
36365
  }
36229
36366
 
36230
36367
  // ../../packages/warmhub-cli/src/domains/auth-handlers.ts
@@ -37621,7 +37758,7 @@ var createFlags3 = {
37621
37758
  };
37622
37759
 
37623
37760
  // ../../packages/warmhub-cli/src/domains/commit-submit-handler.ts
37624
- import { readFile } from "node:fs/promises";
37761
+ import { readFile as readFile2 } from "node:fs/promises";
37625
37762
 
37626
37763
  // ../../packages/warmhub-cli/src/commit-payload-validate.ts
37627
37764
  var NUL = String.fromCharCode(0);
@@ -38631,7 +38768,7 @@ var handleSubmit = async (ctx, { flags, args }) => {
38631
38768
  } else {
38632
38769
  let file;
38633
38770
  try {
38634
- file = await readFile(opsFile, "utf-8");
38771
+ file = await readFile2(opsFile, "utf-8");
38635
38772
  } catch (e) {
38636
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.");
38637
38774
  }
@@ -40951,7 +41088,7 @@ var CREDENTIAL_DOMAIN = defineDomain({
40951
41088
  import { basename } from "node:path";
40952
41089
 
40953
41090
  // ../../packages/warmhub-cli/src/harness.ts
40954
- 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";
40955
41092
  import { homedir as homedir4 } from "node:os";
40956
41093
  import { dirname as dirname6, join as join7 } from "node:path";
40957
41094
  var AGENTS_BEGIN_MARKER = "<!-- BEGIN WARMHUB CLI INTEGRATION -->";
@@ -40982,7 +41119,7 @@ function getHarnessPaths(opts) {
40982
41119
  async function readJsonFile(path2) {
40983
41120
  let data;
40984
41121
  try {
40985
- data = await readFile2(path2, "utf-8");
41122
+ data = await readFile3(path2, "utf-8");
40986
41123
  } catch (error) {
40987
41124
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
40988
41125
  return { exists: false };
@@ -41156,7 +41293,7 @@ ${AGENTS_STANZA}
41156
41293
  async function checkAgentsPrimeStanza(paths) {
41157
41294
  let content;
41158
41295
  try {
41159
- content = await readFile2(paths.agentsPath, "utf-8");
41296
+ content = await readFile3(paths.agentsPath, "utf-8");
41160
41297
  } catch (error) {
41161
41298
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
41162
41299
  return { fileExists: false, hasStanza: false };
@@ -41172,7 +41309,7 @@ async function ensureAgentsPrimeStanza(paths) {
41172
41309
  let current = "";
41173
41310
  let createdFile = false;
41174
41311
  try {
41175
- current = await readFile2(paths.agentsPath, "utf-8");
41312
+ current = await readFile3(paths.agentsPath, "utf-8");
41176
41313
  } catch (error) {
41177
41314
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
41178
41315
  createdFile = true;
@@ -42453,7 +42590,7 @@ var ORG_DOMAIN = defineDomain({
42453
42590
  });
42454
42591
 
42455
42592
  // ../../packages/warmhub-cli/src/domains/prime-content.md
42456
- 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";
42457
42594
 
42458
42595
  // ../../packages/warmhub-cli/src/domains/prime.ts
42459
42596
  function buildMarkdown(config) {
@@ -43588,14 +43725,19 @@ var handleView7 = async (ctx, { flags, args }) => {
43588
43725
  };
43589
43726
 
43590
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
+ });
43591
43731
  var createFlags7 = {
43592
43732
  fields: flag.string({ description: FIELDS_FLAG_DESCRIPTION }),
43733
+ file: fieldsFileFlag,
43593
43734
  description: flag.string({
43594
43735
  description: "Human-readable description of the shape"
43595
43736
  })
43596
43737
  };
43597
43738
  var reviseFlags3 = {
43598
43739
  fields: flag.string({ description: FIELDS_FLAG_DESCRIPTION }),
43740
+ file: fieldsFileFlag,
43599
43741
  description: flag.string({
43600
43742
  description: "Human-readable description of the shape"
43601
43743
  })
@@ -43609,13 +43751,18 @@ var retractFlags3 = {
43609
43751
  };
43610
43752
  var handleCreate6 = async (ctx, { flags, args }) => {
43611
43753
  const shapeName = args[0];
43612
- const fieldsJson = flags.fields;
43613
- if (!shapeName || fieldsJson === undefined) {
43614
- 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"}'`);
43615
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
+ });
43616
43764
  const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
43617
43765
  const c = ctx.colors;
43618
- const fields = parseJsonObject(fieldsJson, "--fields");
43619
43766
  const opts = {};
43620
43767
  if (flags.description !== undefined)
43621
43768
  opts.description = flags.description;
@@ -43630,13 +43777,18 @@ var handleCreate6 = async (ctx, { flags, args }) => {
43630
43777
  };
43631
43778
  var handleRevise3 = async (ctx, { flags, args }) => {
43632
43779
  const shapeName = args[0];
43633
- const fieldsJson = flags.fields;
43634
- if (!shapeName || fieldsJson === undefined) {
43635
- 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"]}'`);
43636
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
+ });
43637
43790
  const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
43638
43791
  const c = ctx.colors;
43639
- const newFields = parseJsonObject(fieldsJson, "--fields");
43640
43792
  const opts = {};
43641
43793
  if (flags.description !== undefined)
43642
43794
  opts.description = flags.description;
@@ -43713,6 +43865,7 @@ var SHAPE_DOMAIN = defineDomain({
43713
43865
  flags: reviseFlags3,
43714
43866
  examples: [
43715
43867
  `wh shape revise location --fields '{"x":"number","y":"number"}'`,
43868
+ "wh shape revise location --file fields.json",
43716
43869
  `wh shape revise Player --fields '{"name":{"type":"string","maxLength":80},"tags":{"type":"array","items":"string","maxItems":10}}'`
43717
43870
  ],
43718
43871
  notes: [...FIELD_CONSTRAINTS_NOTES],
@@ -43725,6 +43878,7 @@ var SHAPE_DOMAIN = defineDomain({
43725
43878
  flags: createFlags7,
43726
43879
  examples: [
43727
43880
  `wh shape create GameConfig --repo org/repo --fields '{"x":"number"}'`,
43881
+ "wh shape create GameConfig --repo org/repo --file fields.json",
43728
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}}'`
43729
43883
  ],
43730
43884
  notes: [...FIELD_CONSTRAINTS_NOTES],
@@ -43773,18 +43927,16 @@ var SHAPE_DOMAIN = defineDomain({
43773
43927
 
43774
43928
  // ../../packages/warmhub-cli/src/domains/sub/flags.ts
43775
43929
  var orgScopeFlag = flag.string({
43776
- 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`
43777
43931
  });
43778
43932
  var createFlags8 = {
43779
43933
  on: flag.string({
43780
43934
  description: "Shape to subscribe to"
43781
43935
  }),
43782
43936
  event: flag.string({
43783
- description: "Event to watch: commit (default), repo.renamed, org.renamed, thing.renamed, or shape.renamed"
43784
- }),
43785
- org: flag.string({
43786
- description: "Org slug for an org-scoped subscription (org.renamed)"
43937
+ description: `event to watch: ${SUBSCRIBABLE_EVENT_TYPES.join(", ")} (commit is default)`
43787
43938
  }),
43939
+ org: orgScopeFlag,
43788
43940
  kind: flag.string({
43789
43941
  description: "Subscription kind (webhook; the default)"
43790
43942
  }),
@@ -43955,11 +44107,11 @@ function buildSubscriptionMutationArgs(flags, usage, example) {
43955
44107
  }
43956
44108
  return mutationArgs;
43957
44109
  }
43958
- function rejectCommitFlags(flags, eventType) {
44110
+ function rejectCommitOnlyFlags(flags, eventType) {
43959
44111
  for (const f of ["on", "filter", "source"]) {
43960
44112
  const v = flags[f];
43961
44113
  if (typeof v === "string" && v.length > 0) {
43962
- 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`);
43963
44115
  }
43964
44116
  }
43965
44117
  }
@@ -43977,7 +44129,7 @@ function scopeLabel(scope) {
43977
44129
  // ../../packages/warmhub-cli/src/domains/sub/handlers-create.ts
43978
44130
  var handleCreate7 = async (ctx, { flags, args }) => {
43979
44131
  const name = args[0] ?? flags.name;
43980
- 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]`;
43981
44133
  const example = `wh sub create signal-hook --repo myorg/myrepo --on Signal --filter '{"shape":"Signal"}' --webhook-url https://example.com/hook`;
43982
44134
  if (!name) {
43983
44135
  usageError(usage, example);
@@ -43991,33 +44143,36 @@ var handleCreate7 = async (ctx, { flags, args }) => {
43991
44143
  }
43992
44144
  const fallbackWebhookUrl = typeof flags["fallback-webhook-url"] === "string" ? flags["fallback-webhook-url"] : undefined;
43993
44145
  const allowTraceReentry = flags["allow-trace-reentry"] === true;
43994
- const renameExtras = {
44146
+ const metadataExtras = {
43995
44147
  ...fallbackWebhookUrl ? { fallbackWebhookUrl } : {},
43996
44148
  ...allowTraceReentry ? { allowTraceReentry: true } : {}
43997
44149
  };
43998
- if (eventType === "org.renamed") {
44150
+ if (isOrgScopedEventType(eventType)) {
43999
44151
  const orgName = typeof flags.org === "string" ? flags.org : undefined;
44000
44152
  if (!orgName) {
44001
- 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`);
44002
44154
  }
44003
- rejectCommitFlags(flags, eventType);
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`);
44157
+ }
44158
+ rejectCommitOnlyFlags(flags, eventType);
44004
44159
  const result2 = await ctx.client.subscription.create({
44005
44160
  orgName,
44006
44161
  name,
44007
44162
  eventType,
44008
44163
  kind,
44009
44164
  webhookUrl,
44010
- ...renameExtras
44165
+ ...metadataExtras
44011
44166
  });
44012
44167
  writeOutput(ctx, result2, () => {
44013
44168
  const c = ctx.colors;
44014
- 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})`);
44015
44170
  });
44016
44171
  return;
44017
44172
  }
44018
44173
  const { org, repo } = resolveRepoContext(ctx);
44019
44174
  if (eventType !== "commit") {
44020
- rejectCommitFlags(flags, eventType);
44175
+ rejectCommitOnlyFlags(flags, eventType);
44021
44176
  const result2 = await ctx.client.subscription.create({
44022
44177
  orgName: org,
44023
44178
  repoName: repo,
@@ -44025,7 +44180,7 @@ var handleCreate7 = async (ctx, { flags, args }) => {
44025
44180
  eventType,
44026
44181
  kind,
44027
44182
  webhookUrl,
44028
- ...renameExtras
44183
+ ...metadataExtras
44029
44184
  });
44030
44185
  writeOutput(ctx, result2, () => {
44031
44186
  const c = ctx.colors;
@@ -44096,6 +44251,7 @@ var handleView8 = async (ctx, { args, flags }) => {
44096
44251
  const c = ctx.colors;
44097
44252
  ctx.out(`${c.bold}${sub.name}${c.reset}`);
44098
44253
  ctx.out(` kind: ${c.cyan}${sub.kind}${c.reset}`);
44254
+ ctx.out(` eventType: ${c.cyan}${sub.eventType}${c.reset}`);
44099
44255
  ctx.out(` active: ${sub.active ? c.green : c.yellow}${sub.active}${c.reset}`);
44100
44256
  if (sub.sourceRepo) {
44101
44257
  ctx.out(` source repo: ${c.cyan}${sub.sourceRepo}${c.reset}`);
@@ -44216,7 +44372,7 @@ var handleList7 = async (ctx, { flags }) => {
44216
44372
  ctx.out(`${c.bold}Subscriptions:${c.reset} ${c.cyan}${label}${c.reset}`);
44217
44373
  for (const sub of items) {
44218
44374
  const active = sub.active ? `${c.green}active` : `${c.yellow}paused`;
44219
- 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}`;
44220
44376
  if (sub.sourceRepo) {
44221
44377
  line += ` ${c.dim}← ${sub.sourceRepo}${c.reset}`;
44222
44378
  }
@@ -44383,6 +44539,9 @@ var SUB_DOMAIN = defineDomain({
44383
44539
  "# Subscribe to org renames (org-scoped — use --org, not --repo)",
44384
44540
  " $ wh sub create org-rename-hook --org myorg --event org.renamed --webhook-url https://example.com/hook",
44385
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
+ "",
44386
44545
  "# Webhook auth: create a credential set with WEBHOOK_* keys, then bind it to the subscription.",
44387
44546
  "# See `wh credential set --help` for supported key names and `wh sub bind --help`.",
44388
44547
  " $ wh credential create webhook-keys --repo myorg/myrepo",
@@ -44400,7 +44559,7 @@ var SUB_DOMAIN = defineDomain({
44400
44559
  examples: [
44401
44560
  "# Update only the webhook URL",
44402
44561
  " $ wh sub update signal-hook --repo myorg/myrepo --webhook-url https://example.com/v2/hook",
44403
- "# Repoint an org-scoped (org.renamed) rename hook in place",
44562
+ "# Repoint an org-scoped metadata hook in place",
44404
44563
  " $ wh sub update org-rename-hook --org myorg --webhook-url https://example.com/v2/hook"
44405
44564
  ],
44406
44565
  handler: handleUpdate4
@@ -44414,7 +44573,7 @@ var SUB_DOMAIN = defineDomain({
44414
44573
  examples: [
44415
44574
  "wh sub view signal-hook --repo myorg/myrepo",
44416
44575
  "wh sub view signal-hook --show-secrets --repo myorg/myrepo",
44417
- "# Org-scoped (org.renamed) subscription",
44576
+ "# Org-scoped metadata subscription",
44418
44577
  " $ wh sub view org-rename-hook --org myorg"
44419
44578
  ],
44420
44579
  handler: handleView8
@@ -44428,7 +44587,7 @@ var SUB_DOMAIN = defineDomain({
44428
44587
  examples: [
44429
44588
  "wh sub list --repo myorg/myrepo",
44430
44589
  "wh sub list --limit 10",
44431
- "# Org-scoped (org.renamed) subscriptions",
44590
+ "# Org-scoped metadata subscriptions",
44432
44591
  " $ wh sub list --org myorg"
44433
44592
  ],
44434
44593
  handler: handleList7
@@ -44479,7 +44638,7 @@ var SUB_DOMAIN = defineDomain({
44479
44638
  flags: scopeFlags,
44480
44639
  examples: [
44481
44640
  "wh sub pause signal-hook --repo myorg/myrepo",
44482
- "# Org-scoped (org.renamed) subscription",
44641
+ "# Org-scoped metadata subscription",
44483
44642
  " $ wh sub pause org-rename-hook --org myorg"
44484
44643
  ],
44485
44644
  handler: handlePause
@@ -44505,7 +44664,7 @@ var SUB_DOMAIN = defineDomain({
44505
44664
  examples: [
44506
44665
  "# Bind credentials to inject auth headers on webhook delivery",
44507
44666
  " $ wh sub bind signal-hook --credentials webhook-keys --repo myorg/myrepo",
44508
- "# Org-scoped (org.renamed) subscription + org-scoped credential set",
44667
+ "# Org-scoped metadata subscription + org-scoped credential set",
44509
44668
  " $ wh sub bind org-rename-hook --credentials org-webhook-keys --org myorg"
44510
44669
  ],
44511
44670
  handler: handleBind
@@ -46494,7 +46653,7 @@ function resolveLogLevel(flags, env) {
46494
46653
  // package.json
46495
46654
  var package_default3 = {
46496
46655
  name: "@warmhub/cli",
46497
- version: "0.72.0",
46656
+ version: "0.73.0",
46498
46657
  private: false,
46499
46658
  type: "module",
46500
46659
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -47149,4 +47308,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
47149
47308
  var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
47150
47309
  process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
47151
47310
 
47152
- //# debugId=32195DBCBD952F6364756E2164756E21
47311
+ //# debugId=D881F1662B4C6E3E64756E2164756E21