@theholocron/cli 5.0.0-alpha.528 → 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
  }
@@ -10390,13 +10390,14 @@ const extrasNote = (noun, extras) => extras.length > 0 ? `; info: ${extras.lengt
10390
10390
  * what `dev.suspendWhenIdle` wants of a development App while `holocron dev` is not running, and a prod App that is
10391
10391
  * suspended is for the person reading to notice. Never a failure.
10392
10392
  */
10393
- function suspensionRow(name, installations) {
10393
+ function statusRow(name, installations) {
10394
10394
  const suspended = installations.filter((i) => i.suspended);
10395
10395
  const who = (i) => i.account?.login ?? `installation ${i.id}`;
10396
- const detail = installations.length === 0 ? "no installations" : suspended.length === 0 ? `${installations.length} installation(s) active` : `${suspended.length} of ${installations.length} suspended, sent no webhooks (${suspended.map(who).join(", ")}); ${installations.length - suspended.length} active`;
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(", ")})`;
10397
10398
  return {
10398
- id: `${name}:suspension`,
10399
- title: `${name}: suspension`,
10399
+ id: `${name}:status`,
10400
+ title: `${name}: status`,
10400
10401
  status: "ok",
10401
10402
  detail,
10402
10403
  problems: []
@@ -10423,7 +10424,7 @@ function appRows(name, manifest, app, installations) {
10423
10424
  row$26(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
10424
10425
  row$26(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
10425
10426
  row$26(name, "installations", installationProblems, `${installations.length} installation(s) up to date`),
10426
- suspensionRow(name, installations)
10427
+ statusRow(name, installations)
10427
10428
  ];
10428
10429
  }
10429
10430
  // src/commands/webhook-deliveries/failed-deliveries.ts
@@ -19524,7 +19525,7 @@ async function runProbe(input) {
19524
19525
  };
19525
19526
  rows.push(clean);
19526
19527
  if (clean.status === "heading") print(`\n ${style.header(clean.label)}`);
19527
- 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 ?? ""]));
19528
19529
  };
19529
19530
  if (input.heading) emit({
19530
19531
  status: "heading",
@@ -20669,7 +20670,7 @@ async function runDoctor(input) {
20669
20670
  status: row.status,
20670
20671
  detail: row.logMessage ?? row.message
20671
20672
  }, `doctor: ${row.capability}`);
20672
- 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]));
20673
20674
  }
20674
20675
  const summary = rows.reduce((acc, r) => {
20675
20676
  acc[r.status] += 1;
@@ -24833,11 +24834,11 @@ function printBoard(input) {
24833
24834
  const { board, created, items } = placement;
24834
24835
  if (dryRun) {
24835
24836
  const state = created ? `would create from template ${template}` : "exists; would add the issues to it";
24836
- print(statusRow("skip", ["migrate", `board "${name}": ${state}`]));
24837
+ print(statusRow$1("skip", ["migrate", `board "${name}": ${state}`]));
24837
24838
  return;
24838
24839
  }
24839
24840
  const added = items.filter((i) => i.added).length;
24840
- 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})`]));
24841
24842
  }
24842
24843
  /**
24843
24844
  * Settles the owner and the template for the board `migrate project` puts issues on. The owner and the template
@@ -24888,7 +24889,7 @@ async function runMigrate(input) {
24888
24889
  const print = input.print ?? ((line) => console.log(line));
24889
24890
  const progress = input.progress ?? createProgress(print);
24890
24891
  const stop = (status, reason) => {
24891
- print(statusRow(status, ["migrate", reason]));
24892
+ print(statusRow$1(status, ["migrate", reason]));
24892
24893
  return {
24893
24894
  status,
24894
24895
  reason
@@ -24946,9 +24947,9 @@ async function runMigrate(input) {
24946
24947
  }));
24947
24948
  if (!collected.ok) return stop(collected.reason.startsWith("the `") ? "skip" : "fail", collected.reason);
24948
24949
  const { records, notes } = collected;
24949
- for (const note of notes) print(statusRow("skip", ["migrate", note]));
24950
+ for (const note of notes) print(statusRow$1("skip", ["migrate", note]));
24950
24951
  const limited = collected.limit === void 0 ? void 0 : describeLimit(records.length, collected.matched, input.order);
24951
- if (limited) print(statusRow("skip", ["migrate", limited]));
24952
+ if (limited) print(statusRow$1("skip", ["migrate", limited]));
24952
24953
  if (records.length === 0) return stop("skip", "nothing to migrate");
24953
24954
  const dryRun = Boolean(input.context.dryRun);
24954
24955
  const milestone = input.milestone ?? (projectScope && !plan ? projectScope.name : void 0);
@@ -24959,7 +24960,7 @@ async function runMigrate(input) {
24959
24960
  message,
24960
24961
  default: false
24961
24962
  })))(`Create ${records.length} issue(s) on ${target.provider} from ${source.provider}?`)) {
24962
- print(statusRow("skip", ["migrate", "cancelled; nothing was changed"]));
24963
+ print(statusRow$1("skip", ["migrate", "cancelled; nothing was changed"]));
24963
24964
  return { status: "cancelled" };
24964
24965
  }
