@theholocron/cli 5.0.0-alpha.536 → 5.0.0-alpha.538

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
@@ -149,7 +149,10 @@ const COMMAND_CONTEXTS = {
149
149
  "update issue": "workspace",
150
150
  "start work": "workspace",
151
151
  "update work": "workspace",
152
- "close work": "workspace"
152
+ "close work": "workspace",
153
+ "new incident": "workspace",
154
+ "update incident": "workspace",
155
+ "close incident": "workspace"
153
156
  };
154
157
  /**
155
158
  * The context for a command name from `argv._`. Falls back to the leading
@@ -320,6 +323,28 @@ const cloneEntry = {
320
323
  }],
321
324
  supportsDryRun: true
322
325
  };
326
+ // src/commands/close-incident/close-incident.entry.ts
327
+ const closeIncidentEntry = {
328
+ name: "close incident",
329
+ description: "Resolve a status page incident with a final update",
330
+ positionals: [{
331
+ key: "id",
332
+ message: "Incident id:",
333
+ type: "input"
334
+ }],
335
+ options: [{
336
+ key: "message",
337
+ flag: "--message",
338
+ type: "input",
339
+ message: "What the final update says:"
340
+ }],
341
+ skipOptions: [
342
+ "page",
343
+ "notify",
344
+ "yes"
345
+ ],
346
+ supportsDryRun: true
347
+ };
323
348
  // src/commands/close-work/close-work.entry.ts
324
349
  const closeWorkEntry = {
325
350
  name: "close work",
@@ -1186,6 +1211,35 @@ const newDomainEntry = {
1186
1211
  skipOptions: ["proxied", "yes"],
1187
1212
  supportsDryRun: true
1188
1213
  };
1214
+ // src/commands/new-incident/new-incident.entry.ts
1215
+ const newIncidentEntry = {
1216
+ name: "new incident",
1217
+ description: "Open an incident on a status page, with its first update and the components it marks",
1218
+ positionals: [{
1219
+ key: "title",
1220
+ message: "Incident title:",
1221
+ type: "input"
1222
+ }],
1223
+ options: [{
1224
+ key: "message",
1225
+ flag: "--message",
1226
+ type: "input",
1227
+ message: "What the first update says:"
1228
+ }, {
1229
+ key: "component",
1230
+ flag: "--component",
1231
+ type: "input",
1232
+ message: "Component to mark (<name>=<impact>):"
1233
+ }],
1234
+ skipOptions: [
1235
+ "page",
1236
+ "status",
1237
+ "allow-duplicate",
1238
+ "notify",
1239
+ "yes"
1240
+ ],
1241
+ supportsDryRun: true
1242
+ };
1189
1243
  // src/commands/new-work/new-work.entry.ts
1190
1244
  const newWorkEntry = {
1191
1245
  name: "new work",
@@ -2095,6 +2149,40 @@ const tunnelUpEntry = {
2095
2149
  ],
2096
2150
  supportsDryRun: true
2097
2151
  };
2152
+ // src/commands/update-incident/update-incident.entry.ts
2153
+ const updateIncidentEntry = {
2154
+ name: "update incident",
2155
+ description: "Append an update to a status page incident",
2156
+ positionals: [{
2157
+ key: "id",
2158
+ message: "Incident id:",
2159
+ type: "input"
2160
+ }],
2161
+ options: [{
2162
+ key: "status",
2163
+ flag: "--status",
2164
+ type: "select",
2165
+ choices: [
2166
+ "investigating",
2167
+ "identified",
2168
+ "monitoring"
2169
+ ],
2170
+ message: "Status:",
2171
+ required: true
2172
+ }, {
2173
+ key: "message",
2174
+ flag: "--message",
2175
+ type: "input",
2176
+ message: "What the update says:",
2177
+ required: true
2178
+ }],
2179
+ skipOptions: [
2180
+ "page",
2181
+ "notify",
2182
+ "yes"
2183
+ ],
2184
+ supportsDryRun: true
2185
+ };
2098
2186
  // src/commands/update-work/update-work.entry.ts
2099
2187
  const updateWorkEntry = {
2100
2188
  name: "update work",
@@ -2245,6 +2333,9 @@ const registry = createCommandRegistry([
2245
2333
  startWorkEntry,
2246
2334
  updateWorkEntry,
2247
2335
  closeWorkEntry,
2336
+ newIncidentEntry,
2337
+ updateIncidentEntry,
2338
+ closeIncidentEntry,
2248
2339
  syncReadmeEntry,
2249
2340
  configShowEntry,
2250
2341
  newRepoEntry,
@@ -6370,6 +6461,167 @@ const cloneCommand = {
6370
6461
  } else if (report.status === "dry-run" && report.cloned === 0 && env$7.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") process.exitCode = DRY_RUN_NOOP_EXIT_CODE;
6371
6462
  }
6372
6463
  };
6464
+ // src/commands/incident-write-failure/incident-write-failure.ts
6465
+ /**
6466
+ * The text of a failed incident write. A transport failure (status 0: a timeout, a dropped connection) leaves it unknown
6467
+ * whether the provider took the write, so that text says so and names where to look, and a rerun is not advised blindly.
6468
+ */
6469
+ function incidentWriteFailure(what, err) {
6470
+ const text = `${what}: ${describeError(err)}`;
6471
+ if (err instanceof ProviderApiError && err.status === 0) return `${text}. It may or may not have been written: check the status page before running it again`;
6472
+ return text;
6473
+ }
6474
+ // src/commands/pick-status-page/pick-status-page.ts
6475
+ /**
6476
+ * The status page an incident command works on: `--page` names one the config declares, and with one declared it is the
6477
+ * default. Returns the page, or why there is none to pick.
6478
+ */
6479
+ function pickStatusPage(pages, name) {
6480
+ if (pages.length === 0) return { problem: "no status page is declared in the monitoring provider's `statusPages`" };
6481
+ if (name !== void 0) {
6482
+ const page = pages.find((p) => p.name === name);
6483
+ return page ? { page } : { problem: `no status page named "${name}" (declared: ${pages.map((p) => p.name).join(", ")})` };
6484
+ }
6485
+ if (pages.length === 1) return { page: pages[0] };
6486
+ return { problem: `${pages.length} status pages are declared; name one with --page (${pages.map((p) => p.name).join(", ")})` };
6487
+ }
6488
+ // src/commands/update-incident/run-update-incident/run-update-incident.ts
6489
+ /**
6490
+ * `holocron update incident <id>` and `holocron close incident <id>` -- append an update to a status page incident (spec
6491
+ * `tech-open-status-page-incidents`, #2591).
6492
+ *
6493
+ * Only appends: an update is never rewritten or deleted, which `sync incidents` relies on. Before writing, the incident
6494
+ * is read, so a retry is safe: an incident whose newest update already has this status and message is left alone, closing
6495
+ * a resolved incident does nothing, and an update to a resolved incident is refused (its status must not leave
6496
+ * `resolved`). It writes to a live public page, so it asks first (`--yes` skips the question, `--dry-run` writes nothing).
6497
+ */
6498
+ /** How far back an incident is looked for: an open one is always read, a resolved one only when it is recent. */
6499
+ const LOOKBACK_MS = 6048e5;
6500
+ /** What a closing update says when `--message` is left out. */
6501
+ const RESOLVED_MESSAGE = "This incident is resolved.";
6502
+ async function runUpdateIncident(input) {
6503
+ const name = input.mode === "close" ? "close incident" : "update incident";
6504
+ const print = input.print ?? ((line) => console.log(line));
6505
+ const row = (status, ...parts) => print(statusRow$1(status, [name, ...parts]));
6506
+ const stop = (status, reason) => {
6507
+ row(status, reason);
6508
+ return {
6509
+ status,
6510
+ reason
6511
+ };
6512
+ };
6513
+ const notify = input.notify ?? true;
6514
+ const status = input.mode === "close" ? "resolved" : input.status;
6515
+ const message = (input.message ?? (input.mode === "close" ? RESOLVED_MESSAGE : "")).trim();
6516
+ if (input.mode === "update") {
6517
+ if (!status) return stop("fail", "an update needs --status (investigating, identified or monitoring)");
6518
+ if (message === "") return stop("fail", "an update needs --message");
6519
+ if (status === "resolved") return stop("fail", "use `close incident` to resolve one");
6520
+ }
6521
+ /* v8 ignore next -- the real loader is only built outside tests, which always inject one */
6522
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
6523
+ await loader.load();
6524
+ assertPluginsResolvable(loader, name);
6525
+ const monitoring = loader.has("monitoring") ? loader.get("monitoring") : void 0;
6526
+ const write = input.mode === "close" ? monitoring?.resolveIncident : monitoring?.updateIncident;
6527
+ if (!monitoring || !write) return stop("fail", "no `monitoring` provider that updates status page incidents");
6528
+ if (!monitoring.listIncidents) return stop("fail", "the `monitoring` provider cannot read incidents, so a retry could not be made safe");
6529
+ const picked = pickStatusPage(monitoring.statusPages ?? [], input.page);
6530
+ if ("problem" in picked) return stop("fail", picked.problem);
6531
+ const { page } = picked;
6532
+ let incident;
6533
+ try {
6534
+ const since = (/* @__PURE__ */ new Date((input.now ?? /* @__PURE__ */ new Date()).getTime() - LOOKBACK_MS)).toISOString();
6535
+ incident = (await monitoring.listIncidents({
6536
+ statusPage: page.name,
6537
+ since
6538
+ })).find((i) => i.id === input.id);
6539
+ } catch (err) {
6540
+ return stop("fail", `reading the incidents of "${page.name}": ${describeError(err)}`);
6541
+ }
6542
+ if (!incident) return stop("fail", `no incident ${input.id} on "${page.name}" that is open or resolved in the last 7 days`);
6543
+ if (incident.status === "resolved") {
6544
+ if (input.mode === "close") return stop("skip", `"${incident.title}" is already resolved`);
6545
+ return stop("fail", `"${incident.title}" is resolved; an update must not move it out of resolved`);
6546
+ }
6547
+ const newest = incident.updates.at(-1);
6548
+ if (newest && newest.status === status && newest.text.trim() === message) return stop("skip", `"${incident.title}" already has this update (${newest.id})`);
6549
+ const told = notify ? "subscribers will be told" : "subscribers will not be told";
6550
+ const what = `${status} update to "${incident.title}" on "${page.name}"`;
6551
+ if (input.context.dryRun) {
6552
+ row("skip", `would append a ${what}; ${told}`);
6553
+ return { status: "ok" };
6554
+ }
6555
+ if (!input.yes) {
6556
+ if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`${name}\` writes to a public status page; pass --yes to run it without asking, or --dry-run to look`);
6557
+ if (!await (input.confirm ?? ((q) => confirm({
6558
+ message: q,
6559
+ default: false
6560
+ })))(`Append a ${what}; ${told}?`)) {
6561
+ row("skip", "cancelled; nothing was changed");
6562
+ return { status: "cancelled" };
6563
+ }
6564
+ }
6565
+ try {
6566
+ const common = {
6567
+ statusPage: page.name,
6568
+ id: input.id,
6569
+ message,
6570
+ notify
6571
+ };
6572
+ row("ok", `appended a ${what}; it is now ${(input.mode === "close" ? await monitoring.resolveIncident(common) : await monitoring.updateIncident({
6573
+ ...common,
6574
+ status
6575
+ })).status}; ${told}`);
6576
+ return { status: "ok" };
6577
+ } catch (err) {
6578
+ return stop("fail", incidentWriteFailure(`updating "${incident.title}"`, err));
6579
+ }
6580
+ }
6581
+ // src/commands/close-incident/close-incident.command.ts
6582
+ const closeIncidentCommand = {
6583
+ command: "incident <id>",
6584
+ describe: "Resolve a status page incident with a final update",
6585
+ builder: (y) => y.positional("id", {
6586
+ type: "string",
6587
+ demandOption: true,
6588
+ describe: "The incident's id, as `new incident` printed it"
6589
+ }).option("page", {
6590
+ type: "string",
6591
+ describe: "The declared status page, when several are declared"
6592
+ }).option("message", {
6593
+ type: "string",
6594
+ describe: "What the final update says (default: a line saying it is resolved)"
6595
+ }).option("notify", {
6596
+ type: "boolean",
6597
+ default: true,
6598
+ describe: "Tell the page's subscribers (--no-notify to leave them)"
6599
+ }).option("yes", {
6600
+ type: "boolean",
6601
+ describe: "Resolve it without asking (required without a terminal)"
6602
+ }),
6603
+ handler: async (argv) => {
6604
+ const tokens = tokenContext(argv.token);
6605
+ if (!tokens) return;
6606
+ const loaded = await loadConfig(argv.cwd);
6607
+ applyResolvedConfig(argv, loaded.resolved);
6608
+ if ((await runUpdateIncident({
6609
+ mode: "close",
6610
+ id: String(argv.id),
6611
+ loaded,
6612
+ context: {
6613
+ repoRoot: argv.cwd,
6614
+ dryRun: argv.dryRun,
6615
+ ...tokens,
6616
+ org: resolveOrg(argv, loaded.resolved)
6617
+ },
6618
+ ...argv.page ? { page: argv.page } : {},
6619
+ ...argv.message !== void 0 ? { message: argv.message } : {},
6620
+ notify: argv.notify !== false,
6621
+ ...argv.yes ? { yes: true } : {}
6622
+ })).status === "fail") process.exitCode = 1;
6623
+ }
6624
+ };
6373
6625
  // src/commands/project/fs-templates-io/fs-templates-io.ts
