slateboard 0.1.1 → 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/dist/bin.js +69 -17
- package/dist/{chunk-PJ5WOZB3.js → chunk-6CR2V7P7.js} +2 -2
- package/dist/chunk-6YTKJKSG.js +129 -0
- package/dist/{chunk-ANFNDJZO.js → chunk-KA7Z72FC.js} +1 -1
- package/dist/{chunk-4PKRRMRZ.js → chunk-OJOVDYIZ.js} +68 -13
- package/dist/{chunk-V3PED2Z5.js → chunk-WREOGLK6.js} +1 -1
- package/dist/{chunk-4TPC7U6A.js → chunk-ZCFHR5VG.js} +3 -3
- package/dist/{client-5B46626J.js → client-BFKANUSM.js} +4 -4
- package/dist/{commands-6UA3YOD4.js → commands-IB76RJGP.js} +1 -1
- package/dist/{doctor-ZTQFKV32.js → doctor-RPN73UNG.js} +3 -3
- package/dist/{hooks-2TI5OLAU.js → hooks-QJ4XG42C.js} +13 -1
- package/dist/{lifecycle-IZH4RJK5.js → lifecycle-O7LDC735.js} +4 -4
- package/dist/{service-command-GKRIZCBL.js → service-command-WG4TAU2T.js} +4 -4
- package/dist/shipped-7D2LNTAK.js +153 -0
- package/dist/{src-BDZFYUYY.js → src-2MHSOXLY.js} +2 -2
- package/dist/{src-YO7L7J26.js → src-QB7VJHQH.js} +9 -1
- package/dist/{upgrade-2CI4OVTY.js → upgrade-M6TR3IBW.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-3ZLMW2RI.js +0 -74
package/dist/bin.js
CHANGED
|
@@ -66,6 +66,19 @@ function parseCommand(argv) {
|
|
|
66
66
|
const { values, positionals } = parse(rest, { commit: { type: "string" }, ...port }, [0, 1], "slate done [item] [--commit <sha>|HEAD]");
|
|
67
67
|
return { name: "done", ...positionals[0] ? { item: positionals[0] } : {}, ...str(values.commit) ? { commit: str(values.commit) } : {}, ...withPort(values) };
|
|
68
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
|
+
}
|
|
69
82
|
case "current": {
|
|
70
83
|
const { values } = parse(rest, port, 0, "slate current [--port <n>]");
|
|
71
84
|
return { name: "current", ...withPort(values) };
|
|
@@ -93,8 +106,16 @@ function parseCommand(argv) {
|
|
|
93
106
|
}
|
|
94
107
|
case "hooks": {
|
|
95
108
|
const [action, ...more] = rest;
|
|
96
|
-
const usage = "slate hooks install|uninstall|status";
|
|
97
|
-
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}`);
|
|
98
119
|
parse(more, {}, 0, usage);
|
|
99
120
|
return { name: "hooks", action };
|
|
100
121
|
}
|
|
@@ -214,8 +235,14 @@ Usage:
|
|
|
214
235
|
slate show [item] an item in full, with its commits (default: the branch's item)
|
|
215
236
|
slate mv <item> <column> [--top] move an item to a column (key or label)
|
|
216
237
|
slate done [item] [--commit HEAD] to the first done column; --commit attaches the sha (HEAD works)
|
|
217
|
-
slate
|
|
218
|
-
|
|
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
|
|
219
246
|
slate next [--milestone <name>] the next unblocked item for the project in this directory;
|
|
220
247
|
--milestone none keeps to items without a milestone
|
|
221
248
|
slate scan todos [--add] TODO/FIXME comments in this directory's project (git-ignored files
|
|
@@ -257,42 +284,61 @@ async function execute(cmd) {
|
|
|
257
284
|
};
|
|
258
285
|
switch (cmd.name) {
|
|
259
286
|
case "start": {
|
|
260
|
-
const { startDaemon, startForeground } = await import("./commands-
|
|
287
|
+
const { startDaemon, startForeground } = await import("./commands-IB76RJGP.js");
|
|
261
288
|
if (cmd.daemon) return startDaemon(port2, service);
|
|
262
289
|
return startForeground(port2, { open: cmd.open, service: cmd.service });
|
|
263
290
|
}
|
|
264
291
|
case "mcp": {
|
|
265
|
-
const { mcpStdio } = await import("./commands-
|
|
292
|
+
const { mcpStdio } = await import("./commands-IB76RJGP.js");
|
|
266
293
|
return mcpStdio(port2);
|
|
267
294
|
}
|
|
268
295
|
case "stop":
|
|
269
|
-
return (await import("./lifecycle-
|
|
296
|
+
return (await import("./lifecycle-O7LDC735.js")).stopCommand(service);
|
|
270
297
|
case "restart":
|
|
271
|
-
return (await import("./lifecycle-
|
|
298
|
+
return (await import("./lifecycle-O7LDC735.js")).restartCommand(service, port2);
|
|
272
299
|
case "status":
|
|
273
|
-
return (await import("./lifecycle-
|
|
300
|
+
return (await import("./lifecycle-O7LDC735.js")).statusCommand(service, port2, VERSION);
|
|
274
301
|
case "service": {
|
|
275
|
-
const { serviceCommand } = await import("./service-command-
|
|
302
|
+
const { serviceCommand } = await import("./service-command-WG4TAU2T.js");
|
|
276
303
|
return serviceCommand(cmd.action, service, cmd.port !== void 0 ? port2 : void 0);
|
|
277
304
|
}
|
|
278
305
|
case "hooks": {
|
|
279
|
-
const hooks = await import("./hooks-
|
|
306
|
+
const hooks = await import("./hooks-QJ4XG42C.js");
|
|
280
307
|
if (cmd.action === "status") {
|
|
281
308
|
const on = await hooks.hookInstalled(process.cwd());
|
|
282
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})`);
|
|
283
313
|
return on ? 0 : 1;
|
|
284
314
|
}
|
|
285
|
-
|
|
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);
|
|
286
332
|
return 0;
|
|
287
333
|
}
|
|
288
334
|
case "upgrade": {
|
|
289
|
-
const { realUpgradeDeps, upgrade } = await import("./upgrade-
|
|
335
|
+
const { realUpgradeDeps, upgrade } = await import("./upgrade-M6TR3IBW.js");
|
|
290
336
|
return upgrade(realUpgradeDeps(service, VERSION, port2), { check: cmd.check });
|
|
291
337
|
}
|
|
292
338
|
case "doctor": {
|
|
293
339
|
const [{ doctor, formatCheck }, { loadMigrations }, { BIN }, { api }, { health: health2 }] = await Promise.all([
|
|
294
|
-
import("./doctor-
|
|
295
|
-
import("./src-
|
|
340
|
+
import("./doctor-RPN73UNG.js"),
|
|
341
|
+
import("./src-QB7VJHQH.js"),
|
|
296
342
|
import("./daemon-PALF5CS6.js"),
|
|
297
343
|
import("./http-APU3FWKO.js"),
|
|
298
344
|
import("./local-6MC4LZJK.js")
|
|
@@ -314,7 +360,7 @@ async function execute(cmd) {
|
|
|
314
360
|
return checks.some((c) => c.level === "fail") ? 1 : 0;
|
|
315
361
|
}
|
|
316
362
|
case "export": {
|
|
317
|
-
const { exportProject } = await import("./client-
|
|
363
|
+
const { exportProject } = await import("./client-BFKANUSM.js");
|
|
318
364
|
const markdown = await exportProject(port2, home(), process.cwd(), cmd.project);
|
|
319
365
|
if (!cmd.output) {
|
|
320
366
|
process.stdout.write(markdown);
|
|
@@ -326,7 +372,7 @@ async function execute(cmd) {
|
|
|
326
372
|
return 0;
|
|
327
373
|
}
|
|
328
374
|
}
|
|
329
|
-
const [{ ensureServer }, client] = await Promise.all([import("./commands-
|
|
375
|
+
const [{ ensureServer }, client] = await Promise.all([import("./commands-IB76RJGP.js"), import("./client-BFKANUSM.js")]);
|
|
330
376
|
if (process.env.SLATE_NO_START) {
|
|
331
377
|
if (!await health(port2)) throw new Error(`no slate server on port ${port2} (SLATE_NO_START is set)`);
|
|
332
378
|
} else await ensureServer(port2);
|
|
@@ -349,6 +395,12 @@ async function execute(cmd) {
|
|
|
349
395
|
return print(await client.moveItem(port2, process.cwd(), cmd.item, cmd.column, cmd.top));
|
|
350
396
|
case "done":
|
|
351
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
|
+
}
|
|
352
404
|
case "start-item":
|
|
353
405
|
return print(await client.startItem(port2, process.cwd(), cmd.item));
|
|
354
406
|
case "current": {
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
statusKindSchema,
|
|
50
50
|
tagsSchema,
|
|
51
51
|
titleSchema
|
|
52
|
-
} from "./chunk-
|
|
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 };
|
|
@@ -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
|
+
};
|
|
@@ -2422,7 +2422,7 @@ function openBrowser(url2, os = process.platform) {
|
|
|
2422
2422
|
}
|
|
2423
2423
|
}
|
|
2424
2424
|
async function startForeground(port, options = {}) {
|
|
2425
|
-
const { start, cliArchRunner } = await import("./src-
|
|
2425
|
+
const { start, cliArchRunner } = await import("./src-2MHSOXLY.js");
|
|
2426
2426
|
const result = await start({ port, archRunner: cliArchRunner([process.execPath, ...process.execArgv, BIN, "arch"]) });
|
|
2427
2427
|
if (result.status === "running") {
|
|
2428
2428
|
if (options.service) {
|
|
@@ -7777,6 +7777,49 @@ import { existsSync as existsSync4 } from "node:fs";
|
|
|
7777
7777
|
// ../core/src/git.ts
|
|
7778
7778
|
import fs from "node:fs";
|
|
7779
7779
|
import path3 from "node:path";
|
|
7780
|
+
|
|
7781
|
+
// ../core/src/mentions.ts
|
|
7782
|
+
var TOKEN = /[A-Za-z0-9_-]+/g;
|
|
7783
|
+
var KEY_TOKEN = /^[A-Za-z]{2,5}-\d{1,9}$/;
|
|
7784
|
+
var SLATE_LINE = /^[ \t]*slate[ \t]*:(.*)$/gim;
|
|
7785
|
+
var PART = /([A-Za-z0-9_-]+)[ \t]*\([ \t]*part(?:ial)?(?:[ \t]+[^)\n]*)?[ \t]*\)/gi;
|
|
7786
|
+
function named(token, wanted) {
|
|
7787
|
+
if (wanted.has(token)) return token;
|
|
7788
|
+
return KEY_TOKEN.test(token) && wanted.has(token.toUpperCase()) ? token.toUpperCase() : null;
|
|
7789
|
+
}
|
|
7790
|
+
function mentionsIn(message, wanted) {
|
|
7791
|
+
const out = /* @__PURE__ */ new Map();
|
|
7792
|
+
if (wanted.size === 0) return out;
|
|
7793
|
+
for (const token of message.match(TOKEN) ?? []) {
|
|
7794
|
+
const id = named(token, wanted);
|
|
7795
|
+
if (id && !out.has(id)) out.set(id, { partial: false });
|
|
7796
|
+
}
|
|
7797
|
+
if (out.size === 0) return out;
|
|
7798
|
+
const part = /* @__PURE__ */ new Set();
|
|
7799
|
+
const plain = /* @__PURE__ */ new Set();
|
|
7800
|
+
for (const line of message.matchAll(SLATE_LINE)) {
|
|
7801
|
+
for (const m of line[1].matchAll(PART)) {
|
|
7802
|
+
const id = named(m[1], wanted);
|
|
7803
|
+
if (id) part.add(id);
|
|
7804
|
+
}
|
|
7805
|
+
for (const token of line[1].replace(PART, " ").match(TOKEN) ?? []) {
|
|
7806
|
+
const id = named(token, wanted);
|
|
7807
|
+
if (id) plain.add(id);
|
|
7808
|
+
}
|
|
7809
|
+
}
|
|
7810
|
+
for (const id of part) if (!plain.has(id)) out.set(id, { partial: true });
|
|
7811
|
+
return out;
|
|
7812
|
+
}
|
|
7813
|
+
function saysNoItem(message) {
|
|
7814
|
+
return /^[ \t]*slate[ \t]*:[ \t]*none[ \t]*$/im.test(message);
|
|
7815
|
+
}
|
|
7816
|
+
function keyTokens(message) {
|
|
7817
|
+
const out = /* @__PURE__ */ new Set();
|
|
7818
|
+
for (const token of message.match(TOKEN) ?? []) if (KEY_TOKEN.test(token)) out.add(token.toUpperCase());
|
|
7819
|
+
return [...out];
|
|
7820
|
+
}
|
|
7821
|
+
|
|
7822
|
+
// ../core/src/git.ts
|
|
7780
7823
|
var loaded;
|
|
7781
7824
|
var lib = () => loaded ??= import("./isomorphic-git-BZUKICXS.js").then((m) => "log" in m ? m : m.default);
|
|
7782
7825
|
var GIT_CACHE_TTL_MS = 15e3;
|
|
@@ -7950,8 +7993,6 @@ async function ignoreChecker(dir) {
|
|
|
7950
7993
|
return git.isIgnored({ fs, dir: workTree, gitdir, filepath }).catch(() => false);
|
|
7951
7994
|
};
|
|
7952
7995
|
}
|
|
7953
|
-
var TOKEN = /[A-Za-z0-9_-]+/g;
|
|
7954
|
-
var KEY_TOKEN = /^[A-Za-z]{2,5}-\d{1,9}$/;
|
|
7955
7996
|
async function findCommitsMentioning(repoPath, ids, options = {}) {
|
|
7956
7997
|
const wanted = new Set(ids.filter((id) => id.length > 0));
|
|
7957
7998
|
if (wanted.size === 0) return [];
|
|
@@ -7962,11 +8003,7 @@ async function findCommitsMentioning(repoPath, ids, options = {}) {
|
|
|
7962
8003
|
if (!entry) return [];
|
|
7963
8004
|
const out = [];
|
|
7964
8005
|
for (const c of await walk(repo, entry, limit)) {
|
|
7965
|
-
const
|
|
7966
|
-
(c.message.match(TOKEN) ?? []).map((token) => wanted.has(token) ? token : KEY_TOKEN.test(token) && wanted.has(token.toUpperCase()) ? token.toUpperCase() : null)
|
|
7967
|
-
);
|
|
7968
|
-
mentioned.delete(null);
|
|
7969
|
-
for (const id of mentioned) out.push({ itemId: id, ...info(c.sha, c.message, c.author, c.timestamp) });
|
|
8006
|
+
for (const [id, { partial }] of mentionsIn(c.message, wanted)) out.push({ itemId: id, partial, ...info(c.sha, c.message, c.author, c.timestamp) });
|
|
7970
8007
|
}
|
|
7971
8008
|
return out;
|
|
7972
8009
|
}
|
|
@@ -9747,7 +9784,7 @@ function createItemService(ctx, refs, links) {
|
|
|
9747
9784
|
}
|
|
9748
9785
|
found.forEach((list2, i) => {
|
|
9749
9786
|
const { id: projectId, name: projectName, path: projectPath } = sources[i];
|
|
9750
|
-
for (const { itemId: _, ...c } of list2) {
|
|
9787
|
+
for (const { itemId: _, partial: _part, ...c } of list2) {
|
|
9751
9788
|
if (seen.has(c.sha)) continue;
|
|
9752
9789
|
seen.add(c.sha);
|
|
9753
9790
|
out.push({ ...c, projectId, projectName, projectPath, source: "discovered", refId: null });
|
|
@@ -9755,7 +9792,7 @@ function createItemService(ctx, refs, links) {
|
|
|
9755
9792
|
});
|
|
9756
9793
|
return out.sort((a, b) => a.date < b.date ? 1 : a.date > b.date ? -1 : 0);
|
|
9757
9794
|
}
|
|
9758
|
-
async function relatedCommits(project, limit) {
|
|
9795
|
+
async function relatedCommits(project, limit, partials) {
|
|
9759
9796
|
const owners = /* @__PURE__ */ new Map();
|
|
9760
9797
|
for (const r of db.prepare(`${ITEM_SELECT} WHERE i.project_id = ?`).all(project.id)) {
|
|
9761
9798
|
owners.set(r.id, r.id);
|
|
@@ -9776,10 +9813,23 @@ function createItemService(ctx, refs, links) {
|
|
|
9776
9813
|
if (!known) commits2.set(c.sha, { ...c, itemIds: [itemId] });
|
|
9777
9814
|
else if (!known.itemIds.includes(itemId)) known.itemIds.push(itemId);
|
|
9778
9815
|
};
|
|
9779
|
-
|
|
9816
|
+
const pinned = /* @__PURE__ */ new Set();
|
|
9817
|
+
for (const ref of attached) {
|
|
9818
|
+
if (!ref.commit) continue;
|
|
9819
|
+
add(ref.itemId, ref.commit);
|
|
9820
|
+
pinned.add(`${ref.commit.sha} ${ref.itemId}`);
|
|
9821
|
+
}
|
|
9780
9822
|
found.forEach((list2, i) => {
|
|
9781
9823
|
const { id: projectId, name: projectName, path: projectPath } = sources[i];
|
|
9782
|
-
for (const { itemId, ...c } of list2)
|
|
9824
|
+
for (const { itemId, partial, ...c } of list2) {
|
|
9825
|
+
const owner = owners.get(itemId);
|
|
9826
|
+
add(owner, { ...c, projectId, projectName, projectPath });
|
|
9827
|
+
if (partial && !pinned.has(`${c.sha} ${owner}`)) partials?.add(`${c.sha} ${owner}`);
|
|
9828
|
+
else {
|
|
9829
|
+
pinned.add(`${c.sha} ${owner}`);
|
|
9830
|
+
partials?.delete(`${c.sha} ${owner}`);
|
|
9831
|
+
}
|
|
9832
|
+
}
|
|
9783
9833
|
});
|
|
9784
9834
|
return [...commits2.values()].sort((a, b) => a.date < b.date ? 1 : a.date > b.date ? -1 : 0);
|
|
9785
9835
|
}
|
|
@@ -9799,7 +9849,8 @@ function createItemService(ctx, refs, links) {
|
|
|
9799
9849
|
async function syncFromGit(projectId) {
|
|
9800
9850
|
const project = projectRow(store, projectId);
|
|
9801
9851
|
if (project.git_transitions !== 1) return [];
|
|
9802
|
-
const
|
|
9852
|
+
const partials = /* @__PURE__ */ new Set();
|
|
9853
|
+
const commits2 = await relatedCommits(project, void 0, partials);
|
|
9803
9854
|
if (commits2.length === 0) return [];
|
|
9804
9855
|
const landed = await defaultBranchShas(project.path);
|
|
9805
9856
|
const statuses = effectiveStatuses(store, projectId);
|
|
@@ -9813,7 +9864,7 @@ function createItemService(ctx, refs, links) {
|
|
|
9813
9864
|
const row = db.prepare(`${ITEM_SELECT} WHERE i.id = ?`).get(id);
|
|
9814
9865
|
if (!row) continue;
|
|
9815
9866
|
const kind = statuses.find((s) => s.key === row.status)?.kind;
|
|
9816
|
-
const onDefault = related.some((c) => landed.has(c.sha));
|
|
9867
|
+
const onDefault = related.some((c) => landed.has(c.sha) && !partials.has(`${c.sha} ${id}`));
|
|
9817
9868
|
const to = kind === "backlog" ? onDefault && review ? review : active : kind === "active" && onDefault ? review : null;
|
|
9818
9869
|
if (!to || to.key === row.status) continue;
|
|
9819
9870
|
move({ id, status: to.key });
|
|
@@ -11146,6 +11197,10 @@ export {
|
|
|
11146
11197
|
resolveItemId,
|
|
11147
11198
|
loadMigrations,
|
|
11148
11199
|
Store,
|
|
11200
|
+
KEY_TOKEN,
|
|
11201
|
+
mentionsIn,
|
|
11202
|
+
saysNoItem,
|
|
11203
|
+
keyTokens,
|
|
11149
11204
|
GIT_CACHE_TTL_MS,
|
|
11150
11205
|
DEFAULT_COMMIT_SCAN,
|
|
11151
11206
|
clearGitCache,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
startDaemon
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KA7Z72FC.js";
|
|
5
5
|
import {
|
|
6
6
|
stopPid
|
|
7
7
|
} from "./chunk-FNBCYJA2.js";
|
|
8
8
|
import {
|
|
9
9
|
readSchemaVersion
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WREOGLK6.js";
|
|
11
11
|
import {
|
|
12
12
|
START_TIMEOUT_MS,
|
|
13
13
|
logFile
|
|
@@ -120,7 +120,7 @@ async function statusCommand(service, port, version) {
|
|
|
120
120
|
} catch (err) {
|
|
121
121
|
schemaVersion = err;
|
|
122
122
|
}
|
|
123
|
-
const { readUpdateCache, updateStatus } = await import("./src-
|
|
123
|
+
const { readUpdateCache, updateStatus } = await import("./src-2MHSOXLY.js");
|
|
124
124
|
const cache = readUpdateCache(dir);
|
|
125
125
|
cachedUpdate = cache ? updateStatus(version, cache.latestVersion) : null;
|
|
126
126
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
withSnapshot
|
|
4
|
-
} from "./chunk-V3PED2Z5.js";
|
|
5
2
|
import {
|
|
6
3
|
ApiError,
|
|
7
4
|
api,
|
|
8
5
|
apiText
|
|
9
6
|
} from "./chunk-7GQK2VEN.js";
|
|
7
|
+
import {
|
|
8
|
+
withSnapshot
|
|
9
|
+
} from "./chunk-WREOGLK6.js";
|
|
10
10
|
import {
|
|
11
11
|
run
|
|
12
12
|
} from "./chunk-I5SMACZY.js";
|
|
13
13
|
import {
|
|
14
14
|
health
|
|
15
15
|
} from "./chunk-3TOSW3FU.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-OJOVDYIZ.js";
|
|
17
17
|
import "./chunk-WKKEXOKW.js";
|
|
18
18
|
import "./chunk-KPOE4I3O.js";
|
|
19
19
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
hookInstalled
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6YTKJKSG.js";
|
|
5
5
|
import {
|
|
6
6
|
isAlive
|
|
7
7
|
} from "./chunk-FNBCYJA2.js";
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
activeProjectPaths,
|
|
10
10
|
openReadOnly,
|
|
11
11
|
schemaVersionOf
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WREOGLK6.js";
|
|
13
13
|
import "./chunk-I5SMACZY.js";
|
|
14
14
|
import {
|
|
15
15
|
baseUrl,
|
|
16
16
|
dbFile
|
|
17
17
|
} from "./chunk-3TOSW3FU.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-OJOVDYIZ.js";
|
|
19
19
|
import "./chunk-WKKEXOKW.js";
|
|
20
20
|
import "./chunk-KPOE4I3O.js";
|
|
21
21
|
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
HOOK,
|
|
4
|
+
HOOK_REFUSED,
|
|
4
5
|
HOOK_SCRIPT,
|
|
5
6
|
MARKER,
|
|
7
|
+
REQUIRE_KEY,
|
|
8
|
+
SHIPPED_CHECK_KEY,
|
|
9
|
+
checkMessage,
|
|
6
10
|
hookInstalled,
|
|
11
|
+
hookPolicy,
|
|
7
12
|
hooksDir,
|
|
8
13
|
installHook,
|
|
14
|
+
messageText,
|
|
9
15
|
uninstallHook
|
|
10
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6YTKJKSG.js";
|
|
11
17
|
import "./chunk-I5SMACZY.js";
|
|
12
18
|
import "./chunk-KPOE4I3O.js";
|
|
13
19
|
export {
|
|
14
20
|
HOOK,
|
|
21
|
+
HOOK_REFUSED,
|
|
15
22
|
HOOK_SCRIPT,
|
|
16
23
|
MARKER,
|
|
24
|
+
REQUIRE_KEY,
|
|
25
|
+
SHIPPED_CHECK_KEY,
|
|
26
|
+
checkMessage,
|
|
17
27
|
hookInstalled,
|
|
28
|
+
hookPolicy,
|
|
18
29
|
hooksDir,
|
|
19
30
|
installHook,
|
|
31
|
+
messageText,
|
|
20
32
|
uninstallHook
|
|
21
33
|
};
|
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
statusLines,
|
|
8
8
|
stopCommand,
|
|
9
9
|
stopServer
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-ZCFHR5VG.js";
|
|
11
|
+
import "./chunk-KA7Z72FC.js";
|
|
12
12
|
import "./chunk-FNBCYJA2.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-WREOGLK6.js";
|
|
14
14
|
import "./chunk-TCKAXJOM.js";
|
|
15
15
|
import "./chunk-MKT3PGWK.js";
|
|
16
16
|
import "./chunk-3TOSW3FU.js";
|
|
17
17
|
import "./chunk-GD6AEWOM.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-OJOVDYIZ.js";
|
|
19
19
|
import "./chunk-WKKEXOKW.js";
|
|
20
20
|
import "./chunk-KPOE4I3O.js";
|
|
21
21
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
stopServer
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ZCFHR5VG.js";
|
|
5
|
+
import "./chunk-KA7Z72FC.js";
|
|
6
6
|
import "./chunk-FNBCYJA2.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-WREOGLK6.js";
|
|
8
8
|
import "./chunk-TCKAXJOM.js";
|
|
9
9
|
import {
|
|
10
10
|
currentSpec
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
waitForHealth
|
|
23
23
|
} from "./chunk-3TOSW3FU.js";
|
|
24
24
|
import "./chunk-GD6AEWOM.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-OJOVDYIZ.js";
|
|
26
26
|
import "./chunk-WKKEXOKW.js";
|
|
27
27
|
import "./chunk-KPOE4I3O.js";
|
|
28
28
|
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ApiError,
|
|
4
|
+
api
|
|
5
|
+
} from "./chunk-7GQK2VEN.js";
|
|
6
|
+
import {
|
|
7
|
+
run
|
|
8
|
+
} from "./chunk-I5SMACZY.js";
|
|
9
|
+
import "./chunk-3TOSW3FU.js";
|
|
10
|
+
import "./chunk-KPOE4I3O.js";
|
|
11
|
+
|
|
12
|
+
// src/shipped.ts
|
|
13
|
+
var SHIPPED_PENDING = 3;
|
|
14
|
+
var RELEASE_TAGS_KEY = "slate.releaseTags";
|
|
15
|
+
var UNDOING = /^(Revert|Reapply) "/;
|
|
16
|
+
var MAX_COMMITS = 5e3;
|
|
17
|
+
var q = encodeURIComponent;
|
|
18
|
+
var short = (sha) => sha.slice(0, 7);
|
|
19
|
+
var plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
20
|
+
var subject = (message) => message.split("\n", 1)[0].trim();
|
|
21
|
+
var label = (item) => item.key ?? item.id;
|
|
22
|
+
async function shipped(port, cwd, options, git = run) {
|
|
23
|
+
const { mentionsIn, saysNoItem } = await import("./src-QB7VJHQH.js");
|
|
24
|
+
const inRepo = (args) => git("git", ["-C", cwd, ...args]);
|
|
25
|
+
const commitOf = async (ref2) => {
|
|
26
|
+
const found = await inRepo(["rev-parse", "--verify", "--quiet", "--end-of-options", `${ref2}^{commit}`]);
|
|
27
|
+
return found.code === 0 ? found.stdout.trim() : null;
|
|
28
|
+
};
|
|
29
|
+
if ((await inRepo(["rev-parse", "--git-dir"])).code !== 0) {
|
|
30
|
+
if (options.check) return { lines: [], code: 0 };
|
|
31
|
+
throw new Error(`${cwd} is not in a git repository`);
|
|
32
|
+
}
|
|
33
|
+
const pattern = (await inRepo(["config", "--get", RELEASE_TAGS_KEY])).stdout.trim();
|
|
34
|
+
const describe = (at) => inRepo(["describe", "--tags", "--abbrev=0", ...pattern ? ["--match", pattern] : [], at]);
|
|
35
|
+
let ref = options.ref;
|
|
36
|
+
if (ref === void 0) {
|
|
37
|
+
const newest = await describe("HEAD");
|
|
38
|
+
if (newest.code !== 0) {
|
|
39
|
+
if (options.check) return { lines: [], code: 0 };
|
|
40
|
+
throw new Error("no tag is reachable from HEAD; name what shipped: slate shipped <ref>");
|
|
41
|
+
}
|
|
42
|
+
ref = newest.stdout.trim();
|
|
43
|
+
}
|
|
44
|
+
const sha = await commitOf(ref);
|
|
45
|
+
if (!sha) throw new Error(`${ref} is not a commit in ${cwd}`);
|
|
46
|
+
let since = options.since;
|
|
47
|
+
let from = null;
|
|
48
|
+
if (since !== void 0) {
|
|
49
|
+
from = await commitOf(since);
|
|
50
|
+
if (!from) throw new Error(`${since} is not a commit in ${cwd}`);
|
|
51
|
+
} else {
|
|
52
|
+
const before = await describe(`${sha}^`);
|
|
53
|
+
if (before.code === 0) {
|
|
54
|
+
since = before.stdout.trim();
|
|
55
|
+
from = await commitOf(since);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const ctx = await api(port, "GET", `/context?cwd=${q(cwd)}`).catch((err) => {
|
|
59
|
+
if (err instanceof ApiError && err.status < 500) return null;
|
|
60
|
+
throw err;
|
|
61
|
+
});
|
|
62
|
+
if (!ctx?.project) {
|
|
63
|
+
if (options.check) return { lines: [], code: 0 };
|
|
64
|
+
throw new Error(`${cwd} is not inside a registered project`);
|
|
65
|
+
}
|
|
66
|
+
const project = await api(port, "GET", `/projects/${q(ctx.project.id)}`);
|
|
67
|
+
const done = project.statuses.find((s) => s.kind === "done");
|
|
68
|
+
if (!done) throw new Error(`${project.name} has no done column`);
|
|
69
|
+
const log = await inRepo(["log", `--max-count=${MAX_COMMITS}`, "--format=%H%x1f%P%x1f%B%x1e", from ? `${from}..${sha}` : sha]);
|
|
70
|
+
if (log.code !== 0) throw new Error(`git log failed: ${(log.stderr || log.stdout).trim().split("\n")[0]}`);
|
|
71
|
+
const commits = log.stdout.split("").map((record) => record.replace(/^\n+/, "").split("")).filter((fields) => fields.length === 3 && fields[0]).map(([hash, parents, message]) => ({ sha: hash, merge: parents.trim().includes(" "), message }));
|
|
72
|
+
const board = await api(port, "GET", `/projects/${q(project.id)}/board?includeDone=true`);
|
|
73
|
+
const items = /* @__PURE__ */ new Map();
|
|
74
|
+
for (const column2 of board.columns) {
|
|
75
|
+
for (const item of column2.items) {
|
|
76
|
+
items.set(item.id, item);
|
|
77
|
+
if (item.key) items.set(item.key, item);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const wanted = new Set(items.keys());
|
|
81
|
+
const finishing = /* @__PURE__ */ new Map();
|
|
82
|
+
const partOnly = /* @__PURE__ */ new Map();
|
|
83
|
+
const unnamed = [];
|
|
84
|
+
for (const commit of commits) {
|
|
85
|
+
if (UNDOING.test(commit.message)) continue;
|
|
86
|
+
const mentions = mentionsIn(commit.message, wanted);
|
|
87
|
+
if (mentions.size === 0) {
|
|
88
|
+
if (!commit.merge && !saysNoItem(commit.message)) unnamed.push(commit);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const plain = /* @__PURE__ */ new Map();
|
|
92
|
+
for (const [token, { partial }] of mentions) {
|
|
93
|
+
const id = items.get(token).id;
|
|
94
|
+
plain.set(id, (plain.get(id) ?? false) || !partial);
|
|
95
|
+
}
|
|
96
|
+
for (const [id, finishes] of plain) {
|
|
97
|
+
const item = items.get(id);
|
|
98
|
+
if (finishes && !finishing.has(id)) finishing.set(id, { item, sha: commit.sha });
|
|
99
|
+
else if (!finishes) partOnly.set(id, item);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const id of finishing.keys()) partOnly.delete(id);
|
|
103
|
+
const kind = (item) => project.statuses.find((s) => s.key === item.status)?.kind;
|
|
104
|
+
const column = (item) => project.statuses.find((s) => s.key === item.status)?.label ?? item.status;
|
|
105
|
+
const pending = [...finishing.values()].filter(({ item }) => kind(item) !== "done");
|
|
106
|
+
const already = finishing.size - pending.length;
|
|
107
|
+
const range = `${ref} (${plural(commits.length, "commit")}${since ? ` since ${since}` : ""})`;
|
|
108
|
+
if (options.check) {
|
|
109
|
+
if (pending.length === 0) return { lines: [`${range} in ${project.name}: nothing left to move to ${done.label}`], code: 0 };
|
|
110
|
+
return {
|
|
111
|
+
lines: [
|
|
112
|
+
`${ref} names ${plural(pending.length, "item")} of ${project.name} not in ${done.label}:`,
|
|
113
|
+
...pending.map(({ item }) => ` ${label(item).padEnd(9)} ${item.title} [${column(item)}]`),
|
|
114
|
+
`when ${ref} is out: slate shipped ${ref}`
|
|
115
|
+
],
|
|
116
|
+
code: SHIPPED_PENDING
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const lines = [`${range} in ${project.name}`];
|
|
120
|
+
let moved = 0;
|
|
121
|
+
let failed = 0;
|
|
122
|
+
for (const { item, sha: commit } of pending) {
|
|
123
|
+
if (options.dryRun) {
|
|
124
|
+
lines.push(` would move ${label(item).padEnd(9)} ${item.title} (${short(commit)})`);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
await api(port, "POST", `/items/${q(item.id)}/move`, { status: done.key, commit, expectedRevision: item.revision });
|
|
129
|
+
moved += 1;
|
|
130
|
+
lines.push(` done ${label(item).padEnd(9)} ${item.title} (${short(commit)})`);
|
|
131
|
+
} catch (err) {
|
|
132
|
+
failed += 1;
|
|
133
|
+
lines.push(` failed ${label(item).padEnd(9)} ${item.title}: ${err instanceof Error ? err.message : String(err)}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
for (const item of partOnly.values()) {
|
|
137
|
+
if (kind(item) !== "done") lines.push(` part ${label(item).padEnd(9)} ${item.title} [${column(item)}]`);
|
|
138
|
+
}
|
|
139
|
+
for (const commit of unnamed) lines.push(` no item ${short(commit.sha)} ${subject(commit.message)}`);
|
|
140
|
+
const counts = [
|
|
141
|
+
options.dryRun ? `${pending.length} to move to ${done.label}` : `${moved} moved to ${done.label}`,
|
|
142
|
+
`${already} already there`,
|
|
143
|
+
...failed ? [`${failed} failed`] : [],
|
|
144
|
+
...unnamed.length ? [`${plural(unnamed.length, "commit")} ${unnamed.length === 1 ? "names" : "name"} no item`] : []
|
|
145
|
+
];
|
|
146
|
+
lines.push(counts.join(", "));
|
|
147
|
+
return { lines, code: failed ? 1 : 0 };
|
|
148
|
+
}
|
|
149
|
+
export {
|
|
150
|
+
RELEASE_TAGS_KEY,
|
|
151
|
+
SHIPPED_PENDING,
|
|
152
|
+
shipped
|
|
153
|
+
};
|
|
@@ -35,9 +35,9 @@ import {
|
|
|
35
35
|
upgradeMarkerPath,
|
|
36
36
|
writeUpdateCache,
|
|
37
37
|
writeUpgradeMarker
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6CR2V7P7.js";
|
|
39
39
|
import "./chunk-GD6AEWOM.js";
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-OJOVDYIZ.js";
|
|
41
41
|
import "./chunk-WKKEXOKW.js";
|
|
42
42
|
import "./chunk-KPOE4I3O.js";
|
|
43
43
|
export {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ERROR_CODES,
|
|
11
11
|
EventBus,
|
|
12
12
|
GIT_CACHE_TTL_MS,
|
|
13
|
+
KEY_TOKEN,
|
|
13
14
|
MAX_ARCHITECTURE_VIEWS,
|
|
14
15
|
MAX_CHANGED_FILES,
|
|
15
16
|
MAX_LIST_LIMIT,
|
|
@@ -51,10 +52,12 @@ import {
|
|
|
51
52
|
itemReleaseSchema,
|
|
52
53
|
itemUpdateSchema,
|
|
53
54
|
keyFromBranch,
|
|
55
|
+
keyTokens,
|
|
54
56
|
lineSuffix,
|
|
55
57
|
linkKindSchema,
|
|
56
58
|
linkSchema,
|
|
57
59
|
loadMigrations,
|
|
60
|
+
mentionsIn,
|
|
58
61
|
milestoneSchema,
|
|
59
62
|
nameSchema,
|
|
60
63
|
normalizePath,
|
|
@@ -77,6 +80,7 @@ import {
|
|
|
77
80
|
resolveCommit,
|
|
78
81
|
resolveItemId,
|
|
79
82
|
resolveSchema,
|
|
83
|
+
saysNoItem,
|
|
80
84
|
setStatusesSchema,
|
|
81
85
|
slateHome,
|
|
82
86
|
splitFileTarget,
|
|
@@ -90,7 +94,7 @@ import {
|
|
|
90
94
|
workspaceCreateSchema,
|
|
91
95
|
workspaceUpdateSchema,
|
|
92
96
|
worktreeMainRepo
|
|
93
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-OJOVDYIZ.js";
|
|
94
98
|
import "./chunk-WKKEXOKW.js";
|
|
95
99
|
import "./chunk-KPOE4I3O.js";
|
|
96
100
|
export {
|
|
@@ -104,6 +108,7 @@ export {
|
|
|
104
108
|
ERROR_CODES,
|
|
105
109
|
EventBus,
|
|
106
110
|
GIT_CACHE_TTL_MS,
|
|
111
|
+
KEY_TOKEN,
|
|
107
112
|
MAX_ARCHITECTURE_VIEWS,
|
|
108
113
|
MAX_CHANGED_FILES,
|
|
109
114
|
MAX_LIST_LIMIT,
|
|
@@ -145,10 +150,12 @@ export {
|
|
|
145
150
|
itemReleaseSchema,
|
|
146
151
|
itemUpdateSchema,
|
|
147
152
|
keyFromBranch,
|
|
153
|
+
keyTokens,
|
|
148
154
|
lineSuffix,
|
|
149
155
|
linkKindSchema,
|
|
150
156
|
linkSchema,
|
|
151
157
|
loadMigrations,
|
|
158
|
+
mentionsIn,
|
|
152
159
|
milestoneSchema,
|
|
153
160
|
nameSchema,
|
|
154
161
|
normalizePath,
|
|
@@ -171,6 +178,7 @@ export {
|
|
|
171
178
|
resolveCommit,
|
|
172
179
|
resolveItemId,
|
|
173
180
|
resolveSchema,
|
|
181
|
+
saysNoItem,
|
|
174
182
|
setStatusesSchema,
|
|
175
183
|
slateHome,
|
|
176
184
|
splitFileTarget,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
stopServer
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ZCFHR5VG.js";
|
|
5
|
+
import "./chunk-KA7Z72FC.js";
|
|
6
6
|
import "./chunk-FNBCYJA2.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-WREOGLK6.js";
|
|
8
8
|
import "./chunk-TCKAXJOM.js";
|
|
9
9
|
import {
|
|
10
10
|
currentSpec
|
|
@@ -32,12 +32,12 @@ import {
|
|
|
32
32
|
compareVersions,
|
|
33
33
|
writeUpdateCache,
|
|
34
34
|
writeUpgradeMarker
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-6CR2V7P7.js";
|
|
36
36
|
import "./chunk-GD6AEWOM.js";
|
|
37
37
|
import {
|
|
38
38
|
Store,
|
|
39
39
|
isInside
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-OJOVDYIZ.js";
|
|
41
41
|
import "./chunk-WKKEXOKW.js";
|
|
42
42
|
import "./chunk-KPOE4I3O.js";
|
|
43
43
|
|
package/package.json
CHANGED
package/dist/chunk-3ZLMW2RI.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
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 HOOK_SCRIPT = `#!/bin/sh
|
|
13
|
-
${MARKER} (slate hooks install; remove with slate hooks uninstall).
|
|
14
|
-
# On a slate/<KEY>-... branch, adds "slate: <KEY>" to the message unless it already names <KEY>.
|
|
15
|
-
chained="$(dirname "$0")/${CHAINED}"
|
|
16
|
-
if [ -x "$chained" ]; then "$chained" "$@" || exit $?; fi
|
|
17
|
-
msg="$1"
|
|
18
|
-
# Merges keep their message.
|
|
19
|
-
[ -f "$(git rev-parse --git-path MERGE_HEAD)" ] && exit 0
|
|
20
|
-
branch=$(git symbolic-ref --short -q HEAD) || exit 0
|
|
21
|
-
key=$(printf '%s\\n' "$branch" | sed -n 's#^slate/\\([A-Za-z][A-Za-z]*-[0-9][0-9]*\\).*$#\\1#p' | tr '[:lower:]' '[:upper:]')
|
|
22
|
-
[ -n "$key" ] || exit 0
|
|
23
|
-
# Nothing written (git aborts empty messages) or the key is already there: leave it alone.
|
|
24
|
-
body=$(grep -v '^#' "$msg" | tr -d '[:space:]')
|
|
25
|
-
[ -n "$body" ] || exit 0
|
|
26
|
-
grep -v '^#' "$msg" | grep -qiE "(^|[^A-Za-z0-9_-])$key([^A-Za-z0-9_-]|$)" && exit 0
|
|
27
|
-
git interpret-trailers --in-place --trailer "slate: $key" "$msg"
|
|
28
|
-
`;
|
|
29
|
-
async function hooksDir(cwd, git = run) {
|
|
30
|
-
const result = await git("git", ["-C", cwd, "rev-parse", "--path-format=absolute", "--git-path", "hooks"]);
|
|
31
|
-
if (result.code !== 0) throw new Error(`${cwd} is not in a git repository`);
|
|
32
|
-
return result.stdout.trim();
|
|
33
|
-
}
|
|
34
|
-
var isOurs = (file) => existsSync(file) && readFileSync(file, "utf8").includes(MARKER);
|
|
35
|
-
async function hookInstalled(cwd, git = run) {
|
|
36
|
-
return isOurs(path.join(await hooksDir(cwd, git), HOOK));
|
|
37
|
-
}
|
|
38
|
-
async function installHook(cwd, git = run) {
|
|
39
|
-
const dir = await hooksDir(cwd, git);
|
|
40
|
-
const file = path.join(dir, HOOK);
|
|
41
|
-
const lines = [];
|
|
42
|
-
if (existsSync(file) && !isOurs(file)) {
|
|
43
|
-
if (existsSync(path.join(dir, CHAINED))) throw new Error(`${file} is not slate's and ${CHAINED} already exists; merge them by hand`);
|
|
44
|
-
renameSync(file, path.join(dir, CHAINED));
|
|
45
|
-
lines.push(`kept the existing ${HOOK} hook as ${CHAINED}; it runs first`);
|
|
46
|
-
}
|
|
47
|
-
const fresh = !isOurs(file);
|
|
48
|
-
writeFileSync(file, HOOK_SCRIPT);
|
|
49
|
-
chmodSync(file, 493);
|
|
50
|
-
lines.unshift(fresh ? `installed ${file}` : `updated ${file}`);
|
|
51
|
-
return lines;
|
|
52
|
-
}
|
|
53
|
-
async function uninstallHook(cwd, git = run) {
|
|
54
|
-
const dir = await hooksDir(cwd, git);
|
|
55
|
-
const file = path.join(dir, HOOK);
|
|
56
|
-
if (!isOurs(file)) return [`no slate ${HOOK} hook in ${dir}`];
|
|
57
|
-
rmSync(file);
|
|
58
|
-
const chained = path.join(dir, CHAINED);
|
|
59
|
-
if (existsSync(chained)) {
|
|
60
|
-
renameSync(chained, file);
|
|
61
|
-
return [`removed slate's hook; restored the previous ${HOOK} hook`];
|
|
62
|
-
}
|
|
63
|
-
return [`removed ${file}`];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
HOOK,
|
|
68
|
-
MARKER,
|
|
69
|
-
HOOK_SCRIPT,
|
|
70
|
-
hooksDir,
|
|
71
|
-
hookInstalled,
|
|
72
|
-
installHook,
|
|
73
|
-
uninstallHook
|
|
74
|
-
};
|