24965
24966
  }
@@ -24972,10 +24973,10 @@ async function runMigrate(input) {
24972
24973
  }));
24973
24974
  for (const r of results) {
24974
24975
  const state = !r.created ? "already migrated" : dryRun ? "would create" : "created";
24975
- 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})`]));
24976
24977
  }
24977
24978
  const created = results.filter((r) => r.created).length;
24978
- 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}`]));
24979
24980
  let placement;
24980
24981
  if (plan) {
24981
24982
  placement = await progress.run(`Placing issues on the ${plan.name} board…`, () => placeOnBoard({
@@ -25153,7 +25154,7 @@ const migrateCommand = {
25153
25154
  async function runProjectMove(input) {
25154
25155
  const print = input.print ?? ((line) => console.log(line));
25155
25156
  const stop = (status, reason) => {
25156
- print(statusRow(status, ["move issues", reason]));
25157
+ print(statusRow$1(status, ["move issues", reason]));
25157
25158
  return {
25158
25159
  status,
25159
25160
  reason
@@ -25188,7 +25189,7 @@ async function runProjectMove(input) {
25188
25189
  if (!projects.items) return stop("skip", `the \`${projects.providerName}\` provider cannot list items to preview`);
25189
25190
  try {
25190
25191
  const preview = previewMove(await projects.items(owner, from, template), await projects.items(owner, to, template));
25191
- print(statusRow("skip", ["move issues", "dry run: nothing was moved"]));
25192
+ print(statusRow$1("skip", ["move issues", "dry run: nothing was moved"]));
25192
25193
  printReport(preview, print, true);
25193
25194
  return {
25194
25195
  status: "ok",
@@ -25204,13 +25205,13 @@ async function runProjectMove(input) {
25204
25205
  message,
25205
25206
  default: false
25206
25207
  })))(`Move the open items of "${from.name}" to "${to.name}"?`)) {
25207
- print(statusRow("skip", ["move issues", "cancelled; nothing was changed"]));
25208
+ print(statusRow$1("skip", ["move issues", "cancelled; nothing was changed"]));
25208
25209
  return { status: "cancelled" };
25209
25210
  }
25210
25211
  }
25211
25212
  try {
25212
25213
  const moved = await projects.move(owner, from, to, template);
25213
- print(statusRow("ok", ["move issues", `"${from.name}" to "${to.name}"`]));
25214
+ print(statusRow$1("ok", ["move issues", `"${from.name}" to "${to.name}"`]));
25214
25215
  printReport(moved, print, false);
25215
25216
  return {
25216
25217
  status: "ok",
@@ -31180,7 +31181,7 @@ async function runProbeCommand(input) {
31180
31181
  }
31181
31182
  const probes = groups.get(input.provider);
31182
31183
  if (!probes) {
31183
- 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(", ")}`]));
31184
31185
  return { status: "fail" };
31185
31186
  }
31186
31187
  if (!input.probe) {
@@ -31189,7 +31190,7 @@ async function runProbeCommand(input) {
31189
31190
  }
31190
31191
  const probe = probes[input.probe];
31191
31192
  if (!probe) {
31192
- 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(", ")}`]));
31193
31194
  return { status: "fail" };
31194
31195
  }
31195
31196
  let layer;
@@ -31246,7 +31247,7 @@ async function runProbeCommand(input) {
31246
31247
  args: []
31247
31248
  };
31248
31249
  } catch (err) {
31249
- print(statusRow("fail", [`\`${input.provider} ${input.probe}\``, commandFailureMessage(err)]));
31250
+ print(statusRow$1("fail", [`\`${input.provider} ${input.probe}\``, commandFailureMessage(err)]));
31250
31251
  return { status: "fail" };
31251
31252
  }
31252
31253
  }
@@ -31287,7 +31288,7 @@ async function runProbeCommand(input) {
31287
31288
  }
31288
31289
  for (const missing of notHeld) {
31289
31290
  out(`\n ${style.header(missing.name)}`);
31290
- out(statusRow(missing.fails ? "fail" : "skip", [`not held in ${missing.environment}`]));
31291
+ out(statusRow$1(missing.fails ? "fail" : "skip", [`not held in ${missing.environment}`]));
31291
31292
  if (missing.fails) statuses.push("fail");
31292
31293
  }
31293
31294
  return { status: ["fail", "cancelled"].find((s) => statuses.includes(s)) ?? "ok" };
@@ -31352,7 +31353,7 @@ const projectCommand = {
31352
31353
  */
31353
31354
  const ACTIONS = ["setup", "doctor"];
31354
31355
  const fail = (print, ...text) => {
31355
- print(statusRow("fail", text));
31356
+ print(statusRow$1("fail", text));
31356
31357
  return {
31357
31358
  status: "fail",
31358
31359
  rows: []
@@ -31824,7 +31825,7 @@ async function filterNewPackages(entries, cwd, exec, print, nameWidth, dirWidth)
31824
31825
  ], { cwd });
31825
31826
  const publishedVersion = view.exitCode === 0 ? view.stdout.trim() : "";
31826
31827
  if (publishedVersion) {
31827
- print(statusRow("skip", [
31828
+ print(statusRow$1("skip", [
31828
31829
  pad$1(entry.name, nameWidth),
31829
31830
  pad$1(entry.dir, dirWidth),
31830
31831
  `already published (v${publishedVersion})`
@@ -32090,7 +32091,7 @@ async function runPublish(input = {}) {
32090
32091
  print(" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:");
32091
32092
  print(` pnpm --filter @theholocron/cli run start:source publish package --initial --otp <6-digit-code>`);
32092
32093
  }
32093
- for (const entry of newEntries) print(statusRow("fail", [
32094
+ for (const entry of newEntries) print(statusRow$1("fail", [
32094
32095
  pad$1(entry.name, nameWidth),
32095
32096
  pad$1(entry.dir, dirWidth),
32096
32097
  "publish failed"
@@ -32106,7 +32107,7 @@ async function runPublish(input = {}) {
32106
32107
  packageNames
32107
32108
  };
32108
32109
  }
32109
- for (const entry of newEntries) print(statusRow("ok", [
32110
+ for (const entry of newEntries) print(statusRow$1("ok", [
32110
32111
  pad$1(entry.name, nameWidth),
32111
32112
  pad$1(entry.dir, dirWidth),
32112
32113
  `published (v${entry.version})`
@@ -35213,7 +35214,7 @@ function feedOf(notifications, pages) {
35213
35214
  }
35214
35215
  async function runSyncIncidents(input) {
35215
35216
  const print = input.print ?? ((line) => console.log(line));
35216
- const row = (status, ...parts) => print(statusRow(status, ["sync incidents", ...parts]));
35217
+ const row = (status, ...parts) => print(statusRow$1(status, ["sync incidents", ...parts]));
35217
35218
  const stop = (status, reason) => {
35218
35219
  row(status, reason);
35219
35220
  return {
@@ -35503,7 +35504,7 @@ function applyAssignees(records, links) {
35503
35504
  async function runSyncIssues(input) {
35504
35505
  const print = input.print ?? ((line) => console.log(line));
35505
35506
  const progress = input.progress ?? createProgress(print);
35506
- const row = (status, text) => print(statusRow(status, ["sync issues", text]));
35507
+ const row = (status, text) => print(statusRow$1(status, ["sync issues", text]));
35507
35508
  const stop = (status, reason) => {
35508
35509
  row(status, reason);
35509
35510
  return {