6374
6626
  /** The real file system for `loadTemplates`, with a relative directory taken from `repoRoot`. A missing directory is empty. */
6375
6627
  function createFsTemplatesIo(repoRoot) {
@@ -9386,8 +9638,8 @@ const projectCloseCommand = {
9386
9638
  // src/commands/close/close.command.ts
9387
9639
  const closeCommand = {
9388
9640
  command: "close",
9389
- describe: "Close a project board, or close out a piece of work",
9390
- builder: (y) => y.command(projectCloseCommand).command(closeWorkCommand).command(groupMenu("close")),
9641
+ describe: "Close a project board, close out a piece of work, or resolve a status page incident",
9642
+ builder: (y) => y.command(projectCloseCommand).command(closeWorkCommand).command(closeIncidentCommand).command(groupMenu("close")),
9391
9643
  handler: () => {}
9392
9644
  };
9393
9645
  // src/commands/cleanup-preview/cleanup-preview.args.ts
@@ -26111,6 +26363,235 @@ const newDomainCommand = {
26111
26363
  })).status === "fail") process.exitCode = 1;
26112
26364
  }
26113
26365
  };
26366
+ // src/commands/incident-mirror-note/incident-mirror-note.ts
26367
+ /**
26368
+ * A note when an incident on `pageName` will not reach a forum: `sync incidents` mirrors the one page `feeds.incidents`
26369
+ * names (or the only one declared, with `true`), so an incident on another page, or with no such forum, stays on the
26370
+ * status page. Undefined when it is mirrored.
26371
+ */
26372
+ function incidentMirrorNote(notifications, pageName, pageCount) {
26373
+ const feeds = notifications.flatMap((n) => n.layout?.categories ?? []).flatMap((c) => c.channels ?? []).map((c) => c.feeds?.incidents).filter((f) => f !== void 0 && f !== false);
26374
+ if (feeds.length === 0) return "no forum has `feeds.incidents`, so this incident will not be mirrored to Discord";
26375
+ if (feeds.length > 1) return "several forums have `feeds.incidents`, so `sync incidents` refuses to run and this incident will not be mirrored to Discord";
26376
+ const named = feeds.filter((f) => typeof f === "string");
26377
+ if (feeds.includes(true) ? pageCount === 1 : named.includes(pageName)) return void 0;
26378
+ return `\`sync incidents\` follows ${named.map((n) => `"${n}"`).join(", ") || "one page only"}, so this incident will not be mirrored to Discord`;
26379
+ }
26380
+ // src/commands/incident-title-key/incident-title-key.ts
26381
+ /**
26382
+ * The form of an incident title that two titles are compared in: trimmed, lower case, runs of whitespace one space.
26383
+ * `new incident` refuses to open a second incident whose key equals an open one's (spec
26384
+ * `tech-open-status-page-incidents`), so a rerun after a timeout never opens two.
26385
+ */
26386
+ function incidentTitleKey(title) {
26387
+ return title.trim().toLowerCase().replace(/\s+/g, " ");
26388
+ }
26389
+ // src/commands/parse-incident-impacts/parse-incident-impacts.ts
26390
+ /** The impact words a person may write, mildest first. */
26391
+ const INCIDENT_IMPACTS = [
26392
+ "maintenance",
26393
+ "degraded",
26394
+ "partial",
26395
+ "major"
26396
+ ];
26397
+ /**
26398
+ * Reads `--component <name>=<impact>` values (and a workflow's one-per-line or comma-separated input) into the impacts
26399
+ * an incident marks. A component is checked against `known`, the names the status page declares, and an impact against
26400
+ * {@link INCIDENT_IMPACTS}; every problem is returned at once so nothing is written for a half-right request.
26401
+ */
26402
+ function parseIncidentImpacts(values, known) {
26403
+ const impacts = [];
26404
+ const problems = [];
26405
+ const entries = values.flatMap((v) => v.split(/[\n,]/)).map((v) => v.trim());
26406
+ for (const entry of entries.filter((e) => e !== "")) {
26407
+ const at = entry.lastIndexOf("=");
26408
+ const component = at < 0 ? "" : entry.slice(0, at).trim();
26409
+ const impact = at < 0 ? "" : entry.slice(at + 1).trim();
26410
+ if (component === "" || impact === "") {
26411
+ problems.push(`"${entry}" is not <component>=<impact>`);
26412
+ continue;
26413
+ }
26414
+ if (!known.includes(component)) {
26415
+ problems.push(`no component "${component}" (the page has ${known.join(", ") || "none"})`);
26416
+ continue;
26417
+ }
26418
+ if (!INCIDENT_IMPACTS.includes(impact)) {
26419
+ problems.push(`impact "${impact}" of "${component}" is not one of ${INCIDENT_IMPACTS.join(", ")}`);
26420
+ continue;
26421
+ }
26422
+ if (impacts.some((i) => i.component === component)) {
26423
+ problems.push(`"${component}" is given twice`);
26424
+ continue;
26425
+ }
26426
+ impacts.push({
26427
+ component,
26428
+ impact
26429
+ });
26430
+ }
26431
+ return {
26432
+ impacts,
26433
+ problems
26434
+ };
26435
+ }
26436
+ // src/commands/new-incident/run-new-incident/run-new-incident.ts
26437
+ /**
26438
+ * `holocron new incident <title>` -- open an incident on a status page (spec `tech-open-status-page-incidents`, #2591).
26439
+ *
26440
+ * The page and its components come from the `monitoring` provider's declaration, the incident is written through its
26441
+ * `openIncident`, and `sync incidents` then mirrors it to Discord. It writes to a live public page, so it refuses an open
26442
+ * incident of the same title (`--allow-duplicate` overrides), asks first (`--yes` skips the question, `--dry-run` writes
26443
+ * nothing) and says whether subscribers will be told. Every problem with the request is found before anything is written.
26444
+ */
26445
+ /** What the opening update says when `--message` is left out. */
26446
+ const DEFAULT_MESSAGES = {
26447
+ investigating: "We are investigating.",
26448
+ identified: "We have identified the cause and are working on it.",
26449
+ monitoring: "A fix is in place and we are monitoring."
26450
+ };
26451
+ async function runNewIncident(input) {
26452
+ const print = input.print ?? ((line) => console.log(line));
26453
+ const row = (status, ...parts) => print(statusRow$1(status, ["new incident", ...parts]));
26454
+ const stop = (status, reason) => {
26455
+ row(status, reason);
26456
+ return {
26457
+ status,
26458
+ reason
26459
+ };
26460
+ };
26461
+ const title = input.title.trim();
26462
+ const status = input.status ?? "investigating";
26463
+ const notify = input.notify ?? true;
26464
+ if (title === "") return stop("fail", "the incident needs a title");
26465
+ if (!(status in DEFAULT_MESSAGES)) return stop("fail", `an incident opens as investigating, identified or monitoring, not "${status}"`);
26466
+ /* v8 ignore next -- the real loader is only built outside tests, which always inject one */
26467
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
26468
+ await loader.load();
26469
+ assertPluginsResolvable(loader, "new incident");
26470
+ const monitoring = loader.has("monitoring") ? loader.get("monitoring") : void 0;
26471
+ if (!monitoring?.openIncident) return stop("fail", "no `monitoring` provider that opens status page incidents");
26472
+ const pages = monitoring.statusPages ?? [];
26473
+ const picked = pickStatusPage(pages, input.page);
26474
+ if ("problem" in picked) return stop("fail", picked.problem);
26475
+ const { page } = picked;
26476
+ const { impacts, problems } = parseIncidentImpacts(input.components ?? [], page.components.map((c) => c.name));
26477
+ if (problems.length > 0) {
26478
+ for (const problem of problems) row("fail", problem);
26479
+ return {
26480
+ status: "fail",
26481
+ reason: problems.join("; ")
26482
+ };
26483
+ }
26484
+ if (monitoring.listIncidents && !input.allowDuplicate) try {
26485
+ const key = incidentTitleKey(title);
26486
+ const since = (input.now ?? /* @__PURE__ */ new Date()).toISOString();
26487
+ const open = (await monitoring.listIncidents({
26488
+ statusPage: page.name,
26489
+ since
26490
+ })).find((i) => i.status !== "resolved" && incidentTitleKey(i.title) === key);
26491
+ if (open) return stop("fail", `"${open.title}" is already open on "${page.name}" (${open.id}); --allow-duplicate opens another`);
26492
+ } catch (err) {
26493
+ return stop("fail", `reading the open incidents of "${page.name}": ${describeError(err)}`);
26494
+ }
26495
+ else if (!monitoring.listIncidents) row("skip", "the provider cannot list incidents, so an open one of the same title was not looked for");
26496
+ const message = input.message ?? DEFAULT_MESSAGES[status];
26497
+ const marked = impacts.map((i) => `${i.component} ${i.impact}`).join(", ") || "no component";
26498
+ const told = notify ? "subscribers will be told" : "subscribers will not be told";
26499
+ const note = loader.has("notifications") ? incidentMirrorNote(loader.get("notifications"), page.name, pages.length) : void 0;
26500
+ if (input.context.dryRun) {
26501
+ row("skip", `would open "${title}" on "${page.name}" as ${status} (${marked}); ${told}`);
26502
+ if (note) row("skip", note);
26503
+ return { status: "ok" };
26504
+ }
26505
+ if (!input.yes) {
26506
+ if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`new incident` writes to a public status page; pass --yes to run it without asking, or --dry-run to look");
26507
+ if (!await (input.confirm ?? ((q) => confirm({
26508
+ message: q,
26509
+ default: false
26510
+ })))(`Open "${title}" on "${page.name}" as ${status} (${marked}); ${told}?`)) {
26511
+ row("skip", "cancelled; nothing was changed");
26512
+ return { status: "cancelled" };
26513
+ }
26514
+ }
26515
+ try {
26516
+ const written = await monitoring.openIncident({
26517
+ statusPage: page.name,
26518
+ title,
26519
+ status,
26520
+ message,
26521
+ notify,
26522
+ impacts
26523
+ });
26524
+ row("ok", `opened "${title}" on "${page.name}" as ${written.status} (${written.id}); ${told}`);
26525
+ if (note) row("skip", note);
26526
+ return {
26527
+ status: "ok",
26528
+ id: written.id
26529
+ };
26530
+ } catch (err) {
26531
+ return stop("fail", incidentWriteFailure(`opening "${title}"`, err));
26532
+ }
26533
+ }
26534
+ // src/commands/new-incident/new-incident.command.ts
26535
+ const newIncidentCommand = {
26536
+ command: "incident <title>",
26537
+ describe: "Open an incident on a status page, with its first update and the components it marks",
26538
+ builder: (y) => y.positional("title", {
26539
+ type: "string",
26540
+ demandOption: true,
26541
+ describe: "The incident's name (at most 255 characters)"
26542
+ }).option("page", {
26543
+ type: "string",
26544
+ describe: "The declared status page, when several are declared"
26545
+ }).option("status", {
26546
+ type: "string",
26547
+ choices: [
26548
+ "investigating",
26549
+ "identified",
26550
+ "monitoring"
26551
+ ],
26552
+ describe: "The status the opening update carries (default investigating)"
26553
+ }).option("component", {
26554
+ type: "string",
26555
+ array: true,
26556
+ describe: "A component to mark and how badly: <name>=<maintenance|degraded|partial|major> (repeatable)"
26557
+ }).option("message", {
26558
+ type: "string",
26559
+ describe: "What the opening update says (default: a line for the status)"
26560
+ }).option("notify", {
26561
+ type: "boolean",
26562
+ default: true,
26563
+ describe: "Tell the page's subscribers (--no-notify to try one out)"
26564
+ }).option("allow-duplicate", {
26565
+ type: "boolean",
26566
+ describe: "Open it even when an open incident has the same title"
26567
+ }).option("yes", {
26568
+ type: "boolean",
26569
+ describe: "Open it without asking (required without a terminal)"
26570
+ }),
26571
+ handler: async (argv) => {
26572
+ const tokens = tokenContext(argv.token);
26573
+ if (!tokens) return;
26574
+ const loaded = await loadConfig(argv.cwd);
26575
+ applyResolvedConfig(argv, loaded.resolved);
26576
+ if ((await runNewIncident({
26577
+ title: String(argv.title),
26578
+ loaded,
26579
+ context: {
26580
+ repoRoot: argv.cwd,
26581
+ dryRun: argv.dryRun,
26582
+ ...tokens,
26583
+ org: resolveOrg(argv, loaded.resolved)
26584
+ },
26585
+ ...argv.page ? { page: argv.page } : {},
26586
+ ...argv.status ? { status: argv.status } : {},
26587
+ ...argv.component ? { components: argv.component.map(String) } : {},
26588
+ ...argv.message !== void 0 ? { message: argv.message } : {},
26589
+ notify: argv.notify !== false,
26590
+ ...argv.allowDuplicate ? { allowDuplicate: true } : {},
26591
+ ...argv.yes ? { yes: true } : {}
26592
+ })).status === "fail") process.exitCode = 1;
26593
+ }
26594
+ };
26114
26595
  // src/commands/new-work/git-assignee/git-assignee.ts
