@theholocron/cli 5.0.0-alpha.527 → 5.0.0-alpha.529

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
@@ -6,7 +6,7 @@ import { PREFIX as PREFIX$1, createEnvLookup, detectEnvironment, firstEnv, holoc
6
6
  import { ProviderApiError, ProviderApiError as ProviderApiError$1, createRestClient, onRetry } from "@theholocron/http-client";
7
7
  import { addGlobalOptions, groupMenu as groupMenu$1, tokenContext as tokenContext$1 } from "@theholocron/kyber/flags";
8
8
  import { checkForUpdates } from "@theholocron/kyber/notifier";
9
- import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, declaredVsActual, describeError, logReason, openPath, pad as pad$1, printCheckRows, printCheckSummary, sanitizeDetail, setProgressListener, statusRow, stripControl, style, summariseChecks, viewJson, withProgress, withSpinner } from "@theholocron/kyber/ui";
9
+ import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, declaredVsActual, describeError, logReason, openPath, pad as pad$1, printCheckRows, printCheckSummary, sanitizeDetail, setProgressListener, statusRow as statusRow$1, stripControl, style, summariseChecks, viewJson, withProgress, withSpinner } from "@theholocron/kyber/ui";
10
10
  import { LOG_LEVELS } from "@theholocron/observability/core";
11
11
  import yargs from "yargs";
12
12
  import { hideBin } from "yargs/helpers";
