spur-board 0.20.2 → 0.21.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/bin.mjs +3 -0
- package/dist/cli.mjs +942 -18
- package/dist/{client-DfvJWQFq.mjs → client-DPui_SJQ.mjs} +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{config-BDEvO1UV.mjs → config-5V7e_pTh.mjs} +17 -5
- package/dist/daemon.mjs +143 -6
- package/dist/mcp.mjs +3 -3
- package/dist/{src-BQIJz8yP.mjs → src-21T39XXT.mjs} +19 -0
- package/package.json +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/setup/references/update.md +23 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-
|
|
1
|
+
import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-21T39XXT.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-DPui_SJQ.mjs";
|
|
2
2
|
export { fetchCatalogVersion, requestOperation, requestTokenEnrollment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as DEFAULT_HTTP_PORT, U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-
|
|
2
|
-
import { i as CliError, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { R as DEFAULT_HTTP_PORT, U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-21T39XXT.mjs";
|
|
2
|
+
import { i as CliError, t as fetchCatalogVersion } from "./client-DPui_SJQ.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";
|
|
@@ -9,12 +9,24 @@ import YAML from "yaml";
|
|
|
9
9
|
//#region src/config.ts
|
|
10
10
|
const CONNECT_TIMEOUT_MS = 2e3;
|
|
11
11
|
const RESPONSE_TIMEOUT_MS = 3e4;
|
|
12
|
-
|
|
12
|
+
/** A relative `BOARD_HOME` counts from `cwd`; relative XDG directories are ignored. */
|
|
13
|
+
function configFile(env, home, cwd = process.cwd()) {
|
|
13
14
|
const boardHome = env["BOARD_HOME"];
|
|
14
|
-
if (boardHome) return join(resolve(boardHome), "config.yaml");
|
|
15
|
+
if (boardHome) return join(resolve(cwd, boardHome), "config.yaml");
|
|
15
16
|
const xdg = env["XDG_CONFIG_HOME"];
|
|
16
17
|
return join(xdg && isAbsolute(xdg) ? xdg : join(home, ".config"), "spur-board", "config.yaml");
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The directory of the daemon database and its lock. It mirrors `resolvePaths` in
|
|
21
|
+
* packages/daemon/src/config.ts, which resolves a relative `BOARD_HOME` from the daemon's
|
|
22
|
+
* working directory, here `cwd`; the CLI cannot import the daemon package.
|
|
23
|
+
*/
|
|
24
|
+
function dataDirectory(env, home, cwd = process.cwd()) {
|
|
25
|
+
const boardHome = env["BOARD_HOME"];
|
|
26
|
+
if (boardHome) return resolve(cwd, boardHome);
|
|
27
|
+
const xdg = env["XDG_DATA_HOME"];
|
|
28
|
+
return join(xdg && isAbsolute(xdg) ? xdg : join(home, ".local", "share"), "spur-board");
|
|
29
|
+
}
|
|
18
30
|
/** The http.port in config.yaml, or the default when the file is missing or invalid. */
|
|
19
31
|
function readConfiguredPort(env, home) {
|
|
20
32
|
try {
|
|
@@ -233,4 +245,4 @@ function fileVerdictCache(path, cliVersion) {
|
|
|
233
245
|
} };
|
|
234
246
|
}
|
|
235
247
|
//#endregion
|
|
236
|
-
export { memoryVerdictCache as a,
|
|
248
|
+
export { memoryVerdictCache as a, loadClientConfig as c, resolveDaemonAddress as d, fileVerdictCache as i, loadEnrollmentConfig as l, cliPackageVersion as n, configFile as o, compareCatalogs as r, dataDirectory as s, checkCatalog as t, readConfiguredPort as u };
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-
|
|
1
|
+
import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-21T39XXT.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
|
-
import { closeSync, existsSync, fstatSync, ftruncateSync, mkdirSync, openSync, readFileSync, readdirSync, writeSync } from "node:fs";
|
|
4
|
+
import { closeSync, existsSync, fstatSync, fsyncSync, ftruncateSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import path, { dirname, isAbsolute, join, resolve } from "node:path";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -47,6 +47,90 @@ const PERSONA_ROLES = [
|
|
|
47
47
|
"board"
|
|
48
48
|
];
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region ../core/src/store/copy.ts
|
|
51
|
+
/**
|
|
52
|
+
* Opens a database read-write with no PRAGMA, migration or version check: the connection only
|
|
53
|
+
* feeds a copy or checkpoints a WAL. Read-write, so SQLite replays a leftover `-wal`.
|
|
54
|
+
*/
|
|
55
|
+
function openRaw(file, purpose) {
|
|
56
|
+
try {
|
|
57
|
+
return new Database(file, {
|
|
58
|
+
fileMustExist: true,
|
|
59
|
+
timeout: 5e3
|
|
60
|
+
});
|
|
61
|
+
} catch (error) {
|
|
62
|
+
throw new Error(`Cannot open database ${file} to ${purpose}`, { cause: error });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function fsyncFile(file) {
|
|
66
|
+
const fd = openSync(file, "r+");
|
|
67
|
+
try {
|
|
68
|
+
fsyncSync(fd);
|
|
69
|
+
} finally {
|
|
70
|
+
closeSync(fd);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** Moves every committed row of the target's `-wal` into its main file and empties the WAL. */
|
|
74
|
+
function checkpoint(file) {
|
|
75
|
+
const db = openRaw(file, "checkpoint it");
|
|
76
|
+
try {
|
|
77
|
+
const [result] = db.pragma("wal_checkpoint(TRUNCATE)");
|
|
78
|
+
if (result !== void 0 && result.busy !== 0) throw new Error(`Database ${file} is in use; its WAL cannot be checkpointed`);
|
|
79
|
+
} finally {
|
|
80
|
+
db.close();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Copies a database into one self-contained file at `target`, with the source's rows, schema
|
|
85
|
+
* and `user_version`. `source` is a path or an open connection. The copy is written with
|
|
86
|
+
* `VACUUM INTO` to `<target>.partial` and synced. An existing target with a non-empty `-wal` is
|
|
87
|
+
* then checkpointed, so its main file holds every committed row. The target is hard-linked to
|
|
88
|
+
* `<target>.replaced-<uuid>`, its empty `-wal` and `-shm` are removed, the partial is renamed
|
|
89
|
+
* over `target`, and only then is the link removed. A kill at any point leaves a complete
|
|
90
|
+
* database at `target`, the old one or the new one. A failure before the rename leaves the
|
|
91
|
+
* target as it is, with no `.partial` and no link. `step` is called after each step; tests use
|
|
92
|
+
* it to stand in for a kill.
|
|
93
|
+
*
|
|
94
|
+
* Opens `target` only to checkpoint a non-empty `-wal`. Creates no directory, takes no lock and
|
|
95
|
+
* checks no version: the caller creates the directory and holds the board lock or owns the
|
|
96
|
+
* connection.
|
|
97
|
+
*/
|
|
98
|
+
function copyDatabase(source, target, step = () => void 0) {
|
|
99
|
+
const sourceFile = typeof source === "string" ? source : source.name;
|
|
100
|
+
if (resolve(sourceFile) === resolve(target)) throw new Error(`Cannot copy database ${sourceFile} onto itself`);
|
|
101
|
+
const db = typeof source === "string" ? openRaw(source, "copy it") : source;
|
|
102
|
+
const partial = `${target}.partial`;
|
|
103
|
+
const aside = `${target}.replaced-${randomUUID()}`;
|
|
104
|
+
let linked = false;
|
|
105
|
+
try {
|
|
106
|
+
rmSync(partial, { force: true });
|
|
107
|
+
db.prepare("VACUUM INTO ?").run(partial);
|
|
108
|
+
fsyncFile(partial);
|
|
109
|
+
step("partial");
|
|
110
|
+
if (existsSync(target)) {
|
|
111
|
+
if ((statSync(`${target}-wal`, { throwIfNoEntry: false })?.size ?? 0) > 0) {
|
|
112
|
+
checkpoint(target);
|
|
113
|
+
step("checkpoint");
|
|
114
|
+
}
|
|
115
|
+
linkSync(target, aside);
|
|
116
|
+
linked = true;
|
|
117
|
+
step("link");
|
|
118
|
+
}
|
|
119
|
+
rmSync(`${target}-wal`, { force: true });
|
|
120
|
+
rmSync(`${target}-shm`, { force: true });
|
|
121
|
+
step("journal");
|
|
122
|
+
renameSync(partial, target);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
rmSync(partial, { force: true });
|
|
125
|
+
if (linked) rmSync(aside, { force: true });
|
|
126
|
+
throw error;
|
|
127
|
+
} finally {
|
|
128
|
+
if (typeof source === "string") db.close();
|
|
129
|
+
}
|
|
130
|
+
step("rename");
|
|
131
|
+
if (linked) rmSync(aside, { force: true });
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
50
134
|
//#region ../core/src/store/migrate.ts
|
|
51
135
|
/** The migration files that ship with this package. */
|
|
52
136
|
const migrationsDir = new URL("./migrations/", import.meta.url);
|
|
@@ -88,7 +172,7 @@ function assertNotNewer(db, target) {
|
|
|
88
172
|
* Brings `db` to the last version in `migrations`. The version lives only in
|
|
89
173
|
* `PRAGMA user_version`. A database newer than the code is refused before any write. Unless
|
|
90
174
|
* the file is new and empty, a database with pending migrations is first copied with
|
|
91
|
-
* `
|
|
175
|
+
* `copyDatabase`. All pending migrations then run in one `BEGIN IMMEDIATE` transaction with
|
|
92
176
|
* foreign keys off, and `foreign_key_check` must come back empty before `COMMIT`; any error
|
|
93
177
|
* rolls everything back.
|
|
94
178
|
*/
|
|
@@ -106,7 +190,7 @@ function migrate(db, migrations) {
|
|
|
106
190
|
let backup = null;
|
|
107
191
|
if (!(db.prepare("SELECT count(*) FROM sqlite_schema").pluck().get() === 0)) {
|
|
108
192
|
backup = backupPath(db.name, from);
|
|
109
|
-
db
|
|
193
|
+
copyDatabase(db, backup);
|
|
110
194
|
}
|
|
111
195
|
const kept = `database kept at v${String(from)}${backup === null ? "" : `, backup at ${backup}`}`;
|
|
112
196
|
db.pragma("foreign_keys = OFF");
|
|
@@ -8933,6 +9017,11 @@ async function createApiServer(options) {
|
|
|
8933
9017
|
doctorInFlight = null;
|
|
8934
9018
|
}
|
|
8935
9019
|
});
|
|
9020
|
+
app.get("/v1/health", async (_request, reply) => {
|
|
9021
|
+
if (!options.ready()) throw new CommandError("starting", "Wait until the daemon is ready.");
|
|
9022
|
+
if (options.firstPollDone === void 0) throw new CommandError("not_found", "Health is unavailable.");
|
|
9023
|
+
return reply.send({ firstPollDone: await options.firstPollDone() });
|
|
9024
|
+
});
|
|
8936
9025
|
app.post("/v1/tokens/requests", async (request, reply) => {
|
|
8937
9026
|
if (!options.ready()) throw new CommandError("starting", "Wait until the daemon is ready.");
|
|
8938
9027
|
const parsed = tokenRequestSchema.safeParse(request.body);
|
|
@@ -11422,6 +11511,15 @@ function doctorSources(config) {
|
|
|
11422
11511
|
return /* @__PURE__ */ new Set(["spur", ...config.projects.flatMap((project) => [trackerSource(project), ...project.repos.map((repo) => `github:${project.id}:${repo.toLowerCase()}`)])]);
|
|
11423
11512
|
}
|
|
11424
11513
|
/**
|
|
11514
|
+
* True once every configured source that is not blind has had a complete poll in this process.
|
|
11515
|
+
* A blind source never completes, so it is left out rather than holding the answer false.
|
|
11516
|
+
*/
|
|
11517
|
+
async function firstPollDone(db, config, completeSince) {
|
|
11518
|
+
const states = await db.selectFrom("source_state").select("source").where("blind_reason", "is not", null).execute();
|
|
11519
|
+
const blind = new Set(states.map((state) => state.source));
|
|
11520
|
+
return [...doctorSources(config)].every((source) => blind.has(source) || completeSince.has(source));
|
|
11521
|
+
}
|
|
11522
|
+
/**
|
|
11425
11523
|
* Called from an accepted observation's transaction after board and item reconciliation.
|
|
11426
11524
|
* The version marker and feed row share that transaction with the source-state update.
|
|
11427
11525
|
*/
|
|
@@ -17130,6 +17228,7 @@ function createHttpModule(ctx, options = {}) {
|
|
|
17130
17228
|
registry: options.registry ?? {},
|
|
17131
17229
|
...options.afterOperation === void 0 ? {} : { afterOperation: options.afterOperation },
|
|
17132
17230
|
doctor: options.doctor ?? (() => runDaemonDoctor(ctx, options.productVersion ?? "unknown", options.fetcher)),
|
|
17231
|
+
...options.firstPollDone === void 0 ? {} : { firstPollDone: options.firstPollDone },
|
|
17133
17232
|
logRequest: ({ requestId, method, url, status, tokenName }) => {
|
|
17134
17233
|
const path = new URL(url, "http://127.0.0.1").pathname;
|
|
17135
17234
|
ctx.log.info({
|
|
@@ -17388,7 +17487,7 @@ function createSystemdNotifier(options) {
|
|
|
17388
17487
|
}
|
|
17389
17488
|
/**
|
|
17390
17489
|
* READY is sent from the `ready` hook, after every module started and the daemon state became
|
|
17391
|
-
* `ready`, so HTTP `/
|
|
17490
|
+
* `ready`, so HTTP `/v1/schema` already answers 200 when systemd releases the unit. A failed or
|
|
17392
17491
|
* aborted start runs no hook and sends nothing.
|
|
17393
17492
|
*/
|
|
17394
17493
|
function createSystemdModule(notifier) {
|
|
@@ -17488,6 +17587,7 @@ function createDaemonModules(ctxFor, ports = {}) {
|
|
|
17488
17587
|
stopStage: "final",
|
|
17489
17588
|
module: createHttpModule(ctxFor("http"), {
|
|
17490
17589
|
registry,
|
|
17590
|
+
firstPollDone: () => firstPollDone(board.store.db, board.config, core.completeSince),
|
|
17491
17591
|
...ports.productVersion === void 0 ? {} : { productVersion: ports.productVersion },
|
|
17492
17592
|
...ports.sessionFetcher === void 0 ? {} : { fetcher: ports.sessionFetcher },
|
|
17493
17593
|
...ports.afterOperation === void 0 ? {} : { afterOperation: ports.afterOperation },
|
|
@@ -17563,6 +17663,43 @@ async function main() {
|
|
|
17563
17663
|
shutdownTimeoutMs: DEFAULT_SHUTDOWN_TIMEOUT_MS
|
|
17564
17664
|
});
|
|
17565
17665
|
}
|
|
17666
|
+
function errorText(error) {
|
|
17667
|
+
if (!(error instanceof Error)) return String(error);
|
|
17668
|
+
return error.cause instanceof Error ? `${error.message}: ${error.cause.message}` : error.message;
|
|
17669
|
+
}
|
|
17670
|
+
/**
|
|
17671
|
+
* `copy-database <source> <target>` in the packed binary: copies the board database to or from
|
|
17672
|
+
* a backup with `copyDatabase` while holding the board lock. One of the two absolute paths must
|
|
17673
|
+
* be this environment's database file. Exits 0 on success, 2 on bad arguments, 75 while another
|
|
17674
|
+
* process holds the lock, and 1 on any other error.
|
|
17675
|
+
*/
|
|
17676
|
+
function copyDatabaseMain(args, env = process.env, home = homedir(), writeErr = (text) => {
|
|
17677
|
+
process.stderr.write(text);
|
|
17678
|
+
}) {
|
|
17679
|
+
const paths = resolvePaths(env, home);
|
|
17680
|
+
const dbFile = resolve(paths.dbFile);
|
|
17681
|
+
const [source, target] = args;
|
|
17682
|
+
if (args.length !== 2 || source === void 0 || target === void 0 || !isAbsolute(source) || !isAbsolute(target) || resolve(source) !== dbFile && resolve(target) !== dbFile) {
|
|
17683
|
+
writeErr(`copy-database: give two absolute paths, one of them the board database ${dbFile}\n`);
|
|
17684
|
+
return 2;
|
|
17685
|
+
}
|
|
17686
|
+
let lock;
|
|
17687
|
+
try {
|
|
17688
|
+
lock = acquireLock(paths.lockFile);
|
|
17689
|
+
} catch (error) {
|
|
17690
|
+
writeErr(`copy-database: ${errorText(error)}\n`);
|
|
17691
|
+
return error instanceof LockHeldError ? 75 : 1;
|
|
17692
|
+
}
|
|
17693
|
+
try {
|
|
17694
|
+
copyDatabase(source, target);
|
|
17695
|
+
return 0;
|
|
17696
|
+
} catch (error) {
|
|
17697
|
+
writeErr(`copy-database: ${errorText(error)}\n`);
|
|
17698
|
+
return 1;
|
|
17699
|
+
} finally {
|
|
17700
|
+
lock.release();
|
|
17701
|
+
}
|
|
17702
|
+
}
|
|
17566
17703
|
if (import.meta.main) main();
|
|
17567
17704
|
//#endregion
|
|
17568
|
-
export { main, publishedVersion };
|
|
17705
|
+
export { copyDatabaseMain, main, publishedVersion };
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-
|
|
2
|
-
import { i as CliError, n as requestOperation } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache,
|
|
1
|
+
import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-21T39XXT.mjs";
|
|
2
|
+
import { i as CliError, n as requestOperation } from "./client-DPui_SJQ.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./config-5V7e_pTh.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -622,6 +622,25 @@ const ERRORS = {
|
|
|
622
622
|
retryTiming: "After fixing the cause."
|
|
623
623
|
}
|
|
624
624
|
}),
|
|
625
|
+
update_rolled_back: spec("update_rolled_back", {
|
|
626
|
+
status: null,
|
|
627
|
+
exit: EXIT_CODES.config,
|
|
628
|
+
message: "The update failed, so the board is back on the version it ran before.",
|
|
629
|
+
hint: "Fix the cause named in this error, then run `board update` again.",
|
|
630
|
+
recovery: noRetry("Fix the reported cause, then run `board update` again.")
|
|
631
|
+
}),
|
|
632
|
+
rollback_failed: spec("rollback_failed", {
|
|
633
|
+
status: null,
|
|
634
|
+
exit: EXIT_CODES.config,
|
|
635
|
+
message: "A rollback step failed; the package, database or service may be only partly restored.",
|
|
636
|
+
hint: "Fix the step named in this error, then run `board rollback --yes` again.",
|
|
637
|
+
recovery: {
|
|
638
|
+
action: "Fix the reported step, then run `board rollback --yes`.",
|
|
639
|
+
sideEffects: "applied",
|
|
640
|
+
maxRetries: 0,
|
|
641
|
+
retryTiming: "After fixing the reported step."
|
|
642
|
+
}
|
|
643
|
+
}),
|
|
625
644
|
outcome_unknown: spec("outcome_unknown", {
|
|
626
645
|
status: null,
|
|
627
646
|
exit: EXIT_CODES.outcomeUnknown,
|
package/package.json
CHANGED
package/skills/setup/SKILL.md
CHANGED
|
@@ -41,4 +41,4 @@ Ask one question at a time, only when current state cannot answer it. Check befo
|
|
|
41
41
|
|
|
42
42
|
## Update
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Follow [the update run](references/update.md): `board update`, or a manual first upgrade when it is missing.
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
# Update run
|
|
2
2
|
|
|
3
|
-
Use this when the installed package is older than the intended release. Keep completed configuration and operator access intact.
|
|
4
|
-
|
|
5
|
-
1. Check the package version, live Spur session Node and PATH, installed skill stamps
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
4.
|
|
10
|
-
5. Run `board
|
|
11
|
-
6.
|
|
3
|
+
Use this when the installed package is older than the intended release. `board update` does the whole update and rolls back by itself when the new version is unhealthy. Keep completed configuration and operator access intact.
|
|
4
|
+
|
|
5
|
+
1. Check the package version, the live Spur session Node and PATH, installed skill stamps, `board service status`, and current `board doctor --json` results. Record the blocking checks: they do not stop the update, and only checks that start blocking after it make it roll back.
|
|
6
|
+
If the help of the installed package lists no `board update`, follow [First upgrade](#first-upgrade-without-board-update) instead of steps 2-10.
|
|
7
|
+
2. Run every `board` command below with the Node and PATH of a live Spur session. The update refuses when this shell's Node, package path or `BOARD_HOME` and `XDG_*` settings differ from the service unit, or when the running daemon uses another data directory or config file, drop-ins and environment files included; its hint quotes both sides. If the service was installed from another environment, ask before running `board service install` from this one.
|
|
8
|
+
3. The update needs a running daemon. If the service is stopped, ask before starting it with `board service restart`.
|
|
9
|
+
4. Tell the operator the installed version and the target, then ask before updating. The service is down for the update.
|
|
10
|
+
5. Run `board update` for the latest release, or `board update <version>` for a named one. Progress lines go to stderr; the JSON result goes to stdout. A result with `changed` as `false` means the version was already installed; stop there.
|
|
11
|
+
6. On success, report `from`, `to`, `database.schemaChanged` and each `operator` line. Agent sessions that run `board mcp` must restart to load the new catalog; Spur sessions named as stale must stop and wake to load the new skill. Do not restart the service or reinstall the skills again: the update did both.
|
|
12
|
+
7. On exit 4 with `update_rolled_back`, the previous version is running again unless the hint reports a failed restart. Report the hint: it names the failed step and says whether the database was kept, restored, or not changed. At `first poll`, a source did not finish its first complete poll within five minutes. Fix the cause with the operator, then run `board update` again.
|
|
13
|
+
8. On exit 4 with `rollback_failed`, follow `Failed update or rollback` in TROUBLESHOOTING.md: fix the step the hint names, then run `board rollback --yes` again.
|
|
14
|
+
9. On any other exit 4 (`config`) or exit 2 (`usage`), nothing was changed. Report the hint and fix what it names; an older target is refused and points to `board rollback`. When another update or rollback holds the update lock, the hint gives the PID that took it: wait for it and the install it started to finish, and never remove the lock file.
|
|
15
|
+
10. To go back to the version before the last update, first run `board rollback` without `--yes`. Outside a terminal it changes nothing, prints what it would do and the `Lost:` text to stderr, and exits 2. Tell the operator that text: either nothing, or the Board changes and journal events recorded after the update started. Run `board rollback --yes` only after the operator agrees.
|
|
16
|
+
11. Never rewrite settled config or secrets, reissue an operator token, uninstall the service, or revoke a token as part of an update.
|
|
17
|
+
|
|
18
|
+
## First upgrade without `board update`
|
|
19
|
+
|
|
20
|
+
Do this once; every later upgrade uses `board update`.
|
|
21
|
+
|
|
22
|
+
1. Install the newer package with the Node and user prefix of a live Spur session. Verify `board --version` there.
|
|
23
|
+
2. Note whether `board service status` reports `active` as `active`. Run the new package's `board service install`. Run `board service restart` only when the service was active before, install reported `changed` as `false`, and the daemon version changed.
|
|
24
|
+
3. Ask before writing agent skill folders, then run `board skills install`.
|
|
25
|
+
4. Run `board doctor --json` until no blocking check remains. Ask the operator to restart live sessions that still use the older skill.
|