26115
26596
  const NOREPLY = /^(?:\d+\+)?([A-Za-z0-9-]+)@users\.noreply\.github\.com$/;
26116
26597
  /**
@@ -28769,8 +29250,8 @@ const newRepoCommand = {
28769
29250
  // src/commands/new/new.command.ts
28770
29251
  const newCommand = {
28771
29252
  command: "new",
28772
- describe: "Create a repo, plugin, channel, server, secret, token, tunnel, domain record, GitHub App, project, spec, issue or work",
28773
- builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(notificationsChannelAddCommand).command(githubAppCreateCommand).command(projectCreateCommand).command(secretSetCommand).command(notificationsCreateServerCommand).command(ideasPromoteCommand).command(issueCreateCommand).command(newWorkCommand).command(authSetCommand).command(tunnelUpCommand).command(newDomainCommand).command(groupMenu("new")),
29253
+ describe: "Create a repo, plugin, channel, server, secret, token, tunnel, domain record, GitHub App, project, spec, issue, incident or work",
29254
+ builder: (y) => y.command(newRepoCommand).command(pluginCreateCommand).command(notificationsChannelAddCommand).command(githubAppCreateCommand).command(projectCreateCommand).command(secretSetCommand).command(notificationsCreateServerCommand).command(ideasPromoteCommand).command(issueCreateCommand).command(newWorkCommand).command(authSetCommand).command(tunnelUpCommand).command(newDomainCommand).command(newIncidentCommand).command(groupMenu("new")),
28774
29255
  handler: () => {}
28775
29256
  };
28776
29257
  // src/commands/open-requests/parse-open-layers/parse-open-layers.ts
@@ -37314,6 +37795,61 @@ const issueUpdateCommand = {
37314
37795
  })).status === "fail") process.exitCode = 1;
37315
37796
  }
37316
37797
  };
37798
+ // src/commands/update-incident/update-incident.command.ts
37799
+ const updateIncidentCommand = {
37800
+ command: "incident <id>",
37801
+ describe: "Append an update to a status page incident (investigating, identified or monitoring)",
37802
+ builder: (y) => y.positional("id", {
37803
+ type: "string",
37804
+ demandOption: true,
37805
+ describe: "The incident's id, as `new incident` printed it"
37806
+ }).option("page", {
37807
+ type: "string",
37808
+ describe: "The declared status page, when several are declared"
37809
+ }).option("status", {
37810
+ type: "string",
37811
+ choices: [
37812
+ "investigating",
37813
+ "identified",
37814
+ "monitoring"
37815
+ ],
37816
+ demandOption: true,
37817
+ describe: "The status the update puts the incident in (`close incident` resolves one)"
37818
+ }).option("message", {
37819
+ type: "string",
37820
+ demandOption: true,
37821
+ describe: "What the update says"
37822
+ }).option("notify", {
37823
+ type: "boolean",
37824
+ default: true,
37825
+ describe: "Tell the page's subscribers (--no-notify to leave them)"
37826
+ }).option("yes", {
37827
+ type: "boolean",
37828
+ describe: "Write it without asking (required without a terminal)"
37829
+ }),
37830
+ handler: async (argv) => {
37831
+ const tokens = tokenContext(argv.token);
37832
+ if (!tokens) return;
37833
+ const loaded = await loadConfig(argv.cwd);
37834
+ applyResolvedConfig(argv, loaded.resolved);
37835
+ if ((await runUpdateIncident({
37836
+ mode: "update",
37837
+ id: String(argv.id),
37838
+ loaded,
37839
+ context: {
37840
+ repoRoot: argv.cwd,
37841
+ dryRun: argv.dryRun,
37842
+ ...tokens,
37843
+ org: resolveOrg(argv, loaded.resolved)
37844
+ },
37845
+ ...argv.page ? { page: argv.page } : {},
37846
+ status: argv.status,
37847
+ message: String(argv.message),
37848
+ notify: argv.notify !== false,
37849
+ ...argv.yes ? { yes: true } : {}
37850
+ })).status === "fail") process.exitCode = 1;
37851
+ }
37852
+ };
37317
37853
  // src/commands/update-work/update-work.command.ts
37318
37854
  const updateWorkCommand = {
37319
37855
  command: "work <issue>",
@@ -37422,8 +37958,8 @@ const updateWorkCommand = {
37422
37958
  // src/commands/update/update.command.ts
37423
37959
  const updateCommand = {
37424
37960
  command: "update",
37425
- describe: "Update installed agent skills, an issue in the tracker, or a piece of work",
37426
- builder: (y) => y.command(skillsUpdateCommand).command(issueUpdateCommand).command(updateWorkCommand).command(groupMenu("update")),
37961
+ describe: "Update installed agent skills, an issue in the tracker, a piece of work, or a status page incident",
37962
+ builder: (y) => y.command(skillsUpdateCommand).command(issueUpdateCommand).command(updateWorkCommand).command(updateIncidentCommand).command(groupMenu("update")),
37427
37963
  handler: () => {}
37428
37964
  };
37429
37965
  // src/commands/upgrade-deps/upgrade-deps.ts