spur-board 0.12.0 → 0.13.0
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 +60 -32
- package/dist/{client-BxeRGI6U.mjs → client-CAcEf5xs.mjs} +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{config-BkpjmVZh.mjs → config-Cd5oLu2h.mjs} +2 -2
- package/dist/daemon.mjs +79 -18
- package/dist/mcp.mjs +3 -3
- package/dist/{src-4YeTky_x.mjs → src-B0lbg34-.mjs} +87 -20
- package/package.json +1 -1
- package/skills/spur-board/references/commands.md +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as requiredSecretKeys, N as ERRORS, U as SLACK_BOT_SCOPES, V as configSchema, c as roleCanUseOperation, l as OPERATIONS, n as SYSTEMD_SERVICE_SETTINGS } from "./src-
|
|
2
|
-
import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as readConfiguredPort, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog, u as resolveDaemonAddress } from "./config-
|
|
1
|
+
import { H as requiredSecretKeys, N as ERRORS, U as SLACK_BOT_SCOPES, V as configSchema, c as roleCanUseOperation, l as OPERATIONS, n as SYSTEMD_SERVICE_SETTINGS } from "./src-B0lbg34-.mjs";
|
|
2
|
+
import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-CAcEf5xs.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as readConfiguredPort, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog, u as resolveDaemonAddress } from "./config-Cd5oLu2h.mjs";
|
|
4
4
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
5
5
|
import { chmodSync, closeSync, constants, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { homedir, hostname, userInfo } from "node:os";
|
|
@@ -513,14 +513,46 @@ async function runCommand(command, args) {
|
|
|
513
513
|
});
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
|
+
function failureDetail(result) {
|
|
517
|
+
return result.stderr.trim() || result.stdout.trim() || `exit ${String(result.exitCode)}`;
|
|
518
|
+
}
|
|
516
519
|
async function requireSuccess(runner, command, args) {
|
|
517
520
|
const result = await runner(command, args);
|
|
518
|
-
if (result.exitCode !== 0) {
|
|
519
|
-
const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.exitCode)}`;
|
|
520
|
-
throw new Error(`${command} ${args.join(" ")} failed: ${detail}`);
|
|
521
|
-
}
|
|
521
|
+
if (result.exitCode !== 0) throw new Error(`${command} ${args.join(" ")} failed: ${failureDetail(result)}`);
|
|
522
522
|
return result;
|
|
523
523
|
}
|
|
524
|
+
async function unitState(runner) {
|
|
525
|
+
const active = await runner("systemctl", [
|
|
526
|
+
"--user",
|
|
527
|
+
"is-active",
|
|
528
|
+
serviceName
|
|
529
|
+
]);
|
|
530
|
+
const enabled = await runner("systemctl", [
|
|
531
|
+
"--user",
|
|
532
|
+
"is-enabled",
|
|
533
|
+
serviceName
|
|
534
|
+
]);
|
|
535
|
+
return {
|
|
536
|
+
active: active.stdout.trim() || "unknown",
|
|
537
|
+
enabled: enabled.stdout.trim() || "unknown"
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
/** Runs a systemctl command that starts the service; a failure leaves the unit in place. */
|
|
541
|
+
async function requireStart(runner, args, unit) {
|
|
542
|
+
const result = await runner("systemctl", args);
|
|
543
|
+
if (result.exitCode === 0) return;
|
|
544
|
+
const detail = failureDetail(result).replace(/\s*\n\s*/g, " ").replace(/\.$/, "");
|
|
545
|
+
const state = await unitState(runner).catch(() => ({
|
|
546
|
+
active: "unknown",
|
|
547
|
+
enabled: "unknown"
|
|
548
|
+
}));
|
|
549
|
+
const origin = unit.written === void 0 ? "" : unit.written ? " (written by this run)" : " (already in place)";
|
|
550
|
+
throw new CliError("service_start_failed", void 0, void 0, [
|
|
551
|
+
`Unit file ${unit.file}${origin} is ${state.enabled}; the service is ${state.active}.`,
|
|
552
|
+
`systemctl ${args.join(" ")} failed: ${detail}.`,
|
|
553
|
+
"Read why with `journalctl --user -u spur-board.service -n 100` and run `board doctor`."
|
|
554
|
+
].join(" "));
|
|
555
|
+
}
|
|
524
556
|
async function preflight(paths) {
|
|
525
557
|
for (const [label, path] of [["Node executable", paths.nodePath], ["daemon entry", paths.daemonEntry]]) {
|
|
526
558
|
if (!isAbsolute(path)) throw new Error(`${label} path must be absolute: ${path}`);
|
|
@@ -575,51 +607,47 @@ async function installService(options = {}) {
|
|
|
575
607
|
wasActive = state.exitCode === 0 && state.stdout.trim() === "active";
|
|
576
608
|
}
|
|
577
609
|
}
|
|
578
|
-
|
|
610
|
+
const unitInfo = {
|
|
611
|
+
file: paths.unitFile,
|
|
612
|
+
written: changed
|
|
613
|
+
};
|
|
614
|
+
await requireStart(runner, [
|
|
579
615
|
"--user",
|
|
580
616
|
"enable",
|
|
581
617
|
"--now",
|
|
582
618
|
serviceName
|
|
583
|
-
]);
|
|
584
|
-
if (wasActive) await
|
|
619
|
+
], unitInfo);
|
|
620
|
+
if (wasActive) await requireStart(runner, [
|
|
585
621
|
"--user",
|
|
586
622
|
"restart",
|
|
587
623
|
serviceName
|
|
588
|
-
]);
|
|
624
|
+
], unitInfo);
|
|
589
625
|
return {
|
|
590
626
|
unitFile: paths.unitFile,
|
|
591
627
|
changed
|
|
592
628
|
};
|
|
593
629
|
}
|
|
594
630
|
async function restartService(options = {}) {
|
|
595
|
-
|
|
631
|
+
const unitFile = servicePaths(options).unitFile;
|
|
632
|
+
if (await existingUnit(unitFile) === void 0) throw new CliError("config", void 0, void 0, `Unit file ${unitFile} is not installed; run \`board service install\` first.`);
|
|
633
|
+
await requireStart(options.runner ?? runCommand, [
|
|
596
634
|
"--user",
|
|
597
635
|
"restart",
|
|
598
636
|
serviceName
|
|
599
|
-
]);
|
|
637
|
+
], { file: unitFile });
|
|
600
638
|
}
|
|
601
639
|
async function statusService(options = {}) {
|
|
602
640
|
const runner = options.runner ?? runCommand;
|
|
603
|
-
const active = await runner
|
|
604
|
-
"--user",
|
|
605
|
-
"is-active",
|
|
606
|
-
serviceName
|
|
607
|
-
]);
|
|
608
|
-
const enabled = await runner("systemctl", [
|
|
609
|
-
"--user",
|
|
610
|
-
"is-enabled",
|
|
611
|
-
serviceName
|
|
612
|
-
]);
|
|
613
|
-
const linger = await requireSuccess(runner, "loginctl", [
|
|
614
|
-
"show-user",
|
|
615
|
-
options.username ?? userInfo().username,
|
|
616
|
-
"--property=Linger",
|
|
617
|
-
"--value"
|
|
618
|
-
]);
|
|
641
|
+
const { active, enabled } = await unitState(runner);
|
|
619
642
|
return {
|
|
620
|
-
active
|
|
621
|
-
enabled
|
|
622
|
-
lingering:
|
|
643
|
+
active,
|
|
644
|
+
enabled,
|
|
645
|
+
lingering: (await requireSuccess(runner, "loginctl", [
|
|
646
|
+
"show-user",
|
|
647
|
+
options.username ?? userInfo().username,
|
|
648
|
+
"--property=Linger",
|
|
649
|
+
"--value"
|
|
650
|
+
])).stdout.trim() === "yes"
|
|
623
651
|
};
|
|
624
652
|
}
|
|
625
653
|
async function uninstallService(options = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as errorEnvelopeSchema, I as successEnvelopeSchema, N as ERRORS, P as errorContextSchema, d as renderJsonError } from "./src-
|
|
1
|
+
import { F as errorEnvelopeSchema, I as successEnvelopeSchema, N as ERRORS, P as errorContextSchema, d as renderJsonError } from "./src-B0lbg34-.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-CAcEf5xs.mjs";
|
|
2
2
|
export { fetchCatalogVersion, requestOperation, requestTokenEnrollment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as DEFAULT_HTTP_PORT, V as configSchema, l as OPERATIONS, s as buildCatalogSnapshot } from "./src-
|
|
2
|
-
import { i as CliError, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { L as DEFAULT_HTTP_PORT, V as configSchema, l as OPERATIONS, s as buildCatalogSnapshot } from "./src-B0lbg34-.mjs";
|
|
2
|
+
import { i as CliError, t as fetchCatalogVersion } from "./client-CAcEf5xs.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as parseActorId, B as RESERVED_PROJECT, C as prFactsSchema, D as actorIdSchema, E as ticketFactsSchema, H as requiredSecretKeys, I as successEnvelopeSchema, M as taskKeySchema, N as ERRORS, O as encodeActorId, S as SESSION_STATUSES, T as sessionFactsSchema, U as SLACK_BOT_SCOPES, V as configSchema, _ as messageRefSchema, a as entityRefSchema, b as eventPayloadSchemas, c as roleCanUseOperation, g as interactionRefSchema, h as inboundEventSchema, i as batchSchema, j as parseRef$1, k as errorCodeOf, l as OPERATIONS, m as conversationRefSchema, o as sourceCursorSchema, p as SPACE_IDS, r as AdapterError, s as buildCatalogSnapshot, t as BOARD_TICK_MS, u as renderHttpProblem, v as userIdSchema, w as prRefSchema, x as SESSION_HEALTH_STATES, y as EVENT_KINDS, z as DEFAULT_SLACK_COMMAND } from "./src-
|
|
1
|
+
import { A as parseActorId, B as RESERVED_PROJECT, C as prFactsSchema, D as actorIdSchema, E as ticketFactsSchema, H as requiredSecretKeys, I as successEnvelopeSchema, M as taskKeySchema, N as ERRORS, O as encodeActorId, S as SESSION_STATUSES, T as sessionFactsSchema, U as SLACK_BOT_SCOPES, V as configSchema, _ as messageRefSchema, a as entityRefSchema, b as eventPayloadSchemas, c as roleCanUseOperation, g as interactionRefSchema, h as inboundEventSchema, i as batchSchema, j as parseRef$1, k as errorCodeOf, l as OPERATIONS, m as conversationRefSchema, o as sourceCursorSchema, p as SPACE_IDS, r as AdapterError, s as buildCatalogSnapshot, t as BOARD_TICK_MS, u as renderHttpProblem, v as userIdSchema, w as prRefSchema, x as SESSION_HEALTH_STATES, y as EVENT_KINDS, z as DEFAULT_SLACK_COMMAND } from "./src-B0lbg34-.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, existsSync, fstatSync, ftruncateSync, mkdirSync, openSync, readFileSync, readdirSync, writeSync } from "node:fs";
|
|
@@ -10736,18 +10736,44 @@ function sessionView(fact) {
|
|
|
10736
10736
|
}))
|
|
10737
10737
|
};
|
|
10738
10738
|
}
|
|
10739
|
+
/** Counts of each value, rendered as `<n> <value>` in the given order. */
|
|
10740
|
+
function counts(values, order) {
|
|
10741
|
+
return order.map((value) => [value, values.filter((entry) => entry === value).length]).filter(([, n]) => n > 0).map(([value, n]) => `${String(n)} ${value}`).join(", ");
|
|
10742
|
+
}
|
|
10743
|
+
/** The one-line task state: ticket status, pull request states, session health counts. */
|
|
10744
|
+
function taskState(ticket, prs, sessions) {
|
|
10745
|
+
const parts = [ticket === null ? "ticket not observed" : `ticket ${ticket.status}`];
|
|
10746
|
+
if (prs.length > 0) {
|
|
10747
|
+
const labels = prs.map((pr) => pr.state === "open" && pr.draft ? "draft" : pr.state);
|
|
10748
|
+
parts.push(`PRs ${counts(labels, [
|
|
10749
|
+
"draft",
|
|
10750
|
+
"open",
|
|
10751
|
+
"merged",
|
|
10752
|
+
"closed"
|
|
10753
|
+
])}`);
|
|
10754
|
+
}
|
|
10755
|
+
if (sessions.length > 0) {
|
|
10756
|
+
const health = sessions.map((session) => session.health);
|
|
10757
|
+
parts.push(`sessions ${counts(health, [...new Set(health)].sort())}`);
|
|
10758
|
+
}
|
|
10759
|
+
return parts.join("; ");
|
|
10760
|
+
}
|
|
10739
10761
|
function interval(config, source) {
|
|
10740
10762
|
if (source === "spur") return config.adapters.spur.intervalMs;
|
|
10741
10763
|
if (source.startsWith("jira:")) return config.adapters.jira.intervalMs;
|
|
10742
10764
|
return config.adapters.github.intervalMs;
|
|
10743
10765
|
}
|
|
10744
10766
|
/** Reads the board's latest facts, items and source availability. */
|
|
10745
|
-
async function getStatus(deps,
|
|
10767
|
+
async function getStatus(deps, options = {}) {
|
|
10746
10768
|
const { store, config, clock, completeSince, gateways = [] } = deps;
|
|
10769
|
+
const { project: projectId, visibleProjects, detail = false } = options;
|
|
10770
|
+
const includeBoardItems = options.includeBoardItems ?? visibleProjects === void 0;
|
|
10747
10771
|
const projects = projectId === void 0 ? config.projects.filter((project) => visibleProjects === void 0 || visibleProjects.has(project.id)) : config.projects.filter((project) => project.id === projectId && (visibleProjects === void 0 || visibleProjects.has(project.id)));
|
|
10748
10772
|
if (projects.length === 0) throw new CommandError("not_found", "Check the project ID.");
|
|
10749
10773
|
const projectIds = new Set(projects.map((project) => project.id));
|
|
10750
10774
|
const rows = await store.db.selectFrom("task").selectAll().where("membership", "!=", "archived").execute();
|
|
10775
|
+
const blockRows = await store.db.selectFrom("block").select(["task_id", (eb) => eb.fn.countAll().as("open")]).where("state", "=", "open").groupBy("task_id").execute();
|
|
10776
|
+
const openBlocks = new Map(blockRows.map((row) => [row.task_id, row.open]));
|
|
10751
10777
|
const tasks = [];
|
|
10752
10778
|
for (const task of rows) {
|
|
10753
10779
|
if (!projectIds.has(task.project)) continue;
|
|
@@ -10760,24 +10786,54 @@ async function getStatus(deps, projectId, visibleProjects, includeBoardItems = v
|
|
|
10760
10786
|
if (snapshot !== void 0) prs.push(parseJson(prFactsSchema, snapshot.detail));
|
|
10761
10787
|
} else if (link.entity === "session" && link.session_id !== null) {
|
|
10762
10788
|
const snapshot = await store.db.selectFrom("session_snapshot").select("detail").where("id", "=", link.session_id).executeTakeFirst();
|
|
10763
|
-
if (snapshot !== void 0) sessions.push(
|
|
10789
|
+
if (snapshot !== void 0) sessions.push(parseJson(sessionFactsSchema, snapshot.detail));
|
|
10764
10790
|
}
|
|
10791
|
+
const ticketFacts = ticket === void 0 ? null : parseJson(ticketFactsSchema, ticket.detail);
|
|
10765
10792
|
tasks.push({
|
|
10766
10793
|
key: task.key,
|
|
10767
10794
|
project: task.project,
|
|
10768
10795
|
column: task.column,
|
|
10769
10796
|
membership: task.membership,
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10797
|
+
state: taskState(ticketFacts, prs, sessions),
|
|
10798
|
+
prCount: links.filter((link) => link.entity === "pr").length,
|
|
10799
|
+
sessionCount: links.filter((link) => link.entity === "session").length,
|
|
10800
|
+
openBlocks: openBlocks.get(task.id) ?? 0,
|
|
10801
|
+
...detail ? {
|
|
10802
|
+
ticket: ticketFacts,
|
|
10803
|
+
prs,
|
|
10804
|
+
sessions: sessions.map(sessionView),
|
|
10805
|
+
links: links.map(linkView)
|
|
10806
|
+
} : {}
|
|
10774
10807
|
});
|
|
10775
10808
|
}
|
|
10776
10809
|
const allPrs = await store.db.selectFrom("pr_snapshot").selectAll().execute();
|
|
10777
10810
|
const allSessions = await store.db.selectFrom("session_snapshot").selectAll().execute();
|
|
10778
10811
|
const allLinks = await store.db.selectFrom("link").selectAll().where("banned", "=", 0).execute();
|
|
10779
|
-
const unlinkedPrs = allPrs.filter((pr) => projects.some((project) => project.repos.some((repo) => repo.toLowerCase() === pr.repo.toLowerCase())) && !allLinks.some((link) => link.entity === "pr" && link.repo?.toLowerCase() === pr.repo.toLowerCase() && link.number === pr.number)).map((pr) =>
|
|
10780
|
-
|
|
10812
|
+
const unlinkedPrs = allPrs.filter((pr) => projects.some((project) => project.repos.some((repo) => repo.toLowerCase() === pr.repo.toLowerCase())) && !allLinks.some((link) => link.entity === "pr" && link.repo?.toLowerCase() === pr.repo.toLowerCase() && link.number === pr.number)).map((pr) => {
|
|
10813
|
+
const facts = parseJson(prFactsSchema, pr.detail);
|
|
10814
|
+
if (detail) return facts;
|
|
10815
|
+
const { repo, number, url, title, state, draft } = facts;
|
|
10816
|
+
return {
|
|
10817
|
+
repo,
|
|
10818
|
+
number,
|
|
10819
|
+
url,
|
|
10820
|
+
title,
|
|
10821
|
+
state,
|
|
10822
|
+
draft
|
|
10823
|
+
};
|
|
10824
|
+
});
|
|
10825
|
+
const unlinkedSessions = allSessions.filter((session) => projects.some((project) => project.spurProjects.some((spur) => spur.name === session.spur_project)) && !allLinks.some((link) => link.entity === "session" && link.session_id === session.id)).map((session) => {
|
|
10826
|
+
const facts = parseJson(sessionFactsSchema, session.detail);
|
|
10827
|
+
if (detail) return sessionView(facts);
|
|
10828
|
+
const { id, spurProject, branch, lifecycle, health } = facts;
|
|
10829
|
+
return {
|
|
10830
|
+
id,
|
|
10831
|
+
spurProject,
|
|
10832
|
+
branch,
|
|
10833
|
+
lifecycle,
|
|
10834
|
+
health
|
|
10835
|
+
};
|
|
10836
|
+
});
|
|
10781
10837
|
const sourceRows = await store.db.selectFrom("source_state").selectAll().execute();
|
|
10782
10838
|
const required = /* @__PURE__ */ new Set(["spur", ...projects.flatMap((project) => [trackerSource(project), ...project.repos.map((repo) => `github:${project.id}:${repo.toLowerCase()}`)])]);
|
|
10783
10839
|
const sourceById = new Map(sourceRows.map((row) => [row.source, row]));
|
|
@@ -10834,15 +10890,15 @@ async function getStatus(deps, projectId, visibleProjects, includeBoardItems = v
|
|
|
10834
10890
|
};
|
|
10835
10891
|
});
|
|
10836
10892
|
return {
|
|
10837
|
-
tasks,
|
|
10838
10893
|
items,
|
|
10839
|
-
unlinkedPrs,
|
|
10840
|
-
unlinkedSessions,
|
|
10841
|
-
sources,
|
|
10842
10894
|
warmingUp: sources.some((source) => source.warmingUp),
|
|
10843
10895
|
spurUnavailable: spur?.blind_reason === null || spur === void 0 ? null : `Spur unavailable: ${spur.blind_message ?? spur.blind_reason}`,
|
|
10844
10896
|
hostLoad: host?.value !== void 0 && host.value !== "null" ? "Host under load" : null,
|
|
10845
|
-
transport
|
|
10897
|
+
transport,
|
|
10898
|
+
sources,
|
|
10899
|
+
tasks,
|
|
10900
|
+
unlinkedPrs,
|
|
10901
|
+
unlinkedSessions
|
|
10846
10902
|
};
|
|
10847
10903
|
}
|
|
10848
10904
|
//#endregion
|
|
@@ -11086,10 +11142,15 @@ function createOperationRegistry(deps) {
|
|
|
11086
11142
|
clock,
|
|
11087
11143
|
completeSince,
|
|
11088
11144
|
gateways
|
|
11089
|
-
},
|
|
11090
|
-
|
|
11091
|
-
|
|
11092
|
-
|
|
11145
|
+
}, {
|
|
11146
|
+
project: input.project,
|
|
11147
|
+
visibleProjects: visibleProjects(config, actor),
|
|
11148
|
+
includeBoardItems: authorize([{ grant: "operator" }], actor, {
|
|
11149
|
+
config,
|
|
11150
|
+
target: { kind: "missing" }
|
|
11151
|
+
}).status === "allowed",
|
|
11152
|
+
detail: input.detail
|
|
11153
|
+
});
|
|
11093
11154
|
}
|
|
11094
11155
|
},
|
|
11095
11156
|
"task.get": taskQueries.get,
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as ERRORS, f as renderMcpError, l as OPERATIONS } from "./src-
|
|
2
|
-
import { i as CliError, n as requestOperation } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-
|
|
1
|
+
import { N as ERRORS, f as renderMcpError, l as OPERATIONS } from "./src-B0lbg34-.mjs";
|
|
2
|
+
import { i as CliError, n as requestOperation } from "./client-CAcEf5xs.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-Cd5oLu2h.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -564,6 +564,18 @@ const ERRORS = {
|
|
|
564
564
|
hint: "Run the command in a Spur session of a project listed in config.yaml, or run `board token create --name <name> --into <folder>` and ask the operator to approve the request in Slack.",
|
|
565
565
|
recovery: noRetry("Get a caller identity as the fix says, then run the command again.")
|
|
566
566
|
}),
|
|
567
|
+
service_start_failed: spec("service_start_failed", {
|
|
568
|
+
status: null,
|
|
569
|
+
exit: EXIT_CODES.config,
|
|
570
|
+
message: "The service unit is installed, but the service did not start.",
|
|
571
|
+
hint: "Read why it failed with `journalctl --user -u spur-board.service -n 100` and run `board doctor`; systemd keeps restarting the service until the cause is fixed.",
|
|
572
|
+
recovery: {
|
|
573
|
+
action: "Fix the cause shown by `journalctl --user -u spur-board.service -n 100` and `board doctor`, then run `board service restart`.",
|
|
574
|
+
sideEffects: "applied",
|
|
575
|
+
maxRetries: 0,
|
|
576
|
+
retryTiming: "After fixing the cause."
|
|
577
|
+
}
|
|
578
|
+
}),
|
|
567
579
|
outcome_unknown: spec("outcome_unknown", {
|
|
568
580
|
status: null,
|
|
569
581
|
exit: EXIT_CODES.outcomeUnknown,
|
|
@@ -1473,12 +1485,40 @@ const linkViewSchema = z.strictObject({
|
|
|
1473
1485
|
"orchestrator"
|
|
1474
1486
|
]).nullable().describe("Session role; null for a pull request or ticket.")
|
|
1475
1487
|
}).describe("An effective link to a task.");
|
|
1488
|
+
const detailOnly = "Present only with detail.";
|
|
1489
|
+
const count = (what) => z.int().min(0).describe(what);
|
|
1476
1490
|
const statusTaskSchema = taskViewSchema.extend({
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1491
|
+
state: z.string().min(1).describe("One line: ticket status, pull request states and session health counts, joined by \"; \"."),
|
|
1492
|
+
prCount: count("Number of effective pull request links."),
|
|
1493
|
+
sessionCount: count("Number of effective session links."),
|
|
1494
|
+
openBlocks: count("Number of open blocks on the task."),
|
|
1495
|
+
ticket: ticketFactsSchema.nullable().optional().describe(`Latest ticket facts, or null before observation. ${detailOnly}`),
|
|
1496
|
+
prs: z.array(prFactsSchema).optional().describe(`Latest facts for linked pull requests. ${detailOnly}`),
|
|
1497
|
+
sessions: z.array(statusSessionFactsSchema).optional().describe(`Latest facts for linked sessions. ${detailOnly}`),
|
|
1498
|
+
links: z.array(linkViewSchema).optional().describe(`Effective pull request, session, and ticket links. ${detailOnly}`)
|
|
1499
|
+
}).describe("A board task with a one-line state and counts; detail adds its facts and links.");
|
|
1500
|
+
const statusUnlinkedPrSchema = prFactsSchema.partial({
|
|
1501
|
+
author: true,
|
|
1502
|
+
headSha: true,
|
|
1503
|
+
headBranch: true,
|
|
1504
|
+
mergeable: true,
|
|
1505
|
+
mergeState: true,
|
|
1506
|
+
requiredChecks: true,
|
|
1507
|
+
checks: true,
|
|
1508
|
+
reviews: true,
|
|
1509
|
+
reviewThreads: true,
|
|
1510
|
+
reviewRequests: true,
|
|
1511
|
+
ticketKeys: true,
|
|
1512
|
+
updatedAt: true
|
|
1513
|
+
}).describe("A pull request without a task link; fields beyond its identity need detail.");
|
|
1514
|
+
const statusUnlinkedSessionSchema = statusSessionFactsSchema.partial({
|
|
1515
|
+
pr: true,
|
|
1516
|
+
links: true,
|
|
1517
|
+
healthSince: true,
|
|
1518
|
+
lastActivityAt: true,
|
|
1519
|
+
endedAt: true,
|
|
1520
|
+
endReason: true
|
|
1521
|
+
}).describe("A session without a task link; fields beyond its identity need detail.");
|
|
1482
1522
|
const statusItemSchema = itemViewSchema.extend({
|
|
1483
1523
|
key: z.string().min(1).describe("Stable key of this actionable item."),
|
|
1484
1524
|
unconfirmed: z.boolean().describe("Whether a supporting fact is stale or its source is blind."),
|
|
@@ -1639,18 +1679,17 @@ const OPERATIONS = [
|
|
|
1639
1679
|
defineOperation({
|
|
1640
1680
|
id: "status.get",
|
|
1641
1681
|
kind: "query",
|
|
1642
|
-
description: "List
|
|
1682
|
+
description: "List actionable items, source freshness and compact tasks; detail adds full facts and links.",
|
|
1643
1683
|
mcp: {
|
|
1644
|
-
whenToUse: "Get a board overview.",
|
|
1684
|
+
whenToUse: "Get a board overview; pass detail for full ticket, pull request and session facts.",
|
|
1645
1685
|
whenNotToUse: "Use task_get for one task."
|
|
1646
1686
|
},
|
|
1647
|
-
input: z.strictObject({
|
|
1687
|
+
input: z.strictObject({
|
|
1688
|
+
project,
|
|
1689
|
+
detail: z.boolean().optional().describe("Include full ticket, pull request and session facts and links; absent means compact rows.")
|
|
1690
|
+
}),
|
|
1648
1691
|
output: z.strictObject({
|
|
1649
|
-
tasks: z.array(statusTaskSchema).describe("Tasks on the board with facts and links."),
|
|
1650
1692
|
items: z.array(statusItemSchema).describe("Actionable items in priority order."),
|
|
1651
|
-
unlinkedPrs: z.array(prFactsSchema).describe("Observed pull requests without a task link."),
|
|
1652
|
-
unlinkedSessions: z.array(statusSessionFactsSchema).describe("Observed sessions without a task link."),
|
|
1653
|
-
sources: z.array(sourceViewSchema).describe("Freshness and availability of each source."),
|
|
1654
1693
|
warmingUp: z.boolean().describe("Whether required sources still need a complete poll."),
|
|
1655
1694
|
spurUnavailable: z.string().nullable().describe("One combined Spur availability line, or null when available."),
|
|
1656
1695
|
hostLoad: z.string().nullable().describe("Host-load episode line, or null when absent."),
|
|
@@ -1660,7 +1699,11 @@ const OPERATIONS = [
|
|
|
1660
1699
|
since: z.iso.datetime().nullable().describe("When the earliest outage started, ISO 8601 UTC, or null when up."),
|
|
1661
1700
|
reason: z.string().nullable().describe("Reason of the earliest outage, or null when up."),
|
|
1662
1701
|
spaces: z.array(z.enum(SPACE_IDS)).describe("Spaces whose delivery is suspended.")
|
|
1663
|
-
}).describe("Transport health of one gateway.")).describe("Transport health of each chat gateway.")
|
|
1702
|
+
}).describe("Transport health of one gateway.")).describe("Transport health of each chat gateway."),
|
|
1703
|
+
sources: z.array(sourceViewSchema).describe("Freshness and availability of each source."),
|
|
1704
|
+
tasks: z.array(statusTaskSchema).describe("Tasks on the board with state and counts; facts and links with detail."),
|
|
1705
|
+
unlinkedPrs: z.array(statusUnlinkedPrSchema).describe("Observed pull requests without a task link."),
|
|
1706
|
+
unlinkedSessions: z.array(statusUnlinkedSessionSchema).describe("Observed sessions without a task link.")
|
|
1664
1707
|
}),
|
|
1665
1708
|
grants: operatorOrProjectAgent,
|
|
1666
1709
|
errors: ["not_found"],
|
|
@@ -1676,21 +1719,45 @@ const OPERATIONS = [
|
|
|
1676
1719
|
summary: "Show the board",
|
|
1677
1720
|
input: {},
|
|
1678
1721
|
output: {
|
|
1722
|
+
items: [],
|
|
1723
|
+
warmingUp: true,
|
|
1724
|
+
spurUnavailable: null,
|
|
1725
|
+
hostLoad: null,
|
|
1726
|
+
transport: [],
|
|
1727
|
+
sources: [],
|
|
1679
1728
|
tasks: [{
|
|
1680
1729
|
...task,
|
|
1730
|
+
state: "ticket not observed",
|
|
1731
|
+
prCount: 0,
|
|
1732
|
+
sessionCount: 0,
|
|
1733
|
+
openBlocks: 0
|
|
1734
|
+
}],
|
|
1735
|
+
unlinkedPrs: [],
|
|
1736
|
+
unlinkedSessions: []
|
|
1737
|
+
}
|
|
1738
|
+
}, {
|
|
1739
|
+
summary: "Show the board with full facts and links",
|
|
1740
|
+
input: { detail: true },
|
|
1741
|
+
output: {
|
|
1742
|
+
items: [],
|
|
1743
|
+
warmingUp: false,
|
|
1744
|
+
spurUnavailable: null,
|
|
1745
|
+
hostLoad: null,
|
|
1746
|
+
transport: [],
|
|
1747
|
+
sources: [],
|
|
1748
|
+
tasks: [{
|
|
1749
|
+
...task,
|
|
1750
|
+
state: "ticket not observed",
|
|
1751
|
+
prCount: 0,
|
|
1752
|
+
sessionCount: 0,
|
|
1753
|
+
openBlocks: 0,
|
|
1681
1754
|
ticket: null,
|
|
1682
1755
|
prs: [],
|
|
1683
1756
|
sessions: [],
|
|
1684
1757
|
links: []
|
|
1685
1758
|
}],
|
|
1686
|
-
items: [],
|
|
1687
1759
|
unlinkedPrs: [],
|
|
1688
|
-
unlinkedSessions: []
|
|
1689
|
-
sources: [],
|
|
1690
|
-
warmingUp: true,
|
|
1691
|
-
spurUnavailable: null,
|
|
1692
|
-
hostLoad: null,
|
|
1693
|
-
transport: []
|
|
1760
|
+
unlinkedSessions: []
|
|
1694
1761
|
}
|
|
1695
1762
|
}]
|
|
1696
1763
|
}),
|
package/package.json
CHANGED
|
@@ -22,10 +22,10 @@ Every command can return the common errors below. Each entry lists its other cod
|
|
|
22
22
|
|
|
23
23
|
### `board status`
|
|
24
24
|
|
|
25
|
-
Purpose: List
|
|
25
|
+
Purpose: List actionable items, source freshness and compact tasks; detail adds full facts and links.
|
|
26
26
|
Arguments: none.
|
|
27
|
-
Flags: `--project <value>`, `--json`.
|
|
28
|
-
Use when: Get a board overview.
|
|
27
|
+
Flags: `--project <value>`, `--detail`, `--json`.
|
|
28
|
+
Use when: Get a board overview; pass detail for full ticket, pull request and session facts.
|
|
29
29
|
Avoid when: Use `board task <task>` for one task.
|
|
30
30
|
Example: `board status` — Show the board.
|
|
31
31
|
Other errors: `not_found`.
|