@theholocron/cli 5.0.0-alpha.337 → 5.0.0-alpha.339

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,27 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "node:module";
3
- import { closeSync, constants, copyFileSync, existsSync, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
3
+ import { closeSync, copyFileSync, existsSync, fstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
4
+ import { addGlobalOptions, groupMenu, tokenContext } from "@theholocron/kyber/flags";
4
5
  import { LOG_LEVELS, NoopAnalyticsSink, NoopErrorSink, redactObject } from "@theholocron/observability/core";
5
6
  import yargs from "yargs";
6
7
  import { hideBin } from "yargs/helpers";
7
8
  import { createLogger, isCI, parseLogLevel, resolveAxiomFromEnv } from "@theholocron/observability/logger";
8
- import { AuthError, ProviderApiError, ProviderApiError as ProviderApiError$1, createRestClient, onRetry } from "@theholocron/http-client";
9
- import path, { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
10
- import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
11
- import { parse } from "dotenv";
12
- import { execFileSync, spawn, spawnSync } from "node:child_process";
9
+ import { AuthError, ProviderApiError, ProviderApiError as ProviderApiError$1, createResolveToken, createRestClient, onRetry } from "@theholocron/http-client";
10
+ import { DOTENV_FILE, createKeyring, getCredential, hasCredentials, readDotenvFile, setCredentials } from "@theholocron/kyber/secrets";
13
11
  import { createEnvLookup, firstEnv, withEnvPrefix } from "@theholocron/env-utils/lookup";
14
12
  import { Entry, findCredentials } from "@napi-rs/keyring";
15
- import chalk from "chalk";
16
- import ora from "ora";
17
- import { createInterface } from "node:readline";
18
- import search from "@inquirer/search";
19
- import { Separator, checkbox, confirm, input, password, select } from "@inquirer/prompts";
13
+ import { createProgress, progressEnabled, withProgress } from "@theholocron/kyber/ui";
14
+ import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
20
15
  import { homedir, hostname, tmpdir, userInfo } from "node:os";
21
16
  import { PostHogSink } from "@theholocron/observability/analytics";
22
17
  import { SentrySink } from "@theholocron/observability/errors";
18
+ import { execFileSync, spawn, spawnSync } from "node:child_process";
19
+ import { Separator, checkbox, confirm, input, select } from "@inquirer/prompts";
23
20
  import { KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, createAlexignore, createAlexrc, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, mergeScripts, readWorkspacePackages, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, workflowFile, workflowKey, workflowKeys, workspacePackages } from "@theholocron/astromech";
24
21
  import { loadTasksConfig } from "@theholocron/astromech/config";
22
+ import path, { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
25
23
  import { ConfigFileError, loadConfigFile } from "@theholocron/datapad";
26
24
  import { readGitRemote, updateGitignore } from "@theholocron/git-utils";
27
25
  import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
@@ -29,409 +27,38 @@ import { errorMessage } from "@theholocron/misc-utils";
29
27
  import { pathToFileURL } from "node:url";
30
28
  import { stringifyJson } from "@theholocron/json-utils";
31
29
  import { findRootSync, isWorkspaceRoot, walkFilesSync } from "@theholocron/fs-utils";
32
- import { createServer } from "node:http";
30
+ import { serveHandler } from "@theholocron/dagobah";
33
31
  import { access, copyFile, lstat, mkdir, open, readFile, readdir, realpath, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
32
+ import { createServer } from "node:http";
34
33
  import { ADR_DIR, ADR_STATUSES, CLOSED_STATUSES, SPEC_DIRS, SPEC_STATUSES, WITHDRAWN_STATE, assignSpecIds, checkSpecs, classifySpecPath, discussionBody, discussionIdLine, discussionPrLine, discussionTitle, evaluateDocsPresence, isAddedDocComment, isFeat, packageOf, parseFrontmatter, parseSkipDocs, reconcileSpecStatus, specSummary, specTitle, updateFrontmatter } from "@theholocron/astromech/repo-validation";
35
34
  import { lintCommitMsgFile } from "@theholocron/astromech/lint";
36
35
  import { createGitHubClient } from "@theholocron/github-client";
37
- // ../kyber/dist/token-args-BgrCq_kK.mjs
38
- var TokenParseError = class extends Error {
39
- name = "TokenParseError";
40
- };
41
- /**
42
- * Converts raw --token CLI values into a typed result.
43
- *
44
- * Bare form: --token ghp_xxx → { cliToken: "ghp_xxx" }
45
- * Keyed form: --token github=ghp_xxx → { cliTokens: { github: "ghp_xxx" } }
46
- * Mixed: --token github=ghp_xxx --token v_yyy
47
- * → { cliToken: "v_yyy", cliTokens: { github: "ghp_xxx" } }
48
- *
49
- * Values may contain "=" (e.g. base64 strings) — only the first "=" is treated as a separator.
50
- */
51
- function parseTokenArgs(tokens) {
52
- if (tokens.length === 0) return {};
53
- const cliTokens = {};
54
- const bare = [];
55
- for (const raw of tokens) {
56
- const eqIdx = raw.indexOf("=");
57
- if (eqIdx === -1) {
58
- bare.push(raw);
59
- continue;
60
- }
61
- const vendor = raw.slice(0, eqIdx);
62
- const value = raw.slice(eqIdx + 1);
63
- if (vendor.trim() === "") throw new TokenParseError(`invalid --token value "${raw}": vendor name must not be empty`);
64
- if (/\s/.test(vendor)) throw new TokenParseError(`invalid --token value "${raw}": vendor name must not contain whitespace`);
65
- if (value === "") throw new TokenParseError(`invalid --token value "${raw}": token value must not be empty`);
66
- cliTokens[vendor] = value;
67
- }
68
- if (bare.length > 1) throw new TokenParseError(`only one bare --token value is allowed; got ${bare.length.toString()} — use vendor=value form for multiple tokens`);
69
- const result = {};
70
- if (bare.length === 1) result.cliToken = bare[0];
71
- if (Object.keys(cliTokens).length > 0) result.cliTokens = cliTokens;
72
- return result;
73
- }
74
- // ../kyber/dist/flags.mjs
75
- /**
76
- * Declares the options every command of a tool takes, once, on the root parser: `--dry-run`, a repeatable `--token`
77
- * (a bare value, or `vendor=value`, parsed by `parseTokenArgs`) and `--cwd`. A tool adds its own to the same parser;
78
- * a command module's arguments extend {@link GlobalArgs}.
79
- */
80
- function addGlobalOptions(parser, options = {}) {
81
- const describe = options.describe ?? {};
82
- return parser.option("dry-run", {
83
- type: "boolean",
84
- default: false,
85
- describe: describe.dryRun ?? "Print what would change without changing it. Read-only commands ignore it."
86
- }).option("token", {
87
- type: "string",
88
- array: true,
89
- describe: describe.token ?? "Token override. Bare form: --token <value>. Keyed form: --token vendor=value (repeat for each vendor)."
90
- }).option("cwd", {
91
- type: "string",
92
- default: options.cwd ?? process.cwd(),
93
- describe: describe.cwd ?? "The directory to work from"
36
+ import { checkForUpdates } from "@theholocron/kyber/notifier";
37
+ // \0rolldown/runtime.js
38
+ var __defProp = Object.defineProperty;
39
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
40
+ var __getOwnPropNames = Object.getOwnPropertyNames;
41
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
42
+ var __exportAll = (all, no_symbols) => {
43
+ let target = {};
44
+ for (var name in all) __defProp(target, name, {
45
+ get: all[name],
46
+ enumerable: true
94
47
  });
95
- }
96
- /**
97
- * The hidden default command (`$0`) of a command group, so that typing just the group (`tool repo`) does something
98
- * useful: `open` is called with the group's name and the parsed arguments, usually to open a menu of its subcommands.
99
- */
100
- const groupMenu$1 = (parent, open) => ({
101
- command: "$0",
102
- describe: false,
103
- builder: (y) => y,
104
- handler: async (argv) => {
105
- await open(parent, argv);
106
- }
107
- });
108
- /**
109
- * Parses the values of a repeatable `--token` flag. An empty or missing flag is `{}`. A value that does not parse is
110
- * reported through `report` (as `--token: <why>`), sets `process.exitCode` to 1 and gives `null`, so the command can stop
111
- * without a stack trace; any other error is thrown.
112
- */
113
- function tokenContext$1(rawTokens, report) {
114
- if (!rawTokens?.length) return {};
115
- try {
116
- return parseTokenArgs(rawTokens);
117
- } catch (err) {
118
- if (err instanceof TokenParseError) {
119
- report(`--token: ${err.message}`);
120
- process.exitCode = 1;
121
- return null;
122
- }
123
- throw err;
124
- }
125
- }
126
- // ../kyber/dist/secrets.mjs
127
- /** Puts `text` on the system clipboard through `clipboardy`, which uses the platform's own tool. Loaded only when called. */
128
- async function copyToClipboard(text) {
129
- const { default: clipboard } = await import("clipboardy");
130
- await clipboard.write(text);
131
- }
132
- /**
133
- * The variables the `credentials` providers returned, kept for the life of the process.
134
- *
135
- * The plugin loader reads each provider once (`setCredentials`), and the token resolvers look a token up here
136
- * (`getCredential`) after the flag and the process environment and before the keyring. It is in memory only: the
137
- * values were already in this process when the provider returned them, and nothing here writes them anywhere.
138
- *
139
- * A source is one provider's answer for one environment. They are kept in the order they were set, which is the
140
- * order `holocron.config` lists the providers, and the first source that has a value wins.
141
- */
142
- const sources = /* @__PURE__ */ new Map();
143
- /** Remember `variables` as what the source `source` returned. Setting a source again replaces its variables. */
144
- function setCredentials(source, variables) {
145
- sources.set(source, variables);
146
- }
147
- /** Whether the source `source` has been read already, so a second loader in the same process does not read it again. */
148
- function hasCredentials(source) {
149
- return sources.has(source);
150
- }
151
- /**
152
- * The first non-empty value for any of `names`, from the first source that has one. Sources are tried in the order
153
- * they were set; within a source the names are tried in the order given (the project's own variable name before the
154
- * vendor's). `undefined` when no source has one.
155
- */
156
- function getCredential(...names) {
157
- for (const variables of sources.values()) for (const name of names) {
158
- const value = variables[name];
159
- if (value) return value;
160
- }
161
- }
162
- /**
163
- * Create `path` as a new file only its owner can read (mode `0600`, set again on the open file so a loose `umask`
164
- * cannot widen it), write `text` to it and return which file it is, with its descriptor left open. It fails if the path
165
- * exists, a symlink included, so nothing is written through a planted link or over a file that is there. When the
166
- * write fails after the file exists, it closes and removes that file, so no plaintext is left behind. `write` is how the
167
- * text is written; it is a parameter so a test can make the write fail.
168
- */
169
- function createPrivateFile(path, text, write = writeSync) {
170
- const fd = openSync(path, "wx", 384);
171
- try {
172
- write(fd, text);
173
- fchmodSync(fd, 384);
174
- const { dev, ino } = fstatSync(fd);
175
- return {
176
- dev,
177
- ino,
178
- fd
179
- };
180
- } catch (err) {
181
- closeSync(fd);
182
- try {
183
- unlinkSync(path);
184
- } catch {}
185
- throw err;
186
- }
187
- }
188
- /**
189
- * Overwrite the file `identity` names with zeros, close it, and remove it from `path`, so the tokens it held are not
190
- * left in a deleted-but-recoverable file.
191
- *
192
- * The overwrite goes through the descriptor held since the file was written, not through the path, so it zeroes that
193
- * file wherever the path points now and never follows a symlink: a symlink or another file swapped in is not touched.
194
- * The path itself is removed only if it is still that file (same device and inode, which the held descriptor keeps
195
- * from being reused); otherwise it is left alone (`replaced`), so a file another process put there, or another
196
- * export's file, survives. A path that is already gone is `missing`, not an error; any other failure to remove it
197
- * throws, so the caller never reports a file as deleted while it is still there.
198
- *
199
- * The overwrite is best effort: a journaling or copy-on-write filesystem and an SSD may keep older blocks it does not
200
- * reach, which is why the file is also kept private and short-lived. One that fails does not stop the removal.
201
- * `remove` is how the path is deleted; it is a parameter so a test can look at the file just before it goes.
202
- */
203
- function shredFile(path, identity, remove = unlinkSync) {
204
- let missing = false;
205
- let same = false;
206
- try {
207
- try {
208
- const { size } = fstatSync(identity.fd);
209
- writeSync(identity.fd, Buffer.alloc(size), 0, size, 0);
210
- fsyncSync(identity.fd);
211
- } catch {}
212
- const stat = lstatSync(path);
213
- same = stat.isFile() && stat.dev === identity.dev && stat.ino === identity.ino;
214
- } catch (err) {
215
- if (err.code !== "ENOENT") throw err;
216
- missing = true;
217
- } finally {
218
- try {
219
- closeSync(identity.fd);
220
- } catch {}
221
- }
222
- if (missing) return "missing";
223
- if (!same) return "replaced";
224
- remove(path);
225
- return "deleted";
226
- }
227
- /**
228
- * Write `text` to `path` as a file only its owner can read (mode `0600`), and return which file that is, with its
229
- * descriptor still open, so cleanup can remove only it. Without `force` it will not replace a file that is already
230
- * there. A write that fails removes the file it had just created, so a failed write never leaves plaintext tokens behind.
231
- *
232
- * With `force` the replacement is written to a temporary file beside `path` first and then renamed over it, which is
233
- * atomic, so a replacement that cannot be written or swapped in leaves the old file exactly as it was. Only once the
234
- * new file is in place is the old file's content overwritten with zeros through a descriptor opened on it before the
235
- * swap, so the tokens of an earlier run are not left recoverable. A symlink at `path` is replaced, not followed.
236
- *
237
- * Windows does not honour these modes, so the caller does not use this there. `write` is how the text is written; it is
238
- * a parameter so a test can make the write fail after the file exists.
239
- */
240
- function writeCredentialsFile(path, text, force = false, write = writeSync) {
241
- if (!force) return createPrivateFile(path, text, write);
242
- const old = openExisting(path);
243
- const temp = join(dirname(path), `${basename(path)}.${randomBytes(6).toString("hex")}.tmp`);
244
- let fresh;
245
- try {
246
- fresh = createPrivateFile(temp, text, write);
247
- try {
248
- renameSync(temp, path);
249
- } catch (err) {
250
- closeSync(fresh.fd);
251
- unlinkSync(temp);
252
- throw err;
253
- }
254
- } catch (err) {
255
- if (old) closeSync(old.fd);
256
- throw err;
257
- }
258
- if (old) shredFile(path, old);
259
- return fresh;
260
- }
261
- /** A descriptor for the regular file at `path`, opened without following a symlink, or `undefined` if there is none. */
262
- function openExisting(path) {
263
- let stat;
264
- try {
265
- stat = lstatSync(path);
266
- } catch (err) {
267
- if (err.code === "ENOENT") return void 0;
268
- throw err;
269
- }
270
- if (!stat.isFile()) return void 0;
271
- const fd = openSync(path, constants.O_WRONLY | constants.O_NOFOLLOW);
272
- const { dev, ino } = fstatSync(fd);
273
- return {
274
- dev,
275
- ino,
276
- fd
277
- };
278
- }
279
- /** The name of the file, at the repo root, that holds a developer's own tokens. */
280
- const DOTENV_FILE = ".env";
281
- /**
282
- * Read `<repoRoot>/.env` into a record, or `null` when the file is not there (or cannot be read).
283
- *
284
- * Only the repo root is looked at, never the directory the command happens to run in, so a `.env` in a checkout you
285
- * cloned and ran the CLI from is not trusted. The file is optional: nothing asks for it, and a project that keeps its
286
- * tokens in a `credentials` provider or the keyring does not need one.
287
- */
288
- function readDotenvFile(repoRoot) {
289
- try {
290
- return parse(readFileSync(join(repoRoot, DOTENV_FILE)));
291
- } catch {
292
- return null;
293
- }
294
- }
295
- /** A value dotenv reads back as written without any quoting: no space, quote, `#`, backslash or line break. */
296
- const PLAIN = /^[A-Za-z0-9_@%+=:,./-]*$/;
297
- /** The quotes dotenv accepts around a value, in the order they are tried. Single quotes keep the value exactly as written. */
298
- const QUOTES = [
299
- "'",
300
- "\"",
301
- "`"
302
- ];
303
- /**
304
- * `NAME=value` in a form dotenv reads back as the same value, or `null` when there is none.
305
- *
306
- * dotenv has no escape for a quote or a backslash: a double-quoted value only turns `\n` and `\r` into line breaks, and
307
- * leaves every other backslash, an escaped quote included, in the value. So nothing is escaped here. A plain value is
308
- * written bare; any other is wrapped in the first of `'`, `"` and `` ` `` it does not contain; a value with a line
309
- * break can only be double-quoted (with `\n` and `\r`) and so must not contain `"` or a backslash. A value that fits
310
- * none of these is `null`, and the caller says so rather than exporting a different token.
311
- */
312
- function dotenvLine(name, value) {
313
- if (PLAIN.test(value)) return `${name}=${value}`;
314
- if (/[\r\n]/.test(value)) {
315
- if (value.includes("\"") || value.includes("\\")) return null;
316
- return `${name}="${value.replace(/\r/g, "\\r").replace(/\n/g, "\\n")}"`;
317
- }
318
- const quote = QUOTES.find((q) => !value.includes(q));
319
- return quote ? `${name}=${quote}${value}${quote}` : null;
320
- }
321
- /**
322
- * Ask git whether it ignores `path` (see {@link GitIgnoreState}). A caller that must not leave a file where it could be
323
- * committed accepts only `ignored` and `no-repo`. Reads only; it changes nothing.
324
- */
325
- function isGitIgnored(path) {
326
- try {
327
- execFileSync("git", [
328
- "check-ignore",
329
- "-q",
330
- "--",
331
- path
332
- ], {
333
- cwd: dirname(path),
334
- stdio: [
335
- "ignore",
336
- "ignore",
337
- "pipe"
338
- ]
48
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
49
+ return target;
50
+ };
51
+ var __copyProps = (to, from, except, desc) => {
52
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
53
+ key = keys[i];
54
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
55
+ get: ((k) => from[k]).bind(null, key),
56
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
339
57
  });
340
- return "ignored";
341
- } catch (err) {
342
- const { status, code, stderr } = err;
343
- if (code === "ENOENT") return "no-repo";
344
- if (status === 1) return "tracked";
345
- return status === 128 && /not a git repository/i.test(String(stderr)) ? "no-repo" : "unknown";
346
- }
347
- }
348
- function loadBinding() {
349
- try {
350
- return createRequire(import.meta.url)("@napi-rs/keyring");
351
- } catch {
352
- return null;
353
58
  }
354
- }
355
- /**
356
- * A tool's secrets in the OS keyring, under one service name.
357
- *
358
- * Keyring access is best-effort. Platforms without a supported credential store (some Linux CI images, sandboxed
359
- * environments) throw from the underlying library, and `@napi-rs/keyring` is an optional peer that may not be installed
360
- * at all. Every method catches that and answers `null`, `false` or an empty list rather than propagating, so a caller's
361
- * chain (a flag, then the environment, then the keyring) falls through to the paths that do work, which is how CI is
362
- * meant to run.
363
- *
364
- * Reads are remembered in memory only, for the life of the process. A cache that outlived the process would mean writing
365
- * secrets somewhere else, which is what the keyring is there to avoid.
366
- */
367
- function createKeyring(options) {
368
- const { service } = options;
369
- const cache = /* @__PURE__ */ new Map();
370
- let binding = options.binding;
371
- const loaded = () => {
372
- if (binding === void 0) binding = loadBinding();
373
- return binding;
374
- };
375
- const entry = (account) => {
376
- const b = loaded();
377
- if (!b) throw new Error("no OS keyring available");
378
- return new b.Entry(service, account);
379
- };
380
- return {
381
- get(account) {
382
- if (cache.has(account)) return cache.get(account);
383
- let secret;
384
- try {
385
- secret = entry(account).getPassword();
386
- } catch {
387
- secret = null;
388
- }
389
- cache.set(account, secret);
390
- return secret;
391
- },
392
- set(account, secret) {
393
- try {
394
- entry(account).setPassword(secret);
395
- cache.set(account, secret);
396
- return true;
397
- } catch {
398
- cache.delete(account);
399
- return false;
400
- }
401
- },
402
- delete(account) {
403
- try {
404
- const removed = entry(account).deletePassword();
405
- cache.set(account, null);
406
- return removed;
407
- } catch {
408
- cache.delete(account);
409
- return false;
410
- }
411
- },
412
- list() {
413
- try {
414
- const b = loaded();
415
- return b ? b.findCredentials(service).map((c) => c.account) : [];
416
- } catch {
417
- return [];
418
- }
419
- },
420
- isAvailable() {
421
- try {
422
- const b = loaded();
423
- if (!b) return false;
424
- b.findCredentials(service);
425
- return true;
426
- } catch {
427
- return false;
428
- }
429
- },
430
- clearCache() {
431
- cache.clear();
432
- }
433
- };
434
- }
59
+ return to;
60
+ };
61
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
435
62
  // src/env/env.ts
436
63
  /** Singleton env for simple global lookups throughout the CLI. */
437
64
  const env = createEnvLookup();
@@ -469,6 +96,13 @@ const keyring = createKeyring({
469
96
  findCredentials
470
97
  }
471
98
  });
99
+ /**
100
+ * Forget every token `getToken` has remembered, so the next read asks the keyring again. For a test, or after the
101
+ * keyring was changed from outside the process.
102
+ */
103
+ function clearTokenCache() {
104
+ keyring.clearCache();
105
+ }
472
106
  /** Store or overwrite a bootstrap token for a provider. Returns true on success, false when the keyring is unsupported or errored. */
473
107
  function setToken(provider, token) {
474
108
  return keyring.set(provider, token);
@@ -496,6 +130,19 @@ function listStoredProviders() {
496
130
  return keyring.list();
497
131
  }
498
132
  // src/auth/auth-resolver/auth-resolver.ts
133
+ /** Wraps `createResolveToken` from `@theholocron/http` and injects the
134
+ * system keyring so plugins stay at a one-liner call site. */
135
+ function createResolveToken$1(config) {
136
+ const storedOrKeyring = (provider) => getCredential(config.envName, config.vendorEnvName) ?? getToken(provider);
137
+ return Object.assign(createResolveToken({
138
+ ...config,
139
+ getKeyringToken: storedOrKeyring
140
+ }), { token: {
141
+ envName: config.envName,
142
+ vendorEnvName: config.vendorEnvName,
143
+ keyringKey: config.keyringService
144
+ } });
145
+ }
499
146
  /**
500
147
  * Build a strict, single-feature token resolver.
501
148
  *
@@ -516,6 +163,20 @@ function createFeatureResolver(config) {
516
163
  keyringKey: config.keyringKey
517
164
  } });
518
165
  }
166
+ // src/auth/index.ts
167
+ var auth_exports = /* @__PURE__ */ __exportAll({
168
+ AuthError: () => AuthError,
169
+ clearTokenCache: () => clearTokenCache,
170
+ createFeatureResolver: () => createFeatureResolver,
171
+ createResolveToken: () => createResolveToken$1,
172
+ deleteToken: () => deleteToken,
173
+ getToken: () => getToken,
174
+ isKeyringAvailable: () => isKeyringAvailable,
175
+ listStoredProviders: () => listStoredProviders,
176
+ setToken: () => setToken
177
+ });
178
+ import * as import__theholocron_kyber_secrets from "@theholocron/kyber/secrets";
179
+ __reExport(auth_exports, import__theholocron_kyber_secrets);
519
180
  // src/commands/contexts/contexts.ts
520
181
  /**
521
182
  * Command → context. Keys are the full command path as it lands in
@@ -605,667 +266,28 @@ function contextForCommand(name) {
605
266
  function commandsInContext(context) {
606
267
  return Object.entries(COMMAND_CONTEXTS).filter(([, c]) => c === context).map(([name]) => name);
607
268
  }
608
- // ../kyber/dist/non-interactive-error-Mm_Mn79M.mjs
609
- /**
610
- * Raised when a prompt is needed but stdin isn't a TTY. A non-TTY run (CI, a
611
- * script, a pipe) throws this instead of hanging on `@inquirer/prompts`, which
612
- * otherwise throws its own `ExitPromptError` the moment stdin closes. `cli.ts`'s
613
- * `USER_FACING_ERRORS` catch prints the message cleanly.
614
- */
615
- var NonInteractiveError = class extends Error {
616
- /** The error's name, `NonInteractiveError`, so a catch can tell it from any other error. */
617
- name = "NonInteractiveError";
618
- };
619
- // ../kyber/dist/ui.mjs
620
- function isContainer(value) {
621
- return typeof value === "object" && value !== null;
622
- }
623
- function childrenOf(value) {
624
- return Array.isArray(value) ? value.map((v, i) => [String(i), v]) : Object.entries(value);
625
- }
626
- function scalar(value) {
627
- if (typeof value === "string") return chalk.green(JSON.stringify(value));
628
- if (typeof value === "number") return chalk.yellow(String(value));
629
- if (typeof value === "boolean") return chalk.magenta(String(value));
630
- return chalk.dim(String(value === void 0 ? null : value));
631
- }
632
- function summary(value) {
633
- const n = childrenOf(value).length;
634
- const unit = Array.isArray(value) ? n === 1 ? "item" : "items" : n === 1 ? "key" : "keys";
635
- return chalk.dim(Array.isArray(value) ? `[… ${n} ${unit}]` : `{… ${n} ${unit}}`);
636
- }
637
- /**
638
- * Paths of every container deeper than `depth` levels are left out, so those
639
- * render collapsed. `depth: 0` collapses the root; `Infinity` expands all.
640
- */
641
- function expandToDepth(value, depth) {
642
- const out = /* @__PURE__ */ new Set();
643
- const walk = (v, path, level) => {
644
- if (!isContainer(v) || level >= depth) return;
645
- out.add(path);
646
- for (const [k, child] of childrenOf(v)) walk(child, `${path}/${k}`, level + 1);
647
- };
648
- walk(value, "", 0);
649
- return out;
650
- }
651
- /** Flatten `value` into the lines visible under `expanded`. Pure — no I/O. */
652
- function renderTree(value, { expanded }) {
653
- const lines = [];
654
- const walk = (v, path, level, label, trailing) => {
655
- const indent = " ".repeat(level);
656
- const prefix = `${indent}${label}`;
657
- if (!isContainer(v)) {
658
- lines.push({
659
- path,
660
- text: `${prefix}${scalar(v)}${trailing}`,
661
- foldable: false,
662
- expanded: false,
663
- level
664
- });
665
- return;
666
- }
667
- const kids = childrenOf(v);
668
- const [open, close] = Array.isArray(v) ? ["[", "]"] : ["{", "}"];
669
- if (kids.length === 0) {
670
- lines.push({
671
- path,
672
- text: `${prefix}${open}${close}${trailing}`,
673
- foldable: false,
674
- expanded: false,
675
- level
676
- });
677
- return;
678
- }
679
- if (!expanded.has(path)) {
680
- lines.push({
681
- path,
682
- text: `${prefix}${summary(v)}${trailing}`,
683
- foldable: true,
684
- expanded: false,
685
- level
686
- });
687
- return;
688
- }
689
- lines.push({
690
- path,
691
- text: `${prefix}${open}`,
692
- foldable: true,
693
- expanded: true,
694
- level
695
- });
696
- kids.forEach(([k, child], i) => {
697
- const comma = i < kids.length - 1 ? "," : "";
698
- const childLabel = Array.isArray(v) ? "" : `${chalk.cyan(JSON.stringify(k))}: `;
699
- walk(child, `${path}/${k}`, level + 1, childLabel, comma);
700
- });
701
- lines.push({
702
- path: `${path}#close`,
703
- text: `${indent}${close}${trailing}`,
704
- foldable: false,
705
- expanded: false,
706
- level
707
- });
708
- };
709
- walk(value, "", 0, "", "");
710
- return lines;
711
- }
712
- /** Pure key reducer: `(state, key) -> state`. `rows` is the viewport height. */
713
- function reduceKey(state, key, value, rows) {
714
- const lines = renderTree(value, { expanded: state.expanded });
715
- const cur = lines[state.cursor];
716
- let { cursor } = state;
717
- const expanded = new Set(state.expanded);
718
- switch (key) {
719
- case "up":
720
- cursor = Math.max(0, cursor - 1);
721
- break;
722
- case "down":
723
- cursor = Math.min(lines.length - 1, cursor + 1);
724
- break;
725
- case "right":
726
- if (cur?.foldable) expanded.add(cur.path);
727
- break;
728
- case "left":
729
- if (cur?.foldable && cur.expanded) expanded.delete(cur.path);
730
- else if (cur) {
731
- const parent = lines.findLastIndex((l, i) => i < cursor && l.foldable && l.expanded && l.level < cur.level);
732
- if (parent >= 0) cursor = parent;
733
- }
734
- break;
735
- case "expandAll": return {
736
- cursor,
737
- top: state.top,
738
- expanded: expandToDepth(value, Infinity)
739
- };
740
- case "collapseAll": return {
741
- cursor: 0,
742
- top: 0,
743
- expanded: /* @__PURE__ */ new Set()
744
- };
745
- }
746
- const count = renderTree(value, { expanded }).length;
747
- cursor = Math.min(cursor, count - 1);
748
- let top = state.top;
749
- if (cursor < top) top = cursor;
750
- if (cursor >= top + rows) top = cursor - rows + 1;
751
- return {
752
- cursor,
753
- top: Math.max(0, top),
754
- expanded
755
- };
756
- }
757
- const KEYMAP = {
758
- "\x1B[A": "up",
759
- k: "up",
760
- "\x1B[B": "down",
761
- j: "down",
762
- "\x1B[C": "right",
763
- l: "right",
764
- "\r": "right",
765
- " ": "right",
766
- "\x1B[D": "left",
767
- h: "left",
768
- E: "expandAll",
769
- C: "collapseAll",
770
- q: "quit",
771
- "\x1B": "quit",
772
- "": "quit"
773
- };
774
- function draw(out, value, state, rows) {
775
- const lines = renderTree(value, { expanded: state.expanded });
776
- const view = lines.slice(state.top, state.top + rows).map((l, i) => {
777
- const row = `${l.foldable ? l.expanded ? "▾ " : "▸ " : " "}${l.text}`;
778
- return state.top + i === state.cursor ? chalk.inverse(row) : row;
779
- });
780
- const footer = chalk.dim(`${state.cursor + 1}/${lines.length} ↑↓ move →/⏎ expand ← collapse E/C all q quit`);
781
- out.write(`\u001b[H\u001b[J${view.join("\n")}\n${footer}`);
782
- }
783
- async function runInteractive(value, depth) {
784
- const { stdin, stdout } = process;
785
- if (!stdin.isTTY || !stdout.isTTY) throw new NonInteractiveError("--interactive needs a TTY on stdin and stdout.");
786
- const rows = () => Math.max(3, (stdout.rows ?? 24) - 1);
787
- let state = {
788
- cursor: 0,
789
- top: 0,
790
- expanded: expandToDepth(value, depth)
791
- };
792
- const wasRaw = stdin.isRaw;
793
- stdin.setRawMode(true);
794
- stdin.resume();
795
- stdout.write("\x1B[?1049h\x1B[?25l");
796
- const redraw = () => draw(stdout, value, state, rows());
797
- stdout.on("resize", redraw);
798
- try {
799
- redraw();
800
- await new Promise((resolve) => {
801
- const onData = (buf) => {
802
- const key = KEYMAP[buf.toString()];
803
- if (key === "quit") {
804
- stdin.off("data", onData);
805
- resolve();
806
- return;
807
- }
808
- if (key) {
809
- state = reduceKey(state, key, value, rows());
810
- redraw();
811
- }
812
- };
813
- stdin.on("data", onData);
814
- });
815
- } finally {
816
- stdout.off("resize", redraw);
817
- stdout.write("\x1B[?25h\x1B[?1049l");
818
- stdin.setRawMode(wasRaw);
819
- stdin.pause();
820
- }
821
- }
822
- /**
823
- * Print `value` as JSON. Non-TTY stdout always gets plain, valid
824
- * `JSON.stringify` output (so `| jq` and redirects keep working); a TTY gets a
825
- * coloured tree, collapsed past `depth`. `interactive` opens a folding viewer (the default on a TTY).
826
- */
827
- async function viewJson(value, options = {}) {
828
- const depth = options.depth ?? Infinity;
829
- if (options.interactive ?? (options.depth === void 0 && Boolean(process.stdin.isTTY && process.stdout.isTTY))) return runInteractive(value, options.depth ?? 1);
830
- if (!process.stdout.isTTY) {
831
- console.log(JSON.stringify(value, null, 2));
832
- return;
833
- }
834
- const lines = renderTree(value, { expanded: expandToDepth(value, depth) });
835
- console.log(lines.map((l) => l.text).join("\n"));
836
- }
837
- /** Platform-appropriate command to open a path in the OS's file browser. */
838
- function openCommand(path) {
839
- if (process.platform === "darwin") return {
840
- cmd: "open",
841
- args: [path]
842
- };
843
- if (process.platform === "win32") return {
844
- cmd: "cmd",
845
- args: [
846
- "/c",
847
- "start",
848
- "",
849
- path
850
- ]
851
- };
852
- return {
853
- cmd: "xdg-open",
854
- args: [path]
855
- };
856
- }
857
- /**
858
- * Open `path` in the OS's default file browser (Finder / Explorer /
859
- * whatever `xdg-open` resolves to on Linux). Fire-and-forget — detached so
860
- * it outlives this process, and never throws when the opener binary isn't
861
- * on PATH (e.g. no `xdg-open` in a minimal container).
862
- */
863
- function openPath(path) {
864
- const { cmd, args } = openCommand(path);
865
- const child = spawn(cmd, args, {
866
- stdio: "ignore",
867
- detached: true
868
- });
869
- child.on("error", () => {});
870
- child.unref();
871
- }
872
- /**
873
- * Runs `fn`, showing an ora spinner for its duration in TTY environments.
874
- * In non-TTY environments (CI, pipes, tests) the spinner is skipped entirely.
875
- */
876
- async function withSpinner(label, fn) {
877
- if (!process.stdout.isTTY) return fn();
878
- const spinner = ora(label).start();
879
- try {
880
- const result = await fn();
881
- spinner.succeed();
882
- return result;
883
- } catch (err) {
884
- spinner.fail();
885
- throw err;
886
- }
887
- }
888
- let allowed = true;
889
- /** Turn progress off for the run (`--quiet`, `--log`), so nothing extra shares the terminal with what those print. */
890
- function allowProgress(on) {
891
- allowed = on;
892
- }
893
- /**
894
- * Whether to draw a progress line: only when a person is watching a terminal (stdout and stderr both), not in CI, and not
895
- * switched off. Everywhere else the output stays the plain line-per-step text that scripts and the docs rely on.
896
- */
897
- function progressEnabled() {
898
- return allowed && Boolean(process.stdout.isTTY) && Boolean(process.stderr.isTTY) && !process.env["CI"];
899
- }
900
- /**
901
- * A spinner for one step at a time that a step can print through. Steps that only return a result use {@link
902
- * withProgress}; a step that prints its own result line while it runs prints through `print`. A `listen` hook can change the
903
- * spinner's text while the step runs, for instance to say that a request is being sent again.
904
- */
905
- function createProgress$1(print, enabled = progressEnabled, listen) {
906
- let active;
907
- return {
908
- async run(label, fn) {
909
- if (!enabled()) return fn();
910
- const spinner = ora({
911
- text: label,
912
- stream: process.stderr,
913
- discardStdin: false
914
- }).start();
915
- active = spinner;
916
- const stopListening = listen?.(label, (text) => {
917
- spinner.text = text;
918
- });
919
- try {
920
- return await fn();
921
- } finally {
922
- stopListening?.();
923
- spinner.stop();
924
- active = void 0;
925
- }
926
- },
927
- print(line) {
928
- const spinner = active;
929
- if (!spinner) return print(line);
930
- spinner.stop();
931
- print(line);
932
- spinner.start();
933
- }
934
- };
935
- }
936
- /** `fn` under a cleared-when-done spinner named `label`, on a terminal only. */
937
- function withProgress$1(label, fn, listen) {
938
- return createProgress$1(() => {}, progressEnabled, listen).run(label, fn);
939
- }
940
- /** Formats a message with a status marker and colour: one helper per kind of line a command prints. */
941
- const style = {
942
- /** A green `✓` for something that worked. */
943
- success: (msg) => `${chalk.green("✓")} ${msg}`,
944
- /** A yellow `⚠` for something worth a second look. */
945
- warn: (msg) => `${chalk.yellow("⚠")} ${msg}`,
946
- /** A red `✗` for something that failed. */
947
- fail: (msg) => `${chalk.red("✗")} ${msg}`,
948
- /** A cyan `→` for a step being taken. */
949
- step: (msg) => `${chalk.cyan("→")} ${msg}`,
950
- /** A dim `·` marker for a row that's neither a pass nor a failure — loaded but inactive, or skipped. */
951
- skip: (msg) => chalk.dim(`· ${msg}`),
952
- /** Dimmed text for a suggestion or a next step. */
953
- hint: (msg) => chalk.dim(msg),
954
- /** Dimmed text for detail that should recede. */
955
- dim: (msg) => chalk.dim(msg),
956
- /** Bold text for a heading. */
957
- header: (msg) => chalk.bold(msg)
958
- };
959
- /** Right-pads `s` to `width` with spaces — never truncates. */
960
- function pad(s, width) {
961
- return s.length >= width ? s : s + " ".repeat(width - s.length);
962
- }
963
- /**
964
- * One row of a status report: a 2-space indent, the status icon (✓ / ✗ / ·),
965
- * then `columns` joined with a two-space gap (blank columns dropped, so a
966
- * row that has nothing for its last column doesn't trail whitespace).
967
- * Column padding (`pad`) is the caller's job — `doctor` pads capability and
968
- * provider to a fixed width; `clone`'s repo names and paths don't, since
969
- * they vary too widely for fixed-width alignment to read cleanly.
970
- *
971
- * Shared by `doctor` (capability / provider / message) and `clone` (repo /
972
- * destination / reason) so every status table in the CLI reads the same way.
973
- */
974
- function statusRow(status, columns) {
975
- const joined = columns.filter((c) => c.length > 0).join(" ");
976
- return ` ${status === "ok" ? style.success(joined) : status === "fail" ? style.fail(joined) : style.skip(joined)}`;
977
- }
978
- /**
979
- * Print `message` and wait until Enter is pressed, the input ends, or Ctrl-C is pressed, whichever comes first, and
980
- * return which: `enter`, or `closed` for the other two. It never hangs on a closed input. It reads from stdin and
981
- * writes to stderr, so a pipe on stdout is never touched; the caller checks there is a terminal to answer it. The
982
- * streams are parameters so a test can answer for the user.
983
- */
984
- function waitForEnter(message, input = process.stdin, output = process.stderr) {
985
- return new Promise((resolve) => {
986
- const rl = createInterface({
987
- input,
988
- output
989
- });
990
- let answered = false;
991
- rl.on("close", () => resolve(answered ? "enter" : "closed"));
992
- rl.on("SIGINT", () => rl.close());
993
- rl.question(message, () => {
994
- answered = true;
995
- rl.close();
996
- });
997
- });
998
- }
999
269
  // src/ui/progress/progress.ts
1000
270
  /** Says on the spinner when a request is being sent again, so a slow step is not mistaken for a stuck one. */
1001
271
  const retryNotice = (label, setText) => onRetry((e) => {
1002
272
  setText(`${label} (retrying ${e.vendor ?? "the request"}, attempt ${e.attempt} of ${e.of})`);
1003
273
  });
1004
274
  /** {@link createSpinnerProgress} with the retry notice hooked in. */
1005
- function createProgress(print, enabled = progressEnabled) {
1006
- return createProgress$1(print, enabled, retryNotice);
275
+ function createProgress$1(print, enabled = progressEnabled) {
276
+ return createProgress(print, enabled, retryNotice);
1007
277
  }
1008
278
  /** `fn` under a cleared-when-done spinner named `label`, on a terminal only, with the retry notice hooked in. */
1009
- function withProgress(label, fn) {
1010
- return withProgress$1(label, fn, retryNotice);
1011
- }
1012
- // ../kyber/dist/prompts.mjs
1013
- /**
1014
- * Searchable autocomplete over one menu level's `items`. `select()` would work too
1015
- * at these list sizes, but `search()` degrades gracefully as the surface grows and
1016
- * costs nothing when it doesn't. Resolves to the picked item's `value`.
1017
- */
1018
- async function pickMenuItem(items, message = "What would you like to do?") {
1019
- return search({
1020
- message,
1021
- source: (term) => searchChoices(items, term)
1022
- });
1023
- }
1024
- /**
1025
- * `@inquirer/search`'s `source` callback, factored out as a plain function —
1026
- * unit-testable directly instead of only through a mocked `search()` call.
1027
- * Empty/undefined `term` (nothing typed yet) returns every item.
1028
- */
1029
- function searchChoices(items, term) {
1030
- const needle = term?.toLowerCase();
1031
- const pool = !needle ? items : items.filter((i) => i.haystack.includes(needle));
1032
- const rank = (i) => {
1033
- if (!needle) return 0;
1034
- const name = i.name.toLowerCase();
1035
- return name.startsWith(needle) ? 0 : name.includes(needle) ? 1 : 2;
1036
- };
1037
- return [...pool].sort((a, b) => rank(a) - rank(b)).map((i) => ({
1038
- name: i.name,
1039
- value: i.value,
1040
- description: i.description,
1041
- short: i.name.replace(/ ›$/, "")
1042
- }));
1043
- }
1044
- /**
1045
- * A required option must not resolve to an empty answer — `optionArgv`/
1046
- * `secretEnv` (child-argv.ts) both drop an empty-string value entirely,
1047
- * which would silently invoke the child without a flag the caller asked
1048
- * for. Passed as `validate` so inquirer re-prompts instead of accepting it.
1049
- */
1050
- const requireNonEmpty = (value) => value.trim().length > 0 || "required";
1051
- async function promptOne(option) {
1052
- if (option.secret || option.type === "password") return await password({
1053
- message: option.message,
1054
- ...option.required ? { validate: requireNonEmpty } : {}
1055
- });
1056
- if (option.type === "confirm") return await confirm({
1057
- message: option.message,
1058
- default: option.default
1059
- });
1060
- if (option.type === "select") {
1061
- const choices = typeof option.choices === "function" ? option.choices() : option.choices ?? [];
1062
- return await select({
1063
- message: option.message,
1064
- choices: choices.map((c) => ({ value: c }))
1065
- });
1066
- }
1067
- if (option.arity && option.arity > 1) {
1068
- const values = [];
1069
- for (let n = 0; n < option.arity; n++) values.push(await input({
1070
- message: `${option.message} (${n + 1} of ${option.arity})`,
1071
- ...option.required ? { validate: requireNonEmpty } : {}
1072
- }));
1073
- return values;
1074
- }
1075
- return await input({
1076
- message: option.message,
1077
- default: option.default,
1078
- ...option.required ? { validate: requireNonEmpty } : {}
1079
- });
1080
- }
1081
- /**
1082
- * For each of `options` not already present in `argv`, resolves a value —
1083
- * `required` ones are always included, like required positionals, never
1084
- * behind a selector; everything else is offered through one `checkbox()`
1085
- * ("set any options?") and only the picked ones are then prompted in
1086
- * `options`' own declaration order. An empty list (or every optional one
1087
- * left unpicked) means zero prompts.
1088
- *
1089
- * A picked option (whether required or checkbox-picked) with
1090
- * `askLast: true` (holocron#1052 follow-up — a time-sensitive secret like
1091
- * an OTP, which should be typed as close as possible to when it's actually
1092
- * used, or one that's always needed for a specific operator's own account
1093
- * but not everyone's) isn't given a value here yet: it's returned in
1094
- * `deferred` instead, for the caller to resolve via
1095
- * `promptForDeferredOptions` right before the real (non-dry-run) spawn.
1096
- *
1097
- * `when`, evaluated against answers collected so far in that same
1098
- * declaration order, can skip a picked option entirely. Skipped this way,
1099
- * the option is simply absent from the result, exactly as if it had never
1100
- * been picked — acceptable for a minor, genuinely optional dependency, but
1101
- * prefer `OptionMode` (see `promptForOptions`) when the options have a
1102
- * real either/or relationship, so nothing contingent is shown at all.
1103
- */
1104
- async function promptForFlatOptions(commandName, options, argv) {
1105
- if (options.length === 0) return {
1106
- answers: {},
1107
- deferred: []
1108
- };
1109
- const answers = {};
1110
- const deferred = [];
1111
- const needsPrompt = (option) => {
1112
- const existing = argv[option.key];
1113
- return existing === void 0 || existing === "";
1114
- };
1115
- const required = options.filter((o) => o.required);
1116
- const optional = options.filter((o) => !o.required);
1117
- if ((required.some(needsPrompt) || optional.some(needsPrompt)) && !process.stdin.isTTY) throw new NonInteractiveError(`\`${commandName}\` has options only settable interactively — pass them directly: holocron ${commandName} [options]`);
1118
- for (const option of required) {
1119
- if (!needsPrompt(option)) {
1120
- answers[option.key] = argv[option.key];
1121
- continue;
1122
- }
1123
- if (option.askLast) {
1124
- deferred.push(option);
1125
- continue;
1126
- }
1127
- answers[option.key] = await promptOne(option);
1128
- }
1129
- for (const option of optional) if (!needsPrompt(option)) answers[option.key] = argv[option.key];
1130
- const selectable = optional.filter(needsPrompt);
1131
- if (selectable.length === 0) return {
1132
- answers,
1133
- deferred
1134
- };
1135
- const picked = await checkbox({
1136
- message: "Set any options? (space to select, enter to skip)",
1137
- choices: selectable.map((o) => ({
1138
- name: o.message,
1139
- value: o.key
1140
- }))
1141
- });
1142
- if (picked.length === 0) return {
1143
- answers,
1144
- deferred
1145
- };
1146
- const pickedSet = new Set(picked);
1147
- for (const option of optional) {
1148
- if (!pickedSet.has(option.key)) continue;
1149
- if (option.when && !option.when(answers)) continue;
1150
- if (option.askLast) {
1151
- deferred.push(option);
1152
- continue;
1153
- }
1154
- answers[option.key] = await promptOne(option);
1155
- }
1156
- return {
1157
- answers,
1158
- deferred
1159
- };
1160
- }
1161
- /**
1162
- * For a `modes`-based command (holocron#1052 follow-up): asks which
1163
- * mutually exclusive workflow first ("What would you like to do?"), then
1164
- * offers only that mode's own options, via the exact same
1165
- * `promptForFlatOptions` flow. The picked mode's `flag`, if it has one, is
1166
- * folded in as an already-resolved `confirm`-type option so
1167
- * `buildChildArgv` renders it with no special-casing — it just sees
1168
- * another boolean option whose answer happens to already be `true`.
1169
- */
1170
- async function promptForModes(entry, modes, argv) {
1171
- if (!process.stdin.isTTY) throw new NonInteractiveError(`\`${entry.name}\` has options only settable interactively — pass them directly: holocron ${entry.name} [options]`);
1172
- const modeKey = await select({
1173
- message: "What would you like to do?",
1174
- choices: modes.map((m) => ({
1175
- name: m.message,
1176
- value: m.key,
1177
- description: m.description
1178
- }))
1179
- });
1180
- const mode = modes.find((m) => m.key === modeKey);
1181
- const options = mode.options ?? [];
1182
- const { answers, deferred } = await promptForFlatOptions(entry.name, options, argv);
1183
- if (!mode.flag) return {
1184
- options,
1185
- answers,
1186
- deferred
1187
- };
1188
- const flagOption = {
1189
- key: `__mode_${mode.key}`,
1190
- flag: mode.flag,
1191
- type: "confirm",
1192
- message: mode.message
1193
- };
1194
- return {
1195
- options: [flagOption, ...options],
1196
- answers: {
1197
- [flagOption.key]: true,
1198
- ...answers
1199
- },
1200
- deferred
1201
- };
1202
- }
1203
- /**
1204
- * Resolves `entry`'s options into a {@link ResolvedOptions} ready for
1205
- * `buildChildArgv`/`secretEnv` — delegating to {@link promptForModes} when
1206
- * `entry.modes` is set, or treating `entry.options` as a flat list
1207
- * otherwise. See `promptForFlatOptions` for the flat-list prompting
1208
- * algorithm itself. `result.deferred` still needs
1209
- * {@link promptForDeferredOptions} before the real spawn.
1210
- */
1211
- async function promptForOptions(entry, argv) {
1212
- if (entry.modes && entry.modes.length > 0) return promptForModes(entry, entry.modes, argv);
1213
- const options = entry.options ?? [];
1214
- const { answers, deferred } = await promptForFlatOptions(entry.name, options, argv);
1215
- return {
1216
- options,
1217
- answers,
1218
- deferred
1219
- };
1220
- }
1221
- /**
1222
- * Collects a value for each of `deferred` — the `askLast: true` options
1223
- * `promptForOptions` deliberately left unresolved. Call this as the very
1224
- * last thing before the real (non-dry-run) spawn, never before: a dry-run
1225
- * preview never reaches the real npm call these options exist for (an OTP
1226
- * is never checked during `--dry-run`), and a time-sensitive code typed
1227
- * any earlier — before a dry-run preview runs, before "proceed with the
1228
- * real run?" waits on a human — risks going stale before it's actually
1229
- * used. A no-op (no prompt at all) when `deferred` is empty.
1230
- */
1231
- async function promptForDeferredOptions(deferred) {
1232
- const answers = {};
1233
- for (const option of deferred) answers[option.key] = await promptOne(option);
1234
- return answers;
1235
- }
1236
- /**
1237
- * For each of `entry.positionals` not already present in `argv`, prompts for
1238
- * it (`input()` or `select()`, per the positional's `type`) and returns the
1239
- * resolved values in positional order — ready to append to a spawned child's
1240
- * argv, or to use directly in the current handler (Layer 3).
1241
- *
1242
- * Throws {@link NonInteractiveError} the first time it would need to prompt
1243
- * on a non-TTY stdin, and again if a `select` positional's choices resolve
1244
- * empty (nothing to pick from — e.g. `auth unset` with no stored tokens).
1245
- */
1246
- async function promptForPositionals(entry, argv) {
1247
- const out = [];
1248
- for (const positional of entry.positionals) {
1249
- const existing = argv[positional.key];
1250
- if (existing !== void 0 && existing !== "") {
1251
- out.push(String(existing));
1252
- continue;
1253
- }
1254
- if (!process.stdin.isTTY) throw new NonInteractiveError(`\`${entry.name}\` needs "${positional.key}" — pass it directly: holocron ${entry.name} <${positional.cliArg ?? positional.key}>`);
1255
- if (positional.type === "select") {
1256
- const choices = typeof positional.choices === "function" ? positional.choices() : positional.choices ?? [];
1257
- if (choices.length === 0) throw new NonInteractiveError(`\`${entry.name}\`: no ${positional.key} to choose from — nothing stored yet`);
1258
- out.push(await select({
1259
- message: positional.message,
1260
- choices: choices.map((c) => ({ value: c }))
1261
- }));
1262
- } else out.push(await input({
1263
- message: positional.message,
1264
- ...positional.validate ? { validate: positional.validate } : {}
1265
- }));
1266
- }
1267
- return out;
279
+ function withProgress$1(label, fn) {
280
+ return withProgress(label, fn, retryNotice);
1268
281
  }
282
+ // src/ui/index.ts
283
+ var ui_exports = /* @__PURE__ */ __exportAll({
284
+ createProgress: () => createProgress$1,
285
+ withProgress: () => withProgress$1
286
+ });
287
+ import * as import__theholocron_kyber_prompts from "@theholocron/kyber/prompts";
288
+ __reExport(ui_exports, import__theholocron_kyber_prompts);
289
+ import * as import__theholocron_kyber_ui from "@theholocron/kyber/ui";
290
+ __reExport(ui_exports, import__theholocron_kyber_ui);
1269
291
  // src/observability/logger/logger.ts
1270
292
  /**
1271
293
  * Dataset for `global`-context commands (`clone`, `auth set`, `upgrade
@@ -1356,7 +378,7 @@ function resolveCliAxiom(opts) {
1356
378
  */
1357
379
  function buildCliLogger(argv, opts = {}) {
1358
380
  const { command, configLevel } = opts;
1359
- allowProgress(!argv.quiet && !argv.log);
381
+ (0, ui_exports.allowProgress)(!argv.quiet && !argv.log);
1360
382
  if (command) rootCommand = command;
1361
383
  const level = resolveLogLevel(argv, configLevel);
1362
384
  const consoleOutput = resolveConsoleOutput(argv);
@@ -1405,7 +427,7 @@ function getLogger() {
1405
427
  * the per-step reason belongs in the structured log alone.
1406
428
  */
1407
429
  function reportError(message, log = getLogger()) {
1408
- console.error(style.fail(message));
430
+ console.error(ui_exports.style.fail(message));
1409
431
  log.error(message);
1410
432
  }
1411
433
  /** The current root logger's correlation id, if a root has been built. */
@@ -2528,7 +1550,7 @@ function spawnChild(args, extraEnv) {
2528
1550
  */
2529
1551
  async function resolveForRealSpawn(resolved) {
2530
1552
  if (!resolved.deferred || resolved.deferred.length === 0) return resolved;
2531
- const deferredAnswers = await promptForDeferredOptions(resolved.deferred);
1553
+ const deferredAnswers = await (0, ui_exports.promptForDeferredOptions)(resolved.deferred);
2532
1554
  return {
2533
1555
  ...resolved,
2534
1556
  answers: {
@@ -2572,7 +1594,7 @@ function shouldPreviewDryRun(entry, parentArgv) {
2572
1594
  * left to make, since this one does mutate something.
2573
1595
  */
2574
1596
  async function launchMenu(entries, parentArgv, pickMessage, nonInteractiveMessage = "Run `holocron --help` to see available commands.", startPath = []) {
2575
- if (!process.stdin.isTTY) throw new NonInteractiveError(nonInteractiveMessage);
1597
+ if (!process.stdin.isTTY) throw new ui_exports.NonInteractiveError(nonInteractiveMessage);
2576
1598
  const stack = [startPath];
2577
1599
  let picked;
2578
1600
  while (!picked) {
@@ -2584,13 +1606,14 @@ async function launchMenu(entries, parentArgv, pickMessage, nonInteractiveMessag
2584
1606
  description: "Return to the previous menu",
2585
1607
  haystack: "back"
2586
1608
  });
2587
- const value = await pickMenuItem(items, stack.length === 1 ? pickMessage : `${path.join(" ")} — choose a subcommand:`);
1609
+ const message = stack.length === 1 ? pickMessage : `${path.join(" ")} — choose a subcommand:`;
1610
+ const value = await (0, ui_exports.pickMenuItem)(items, message);
2588
1611
  if (value === "back") stack.pop();
2589
1612
  else if (value.startsWith("group:")) stack.push(value.slice(6).split(" "));
2590
1613
  else picked = entries.find((e) => e.name === value);
2591
1614
  }
2592
- const positionals = await promptForPositionals(picked, {});
2593
- const resolvedOptions = await promptForOptions(picked, {});
1615
+ const positionals = await (0, ui_exports.promptForPositionals)(picked, {});
1616
+ const resolvedOptions = await (0, ui_exports.promptForOptions)(picked, {});
2594
1617
  const extraEnv = secretEnv(resolvedOptions);
2595
1618
  if (shouldPreviewDryRun(picked, parentArgv)) {
2596
1619
  const dryExit = await spawnChild(buildChildArgv(picked, positionals, resolvedOptions, parentArgv, true), {
@@ -2748,7 +1771,7 @@ async function launchGroupMenu(parent, argv) {
2748
1771
  await launchMenu(COMMAND_REGISTRY, argv, `${parent} — choose a subcommand:`, `Run \`holocron ${parent} --help\` to see available ${parent} subcommands.`, parent.split(" "));
2749
1772
  }
2750
1773
  /** The hidden `$0` of a command group: bare `holocron <group>` opens the menu at that group. */
2751
- const groupMenu = (parent) => groupMenu$1(parent, launchGroupMenu);
1774
+ const groupMenu$1 = (parent) => groupMenu(parent, launchGroupMenu);
2752
1775
  // src/cli-support/parse-scope/parse-scope.ts
2753
1776
  /** `--scope` / `--github-secret-scope`: `repo`, `env=<name>` or `org=<name>`. */
2754
1777
  function parseScope(s) {
@@ -2765,8 +1788,8 @@ function parseScope(s) {
2765
1788
  }
2766
1789
  // src/cli-support/token-context/token-context.ts
2767
1790
  /** Parses --token values and returns the context spread, or null on parse error (exits with code 1). */
2768
- function tokenContext(rawTokens) {
2769
- return tokenContext$1(rawTokens, reportError);
1791
+ function tokenContext$1(rawTokens) {
1792
+ return tokenContext(rawTokens, reportError);
2770
1793
  }
2771
1794
  // src/plugin/capabilities/capabilities.ts
2772
1795
  /** How many providers each capability resolves to: one (`"single"`) or several active at once (`"many"`). */
@@ -2809,6 +1832,8 @@ const CARDINALITY = {
2809
1832
  workers: "single",
2810
1833
  /** `tunnels` has exactly one provider. */
2811
1834
  tunnels: "single",
1835
+ /** `projects` has exactly one provider. */
1836
+ projects: "single",
2812
1837
  /** `credentials` can have several providers, tried in order. */
2813
1838
  credentials: "many"
2814
1839
  };
@@ -3542,12 +2567,12 @@ async function runAuthSet(input) {
3542
2567
  const isFeatureKey = provider.includes(".");
3543
2568
  const packageName = isFeatureKey ? null : resolvePluginPackage(provider);
3544
2569
  if (!token) {
3545
- print(style.fail(`no token supplied for \`${keyringKey}\`.`));
3546
- print(style.hint(` pass as positional arg: holocron auth set ${provider} <token>`));
2570
+ print(ui_exports.style.fail(`no token supplied for \`${keyringKey}\`.`));
2571
+ print(ui_exports.style.hint(` pass as positional arg: holocron auth set ${provider} <token>`));
3547
2572
  if (!isFeatureKey) {
3548
- print(style.hint(` or via env: HOLOCRON_${provider.toUpperCase()}_TOKEN / ${provider.toUpperCase()}_TOKEN`));
2573
+ print(ui_exports.style.hint(` or via env: HOLOCRON_${provider.toUpperCase()}_TOKEN / ${provider.toUpperCase()}_TOKEN`));
3549
2574
  const hint = await tryLoadHint(importer, packageName);
3550
- if (hint) print(style.hint(` hint: ${hint}`));
2575
+ if (hint) print(ui_exports.style.hint(` hint: ${hint}`));
3551
2576
  }
3552
2577
  logger.warn({
3553
2578
  provider,
@@ -3567,8 +2592,8 @@ async function runAuthSet(input) {
3567
2592
  if (typeof module.verifyToken === "function") {
3568
2593
  const verified = await module.verifyToken(token);
3569
2594
  if (!verified.ok) {
3570
- print(style.fail(`token rejected by ${provider}: ${verified.message}`));
3571
- if (module.AUTH_HINT) print(style.hint(` hint: ${module.AUTH_HINT}`));
2595
+ print(ui_exports.style.fail(`token rejected by ${provider}: ${verified.message}`));
2596
+ if (module.AUTH_HINT) print(ui_exports.style.hint(` hint: ${module.AUTH_HINT}`));
3572
2597
  logger.warn({
3573
2598
  provider,
3574
2599
  keyringKey,
@@ -3581,14 +2606,14 @@ async function runAuthSet(input) {
3581
2606
  };
3582
2607
  }
3583
2608
  subject = verified.subject;
3584
- } else print(style.warn(`${provider} plugin has no verifyToken; storing without verification`));
2609
+ } else print(ui_exports.style.warn(`${provider} plugin has no verifyToken; storing without verification`));
3585
2610
  } catch (err) {
3586
2611
  const msg = errorMessage(err);
3587
- print(style.warn(`cannot verify token — failed to load ${packageName}: ${msg}`));
3588
- print(style.hint(` storing token anyway; run 'holocron auth check ${provider}' once the plugin is installed`));
2612
+ print(ui_exports.style.warn(`cannot verify token — failed to load ${packageName}: ${msg}`));
2613
+ print(ui_exports.style.hint(` storing token anyway; run 'holocron auth check ${provider}' once the plugin is installed`));
3589
2614
  }
3590
2615
  if (!setToken(keyringKey, token)) {
3591
- print(style.fail(`keyring unavailable — token not stored. Use env vars instead.`));
2616
+ print(ui_exports.style.fail(`keyring unavailable — token not stored. Use env vars instead.`));
3592
2617
  logger.warn({
3593
2618
  provider,
3594
2619
  keyringKey,
@@ -3599,11 +2624,11 @@ async function runAuthSet(input) {
3599
2624
  message: "keyring unavailable"
3600
2625
  };
3601
2626
  }
3602
- print(style.success(`stored ${keyringKey} token${subject ? ` (${subject})` : ""}`));
2627
+ print(ui_exports.style.success(`stored ${keyringKey} token${subject ? ` (${subject})` : ""}`));
3603
2628
  if (input.credentials) {
3604
2629
  const { provider: from, environment } = input.credentials;
3605
2630
  const variable = credentialVariable(provider, keyringKey, listed);
3606
- print(style.hint(` ${from} cannot be written to from the CLI: add ${variable} to its "${environment}" environment yourself, so the token follows you to other machines`));
2631
+ print(ui_exports.style.hint(` ${from} cannot be written to from the CLI: add ${variable} to its "${environment}" environment yourself, so the token follows you to other machines`));
3607
2632
  }
3608
2633
  logger.info({
3609
2634
  provider,
@@ -3621,14 +2646,14 @@ function runAuthUnset(input) {
3621
2646
  const print = input.print ?? ((l) => console.log(l));
3622
2647
  const logger = input.logger ?? getLogger();
3623
2648
  if (deleteToken(input.provider)) {
3624
- print(style.success(`removed ${input.provider} token`));
2649
+ print(ui_exports.style.success(`removed ${input.provider} token`));
3625
2650
  logger.info({
3626
2651
  provider: input.provider,
3627
2652
  status: "ok"
3628
2653
  }, `auth unset: ${input.provider}`);
3629
2654
  return { status: "ok" };
3630
2655
  }
3631
- print(style.dim(`no stored token for ${input.provider}`));
2656
+ print(ui_exports.style.dim(`no stored token for ${input.provider}`));
3632
2657
  logger.info({
3633
2658
  provider: input.provider,
3634
2659
  status: "skip"
@@ -3646,7 +2671,7 @@ async function runAuthCheck(input) {
3646
2671
  const keyringKey = input.org ? `${provider}.${input.org}` : provider;
3647
2672
  const token = getToken(keyringKey);
3648
2673
  if (!token) {
3649
- print(style.dim(`no stored token for ${keyringKey}`));
2674
+ print(ui_exports.style.dim(`no stored token for ${keyringKey}`));
3650
2675
  logger.info({
3651
2676
  provider,
3652
2677
  keyringKey,
@@ -3659,7 +2684,7 @@ async function runAuthCheck(input) {
3659
2684
  };
3660
2685
  }
3661
2686
  if (provider.includes(".")) {
3662
- print(style.success(`${keyringKey}: token stored (feature key — no plugin verification)`));
2687
+ print(ui_exports.style.success(`${keyringKey}: token stored (feature key — no plugin verification)`));
3663
2688
  return {
3664
2689
  status: "ok",
3665
2690
  message: "stored"
@@ -3669,16 +2694,16 @@ async function runAuthCheck(input) {
3669
2694
  try {
3670
2695
  const module = await importer(packageName);
3671
2696
  if (typeof module.verifyToken !== "function") {
3672
- print(style.warn(`${keyringKey}: token stored (plugin has no verifyToken; can't confirm validity)`));
2697
+ print(ui_exports.style.warn(`${keyringKey}: token stored (plugin has no verifyToken; can't confirm validity)`));
3673
2698
  return {
3674
2699
  status: "ok",
3675
2700
  message: "stored, unverified"
3676
2701
  };
3677
2702
  }
3678
2703
  const verify = () => module.verifyToken(token);
3679
- const verified = input.showSpinner !== false ? await withSpinner(`Verifying ${keyringKey} token…`, verify) : await verify();
2704
+ const verified = input.showSpinner !== false ? await (0, ui_exports.withSpinner)(`Verifying ${keyringKey} token…`, verify) : await verify();
3680
2705
  if (verified.ok) {
3681
- print(style.success(`${keyringKey}: ok — ${verified.subject}`));
2706
+ print(ui_exports.style.success(`${keyringKey}: ok — ${verified.subject}`));
3682
2707
  logger.info({
3683
2708
  provider,
3684
2709
  keyringKey,
@@ -3691,8 +2716,8 @@ async function runAuthCheck(input) {
3691
2716
  message: verified.subject
3692
2717
  };
3693
2718
  }
3694
- print(style.fail(`${keyringKey}: rejected — ${verified.message}`));
3695
- if (module.AUTH_HINT) print(style.hint(` hint: ${module.AUTH_HINT}`));
2719
+ print(ui_exports.style.fail(`${keyringKey}: rejected — ${verified.message}`));
2720
+ if (module.AUTH_HINT) print(ui_exports.style.hint(` hint: ${module.AUTH_HINT}`));
3696
2721
  logger.warn({
3697
2722
  provider,
3698
2723
  keyringKey,
@@ -3707,7 +2732,7 @@ async function runAuthCheck(input) {
3707
2732
  } catch (err) {
3708
2733
  const msg = errorMessage(err);
3709
2734
  if (isModuleNotFound(err)) {
3710
- print(style.warn(`${keyringKey}: token present — verification skipped (plugin not available here)`));
2735
+ print(ui_exports.style.warn(`${keyringKey}: token present — verification skipped (plugin not available here)`));
3711
2736
  logger.info({
3712
2737
  provider,
3713
2738
  keyringKey,
@@ -3719,7 +2744,7 @@ async function runAuthCheck(input) {
3719
2744
  message: "stored, unverified (plugin not available)"
3720
2745
  };
3721
2746
  }
3722
- print(style.fail(`${keyringKey}: cannot verify — ${msg}`));
2747
+ print(ui_exports.style.fail(`${keyringKey}: cannot verify — ${msg}`));
3723
2748
  logger.warn({
3724
2749
  provider,
3725
2750
  keyringKey,
@@ -3738,8 +2763,8 @@ async function runAuthList(input = {}) {
3738
2763
  const importer = input.importer ?? defaultImporter;
3739
2764
  const providers = listStoredProviders();
3740
2765
  if (providers.length === 0) {
3741
- print(style.dim("no stored tokens."));
3742
- print(style.hint("run: holocron auth set <provider> <token>"));
2766
+ print(ui_exports.style.dim("no stored tokens."));
2767
+ print(ui_exports.style.hint("run: holocron auth set <provider> <token>"));
3743
2768
  logger.info({ providers: 0 }, "auth list: done");
3744
2769
  return {
3745
2770
  status: "ok",
@@ -3759,11 +2784,11 @@ async function runAuthList(input = {}) {
3759
2784
  const label = `${provider}${check.message ? ` — ${check.message}` : ""}`;
3760
2785
  if (check.status === "ok") {
3761
2786
  ok += 1;
3762
- print(` ${style.success(label)}`);
2787
+ print(` ${ui_exports.style.success(label)}`);
3763
2788
  } else if (check.status === "fail") {
3764
2789
  fail += 1;
3765
- print(` ${style.fail(label)}`);
3766
- } else print(` ${style.dim(`· ${label}`)}`);
2790
+ print(` ${ui_exports.style.fail(label)}`);
2791
+ } else print(` ${ui_exports.style.dim(`· ${label}`)}`);
3767
2792
  }
3768
2793
  logger.info({
3769
2794
  providers: providers.length,
@@ -3807,7 +2832,7 @@ function declaredVsActual(declared, actual, options) {
3807
2832
  function printCheckRows(rows, print) {
3808
2833
  const width = Math.max(0, ...rows.map((row) => row.title.length));
3809
2834
  for (const row of rows) {
3810
- print(statusRow(row.status, [row.title.padEnd(width), row.detail]));
2835
+ print((0, ui_exports.statusRow)(row.status, [row.title.padEnd(width), row.detail]));
3811
2836
  for (const problem of row.problems) print(` - ${problem}`);
3812
2837
  }
3813
2838
  }
@@ -3815,7 +2840,7 @@ function printCheckRows(rows, print) {
3815
2840
  /** A blank line, then the closing `N ok, N fail, N skipped`. */
3816
2841
  function printCheckSummary(summary, print) {
3817
2842
  print("");
3818
- print(style.header(`${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`));
2843
+ print(ui_exports.style.header(`${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`));
3819
2844
  }
3820
2845
  // src/commands/doctor-checks/summarise-checks.ts
3821
2846
  /** How many rows ended each way. */
@@ -3935,7 +2960,7 @@ const doctorTokensCommand = {
3935
2960
  command: "tokens",
3936
2961
  describe: "Check that each token a configured plugin takes is set and still accepted (read-only; no token is printed)",
3937
2962
  handler: async (argv) => {
3938
- const tokens = tokenContext(argv.token);
2963
+ const tokens = tokenContext$1(argv.token);
3939
2964
  if (!tokens) return;
3940
2965
  const loaded = await loadConfig(argv.cwd);
3941
2966
  applyResolvedConfig(argv, loaded.resolved);
@@ -3971,7 +2996,7 @@ async function finishCredentialsFile(input) {
3971
2996
  }
3972
2997
  const cleanup = () => {
3973
2998
  try {
3974
- const outcome = (input.shred ?? shredFile)(path, identity);
2999
+ const outcome = (input.shred ?? auth_exports.shredFile)(path, identity);
3975
3000
  if (outcome === "deleted") print(`deleted ${path}`);
3976
3001
  else if (outcome === "missing") print(`${path} was already gone`);
3977
3002
  else print(`left ${path} alone: it is no longer the file this command wrote`);
@@ -3992,7 +3017,7 @@ async function finishCredentialsFile(input) {
3992
3017
  });
3993
3018
  let cleaned;
3994
3019
  try {
3995
- await (input.waitForImport ?? waitForEnter)("press Enter when the import is done and the file will be deleted: ");
3020
+ await (input.waitForImport ?? ui_exports.waitForEnter)("press Enter when the import is done and the file will be deleted: ");
3996
3021
  } finally {
3997
3022
  for (const [signal, handler] of handlers) process.off(signal, handler);
3998
3023
  cleaned = cleanup();
@@ -4123,7 +3148,7 @@ async function runAuthExport(input) {
4123
3148
  } else missing.push(name);
4124
3149
  continue;
4125
3150
  }
4126
- const line = dotenvLine(written, value);
3151
+ const line = (0, auth_exports.dotenvLine)(written, value);
4127
3152
  if (line === null) {
4128
3153
  unsupported.push(written);
4129
3154
  continue;
@@ -4137,7 +3162,7 @@ async function runAuthExport(input) {
4137
3162
  }
4138
3163
  const taken = new Set(entries.map((e) => e.name));
4139
3164
  for (const [name, value] of literals) {
4140
- const line = dotenvLine(name, value);
3165
+ const line = (0, auth_exports.dotenvLine)(name, value);
4141
3166
  if (taken.has(name)) continue;
4142
3167
  if (line === null) {
4143
3168
  unsupported.push(name);
@@ -4172,7 +3197,7 @@ async function runAuthExport(input) {
4172
3197
  if (target === "clipboard") {
4173
3198
  try {
4174
3199
  const pasted = input.only?.length && lines.length === 1 && exported.length === 1 ? values.get(exported[0]) : text;
4175
- await (input.copy ?? copyToClipboard)(pasted);
3200
+ await (input.copy ?? auth_exports.copyToClipboard)(pasted);
4176
3201
  } catch (err) {
4177
3202
  return refuse("clipboard", `could not copy to the clipboard: ${errorMessage(err)}`, "write the private file instead: `holocron auth export --file`");
4178
3203
  }
@@ -4180,10 +3205,10 @@ async function runAuthExport(input) {
4180
3205
  } else if (target === "file") {
4181
3206
  if ((input.platform ?? process.platform) === "win32") return refuse("windows", "cannot make the file private on Windows: its mode bits are not enforced, so other users may read it", "use `holocron auth export --copy`, or pipe the output to a tool");
4182
3207
  file = resolve(dirname(input.loaded.filepath), input.file || DEFAULT_FILE$1);
4183
- const git = (input.isIgnored ?? isGitIgnored)(file);
3208
+ const git = (input.isIgnored ?? auth_exports.isGitIgnored)(file);
4184
3209
  if (git === "tracked" || git === "unknown") return refuse("not-ignored", git === "tracked" ? `refusing to write tokens to ${file}: git does not ignore it, so it could be committed` : `refusing to write tokens to ${file}: git could not say whether it ignores it`, "add it to .gitignore, or choose a path outside the repository with --file");
4185
3210
  try {
4186
- identity = (input.writeFile ?? writeCredentialsFile)(file, text, input.force === true);
3211
+ identity = (input.writeFile ?? auth_exports.writeCredentialsFile)(file, text, input.force === true);
4187
3212
  } catch (err) {
4188
3213
  return refuse("write", `could not write ${file}: ${errorMessage(err)}`, "an existing file is never overwritten: delete it, or pass --force to replace it");
4189
3214
  }
@@ -4194,15 +3219,15 @@ async function runAuthExport(input) {
4194
3219
  }
4195
3220
  }
4196
3221
  print(`exported ${exported.length} of ${tokens.size + literals.size + placeholders.length}:`);
4197
- for (const name of exported) print(` ${style.success(name)}`);
4198
- for (const name of blank) print(` ${style.dim("·")} ${name}${style.dim(" (written empty: fill it in)")}`);
4199
- for (const name of missing) print(` ${style.dim("·")} ${name}${tokens.get(name)?.optional ? style.dim(" (optional)") : ""}`);
4200
- for (const name of [...conflicts].sort(compare$1)) print(` ${style.fail(`${name} (listed by two plugins under different keyring entries, so not exported)`)}`);
4201
- for (const name of unsupported) print(` ${style.fail(`${name} (a value dotenv cannot carry unchanged, so add it by hand)`)}`);
3222
+ for (const name of exported) print(` ${ui_exports.style.success(name)}`);
3223
+ for (const name of blank) print(` ${ui_exports.style.dim("·")} ${name}${ui_exports.style.dim(" (written empty: fill it in)")}`);
3224
+ for (const name of missing) print(` ${ui_exports.style.dim("·")} ${name}${tokens.get(name)?.optional ? ui_exports.style.dim(" (optional)") : ""}`);
3225
+ for (const name of [...conflicts].sort(compare$1)) print(` ${ui_exports.style.fail(`${name} (listed by two plugins under different keyring entries, so not exported)`)}`);
3226
+ for (const name of unsupported) print(` ${ui_exports.style.fail(`${name} (a value dotenv cannot carry unchanged, so add it by hand)`)}`);
4202
3227
  if (unavailable.length > 0) {
4203
3228
  print("");
4204
3229
  print("could not load, so the tokens they take are not listed:");
4205
- for (const pkg of [...unavailable].sort(compare$1)) print(` ${style.fail(`${pkg} (${reasons.get(pkg)})`)}`);
3230
+ for (const pkg of [...unavailable].sort(compare$1)) print(` ${ui_exports.style.fail(`${pkg} (${reasons.get(pkg)})`)}`);
4206
3231
  }
4207
3232
  if (destination === "clipboard" || destination === "file") print("");
4208
3233
  if (destination === "clipboard") print("copied to the clipboard: paste it, then clear the clipboard");
@@ -4311,7 +3336,7 @@ const authCheckCommand = {
4311
3336
  describe: "Re-verify a stored bootstrap token",
4312
3337
  builder: authCheckArgs,
4313
3338
  handler: async (argv) => {
4314
- const [provider] = await promptForPositionals(getEntry("auth check"), argv);
3339
+ const [provider] = await (0, ui_exports.promptForPositionals)(getEntry("auth check"), argv);
4315
3340
  if ((await runAuthCheck({
4316
3341
  provider,
4317
3342
  ...argv.org ? { org: argv.org } : {}
@@ -4352,7 +3377,7 @@ const authSetCommand = {
4352
3377
  describe: "Verify + store a bootstrap token for a provider",
4353
3378
  builder: authSetArgs,
4354
3379
  handler: async (argv) => {
4355
- const [provider] = await promptForPositionals(getEntry("auth set"), argv);
3380
+ const [provider] = await (0, ui_exports.promptForPositionals)(getEntry("auth set"), argv);
4356
3381
  const credentials = await credentialsOf(argv.cwd);
4357
3382
  if ((await runAuthSet({
4358
3383
  provider,
@@ -4370,7 +3395,7 @@ const authUnsetCommand = {
4370
3395
  describe: "Remove a stored bootstrap token",
4371
3396
  builder: authUnsetArgs,
4372
3397
  handler: async (argv) => {
4373
- const [provider] = await promptForPositionals(getEntry("auth unset"), argv);
3398
+ const [provider] = await (0, ui_exports.promptForPositionals)(getEntry("auth unset"), argv);
4374
3399
  runAuthUnset({ provider });
4375
3400
  }
4376
3401
  };
@@ -4378,7 +3403,7 @@ const authUnsetCommand = {
4378
3403
  const authCommand = {
4379
3404
  command: "auth <subcommand>",
4380
3405
  describe: "Manage bootstrap credentials in the OS keyring",
4381
- builder: (y) => y.command(authSetCommand).command(authUnsetCommand).command(authCheckCommand).command(authListCommand).command(authExportCommand).command(groupMenu("auth")),
3406
+ builder: (y) => y.command(authSetCommand).command(authUnsetCommand).command(authCheckCommand).command(authListCommand).command(authExportCommand).command(groupMenu$1("auth")),
4382
3407
  handler: () => {}
4383
3408
  };
4384
3409
  // src/commands/clone/clone.args.ts
@@ -4464,7 +3489,7 @@ async function runClone(input) {
4464
3489
  });
4465
3490
  print("");
4466
3491
  if (!existsSync(targetDir)) {
4467
- if (dryRun) print(style.dim(` would create ${targetDir}`));
3492
+ if (dryRun) print(ui_exports.style.dim(` would create ${targetDir}`));
4468
3493
  else mkdirSync(targetDir, { recursive: true });
4469
3494
  }
4470
3495
  let repos;
@@ -4493,7 +3518,7 @@ async function runClone(input) {
4493
3518
  toClone: repos.length - alreadyCloned
4494
3519
  };
4495
3520
  if (!await input.confirmWholeOrg(scope)) {
4496
- print(style.dim(" aborted — nothing cloned"));
3521
+ print(ui_exports.style.dim(" aborted — nothing cloned"));
4497
3522
  logger.info({
4498
3523
  org: input.org,
4499
3524
  ...scope
@@ -4513,7 +3538,7 @@ async function runClone(input) {
4513
3538
  for (const repo of repos) {
4514
3539
  const dest = join(targetDir, repoDirName(repo));
4515
3540
  if (existsSync(dest)) {
4516
- print(statusRow("skip", [
3541
+ print((0, ui_exports.statusRow)("skip", [
4517
3542
  repo.full_name,
4518
3543
  dest,
4519
3544
  "already exists"
@@ -4522,14 +3547,14 @@ async function runClone(input) {
4522
3547
  continue;
4523
3548
  }
4524
3549
  if (dryRun) {
4525
- print(style.dim(` would clone ${repo.full_name} → ${dest}`));
3550
+ print(ui_exports.style.dim(` would clone ${repo.full_name} → ${dest}`));
4526
3551
  cloned++;
4527
3552
  continue;
4528
3553
  }
4529
- print(style.step(` clone ${repo.full_name} → ${dest}`));
3554
+ print(ui_exports.style.step(` clone ${repo.full_name} → ${dest}`));
4530
3555
  const { clone_url } = repo;
4531
3556
  if (!clone_url.startsWith("https://github.com/")) {
4532
- print(statusRow("fail", [
3557
+ print((0, ui_exports.statusRow)("fail", [
4533
3558
  repo.full_name,
4534
3559
  dest,
4535
3560
  `unexpected clone URL: ${clone_url}`
@@ -4541,7 +3566,7 @@ async function runClone(input) {
4541
3566
  try {
4542
3567
  encodedToken = encodeTokenForGitHttpAuth(input.token);
4543
3568
  } catch (err) {
4544
- print(statusRow("fail", [
3569
+ print((0, ui_exports.statusRow)("fail", [
4545
3570
  repo.full_name,
4546
3571
  dest,
4547
3572
  `invalid token format: ${errorMessage(err)}`
@@ -4555,16 +3580,16 @@ async function runClone(input) {
4555
3580
  `https://x-access-token:${encodedToken}@github.com/${clone_url.slice(19)}`,
4556
3581
  dest
4557
3582
  ], { cwd: targetDir }).status !== 0) {
4558
- print(statusRow("fail", [repo.full_name, dest]));
3583
+ print((0, ui_exports.statusRow)("fail", [repo.full_name, dest]));
4559
3584
  failed++;
4560
3585
  } else {
4561
- print(statusRow("ok", [repo.full_name, dest]));
3586
+ print((0, ui_exports.statusRow)("ok", [repo.full_name, dest]));
4562
3587
  cloned++;
4563
3588
  }
4564
3589
  }
4565
3590
  const summary = `${cloned} cloned, ${failed} failed, ${skipped} skipped`;
4566
3591
  print("");
4567
- print(dryRun ? style.dim(` dry-run: ${summary}`) : failed > 0 ? style.fail(` ${summary}`) : style.success(` ${summary}`));
3592
+ print(dryRun ? ui_exports.style.dim(` dry-run: ${summary}`) : failed > 0 ? ui_exports.style.fail(` ${summary}`) : ui_exports.style.success(` ${summary}`));
4568
3593
  const status = dryRun ? "dry-run" : failed > 0 ? "fail" : "ok";
4569
3594
  logger[failed > 0 ? "warn" : "info"]({
4570
3595
  org: input.org,
@@ -4595,7 +3620,7 @@ const cloneCommand = {
4595
3620
  describe: "Clone a single repo (org/repo) or every repo in an org (org)",
4596
3621
  builder: cloneArgs,
4597
3622
  handler: async (argv) => {
4598
- const tokens = tokenContext(argv.token);
3623
+ const tokens = tokenContext$1(argv.token);
4599
3624
  if (!tokens) return;
4600
3625
  let token;
4601
3626
  try {
@@ -4605,7 +3630,7 @@ const cloneCommand = {
4605
3630
  process.exitCode = 1;
4606
3631
  return;
4607
3632
  }
4608
- const [targetInput] = await promptForPositionals(getEntry("clone"), argv);
3633
+ const [targetInput] = await (0, ui_exports.promptForPositionals)(getEntry("clone"), argv);
4609
3634
  const { org, repo } = parseCloneTarget(targetInput);
4610
3635
  const report = await runClone({
4611
3636
  org,
@@ -4614,7 +3639,7 @@ const cloneCommand = {
4614
3639
  dryRun: argv.dryRun,
4615
3640
  ...argv.dir ? { dir: argv.dir } : {},
4616
3641
  ...!repo ? { confirmWholeOrg: async ({ total, alreadyCloned, toClone }) => {
4617
- if (!process.stdin.isTTY) throw new NonInteractiveError(`clone: cloning every repo in "${org}" needs interactive confirmation — run this from a terminal, or pass a specific org/repo instead`);
3642
+ if (!process.stdin.isTTY) throw new ui_exports.NonInteractiveError(`clone: cloning every repo in "${org}" needs interactive confirmation — run this from a terminal, or pass a specific org/repo instead`);
4618
3643
  if (toClone === 0) return true;
4619
3644
  return confirm({
4620
3645
  message: `${org} has ${total} repos — ${alreadyCloned} already cloned locally, ${toClone} new. Clone them all?`,
@@ -4627,7 +3652,7 @@ const cloneCommand = {
4627
3652
  if (await confirm({
4628
3653
  message: `Open ${openTarget}?`,
4629
3654
  default: false
4630
- })) openPath(openTarget);
3655
+ })) (0, ui_exports.openPath)(openTarget);
4631
3656
  }
4632
3657
  });
4633
3658
  if (report.status === "fail") {
@@ -4650,7 +3675,8 @@ const configShowCommand = {
4650
3675
  describe: "Print the resolved holocron config",
4651
3676
  builder: configShowArgs,
4652
3677
  handler: async (argv) => {
4653
- await viewJson((await loadConfig(argv.cwd)).resolved, {
3678
+ const loaded = await loadConfig(argv.cwd);
3679
+ await (0, ui_exports.viewJson)(loaded.resolved, {
4654
3680
  depth: argv.depth,
4655
3681
  interactive: argv.interactive
4656
3682
  });
@@ -4670,9 +3696,9 @@ const cleanupPreviewArgs = (y) => y.positional("pr", {
4670
3696
  });
4671
3697
  // src/commands/cleanup-preview/cleanup-preview.ts
4672
3698
  function prStateLabel(pr) {
4673
- if (pr.merged) return style.success("merged");
4674
- if (pr.state === "closed") return style.dim("closed (not merged)");
4675
- return style.warn("open");
3699
+ if (pr.merged) return ui_exports.style.success("merged");
3700
+ if (pr.state === "closed") return ui_exports.style.dim("closed (not merged)");
3701
+ return ui_exports.style.warn("open");
4676
3702
  }
4677
3703
  async function runCleanupPreview(input) {
4678
3704
  const print = input.print ?? ((line) => console.log(line));
@@ -4697,10 +3723,10 @@ async function runCleanupPreview(input) {
4697
3723
  }
4698
3724
  const branch = `${(input.repo ?? input.loaded.resolved.repo?.name ?? "").split("/").pop()}-pr-${pr.number}`;
4699
3725
  print("");
4700
- print(`${style.header(`PR #${pr.number}`)} — ${pr.title}`);
4701
- print(` Status : ${prStateLabel(pr)} | Branch : ${style.dim(pr.branch)}`);
4702
- print(` URL : ${style.dim(pr.url)}`);
4703
- print(` CF alias : ${style.dim(branch)}`);
3726
+ print(`${ui_exports.style.header(`PR #${pr.number}`)} — ${pr.title}`);
3727
+ print(` Status : ${prStateLabel(pr)} | Branch : ${ui_exports.style.dim(pr.branch)}`);
3728
+ print(` URL : ${ui_exports.style.dim(pr.url)}`);
3729
+ print(` CF alias : ${ui_exports.style.dim(branch)}`);
4704
3730
  print("");
4705
3731
  if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a deployment provider to holocron.config.json");
4706
3732
  const deploy = loader.get("deployment");
@@ -4713,7 +3739,7 @@ async function runCleanupPreview(input) {
4713
3739
  throw new Error(`Failed to list deployments: ${message}`, { cause: err });
4714
3740
  }
4715
3741
  if (deployments.length === 0) {
4716
- print(style.dim(`No deployments found for branch ${branch}.`));
3742
+ print(ui_exports.style.dim(`No deployments found for branch ${branch}.`));
4717
3743
  logger.info({
4718
3744
  pr: pr.number,
4719
3745
  branch,
@@ -4729,16 +3755,16 @@ async function runCleanupPreview(input) {
4729
3755
  status: "none"
4730
3756
  };
4731
3757
  }
4732
- print(`Found ${deployments.length} deployment${deployments.length === 1 ? "" : "s"} for ${style.dim(branch)}:`);
3758
+ print(`Found ${deployments.length} deployment${deployments.length === 1 ? "" : "s"} for ${ui_exports.style.dim(branch)}:`);
4733
3759
  print("");
4734
3760
  if (pr.state === "open") {
4735
- print(style.warn(`PR #${pr.number} is still open. Deleting its preview deployments will break the live preview link.`));
4736
- print(style.warn("Nothing is pre-selected — check the deployments you want to remove."));
3761
+ print(ui_exports.style.warn(`PR #${pr.number} is still open. Deleting its preview deployments will break the live preview link.`));
3762
+ print(ui_exports.style.warn("Nothing is pre-selected — check the deployments you want to remove."));
4737
3763
  print("");
4738
3764
  }
4739
3765
  const choices = deployments.map((d) => {
4740
3766
  return {
4741
- name: `${d.id.includes(":") ? d.id.split(":").pop() : d.id} ${d.createdAt ? style.dim(d.createdAt.slice(0, 10)) : ""} ${style.dim(d.url)}`,
3767
+ name: `${d.id.includes(":") ? d.id.split(":").pop() : d.id} ${d.createdAt ? ui_exports.style.dim(d.createdAt.slice(0, 10)) : ""} ${ui_exports.style.dim(d.url)}`,
4742
3768
  value: d.id,
4743
3769
  checked: pr.state !== "open"
4744
3770
  };
@@ -4750,7 +3776,7 @@ async function runCleanupPreview(input) {
4750
3776
  choices
4751
3777
  });
4752
3778
  } catch {
4753
- print(style.dim("Aborted."));
3779
+ print(ui_exports.style.dim("Aborted."));
4754
3780
  return {
4755
3781
  pr,
4756
3782
  branch,
@@ -4760,7 +3786,7 @@ async function runCleanupPreview(input) {
4760
3786
  };
4761
3787
  }
4762
3788
  if (selected.length === 0) {
4763
- print(style.dim("Nothing selected — no deployments deleted."));
3789
+ print(ui_exports.style.dim("Nothing selected — no deployments deleted."));
4764
3790
  return {
4765
3791
  pr,
4766
3792
  branch,
@@ -4772,7 +3798,7 @@ async function runCleanupPreview(input) {
4772
3798
  print("");
4773
3799
  try {
4774
3800
  const count = await deploy.deletePreviewDeployments(input.project, selected);
4775
- print(style.success(`Deleted ${count} deployment${count === 1 ? "" : "s"}.`));
3801
+ print(ui_exports.style.success(`Deleted ${count} deployment${count === 1 ? "" : "s"}.`));
4776
3802
  logger.info({
4777
3803
  pr: pr.number,
4778
3804
  branch,
@@ -4789,7 +3815,7 @@ async function runCleanupPreview(input) {
4789
3815
  };
4790
3816
  } catch (err) {
4791
3817
  const message = errorMessage(err);
4792
- print(style.fail(message));
3818
+ print(ui_exports.style.fail(message));
4793
3819
  logger.warn({
4794
3820
  pr: pr.number,
4795
3821
  branch,
@@ -4813,9 +3839,9 @@ const cleanupPreviewCommand = {
4813
3839
  describe: "List and delete Cloudflare Pages preview deployments for a GitHub PR",
4814
3840
  builder: cleanupPreviewArgs,
4815
3841
  handler: async (argv) => {
4816
- const tokens = tokenContext(argv.token);
3842
+ const tokens = tokenContext$1(argv.token);
4817
3843
  if (!tokens) return;
4818
- const [pr] = await promptForPositionals(getEntry("deploy cleanup-preview"), argv);
3844
+ const [pr] = await (0, ui_exports.promptForPositionals)(getEntry("deploy cleanup-preview"), argv);
4819
3845
  const loaded = await loadConfig(argv.cwd);
4820
3846
  applyResolvedConfig(argv, loaded.resolved);
4821
3847
  if ((await runCleanupPreview({
@@ -5137,12 +4163,12 @@ async function runDeploy(input) {
5137
4163
  projectId: input.projectId,
5138
4164
  dryRun: dryRun || void 0
5139
4165
  }, "deploy: start");
5140
- print(style.header(`Holocron deploy — branch=${input.branch}${input.target ? `, target=${input.target}` : " (preview)"}${dryRun ? " (dry-run)" : ""}`));
4166
+ print(ui_exports.style.header(`Holocron deploy — branch=${input.branch}${input.target ? `, target=${input.target}` : " (preview)"}${dryRun ? " (dry-run)" : ""}`));
5141
4167
  if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a `deployment` provider to holocron.config.json");
5142
4168
  const deploy = loader.get("deployment");
5143
4169
  if (dryRun) {
5144
4170
  const message = `would: ${deploy.providerName}.triggerDeployment(projectId=${input.projectId}, branch=${input.branch}${input.target ? `, target=${input.target}` : ""})`;
5145
- print(` ${style.dim(`… ${message}`)}`);
4171
+ print(` ${ui_exports.style.dim(`… ${message}`)}`);
5146
4172
  return {
5147
4173
  deployment: null,
5148
4174
  status: "dry-run",
@@ -5150,7 +4176,7 @@ async function runDeploy(input) {
5150
4176
  };
5151
4177
  }
5152
4178
  try {
5153
- const triggered = await withSpinner(`Deploying ${input.branch}${input.target ? ` → ${input.target}` : ""}…`, () => deploy.triggerDeployment({
4179
+ const triggered = await (0, ui_exports.withSpinner)(`Deploying ${input.branch}${input.target ? ` → ${input.target}` : ""}…`, () => deploy.triggerDeployment({
5154
4180
  projectId: input.projectId,
5155
4181
  branch: input.branch,
5156
4182
  ...input.target ? { target: input.target } : {}
@@ -5160,10 +4186,10 @@ async function runDeploy(input) {
5160
4186
  url: triggered.url,
5161
4187
  id: triggered.id
5162
4188
  }, "deploy: triggered");
5163
- const record = TERMINAL_STATUSES.has(triggered.status) ? triggered : await withSpinner(`Waiting for ${withScheme(triggered.url)} to finish…`, () => waitForDeployment(deploy, triggered.id, input.wait));
4189
+ const record = TERMINAL_STATUSES.has(triggered.status) ? triggered : await (0, ui_exports.withSpinner)(`Waiting for ${withScheme(triggered.url)} to finish…`, () => waitForDeployment(deploy, triggered.id, input.wait));
5164
4190
  if (record.status !== "ready") {
5165
4191
  const message = terminalFailure(record);
5166
- print(` ${style.fail(`${message} — ${withScheme(triggered.url)}`)}`);
4192
+ print(` ${ui_exports.style.fail(`${message} — ${withScheme(triggered.url)}`)}`);
5167
4193
  logger.warn({
5168
4194
  id: record.id,
5169
4195
  status: record.status,
@@ -5175,7 +4201,7 @@ async function runDeploy(input) {
5175
4201
  message
5176
4202
  };
5177
4203
  }
5178
- print(` ${style.success(`${record.status} — ${withScheme(triggered.url)}`)}`);
4204
+ print(` ${ui_exports.style.success(`${record.status} — ${withScheme(triggered.url)}`)}`);
5179
4205
  logger.info({
5180
4206
  status: record.status,
5181
4207
  url: triggered.url,
@@ -5187,7 +4213,7 @@ async function runDeploy(input) {
5187
4213
  };
5188
4214
  } catch (err) {
5189
4215
  const message = errorMessage(err);
5190
- print(` ${style.fail(message)}`);
4216
+ print(` ${ui_exports.style.fail(message)}`);
5191
4217
  logger.warn({
5192
4218
  branch: input.branch,
5193
4219
  reason: message
@@ -5228,13 +4254,13 @@ async function runDeployFromFiles(input) {
5228
4254
  projectId: input.projectId,
5229
4255
  dryRun: dryRun || void 0
5230
4256
  }, "deploy: start (files)");
5231
- print(style.header(`Holocron deploy — files=${input.dir} (${fileCount} file${fileCount === 1 ? "" : "s"})${input.target ? `, target=${input.target}` : " (preview)"}${dryRun ? " (dry-run)" : ""}`));
4257
+ print(ui_exports.style.header(`Holocron deploy — files=${input.dir} (${fileCount} file${fileCount === 1 ? "" : "s"})${input.target ? `, target=${input.target}` : " (preview)"}${dryRun ? " (dry-run)" : ""}`));
5232
4258
  if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a `deployment` provider to holocron.config.json");
5233
4259
  const deploy = loader.get("deployment");
5234
4260
  if (!deploy.deployFunction) throw new Error(`deployment provider "${deploy.providerName}" does not support deploying from files — deployFunction() is not implemented`);
5235
4261
  if (dryRun) {
5236
4262
  const message = `would: ${deploy.providerName}.deployFunction(projectId=${input.projectId}, files=${fileCount}${input.target ? `, target=${input.target}` : ""})`;
5237
- print(` ${style.dim(`… ${message}`)}`);
4263
+ print(` ${ui_exports.style.dim(`… ${message}`)}`);
5238
4264
  return {
5239
4265
  deployment: null,
5240
4266
  status: "dry-run",
@@ -5242,7 +4268,7 @@ async function runDeployFromFiles(input) {
5242
4268
  };
5243
4269
  }
5244
4270
  try {
5245
- const result = await withSpinner(`Deploying ${fileCount} file${fileCount === 1 ? "" : "s"} from ${input.dir}…`, () => deploy.deployFunction(input.projectId, {
4271
+ const result = await (0, ui_exports.withSpinner)(`Deploying ${fileCount} file${fileCount === 1 ? "" : "s"} from ${input.dir}…`, () => deploy.deployFunction(input.projectId, {
5246
4272
  files,
5247
4273
  ...input.target ? { target: input.target } : {}
5248
4274
  }));
@@ -5250,10 +4276,10 @@ async function runDeployFromFiles(input) {
5250
4276
  url: result.url,
5251
4277
  id: result.deploymentId
5252
4278
  }, "deploy: triggered (files)");
5253
- const record = await withSpinner(`Waiting for ${withScheme(result.url)} to finish…`, () => waitForDeployment(deploy, result.deploymentId, input.wait));
4279
+ const record = await (0, ui_exports.withSpinner)(`Waiting for ${withScheme(result.url)} to finish…`, () => waitForDeployment(deploy, result.deploymentId, input.wait));
5254
4280
  if (record.status !== "ready") {
5255
4281
  const message = terminalFailure(record);
5256
- print(` ${style.fail(`${message} — ${withScheme(result.url)}`)}`);
4282
+ print(` ${ui_exports.style.fail(`${message} — ${withScheme(result.url)}`)}`);
5257
4283
  logger.warn({
5258
4284
  id: record.id,
5259
4285
  status: record.status,
@@ -5265,7 +4291,7 @@ async function runDeployFromFiles(input) {
5265
4291
  message
5266
4292
  };
5267
4293
  }
5268
- print(` ${style.success(withScheme(result.url))}`);
4294
+ print(` ${ui_exports.style.success(withScheme(result.url))}`);
5269
4295
  logger.info({
5270
4296
  url: result.url,
5271
4297
  id: result.deploymentId
@@ -5276,7 +4302,7 @@ async function runDeployFromFiles(input) {
5276
4302
  };
5277
4303
  } catch (err) {
5278
4304
  const message = errorMessage(err);
5279
- print(` ${style.fail(message)}`);
4305
+ print(` ${ui_exports.style.fail(message)}`);
5280
4306
  logger.warn({
5281
4307
  dir: input.dir,
5282
4308
  reason: message
@@ -5299,7 +4325,7 @@ const deployCommand = {
5299
4325
  process.exitCode = 1;
5300
4326
  return;
5301
4327
  }
5302
- const tokens = tokenContext(argv.token);
4328
+ const tokens = tokenContext$1(argv.token);
5303
4329
  if (!tokens) return;
5304
4330
  const loaded = await loadConfig(argv.cwd);
5305
4331
  applyResolvedConfig(argv, loaded.resolved);
@@ -5319,7 +4345,7 @@ const deployCommand = {
5319
4345
  })).status === "fail") process.exitCode = 1;
5320
4346
  return;
5321
4347
  }
5322
- const [branch] = await promptForPositionals(getEntry("deploy"), argv);
4348
+ const [branch] = await (0, ui_exports.promptForPositionals)(getEntry("deploy"), argv);
5323
4349
  if ((await runDeploy({
5324
4350
  loaded,
5325
4351
  context,
@@ -5329,153 +4355,6 @@ const deployCommand = {
5329
4355
  })).status === "fail") process.exitCode = 1;
5330
4356
  }
5331
4357
  };
5332
- // ../dagobah/dist/index.mjs
5333
- /**
5334
- * Wrap an unquoted PEM block in double quotes. `op environment secret list --format=dotenv` prints a multi-line
5335
- * value (a private key) unquoted, which `dotenv` reads as its first line only; quoted, it reads the whole block.
5336
- * A PEM holds no quote or backslash, so nothing needs escaping.
5337
- */
5338
- function quotePem(text) {
5339
- return text.replace(/^([A-Za-z_][A-Za-z0-9_]*)=(-----BEGIN [^-]+-----[\s\S]*?-----END [^-]+-----)[ \t]*$/gm, "$1=\"$2\"");
5340
- }
5341
- /**
5342
- * The environment a local app runs with: the variables already in the process, and what the 1Password
5343
- * Environment `environment` holds for the rest (read with `op environment secret list`, the way the 1Password
5344
- * plugin reads one, so Touch ID asks once). The process wins, so a variable exported for one run overrides the
5345
- * Environment. The `required` ones must end up set; a message names the ones that are not, and never a
5346
- * value. Nothing is written to disk.
5347
- */
5348
- function loadDevEnv(input) {
5349
- const REQUIRED = input.required;
5350
- const env = input.env ?? process.env;
5351
- const present = (name) => (env[name] ?? "") !== "";
5352
- let merged = env;
5353
- if (!REQUIRED.every(present)) {
5354
- const result = (input.spawn ?? spawnSync)("op", [
5355
- "environment",
5356
- "secret",
5357
- "list",
5358
- input.environment,
5359
- "--reveal",
5360
- "--format=dotenv"
5361
- ], {
5362
- encoding: "utf8",
5363
- stdio: [
5364
- "inherit",
5365
- "pipe",
5366
- "pipe"
5367
- ]
5368
- });
5369
- if (result.error || result.status !== 0) {
5370
- const why = result.error?.message ?? result.stderr.trim().split("\n")[0];
5371
- throw new Error(`could not read the 1Password Environment "${input.environment}": ${why || "op failed"}`);
5372
- }
5373
- merged = {
5374
- ...parse(quotePem(String(result.stdout))),
5375
- ...Object.fromEntries(Object.entries(env).filter(([, v]) => v !== void 0 && v !== ""))
5376
- };
5377
- }
5378
- const missing = REQUIRED.filter((name) => (merged[name] ?? "") === "");
5379
- if (missing.length > 0) throw new Error(`missing from the environment and from "${input.environment}": ${missing.join(", ")}`);
5380
- return merged;
5381
- }
5382
- /**
5383
- * One line saying where this run's structured logs go: they ship to Axiom when both variables are set. Names the
5384
- * dataset (not a secret) and never the token, so a development run does not quietly write into production's dataset.
5385
- */
5386
- function describeLogging(env, options) {
5387
- const token = env[options.tokenVar];
5388
- const dataset = env[options.datasetVar];
5389
- return token && dataset ? `logs: shipped to Axiom, dataset "${dataset}"` : `logs: not shipped to Axiom (${options.tokenVar} and ${options.datasetVar} are not both set)`;
5390
- }
5391
- const LOOPBACK$1 = "127.0.0.1";
5392
- /** GitHub caps a webhook payload at 25 MB; anything larger is not one. */
5393
- const MAX_BODY = 27262976;
5394
- /** The request body, or `undefined` when it is larger than a webhook can be. */
5395
- async function readBody(req) {
5396
- const chunks = [];
5397
- let size = 0;
5398
- for await (const chunk of req) {
5399
- size += chunk.length;
5400
- if (size > MAX_BODY) return void 0;
5401
- chunks.push(chunk);
5402
- }
5403
- return Buffer.concat(chunks);
5404
- }
5405
- /**
5406
- * Serves a `(Request, env) => Response` handler over HTTP on the loopback address, for a development instance behind
5407
- * a tunnel: the same function the Vercel entry (e.g. Sentinel's `api/webhook.mjs`) calls, with the same web-standard `Request`. Only
5408
- * the handler's own path is served. A request is logged as one line (method, path, status) and nothing else, so no
5409
- * signature, token or payload reaches the terminal.
5410
- */
5411
- async function startDevServer(input) {
5412
- const path = input.path ?? "/api/webhook";
5413
- const log = input.log ?? (() => {});
5414
- const server = createServer(async (req, res) => {
5415
- const method = req.method;
5416
- const url = new URL(req.url, `http://${LOOPBACK$1}`);
5417
- const reply = (status, body, headers = {}) => {
5418
- log(`${method} ${url.pathname} ${status}`);
5419
- res.writeHead(status, headers);
5420
- res.end(body);
5421
- };
5422
- if (url.pathname !== path) return reply(404, "Not Found");
5423
- const hasBody = method !== "GET" && method !== "HEAD";
5424
- const body = hasBody ? await readBody(req) : void 0;
5425
- if (hasBody && body === void 0) return reply(413, "Payload Too Large");
5426
- const headers = new Headers();
5427
- for (let i = 0; i < req.rawHeaders.length; i += 2) headers.append(req.rawHeaders[i], req.rawHeaders[i + 1]);
5428
- try {
5429
- const response = await input.handle(new Request(`http://${req.headers.host}${req.url}`, {
5430
- method,
5431
- headers,
5432
- ...body ? { body } : {}
5433
- }), input.env);
5434
- reply(response.status, Buffer.from(await response.arrayBuffer()), Object.fromEntries(response.headers));
5435
- } catch {
5436
- reply(500, "Internal Server Error");
5437
- }
5438
- });
5439
- await new Promise((resolve) => server.listen(input.port, LOOPBACK$1, resolve));
5440
- const { port } = server.address();
5441
- return {
5442
- url: `http://${LOOPBACK$1}:${port}${path}`,
5443
- close: () => new Promise((resolve) => {
5444
- server.close(() => resolve());
5445
- server.closeAllConnections();
5446
- })
5447
- };
5448
- }
5449
- /**
5450
- * Runs a web-standard handler locally: loads its environment, puts it in `process.env`, imports the handler, serves
5451
- * it on the loopback address and says where it is listening and where its logs go. The server stops, and the process
5452
- * exits, on SIGINT and SIGTERM.
5453
- *
5454
- * @returns The running server.
5455
- */
5456
- async function serveHandler(input) {
5457
- const log = input.log ?? ((line) => console.log(line));
5458
- const settings = input.env ?? process.env;
5459
- const env = loadDevEnv({
5460
- environment: input.environment,
5461
- required: input.required,
5462
- env: settings,
5463
- ...input.spawn ? { spawn: input.spawn } : {}
5464
- });
5465
- Object.assign(process.env, env);
5466
- const server = await startDevServer({
5467
- handle: await input.handler(),
5468
- env,
5469
- port: input.port,
5470
- ...input.path ? { path: input.path } : {},
5471
- log
5472
- });
5473
- log(`listening on ${server.url}, secrets from "${input.environment}"`);
5474
- if (input.logging) log(describeLogging(env, input.logging));
5475
- const stop = input.onSignal ?? ((close) => void close().then(() => process.exit(0)));
5476
- for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop(server.close));
5477
- return server;
5478
- }
5479
4358
  // src/commands/dev-serve/dev-serve.ts
5480
4359
  /**
5481
4360
  * `holocron dev serve` — the application `holocron dev` runs when `dev.serve` names a handler: it loads the handler
@@ -5737,13 +4616,13 @@ async function runTunnelUp(input) {
5737
4616
  };
5738
4617
  const row = (ok, label, detail) => {
5739
4618
  summary[ok ? "ok" : "fail"] += 1;
5740
- const text = `${label} ${style.dim(`(${detail})`)}`;
5741
- print(` ${ok ? style.success(text) : style.fail(text)}`);
4619
+ const text = `${label} ${ui_exports.style.dim(`(${detail})`)}`;
4620
+ print(` ${ok ? ui_exports.style.success(text) : ui_exports.style.fail(text)}`);
5742
4621
  };
5743
4622
  const finish = (status, extra = {}) => {
5744
4623
  print("");
5745
4624
  const line = `${summary.ok} ok, ${summary.fail} failed`;
5746
- print(summary.fail > 0 ? style.fail(line) : style.success(line));
4625
+ print(summary.fail > 0 ? ui_exports.style.fail(line) : ui_exports.style.success(line));
5747
4626
  logger[status === "ok" ? "info" : "warn"]({
5748
4627
  status,
5749
4628
  ...summary
@@ -5755,10 +4634,10 @@ async function runTunnelUp(input) {
5755
4634
  };
5756
4635
  };
5757
4636
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
5758
- await withSpinner("Loading plugins…", () => loader.load());
4637
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
5759
4638
  assertPluginsResolvable(loader, COMMAND$3);
5760
4639
  const dryRun = input.context.dryRun ?? false;
5761
- print(style.header(`Holocron tunnel up — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
4640
+ print(ui_exports.style.header(`Holocron tunnel up — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
5762
4641
  print("");
5763
4642
  if (!loader.has("tunnels")) {
5764
4643
  row(false, "tunnels", missing(loader, "tunnels", "needs a `tunnels` provider in holocron.config.ts (cloudflare)"));
@@ -5853,7 +4732,7 @@ const tunnelUpCommand = {
5853
4732
  describe: "Make a named tunnel with a stable public hostname that reaches a local port",
5854
4733
  builder: tunnelUpArgs,
5855
4734
  handler: async (argv) => {
5856
- const tokens = tokenContext(argv.token);
4735
+ const tokens = tokenContext$1(argv.token);
5857
4736
  if (!tokens) return;
5858
4737
  const loaded = await loadConfig(argv.cwd);
5859
4738
  applyResolvedConfig(argv, loaded.resolved);
@@ -5885,13 +4764,13 @@ async function runDev(input) {
5885
4764
  };
5886
4765
  const row = (ok, label, detail) => {
5887
4766
  summary[ok ? "ok" : "fail"] += 1;
5888
- const text = `${label} ${style.dim(`(${detail})`)}`;
5889
- print(` ${ok ? style.success(text) : style.fail(text)}`);
4767
+ const text = `${label} ${ui_exports.style.dim(`(${detail})`)}`;
4768
+ print(` ${ok ? ui_exports.style.success(text) : ui_exports.style.fail(text)}`);
5890
4769
  };
5891
4770
  const finish = (status, extra = {}) => {
5892
4771
  print("");
5893
4772
  const line = `${summary.ok} ok, ${summary.fail} failed`;
5894
- print(summary.fail > 0 ? style.fail(line) : style.success(line));
4773
+ print(summary.fail > 0 ? ui_exports.style.fail(line) : ui_exports.style.success(line));
5895
4774
  logger[status === "ok" ? "info" : "warn"]({
5896
4775
  status,
5897
4776
  ...summary
@@ -5903,12 +4782,12 @@ async function runDev(input) {
5903
4782
  };
5904
4783
  };
5905
4784
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
5906
- await withSpinner("Loading plugins…", () => loader.load());
4785
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
5907
4786
  assertPluginsResolvable(loader, COMMAND$2);
5908
4787
  const dryRun = input.context.dryRun ?? false;
5909
4788
  const [program, ...args] = input.command;
5910
4789
  const shown = input.command.join(" ");
5911
- print(style.header(`Holocron dev — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
4790
+ print(ui_exports.style.header(`Holocron dev — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
5912
4791
  print("");
5913
4792
  const vault = loader.has("vault") ? loader.get("vault") : void 0;
5914
4793
  if (!vault?.readEnvironment) {
@@ -6000,7 +4879,7 @@ const devCommand = {
6000
4879
  describe: "Run an application locally behind its development tunnel, with its secrets from the vault (command after --)",
6001
4880
  builder: (y) => devArgs(y).command(devServeCommand),
6002
4881
  handler: async (argv) => {
6003
- const tokens = tokenContext(argv.token);
4882
+ const tokens = tokenContext$1(argv.token);
6004
4883
  if (!tokens) return;
6005
4884
  const loaded = await loadConfig(argv.cwd);
6006
4885
  applyResolvedConfig(argv, loaded.resolved);
@@ -6417,7 +5296,7 @@ const doctorCredentialsCommand = {
6417
5296
  command: "credentials",
6418
5297
  describe: "Check that the credentials environment exists and holds the tokens the plugins take (read-only)",
6419
5298
  handler: async (argv) => {
6420
- const tokens = tokenContext(argv.token);
5299
+ const tokens = tokenContext$1(argv.token);
6421
5300
  if (!tokens) return;
6422
5301
  const loaded = await loadConfig(argv.cwd);
6423
5302
  applyResolvedConfig(argv, loaded.resolved);
@@ -6545,7 +5424,7 @@ async function readCapped(res, maxBytes, tooBig) {
6545
5424
  */
6546
5425
  /** Providers cap avatars well below this; it only keeps a wrong file from filling memory. */
6547
5426
  const MAX_AVATAR_BYTES = 8388608;
6548
- const FETCH_TIMEOUT_MS$2 = 15e3;
5427
+ const FETCH_TIMEOUT_MS$1 = 15e3;
6549
5428
  const SIGNATURES = [
6550
5429
  ["image/png", [
6551
5430
  137,
@@ -6605,7 +5484,7 @@ async function loadAvatar(source, baseDir = process.cwd(), fetchImpl = fetch) {
6605
5484
  const base64 = /^data:[^;,]+;base64,(.*)$/is.exec(source)?.[1];
6606
5485
  if (base64 === void 0) throw new Error("it is not a base64 data URI");
6607
5486
  bytes = Buffer.from(base64, "base64");
6608
- } else if (/^https:\/\//i.test(source)) bytes = await fetchAvatarBytes(source, fetchImpl, MAX_AVATAR_BYTES, FETCH_TIMEOUT_MS$2, tooBig);
5487
+ } else if (/^https:\/\//i.test(source)) bytes = await fetchAvatarBytes(source, fetchImpl, MAX_AVATAR_BYTES, FETCH_TIMEOUT_MS$1, tooBig);
6609
5488
  else {
6610
5489
  const path = resolve(baseDir, source);
6611
5490
  if ((await stat(path)).size > 8388608) throw tooBig();
@@ -6744,15 +5623,15 @@ async function provisionChannel(deps, spec) {
6744
5623
  const relay = spec.feeds?.errors;
6745
5624
  if (relay && !notifications.ensureWebhook) throw new Error(`\`${notifications.providerName}\` cannot create webhooks`);
6746
5625
  if (dryRun) {
6747
- print(` ${style.skip(`would ensure channel ${spec.name}${where}`)}`);
5626
+ print(` ${ui_exports.style.skip(`would ensure channel ${spec.name}${where}`)}`);
6748
5627
  if (tally) tally.skip += webhookCfg ? 2 : 1;
6749
- if (webhookCfg) print(` ${style.skip(`would ensure webhook ${webhookName} and store its URL in ${secretName}`)}`);
5628
+ if (webhookCfg) print(` ${ui_exports.style.skip(`would ensure webhook ${webhookName} and store its URL in ${secretName}`)}`);
6750
5629
  if (feed) {
6751
- print(` ${style.skip(`would ensure webhook ${feed.webhook} and alert channel ${feed.name} (monitoring)`)}`);
5630
+ print(` ${ui_exports.style.skip(`would ensure webhook ${feed.webhook} and alert channel ${feed.name} (monitoring)`)}`);
6752
5631
  if (tally) tally.skip += 2;
6753
5632
  }
6754
5633
  if (relay) {
6755
- print(` ${style.skip(`would ensure webhook ${relay.webhook} for the relay Worker (errors)`)}`);
5634
+ print(` ${ui_exports.style.skip(`would ensure webhook ${relay.webhook} for the relay Worker (errors)`)}`);
6756
5635
  if (tally) tally.skip++;
6757
5636
  }
6758
5637
  return {
@@ -6772,7 +5651,7 @@ async function provisionChannel(deps, spec) {
6772
5651
  const changed = channel.created || (channel.updated?.length ?? 0) > 0;
6773
5652
  const verb = channel.created ? "created" : changed ? "updated" : "exists ";
6774
5653
  const what = channel.updated?.length ? `: ${channel.updated.join(", ")}` : "";
6775
- print(` ${(changed ? style.success : style.skip)(`${verb} channel ${spec.name}${where}${what}`)}`);
5654
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} channel ${spec.name}${where}${what}`)}`);
6776
5655
  if (tally) tally[changed ? "ok" : "skip"]++;
6777
5656
  const outcome = {
6778
5657
  name: spec.name,
@@ -6798,7 +5677,7 @@ async function provisionChannel(deps, spec) {
6798
5677
  } catch (err) {
6799
5678
  throw new Error(`webhook ${webhookName} was ${hook.created ? "created" : "found"} but storing its URL in ${secretName} failed (${describeProviderError(err)}) — delete the webhook in the provider and re-run to get a fresh URL`, { cause: err });
6800
5679
  }
6801
- print(` ${style.success(`${hook.created ? "created" : "found "} webhook ${webhookName}; URL stored in ${secretName}`)}`);
5680
+ print(` ${ui_exports.style.success(`${hook.created ? "created" : "found "} webhook ${webhookName}; URL stored in ${secretName}`)}`);
6802
5681
  if (tally) tally.ok++;
6803
5682
  outcome.webhook = {
6804
5683
  name: webhookName,
@@ -6809,7 +5688,7 @@ async function provisionChannel(deps, spec) {
6809
5688
  };
6810
5689
  } else {
6811
5690
  const note = `webhook ${webhookName} already exists and its URL cannot be read back — delete it in the provider and re-run, or set ${secretName} yourself`;
6812
- print(` ${style.warn(note)}`);
5691
+ print(` ${ui_exports.style.warn(note)}`);
6813
5692
  outcome.webhook = {
6814
5693
  name: webhookName,
6815
5694
  created: hook.created,
@@ -6820,7 +5699,7 @@ async function provisionChannel(deps, spec) {
6820
5699
  };
6821
5700
  }
6822
5701
  if (avatarSet) {
6823
- print(` ${style.success(`set avatar on webhook ${webhookName}`)}`);
5702
+ print(` ${ui_exports.style.success(`set avatar on webhook ${webhookName}`)}`);
6824
5703
  if (tally) tally.ok++;
6825
5704
  }
6826
5705
  if (hook.avatarError) throw new Error(`webhook ${webhookName} is ready but setting its avatar failed (${hook.avatarError})`);
@@ -6842,7 +5721,7 @@ async function provisionRelayFeed(deps, spec, feed, outcome) {
6842
5721
  ...feed.avatar ? { avatar: feed.avatar } : {}
6843
5722
  });
6844
5723
  const avatarSet = hook.updated?.includes("avatar") ?? false;
6845
- print(` ${(hook.created || avatarSet ? style.success : style.skip)(`${hook.created ? "created" : "found "} webhook ${feed.webhook} for the relay${avatarSet ? " (avatar set)" : ""}`)}`);
5724
+ print(` ${(hook.created || avatarSet ? ui_exports.style.success : ui_exports.style.skip)(`${hook.created ? "created" : "found "} webhook ${feed.webhook} for the relay${avatarSet ? " (avatar set)" : ""}`)}`);
6846
5725
  if (tally) {
6847
5726
  const done = Number(hook.created) + Number(avatarSet);
6848
5727
  if (done > 0) tally.ok += done;
@@ -6871,7 +5750,7 @@ async function provisionFeed(deps, spec, feed, outcome) {
6871
5750
  ...feed.avatar ? { avatar: feed.avatar } : {}
6872
5751
  });
6873
5752
  const avatarSet = hook.updated?.includes("avatar") ?? false;
6874
- print(` ${(hook.created || avatarSet ? style.success : style.skip)(`${hook.created ? "created" : "found "} webhook ${feed.webhook}${avatarSet ? " (avatar set)" : ""}`)}`);
5753
+ print(` ${(hook.created || avatarSet ? ui_exports.style.success : ui_exports.style.skip)(`${hook.created ? "created" : "found "} webhook ${feed.webhook}${avatarSet ? " (avatar set)" : ""}`)}`);
6875
5754
  if (tally) {
6876
5755
  const done = Number(hook.created) + Number(avatarSet);
6877
5756
  if (done > 0) tally.ok += done;
@@ -6892,7 +5771,7 @@ async function provisionFeed(deps, spec, feed, outcome) {
6892
5771
  const changed = result.created || result.updated.length > 0;
6893
5772
  const verb = result.created ? "created" : changed ? "updated" : "exists ";
6894
5773
  const what = result.updated.length > 0 ? `: ${result.updated.join(", ")}` : "";
6895
- print(` ${(changed ? style.success : style.skip)(`${verb} alert channel ${feed.name} via webhook ${feed.webhook}${what} (${result.subscribed} checks)`)}`);
5774
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} alert channel ${feed.name} via webhook ${feed.webhook}${what} (${result.subscribed} checks)`)}`);
6896
5775
  if (tally) tally[changed ? "ok" : "skip"]++;
6897
5776
  outcome.alertChannel = {
6898
5777
  name: feed.name,
@@ -6948,7 +5827,7 @@ async function runNotificationsChannelAdd(input) {
6948
5827
  }, `notifications channel add: ${input.name}`);
6949
5828
  if (channel.webhook && !channel.webhook.stored && !dryRun) {
6950
5829
  const message = channel.webhook.note;
6951
- print(` ${style.fail(message)}`);
5830
+ print(` ${ui_exports.style.fail(message)}`);
6952
5831
  return {
6953
5832
  status: "fail",
6954
5833
  channel,
@@ -6961,7 +5840,7 @@ async function runNotificationsChannelAdd(input) {
6961
5840
  };
6962
5841
  } catch (err) {
6963
5842
  const message = describeProviderError(err);
6964
- print(` ${style.fail(message)}`);
5843
+ print(` ${ui_exports.style.fail(message)}`);
6965
5844
  logger.warn({
6966
5845
  channel: input.name,
6967
5846
  reason: logReason(err)
@@ -7295,7 +6174,7 @@ const doctorDnsCommand = {
7295
6174
  command: "dns",
7296
6175
  describe: "Check that the DNS records the config makes setup write exist and point where they should (read-only)",
7297
6176
  handler: async (argv) => {
7298
- const tokens = tokenContext(argv.token);
6177
+ const tokens = tokenContext$1(argv.token);
7299
6178
  if (!tokens) return;
7300
6179
  const loaded = await loadConfig(argv.cwd);
7301
6180
  applyResolvedConfig(argv, loaded.resolved);
@@ -7371,7 +6250,7 @@ const doctorEnvironmentsCommand = {
7371
6250
  command: "environments",
7372
6251
  describe: "Check that the deployment environments the config relies on exist (read-only)",
7373
6252
  handler: async (argv) => {
7374
- const tokens = tokenContext(argv.token);
6253
+ const tokens = tokenContext$1(argv.token);
7375
6254
  if (!tokens) return;
7376
6255
  const loaded = await loadConfig(argv.cwd);
7377
6256
  applyResolvedConfig(argv, loaded.resolved);
@@ -7527,7 +6406,7 @@ const doctorMonitoringCommand = {
7527
6406
  command: "monitoring",
7528
6407
  describe: "Check the monitoring checks the config declares against the ones the provider holds (read-only)",
7529
6408
  handler: async (argv) => {
7530
- const tokens = tokenContext(argv.token);
6409
+ const tokens = tokenContext$1(argv.token);
7531
6410
  if (!tokens) return;
7532
6411
  const loaded = await loadConfig(argv.cwd);
7533
6412
  applyResolvedConfig(argv, loaded.resolved);
@@ -7759,7 +6638,7 @@ async function withElevation(run, deps) {
7759
6638
  const { permission, grantUrl, revokeUrl, applied, keep } = err.elevation;
7760
6639
  const name = err.elevation.label ?? permission;
7761
6640
  if (await notifications.holdsPermission?.(permission).catch(() => false)) throw err;
7762
- print(` ${style.skip(`${deps.label} needs ${name}${keep ? "" : " for this one edit"}`)}`);
6641
+ print(` ${ui_exports.style.skip(`${deps.label} needs ${name}${keep ? "" : " for this one edit"}`)}`);
7763
6642
  print(` 1. approve it: ${grantUrl}`);
7764
6643
  await pause(`Press Enter once ${name} is approved to try again`);
7765
6644
  let result;
@@ -7777,10 +6656,10 @@ async function withElevation(run, deps) {
7777
6656
  const holdsNow = await notifications.holdsPermission?.(permission).catch(() => void 0);
7778
6657
  if (holdsNow === void 0) leftover = `could not check that ${permission} is gone; confirm it in ${notifications.providerName}'s role, then run \`holocron doctor notifications\``;
7779
6658
  else if (holdsNow) leftover = `${notifications.providerName} still holds ${permission}; use the link above to take it away, then run \`holocron doctor notifications\` to check`;
7780
- else print(` ${style.success(`${permission} is gone again`)}`);
6659
+ else print(` ${ui_exports.style.success(`${permission} is gone again`)}`);
7781
6660
  }
7782
6661
  if (failure !== void 0) {
7783
- if (leftover) print(` ${style.fail(leftover)}`);
6662
+ if (leftover) print(` ${ui_exports.style.fail(leftover)}`);
7784
6663
  throw failure;
7785
6664
  }
7786
6665
  return {
@@ -7976,7 +6855,7 @@ function serverLayoutProblem(layout) {
7976
6855
  }
7977
6856
  }
7978
6857
  async function runNotificationsSetup(input$1) {
7979
- const progress = createProgress(input$1.print ?? ((line) => console.log(line)));
6858
+ const progress = createProgress$1(input$1.print ?? ((line) => console.log(line)));
7980
6859
  const print = progress.print;
7981
6860
  const logger = input$1.logger ?? getLogger();
7982
6861
  /* v8 ignore next -- the real loader is only built outside tests, which always inject one */
@@ -7992,9 +6871,9 @@ async function runNotificationsSetup(input$1) {
7992
6871
  failures: []
7993
6872
  };
7994
6873
  const refuse = (message, reason = message) => {
7995
- print(` ${style.fail(message)}`);
6874
+ print(` ${ui_exports.style.fail(message)}`);
7996
6875
  print("");
7997
- print(style.header("0 ok, 1 fail, 0 skipped"));
6876
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
7998
6877
  logger.warn({ reason }, "notifications setup");
7999
6878
  return {
8000
6879
  ...report,
@@ -8065,7 +6944,7 @@ async function runNotificationsSetup(input$1) {
8065
6944
  ]) {
8066
6945
  const key = JSON.stringify(sources);
8067
6946
  if (sources.length > 0 && !avatars.has(key)) try {
8068
- avatars.set(key, await loadFirstAvatar(sources, read, (source, reason, moreToTry) => print(` ${style.skip(`avatar ${describeAvatarSource(source)} could not be read (${reason})${moreToTry ? "; trying the next" : ""}`)}`)));
6947
+ avatars.set(key, await loadFirstAvatar(sources, read, (source, reason, moreToTry) => print(` ${ui_exports.style.skip(`avatar ${describeAvatarSource(source)} could not be read (${reason})${moreToTry ? "; trying the next" : ""}`)}`)));
8069
6948
  } catch (err) {
8070
6949
  return refuse(`webhook avatar ${errorMessage(err)}`);
8071
6950
  }
@@ -8110,7 +6989,7 @@ async function runNotificationsSetup(input$1) {
8110
6989
  return true;
8111
6990
  } catch (err) {
8112
6991
  const message = describeProviderError(err);
8113
- print(` ${style.fail(`${step}: ${message}`)}`);
6992
+ print(` ${ui_exports.style.fail(`${step}: ${message}`)}`);
8114
6993
  report.failures.push({
8115
6994
  step,
8116
6995
  message
@@ -8118,11 +6997,11 @@ async function runNotificationsSetup(input$1) {
8118
6997
  return false;
8119
6998
  }
8120
6999
  };
8121
- if ((layout.roles ?? []).length > 0) print(`\n${style.header("Roles")}`);
7000
+ if ((layout.roles ?? []).length > 0) print(`\n${ui_exports.style.header("Roles")}`);
8122
7001
  for (const role of layout.roles ?? []) await attempt(`role ${role.name}`, async () => {
8123
7002
  if (!notifications.ensureRole) throw new Error(`\`${notifications.providerName}\` cannot manage roles`);
8124
7003
  if (dryRun) {
8125
- print(` ${style.skip(`would ensure role ${role.name}${role.secret ? ` and store its id in ${role.secret}` : ""}`)}`);
7004
+ print(` ${ui_exports.style.skip(`would ensure role ${role.name}${role.secret ? ` and store its id in ${role.secret}` : ""}`)}`);
8126
7005
  tally.skip++;
8127
7006
  report.roles.push({
8128
7007
  name: role.name,
@@ -8147,23 +7026,23 @@ async function runNotificationsSetup(input$1) {
8147
7026
  report.roles.push(outcome);
8148
7027
  const changed = result.created || (result.updated?.length ?? 0) > 0;
8149
7028
  const verb = result.created ? "created" : changed ? "updated" : "exists ";
8150
- print(` ${(changed ? style.success : style.skip)(`${verb} role ${role.name} (id ${result.id})${result.updated?.length ? `: ${result.updated.join(", ")}` : ""}`)}`);
7029
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} role ${role.name} (id ${result.id})${result.updated?.length ? `: ${result.updated.join(", ")}` : ""}`)}`);
8151
7030
  made(changed);
8152
7031
  if (role.secret) {
8153
7032
  await secrets.setSecret(scope, role.secret, result.id);
8154
7033
  outcome.secret = role.secret;
8155
7034
  outcome.stored = true;
8156
- print(` ${style.success(`stored the id of ${role.name} in ${role.secret}`)}`);
7035
+ print(` ${ui_exports.style.success(`stored the id of ${role.name} in ${role.secret}`)}`);
8157
7036
  tally.ok++;
8158
7037
  }
8159
7038
  });
8160
7039
  for (const category of layout.categories ?? []) {
8161
- print(`\n${style.header(category.name)}`);
7040
+ print(`\n${ui_exports.style.header(category.name)}`);
8162
7041
  report.categories.push(category.name);
8163
7042
  const categoryOk = await attempt(`category ${category.name}`, async () => {
8164
7043
  if (!notifications.ensureCategory) return;
8165
7044
  if (dryRun) {
8166
- print(` ${style.skip(`would ensure category ${category.name}`)}`);
7045
+ print(` ${ui_exports.style.skip(`would ensure category ${category.name}`)}`);
8167
7046
  tally.skip++;
8168
7047
  return;
8169
7048
  }
@@ -8171,12 +7050,12 @@ async function runNotificationsSetup(input$1) {
8171
7050
  const changed = result.created || (result.updated?.length ?? 0) > 0;
8172
7051
  const verb = result.created ? "created" : changed ? "updated" : "exists ";
8173
7052
  const what = result.updated?.length ? `: ${result.updated.join(", ")}` : "";
8174
- print(` ${(changed ? style.success : style.skip)(`${verb} category ${category.name}${what}`)}`);
7053
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} category ${category.name}${what}`)}`);
8175
7054
  made(changed);
8176
7055
  });
8177
7056
  const channels = category.channels ?? [];
8178
7057
  if (!categoryOk && channels.length > 0) {
8179
- print(` ${style.skip(`skipped ${channels.length} channel${channels.length === 1 ? "" : "s"}: the category failed`)}`);
7058
+ print(` ${ui_exports.style.skip(`skipped ${channels.length} channel${channels.length === 1 ? "" : "s"}: the category failed`)}`);
8180
7059
  tally.skip += channels.length;
8181
7060
  continue;
8182
7061
  }
@@ -8224,14 +7103,14 @@ async function runNotificationsSetup(input$1) {
8224
7103
  });
8225
7104
  }
8226
7105
  if (errors && workers && dns && wantsRelay(layout)) {
8227
- print(`\n${style.header("Relay")}`);
7106
+ print(`\n${ui_exports.style.header("Relay")}`);
8228
7107
  const tracker = layout.relay.errors;
8229
7108
  let signingSecret;
8230
7109
  if (tracker && errors.ensureRelay) await attempt(`${errors.providerName} alert relay`, async () => {
8231
7110
  const integration = tracker.integration ?? "Comlink";
8232
7111
  const rule = tracker.rule ?? "Errors to Discord (Comlink)";
8233
7112
  if (dryRun) {
8234
- print(` ${style.skip(`would ensure the ${errors.providerName} integration ${integration} and the alert rule ${rule} on ${tracker.projects.join(", ")}`)}`);
7113
+ print(` ${ui_exports.style.skip(`would ensure the ${errors.providerName} integration ${integration} and the alert rule ${rule} on ${tracker.projects.join(", ")}`)}`);
8235
7114
  tally.skip += 2;
8236
7115
  return;
8237
7116
  }
@@ -8257,14 +7136,14 @@ async function runNotificationsSetup(input$1) {
8257
7136
  const changed = outcome.created || outcome.updated.length > 0;
8258
7137
  const verb = outcome.created ? "created" : changed ? "updated" : "exists ";
8259
7138
  const detail = outcome.updated.length > 0 ? `: ${outcome.updated.join(", ")}` : "";
8260
- print(` ${(changed ? style.success : style.skip)(`${verb} ${errors.providerName} ${what} ${name}${detail}`)}`);
7139
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} ${errors.providerName} ${what} ${name}${detail}`)}`);
8261
7140
  made(changed);
8262
7141
  }
8263
- if (!signingSecret) print(` ${style.warn(`${errors.providerName} did not give the integration's signing secret (it may only show it once, when the integration is made), so the Worker keeps the one it has. To set it: copy it from the integration's page, add it to Doppler as COMLINK_${errors.providerName.toUpperCase()}_SECRET and run holocron secrets sync`)}`);
7142
+ if (!signingSecret) print(` ${ui_exports.style.warn(`${errors.providerName} did not give the integration's signing secret (it may only show it once, when the integration is made), so the Worker keeps the one it has. To set it: copy it from the integration's page, add it to Doppler as COMLINK_${errors.providerName.toUpperCase()}_SECRET and run holocron secrets sync`)}`);
8264
7143
  });
8265
7144
  await attempt(`relay ${layout.relay.host}`, async () => {
8266
7145
  if (dryRun) {
8267
- print(` ${style.skip(`would deploy the relay Worker at ${layout.relay.host}`)}`);
7146
+ print(` ${ui_exports.style.skip(`would deploy the relay Worker at ${layout.relay.host}`)}`);
8268
7147
  tally.skip++;
8269
7148
  return;
8270
7149
  }
@@ -8279,26 +7158,26 @@ async function runNotificationsSetup(input$1) {
8279
7158
  dns,
8280
7159
  ...input$1.readRelayCode ? { readCode: input$1.readRelayCode } : {}
8281
7160
  });
8282
- print(` ${style.success(`deployed ${deployed.script} at ${deployed.host}`)}`);
7161
+ print(` ${ui_exports.style.success(`deployed ${deployed.script} at ${deployed.host}`)}`);
8283
7162
  tally.ok++;
8284
7163
  });
8285
7164
  }
8286
7165
  if (layout.server || layout.welcome || layout.onboarding || (layout.pinned?.length ?? 0) > 0 || layout.application || layout.everyone) {
8287
- print(`\n${style.header("Server")}`);
7166
+ print(`\n${ui_exports.style.header("Server")}`);
8288
7167
  const apply = async (label, declared, run) => {
8289
7168
  if (!declared) return;
8290
7169
  await attempt(label, async () => {
8291
7170
  if (dryRun) {
8292
- print(` ${style.skip(`would ensure ${label}`)}`);
7171
+ print(` ${ui_exports.style.skip(`would ensure ${label}`)}`);
8293
7172
  tally.skip++;
8294
7173
  return;
8295
7174
  }
8296
7175
  const result = await run();
8297
7176
  const changed = result.updated.length > 0;
8298
- print(` ${(changed ? style.success : style.skip)(`${changed ? "updated" : "exists "} ${label}${changed ? `: ${result.updated.join(", ")}` : ""}`)}`);
7177
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${changed ? "updated" : "exists "} ${label}${changed ? `: ${result.updated.join(", ")}` : ""}`)}`);
8299
7178
  made(changed);
8300
7179
  for (const todo of result.todo ?? []) {
8301
- print(` ${style.fail(`${label}: ${todo}`)}`);
7180
+ print(` ${ui_exports.style.fail(`${label}: ${todo}`)}`);
8302
7181
  report.failures.push({
8303
7182
  step: label,
8304
7183
  message: todo
@@ -8328,7 +7207,7 @@ async function runNotificationsSetup(input$1) {
8328
7207
  if (report.failures.length > 0) report.status = "fail";
8329
7208
  else if (dryRun) report.status = "dry-run";
8330
7209
  print("");
8331
- print(style.header(`${tally.ok} ok, ${report.failures.length} fail, ${tally.skip} skipped`));
7210
+ print(ui_exports.style.header(`${tally.ok} ok, ${report.failures.length} fail, ${tally.skip} skipped`));
8332
7211
  logger.info({
8333
7212
  provider: notifications.providerName,
8334
7213
  channels: report.channels.length,
@@ -8605,7 +7484,7 @@ async function syncRoles(input) {
8605
7484
  skipped: 0
8606
7485
  };
8607
7486
  for (const role of input.roles) {
8608
- print(`\n${style.header(`${role.name} ← team ${role.team}`)}`);
7487
+ print(`\n${ui_exports.style.header(`${role.name} ← team ${role.team}`)}`);
8609
7488
  const step = `role ${role.name}`;
8610
7489
  let plan;
8611
7490
  try {
@@ -8619,7 +7498,7 @@ async function syncRoles(input) {
8619
7498
  });
8620
7499
  } catch (err) {
8621
7500
  const message = describeProviderError(err);
8622
- print(` ${style.fail(`${step}: ${message}`)}`);
7501
+ print(` ${ui_exports.style.fail(`${step}: ${message}`)}`);
8623
7502
  result.failures.push({
8624
7503
  step,
8625
7504
  message
@@ -8635,11 +7514,11 @@ async function syncRoles(input) {
8635
7514
  };
8636
7515
  result.roles.push(outcome);
8637
7516
  result.skipped += plan.inSync;
8638
- if (plan.inSync > 0) print(` ${style.skip(`${plan.inSync} already have it`)}`);
7517
+ if (plan.inSync > 0) print(` ${ui_exports.style.skip(`${plan.inSync} already have it`)}`);
8639
7518
  const act = async (verb, who) => {
8640
7519
  const label = `${verb === "add" ? "gave" : "took"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})`;
8641
7520
  if (dryRun || verb === "remove" && keep) {
8642
- print(` ${style.skip(`would ${verb === "add" ? "give" : "take"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})${keep && verb === "remove" ? " (kept: --keep)" : ""}`)}`);
7521
+ print(` ${ui_exports.style.skip(`would ${verb === "add" ? "give" : "take"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})${keep && verb === "remove" ? " (kept: --keep)" : ""}`)}`);
8643
7522
  result.skipped++;
8644
7523
  return;
8645
7524
  }
@@ -8647,11 +7526,11 @@ async function syncRoles(input) {
8647
7526
  if (verb === "add") await notifications.addRoleMember(role.name, who.member);
8648
7527
  else await notifications.removeRoleMember(role.name, who.member);
8649
7528
  (verb === "add" ? outcome.added : outcome.removed).push(who.member);
8650
- print(` ${style.success(label)}`);
7529
+ print(` ${ui_exports.style.success(label)}`);
8651
7530
  result.ok++;
8652
7531
  } catch (err) {
8653
7532
  const message = describeProviderError(err);
8654
- print(` ${style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
7533
+ print(` ${ui_exports.style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
8655
7534
  result.failures.push({
8656
7535
  step: `${step} ${verb} ${who.login}`,
8657
7536
  message
@@ -8661,11 +7540,11 @@ async function syncRoles(input) {
8661
7540
  for (const who of plan.add) await act("add", who);
8662
7541
  for (const who of plan.remove) await act("remove", who);
8663
7542
  for (const person of plan.unlinked) {
8664
- print(` ${style.skip(`${person.login} is on the team but has not linked their account`)}`);
7543
+ print(` ${ui_exports.style.skip(`${person.login} is on the team but has not linked their account`)}`);
8665
7544
  result.skipped++;
8666
7545
  }
8667
7546
  for (const holder of plan.unknownHolders) {
8668
- print(` ${style.skip(`${holder.name ?? holder.member} holds ${role.name} but is not linked to anyone: left alone`)}`);
7547
+ print(` ${ui_exports.style.skip(`${holder.name ?? holder.member} holds ${role.name} but is not linked to anyone: left alone`)}`);
8669
7548
  result.skipped++;
8670
7549
  }
8671
7550
  }
@@ -8721,9 +7600,9 @@ async function runNotificationsSyncRoles(input) {
8721
7600
  failures: []
8722
7601
  };
8723
7602
  const refuse = (message, reason = message) => {
8724
- print(` ${style.fail(message)}`);
7603
+ print(` ${ui_exports.style.fail(message)}`);
8725
7604
  print("");
8726
- print(style.header("0 ok, 1 fail, 0 skipped"));
7605
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
8727
7606
  logger.warn({ reason }, "notifications sync-roles");
8728
7607
  return {
8729
7608
  ...report,
@@ -8751,7 +7630,7 @@ async function runNotificationsSyncRoles(input) {
8751
7630
  } catch (err) {
8752
7631
  return refuse(describeProviderError(err), logReason(err));
8753
7632
  }
8754
- if (links.links.length === 0) print(` ${style.skip("no links yet: nobody can be given a role until they link their account")}`);
7633
+ if (links.links.length === 0) print(` ${ui_exports.style.skip("no links yet: nobody can be given a role until they link their account")}`);
8755
7634
  const result = await syncRoles({
8756
7635
  notifications,
8757
7636
  source,
@@ -8770,7 +7649,7 @@ async function runNotificationsSyncRoles(input) {
8770
7649
  if (report.failures.length > 0) report.status = "fail";
8771
7650
  else if (dryRun) report.status = "dry-run";
8772
7651
  print("");
8773
- print(style.header(`${result.ok} ok, ${report.failures.length} fail, ${result.skipped} skipped`));
7652
+ print(ui_exports.style.header(`${result.ok} ok, ${report.failures.length} fail, ${result.skipped} skipped`));
8774
7653
  logger.info({
8775
7654
  provider: notifications.providerName,
8776
7655
  roles: report.roles.length,
@@ -8822,9 +7701,9 @@ async function runNotificationsLink(input) {
8822
7701
  assertPluginsResolvable(loader, "notifications link");
8823
7702
  const dryRun = input.context.dryRun ?? false;
8824
7703
  const refuse = (message, reason = message) => {
8825
- print(` ${style.fail(message)}`);
7704
+ print(` ${ui_exports.style.fail(message)}`);
8826
7705
  print("");
8827
- print(style.header("0 ok, 1 fail, 0 skipped"));
7706
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
8828
7707
  logger.warn({ reason }, "notifications link");
8829
7708
  return {
8830
7709
  status: "fail",
@@ -8856,21 +7735,21 @@ async function runNotificationsLink(input) {
8856
7735
  /* v8 ignore next -- the real fetch is only used outside tests, which inject one */
8857
7736
  ...input.fetch ? { fetch: input.fetch } : {}
8858
7737
  });
8859
- print(` ${style.skip(`sign-in ${choice.kind === "hosted" ? "is hosted" : "runs on this machine"}: ${choice.reason}`)}`);
7738
+ print(` ${ui_exports.style.skip(`sign-in ${choice.kind === "hosted" ? "is hosted" : "runs on this machine"}: ${choice.reason}`)}`);
8860
7739
  if (choice.kind === "hosted") {
8861
7740
  print(` open ${`${choice.redirectUri.replace(/\/callback$/, "")}/start`} in a browser to link your account`);
8862
7741
  print("");
8863
- print(style.header("0 ok, 0 fail, 1 skipped"));
7742
+ print(ui_exports.style.header("0 ok, 0 fail, 1 skipped"));
8864
7743
  return {
8865
7744
  status: "ok",
8866
7745
  via: "hosted"
8867
7746
  };
8868
7747
  }
8869
7748
  if (dryRun) {
8870
- print(` ${style.skip(`would sign in on ${choice.redirectUri} and write the link to ${location.repo}/${location.path}`)}`);
8871
- print(` ${style.skip(`first, ${redirectInstruction(choice.redirectUri)}`)}`);
7749
+ print(` ${ui_exports.style.skip(`would sign in on ${choice.redirectUri} and write the link to ${location.repo}/${location.path}`)}`);
7750
+ print(` ${ui_exports.style.skip(`first, ${redirectInstruction(choice.redirectUri)}`)}`);
8872
7751
  print("");
8873
- print(style.header("0 ok, 0 fail, 1 skipped"));
7752
+ print(ui_exports.style.header("0 ok, 0 fail, 1 skipped"));
8874
7753
  return {
8875
7754
  status: "dry-run",
8876
7755
  via: "local"
@@ -8897,7 +7776,7 @@ async function runNotificationsLink(input) {
8897
7776
  const code = await wait({
8898
7777
  port,
8899
7778
  state,
8900
- onListening: () => void open(url).catch(() => print(` ${style.skip("could not open a browser; use the link above")}`))
7779
+ onListening: () => void open(url).catch(() => print(` ${ui_exports.style.skip("could not open a browser; use the link above")}`))
8901
7780
  });
8902
7781
  const who = await signIn.complete({
8903
7782
  redirectUri: choice.redirectUri,
@@ -8930,9 +7809,9 @@ async function runNotificationsLink(input) {
8930
7809
  throw err;
8931
7810
  }
8932
7811
  }
8933
- print(` ${style.success(`${outcome.changed ? "linked" : "already linked"} ${who.github.login} (github ${who.github.id}) to ${who.name ?? who.member} (${who.member})`)}`);
7812
+ print(` ${ui_exports.style.success(`${outcome.changed ? "linked" : "already linked"} ${who.github.login} (github ${who.github.id}) to ${who.name ?? who.member} (${who.member})`)}`);
8934
7813
  print("");
8935
- print(style.header(`${outcome.changed ? 1 : 0} ok, 0 fail, ${outcome.changed ? 0 : 1} skipped`));
7814
+ print(ui_exports.style.header(`${outcome.changed ? 1 : 0} ok, 0 fail, ${outcome.changed ? 0 : 1} skipped`));
8936
7815
  logger.info({
8937
7816
  provider: notifications.providerName,
8938
7817
  changed: outcome.changed
@@ -9301,7 +8180,7 @@ async function runDoctorNotifications(input) {
9301
8180
  return report;
9302
8181
  };
9303
8182
  const refuse = (message, reason = message) => {
9304
- print(` ${style.fail(message)}`);
8183
+ print(` ${ui_exports.style.fail(message)}`);
9305
8184
  printCheckSummary({
9306
8185
  ok: 0,
9307
8186
  fail: 1,
@@ -9785,7 +8664,7 @@ async function runDoctorNotifications(input) {
9785
8664
  })), print);
9786
8665
  if (deliveryNote) {
9787
8666
  print("");
9788
- print(` ${style.skip(`note: ${deliveryNote}`)}`);
8667
+ print(` ${ui_exports.style.skip(`note: ${deliveryNote}`)}`);
9789
8668
  }
9790
8669
  const summary = summarise();
9791
8670
  printCheckSummary({
@@ -9793,7 +8672,7 @@ async function runDoctorNotifications(input) {
9793
8672
  fail: summary.fail,
9794
8673
  skip: summary.skip
9795
8674
  }, print);
9796
- if (input.post !== void 0) print(` ${style.skip(await postDoctorReport(notifications, input.post, {
8675
+ if (input.post !== void 0) print(` ${ui_exports.style.skip(await postDoctorReport(notifications, input.post, {
9797
8676
  checks,
9798
8677
  summary
9799
8678
  }))}`);
@@ -9805,7 +8684,7 @@ const doctorNotificationsCommand = {
9805
8684
  describe: "Check the layout against the server and the secrets store, step by step (a full run leaves one test post in the test channel; --built-only posts nothing unless --deliver)",
9806
8685
  builder: doctorNotificationsArgs,
9807
8686
  handler: async (argv) => {
9808
- const tokens = tokenContext(argv.token);
8687
+ const tokens = tokenContext$1(argv.token);
9809
8688
  if (!tokens) return;
9810
8689
  const loaded = await loadConfig(argv.cwd);
9811
8690
  applyResolvedConfig(argv, loaded.resolved);
@@ -10505,7 +9384,7 @@ const doctorRepoCommand = {
10505
9384
  command: "repo",
10506
9385
  describe: "Check the repository settings against the config (read-only): description, topics, labels, teams, protection, security",
10507
9386
  handler: async (argv) => {
10508
- const tokens = tokenContext(argv.token);
9387
+ const tokens = tokenContext$1(argv.token);
10509
9388
  if (!tokens) return;
10510
9389
  const loaded = await loadConfig(argv.cwd);
10511
9390
  applyResolvedConfig(argv, loaded.resolved);
@@ -10759,7 +9638,7 @@ const doctorSecretsCommand = {
10759
9638
  command: "secrets",
10760
9639
  describe: "Check the secrets the config says must exist against the ones the provider holds (read-only, names only)",
10761
9640
  handler: async (argv) => {
10762
- const tokens = tokenContext(argv.token);
9641
+ const tokens = tokenContext$1(argv.token);
10763
9642
  if (!tokens) return;
10764
9643
  const loaded = await loadConfig(argv.cwd);
10765
9644
  applyResolvedConfig(argv, loaded.resolved);
@@ -11051,7 +9930,7 @@ const DEEP_CHECKS = [
11051
9930
  command: "variables",
11052
9931
  describe: "Check the Actions variables the config declares against the ones the provider holds (read-only)",
11053
9932
  handler: async (argv) => {
11054
- const tokens = tokenContext(argv.token);
9933
+ const tokens = tokenContext$1(argv.token);
11055
9934
  if (!tokens) return;
11056
9935
  const loaded = await loadConfig(argv.cwd);
11057
9936
  applyResolvedConfig(argv, loaded.resolved);
@@ -11198,12 +10077,12 @@ const doctorArgs = (y) => {
11198
10077
  async function runDoctor(input) {
11199
10078
  const print = input.print ?? ((line) => console.log(line));
11200
10079
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
11201
- await withSpinner("Loading plugins…", () => loader.load());
10080
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
11202
10081
  assertPluginsResolvable(loader, "doctor");
11203
10082
  const rows = [];
11204
10083
  const config = input.loaded.resolved;
11205
10084
  print("");
11206
- print(style.dim(` config: ${input.loaded.filepath}`));
10085
+ print(ui_exports.style.dim(` config: ${input.loaded.filepath}`));
11207
10086
  print("");
11208
10087
  for (const failure of loader.loadFailures()) rows.push({
11209
10088
  capability: failure.key,
@@ -11219,12 +10098,12 @@ async function runDoctor(input) {
11219
10098
  const impls = loader.get(key);
11220
10099
  for (const [idx, impl] of impls.entries()) {
11221
10100
  const name = impl.providerName ?? providers[idx];
11222
- rows.push(await withProgress(`Checking ${key} (${name})…`, () => smokeCheck(key, name, impl)));
10101
+ rows.push(await withProgress$1(`Checking ${key} (${name})…`, () => smokeCheck(key, name, impl)));
11223
10102
  }
11224
10103
  } else {
11225
10104
  const impl = loader.get(key);
11226
10105
  const provider = providers[0] ?? "?";
11227
- const row = await withProgress(`Checking ${key} (${provider})…`, () => smokeCheck(key, provider, impl));
10106
+ const row = await withProgress$1(`Checking ${key} (${provider})…`, () => smokeCheck(key, provider, impl));
11228
10107
  rows.push(row);
11229
10108
  }
11230
10109
  }
@@ -11236,7 +10115,7 @@ async function runDoctor(input) {
11236
10115
  status: row.status,
11237
10116
  detail: row.logMessage ?? row.message
11238
10117
  }, `doctor: ${row.capability}`);
11239
- print(statusRow(row.status, [`${pad(row.capability, 14)} via ${pad(row.provider, 14)}`, row.message]));
10118
+ print((0, ui_exports.statusRow)(row.status, [`${(0, ui_exports.pad)(row.capability, 14)} via ${(0, ui_exports.pad)(row.provider, 14)}`, row.message]));
11240
10119
  }
11241
10120
  const summary = rows.reduce((acc, r) => {
11242
10121
  acc[r.status] += 1;
@@ -11248,7 +10127,7 @@ async function runDoctor(input) {
11248
10127
  });
11249
10128
  const summaryLine = `${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`;
11250
10129
  print("");
11251
- print(style.header(summaryLine));
10130
+ print(ui_exports.style.header(summaryLine));
11252
10131
  return {
11253
10132
  rows,
11254
10133
  summary
@@ -11312,6 +10191,14 @@ async function runSmokeCheck(key, provider, impl) {
11312
10191
  }
11313
10192
  return mk(key, provider, "skip", "loaded (no smoke check defined for this capability)");
11314
10193
  }
10194
+ case "projects": {
10195
+ const projects = impl;
10196
+ if (projects.whoami) {
10197
+ const who = await projects.whoami();
10198
+ return mk(key, provider, who.ok ? "ok" : "fail", `boards: ${who.boards} visible`);
10199
+ }
10200
+ return mk(key, provider, "skip", "loaded (no smoke check defined for this capability)");
10201
+ }
11315
10202
  case "auth": {
11316
10203
  const who = await impl.whoami();
11317
10204
  const details = who.details ? ` (${Object.entries(who.details).map(([k, v]) => `${k}=${v}`).join(", ")})` : "";
@@ -11384,7 +10271,7 @@ const doctorCommand = {
11384
10271
  describe: "Load the config and run a smoke check against every provider",
11385
10272
  builder: doctorArgs,
11386
10273
  handler: async (argv) => {
11387
- const tokens = tokenContext(argv.token);
10274
+ const tokens = tokenContext$1(argv.token);
11388
10275
  if (!tokens) return;
11389
10276
  const loaded = await loadConfig(argv.cwd);
11390
10277
  applyResolvedConfig(argv, loaded.resolved);
@@ -11591,7 +10478,7 @@ async function runGithubAppCreate(input) {
11591
10478
  return refuse("manifest", errorMessage(err));
11592
10479
  }
11593
10480
  const file = resolve(input.dir, input.file || DEFAULT_FILE);
11594
- const git = (input.isIgnored ?? isGitIgnored)(file);
10481
+ const git = (input.isIgnored ?? auth_exports.isGitIgnored)(file);
11595
10482
  if (git === "tracked" || git === "unknown") return refuse("not-ignored", git === "tracked" ? `refusing to write credentials to ${file}: git does not ignore it, so it could be committed` : `refusing to write credentials to ${file}: git could not say whether it ignores it`, "add it to .gitignore, or choose another path with --file");
11596
10483
  if (!input.force && (input.exists ?? existsSync)(file)) return refuse("exists", `${file} is already there and is never overwritten`, "delete it, or pass --force to replace it");
11597
10484
  const state = input.state ?? randomBytes(16).toString("hex");
@@ -11608,7 +10495,7 @@ async function runGithubAppCreate(input) {
11608
10495
  let app;
11609
10496
  try {
11610
10497
  print(`opening ${server.url} — press "Create GitHub App" on GitHub (this page waits up to five minutes)`);
11611
- (input.openUrl ?? openPath)(server.url);
10498
+ (input.openUrl ?? ui_exports.openPath)(server.url);
11612
10499
  app = await (input.convert ?? convertAppManifest)(await server.code);
11613
10500
  } catch (err) {
11614
10501
  return refuse("create", `the App was not created: ${errorMessage(err)}`);
@@ -11619,12 +10506,12 @@ async function runGithubAppCreate(input) {
11619
10506
  let identity;
11620
10507
  try {
11621
10508
  const lines = [
11622
- dotenvLine("GITHUB_APP_ID", String(app.id)),
11623
- dotenvLine("GITHUB_APP_PRIVATE_KEY", app.pem),
11624
- dotenvLine(input.webhookSecretVar || DEFAULT_WEBHOOK_SECRET_VAR, app.webhookSecret)
10509
+ (0, auth_exports.dotenvLine)("GITHUB_APP_ID", String(app.id)),
10510
+ (0, auth_exports.dotenvLine)("GITHUB_APP_PRIVATE_KEY", app.pem),
10511
+ (0, auth_exports.dotenvLine)(input.webhookSecretVar || DEFAULT_WEBHOOK_SECRET_VAR, app.webhookSecret)
11625
10512
  ];
11626
10513
  if (lines.includes(null)) throw new Error("a value cannot be written as a dotenv line");
11627
- identity = (input.writeFile ?? writeCredentialsFile)(file, `${lines.join("\n")}\n`, input.force === true);
10514
+ identity = (input.writeFile ?? auth_exports.writeCredentialsFile)(file, `${lines.join("\n")}\n`, input.force === true);
11628
10515
  } catch (err) {
11629
10516
  logger.warn({
11630
10517
  status: "fail",
@@ -11715,7 +10602,7 @@ const githubAppCreateCommand = {
11715
10602
  const githubAppCommand = {
11716
10603
  command: "github-app <subcommand>",
11717
10604
  describe: "Create and manage GitHub Apps",
11718
- builder: (y) => y.command(githubAppCreateCommand).command(groupMenu("github-app")),
10605
+ builder: (y) => y.command(githubAppCreateCommand).command(groupMenu$1("github-app")),
11719
10606
  handler: () => {}
11720
10607
  };
11721
10608
  // src/commands/menu/menu.command.ts
@@ -11729,7 +10616,7 @@ const githubAppCommand = {
11729
10616
  function printVersionHeaderOnce(version) {
11730
10617
  const marker = join(tmpdir(), `.holocron-version-shown-${process.ppid}`);
11731
10618
  if (existsSync(marker)) return;
11732
- console.log(style.dim(`v${version}`));
10619
+ console.log(ui_exports.style.dim(`v${version}`));
11733
10620
  writeFileSync(marker, "");
11734
10621
  }
11735
10622
  /** Bare `holocron` (hidden from --help): a menu of every command, with this repo's runnable tasks merged in. */
@@ -11940,9 +10827,9 @@ const monitoringCheckCommand = {
11940
10827
  describe: "Run every configured `monitoring` check against a given URL instead of its own configured url",
11941
10828
  builder: monitoringCheckArgs,
11942
10829
  handler: async (argv) => {
11943
- const tokens = tokenContext(argv.token);
10830
+ const tokens = tokenContext$1(argv.token);
11944
10831
  if (!tokens) return;
11945
- const [url] = await promptForPositionals(getEntry("monitoring check"), argv);
10832
+ const [url] = await (0, ui_exports.promptForPositionals)(getEntry("monitoring check"), argv);
11946
10833
  const loaded = await loadConfig(argv.cwd);
11947
10834
  applyResolvedConfig(argv, loaded.resolved);
11948
10835
  const { headers } = await resolveVercelBypassHeaders({
@@ -12000,7 +10887,7 @@ const monitoringResolveChecksCommand = {
12000
10887
  describe: "Load config/plugins and write the configured `monitoring` checks to a file as JSON — the untrusted half of the delivery.previewCheck split (holocron#1030/#1032)",
12001
10888
  builder: monitoringResolveChecksArgs,
12002
10889
  handler: async (argv) => {
12003
- const tokens = tokenContext(argv.token);
10890
+ const tokens = tokenContext$1(argv.token);
12004
10891
  if (!tokens) return;
12005
10892
  const loaded = await loadConfig(argv.cwd);
12006
10893
  applyResolvedConfig(argv, loaded.resolved);
@@ -12048,7 +10935,7 @@ const monitoringRunResolvedCommand = {
12048
10935
  const monitoringCommand = {
12049
10936
  command: "monitoring",
12050
10937
  describe: "Run monitoring checks ad hoc, outside the configured provider",
12051
- builder: (y) => y.command(monitoringCheckCommand).command(monitoringResolveChecksCommand).command(monitoringRunResolvedCommand).command(groupMenu("monitoring")),
10938
+ builder: (y) => y.command(monitoringCheckCommand).command(monitoringResolveChecksCommand).command(monitoringRunResolvedCommand).command(groupMenu$1("monitoring")),
12052
10939
  handler: () => {}
12053
10940
  };
12054
10941
  // src/commands/plugin-create/template-inputs/template-inputs.ts
@@ -13099,7 +11986,7 @@ const pluginCreateArgs = (y) => y.positional("slug", {
13099
11986
  describe: "Vendor display name (PascalCase)"
13100
11987
  }).option("capability", {
13101
11988
  type: "string",
13102
- describe: "Capability key: source|ci|secrets|environments|issues|deployment|storage|auth|vault|dns|tooling|notifications|analytics|errors|logs|wiki|workers|tunnels"
11989
+ describe: "Capability key: source|ci|secrets|environments|issues|deployment|storage|auth|vault|dns|tooling|notifications|analytics|errors|logs|wiki|workers|tunnels|projects"
13103
11990
  }).option("token-env", {
13104
11991
  type: "string",
13105
11992
  describe: "Holocron env var name (defaults to HOLOCRON_<VENDOR>_TOKEN)"
@@ -13121,7 +12008,7 @@ const pluginCreateCommand = {
13121
12008
  builder: pluginCreateArgs,
13122
12009
  handler: async (argv) => {
13123
12010
  try {
13124
- const [slug, vendor] = await promptForPositionals(getEntry("new plugin"), argv);
12011
+ const [slug, vendor] = await (0, ui_exports.promptForPositionals)(getEntry("new plugin"), argv);
13125
12012
  const { capability, vendorEnv, baseUrl } = await resolvePluginCreateInputs({
13126
12013
  capability: argv.capability,
13127
12014
  vendorEnv: argv.vendorEnv,
@@ -13807,7 +12694,7 @@ const newRepoCommand = {
13807
12694
  builder: newRepoArgs,
13808
12695
  handler: async (argv) => {
13809
12696
  try {
13810
- const tokens = tokenContext(argv.token);
12697
+ const tokens = tokenContext$1(argv.token);
13811
12698
  if (!tokens) return;
13812
12699
  const adminToken = tokens.cliTokens?.["github"] ?? tokens.cliToken;
13813
12700
  const answers = await askNewRepoAnswers(argv);
@@ -13860,7 +12747,7 @@ const newRepoCommand = {
13860
12747
  const newCommand = {
13861
12748
  command: "new",
13862
12749
  describe: "Scaffold a new repo or plugin",
13863
- builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(groupMenu("new")),
12750
+ builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(groupMenu$1("new")),
13864
12751
  handler: () => {}
13865
12752
  };
13866
12753
  // src/commands/notifications-create-server/find-guild-id.ts
@@ -14013,9 +12900,9 @@ async function runNotificationsCreateServer(input) {
14013
12900
  const dryRun = input.context.dryRun ?? false;
14014
12901
  const sleep = input.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
14015
12902
  const refuse = (message, reason = message) => {
14016
- print(` ${style.fail(message)}`);
12903
+ print(` ${ui_exports.style.fail(message)}`);
14017
12904
  print("");
14018
- print(style.header("0 ok, 1 fail, 0 skipped"));
12905
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
14019
12906
  logger.warn({ reason }, "notifications create-server");
14020
12907
  return {
14021
12908
  status: "fail",
@@ -14065,9 +12952,9 @@ async function runNotificationsCreateServer(input) {
14065
12952
  `write its id into ${input.loaded.filepath}`
14066
12953
  ];
14067
12954
  print("");
14068
- for (const step of steps) print(` ${style.skip(step)}`);
12955
+ for (const step of steps) print(` ${ui_exports.style.skip(step)}`);
14069
12956
  print("");
14070
- print(style.header("0 ok, 0 fail, 1 skipped"));
12957
+ print(ui_exports.style.header("0 ok, 0 fail, 1 skipped"));
14071
12958
  return { status: "dry-run" };
14072
12959
  }
14073
12960
  const lock = await lockConfig(input.loaded.filepath);
@@ -14075,7 +12962,7 @@ async function runNotificationsCreateServer(input) {
14075
12962
  const report = { status: "ok" };
14076
12963
  let ok = 0;
14077
12964
  const step = (line) => {
14078
- print(` ${style.success(line)}`);
12965
+ print(` ${ui_exports.style.success(line)}`);
14079
12966
  ok++;
14080
12967
  };
14081
12968
  try {
@@ -14091,7 +12978,7 @@ async function runNotificationsCreateServer(input) {
14091
12978
  const written = await writeGuildId(input.loaded.filepath, made.id);
14092
12979
  report.configUpdated = written.written;
14093
12980
  if (written.written) step(`wrote the server id into ${input.loaded.filepath}`);
14094
- else print(` ${style.fail(`could not update the config: ${written.reason}. Set guildId to ${made.id} by hand.`)}`);
12981
+ else print(` ${ui_exports.style.fail(`could not update the config: ${written.reason}. Set guildId to ${made.id} by hand.`)}`);
14095
12982
  } else if (notifications.serverOwner) {
14096
12983
  const owner = await notifications.serverOwner();
14097
12984
  if (!owner.isBot) return refuse("the server in the config is not owned by the bot, so there is nothing to hand over; check `guildId` names the server this run created");
@@ -14112,7 +12999,7 @@ async function runNotificationsCreateServer(input) {
14112
12999
  step(`invite for member ${input.owner} (one use, valid for a day): ${invite}`);
14113
13000
  const waitMs = input.waitMs ?? 9e5;
14114
13001
  const pollMs = input.pollMs ?? 5e3;
14115
- print(` ${style.skip(`waiting for member ${input.owner} to join (up to ${Math.round(waitMs / 6e4)} minutes)…`)}`);
13002
+ print(` ${ui_exports.style.skip(`waiting for member ${input.owner} to join (up to ${Math.round(waitMs / 6e4)} minutes)…`)}`);
14116
13003
  let waited = 0;
14117
13004
  while (!await notifications.hasMember(input.owner)) {
14118
13005
  if (waited >= waitMs) return refuse(`member ${input.owner} did not join in time; the server is ready and still owned by the bot. Open the invite, then run \`holocron notifications create-server --resume --owner ${input.owner}\``);
@@ -14132,7 +13019,7 @@ async function runNotificationsCreateServer(input) {
14132
13019
  await lock.release();
14133
13020
  }
14134
13021
  print("");
14135
- print(style.header(`${ok} ok, 0 fail, 0 skipped`));
13022
+ print(ui_exports.style.header(`${ok} ok, 0 fail, 0 skipped`));
14136
13023
  logger.info({ serverId: report.serverId }, "notifications create-server");
14137
13024
  return report;
14138
13025
  }
@@ -14162,7 +13049,7 @@ const notificationsCreateServerCommand = {
14162
13049
  describe: "Create the server the layout describes, apply it, invite its owner and hand it over",
14163
13050
  builder: notificationsCreateServerArgs,
14164
13051
  handler: async (argv) => {
14165
- const tokens = tokenContext(argv.token);
13052
+ const tokens = tokenContext$1(argv.token);
14166
13053
  if (!tokens) return;
14167
13054
  const loaded = await loadConfig(argv.cwd);
14168
13055
  applyResolvedConfig(argv, loaded.resolved);
@@ -14193,7 +13080,7 @@ const notificationsLinkCommand = {
14193
13080
  describe: "Link your server account to your GitHub account by signing in with the provider",
14194
13081
  builder: notificationsLinkArgs,
14195
13082
  handler: async (argv) => {
14196
- const tokens = tokenContext(argv.token);
13083
+ const tokens = tokenContext$1(argv.token);
14197
13084
  if (!tokens) return;
14198
13085
  const loaded = await loadConfig(argv.cwd);
14199
13086
  applyResolvedConfig(argv, loaded.resolved);
@@ -14223,7 +13110,7 @@ const notificationsSetupCommand = {
14223
13110
  describe: "Apply the server layout a notifications provider declares in holocron.config.ts",
14224
13111
  builder: notificationsSetupArgs,
14225
13112
  handler: async (argv) => {
14226
- const tokens = tokenContext(argv.token);
13113
+ const tokens = tokenContext$1(argv.token);
14227
13114
  if (!tokens) return;
14228
13115
  const loaded = await loadConfig(argv.cwd);
14229
13116
  applyResolvedConfig(argv, loaded.resolved);
@@ -14255,7 +13142,7 @@ const notificationsSyncRolesCommand = {
14255
13142
  describe: "Make who holds a server role match a team, through the links file",
14256
13143
  builder: notificationsSyncRolesArgs,
14257
13144
  handler: async (argv) => {
14258
- const tokens = tokenContext(argv.token);
13145
+ const tokens = tokenContext$1(argv.token);
14259
13146
  if (!tokens) return;
14260
13147
  const loaded = await loadConfig(argv.cwd);
14261
13148
  applyResolvedConfig(argv, loaded.resolved);
@@ -14305,9 +13192,9 @@ const notificationsChannelAddCommand = {
14305
13192
  describe: "Create a channel, optionally with a webhook whose URL is stored as a secret",
14306
13193
  builder: notificationsChannelAddArgs,
14307
13194
  handler: async (argv) => {
14308
- const tokens = tokenContext(argv.token);
13195
+ const tokens = tokenContext$1(argv.token);
14309
13196
  if (!tokens) return;
14310
- const [name] = await promptForPositionals(getEntry("notifications channel add"), argv);
13197
+ const [name] = await (0, ui_exports.promptForPositionals)(getEntry("notifications channel add"), argv);
14311
13198
  const loaded = await loadConfig(argv.cwd);
14312
13199
  applyResolvedConfig(argv, loaded.resolved);
14313
13200
  if ((await runNotificationsChannelAdd({
@@ -14333,14 +13220,14 @@ const notificationsChannelAddCommand = {
14333
13220
  const notificationsChannelCommand = {
14334
13221
  command: "channel",
14335
13222
  describe: "Manage notification channels",
14336
- builder: (y) => y.command(notificationsChannelAddCommand).command(groupMenu("notifications channel")),
13223
+ builder: (y) => y.command(notificationsChannelAddCommand).command(groupMenu$1("notifications channel")),
14337
13224
  handler: () => {}
14338
13225
  };
14339
13226
  // src/commands/notifications/notifications.command.ts
14340
13227
  const notificationsCommand = {
14341
13228
  command: "notifications",
14342
13229
  describe: "Provision notification channels, webhooks and roles",
14343
- builder: (y) => y.command(notificationsChannelCommand).command(notificationsSetupCommand).command(notificationsCreateServerCommand).command(notificationsLinkCommand).command(notificationsSyncRolesCommand).command(groupMenu("notifications")),
13230
+ builder: (y) => y.command(notificationsChannelCommand).command(notificationsSetupCommand).command(notificationsCreateServerCommand).command(notificationsLinkCommand).command(notificationsSyncRolesCommand).command(groupMenu$1("notifications")),
14344
13231
  handler: () => {}
14345
13232
  };
14346
13233
  // src/commands/move-tag/move-tag.ts
@@ -14469,7 +13356,7 @@ const moveTagCommand = {
14469
13356
  describe: "Move a version group's major tag (ci-v1) to its latest stable release (semantic-release publishCmd)",
14470
13357
  builder: moveTagArgs,
14471
13358
  handler: async (argv) => {
14472
- const [group] = await promptForPositionals(getEntry("package move-tag"), argv);
13359
+ const [group] = await (0, ui_exports.promptForPositionals)(getEntry("package move-tag"), argv);
14473
13360
  if ((await runMoveTag({
14474
13361
  group,
14475
13362
  cwd: argv.cwd,
@@ -14612,7 +13499,7 @@ const npmBumpVersionsCommand = {
14612
13499
  describe: "Bump all non-private package versions in lockstep (semantic-release prepareCmd)",
14613
13500
  builder: npmBumpVersionsArgs,
14614
13501
  handler: async (argv) => {
14615
- const [newVersion] = await promptForPositionals(getEntry("package bump-versions"), argv);
13502
+ const [newVersion] = await (0, ui_exports.promptForPositionals)(getEntry("package bump-versions"), argv);
14616
13503
  if ((await runNpmBumpVersions({
14617
13504
  version: newVersion,
14618
13505
  cwd: argv.cwd,
@@ -14745,9 +13632,9 @@ async function filterNewPackages(entries, cwd, exec, print, nameWidth, dirWidth)
14745
13632
  ], { cwd });
14746
13633
  const publishedVersion = view.exitCode === 0 ? view.stdout.trim() : "";
14747
13634
  if (publishedVersion) {
14748
- print(statusRow("skip", [
14749
- pad(entry.name, nameWidth),
14750
- pad(entry.dir, dirWidth),
13635
+ print((0, ui_exports.statusRow)("skip", [
13636
+ (0, ui_exports.pad)(entry.name, nameWidth),
13637
+ (0, ui_exports.pad)(entry.dir, dirWidth),
14751
13638
  `already published (v${publishedVersion})`
14752
13639
  ]));
14753
13640
  continue;
@@ -14875,7 +13762,7 @@ function workspaceFilterArgs(cwd, scope = {}) {
14875
13762
  function printSummary(print, dryRun, publishedCount, failedCount, skippedCount) {
14876
13763
  const summary = `${publishedCount} published, ${failedCount} failed, ${skippedCount} skipped`;
14877
13764
  print("");
14878
- print(dryRun ? style.dim(` dry-run: ${summary}`) : failedCount > 0 ? style.fail(` ${summary}`) : style.success(` ${summary}`));
13765
+ print(dryRun ? ui_exports.style.dim(` dry-run: ${summary}`) : failedCount > 0 ? ui_exports.style.fail(` ${summary}`) : ui_exports.style.success(` ${summary}`));
14879
13766
  }
14880
13767
  async function runPublish(input = {}) {
14881
13768
  const print = input.print ?? ((line) => console.log(line));
@@ -14892,7 +13779,7 @@ async function runPublish(input = {}) {
14892
13779
  dryRun: dryRun || void 0
14893
13780
  }, "publish --initial: start");
14894
13781
  print("");
14895
- print(style.dim(" → verifying npm auth (`npm whoami`)…"));
13782
+ print(ui_exports.style.dim(" → verifying npm auth (`npm whoami`)…"));
14896
13783
  let whoami = await exec("npm", ["whoami"], { cwd });
14897
13784
  if (whoami.exitCode !== 0) {
14898
13785
  print(" not authenticated — running `npm login --auth-type=web`…");
@@ -14922,9 +13809,9 @@ async function runPublish(input = {}) {
14922
13809
  }
14923
13810
  }
14924
13811
  const whoamiName = whoami.stdout.trim() || "<unknown>";
14925
- print(style.dim(` ✓ authed as ${whoamiName}`));
13812
+ print(ui_exports.style.dim(` ✓ authed as ${whoamiName}`));
14926
13813
  print("");
14927
- if (otp) print(style.dim(` otp: <${otp.length} chars>`));
13814
+ if (otp) print(ui_exports.style.dim(` otp: <${otp.length} chars>`));
14928
13815
  const discoveredEntries = input.packages ?? discoverPublicPackageEntries(cwd, scopeOf(input));
14929
13816
  const nameWidth = Math.max(0, ...discoveredEntries.map((e) => e.name.length));
14930
13817
  const dirWidth = Math.max(0, ...discoveredEntries.map((e) => e.dir.length));
@@ -14971,8 +13858,8 @@ async function runPublish(input = {}) {
14971
13858
  ];
14972
13859
  if (dryRun) {
14973
13860
  print("");
14974
- for (const entry of newEntries) print(style.dim(` ${pad(entry.name, nameWidth)} ${pad(entry.dir, dirWidth)} would publish (v${entry.version})`));
14975
- print(style.dim(` would run: pnpm ${redactOtp(publishArgs, otp).join(" ")}`));
13861
+ for (const entry of newEntries) print(ui_exports.style.dim(` ${(0, ui_exports.pad)(entry.name, nameWidth)} ${(0, ui_exports.pad)(entry.dir, dirWidth)} would publish (v${entry.version})`));
13862
+ print(ui_exports.style.dim(` would run: pnpm ${redactOtp(publishArgs, otp).join(" ")}`));
14976
13863
  printSummary(print, dryRun, packageNames.length, 0, skippedCount);
14977
13864
  printNextSteps(print, env, packageNames, identity);
14978
13865
  logger.info({
@@ -14997,9 +13884,9 @@ async function runPublish(input = {}) {
14997
13884
  print(" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:");
14998
13885
  print(` pnpm exec tsx cli/cli/src/cli.ts package publish --initial --otp <6-digit-code>`);
14999
13886
  }
15000
- for (const entry of newEntries) print(statusRow("fail", [
15001
- pad(entry.name, nameWidth),
15002
- pad(entry.dir, dirWidth),
13887
+ for (const entry of newEntries) print((0, ui_exports.statusRow)("fail", [
13888
+ (0, ui_exports.pad)(entry.name, nameWidth),
13889
+ (0, ui_exports.pad)(entry.dir, dirWidth),
15003
13890
  "publish failed"
15004
13891
  ]));
15005
13892
  printSummary(print, dryRun, 0, packageNames.length, skippedCount);
@@ -15013,9 +13900,9 @@ async function runPublish(input = {}) {
15013
13900
  packageNames
15014
13901
  };
15015
13902
  }
15016
- for (const entry of newEntries) print(statusRow("ok", [
15017
- pad(entry.name, nameWidth),
15018
- pad(entry.dir, dirWidth),
13903
+ for (const entry of newEntries) print((0, ui_exports.statusRow)("ok", [
13904
+ (0, ui_exports.pad)(entry.name, nameWidth),
13905
+ (0, ui_exports.pad)(entry.dir, dirWidth),
15019
13906
  `published (v${entry.version})`
15020
13907
  ]));
15021
13908
  printSummary(print, dryRun, packageNames.length, 0, skippedCount);
@@ -15481,7 +14368,7 @@ const publishCommand = {
15481
14368
  const packageCommand = {
15482
14369
  command: "package",
15483
14370
  describe: "Version and publish workspace packages",
15484
- builder: (y) => y.command(npmBumpVersionsCommand).command(moveTagCommand).command(publishCommand).command(groupMenu("package")),
14371
+ builder: (y) => y.command(npmBumpVersionsCommand).command(moveTagCommand).command(publishCommand).command(groupMenu$1("package")),
15485
14372
  handler: () => {}
15486
14373
  };
15487
14374
  // src/commands/probe/probe.args.ts
@@ -17242,7 +16129,7 @@ function listProbes(groups) {
17242
16129
  const lines = [];
17243
16130
  const width = Math.max(0, ...[...groups.values()].flatMap((g) => Object.keys(g).map((n) => n.length)));
17244
16131
  for (const [provider, probes] of [...groups].sort(([a], [b]) => a.localeCompare(b))) {
17245
- lines.push(style.header(provider));
16132
+ lines.push(ui_exports.style.header(provider));
17246
16133
  for (const [name, probe] of Object.entries(probes).sort(([a], [b]) => a.localeCompare(b))) {
17247
16134
  const mark = probe.writes ? " (changes things)" : "";
17248
16135
  lines.push(` ${name.padEnd(width)} ${probe.summary}${mark}`);
@@ -17484,7 +16371,7 @@ const defaultInterrupt = (handler) => {
17484
16371
  * failed or was interrupted.
17485
16372
  */
17486
16373
  async function runProbe(input) {
17487
- const progress = createProgress(input.print ?? ((line) => console.log(line)));
16374
+ const progress = createProgress$1(input.print ?? ((line) => console.log(line)));
17488
16375
  const print = progress.print;
17489
16376
  const secrets = new Set(input.secrets ?? []);
17490
16377
  const scrub = createScrubber(secrets);
@@ -17496,11 +16383,11 @@ async function runProbe(input) {
17496
16383
  ...row.detail ? { detail: scrub(sanitizeDetail(row.detail)) } : {}
17497
16384
  };
17498
16385
  rows.push(clean);
17499
- if (clean.status === "heading") print(`\n ${style.header(clean.label)}`);
17500
- else print(statusRow(clean.status === "info" ? "skip" : clean.status, [clean.label, clean.detail ?? ""]));
16386
+ if (clean.status === "heading") print(`\n ${ui_exports.style.header(clean.label)}`);
16387
+ else print((0, ui_exports.statusRow)(clean.status === "info" ? "skip" : clean.status, [clean.label, clean.detail ?? ""]));
17501
16388
  };
17502
16389
  if (input.probe.writes && !input.dryRun && !input.yes) {
17503
- if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`${input.name}\` changes things on ${input.provider} (${input.probe.summary}); pass --yes to run it without asking`);
16390
+ if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new ui_exports.NonInteractiveError(`\`${input.name}\` changes things on ${input.provider} (${input.probe.summary}); pass --yes to run it without asking`);
17504
16391
  if (!await (input.confirm ?? ((message) => confirm({
17505
16392
  message,
17506
16393
  default: false
@@ -17880,7 +16767,7 @@ async function runProbeCommand(input) {
17880
16767
  }
17881
16768
  const probes = groups.get(input.provider);
17882
16769
  if (!probes) {
17883
- print(statusRow("fail", [`no probes for \`${input.provider}\``, `try: ${[...groups.keys()].sort().join(", ")}`]));
16770
+ print((0, ui_exports.statusRow)("fail", [`no probes for \`${input.provider}\``, `try: ${[...groups.keys()].sort().join(", ")}`]));
17884
16771
  return { status: "fail" };
17885
16772
  }
17886
16773
  if (!input.probe) {
@@ -17889,7 +16776,7 @@ async function runProbeCommand(input) {
17889
16776
  }
17890
16777
  const probe = probes[input.probe];
17891
16778
  if (!probe) {
17892
- print(statusRow("fail", [`\`${input.provider}\` has no probe \`${input.probe}\``, `try: ${Object.keys(probes).sort().join(", ")}`]));
16779
+ print((0, ui_exports.statusRow)("fail", [`\`${input.provider}\` has no probe \`${input.probe}\``, `try: ${Object.keys(probes).sort().join(", ")}`]));
17893
16780
  return { status: "fail" };
17894
16781
  }
17895
16782
  const tokens = [input.context.cliToken, ...Object.values(input.context.cliTokens ?? {})].filter((t) => typeof t === "string");
@@ -17915,7 +16802,7 @@ const probeCommand = {
17915
16802
  describe: "Poke a live provider on purpose: inspect it, or run a proof that cleans up after itself",
17916
16803
  builder: probeArgs,
17917
16804
  handler: async (argv) => {
17918
- const tokens = tokenContext(argv.token);
16805
+ const tokens = tokenContext$1(argv.token);
17919
16806
  if (!tokens) return;
17920
16807
  const loaded = await loadConfig(argv.cwd);
17921
16808
  applyResolvedConfig(argv, loaded.resolved);
@@ -18391,7 +17278,7 @@ async function execStep(capability, step, dryRun, body, opts = {}) {
18391
17278
  status: "dry-run"
18392
17279
  };
18393
17280
  try {
18394
- const note = await withProgress(`${capability}: ${step}…`, body);
17281
+ const note = await withProgress$1(`${capability}: ${step}…`, body);
18395
17282
  const result = {
18396
17283
  capability,
18397
17284
  step,
@@ -18434,12 +17321,12 @@ function classify403(err) {
18434
17321
  }
18435
17322
  function formatStep(step) {
18436
17323
  const tag = step.reason === "permissions" ? " [permissions]" : step.reason === "plan" ? " [plan restriction]" : "";
18437
- const detail = step.message ? style.dim(` (${step.message})`) : "";
17324
+ const detail = step.message ? ui_exports.style.dim(` (${step.message})`) : "";
18438
17325
  const label = `${step.step}${tag}${detail}`;
18439
- if (step.status === "ok") return ` ${style.success(label)}`;
18440
- if (step.status === "fail") return ` ${style.fail(label)}`;
18441
- if (step.status === "dry-run") return ` ${style.dim(`… ${label}`)}`;
18442
- return ` ${style.dim(`· ${label}`)}`;
17326
+ if (step.status === "ok") return ` ${ui_exports.style.success(label)}`;
17327
+ if (step.status === "fail") return ` ${ui_exports.style.fail(label)}`;
17328
+ if (step.status === "dry-run") return ` ${ui_exports.style.dim(`… ${label}`)}`;
17329
+ return ` ${ui_exports.style.dim(`· ${label}`)}`;
18443
17330
  }
18444
17331
  // src/commands/setup/skills/skills.ts
18445
17332
  async function fetchExternalSkill(entry) {
@@ -18639,7 +17526,7 @@ async function runSetup(input) {
18639
17526
  const print = input.print ?? ((line) => console.log(line));
18640
17527
  const logger = getLogger();
18641
17528
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
18642
- await withSpinner("Loading plugins…", () => loader.load());
17529
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
18643
17530
  assertPluginsResolvable(loader, "repo setup");
18644
17531
  const config = input.loaded.resolved;
18645
17532
  const dryRun = input.context.dryRun ?? false;
@@ -18650,12 +17537,12 @@ async function runSetup(input) {
18650
17537
  fallback: "start",
18651
17538
  realpath: true
18652
17539
  }), input.loaded.filepath);
18653
- print(style.header(`Holocron setup — ${config.name}${dryRun ? " (dry-run)" : ""}`));
18654
- print(style.dim(` config: ${input.loaded.filepath}`));
17540
+ print(ui_exports.style.header(`Holocron setup — ${config.name}${dryRun ? " (dry-run)" : ""}`));
17541
+ print(ui_exports.style.dim(` config: ${input.loaded.filepath}`));
18655
17542
  print("");
18656
17543
  if (loader.has("source")) {
18657
17544
  const source = loader.get("source");
18658
- print(style.step("source"));
17545
+ print(ui_exports.style.step("source"));
18659
17546
  const SECURITY_SKIP_CODES = {
18660
17547
  enableSecretScanning: [422],
18661
17548
  enablePrivateVulnerabilityReporting: [404]
@@ -18699,7 +17586,7 @@ async function runSetup(input) {
18699
17586
  }
18700
17587
  if (loader.has("source")) {
18701
17588
  const source = loader.get("source");
18702
- if (config.tasks && config.tasks.length > 0) print(style.step("workflows"));
17589
+ if (config.tasks && config.tasks.length > 0) print(ui_exports.style.step("workflows"));
18703
17590
  for (const entry of await generateRepoFiles({
18704
17591
  loaded: input.loaded,
18705
17592
  repoRoot: input.context.repoRoot,
@@ -18868,7 +17755,7 @@ async function runSetup(input) {
18868
17755
  }
18869
17756
  if (loader.has("environments")) {
18870
17757
  const envs = loader.get("environments");
18871
- print(style.step("environments"));
17758
+ print(ui_exports.style.step("environments"));
18872
17759
  for (const envName of SETUP_ENVIRONMENTS) {
18873
17760
  steps.push(await runStep("environments", `upsert ${envName}`, dryRun, async () => {
18874
17761
  await envs.upsertEnvironment({ name: envName });
@@ -18888,7 +17775,7 @@ async function runSetup(input) {
18888
17775
  } catch (err) {
18889
17776
  if (!(err instanceof AuthError)) throw err;
18890
17777
  }
18891
- print(style.step("docs"));
17778
+ print(ui_exports.style.step("docs"));
18892
17779
  if (!deployToken) {
18893
17780
  steps.push({
18894
17781
  capability: "source",
@@ -18910,7 +17797,7 @@ async function runSetup(input) {
18910
17797
  }
18911
17798
  if (loader.has("wiki")) {
18912
17799
  const wiki = loader.get("wiki");
18913
- print(style.step("wiki"));
17800
+ print(ui_exports.style.step("wiki"));
18914
17801
  steps.push(await runStep("wiki", "provision wiki config", dryRun, async () => {
18915
17802
  return await wiki.provision({ name: config.name });
18916
17803
  }));
@@ -18938,7 +17825,7 @@ async function runSetup(input) {
18938
17825
  }
18939
17826
  if (loader.has("deployment")) {
18940
17827
  const deploy = loader.get("deployment");
18941
- print(style.step("deployment"));
17828
+ print(ui_exports.style.step("deployment"));
18942
17829
  const previewCfg = previewConfigOf(config);
18943
17830
  const ensureCustomDomain = async (projectId, hostname) => {
18944
17831
  if (!deploy.ensureCustomDomain) return;
@@ -18998,7 +17885,7 @@ async function runSetup(input) {
18998
17885
  }
18999
17886
  if (loader.has("auth")) {
19000
17887
  const auth = loader.get("auth");
19001
- print(style.step("auth"));
17888
+ print(ui_exports.style.step("auth"));
19002
17889
  if (auth.ensureWebhookApp) {
19003
17890
  steps.push(await runStep("auth", "ensureWebhookApp", dryRun, async () => {
19004
17891
  return `webhook ${(await auth.ensureWebhookApp()).alreadyExists ? "exists" : "created"}`;
@@ -19016,7 +17903,7 @@ async function runSetup(input) {
19016
17903
  }
19017
17904
  if (loader.has("vault")) {
19018
17905
  const vault = loader.get("vault");
19019
- print(style.step("vault"));
17906
+ print(ui_exports.style.step("vault"));
19020
17907
  if (vault.ensureProject) {
19021
17908
  steps.push(await runStep("vault", `ensureProject ${config.name}`, dryRun, async () => {
19022
17909
  return `project ${(await vault.ensureProject(config.name)).alreadyExists ? "exists" : "created"}`;
@@ -19054,7 +17941,7 @@ async function runSetup(input) {
19054
17941
  }
19055
17942
  if (loader.has("errors")) {
19056
17943
  const errors = loader.get("errors");
19057
- print(style.step("errors"));
17944
+ print(ui_exports.style.step("errors"));
19058
17945
  if (errors.ensureProject) {
19059
17946
  let dsn;
19060
17947
  steps.push(await runStep("errors", `ensureProject ${config.name}`, dryRun, async () => {
@@ -19077,7 +17964,7 @@ async function runSetup(input) {
19077
17964
  }
19078
17965
  if (loader.has("logs")) {
19079
17966
  const logs = loader.get("logs");
19080
- print(style.step("logs"));
17967
+ print(ui_exports.style.step("logs"));
19081
17968
  if (logs.ensureDataset) for (const dataset of ["holocron-ci", "holocron-local"]) {
19082
17969
  steps.push(await runStep("logs", `ensureDataset ${dataset}`, dryRun, async () => {
19083
17970
  const result = await logs.ensureDataset(dataset);
@@ -19088,7 +17975,7 @@ async function runSetup(input) {
19088
17975
  }
19089
17976
  if (loader.has("monitoring")) {
19090
17977
  const monitoring = loader.get("monitoring");
19091
- print(style.step("monitoring"));
17978
+ print(ui_exports.style.step("monitoring"));
19092
17979
  for (const checkInput of monitoring.checks) {
19093
17980
  steps.push(await runStep("monitoring", `ensureCheck ${checkInput.name}`, dryRun, async () => {
19094
17981
  const result = await monitoring.ensureCheck(checkInput);
@@ -19099,7 +17986,7 @@ async function runSetup(input) {
19099
17986
  }
19100
17987
  if (loader.has("tooling")) {
19101
17988
  const tools = loader.get("tooling");
19102
- print(style.step("tooling"));
17989
+ print(ui_exports.style.step("tooling"));
19103
17990
  for (const tool of tools) {
19104
17991
  steps.push(await runStep("tooling", `${tool.providerName}.sync`, dryRun, async () => {
19105
17992
  await tool.sync();
@@ -19108,7 +17995,7 @@ async function runSetup(input) {
19108
17995
  }
19109
17996
  }
19110
17997
  if (config.skills && config.skills.length > 0 && config.agent) {
19111
- print(style.step("skills"));
17998
+ print(ui_exports.style.step("skills"));
19112
17999
  if (!(config.agent in AGENT_SYMLINK_PATHS)) steps.push({
19113
18000
  capability: "skills",
19114
18001
  step: "install skills",
@@ -19125,14 +18012,14 @@ async function runSetup(input) {
19125
18012
  print(formatStep(steps[steps.length - 1]));
19126
18013
  }
19127
18014
  if (config.agent) {
19128
- print(style.step("prompts"));
18015
+ print(ui_exports.style.step("prompts"));
19129
18016
  steps.push(await runStep("prompts", "install agent prompts", dryRun, async () => {
19130
18017
  return await installAgentPrompts({ repoRoot: input.context.repoRoot });
19131
18018
  }));
19132
18019
  print(formatStep(steps[steps.length - 1]));
19133
18020
  }
19134
18021
  if (config.docs) {
19135
- print(style.step("engineering"));
18022
+ print(ui_exports.style.step("engineering"));
19136
18023
  steps.push(await runStep("engineering", "provision engineering structure", dryRun, async () => {
19137
18024
  return await installEngineeringStructure({ repoRoot: input.context.repoRoot });
19138
18025
  }));
@@ -19152,56 +18039,56 @@ async function runSetup(input) {
19152
18039
  });
19153
18040
  print("");
19154
18041
  const summaryLine = ` ${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${dryRun ? `, ${summary.dryRun} would-do` : ""}`;
19155
- print(summary.fail > 0 ? style.fail(summaryLine.trim()) : style.success(summaryLine.trim()));
18042
+ print(summary.fail > 0 ? ui_exports.style.fail(summaryLine.trim()) : ui_exports.style.success(summaryLine.trim()));
19156
18043
  const skippedSteps = steps.filter((s) => s.status === "skip");
19157
18044
  if (skippedSteps.length > 0) {
19158
18045
  print("");
19159
- print(style.hint(" Skipped:"));
18046
+ print(ui_exports.style.hint(" Skipped:"));
19160
18047
  for (const s of skippedSteps)
19161
18048
  /* v8 ignore next -- all skip steps set message; empty fallback is defensive */
19162
- print(style.hint(` · ${s.step}${s.message ? ` (${s.message})` : ""}`));
18049
+ print(ui_exports.style.hint(` · ${s.step}${s.message ? ` (${s.message})` : ""}`));
19163
18050
  }
19164
18051
  if (steps.some((s) => s.reason === "permissions")) {
19165
18052
  print("");
19166
- print(style.warn("Some steps failed with 403 (insufficient token permissions)."));
19167
- print(style.hint(" Repo-scoped operations (rulesets, settings, workflows) require a"));
19168
- print(style.hint(" fine-grained PAT passed via --token or HOLOCRON_ADMIN_TOKEN:"));
18053
+ print(ui_exports.style.warn("Some steps failed with 403 (insufficient token permissions)."));
18054
+ print(ui_exports.style.hint(" Repo-scoped operations (rulesets, settings, workflows) require a"));
18055
+ print(ui_exports.style.hint(" fine-grained PAT passed via --token or HOLOCRON_ADMIN_TOKEN:"));
19169
18056
  print("");
19170
- print(style.hint(" · Administration — read and write"));
19171
- print(style.hint(" · Code scanning alerts — read and write"));
19172
- print(style.hint(" · Contents — read and write"));
19173
- print(style.hint(" · Custom properties — read and write"));
19174
- print(style.hint(" · Environments — read and write"));
19175
- print(style.hint(" · Issues — read and write (labels)"));
19176
- print(style.hint(" · Secret scanning alerts — read and write"));
19177
- print(style.hint(" · Secrets — read and write"));
19178
- print(style.hint(" · Variables — read and write (Actions variables)"));
19179
- print(style.hint(" · Workflows — read and write"));
19180
- print(style.hint(" · Metadata — read (added automatically)"));
18057
+ print(ui_exports.style.hint(" · Administration — read and write"));
18058
+ print(ui_exports.style.hint(" · Code scanning alerts — read and write"));
18059
+ print(ui_exports.style.hint(" · Contents — read and write"));
18060
+ print(ui_exports.style.hint(" · Custom properties — read and write"));
18061
+ print(ui_exports.style.hint(" · Environments — read and write"));
18062
+ print(ui_exports.style.hint(" · Issues — read and write (labels)"));
18063
+ print(ui_exports.style.hint(" · Secret scanning alerts — read and write"));
18064
+ print(ui_exports.style.hint(" · Secrets — read and write"));
18065
+ print(ui_exports.style.hint(" · Variables — read and write (Actions variables)"));
18066
+ print(ui_exports.style.hint(" · Workflows — read and write"));
18067
+ print(ui_exports.style.hint(" · Metadata — read (added automatically)"));
19181
18068
  print("");
19182
- print(style.hint(" Org-scoped operations (teams, organization Actions variables) require"));
19183
- print(style.hint(" HOLOCRON_ORG_TOKEN — a fine-grained PAT with resource owner set to the org:"));
18069
+ print(ui_exports.style.hint(" Org-scoped operations (teams, organization Actions variables) require"));
18070
+ print(ui_exports.style.hint(" HOLOCRON_ORG_TOKEN — a fine-grained PAT with resource owner set to the org:"));
19184
18071
  print("");
19185
- print(style.hint(" · Administration — read and write (repository permission)"));
19186
- print(style.hint(" · Members — read (organization permission)"));
19187
- print(style.hint(" · Variables — read and write (organization permission)"));
19188
- print(style.hint(" · Metadata — read (repository permission, auto-included)"));
18072
+ print(ui_exports.style.hint(" · Administration — read and write (repository permission)"));
18073
+ print(ui_exports.style.hint(" · Members — read (organization permission)"));
18074
+ print(ui_exports.style.hint(" · Variables — read and write (organization permission)"));
18075
+ print(ui_exports.style.hint(" · Metadata — read (repository permission, auto-included)"));
19189
18076
  print("");
19190
18077
  if (steps.some((s) => s.reason === "permissions" && /GitHub Pages/.test(s.step))) {
19191
18078
  print("");
19192
- print(style.hint(" GitHub Pages uses HOLOCRON_DEPLOY_TOKEN (keyring key github.deploy):"));
18079
+ print(ui_exports.style.hint(" GitHub Pages uses HOLOCRON_DEPLOY_TOKEN (keyring key github.deploy):"));
19193
18080
  print("");
19194
- print(style.hint(" · Pages — read and write"));
19195
- print(style.hint(" · Administration — read and write"));
19196
- print(style.hint(" · Metadata — read (added automatically)"));
18081
+ print(ui_exports.style.hint(" · Pages — read and write"));
18082
+ print(ui_exports.style.hint(" · Administration — read and write"));
18083
+ print(ui_exports.style.hint(" · Metadata — read (added automatically)"));
19197
18084
  }
19198
18085
  print("");
19199
- print(style.hint(" Create tokens at: https://github.com/settings/personal-access-tokens/new"));
19200
- print(style.hint(" Store them: HOLOCRON_ADMIN_TOKEN / HOLOCRON_ORG_TOKEN / HOLOCRON_DEPLOY_TOKEN env vars,"));
19201
- print(style.hint(" or keyring keys github.admin / github.org / github.deploy"));
19202
- print(style.hint(" Then re-run: holocron repo setup"));
19203
- print(style.hint(" (--token <pat> overrides every token, the org one included; use it only when one"));
19204
- print(style.hint(" token covers everything.)"));
18086
+ print(ui_exports.style.hint(" Create tokens at: https://github.com/settings/personal-access-tokens/new"));
18087
+ print(ui_exports.style.hint(" Store them: HOLOCRON_ADMIN_TOKEN / HOLOCRON_ORG_TOKEN / HOLOCRON_DEPLOY_TOKEN env vars,"));
18088
+ print(ui_exports.style.hint(" or keyring keys github.admin / github.org / github.deploy"));
18089
+ print(ui_exports.style.hint(" Then re-run: holocron repo setup"));
18090
+ print(ui_exports.style.hint(" (--token <pat> overrides every token, the org one included; use it only when one"));
18091
+ print(ui_exports.style.hint(" token covers everything.)"));
19205
18092
  }
19206
18093
  return {
19207
18094
  steps,
@@ -19247,7 +18134,7 @@ const setupCommand = {
19247
18134
  describe: "Apply infra setup actions across every configured capability",
19248
18135
  builder: setupArgs,
19249
18136
  handler: async (argv) => {
19250
- const tokens = tokenContext(argv.token);
18137
+ const tokens = tokenContext$1(argv.token);
19251
18138
  if (!tokens) return;
19252
18139
  const loaded = await loadConfig(argv.cwd);
19253
18140
  applyResolvedConfig(argv, loaded.resolved);
@@ -19451,7 +18338,7 @@ const SKIP_LABEL = {
19451
18338
  /** A row's label: the name, where it lives, when it was last committed to (local only) and its PR. */
19452
18339
  function rowLabel(entry) {
19453
18340
  const detail = [entry.date?.slice(0, 10), entry.pr === void 0 ? void 0 : `PR #${entry.pr}`].filter(Boolean);
19454
- return `${entry.name} [${entry.locations.join(", ")}]${detail.length > 0 ? ` ${style.dim(detail.join(" "))}` : ""}`;
18341
+ return `${entry.name} [${entry.locations.join(", ")}]${detail.length > 0 ? ` ${ui_exports.style.dim(detail.join(" "))}` : ""}`;
19455
18342
  }
19456
18343
  /**
19457
18344
  * Classifies the branches against the provider's pull requests, shows them grouped, and deletes the ones
@@ -19512,17 +18399,17 @@ async function runCleanupBranches(input) {
19512
18399
  for (const group of GROUPS) {
19513
18400
  const rows = entries.filter((e) => e.group === group);
19514
18401
  const line = `${rows.length} ${GROUP_LABEL[group]}`;
19515
- print(SAFE.includes(group) ? style.success(line) : style.warn(line));
18402
+ print(SAFE.includes(group) ? ui_exports.style.success(line) : ui_exports.style.warn(line));
19516
18403
  for (const row of rows) print(` ${rowLabel(row)}`);
19517
18404
  }
19518
18405
  if (classification.skipped.length > 0) {
19519
- print(style.dim(`${classification.skipped.length} skipped`));
19520
- for (const { ref, reason } of classification.skipped) print(style.dim(` ${ref.name} [${ref.where}] ${SKIP_LABEL[reason]}`));
18406
+ print(ui_exports.style.dim(`${classification.skipped.length} skipped`));
18407
+ for (const { ref, reason } of classification.skipped) print(ui_exports.style.dim(` ${ref.name} [${ref.where}] ${SKIP_LABEL[reason]}`));
19521
18408
  }
19522
18409
  print("");
19523
18410
  const safe = entries.filter((e) => SAFE.includes(e.group));
19524
18411
  if (input.context.dryRun === true) {
19525
- print(style.dim(`Dry run: ${safe.length} branches are proven merged. Nothing was deleted.`));
18412
+ print(ui_exports.style.dim(`Dry run: ${safe.length} branches are proven merged. Nothing was deleted.`));
19526
18413
  logger.info({
19527
18414
  proven: safe.length,
19528
18415
  deleted: 0
@@ -19532,7 +18419,7 @@ async function runCleanupBranches(input) {
19532
18419
  if (entries.length === 0) return report;
19533
18420
  let chosen = safe;
19534
18421
  if (input.yes !== true) {
19535
- if (!process.stdin.isTTY) throw new NonInteractiveError("`repo cleanup branches` asks which branches to delete — run it in a terminal, or pass --yes to delete the proven-merged ones, or --dry-run to only list them");
18422
+ if (!process.stdin.isTTY) throw new ui_exports.NonInteractiveError("`repo cleanup branches` asks which branches to delete — run it in a terminal, or pass --yes to delete the proven-merged ones, or --dry-run to only list them");
19536
18423
  if (!await confirm({
19537
18424
  message: "Choose branches to delete?",
19538
18425
  default: true
@@ -19565,7 +18452,7 @@ async function runCleanupBranches(input) {
19565
18452
  message: errorMessage(err)
19566
18453
  });
19567
18454
  }
19568
- for (const { name, where, message } of report.failed) print(style.fail(`${name} [${where}]: ${message}`));
18455
+ for (const { name, where, message } of report.failed) print(ui_exports.style.fail(`${name} [${where}]: ${message}`));
19569
18456
  print(`Deleted ${report.deleted.length} of ${report.deleted.length + report.failed.length} branches.`);
19570
18457
  if (report.failed.length > 0) report.status = "fail";
19571
18458
  logger.info({
@@ -19594,7 +18481,7 @@ const repoCleanupBranchesCommand = {
19594
18481
  describe: "List the branches whose pull request is merged and delete the ones you pick (local, remote or both)",
19595
18482
  builder: repoCleanupBranchesArgs,
19596
18483
  handler: async (argv) => {
19597
- const tokens = tokenContext(argv.token);
18484
+ const tokens = tokenContext$1(argv.token);
19598
18485
  if (!tokens) return;
19599
18486
  const loaded = await loadConfig(argv.cwd);
19600
18487
  applyResolvedConfig(argv, loaded.resolved);
@@ -19616,7 +18503,7 @@ const repoCleanupBranchesCommand = {
19616
18503
  const repoCleanupCommand = {
19617
18504
  command: "cleanup",
19618
18505
  describe: "Clean up what a repo accumulates (merged branches)",
19619
- builder: (y) => y.command(repoCleanupBranchesCommand).command(groupMenu("repo cleanup")),
18506
+ builder: (y) => y.command(repoCleanupBranchesCommand).command(groupMenu$1("repo cleanup")),
19620
18507
  handler: () => {}
19621
18508
  };
19622
18509
  // src/commands/sync-readme/generate-readme.ts
@@ -19814,8 +18701,8 @@ async function runSyncReadme(input) {
19814
18701
  const logger = input.logger ?? getLogger();
19815
18702
  const { repoRoot, dryRun = false } = context;
19816
18703
  const namespaces = loaded.resolved.env?.namespaces ?? [];
19817
- print(style.header(`Syncing README installation block${dryRun ? " (dry-run)" : ""}…`));
19818
- if (namespaces.length > 0) print(style.hint(` namespaces: ${namespaces.join(", ")}`));
18704
+ print(ui_exports.style.header(`Syncing README installation block${dryRun ? " (dry-run)" : ""}…`));
18705
+ if (namespaces.length > 0) print(ui_exports.style.hint(` namespaces: ${namespaces.join(", ")}`));
19819
18706
  let pkg;
19820
18707
  try {
19821
18708
  const raw = await readFileFn(join(repoRoot, "package.json"), "utf8");
@@ -19847,7 +18734,7 @@ async function runSyncReadme(input) {
19847
18734
  };
19848
18735
  const text = await updateReadme(repoRoot, generateInstallBlock(pkg, homepage), markerSections, dryRun, readFileFn, writeFileFn);
19849
18736
  if (text === null) {
19850
- print(style.warn("README.md not found or has no writable location for installation block"));
18737
+ print(ui_exports.style.warn("README.md not found or has no writable location for installation block"));
19851
18738
  logger.warn({
19852
18739
  repoRoot,
19853
18740
  reason: "README.md not found / no marker block"
@@ -19859,9 +18746,9 @@ async function runSyncReadme(input) {
19859
18746
  };
19860
18747
  }
19861
18748
  if (description) await updateIndexMdxDescription(repoRoot, description, dryRun, readFileFn, writeFileFn);
19862
- print(dryRun ? style.hint(" would update README.md") : style.success(" updated README.md"));
18749
+ print(dryRun ? ui_exports.style.hint(" would update README.md") : ui_exports.style.success(" updated README.md"));
19863
18750
  const problems = readmeScriptProblems(text, scripts);
19864
- for (const problem of problems) print(style.fail(` ${problem}`));
18751
+ for (const problem of problems) print(ui_exports.style.fail(` ${problem}`));
19865
18752
  const status = dryRun ? "dry-run" : "ok";
19866
18753
  logger.info({
19867
18754
  repoRoot,
@@ -20691,7 +19578,7 @@ const repoSyncCommand = {
20691
19578
  describe: "Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)",
20692
19579
  builder: (y) => repoSyncArgs(y).command(syncReadmeCommand),
20693
19580
  handler: async (argv) => {
20694
- const tokens = tokenContext(argv.token);
19581
+ const tokens = tokenContext$1(argv.token);
20695
19582
  if (!tokens) return;
20696
19583
  const loaded = await loadConfig(argv.cwd);
20697
19584
  applyResolvedConfig(argv, loaded.resolved);
@@ -20727,12 +19614,12 @@ const repoSyncCommand = {
20727
19614
  *
20728
19615
  * After running, `pnpm install && holocron run ci`.
20729
19616
  */
20730
- const FETCH_TIMEOUT_MS$1 = 4e3;
19617
+ const FETCH_TIMEOUT_MS = 4e3;
20731
19618
  /** Resolve a package's `latest` dist-tag from the npm registry. */
20732
19619
  const fetchLatestFromNpm = async (pkg) => {
20733
19620
  try {
20734
19621
  const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`, {
20735
- signal: AbortSignal.timeout(FETCH_TIMEOUT_MS$1),
19622
+ signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
20736
19623
  headers: { accept: "application/vnd.npm.install-v1+json" }
20737
19624
  });
20738
19625
  if (!res.ok) return null;
@@ -21119,7 +20006,7 @@ const upgradeNodeCommand = {
21119
20006
  describe: "Scan the repo and update every Node.js version pin to a new major",
21120
20007
  builder: upgradeNodeArgs,
21121
20008
  handler: async (argv) => {
21122
- const [to] = await promptForPositionals(getEntry("repo upgrade node"), argv);
20009
+ const [to] = await (0, ui_exports.promptForPositionals)(getEntry("repo upgrade node"), argv);
21123
20010
  let extra = [];
21124
20011
  try {
21125
20012
  const raw = readFileSync(join(argv.cwd, "holocron.config.json"), "utf8");
@@ -21143,14 +20030,14 @@ const upgradeNodeCommand = {
21143
20030
  const repoUpgradeCommand = {
21144
20031
  command: "upgrade",
21145
20032
  describe: "Upgrade toolchain version pins across the repo",
21146
- builder: (y) => y.command(upgradeNodeCommand).command(upgradeDepsCommand).command(groupMenu("repo upgrade")),
20033
+ builder: (y) => y.command(upgradeNodeCommand).command(upgradeDepsCommand).command(groupMenu$1("repo upgrade")),
21147
20034
  handler: () => {}
21148
20035
  };
21149
20036
  // src/commands/repo/repo.command.ts
21150
20037
  const repoCommand = {
21151
20038
  command: "repo",
21152
20039
  describe: "Set up, sync, upgrade and clean up the current repo",
21153
- builder: (y) => y.command(setupCommand).command(repoSyncCommand).command(repoUpgradeCommand).command(repoCleanupCommand).command(groupMenu("repo")),
20040
+ builder: (y) => y.command(setupCommand).command(repoSyncCommand).command(repoUpgradeCommand).command(repoCleanupCommand).command(groupMenu$1("repo")),
21154
20041
  handler: () => {}
21155
20042
  };
21156
20043
  // src/commands/run/run.args.ts
@@ -21361,9 +20248,9 @@ const secretSetCommand = {
21361
20248
  describe: "Set a single secret via the configured `secrets` capability",
21362
20249
  builder: secretSetArgs,
21363
20250
  handler: async (argv) => {
21364
- const tokens = tokenContext(argv.token);
20251
+ const tokens = tokenContext$1(argv.token);
21365
20252
  if (!tokens) return;
21366
- const [name] = await promptForPositionals(getEntry("secrets set"), argv);
20253
+ const [name] = await (0, ui_exports.promptForPositionals)(getEntry("secrets set"), argv);
21367
20254
  const scopeArg = argv.scope;
21368
20255
  const scope = parseScope(scopeArg);
21369
20256
  const loaded = await loadConfig(argv.cwd);
@@ -21509,7 +20396,7 @@ const secretsListCommand = {
21509
20396
  describe: "List the names of the secrets at each scope (never the values)",
21510
20397
  builder: secretsListArgs,
21511
20398
  handler: async (argv) => {
21512
- const tokens = tokenContext(argv.token);
20399
+ const tokens = tokenContext$1(argv.token);
21513
20400
  if (!tokens) return;
21514
20401
  const loaded = await loadConfig(argv.cwd);
21515
20402
  applyResolvedConfig(argv, loaded.resolved);
@@ -21597,7 +20484,7 @@ async function runSecretsSync(input) {
21597
20484
  const print = input.print ?? ((line) => console.log(line));
21598
20485
  const logger = input.logger ?? getLogger();
21599
20486
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
21600
- await withSpinner("Loading plugins…", () => loader.load());
20487
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
21601
20488
  assertPluginsResolvable(loader, "secrets sync");
21602
20489
  logger.info({
21603
20490
  environment: input.environmentId,
@@ -21605,17 +20492,17 @@ async function runSecretsSync(input) {
21605
20492
  }, "secrets sync: start");
21606
20493
  const dryRun = input.context.dryRun ?? false;
21607
20494
  const targets = input.targets ?? ["production", "preview"];
21608
- print(style.header(`Holocron secrets sync — environment ${input.environmentId}${dryRun ? " (dry-run)" : ""}`));
21609
- print(style.dim(` vault: ${vaultProviderName(loader)}`));
20495
+ print(ui_exports.style.header(`Holocron secrets sync — environment ${input.environmentId}${dryRun ? " (dry-run)" : ""}`));
20496
+ print(ui_exports.style.dim(` vault: ${vaultProviderName(loader)}`));
21610
20497
  print("");
21611
20498
  const vault = loader.get("vault");
21612
20499
  if (!vault.readEnvironment) throw new Error(`vault provider (${vault.providerName}) does not implement readEnvironment — sync needs bulk env reads`);
21613
20500
  let envVars;
21614
20501
  try {
21615
- envVars = await withSpinner(`Reading vault environment ${input.environmentId}…`, () => vault.readEnvironment(input.environmentId));
20502
+ envVars = await (0, ui_exports.withSpinner)(`Reading vault environment ${input.environmentId}…`, () => vault.readEnvironment(input.environmentId));
21616
20503
  } catch (err) {
21617
20504
  const message = describeProviderError(err);
21618
- print(` ${style.fail(`could not read vault environment ${input.environmentId}: ${message}`)}`);
20505
+ print(` ${ui_exports.style.fail(`could not read vault environment ${input.environmentId}: ${message}`)}`);
21619
20506
  logger.warn({
21620
20507
  environment: input.environmentId,
21621
20508
  reason: logReason(err)
@@ -21629,7 +20516,7 @@ async function runSecretsSync(input) {
21629
20516
  }], logger, print, dryRun);
21630
20517
  }
21631
20518
  const keys = Object.keys(envVars).sort();
21632
- print(style.step(`read ${keys.length} keys from vault`));
20519
+ print(ui_exports.style.step(`read ${keys.length} keys from vault`));
21633
20520
  print("");
21634
20521
  const rows = [];
21635
20522
  if (loader.has("secrets")) {
@@ -21639,7 +20526,7 @@ async function runSecretsSync(input) {
21639
20526
  ...input.githubSecretKeys ? { keys: input.githubSecretKeys } : {}
21640
20527
  }];
21641
20528
  for (const route of routes) {
21642
- print(style.step(routes.length > 1 ? `secrets (${scopeLabel(route.scope)})` : "secrets"));
20529
+ print(ui_exports.style.step(routes.length > 1 ? `secrets (${scopeLabel(route.scope)})` : "secrets"));
21643
20530
  for (const key of route.keys ?? keys) {
21644
20531
  rows.push(await pushRow(`secrets:${secrets.providerName}`, scopeLabel(route.scope), key, envVars, dryRun, async (value) => {
21645
20532
  await secrets.setSecret(route.scope, key, value);
@@ -21651,7 +20538,7 @@ async function runSecretsSync(input) {
21651
20538
  if (loader.has("deployment")) {
21652
20539
  const deploy = loader.get("deployment");
21653
20540
  if (!input.projectId) {
21654
- print(style.step("deployment"));
20541
+ print(ui_exports.style.step("deployment"));
21655
20542
  const row = {
21656
20543
  destination: `deployment:${deploy.providerName}`,
21657
20544
  scope: "no projectId",
@@ -21662,7 +20549,7 @@ async function runSecretsSync(input) {
21662
20549
  rows.push(row);
21663
20550
  print(formatRow(row));
21664
20551
  } else for (const target of targets) {
21665
- print(style.step(`deployment (target=${target})`));
20552
+ print(ui_exports.style.step(`deployment (target=${target})`));
21666
20553
  for (const key of keys) {
21667
20554
  rows.push(await pushRow(`deployment:${deploy.providerName}`, `target=${target}`, key, envVars, dryRun, async (value) => {
21668
20555
  await deploy.setEnvVar(input.projectId, target, key, value);
@@ -21673,7 +20560,7 @@ async function runSecretsSync(input) {
21673
20560
  }
21674
20561
  if (input.workerScript) {
21675
20562
  const script = input.workerScript;
21676
- print(style.step(`workers (script=${script})`));
20563
+ print(ui_exports.style.step(`workers (script=${script})`));
21677
20564
  const workers = loader.has("workers") ? loader.get("workers") : void 0;
21678
20565
  if (!workers?.setSecret) {
21679
20566
  const row = {
@@ -21721,7 +20608,7 @@ function summarise(rows, logger, print, dryRun) {
21721
20608
  }, "secrets sync: done");
21722
20609
  print("");
21723
20610
  const summaryLine = `${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${dryRun ? `, ${summary.dryRun} would-do` : ""}`;
21724
- print(summary.fail > 0 ? style.fail(summaryLine) : style.success(summaryLine));
20611
+ print(summary.fail > 0 ? ui_exports.style.fail(summaryLine) : ui_exports.style.success(summaryLine));
21725
20612
  return {
21726
20613
  rows,
21727
20614
  summary
@@ -21776,12 +20663,12 @@ async function runRow(destination, scope, key, dryRun, body) {
21776
20663
  }
21777
20664
  }
21778
20665
  function formatRow(row) {
21779
- const detail = row.message ? style.dim(` (${row.message})`) : "";
20666
+ const detail = row.message ? ui_exports.style.dim(` (${row.message})`) : "";
21780
20667
  const label = `${row.key}${detail}`;
21781
- if (row.status === "ok") return ` ${style.success(label)}`;
21782
- if (row.status === "fail") return ` ${style.fail(label)}`;
21783
- if (row.status === "dry-run") return ` ${style.dim(`… ${label}`)}`;
21784
- return ` ${style.dim(`· ${label}`)}`;
20668
+ if (row.status === "ok") return ` ${ui_exports.style.success(label)}`;
20669
+ if (row.status === "fail") return ` ${ui_exports.style.fail(label)}`;
20670
+ if (row.status === "dry-run") return ` ${ui_exports.style.dim(`… ${label}`)}`;
20671
+ return ` ${ui_exports.style.dim(`· ${label}`)}`;
21785
20672
  }
21786
20673
  function scopeLabel(scope) {
21787
20674
  if (scope.kind === "repo") return "scope=repo";
@@ -21820,10 +20707,10 @@ const secretsSyncCommand = {
21820
20707
  describe: "Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars",
21821
20708
  builder: secretsSyncArgs,
21822
20709
  handler: async (argv) => {
21823
- const tokens = tokenContext(argv.token);
20710
+ const tokens = tokenContext$1(argv.token);
21824
20711
  if (!tokens) return;
21825
20712
  const githubSecretScope = parseScope(argv.githubSecretScope);
21826
- const [environmentId] = await promptForPositionals(getEntry("secrets sync"), argv);
20713
+ const [environmentId] = await (0, ui_exports.promptForPositionals)(getEntry("secrets sync"), argv);
21827
20714
  const loaded = await loadConfig(argv.cwd);
21828
20715
  applyResolvedConfig(argv, loaded.resolved);
21829
20716
  const routes = argv.githubSecret?.length ? [] : secretRoutes(loaded.resolved.repo?.secrets?.sync, environmentId);
@@ -21849,7 +20736,7 @@ const secretsSyncCommand = {
21849
20736
  const secretsCommand = {
21850
20737
  command: "secrets",
21851
20738
  describe: "List and set secrets, and sync vault environments",
21852
- builder: (y) => y.command(secretSetCommand).command(secretsListCommand).command(secretsSyncCommand).command(groupMenu("secrets")),
20739
+ builder: (y) => y.command(secretSetCommand).command(secretsListCommand).command(secretsSyncCommand).command(groupMenu$1("secrets")),
21853
20740
  handler: () => {}
21854
20741
  };
21855
20742
  // src/commands/skills/skills.args.ts
@@ -22006,7 +20893,7 @@ const skillsUpdate = {
22006
20893
  const skillsCommand = {
22007
20894
  command: "skills",
22008
20895
  describe: "Manage agent skills from the @theholocron/skills registry",
22009
- builder: (y) => y.command(skillsInstall).command(skillsRemove).command(skillsUpdate).command(groupMenu("skills")),
20896
+ builder: (y) => y.command(skillsInstall).command(skillsRemove).command(skillsUpdate).command(groupMenu$1("skills")),
22010
20897
  handler: () => {}
22011
20898
  };
22012
20899
  // src/commands/specs-sync/forum-channel.ts
@@ -22316,9 +21203,9 @@ async function runSpecsSync(input) {
22316
21203
  assertPluginsResolvable(loader, "specs sync");
22317
21204
  const dryRun = input.context.dryRun ?? false;
22318
21205
  const refuse = (message, reason = message) => {
22319
- print(` ${style.fail(message)}`);
21206
+ print(` ${ui_exports.style.fail(message)}`);
22320
21207
  print("");
22321
- print(style.header("0 ok, 1 fail, 0 skipped"));
21208
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
22322
21209
  logger.warn({ reason }, "specs sync");
22323
21210
  return {
22324
21211
  status: "fail",
@@ -22398,7 +21285,7 @@ async function runSpecsSync(input) {
22398
21285
  let renamed = 0;
22399
21286
  let linked = 0;
22400
21287
  let rateLimited;
22401
- print(`\n${style.header(`ADRs and specs → #${forum.channel}`)}`);
21288
+ print(`\n${ui_exports.style.header(`ADRs and specs → #${forum.channel}`)}`);
22402
21289
  for (const doc of documents) {
22403
21290
  let outcome;
22404
21291
  try {
@@ -22428,13 +21315,13 @@ async function runSpecsSync(input) {
22428
21315
  if (outcome.titleRenamed) renamed++;
22429
21316
  if (outcome.idLineRewritten) linked++;
22430
21317
  if (outcome.problem) {
22431
- print(` ${style.fail(`${outcome.path}: ${outcome.problem}`)}`);
21318
+ print(` ${ui_exports.style.fail(`${outcome.path}: ${outcome.problem}`)}`);
22432
21319
  failed++;
22433
21320
  } else if (outcome.did.length === 0) {
22434
- print(` ${style.skip(`${outcome.path}: in step`)}`);
21321
+ print(` ${ui_exports.style.skip(`${outcome.path}: in step`)}`);
22435
21322
  skipped++;
22436
21323
  } else {
22437
- print(` ${(dryRun ? style.skip : style.success)(`${outcome.path}: ${outcome.did.join("; ")}`)}`);
21324
+ print(` ${(dryRun ? ui_exports.style.skip : ui_exports.style.success)(`${outcome.path}: ${outcome.did.join("; ")}`)}`);
22438
21325
  if (dryRun) skipped++;
22439
21326
  else ok++;
22440
21327
  if (!dryRun && outcome.text !== doc.text) input.io.write(doc.path, outcome.text);
@@ -22442,15 +21329,15 @@ async function runSpecsSync(input) {
22442
21329
  }
22443
21330
  if (rateLimited) {
22444
21331
  const after = rateLimited.retryAfter > 0 ? `; it asks for ${rateLimited.retryAfter} seconds` : "";
22445
- print(` ${style.skip(`stopped: the provider is rate limiting${after}. ${rateLimited.left} document(s) are left for the next run`)}`);
21332
+ print(` ${ui_exports.style.skip(`stopped: the provider is rate limiting${after}. ${rateLimited.left} document(s) are left for the next run`)}`);
22446
21333
  skipped += rateLimited.left;
22447
21334
  }
22448
- if (refreshOrigin) print(style.header(`${rewritten} PR line(s) ${dryRun ? "would be rewritten" : "rewritten"}`));
22449
- if (refreshTitles) print(style.header(`${renamed} title(s) ${dryRun ? "would be renamed" : "renamed"}`));
22450
- if (input.refresh || linking) print(style.header(`${linked} id line(s) ${dryRun ? "would be rewritten" : "rewritten"}`));
21335
+ if (refreshOrigin) print(ui_exports.style.header(`${rewritten} PR line(s) ${dryRun ? "would be rewritten" : "rewritten"}`));
21336
+ if (refreshTitles) print(ui_exports.style.header(`${renamed} title(s) ${dryRun ? "would be renamed" : "renamed"}`));
21337
+ if (input.refresh || linking) print(ui_exports.style.header(`${linked} id line(s) ${dryRun ? "would be rewritten" : "rewritten"}`));
22451
21338
  const status = failed > 0 ? "fail" : dryRun ? "dry-run" : "ok";
22452
21339
  print("");
22453
- print(style.header(`${ok} ok, ${failed} fail, ${skipped} skipped`));
21340
+ print(ui_exports.style.header(`${ok} ok, ${failed} fail, ${skipped} skipped`));
22454
21341
  logger.info({
22455
21342
  provider: notifications.providerName,
22456
21343
  channel: forum.channel,
@@ -22508,7 +21395,7 @@ const specsSyncCommand = {
22508
21395
  describe: "Keep each ADR and spec in step with a post in a forum channel",
22509
21396
  builder: specsSyncArgs,
22510
21397
  handler: async (argv) => {
22511
- const tokens = tokenContext(argv.token);
21398
+ const tokens = tokenContext$1(argv.token);
22512
21399
  if (!tokens) return;
22513
21400
  const loaded = await loadConfig(argv.cwd);
22514
21401
  applyResolvedConfig(argv, loaded.resolved);
@@ -22537,7 +21424,7 @@ const specsSyncCommand = {
22537
21424
  const specsCommand = {
22538
21425
  command: "specs",
22539
21426
  describe: "Keep the repo's ADRs and specs in step with their discussion",
22540
- builder: (y) => y.command(specsSyncCommand).command(groupMenu("specs")),
21427
+ builder: (y) => y.command(specsSyncCommand).command(groupMenu$1("specs")),
22541
21428
  handler: () => {}
22542
21429
  };
22543
21430
  // src/commands/sync-github/sync-github.ts
@@ -22845,7 +21732,7 @@ const syncGithubCommand = {
22845
21732
  builder: syncGithubArgs,
22846
21733
  handler: async (argv) => {
22847
21734
  const outputDir = argv["output-dir"];
22848
- const parsed = tokenContext(argv.token);
21735
+ const parsed = tokenContext$1(argv.token);
22849
21736
  if (!parsed) return;
22850
21737
  let token;
22851
21738
  if (outputDir) token = "no-token-needed";
@@ -22871,141 +21758,24 @@ const syncGithubCommand = {
22871
21758
  const syncCommand = {
22872
21759
  command: "sync",
22873
21760
  describe: "Sync generated files to other repos",
22874
- builder: (y) => y.command(syncGithubCommand).command(groupMenu("sync")),
21761
+ builder: (y) => y.command(syncGithubCommand).command(groupMenu$1("sync")),
22875
21762
  handler: () => {}
22876
21763
  };
22877
21764
  // src/commands/tunnel/tunnel.command.ts
22878
21765
  const tunnelCommand = {
22879
21766
  command: "tunnel <subcommand>",
22880
21767
  describe: "Tunnels from a stable public hostname to this machine",
22881
- builder: (y) => y.command(tunnelUpCommand).command(groupMenu("tunnel")),
21768
+ builder: (y) => y.command(tunnelUpCommand).command(groupMenu$1("tunnel")),
22882
21769
  handler: () => {}
22883
21770
  };
22884
- // ../kyber/dist/notifier.mjs
22885
- const CACHE_FILE = "update-check.json";
22886
- const CACHE_TTL_MS = 864e5;
22887
- const FETCH_TIMEOUT_MS = 3e3;
22888
- function readCache(cacheDir) {
22889
- try {
22890
- return JSON.parse(readFileSync(join(cacheDir, CACHE_FILE), "utf8"));
22891
- } catch {
22892
- return null;
22893
- }
22894
- }
22895
- function writeCache(cacheDir, entry) {
22896
- try {
22897
- mkdirSync(cacheDir, { recursive: true });
22898
- writeFileSync(join(cacheDir, CACHE_FILE), JSON.stringify(entry));
22899
- } catch {}
22900
- }
22901
- async function fetchLatestVersion(name, channel) {
22902
- try {
22903
- const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(name)}`, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
22904
- if (!res.ok) return null;
22905
- const data = await res.json();
22906
- return data["dist-tags"][channel] ?? data["dist-tags"]["latest"] ?? null;
22907
- } catch {
22908
- return null;
22909
- }
22910
- }
22911
- function getChannel(version) {
22912
- return /^[^-]+-([a-zA-Z]+)/.exec(version)?.[1] ?? "latest";
22913
- }
22914
- /**
22915
- * Whether `latest` is newer than `current`: release parts compare as numbers, a stable release is newer than any
22916
- * prerelease of it, and prereleases compare segment by segment. A leading `v` is ignored.
22917
- */
22918
- function isUpdateAvailable(current, latest) {
22919
- const normalize = (v) => v.replace(/^v/, "");
22920
- const c = normalize(current);
22921
- const l = normalize(latest);
22922
- if (c === l) return false;
22923
- const splitPre = (v) => {
22924
- const idx = v.indexOf("-");
22925
- return idx === -1 ? [v, ""] : [v.slice(0, idx), v.slice(idx + 1)];
22926
- };
22927
- const [cRelease, cPre] = splitPre(c);
22928
- const [lRelease, lPre] = splitPre(l);
22929
- const parseRelease = (r) => r.split(".").map(Number);
22930
- const cParts = parseRelease(cRelease);
22931
- const lParts = parseRelease(lRelease);
22932
- for (let i = 0; i < Math.max(cParts.length, lParts.length); i++) {
22933
- const cv = cParts[i] ?? 0;
22934
- const lv = lParts[i] ?? 0;
22935
- if (lv > cv) return true;
22936
- if (lv < cv) return false;
22937
- }
22938
- if (!lPre && cPre) return true;
22939
- if (lPre && !cPre) return false;
22940
- const cPreParts = cPre.split(".");
22941
- const lPreParts = lPre.split(".");
22942
- for (let i = 0; i < Math.max(cPreParts.length, lPreParts.length); i++) {
22943
- const cv = cPreParts[i] ?? "";
22944
- const lv = lPreParts[i] ?? "";
22945
- const cvNum = Number(cv);
22946
- const lvNum = Number(lv);
22947
- if (!isNaN(cvNum) && !isNaN(lvNum)) {
22948
- if (lvNum > cvNum) return true;
22949
- if (lvNum < cvNum) return false;
22950
- } else {
22951
- if (lv > cv) return true;
22952
- if (lv < cv) return false;
22953
- }
22954
- }
22955
- return false;
22956
- }
22957
- function formatNotice(current, latest, installCmd) {
22958
- const raw1 = `Update available: ${current} → ${latest}`;
22959
- const raw2 = `Run ${installCmd} to update`;
22960
- const width = Math.max(raw1.length, raw2.length) + 4;
22961
- const bar = chalk.yellow("─".repeat(width));
22962
- const border = chalk.yellow("│");
22963
- const pad = (raw, styled) => `${border} ${styled}${" ".repeat(width - 2 - raw.length)} ${border}`;
22964
- return [
22965
- "",
22966
- chalk.yellow(`╭${bar}╮`),
22967
- pad(raw1, `Update available: ${chalk.dim(current)} → ${chalk.green(latest)}`),
22968
- pad(raw2, `Run ${chalk.cyan(installCmd)} to update`),
22969
- chalk.yellow(`╰${bar}╯`),
22970
- ""
22971
- ].join("\n");
22972
- }
22973
- /**
22974
- * Looks for a newer version of a package on npm, at most once a day, and returns a function that prints a boxed notice to
22975
- * stderr, or `null` when there is nothing to say. It is best-effort: a network error, a bad answer or an unwritable cache
22976
- * is `null`, never a thrown error. It says nothing in CI or when `NO_UPDATE_NOTIFIER` is set. A prerelease is compared
22977
- * with the newest version on its own channel (`2.0.0-alpha.3` with the `alpha` tag).
22978
- */
22979
- async function checkForUpdates$1(options) {
22980
- const { name, currentVersion, cacheDir } = options;
22981
- const env = options.env ?? process.env;
22982
- if (env["CI"] || env["NO_UPDATE_NOTIFIER"]) return null;
22983
- const channel = getChannel(currentVersion);
22984
- const cache = readCache(cacheDir);
22985
- const now = Date.now();
22986
- let latestVersion = null;
22987
- if (cache && now - cache.checkedAt < CACHE_TTL_MS) latestVersion = cache.latestVersion;
22988
- else {
22989
- latestVersion = await fetchLatestVersion(name, channel);
22990
- if (latestVersion) writeCache(cacheDir, {
22991
- latestVersion,
22992
- checkedAt: now
22993
- });
22994
- }
22995
- if (!latestVersion || !isUpdateAvailable(currentVersion, latestVersion)) return null;
22996
- const installCommand = options.installCommand ?? `npm install -g ${name}`;
22997
- return () => {
22998
- process.stderr.write(formatNotice(currentVersion, latestVersion, installCommand) + "\n");
22999
- };
23000
- }
23001
21771
  // src/update-notifier/update-notifier.ts
23002
21772
  const PACKAGE_NAME = "@theholocron/cli";
23003
21773
  /**
23004
21774
  * Looks for a newer `@theholocron/cli` and returns a function that prints the notice, or `null` when there is none. The
23005
21775
  * answer is kept in `HOLOCRON_CACHE_DIR`, `~/.cache/holocron` by default.
23006
21776
  */
23007
- function checkForUpdates(currentVersion) {
23008
- return checkForUpdates$1({
21777
+ function checkForUpdates$1(currentVersion) {
21778
+ return checkForUpdates({
23009
21779
  name: PACKAGE_NAME,
23010
21780
  currentVersion,
23011
21781
  cacheDir: env.get("HOLOCRON_CACHE_DIR") ?? join(homedir(), ".cache", "holocron"),
@@ -23020,7 +21790,7 @@ const { version: CLI_VERSION } = JSON.parse(readFileSync(new URL("../package.jso
23020
21790
  /** Whether to print the correlation id at command end (`--debug` / `--verbose`). */
23021
21791
  let printRunId = false;
23022
21792
  init(CLI_VERSION);
23023
- const updateCheckPromise = checkForUpdates(CLI_VERSION);
21793
+ const updateCheckPromise = checkForUpdates$1(CLI_VERSION);
23024
21794
  let finishCommand = () => {};
23025
21795
  /** Set by `.fail()` once it has printed an error, so the outer catch doesn't repeat it. */
23026
21796
  let errorReported = false;