@@ -4885,7 +4885,7 @@ function capabilityValues() {
4885
4885
  async function runPropertiesApply(input) {
4886
4886
  const print = input.print ?? ((line) => console.log(line));
4887
4887
  const stop = (status, reason) => {
4888
- print(statusRow(status, ["apply properties", reason]));
4888
+ print(statusRow$1(status, ["apply properties", reason]));
4889
4889
  return {
4890
4890
  status,
4891
4891
  reason
@@ -4907,14 +4907,14 @@ async function runPropertiesApply(input) {
4907
4907
  return stop("fail", describeError(err));
4908
4908
  }
4909
4909
  if (missing.length === 0) {
4910
- print(statusRow("ok", ["apply properties", `${CAPABILITIES_PROPERTY} already allows every capability`]));
4910
+ print(statusRow$1("ok", ["apply properties", `${CAPABILITIES_PROPERTY} already allows every capability`]));
4911
4911
  return {
4912
4912
  status: "ok",
4913
4913
  added: []
4914
4914
  };
4915
4915
  }
4916
4916
  if (input.context.dryRun) {
4917
- print(statusRow("skip", ["apply properties", `dry run: would add ${missing.join(", ")}`]));
4917
+ print(statusRow$1("skip", ["apply properties", `dry run: would add ${missing.join(", ")}`]));
4918
4918
  return {
4919
4919
  status: "ok",
4920
4920
  added: missing
@@ -4926,13 +4926,13 @@ async function runPropertiesApply(input) {
4926
4926
  message,
4927
4927
  default: false
4928
4928
  })))(`Allow ${missing.join(", ")} in holocron_capabilities for the whole organization?`)) {
4929
- print(statusRow("skip", ["apply properties", "cancelled; nothing was changed"]));
4929
+ print(statusRow$1("skip", ["apply properties", "cancelled; nothing was changed"]));
4930
4930
  return { status: "cancelled" };
4931
4931
  }
4932
4932
  }
4933
4933
  try {
4934
4934
  const added = await source.addOrgPropertyValues(CAPABILITIES_PROPERTY, missing);
4935
- print(statusRow("ok", ["apply properties", `${CAPABILITIES_PROPERTY}: added ${added.join(", ") || "nothing"}`]));
4935
+ print(statusRow$1("ok", ["apply properties", `${CAPABILITIES_PROPERTY}: added ${added.join(", ") || "nothing"}`]));
4936
4936
  return {
4937
4937
  status: "ok",
4938
4938
  added
@@ -6242,7 +6242,7 @@ async function runClone(input) {
6242
6242
  for (const repo of repos) {
6243
6243
  const dest = join(targetDir, repoDirName(repo));
6244
6244
  if (existsSync(dest)) {
6245
- print(statusRow("skip", [
6245
+ print(statusRow$1("skip", [
6246
6246
  repo.full_name,
6247
6247
  dest,
6248
6248
  "already exists"
@@ -6258,7 +6258,7 @@ async function runClone(input) {
6258
6258
  print(style.step(` clone ${repo.full_name} → ${dest}`));
6259
6259
  const { clone_url } = repo;
6260
6260
  if (!clone_url.startsWith("https://github.com/")) {
6261
- print(statusRow("fail", [
6261
+ print(statusRow$1("fail", [
6262
6262
  repo.full_name,
6263
6263
  dest,
6264
6264
  `unexpected clone URL: ${clone_url}`
@@ -6270,7 +6270,7 @@ async function runClone(input) {
6270
6270
  try {
6271
6271
  encodedToken = encodeTokenForGitHttpAuth(input.token);
6272
6272
  } catch (err) {
6273
- print(statusRow("fail", [
6273
+ print(statusRow$1("fail", [
6274
6274
  repo.full_name,
6275
6275
  dest,
6276
6276
  `invalid token format: ${errorMessage(err)}`
@@ -6284,10 +6284,10 @@ async function runClone(input) {
6284
6284
  `https://x-access-token:${encodedToken}@github.com/${clone_url.slice(19)}`,
6285
6285
  dest
6286
6286
  ], { cwd: targetDir }).status !== 0) {
6287
- print(statusRow("fail", [repo.full_name, dest]));
6287
+ print(statusRow$1("fail", [repo.full_name, dest]));
6288
6288
  failed++;
6289
6289
  } else {
6290
- print(statusRow("ok", [repo.full_name, dest]));
6290
+ print(statusRow$1("ok", [repo.full_name, dest]));
6291
6291
  cloned++;
6292
6292
  }
6293
6293
  }
@@ -10386,6 +10386,24 @@ const row$26 = (name, what, problems, ok) => ({
10386
10386
  /** Extras are information only: they never fail a row, they are named in its detail. */
10387
10387
  const extrasNote = (noun, extras) => extras.length > 0 ? `; info: ${extras.length} ${noun} not in the manifest (${extras.join(", ")})` : "";
10388
10388
  /**
10389
+ * Whether each installation is active or suspended, as information only: a suspended one is sent no webhooks, which is
10390
+ * what `dev.suspendWhenIdle` wants of a development App while `holocron dev` is not running, and a prod App that is
10391
+ * suspended is for the person reading to notice. Never a failure.
10392
+ */
10393
+ function statusRow(name, installations) {
10394
+ const suspended = installations.filter((i) => i.suspended);
10395
+ const who = (i) => i.account?.login ?? `installation ${i.id}`;
10396
+ const count = `${installations.length} installation(s)`;
10397
+ const detail = installations.length === 0 ? "no installations" : suspended.length === 0 ? `${count} active` : suspended.length === installations.length ? `${count} suspended` : `${count}: ${installations.length - suspended.length} active, ${suspended.length} suspended (${suspended.map(who).join(", ")})`;
10398
+ return {
10399
+ id: `${name}:status`,
10400
+ title: `${name}: status`,
10401
+ status: "ok",
10402
+ detail,
10403
+ problems: []
10404
+ };
10405
+ }
10406
+ /**
10389
10407
  * The events, permissions and installations rows of one App instance: the manifest against the live App, and the live
10390
10408
  * App against what each installation has accepted. A row that fails ends with the page that fixes it.
10391
10409
  */
@@ -10405,7 +10423,8 @@ function appRows(name, manifest, app, installations) {
10405
10423
  return [
10406
10424
  row$26(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
10407
10425
  row$26(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
10408
- row$26(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
10426
+ row$26(name, "installations", installationProblems, `${installations.length} installation(s) up to date`),
10427
+ statusRow(name, installations)
10409
10428
  ];
10410
10429
  }
10411
10430
  // src/commands/webhook-deliveries/failed-deliveries.ts
@@ -19506,7 +19525,7 @@ async function runProbe(input) {
19506
19525
  };
19507
19526
  rows.push(clean);
19508
19527
  if (clean.status === "heading") print(`\n ${style.header(clean.label)}`);
19509
- else print(statusRow(clean.status === "info" ? "skip" : clean.status, [clean.label, clean.detail ?? ""]));
19528
+ else print(statusRow$1(clean.status === "info" ? "skip" : clean.status, [clean.label, clean.detail ?? ""]));
19510
19529
  };
19511
19530
  if (input.heading) emit({
19512
19531
  status: "heading",
@@ -20651,7 +20670,7 @@ async function runDoctor(input) {
20651
20670
  status: row.status,
20652
20671
  detail: row.logMessage ?? row.message
20653
20672
  }, `doctor: ${row.capability}`);
20654
- print(statusRow(row.status, [`${pad$1(row.capability, 14)} via ${pad$1(row.provider, 14)}`, row.message]));
20673
+ print(statusRow$1(row.status, [`${pad$1(row.capability, 14)} via ${pad$1(row.provider, 14)}`, row.message]));
20655
20674
  }
20656
20675
  const summary = rows.reduce((acc, r) => {
20657
20676
  acc[r.status] += 1;
@@ -24815,11 +24834,11 @@ function printBoard(input) {
24815
24834
  const { board, created, items } = placement;
24816
24835
  if (dryRun) {
24817
24836
  const state = created ? `would create from template ${template}` : "exists; would add the issues to it";
24818
- print(statusRow("skip", ["migrate", `board "${name}": ${state}`]));
24837
+ print(statusRow$1("skip", ["migrate", `board "${name}": ${state}`]));
24819
24838
  return;
24820
24839
  }
24821
24840
  const added = items.filter((i) => i.added).length;
24822
- print(statusRow("ok", ["migrate", `board "${name}": ${created ? "created" : "found"}, added ${added}, already there ${items.length - added} (${board?.url})`]));
24841
+ print(statusRow$1("ok", ["migrate", `board "${name}": ${created ? "created" : "found"}, added ${added}, already there ${items.length - added} (${board?.url})`]));
24823
24842
  }
24824
24843
  /**
24825
24844
  * Settles the owner and the template for the board `migrate project` puts issues on. The owner and the template
@@ -24870,7 +24889,7 @@ async function runMigrate(input) {
24870
24889
  const print = input.print ?? ((line) => console.log(line));
24871
24890
  const progress = input.progress ?? createProgress(print);
24872
24891
  const stop = (status, reason) => {
24873
- print(statusRow(status, ["migrate", reason]));
24892
+ print(statusRow$1(status, ["migrate", reason]));
24874
24893
  return {
24875
24894
  status,
24876
24895
  reason
@@ -24928,9 +24947,9 @@ async function runMigrate(input) {
24928
24947
  }));
24929
24948
  if (!collected.ok) return stop(collected.reason.startsWith("the `") ? "skip" : "fail", collected.reason);
24930
24949
  const { records, notes } = collected;
24931
- for (const note of notes) print(statusRow("skip", ["migrate", note]));
24950
+ for (const note of notes) print(statusRow$1("skip", ["migrate", note]));
24932
24951
  const limited = collected.limit === void 0 ? void 0 : describeLimit(records.length, collected.matched, input.order);
24933
- if (limited) print(statusRow("skip", ["migrate", limited]));
24952
+ if (limited) print(statusRow$1("skip", ["migrate", limited]));
24934
24953
  if (records.length === 0) return stop("skip", "nothing to migrate");
24935
24954
  const dryRun = Boolean(input.context.dryRun);
24936
24955
  const milestone = input.milestone ?? (projectScope && !plan ? projectScope.name : void 0);
@@ -24941,7 +24960,7 @@ async function runMigrate(input) {
24941
24960
  message,
24942
24961
  default: false
24943
24962
  })))(`Create ${records.length} issue(s) on ${target.provider} from ${source.provider}?`)) {
24944
- print(statusRow("skip", ["migrate", "cancelled; nothing was changed"]));
24963
+ print(statusRow$1("skip", ["migrate", "cancelled; nothing was changed"]));
24945
24964
  return { status: "cancelled" };
24946
24965
  }
24947
24966
  }
@@ -24954,10 +24973,10 @@ async function runMigrate(input) {
24954
24973
  }));
24955
24974
  for (const r of results) {
24956
24975
  const state = !r.created ? "already migrated" : dryRun ? "would create" : "created";
24957
- print(statusRow(r.created ? "ok" : "skip", ["migrate", `${r.source} → ${r.key ?? "(new)"} (${state})`]));
24976
+ print(statusRow$1(r.created ? "ok" : "skip", ["migrate", `${r.source} → ${r.key ?? "(new)"} (${state})`]));
24958
24977
  }
24959
24978
  const created = results.filter((r) => r.created).length;
24960
- print(statusRow(dryRun ? "skip" : "ok", ["migrate", `${where}: ${dryRun ? "dry run, nothing written; would create" : "created"} ${created}, skipped ${results.length - created}`]));
24979
+ print(statusRow$1(dryRun ? "skip" : "ok", ["migrate", `${where}: ${dryRun ? "dry run, nothing written; would create" : "created"} ${created}, skipped ${results.length - created}`]));
24961
24980
  let placement;
24962
24981
  if (plan) {
24963
24982
  placement = await progress.run(`Placing issues on the ${plan.name} board…`, () => placeOnBoard({
@@ -25135,7 +25154,7 @@ const migrateCommand = {
25135
25154
  async function runProjectMove(input) {
25136
25155
  const print = input.print ?? ((line) => console.log(line));
25137
25156
  const stop = (status, reason) => {
25138
- print(statusRow(status, ["move issues", reason]));
25157
+ print(statusRow$1(status, ["move issues", reason]));
25139
25158
  return {
25140
25159
  status,
25141
25160
  reason
@@ -25170,7 +25189,7 @@ async function runProjectMove(input) {
25170
25189
  if (!projects.items) return stop("skip", `the \`${projects.providerName}\` provider cannot list items to preview`);
25171
25190
  try {
25172
25191
  const preview = previewMove(await projects.items(owner, from, template), await projects.items(owner, to, template));
25173
- print(statusRow("skip", ["move issues", "dry run: nothing was moved"]));
25192
+ print(statusRow$1("skip", ["move issues", "dry run: nothing was moved"]));
25174
25193
  printReport(preview, print, true);
25175
25194
  return {
25176
25195
  status: "ok",
@@ -25186,13 +25205,13 @@ async function runProjectMove(input) {
25186
25205
  message,
25187
25206
  default: false
25188
25207
  })))(`Move the open items of "${from.name}" to "${to.name}"?`)) {
25189
- print(statusRow("skip", ["move issues", "cancelled; nothing was changed"]));
25208
+ print(statusRow$1("skip", ["move issues", "cancelled; nothing was changed"]));
25190
25209
  return { status: "cancelled" };
25191
25210
  }
25192
25211
  }
25193
25212
  try {
25194
25213
  const moved = await projects.move(owner, from, to, template);
25195
- print(statusRow("ok", ["move issues", `"${from.name}" to "${to.name}"`]));
25214
+ print(statusRow$1("ok", ["move issues", `"${from.name}" to "${to.name}"`]));
25196
25215
  printReport(moved, print, false);
25197
25216
  return {
25198
25217
  status: "ok",
@@ -31162,7 +31181,7 @@ async function runProbeCommand(input) {
31162
31181
  }
31163
31182
  const probes = groups.get(input.provider);
31164
31183
  if (!probes) {
31165
- print(statusRow("fail", [`no probes for \`${input.provider}\``, `try: ${[...groups.keys()].sort().join(", ")}`]));
31184
+ print(statusRow$1("fail", [`no probes for \`${input.provider}\``, `try: ${[...groups.keys()].sort().join(", ")}`]));
31166
31185
  return { status: "fail" };
31167
31186
  }
31168
31187
  if (!input.probe) {
@@ -31171,7 +31190,7 @@ async function runProbeCommand(input) {
31171
31190
  }
31172
31191
  const probe = probes[input.probe];
31173
31192
  if (!probe) {
31174
- print(statusRow("fail", [`\`${input.provider}\` has no probe \`${input.probe}\``, `try: ${Object.keys(probes).sort().join(", ")}`]));
31193
+ print(statusRow$1("fail", [`\`${input.provider}\` has no probe \`${input.probe}\``, `try: ${Object.keys(probes).sort().join(", ")}`]));
31175
31194
  return { status: "fail" };
31176
31195
  }
31177
31196
  let layer;
@@ -31228,7 +31247,7 @@ async function runProbeCommand(input) {
31228
31247
  args: []
31229
31248
  };
31230
31249
  } catch (err) {
31231
- print(statusRow("fail", [`\`${input.provider} ${input.probe}\``, commandFailureMessage(err)]));
31250
+ print(statusRow$1("fail", [`\`${input.provider} ${input.probe}\``, commandFailureMessage(err)]));
31232
31251
  return { status: "fail" };
31233
31252
  }
31234
31253
  }
@@ -31269,7 +31288,7 @@ async function runProbeCommand(input) {
31269
31288
  }
31270
31289
  for (const missing of notHeld) {
31271
31290
  out(`\n ${style.header(missing.name)}`);
31272
- out(statusRow(missing.fails ? "fail" : "skip", [`not held in ${missing.environment}`]));
31291
+ out(statusRow$1(missing.fails ? "fail" : "skip", [`not held in ${missing.environment}`]));
31273
31292
  if (missing.fails) statuses.push("fail");
31274
31293
  }
31275
31294
  return { status: ["fail", "cancelled"].find((s) => statuses.includes(s)) ?? "ok" };
@@ -31334,7 +31353,7 @@ const projectCommand = {
31334
31353
  */
31335
31354
  const ACTIONS = ["setup", "doctor"];
31336
31355
  const fail = (print, ...text) => {
31337
- print(statusRow("fail", text));
31356
+ print(statusRow$1("fail", text));
31338
31357
  return {
31339
31358
  status: "fail",
31340
31359
  rows: []
@@ -31806,7 +31825,7 @@ async function filterNewPackages(entries, cwd, exec, print, nameWidth, dirWidth)
31806
31825
  ], { cwd });
31807
31826
  const publishedVersion = view.exitCode === 0 ? view.stdout.trim() : "";
31808
31827
  if (publishedVersion) {
31809
- print(statusRow("skip", [
31828
+ print(statusRow$1("skip", [
31810
31829
  pad$1(entry.name, nameWidth),
31811
31830
  pad$1(entry.dir, dirWidth),
31812
31831
  `already published (v${publishedVersion})`
@@ -32072,7 +32091,7 @@ async function runPublish(input = {}) {
32072
32091
  print(" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:");
32073
32092
  print(` pnpm --filter @theholocron/cli run start:source publish package --initial --otp <6-digit-code>`);
32074
32093
  }
32075
- for (const entry of newEntries) print(statusRow("fail", [
32094
+ for (const entry of newEntries) print(statusRow$1("fail", [
32076
32095
  pad$1(entry.name, nameWidth),
32077
32096
  pad$1(entry.dir, dirWidth),
32078
32097
  "publish failed"
@@ -32088,7 +32107,7 @@ async function runPublish(input = {}) {
32088
32107
  packageNames
32089
32108
  };
32090
32109
  }
32091
- for (const entry of newEntries) print(statusRow("ok", [
32110
+ for (const entry of newEntries) print(statusRow$1("ok", [
32092
32111
  pad$1(entry.name, nameWidth),
32093
32112
  pad$1(entry.dir, dirWidth),
32094
32113
  `published (v${entry.version})`
@@ -35195,7 +35214,7 @@ function feedOf(notifications, pages) {
35195
35214
  }
35196
35215
  async function runSyncIncidents(input) {
35197
35216
  const print = input.print ?? ((line) => console.log(line));
35198
- const row = (status, ...parts) => print(statusRow(status, ["sync incidents", ...parts]));
35217
+ const row = (status, ...parts) => print(statusRow$1(status, ["sync incidents", ...parts]));
35199
35218
  const stop = (status, reason) => {
35200
35219
  row(status, reason);
35201
35220
  return {
@@ -35485,7 +35504,7 @@ function applyAssignees(records, links) {
35485
35504
  async function runSyncIssues(input) {
35486
35505
  const print = input.print ?? ((line) => console.log(line));
35487
35506
  const progress = input.progress ?? createProgress(print);
35488
- const row = (status, text) => print(statusRow(status, ["sync issues", text]));
35507
+ const row = (status, text) => print(statusRow$1(status, ["sync issues", text]));
35489
35508
  const stop = (status, reason) => {
35490
35509
  row(status, reason);
35491
35510
  return {