spur-board 0.12.0 → 0.12.1
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-BOm8yksw.mjs} +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{config-BkpjmVZh.mjs → config-Dl7_gx5z.mjs} +2 -2
- package/dist/daemon.mjs +1 -1
- package/dist/mcp.mjs +3 -3
- package/dist/{src-4YeTky_x.mjs → src-CYQZCwhN.mjs} +12 -0
- package/package.json +1 -1
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-CYQZCwhN.mjs";
|
|
2
|
+
import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-BOm8yksw.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-Dl7_gx5z.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-CYQZCwhN.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-BOm8yksw.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-CYQZCwhN.mjs";
|
|
2
|
+
import { i as CliError, t as fetchCatalogVersion } from "./client-BOm8yksw.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-CYQZCwhN.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";
|
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-CYQZCwhN.mjs";
|
|
2
|
+
import { i as CliError, n as requestOperation } from "./client-BOm8yksw.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-Dl7_gx5z.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,
|