@theholocron/cli 5.0.0-alpha.423 → 5.0.0-alpha.425

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
@@ -375,6 +375,28 @@ const ideasSyncEntry = {
375
375
  skipOptions: ["yes"],
376
376
  supportsDryRun: true
377
377
  };
378
+ // src/commands/issue-create/issue-create.entry.ts
379
+ const issueCreateEntry = {
380
+ name: "new issue",
381
+ description: "File an issue in the repo's tracker",
382
+ positionals: [{
383
+ key: "title",
384
+ message: "Title:",
385
+ type: "input"
386
+ }],
387
+ options: [{
388
+ key: "body",
389
+ flag: "--body",
390
+ type: "input",
391
+ message: "Text:"
392
+ }],
393
+ skipOptions: [
394
+ "label",
395
+ "milestone",
396
+ "yes"
397
+ ],
398
+ supportsDryRun: true
399
+ };
378
400
  // src/commands/migrate/migrate-issue/migrate-issue.entry.ts
379
401
  const migrateIssueEntry = {
380
402
  name: "migrate issue",
@@ -1058,6 +1080,7 @@ const registry = createCommandRegistry([
1058
1080
  },
1059
1081
  ideasSyncEntry,
1060
1082
  ideasPromoteEntry,
1083
+ issueCreateEntry,
1061
1084
  {
1062
1085
  name: "sync readme",
1063
1086
  description: "Sync the Installation + Usage block in README.md from package.json",
@@ -2352,7 +2375,8 @@ const COMMAND_CONTEXTS = {
2352
2375
  "sync github": "workspace",
2353
2376
  "sync issues": "workspace",
2354
2377
  "sync ideas": "workspace",
2355
- "new spec": "workspace"
2378
+ "new spec": "workspace",
2379
+ "new issue": "workspace"
2356
2380
  };
2357
2381
  /**
2358
2382
  * The context for a command name from `argv._`. Falls back to the leading
@@ -2877,6 +2901,34 @@ async function loadAvatar(source, baseDir = process.cwd(), fetchImpl = fetch) {
2877
2901
  if (!type) throw new Error("it is not a PNG, JPEG or GIF image, which are the formats providers accept");
2878
2902
  return `data:${type};base64,${bytes.toString("base64")}`;
2879
2903
  }
2904
+ // src/commands/secrets-sync/repo-name/repo-name.ts
2905
+ /** `holocron` from `holocron` or `theholocron/holocron`: the config accepts both, the provider takes the name. */
2906
+ function repoName(repo) {
2907
+ return repo.slice(repo.indexOf("/") + 1);
2908
+ }
2909
+ // src/commands/notifications-channel-add/layout-secret-scope.ts
2910
+ /**
2911
+ * Where the notification secrets are written, with who may read them (spec `tech-org-secret-visibility`, #2131).
2912
+ * A repository or environment scope is returned as it is. An organization scope gets visibility `selected` and the
2913
+ * layout's `readers` (as repository names in that organization), so a Discord webhook is never readable by every
2914
+ * repository. It fails closed: no `readers` is a problem naming the field, not a silent `all`, and a reader outside the
2915
+ * organization is one too. An existing secret with another visibility is narrowed when it is written again.
2916
+ *
2917
+ * @param scope - The scope the run writes to.
2918
+ * @param readers - The layout's `readers`, as `owner/repo`.
2919
+ * @returns The scope to write to, or why there is none.
2920
+ */
2921
+ function layoutSecretScope(scope, readers) {
2922
+ if (scope.kind !== "organization") return { scope };
2923
+ if (!readers || readers.length === 0) return { problem: `the notification secrets would be readable by every repository of ${scope.name}: list the repositories that read them in the layout's \`readers\` (for example ["${scope.name}/<repo>"])` };
2924
+ const outside = readers.filter((r) => !r.startsWith(`${scope.name}/`));
2925
+ if (outside.length > 0) return { problem: `\`readers\` must be repositories of ${scope.name} (owner/repo); not: ${outside.join(", ")}` };
2926
+ return { scope: {
2927
+ ...scope,
2928
+ visibility: "selected",
2929
+ repos: [...new Set(readers.map(repoName))]
2930
+ } };
2931
+ }
2880
2932
  // src/commands/notifications-channel-add/notifications-channel-add.ts
2881
2933
  /**
2882
2934
  * `holocron new channel` — create one channel (and, with
@@ -3181,11 +3233,16 @@ async function runNotificationsChannelAdd(input) {
3181
3233
  secrets = loader.get("secrets");
3182
3234
  }
3183
3235
  const org = input.context.org;
3184
- const scope = input.scope ?? (org ? {
3236
+ let scope = input.scope ?? (org ? {
3185
3237
  kind: "organization",
3186
3238
  name: org
3187
3239
  } : void 0);
3188
3240
  if (input.withWebhook && !scope && !dryRun) throw new Error("no org to store the webhook secret under — pass --scope or set `org` in holocron.config.ts");
3241
+ if (input.withWebhook && scope && !dryRun) {
3242
+ const narrowed = layoutSecretScope(scope, notifications.layout?.readers);
3243
+ if ("problem" in narrowed) throw new Error(narrowed.problem);
3244
+ scope = narrowed.scope;
3245
+ }
3189
3246
  if (secrets && scope && !dryRun) await assertSecretsReachable(secrets, scope);
3190
3247
  const channel = await provisionChannel({
3191
3248
  notifications,
@@ -6558,12 +6615,12 @@ async function runDoctorTokens(input) {
6558
6615
  try {
6559
6616
  module = await importer(pkg);
6560
6617
  } catch (err) {
6561
- rows.push(row$11(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
6618
+ rows.push(row$12(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
6562
6619
  continue;
6563
6620
  }
6564
6621
  for (const token of module.tokens ?? []) rows.push(await checkToken$1(token, module, env, readToken, now()));
6565
6622
  }
6566
- if (rows.length === 0) rows.push(row$11("tokens", "skip", "no configured plugin lists the tokens it takes"));
6623
+ if (rows.length === 0) rows.push(row$12("tokens", "skip", "no configured plugin lists the tokens it takes"));
6567
6624
  printCheckRows(rows, print);
6568
6625
  const summary = summariseChecks(rows);
6569
6626
  printCheckSummary(summary, print);
@@ -6595,11 +6652,11 @@ async function loadCredentials(input) {
6595
6652
  try {
6596
6653
  await loader.load();
6597
6654
  } catch (err) {
6598
- return [row$11("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
6655
+ return [row$12("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
6599
6656
  }
6600
- return loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$11(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
6657
+ return loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$12(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
6601
6658
  }
6602
- function row$11(id, status, detail) {
6659
+ function row$12(id, status, detail) {
6603
6660
  return {
6604
6661
  id,
6605
6662
  title: id,
@@ -6613,21 +6670,21 @@ async function checkToken$1(token, module, env, readToken, now) {
6613
6670
  const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
6614
6671
  const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
6615
6672
  const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
6616
- if (!value) return row$11(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
6673
+ if (!value) return row$12(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
6617
6674
  const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
6618
- if (!verify) return row$11(keyringKey, "skip", "set, but its plugin cannot verify it");
6675
+ if (!verify) return row$12(keyringKey, "skip", "set, but its plugin cannot verify it");
6619
6676
  const from = fromEnv ?? stored?.source ?? "keyring";
6620
6677
  try {
6621
6678
  const verified = await verify(value);
6622
- if (!verified.ok) return row$11(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
6679
+ if (!verified.ok) return row$12(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
6623
6680
  const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
6624
- if (!expiry) return row$11(keyringKey, "ok", `${verified.subject} (${from})`);
6681
+ if (!expiry) return row$12(keyringKey, "ok", `${verified.subject} (${from})`);
6625
6682
  return expiry.soon ? {
6626
- ...row$11(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
6683
+ ...row$12(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
6627
6684
  problems: [`${expiry.text}: renew it`]
6628
- } : row$11(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
6685
+ } : row$12(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
6629
6686
  } catch (err) {
6630
- return row$11(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
6687
+ return row$12(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
6631
6688
  }
6632
6689
  }
6633
6690
  // src/commands/doctor-tokens/doctor-tokens.command.ts
@@ -6686,7 +6743,7 @@ async function runDoctorCredentials(input) {
6686
6743
  };
6687
6744
  }
6688
6745
  /** A row for the provider as a whole, or for one of its variables when `name` is given. */
6689
- function row$10(provider, status, detail, name) {
6746
+ function row$11(provider, status, detail, name) {
6690
6747
  return name === void 0 ? {
6691
6748
  id: provider,
6692
6749
  title: provider,
@@ -6703,8 +6760,8 @@ function row$10(provider, status, detail, name) {
6703
6760
  }
6704
6761
  async function checkCredentials(input, loader) {
6705
6762
  const { resolved } = input.loaded;
6706
- if (!resolved.providers.credentials) return [row$10("credentials", "skip", "no `credentials` provider is configured")];
6707
- const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$10(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
6763
+ if (!resolved.providers.credentials) return [row$11("credentials", "skip", "no `credentials` provider is configured")];
6764
+ const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$11(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
6708
6765
  if (!loader.has("credentials")) return rows;
6709
6766
  const expected = await expectedTokens(input);
6710
6767
  const { tuples } = resolved.providers.credentials;
@@ -6712,7 +6769,7 @@ async function checkCredentials(input, loader) {
6712
6769
  const tuple = tuples.find((t) => t.provider === impl.providerName);
6713
6770
  const explicit = tuple && credentialsEnvironment(tuple, resolved);
6714
6771
  if (!explicit && !derivesEnvironment(impl.providerName)) {
6715
- rows.push(row$10(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
6772
+ rows.push(row$11(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
6716
6773
  continue;
6717
6774
  }
6718
6775
  try {
@@ -6723,7 +6780,7 @@ async function checkCredentials(input, loader) {
6723
6780
  });
6724
6781
  rows.push(...await checkProvider(impl, candidates, expected));
6725
6782
  } catch (err) {
6726
- rows.push(row$10(impl.providerName, "fail", errorMessage(err)));
6783
+ rows.push(row$11(impl.providerName, "fail", errorMessage(err)));
6727
6784
  }
6728
6785
  }
6729
6786
  return rows;
@@ -6735,25 +6792,25 @@ async function checkCredentials(input, loader) {
6735
6792
  */
6736
6793
  async function checkProvider(impl, candidates, expected) {
6737
6794
  const provider = impl.providerName;
6738
- if (!impl.inspect) return [row$10(provider, "skip", "cannot list the variables without reading their values")];
6739
- if (expected.length === 0) return [row$10(provider, "skip", "no configured plugin lists the tokens it takes")];
6740
- if (candidates.length === 0) return [row$10(provider, "skip", "the `test` layer reads no Environment")];
6795
+ if (!impl.inspect) return [row$11(provider, "skip", "cannot list the variables without reading their values")];
6796
+ if (expected.length === 0) return [row$11(provider, "skip", "no configured plugin lists the tokens it takes")];
6797
+ if (candidates.length === 0) return [row$11(provider, "skip", "the `test` layer reads no Environment")];
6741
6798
  const inspect = impl.inspect.bind(impl);
6742
6799
  try {
6743
6800
  const { found, missing } = await tryEnvironments(candidates, inspect);
6744
- const rows = missing.map((name) => row$10(provider, "fail", `${provider} has no Environment named "${name}"`));
6801
+ const rows = missing.map((name) => row$11(provider, "fail", `${provider} has no Environment named "${name}"`));
6745
6802
  const labels = found.map(({ name, result }) => result.environment === name ? `"${name}"` : `"${result.environment}" (the config writes "${name}")`);
6746
6803
  const where = labels.join(", ");
6747
6804
  if (found.length === 0) return rows;
6748
6805
  for (const { name, optional } of expected) {
6749
6806
  const at = found.findIndex((f) => f.result.names.includes(name));
6750
- if (at >= 0) rows.push(row$10(provider, "ok", `present in ${labels[at]}`, name));
6751
- else if (optional) rows.push(row$10(provider, "skip", `optional, not set in ${where}`, name));
6752
- else rows.push(row$10(provider, "fail", `missing from ${where}`, name));
6807
+ if (at >= 0) rows.push(row$11(provider, "ok", `present in ${labels[at]}`, name));
6808
+ else if (optional) rows.push(row$11(provider, "skip", `optional, not set in ${where}`, name));
6809
+ else rows.push(row$11(provider, "fail", `missing from ${where}`, name));
6753
6810
  }
6754
6811
  return rows;
6755
6812
  } catch (err) {
6756
- return [row$10(provider, "fail", errorMessage(err))];
6813
+ return [row$11(provider, "fail", errorMessage(err))];
6757
6814
  }
6758
6815
  }
6759
6816
  /**
@@ -7043,7 +7100,7 @@ async function runDoctorDns(input) {
7043
7100
  });
7044
7101
  else if (!loader.has("dns")) {
7045
7102
  const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
7046
- for (const zone of zones) rows.push(row$9(zone, "skip", why));
7103
+ for (const zone of zones) rows.push(row$10(zone, "skip", why));
7047
7104
  for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
7048
7105
  } else {
7049
7106
  const dns = loader.get("dns");
@@ -7065,7 +7122,7 @@ async function runDoctorDns(input) {
7065
7122
  ...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
7066
7123
  };
7067
7124
  }
7068
- function row$9(zone, status, detail, problems = []) {
7125
+ function row$10(zone, status, detail, problems = []) {
7069
7126
  return {
7070
7127
  id: `dns-${zone}`,
7071
7128
  title: `${zone} records exist`,
@@ -7094,7 +7151,7 @@ async function checkDomain(dns, deploy, project, hostname) {
7094
7151
  return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
7095
7152
  }
7096
7153
  }
7097
- async function checkZone(dns, zone, wanted, rowOf = (...args) => row$9(zone, ...args)) {
7154
+ async function checkZone(dns, zone, wanted, rowOf = (...args) => row$10(zone, ...args)) {
7098
7155
  try {
7099
7156
  const have = await dns.listRecords(zone);
7100
7157
  const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
@@ -7229,7 +7286,7 @@ function installationSettingsUrl(account, id) {
7229
7286
  return `https://github.com/settings/installations/${id}`;
7230
7287
  }
7231
7288
  // src/commands/doctor-github-app/app-rows.ts
7232
- const row$8 = (name, what, problems, ok) => ({
7289
+ const row$9 = (name, what, problems, ok) => ({
7233
7290
  id: `${name}:${what}`,
7234
7291
  title: `${name}: ${what}`,
7235
7292
  status: problems.length > 0 ? "fail" : "ok",
@@ -7256,9 +7313,9 @@ function appRows(name, manifest, app, installations) {
7256
7313
  return [`${who} has not accepted the current App: ${gaps.join("; ")}`, `fix: ${who} accepts the update at ${url}`];
7257
7314
  });
7258
7315
  return [
7259
- row$8(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
7260
- row$8(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
7261
- row$8(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
7316
+ row$9(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
7317
+ row$9(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
7318
+ row$9(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
7262
7319
  ];
7263
7320
  }
7264
7321
  // src/commands/doctor-github-app/parse-manifest.ts
@@ -7316,7 +7373,7 @@ async function runDoctorGitHubApp(input) {
7316
7373
  assertPluginsResolvable$1(loader, "doctor github-app");
7317
7374
  }
7318
7375
  const rows = [];
7319
- if (instances.length === 0) rows.push(row$7("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
7376
+ if (instances.length === 0) rows.push(row$8("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
7320
7377
  for (const instance of instances) rows.push(...await checkInstance(instance, loader, input));
7321
7378
  printCheckRows(rows, print);
7322
7379
  const summary = summariseChecks(rows);
@@ -7333,7 +7390,7 @@ async function runDoctorGitHubApp(input) {
7333
7390
  ...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
7334
7391
  };
7335
7392
  }
7336
- function row$7(name, what, status, detail) {
7393
+ function row$8(name, what, status, detail) {
7337
7394
  return {
7338
7395
  id: `${name}:${what}`,
7339
7396
  title: `${name}: ${what}`,
@@ -7374,19 +7431,19 @@ async function checkInstance(instance, loader, input) {
7374
7431
  try {
7375
7432
  manifest = parseManifest(readManifest(instance.manifest));
7376
7433
  } catch (err) {
7377
- return [row$7(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
7434
+ return [row$8(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
7378
7435
  }
7379
7436
  const read = await readCredentials(instance, loader);
7380
- if ("reason" in read) return [row$7(name, "reachable", "skip", read.reason)];
7437
+ if ("reason" in read) return [row$8(name, "reachable", "skip", read.reason)];
7381
7438
  const api = input.api ?? defaultApi;
7382
7439
  const secrets = [read.creds.privateKey];
7383
7440
  try {
7384
7441
  const app = await api.getApp(read.creds);
7385
7442
  const installations = await api.listAppInstallations(read.creds);
7386
7443
  const owner = app.owner ? `, owned by ${app.owner.login}` : "";
7387
- return [row$7(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`), ...appRows(name, manifest, app, installations)];
7444
+ return [row$8(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`), ...appRows(name, manifest, app, installations)];
7388
7445
  } catch (err) {
7389
- return [row$7(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
7446
+ return [row$8(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
7390
7447
  }
7391
7448
  }
7392
7449
  // src/commands/doctor-github-app/doctor-github-app.command.ts
@@ -7453,7 +7510,7 @@ function datasetTargets(config) {
7453
7510
  * dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
7454
7511
  * a name, a token or a response that cannot be read is a skip with the reason.
7455
7512
  */
7456
- const row$6 = (id, title, status, detail, problems = []) => ({
7513
+ const row$7 = (id, title, status, detail, problems = []) => ({
7457
7514
  id,
7458
7515
  title,
7459
7516
  status,
@@ -7470,7 +7527,7 @@ async function runDoctorLogs(input) {
7470
7527
  if (!loader.has("logs")) {
7471
7528
  const failure = loader.loadFailures().find((f) => f.key === "logs");
7472
7529
  const why = failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `logs` provider is configured in holocron.config.ts";
7473
- rows.push(row$6("logs", "logs", "skip", why));
7530
+ rows.push(row$7("logs", "logs", "skip", why));
7474
7531
  } else rows.push(...await checkLogs(loader.get("logs"), datasetTargets(input.loaded.resolved)));
7475
7532
  printCheckRows(rows, print);
7476
7533
  const summary = summariseChecks(rows);
@@ -7494,38 +7551,38 @@ async function checkLogs(logs, targets) {
7494
7551
  for (const target of targets) {
7495
7552
  const id = `logs:dataset:${target.id}`;
7496
7553
  const title = `dataset for ${target.label}`;
7497
- if (!target.name) rows.push(row$6(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
7498
- else if (!token.usable) rows.push(row$6(id, title, "skip", `${target.name}: not checked, the token is not usable`));
7499
- else if (!logs.readDataset) rows.push(row$6(id, title, "skip", `${logs.providerName} cannot read a dataset`));
7554
+ if (!target.name) rows.push(row$7(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
7555
+ else if (!token.usable) rows.push(row$7(id, title, "skip", `${target.name}: not checked, the token is not usable`));
7556
+ else if (!logs.readDataset) rows.push(row$7(id, title, "skip", `${logs.providerName} cannot read a dataset`));
7500
7557
  else rows.push(...await checkDataset(logs, target, target.name, id, title));
7501
7558
  }
7502
7559
  const org = resolveValue$2(["AXIOM_ORG"], void 0, { prefix: PREFIX });
7503
- rows.push(org ? row$6("logs:org", "organization", "ok", `${PREFIX}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$6("logs:org", "organization", "skip", `${PREFIX}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links and check-dispatched need it`));
7560
+ rows.push(org ? row$7("logs:org", "organization", "ok", `${PREFIX}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$7("logs:org", "organization", "skip", `${PREFIX}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links and check-dispatched need it`));
7504
7561
  return rows;
7505
7562
  }
7506
7563
  /** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
7507
7564
  async function checkToken(logs) {
7508
7565
  const title = "token is accepted";
7509
7566
  if (!logs.checkToken) return {
7510
- row: row$6("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
7567
+ row: row$7("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
7511
7568
  usable: true
7512
7569
  };
7513
7570
  try {
7514
7571
  const result = await logs.checkToken();
7515
7572
  if (result.ok) return {
7516
- row: row$6("logs:token", title, "ok", `${logs.providerName} accepts the token`),
7573
+ row: row$7("logs:token", title, "ok", `${logs.providerName} accepts the token`),
7517
7574
  usable: true
7518
7575
  };
7519
7576
  const reason = result.reason ?? `${logs.providerName} refused the token`;
7520
7577
  return {
7521
- row: row$6("logs:token", title, "fail", reason, [reason]),
7578
+ row: row$7("logs:token", title, "fail", reason, [reason]),
7522
7579
  usable: false
7523
7580
  };
7524
7581
  } catch (err) {
7525
7582
  const noToken = missingTokenReason(err);
7526
7583
  const detail = noToken ?? `could not check the token: ${describeError(err)}`;
7527
7584
  return {
7528
- row: row$6("logs:token", title, "skip", detail),
7585
+ row: row$7("logs:token", title, "skip", detail),
7529
7586
  usable: noToken === void 0
7530
7587
  };
7531
7588
  }
@@ -7535,13 +7592,13 @@ async function checkDataset(logs, target, name, id, title) {
7535
7592
  const found = await logs.readDataset(name);
7536
7593
  if (!found.exists) {
7537
7594
  const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
7538
- return [row$6(id, title, "fail", `${name} does not exist`, [problem])];
7595
+ return [row$7(id, title, "fail", `${name} does not exist`, [problem])];
7539
7596
  }
7540
7597
  const retention = found.retentionDays === void 0 ? `retention: ${logs.providerName} did not report one for ${name}` : `retention: ${found.retentionDays} days for ${name}`;
7541
- return [row$6(id, title, "ok", `${name} exists`), row$6(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
7598
+ return [row$7(id, title, "ok", `${name} exists`), row$7(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
7542
7599
  } catch (err) {
7543
7600
  const detail = missingTokenReason(err) ?? `could not read ${name}: ${describeError(err)}`;
7544
- return [row$6(id, title, "skip", detail)];
7601
+ return [row$7(id, title, "skip", detail)];
7545
7602
  }
7546
7603
  }
7547
7604
  // src/commands/doctor-logs/doctor-logs.command.ts
@@ -8250,7 +8307,7 @@ async function runNotificationsSetup(input$1) {
8250
8307
  secrets = loader.get("secrets");
8251
8308
  }
8252
8309
  const org = input$1.context.org;
8253
- const scope = input$1.scope ?? (org ? {
8310
+ let scope = input$1.scope ?? (org ? {
8254
8311
  kind: "organization",
8255
8312
  name: org
8256
8313
  } : void 0);
@@ -8300,10 +8357,15 @@ async function runNotificationsSetup(input$1) {
8300
8357
  return refuse(`webhook avatar ${errorMessage(err)}`);
8301
8358
  }
8302
8359
  }
8303
- if (secrets && scope && !dryRun) try {
8304
- await assertSecretsReachable(secrets, scope);
8305
- } catch (err) {
8306
- return refuse(errorMessage(err), logReason(err));
8360
+ if (secrets && scope && !dryRun) {
8361
+ const narrowed = layoutSecretScope(scope, layout.readers);
8362
+ if ("problem" in narrowed) return refuse(narrowed.problem);
8363
+ scope = narrowed.scope;
8364
+ try {
8365
+ await assertSecretsReachable(secrets, scope);
8366
+ } catch (err) {
8367
+ return refuse(errorMessage(err), logReason(err));
8368
+ }
8307
8369
  }
8308
8370
  const secretProblem = layoutSecretProblem(layout);
8309
8371
  if (secretProblem) return refuse(secretProblem);
@@ -10478,7 +10540,7 @@ const info = (id, title, noun, extras) => ({
10478
10540
  detail: `info: ${extras.length} ${noun} not in the template (never deleted)`,
10479
10541
  problems: extras
10480
10542
  });
10481
- const row$5 = (id, title, problems, ok) => ({
10543
+ const row$6 = (id, title, problems, ok) => ({
10482
10544
  id,
10483
10545
  title,
10484
10546
  status: problems.length > 0 ? "fail" : "ok",
@@ -10514,19 +10576,19 @@ function viewProblems(want, found) {
10514
10576
  function boardRows(boardName, template, state) {
10515
10577
  const id = `project:${boardName}`;
10516
10578
  const rows = [];
10517
- rows.push(row$5(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
10579
+ rows.push(row$6(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
10518
10580
  const extraStatuses = state.statuses.filter((s) => !template.statuses.some((t) => t.name === s));
10519
10581
  if (extraStatuses.length > 0) rows.push(info(`${id}:extra-statuses`, `${boardName}: extra statuses`, "status(es)", extraStatuses));
10520
- for (const want of template.fields) rows.push(row$5(`${id}:field:${want.name}`, `${boardName}: field ${want.name}`, fieldProblems(want, state.fields.find((f) => f.name === want.name)), want.options ? `${want.options.length} options in order` : want.type));
10582
+ for (const want of template.fields) rows.push(row$6(`${id}:field:${want.name}`, `${boardName}: field ${want.name}`, fieldProblems(want, state.fields.find((f) => f.name === want.name)), want.options ? `${want.options.length} options in order` : want.type));
10521
10583
  const extraFields = state.fields.filter((f) => !template.fields.some((t) => t.name === f.name));
10522
10584
  if (extraFields.length > 0) rows.push(info(`${id}:extra-fields`, `${boardName}: extra fields`, "field(s)", extraFields.map((f) => f.name)));
10523
- for (const want of template.views) rows.push(row$5(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
10585
+ for (const want of template.views) rows.push(row$6(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
10524
10586
  const extraViews = state.views.filter((v) => !template.views.some((t) => t.name === v.name));
10525
10587
  if (extraViews.length > 0) rows.push(info(`${id}:extra-views`, `${boardName}: extra views`, "view(s)", extraViews.map((v) => v.name)));
10526
10588
  for (const name of template.rules ?? []) {
10527
10589
  const found = state.rules.find((r) => r.name === name);
10528
10590
  const problems = !found ? [`missing rule ${name}`] : found.enabled ? [] : [`rule ${name} is off`];
10529
- rows.push(row$5(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
10591
+ rows.push(row$6(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
10530
10592
  }
10531
10593
  return rows;
10532
10594
  }
@@ -10586,7 +10648,7 @@ function itemRows(boardName, items) {
10586
10648
  * never fail the run. A template file that does not read is a failure naming the file. `--post [channel]` shares the
10587
10649
  * failing rows through the `notifications` provider's bot, like `doctor notifications --post`.
10588
10650
  */
10589
- const row$4 = (id, title, status, detail, problems = []) => ({
10651
+ const row$5 = (id, title, status, detail, problems = []) => ({
10590
10652
  id,
10591
10653
  title,
10592
10654
  status,
@@ -10640,14 +10702,14 @@ async function checkBoards(input, loader) {
10640
10702
  loader,
10641
10703
  ...input.io ? { io: input.io } : {}
10642
10704
  });
10643
- if (!opened.ok) return [row$4("project", "project", opened.kind, opened.reason, opened.problems)];
10705
+ if (!opened.ok) return [row$5("project", "project", opened.kind, opened.reason, opened.problems)];
10644
10706
  const { projects, owner, boards, templates, templateProblems } = opened.context;
10645
10707
  const rows = templateProblems.map((problem) => {
10646
10708
  /* v8 ignore next -- split always returns at least one element; the fallback only satisfies noUncheckedIndexedAccess */
10647
10709
  const file = problem.split(": ")[0] ?? problem;
10648
- return row$4(`project:template:${file}`, `template file ${file}`, "fail", problem);
10710
+ return row$5(`project:template:${file}`, `template file ${file}`, "fail", problem);
10649
10711
  });
10650
- if (boards.length === 0) return [...rows, row$4("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
10712
+ if (boards.length === 0) return [...rows, row$5("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
10651
10713
  for (const declared of boards) {
10652
10714
  const template = templates[declared.template];
10653
10715
  const title = `${declared.name}: board exists and is open`;
@@ -10655,18 +10717,18 @@ async function checkBoards(input, loader) {
10655
10717
  const board = await projects.find(owner, declared.name);
10656
10718
  if (!board) {
10657
10719
  const closed = (await projects.list(owner)).some((b) => b.name === declared.name && b.closed);
10658
- rows.push(row$4(`project:${declared.name}`, title, "fail", closed ? "the board is closed" : "no open board has this name", [closed ? "reopen it, or run `holocron setup project` to make a new one" : "run `holocron setup project`"]));
10720
+ rows.push(row$5(`project:${declared.name}`, title, "fail", closed ? "the board is closed" : "no open board has this name", [closed ? "reopen it, or run `holocron setup project` to make a new one" : "run `holocron setup project`"]));
10659
10721
  continue;
10660
10722
  }
10661
- rows.push(row$4(`project:${declared.name}`, title, "ok", board.url));
10723
+ rows.push(row$5(`project:${declared.name}`, title, "ok", board.url));
10662
10724
  if (!template) {
10663
- rows.push(row$4(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
10725
+ rows.push(row$5(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
10664
10726
  continue;
10665
10727
  }
10666
10728
  rows.push(...boardRows(declared.name, template, await projects.read(owner, board)));
10667
- rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$4(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
10729
+ rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$5(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
10668
10730
  } catch (err) {
10669
- rows.push(row$4(`project:${declared.name}`, title, "fail", describeError(err)));
10731
+ rows.push(row$5(`project:${declared.name}`, title, "fail", describeError(err)));
10670
10732
  }
10671
10733
  }
10672
10734
  return rows;
@@ -11340,19 +11402,19 @@ async function runDoctorRepo(input) {
11340
11402
  const rows = [];
11341
11403
  if (!loader.has("source")) {
11342
11404
  const why = whyMissing(loader, "source", "no `source` provider to read the repository with");
11343
- for (const check of checks) rows.push(row$3(check, { skip: why }));
11405
+ for (const check of checks) rows.push(row$4(check, { skip: why }));
11344
11406
  } else {
11345
11407
  const source = loader.get("source");
11346
11408
  for (const check of checks) {
11347
11409
  if (typeof source[check.needs] !== "function") {
11348
- rows.push(row$3(check, { skip: `provider does not implement ${check.needs}` }));
11410
+ rows.push(row$4(check, { skip: `provider does not implement ${check.needs}` }));
11349
11411
  continue;
11350
11412
  }
11351
11413
  try {
11352
- rows.push(row$3(check, await check.run(source)));
11414
+ rows.push(row$4(check, await check.run(source)));
11353
11415
  } catch (err) {
11354
11416
  const noToken = missingTokenReason(err);
11355
- if (noToken !== void 0) rows.push(row$3(check, { skip: noToken }));
11417
+ if (noToken !== void 0) rows.push(row$4(check, { skip: noToken }));
11356
11418
  else rows.push({
11357
11419
  id: check.id,
11358
11420
  title: check.title,
@@ -11378,7 +11440,7 @@ async function runDoctorRepo(input) {
11378
11440
  ...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
11379
11441
  };
11380
11442
  }
11381
- function row$3(check, result) {
11443
+ function row$4(check, result) {
11382
11444
  const { id, title } = check;
11383
11445
  if ("skip" in result) return {
11384
11446
  id,
@@ -11677,11 +11739,6 @@ function expectedSecrets(config, layouts) {
11677
11739
  environments: Object.fromEntries(Object.entries(declared?.environments ?? {}).map(([env, names]) => [env, uniqueNames(names)]))
11678
11740
  };
11679
11741
  }
11680
- // src/commands/secrets-sync/repo-name/repo-name.ts
11681
- /** `holocron` from `holocron` or `theholocron/holocron`: the config accepts both, the provider takes the name. */
11682
- function repoName(repo) {
11683
- return repo.slice(repo.indexOf("/") + 1);
11684
- }
11685
11742
  // src/commands/doctor-secrets/synced-secrets.ts
11686
11743
  /**
11687
11744
  * The secrets `holocron sync secrets` fills from a vault, as `repo.secrets.sync` declares them: which names land at
@@ -11762,7 +11819,8 @@ async function runDoctorSecrets(input) {
11762
11819
  await loader.load();
11763
11820
  assertPluginsResolvable$1(loader, "doctor secrets");
11764
11821
  const config = input.loaded.resolved;
11765
- const expected = expectedSecrets(config, (loader.has("notifications") ? loader.get("notifications") : []).flatMap((p) => p.layout ? [p.layout] : []));
11822
+ const layouts = (loader.has("notifications") ? loader.get("notifications") : []).flatMap((p) => p.layout ? [p.layout] : []);
11823
+ const expected = expectedSecrets(config, layouts);
11766
11824
  const org = input.context.org ?? (input.context.repo ?? config.repo?.name ?? "").split("/")[0];
11767
11825
  const synced = await syncedSecrets(config.repo?.secrets?.sync ?? [], loader.has("vault") ? loader.get("vault") : { why: whyMissing(loader, "vault", "no `vault` provider to list the environment's keys with") });
11768
11826
  const foreignOrgs = /* @__PURE__ */ new Map();
@@ -11841,6 +11899,16 @@ async function runDoctorSecrets(input) {
11841
11899
  for (const name of names) entry.declared.set(name, [...new Set(repos)].sort());
11842
11900
  readers.set(scope.name, entry);
11843
11901
  }
11902
+ for (const layout of layouts) {
11903
+ if (!org || !layout.readers?.length) continue;
11904
+ const entry = readers.get(org) ?? {
11905
+ org,
11906
+ declared: /* @__PURE__ */ new Map()
11907
+ };
11908
+ const repos = [...new Set(layout.readers.map(repoName))].sort();
11909
+ for (const name of layoutSecretNames(layout)) entry.declared.set(name, repos);
11910
+ readers.set(org, entry);
11911
+ }
11844
11912
  for (const entry of readers.values()) rows.push(await accessRow(secrets, entry, entry.org === org));
11845
11913
  if (expected.org.length > 0) rows.push(await shadowRow(secrets, expected.org));
11846
11914
  }
@@ -12664,14 +12732,14 @@ async function runDoctorVariables(input) {
12664
12732
  });
12665
12733
  else if (!loader.has("source")) {
12666
12734
  const why = whyMissing(loader, "source", "no `source` provider to read them with");
12667
- for (const check of checks) rows.push(row$2(check, { skip: why }));
12735
+ for (const check of checks) rows.push(row$3(check, { skip: why }));
12668
12736
  } else {
12669
12737
  const source = loader.get("source");
12670
12738
  for (const check of checks) try {
12671
- rows.push(row$2(check, await check.run(source)));
12739
+ rows.push(row$3(check, await check.run(source)));
12672
12740
  } catch (err) {
12673
12741
  const noToken = missingTokenReason(err);
12674
- if (noToken !== void 0) rows.push(row$2(check, { skip: noToken }));
12742
+ if (noToken !== void 0) rows.push(row$3(check, { skip: noToken }));
12675
12743
  else rows.push({
12676
12744
  id: check.id,
12677
12745
  title: check.title,
@@ -12696,7 +12764,7 @@ async function runDoctorVariables(input) {
12696
12764
  ...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
12697
12765
  };
12698
12766
  }
12699
- function row$2(check, result) {
12767
+ function row$3(check, result) {
12700
12768
  const { id, title } = check;
12701
12769
  if ("skip" in result) return {
12702
12770
  id,
@@ -13770,6 +13838,12 @@ function hooksEnabled(input) {
13770
13838
  return config.repo?.protection === "strict";
13771
13839
  }
13772
13840
  // src/commands/repo-files/generate-config-files.ts
13841
+ /** Where a repo that hosts the reusables keeps the sources of its generated workflows and the actions they run. */
13842
+ const HOSTED_SOURCES = [
13843
+ "/ci/workflows",
13844
+ "/ci/workflows/*",
13845
+ "/ci/actions/*"
13846
+ ];
13773
13847
  function file(path, content, note) {
13774
13848
  const step = `write ${path}`;
13775
13849
  return {
@@ -13791,7 +13865,10 @@ async function generateConfigFiles(input) {
13791
13865
  const taskNames = (config.tasks ?? []).map((e) => typeof e === "string" ? e : e.name);
13792
13866
  const entries = [];
13793
13867
  if (taskNames.includes("bookkeeping")) entries.push(file(".github/labeler.yml", createLabeler()));
13794
- if (config.repo?.protection !== "none") entries.push(file(".github/dependabot.yml", createDependabot({ ignore: ownCatalogPackages(input.repoRoot) })), file(".github/dco.yml", createDco()));
13868
+ if (config.repo?.protection !== "none") entries.push(file(".github/dependabot.yml", createDependabot({
13869
+ ignore: ownCatalogPackages(input.repoRoot),
13870
+ sources: hostsReusables(input.repoRoot) ? HOSTED_SOURCES : []
13871
+ })), file(".github/dco.yml", createDco()));
13795
13872
  entries.push(file(".alexrc.json", createAlexrc()), file(".alexignore", createAlexignore()), file(".yamllint.yml", createYamllint()), file(".yamlignore", createYamlignore()), file(".editorconfig", createEditorconfig()), file(".editorconfig-checker.json", createEditorconfigChecker()), file("devmoji.config.cjs", createDevmoji()), file(".husky/prepare-commit-msg", createPrepareCommitMsg()), file(".husky/commit-msg", createCommitMsg(config.holocronScript)));
13796
13873
  if (hooksEnabled(input)) entries.push(file(".husky/pre-push", createPrePush(config.holocronScript), "runs `holocron run ci` before push — bypass with `git push --no-verify`"), file(".husky/pre-commit", createPreCommit(), "runs GitLeaks (staged-only) + lint-staged before commit"));
13797
13874
  else for (const hook of [".husky/pre-push", ".husky/pre-commit"]) entries.push({
@@ -16979,8 +17056,8 @@ function specName(title, name) {
16979
17056
  * `--yes` (without a terminal it refuses instead).
16980
17057
  */
16981
17058
  /** How many lines of the spec a dry run shows. */
16982
- const PREVIEW_LINES = 12;
16983
- const row$1 = (id, status, detail) => ({
17059
+ const PREVIEW_LINES$1 = 12;
17060
+ const row$2 = (id, status, detail) => ({
16984
17061
  id,
16985
17062
  title: id,
16986
17063
  status,
@@ -17010,7 +17087,7 @@ async function runIdeasPromote(input) {
17010
17087
  print(style.header(`Holocron new spec${dryRun ? " (dry-run)" : ""}`));
17011
17088
  print("");
17012
17089
  const entry = input.loaded.resolved.providers.issues;
17013
- if (!entry) return finish([row$1(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
17090
+ if (!entry) return finish([row$2(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
17014
17091
  const credentials = input.loaded.resolved.providers.credentials;
17015
17092
  /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
17016
17093
  const loader = input.loader ?? new PluginLoader({
@@ -17025,18 +17102,18 @@ async function runIdeasPromote(input) {
17025
17102
  assertPluginsResolvable$1(loader, "new spec");
17026
17103
  if (!loader.has("issues")) {
17027
17104
  const failure = loader.loadFailures().find((f) => f.key === "issues");
17028
- return finish([row$1(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
17105
+ return finish([row$2(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
17029
17106
  }
17030
17107
  let issue;
17031
17108
  try {
17032
17109
  issue = await loader.get("issues").get(input.issue);
17033
17110
  } catch (err) {
17034
- return finish([row$1(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
17111
+ return finish([row$2(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
17035
17112
  }
17036
17113
  const name = specName(issue.summary, input.name);
17037
- if (!name) return finish([row$1(issue.key, "fail", input.name === void 0 ? "no spec name can be made from the title; pass --name" : `"${input.name}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`)]);
17114
+ if (!name) return finish([row$2(issue.key, "fail", input.name === void 0 ? "no spec name can be made from the title; pass --name" : `"${input.name}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`)]);
17038
17115
  const relative = join(".notes", `${name}.spec.md`);
17039
- if (io.exists(join(input.context.repoRoot, relative))) return finish([row$1(relative, "fail", "the spec already exists; it is never overwritten")], relative);
17116
+ if (io.exists(join(input.context.repoRoot, relative))) return finish([row$2(relative, "fail", "the spec already exists; it is never overwritten")], relative);
17040
17117
  const { org, name: repoName } = input.loaded.resolved;
17041
17118
  const ref = githubRef(issue.url) ?? (issue.key.startsWith("#") ? `${org}/${repoName}${issue.key}` : issue.key);
17042
17119
  const { content, fromIdea } = buildSpec({
@@ -17047,9 +17124,9 @@ async function runIdeasPromote(input) {
17047
17124
  const origin = fromIdea ? `from ${issue.key}, which carries the idea marker` : `from ${issue.key}, which has no \`Filed from idea:\` marker (its text is used as it is)`;
17048
17125
  if (dryRun) {
17049
17126
  print(` ${relative}`);
17050
- for (const line of content.split("\n").slice(0, PREVIEW_LINES)) print(` ${style.skip(line)}`);
17127
+ for (const line of content.split("\n").slice(0, PREVIEW_LINES$1)) print(` ${style.skip(line)}`);
17051
17128
  print("");
17052
- return finish([row$1(relative, "skip", `would write the spec ${origin}`)], relative);
17129
+ return finish([row$2(relative, "skip", `would write the spec ${origin}`)], relative);
17053
17130
  }
17054
17131
  if (!input.yes) {
17055
17132
  if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`new spec\` writes ${relative}; pass --yes to run it without asking, or --dry-run to preview`);
@@ -17068,9 +17145,9 @@ async function runIdeasPromote(input) {
17068
17145
  try {
17069
17146
  io.write(join(input.context.repoRoot, relative), content);
17070
17147
  } catch (err) {
17071
- return finish([row$1(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
17148
+ return finish([row$2(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
17072
17149
  }
17073
- return finish([row$1(relative, "ok", `wrote the spec ${origin}`)], relative);
17150
+ return finish([row$2(relative, "ok", `wrote the spec ${origin}`)], relative);
17074
17151
  }
17075
17152
  // src/commands/ideas-promote/ideas-promote.command.ts
17076
17153
  const ideasPromoteCommand = {
@@ -17106,6 +17183,138 @@ const ideasPromoteCommand = {
17106
17183
  })).status === "fail") process.exitCode = 1;
17107
17184
  }
17108
17185
  };
17186
+ // src/commands/issue-create/run-issue-create/run-issue-create.ts
17187
+ /**
17188
+ * `holocron new issue` — files an issue through the repo's `issues` provider.
17189
+ *
17190
+ * The provider's `create` makes the issue (GitHub or Linear, whatever the config names), so the command knows nothing
17191
+ * of a tracker. It writes to a tracker, so it asks first unless `--dry-run` or `--yes` (without a terminal it refuses
17192
+ * instead). It does not look for a duplicate: filing the same title twice makes two issues.
17193
+ */
17194
+ /** How many lines of the body a dry run shows. */
17195
+ const PREVIEW_LINES = 8;
17196
+ const row$1 = (id, status, detail) => ({
17197
+ id,
17198
+ title: id,
17199
+ status,
17200
+ detail,
17201
+ problems: []
17202
+ });
17203
+ async function runIssueCreate(input) {
17204
+ /* v8 ignore next -- the console is only used outside tests, which inject `print` */
17205
+ const print = input.print ?? ((line) => console.log(line));
17206
+ const dryRun = Boolean(input.context.dryRun);
17207
+ const finish = (rows, key) => {
17208
+ printCheckRows(rows, print);
17209
+ const summary = summariseChecks(rows);
17210
+ printCheckSummary(summary, print);
17211
+ return {
17212
+ status: summary.fail > 0 ? "fail" : "ok",
17213
+ rows,
17214
+ ...key ? { key } : {}
17215
+ };
17216
+ };
17217
+ print(style.header(`Holocron new issue${dryRun ? " (dry-run)" : ""}`));
17218
+ print("");
17219
+ const title = input.title.trim();
17220
+ if (!title) return finish([row$1("title", "fail", "the title is empty")]);
17221
+ const entry = input.loaded.resolved.providers.issues;
17222
+ if (!entry) return finish([row$1(title, "fail", "the config has no `issues` provider to file the issue with")]);
17223
+ const credentials = input.loaded.resolved.providers.credentials;
17224
+ /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
17225
+ const loader = input.loader ?? new PluginLoader({
17226
+ ...input.loaded.resolved,
17227
+ providers: {
17228
+ issues: entry,
17229
+ ...credentials ? { credentials } : {}
17230
+ }
17231
+ }, input.context);
17232
+ /* v8 ignore stop */
17233
+ await loader.load();
17234
+ assertPluginsResolvable$1(loader, "new issue");
17235
+ if (!loader.has("issues")) {
17236
+ const failure = loader.loadFailures().find((f) => f.key === "issues");
17237
+ return finish([row$1(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
17238
+ }
17239
+ const labels = [...new Set((input.labels ?? []).map((l) => l.trim()).filter(Boolean))];
17240
+ const body = input.body?.trim() ? input.body : void 0;
17241
+ const milestone = input.milestone?.trim() ? input.milestone.trim() : void 0;
17242
+ const details = [labels.length > 0 ? `labels: ${labels.join(", ")}` : void 0, milestone ? `milestone: ${milestone}` : void 0].filter(Boolean);
17243
+ const summary = details.length > 0 ? ` (${details.join("; ")})` : "";
17244
+ if (dryRun) {
17245
+ print(` ${title}`);
17246
+ for (const line of (body ?? "").split("\n").slice(0, PREVIEW_LINES)) print(` ${style.skip(line)}`);
17247
+ print("");
17248
+ return finish([row$1(title, "skip", `would file the issue${summary}`)]);
17249
+ }
17250
+ if (!input.yes) {
17251
+ if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`new issue` files an issue; pass --yes to run it without asking, or --dry-run to preview");
17252
+ if (!await (input.confirm ?? ((message) => confirm({
17253
+ message,
17254
+ default: false
17255
+ })))(`File "${title}"${summary}?`)) {
17256
+ print(` ${style.skip("cancelled; nothing was filed")}`);
17257
+ return {
17258
+ status: "cancelled",
17259
+ rows: []
17260
+ };
17261
+ }
17262
+ }
17263
+ try {
17264
+ const { key } = await loader.get("issues").create({
17265
+ summary: title,
17266
+ ...body ? { body } : {},
17267
+ ...labels.length > 0 ? { labels } : {},
17268
+ ...milestone ? { milestone } : {}
17269
+ });
17270
+ return finish([row$1(title, "ok", `filed ${key}`)], key);
17271
+ } catch (err) {
17272
+ return finish([row$1(title, "fail", `could not file the issue: ${describeError(err)}`)]);
17273
+ }
17274
+ }
17275
+ // src/commands/issue-create/issue-create.command.ts
17276
+ const issueCreateCommand = {
17277
+ command: "issue <title>",
17278
+ describe: "File an issue in the repo's tracker",
17279
+ builder: (y) => y.positional("title", {
17280
+ type: "string",
17281
+ demandOption: true,
17282
+ describe: "The issue's title"
17283
+ }).option("body", {
17284
+ type: "string",
17285
+ describe: "The issue's text"
17286
+ }).option("label", {
17287
+ type: "string",
17288
+ array: true,
17289
+ describe: "A label to put on it (repeatable)"
17290
+ }).option("milestone", {
17291
+ type: "string",
17292
+ describe: "The milestone: its number or its exact title"
17293
+ }).option("yes", {
17294
+ type: "boolean",
17295
+ describe: "File without asking (required without a terminal)"
17296
+ }),
17297
+ handler: async (argv) => {
17298
+ const tokens = tokenContext$1(argv.token);
17299
+ if (!tokens) return;
17300
+ const loaded = await loadConfig(argv.cwd);
17301
+ applyResolvedConfig(argv, loaded.resolved);
17302
+ if ((await runIssueCreate({
17303
+ title: String(argv.title),
17304
+ loaded,
17305
+ context: {
17306
+ repoRoot: argv.cwd,
17307
+ dryRun: argv.dryRun,
17308
+ ...tokens,
17309
+ org: resolveOrg(argv, loaded.resolved)
17310
+ },
17311
+ ...argv.body ? { body: argv.body } : {},
17312
+ ...argv.label ? { labels: argv.label.map(String) } : {},
17313
+ ...argv.milestone ? { milestone: String(argv.milestone) } : {},
17314
+ ...argv.yes ? { yes: true } : {}
17315
+ })).status === "fail") process.exitCode = 1;
17316
+ }
17317
+ };
17109
17318
  // src/commands/notifications-channel-add/notifications-channel-add.args.ts
17110
17319
  const notificationsChannelAddArgs = (y) => y.positional("name", {
17111
17320
  type: "string",
@@ -19535,8 +19744,8 @@ const newRepoCommand = {
19535
19744
  // src/commands/new/new.command.ts
19536
19745
  const newCommand = {
19537
19746
  command: "new",
19538
- describe: "Create a repo, plugin, channel, server, secret, token, tunnel, GitHub App, project or spec",
19539
- builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(notificationsChannelAddCommand).command(githubAppCreateCommand).command(projectCreateCommand).command(secretSetCommand).command(notificationsCreateServerCommand).command(ideasPromoteCommand).command(authSetCommand).command(tunnelUpCommand).command(groupMenu$1("new")),
19747
+ describe: "Create a repo, plugin, channel, server, secret, token, tunnel, GitHub App, project, spec or issue",
19748
+ builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(notificationsChannelAddCommand).command(githubAppCreateCommand).command(projectCreateCommand).command(secretSetCommand).command(notificationsCreateServerCommand).command(ideasPromoteCommand).command(issueCreateCommand).command(authSetCommand).command(tunnelUpCommand).command(groupMenu$1("new")),
19540
19749
  handler: () => {}
19541
19750
  };
19542
19751
  // src/commands/probe/probe.args.ts