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

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
58
  }
347
- }
348
- function loadBinding() {
349
- try {
350
- return createRequire(import.meta.url)("@napi-rs/keyring");
351
- } catch {
352
- return null;
353
- }
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"`). */
@@ -3542,12 +2565,12 @@ async function runAuthSet(input) {
3542
2565
  const isFeatureKey = provider.includes(".");
3543
2566
  const packageName = isFeatureKey ? null : resolvePluginPackage(provider);
3544
2567
  if (!token) {
3545
- print(style.fail(`no token supplied for \`${keyringKey}\`.`));
3546
- print(style.hint(` pass as positional arg: holocron auth set ${provider} <token>`));
2568
+ print(ui_exports.style.fail(`no token supplied for \`${keyringKey}\`.`));
2569
+ print(ui_exports.style.hint(` pass as positional arg: holocron auth set ${provider} <token>`));
3547
2570
  if (!isFeatureKey) {
3548
- print(style.hint(` or via env: HOLOCRON_${provider.toUpperCase()}_TOKEN / ${provider.toUpperCase()}_TOKEN`));
2571
+ print(ui_exports.style.hint(` or via env: HOLOCRON_${provider.toUpperCase()}_TOKEN / ${provider.toUpperCase()}_TOKEN`));
3549
2572
  const hint = await tryLoadHint(importer, packageName);
3550
- if (hint) print(style.hint(` hint: ${hint}`));
2573
+ if (hint) print(ui_exports.style.hint(` hint: ${hint}`));
3551
2574
  }
3552
2575
  logger.warn({
3553
2576
  provider,
@@ -3567,8 +2590,8 @@ async function runAuthSet(input) {
3567
2590
  if (typeof module.verifyToken === "function") {
3568
2591
  const verified = await module.verifyToken(token);
3569
2592
  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}`));
2593
+ print(ui_exports.style.fail(`token rejected by ${provider}: ${verified.message}`));
2594
+ if (module.AUTH_HINT) print(ui_exports.style.hint(` hint: ${module.AUTH_HINT}`));
3572
2595
  logger.warn({
3573
2596
  provider,
3574
2597
  keyringKey,
@@ -3581,14 +2604,14 @@ async function runAuthSet(input) {
3581
2604
  };
3582
2605
  }
3583
2606
  subject = verified.subject;
3584
- } else print(style.warn(`${provider} plugin has no verifyToken; storing without verification`));
2607
+ } else print(ui_exports.style.warn(`${provider} plugin has no verifyToken; storing without verification`));
3585
2608
  } catch (err) {
3586
2609
  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`));
2610
+ print(ui_exports.style.warn(`cannot verify token — failed to load ${packageName}: ${msg}`));
2611
+ print(ui_exports.style.hint(` storing token anyway; run 'holocron auth check ${provider}' once the plugin is installed`));
3589
2612
  }
3590
2613
  if (!setToken(keyringKey, token)) {
3591
- print(style.fail(`keyring unavailable — token not stored. Use env vars instead.`));
2614
+ print(ui_exports.style.fail(`keyring unavailable — token not stored. Use env vars instead.`));
3592
2615
  logger.warn({
3593
2616
  provider,
3594
2617
  keyringKey,
@@ -3599,11 +2622,11 @@ async function runAuthSet(input) {
3599
2622
  message: "keyring unavailable"
3600
2623
  };
3601
2624
  }
3602
- print(style.success(`stored ${keyringKey} token${subject ? ` (${subject})` : ""}`));
2625
+ print(ui_exports.style.success(`stored ${keyringKey} token${subject ? ` (${subject})` : ""}`));
3603
2626
  if (input.credentials) {
3604
2627
  const { provider: from, environment } = input.credentials;
3605
2628
  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`));
2629
+ 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
2630
  }
3608
2631
  logger.info({
3609
2632
  provider,
@@ -3621,14 +2644,14 @@ function runAuthUnset(input) {
3621
2644
  const print = input.print ?? ((l) => console.log(l));
3622
2645
  const logger = input.logger ?? getLogger();
3623
2646
  if (deleteToken(input.provider)) {
3624
- print(style.success(`removed ${input.provider} token`));
2647
+ print(ui_exports.style.success(`removed ${input.provider} token`));
3625
2648
  logger.info({
3626
2649
  provider: input.provider,
3627
2650
  status: "ok"
3628
2651
  }, `auth unset: ${input.provider}`);
3629
2652
  return { status: "ok" };
3630
2653
  }
3631
- print(style.dim(`no stored token for ${input.provider}`));
2654
+ print(ui_exports.style.dim(`no stored token for ${input.provider}`));
3632
2655
  logger.info({
3633
2656
  provider: input.provider,
3634
2657
  status: "skip"
@@ -3646,7 +2669,7 @@ async function runAuthCheck(input) {
3646
2669
  const keyringKey = input.org ? `${provider}.${input.org}` : provider;
3647
2670
  const token = getToken(keyringKey);
3648
2671
  if (!token) {
3649
- print(style.dim(`no stored token for ${keyringKey}`));
2672
+ print(ui_exports.style.dim(`no stored token for ${keyringKey}`));
3650
2673
  logger.info({
3651
2674
  provider,
3652
2675
  keyringKey,
@@ -3659,7 +2682,7 @@ async function runAuthCheck(input) {
3659
2682
  };
3660
2683
  }
3661
2684
  if (provider.includes(".")) {
3662
- print(style.success(`${keyringKey}: token stored (feature key — no plugin verification)`));
2685
+ print(ui_exports.style.success(`${keyringKey}: token stored (feature key — no plugin verification)`));
3663
2686
  return {
3664
2687
  status: "ok",
3665
2688
  message: "stored"
@@ -3669,16 +2692,16 @@ async function runAuthCheck(input) {
3669
2692
  try {
3670
2693
  const module = await importer(packageName);
3671
2694
  if (typeof module.verifyToken !== "function") {
3672
- print(style.warn(`${keyringKey}: token stored (plugin has no verifyToken; can't confirm validity)`));
2695
+ print(ui_exports.style.warn(`${keyringKey}: token stored (plugin has no verifyToken; can't confirm validity)`));
3673
2696
  return {
3674
2697
  status: "ok",
3675
2698
  message: "stored, unverified"
3676
2699
  };
3677
2700
  }
3678
2701
  const verify = () => module.verifyToken(token);
3679
- const verified = input.showSpinner !== false ? await withSpinner(`Verifying ${keyringKey} token…`, verify) : await verify();
2702
+ const verified = input.showSpinner !== false ? await (0, ui_exports.withSpinner)(`Verifying ${keyringKey} token…`, verify) : await verify();
3680
2703
  if (verified.ok) {
3681
- print(style.success(`${keyringKey}: ok — ${verified.subject}`));
2704
+ print(ui_exports.style.success(`${keyringKey}: ok — ${verified.subject}`));
3682
2705
  logger.info({
3683
2706
  provider,
3684
2707
  keyringKey,
@@ -3691,8 +2714,8 @@ async function runAuthCheck(input) {
3691
2714
  message: verified.subject
3692
2715
  };
3693
2716
  }
3694
- print(style.fail(`${keyringKey}: rejected — ${verified.message}`));
3695
- if (module.AUTH_HINT) print(style.hint(` hint: ${module.AUTH_HINT}`));
2717
+ print(ui_exports.style.fail(`${keyringKey}: rejected — ${verified.message}`));
2718
+ if (module.AUTH_HINT) print(ui_exports.style.hint(` hint: ${module.AUTH_HINT}`));
3696
2719
  logger.warn({
3697
2720
  provider,
3698
2721
  keyringKey,
@@ -3707,7 +2730,7 @@ async function runAuthCheck(input) {
3707
2730
  } catch (err) {
3708
2731
  const msg = errorMessage(err);
3709
2732
  if (isModuleNotFound(err)) {
3710
- print(style.warn(`${keyringKey}: token present — verification skipped (plugin not available here)`));
2733
+ print(ui_exports.style.warn(`${keyringKey}: token present — verification skipped (plugin not available here)`));
3711
2734
  logger.info({
3712
2735
  provider,
3713
2736
  keyringKey,
@@ -3719,7 +2742,7 @@ async function runAuthCheck(input) {
3719
2742
  message: "stored, unverified (plugin not available)"
3720
2743
  };
3721
2744
  }
3722
- print(style.fail(`${keyringKey}: cannot verify — ${msg}`));
2745
+ print(ui_exports.style.fail(`${keyringKey}: cannot verify — ${msg}`));
3723
2746
  logger.warn({
3724
2747
  provider,
3725
2748
  keyringKey,
@@ -3738,8 +2761,8 @@ async function runAuthList(input = {}) {
3738
2761
  const importer = input.importer ?? defaultImporter;
3739
2762
  const providers = listStoredProviders();
3740
2763
  if (providers.length === 0) {
3741
- print(style.dim("no stored tokens."));
3742
- print(style.hint("run: holocron auth set <provider> <token>"));
2764
+ print(ui_exports.style.dim("no stored tokens."));
2765
+ print(ui_exports.style.hint("run: holocron auth set <provider> <token>"));
3743
2766
  logger.info({ providers: 0 }, "auth list: done");
3744
2767
  return {
3745
2768
  status: "ok",
@@ -3759,11 +2782,11 @@ async function runAuthList(input = {}) {
3759
2782
  const label = `${provider}${check.message ? ` — ${check.message}` : ""}`;
3760
2783
  if (check.status === "ok") {
3761
2784
  ok += 1;
3762
- print(` ${style.success(label)}`);
2785
+ print(` ${ui_exports.style.success(label)}`);
3763
2786
  } else if (check.status === "fail") {
3764
2787
  fail += 1;
3765
- print(` ${style.fail(label)}`);
3766
- } else print(` ${style.dim(`· ${label}`)}`);
2788
+ print(` ${ui_exports.style.fail(label)}`);
2789
+ } else print(` ${ui_exports.style.dim(`· ${label}`)}`);
3767
2790
  }
3768
2791
  logger.info({
3769
2792
  providers: providers.length,
@@ -3807,7 +2830,7 @@ function declaredVsActual(declared, actual, options) {
3807
2830
  function printCheckRows(rows, print) {
3808
2831
  const width = Math.max(0, ...rows.map((row) => row.title.length));
3809
2832
  for (const row of rows) {
3810
- print(statusRow(row.status, [row.title.padEnd(width), row.detail]));
2833
+ print((0, ui_exports.statusRow)(row.status, [row.title.padEnd(width), row.detail]));
3811
2834
  for (const problem of row.problems) print(` - ${problem}`);
3812
2835
  }
3813
2836
  }
@@ -3815,7 +2838,7 @@ function printCheckRows(rows, print) {
3815
2838
  /** A blank line, then the closing `N ok, N fail, N skipped`. */
3816
2839
  function printCheckSummary(summary, print) {
3817
2840
  print("");
3818
- print(style.header(`${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`));
2841
+ print(ui_exports.style.header(`${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`));
3819
2842
  }
3820
2843
  // src/commands/doctor-checks/summarise-checks.ts
3821
2844
  /** How many rows ended each way. */
@@ -3935,7 +2958,7 @@ const doctorTokensCommand = {
3935
2958
  command: "tokens",
3936
2959
  describe: "Check that each token a configured plugin takes is set and still accepted (read-only; no token is printed)",
3937
2960
  handler: async (argv) => {
3938
- const tokens = tokenContext(argv.token);
2961
+ const tokens = tokenContext$1(argv.token);
3939
2962
  if (!tokens) return;
3940
2963
  const loaded = await loadConfig(argv.cwd);
3941
2964
  applyResolvedConfig(argv, loaded.resolved);
@@ -3971,7 +2994,7 @@ async function finishCredentialsFile(input) {
3971
2994
  }
3972
2995
  const cleanup = () => {
3973
2996
  try {
3974
- const outcome = (input.shred ?? shredFile)(path, identity);
2997
+ const outcome = (input.shred ?? auth_exports.shredFile)(path, identity);
3975
2998
  if (outcome === "deleted") print(`deleted ${path}`);
3976
2999
  else if (outcome === "missing") print(`${path} was already gone`);
3977
3000
  else print(`left ${path} alone: it is no longer the file this command wrote`);
@@ -3992,7 +3015,7 @@ async function finishCredentialsFile(input) {
3992
3015
  });
3993
3016
  let cleaned;
3994
3017
  try {
3995
- await (input.waitForImport ?? waitForEnter)("press Enter when the import is done and the file will be deleted: ");
3018
+ await (input.waitForImport ?? ui_exports.waitForEnter)("press Enter when the import is done and the file will be deleted: ");
3996
3019
  } finally {
3997
3020
  for (const [signal, handler] of handlers) process.off(signal, handler);
3998
3021
  cleaned = cleanup();
@@ -4123,7 +3146,7 @@ async function runAuthExport(input) {
4123
3146
  } else missing.push(name);
4124
3147
  continue;
4125
3148
  }
4126
- const line = dotenvLine(written, value);
3149
+ const line = (0, auth_exports.dotenvLine)(written, value);
4127
3150
  if (line === null) {
4128
3151
  unsupported.push(written);
4129
3152
  continue;
@@ -4137,7 +3160,7 @@ async function runAuthExport(input) {
4137
3160
  }
4138
3161
  const taken = new Set(entries.map((e) => e.name));
4139
3162
  for (const [name, value] of literals) {
4140
- const line = dotenvLine(name, value);
3163
+ const line = (0, auth_exports.dotenvLine)(name, value);
4141
3164
  if (taken.has(name)) continue;
4142
3165
  if (line === null) {
4143
3166
  unsupported.push(name);
@@ -4172,7 +3195,7 @@ async function runAuthExport(input) {
4172
3195
  if (target === "clipboard") {
4173
3196
  try {
4174
3197
  const pasted = input.only?.length && lines.length === 1 && exported.length === 1 ? values.get(exported[0]) : text;
4175
- await (input.copy ?? copyToClipboard)(pasted);
3198
+ await (input.copy ?? auth_exports.copyToClipboard)(pasted);
4176
3199
  } catch (err) {
4177
3200
  return refuse("clipboard", `could not copy to the clipboard: ${errorMessage(err)}`, "write the private file instead: `holocron auth export --file`");
4178
3201
  }
@@ -4180,10 +3203,10 @@ async function runAuthExport(input) {
4180
3203
  } else if (target === "file") {
4181
3204
  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
3205
  file = resolve(dirname(input.loaded.filepath), input.file || DEFAULT_FILE$1);
4183
- const git = (input.isIgnored ?? isGitIgnored)(file);
3206
+ const git = (input.isIgnored ?? auth_exports.isGitIgnored)(file);
4184
3207
  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
3208
  try {
4186
- identity = (input.writeFile ?? writeCredentialsFile)(file, text, input.force === true);
3209
+ identity = (input.writeFile ?? auth_exports.writeCredentialsFile)(file, text, input.force === true);
4187
3210
  } catch (err) {
4188
3211
  return refuse("write", `could not write ${file}: ${errorMessage(err)}`, "an existing file is never overwritten: delete it, or pass --force to replace it");
4189
3212
  }
@@ -4194,15 +3217,15 @@ async function runAuthExport(input) {
4194
3217
  }
4195
3218
  }
4196
3219
  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)`)}`);
3220
+ for (const name of exported) print(` ${ui_exports.style.success(name)}`);
3221
+ for (const name of blank) print(` ${ui_exports.style.dim("·")} ${name}${ui_exports.style.dim(" (written empty: fill it in)")}`);
3222
+ for (const name of missing) print(` ${ui_exports.style.dim("·")} ${name}${tokens.get(name)?.optional ? ui_exports.style.dim(" (optional)") : ""}`);
3223
+ 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)`)}`);
3224
+ for (const name of unsupported) print(` ${ui_exports.style.fail(`${name} (a value dotenv cannot carry unchanged, so add it by hand)`)}`);
4202
3225
  if (unavailable.length > 0) {
4203
3226
  print("");
4204
3227
  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)})`)}`);
3228
+ for (const pkg of [...unavailable].sort(compare$1)) print(` ${ui_exports.style.fail(`${pkg} (${reasons.get(pkg)})`)}`);
4206
3229
  }
4207
3230
  if (destination === "clipboard" || destination === "file") print("");
4208
3231
  if (destination === "clipboard") print("copied to the clipboard: paste it, then clear the clipboard");
@@ -4311,7 +3334,7 @@ const authCheckCommand = {
4311
3334
  describe: "Re-verify a stored bootstrap token",
4312
3335
  builder: authCheckArgs,
4313
3336
  handler: async (argv) => {
4314
- const [provider] = await promptForPositionals(getEntry("auth check"), argv);
3337
+ const [provider] = await (0, ui_exports.promptForPositionals)(getEntry("auth check"), argv);
4315
3338
  if ((await runAuthCheck({
4316
3339
  provider,
4317
3340
  ...argv.org ? { org: argv.org } : {}
@@ -4352,7 +3375,7 @@ const authSetCommand = {
4352
3375
  describe: "Verify + store a bootstrap token for a provider",
4353
3376
  builder: authSetArgs,
4354
3377
  handler: async (argv) => {
4355
- const [provider] = await promptForPositionals(getEntry("auth set"), argv);
3378
+ const [provider] = await (0, ui_exports.promptForPositionals)(getEntry("auth set"), argv);
4356
3379
  const credentials = await credentialsOf(argv.cwd);
4357
3380
  if ((await runAuthSet({
4358
3381
  provider,
@@ -4370,7 +3393,7 @@ const authUnsetCommand = {
4370
3393
  describe: "Remove a stored bootstrap token",
4371
3394
  builder: authUnsetArgs,
4372
3395
  handler: async (argv) => {
4373
- const [provider] = await promptForPositionals(getEntry("auth unset"), argv);
3396
+ const [provider] = await (0, ui_exports.promptForPositionals)(getEntry("auth unset"), argv);
4374
3397
  runAuthUnset({ provider });
4375
3398
  }
4376
3399
  };
@@ -4378,7 +3401,7 @@ const authUnsetCommand = {
4378
3401
  const authCommand = {
4379
3402
  command: "auth <subcommand>",
4380
3403
  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")),
3404
+ builder: (y) => y.command(authSetCommand).command(authUnsetCommand).command(authCheckCommand).command(authListCommand).command(authExportCommand).command(groupMenu$1("auth")),
4382
3405
  handler: () => {}
4383
3406
  };
4384
3407
  // src/commands/clone/clone.args.ts
@@ -4464,7 +3487,7 @@ async function runClone(input) {
4464
3487
  });
4465
3488
  print("");
4466
3489
  if (!existsSync(targetDir)) {
4467
- if (dryRun) print(style.dim(` would create ${targetDir}`));
3490
+ if (dryRun) print(ui_exports.style.dim(` would create ${targetDir}`));
4468
3491
  else mkdirSync(targetDir, { recursive: true });
4469
3492
  }
4470
3493
  let repos;
@@ -4493,7 +3516,7 @@ async function runClone(input) {
4493
3516
  toClone: repos.length - alreadyCloned
4494
3517
  };
4495
3518
  if (!await input.confirmWholeOrg(scope)) {
4496
- print(style.dim(" aborted — nothing cloned"));
3519
+ print(ui_exports.style.dim(" aborted — nothing cloned"));
4497
3520
  logger.info({
4498
3521
  org: input.org,
4499
3522
  ...scope
@@ -4513,7 +3536,7 @@ async function runClone(input) {
4513
3536
  for (const repo of repos) {
4514
3537
  const dest = join(targetDir, repoDirName(repo));
4515
3538
  if (existsSync(dest)) {
4516
- print(statusRow("skip", [
3539
+ print((0, ui_exports.statusRow)("skip", [
4517
3540
  repo.full_name,
4518
3541
  dest,
4519
3542
  "already exists"
@@ -4522,14 +3545,14 @@ async function runClone(input) {
4522
3545
  continue;
4523
3546
  }
4524
3547
  if (dryRun) {
4525
- print(style.dim(` would clone ${repo.full_name} → ${dest}`));
3548
+ print(ui_exports.style.dim(` would clone ${repo.full_name} → ${dest}`));
4526
3549
  cloned++;
4527
3550
  continue;
4528
3551
  }
4529
- print(style.step(` clone ${repo.full_name} → ${dest}`));
3552
+ print(ui_exports.style.step(` clone ${repo.full_name} → ${dest}`));
4530
3553
  const { clone_url } = repo;
4531
3554
  if (!clone_url.startsWith("https://github.com/")) {
4532
- print(statusRow("fail", [
3555
+ print((0, ui_exports.statusRow)("fail", [
4533
3556
  repo.full_name,
4534
3557
  dest,
4535
3558
  `unexpected clone URL: ${clone_url}`
@@ -4541,7 +3564,7 @@ async function runClone(input) {
4541
3564
  try {
4542
3565
  encodedToken = encodeTokenForGitHttpAuth(input.token);
4543
3566
  } catch (err) {
4544
- print(statusRow("fail", [
3567
+ print((0, ui_exports.statusRow)("fail", [
4545
3568
  repo.full_name,
4546
3569
  dest,
4547
3570
  `invalid token format: ${errorMessage(err)}`
@@ -4555,16 +3578,16 @@ async function runClone(input) {
4555
3578
  `https://x-access-token:${encodedToken}@github.com/${clone_url.slice(19)}`,
4556
3579
  dest
4557
3580
  ], { cwd: targetDir }).status !== 0) {
4558
- print(statusRow("fail", [repo.full_name, dest]));
3581
+ print((0, ui_exports.statusRow)("fail", [repo.full_name, dest]));
4559
3582
  failed++;
4560
3583
  } else {
4561
- print(statusRow("ok", [repo.full_name, dest]));
3584
+ print((0, ui_exports.statusRow)("ok", [repo.full_name, dest]));
4562
3585
  cloned++;
4563
3586
  }
4564
3587
  }
4565
3588
  const summary = `${cloned} cloned, ${failed} failed, ${skipped} skipped`;
4566
3589
  print("");
4567
- print(dryRun ? style.dim(` dry-run: ${summary}`) : failed > 0 ? style.fail(` ${summary}`) : style.success(` ${summary}`));
3590
+ print(dryRun ? ui_exports.style.dim(` dry-run: ${summary}`) : failed > 0 ? ui_exports.style.fail(` ${summary}`) : ui_exports.style.success(` ${summary}`));
4568
3591
  const status = dryRun ? "dry-run" : failed > 0 ? "fail" : "ok";
4569
3592
  logger[failed > 0 ? "warn" : "info"]({
4570
3593
  org: input.org,
@@ -4595,7 +3618,7 @@ const cloneCommand = {
4595
3618
  describe: "Clone a single repo (org/repo) or every repo in an org (org)",
4596
3619
  builder: cloneArgs,
4597
3620
  handler: async (argv) => {
4598
- const tokens = tokenContext(argv.token);
3621
+ const tokens = tokenContext$1(argv.token);
4599
3622
  if (!tokens) return;
4600
3623
  let token;
4601
3624
  try {
@@ -4605,7 +3628,7 @@ const cloneCommand = {
4605
3628
  process.exitCode = 1;
4606
3629
  return;
4607
3630
  }
4608
- const [targetInput] = await promptForPositionals(getEntry("clone"), argv);
3631
+ const [targetInput] = await (0, ui_exports.promptForPositionals)(getEntry("clone"), argv);
4609
3632
  const { org, repo } = parseCloneTarget(targetInput);
4610
3633
  const report = await runClone({
4611
3634
  org,
@@ -4614,7 +3637,7 @@ const cloneCommand = {
4614
3637
  dryRun: argv.dryRun,
4615
3638
  ...argv.dir ? { dir: argv.dir } : {},
4616
3639
  ...!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`);
3640
+ 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
3641
  if (toClone === 0) return true;
4619
3642
  return confirm({
4620
3643
  message: `${org} has ${total} repos — ${alreadyCloned} already cloned locally, ${toClone} new. Clone them all?`,
@@ -4627,7 +3650,7 @@ const cloneCommand = {
4627
3650
  if (await confirm({
4628
3651
  message: `Open ${openTarget}?`,
4629
3652
  default: false
4630
- })) openPath(openTarget);
3653
+ })) (0, ui_exports.openPath)(openTarget);
4631
3654
  }
4632
3655
  });
4633
3656
  if (report.status === "fail") {
@@ -4650,7 +3673,8 @@ const configShowCommand = {
4650
3673
  describe: "Print the resolved holocron config",
4651
3674
  builder: configShowArgs,
4652
3675
  handler: async (argv) => {
4653
- await viewJson((await loadConfig(argv.cwd)).resolved, {
3676
+ const loaded = await loadConfig(argv.cwd);
3677
+ await (0, ui_exports.viewJson)(loaded.resolved, {
4654
3678
  depth: argv.depth,
4655
3679
  interactive: argv.interactive
4656
3680
  });
@@ -4670,9 +3694,9 @@ const cleanupPreviewArgs = (y) => y.positional("pr", {
4670
3694
  });
4671
3695
  // src/commands/cleanup-preview/cleanup-preview.ts
4672
3696
  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");
3697
+ if (pr.merged) return ui_exports.style.success("merged");
3698
+ if (pr.state === "closed") return ui_exports.style.dim("closed (not merged)");
3699
+ return ui_exports.style.warn("open");
4676
3700
  }
4677
3701
  async function runCleanupPreview(input) {
4678
3702
  const print = input.print ?? ((line) => console.log(line));
@@ -4697,10 +3721,10 @@ async function runCleanupPreview(input) {
4697
3721
  }
4698
3722
  const branch = `${(input.repo ?? input.loaded.resolved.repo?.name ?? "").split("/").pop()}-pr-${pr.number}`;
4699
3723
  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)}`);
3724
+ print(`${ui_exports.style.header(`PR #${pr.number}`)} — ${pr.title}`);
3725
+ print(` Status : ${prStateLabel(pr)} | Branch : ${ui_exports.style.dim(pr.branch)}`);
3726
+ print(` URL : ${ui_exports.style.dim(pr.url)}`);
3727
+ print(` CF alias : ${ui_exports.style.dim(branch)}`);
4704
3728
  print("");
4705
3729
  if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a deployment provider to holocron.config.json");
4706
3730
  const deploy = loader.get("deployment");
@@ -4713,7 +3737,7 @@ async function runCleanupPreview(input) {
4713
3737
  throw new Error(`Failed to list deployments: ${message}`, { cause: err });
4714
3738
  }
4715
3739
  if (deployments.length === 0) {
4716
- print(style.dim(`No deployments found for branch ${branch}.`));
3740
+ print(ui_exports.style.dim(`No deployments found for branch ${branch}.`));
4717
3741
  logger.info({
4718
3742
  pr: pr.number,
4719
3743
  branch,
@@ -4729,16 +3753,16 @@ async function runCleanupPreview(input) {
4729
3753
  status: "none"
4730
3754
  };
4731
3755
  }
4732
- print(`Found ${deployments.length} deployment${deployments.length === 1 ? "" : "s"} for ${style.dim(branch)}:`);
3756
+ print(`Found ${deployments.length} deployment${deployments.length === 1 ? "" : "s"} for ${ui_exports.style.dim(branch)}:`);
4733
3757
  print("");
4734
3758
  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."));
3759
+ print(ui_exports.style.warn(`PR #${pr.number} is still open. Deleting its preview deployments will break the live preview link.`));
3760
+ print(ui_exports.style.warn("Nothing is pre-selected — check the deployments you want to remove."));
4737
3761
  print("");
4738
3762
  }
4739
3763
  const choices = deployments.map((d) => {
4740
3764
  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)}`,
3765
+ 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
3766
  value: d.id,
4743
3767
  checked: pr.state !== "open"
4744
3768
  };
@@ -4750,7 +3774,7 @@ async function runCleanupPreview(input) {
4750
3774
  choices
4751
3775
  });
4752
3776
  } catch {
4753
- print(style.dim("Aborted."));
3777
+ print(ui_exports.style.dim("Aborted."));
4754
3778
  return {
4755
3779
  pr,
4756
3780
  branch,
@@ -4760,7 +3784,7 @@ async function runCleanupPreview(input) {
4760
3784
  };
4761
3785
  }
4762
3786
  if (selected.length === 0) {
4763
- print(style.dim("Nothing selected — no deployments deleted."));
3787
+ print(ui_exports.style.dim("Nothing selected — no deployments deleted."));
4764
3788
  return {
4765
3789
  pr,
4766
3790
  branch,
@@ -4772,7 +3796,7 @@ async function runCleanupPreview(input) {
4772
3796
  print("");
4773
3797
  try {
4774
3798
  const count = await deploy.deletePreviewDeployments(input.project, selected);
4775
- print(style.success(`Deleted ${count} deployment${count === 1 ? "" : "s"}.`));
3799
+ print(ui_exports.style.success(`Deleted ${count} deployment${count === 1 ? "" : "s"}.`));
4776
3800
  logger.info({
4777
3801
  pr: pr.number,
4778
3802
  branch,
@@ -4789,7 +3813,7 @@ async function runCleanupPreview(input) {
4789
3813
  };
4790
3814
  } catch (err) {
4791
3815
  const message = errorMessage(err);
4792
- print(style.fail(message));
3816
+ print(ui_exports.style.fail(message));
4793
3817
  logger.warn({
4794
3818
  pr: pr.number,
4795
3819
  branch,
@@ -4813,9 +3837,9 @@ const cleanupPreviewCommand = {
4813
3837
  describe: "List and delete Cloudflare Pages preview deployments for a GitHub PR",
4814
3838
  builder: cleanupPreviewArgs,
4815
3839
  handler: async (argv) => {
4816
- const tokens = tokenContext(argv.token);
3840
+ const tokens = tokenContext$1(argv.token);
4817
3841
  if (!tokens) return;
4818
- const [pr] = await promptForPositionals(getEntry("deploy cleanup-preview"), argv);
3842
+ const [pr] = await (0, ui_exports.promptForPositionals)(getEntry("deploy cleanup-preview"), argv);
4819
3843
  const loaded = await loadConfig(argv.cwd);
4820
3844
  applyResolvedConfig(argv, loaded.resolved);
4821
3845
  if ((await runCleanupPreview({
@@ -5137,12 +4161,12 @@ async function runDeploy(input) {
5137
4161
  projectId: input.projectId,
5138
4162
  dryRun: dryRun || void 0
5139
4163
  }, "deploy: start");
5140
- print(style.header(`Holocron deploy — branch=${input.branch}${input.target ? `, target=${input.target}` : " (preview)"}${dryRun ? " (dry-run)" : ""}`));
4164
+ print(ui_exports.style.header(`Holocron deploy — branch=${input.branch}${input.target ? `, target=${input.target}` : " (preview)"}${dryRun ? " (dry-run)" : ""}`));
5141
4165
  if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a `deployment` provider to holocron.config.json");
5142
4166
  const deploy = loader.get("deployment");
5143
4167
  if (dryRun) {
5144
4168
  const message = `would: ${deploy.providerName}.triggerDeployment(projectId=${input.projectId}, branch=${input.branch}${input.target ? `, target=${input.target}` : ""})`;
5145
- print(` ${style.dim(`… ${message}`)}`);
4169
+ print(` ${ui_exports.style.dim(`… ${message}`)}`);
5146
4170
  return {
5147
4171
  deployment: null,
5148
4172
  status: "dry-run",
@@ -5150,7 +4174,7 @@ async function runDeploy(input) {
5150
4174
  };
5151
4175
  }
5152
4176
  try {
5153
- const triggered = await withSpinner(`Deploying ${input.branch}${input.target ? ` → ${input.target}` : ""}…`, () => deploy.triggerDeployment({
4177
+ const triggered = await (0, ui_exports.withSpinner)(`Deploying ${input.branch}${input.target ? ` → ${input.target}` : ""}…`, () => deploy.triggerDeployment({
5154
4178
  projectId: input.projectId,
5155
4179
  branch: input.branch,
5156
4180
  ...input.target ? { target: input.target } : {}
@@ -5160,10 +4184,10 @@ async function runDeploy(input) {
5160
4184
  url: triggered.url,
5161
4185
  id: triggered.id
5162
4186
  }, "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));
4187
+ 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
4188
  if (record.status !== "ready") {
5165
4189
  const message = terminalFailure(record);
5166
- print(` ${style.fail(`${message} — ${withScheme(triggered.url)}`)}`);
4190
+ print(` ${ui_exports.style.fail(`${message} — ${withScheme(triggered.url)}`)}`);
5167
4191
  logger.warn({
5168
4192
  id: record.id,
5169
4193
  status: record.status,
@@ -5175,7 +4199,7 @@ async function runDeploy(input) {
5175
4199
  message
5176
4200
  };
5177
4201
  }
5178
- print(` ${style.success(`${record.status} — ${withScheme(triggered.url)}`)}`);
4202
+ print(` ${ui_exports.style.success(`${record.status} — ${withScheme(triggered.url)}`)}`);
5179
4203
  logger.info({
5180
4204
  status: record.status,
5181
4205
  url: triggered.url,
@@ -5187,7 +4211,7 @@ async function runDeploy(input) {
5187
4211
  };
5188
4212
  } catch (err) {
5189
4213
  const message = errorMessage(err);
5190
- print(` ${style.fail(message)}`);
4214
+ print(` ${ui_exports.style.fail(message)}`);
5191
4215
  logger.warn({
5192
4216
  branch: input.branch,
5193
4217
  reason: message
@@ -5228,13 +4252,13 @@ async function runDeployFromFiles(input) {
5228
4252
  projectId: input.projectId,
5229
4253
  dryRun: dryRun || void 0
5230
4254
  }, "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)" : ""}`));
4255
+ 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
4256
  if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a `deployment` provider to holocron.config.json");
5233
4257
  const deploy = loader.get("deployment");
5234
4258
  if (!deploy.deployFunction) throw new Error(`deployment provider "${deploy.providerName}" does not support deploying from files — deployFunction() is not implemented`);
5235
4259
  if (dryRun) {
5236
4260
  const message = `would: ${deploy.providerName}.deployFunction(projectId=${input.projectId}, files=${fileCount}${input.target ? `, target=${input.target}` : ""})`;
5237
- print(` ${style.dim(`… ${message}`)}`);
4261
+ print(` ${ui_exports.style.dim(`… ${message}`)}`);
5238
4262
  return {
5239
4263
  deployment: null,
5240
4264
  status: "dry-run",
@@ -5242,7 +4266,7 @@ async function runDeployFromFiles(input) {
5242
4266
  };
5243
4267
  }
5244
4268
  try {
5245
- const result = await withSpinner(`Deploying ${fileCount} file${fileCount === 1 ? "" : "s"} from ${input.dir}…`, () => deploy.deployFunction(input.projectId, {
4269
+ const result = await (0, ui_exports.withSpinner)(`Deploying ${fileCount} file${fileCount === 1 ? "" : "s"} from ${input.dir}…`, () => deploy.deployFunction(input.projectId, {
5246
4270
  files,
5247
4271
  ...input.target ? { target: input.target } : {}
5248
4272
  }));
@@ -5250,10 +4274,10 @@ async function runDeployFromFiles(input) {
5250
4274
  url: result.url,
5251
4275
  id: result.deploymentId
5252
4276
  }, "deploy: triggered (files)");
5253
- const record = await withSpinner(`Waiting for ${withScheme(result.url)} to finish…`, () => waitForDeployment(deploy, result.deploymentId, input.wait));
4277
+ const record = await (0, ui_exports.withSpinner)(`Waiting for ${withScheme(result.url)} to finish…`, () => waitForDeployment(deploy, result.deploymentId, input.wait));
5254
4278
  if (record.status !== "ready") {
5255
4279
  const message = terminalFailure(record);
5256
- print(` ${style.fail(`${message} — ${withScheme(result.url)}`)}`);
4280
+ print(` ${ui_exports.style.fail(`${message} — ${withScheme(result.url)}`)}`);
5257
4281
  logger.warn({
5258
4282
  id: record.id,
5259
4283
  status: record.status,
@@ -5265,7 +4289,7 @@ async function runDeployFromFiles(input) {
5265
4289
  message
5266
4290
  };
5267
4291
  }
5268
- print(` ${style.success(withScheme(result.url))}`);
4292
+ print(` ${ui_exports.style.success(withScheme(result.url))}`);
5269
4293
  logger.info({
5270
4294
  url: result.url,
5271
4295
  id: result.deploymentId
@@ -5276,7 +4300,7 @@ async function runDeployFromFiles(input) {
5276
4300
  };
5277
4301
  } catch (err) {
5278
4302
  const message = errorMessage(err);
5279
- print(` ${style.fail(message)}`);
4303
+ print(` ${ui_exports.style.fail(message)}`);
5280
4304
  logger.warn({
5281
4305
  dir: input.dir,
5282
4306
  reason: message
@@ -5299,7 +4323,7 @@ const deployCommand = {
5299
4323
  process.exitCode = 1;
5300
4324
  return;
5301
4325
  }
5302
- const tokens = tokenContext(argv.token);
4326
+ const tokens = tokenContext$1(argv.token);
5303
4327
  if (!tokens) return;
5304
4328
  const loaded = await loadConfig(argv.cwd);
5305
4329
  applyResolvedConfig(argv, loaded.resolved);
@@ -5319,7 +4343,7 @@ const deployCommand = {
5319
4343
  })).status === "fail") process.exitCode = 1;
5320
4344
  return;
5321
4345
  }
5322
- const [branch] = await promptForPositionals(getEntry("deploy"), argv);
4346
+ const [branch] = await (0, ui_exports.promptForPositionals)(getEntry("deploy"), argv);
5323
4347
  if ((await runDeploy({
5324
4348
  loaded,
5325
4349
  context,
@@ -5329,153 +4353,6 @@ const deployCommand = {
5329
4353
  })).status === "fail") process.exitCode = 1;
5330
4354
  }
5331
4355
  };
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
4356
  // src/commands/dev-serve/dev-serve.ts
5480
4357
  /**
5481
4358
  * `holocron dev serve` — the application `holocron dev` runs when `dev.serve` names a handler: it loads the handler
@@ -5737,13 +4614,13 @@ async function runTunnelUp(input) {
5737
4614
  };
5738
4615
  const row = (ok, label, detail) => {
5739
4616
  summary[ok ? "ok" : "fail"] += 1;
5740
- const text = `${label} ${style.dim(`(${detail})`)}`;
5741
- print(` ${ok ? style.success(text) : style.fail(text)}`);
4617
+ const text = `${label} ${ui_exports.style.dim(`(${detail})`)}`;
4618
+ print(` ${ok ? ui_exports.style.success(text) : ui_exports.style.fail(text)}`);
5742
4619
  };
5743
4620
  const finish = (status, extra = {}) => {
5744
4621
  print("");
5745
4622
  const line = `${summary.ok} ok, ${summary.fail} failed`;
5746
- print(summary.fail > 0 ? style.fail(line) : style.success(line));
4623
+ print(summary.fail > 0 ? ui_exports.style.fail(line) : ui_exports.style.success(line));
5747
4624
  logger[status === "ok" ? "info" : "warn"]({
5748
4625
  status,
5749
4626
  ...summary
@@ -5755,10 +4632,10 @@ async function runTunnelUp(input) {
5755
4632
  };
5756
4633
  };
5757
4634
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
5758
- await withSpinner("Loading plugins…", () => loader.load());
4635
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
5759
4636
  assertPluginsResolvable(loader, COMMAND$3);
5760
4637
  const dryRun = input.context.dryRun ?? false;
5761
- print(style.header(`Holocron tunnel up — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
4638
+ print(ui_exports.style.header(`Holocron tunnel up — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
5762
4639
  print("");
5763
4640
  if (!loader.has("tunnels")) {
5764
4641
  row(false, "tunnels", missing(loader, "tunnels", "needs a `tunnels` provider in holocron.config.ts (cloudflare)"));
@@ -5853,7 +4730,7 @@ const tunnelUpCommand = {
5853
4730
  describe: "Make a named tunnel with a stable public hostname that reaches a local port",
5854
4731
  builder: tunnelUpArgs,
5855
4732
  handler: async (argv) => {
5856
- const tokens = tokenContext(argv.token);
4733
+ const tokens = tokenContext$1(argv.token);
5857
4734
  if (!tokens) return;
5858
4735
  const loaded = await loadConfig(argv.cwd);
5859
4736
  applyResolvedConfig(argv, loaded.resolved);
@@ -5885,13 +4762,13 @@ async function runDev(input) {
5885
4762
  };
5886
4763
  const row = (ok, label, detail) => {
5887
4764
  summary[ok ? "ok" : "fail"] += 1;
5888
- const text = `${label} ${style.dim(`(${detail})`)}`;
5889
- print(` ${ok ? style.success(text) : style.fail(text)}`);
4765
+ const text = `${label} ${ui_exports.style.dim(`(${detail})`)}`;
4766
+ print(` ${ok ? ui_exports.style.success(text) : ui_exports.style.fail(text)}`);
5890
4767
  };
5891
4768
  const finish = (status, extra = {}) => {
5892
4769
  print("");
5893
4770
  const line = `${summary.ok} ok, ${summary.fail} failed`;
5894
- print(summary.fail > 0 ? style.fail(line) : style.success(line));
4771
+ print(summary.fail > 0 ? ui_exports.style.fail(line) : ui_exports.style.success(line));
5895
4772
  logger[status === "ok" ? "info" : "warn"]({
5896
4773
  status,
5897
4774
  ...summary
@@ -5903,12 +4780,12 @@ async function runDev(input) {
5903
4780
  };
5904
4781
  };
5905
4782
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
5906
- await withSpinner("Loading plugins…", () => loader.load());
4783
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
5907
4784
  assertPluginsResolvable(loader, COMMAND$2);
5908
4785
  const dryRun = input.context.dryRun ?? false;
5909
4786
  const [program, ...args] = input.command;
5910
4787
  const shown = input.command.join(" ");
5911
- print(style.header(`Holocron dev — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
4788
+ print(ui_exports.style.header(`Holocron dev — ${input.hostname}${dryRun ? " (dry-run)" : ""}`));
5912
4789
  print("");
5913
4790
  const vault = loader.has("vault") ? loader.get("vault") : void 0;
5914
4791
  if (!vault?.readEnvironment) {
@@ -6000,7 +4877,7 @@ const devCommand = {
6000
4877
  describe: "Run an application locally behind its development tunnel, with its secrets from the vault (command after --)",
6001
4878
  builder: (y) => devArgs(y).command(devServeCommand),
6002
4879
  handler: async (argv) => {
6003
- const tokens = tokenContext(argv.token);
4880
+ const tokens = tokenContext$1(argv.token);
6004
4881
  if (!tokens) return;
6005
4882
  const loaded = await loadConfig(argv.cwd);
6006
4883
  applyResolvedConfig(argv, loaded.resolved);
@@ -6417,7 +5294,7 @@ const doctorCredentialsCommand = {
6417
5294
  command: "credentials",
6418
5295
  describe: "Check that the credentials environment exists and holds the tokens the plugins take (read-only)",
6419
5296
  handler: async (argv) => {
6420
- const tokens = tokenContext(argv.token);
5297
+ const tokens = tokenContext$1(argv.token);
6421
5298
  if (!tokens) return;
6422
5299
  const loaded = await loadConfig(argv.cwd);
6423
5300
  applyResolvedConfig(argv, loaded.resolved);
@@ -6545,7 +5422,7 @@ async function readCapped(res, maxBytes, tooBig) {
6545
5422
  */
6546
5423
  /** Providers cap avatars well below this; it only keeps a wrong file from filling memory. */
6547
5424
  const MAX_AVATAR_BYTES = 8388608;
6548
- const FETCH_TIMEOUT_MS$2 = 15e3;
5425
+ const FETCH_TIMEOUT_MS$1 = 15e3;
6549
5426
  const SIGNATURES = [
6550
5427
  ["image/png", [
6551
5428
  137,
@@ -6605,7 +5482,7 @@ async function loadAvatar(source, baseDir = process.cwd(), fetchImpl = fetch) {
6605
5482
  const base64 = /^data:[^;,]+;base64,(.*)$/is.exec(source)?.[1];
6606
5483
  if (base64 === void 0) throw new Error("it is not a base64 data URI");
6607
5484
  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);
5485
+ } else if (/^https:\/\//i.test(source)) bytes = await fetchAvatarBytes(source, fetchImpl, MAX_AVATAR_BYTES, FETCH_TIMEOUT_MS$1, tooBig);
6609
5486
  else {
6610
5487
  const path = resolve(baseDir, source);
6611
5488
  if ((await stat(path)).size > 8388608) throw tooBig();
@@ -6744,15 +5621,15 @@ async function provisionChannel(deps, spec) {
6744
5621
  const relay = spec.feeds?.errors;
6745
5622
  if (relay && !notifications.ensureWebhook) throw new Error(`\`${notifications.providerName}\` cannot create webhooks`);
6746
5623
  if (dryRun) {
6747
- print(` ${style.skip(`would ensure channel ${spec.name}${where}`)}`);
5624
+ print(` ${ui_exports.style.skip(`would ensure channel ${spec.name}${where}`)}`);
6748
5625
  if (tally) tally.skip += webhookCfg ? 2 : 1;
6749
- if (webhookCfg) print(` ${style.skip(`would ensure webhook ${webhookName} and store its URL in ${secretName}`)}`);
5626
+ if (webhookCfg) print(` ${ui_exports.style.skip(`would ensure webhook ${webhookName} and store its URL in ${secretName}`)}`);
6750
5627
  if (feed) {
6751
- print(` ${style.skip(`would ensure webhook ${feed.webhook} and alert channel ${feed.name} (monitoring)`)}`);
5628
+ print(` ${ui_exports.style.skip(`would ensure webhook ${feed.webhook} and alert channel ${feed.name} (monitoring)`)}`);
6752
5629
  if (tally) tally.skip += 2;
6753
5630
  }
6754
5631
  if (relay) {
6755
- print(` ${style.skip(`would ensure webhook ${relay.webhook} for the relay Worker (errors)`)}`);
5632
+ print(` ${ui_exports.style.skip(`would ensure webhook ${relay.webhook} for the relay Worker (errors)`)}`);
6756
5633
  if (tally) tally.skip++;
6757
5634
  }
6758
5635
  return {
@@ -6772,7 +5649,7 @@ async function provisionChannel(deps, spec) {
6772
5649
  const changed = channel.created || (channel.updated?.length ?? 0) > 0;
6773
5650
  const verb = channel.created ? "created" : changed ? "updated" : "exists ";
6774
5651
  const what = channel.updated?.length ? `: ${channel.updated.join(", ")}` : "";
6775
- print(` ${(changed ? style.success : style.skip)(`${verb} channel ${spec.name}${where}${what}`)}`);
5652
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} channel ${spec.name}${where}${what}`)}`);
6776
5653
  if (tally) tally[changed ? "ok" : "skip"]++;
6777
5654
  const outcome = {
6778
5655
  name: spec.name,
@@ -6798,7 +5675,7 @@ async function provisionChannel(deps, spec) {
6798
5675
  } catch (err) {
6799
5676
  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
5677
  }
6801
- print(` ${style.success(`${hook.created ? "created" : "found "} webhook ${webhookName}; URL stored in ${secretName}`)}`);
5678
+ print(` ${ui_exports.style.success(`${hook.created ? "created" : "found "} webhook ${webhookName}; URL stored in ${secretName}`)}`);
6802
5679
  if (tally) tally.ok++;
6803
5680
  outcome.webhook = {
6804
5681
  name: webhookName,
@@ -6809,7 +5686,7 @@ async function provisionChannel(deps, spec) {
6809
5686
  };
6810
5687
  } else {
6811
5688
  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)}`);
5689
+ print(` ${ui_exports.style.warn(note)}`);
6813
5690
  outcome.webhook = {
6814
5691
  name: webhookName,
6815
5692
  created: hook.created,
@@ -6820,7 +5697,7 @@ async function provisionChannel(deps, spec) {
6820
5697
  };
6821
5698
  }
6822
5699
  if (avatarSet) {
6823
- print(` ${style.success(`set avatar on webhook ${webhookName}`)}`);
5700
+ print(` ${ui_exports.style.success(`set avatar on webhook ${webhookName}`)}`);
6824
5701
  if (tally) tally.ok++;
6825
5702
  }
6826
5703
  if (hook.avatarError) throw new Error(`webhook ${webhookName} is ready but setting its avatar failed (${hook.avatarError})`);
@@ -6842,7 +5719,7 @@ async function provisionRelayFeed(deps, spec, feed, outcome) {
6842
5719
  ...feed.avatar ? { avatar: feed.avatar } : {}
6843
5720
  });
6844
5721
  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)" : ""}`)}`);
5722
+ 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
5723
  if (tally) {
6847
5724
  const done = Number(hook.created) + Number(avatarSet);
6848
5725
  if (done > 0) tally.ok += done;
@@ -6871,7 +5748,7 @@ async function provisionFeed(deps, spec, feed, outcome) {
6871
5748
  ...feed.avatar ? { avatar: feed.avatar } : {}
6872
5749
  });
6873
5750
  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)" : ""}`)}`);
5751
+ print(` ${(hook.created || avatarSet ? ui_exports.style.success : ui_exports.style.skip)(`${hook.created ? "created" : "found "} webhook ${feed.webhook}${avatarSet ? " (avatar set)" : ""}`)}`);
6875
5752
  if (tally) {
6876
5753
  const done = Number(hook.created) + Number(avatarSet);
6877
5754
  if (done > 0) tally.ok += done;
@@ -6892,7 +5769,7 @@ async function provisionFeed(deps, spec, feed, outcome) {
6892
5769
  const changed = result.created || result.updated.length > 0;
6893
5770
  const verb = result.created ? "created" : changed ? "updated" : "exists ";
6894
5771
  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)`)}`);
5772
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} alert channel ${feed.name} via webhook ${feed.webhook}${what} (${result.subscribed} checks)`)}`);
6896
5773
  if (tally) tally[changed ? "ok" : "skip"]++;
6897
5774
  outcome.alertChannel = {
6898
5775
  name: feed.name,
@@ -6948,7 +5825,7 @@ async function runNotificationsChannelAdd(input) {
6948
5825
  }, `notifications channel add: ${input.name}`);
6949
5826
  if (channel.webhook && !channel.webhook.stored && !dryRun) {
6950
5827
  const message = channel.webhook.note;
6951
- print(` ${style.fail(message)}`);
5828
+ print(` ${ui_exports.style.fail(message)}`);
6952
5829
  return {
6953
5830
  status: "fail",
6954
5831
  channel,
@@ -6961,7 +5838,7 @@ async function runNotificationsChannelAdd(input) {
6961
5838
  };
6962
5839
  } catch (err) {
6963
5840
  const message = describeProviderError(err);
6964
- print(` ${style.fail(message)}`);
5841
+ print(` ${ui_exports.style.fail(message)}`);
6965
5842
  logger.warn({
6966
5843
  channel: input.name,
6967
5844
  reason: logReason(err)
@@ -7295,7 +6172,7 @@ const doctorDnsCommand = {
7295
6172
  command: "dns",
7296
6173
  describe: "Check that the DNS records the config makes setup write exist and point where they should (read-only)",
7297
6174
  handler: async (argv) => {
7298
- const tokens = tokenContext(argv.token);
6175
+ const tokens = tokenContext$1(argv.token);
7299
6176
  if (!tokens) return;
7300
6177
  const loaded = await loadConfig(argv.cwd);
7301
6178
  applyResolvedConfig(argv, loaded.resolved);
@@ -7371,7 +6248,7 @@ const doctorEnvironmentsCommand = {
7371
6248
  command: "environments",
7372
6249
  describe: "Check that the deployment environments the config relies on exist (read-only)",
7373
6250
  handler: async (argv) => {
7374
- const tokens = tokenContext(argv.token);
6251
+ const tokens = tokenContext$1(argv.token);
7375
6252
  if (!tokens) return;
7376
6253
  const loaded = await loadConfig(argv.cwd);
7377
6254
  applyResolvedConfig(argv, loaded.resolved);
@@ -7527,7 +6404,7 @@ const doctorMonitoringCommand = {
7527
6404
  command: "monitoring",
7528
6405
  describe: "Check the monitoring checks the config declares against the ones the provider holds (read-only)",
7529
6406
  handler: async (argv) => {
7530
- const tokens = tokenContext(argv.token);
6407
+ const tokens = tokenContext$1(argv.token);
7531
6408
  if (!tokens) return;
7532
6409
  const loaded = await loadConfig(argv.cwd);
7533
6410
  applyResolvedConfig(argv, loaded.resolved);
@@ -7759,7 +6636,7 @@ async function withElevation(run, deps) {
7759
6636
  const { permission, grantUrl, revokeUrl, applied, keep } = err.elevation;
7760
6637
  const name = err.elevation.label ?? permission;
7761
6638
  if (await notifications.holdsPermission?.(permission).catch(() => false)) throw err;
7762
- print(` ${style.skip(`${deps.label} needs ${name}${keep ? "" : " for this one edit"}`)}`);
6639
+ print(` ${ui_exports.style.skip(`${deps.label} needs ${name}${keep ? "" : " for this one edit"}`)}`);
7763
6640
  print(` 1. approve it: ${grantUrl}`);
7764
6641
  await pause(`Press Enter once ${name} is approved to try again`);
7765
6642
  let result;
@@ -7777,10 +6654,10 @@ async function withElevation(run, deps) {
7777
6654
  const holdsNow = await notifications.holdsPermission?.(permission).catch(() => void 0);
7778
6655
  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
6656
  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`)}`);
6657
+ else print(` ${ui_exports.style.success(`${permission} is gone again`)}`);
7781
6658
  }
7782
6659
  if (failure !== void 0) {
7783
- if (leftover) print(` ${style.fail(leftover)}`);
6660
+ if (leftover) print(` ${ui_exports.style.fail(leftover)}`);
7784
6661
  throw failure;
7785
6662
  }
7786
6663
  return {
@@ -7976,7 +6853,7 @@ function serverLayoutProblem(layout) {
7976
6853
  }
7977
6854
  }
7978
6855
  async function runNotificationsSetup(input$1) {
7979
- const progress = createProgress(input$1.print ?? ((line) => console.log(line)));
6856
+ const progress = createProgress$1(input$1.print ?? ((line) => console.log(line)));
7980
6857
  const print = progress.print;
7981
6858
  const logger = input$1.logger ?? getLogger();
7982
6859
  /* v8 ignore next -- the real loader is only built outside tests, which always inject one */
@@ -7992,9 +6869,9 @@ async function runNotificationsSetup(input$1) {
7992
6869
  failures: []
7993
6870
  };
7994
6871
  const refuse = (message, reason = message) => {
7995
- print(` ${style.fail(message)}`);
6872
+ print(` ${ui_exports.style.fail(message)}`);
7996
6873
  print("");
7997
- print(style.header("0 ok, 1 fail, 0 skipped"));
6874
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
7998
6875
  logger.warn({ reason }, "notifications setup");
7999
6876
  return {
8000
6877
  ...report,
@@ -8065,7 +6942,7 @@ async function runNotificationsSetup(input$1) {
8065
6942
  ]) {
8066
6943
  const key = JSON.stringify(sources);
8067
6944
  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" : ""}`)}`)));
6945
+ 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
6946
  } catch (err) {
8070
6947
  return refuse(`webhook avatar ${errorMessage(err)}`);
8071
6948
  }
@@ -8110,7 +6987,7 @@ async function runNotificationsSetup(input$1) {
8110
6987
  return true;
8111
6988
  } catch (err) {
8112
6989
  const message = describeProviderError(err);
8113
- print(` ${style.fail(`${step}: ${message}`)}`);
6990
+ print(` ${ui_exports.style.fail(`${step}: ${message}`)}`);
8114
6991
  report.failures.push({
8115
6992
  step,
8116
6993
  message
@@ -8118,11 +6995,11 @@ async function runNotificationsSetup(input$1) {
8118
6995
  return false;
8119
6996
  }
8120
6997
  };
8121
- if ((layout.roles ?? []).length > 0) print(`\n${style.header("Roles")}`);
6998
+ if ((layout.roles ?? []).length > 0) print(`\n${ui_exports.style.header("Roles")}`);
8122
6999
  for (const role of layout.roles ?? []) await attempt(`role ${role.name}`, async () => {
8123
7000
  if (!notifications.ensureRole) throw new Error(`\`${notifications.providerName}\` cannot manage roles`);
8124
7001
  if (dryRun) {
8125
- print(` ${style.skip(`would ensure role ${role.name}${role.secret ? ` and store its id in ${role.secret}` : ""}`)}`);
7002
+ print(` ${ui_exports.style.skip(`would ensure role ${role.name}${role.secret ? ` and store its id in ${role.secret}` : ""}`)}`);
8126
7003
  tally.skip++;
8127
7004
  report.roles.push({
8128
7005
  name: role.name,
@@ -8147,23 +7024,23 @@ async function runNotificationsSetup(input$1) {
8147
7024
  report.roles.push(outcome);
8148
7025
  const changed = result.created || (result.updated?.length ?? 0) > 0;
8149
7026
  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(", ")}` : ""}`)}`);
7027
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} role ${role.name} (id ${result.id})${result.updated?.length ? `: ${result.updated.join(", ")}` : ""}`)}`);
8151
7028
  made(changed);
8152
7029
  if (role.secret) {
8153
7030
  await secrets.setSecret(scope, role.secret, result.id);
8154
7031
  outcome.secret = role.secret;
8155
7032
  outcome.stored = true;
8156
- print(` ${style.success(`stored the id of ${role.name} in ${role.secret}`)}`);
7033
+ print(` ${ui_exports.style.success(`stored the id of ${role.name} in ${role.secret}`)}`);
8157
7034
  tally.ok++;
8158
7035
  }
8159
7036
  });
8160
7037
  for (const category of layout.categories ?? []) {
8161
- print(`\n${style.header(category.name)}`);
7038
+ print(`\n${ui_exports.style.header(category.name)}`);
8162
7039
  report.categories.push(category.name);
8163
7040
  const categoryOk = await attempt(`category ${category.name}`, async () => {
8164
7041
  if (!notifications.ensureCategory) return;
8165
7042
  if (dryRun) {
8166
- print(` ${style.skip(`would ensure category ${category.name}`)}`);
7043
+ print(` ${ui_exports.style.skip(`would ensure category ${category.name}`)}`);
8167
7044
  tally.skip++;
8168
7045
  return;
8169
7046
  }
@@ -8171,12 +7048,12 @@ async function runNotificationsSetup(input$1) {
8171
7048
  const changed = result.created || (result.updated?.length ?? 0) > 0;
8172
7049
  const verb = result.created ? "created" : changed ? "updated" : "exists ";
8173
7050
  const what = result.updated?.length ? `: ${result.updated.join(", ")}` : "";
8174
- print(` ${(changed ? style.success : style.skip)(`${verb} category ${category.name}${what}`)}`);
7051
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} category ${category.name}${what}`)}`);
8175
7052
  made(changed);
8176
7053
  });
8177
7054
  const channels = category.channels ?? [];
8178
7055
  if (!categoryOk && channels.length > 0) {
8179
- print(` ${style.skip(`skipped ${channels.length} channel${channels.length === 1 ? "" : "s"}: the category failed`)}`);
7056
+ print(` ${ui_exports.style.skip(`skipped ${channels.length} channel${channels.length === 1 ? "" : "s"}: the category failed`)}`);
8180
7057
  tally.skip += channels.length;
8181
7058
  continue;
8182
7059
  }
@@ -8224,14 +7101,14 @@ async function runNotificationsSetup(input$1) {
8224
7101
  });
8225
7102
  }
8226
7103
  if (errors && workers && dns && wantsRelay(layout)) {
8227
- print(`\n${style.header("Relay")}`);
7104
+ print(`\n${ui_exports.style.header("Relay")}`);
8228
7105
  const tracker = layout.relay.errors;
8229
7106
  let signingSecret;
8230
7107
  if (tracker && errors.ensureRelay) await attempt(`${errors.providerName} alert relay`, async () => {
8231
7108
  const integration = tracker.integration ?? "Comlink";
8232
7109
  const rule = tracker.rule ?? "Errors to Discord (Comlink)";
8233
7110
  if (dryRun) {
8234
- print(` ${style.skip(`would ensure the ${errors.providerName} integration ${integration} and the alert rule ${rule} on ${tracker.projects.join(", ")}`)}`);
7111
+ print(` ${ui_exports.style.skip(`would ensure the ${errors.providerName} integration ${integration} and the alert rule ${rule} on ${tracker.projects.join(", ")}`)}`);
8235
7112
  tally.skip += 2;
8236
7113
  return;
8237
7114
  }
@@ -8257,14 +7134,14 @@ async function runNotificationsSetup(input$1) {
8257
7134
  const changed = outcome.created || outcome.updated.length > 0;
8258
7135
  const verb = outcome.created ? "created" : changed ? "updated" : "exists ";
8259
7136
  const detail = outcome.updated.length > 0 ? `: ${outcome.updated.join(", ")}` : "";
8260
- print(` ${(changed ? style.success : style.skip)(`${verb} ${errors.providerName} ${what} ${name}${detail}`)}`);
7137
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${verb} ${errors.providerName} ${what} ${name}${detail}`)}`);
8261
7138
  made(changed);
8262
7139
  }
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`)}`);
7140
+ 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
7141
  });
8265
7142
  await attempt(`relay ${layout.relay.host}`, async () => {
8266
7143
  if (dryRun) {
8267
- print(` ${style.skip(`would deploy the relay Worker at ${layout.relay.host}`)}`);
7144
+ print(` ${ui_exports.style.skip(`would deploy the relay Worker at ${layout.relay.host}`)}`);
8268
7145
  tally.skip++;
8269
7146
  return;
8270
7147
  }
@@ -8279,26 +7156,26 @@ async function runNotificationsSetup(input$1) {
8279
7156
  dns,
8280
7157
  ...input$1.readRelayCode ? { readCode: input$1.readRelayCode } : {}
8281
7158
  });
8282
- print(` ${style.success(`deployed ${deployed.script} at ${deployed.host}`)}`);
7159
+ print(` ${ui_exports.style.success(`deployed ${deployed.script} at ${deployed.host}`)}`);
8283
7160
  tally.ok++;
8284
7161
  });
8285
7162
  }
8286
7163
  if (layout.server || layout.welcome || layout.onboarding || (layout.pinned?.length ?? 0) > 0 || layout.application || layout.everyone) {
8287
- print(`\n${style.header("Server")}`);
7164
+ print(`\n${ui_exports.style.header("Server")}`);
8288
7165
  const apply = async (label, declared, run) => {
8289
7166
  if (!declared) return;
8290
7167
  await attempt(label, async () => {
8291
7168
  if (dryRun) {
8292
- print(` ${style.skip(`would ensure ${label}`)}`);
7169
+ print(` ${ui_exports.style.skip(`would ensure ${label}`)}`);
8293
7170
  tally.skip++;
8294
7171
  return;
8295
7172
  }
8296
7173
  const result = await run();
8297
7174
  const changed = result.updated.length > 0;
8298
- print(` ${(changed ? style.success : style.skip)(`${changed ? "updated" : "exists "} ${label}${changed ? `: ${result.updated.join(", ")}` : ""}`)}`);
7175
+ print(` ${(changed ? ui_exports.style.success : ui_exports.style.skip)(`${changed ? "updated" : "exists "} ${label}${changed ? `: ${result.updated.join(", ")}` : ""}`)}`);
8299
7176
  made(changed);
8300
7177
  for (const todo of result.todo ?? []) {
8301
- print(` ${style.fail(`${label}: ${todo}`)}`);
7178
+ print(` ${ui_exports.style.fail(`${label}: ${todo}`)}`);
8302
7179
  report.failures.push({
8303
7180
  step: label,
8304
7181
  message: todo
@@ -8328,7 +7205,7 @@ async function runNotificationsSetup(input$1) {
8328
7205
  if (report.failures.length > 0) report.status = "fail";
8329
7206
  else if (dryRun) report.status = "dry-run";
8330
7207
  print("");
8331
- print(style.header(`${tally.ok} ok, ${report.failures.length} fail, ${tally.skip} skipped`));
7208
+ print(ui_exports.style.header(`${tally.ok} ok, ${report.failures.length} fail, ${tally.skip} skipped`));
8332
7209
  logger.info({
8333
7210
  provider: notifications.providerName,
8334
7211
  channels: report.channels.length,
@@ -8605,7 +7482,7 @@ async function syncRoles(input) {
8605
7482
  skipped: 0
8606
7483
  };
8607
7484
  for (const role of input.roles) {
8608
- print(`\n${style.header(`${role.name} ← team ${role.team}`)}`);
7485
+ print(`\n${ui_exports.style.header(`${role.name} ← team ${role.team}`)}`);
8609
7486
  const step = `role ${role.name}`;
8610
7487
  let plan;
8611
7488
  try {
@@ -8619,7 +7496,7 @@ async function syncRoles(input) {
8619
7496
  });
8620
7497
  } catch (err) {
8621
7498
  const message = describeProviderError(err);
8622
- print(` ${style.fail(`${step}: ${message}`)}`);
7499
+ print(` ${ui_exports.style.fail(`${step}: ${message}`)}`);
8623
7500
  result.failures.push({
8624
7501
  step,
8625
7502
  message
@@ -8635,11 +7512,11 @@ async function syncRoles(input) {
8635
7512
  };
8636
7513
  result.roles.push(outcome);
8637
7514
  result.skipped += plan.inSync;
8638
- if (plan.inSync > 0) print(` ${style.skip(`${plan.inSync} already have it`)}`);
7515
+ if (plan.inSync > 0) print(` ${ui_exports.style.skip(`${plan.inSync} already have it`)}`);
8639
7516
  const act = async (verb, who) => {
8640
7517
  const label = `${verb === "add" ? "gave" : "took"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})`;
8641
7518
  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)" : ""}`)}`);
7519
+ 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
7520
  result.skipped++;
8644
7521
  return;
8645
7522
  }
@@ -8647,11 +7524,11 @@ async function syncRoles(input) {
8647
7524
  if (verb === "add") await notifications.addRoleMember(role.name, who.member);
8648
7525
  else await notifications.removeRoleMember(role.name, who.member);
8649
7526
  (verb === "add" ? outcome.added : outcome.removed).push(who.member);
8650
- print(` ${style.success(label)}`);
7527
+ print(` ${ui_exports.style.success(label)}`);
8651
7528
  result.ok++;
8652
7529
  } catch (err) {
8653
7530
  const message = describeProviderError(err);
8654
- print(` ${style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
7531
+ print(` ${ui_exports.style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
8655
7532
  result.failures.push({
8656
7533
  step: `${step} ${verb} ${who.login}`,
8657
7534
  message
@@ -8661,11 +7538,11 @@ async function syncRoles(input) {
8661
7538
  for (const who of plan.add) await act("add", who);
8662
7539
  for (const who of plan.remove) await act("remove", who);
8663
7540
  for (const person of plan.unlinked) {
8664
- print(` ${style.skip(`${person.login} is on the team but has not linked their account`)}`);
7541
+ print(` ${ui_exports.style.skip(`${person.login} is on the team but has not linked their account`)}`);
8665
7542
  result.skipped++;
8666
7543
  }
8667
7544
  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`)}`);
7545
+ print(` ${ui_exports.style.skip(`${holder.name ?? holder.member} holds ${role.name} but is not linked to anyone: left alone`)}`);
8669
7546
  result.skipped++;
8670
7547
  }
8671
7548
  }
@@ -8721,9 +7598,9 @@ async function runNotificationsSyncRoles(input) {
8721
7598
  failures: []
8722
7599
  };
8723
7600
  const refuse = (message, reason = message) => {
8724
- print(` ${style.fail(message)}`);
7601
+ print(` ${ui_exports.style.fail(message)}`);
8725
7602
  print("");
8726
- print(style.header("0 ok, 1 fail, 0 skipped"));
7603
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
8727
7604
  logger.warn({ reason }, "notifications sync-roles");
8728
7605
  return {
8729
7606
  ...report,
@@ -8751,7 +7628,7 @@ async function runNotificationsSyncRoles(input) {
8751
7628
  } catch (err) {
8752
7629
  return refuse(describeProviderError(err), logReason(err));
8753
7630
  }
8754
- if (links.links.length === 0) print(` ${style.skip("no links yet: nobody can be given a role until they link their account")}`);
7631
+ 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
7632
  const result = await syncRoles({
8756
7633
  notifications,
8757
7634
  source,
@@ -8770,7 +7647,7 @@ async function runNotificationsSyncRoles(input) {
8770
7647
  if (report.failures.length > 0) report.status = "fail";
8771
7648
  else if (dryRun) report.status = "dry-run";
8772
7649
  print("");
8773
- print(style.header(`${result.ok} ok, ${report.failures.length} fail, ${result.skipped} skipped`));
7650
+ print(ui_exports.style.header(`${result.ok} ok, ${report.failures.length} fail, ${result.skipped} skipped`));
8774
7651
  logger.info({
8775
7652
  provider: notifications.providerName,
8776
7653
  roles: report.roles.length,
@@ -8822,9 +7699,9 @@ async function runNotificationsLink(input) {
8822
7699
  assertPluginsResolvable(loader, "notifications link");
8823
7700
  const dryRun = input.context.dryRun ?? false;
8824
7701
  const refuse = (message, reason = message) => {
8825
- print(` ${style.fail(message)}`);
7702
+ print(` ${ui_exports.style.fail(message)}`);
8826
7703
  print("");
8827
- print(style.header("0 ok, 1 fail, 0 skipped"));
7704
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
8828
7705
  logger.warn({ reason }, "notifications link");
8829
7706
  return {
8830
7707
  status: "fail",
@@ -8856,21 +7733,21 @@ async function runNotificationsLink(input) {
8856
7733
  /* v8 ignore next -- the real fetch is only used outside tests, which inject one */
8857
7734
  ...input.fetch ? { fetch: input.fetch } : {}
8858
7735
  });
8859
- print(` ${style.skip(`sign-in ${choice.kind === "hosted" ? "is hosted" : "runs on this machine"}: ${choice.reason}`)}`);
7736
+ print(` ${ui_exports.style.skip(`sign-in ${choice.kind === "hosted" ? "is hosted" : "runs on this machine"}: ${choice.reason}`)}`);
8860
7737
  if (choice.kind === "hosted") {
8861
7738
  print(` open ${`${choice.redirectUri.replace(/\/callback$/, "")}/start`} in a browser to link your account`);
8862
7739
  print("");
8863
- print(style.header("0 ok, 0 fail, 1 skipped"));
7740
+ print(ui_exports.style.header("0 ok, 0 fail, 1 skipped"));
8864
7741
  return {
8865
7742
  status: "ok",
8866
7743
  via: "hosted"
8867
7744
  };
8868
7745
  }
8869
7746
  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)}`)}`);
7747
+ print(` ${ui_exports.style.skip(`would sign in on ${choice.redirectUri} and write the link to ${location.repo}/${location.path}`)}`);
7748
+ print(` ${ui_exports.style.skip(`first, ${redirectInstruction(choice.redirectUri)}`)}`);
8872
7749
  print("");
8873
- print(style.header("0 ok, 0 fail, 1 skipped"));
7750
+ print(ui_exports.style.header("0 ok, 0 fail, 1 skipped"));
8874
7751
  return {
8875
7752
  status: "dry-run",
8876
7753
  via: "local"
@@ -8897,7 +7774,7 @@ async function runNotificationsLink(input) {
8897
7774
  const code = await wait({
8898
7775
  port,
8899
7776
  state,
8900
- onListening: () => void open(url).catch(() => print(` ${style.skip("could not open a browser; use the link above")}`))
7777
+ onListening: () => void open(url).catch(() => print(` ${ui_exports.style.skip("could not open a browser; use the link above")}`))
8901
7778
  });
8902
7779
  const who = await signIn.complete({
8903
7780
  redirectUri: choice.redirectUri,
@@ -8930,9 +7807,9 @@ async function runNotificationsLink(input) {
8930
7807
  throw err;
8931
7808
  }
8932
7809
  }
8933
- print(` ${style.success(`${outcome.changed ? "linked" : "already linked"} ${who.github.login} (github ${who.github.id}) to ${who.name ?? who.member} (${who.member})`)}`);
7810
+ 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
7811
  print("");
8935
- print(style.header(`${outcome.changed ? 1 : 0} ok, 0 fail, ${outcome.changed ? 0 : 1} skipped`));
7812
+ print(ui_exports.style.header(`${outcome.changed ? 1 : 0} ok, 0 fail, ${outcome.changed ? 0 : 1} skipped`));
8936
7813
  logger.info({
8937
7814
  provider: notifications.providerName,
8938
7815
  changed: outcome.changed
@@ -9301,7 +8178,7 @@ async function runDoctorNotifications(input) {
9301
8178
  return report;
9302
8179
  };
9303
8180
  const refuse = (message, reason = message) => {
9304
- print(` ${style.fail(message)}`);
8181
+ print(` ${ui_exports.style.fail(message)}`);
9305
8182
  printCheckSummary({
9306
8183
  ok: 0,
9307
8184
  fail: 1,
@@ -9785,7 +8662,7 @@ async function runDoctorNotifications(input) {
9785
8662
  })), print);
9786
8663
  if (deliveryNote) {
9787
8664
  print("");
9788
- print(` ${style.skip(`note: ${deliveryNote}`)}`);
8665
+ print(` ${ui_exports.style.skip(`note: ${deliveryNote}`)}`);
9789
8666
  }
9790
8667
  const summary = summarise();
9791
8668
  printCheckSummary({
@@ -9793,7 +8670,7 @@ async function runDoctorNotifications(input) {
9793
8670
  fail: summary.fail,
9794
8671
  skip: summary.skip
9795
8672
  }, print);
9796
- if (input.post !== void 0) print(` ${style.skip(await postDoctorReport(notifications, input.post, {
8673
+ if (input.post !== void 0) print(` ${ui_exports.style.skip(await postDoctorReport(notifications, input.post, {
9797
8674
  checks,
9798
8675
  summary
9799
8676
  }))}`);
@@ -9805,7 +8682,7 @@ const doctorNotificationsCommand = {
9805
8682
  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
8683
  builder: doctorNotificationsArgs,
9807
8684
  handler: async (argv) => {
9808
- const tokens = tokenContext(argv.token);
8685
+ const tokens = tokenContext$1(argv.token);
9809
8686
  if (!tokens) return;
9810
8687
  const loaded = await loadConfig(argv.cwd);
9811
8688
  applyResolvedConfig(argv, loaded.resolved);
@@ -10505,7 +9382,7 @@ const doctorRepoCommand = {
10505
9382
  command: "repo",
10506
9383
  describe: "Check the repository settings against the config (read-only): description, topics, labels, teams, protection, security",
10507
9384
  handler: async (argv) => {
10508
- const tokens = tokenContext(argv.token);
9385
+ const tokens = tokenContext$1(argv.token);
10509
9386
  if (!tokens) return;
10510
9387
  const loaded = await loadConfig(argv.cwd);
10511
9388
  applyResolvedConfig(argv, loaded.resolved);
@@ -10759,7 +9636,7 @@ const doctorSecretsCommand = {
10759
9636
  command: "secrets",
10760
9637
  describe: "Check the secrets the config says must exist against the ones the provider holds (read-only, names only)",
10761
9638
  handler: async (argv) => {
10762
- const tokens = tokenContext(argv.token);
9639
+ const tokens = tokenContext$1(argv.token);
10763
9640
  if (!tokens) return;
10764
9641
  const loaded = await loadConfig(argv.cwd);
10765
9642
  applyResolvedConfig(argv, loaded.resolved);
@@ -11051,7 +9928,7 @@ const DEEP_CHECKS = [
11051
9928
  command: "variables",
11052
9929
  describe: "Check the Actions variables the config declares against the ones the provider holds (read-only)",
11053
9930
  handler: async (argv) => {
11054
- const tokens = tokenContext(argv.token);
9931
+ const tokens = tokenContext$1(argv.token);
11055
9932
  if (!tokens) return;
11056
9933
  const loaded = await loadConfig(argv.cwd);
11057
9934
  applyResolvedConfig(argv, loaded.resolved);
@@ -11198,12 +10075,12 @@ const doctorArgs = (y) => {
11198
10075
  async function runDoctor(input) {
11199
10076
  const print = input.print ?? ((line) => console.log(line));
11200
10077
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
11201
- await withSpinner("Loading plugins…", () => loader.load());
10078
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
11202
10079
  assertPluginsResolvable(loader, "doctor");
11203
10080
  const rows = [];
11204
10081
  const config = input.loaded.resolved;
11205
10082
  print("");
11206
- print(style.dim(` config: ${input.loaded.filepath}`));
10083
+ print(ui_exports.style.dim(` config: ${input.loaded.filepath}`));
11207
10084
  print("");
11208
10085
  for (const failure of loader.loadFailures()) rows.push({
11209
10086
  capability: failure.key,
@@ -11219,12 +10096,12 @@ async function runDoctor(input) {
11219
10096
  const impls = loader.get(key);
11220
10097
  for (const [idx, impl] of impls.entries()) {
11221
10098
  const name = impl.providerName ?? providers[idx];
11222
- rows.push(await withProgress(`Checking ${key} (${name})…`, () => smokeCheck(key, name, impl)));
10099
+ rows.push(await withProgress$1(`Checking ${key} (${name})…`, () => smokeCheck(key, name, impl)));
11223
10100
  }
11224
10101
  } else {
11225
10102
  const impl = loader.get(key);
11226
10103
  const provider = providers[0] ?? "?";
11227
- const row = await withProgress(`Checking ${key} (${provider})…`, () => smokeCheck(key, provider, impl));
10104
+ const row = await withProgress$1(`Checking ${key} (${provider})…`, () => smokeCheck(key, provider, impl));
11228
10105
  rows.push(row);
11229
10106
  }
11230
10107
  }
@@ -11236,7 +10113,7 @@ async function runDoctor(input) {
11236
10113
  status: row.status,
11237
10114
  detail: row.logMessage ?? row.message
11238
10115
  }, `doctor: ${row.capability}`);
11239
- print(statusRow(row.status, [`${pad(row.capability, 14)} via ${pad(row.provider, 14)}`, row.message]));
10116
+ 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
10117
  }
11241
10118
  const summary = rows.reduce((acc, r) => {
11242
10119
  acc[r.status] += 1;
@@ -11248,7 +10125,7 @@ async function runDoctor(input) {
11248
10125
  });
11249
10126
  const summaryLine = `${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`;
11250
10127
  print("");
11251
- print(style.header(summaryLine));
10128
+ print(ui_exports.style.header(summaryLine));
11252
10129
  return {
11253
10130
  rows,
11254
10131
  summary
@@ -11384,7 +10261,7 @@ const doctorCommand = {
11384
10261
  describe: "Load the config and run a smoke check against every provider",
11385
10262
  builder: doctorArgs,
11386
10263
  handler: async (argv) => {
11387
- const tokens = tokenContext(argv.token);
10264
+ const tokens = tokenContext$1(argv.token);
11388
10265
  if (!tokens) return;
11389
10266
  const loaded = await loadConfig(argv.cwd);
11390
10267
  applyResolvedConfig(argv, loaded.resolved);
@@ -11591,7 +10468,7 @@ async function runGithubAppCreate(input) {
11591
10468
  return refuse("manifest", errorMessage(err));
11592
10469
  }
11593
10470
  const file = resolve(input.dir, input.file || DEFAULT_FILE);
11594
- const git = (input.isIgnored ?? isGitIgnored)(file);
10471
+ const git = (input.isIgnored ?? auth_exports.isGitIgnored)(file);
11595
10472
  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
10473
  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
10474
  const state = input.state ?? randomBytes(16).toString("hex");
@@ -11608,7 +10485,7 @@ async function runGithubAppCreate(input) {
11608
10485
  let app;
11609
10486
  try {
11610
10487
  print(`opening ${server.url} — press "Create GitHub App" on GitHub (this page waits up to five minutes)`);
11611
- (input.openUrl ?? openPath)(server.url);
10488
+ (input.openUrl ?? ui_exports.openPath)(server.url);
11612
10489
  app = await (input.convert ?? convertAppManifest)(await server.code);
11613
10490
  } catch (err) {
11614
10491
  return refuse("create", `the App was not created: ${errorMessage(err)}`);
@@ -11619,12 +10496,12 @@ async function runGithubAppCreate(input) {
11619
10496
  let identity;
11620
10497
  try {
11621
10498
  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)
10499
+ (0, auth_exports.dotenvLine)("GITHUB_APP_ID", String(app.id)),
10500
+ (0, auth_exports.dotenvLine)("GITHUB_APP_PRIVATE_KEY", app.pem),
10501
+ (0, auth_exports.dotenvLine)(input.webhookSecretVar || DEFAULT_WEBHOOK_SECRET_VAR, app.webhookSecret)
11625
10502
  ];
11626
10503
  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);
10504
+ identity = (input.writeFile ?? auth_exports.writeCredentialsFile)(file, `${lines.join("\n")}\n`, input.force === true);
11628
10505
  } catch (err) {
11629
10506
  logger.warn({
11630
10507
  status: "fail",
@@ -11715,7 +10592,7 @@ const githubAppCreateCommand = {
11715
10592
  const githubAppCommand = {
11716
10593
  command: "github-app <subcommand>",
11717
10594
  describe: "Create and manage GitHub Apps",
11718
- builder: (y) => y.command(githubAppCreateCommand).command(groupMenu("github-app")),
10595
+ builder: (y) => y.command(githubAppCreateCommand).command(groupMenu$1("github-app")),
11719
10596
  handler: () => {}
11720
10597
  };
11721
10598
  // src/commands/menu/menu.command.ts
@@ -11729,7 +10606,7 @@ const githubAppCommand = {
11729
10606
  function printVersionHeaderOnce(version) {
11730
10607
  const marker = join(tmpdir(), `.holocron-version-shown-${process.ppid}`);
11731
10608
  if (existsSync(marker)) return;
11732
- console.log(style.dim(`v${version}`));
10609
+ console.log(ui_exports.style.dim(`v${version}`));
11733
10610
  writeFileSync(marker, "");
11734
10611
  }
11735
10612
  /** Bare `holocron` (hidden from --help): a menu of every command, with this repo's runnable tasks merged in. */
@@ -11940,9 +10817,9 @@ const monitoringCheckCommand = {
11940
10817
  describe: "Run every configured `monitoring` check against a given URL instead of its own configured url",
11941
10818
  builder: monitoringCheckArgs,
11942
10819
  handler: async (argv) => {
11943
- const tokens = tokenContext(argv.token);
10820
+ const tokens = tokenContext$1(argv.token);
11944
10821
  if (!tokens) return;
11945
- const [url] = await promptForPositionals(getEntry("monitoring check"), argv);
10822
+ const [url] = await (0, ui_exports.promptForPositionals)(getEntry("monitoring check"), argv);
11946
10823
  const loaded = await loadConfig(argv.cwd);
11947
10824
  applyResolvedConfig(argv, loaded.resolved);
11948
10825
  const { headers } = await resolveVercelBypassHeaders({
@@ -12000,7 +10877,7 @@ const monitoringResolveChecksCommand = {
12000
10877
  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
10878
  builder: monitoringResolveChecksArgs,
12002
10879
  handler: async (argv) => {
12003
- const tokens = tokenContext(argv.token);
10880
+ const tokens = tokenContext$1(argv.token);
12004
10881
  if (!tokens) return;
12005
10882
  const loaded = await loadConfig(argv.cwd);
12006
10883
  applyResolvedConfig(argv, loaded.resolved);
@@ -12048,7 +10925,7 @@ const monitoringRunResolvedCommand = {
12048
10925
  const monitoringCommand = {
12049
10926
  command: "monitoring",
12050
10927
  describe: "Run monitoring checks ad hoc, outside the configured provider",
12051
- builder: (y) => y.command(monitoringCheckCommand).command(monitoringResolveChecksCommand).command(monitoringRunResolvedCommand).command(groupMenu("monitoring")),
10928
+ builder: (y) => y.command(monitoringCheckCommand).command(monitoringResolveChecksCommand).command(monitoringRunResolvedCommand).command(groupMenu$1("monitoring")),
12052
10929
  handler: () => {}
12053
10930
  };
12054
10931
  // src/commands/plugin-create/template-inputs/template-inputs.ts
@@ -13121,7 +11998,7 @@ const pluginCreateCommand = {
13121
11998
  builder: pluginCreateArgs,
13122
11999
  handler: async (argv) => {
13123
12000
  try {
13124
- const [slug, vendor] = await promptForPositionals(getEntry("new plugin"), argv);
12001
+ const [slug, vendor] = await (0, ui_exports.promptForPositionals)(getEntry("new plugin"), argv);
13125
12002
  const { capability, vendorEnv, baseUrl } = await resolvePluginCreateInputs({
13126
12003
  capability: argv.capability,
13127
12004
  vendorEnv: argv.vendorEnv,
@@ -13807,7 +12684,7 @@ const newRepoCommand = {
13807
12684
  builder: newRepoArgs,
13808
12685
  handler: async (argv) => {
13809
12686
  try {
13810
- const tokens = tokenContext(argv.token);
12687
+ const tokens = tokenContext$1(argv.token);
13811
12688
  if (!tokens) return;
13812
12689
  const adminToken = tokens.cliTokens?.["github"] ?? tokens.cliToken;
13813
12690
  const answers = await askNewRepoAnswers(argv);
@@ -13860,7 +12737,7 @@ const newRepoCommand = {
13860
12737
  const newCommand = {
13861
12738
  command: "new",
13862
12739
  describe: "Scaffold a new repo or plugin",
13863
- builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(groupMenu("new")),
12740
+ builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(groupMenu$1("new")),
13864
12741
  handler: () => {}
13865
12742
  };
13866
12743
  // src/commands/notifications-create-server/find-guild-id.ts
@@ -14013,9 +12890,9 @@ async function runNotificationsCreateServer(input) {
14013
12890
  const dryRun = input.context.dryRun ?? false;
14014
12891
  const sleep = input.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
14015
12892
  const refuse = (message, reason = message) => {
14016
- print(` ${style.fail(message)}`);
12893
+ print(` ${ui_exports.style.fail(message)}`);
14017
12894
  print("");
14018
- print(style.header("0 ok, 1 fail, 0 skipped"));
12895
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
14019
12896
  logger.warn({ reason }, "notifications create-server");
14020
12897
  return {
14021
12898
  status: "fail",
@@ -14065,9 +12942,9 @@ async function runNotificationsCreateServer(input) {
14065
12942
  `write its id into ${input.loaded.filepath}`
14066
12943
  ];
14067
12944
  print("");
14068
- for (const step of steps) print(` ${style.skip(step)}`);
12945
+ for (const step of steps) print(` ${ui_exports.style.skip(step)}`);
14069
12946
  print("");
14070
- print(style.header("0 ok, 0 fail, 1 skipped"));
12947
+ print(ui_exports.style.header("0 ok, 0 fail, 1 skipped"));
14071
12948
  return { status: "dry-run" };
14072
12949
  }
14073
12950
  const lock = await lockConfig(input.loaded.filepath);
@@ -14075,7 +12952,7 @@ async function runNotificationsCreateServer(input) {
14075
12952
  const report = { status: "ok" };
14076
12953
  let ok = 0;
14077
12954
  const step = (line) => {
14078
- print(` ${style.success(line)}`);
12955
+ print(` ${ui_exports.style.success(line)}`);
14079
12956
  ok++;
14080
12957
  };
14081
12958
  try {
@@ -14091,7 +12968,7 @@ async function runNotificationsCreateServer(input) {
14091
12968
  const written = await writeGuildId(input.loaded.filepath, made.id);
14092
12969
  report.configUpdated = written.written;
14093
12970
  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.`)}`);
12971
+ else print(` ${ui_exports.style.fail(`could not update the config: ${written.reason}. Set guildId to ${made.id} by hand.`)}`);
14095
12972
  } else if (notifications.serverOwner) {
14096
12973
  const owner = await notifications.serverOwner();
14097
12974
  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 +12989,7 @@ async function runNotificationsCreateServer(input) {
14112
12989
  step(`invite for member ${input.owner} (one use, valid for a day): ${invite}`);
14113
12990
  const waitMs = input.waitMs ?? 9e5;
14114
12991
  const pollMs = input.pollMs ?? 5e3;
14115
- print(` ${style.skip(`waiting for member ${input.owner} to join (up to ${Math.round(waitMs / 6e4)} minutes)…`)}`);
12992
+ print(` ${ui_exports.style.skip(`waiting for member ${input.owner} to join (up to ${Math.round(waitMs / 6e4)} minutes)…`)}`);
14116
12993
  let waited = 0;
14117
12994
  while (!await notifications.hasMember(input.owner)) {
14118
12995
  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 +13009,7 @@ async function runNotificationsCreateServer(input) {
14132
13009
  await lock.release();
14133
13010
  }
14134
13011
  print("");
14135
- print(style.header(`${ok} ok, 0 fail, 0 skipped`));
13012
+ print(ui_exports.style.header(`${ok} ok, 0 fail, 0 skipped`));
14136
13013
  logger.info({ serverId: report.serverId }, "notifications create-server");
14137
13014
  return report;
14138
13015
  }
@@ -14162,7 +13039,7 @@ const notificationsCreateServerCommand = {
14162
13039
  describe: "Create the server the layout describes, apply it, invite its owner and hand it over",
14163
13040
  builder: notificationsCreateServerArgs,
14164
13041
  handler: async (argv) => {
14165
- const tokens = tokenContext(argv.token);
13042
+ const tokens = tokenContext$1(argv.token);
14166
13043
  if (!tokens) return;
14167
13044
  const loaded = await loadConfig(argv.cwd);
14168
13045
  applyResolvedConfig(argv, loaded.resolved);
@@ -14193,7 +13070,7 @@ const notificationsLinkCommand = {
14193
13070
  describe: "Link your server account to your GitHub account by signing in with the provider",
14194
13071
  builder: notificationsLinkArgs,
14195
13072
  handler: async (argv) => {
14196
- const tokens = tokenContext(argv.token);
13073
+ const tokens = tokenContext$1(argv.token);
14197
13074
  if (!tokens) return;
14198
13075
  const loaded = await loadConfig(argv.cwd);
14199
13076
  applyResolvedConfig(argv, loaded.resolved);
@@ -14223,7 +13100,7 @@ const notificationsSetupCommand = {
14223
13100
  describe: "Apply the server layout a notifications provider declares in holocron.config.ts",
14224
13101
  builder: notificationsSetupArgs,
14225
13102
  handler: async (argv) => {
14226
- const tokens = tokenContext(argv.token);
13103
+ const tokens = tokenContext$1(argv.token);
14227
13104
  if (!tokens) return;
14228
13105
  const loaded = await loadConfig(argv.cwd);
14229
13106
  applyResolvedConfig(argv, loaded.resolved);
@@ -14255,7 +13132,7 @@ const notificationsSyncRolesCommand = {
14255
13132
  describe: "Make who holds a server role match a team, through the links file",
14256
13133
  builder: notificationsSyncRolesArgs,
14257
13134
  handler: async (argv) => {
14258
- const tokens = tokenContext(argv.token);
13135
+ const tokens = tokenContext$1(argv.token);
14259
13136
  if (!tokens) return;
14260
13137
  const loaded = await loadConfig(argv.cwd);
14261
13138
  applyResolvedConfig(argv, loaded.resolved);
@@ -14305,9 +13182,9 @@ const notificationsChannelAddCommand = {
14305
13182
  describe: "Create a channel, optionally with a webhook whose URL is stored as a secret",
14306
13183
  builder: notificationsChannelAddArgs,
14307
13184
  handler: async (argv) => {
14308
- const tokens = tokenContext(argv.token);
13185
+ const tokens = tokenContext$1(argv.token);
14309
13186
  if (!tokens) return;
14310
- const [name] = await promptForPositionals(getEntry("notifications channel add"), argv);
13187
+ const [name] = await (0, ui_exports.promptForPositionals)(getEntry("notifications channel add"), argv);
14311
13188
  const loaded = await loadConfig(argv.cwd);
14312
13189
  applyResolvedConfig(argv, loaded.resolved);
14313
13190
  if ((await runNotificationsChannelAdd({
@@ -14333,14 +13210,14 @@ const notificationsChannelAddCommand = {
14333
13210
  const notificationsChannelCommand = {
14334
13211
  command: "channel",
14335
13212
  describe: "Manage notification channels",
14336
- builder: (y) => y.command(notificationsChannelAddCommand).command(groupMenu("notifications channel")),
13213
+ builder: (y) => y.command(notificationsChannelAddCommand).command(groupMenu$1("notifications channel")),
14337
13214
  handler: () => {}
14338
13215
  };
14339
13216
  // src/commands/notifications/notifications.command.ts
14340
13217
  const notificationsCommand = {
14341
13218
  command: "notifications",
14342
13219
  describe: "Provision notification channels, webhooks and roles",
14343
- builder: (y) => y.command(notificationsChannelCommand).command(notificationsSetupCommand).command(notificationsCreateServerCommand).command(notificationsLinkCommand).command(notificationsSyncRolesCommand).command(groupMenu("notifications")),
13220
+ builder: (y) => y.command(notificationsChannelCommand).command(notificationsSetupCommand).command(notificationsCreateServerCommand).command(notificationsLinkCommand).command(notificationsSyncRolesCommand).command(groupMenu$1("notifications")),
14344
13221
  handler: () => {}
14345
13222
  };
14346
13223
  // src/commands/move-tag/move-tag.ts
@@ -14469,7 +13346,7 @@ const moveTagCommand = {
14469
13346
  describe: "Move a version group's major tag (ci-v1) to its latest stable release (semantic-release publishCmd)",
14470
13347
  builder: moveTagArgs,
14471
13348
  handler: async (argv) => {
14472
- const [group] = await promptForPositionals(getEntry("package move-tag"), argv);
13349
+ const [group] = await (0, ui_exports.promptForPositionals)(getEntry("package move-tag"), argv);
14473
13350
  if ((await runMoveTag({
14474
13351
  group,
14475
13352
  cwd: argv.cwd,
@@ -14612,7 +13489,7 @@ const npmBumpVersionsCommand = {
14612
13489
  describe: "Bump all non-private package versions in lockstep (semantic-release prepareCmd)",
14613
13490
  builder: npmBumpVersionsArgs,
14614
13491
  handler: async (argv) => {
14615
- const [newVersion] = await promptForPositionals(getEntry("package bump-versions"), argv);
13492
+ const [newVersion] = await (0, ui_exports.promptForPositionals)(getEntry("package bump-versions"), argv);
14616
13493
  if ((await runNpmBumpVersions({
14617
13494
  version: newVersion,
14618
13495
  cwd: argv.cwd,
@@ -14745,9 +13622,9 @@ async function filterNewPackages(entries, cwd, exec, print, nameWidth, dirWidth)
14745
13622
  ], { cwd });
14746
13623
  const publishedVersion = view.exitCode === 0 ? view.stdout.trim() : "";
14747
13624
  if (publishedVersion) {
14748
- print(statusRow("skip", [
14749
- pad(entry.name, nameWidth),
14750
- pad(entry.dir, dirWidth),
13625
+ print((0, ui_exports.statusRow)("skip", [
13626
+ (0, ui_exports.pad)(entry.name, nameWidth),
13627
+ (0, ui_exports.pad)(entry.dir, dirWidth),
14751
13628
  `already published (v${publishedVersion})`
14752
13629
  ]));
14753
13630
  continue;
@@ -14875,7 +13752,7 @@ function workspaceFilterArgs(cwd, scope = {}) {
14875
13752
  function printSummary(print, dryRun, publishedCount, failedCount, skippedCount) {
14876
13753
  const summary = `${publishedCount} published, ${failedCount} failed, ${skippedCount} skipped`;
14877
13754
  print("");
14878
- print(dryRun ? style.dim(` dry-run: ${summary}`) : failedCount > 0 ? style.fail(` ${summary}`) : style.success(` ${summary}`));
13755
+ print(dryRun ? ui_exports.style.dim(` dry-run: ${summary}`) : failedCount > 0 ? ui_exports.style.fail(` ${summary}`) : ui_exports.style.success(` ${summary}`));
14879
13756
  }
14880
13757
  async function runPublish(input = {}) {
14881
13758
  const print = input.print ?? ((line) => console.log(line));
@@ -14892,7 +13769,7 @@ async function runPublish(input = {}) {
14892
13769
  dryRun: dryRun || void 0
14893
13770
  }, "publish --initial: start");
14894
13771
  print("");
14895
- print(style.dim(" → verifying npm auth (`npm whoami`)…"));
13772
+ print(ui_exports.style.dim(" → verifying npm auth (`npm whoami`)…"));
14896
13773
  let whoami = await exec("npm", ["whoami"], { cwd });
14897
13774
  if (whoami.exitCode !== 0) {
14898
13775
  print(" not authenticated — running `npm login --auth-type=web`…");
@@ -14922,9 +13799,9 @@ async function runPublish(input = {}) {
14922
13799
  }
14923
13800
  }
14924
13801
  const whoamiName = whoami.stdout.trim() || "<unknown>";
14925
- print(style.dim(` ✓ authed as ${whoamiName}`));
13802
+ print(ui_exports.style.dim(` ✓ authed as ${whoamiName}`));
14926
13803
  print("");
14927
- if (otp) print(style.dim(` otp: <${otp.length} chars>`));
13804
+ if (otp) print(ui_exports.style.dim(` otp: <${otp.length} chars>`));
14928
13805
  const discoveredEntries = input.packages ?? discoverPublicPackageEntries(cwd, scopeOf(input));
14929
13806
  const nameWidth = Math.max(0, ...discoveredEntries.map((e) => e.name.length));
14930
13807
  const dirWidth = Math.max(0, ...discoveredEntries.map((e) => e.dir.length));
@@ -14971,8 +13848,8 @@ async function runPublish(input = {}) {
14971
13848
  ];
14972
13849
  if (dryRun) {
14973
13850
  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(" ")}`));
13851
+ 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})`));
13852
+ print(ui_exports.style.dim(` would run: pnpm ${redactOtp(publishArgs, otp).join(" ")}`));
14976
13853
  printSummary(print, dryRun, packageNames.length, 0, skippedCount);
14977
13854
  printNextSteps(print, env, packageNames, identity);
14978
13855
  logger.info({
@@ -14997,9 +13874,9 @@ async function runPublish(input = {}) {
14997
13874
  print(" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:");
14998
13875
  print(` pnpm exec tsx cli/cli/src/cli.ts package publish --initial --otp <6-digit-code>`);
14999
13876
  }
15000
- for (const entry of newEntries) print(statusRow("fail", [
15001
- pad(entry.name, nameWidth),
15002
- pad(entry.dir, dirWidth),
13877
+ for (const entry of newEntries) print((0, ui_exports.statusRow)("fail", [
13878
+ (0, ui_exports.pad)(entry.name, nameWidth),
13879
+ (0, ui_exports.pad)(entry.dir, dirWidth),
15003
13880
  "publish failed"
15004
13881
  ]));
15005
13882
  printSummary(print, dryRun, 0, packageNames.length, skippedCount);
@@ -15013,9 +13890,9 @@ async function runPublish(input = {}) {
15013
13890
  packageNames
15014
13891
  };
15015
13892
  }
15016
- for (const entry of newEntries) print(statusRow("ok", [
15017
- pad(entry.name, nameWidth),
15018
- pad(entry.dir, dirWidth),
13893
+ for (const entry of newEntries) print((0, ui_exports.statusRow)("ok", [
13894
+ (0, ui_exports.pad)(entry.name, nameWidth),
13895
+ (0, ui_exports.pad)(entry.dir, dirWidth),
15019
13896
  `published (v${entry.version})`
15020
13897
  ]));
15021
13898
  printSummary(print, dryRun, packageNames.length, 0, skippedCount);
@@ -15481,7 +14358,7 @@ const publishCommand = {
15481
14358
  const packageCommand = {
15482
14359
  command: "package",
15483
14360
  describe: "Version and publish workspace packages",
15484
- builder: (y) => y.command(npmBumpVersionsCommand).command(moveTagCommand).command(publishCommand).command(groupMenu("package")),
14361
+ builder: (y) => y.command(npmBumpVersionsCommand).command(moveTagCommand).command(publishCommand).command(groupMenu$1("package")),
15485
14362
  handler: () => {}
15486
14363
  };
15487
14364
  // src/commands/probe/probe.args.ts
@@ -17242,7 +16119,7 @@ function listProbes(groups) {
17242
16119
  const lines = [];
17243
16120
  const width = Math.max(0, ...[...groups.values()].flatMap((g) => Object.keys(g).map((n) => n.length)));
17244
16121
  for (const [provider, probes] of [...groups].sort(([a], [b]) => a.localeCompare(b))) {
17245
- lines.push(style.header(provider));
16122
+ lines.push(ui_exports.style.header(provider));
17246
16123
  for (const [name, probe] of Object.entries(probes).sort(([a], [b]) => a.localeCompare(b))) {
17247
16124
  const mark = probe.writes ? " (changes things)" : "";
17248
16125
  lines.push(` ${name.padEnd(width)} ${probe.summary}${mark}`);
@@ -17484,7 +16361,7 @@ const defaultInterrupt = (handler) => {
17484
16361
  * failed or was interrupted.
17485
16362
  */
17486
16363
  async function runProbe(input) {
17487
- const progress = createProgress(input.print ?? ((line) => console.log(line)));
16364
+ const progress = createProgress$1(input.print ?? ((line) => console.log(line)));
17488
16365
  const print = progress.print;
17489
16366
  const secrets = new Set(input.secrets ?? []);
17490
16367
  const scrub = createScrubber(secrets);
@@ -17496,11 +16373,11 @@ async function runProbe(input) {
17496
16373
  ...row.detail ? { detail: scrub(sanitizeDetail(row.detail)) } : {}
17497
16374
  };
17498
16375
  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 ?? ""]));
16376
+ if (clean.status === "heading") print(`\n ${ui_exports.style.header(clean.label)}`);
16377
+ else print((0, ui_exports.statusRow)(clean.status === "info" ? "skip" : clean.status, [clean.label, clean.detail ?? ""]));
17501
16378
  };
17502
16379
  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`);
16380
+ 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
16381
  if (!await (input.confirm ?? ((message) => confirm({
17505
16382
  message,
17506
16383
  default: false
@@ -17880,7 +16757,7 @@ async function runProbeCommand(input) {
17880
16757
  }
17881
16758
  const probes = groups.get(input.provider);
17882
16759
  if (!probes) {
17883
- print(statusRow("fail", [`no probes for \`${input.provider}\``, `try: ${[...groups.keys()].sort().join(", ")}`]));
16760
+ print((0, ui_exports.statusRow)("fail", [`no probes for \`${input.provider}\``, `try: ${[...groups.keys()].sort().join(", ")}`]));
17884
16761
  return { status: "fail" };
17885
16762
  }
17886
16763
  if (!input.probe) {
@@ -17889,7 +16766,7 @@ async function runProbeCommand(input) {
17889
16766
  }
17890
16767
  const probe = probes[input.probe];
17891
16768
  if (!probe) {
17892
- print(statusRow("fail", [`\`${input.provider}\` has no probe \`${input.probe}\``, `try: ${Object.keys(probes).sort().join(", ")}`]));
16769
+ print((0, ui_exports.statusRow)("fail", [`\`${input.provider}\` has no probe \`${input.probe}\``, `try: ${Object.keys(probes).sort().join(", ")}`]));
17893
16770
  return { status: "fail" };
17894
16771
  }
17895
16772
  const tokens = [input.context.cliToken, ...Object.values(input.context.cliTokens ?? {})].filter((t) => typeof t === "string");
@@ -17915,7 +16792,7 @@ const probeCommand = {
17915
16792
  describe: "Poke a live provider on purpose: inspect it, or run a proof that cleans up after itself",
17916
16793
  builder: probeArgs,
17917
16794
  handler: async (argv) => {
17918
- const tokens = tokenContext(argv.token);
16795
+ const tokens = tokenContext$1(argv.token);
17919
16796
  if (!tokens) return;
17920
16797
  const loaded = await loadConfig(argv.cwd);
17921
16798
  applyResolvedConfig(argv, loaded.resolved);
@@ -18391,7 +17268,7 @@ async function execStep(capability, step, dryRun, body, opts = {}) {
18391
17268
  status: "dry-run"
18392
17269
  };
18393
17270
  try {
18394
- const note = await withProgress(`${capability}: ${step}…`, body);
17271
+ const note = await withProgress$1(`${capability}: ${step}…`, body);
18395
17272
  const result = {
18396
17273
  capability,
18397
17274
  step,
@@ -18434,12 +17311,12 @@ function classify403(err) {
18434
17311
  }
18435
17312
  function formatStep(step) {
18436
17313
  const tag = step.reason === "permissions" ? " [permissions]" : step.reason === "plan" ? " [plan restriction]" : "";
18437
- const detail = step.message ? style.dim(` (${step.message})`) : "";
17314
+ const detail = step.message ? ui_exports.style.dim(` (${step.message})`) : "";
18438
17315
  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}`)}`;
17316
+ if (step.status === "ok") return ` ${ui_exports.style.success(label)}`;
17317
+ if (step.status === "fail") return ` ${ui_exports.style.fail(label)}`;
17318
+ if (step.status === "dry-run") return ` ${ui_exports.style.dim(`… ${label}`)}`;
17319
+ return ` ${ui_exports.style.dim(`· ${label}`)}`;
18443
17320
  }
18444
17321
  // src/commands/setup/skills/skills.ts
18445
17322
  async function fetchExternalSkill(entry) {
@@ -18639,7 +17516,7 @@ async function runSetup(input) {
18639
17516
  const print = input.print ?? ((line) => console.log(line));
18640
17517
  const logger = getLogger();
18641
17518
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
18642
- await withSpinner("Loading plugins…", () => loader.load());
17519
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
18643
17520
  assertPluginsResolvable(loader, "repo setup");
18644
17521
  const config = input.loaded.resolved;
18645
17522
  const dryRun = input.context.dryRun ?? false;
@@ -18650,12 +17527,12 @@ async function runSetup(input) {
18650
17527
  fallback: "start",
18651
17528
  realpath: true
18652
17529
  }), input.loaded.filepath);
18653
- print(style.header(`Holocron setup — ${config.name}${dryRun ? " (dry-run)" : ""}`));
18654
- print(style.dim(` config: ${input.loaded.filepath}`));
17530
+ print(ui_exports.style.header(`Holocron setup — ${config.name}${dryRun ? " (dry-run)" : ""}`));
17531
+ print(ui_exports.style.dim(` config: ${input.loaded.filepath}`));
18655
17532
  print("");
18656
17533
  if (loader.has("source")) {
18657
17534
  const source = loader.get("source");
18658
- print(style.step("source"));
17535
+ print(ui_exports.style.step("source"));
18659
17536
  const SECURITY_SKIP_CODES = {
18660
17537
  enableSecretScanning: [422],
18661
17538
  enablePrivateVulnerabilityReporting: [404]
@@ -18699,7 +17576,7 @@ async function runSetup(input) {
18699
17576
  }
18700
17577
  if (loader.has("source")) {
18701
17578
  const source = loader.get("source");
18702
- if (config.tasks && config.tasks.length > 0) print(style.step("workflows"));
17579
+ if (config.tasks && config.tasks.length > 0) print(ui_exports.style.step("workflows"));
18703
17580
  for (const entry of await generateRepoFiles({
18704
17581
  loaded: input.loaded,
18705
17582
  repoRoot: input.context.repoRoot,
@@ -18868,7 +17745,7 @@ async function runSetup(input) {
18868
17745
  }
18869
17746
  if (loader.has("environments")) {
18870
17747
  const envs = loader.get("environments");
18871
- print(style.step("environments"));
17748
+ print(ui_exports.style.step("environments"));
18872
17749
  for (const envName of SETUP_ENVIRONMENTS) {
18873
17750
  steps.push(await runStep("environments", `upsert ${envName}`, dryRun, async () => {
18874
17751
  await envs.upsertEnvironment({ name: envName });
@@ -18888,7 +17765,7 @@ async function runSetup(input) {
18888
17765
  } catch (err) {
18889
17766
  if (!(err instanceof AuthError)) throw err;
18890
17767
  }
18891
- print(style.step("docs"));
17768
+ print(ui_exports.style.step("docs"));
18892
17769
  if (!deployToken) {
18893
17770
  steps.push({
18894
17771
  capability: "source",
@@ -18910,7 +17787,7 @@ async function runSetup(input) {
18910
17787
  }
18911
17788
  if (loader.has("wiki")) {
18912
17789
  const wiki = loader.get("wiki");
18913
- print(style.step("wiki"));
17790
+ print(ui_exports.style.step("wiki"));
18914
17791
  steps.push(await runStep("wiki", "provision wiki config", dryRun, async () => {
18915
17792
  return await wiki.provision({ name: config.name });
18916
17793
  }));
@@ -18938,7 +17815,7 @@ async function runSetup(input) {
18938
17815
  }
18939
17816
  if (loader.has("deployment")) {
18940
17817
  const deploy = loader.get("deployment");
18941
- print(style.step("deployment"));
17818
+ print(ui_exports.style.step("deployment"));
18942
17819
  const previewCfg = previewConfigOf(config);
18943
17820
  const ensureCustomDomain = async (projectId, hostname) => {
18944
17821
  if (!deploy.ensureCustomDomain) return;
@@ -18998,7 +17875,7 @@ async function runSetup(input) {
18998
17875
  }
18999
17876
  if (loader.has("auth")) {
19000
17877
  const auth = loader.get("auth");
19001
- print(style.step("auth"));
17878
+ print(ui_exports.style.step("auth"));
19002
17879
  if (auth.ensureWebhookApp) {
19003
17880
  steps.push(await runStep("auth", "ensureWebhookApp", dryRun, async () => {
19004
17881
  return `webhook ${(await auth.ensureWebhookApp()).alreadyExists ? "exists" : "created"}`;
@@ -19016,7 +17893,7 @@ async function runSetup(input) {
19016
17893
  }
19017
17894
  if (loader.has("vault")) {
19018
17895
  const vault = loader.get("vault");
19019
- print(style.step("vault"));
17896
+ print(ui_exports.style.step("vault"));
19020
17897
  if (vault.ensureProject) {
19021
17898
  steps.push(await runStep("vault", `ensureProject ${config.name}`, dryRun, async () => {
19022
17899
  return `project ${(await vault.ensureProject(config.name)).alreadyExists ? "exists" : "created"}`;
@@ -19054,7 +17931,7 @@ async function runSetup(input) {
19054
17931
  }
19055
17932
  if (loader.has("errors")) {
19056
17933
  const errors = loader.get("errors");
19057
- print(style.step("errors"));
17934
+ print(ui_exports.style.step("errors"));
19058
17935
  if (errors.ensureProject) {
19059
17936
  let dsn;
19060
17937
  steps.push(await runStep("errors", `ensureProject ${config.name}`, dryRun, async () => {
@@ -19077,7 +17954,7 @@ async function runSetup(input) {
19077
17954
  }
19078
17955
  if (loader.has("logs")) {
19079
17956
  const logs = loader.get("logs");
19080
- print(style.step("logs"));
17957
+ print(ui_exports.style.step("logs"));
19081
17958
  if (logs.ensureDataset) for (const dataset of ["holocron-ci", "holocron-local"]) {
19082
17959
  steps.push(await runStep("logs", `ensureDataset ${dataset}`, dryRun, async () => {
19083
17960
  const result = await logs.ensureDataset(dataset);
@@ -19088,7 +17965,7 @@ async function runSetup(input) {
19088
17965
  }
19089
17966
  if (loader.has("monitoring")) {
19090
17967
  const monitoring = loader.get("monitoring");
19091
- print(style.step("monitoring"));
17968
+ print(ui_exports.style.step("monitoring"));
19092
17969
  for (const checkInput of monitoring.checks) {
19093
17970
  steps.push(await runStep("monitoring", `ensureCheck ${checkInput.name}`, dryRun, async () => {
19094
17971
  const result = await monitoring.ensureCheck(checkInput);
@@ -19099,7 +17976,7 @@ async function runSetup(input) {
19099
17976
  }
19100
17977
  if (loader.has("tooling")) {
19101
17978
  const tools = loader.get("tooling");
19102
- print(style.step("tooling"));
17979
+ print(ui_exports.style.step("tooling"));
19103
17980
  for (const tool of tools) {
19104
17981
  steps.push(await runStep("tooling", `${tool.providerName}.sync`, dryRun, async () => {
19105
17982
  await tool.sync();
@@ -19108,7 +17985,7 @@ async function runSetup(input) {
19108
17985
  }
19109
17986
  }
19110
17987
  if (config.skills && config.skills.length > 0 && config.agent) {
19111
- print(style.step("skills"));
17988
+ print(ui_exports.style.step("skills"));
19112
17989
  if (!(config.agent in AGENT_SYMLINK_PATHS)) steps.push({
19113
17990
  capability: "skills",
19114
17991
  step: "install skills",
@@ -19125,14 +18002,14 @@ async function runSetup(input) {
19125
18002
  print(formatStep(steps[steps.length - 1]));
19126
18003
  }
19127
18004
  if (config.agent) {
19128
- print(style.step("prompts"));
18005
+ print(ui_exports.style.step("prompts"));
19129
18006
  steps.push(await runStep("prompts", "install agent prompts", dryRun, async () => {
19130
18007
  return await installAgentPrompts({ repoRoot: input.context.repoRoot });
19131
18008
  }));
19132
18009
  print(formatStep(steps[steps.length - 1]));
19133
18010
  }
19134
18011
  if (config.docs) {
19135
- print(style.step("engineering"));
18012
+ print(ui_exports.style.step("engineering"));
19136
18013
  steps.push(await runStep("engineering", "provision engineering structure", dryRun, async () => {
19137
18014
  return await installEngineeringStructure({ repoRoot: input.context.repoRoot });
19138
18015
  }));
@@ -19152,56 +18029,56 @@ async function runSetup(input) {
19152
18029
  });
19153
18030
  print("");
19154
18031
  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()));
18032
+ print(summary.fail > 0 ? ui_exports.style.fail(summaryLine.trim()) : ui_exports.style.success(summaryLine.trim()));
19156
18033
  const skippedSteps = steps.filter((s) => s.status === "skip");
19157
18034
  if (skippedSteps.length > 0) {
19158
18035
  print("");
19159
- print(style.hint(" Skipped:"));
18036
+ print(ui_exports.style.hint(" Skipped:"));
19160
18037
  for (const s of skippedSteps)
19161
18038
  /* v8 ignore next -- all skip steps set message; empty fallback is defensive */
19162
- print(style.hint(` · ${s.step}${s.message ? ` (${s.message})` : ""}`));
18039
+ print(ui_exports.style.hint(` · ${s.step}${s.message ? ` (${s.message})` : ""}`));
19163
18040
  }
19164
18041
  if (steps.some((s) => s.reason === "permissions")) {
19165
18042
  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:"));
18043
+ print(ui_exports.style.warn("Some steps failed with 403 (insufficient token permissions)."));
18044
+ print(ui_exports.style.hint(" Repo-scoped operations (rulesets, settings, workflows) require a"));
18045
+ print(ui_exports.style.hint(" fine-grained PAT passed via --token or HOLOCRON_ADMIN_TOKEN:"));
19169
18046
  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)"));
18047
+ print(ui_exports.style.hint(" · Administration — read and write"));
18048
+ print(ui_exports.style.hint(" · Code scanning alerts — read and write"));
18049
+ print(ui_exports.style.hint(" · Contents — read and write"));
18050
+ print(ui_exports.style.hint(" · Custom properties — read and write"));
18051
+ print(ui_exports.style.hint(" · Environments — read and write"));
18052
+ print(ui_exports.style.hint(" · Issues — read and write (labels)"));
18053
+ print(ui_exports.style.hint(" · Secret scanning alerts — read and write"));
18054
+ print(ui_exports.style.hint(" · Secrets — read and write"));
18055
+ print(ui_exports.style.hint(" · Variables — read and write (Actions variables)"));
18056
+ print(ui_exports.style.hint(" · Workflows — read and write"));
18057
+ print(ui_exports.style.hint(" · Metadata — read (added automatically)"));
19181
18058
  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:"));
18059
+ print(ui_exports.style.hint(" Org-scoped operations (teams, organization Actions variables) require"));
18060
+ print(ui_exports.style.hint(" HOLOCRON_ORG_TOKEN — a fine-grained PAT with resource owner set to the org:"));
19184
18061
  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)"));
18062
+ print(ui_exports.style.hint(" · Administration — read and write (repository permission)"));
18063
+ print(ui_exports.style.hint(" · Members — read (organization permission)"));
18064
+ print(ui_exports.style.hint(" · Variables — read and write (organization permission)"));
18065
+ print(ui_exports.style.hint(" · Metadata — read (repository permission, auto-included)"));
19189
18066
  print("");
19190
18067
  if (steps.some((s) => s.reason === "permissions" && /GitHub Pages/.test(s.step))) {
19191
18068
  print("");
19192
- print(style.hint(" GitHub Pages uses HOLOCRON_DEPLOY_TOKEN (keyring key github.deploy):"));
18069
+ print(ui_exports.style.hint(" GitHub Pages uses HOLOCRON_DEPLOY_TOKEN (keyring key github.deploy):"));
19193
18070
  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)"));
18071
+ print(ui_exports.style.hint(" · Pages — read and write"));
18072
+ print(ui_exports.style.hint(" · Administration — read and write"));
18073
+ print(ui_exports.style.hint(" · Metadata — read (added automatically)"));
19197
18074
  }
19198
18075
  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.)"));
18076
+ print(ui_exports.style.hint(" Create tokens at: https://github.com/settings/personal-access-tokens/new"));
18077
+ print(ui_exports.style.hint(" Store them: HOLOCRON_ADMIN_TOKEN / HOLOCRON_ORG_TOKEN / HOLOCRON_DEPLOY_TOKEN env vars,"));
18078
+ print(ui_exports.style.hint(" or keyring keys github.admin / github.org / github.deploy"));
18079
+ print(ui_exports.style.hint(" Then re-run: holocron repo setup"));
18080
+ print(ui_exports.style.hint(" (--token <pat> overrides every token, the org one included; use it only when one"));
18081
+ print(ui_exports.style.hint(" token covers everything.)"));
19205
18082
  }
19206
18083
  return {
19207
18084
  steps,
@@ -19247,7 +18124,7 @@ const setupCommand = {
19247
18124
  describe: "Apply infra setup actions across every configured capability",
19248
18125
  builder: setupArgs,
19249
18126
  handler: async (argv) => {
19250
- const tokens = tokenContext(argv.token);
18127
+ const tokens = tokenContext$1(argv.token);
19251
18128
  if (!tokens) return;
19252
18129
  const loaded = await loadConfig(argv.cwd);
19253
18130
  applyResolvedConfig(argv, loaded.resolved);
@@ -19451,7 +18328,7 @@ const SKIP_LABEL = {
19451
18328
  /** A row's label: the name, where it lives, when it was last committed to (local only) and its PR. */
19452
18329
  function rowLabel(entry) {
19453
18330
  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(" "))}` : ""}`;
18331
+ return `${entry.name} [${entry.locations.join(", ")}]${detail.length > 0 ? ` ${ui_exports.style.dim(detail.join(" "))}` : ""}`;
19455
18332
  }
19456
18333
  /**
19457
18334
  * Classifies the branches against the provider's pull requests, shows them grouped, and deletes the ones
@@ -19512,17 +18389,17 @@ async function runCleanupBranches(input) {
19512
18389
  for (const group of GROUPS) {
19513
18390
  const rows = entries.filter((e) => e.group === group);
19514
18391
  const line = `${rows.length} ${GROUP_LABEL[group]}`;
19515
- print(SAFE.includes(group) ? style.success(line) : style.warn(line));
18392
+ print(SAFE.includes(group) ? ui_exports.style.success(line) : ui_exports.style.warn(line));
19516
18393
  for (const row of rows) print(` ${rowLabel(row)}`);
19517
18394
  }
19518
18395
  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]}`));
18396
+ print(ui_exports.style.dim(`${classification.skipped.length} skipped`));
18397
+ for (const { ref, reason } of classification.skipped) print(ui_exports.style.dim(` ${ref.name} [${ref.where}] ${SKIP_LABEL[reason]}`));
19521
18398
  }
19522
18399
  print("");
19523
18400
  const safe = entries.filter((e) => SAFE.includes(e.group));
19524
18401
  if (input.context.dryRun === true) {
19525
- print(style.dim(`Dry run: ${safe.length} branches are proven merged. Nothing was deleted.`));
18402
+ print(ui_exports.style.dim(`Dry run: ${safe.length} branches are proven merged. Nothing was deleted.`));
19526
18403
  logger.info({
19527
18404
  proven: safe.length,
19528
18405
  deleted: 0
@@ -19532,7 +18409,7 @@ async function runCleanupBranches(input) {
19532
18409
  if (entries.length === 0) return report;
19533
18410
  let chosen = safe;
19534
18411
  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");
18412
+ 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
18413
  if (!await confirm({
19537
18414
  message: "Choose branches to delete?",
19538
18415
  default: true
@@ -19565,7 +18442,7 @@ async function runCleanupBranches(input) {
19565
18442
  message: errorMessage(err)
19566
18443
  });
19567
18444
  }
19568
- for (const { name, where, message } of report.failed) print(style.fail(`${name} [${where}]: ${message}`));
18445
+ for (const { name, where, message } of report.failed) print(ui_exports.style.fail(`${name} [${where}]: ${message}`));
19569
18446
  print(`Deleted ${report.deleted.length} of ${report.deleted.length + report.failed.length} branches.`);
19570
18447
  if (report.failed.length > 0) report.status = "fail";
19571
18448
  logger.info({
@@ -19594,7 +18471,7 @@ const repoCleanupBranchesCommand = {
19594
18471
  describe: "List the branches whose pull request is merged and delete the ones you pick (local, remote or both)",
19595
18472
  builder: repoCleanupBranchesArgs,
19596
18473
  handler: async (argv) => {
19597
- const tokens = tokenContext(argv.token);
18474
+ const tokens = tokenContext$1(argv.token);
19598
18475
  if (!tokens) return;
19599
18476
  const loaded = await loadConfig(argv.cwd);
19600
18477
  applyResolvedConfig(argv, loaded.resolved);
@@ -19616,7 +18493,7 @@ const repoCleanupBranchesCommand = {
19616
18493
  const repoCleanupCommand = {
19617
18494
  command: "cleanup",
19618
18495
  describe: "Clean up what a repo accumulates (merged branches)",
19619
- builder: (y) => y.command(repoCleanupBranchesCommand).command(groupMenu("repo cleanup")),
18496
+ builder: (y) => y.command(repoCleanupBranchesCommand).command(groupMenu$1("repo cleanup")),
19620
18497
  handler: () => {}
19621
18498
  };
19622
18499
  // src/commands/sync-readme/generate-readme.ts
@@ -19814,8 +18691,8 @@ async function runSyncReadme(input) {
19814
18691
  const logger = input.logger ?? getLogger();
19815
18692
  const { repoRoot, dryRun = false } = context;
19816
18693
  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(", ")}`));
18694
+ print(ui_exports.style.header(`Syncing README installation block${dryRun ? " (dry-run)" : ""}…`));
18695
+ if (namespaces.length > 0) print(ui_exports.style.hint(` namespaces: ${namespaces.join(", ")}`));
19819
18696
  let pkg;
19820
18697
  try {
19821
18698
  const raw = await readFileFn(join(repoRoot, "package.json"), "utf8");
@@ -19847,7 +18724,7 @@ async function runSyncReadme(input) {
19847
18724
  };
19848
18725
  const text = await updateReadme(repoRoot, generateInstallBlock(pkg, homepage), markerSections, dryRun, readFileFn, writeFileFn);
19849
18726
  if (text === null) {
19850
- print(style.warn("README.md not found or has no writable location for installation block"));
18727
+ print(ui_exports.style.warn("README.md not found or has no writable location for installation block"));
19851
18728
  logger.warn({
19852
18729
  repoRoot,
19853
18730
  reason: "README.md not found / no marker block"
@@ -19859,9 +18736,9 @@ async function runSyncReadme(input) {
19859
18736
  };
19860
18737
  }
19861
18738
  if (description) await updateIndexMdxDescription(repoRoot, description, dryRun, readFileFn, writeFileFn);
19862
- print(dryRun ? style.hint(" would update README.md") : style.success(" updated README.md"));
18739
+ print(dryRun ? ui_exports.style.hint(" would update README.md") : ui_exports.style.success(" updated README.md"));
19863
18740
  const problems = readmeScriptProblems(text, scripts);
19864
- for (const problem of problems) print(style.fail(` ${problem}`));
18741
+ for (const problem of problems) print(ui_exports.style.fail(` ${problem}`));
19865
18742
  const status = dryRun ? "dry-run" : "ok";
19866
18743
  logger.info({
19867
18744
  repoRoot,
@@ -20691,7 +19568,7 @@ const repoSyncCommand = {
20691
19568
  describe: "Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)",
20692
19569
  builder: (y) => repoSyncArgs(y).command(syncReadmeCommand),
20693
19570
  handler: async (argv) => {
20694
- const tokens = tokenContext(argv.token);
19571
+ const tokens = tokenContext$1(argv.token);
20695
19572
  if (!tokens) return;
20696
19573
  const loaded = await loadConfig(argv.cwd);
20697
19574
  applyResolvedConfig(argv, loaded.resolved);
@@ -20727,12 +19604,12 @@ const repoSyncCommand = {
20727
19604
  *
20728
19605
  * After running, `pnpm install && holocron run ci`.
20729
19606
  */
20730
- const FETCH_TIMEOUT_MS$1 = 4e3;
19607
+ const FETCH_TIMEOUT_MS = 4e3;
20731
19608
  /** Resolve a package's `latest` dist-tag from the npm registry. */
20732
19609
  const fetchLatestFromNpm = async (pkg) => {
20733
19610
  try {
20734
19611
  const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`, {
20735
- signal: AbortSignal.timeout(FETCH_TIMEOUT_MS$1),
19612
+ signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
20736
19613
  headers: { accept: "application/vnd.npm.install-v1+json" }
20737
19614
  });
20738
19615
  if (!res.ok) return null;
@@ -21119,7 +19996,7 @@ const upgradeNodeCommand = {
21119
19996
  describe: "Scan the repo and update every Node.js version pin to a new major",
21120
19997
  builder: upgradeNodeArgs,
21121
19998
  handler: async (argv) => {
21122
- const [to] = await promptForPositionals(getEntry("repo upgrade node"), argv);
19999
+ const [to] = await (0, ui_exports.promptForPositionals)(getEntry("repo upgrade node"), argv);
21123
20000
  let extra = [];
21124
20001
  try {
21125
20002
  const raw = readFileSync(join(argv.cwd, "holocron.config.json"), "utf8");
@@ -21143,14 +20020,14 @@ const upgradeNodeCommand = {
21143
20020
  const repoUpgradeCommand = {
21144
20021
  command: "upgrade",
21145
20022
  describe: "Upgrade toolchain version pins across the repo",
21146
- builder: (y) => y.command(upgradeNodeCommand).command(upgradeDepsCommand).command(groupMenu("repo upgrade")),
20023
+ builder: (y) => y.command(upgradeNodeCommand).command(upgradeDepsCommand).command(groupMenu$1("repo upgrade")),
21147
20024
  handler: () => {}
21148
20025
  };
21149
20026
  // src/commands/repo/repo.command.ts
21150
20027
  const repoCommand = {
21151
20028
  command: "repo",
21152
20029
  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")),
20030
+ builder: (y) => y.command(setupCommand).command(repoSyncCommand).command(repoUpgradeCommand).command(repoCleanupCommand).command(groupMenu$1("repo")),
21154
20031
  handler: () => {}
21155
20032
  };
21156
20033
  // src/commands/run/run.args.ts
@@ -21361,9 +20238,9 @@ const secretSetCommand = {
21361
20238
  describe: "Set a single secret via the configured `secrets` capability",
21362
20239
  builder: secretSetArgs,
21363
20240
  handler: async (argv) => {
21364
- const tokens = tokenContext(argv.token);
20241
+ const tokens = tokenContext$1(argv.token);
21365
20242
  if (!tokens) return;
21366
- const [name] = await promptForPositionals(getEntry("secrets set"), argv);
20243
+ const [name] = await (0, ui_exports.promptForPositionals)(getEntry("secrets set"), argv);
21367
20244
  const scopeArg = argv.scope;
21368
20245
  const scope = parseScope(scopeArg);
21369
20246
  const loaded = await loadConfig(argv.cwd);
@@ -21509,7 +20386,7 @@ const secretsListCommand = {
21509
20386
  describe: "List the names of the secrets at each scope (never the values)",
21510
20387
  builder: secretsListArgs,
21511
20388
  handler: async (argv) => {
21512
- const tokens = tokenContext(argv.token);
20389
+ const tokens = tokenContext$1(argv.token);
21513
20390
  if (!tokens) return;
21514
20391
  const loaded = await loadConfig(argv.cwd);
21515
20392
  applyResolvedConfig(argv, loaded.resolved);
@@ -21597,7 +20474,7 @@ async function runSecretsSync(input) {
21597
20474
  const print = input.print ?? ((line) => console.log(line));
21598
20475
  const logger = input.logger ?? getLogger();
21599
20476
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
21600
- await withSpinner("Loading plugins…", () => loader.load());
20477
+ await (0, ui_exports.withSpinner)("Loading plugins…", () => loader.load());
21601
20478
  assertPluginsResolvable(loader, "secrets sync");
21602
20479
  logger.info({
21603
20480
  environment: input.environmentId,
@@ -21605,17 +20482,17 @@ async function runSecretsSync(input) {
21605
20482
  }, "secrets sync: start");
21606
20483
  const dryRun = input.context.dryRun ?? false;
21607
20484
  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)}`));
20485
+ print(ui_exports.style.header(`Holocron secrets sync — environment ${input.environmentId}${dryRun ? " (dry-run)" : ""}`));
20486
+ print(ui_exports.style.dim(` vault: ${vaultProviderName(loader)}`));
21610
20487
  print("");
21611
20488
  const vault = loader.get("vault");
21612
20489
  if (!vault.readEnvironment) throw new Error(`vault provider (${vault.providerName}) does not implement readEnvironment — sync needs bulk env reads`);
21613
20490
  let envVars;
21614
20491
  try {
21615
- envVars = await withSpinner(`Reading vault environment ${input.environmentId}…`, () => vault.readEnvironment(input.environmentId));
20492
+ envVars = await (0, ui_exports.withSpinner)(`Reading vault environment ${input.environmentId}…`, () => vault.readEnvironment(input.environmentId));
21616
20493
  } catch (err) {
21617
20494
  const message = describeProviderError(err);
21618
- print(` ${style.fail(`could not read vault environment ${input.environmentId}: ${message}`)}`);
20495
+ print(` ${ui_exports.style.fail(`could not read vault environment ${input.environmentId}: ${message}`)}`);
21619
20496
  logger.warn({
21620
20497
  environment: input.environmentId,
21621
20498
  reason: logReason(err)
@@ -21629,7 +20506,7 @@ async function runSecretsSync(input) {
21629
20506
  }], logger, print, dryRun);
21630
20507
  }
21631
20508
  const keys = Object.keys(envVars).sort();
21632
- print(style.step(`read ${keys.length} keys from vault`));
20509
+ print(ui_exports.style.step(`read ${keys.length} keys from vault`));
21633
20510
  print("");
21634
20511
  const rows = [];
21635
20512
  if (loader.has("secrets")) {
@@ -21639,7 +20516,7 @@ async function runSecretsSync(input) {
21639
20516
  ...input.githubSecretKeys ? { keys: input.githubSecretKeys } : {}
21640
20517
  }];
21641
20518
  for (const route of routes) {
21642
- print(style.step(routes.length > 1 ? `secrets (${scopeLabel(route.scope)})` : "secrets"));
20519
+ print(ui_exports.style.step(routes.length > 1 ? `secrets (${scopeLabel(route.scope)})` : "secrets"));
21643
20520
  for (const key of route.keys ?? keys) {
21644
20521
  rows.push(await pushRow(`secrets:${secrets.providerName}`, scopeLabel(route.scope), key, envVars, dryRun, async (value) => {
21645
20522
  await secrets.setSecret(route.scope, key, value);
@@ -21651,7 +20528,7 @@ async function runSecretsSync(input) {
21651
20528
  if (loader.has("deployment")) {
21652
20529
  const deploy = loader.get("deployment");
21653
20530
  if (!input.projectId) {
21654
- print(style.step("deployment"));
20531
+ print(ui_exports.style.step("deployment"));
21655
20532
  const row = {
21656
20533
  destination: `deployment:${deploy.providerName}`,
21657
20534
  scope: "no projectId",
@@ -21662,7 +20539,7 @@ async function runSecretsSync(input) {
21662
20539
  rows.push(row);
21663
20540
  print(formatRow(row));
21664
20541
  } else for (const target of targets) {
21665
- print(style.step(`deployment (target=${target})`));
20542
+ print(ui_exports.style.step(`deployment (target=${target})`));
21666
20543
  for (const key of keys) {
21667
20544
  rows.push(await pushRow(`deployment:${deploy.providerName}`, `target=${target}`, key, envVars, dryRun, async (value) => {
21668
20545
  await deploy.setEnvVar(input.projectId, target, key, value);
@@ -21673,7 +20550,7 @@ async function runSecretsSync(input) {
21673
20550
  }
21674
20551
  if (input.workerScript) {
21675
20552
  const script = input.workerScript;
21676
- print(style.step(`workers (script=${script})`));
20553
+ print(ui_exports.style.step(`workers (script=${script})`));
21677
20554
  const workers = loader.has("workers") ? loader.get("workers") : void 0;
21678
20555
  if (!workers?.setSecret) {
21679
20556
  const row = {
@@ -21721,7 +20598,7 @@ function summarise(rows, logger, print, dryRun) {
21721
20598
  }, "secrets sync: done");
21722
20599
  print("");
21723
20600
  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));
20601
+ print(summary.fail > 0 ? ui_exports.style.fail(summaryLine) : ui_exports.style.success(summaryLine));
21725
20602
  return {
21726
20603
  rows,
21727
20604
  summary
@@ -21776,12 +20653,12 @@ async function runRow(destination, scope, key, dryRun, body) {
21776
20653
  }
21777
20654
  }
21778
20655
  function formatRow(row) {
21779
- const detail = row.message ? style.dim(` (${row.message})`) : "";
20656
+ const detail = row.message ? ui_exports.style.dim(` (${row.message})`) : "";
21780
20657
  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}`)}`;
20658
+ if (row.status === "ok") return ` ${ui_exports.style.success(label)}`;
20659
+ if (row.status === "fail") return ` ${ui_exports.style.fail(label)}`;
20660
+ if (row.status === "dry-run") return ` ${ui_exports.style.dim(`… ${label}`)}`;
20661
+ return ` ${ui_exports.style.dim(`· ${label}`)}`;
21785
20662
  }
21786
20663
  function scopeLabel(scope) {
21787
20664
  if (scope.kind === "repo") return "scope=repo";
@@ -21820,10 +20697,10 @@ const secretsSyncCommand = {
21820
20697
  describe: "Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars",
21821
20698
  builder: secretsSyncArgs,
21822
20699
  handler: async (argv) => {
21823
- const tokens = tokenContext(argv.token);
20700
+ const tokens = tokenContext$1(argv.token);
21824
20701
  if (!tokens) return;
21825
20702
  const githubSecretScope = parseScope(argv.githubSecretScope);
21826
- const [environmentId] = await promptForPositionals(getEntry("secrets sync"), argv);
20703
+ const [environmentId] = await (0, ui_exports.promptForPositionals)(getEntry("secrets sync"), argv);
21827
20704
  const loaded = await loadConfig(argv.cwd);
21828
20705
  applyResolvedConfig(argv, loaded.resolved);
21829
20706
  const routes = argv.githubSecret?.length ? [] : secretRoutes(loaded.resolved.repo?.secrets?.sync, environmentId);
@@ -21849,7 +20726,7 @@ const secretsSyncCommand = {
21849
20726
  const secretsCommand = {
21850
20727
  command: "secrets",
21851
20728
  describe: "List and set secrets, and sync vault environments",
21852
- builder: (y) => y.command(secretSetCommand).command(secretsListCommand).command(secretsSyncCommand).command(groupMenu("secrets")),
20729
+ builder: (y) => y.command(secretSetCommand).command(secretsListCommand).command(secretsSyncCommand).command(groupMenu$1("secrets")),
21853
20730
  handler: () => {}
21854
20731
  };
21855
20732
  // src/commands/skills/skills.args.ts
@@ -22006,7 +20883,7 @@ const skillsUpdate = {
22006
20883
  const skillsCommand = {
22007
20884
  command: "skills",
22008
20885
  describe: "Manage agent skills from the @theholocron/skills registry",
22009
- builder: (y) => y.command(skillsInstall).command(skillsRemove).command(skillsUpdate).command(groupMenu("skills")),
20886
+ builder: (y) => y.command(skillsInstall).command(skillsRemove).command(skillsUpdate).command(groupMenu$1("skills")),
22010
20887
  handler: () => {}
22011
20888
  };
22012
20889
  // src/commands/specs-sync/forum-channel.ts
@@ -22316,9 +21193,9 @@ async function runSpecsSync(input) {
22316
21193
  assertPluginsResolvable(loader, "specs sync");
22317
21194
  const dryRun = input.context.dryRun ?? false;
22318
21195
  const refuse = (message, reason = message) => {
22319
- print(` ${style.fail(message)}`);
21196
+ print(` ${ui_exports.style.fail(message)}`);
22320
21197
  print("");
22321
- print(style.header("0 ok, 1 fail, 0 skipped"));
21198
+ print(ui_exports.style.header("0 ok, 1 fail, 0 skipped"));
22322
21199
  logger.warn({ reason }, "specs sync");
22323
21200
  return {
22324
21201
  status: "fail",
@@ -22398,7 +21275,7 @@ async function runSpecsSync(input) {
22398
21275
  let renamed = 0;
22399
21276
  let linked = 0;
22400
21277
  let rateLimited;
22401
- print(`\n${style.header(`ADRs and specs → #${forum.channel}`)}`);
21278
+ print(`\n${ui_exports.style.header(`ADRs and specs → #${forum.channel}`)}`);
22402
21279
  for (const doc of documents) {
22403
21280
  let outcome;
22404
21281
  try {
@@ -22428,13 +21305,13 @@ async function runSpecsSync(input) {
22428
21305
  if (outcome.titleRenamed) renamed++;
22429
21306
  if (outcome.idLineRewritten) linked++;
22430
21307
  if (outcome.problem) {
22431
- print(` ${style.fail(`${outcome.path}: ${outcome.problem}`)}`);
21308
+ print(` ${ui_exports.style.fail(`${outcome.path}: ${outcome.problem}`)}`);
22432
21309
  failed++;
22433
21310
  } else if (outcome.did.length === 0) {
22434
- print(` ${style.skip(`${outcome.path}: in step`)}`);
21311
+ print(` ${ui_exports.style.skip(`${outcome.path}: in step`)}`);
22435
21312
  skipped++;
22436
21313
  } else {
22437
- print(` ${(dryRun ? style.skip : style.success)(`${outcome.path}: ${outcome.did.join("; ")}`)}`);
21314
+ print(` ${(dryRun ? ui_exports.style.skip : ui_exports.style.success)(`${outcome.path}: ${outcome.did.join("; ")}`)}`);
22438
21315
  if (dryRun) skipped++;
22439
21316
  else ok++;
22440
21317
  if (!dryRun && outcome.text !== doc.text) input.io.write(doc.path, outcome.text);
@@ -22442,15 +21319,15 @@ async function runSpecsSync(input) {
22442
21319
  }
22443
21320
  if (rateLimited) {
22444
21321
  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`)}`);
21322
+ print(` ${ui_exports.style.skip(`stopped: the provider is rate limiting${after}. ${rateLimited.left} document(s) are left for the next run`)}`);
22446
21323
  skipped += rateLimited.left;
22447
21324
  }
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"}`));
21325
+ if (refreshOrigin) print(ui_exports.style.header(`${rewritten} PR line(s) ${dryRun ? "would be rewritten" : "rewritten"}`));
21326
+ if (refreshTitles) print(ui_exports.style.header(`${renamed} title(s) ${dryRun ? "would be renamed" : "renamed"}`));
21327
+ if (input.refresh || linking) print(ui_exports.style.header(`${linked} id line(s) ${dryRun ? "would be rewritten" : "rewritten"}`));
22451
21328
  const status = failed > 0 ? "fail" : dryRun ? "dry-run" : "ok";
22452
21329
  print("");
22453
- print(style.header(`${ok} ok, ${failed} fail, ${skipped} skipped`));
21330
+ print(ui_exports.style.header(`${ok} ok, ${failed} fail, ${skipped} skipped`));
22454
21331
  logger.info({
22455
21332
  provider: notifications.providerName,
22456
21333
  channel: forum.channel,
@@ -22508,7 +21385,7 @@ const specsSyncCommand = {
22508
21385
  describe: "Keep each ADR and spec in step with a post in a forum channel",
22509
21386
  builder: specsSyncArgs,
22510
21387
  handler: async (argv) => {
22511
- const tokens = tokenContext(argv.token);
21388
+ const tokens = tokenContext$1(argv.token);
22512
21389
  if (!tokens) return;
22513
21390
  const loaded = await loadConfig(argv.cwd);
22514
21391
  applyResolvedConfig(argv, loaded.resolved);
@@ -22537,7 +21414,7 @@ const specsSyncCommand = {
22537
21414
  const specsCommand = {
22538
21415
  command: "specs",
22539
21416
  describe: "Keep the repo's ADRs and specs in step with their discussion",
22540
- builder: (y) => y.command(specsSyncCommand).command(groupMenu("specs")),
21417
+ builder: (y) => y.command(specsSyncCommand).command(groupMenu$1("specs")),
22541
21418
  handler: () => {}
22542
21419
  };
22543
21420
  // src/commands/sync-github/sync-github.ts
@@ -22845,7 +21722,7 @@ const syncGithubCommand = {
22845
21722
  builder: syncGithubArgs,
22846
21723
  handler: async (argv) => {
22847
21724
  const outputDir = argv["output-dir"];
22848
- const parsed = tokenContext(argv.token);
21725
+ const parsed = tokenContext$1(argv.token);
22849
21726
  if (!parsed) return;
22850
21727
  let token;
22851
21728
  if (outputDir) token = "no-token-needed";
@@ -22871,141 +21748,24 @@ const syncGithubCommand = {
22871
21748
  const syncCommand = {
22872
21749
  command: "sync",
22873
21750
  describe: "Sync generated files to other repos",
22874
- builder: (y) => y.command(syncGithubCommand).command(groupMenu("sync")),
21751
+ builder: (y) => y.command(syncGithubCommand).command(groupMenu$1("sync")),
22875
21752
  handler: () => {}
22876
21753
  };
22877
21754
  // src/commands/tunnel/tunnel.command.ts
22878
21755
  const tunnelCommand = {
22879
21756
  command: "tunnel <subcommand>",
22880
21757
  describe: "Tunnels from a stable public hostname to this machine",
22881
- builder: (y) => y.command(tunnelUpCommand).command(groupMenu("tunnel")),
21758
+ builder: (y) => y.command(tunnelUpCommand).command(groupMenu$1("tunnel")),
22882
21759
  handler: () => {}
22883
21760
  };
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
21761
  // src/update-notifier/update-notifier.ts
23002
21762
  const PACKAGE_NAME = "@theholocron/cli";
23003
21763
  /**
23004
21764
  * Looks for a newer `@theholocron/cli` and returns a function that prints the notice, or `null` when there is none. The
23005
21765
  * answer is kept in `HOLOCRON_CACHE_DIR`, `~/.cache/holocron` by default.
23006
21766
  */
23007
- function checkForUpdates(currentVersion) {
23008
- return checkForUpdates$1({
21767
+ function checkForUpdates$1(currentVersion) {
21768
+ return checkForUpdates({
23009
21769
  name: PACKAGE_NAME,
23010
21770
  currentVersion,
23011
21771
  cacheDir: env.get("HOLOCRON_CACHE_DIR") ?? join(homedir(), ".cache", "holocron"),
@@ -23020,7 +21780,7 @@ const { version: CLI_VERSION } = JSON.parse(readFileSync(new URL("../package.jso
23020
21780
  /** Whether to print the correlation id at command end (`--debug` / `--verbose`). */
23021
21781
  let printRunId = false;
23022
21782
  init(CLI_VERSION);
23023
- const updateCheckPromise = checkForUpdates(CLI_VERSION);
21783
+ const updateCheckPromise = checkForUpdates$1(CLI_VERSION);
23024
21784
  let finishCommand = () => {};
23025
21785
  /** Set by `.fail()` once it has printed an error, so the outer catch doesn't repeat it. */
23026
21786
  let errorReported = false;