slateboard 0.1.0 → 0.1.2
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/README.md +33 -192
- package/dist/arch-3JZTL2DJ.js +1842 -0
- package/dist/bin.js +93 -17
- package/dist/{chunk-ONZFKR4I.js → chunk-6CR2V7P7.js} +172 -22
- package/dist/chunk-6YTKJKSG.js +129 -0
- package/dist/{chunk-SQHGMBUM.js → chunk-KA7Z72FC.js} +3 -2
- package/dist/{chunk-WXM4BB4D.js → chunk-OJOVDYIZ.js} +1400 -873
- package/dist/{chunk-BWNUX4FT.js → chunk-WREOGLK6.js} +4 -4
- package/dist/{chunk-FMO5B2KJ.js → chunk-ZCFHR5VG.js} +5 -5
- package/dist/{client-JHI2EG6J.js → client-BFKANUSM.js} +4 -4
- package/dist/{commands-ONES545N.js → commands-IB76RJGP.js} +1 -1
- package/dist/{doctor-H5Y5L2JZ.js → doctor-RPN73UNG.js} +3 -3
- package/dist/{hooks-2TI5OLAU.js → hooks-QJ4XG42C.js} +13 -1
- package/dist/{lifecycle-ZB5HEO5P.js → lifecycle-O7LDC735.js} +4 -4
- package/dist/{service-command-26BPMBK3.js → service-command-WG4TAU2T.js} +5 -5
- package/dist/shipped-7D2LNTAK.js +153 -0
- package/dist/{src-QZIVUACM.js → src-2MHSOXLY.js} +12 -2
- package/dist/{src-YVFB3ZLM.js → src-QB7VJHQH.js} +21 -1
- package/dist/ui/assets/abnfDiagram-XWFEHMT6-DAC8TnbO.js +1 -0
- package/dist/ui/assets/architecture-WOLXFQ4H-X8k0-LVf.js +1 -0
- package/dist/ui/assets/architectureDiagram-CSQXQB3N-CVoxvA0s.js +36 -0
- package/dist/ui/assets/blockDiagram-BEDRHYPZ-DGf5VAwB.js +140 -0
- package/dist/ui/assets/bpmnIcons-APHXDYXF-C0jbCElo.js +1 -0
- package/dist/ui/assets/c4Diagram-M2UUVUY5-PB5quCOl.js +38 -0
- package/dist/ui/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/ui/assets/chunk-3GCGMST5-RRiusQp9.js +1 -0
- package/dist/ui/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/ui/assets/chunk-7U7NFRK5-CSOOpKZT.js +88 -0
- package/dist/ui/assets/chunk-CNRTWJTD-DJuDnaYn.js +1 -0
- package/dist/ui/assets/chunk-D5HYT7QG-imLQxbAy.js +1 -0
- package/dist/ui/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
- package/dist/ui/assets/chunk-DZSZGQHW-BCXsfFfT.js +1 -0
- package/dist/ui/assets/chunk-EBZ3SEQC-CdDips7b.js +2 -0
- package/dist/ui/assets/chunk-F3AE6A5H-DTVcMSk7.js +1 -0
- package/dist/ui/assets/chunk-FGVZ23HU-BEVs0fgA.js +213 -0
- package/dist/ui/assets/chunk-GZTWQ64R-CKGVWw4I.js +62 -0
- package/dist/ui/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
- package/dist/ui/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/ui/assets/chunk-KTR4FSNJ-DSr3q0Xy.js +1 -0
- package/dist/ui/assets/chunk-MDAHDJXZ-YMIkXJ0O.js +10 -0
- package/dist/ui/assets/chunk-MPYPSXSE-C-CxVwa7.js +1 -0
- package/dist/ui/assets/chunk-ND7LMLKX-lfusdDHU.js +72 -0
- package/dist/ui/assets/chunk-NGNAAXSQ-DqoPQk1a.js +136 -0
- package/dist/ui/assets/chunk-OWCVCYLK-4-W-ynqW.js +2 -0
- package/dist/ui/assets/chunk-QDWOWVBQ-Du0KmhW4.js +129 -0
- package/dist/ui/assets/chunk-T47YP6PS-CKli33QU.js +1 -0
- package/dist/ui/assets/chunk-XXDRQBXY-DSL17ZTh.js +1 -0
- package/dist/ui/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/ui/assets/classDiagram-v2-KXABOMEV-CYc2BZ2y.js +217 -0
- package/dist/ui/assets/cose-bilkent-JH36ORCC-81nUs0at.js +1 -0
- package/dist/ui/assets/cynefin-EF2NZ3EQ-Clvwy422.js +1 -0
- package/dist/ui/assets/cynefinDiagram-NJNITYFG-CsgTQqAC.js +62 -0
- package/dist/ui/assets/cytoscape.esm-BPveszXl.js +321 -0
- package/dist/ui/assets/d3-scale-lXtN6-Od.js +1 -0
- package/dist/ui/assets/d3-selection-BFzs9NTX.js +1 -0
- package/dist/ui/assets/dagre-KIHZ2IZ3--BpWd3hW.js +4 -0
- package/dist/ui/assets/diagram-7YQZDPLS-Dp_m-C1a.js +41 -0
- package/dist/ui/assets/diagram-QBROCOUO-Bt-Lp7vq.js +200 -0
- package/dist/ui/assets/diagram-RJJCUUZO-DLsG2Tej.js +30 -0
- package/dist/ui/assets/diagram-WERXNKYE-D31SLp70.js +24 -0
- package/dist/ui/assets/diagram-YHHI257C-CVMeUILe.js +3 -0
- package/dist/ui/assets/diagram-YR4HJLHV-Bz9qvIhJ.js +24 -0
- package/dist/ui/assets/dist-YCovsM_S.js +1 -0
- package/dist/ui/assets/ebnfDiagram-N527522P-_FIZSf8P.js +1 -0
- package/dist/ui/assets/elk-O5DQBFGD-BK3qD3UW.js +27 -0
- package/dist/ui/assets/erDiagram-K3K3BIDK-Dmpdi5Ob.js +99 -0
- package/dist/ui/assets/eventmodeling-K75KTNOO-Dt-51L4s.js +1 -0
- package/dist/ui/assets/flowDiagram-Z6JWZHQI-Cn2ZVzvO.js +1 -0
- package/dist/ui/assets/ganttDiagram-3PRQTZWP-BaZof7eT.js +292 -0
- package/dist/ui/assets/gitGraph-VSP46ZUC-ezyaB0jQ.js +1 -0
- package/dist/ui/assets/gitGraphDiagram-VXDFKS5L-DRNdClPw.js +106 -0
- package/dist/ui/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/ui/assets/grid-E2QIVN74--djCUwdI.js +1 -0
- package/dist/ui/assets/index-Bly281F6.css +1 -0
- package/dist/ui/assets/index-CXK8WmR8.js +45 -0
- package/dist/ui/assets/info-OHQRW6UA-DsFXrFWI.js +1 -0
- package/dist/ui/assets/infoDiagram-EZ3ZOAHP-e8qx3eqc.js +2 -0
- package/dist/ui/assets/ishikawaDiagram-S3EKX5GW-CuKExPKN.js +70 -0
- package/dist/ui/assets/journeyDiagram-POQNLL5X-D0GE8iji.js +139 -0
- package/dist/ui/assets/kanban-definition-BH5XI6FM-NL5dOF_0.js +89 -0
- package/dist/ui/assets/katex-BXIx1Jgr.js +257 -0
- package/dist/ui/assets/mermaid-parser.core-0pE4JCc_.js +7 -0
- package/dist/ui/assets/mermaid.core-BVgUieVU.js +44 -0
- package/dist/ui/assets/mindmap-definition-WVAN44T4-BLTtjuVH.js +98 -0
- package/dist/ui/assets/packet-JDAUHWVQ-C-7DeilZ.js +1 -0
- package/dist/ui/assets/pegDiagram-D4NLKWP3-F2SSXiqv.js +1 -0
- package/dist/ui/assets/pie-XZMESJXO-B4BkiWTy.js +1 -0
- package/dist/ui/assets/pieDiagram-36ENHN4W-BB5uEdtB.js +39 -0
- package/dist/ui/assets/quadrantDiagram-ZQUDMS73-B5iPooYO.js +7 -0
- package/dist/ui/assets/radar-ABXABTNO-Dx3jkQdr.js +1 -0
- package/dist/ui/assets/railroad-I3PHUGI6-BSh47OT_.js +1 -0
- package/dist/ui/assets/railroad-abnf-LNEFI6M7-BWFvDxOj.js +1 -0
- package/dist/ui/assets/railroad-ebnf-DWYD2UWJ-GBoLzumA.js +1 -0
- package/dist/ui/assets/railroad-peg-JR7BVNR7-DByw5Orh.js +1 -0
- package/dist/ui/assets/railroadDiagram-JIZHGYPL--ptGd2NR.js +1 -0
- package/dist/ui/assets/render-VIF2ZAQL-CzNp-J42.js +2 -0
- package/dist/ui/assets/requirementDiagram-AXW2TVFA-DBh9Dt63.js +84 -0
- package/dist/ui/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/ui/assets/sankeyDiagram-FBCJTAIF-CjJtGyu8.js +40 -0
- package/dist/ui/assets/sequenceDiagram-3LA2ROMG-BzeMVuzG.js +169 -0
- package/dist/ui/assets/sizeCapture-2Q2CQKSF-DSY_W0YL.js +1 -0
- package/dist/ui/assets/stateDiagram-v2-ATKHQDJO-DYavre2v.js +291 -0
- package/dist/ui/assets/swimlanes-YQL5WMAO-CUTCsfPM.js +1 -0
- package/dist/ui/assets/swimlanesDiagram-UCCPES4V-B7bXxKVr.js +8 -0
- package/dist/ui/assets/timeline-definition-7Z437IG3-HWrtH0QT.js +120 -0
- package/dist/ui/assets/treeView-D4JQ5SDB-B5lbyI_M.js +1 -0
- package/dist/ui/assets/treemap-SAJKECNS-Ckfi-DGc.js +1 -0
- package/dist/ui/assets/usecaseDiagram-RDK6N6HP-BuKN2NAW.js +328 -0
- package/dist/ui/assets/vennDiagram-SHRQU5PJ-s2gljkjP.js +34 -0
- package/dist/ui/assets/wardley-7MLQ67FV-CjAqYBcP.js +1 -0
- package/dist/ui/assets/wardleyDiagram-F3OXNVQS-Ba_SoMTx.js +78 -0
- package/dist/ui/assets/xychartDiagram-GDYJKCDI-FsxUUoqL.js +7 -0
- package/dist/ui/index.html +2 -2
- package/dist/{upgrade-FND3UBJR.js → upgrade-M6TR3IBW.js} +15 -15
- package/migrations/0006_arch_auto.sql +8 -0
- package/package.json +1 -1
- package/dist/chunk-3ZLMW2RI.js +0 -74
- package/dist/ui/assets/index-4WzXlYHs.css +0 -1
- package/dist/ui/assets/index-ZKfByx7Q.js +0 -42
package/dist/bin.js
CHANGED
|
@@ -10,6 +10,7 @@ import { parseArgs } from "node:util";
|
|
|
10
10
|
var UsageError = class extends Error {
|
|
11
11
|
};
|
|
12
12
|
var SERVICE_ACTIONS = ["install", "uninstall", "start", "stop", "restart", "status"];
|
|
13
|
+
var ARCH_ACTIONS = ["generate", "check", "verify"];
|
|
13
14
|
var port = { port: { type: "string" } };
|
|
14
15
|
function parse(args, options, positionals, usage) {
|
|
15
16
|
const [min, max] = typeof positionals === "number" ? [positionals, positionals] : positionals;
|
|
@@ -65,6 +66,19 @@ function parseCommand(argv) {
|
|
|
65
66
|
const { values, positionals } = parse(rest, { commit: { type: "string" }, ...port }, [0, 1], "slate done [item] [--commit <sha>|HEAD]");
|
|
66
67
|
return { name: "done", ...positionals[0] ? { item: positionals[0] } : {}, ...str(values.commit) ? { commit: str(values.commit) } : {}, ...withPort(values) };
|
|
67
68
|
}
|
|
69
|
+
case "shipped": {
|
|
70
|
+
const usage = "slate shipped [<ref>] [--since <ref>] [--check | --dry-run]";
|
|
71
|
+
const { values, positionals } = parse(rest, { since: { type: "string" }, check: { type: "boolean" }, "dry-run": { type: "boolean" }, ...port }, [0, 1], usage);
|
|
72
|
+
if (values.check && values["dry-run"]) throw new UsageError(`--check and --dry-run cannot be combined; usage: ${usage}`);
|
|
73
|
+
return {
|
|
74
|
+
name: "shipped",
|
|
75
|
+
...positionals[0] ? { ref: positionals[0] } : {},
|
|
76
|
+
...str(values.since) ? { since: str(values.since) } : {},
|
|
77
|
+
check: values.check === true,
|
|
78
|
+
dryRun: values["dry-run"] === true,
|
|
79
|
+
...withPort(values)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
68
82
|
case "current": {
|
|
69
83
|
const { values } = parse(rest, port, 0, "slate current [--port <n>]");
|
|
70
84
|
return { name: "current", ...withPort(values) };
|
|
@@ -92,11 +106,33 @@ function parseCommand(argv) {
|
|
|
92
106
|
}
|
|
93
107
|
case "hooks": {
|
|
94
108
|
const [action, ...more] = rest;
|
|
95
|
-
const usage = "slate hooks install|uninstall|status";
|
|
96
|
-
if (action
|
|
109
|
+
const usage = "slate hooks install [--require] [--shipped-check] | uninstall | status | check <message-file>";
|
|
110
|
+
if (action === "install") {
|
|
111
|
+
const { values } = parse(more, { require: { type: "boolean" }, "shipped-check": { type: "boolean" } }, 0, usage);
|
|
112
|
+
return { name: "hooks", action, ...values.require === true ? { require: true } : {}, ...values["shipped-check"] === true ? { shippedCheck: true } : {} };
|
|
113
|
+
}
|
|
114
|
+
if (action === "check") {
|
|
115
|
+
const { values, positionals } = parse(more, port, 1, usage);
|
|
116
|
+
return { name: "hooks", action, file: positionals[0], ...withPort(values) };
|
|
117
|
+
}
|
|
118
|
+
if (action !== "uninstall" && action !== "status") throw new UsageError(`usage: ${usage}`);
|
|
97
119
|
parse(more, {}, 0, usage);
|
|
98
120
|
return { name: "hooks", action };
|
|
99
121
|
}
|
|
122
|
+
case "arch": {
|
|
123
|
+
const usage = "slate arch [generate|check|verify [file] [--write]] [--root <dir>]";
|
|
124
|
+
const [first, ...more] = rest;
|
|
125
|
+
const action = ARCH_ACTIONS.includes(first ?? "") ? first : void 0;
|
|
126
|
+
const { values, positionals } = parse(action ? more : rest, { root: { type: "string" }, write: { type: "boolean" } }, [0, action === "verify" ? 1 : 0], usage);
|
|
127
|
+
if (values.write && action !== "verify") throw new UsageError(`--write is for slate arch verify; usage: ${usage}`);
|
|
128
|
+
return {
|
|
129
|
+
name: "arch",
|
|
130
|
+
action: action ?? "check",
|
|
131
|
+
...str(values.root) ? { root: str(values.root) } : {},
|
|
132
|
+
...positionals[0] ? { file: positionals[0] } : {},
|
|
133
|
+
write: values.write === true
|
|
134
|
+
};
|
|
135
|
+
}
|
|
100
136
|
case "upgrade": {
|
|
101
137
|
const { values } = parse(rest, { check: { type: "boolean" } }, 0, "slate upgrade [--check]");
|
|
102
138
|
return { name: "upgrade", check: values.check === true };
|
|
@@ -199,8 +235,14 @@ Usage:
|
|
|
199
235
|
slate show [item] an item in full, with its commits (default: the branch's item)
|
|
200
236
|
slate mv <item> <column> [--top] move an item to a column (key or label)
|
|
201
237
|
slate done [item] [--commit HEAD] to the first done column; --commit attaches the sha (HEAD works)
|
|
202
|
-
slate
|
|
203
|
-
|
|
238
|
+
slate shipped [<ref>] [--since <ref>] [--check|--dry-run]
|
|
239
|
+
<ref> is out (default: the newest tag): the items its commits since the
|
|
240
|
+
tag before name move to done, each with its commit; "slate: <key> (part)"
|
|
241
|
+
in a message finishes nothing; --check exits 3 when items are left
|
|
242
|
+
slate hooks install [--require] [--shipped-check] | uninstall | status
|
|
243
|
+
a git commit-msg hook adding "slate: <key>" on slate/<key> branches;
|
|
244
|
+
--require refuses a commit that names no item ("slate: none" passes);
|
|
245
|
+
--shipped-check lets the Claude Code plugin say when a tag's items are not done
|
|
204
246
|
slate next [--milestone <name>] the next unblocked item for the project in this directory;
|
|
205
247
|
--milestone none keeps to items without a milestone
|
|
206
248
|
slate scan todos [--add] TODO/FIXME comments in this directory's project (git-ignored files
|
|
@@ -209,6 +251,12 @@ Usage:
|
|
|
209
251
|
slate import <file> [--project <p>] [--dry-run] [--prune] [--force]
|
|
210
252
|
apply a board file; --dry-run shows the plan, --prune deletes
|
|
211
253
|
what the file lacks, --force overwrites items changed since export
|
|
254
|
+
slate arch generate|check [--root <dir>]
|
|
255
|
+
the architecture map of this repository (docs/architecture: facts.json
|
|
256
|
+
and views), from .slate/arch.json or a config derived from the layout;
|
|
257
|
+
check (the default) exits 1 when it is stale; generate needs TypeScript 7+
|
|
258
|
+
slate arch verify [file] [--write] check agent-proposed components.json against facts.json; --write drops
|
|
259
|
+
unsupported edges and writes components.json and components.md
|
|
212
260
|
|
|
213
261
|
Every command that talks to the server takes --port <n> (default 4848, or SLATE_PORT).
|
|
214
262
|
Data lives in $SLATE_HOME (default ~/.slate). With SLATE_NO_START=1, commands fail instead of
|
|
@@ -223,6 +271,9 @@ async function execute(cmd) {
|
|
|
223
271
|
process.stdout.write(USAGE);
|
|
224
272
|
return 0;
|
|
225
273
|
}
|
|
274
|
+
if (cmd.name === "arch") {
|
|
275
|
+
return (await import("./arch-3JZTL2DJ.js")).archCommand(cmd);
|
|
276
|
+
}
|
|
226
277
|
const { resolvePort, home, health } = await import("./local-6MC4LZJK.js");
|
|
227
278
|
const { serviceFor } = await import("./service-FAEKZ3X2.js");
|
|
228
279
|
const service = serviceFor();
|
|
@@ -233,42 +284,61 @@ async function execute(cmd) {
|
|
|
233
284
|
};
|
|
234
285
|
switch (cmd.name) {
|
|
235
286
|
case "start": {
|
|
236
|
-
const { startDaemon, startForeground } = await import("./commands-
|
|
287
|
+
const { startDaemon, startForeground } = await import("./commands-IB76RJGP.js");
|
|
237
288
|
if (cmd.daemon) return startDaemon(port2, service);
|
|
238
289
|
return startForeground(port2, { open: cmd.open, service: cmd.service });
|
|
239
290
|
}
|
|
240
291
|
case "mcp": {
|
|
241
|
-
const { mcpStdio } = await import("./commands-
|
|
292
|
+
const { mcpStdio } = await import("./commands-IB76RJGP.js");
|
|
242
293
|
return mcpStdio(port2);
|
|
243
294
|
}
|
|
244
295
|
case "stop":
|
|
245
|
-
return (await import("./lifecycle-
|
|
296
|
+
return (await import("./lifecycle-O7LDC735.js")).stopCommand(service);
|
|
246
297
|
case "restart":
|
|
247
|
-
return (await import("./lifecycle-
|
|
298
|
+
return (await import("./lifecycle-O7LDC735.js")).restartCommand(service, port2);
|
|
248
299
|
case "status":
|
|
249
|
-
return (await import("./lifecycle-
|
|
300
|
+
return (await import("./lifecycle-O7LDC735.js")).statusCommand(service, port2, VERSION);
|
|
250
301
|
case "service": {
|
|
251
|
-
const { serviceCommand } = await import("./service-command-
|
|
302
|
+
const { serviceCommand } = await import("./service-command-WG4TAU2T.js");
|
|
252
303
|
return serviceCommand(cmd.action, service, cmd.port !== void 0 ? port2 : void 0);
|
|
253
304
|
}
|
|
254
305
|
case "hooks": {
|
|
255
|
-
const hooks = await import("./hooks-
|
|
306
|
+
const hooks = await import("./hooks-QJ4XG42C.js");
|
|
256
307
|
if (cmd.action === "status") {
|
|
257
308
|
const on = await hooks.hookInstalled(process.cwd());
|
|
258
309
|
console.log(on ? "slate commit-msg hook: installed" : "slate commit-msg hook: not installed (slate hooks install)");
|
|
310
|
+
const policy = await hooks.hookPolicy(process.cwd());
|
|
311
|
+
if (policy.require) console.log(` commits must name an item (${hooks.REQUIRE_KEY})${on ? "" : ", once the hook is installed"}`);
|
|
312
|
+
if (policy.shippedCheck) console.log(` the Claude Code plugin checks the newest tag's items (${hooks.SHIPPED_CHECK_KEY})`);
|
|
259
313
|
return on ? 0 : 1;
|
|
260
314
|
}
|
|
261
|
-
|
|
315
|
+
if (cmd.action === "check") {
|
|
316
|
+
const [{ readFileSync }, { api, ApiError }] = await Promise.all([import("node:fs"), import("./http-APU3FWKO.js")]);
|
|
317
|
+
const { ok, lines: lines2 } = await hooks.checkMessage(readFileSync(cmd.file, "utf8"), {
|
|
318
|
+
health: async () => await health(port2) !== null,
|
|
319
|
+
exists: (key) => api(port2, "GET", `/items/${encodeURIComponent(key)}`).then(
|
|
320
|
+
() => true,
|
|
321
|
+
(err) => {
|
|
322
|
+
if (err instanceof ApiError && (err.status === 404 || err.status === 400)) return false;
|
|
323
|
+
throw err;
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
});
|
|
327
|
+
for (const line of lines2) console.error(line);
|
|
328
|
+
return ok ? 0 : hooks.HOOK_REFUSED;
|
|
329
|
+
}
|
|
330
|
+
const lines = cmd.action === "install" ? await hooks.installHook(process.cwd(), void 0, { ...cmd.require ? { require: true } : {}, ...cmd.shippedCheck ? { shippedCheck: true } : {} }) : await hooks.uninstallHook(process.cwd());
|
|
331
|
+
for (const line of lines) console.log(line);
|
|
262
332
|
return 0;
|
|
263
333
|
}
|
|
264
334
|
case "upgrade": {
|
|
265
|
-
const { realUpgradeDeps, upgrade } = await import("./upgrade-
|
|
335
|
+
const { realUpgradeDeps, upgrade } = await import("./upgrade-M6TR3IBW.js");
|
|
266
336
|
return upgrade(realUpgradeDeps(service, VERSION, port2), { check: cmd.check });
|
|
267
337
|
}
|
|
268
338
|
case "doctor": {
|
|
269
339
|
const [{ doctor, formatCheck }, { loadMigrations }, { BIN }, { api }, { health: health2 }] = await Promise.all([
|
|
270
|
-
import("./doctor-
|
|
271
|
-
import("./src-
|
|
340
|
+
import("./doctor-RPN73UNG.js"),
|
|
341
|
+
import("./src-QB7VJHQH.js"),
|
|
272
342
|
import("./daemon-PALF5CS6.js"),
|
|
273
343
|
import("./http-APU3FWKO.js"),
|
|
274
344
|
import("./local-6MC4LZJK.js")
|
|
@@ -290,7 +360,7 @@ async function execute(cmd) {
|
|
|
290
360
|
return checks.some((c) => c.level === "fail") ? 1 : 0;
|
|
291
361
|
}
|
|
292
362
|
case "export": {
|
|
293
|
-
const { exportProject } = await import("./client-
|
|
363
|
+
const { exportProject } = await import("./client-BFKANUSM.js");
|
|
294
364
|
const markdown = await exportProject(port2, home(), process.cwd(), cmd.project);
|
|
295
365
|
if (!cmd.output) {
|
|
296
366
|
process.stdout.write(markdown);
|
|
@@ -302,7 +372,7 @@ async function execute(cmd) {
|
|
|
302
372
|
return 0;
|
|
303
373
|
}
|
|
304
374
|
}
|
|
305
|
-
const [{ ensureServer }, client] = await Promise.all([import("./commands-
|
|
375
|
+
const [{ ensureServer }, client] = await Promise.all([import("./commands-IB76RJGP.js"), import("./client-BFKANUSM.js")]);
|
|
306
376
|
if (process.env.SLATE_NO_START) {
|
|
307
377
|
if (!await health(port2)) throw new Error(`no slate server on port ${port2} (SLATE_NO_START is set)`);
|
|
308
378
|
} else await ensureServer(port2);
|
|
@@ -325,6 +395,12 @@ async function execute(cmd) {
|
|
|
325
395
|
return print(await client.moveItem(port2, process.cwd(), cmd.item, cmd.column, cmd.top));
|
|
326
396
|
case "done":
|
|
327
397
|
return print(await client.doneItem(port2, process.cwd(), cmd.item, cmd.commit));
|
|
398
|
+
case "shipped": {
|
|
399
|
+
const { shipped } = await import("./shipped-7D2LNTAK.js");
|
|
400
|
+
const result = await shipped(port2, process.cwd(), cmd);
|
|
401
|
+
print(result.lines);
|
|
402
|
+
return result.code;
|
|
403
|
+
}
|
|
328
404
|
case "start-item":
|
|
329
405
|
return print(await client.startItem(port2, process.cwd(), cmd.item));
|
|
330
406
|
case "current": {
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
SlateError,
|
|
4
|
-
Store,
|
|
5
|
-
commitShaSchema,
|
|
6
|
-
createServices,
|
|
7
|
-
detailsSchema,
|
|
8
|
-
idSchema,
|
|
9
|
-
isSlateError,
|
|
10
|
-
linkKindSchema,
|
|
11
|
-
milestoneSchema,
|
|
12
|
-
positionSchema,
|
|
13
|
-
prioritySchema,
|
|
14
|
-
refTypeSchema,
|
|
15
|
-
slateHome,
|
|
16
|
-
statusKeySchema,
|
|
17
|
-
statusKindSchema,
|
|
18
|
-
tagsSchema,
|
|
19
|
-
titleSchema
|
|
20
|
-
} from "./chunk-WXM4BB4D.js";
|
|
21
2
|
import {
|
|
22
3
|
CallToolRequestSchema,
|
|
23
4
|
CompleteRequestSchema,
|
|
@@ -50,6 +31,25 @@ import {
|
|
|
50
31
|
safeParseAsync,
|
|
51
32
|
toJsonSchemaCompat
|
|
52
33
|
} from "./chunk-GD6AEWOM.js";
|
|
34
|
+
import {
|
|
35
|
+
SlateError,
|
|
36
|
+
Store,
|
|
37
|
+
commitShaSchema,
|
|
38
|
+
createServices,
|
|
39
|
+
detailsSchema,
|
|
40
|
+
idSchema,
|
|
41
|
+
isSlateError,
|
|
42
|
+
linkKindSchema,
|
|
43
|
+
milestoneSchema,
|
|
44
|
+
positionSchema,
|
|
45
|
+
prioritySchema,
|
|
46
|
+
refTypeSchema,
|
|
47
|
+
slateHome,
|
|
48
|
+
statusKeySchema,
|
|
49
|
+
statusKindSchema,
|
|
50
|
+
tagsSchema,
|
|
51
|
+
titleSchema
|
|
52
|
+
} from "./chunk-OJOVDYIZ.js";
|
|
53
53
|
import {
|
|
54
54
|
ZodOptional,
|
|
55
55
|
external_exports
|
|
@@ -2192,7 +2192,7 @@ function itemFields(args) {
|
|
|
2192
2192
|
}
|
|
2193
2193
|
var ITEM_ARGS = ["item_id", "from_id", "to_id", "after", "before", "blocked_by"];
|
|
2194
2194
|
var itemId = idSchema.describe("The item: its id, its key (SLT-42), or its number (42) when cwd is inside its project.");
|
|
2195
|
-
var CONVENTION = "Put the item key in commit messages (a trailing `slate: SLT-42` line, the item's `key`) so the board discovers the commits automatically; the item id works too.";
|
|
2195
|
+
var CONVENTION = "Put the item key in commit messages (a trailing `slate: SLT-42` line, the item's `key`) so the board discovers the commits automatically; the item id works too. A commit that is only one step of a longer item says `slate: SLT-42 (part)`, so it does not finish the item; one that belongs to no item says `slate: none`.";
|
|
2196
2196
|
var READ = { readOnlyHint: true, openWorldHint: false };
|
|
2197
2197
|
var WRITE = { readOnlyHint: false, destructiveHint: false, openWorldHint: false };
|
|
2198
2198
|
var DESTROY = { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
|
|
@@ -2280,7 +2280,7 @@ function registerTools(server, services) {
|
|
|
2280
2280
|
);
|
|
2281
2281
|
tool(
|
|
2282
2282
|
"update_project",
|
|
2283
|
-
"Rename a project, change its key or description, turn git-driven moves on or off, reorder or replace its milestone list, or archive/unarchive it. Removing a milestone that items still use fails with milestone_in_use unless remap maps it to another milestone (or null for unscheduled).",
|
|
2283
|
+
"Rename a project, change its key or description, turn git-driven moves, the roadmap file or self-updating architecture views on or off, reorder or replace its milestone list, or archive/unarchive it. Removing a milestone that items still use fails with milestone_in_use unless remap maps it to another milestone (or null for unscheduled).",
|
|
2284
2284
|
{
|
|
2285
2285
|
project_id: projectId,
|
|
2286
2286
|
name: external_exports.string().min(1).optional(),
|
|
@@ -2290,12 +2290,15 @@ function registerTools(server, services) {
|
|
|
2290
2290
|
archived: external_exports.boolean().optional(),
|
|
2291
2291
|
key: external_exports.string().optional().describe("The project key, 2 to 5 letters: the prefix of item keys (SLT in SLT-42). Old keys keep resolving."),
|
|
2292
2292
|
roadmap_file: external_exports.string().nullable().optional().describe("Keep the board as a markdown file in the project (e.g. docs/ROADMAP.md), rewritten after each change but never over a hand edit; null stops it."),
|
|
2293
|
+
arch_auto: external_exports.boolean().optional().describe(
|
|
2294
|
+
"Keep docs/architecture current: the server regenerates facts.json and the views (as `slate arch generate`) when HEAD moves, and once now; it never commits or touches components.json. Needs TypeScript 7."
|
|
2295
|
+
),
|
|
2293
2296
|
git_transitions: external_exports.boolean().optional().describe("Move items from git activity: a related commit moves a not-started item to the first active column; on the default branch, an active item to the first review column.")
|
|
2294
2297
|
},
|
|
2295
2298
|
WRITE,
|
|
2296
2299
|
(a) => {
|
|
2297
2300
|
const { id } = project(a);
|
|
2298
|
-
let result = services.projects.update({ id, name: a.name, key: a.key, description: a.description, milestones: a.milestones, remap: a.remap, gitTransitions: a.git_transitions, roadmapFile: a.roadmap_file });
|
|
2301
|
+
let result = services.projects.update({ id, name: a.name, key: a.key, description: a.description, milestones: a.milestones, remap: a.remap, gitTransitions: a.git_transitions, roadmapFile: a.roadmap_file, archAuto: a.arch_auto });
|
|
2299
2302
|
if (a.archived !== void 0) result = services.projects.archive({ id, archived: a.archived });
|
|
2300
2303
|
return result;
|
|
2301
2304
|
}
|
|
@@ -2385,6 +2388,17 @@ function registerTools(server, services) {
|
|
|
2385
2388
|
READ,
|
|
2386
2389
|
(a) => services.items.commits(a.item_id, a.limit === void 0 ? {} : { limit: a.limit })
|
|
2387
2390
|
);
|
|
2391
|
+
tool(
|
|
2392
|
+
"get_touched_components",
|
|
2393
|
+
"Map commits to the architecture model in the project's docs/architecture: components.json components (by file glob) when it has them, else the packages of facts.json (longest directory prefix); files neither claims count as Other. With item_id, the components the item's commits changed, each with files, commits and up to 20 paths. Without it, the aggregate for the project's items in milestone (null: items without one; omitted: every item), each component with items, files and commits. model is null when the project has no architecture model (run `slate arch`). Only commits in the project's own repository count; diffs are against the first parent. Read-only.",
|
|
2394
|
+
{
|
|
2395
|
+
item_id: itemId.optional(),
|
|
2396
|
+
project_id: projectId,
|
|
2397
|
+
milestone: milestoneSchema.nullable().optional().describe("Without item_id: only items in this milestone; null for items without one. Omit for every item.")
|
|
2398
|
+
},
|
|
2399
|
+
READ,
|
|
2400
|
+
(a) => a.item_id ? services.touch.forItem(a.item_id) : services.touch.forMilestone(project(a).id, a.milestone)
|
|
2401
|
+
);
|
|
2388
2402
|
tool(
|
|
2389
2403
|
"update_item",
|
|
2390
2404
|
"Edit an item's title, details, milestone, priority or tags. Omitted fields are unchanged; null clears details or milestone. Does not change status or order; use move_item for that.",
|
|
@@ -4647,6 +4661,13 @@ function createApi(services) {
|
|
|
4647
4661
|
})
|
|
4648
4662
|
);
|
|
4649
4663
|
});
|
|
4664
|
+
api.get("/projects/:id/architecture", (c) => c.json(services.architecture.list(c.req.param("id"))));
|
|
4665
|
+
api.get("/projects/:id/architecture-status", (c) => c.json(services.architecture.status(c.req.param("id"))));
|
|
4666
|
+
api.get("/projects/:id/touch", async (c) => {
|
|
4667
|
+
const milestone = c.req.query("milestone");
|
|
4668
|
+
return c.json(await services.touch.forMilestone(c.req.param("id"), milestone === void 0 ? void 0 : milestone === "" ? null : milestone));
|
|
4669
|
+
});
|
|
4670
|
+
api.get("/projects/:id/architecture/:name", (c) => markdown2(services.architecture.read(c.req.param("id"), c.req.param("name")).markdown));
|
|
4650
4671
|
api.get("/projects/:id/export.md", (c) => markdown2(services.export.project(c.req.param("id"))));
|
|
4651
4672
|
api.post("/projects/:id/scan-todos", async (c) => {
|
|
4652
4673
|
const b = c.req.header("content-type") ? await body(c.req) : {};
|
|
@@ -4672,6 +4693,7 @@ function createApi(services) {
|
|
|
4672
4693
|
const { limit } = query(c.req.query());
|
|
4673
4694
|
return c.json(await items.commits(c.req.param("id"), limit === void 0 ? {} : { limit }));
|
|
4674
4695
|
});
|
|
4696
|
+
api.get("/items/:id/components", async (c) => c.json(await services.touch.forItem(c.req.param("id"))));
|
|
4675
4697
|
api.patch("/items/:id", async (c) => c.json(await items.withCommits(items.update({ ...await body(c.req), id: c.req.param("id") }))));
|
|
4676
4698
|
api.delete("/items/:id", (c) => {
|
|
4677
4699
|
items.remove(c.req.param("id"));
|
|
@@ -5071,6 +5093,126 @@ function createApp({ services, port, version, startedAt = Date.now(), uiDir = DE
|
|
|
5071
5093
|
return app;
|
|
5072
5094
|
}
|
|
5073
5095
|
|
|
5096
|
+
// ../server/src/arch-auto.ts
|
|
5097
|
+
import { spawn } from "node:child_process";
|
|
5098
|
+
var ARCH_POLL_MS = 1e4;
|
|
5099
|
+
var ARCH_EVENT_DEBOUNCE_MS = 300;
|
|
5100
|
+
var ARCH_TIMEOUT_MS = 12e4;
|
|
5101
|
+
var MAX_OUTPUT = 64 * 1024;
|
|
5102
|
+
var TS_MISSING = /needs TypeScript 7/;
|
|
5103
|
+
function archOutcome(code, stdout, stderr, timedOut = false, timeoutMs = ARCH_TIMEOUT_MS) {
|
|
5104
|
+
const errors = stderr.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
5105
|
+
if (timedOut) return { state: "failed", reason: `timed out after ${timeoutMs >= 1e3 ? `${Math.round(timeoutMs / 1e3)}s` : `${timeoutMs}ms`}` };
|
|
5106
|
+
const missing = errors.find((l) => TS_MISSING.test(l));
|
|
5107
|
+
if (missing) return { state: "skipped", reason: missing };
|
|
5108
|
+
if (/^wrote /m.test(stdout)) {
|
|
5109
|
+
const problems = errors.filter((l) => !l.startsWith("unresolved import "));
|
|
5110
|
+
return { state: "generated", reason: code === 0 || !problems.length ? null : problems.at(-1) };
|
|
5111
|
+
}
|
|
5112
|
+
return { state: "failed", reason: errors.at(-1) ?? `exited with code ${code}` };
|
|
5113
|
+
}
|
|
5114
|
+
function cliArchRunner(argv, timeoutMs = ARCH_TIMEOUT_MS) {
|
|
5115
|
+
return (root) => new Promise((resolve) => {
|
|
5116
|
+
const child = spawn(argv[0], [...argv.slice(1), "generate", "--root", root], { cwd: root, stdio: ["ignore", "pipe", "pipe"], env: { ...process.env, SLATE_NO_START: "1" } });
|
|
5117
|
+
let stdout = "";
|
|
5118
|
+
let stderr = "";
|
|
5119
|
+
let timedOut = false;
|
|
5120
|
+
child.stdout.on("data", (d) => stdout = (stdout + d.toString("utf8")).slice(-MAX_OUTPUT));
|
|
5121
|
+
child.stderr.on("data", (d) => stderr = (stderr + d.toString("utf8")).slice(-MAX_OUTPUT));
|
|
5122
|
+
const timer = setTimeout(() => {
|
|
5123
|
+
timedOut = true;
|
|
5124
|
+
child.kill("SIGKILL");
|
|
5125
|
+
}, timeoutMs);
|
|
5126
|
+
timer.unref();
|
|
5127
|
+
child.once("error", (err) => {
|
|
5128
|
+
clearTimeout(timer);
|
|
5129
|
+
resolve({ state: "failed", reason: `could not run the generator: ${err.message}` });
|
|
5130
|
+
});
|
|
5131
|
+
child.once("close", (code) => {
|
|
5132
|
+
clearTimeout(timer);
|
|
5133
|
+
resolve(archOutcome(code, stdout, stderr, timedOut, timeoutMs));
|
|
5134
|
+
});
|
|
5135
|
+
});
|
|
5136
|
+
}
|
|
5137
|
+
function createArchAuto({ services, run: run2, pollMs = ARCH_POLL_MS }) {
|
|
5138
|
+
const queue = /* @__PURE__ */ new Set();
|
|
5139
|
+
let running = null;
|
|
5140
|
+
let checking = null;
|
|
5141
|
+
let closed = false;
|
|
5142
|
+
const due = (id) => services.archAuto.due(id).catch(() => null);
|
|
5143
|
+
async function runOne(id) {
|
|
5144
|
+
const head = await due(id);
|
|
5145
|
+
if (!head || closed) return;
|
|
5146
|
+
const since = services.archAuto.lastHead(id);
|
|
5147
|
+
const root = services.projects.get(id).path;
|
|
5148
|
+
const result = await run2(root).catch((err) => ({ state: "failed", reason: err instanceof Error ? err.message : String(err) }));
|
|
5149
|
+
if (closed) return;
|
|
5150
|
+
try {
|
|
5151
|
+
services.archAuto.record(id, head, result, since);
|
|
5152
|
+
} catch {
|
|
5153
|
+
return;
|
|
5154
|
+
}
|
|
5155
|
+
if (await due(id)) queue.add(id);
|
|
5156
|
+
}
|
|
5157
|
+
function kick() {
|
|
5158
|
+
if (running || closed) return;
|
|
5159
|
+
const id = queue.values().next().value;
|
|
5160
|
+
if (id === void 0) return;
|
|
5161
|
+
queue.delete(id);
|
|
5162
|
+
running = runOne(id).catch(() => {
|
|
5163
|
+
}).finally(() => {
|
|
5164
|
+
running = null;
|
|
5165
|
+
kick();
|
|
5166
|
+
});
|
|
5167
|
+
}
|
|
5168
|
+
function check() {
|
|
5169
|
+
if (checking) return checking;
|
|
5170
|
+
const current = (async () => {
|
|
5171
|
+
await null;
|
|
5172
|
+
try {
|
|
5173
|
+
for (const id of services.archAuto.enabled()) if (!queue.has(id) && await due(id)) queue.add(id);
|
|
5174
|
+
} finally {
|
|
5175
|
+
checking = null;
|
|
5176
|
+
}
|
|
5177
|
+
kick();
|
|
5178
|
+
})();
|
|
5179
|
+
checking = current;
|
|
5180
|
+
return current;
|
|
5181
|
+
}
|
|
5182
|
+
let nudge = null;
|
|
5183
|
+
const unsubscribe = services.events.subscribe((e) => {
|
|
5184
|
+
if (e.type !== "project.updated" && e.type !== "project.created") return;
|
|
5185
|
+
if (nudge) clearTimeout(nudge);
|
|
5186
|
+
nudge = setTimeout(() => {
|
|
5187
|
+
nudge = null;
|
|
5188
|
+
if (!closed) void check();
|
|
5189
|
+
}, ARCH_EVENT_DEBOUNCE_MS);
|
|
5190
|
+
nudge.unref();
|
|
5191
|
+
});
|
|
5192
|
+
const timer = setInterval(() => void check(), pollMs);
|
|
5193
|
+
timer.unref();
|
|
5194
|
+
void check();
|
|
5195
|
+
return {
|
|
5196
|
+
check,
|
|
5197
|
+
async idle() {
|
|
5198
|
+
for (; ; ) {
|
|
5199
|
+
await checking;
|
|
5200
|
+
await running;
|
|
5201
|
+
await new Promise((r) => setImmediate(r));
|
|
5202
|
+
if (!running && !checking && (closed || queue.size === 0)) return;
|
|
5203
|
+
if (!running) kick();
|
|
5204
|
+
}
|
|
5205
|
+
},
|
|
5206
|
+
close() {
|
|
5207
|
+
closed = true;
|
|
5208
|
+
clearInterval(timer);
|
|
5209
|
+
if (nudge) clearTimeout(nudge);
|
|
5210
|
+
unsubscribe();
|
|
5211
|
+
queue.clear();
|
|
5212
|
+
}
|
|
5213
|
+
};
|
|
5214
|
+
}
|
|
5215
|
+
|
|
5074
5216
|
// ../server/src/start.ts
|
|
5075
5217
|
import { mkdirSync } from "node:fs";
|
|
5076
5218
|
|
|
@@ -6668,6 +6810,7 @@ async function start(options = {}) {
|
|
|
6668
6810
|
if (event.projectId && services.roadmapFile.enabled().includes(event.projectId)) writeRoadmap(event.projectId);
|
|
6669
6811
|
});
|
|
6670
6812
|
for (const id of services.roadmapFile.enabled()) writeRoadmap(id);
|
|
6813
|
+
const archAuto = options.archRunner ? createArchAuto({ services, run: options.archRunner, ...options.archPollMs ? { pollMs: options.archPollMs } : {} }) : null;
|
|
6671
6814
|
const opened = store;
|
|
6672
6815
|
let closing = null;
|
|
6673
6816
|
return {
|
|
@@ -6677,6 +6820,8 @@ async function start(options = {}) {
|
|
|
6677
6820
|
close: () => closing ??= new Promise((resolve) => {
|
|
6678
6821
|
clearInterval(gitTimer);
|
|
6679
6822
|
unsubscribe();
|
|
6823
|
+
archAuto?.close();
|
|
6824
|
+
services.architecture.close();
|
|
6680
6825
|
for (const timer of pendingRoadmaps.values()) clearTimeout(timer);
|
|
6681
6826
|
server.close(() => resolve());
|
|
6682
6827
|
server.closeAllConnections();
|
|
@@ -6695,6 +6840,11 @@ async function start(options = {}) {
|
|
|
6695
6840
|
export {
|
|
6696
6841
|
resolveUiDir,
|
|
6697
6842
|
createApp,
|
|
6843
|
+
ARCH_POLL_MS,
|
|
6844
|
+
ARCH_TIMEOUT_MS,
|
|
6845
|
+
archOutcome,
|
|
6846
|
+
cliArchRunner,
|
|
6847
|
+
createArchAuto,
|
|
6698
6848
|
KEEP_BACKUPS,
|
|
6699
6849
|
backupsDir,
|
|
6700
6850
|
backupFileName,
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
run
|
|
4
|
+
} from "./chunk-I5SMACZY.js";
|
|
5
|
+
|
|
6
|
+
// src/hooks.ts
|
|
7
|
+
import { chmodSync, existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
var HOOK = "commit-msg";
|
|
10
|
+
var MARKER = "# slate commit-msg hook";
|
|
11
|
+
var CHAINED = `${HOOK}.slate-chained`;
|
|
12
|
+
var REQUIRE_KEY = "slate.requireItem";
|
|
13
|
+
var SHIPPED_CHECK_KEY = "slate.shippedCheck";
|
|
14
|
+
var HOOK_REFUSED = 4;
|
|
15
|
+
var HOOK_SCRIPT = `#!/bin/sh
|
|
16
|
+
${MARKER} (slate hooks install; remove with slate hooks uninstall).
|
|
17
|
+
# On a slate/<KEY>-... branch, adds "slate: <KEY>" to the message unless it already names <KEY>.
|
|
18
|
+
# With ${REQUIRE_KEY} on (slate hooks install --require), refuses a message that names no item.
|
|
19
|
+
chained="$(dirname "$0")/${CHAINED}"
|
|
20
|
+
if [ -x "$chained" ]; then "$chained" "$@" || exit $?; fi
|
|
21
|
+
msg="$1"
|
|
22
|
+
# Merges keep their message.
|
|
23
|
+
[ -f "$(git rev-parse --git-path MERGE_HEAD)" ] && exit 0
|
|
24
|
+
# Nothing written (git aborts empty messages): leave it alone.
|
|
25
|
+
body=$(grep -v '^#' "$msg" | tr -d '[:space:]')
|
|
26
|
+
[ -n "$body" ] || exit 0
|
|
27
|
+
branch=$(git symbolic-ref --short -q HEAD) || branch=
|
|
28
|
+
key=$(printf '%s\\n' "$branch" | sed -n 's#^slate/\\([A-Za-z][A-Za-z]*-[0-9][0-9]*\\).*$#\\1#p' | tr '[:lower:]' '[:upper:]')
|
|
29
|
+
# The key is already there: leave the message alone.
|
|
30
|
+
if [ -n "$key" ] && ! grep -v '^#' "$msg" | grep -qiE "(^|[^A-Za-z0-9_-])$key([^A-Za-z0-9_-]|$)"; then
|
|
31
|
+
git interpret-trailers --in-place --trailer "slate: $key" "$msg"
|
|
32
|
+
fi
|
|
33
|
+
if [ "$(git config --bool --get ${REQUIRE_KEY} 2>/dev/null)" = "true" ]; then
|
|
34
|
+
if command -v slate >/dev/null 2>&1; then
|
|
35
|
+
# Only a refusal (exit ${HOOK_REFUSED}) stops the commit: an older slate or a failing one never does.
|
|
36
|
+
SLATE_NO_START=1 slate hooks check "$msg"
|
|
37
|
+
[ $? -eq ${HOOK_REFUSED} ] && exit 1
|
|
38
|
+
else
|
|
39
|
+
echo "slate: not on PATH, so the commit message was not checked" >&2
|
|
40
|
+
fi
|
|
41
|
+
fi
|
|
42
|
+
exit 0
|
|
43
|
+
`;
|
|
44
|
+
async function hooksDir(cwd, git = run) {
|
|
45
|
+
const result = await git("git", ["-C", cwd, "rev-parse", "--path-format=absolute", "--git-path", "hooks"]);
|
|
46
|
+
if (result.code !== 0) throw new Error(`${cwd} is not in a git repository`);
|
|
47
|
+
return result.stdout.trim();
|
|
48
|
+
}
|
|
49
|
+
var isOurs = (file) => existsSync(file) && readFileSync(file, "utf8").includes(MARKER);
|
|
50
|
+
async function hookInstalled(cwd, git = run) {
|
|
51
|
+
return isOurs(path.join(await hooksDir(cwd, git), HOOK));
|
|
52
|
+
}
|
|
53
|
+
async function hookPolicy(cwd, git = run) {
|
|
54
|
+
const on = async (key) => (await git("git", ["-C", cwd, "config", "--bool", "--get", key])).stdout.trim() === "true";
|
|
55
|
+
return { require: await on(REQUIRE_KEY), shippedCheck: await on(SHIPPED_CHECK_KEY) };
|
|
56
|
+
}
|
|
57
|
+
async function installHook(cwd, git = run, policy = {}) {
|
|
58
|
+
const dir = await hooksDir(cwd, git);
|
|
59
|
+
const file = path.join(dir, HOOK);
|
|
60
|
+
const lines = [];
|
|
61
|
+
if (existsSync(file) && !isOurs(file)) {
|
|
62
|
+
if (existsSync(path.join(dir, CHAINED))) throw new Error(`${file} is not slate's and ${CHAINED} already exists; merge them by hand`);
|
|
63
|
+
renameSync(file, path.join(dir, CHAINED));
|
|
64
|
+
lines.push(`kept the existing ${HOOK} hook as ${CHAINED}; it runs first`);
|
|
65
|
+
}
|
|
66
|
+
const fresh = !isOurs(file);
|
|
67
|
+
writeFileSync(file, HOOK_SCRIPT);
|
|
68
|
+
chmodSync(file, 493);
|
|
69
|
+
lines.unshift(fresh ? `installed ${file}` : `updated ${file}`);
|
|
70
|
+
for (const [wanted, key, says] of [
|
|
71
|
+
[policy.require, REQUIRE_KEY, "commits must name an item, or say `slate: none`"],
|
|
72
|
+
[policy.shippedCheck, SHIPPED_CHECK_KEY, "the Claude Code plugin says when a tag names items that are not done"]
|
|
73
|
+
]) {
|
|
74
|
+
if (!wanted) continue;
|
|
75
|
+
const set = await git("git", ["-C", cwd, "config", "--local", key, "true"]);
|
|
76
|
+
if (set.code !== 0) throw new Error(`git config ${key} failed: ${(set.stderr || set.stdout).trim().split("\n")[0]}`);
|
|
77
|
+
lines.push(`${says} (${key})`);
|
|
78
|
+
}
|
|
79
|
+
return lines;
|
|
80
|
+
}
|
|
81
|
+
async function uninstallHook(cwd, git = run) {
|
|
82
|
+
const dir = await hooksDir(cwd, git);
|
|
83
|
+
const file = path.join(dir, HOOK);
|
|
84
|
+
if (!isOurs(file)) return [`no slate ${HOOK} hook in ${dir}`];
|
|
85
|
+
rmSync(file);
|
|
86
|
+
for (const key of [REQUIRE_KEY, SHIPPED_CHECK_KEY]) await git("git", ["-C", cwd, "config", "--local", "--unset-all", key]);
|
|
87
|
+
const chained = path.join(dir, CHAINED);
|
|
88
|
+
if (existsSync(chained)) {
|
|
89
|
+
renameSync(chained, file);
|
|
90
|
+
return [`removed slate's hook; restored the previous ${HOOK} hook`];
|
|
91
|
+
}
|
|
92
|
+
return [`removed ${file}`];
|
|
93
|
+
}
|
|
94
|
+
function messageText(raw) {
|
|
95
|
+
const cut = raw.search(/^# -+ >8 -+$/m);
|
|
96
|
+
return (cut === -1 ? raw : raw.slice(0, cut)).split("\n").filter((line) => !line.startsWith("#")).join("\n");
|
|
97
|
+
}
|
|
98
|
+
var DERIVED = /^(fixup!|squash!|amend!|Revert "|Reapply ")/;
|
|
99
|
+
async function checkMessage(raw, deps) {
|
|
100
|
+
const { keyTokens, saysNoItem } = await import("./src-QB7VJHQH.js");
|
|
101
|
+
const message = messageText(raw);
|
|
102
|
+
if (!message.trim() || DERIVED.test(message.trimStart()) || saysNoItem(message)) return { ok: true, lines: [] };
|
|
103
|
+
const keys = keyTokens(message);
|
|
104
|
+
const how = 'add a line "slate: <KEY>" (slate ls lists the items), or "slate: none" when it belongs to none';
|
|
105
|
+
if (keys.length === 0) return { ok: false, lines: [`slate: this commit names no item; ${how}`] };
|
|
106
|
+
if (!await deps.health()) return { ok: true, lines: [`slate: no server running, so ${keys.join(", ")} was not looked up`] };
|
|
107
|
+
try {
|
|
108
|
+
for (const key of keys) if (await deps.exists(key)) return { ok: true, lines: [] };
|
|
109
|
+
} catch (err) {
|
|
110
|
+
return { ok: true, lines: [`slate: ${keys.join(", ")} was not looked up: ${err instanceof Error ? err.message : String(err)}`] };
|
|
111
|
+
}
|
|
112
|
+
return { ok: false, lines: [`slate: no item is named ${keys.join(" or ")}; ${how}`] };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
HOOK,
|
|
117
|
+
MARKER,
|
|
118
|
+
REQUIRE_KEY,
|
|
119
|
+
SHIPPED_CHECK_KEY,
|
|
120
|
+
HOOK_REFUSED,
|
|
121
|
+
HOOK_SCRIPT,
|
|
122
|
+
hooksDir,
|
|
123
|
+
hookInstalled,
|
|
124
|
+
hookPolicy,
|
|
125
|
+
installHook,
|
|
126
|
+
uninstallHook,
|
|
127
|
+
messageText,
|
|
128
|
+
checkMessage
|
|
129
|
+
};
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
VERSION
|
|
4
4
|
} from "./chunk-TCKAXJOM.js";
|
|
5
5
|
import {
|
|
6
|
+
BIN,
|
|
6
7
|
START_TIMEOUT_MS,
|
|
7
8
|
launchDaemon,
|
|
8
9
|
logFile,
|
|
@@ -2421,8 +2422,8 @@ function openBrowser(url2, os = process.platform) {
|
|
|
2421
2422
|
}
|
|
2422
2423
|
}
|
|
2423
2424
|
async function startForeground(port, options = {}) {
|
|
2424
|
-
const { start } = await import("./src-
|
|
2425
|
-
const result = await start({ port });
|
|
2425
|
+
const { start, cliArchRunner } = await import("./src-2MHSOXLY.js");
|
|
2426
|
+
const result = await start({ port, archRunner: cliArchRunner([process.execPath, ...process.execArgv, BIN, "arch"]) });
|
|
2426
2427
|
if (result.status === "running") {
|
|
2427
2428
|
if (options.service) {
|
|
2428
2429
|
console.error(`slate: another server already runs at ${result.url} (pid ${result.pid}); stop it with \`slate stop\``);
|