@theholocron/cli 5.0.0-alpha.460 → 5.0.0-alpha.462

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
@@ -10,17 +10,18 @@ import { NonInteractiveError, commandFailureMessage, createProgress, createRetry
10
10
  import { LOG_LEVELS } from "@theholocron/observability/core";
11
11
  import yargs from "yargs";
12
12
  import { hideBin } from "yargs/helpers";
13
+ import { appendFileSync, copyFileSync, existsSync, fstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
13
14
  import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, numeric } from "@theholocron/kyber/menu";
14
15
  import { Entry, findCredentials } from "@napi-rs/keyring";
15
16
  import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver as createFeatureResolver$1, createKeyring, dotenvLine, findCredential, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue as resolveValue$1, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
16
17
  import { DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, localizeActions, mergeScripts, packageLocation, readWorkspacePackages, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, workflowFile, workflowKey, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
17
18
  import { loadTasksConfig } from "@theholocron/astromech/config";
19
+ import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
20
+ import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
18
21
  import { ConfigError, ConfigError as ConfigError$1, createConfigSystem, lastWins, mergeByKey, shallowMerge, union } from "@theholocron/kyber/config";
19
22
  import { LoaderError, assertPluginsResolvable as assertPluginsResolvable$1, createPluginSystem, defaultImporter as defaultImporter$1, isModuleNotFound, isModuleNotFound as isModuleNotFound$1, resolvePluginPackage as resolvePluginPackage$1 } from "@theholocron/kyber/plugins";
20
23
  import { readGitRemote, updateGitignore, upsertManagedBlock } from "@theholocron/git-utils";
21
24
  import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
22
- import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
23
- import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
24
25
  import { Separator, checkbox, confirm, input, password, select } from "@inquirer/prompts";
25
26
  import { runCheckAgainstUrl } from "@theholocron/kyber/checks";
26
27
  import { access, copyFile, lstat, mkdir, open, readFile, readdir, realpath, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
@@ -28,7 +29,6 @@ import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
28
29
  import { promptForPositionals } from "@theholocron/kyber/prompts";
29
30
  import { fileURLToPath, pathToFileURL } from "node:url";
30
31
  import { errorMessage } from "@theholocron/misc-utils";
31
- import { appendFileSync, copyFileSync, existsSync, fstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
32
32
  import { execFileSync, spawn, spawnSync } from "node:child_process";
33
33
  import { stringifyJson } from "@theholocron/json-utils";
34
34
  import { findRootSync, isWorkspaceRoot, walkFilesSync } from "@theholocron/fs-utils";
@@ -40,6 +40,117 @@ import { loadConfigPath } from "@theholocron/datapad";
40
40
  import { moveMajorTag } from "@theholocron/kyber/git";
41
41
  import { lintCommitMsgFile } from "@theholocron/astromech/lint";
42
42
  import { fetchLatestFromNpm, runUpgradeNode as runUpgradeNode$1 } from "@theholocron/astromech/upgrade";
43
+ // src/commands/contexts/contexts.ts
44
+ /**
45
+ * Command → context. Keys are the full command path as it lands in
46
+ * yargs' `argv._` (`"new token"`, `"upgrade node"`), the bare verb
47
+ * otherwise; a longer, more specific key wins over its parent.
48
+ *
49
+ * - **`global`** — needs nothing but the CLI binary. Works anywhere.
50
+ * - **`repo-aware`** — reads `./holocron.config` + `./package.json`
51
+ * relative to cwd, but never touches the plugin loader.
52
+ * - **`workspace`** — needs the configured providers' plugin packages to
53
+ * resolve (devDeps in a repo, or `pnpm exec`).
54
+ */
55
+ const COMMAND_CONTEXTS = {
56
+ clone: "global",
57
+ "new repo": "global",
58
+ "new plugin": "global",
59
+ "upgrade node": "global",
60
+ "upgrade deps": "global",
61
+ "new token": "global",
62
+ "remove token": "global",
63
+ "list tokens": "global",
64
+ "export tokens": "workspace",
65
+ "export requests": "workspace",
66
+ "upload coverage": "workspace",
67
+ "new github-app": "global",
68
+ "check token": "global",
69
+ "publish bump-versions": "global",
70
+ "publish tag": "global",
71
+ "publish package": "global",
72
+ "install skills": "global",
73
+ "remove skill": "global",
74
+ "update skills": "global",
75
+ "list skills": "global",
76
+ "run lint commit-msg": "global",
77
+ run: "repo-aware",
78
+ "run ci": "repo-aware",
79
+ "deploy on-release": "repo-aware",
80
+ "deploy stage": "repo-aware",
81
+ "show config": "repo-aware",
82
+ "sync readme": "repo-aware",
83
+ doctor: "workspace",
84
+ setup: "workspace",
85
+ "list secrets": "workspace",
86
+ "new secret": "workspace",
87
+ "sync secrets": "workspace",
88
+ "new tunnel": "workspace",
89
+ "list projects": "workspace",
90
+ "new project": "workspace",
91
+ "close project": "workspace",
92
+ "setup project": "workspace",
93
+ dev: "workspace",
94
+ "dev serve": "repo-aware",
95
+ "new channel": "workspace",
96
+ "setup notifications": "workspace",
97
+ "link account": "workspace",
98
+ "new server": "workspace",
99
+ "sync roles": "workspace",
100
+ "cleanup posts": "workspace",
101
+ "sync specs": "workspace",
102
+ "reconcile project": "workspace",
103
+ "doctor all": "workspace",
104
+ "doctor notifications": "workspace",
105
+ "doctor environments": "workspace",
106
+ "doctor project": "workspace",
107
+ "doctor logs": "workspace",
108
+ "doctor github-app": "workspace",
109
+ "move issues": "workspace",
110
+ "apply properties": "workspace",
111
+ "migrate issue": "workspace",
112
+ "migrate issues": "workspace",
113
+ "migrate project": "workspace",
114
+ "doctor dns": "workspace",
115
+ "doctor repo": "workspace",
116
+ "doctor secrets": "workspace",
117
+ "doctor tokens": "workspace",
118
+ "doctor monitoring": "workspace",
119
+ "doctor ci": "repo-aware",
120
+ probe: "workspace",
121
+ provider: "workspace",
122
+ deploy: "workspace",
123
+ "deploy cleanup-preview": "workspace",
124
+ "check monitor": "workspace",
125
+ "resolve checks": "workspace",
126
+ "check resolved": "global",
127
+ sync: "workspace",
128
+ "cleanup branches": "workspace",
129
+ "sync github": "workspace",
130
+ "sync issues": "workspace",
131
+ "sync ideas": "workspace",
132
+ "sync tooling": "workspace",
133
+ "sync requests": "workspace",
134
+ "new spec": "workspace",
135
+ "new issue": "workspace"
136
+ };
137
+ /**
138
+ * The context for a command name from `argv._`. Falls back to the leading
139
+ * verb (`"auth foo"` → `"auth"`) and finally `undefined` for a name the
140
+ * map doesn't know — callers treat unknown as "don't guard".
141
+ */
142
+ function contextForCommand(name) {
143
+ const map = COMMAND_CONTEXTS;
144
+ const tokens = name.split(" ").filter(Boolean);
145
+ for (let n = tokens.length; n > 0; n--) {
146
+ const ctx = map[tokens.slice(0, n).join(" ")];
147
+ if (ctx) return ctx;
148
+ }
149
+ }
150
+ /** Command names in a given context, in registration order. */
151
+ function commandsInContext(context) {
152
+ return Object.entries(COMMAND_CONTEXTS).filter(([, c]) => c === context).map(([name]) => name);
153
+ }
43
154
  // src/auth/auth.ts
44
155
  /**
45
156
  * The CLI's credentials: the OS keyring every plugin's bootstrap token lives in, and the two token resolvers built on
@@ -121,6 +232,16 @@ const authExportEntry = {
121
232
  name: "export tokens",
122
233
  description: "Write the stored tokens as NAME=value lines to a private file, to import them into a credentials environment",
123
234
  positionals: [],
235
+ skipOptions: [
236
+ "from-env",
237
+ "file",
238
+ "only",
239
+ "blank",
240
+ "vendor-names",
241
+ "copy",
242
+ "keep",
243
+ "force"
244
+ ],
124
245
  supportsDryRun: false
125
246
  };
126
247
  // src/commands/cleanup-preview/cleanup-preview.entry.ts
@@ -133,6 +254,19 @@ const cleanupPreviewEntry = {
133
254
  type: "input",
134
255
  validate: numeric
135
256
  }],
257
+ options: [{
258
+ key: "project",
259
+ flag: "--project",
260
+ type: "input",
261
+ required: true,
262
+ message: "Cloudflare Pages project name (e.g. theholocron-preview):"
263
+ }],
264
+ skipOptions: [
265
+ "project-id",
266
+ "target",
267
+ "files",
268
+ "repo"
269
+ ],
136
270
  supportsDryRun: true
137
271
  };
138
272
  // src/commands/clone/clone.entry.ts
@@ -145,13 +279,20 @@ const cloneEntry = {
145
279
  type: "input",
146
280
  validate: (v) => v.trim().length > 0 || "org/repo or org is required"
147
281
  }],
282
+ options: [{
283
+ key: "dir",
284
+ flag: "--dir",
285
+ type: "input",
286
+ message: "Parent directory to clone into (blank = ~/Code/<org>):"
287
+ }],
148
288
  supportsDryRun: true
149
289
  };
150
290
  // src/commands/config-show/config-show.entry.ts
151
291
  const configShowEntry = {
152
292
  name: "show config",
153
293
  description: "Print the resolved holocron config",
154
- positionals: []
294
+ positionals: [],
295
+ skipOptions: ["depth", "interactive"]
155
296
  };
156
297
  // src/commands/deploy/deploy.entry.ts
157
298
  const deployEntry = {
@@ -162,6 +303,21 @@ const deployEntry = {
162
303
  message: "Branch to deploy:",
163
304
  type: "input"
164
305
  }],
306
+ options: [{
307
+ key: "projectId",
308
+ flag: "--project-id",
309
+ type: "input",
310
+ required: true,
311
+ message: "Deployment project id (e.g. Vercel prj_*):"
312
+ }, {
313
+ key: "target",
314
+ flag: "--target",
315
+ type: "select",
316
+ choices: ["production", "staging"],
317
+ default: "production",
318
+ message: "Named environment to deploy into (leave the option off for a branch preview):"
319
+ }],
320
+ skipOptions: ["files"],
165
321
  supportsDryRun: true
166
322
  };
167
323
  // src/commands/deploy/deploy-on-release.entry.ts
@@ -169,6 +325,14 @@ const deployOnReleaseEntry = {
169
325
  name: "deploy on-release",
170
326
  description: "Deploy every workspace package whose delivery.deploy task is `on: release`",
171
327
  positionals: [],
328
+ skipOptions: [
329
+ "project-id",
330
+ "target",
331
+ "files",
332
+ "channel",
333
+ "from",
334
+ "to"
335
+ ],
172
336
  supportsDryRun: true
173
337
  };
174
338
  // src/commands/doctor/doctor.entry.ts
@@ -176,6 +340,7 @@ const doctorEntry = {
176
340
  name: "doctor",
177
341
  description: "Load the config and run a smoke check against every provider",
178
342
  positionals: [],
343
+ skipOptions: ["all", "repo"],
179
344
  supportsDryRun: true
180
345
  };
181
346
  // src/commands/doctor/doctor-all.entry.ts
@@ -184,6 +349,7 @@ const doctorAllEntry = {
184
349
  menuLabel: "doctor (everything)",
185
350
  description: "Run every deep check (doctor <capability>) and print one row each",
186
351
  positionals: [],
352
+ skipOptions: ["all", "repo"],
187
353
  supportsDryRun: false,
188
354
  spawnArgs: ["doctor", "--all"]
189
355
  };
@@ -192,6 +358,7 @@ const doctorCiEntry = {
192
358
  name: "doctor ci",
193
359
  description: "Check the repo against the flat task vocabulary: aliases, caller names, the ci aggregate, home (read-only)",
194
360
  positionals: [],
361
+ skipOptions: ["all", "repo"],
195
362
  supportsDryRun: false
196
363
  };
197
364
  // src/commands/doctor-dns/doctor-dns.entry.ts
@@ -199,6 +366,7 @@ const doctorDnsEntry = {
199
366
  name: "doctor dns",
200
367
  description: "Check that the DNS records the config makes setup write exist and point where they should (read-only)",
201
368
  positionals: [],
369
+ skipOptions: ["all", "repo"],
202
370
  supportsDryRun: false
203
371
  };
204
372
  // src/commands/doctor-environments/doctor-environments.entry.ts
@@ -206,6 +374,7 @@ const doctorEnvironmentsEntry = {
206
374
  name: "doctor environments",
207
375
  description: "Check that the deployment environments the config relies on exist (read-only)",
208
376
  positionals: [],
377
+ skipOptions: ["all", "repo"],
209
378
  supportsDryRun: false
210
379
  };
211
380
  // src/commands/doctor-github-app/doctor-github-app.entry.ts
@@ -213,6 +382,7 @@ const doctorGitHubAppEntry = {
213
382
  name: "doctor github-app",
214
383
  description: "Compare each registered GitHub App's events, permissions and installations with its manifest (read-only)",
215
384
  positionals: [],
385
+ skipOptions: ["all", "repo"],
216
386
  supportsDryRun: false
217
387
  };
218
388
  // src/commands/doctor-logs/doctor-logs.entry.ts
@@ -220,6 +390,7 @@ const doctorLogsEntry = {
220
390
  name: "doctor logs",
221
391
  description: "Check the Axiom datasets the setup ships logs to exist and the token reaches them (read-only)",
222
392
  positionals: [],
393
+ skipOptions: ["all", "repo"],
223
394
  supportsDryRun: false
224
395
  };
225
396
  // src/commands/doctor-monitoring/doctor-monitoring.entry.ts
@@ -227,6 +398,7 @@ const doctorMonitoringEntry = {
227
398
  name: "doctor monitoring",
228
399
  description: "Check the monitoring checks the config declares against the ones the provider holds (read-only)",
229
400
  positionals: [],
401
+ skipOptions: ["all", "repo"],
230
402
  supportsDryRun: false
231
403
  };
232
404
  // src/commands/doctor-notifications/doctor-notifications.entry.ts
@@ -247,6 +419,13 @@ const doctorNotificationsEntry = {
247
419
  default: false,
248
420
  message: "Post the result to #alerts (the failures, or just the summary)?"
249
421
  }],
422
+ skipOptions: [
423
+ "all",
424
+ "repo",
425
+ "scope",
426
+ "provider",
427
+ "built-only"
428
+ ],
250
429
  supportsDryRun: false
251
430
  };
252
431
  // src/commands/doctor-project/doctor-project.entry.ts
@@ -261,6 +440,7 @@ const doctorProjectEntry = {
261
440
  default: false,
262
441
  message: "Post the result to #alerts (the failures, or just the summary)?"
263
442
  }],
443
+ skipOptions: ["all", "repo"],
264
444
  supportsDryRun: false
265
445
  };
266
446
  // src/commands/doctor-repo/doctor-repo.entry.ts
@@ -268,6 +448,7 @@ const doctorRepoEntry = {
268
448
  name: "doctor repo",
269
449
  description: "Check the repository settings against the config (read-only): description, topics, labels, teams, protection, security",
270
450
  positionals: [],
451
+ skipOptions: ["all", "repo"],
271
452
  supportsDryRun: false
272
453
  };
273
454
  // src/commands/doctor-secrets/doctor-secrets.entry.ts
@@ -310,6 +491,13 @@ const doctorSecretsEntry = {
310
491
  message: "Look up one name:"
311
492
  }
312
493
  ],
494
+ skipOptions: [
495
+ "all",
496
+ "repo",
497
+ "only-secrets",
498
+ "only-variables",
499
+ "allow"
500
+ ],
313
501
  supportsDryRun: false
314
502
  };
315
503
  // src/commands/doctor-tokens/doctor-tokens.entry.ts
@@ -317,6 +505,7 @@ const doctorTokensEntry = {
317
505
  name: "doctor tokens",
318
506
  description: "Check every token the plugins declare for a layer has the permissions it should, no more, and is not due for rotation (read-only, goes online)",
319
507
  positionals: [],
508
+ skipOptions: ["all", "repo"],
320
509
  supportsDryRun: false
321
510
  };
322
511
  // src/commands/github-app-create/github-app-create.entry.ts
@@ -547,6 +736,12 @@ const monitoringCheckEntry = {
547
736
  message: "URL to test against:",
548
737
  type: "input"
549
738
  }],
739
+ options: [{
740
+ key: "vercelProject",
741
+ flag: "--vercel-project",
742
+ type: "input",
743
+ message: "Vercel project the URL must resolve to (blank = any):"
744
+ }],
550
745
  supportsDryRun: false
551
746
  };
552
747
  // src/commands/move-tag/move-tag.entry.ts
@@ -559,6 +754,7 @@ const moveTagEntry = {
559
754
  message: "Version group:",
560
755
  type: "input"
561
756
  }],
757
+ skipOptions: ["remote"],
562
758
  supportsDryRun: true
563
759
  };
564
760
  // src/commands/new/new-repo.entry.ts
@@ -566,6 +762,22 @@ const newRepoEntry = {
566
762
  name: "new repo",
567
763
  description: "Scaffold a new repo from a GitHub template (e.g. cli, react, nextjs, node, monorepo, base)",
568
764
  positionals: [],
765
+ skipOptions: [
766
+ "description",
767
+ "homepage",
768
+ "vault",
769
+ "deployment",
770
+ "agent",
771
+ "runtime-environment",
772
+ "topics",
773
+ "protection",
774
+ "open-source",
775
+ "uses-external-packages",
776
+ "skills",
777
+ "is-template",
778
+ "verify",
779
+ "org"
780
+ ],
569
781
  supportsDryRun: true
570
782
  };
571
783
  // src/commands/notifications-channel-add/notifications-channel-add.entry.ts
@@ -577,6 +789,33 @@ const notificationsChannelAddEntry = {
577
789
  message: "Channel name:",
578
790
  type: "input"
579
791
  }],
792
+ options: [
793
+ {
794
+ key: "category",
795
+ flag: "--category",
796
+ type: "input",
797
+ message: "Put the channel under this category (created if missing):"
798
+ },
799
+ {
800
+ key: "topic",
801
+ flag: "--topic",
802
+ type: "input",
803
+ message: "Channel topic:"
804
+ },
805
+ {
806
+ key: "withWebhook",
807
+ flag: "--with-webhook",
808
+ type: "confirm",
809
+ default: false,
810
+ message: "Also create a webhook and store its URL as a secret?"
811
+ }
812
+ ],
813
+ skipOptions: [
814
+ "webhook-name",
815
+ "secret",
816
+ "scope",
817
+ "provider"
818
+ ],
580
819
  supportsDryRun: true
581
820
  };
582
821
  // src/commands/notifications-create-server/notifications-create-server.entry.ts
@@ -613,6 +852,7 @@ const notificationsCreateServerEntry = {
613
852
  message: "Finish an earlier run (the server exists): invite the owner and hand it over?"
614
853
  }
615
854
  ],
855
+ skipOptions: ["provider"],
616
856
  supportsDryRun: true
617
857
  };
618
858
  // src/commands/notifications-dedupe/notifications-dedupe.entry.ts
@@ -641,6 +881,7 @@ const notificationsSetupEntry = {
641
881
  name: "setup notifications",
642
882
  description: "Apply the server layout a notifications provider declares in holocron.config.ts",
643
883
  positionals: [],
884
+ skipOptions: ["scope", "provider"],
644
885
  supportsDryRun: true
645
886
  };
646
887
  // src/commands/notifications-sync-roles/notifications-sync-roles.entry.ts
@@ -672,6 +913,11 @@ const npmBumpVersionsEntry = {
672
913
  message: "New version:",
673
914
  type: "input"
674
915
  }],
916
+ skipOptions: [
917
+ "group",
918
+ "exclude-group",
919
+ "include-private"
920
+ ],
675
921
  supportsDryRun: true
676
922
  };
677
923
  // src/commands/plugin-create/plugin-create.entry.ts
@@ -687,14 +933,32 @@ const pluginCreateEntry = {
687
933
  message: "Vendor display name (PascalCase):",
688
934
  type: "input"
689
935
  }],
936
+ skipOptions: [
937
+ "capability",
938
+ "token-env",
939
+ "vendor-env",
940
+ "base-url",
941
+ "verify"
942
+ ],
690
943
  supportsDryRun: true
691
944
  };
692
945
  // src/commands/probe/probe.entry.ts
946
+ /** The options of `probe`: each probe that takes one asks for it itself, so the menu offers none (the probe menu entries share this). */
947
+ const PROBE_SKIP_OPTIONS = [
948
+ "lcov",
949
+ "warn",
950
+ "files",
951
+ "only",
952
+ "copy",
953
+ "environment",
954
+ "yes"
955
+ ];
693
956
  const probeEntry = {
694
957
  name: "probe",
695
958
  description: "Poke a live provider on purpose: inspect it, or run a proof that cleans up after itself",
696
959
  positionals: [],
697
- opensMenu: true
960
+ opensMenu: true,
961
+ skipOptions: PROBE_SKIP_OPTIONS
698
962
  };
699
963
  // src/commands/project/move/move.entry.ts
700
964
  const projectMoveEntry = {
@@ -740,6 +1004,7 @@ const projectCreateEntry = {
740
1004
  type: "input",
741
1005
  message: "Board title (blank = the template's name):"
742
1006
  }],
1007
+ skipOptions: ["yes"],
743
1008
  supportsDryRun: true
744
1009
  };
745
1010
  // src/commands/project/project-list/project-list.entry.ts
@@ -788,6 +1053,117 @@ const PUBLISH_OTP_OPTION = {
788
1053
  required: Boolean(env$10.get("HOLOCRON_NPM_ENFORCE_2FA")),
789
1054
  message: "One-time password (2FA), if npm requires it for this publish:"
790
1055
  };
1056
+ const publishEntry = {
1057
+ name: "publish package",
1058
+ description: "Publish @theholocron/* packages to npm",
1059
+ positionals: [],
1060
+ skipOptions: [
1061
+ "group",
1062
+ "package",
1063
+ "exclude-group",
1064
+ "force"
1065
+ ],
1066
+ supportsDryRun: true,
1067
+ modes: [
1068
+ {
1069
+ key: "steady",
1070
+ message: "Publish a new version",
1071
+ options: [
1072
+ PUBLISH_TAG_OPTION,
1073
+ PUBLISH_OTP_OPTION,
1074
+ {
1075
+ key: "provenance",
1076
+ flag: "--provenance",
1077
+ type: "confirm",
1078
+ default: true,
1079
+ negatable: true,
1080
+ message: "Publish with --provenance? (on by default)"
1081
+ },
1082
+ {
1083
+ key: "skipAlreadyPublished",
1084
+ flag: "--skip-already-published",
1085
+ type: "confirm",
1086
+ default: false,
1087
+ message: "Skip a package already published at this exact version, instead of one bulk publish?"
1088
+ }
1089
+ ]
1090
+ },
1091
+ {
1092
+ key: "initial",
1093
+ message: "Initial publish (--initial)",
1094
+ description: "Use only for a package's very first publish.",
1095
+ flag: "--initial",
1096
+ options: [PUBLISH_TAG_OPTION, PUBLISH_OTP_OPTION]
1097
+ },
1098
+ {
1099
+ key: "syncTrust",
1100
+ message: "Sync Trusted Publisher workflow filename across every public package (--sync-trust)",
1101
+ options: [{
1102
+ key: "syncTrust",
1103
+ flag: "--sync-trust",
1104
+ type: "input",
1105
+ arity: 2,
1106
+ required: true,
1107
+ message: "Workflow filename (old, then new)"
1108
+ }, {
1109
+ key: "repo",
1110
+ flag: "--repo",
1111
+ type: "input",
1112
+ message: "owner/repo for Trusted Publisher config (blank = theholocron/holocron):"
1113
+ }]
1114
+ }
1115
+ ]
1116
+ };
1117
+ // src/commands/repo-cleanup-branches/repo-cleanup-branches.entry.ts
1118
+ const repoCleanupBranchesEntry = {
1119
+ name: "cleanup branches",
1120
+ description: "List the branches whose pull request is merged and delete the ones you pick",
1121
+ positionals: [],
1122
+ options: [{
1123
+ key: "local",
1124
+ flag: "--local",
1125
+ type: "confirm",
1126
+ default: false,
1127
+ message: "Only the branches in this checkout?"
1128
+ }, {
1129
+ key: "remote",
1130
+ flag: "--remote",
1131
+ type: "confirm",
1132
+ default: false,
1133
+ message: "Only the branches on the remote?"
1134
+ }],
1135
+ skipOptions: ["yes", "repo"],
1136
+ supportsDryRun: false
1137
+ };
1138
+ // src/commands/repo-properties/repo-properties-apply.entry.ts
1139
+ const repoPropertiesApplyEntry = {
1140
+ name: "apply properties",
1141
+ description: "Add the capabilities the organization's holocron_capabilities property does not allow yet",
1142
+ positionals: [],
1143
+ skipOptions: ["yes"],
1144
+ supportsDryRun: true
1145
+ };
1146
+ // src/commands/requests-export/requests-export.entry.ts
1147
+ const requestsExportEntry = {
1148
+ name: "export requests",
1149
+ description: "Write the repo's request collections in each tooling provider's own format, under a git-ignored folder",
1150
+ positionals: [],
1151
+ skipOptions: [
1152
+ "yes",
1153
+ "to",
1154
+ "out"
1155
+ ],
1156
+ supportsDryRun: true
1157
+ };
1158
+ // src/commands/run/run-ci.entry.ts
1159
+ /** The options of `run` that the menu does not offer; the entries it builds for each task share this (`run ci` also offers `--all`). */
1160
+ const RUN_SKIP_OPTIONS = [
1161
+ "check",
1162
+ "required",
1163
+ "filter",
1164
+ "affected",
1165
+ "base"
1166
+ ];
791
1167
  // src/interactive-menu/command-catalog/command-catalog.ts
792
1168
  /**
793
1169
  * The full command surface for the interactive menu. Each entry lives next to the command it describes
@@ -809,6 +1185,7 @@ const registry = createCommandRegistry([
809
1185
  name: "setup",
810
1186
  description: "Apply infra setup actions across every configured capability",
811
1187
  positionals: [],
1188
+ skipOptions: ["repo", "hooks"],
812
1189
  supportsDryRun: true
813
1190
  },
814
1191
  {
@@ -819,12 +1196,33 @@ const registry = createCommandRegistry([
819
1196
  message: "Secret name:",
820
1197
  type: "input"
821
1198
  }],
1199
+ options: [{
1200
+ key: "scope",
1201
+ flag: "--scope",
1202
+ type: "input",
1203
+ message: "Scope: repo (default), env=<name> or org=<name>:"
1204
+ }],
1205
+ skipOptions: ["from-stdin", "from-env"],
822
1206
  supportsDryRun: true
823
1207
  },
824
1208
  {
825
1209
  name: "list secrets",
826
1210
  description: "List the names of the secrets at each scope (never the values)",
827
1211
  positionals: [],
1212
+ options: [{
1213
+ key: "scope",
1214
+ flag: "--scope",
1215
+ type: "select",
1216
+ choices: ["repo", "organization"],
1217
+ default: "repo",
1218
+ message: "List one scope:"
1219
+ }, {
1220
+ key: "env",
1221
+ flag: "--env",
1222
+ type: "input",
1223
+ message: "Also list this environment (blank = none):"
1224
+ }],
1225
+ skipOptions: ["json"],
828
1226
  supportsDryRun: false
829
1227
  },
830
1228
  {
@@ -838,6 +1236,13 @@ const registry = createCommandRegistry([
838
1236
  required: true,
839
1237
  message: "Vault environment (a layer such as ci or prod, or an Environment name):"
840
1238
  }],
1239
+ skipOptions: [
1240
+ "project-id",
1241
+ "target",
1242
+ "worker",
1243
+ "github-secret",
1244
+ "github-secret-scope"
1245
+ ],
841
1246
  supportsDryRun: true
842
1247
  },
843
1248
  notificationsChannelAddEntry,
@@ -848,13 +1253,7 @@ const registry = createCommandRegistry([
848
1253
  doctorGitHubAppEntry,
849
1254
  doctorLogsEntry,
850
1255
  projectMoveEntry,
851
- {
852
- name: "apply properties",
853
- description: "Add the capabilities the organization's holocron_capabilities property does not allow yet",
854
- positionals: [],
855
- skipOptions: ["yes"],
856
- supportsDryRun: true
857
- },
1256
+ repoPropertiesApplyEntry,
858
1257
  migrateIssueEntry,
859
1258
  migrateIssuesEntry,
860
1259
  migrateProjectEntry,
@@ -941,97 +1340,40 @@ const registry = createCommandRegistry([
941
1340
  monitoringCheckEntry,
942
1341
  npmBumpVersionsEntry,
943
1342
  moveTagEntry,
944
- {
945
- name: "publish package",
946
- description: "Publish @theholocron/* packages to npm",
947
- positionals: [],
948
- supportsDryRun: true,
949
- modes: [
950
- {
951
- key: "steady",
952
- message: "Publish a new version",
953
- options: [
954
- PUBLISH_TAG_OPTION,
955
- PUBLISH_OTP_OPTION,
956
- {
957
- key: "provenance",
958
- flag: "--provenance",
959
- type: "confirm",
960
- default: true,
961
- negatable: true,
962
- message: "Publish with --provenance? (on by default)"
963
- },
964
- {
965
- key: "skipAlreadyPublished",
966
- flag: "--skip-already-published",
967
- type: "confirm",
968
- default: false,
969
- message: "Skip a package already published at this exact version, instead of one bulk publish?"
970
- }
971
- ]
972
- },
973
- {
974
- key: "initial",
975
- message: "Initial publish (--initial)",
976
- description: "Use only for a package's very first publish.",
977
- flag: "--initial",
978
- options: [PUBLISH_TAG_OPTION, PUBLISH_OTP_OPTION]
979
- },
980
- {
981
- key: "syncTrust",
982
- message: "Sync Trusted Publisher workflow filename across every public package (--sync-trust)",
983
- options: [{
984
- key: "syncTrust",
985
- flag: "--sync-trust",
986
- type: "input",
987
- arity: 2,
988
- required: true,
989
- message: "Workflow filename (old, then new)"
990
- }, {
991
- key: "repo",
992
- flag: "--repo",
993
- type: "input",
994
- message: "owner/repo for Trusted Publisher config (blank = theholocron/holocron):"
995
- }]
996
- }
997
- ]
998
- },
1343
+ publishEntry,
999
1344
  {
1000
1345
  name: "sync",
1001
1346
  description: "Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)",
1002
1347
  positionals: [],
1348
+ skipOptions: ["repo"],
1003
1349
  supportsDryRun: true
1004
1350
  },
1351
+ repoCleanupBranchesEntry,
1005
1352
  {
1006
- name: "cleanup branches",
1007
- description: "List the branches whose pull request is merged and delete the ones you pick",
1353
+ name: "run ci",
1354
+ description: "Run the merge-gating checks locally, in CI order — 'will CI pass?'",
1008
1355
  positionals: [],
1009
1356
  options: [{
1010
- key: "local",
1011
- flag: "--local",
1357
+ key: "all",
1358
+ flag: "--all",
1012
1359
  type: "confirm",
1013
1360
  default: false,
1014
- message: "Only the branches in this checkout?"
1015
- }, {
1016
- key: "remote",
1017
- flag: "--remote",
1018
- type: "confirm",
1019
- default: false,
1020
- message: "Only the branches on the remote?"
1361
+ message: "Run every ci task, not only the required ones?"
1021
1362
  }],
1022
- skipOptions: ["yes", "repo"],
1023
- supportsDryRun: false
1024
- },
1025
- {
1026
- name: "run ci",
1027
- description: "Run the merge-gating checks locally, in CI order — 'will CI pass?'",
1028
- positionals: [],
1363
+ skipOptions: RUN_SKIP_OPTIONS,
1029
1364
  supportsDryRun: true
1030
1365
  },
1031
1366
  {
1032
1367
  name: "sync github",
1033
1368
  description: "Sync workflow templates and composite actions to theholocron/.github",
1034
1369
  positionals: [],
1370
+ skipOptions: [
1371
+ "repo",
1372
+ "branch",
1373
+ "pr",
1374
+ "message",
1375
+ "output-dir"
1376
+ ],
1035
1377
  supportsDryRun: true
1036
1378
  },
1037
1379
  {
@@ -1102,6 +1444,7 @@ const registry = createCommandRegistry([
1102
1444
  name: "sync readme",
1103
1445
  description: "Sync the Installation + Usage block in README.md from package.json",
1104
1446
  positionals: [],
1447
+ skipOptions: ["dry-run"],
1105
1448
  supportsDryRun: true
1106
1449
  },
1107
1450
  configShowEntry,
@@ -1117,6 +1460,7 @@ const registry = createCommandRegistry([
1117
1460
  name: "remove skill",
1118
1461
  description: "Remove installed skills via npx skills remove",
1119
1462
  positionals: [],
1463
+ skipOptions: ["all"],
1120
1464
  supportsDryRun: true
1121
1465
  },
1122
1466
  {
@@ -1139,12 +1483,20 @@ const registry = createCommandRegistry([
1139
1483
  type: "input",
1140
1484
  validate: numeric
1141
1485
  }],
1486
+ skipOptions: ["from"],
1142
1487
  supportsDryRun: true
1143
1488
  },
1144
1489
  {
1145
1490
  name: "upgrade deps",
1146
1491
  description: "Bump every @theholocron/* pin to latest and migrate holocron.config.ts to the current preset API",
1147
1492
  positionals: [],
1493
+ options: [{
1494
+ key: "pinsOnly",
1495
+ flag: "--pins-only",
1496
+ type: "confirm",
1497
+ default: false,
1498
+ message: "Only bump the catalog pins, not holocron.config.ts?"
1499
+ }],
1148
1500
  supportsDryRun: true
1149
1501
  },
1150
1502
  authSetEntry,
@@ -1152,17 +1504,7 @@ const registry = createCommandRegistry([
1152
1504
  authCheckEntry,
1153
1505
  authListEntry,
1154
1506
  authExportEntry,
1155
- {
1156
- name: "export requests",
1157
- description: "Write the repo's request collections in each tooling provider's own format, under a git-ignored folder",
1158
- positionals: [],
1159
- skipOptions: [
1160
- "yes",
1161
- "to",
1162
- "out"
1163
- ],
1164
- supportsDryRun: true
1165
- },
1507
+ requestsExportEntry,
1166
1508
  {
1167
1509
  name: "upload coverage",
1168
1510
  description: "Upload the repo's coverage reports, one flag per group, through the coverage provider",
@@ -1251,6 +1593,7 @@ function buildProbeMenuEntries(groups) {
1251
1593
  name: `probe ${provider} ${name}`,
1252
1594
  description: probe.writes ? `${probe.summary} (changes things)` : probe.summary,
1253
1595
  positionals: [],
1596
+ skipOptions: PROBE_SKIP_OPTIONS,
1254
1597
  supportsDryRun: probe.writes,
1255
1598
  spawnArgs: [
1256
1599
  "probe",
@@ -1346,6 +1689,7 @@ function buildRunMenuEntries(taskNames) {
1346
1689
  name: `run ${namespace}`,
1347
1690
  description: `Run every ${namespace}.* task in sequence`,
1348
1691
  positionals: [],
1692
+ skipOptions: [...RUN_SKIP_OPTIONS, "all"],
1349
1693
  supportsDryRun: true,
1350
1694
  spawnArgs: ["run", namespace]
1351
1695
  });
@@ -1355,6 +1699,7 @@ function buildRunMenuEntries(taskNames) {
1355
1699
  name: isRealNamespace ? `run ${namespace} ${leaf}` : `run ${leaf}`,
1356
1700
  description: `Run ${task}`,
1357
1701
  positionals: [],
1702
+ skipOptions: [...RUN_SKIP_OPTIONS, "all"],
1358
1703
  supportsDryRun: true,
1359
1704
  spawnArgs: ["run", task]
1360
1705
  });
@@ -1362,6 +1707,160 @@ function buildRunMenuEntries(taskNames) {
1362
1707
  }
1363
1708
  return entries;
1364
1709
  }
1710
+ // src/commands/menu/menu.command.ts
1711
+ /**
1712
+ * Print the dim version line once per terminal session — keyed by the
1713
+ * parent shell's PID, since that's stable across repeated bare `holocron`
1714
+ * invocations in the same shell but changes in a new tab/window. A marker
1715
+ * file in the OS tmpdir tracks whether this shell has already seen it, so
1716
+ * re-running `holocron` doesn't repeat the line every time.
1717
+ */
1718
+ function printVersionHeaderOnce(version) {
1719
+ const marker = join(tmpdir(), `.holocron-version-shown-${process.ppid}`);
1720
+ if (existsSync(marker)) return;
1721
+ console.log(style.dim(`v${version}`));
1722
+ writeFileSync(marker, "");
1723
+ }
1724
+ /** Bare `holocron` (hidden from --help): a menu of every command, with this repo's runnable tasks merged in. */
1725
+ const menuCommand = (version) => ({
1726
+ command: "$0",
1727
+ describe: false,
1728
+ builder: (y) => y,
1729
+ handler: async (argv) => {
1730
+ printVersionHeaderOnce(version);
1731
+ const runEntries = buildRunMenuEntries(await listRunnableTasks(argv));
1732
+ await launchMenu([...COMMAND_REGISTRY, ...runEntries], argv);
1733
+ }
1734
+ });
1735
+ // src/observability/logger/logger.ts
1736
+ /**
1737
+ * CLI-side wiring for `@theholocron/observability/logger`.
1738
+ *
1739
+ * `logger` is the operational-output channel — internal state, debug
1740
+ * traces, errors, structured context that routes to Axiom. It runs in
1741
+ * parallel to `print` (user-facing UX output) and does not replace it.
1742
+ */
1743
+ const env$9 = createEnvLookup();
1744
+ const holocron = holocronEnv();
1745
+ /**
1746
+ * The CLI's Axiom dataset (`holocron`; each service has its own): the process environment (`HOLOCRON_AXIOM_DATASET`, then the unprefixed `AXIOM_DATASET`,
1747
+ * through the prefix lookup), then the repo's `log.axiom.dataset`, then the credential chain, which is asked for the
1748
+ * same pair of names through `resolveValue`'s `prefix` option.
1749
+ *
1750
+ * A service's environments ship to the same dataset and are told apart by the `env` field on each line (ADR-0019). The
1751
+ * config dataset is only a per-repo override, so a `global`-context command (`clone`, `new token`, `upgrade node`, ...,
1752
+ * ADR-0012) leaves it out: it is not about any repo, and the repo it happens to run in must not choose where its
1753
+ * lines go.
1754
+ */
1755
+ function resolveCliDataset(opts, isGlobal) {
1756
+ return holocron.get("AXIOM_DATASET") ?? (isGlobal ? void 0 : opts.configAxiomDataset) ?? resolveValue$1(["AXIOM_DATASET"], void 0, { prefix: PREFIX$1 });
1757
+ }
1758
+ /**
1759
+ * Resolve Axiom credentials for the CLI.
1760
+ *
1761
+ * Env vars win (same contract as `@theholocron/observability`'s `resolveAxiomFromEnv`), falling back to the CLI-only
1762
+ * bridge that pairs the OS-keyring token (`axiom.<org>` then bare `axiom`) with the dataset from
1763
+ * {@link resolveCliDataset}. Returns `undefined` unless both a token and a dataset are found, so a local run with
1764
+ * neither stays off Axiom.
1765
+ */
1766
+ function resolveCliAxiom(opts, ctx) {
1767
+ const fromEnv = resolveAxiomFromEnv();
1768
+ if (fromEnv) return fromEnv;
1769
+ const dataset = resolveCliDataset(opts, contextForCommand(ctx.command ?? "") === "global");
1770
+ if (!dataset) return void 0;
1771
+ const org = opts.org ?? env$9.get(`${PREFIX$1}_ORG`);
1772
+ const token = holocron.get("AXIOM_TOKEN") || (org ? keyring.get(`axiom.${org}`) : null) || keyring.get("axiom");
1773
+ return token ? {
1774
+ dataset,
1775
+ token
1776
+ } : void 0;
1777
+ }
1778
+ const logger = createCliLogger({
1779
+ envPrefix: PREFIX$1,
1780
+ resolveAxiom: resolveCliAxiom
1781
+ });
1782
+ /**
1783
+ * The process-wide root logger, built once from `cli.ts`'s middleware and
1784
+ * rebuilt at most once more when a handler supplies `holocron.config` context.
1785
+ * See `createCliLogger` in `@theholocron/kyber/observability`.
1786
+ */
1787
+ const buildCliLogger = logger.buildCliLogger;
1788
+ /** Lazily-memoized `Logger` for call sites with no `argv` in scope (yargs' `.fail()`). */
1789
+ const getLogger = logger.getLogger;
1790
+ /** Report a fatal, command-ending CLI error: printed with `style.fail` and logged. */
1791
+ const reportError = logger.reportError;
1792
+ /** The current root logger's correlation id, if a root has been built. */
1793
+ const getRunId = logger.getRunId;
1794
+ logger.resetCliLogger;
1795
+ logger.resolveLogLevel;
1796
+ // src/observability/resolve-telemetry/resolve-telemetry.ts
1797
+ const env$8 = holocronEnv();
1798
+ /**
1799
+ * Holocron-specific credential resolution for the telemetry sinks — the env
1800
+ * chain plus Holocron's own shipped fallbacks. This is **CLI policy**, not part
1801
+ * of the portable adapter set: `sentry-sink.ts` / `posthog-sink.ts` take a
1802
+ * resolved DSN / key and never read the environment. When the adapters move to
1803
+ * `@theholocron/observability` (#635) this module stays here.
1804
+ *
1805
+ * errors: HOLOCRON_SENTRY_DSN → SENTRY_DSN → FALLBACK_DSN
1806
+ * analytics: HOLOCRON_POSTHOG_PROJECT_TOKEN → POSTHOG_PROJECT_TOKEN → FALLBACK_POSTHOG_PROJECT_TOKEN
1807
+ * host: HOLOCRON_POSTHOG_HOST → POSTHOG_HOST → DEFAULT_POSTHOG_HOST
1808
+ *
1809
+ * The `SENTRY_DSN` / `POSTHOG_PROJECT_TOKEN` fallbacks are the vendor-native
1810
+ * names a consumer repo sets to route CLI telemetry to its own project. The
1811
+ * built-in fallbacks are ingest-only keys — publishable by design, same risk
1812
+ * model as ADR-0007 / ADR-0008.
1813
+ */
1814
+ /** Holocron's own Sentry project — the fallback when no env var points elsewhere. */
1815
+ const FALLBACK_DSN = "https://95cbb72ad5636c94e119a5405ee8f55f@o4508238154104832.ingest.us.sentry.io/4511810950791168";
1816
+ /** Holocron's own PostHog project write key — ingest-only. */
1817
+ const FALLBACK_POSTHOG_PROJECT_TOKEN = "phc_AC4vFCvYzwnzmG7Vg5nEc3PZKZztoPyfKp4Lb9BbXcLK";
1818
+ const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
1819
+ /** Resolve the Sentry DSN. `""` → error telemetry disabled. */
1820
+ function resolveDsn() {
1821
+ return env$8.get("SENTRY_DSN") ?? FALLBACK_DSN;
1822
+ }
1823
+ /** Resolve the PostHog project key. `""` → usage analytics disabled. */
1824
+ function resolvePostHogKey() {
1825
+ return env$8.get("POSTHOG_PROJECT_TOKEN") ?? FALLBACK_POSTHOG_PROJECT_TOKEN;
1826
+ }
1827
+ /** Resolve the PostHog ingest host. */
1828
+ function resolvePostHogHost() {
1829
+ return env$8.get("POSTHOG_HOST") ?? DEFAULT_POSTHOG_HOST;
1830
+ }
1831
+ // src/observability/telemetry/telemetry.ts
1832
+ /**
1833
+ * CLI self-telemetry — errors (Sentry), usage analytics (PostHog).
1834
+ *
1835
+ * The orchestration is `createCliTelemetry` in `@theholocron/kyber/observability`
1836
+ * (no vendor SDK import here either: the sinks live in `@theholocron/observability`).
1837
+ * This module binds it to Holocron's values: the `HOLOCRON` env prefix, the
1838
+ * credentials resolved by `resolve-telemetry.ts`, and the logger's run id.
1839
+ * The single kill switch is `HOLOCRON_TELEMETRY=false` (legacy alias
1840
+ * `NO_HOLOCRON_TELEMETRY`); see ADR-0007 / ADR-0008.
1841
+ */
1842
+ const telemetry = createCliTelemetry({
1843
+ envPrefix: PREFIX$1,
1844
+ dsn: resolveDsn,
1845
+ posthogKey: resolvePostHogKey,
1846
+ posthogHost: resolvePostHogHost,
1847
+ getRunId: () => getRunId()
1848
+ });
1849
+ /** Install the live sinks unless telemetry is opted out or a credential is empty. */
1850
+ const init = telemetry.init;
1851
+ /** Apply the `telemetry` config block; it only ever narrows what `init` turned on. */
1852
+ const applyConfig = telemetry.applyConfig;
1853
+ /** Capture a PostHog event, scrubbed of secrets. */
1854
+ const event = telemetry.event;
1855
+ /** Start a command span; call the returned function with the outcome. */
1856
+ const startCommand = telemetry.startCommand;
1857
+ /** Report an error to Sentry. */
1858
+ const captureException = telemetry.captureException;
1859
+ /** End the Sentry session. */
1860
+ const endSession = telemetry.endSession;
1861
+ /** Drain both sinks and return to the no-ops. */
1862
+ const flush = telemetry.flush;
1863
+ telemetry.resetTelemetry;
1365
1864
  // src/commands/group-menu/group-menu.ts
1366
1865
  /** Layer 2: a bare group command (`holocron repo`, `holocron upgrade`, …) opens the menu at that level. */
1367
1866
  async function launchGroupMenu(parent, argv) {
@@ -2227,374 +2726,134 @@ async function tryEnvironments(candidates, attempt) {
2227
2726
  if (!isNotFound(err)) throw err;
2228
2727
  if (!candidate.optional) missing.push(candidate.name);
2229
2728
  }
2230
- return {
2231
- found,
2232
- missing
2233
- };
2234
- }
2235
- // src/config/resolve-layers/resolve-layers.ts
2236
- /**
2237
- * Turns every `layer` in a loaded config into the `environment` it names (spec `tech-environment-layers`, #2069), so
2238
- * the commands and doctors that read Environments see one literal name and none of them derives it again. The name is
2239
- * `layerEnvironment()` over the `origin` remote of `input.repoRoot`, read at most once and only when an entry names a
2240
- * layer. A remote that cannot be read is a `ConfigError` naming the `environment` option (`repoSlug()`); nothing is
2241
- * guessed. Covers `repo.secrets.sync`, `repo.secrets.deploy`, `repo.variables.sync`, `githubApps`, `dev` and the
2242
- * `vault` provider's `layer` option. Returns a new config; the one passed in is not changed.
2243
- *
2244
- * @param config - The resolved config, validated by `resolveConfig()`.
2245
- * @param input - Where to read the remote, and how.
2246
- * @returns The config with each `layer` replaced by its `environment`.
2247
- */
2248
- async function resolveLayers(config, input) {
2249
- let slug;
2250
- const named = async (entry) => {
2251
- if (entry.layer === void 0) return entry;
2252
- const { layer, ...rest } = entry;
2253
- slug ??= repoSlug(input.repoRoot, input.gitExec);
2254
- return {
2255
- ...rest,
2256
- environment: layerEnvironment(await slug, layer)
2257
- };
2258
- };
2259
- const all = (list) => Promise.all(list.map(named));
2260
- const out = { ...config };
2261
- const { repo } = config;
2262
- if (repo) {
2263
- const next = { ...repo };
2264
- if (repo.secrets) {
2265
- next.secrets = { ...repo.secrets };
2266
- if (repo.secrets.sync) next.secrets.sync = await all(repo.secrets.sync);
2267
- if (repo.secrets.deploy) next.secrets.deploy = await all(repo.secrets.deploy);
2268
- }
2269
- if (repo.variables?.sync) next.variables = {
2270
- ...repo.variables,
2271
- sync: await all(repo.variables.sync)
2272
- };
2273
- out.repo = next;
2274
- }
2275
- if (config.githubApps) out.githubApps = await all(config.githubApps);
2276
- if (config.dev) out.dev = await named(config.dev);
2277
- const vault = config.providers.vault;
2278
- if (vault?.cardinality === "single" && vault.tuple.options.layer !== void 0) {
2279
- const { layer, ...options } = vault.tuple.options;
2280
- const resolved = await named({ layer });
2281
- out.providers = {
2282
- ...config.providers,
2283
- vault: {
2284
- cardinality: "single",
2285
- tuple: {
2286
- ...vault.tuple,
2287
- options: {
2288
- ...options,
2289
- environment: resolved.environment
2290
- }
2291
- }
2292
- }
2293
- };
2294
- }
2295
- return out;
2296
- }
2297
- // src/config/config-system.ts
2298
- /**
2299
- * Holocron's config system: `defineConfig`, `loadConfig` and `compose`, all built from one
2300
- * `createConfigSystem` call.
2301
- *
2302
- * File discovery, the walk up to `.git`, module loading (typed configs via `tsx`) and the derive-then-resolve flow come
2303
- * from `@theholocron/kyber/config`. The holocron-specific parts are `deriveDefaults` (name, `repo.name`, the task
2304
- * manifest), `placeAreas` (the `.holocron/` area files, placed before `deriveDefaults`), `resolveConfig` and `mergeStrategies`.
2305
- *
2306
- * The three functions live together because each is only a method of the one system object; splitting them back into
2307
- * one file apiece would just be pass-through wrappers (an exception to the one-function-per-file rule).
2308
- *
2309
- * Probe order is TS-first (`.ts` → `.js` → `.mjs` → `.cjs` → `.json`) —
2310
- * see ADR-0010 / issue #75 / #81.
2311
- */
2312
- const system$1 = createConfigSystem({
2313
- name: "holocron",
2314
- areas: HOLOCRON_AREAS,
2315
- shared: SHARED_AREAS,
2316
- place: placeAreas,
2317
- derive: deriveDefaults$1,
2318
- resolve: resolveConfig,
2319
- merge: mergeStrategies
2320
- });
2321
- system$1.defineConfig;
2322
- /**
2323
- * Read + parse + resolve `holocron.config.*` starting from the given
2324
- * directory, walking up through ancestors to the nearest `.git` boundary
2325
- * when `cwd` itself has no match — every command is usable from any
2326
- * subdirectory of a repo, not only its exact root (see
2327
- * `@theholocron/datapad`'s own doc comment for the stop conditions).
2328
- * Throws `ConfigFileError` when nothing is found or a file cannot
2329
- * be loaded, or `ConfigError` when the config fails schema checks.
2330
- *
2331
- * Every `layer` an entry names becomes the `environment` it stands for (`resolveLayers()`, spec
2332
- * `tech-environment-layers`, #2069), read from the `origin` remote at `cwd`; `input` lets a test pass a fake remote.
2333
- */
2334
- async function loadConfig(cwd, input = {}) {
2335
- const loaded = await system$1.loadConfig(cwd);
2336
- return {
2337
- ...loaded,
2338
- resolved: await resolveLayers(loaded.resolved, {
2339
- repoRoot: cwd,
2340
- ...input
2341
- })
2342
- };
2343
- }
2344
- system$1.compose;
2345
- // src/config/resolved-environment/resolved-environment.ts
2346
- /**
2347
- * The vault Environment a loaded config entry names. `loadConfig()` has already turned every `layer` into an
2348
- * `environment` (`resolveLayers()`), so a missing one means the config did not come through it; that is an error, never
2349
- * a guess (spec `tech-environment-layers`, #2069).
2350
- *
2351
- * @param entry - A `repo.secrets.sync`, `repo.secrets.deploy`, `repo.variables.sync` or `githubApps` entry.
2352
- * @throws {ConfigError} When the entry still has no `environment`.
2353
- */
2354
- function resolvedEnvironment(entry) {
2355
- if (entry.environment === void 0) throw new ConfigError$1(`an entry names the layer ${JSON.stringify(entry.layer)} but its Environment was not derived: load the config with loadConfig()`);
2356
- return entry.environment;
2357
- }
2358
- // src/commands/contexts/contexts.ts
2359
- /**
2360
- * Command → context. Keys are the full command path as it lands in
2361
- * yargs' `argv._` (`"new token"`, `"upgrade node"`), the bare verb
2362
- * otherwise; a longer, more specific key wins over its parent.
2363
- *
2364
- * - **`global`** — needs nothing but the CLI binary. Works anywhere.
2365
- * - **`repo-aware`** — reads `./holocron.config` + `./package.json`
2366
- * relative to cwd, but never touches the plugin loader.
2367
- * - **`workspace`** — needs the configured providers' plugin packages to
2368
- * resolve (devDeps in a repo, or `pnpm exec`).
2369
- */
2370
- const COMMAND_CONTEXTS = {
2371
- clone: "global",
2372
- "new repo": "global",
2373
- "new plugin": "global",
2374
- "upgrade node": "global",
2375
- "upgrade deps": "global",
2376
- "new token": "global",
2377
- "remove token": "global",
2378
- "list tokens": "global",
2379
- "export tokens": "workspace",
2380
- "export requests": "workspace",
2381
- "upload coverage": "workspace",
2382
- "new github-app": "global",
2383
- "check token": "global",
2384
- "publish bump-versions": "global",
2385
- "publish tag": "global",
2386
- "publish package": "global",
2387
- "install skills": "global",
2388
- "remove skill": "global",
2389
- "update skills": "global",
2390
- "list skills": "global",
2391
- "run lint commit-msg": "global",
2392
- run: "repo-aware",
2393
- "run ci": "repo-aware",
2394
- "deploy on-release": "repo-aware",
2395
- "deploy stage": "repo-aware",
2396
- "show config": "repo-aware",
2397
- "sync readme": "repo-aware",
2398
- doctor: "workspace",
2399
- setup: "workspace",
2400
- "list secrets": "workspace",
2401
- "new secret": "workspace",
2402
- "sync secrets": "workspace",
2403
- "new tunnel": "workspace",
2404
- "list projects": "workspace",
2405
- "new project": "workspace",
2406
- "close project": "workspace",
2407
- "setup project": "workspace",
2408
- dev: "workspace",
2409
- "dev serve": "repo-aware",
2410
- "new channel": "workspace",
2411
- "setup notifications": "workspace",
2412
- "link account": "workspace",
2413
- "new server": "workspace",
2414
- "sync roles": "workspace",
2415
- "cleanup posts": "workspace",
2416
- "sync specs": "workspace",
2417
- "reconcile project": "workspace",
2418
- "doctor all": "workspace",
2419
- "doctor notifications": "workspace",
2420
- "doctor environments": "workspace",
2421
- "doctor project": "workspace",
2422
- "doctor logs": "workspace",
2423
- "doctor github-app": "workspace",
2424
- "move issues": "workspace",
2425
- "apply properties": "workspace",
2426
- "migrate issue": "workspace",
2427
- "migrate issues": "workspace",
2428
- "migrate project": "workspace",
2429
- "doctor dns": "workspace",
2430
- "doctor repo": "workspace",
2431
- "doctor secrets": "workspace",
2432
- "doctor tokens": "workspace",
2433
- "doctor monitoring": "workspace",
2434
- "doctor ci": "repo-aware",
2435
- probe: "workspace",
2436
- provider: "workspace",
2437
- deploy: "workspace",
2438
- "deploy cleanup-preview": "workspace",
2439
- "check monitor": "workspace",
2440
- "resolve checks": "workspace",
2441
- "check resolved": "global",
2442
- sync: "workspace",
2443
- "cleanup branches": "workspace",
2444
- "sync github": "workspace",
2445
- "sync issues": "workspace",
2446
- "sync ideas": "workspace",
2447
- "sync tooling": "workspace",
2448
- "sync requests": "workspace",
2449
- "new spec": "workspace",
2450
- "new issue": "workspace"
2451
- };
2452
- /**
2453
- * The context for a command name from `argv._`. Falls back to the leading
2454
- * verb (`"auth foo"` → `"auth"`) and finally `undefined` for a name the
2455
- * map doesn't know — callers treat unknown as "don't guard".
2456
- */
2457
- function contextForCommand(name) {
2458
- const map = COMMAND_CONTEXTS;
2459
- const tokens = name.split(" ").filter(Boolean);
2460
- for (let n = tokens.length; n > 0; n--) {
2461
- const ctx = map[tokens.slice(0, n).join(" ")];
2462
- if (ctx) return ctx;
2463
- }
2464
- }
2465
- /** Command names in a given context, in registration order. */
2466
- function commandsInContext(context) {
2467
- return Object.entries(COMMAND_CONTEXTS).filter(([, c]) => c === context).map(([name]) => name);
2729
+ return {
2730
+ found,
2731
+ missing
2732
+ };
2468
2733
  }
2469
- // src/observability/logger/logger.ts
2470
- /**
2471
- * CLI-side wiring for `@theholocron/observability/logger`.
2472
- *
2473
- * `logger` is the operational-output channel — internal state, debug
2474
- * traces, errors, structured context that routes to Axiom. It runs in
2475
- * parallel to `print` (user-facing UX output) and does not replace it.
2476
- */
2477
- const env$9 = createEnvLookup();
2478
- const holocron = holocronEnv();
2734
+ // src/config/resolve-layers/resolve-layers.ts
2479
2735
  /**
2480
- * The CLI's Axiom dataset (`holocron`; each service has its own): the process environment (`HOLOCRON_AXIOM_DATASET`, then the unprefixed `AXIOM_DATASET`,
2481
- * through the prefix lookup), then the repo's `log.axiom.dataset`, then the credential chain, which is asked for the
2482
- * same pair of names through `resolveValue`'s `prefix` option.
2736
+ * Turns every `layer` in a loaded config into the `environment` it names (spec `tech-environment-layers`, #2069), so
2737
+ * the commands and doctors that read Environments see one literal name and none of them derives it again. The name is
2738
+ * `layerEnvironment()` over the `origin` remote of `input.repoRoot`, read at most once and only when an entry names a
2739
+ * layer. A remote that cannot be read is a `ConfigError` naming the `environment` option (`repoSlug()`); nothing is
2740
+ * guessed. Covers `repo.secrets.sync`, `repo.secrets.deploy`, `repo.variables.sync`, `githubApps`, `dev` and the
2741
+ * `vault` provider's `layer` option. Returns a new config; the one passed in is not changed.
2483
2742
  *
2484
- * A service's environments ship to the same dataset and are told apart by the `env` field on each line (ADR-0019). The
2485
- * config dataset is only a per-repo override, so a `global`-context command (`clone`, `new token`, `upgrade node`, ...,
2486
- * ADR-0012) leaves it out: it is not about any repo, and the repo it happens to run in must not choose where its
2487
- * lines go.
2743
+ * @param config - The resolved config, validated by `resolveConfig()`.
2744
+ * @param input - Where to read the remote, and how.
2745
+ * @returns The config with each `layer` replaced by its `environment`.
2488
2746
  */
2489
- function resolveCliDataset(opts, isGlobal) {
2490
- return holocron.get("AXIOM_DATASET") ?? (isGlobal ? void 0 : opts.configAxiomDataset) ?? resolveValue$1(["AXIOM_DATASET"], void 0, { prefix: PREFIX$1 });
2747
+ async function resolveLayers(config, input) {
2748
+ let slug;
2749
+ const named = async (entry) => {
2750
+ if (entry.layer === void 0) return entry;
2751
+ const { layer, ...rest } = entry;
2752
+ slug ??= repoSlug(input.repoRoot, input.gitExec);
2753
+ return {
2754
+ ...rest,
2755
+ environment: layerEnvironment(await slug, layer)
2756
+ };
2757
+ };
2758
+ const all = (list) => Promise.all(list.map(named));
2759
+ const out = { ...config };
2760
+ const { repo } = config;
2761
+ if (repo) {
2762
+ const next = { ...repo };
2763
+ if (repo.secrets) {
2764
+ next.secrets = { ...repo.secrets };
2765
+ if (repo.secrets.sync) next.secrets.sync = await all(repo.secrets.sync);
2766
+ if (repo.secrets.deploy) next.secrets.deploy = await all(repo.secrets.deploy);
2767
+ }
2768
+ if (repo.variables?.sync) next.variables = {
2769
+ ...repo.variables,
2770
+ sync: await all(repo.variables.sync)
2771
+ };
2772
+ out.repo = next;
2773
+ }
2774
+ if (config.githubApps) out.githubApps = await all(config.githubApps);
2775
+ if (config.dev) out.dev = await named(config.dev);
2776
+ const vault = config.providers.vault;
2777
+ if (vault?.cardinality === "single" && vault.tuple.options.layer !== void 0) {
2778
+ const { layer, ...options } = vault.tuple.options;
2779
+ const resolved = await named({ layer });
2780
+ out.providers = {
2781
+ ...config.providers,
2782
+ vault: {
2783
+ cardinality: "single",
2784
+ tuple: {
2785
+ ...vault.tuple,
2786
+ options: {
2787
+ ...options,
2788
+ environment: resolved.environment
2789
+ }
2790
+ }
2791
+ }
2792
+ };
2793
+ }
2794
+ return out;
2491
2795
  }
2796
+ // src/config/config-system.ts
2492
2797
  /**
2493
- * Resolve Axiom credentials for the CLI.
2798
+ * Holocron's config system: `defineConfig`, `loadConfig` and `compose`, all built from one
2799
+ * `createConfigSystem` call.
2494
2800
  *
2495
- * Env vars win (same contract as `@theholocron/observability`'s `resolveAxiomFromEnv`), falling back to the CLI-only
2496
- * bridge that pairs the OS-keyring token (`axiom.<org>` then bare `axiom`) with the dataset from
2497
- * {@link resolveCliDataset}. Returns `undefined` unless both a token and a dataset are found, so a local run with
2498
- * neither stays off Axiom.
2801
+ * File discovery, the walk up to `.git`, module loading (typed configs via `tsx`) and the derive-then-resolve flow come
2802
+ * from `@theholocron/kyber/config`. The holocron-specific parts are `deriveDefaults` (name, `repo.name`, the task
2803
+ * manifest), `placeAreas` (the `.holocron/` area files, placed before `deriveDefaults`), `resolveConfig` and `mergeStrategies`.
2804
+ *
2805
+ * The three functions live together because each is only a method of the one system object; splitting them back into
2806
+ * one file apiece would just be pass-through wrappers (an exception to the one-function-per-file rule).
2807
+ *
2808
+ * Probe order is TS-first (`.ts` → `.js` → `.mjs` → `.cjs` → `.json`) —
2809
+ * see ADR-0010 / issue #75 / #81.
2499
2810
  */
2500
- function resolveCliAxiom(opts, ctx) {
2501
- const fromEnv = resolveAxiomFromEnv();
2502
- if (fromEnv) return fromEnv;
2503
- const dataset = resolveCliDataset(opts, contextForCommand(ctx.command ?? "") === "global");
2504
- if (!dataset) return void 0;
2505
- const org = opts.org ?? env$9.get(`${PREFIX$1}_ORG`);
2506
- const token = holocron.get("AXIOM_TOKEN") || (org ? keyring.get(`axiom.${org}`) : null) || keyring.get("axiom");
2507
- return token ? {
2508
- dataset,
2509
- token
2510
- } : void 0;
2511
- }
2512
- const logger = createCliLogger({
2513
- envPrefix: PREFIX$1,
2514
- resolveAxiom: resolveCliAxiom
2811
+ const system$1 = createConfigSystem({
2812
+ name: "holocron",
2813
+ areas: HOLOCRON_AREAS,
2814
+ shared: SHARED_AREAS,
2815
+ place: placeAreas,
2816
+ derive: deriveDefaults$1,
2817
+ resolve: resolveConfig,
2818
+ merge: mergeStrategies
2515
2819
  });
2820
+ system$1.defineConfig;
2516
2821
  /**
2517
- * The process-wide root logger, built once from `cli.ts`'s middleware and
2518
- * rebuilt at most once more when a handler supplies `holocron.config` context.
2519
- * See `createCliLogger` in `@theholocron/kyber/observability`.
2520
- */
2521
- const buildCliLogger = logger.buildCliLogger;
2522
- /** Lazily-memoized `Logger` for call sites with no `argv` in scope (yargs' `.fail()`). */
2523
- const getLogger = logger.getLogger;
2524
- /** Report a fatal, command-ending CLI error: printed with `style.fail` and logged. */
2525
- const reportError = logger.reportError;
2526
- /** The current root logger's correlation id, if a root has been built. */
2527
- const getRunId = logger.getRunId;
2528
- logger.resetCliLogger;
2529
- logger.resolveLogLevel;
2530
- // src/observability/resolve-telemetry/resolve-telemetry.ts
2531
- const env$8 = holocronEnv();
2532
- /**
2533
- * Holocron-specific credential resolution for the telemetry sinks — the env
2534
- * chain plus Holocron's own shipped fallbacks. This is **CLI policy**, not part
2535
- * of the portable adapter set: `sentry-sink.ts` / `posthog-sink.ts` take a
2536
- * resolved DSN / key and never read the environment. When the adapters move to
2537
- * `@theholocron/observability` (#635) this module stays here.
2538
- *
2539
- * errors: HOLOCRON_SENTRY_DSN → SENTRY_DSN → FALLBACK_DSN
2540
- * analytics: HOLOCRON_POSTHOG_PROJECT_TOKEN → POSTHOG_PROJECT_TOKEN → FALLBACK_POSTHOG_PROJECT_TOKEN
2541
- * host: HOLOCRON_POSTHOG_HOST → POSTHOG_HOST → DEFAULT_POSTHOG_HOST
2822
+ * Read + parse + resolve `holocron.config.*` starting from the given
2823
+ * directory, walking up through ancestors to the nearest `.git` boundary
2824
+ * when `cwd` itself has no match — every command is usable from any
2825
+ * subdirectory of a repo, not only its exact root (see
2826
+ * `@theholocron/datapad`'s own doc comment for the stop conditions).
2827
+ * Throws `ConfigFileError` when nothing is found or a file cannot
2828
+ * be loaded, or `ConfigError` when the config fails schema checks.
2542
2829
  *
2543
- * The `SENTRY_DSN` / `POSTHOG_PROJECT_TOKEN` fallbacks are the vendor-native
2544
- * names a consumer repo sets to route CLI telemetry to its own project. The
2545
- * built-in fallbacks are ingest-only keys — publishable by design, same risk
2546
- * model as ADR-0007 / ADR-0008.
2830
+ * Every `layer` an entry names becomes the `environment` it stands for (`resolveLayers()`, spec
2831
+ * `tech-environment-layers`, #2069), read from the `origin` remote at `cwd`; `input` lets a test pass a fake remote.
2547
2832
  */
2548
- /** Holocron's own Sentry project — the fallback when no env var points elsewhere. */
2549
- const FALLBACK_DSN = "https://95cbb72ad5636c94e119a5405ee8f55f@o4508238154104832.ingest.us.sentry.io/4511810950791168";
2550
- /** Holocron's own PostHog project write key — ingest-only. */
2551
- const FALLBACK_POSTHOG_PROJECT_TOKEN = "phc_AC4vFCvYzwnzmG7Vg5nEc3PZKZztoPyfKp4Lb9BbXcLK";
2552
- const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
2553
- /** Resolve the Sentry DSN. `""` → error telemetry disabled. */
2554
- function resolveDsn() {
2555
- return env$8.get("SENTRY_DSN") ?? FALLBACK_DSN;
2556
- }
2557
- /** Resolve the PostHog project key. `""` → usage analytics disabled. */
2558
- function resolvePostHogKey() {
2559
- return env$8.get("POSTHOG_PROJECT_TOKEN") ?? FALLBACK_POSTHOG_PROJECT_TOKEN;
2560
- }
2561
- /** Resolve the PostHog ingest host. */
2562
- function resolvePostHogHost() {
2563
- return env$8.get("POSTHOG_HOST") ?? DEFAULT_POSTHOG_HOST;
2833
+ async function loadConfig(cwd, input = {}) {
2834
+ const loaded = await system$1.loadConfig(cwd);
2835
+ return {
2836
+ ...loaded,
2837
+ resolved: await resolveLayers(loaded.resolved, {
2838
+ repoRoot: cwd,
2839
+ ...input
2840
+ })
2841
+ };
2564
2842
  }
2565
- // src/observability/telemetry/telemetry.ts
2843
+ system$1.compose;
2844
+ // src/config/resolved-environment/resolved-environment.ts
2566
2845
  /**
2567
- * CLI self-telemetry — errors (Sentry), usage analytics (PostHog).
2846
+ * The vault Environment a loaded config entry names. `loadConfig()` has already turned every `layer` into an
2847
+ * `environment` (`resolveLayers()`), so a missing one means the config did not come through it; that is an error, never
2848
+ * a guess (spec `tech-environment-layers`, #2069).
2568
2849
  *
2569
- * The orchestration is `createCliTelemetry` in `@theholocron/kyber/observability`
2570
- * (no vendor SDK import here either: the sinks live in `@theholocron/observability`).
2571
- * This module binds it to Holocron's values: the `HOLOCRON` env prefix, the
2572
- * credentials resolved by `resolve-telemetry.ts`, and the logger's run id.
2573
- * The single kill switch is `HOLOCRON_TELEMETRY=false` (legacy alias
2574
- * `NO_HOLOCRON_TELEMETRY`); see ADR-0007 / ADR-0008.
2850
+ * @param entry - A `repo.secrets.sync`, `repo.secrets.deploy`, `repo.variables.sync` or `githubApps` entry.
2851
+ * @throws {ConfigError} When the entry still has no `environment`.
2575
2852
  */
2576
- const telemetry = createCliTelemetry({
2577
- envPrefix: PREFIX$1,
2578
- dsn: resolveDsn,
2579
- posthogKey: resolvePostHogKey,
2580
- posthogHost: resolvePostHogHost,
2581
- getRunId: () => getRunId()
2582
- });
2583
- /** Install the live sinks unless telemetry is opted out or a credential is empty. */
2584
- const init = telemetry.init;
2585
- /** Apply the `telemetry` config block; it only ever narrows what `init` turned on. */
2586
- const applyConfig = telemetry.applyConfig;
2587
- /** Capture a PostHog event, scrubbed of secrets. */
2588
- const event = telemetry.event;
2589
- /** Start a command span; call the returned function with the outcome. */
2590
- const startCommand = telemetry.startCommand;
2591
- /** Report an error to Sentry. */
2592
- const captureException = telemetry.captureException;
2593
- /** End the Sentry session. */
2594
- const endSession = telemetry.endSession;
2595
- /** Drain both sinks and return to the no-ops. */
2596
- const flush = telemetry.flush;
2597
- telemetry.resetTelemetry;
2853
+ function resolvedEnvironment(entry) {
2854
+ if (entry.environment === void 0) throw new ConfigError$1(`an entry names the layer ${JSON.stringify(entry.layer)} but its Environment was not derived: load the config with loadConfig()`);
2855
+ return entry.environment;
2856
+ }
2598
2857
  // src/commands/resolve-org/resolve-org.ts
2599
2858
  const env$7 = createEnvLookup();
2600
2859
  /**
@@ -17460,31 +17719,6 @@ const listCommand = {
17460
17719
  builder: (y) => y.command(secretsListCommand).command(projectListCommand).command(authListCommand).command(skillsListCommand).command(groupMenu("list")),
17461
17720
  handler: () => {}
17462
17721
  };
17463
- // src/commands/menu/menu.command.ts
17464
- /**
17465
- * Print the dim version line once per terminal session — keyed by the
17466
- * parent shell's PID, since that's stable across repeated bare `holocron`
17467
- * invocations in the same shell but changes in a new tab/window. A marker
17468
- * file in the OS tmpdir tracks whether this shell has already seen it, so
17469
- * re-running `holocron` doesn't repeat the line every time.
17470
- */
17471
- function printVersionHeaderOnce(version) {
17472
- const marker = join(tmpdir(), `.holocron-version-shown-${process.ppid}`);
17473
- if (existsSync(marker)) return;
17474
- console.log(style.dim(`v${version}`));
17475
- writeFileSync(marker, "");
17476
- }
17477
- /** Bare `holocron` (hidden from --help): a menu of every command, with this repo's runnable tasks merged in. */
17478
- const menuCommand = (version) => ({
17479
- command: "$0",
17480
- describe: false,
17481
- builder: (y) => y,
17482
- handler: async (argv) => {
17483
- printVersionHeaderOnce(version);
17484
- const runEntries = buildRunMenuEntries(await listRunnableTasks(argv));
17485
- await launchMenu([...COMMAND_REGISTRY, ...runEntries], argv);
17486
- }
17487
- });
17488
17722
  // src/commands/migrate/parse-limit/parse-limit.ts
17489
17723
  /**
17490
17724
  * Reads `--limit`: a positive whole number, or undefined when the flag was not given. Anything else (zero, a negative
@@ -29216,13 +29450,47 @@ const uploadCoverageCommand = {
29216
29450
  if (report.status === "fail") process.exitCode = 1;
29217
29451
  }
29218
29452
  };
29219
- // src/commands/upload/upload.command.ts
29220
- const uploadCommand = {
29221
- command: "upload",
29222
- describe: "Upload what a run produced (coverage reports) to the service that keeps it",
29223
- builder: (y) => y.command(uploadCoverageCommand).command(groupMenu("upload")),
29224
- handler: () => {}
29225
- };
29453
+ // src/cli/command-modules/command-modules.ts
29454
+ /**
29455
+ * Every top-level command module the binary registers, in the order its help lists them (the menu, which needs the
29456
+ * CLI's version, is registered beside them in `cli.ts`). One list, so the binary and the tests that walk the command
29457
+ * surface (the menu's option drift guard) cannot disagree about what is registered.
29458
+ */
29459
+ const COMMAND_MODULES = [
29460
+ cloneCommand,
29461
+ doctorCommand,
29462
+ installCommand,
29463
+ updateCommand,
29464
+ runCommand,
29465
+ showCommand,
29466
+ checkCommand,
29467
+ exportCommand,
29468
+ {
29469
+ command: "upload",
29470
+ describe: "Upload what a run produced (coverage reports) to the service that keeps it",
29471
+ builder: (y) => y.command(uploadCoverageCommand).command(groupMenu("upload")),
29472
+ handler: () => {}
29473
+ },
29474
+ setupCommand,
29475
+ upgradeCommand,
29476
+ cleanupCommand,
29477
+ applyCommand,
29478
+ newCommand,
29479
+ listCommand,
29480
+ removeCommand,
29481
+ probeCommand,
29482
+ providerCommand,
29483
+ linkCommand,
29484
+ closeCommand,
29485
+ moveCommand,
29486
+ migrateCommand,
29487
+ devCommand,
29488
+ syncCommand,
29489
+ publishCommand,
29490
+ deployCommand,
29491
+ resolveCommand,
29492
+ reconcileCommand
29493
+ ];
29226
29494
  // src/cli/own-package-json.ts
29227
29495
  /**
29228
29496
  * The `name` and `version` of the package that `moduleUrl` belongs to, from the nearest `package.json` above it.
@@ -29299,7 +29567,7 @@ try {
29299
29567
  org: argv.org
29300
29568
  });
29301
29569
  finishCommand = startCommand(name);
29302
- }).command(cloneCommand).command(doctorCommand).command(installCommand).command(updateCommand).command(runCommand).command(showCommand).command(checkCommand).command(exportCommand).command(uploadCommand).command(menuCommand(CLI_VERSION)).command(setupCommand).command(upgradeCommand).command(cleanupCommand).command(applyCommand).command(newCommand).command(listCommand).command(removeCommand).command(probeCommand).command(providerCommand).command(linkCommand).command(closeCommand).command(moveCommand).command(migrateCommand).command(devCommand).command(syncCommand).command(publishCommand).command(deployCommand).command(resolveCommand).command(reconcileCommand).strict().help().epilogue(`Execution contexts:
29570
+ }).command(COMMAND_MODULES).command(menuCommand(CLI_VERSION)).strict().help().epilogue(`Execution contexts:
29303
29571
  global works from a bare 'npm i -g': ${commandsInContext("global").join(", ")}\n repo-aware needs ./holocron.config in cwd: ${commandsInContext("repo-aware").join(", ")}\n workspace also needs the plugin packages: ${commandsInContext("workspace").join(", ")}\n https://docs.theholocron.dev/holocron/execution-contexts`).fail((msg, err) => {
29304
29572
  if (err instanceof Error && USER_FACING_ERRORS.has(err.name)) {
29305
29573
  captureException(err);