@theholocron/cli 5.0.0-alpha.341 → 5.0.0-alpha.342
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/README.md +8 -7
- package/dist/cli.mjs +192 -396
- package/dist/cli.mjs.map +1 -1
- package/dist/{compose-BucaYv2k.mjs → config-system-Bq6510iF.mjs} +30 -8
- package/dist/{index-BfArEnkX.d.mts → config-system-uaeB3g1g.d.mts} +22 -3
- package/dist/index.d.mts +2 -22
- package/dist/index.mjs +1 -30
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +1 -1
- package/package.json +11 -11
package/dist/cli.mjs
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { closeSync, copyFileSync, existsSync, fstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { homedir,
|
|
4
|
+
import { homedir, tmpdir } from "node:os";
|
|
5
5
|
import path, { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { createEnvLookup, firstEnv, withEnvPrefix } from "@theholocron/env-utils/lookup";
|
|
7
|
+
import { ProviderApiError, ProviderApiError as ProviderApiError$1, createRestClient, onRetry } from "@theholocron/http-client";
|
|
7
8
|
import { addGlobalOptions, groupMenu, tokenContext } from "@theholocron/kyber/flags";
|
|
8
9
|
import { checkForUpdates } from "@theholocron/kyber/notifier";
|
|
9
|
-
import { NonInteractiveError,
|
|
10
|
-
import { LOG_LEVELS
|
|
10
|
+
import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, describeError, logReason, openPath, pad, sanitizeDetail, setProgressListener, statusRow, stripControl, style, viewJson, waitForEnter, withProgress, withSpinner } from "@theholocron/kyber/ui";
|
|
11
|
+
import { LOG_LEVELS } from "@theholocron/observability/core";
|
|
11
12
|
import yargs from "yargs";
|
|
12
13
|
import { hideBin } from "yargs/helpers";
|
|
13
14
|
import { ConfigError, createConfigSystem, lastWins, mergeByKey, shallowMerge, union } from "@theholocron/kyber/config";
|
|
14
15
|
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";
|
|
15
|
-
import { ProviderApiError, ProviderApiError as ProviderApiError$1, createRestClient, onRetry } from "@theholocron/http-client";
|
|
16
16
|
import { loadTasksConfig } from "@theholocron/astromech/config";
|
|
17
17
|
import { readGitRemote, updateGitignore } from "@theholocron/git-utils";
|
|
18
18
|
import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
|
|
19
|
-
import {
|
|
19
|
+
import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
|
|
20
|
+
import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
|
|
20
21
|
import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
21
22
|
import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver, createKeyring, dotenvLine, hasCredentials, isGitIgnored, readDotenvFile, setCredentials, shredFile, writeCredentialsFile } from "@theholocron/kyber/secrets";
|
|
22
|
-
import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
|
|
23
|
-
import { PostHogSink } from "@theholocron/observability/analytics";
|
|
24
|
-
import { SentrySink } from "@theholocron/observability/errors";
|
|
25
23
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
26
24
|
import { pathToFileURL } from "node:url";
|
|
27
|
-
import { DRY_RUN_NOOP_EXIT_CODE,
|
|
25
|
+
import { DRY_RUN_NOOP_EXIT_CODE, createMenu } from "@theholocron/kyber/menu";
|
|
28
26
|
import { promptForPositionals } from "@theholocron/kyber/prompts";
|
|
29
27
|
import { Separator, checkbox, confirm, input, select } from "@inquirer/prompts";
|
|
30
28
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -32,100 +30,11 @@ import { stringifyJson } from "@theholocron/json-utils";
|
|
|
32
30
|
import { findRootSync, isWorkspaceRoot, walkFilesSync } from "@theholocron/fs-utils";
|
|
33
31
|
import { serveHandler } from "@theholocron/dagobah";
|
|
34
32
|
import { access, copyFile, lstat, mkdir, open, readFile, readdir, realpath, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
33
|
+
import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
|
|
35
34
|
import { createServer } from "node:http";
|
|
36
35
|
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";
|
|
37
36
|
import { lintCommitMsgFile } from "@theholocron/astromech/lint";
|
|
38
37
|
import { createGitHubClient } from "@theholocron/github-client";
|
|
39
|
-
// src/config/compose/merge-sync/merge-sync.ts
|
|
40
|
-
/**
|
|
41
|
-
* Merge two lists of `repo.secrets.sync` entries. An entry is the same sync when its environment and scope match;
|
|
42
|
-
* the keys then add up, and an entry that names no keys (every key the vault holds) stays that way.
|
|
43
|
-
*/
|
|
44
|
-
function mergeSync(a, b) {
|
|
45
|
-
const merged = /* @__PURE__ */ new Map();
|
|
46
|
-
for (const entry of [...a ?? [], ...b ?? []]) {
|
|
47
|
-
const id = `${entry.environment}\0${entry.scope ?? "repo"}`;
|
|
48
|
-
const have = merged.get(id);
|
|
49
|
-
merged.set(id, have ? {
|
|
50
|
-
...have,
|
|
51
|
-
...have.keys && entry.keys ? { keys: [.../* @__PURE__ */ new Set([...have.keys, ...entry.keys])] } : { keys: void 0 }
|
|
52
|
-
} : { ...entry });
|
|
53
|
-
}
|
|
54
|
-
return [...merged.values()].map(({ keys, ...rest }) => keys ? {
|
|
55
|
-
...rest,
|
|
56
|
-
keys
|
|
57
|
-
} : rest);
|
|
58
|
-
}
|
|
59
|
-
// src/config/compose/merge-repo/merge-repo.ts
|
|
60
|
-
const names$1 = union();
|
|
61
|
-
const properties = shallowMerge();
|
|
62
|
-
const teamsByKey = mergeByKey((t) => typeof t === "string" ? t : t.slug);
|
|
63
|
-
/**
|
|
64
|
-
* Merge one capability's `repo` fragment onto what earlier ones gave. Scalars: last writer wins. `properties`: shallow
|
|
65
|
-
* merge. `variables`: merged per scope (`repo`, `org`). `secrets`: each name list is a union, and `sync` entries merge by
|
|
66
|
-
* environment and scope. `topics`: union. `teams`: merged by slug.
|
|
67
|
-
*/
|
|
68
|
-
function mergeRepo(prev, next) {
|
|
69
|
-
const { properties: nextProperties, topics, teams, variables, secrets, ...scalars } = next;
|
|
70
|
-
const repo = {
|
|
71
|
-
...prev,
|
|
72
|
-
...scalars
|
|
73
|
-
};
|
|
74
|
-
if (nextProperties) repo.properties = properties.merge(repo.properties ?? {}, nextProperties);
|
|
75
|
-
if (variables) repo.variables = {
|
|
76
|
-
...repo.variables,
|
|
77
|
-
...variables,
|
|
78
|
-
...repo.variables?.repo || variables.repo ? { repo: {
|
|
79
|
-
...repo.variables?.repo,
|
|
80
|
-
...variables.repo
|
|
81
|
-
} } : {},
|
|
82
|
-
...repo.variables?.org || variables.org ? { org: {
|
|
83
|
-
...repo.variables?.org,
|
|
84
|
-
...variables.org
|
|
85
|
-
} } : {}
|
|
86
|
-
};
|
|
87
|
-
if (secrets) {
|
|
88
|
-
const environments = { ...repo.secrets?.environments };
|
|
89
|
-
for (const [env, list] of Object.entries(secrets.environments ?? {})) environments[env] = names$1.merge(environments[env] ?? [], list);
|
|
90
|
-
repo.secrets = {
|
|
91
|
-
...repo.secrets?.repo || secrets.repo ? { repo: names$1.merge(repo.secrets?.repo ?? [], secrets.repo ?? []) } : {},
|
|
92
|
-
...repo.secrets?.org || secrets.org ? { org: names$1.merge(repo.secrets?.org ?? [], secrets.org ?? []) } : {},
|
|
93
|
-
...Object.keys(environments).length > 0 ? { environments } : {},
|
|
94
|
-
...repo.secrets?.sync || secrets.sync ? { sync: mergeSync(repo.secrets?.sync, secrets.sync) } : {}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
if (topics) repo.topics = names$1.merge(repo.topics ?? [], topics);
|
|
98
|
-
if (teams) repo.teams = teamsByKey.merge(repo.teams ?? [], teams);
|
|
99
|
-
return repo;
|
|
100
|
-
}
|
|
101
|
-
// src/config/compose/task-name/task-name.ts
|
|
102
|
-
/**
|
|
103
|
-
* The key a task entry merges under. A name that stands for exactly one flat id (the id itself, or an old dotted
|
|
104
|
-
* alias such as `verification.unitTests`) keys by that id, so the alias overrides the preset's entry instead of
|
|
105
|
-
* sitting next to it; a name that stands for several ids or none (a suite, an unknown name) keys by itself.
|
|
106
|
-
*/
|
|
107
|
-
function taskName(e) {
|
|
108
|
-
const name = typeof e === "string" ? e : e.name;
|
|
109
|
-
const resolved = resolveTaskName(name);
|
|
110
|
-
return resolved.length === 1 ? resolved[0].id : name;
|
|
111
|
-
}
|
|
112
|
-
// src/config/compose/merge-strategies/merge-strategies.ts
|
|
113
|
-
/**
|
|
114
|
-
* How `compose()` merges each key of the capabilities: tasks by name (an old dotted alias overrides the entry it names),
|
|
115
|
-
* providers shallowly, the non-task required checks as a union, `repo` by its own rules, the rest last writer wins.
|
|
116
|
-
*/
|
|
117
|
-
const mergeStrategies = {
|
|
118
|
-
tasks: mergeByKey(taskName),
|
|
119
|
-
providers: shallowMerge(),
|
|
120
|
-
extraRequiredChecks: union(),
|
|
121
|
-
repo: {
|
|
122
|
-
empty: {},
|
|
123
|
-
merge: mergeRepo
|
|
124
|
-
},
|
|
125
|
-
org: lastWins(),
|
|
126
|
-
domain: lastWins(),
|
|
127
|
-
docs: lastWins()
|
|
128
|
-
};
|
|
129
38
|
// src/plugin/capabilities/capabilities.ts
|
|
130
39
|
/** How many providers each capability resolves to: one (`"single"`) or several active at once (`"many"`). */
|
|
131
40
|
const CARDINALITY = {
|
|
@@ -357,6 +266,96 @@ function resolveConfig(raw) {
|
|
|
357
266
|
eslint: raw.eslint
|
|
358
267
|
};
|
|
359
268
|
}
|
|
269
|
+
// src/config/compose/merge-sync/merge-sync.ts
|
|
270
|
+
/**
|
|
271
|
+
* Merge two lists of `repo.secrets.sync` entries. An entry is the same sync when its environment and scope match;
|
|
272
|
+
* the keys then add up, and an entry that names no keys (every key the vault holds) stays that way.
|
|
273
|
+
*/
|
|
274
|
+
function mergeSync(a, b) {
|
|
275
|
+
const merged = /* @__PURE__ */ new Map();
|
|
276
|
+
for (const entry of [...a ?? [], ...b ?? []]) {
|
|
277
|
+
const id = `${entry.environment}\0${entry.scope ?? "repo"}`;
|
|
278
|
+
const have = merged.get(id);
|
|
279
|
+
merged.set(id, have ? {
|
|
280
|
+
...have,
|
|
281
|
+
...have.keys && entry.keys ? { keys: [.../* @__PURE__ */ new Set([...have.keys, ...entry.keys])] } : { keys: void 0 }
|
|
282
|
+
} : { ...entry });
|
|
283
|
+
}
|
|
284
|
+
return [...merged.values()].map(({ keys, ...rest }) => keys ? {
|
|
285
|
+
...rest,
|
|
286
|
+
keys
|
|
287
|
+
} : rest);
|
|
288
|
+
}
|
|
289
|
+
// src/config/compose/merge-repo/merge-repo.ts
|
|
290
|
+
const names$1 = union();
|
|
291
|
+
const properties = shallowMerge();
|
|
292
|
+
const teamsByKey = mergeByKey((t) => typeof t === "string" ? t : t.slug);
|
|
293
|
+
/**
|
|
294
|
+
* Merge one capability's `repo` fragment onto what earlier ones gave. Scalars: last writer wins. `properties`: shallow
|
|
295
|
+
* merge. `variables`: merged per scope (`repo`, `org`). `secrets`: each name list is a union, and `sync` entries merge by
|
|
296
|
+
* environment and scope. `topics`: union. `teams`: merged by slug.
|
|
297
|
+
*/
|
|
298
|
+
function mergeRepo(prev, next) {
|
|
299
|
+
const { properties: nextProperties, topics, teams, variables, secrets, ...scalars } = next;
|
|
300
|
+
const repo = {
|
|
301
|
+
...prev,
|
|
302
|
+
...scalars
|
|
303
|
+
};
|
|
304
|
+
if (nextProperties) repo.properties = properties.merge(repo.properties ?? {}, nextProperties);
|
|
305
|
+
if (variables) repo.variables = {
|
|
306
|
+
...repo.variables,
|
|
307
|
+
...variables,
|
|
308
|
+
...repo.variables?.repo || variables.repo ? { repo: {
|
|
309
|
+
...repo.variables?.repo,
|
|
310
|
+
...variables.repo
|
|
311
|
+
} } : {},
|
|
312
|
+
...repo.variables?.org || variables.org ? { org: {
|
|
313
|
+
...repo.variables?.org,
|
|
314
|
+
...variables.org
|
|
315
|
+
} } : {}
|
|
316
|
+
};
|
|
317
|
+
if (secrets) {
|
|
318
|
+
const environments = { ...repo.secrets?.environments };
|
|
319
|
+
for (const [env, list] of Object.entries(secrets.environments ?? {})) environments[env] = names$1.merge(environments[env] ?? [], list);
|
|
320
|
+
repo.secrets = {
|
|
321
|
+
...repo.secrets?.repo || secrets.repo ? { repo: names$1.merge(repo.secrets?.repo ?? [], secrets.repo ?? []) } : {},
|
|
322
|
+
...repo.secrets?.org || secrets.org ? { org: names$1.merge(repo.secrets?.org ?? [], secrets.org ?? []) } : {},
|
|
323
|
+
...Object.keys(environments).length > 0 ? { environments } : {},
|
|
324
|
+
...repo.secrets?.sync || secrets.sync ? { sync: mergeSync(repo.secrets?.sync, secrets.sync) } : {}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
if (topics) repo.topics = names$1.merge(repo.topics ?? [], topics);
|
|
328
|
+
if (teams) repo.teams = teamsByKey.merge(repo.teams ?? [], teams);
|
|
329
|
+
return repo;
|
|
330
|
+
}
|
|
331
|
+
// src/config/compose/task-name/task-name.ts
|
|
332
|
+
/**
|
|
333
|
+
* The key a task entry merges under. A name that stands for exactly one flat id (the id itself, or an old dotted
|
|
334
|
+
* alias such as `verification.unitTests`) keys by that id, so the alias overrides the preset's entry instead of
|
|
335
|
+
* sitting next to it; a name that stands for several ids or none (a suite, an unknown name) keys by itself.
|
|
336
|
+
*/
|
|
337
|
+
function taskName(e) {
|
|
338
|
+
const name = typeof e === "string" ? e : e.name;
|
|
339
|
+
const resolved = resolveTaskName(name);
|
|
340
|
+
return resolved.length === 1 ? resolved[0].id : name;
|
|
341
|
+
}
|
|
342
|
+
// src/config/compose/merge-strategies/merge-strategies.ts
|
|
343
|
+
/**
|
|
344
|
+
* How `compose()` merges each key of the capabilities: tasks by name (an old dotted alias overrides the entry it names),
|
|
345
|
+
* providers shallowly, the non-task required checks as a union, `repo` by its own rules, the rest last writer wins.
|
|
346
|
+
*/
|
|
347
|
+
const mergeStrategies = {
|
|
348
|
+
tasks: mergeByKey(taskName),
|
|
349
|
+
providers: shallowMerge(),
|
|
350
|
+
extraRequiredChecks: union(),
|
|
351
|
+
repo: {
|
|
352
|
+
empty: {},
|
|
353
|
+
merge: mergeRepo
|
|
354
|
+
},
|
|
355
|
+
org: lastWins(),
|
|
356
|
+
domain: lastWins(),
|
|
357
|
+
docs: lastWins()
|
|
358
|
+
};
|
|
360
359
|
// src/config/load-config/read-package-json-name/read-package-json-name.ts
|
|
361
360
|
/** The `name` of the `package.json` in `dir` without its scope, or `undefined`. */
|
|
362
361
|
async function readPackageJsonName(dir) {
|
|
@@ -387,25 +386,28 @@ async function deriveDefaults$1(found) {
|
|
|
387
386
|
if (manifest.extraRequiredChecks) result.extraRequiredChecks = [...result.extraRequiredChecks ?? [], ...manifest.extraRequiredChecks];
|
|
388
387
|
return result;
|
|
389
388
|
}
|
|
390
|
-
// src/config/system
|
|
391
|
-
/** Holocron's config system, built from kyber's factory; `loadConfig`, `compose` and `defineConfig` wrap its parts. */
|
|
392
|
-
const system = createConfigSystem({
|
|
393
|
-
name: "holocron",
|
|
394
|
-
derive: deriveDefaults$1,
|
|
395
|
-
resolve: resolveConfig,
|
|
396
|
-
merge: mergeStrategies
|
|
397
|
-
});
|
|
398
|
-
// src/config/load-config/load-config.ts
|
|
389
|
+
// src/config/config-system.ts
|
|
399
390
|
/**
|
|
400
|
-
*
|
|
391
|
+
* Holocron's config system: `defineConfig`, `loadConfig` and `compose`, all built from one
|
|
392
|
+
* `createConfigSystem` call.
|
|
401
393
|
*
|
|
402
394
|
* File discovery, the walk up to `.git`, module loading (typed configs via `tsx`) and the derive-then-resolve flow come
|
|
403
395
|
* from `@theholocron/kyber/config`. The holocron-specific parts are `deriveDefaults` (name, `repo.name`, the task
|
|
404
|
-
* manifest)
|
|
396
|
+
* manifest), `resolveConfig` and `mergeStrategies`.
|
|
397
|
+
*
|
|
398
|
+
* The three functions live together because each is only a method of the one system object; splitting them back into
|
|
399
|
+
* one file apiece would just be pass-through wrappers (an exception to the one-function-per-file rule).
|
|
405
400
|
*
|
|
406
401
|
* Probe order is TS-first (`.ts` → `.js` → `.mjs` → `.cjs` → `.json`) —
|
|
407
402
|
* see ADR-0010 / issue #75 / #81.
|
|
408
403
|
*/
|
|
404
|
+
const system = createConfigSystem({
|
|
405
|
+
name: "holocron",
|
|
406
|
+
derive: deriveDefaults$1,
|
|
407
|
+
resolve: resolveConfig,
|
|
408
|
+
merge: mergeStrategies
|
|
409
|
+
});
|
|
410
|
+
system.defineConfig;
|
|
409
411
|
/**
|
|
410
412
|
* Read + parse + resolve `holocron.config.*` starting from the given
|
|
411
413
|
* directory, walking up through ancestors to the nearest `.git` boundary
|
|
@@ -415,9 +417,8 @@ const system = createConfigSystem({
|
|
|
415
417
|
* Throws `ConfigFileError` when nothing is found or a file cannot
|
|
416
418
|
* be loaded, or `ConfigError` when the config fails schema checks.
|
|
417
419
|
*/
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
420
|
+
const loadConfig = system.loadConfig;
|
|
421
|
+
system.compose;
|
|
421
422
|
// src/auth.ts
|
|
422
423
|
/**
|
|
423
424
|
* The CLI's credentials: the OS keyring every plugin's bootstrap token lives in, and the two token resolvers built on
|
|
@@ -560,8 +561,8 @@ function commandsInContext(context) {
|
|
|
560
561
|
* traces, errors, structured context that routes to Axiom. It runs in
|
|
561
562
|
* parallel to `print` (user-facing UX output) and does not replace it.
|
|
562
563
|
*/
|
|
563
|
-
const env$
|
|
564
|
-
const holocronEnv$1 = withEnvPrefix(env$
|
|
564
|
+
const env$8 = createEnvLookup();
|
|
565
|
+
const holocronEnv$1 = withEnvPrefix(env$8, "HOLOCRON");
|
|
565
566
|
/**
|
|
566
567
|
* Dataset for `global`-context commands (`clone`, `auth set`, `upgrade
|
|
567
568
|
* node`, …) — ADR-0012. These commands aren't "about" any repo, so their
|
|
@@ -573,44 +574,6 @@ const holocronEnv$1 = withEnvPrefix(env$9, "HOLOCRON");
|
|
|
573
574
|
*/
|
|
574
575
|
const GLOBAL_AXIOM_DATASET = "holocron-global";
|
|
575
576
|
/**
|
|
576
|
-
* Resolve the explicit level to hand to `createLogger`, in priority order:
|
|
577
|
-
*
|
|
578
|
-
* 1. `--log <level>` 2. `--verbose` → `"debug"` 3. `--quiet` → `"error"`
|
|
579
|
-
* 4. `HOLOCRON_LOG_LEVEL` env var
|
|
580
|
-
* 5. `holocron.config` `log.level` (`configLevel`)
|
|
581
|
-
*
|
|
582
|
-
* Returns `undefined` when nothing applies — `createLogger` then defaults
|
|
583
|
-
* to `"info"`. Resolving the full chain here (rather than passing
|
|
584
|
-
* `configLevel` straight through) keeps config below the env var.
|
|
585
|
-
*/
|
|
586
|
-
function resolveLogLevel(argv, configLevel) {
|
|
587
|
-
if (argv.log) return argv.log;
|
|
588
|
-
if (argv.verbose) return "debug";
|
|
589
|
-
if (argv.quiet) return "error";
|
|
590
|
-
return parseLogLevel(env$9.get("HOLOCRON_LOG_LEVEL")) ?? configLevel;
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* Resolve whether human-visible console output (pretty or NDJSON) should run
|
|
594
|
-
* at all, independent of level — the `@theholocron/observability`
|
|
595
|
-
* `consoleOutput` override.
|
|
596
|
-
*
|
|
597
|
-
* Local/interactive runs are quiet by default: any raw structured logger
|
|
598
|
-
* output (colorized or not) stays off regardless of the resolved level,
|
|
599
|
-
* unless the user explicitly asked to see it via `--log <level>`,
|
|
600
|
-
* `--verbose`, or `--quiet`. CI is untouched either way — returning
|
|
601
|
-
* `undefined` there preserves `createLogger`'s own `ci`/`tty`
|
|
602
|
-
* auto-detection exactly, so CI's existing NDJSON-to-stdout behavior is
|
|
603
|
-
* unaffected by this flag.
|
|
604
|
-
*/
|
|
605
|
-
function resolveConsoleOutput(argv) {
|
|
606
|
-
if (argv.log || argv.verbose || argv.quiet) return true;
|
|
607
|
-
return isCI() ? void 0 : false;
|
|
608
|
-
}
|
|
609
|
-
let root;
|
|
610
|
-
let rootLevel;
|
|
611
|
-
let rootCommand;
|
|
612
|
-
let rootAxiomKey;
|
|
613
|
-
/**
|
|
614
577
|
* Resolve Axiom credentials for the CLI.
|
|
615
578
|
*
|
|
616
579
|
* A `global`-context command (ADR-0012) always resolves to
|
|
@@ -624,89 +587,39 @@ let rootAxiomKey;
|
|
|
624
587
|
* `HOLOCRON_AXIOM_DATASET` / `AXIOM_DATASET` or `log.axiom.dataset`.
|
|
625
588
|
* Returns `undefined` unless both a token and a dataset are found.
|
|
626
589
|
*/
|
|
627
|
-
function resolveCliAxiom(opts) {
|
|
628
|
-
const isGlobal = contextForCommand(
|
|
590
|
+
function resolveCliAxiom(opts, ctx) {
|
|
591
|
+
const isGlobal = contextForCommand(ctx.command ?? "") === "global";
|
|
629
592
|
if (!isGlobal) {
|
|
630
593
|
const fromEnv = resolveAxiomFromEnv();
|
|
631
594
|
if (fromEnv) return fromEnv;
|
|
632
595
|
}
|
|
633
596
|
const dataset = isGlobal ? GLOBAL_AXIOM_DATASET : holocronEnv$1.get("AXIOM_DATASET") ?? opts.configAxiomDataset;
|
|
634
597
|
if (!dataset) return void 0;
|
|
635
|
-
const org = opts.org ?? env$
|
|
598
|
+
const org = opts.org ?? env$8.get("HOLOCRON_ORG");
|
|
636
599
|
const token = holocronEnv$1.get("AXIOM_TOKEN") || (org ? keyring.get(`axiom.${org}`) : null) || keyring.get("axiom");
|
|
637
600
|
return token ? {
|
|
638
601
|
dataset,
|
|
639
602
|
token
|
|
640
603
|
} : void 0;
|
|
641
604
|
}
|
|
605
|
+
const logger = createCliLogger({
|
|
606
|
+
envPrefix: "HOLOCRON",
|
|
607
|
+
resolveAxiom: resolveCliAxiom
|
|
608
|
+
});
|
|
642
609
|
/**
|
|
643
|
-
* The process-wide root logger
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
* first pass could not have known — `log.level` (unless `--verbose` /
|
|
647
|
-
* `--quiet` already fixed it) or `log.axiom.dataset` + the resolved org
|
|
648
|
-
* for a keyring-backed Axiom transport. That rebuild generates a fresh
|
|
649
|
-
* `runId`, which is harmless: nothing logs between the middleware and the
|
|
650
|
-
* handler.
|
|
651
|
-
*/
|
|
652
|
-
function buildCliLogger(argv, opts = {}) {
|
|
653
|
-
const { command, configLevel } = opts;
|
|
654
|
-
allowProgress(!argv.quiet && !argv.log);
|
|
655
|
-
if (command) rootCommand = command;
|
|
656
|
-
const level = resolveLogLevel(argv, configLevel);
|
|
657
|
-
const consoleOutput = resolveConsoleOutput(argv);
|
|
658
|
-
const axiom = resolveCliAxiom(opts);
|
|
659
|
-
const axiomKey = axiom?.dataset;
|
|
660
|
-
const rebuildForConfig = configLevel !== void 0 && level !== rootLevel && !argv.verbose && !argv.quiet && !argv.log;
|
|
661
|
-
if (!root || rebuildForConfig || axiomKey !== void 0 && axiomKey !== rootAxiomKey) {
|
|
662
|
-
const built = createLogger({
|
|
663
|
-
...level ? { level } : {},
|
|
664
|
-
...axiom ? { axiom } : {},
|
|
665
|
-
...consoleOutput !== void 0 ? { consoleOutput } : {}
|
|
666
|
-
});
|
|
667
|
-
root = {
|
|
668
|
-
logger: rootCommand ? built.logger.child({ command: rootCommand }) : built.logger,
|
|
669
|
-
runId: built.runId
|
|
670
|
-
};
|
|
671
|
-
rootLevel = level;
|
|
672
|
-
rootAxiomKey = axiomKey;
|
|
673
|
-
}
|
|
674
|
-
return root;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Lazily-memoized `Logger` for module-level call sites with no `argv` in
|
|
678
|
-
* scope — notably yargs' own `.fail()` handler, which fires on a
|
|
679
|
-
* pre-middleware validation failure (a missing required argument, an
|
|
680
|
-
* unknown command) and therefore runs before `buildCliLogger` has ever
|
|
681
|
-
* built the real root. Without an explicit `consoleOutput` here, that
|
|
682
|
-
* fallback would use `createLogger`'s bare auto-detection (pretty on any
|
|
683
|
-
* local TTY) and leak a structured block even though no flag asked for one
|
|
684
|
-
* — so it resolves the same "quiet unless CI" default `buildCliLogger`
|
|
685
|
-
* would, as if no flags were passed.
|
|
686
|
-
*/
|
|
687
|
-
function getLogger() {
|
|
688
|
-
return (root ??= createLogger({ consoleOutput: resolveConsoleOutput({}) })).logger;
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Report a fatal, command-ending CLI error: always printed to the console
|
|
692
|
-
* (regardless of `consoleOutput` suppression) via `style.fail`, and also
|
|
693
|
-
* sent through the structured logger for Axiom/telemetry visibility.
|
|
694
|
-
*
|
|
695
|
-
* Use this when a handler is returning or exiting right here with nothing
|
|
696
|
-
* else for the user to see — a resolved `--token` failure, a yargs
|
|
697
|
-
* validation failure, a thrown domain error. Don't use it for a per-step
|
|
698
|
-
* warning inside a multi-step orchestrator that already prints its own
|
|
699
|
-
* `ok / fail / skip` summary — that summary is the user-facing signal;
|
|
700
|
-
* the per-step reason belongs in the structured log alone.
|
|
610
|
+
* The process-wide root logger, built once from `cli.ts`'s middleware and
|
|
611
|
+
* rebuilt at most once more when a handler supplies `holocron.config` context.
|
|
612
|
+
* See `createCliLogger` in `@theholocron/kyber/observability`.
|
|
701
613
|
*/
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
614
|
+
const buildCliLogger = logger.buildCliLogger;
|
|
615
|
+
/** Lazily-memoized `Logger` for call sites with no `argv` in scope (yargs' `.fail()`). */
|
|
616
|
+
const getLogger = logger.getLogger;
|
|
617
|
+
/** Report a fatal, command-ending CLI error: printed with `style.fail` and logged. */
|
|
618
|
+
const reportError = logger.reportError;
|
|
706
619
|
/** The current root logger's correlation id, if a root has been built. */
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
620
|
+
const getRunId = logger.getRunId;
|
|
621
|
+
logger.resetCliLogger;
|
|
622
|
+
logger.resolveLogLevel;
|
|
710
623
|
// src/observability/resolve-telemetry/resolve-telemetry.ts
|
|
711
624
|
const holocronEnv = withEnvPrefix(createEnvLookup(), "HOLOCRON");
|
|
712
625
|
/**
|
|
@@ -744,148 +657,37 @@ function resolvePostHogHost() {
|
|
|
744
657
|
}
|
|
745
658
|
// src/observability/telemetry/telemetry.ts
|
|
746
659
|
/**
|
|
747
|
-
* CLI self-telemetry
|
|
748
|
-
*
|
|
749
|
-
* This module holds *no* vendor SDK import. Each concern sits behind an
|
|
750
|
-
* interface from `@theholocron/observability` ({@link ErrorSink} /
|
|
751
|
-
* {@link AnalyticsSink}); the `SentrySink` / `PostHogSink` adapters there are
|
|
752
|
-
* the only `@sentry/node` / `posthog-node` call sites, and a `Noop*Sink` is
|
|
753
|
-
* installed when telemetry is off. Same seam the package's `Logger` uses for
|
|
754
|
-
* Pino.
|
|
755
|
-
*
|
|
756
|
-
* Activation is env-var + shipped-fallback, resolved here (`resolve-telemetry.ts`)
|
|
757
|
-
* and passed to the sink — the adapters read no environment. The single kill
|
|
758
|
-
* switch is `HOLOCRON_TELEMETRY=false` (legacy alias `NO_HOLOCRON_TELEMETRY`);
|
|
759
|
-
* see ADR-0007 / ADR-0008.
|
|
760
|
-
*/
|
|
761
|
-
const env$8 = createEnvLookup();
|
|
762
|
-
let errors = new NoopErrorSink();
|
|
763
|
-
let analytics = new NoopAnalyticsSink();
|
|
764
|
-
/**
|
|
765
|
-
* The shared opt-out. `HOLOCRON_TELEMETRY=false` (going-forward) or
|
|
766
|
-
* `NO_HOLOCRON_TELEMETRY` (any truthy value, back-compat) disables all sinks.
|
|
767
|
-
*/
|
|
768
|
-
function isEnabled() {
|
|
769
|
-
return env$8.get("HOLOCRON_TELEMETRY") !== "false" && !env$8.get("NO_HOLOCRON_TELEMETRY");
|
|
770
|
-
}
|
|
771
|
-
let commandStartedAt = 0;
|
|
772
|
-
let currentCommand = "unknown";
|
|
773
|
-
let lastErrorType;
|
|
774
|
-
let currentSpan;
|
|
775
|
-
/**
|
|
776
|
-
* Anonymous, stable per-machine id — `sha256(hostname + username)` truncated
|
|
777
|
-
* (ADR-0008). One-way: no raw hostname or username is ever transmitted.
|
|
778
|
-
*/
|
|
779
|
-
function machineId() {
|
|
780
|
-
try {
|
|
781
|
-
return createHash("sha256").update(`${hostname()} ${userInfo().username}`).digest("hex").slice(0, 32);
|
|
782
|
-
} catch {
|
|
783
|
-
return "unknown";
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
/** Properties every analytics event carries — pivot key to the Axiom trace. */
|
|
787
|
-
function baseProps() {
|
|
788
|
-
const runId = getRunId();
|
|
789
|
-
return {
|
|
790
|
-
command: currentCommand,
|
|
791
|
-
ci: Boolean(env$8.get("CI")),
|
|
792
|
-
...runId ? { runId } : {}
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
function init(version) {
|
|
796
|
-
const dsn = resolveDsn();
|
|
797
|
-
if (isEnabled() && dsn !== "") {
|
|
798
|
-
errors = new SentrySink();
|
|
799
|
-
errors.init({
|
|
800
|
-
dsn,
|
|
801
|
-
release: `holocron@${version}`,
|
|
802
|
-
environment: env$8.get("CI") ? "ci" : "local",
|
|
803
|
-
tags: {
|
|
804
|
-
os: process.platform,
|
|
805
|
-
node: process.version,
|
|
806
|
-
ci: String(Boolean(env$8.get("CI")))
|
|
807
|
-
}
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
const posthogKey = resolvePostHogKey();
|
|
811
|
-
if (isEnabled() && posthogKey !== "") {
|
|
812
|
-
analytics = new PostHogSink({
|
|
813
|
-
key: posthogKey,
|
|
814
|
-
host: resolvePostHogHost()
|
|
815
|
-
});
|
|
816
|
-
analytics.identify(machineId(), {
|
|
817
|
-
ci: Boolean(env$8.get("CI")),
|
|
818
|
-
os: process.platform,
|
|
819
|
-
node: process.version,
|
|
820
|
-
cli: version,
|
|
821
|
-
...env$8.get("HOLOCRON_ORG") ? { org: env$8.get("HOLOCRON_ORG") } : {}
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Apply the `telemetry` config block — the committed override layer, run once
|
|
827
|
-
* per command *after* config loads (so it lands after {@link init}). Env still
|
|
828
|
-
* wins: this only ever *narrows* what `init` turned on, never re-enables.
|
|
660
|
+
* CLI self-telemetry — errors (Sentry), usage analytics (PostHog).
|
|
829
661
|
*
|
|
830
|
-
*
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
-
function startCommand(name) {
|
|
861
|
-
currentCommand = name;
|
|
862
|
-
commandStartedAt = Date.now();
|
|
863
|
-
lastErrorType = void 0;
|
|
864
|
-
currentSpan = errors.startSpan(name);
|
|
865
|
-
event("command_started", { dry_run: process.argv.includes("--dry-run") });
|
|
866
|
-
return (ok) => {
|
|
867
|
-
currentSpan?.setStatus(ok);
|
|
868
|
-
currentSpan?.end();
|
|
869
|
-
event(ok ? "command_completed" : "command_failed", {
|
|
870
|
-
status: ok ? "ok" : "fail",
|
|
871
|
-
duration_ms: Date.now() - commandStartedAt,
|
|
872
|
-
...ok || !lastErrorType ? {} : { error_type: lastErrorType }
|
|
873
|
-
});
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
function captureException(err) {
|
|
877
|
-
lastErrorType = err instanceof Error ? err.constructor.name : "Error";
|
|
878
|
-
errors.captureException(err);
|
|
879
|
-
}
|
|
880
|
-
function endSession() {
|
|
881
|
-
errors.endSession();
|
|
882
|
-
}
|
|
883
|
-
async function flush() {
|
|
884
|
-
await errors.flush();
|
|
885
|
-
await analytics.shutdown();
|
|
886
|
-
errors = new NoopErrorSink();
|
|
887
|
-
analytics = new NoopAnalyticsSink();
|
|
888
|
-
}
|
|
662
|
+
* The orchestration is `createCliTelemetry` in `@theholocron/kyber/observability`
|
|
663
|
+
* (no vendor SDK import here either: the sinks live in `@theholocron/observability`).
|
|
664
|
+
* This module binds it to Holocron's values: the `HOLOCRON` env prefix, the
|
|
665
|
+
* credentials resolved by `resolve-telemetry.ts`, and the logger's run id.
|
|
666
|
+
* The single kill switch is `HOLOCRON_TELEMETRY=false` (legacy alias
|
|
667
|
+
* `NO_HOLOCRON_TELEMETRY`); see ADR-0007 / ADR-0008.
|
|
668
|
+
*/
|
|
669
|
+
const telemetry = createCliTelemetry({
|
|
670
|
+
envPrefix: "HOLOCRON",
|
|
671
|
+
dsn: resolveDsn,
|
|
672
|
+
posthogKey: resolvePostHogKey,
|
|
673
|
+
posthogHost: resolvePostHogHost,
|
|
674
|
+
getRunId: () => getRunId()
|
|
675
|
+
});
|
|
676
|
+
/** Install the live sinks unless telemetry is opted out or a credential is empty. */
|
|
677
|
+
const init = telemetry.init;
|
|
678
|
+
/** Apply the `telemetry` config block; it only ever narrows what `init` turned on. */
|
|
679
|
+
const applyConfig = telemetry.applyConfig;
|
|
680
|
+
/** Capture a PostHog event, scrubbed of secrets. */
|
|
681
|
+
const event = telemetry.event;
|
|
682
|
+
/** Start a command span; call the returned function with the outcome. */
|
|
683
|
+
const startCommand = telemetry.startCommand;
|
|
684
|
+
/** Report an error to Sentry. */
|
|
685
|
+
const captureException = telemetry.captureException;
|
|
686
|
+
/** End the Sentry session. */
|
|
687
|
+
const endSession = telemetry.endSession;
|
|
688
|
+
/** Drain both sinks and return to the no-ops. */
|
|
689
|
+
const flush = telemetry.flush;
|
|
690
|
+
telemetry.resetTelemetry;
|
|
889
691
|
// src/commands/resolve-org/resolve-org.ts
|
|
890
692
|
const env$7 = createEnvLookup();
|
|
891
693
|
/**
|
|
@@ -2976,33 +2778,23 @@ function getEntry(name) {
|
|
|
2976
2778
|
if (!entry) throw new Error(`interactive-menu: no COMMAND_REGISTRY entry named "${name}"`);
|
|
2977
2779
|
return entry;
|
|
2978
2780
|
}
|
|
2979
|
-
// src/interactive-menu/
|
|
2980
|
-
/**
|
|
2981
|
-
* Set on a dry-run preview child's env so its handler knows this specific `--dry-run` came from the menu's
|
|
2982
|
-
* own preview-then-ask flow, not a direct `holocron <cmd> --dry-run` invocation (see kyber's
|
|
2983
|
-
* `dryRunPreviewEnvVar`). A handler that supports it uses this to decide whether to report
|
|
2984
|
-
* {@link DRY_RUN_NOOP_EXIT_CODE}.
|
|
2985
|
-
*/
|
|
2986
|
-
const DRY_RUN_PREVIEW_ENV_VAR = dryRunPreviewEnvVar("HOLOCRON");
|
|
2781
|
+
// src/interactive-menu/menu.ts
|
|
2987
2782
|
/**
|
|
2988
2783
|
* Kyber's menu engine bound to `holocron`: secret options travel as `HOLOCRON_<OPTION>` env vars and the
|
|
2989
|
-
* non-interactive hint names the `holocron` bin.
|
|
2784
|
+
* non-interactive hint names the `holocron` bin. Feed it {@link COMMAND_REGISTRY} (plus any dynamically-built
|
|
2785
|
+
* entries); see `docs/wiki/specifications/tool-interactive-cli-menu.spec.md`.
|
|
2990
2786
|
*
|
|
2991
|
-
*
|
|
2992
|
-
*
|
|
2993
|
-
*
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
...nonInteractiveMessage !== void 0 && { nonInteractiveMessage },
|
|
3003
|
-
...startPath !== void 0 && { startPath }
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
2787
|
+
* Set on a dry-run preview child's env, `dryRunPreviewEnvVar` tells its handler this `--dry-run` came from the menu's own
|
|
2788
|
+
* preview-then-ask flow, not a direct `holocron <cmd> --dry-run`; a handler that supports it uses that to decide
|
|
2789
|
+
* whether to report {@link DRY_RUN_NOOP_EXIT_CODE}.
|
|
2790
|
+
*/
|
|
2791
|
+
const menu = createMenu({
|
|
2792
|
+
bin: "holocron",
|
|
2793
|
+
envPrefix: "HOLOCRON"
|
|
2794
|
+
});
|
|
2795
|
+
const launchMenu = menu.launchMenu;
|
|
2796
|
+
/** The env var a Holocron dry-run preview child gets (`HOLOCRON_DRY_RUN_PREVIEW`). */
|
|
2797
|
+
const DRY_RUN_PREVIEW_ENV_VAR = menu.dryRunPreviewEnvVar;
|
|
3006
2798
|
// src/interactive-menu/probe-menu-entries/probe-menu-entries.ts
|
|
3007
2799
|
/**
|
|
3008
2800
|
* One menu entry per probe, grouped under its provider (`probe sentry integrations`), for the menu `holocron probe`
|
|
@@ -3129,7 +2921,11 @@ function buildRunMenuEntries(taskNames) {
|
|
|
3129
2921
|
// src/commands/group-menu/group-menu.ts
|
|
3130
2922
|
/** Layer 2: a bare group command (`holocron repo`, `holocron repo upgrade`, …) opens the menu at that level. */
|
|
3131
2923
|
async function launchGroupMenu(parent, argv) {
|
|
3132
|
-
await launchMenu
|
|
2924
|
+
await launchMenu(COMMAND_REGISTRY, argv, {
|
|
2925
|
+
pickMessage: `${parent} — choose a subcommand:`,
|
|
2926
|
+
nonInteractiveMessage: `Run \`holocron ${parent} --help\` to see available ${parent} subcommands.`,
|
|
2927
|
+
startPath: parent.split(" ")
|
|
2928
|
+
});
|
|
3133
2929
|
}
|
|
3134
2930
|
/** The hidden `$0` of a command group: bare `holocron <group>` opens the menu at that group. */
|
|
3135
2931
|
const groupMenu$1 = (parent) => groupMenu(parent, launchGroupMenu);
|
|
@@ -11052,7 +10848,7 @@ const menuCommand = (version) => ({
|
|
|
11052
10848
|
handler: async (argv) => {
|
|
11053
10849
|
printVersionHeaderOnce(version);
|
|
11054
10850
|
const runEntries = buildRunMenuEntries(await listRunnableTasks(argv));
|
|
11055
|
-
await launchMenu
|
|
10851
|
+
await launchMenu([...COMMAND_REGISTRY, ...runEntries], argv);
|
|
11056
10852
|
}
|
|
11057
10853
|
});
|
|
11058
10854
|
// src/commands/monitoring-check/monitoring-check.ts
|
|
@@ -17371,7 +17167,11 @@ const probeCommand = {
|
|
|
17371
17167
|
...argv.lcov ? { lcov: argv.lcov } : {},
|
|
17372
17168
|
dryRun: argv.dryRun,
|
|
17373
17169
|
yes: argv.yes,
|
|
17374
|
-
...process.stdin.isTTY ? { pick: (groups) => launchMenu
|
|
17170
|
+
...process.stdin.isTTY ? { pick: (groups) => launchMenu(buildProbeMenuEntries(groups), argv, {
|
|
17171
|
+
pickMessage: "probe — choose a provider:",
|
|
17172
|
+
nonInteractiveMessage: "Run `holocron probe` to list the probes.",
|
|
17173
|
+
startPath: ["probe"]
|
|
17174
|
+
}) } : {}
|
|
17375
17175
|
})).status === "fail") process.exitCode = 1;
|
|
17376
17176
|
}
|
|
17377
17177
|
};
|
|
@@ -21396,7 +21196,8 @@ const runCommand = {
|
|
|
21396
21196
|
describe: "Run a task or a suite locally (`test`, `test unit`, `typecheck`, `lint`, `build`, `format`) — figures out turbo / the tool / the package manager. `run ci` runs every merge-gating check; `run lint commit-msg <file>` lints a commit message.",
|
|
21397
21197
|
builder: runArgs,
|
|
21398
21198
|
handler: async (argv) => {
|
|
21399
|
-
const
|
|
21199
|
+
const commandKey = argv.task === "ci" ? "run ci" : argv.task === "lint" && argv.job === "commit-msg" ? "run lint commit-msg" : "run";
|
|
21200
|
+
const { logger } = buildCliLogger(argv, { command: commandKey });
|
|
21400
21201
|
const args = argv.passthrough ?? [];
|
|
21401
21202
|
const passthrough = argv["--"] ?? [];
|
|
21402
21203
|
if (argv.task === "lint" && argv.job === "commit-msg") {
|
|
@@ -23084,11 +22885,6 @@ const tunnelCommand = {
|
|
|
23084
22885
|
builder: (y) => y.command(tunnelUpCommand).command(groupMenu$1("tunnel")),
|
|
23085
22886
|
handler: () => {}
|
|
23086
22887
|
};
|
|
23087
|
-
// src/retry-notice/retry-notice.ts
|
|
23088
|
-
/** Says on the spinner when a request is being sent again, so a slow step is not mistaken for a stuck one. */
|
|
23089
|
-
const retryNotice = (label, setText) => onRetry((e) => {
|
|
23090
|
-
setText(`${label} (retrying ${e.vendor ?? "the request"}, attempt ${e.attempt} of ${e.of})`);
|
|
23091
|
-
});
|
|
23092
22888
|
// src/cli.ts
|
|
23093
22889
|
const env = createEnvLookup();
|
|
23094
22890
|
const { name: CLI_PACKAGE_NAME, version: CLI_VERSION } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
@@ -23104,7 +22900,7 @@ const USER_FACING_ERRORS = /* @__PURE__ */ new Set([
|
|
|
23104
22900
|
/** Whether to print the correlation id at command end (`--debug` / `--verbose`). */
|
|
23105
22901
|
let printRunId = false;
|
|
23106
22902
|
init(CLI_VERSION);
|
|
23107
|
-
setProgressListener(
|
|
22903
|
+
setProgressListener(createRetryNotice(onRetry));
|
|
23108
22904
|
const updateCheckPromise = checkForUpdates({
|
|
23109
22905
|
name: CLI_PACKAGE_NAME,
|
|
23110
22906
|
currentVersion: CLI_VERSION,
|