@nickmeriano/task 0.7.1 → 0.9.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.
Files changed (128) hide show
  1. package/README.md +73 -25
  2. package/dist/asks.test.d.ts +17 -0
  3. package/dist/asks.test.d.ts.map +1 -0
  4. package/dist/asks.test.js +278 -0
  5. package/dist/asks.test.js.map +1 -0
  6. package/dist/check.d.ts +43 -0
  7. package/dist/check.d.ts.map +1 -0
  8. package/dist/check.js +403 -0
  9. package/dist/check.js.map +1 -0
  10. package/dist/check.test.d.ts +9 -0
  11. package/dist/check.test.d.ts.map +1 -0
  12. package/dist/check.test.js +248 -0
  13. package/dist/check.test.js.map +1 -0
  14. package/dist/claim-io.d.ts +73 -0
  15. package/dist/claim-io.d.ts.map +1 -0
  16. package/dist/claim-io.js +344 -0
  17. package/dist/claim-io.js.map +1 -0
  18. package/dist/claim.d.ts +61 -9
  19. package/dist/claim.d.ts.map +1 -1
  20. package/dist/claim.js +197 -67
  21. package/dist/claim.js.map +1 -1
  22. package/dist/claim.test.d.ts +2 -2
  23. package/dist/claim.test.js +235 -64
  24. package/dist/claim.test.js.map +1 -1
  25. package/dist/cli.js +724 -136
  26. package/dist/cli.js.map +1 -1
  27. package/dist/file-store.d.ts +110 -38
  28. package/dist/file-store.d.ts.map +1 -1
  29. package/dist/file-store.js +514 -238
  30. package/dist/file-store.js.map +1 -1
  31. package/dist/git-serve.d.ts +183 -0
  32. package/dist/git-serve.d.ts.map +1 -0
  33. package/dist/git-serve.js +503 -0
  34. package/dist/git-serve.js.map +1 -0
  35. package/dist/git-serve.test.d.ts +16 -0
  36. package/dist/git-serve.test.d.ts.map +1 -0
  37. package/dist/git-serve.test.js +183 -0
  38. package/dist/git-serve.test.js.map +1 -0
  39. package/dist/git.d.ts +65 -0
  40. package/dist/git.d.ts.map +1 -0
  41. package/dist/git.js +114 -0
  42. package/dist/git.js.map +1 -0
  43. package/dist/id.d.ts +39 -0
  44. package/dist/id.d.ts.map +1 -0
  45. package/dist/id.js +67 -0
  46. package/dist/id.js.map +1 -0
  47. package/dist/inbox.d.ts +41 -0
  48. package/dist/inbox.d.ts.map +1 -0
  49. package/dist/inbox.js +56 -0
  50. package/dist/inbox.js.map +1 -0
  51. package/dist/index.d.ts +5 -3
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +5 -3
  54. package/dist/index.js.map +1 -1
  55. package/dist/overview.d.ts +52 -0
  56. package/dist/overview.d.ts.map +1 -0
  57. package/dist/overview.js +61 -0
  58. package/dist/overview.js.map +1 -0
  59. package/dist/overview.test.d.ts +8 -0
  60. package/dist/overview.test.d.ts.map +1 -0
  61. package/dist/overview.test.js +48 -0
  62. package/dist/overview.test.js.map +1 -0
  63. package/dist/promote.test.d.ts +15 -0
  64. package/dist/promote.test.d.ts.map +1 -0
  65. package/dist/promote.test.js +104 -0
  66. package/dist/promote.test.js.map +1 -0
  67. package/dist/publish.d.ts +2 -17
  68. package/dist/publish.d.ts.map +1 -1
  69. package/dist/publish.js +4 -49
  70. package/dist/publish.js.map +1 -1
  71. package/dist/search.d.ts +34 -0
  72. package/dist/search.d.ts.map +1 -0
  73. package/dist/search.js +79 -0
  74. package/dist/search.js.map +1 -0
  75. package/dist/search.test.d.ts +2 -0
  76. package/dist/search.test.d.ts.map +1 -0
  77. package/dist/search.test.js +53 -0
  78. package/dist/search.test.js.map +1 -0
  79. package/dist/server.d.ts.map +1 -1
  80. package/dist/server.js +228 -23
  81. package/dist/server.js.map +1 -1
  82. package/dist/store.d.ts +43 -63
  83. package/dist/store.d.ts.map +1 -1
  84. package/dist/store.js +0 -368
  85. package/dist/store.js.map +1 -1
  86. package/dist/store.test.d.ts +1 -2
  87. package/dist/store.test.d.ts.map +1 -1
  88. package/dist/store.test.js +148 -106
  89. package/dist/store.test.js.map +1 -1
  90. package/dist/ticket-doc.d.ts +74 -5
  91. package/dist/ticket-doc.d.ts.map +1 -1
  92. package/dist/ticket-doc.js +229 -15
  93. package/dist/ticket-doc.js.map +1 -1
  94. package/dist/types.d.ts +115 -28
  95. package/dist/types.d.ts.map +1 -1
  96. package/dist/types.js.map +1 -1
  97. package/package.json +1 -1
  98. package/skill/SKILL.md +153 -40
  99. package/src/asks.test.ts +355 -0
  100. package/src/check.test.ts +328 -0
  101. package/src/check.ts +497 -0
  102. package/src/claim-io.ts +401 -0
  103. package/src/claim.test.ts +301 -71
  104. package/src/claim.ts +238 -81
  105. package/src/cli.ts +740 -131
  106. package/src/file-store.ts +572 -254
  107. package/src/git-serve.test.ts +240 -0
  108. package/src/git-serve.ts +595 -0
  109. package/src/git.ts +141 -0
  110. package/src/id.ts +68 -0
  111. package/src/inbox.ts +77 -0
  112. package/src/index.ts +4 -2
  113. package/src/overview.test.ts +52 -0
  114. package/src/overview.ts +105 -0
  115. package/src/promote.test.ts +143 -0
  116. package/src/publish.ts +6 -53
  117. package/src/search.test.ts +64 -0
  118. package/src/search.ts +105 -0
  119. package/src/server.ts +232 -21
  120. package/src/store.test.ts +166 -116
  121. package/src/store.ts +46 -444
  122. package/src/ticket-doc.ts +284 -21
  123. package/src/types.ts +120 -28
  124. package/ui/dist/assets/index-BjsorZOU.js +229 -0
  125. package/ui/dist/assets/index-CoKCUYic.css +1 -0
  126. package/ui/dist/index.html +2 -2
  127. package/ui/dist/assets/index-COunM-QN.css +0 -1
  128. package/ui/dist/assets/index-D4homvrQ.js +0 -229
@@ -0,0 +1,344 @@
1
+ /**
2
+ * Ask I/O against claim branches (TAS-38, second round): a claimed ticket's
3
+ * truth lives on its claim branch, so ask *writes* on a claimed ticket go to
4
+ * the branch too — resolve, reopen, add, delete — as real commits, made and
5
+ * pushed without ever touching the checkout. The owner clicks a checkbox on
6
+ * main's board; the commit lands on `claude/task/tas-40`; the worker's next
7
+ * tick pulls it and sees the answer in the one place it was ever going to
8
+ * look. No parallel copies, no merge collision, no relay through comments.
9
+ *
10
+ * The mechanics are plain git plumbing: build the new tree in a temporary
11
+ * index (`read-tree` → `update-index` → `write-tree`), commit it with the
12
+ * branch tip as parent, and push fast-forward. A concurrent worker push just
13
+ * rejects ours; we refetch and reapply once against the new tip — the
14
+ * mutation is expressed as a function of the file's current bytes, so a
15
+ * retry can notice the work is already done and quietly stand down.
16
+ *
17
+ * Reads (the inbox's view of a claimed ticket) live here too, so reading and
18
+ * writing can never disagree about where an ask file is.
19
+ */
20
+ import { rmSync } from "node:fs";
21
+ import { tmpdir } from "node:os";
22
+ import { join, relative, sep } from "node:path";
23
+ import { claimBranch, claimNamespace } from "./claim.js";
24
+ import { gitOut, runGit } from "./git.js";
25
+ import { commentStem, parseAskLenient, serializeAsk } from "./ticket-doc.js";
26
+ import { ASKS_DIR, TICKETS_DIR } from "./file-store.js";
27
+ /**
28
+ * Soft git (from git.ts): null on any failure — callers decide whether that's
29
+ * an error. These run inside `task serve` request handlers, so a network call
30
+ * must never wait on a human: the shared module's no-prompt env turns a
31
+ * would-be credential prompt into a fast failure, and its timeout bounds a
32
+ * wedged remote. The 30s default is kept even for the fetches and pushes
33
+ * here — a serve request that can't finish in that is better off failing.
34
+ */
35
+ const git = gitOut;
36
+ /** Like `git`, but with extra env — the temp-index dance needs GIT_INDEX_FILE. */
37
+ function gitEnv(cwd, env, ...args) {
38
+ const result = runGit(cwd, args, { env });
39
+ return result.status === 0 ? result.stdout : null;
40
+ }
41
+ /**
42
+ * Every claim branch on origin right now, with its tip sha — one bounded
43
+ * `ls-remote`, the single unavoidable network call behind live claim status.
44
+ * Null means "origin can't be asked" (offline, no remote, auth would have
45
+ * prompted), which every caller treats as "act on file truth". This is the
46
+ * read-path twin of claim.ts's `remoteClaims`, deliberately separate: reads
47
+ * must never prompt for credentials — this runs inside `task serve` request
48
+ * handlers — while `task claim` itself may legitimately ask a human to log in.
49
+ */
50
+ export function remoteClaimTips(store) {
51
+ let namespace;
52
+ try {
53
+ namespace = claimNamespace(store.config);
54
+ }
55
+ catch {
56
+ return null;
57
+ }
58
+ const out = git(store.root, "ls-remote", "--heads", "origin", `${namespace}*`);
59
+ if (out === null)
60
+ return null;
61
+ const tips = new Map();
62
+ for (const line of out.split("\n")) {
63
+ const [sha, ref] = line.split("\t");
64
+ if (ref?.startsWith("refs/heads/"))
65
+ tips.set(ref.slice("refs/heads/".length), sha);
66
+ }
67
+ return tips;
68
+ }
69
+ /**
70
+ * Make the local remote-tracking claim refs agree with the tips `ls-remote`
71
+ * just reported — fetching *only the branches that moved* (the tip sha says
72
+ * whether anything changed, so an unchanged claim costs no fetch at all) and
73
+ * deleting local refs for claims origin no longer has, so a released claim
74
+ * can't linger as a ghost. This is what keeps the inbox cheap under the UI's
75
+ * refetch-on-every-change behavior: steady state is one ls-remote and zero
76
+ * fetches.
77
+ */
78
+ export function syncClaimRefs(store, namespace, tips) {
79
+ const stale = [...tips].filter(([branch, sha]) => git(store.root, "rev-parse", "--verify", "--quiet", `refs/remotes/origin/${branch}`) !== sha);
80
+ if (stale.length > 0) {
81
+ git(store.root, "fetch", "--quiet", "origin", ...stale.map(([branch]) => `+refs/heads/${branch}:refs/remotes/origin/${branch}`));
82
+ }
83
+ const local = git(store.root, "for-each-ref", "--format=%(refname:short)", `refs/remotes/origin/${namespace}*`);
84
+ for (const short of local?.split("\n") ?? []) {
85
+ const branch = short.replace(/^origin\//, "");
86
+ if (branch && !tips.has(branch)) {
87
+ git(store.root, "update-ref", "-d", `refs/remotes/origin/${branch}`);
88
+ }
89
+ }
90
+ }
91
+ /** Force-refresh one claim branch's local ref — the write path's retry needs the moved tip. */
92
+ function fetchClaimBranch(store, branch) {
93
+ git(store.root, "fetch", "--quiet", "origin", `+refs/heads/${branch}:refs/remotes/origin/${branch}`);
94
+ }
95
+ /**
96
+ * The ticket's claim branch if one exists on origin right now, else null —
97
+ * null also for "origin unreachable". Syncs the local claim refs as a side
98
+ * effect when a claim is found, so subsequent branch reads see the tip the
99
+ * answer was based on.
100
+ */
101
+ export function claimFor(store, key) {
102
+ try {
103
+ const branch = claimBranch(store.config, key);
104
+ const tips = remoteClaimTips(store);
105
+ if (!tips?.has(branch))
106
+ return null;
107
+ syncClaimRefs(store, claimNamespace(store.config), tips);
108
+ return branch;
109
+ }
110
+ catch {
111
+ return null;
112
+ }
113
+ }
114
+ /** True when this checkout *is* the claim branch — then local writes are branch writes. */
115
+ export function onClaimBranch(store, branch) {
116
+ return git(store.root, "symbolic-ref", "--quiet", "--short", "HEAD") === branch;
117
+ }
118
+ /** The ask directory's path relative to the git toplevel — git speaks toplevel paths. */
119
+ function askDirOnBranch(store, key) {
120
+ const toplevel = git(store.root, "rev-parse", "--show-toplevel");
121
+ if (!toplevel)
122
+ return null;
123
+ return [relative(toplevel, store.taskDir).split(sep).join("/"), TICKETS_DIR, key, ASKS_DIR]
124
+ .filter(Boolean)
125
+ .join("/");
126
+ }
127
+ /**
128
+ * The ask files of one ticket as its claim branch has them, leniently — the
129
+ * branch's bytes were written by another checkout and possibly an older CLI.
130
+ * Any git failure (ref gone between fetch and read, no asks dir) reads as
131
+ * "no asks on the branch", never an error.
132
+ */
133
+ export function branchAsks(store, branch, key) {
134
+ const dir = askDirOnBranch(store, key);
135
+ if (!dir)
136
+ return [];
137
+ const listing = git(store.root, "ls-tree", "--name-only", `origin/${branch}:${dir}`);
138
+ if (!listing)
139
+ return [];
140
+ const asks = [];
141
+ for (const name of listing.split("\n")) {
142
+ if (!name.endsWith(".md") || name.startsWith("."))
143
+ continue;
144
+ const text = git(store.root, "show", `origin/${branch}:${dir}/${name}`);
145
+ if (text === null)
146
+ continue;
147
+ const doc = parseAskLenient(text);
148
+ if (!doc)
149
+ continue;
150
+ asks.push({
151
+ id: name.slice(0, -3),
152
+ taskId: store.displayId(key),
153
+ text: doc.body,
154
+ author: doc.author,
155
+ createdAt: doc.createdAt,
156
+ resolvedAt: doc.resolvedAt,
157
+ resolvedBy: doc.resolvedBy,
158
+ });
159
+ }
160
+ return asks;
161
+ }
162
+ /**
163
+ * Local and branch asks, unioned by id with the branch winning — the branch
164
+ * holds the claim, so its version of a shared ask is the fresher one — then
165
+ * re-ordinaled over the union. These are the ordinals the inbox prints and
166
+ * the ones a resolve against a claimed ticket accepts.
167
+ */
168
+ export function mergedAsks(store, branch, task) {
169
+ const merged = new Map(task.asks.map((a) => [a.id, a]));
170
+ for (const ask of branchAsks(store, branch, task.key))
171
+ merged.set(ask.id, ask);
172
+ return [...merged.values()]
173
+ .sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id))
174
+ .map((ask, index) => ({ ...ask, ordinal: index + 1 }));
175
+ }
176
+ /**
177
+ * Commit one file change onto the claim branch and push it, without touching
178
+ * the checkout. `mutate` maps the file's current bytes (null = absent) to its
179
+ * next bytes (null = delete) — expressed that way so the fast-forward-reject
180
+ * retry can recompute against the moved tip, and return `null → no change`
181
+ * when someone else already made the edit.
182
+ */
183
+ function writeOnClaimBranch(store, branch, path, message, mutate) {
184
+ const cwd = store.root;
185
+ for (let attempt = 0;; attempt++) {
186
+ const tip = git(cwd, "rev-parse", `refs/remotes/origin/${branch}`);
187
+ if (!tip)
188
+ throw new Error(`can't read origin/${branch} — is origin reachable?`);
189
+ const current = git(cwd, "show", `${tip}:${path}`);
190
+ const next = mutate(current);
191
+ if (next === current || (next === null && current === null))
192
+ return; // already there
193
+ const index = join(tmpdir(), `task-claim-index-${process.pid}-${Date.now()}`);
194
+ const env = { GIT_INDEX_FILE: index };
195
+ try {
196
+ if (gitEnv(cwd, env, "read-tree", tip) === null) {
197
+ throw new Error(`git read-tree failed on origin/${branch}`);
198
+ }
199
+ if (next === null) {
200
+ if (gitEnv(cwd, env, "update-index", "--force-remove", path) === null) {
201
+ throw new Error(`git update-index --force-remove failed for ${path}`);
202
+ }
203
+ }
204
+ else {
205
+ const blob = runGit(cwd, ["hash-object", "-w", "--stdin"], { input: next });
206
+ const sha = blob.status === 0 ? blob.stdout : null;
207
+ if (!sha)
208
+ throw new Error("git hash-object failed");
209
+ if (gitEnv(cwd, env, "update-index", "--add", "--cacheinfo", `100644,${sha},${path}`) === null) {
210
+ throw new Error(`git update-index failed for ${path}`);
211
+ }
212
+ }
213
+ const tree = gitEnv(cwd, env, "write-tree");
214
+ if (!tree)
215
+ throw new Error("git write-tree failed");
216
+ const commit = git(cwd, "commit-tree", tree, "-p", tip, "-m", message);
217
+ if (!commit) {
218
+ throw new Error("git commit-tree failed — is git user.name/user.email configured?");
219
+ }
220
+ // The lease pins the remote ref to the tip this commit was built on:
221
+ // a moved branch rejects (retry below), and — the case a plain push
222
+ // gets dangerously wrong — a *deleted* branch rejects too, instead of
223
+ // being quietly re-created. A claim released mid-click must stay
224
+ // released; resurrecting the branch would re-lock the ticket.
225
+ if (git(cwd, "push", "--quiet", "origin", `${commit}:refs/heads/${branch}`, `--force-with-lease=refs/heads/${branch}:${tip}`) !== null) {
226
+ // Keep the local remote-tracking ref in step so an immediate re-read
227
+ // (the UI refetching the inbox) sees what was just pushed.
228
+ git(cwd, "update-ref", `refs/remotes/origin/${branch}`, commit);
229
+ return;
230
+ }
231
+ }
232
+ finally {
233
+ rmSync(index, { force: true });
234
+ }
235
+ // Push rejected — a worker moved the branch under us. Refetch and
236
+ // reapply once; a second rejection is contention worth surfacing.
237
+ if (attempt >= 1) {
238
+ throw new Error(`origin/${branch} keeps moving — a worker is pushing; retry in a moment`);
239
+ }
240
+ fetchClaimBranch(store, branch);
241
+ }
242
+ }
243
+ export function addAskRouted(store, key, text, author = "") {
244
+ const branch = claimFor(store, key);
245
+ if (!branch || onClaimBranch(store, branch)) {
246
+ return { ask: store.addAsk(key, text, author), branch: null };
247
+ }
248
+ const dir = askDirOnBranch(store, key);
249
+ if (!dir)
250
+ return { ask: store.addAsk(key, text, author), branch: null };
251
+ const createdAt = new Date().toISOString();
252
+ const existing = new Set(branchAsks(store, branch, key).map((a) => a.id));
253
+ const stem = commentStem(createdAt, author);
254
+ let id = stem;
255
+ for (let n = 2; existing.has(id); n++)
256
+ id = `${stem}-${n}`;
257
+ const doc = { author, createdAt, resolvedAt: null, resolvedBy: null, body: text };
258
+ writeOnClaimBranch(store, branch, `${dir}/${id}.md`, `chore(board): ask on ${store.displayId(key)}`,
259
+ // Absent → create; if a racing write took the name, keep theirs.
260
+ (current) => current ?? serializeAsk(doc));
261
+ const ask = mergedAsks(store, branch, store.get(key)).find((a) => a.id === id);
262
+ if (!ask)
263
+ throw new Error(`ask ${id} didn't land on ${branch} — retry`);
264
+ return { ask, branch };
265
+ }
266
+ export function setAskResolvedRouted(store, key, ref, resolved, resolvedBy = "") {
267
+ const branch = claimFor(store, key);
268
+ if (!branch || onClaimBranch(store, branch)) {
269
+ return {
270
+ ask: resolved ? store.resolveAsk(key, ref, resolvedBy) : store.reopenAsk(key, ref),
271
+ branch: null,
272
+ };
273
+ }
274
+ const task = store.get(key);
275
+ if (!task)
276
+ throw new Error(`no such task: ${store.displayId(key)}`);
277
+ const union = mergedAsks(store, branch, task);
278
+ const target = findInUnion(store, key, union, ref);
279
+ const onBranch = branchAsks(store, branch, key).some((a) => a.id === target.id);
280
+ if (!onBranch) {
281
+ return {
282
+ ask: resolved
283
+ ? store.resolveAsk(key, target.id, resolvedBy)
284
+ : store.reopenAsk(key, target.id),
285
+ branch: null,
286
+ };
287
+ }
288
+ const dir = askDirOnBranch(store, key);
289
+ const resolvedAt = new Date().toISOString();
290
+ writeOnClaimBranch(store, branch, `${dir}/${target.id}.md`, `chore(board): ${resolved ? "resolve" : "reopen"} ask [${target.ordinal}] on ${store.displayId(key)}`, (current) => {
291
+ if (current === null)
292
+ return null; // deleted under us — nothing to write
293
+ const doc = parseAskLenient(current);
294
+ if (!doc)
295
+ return current;
296
+ if (resolved && doc.resolvedAt)
297
+ return current; // already resolved — stand down
298
+ if (!resolved && !doc.resolvedAt)
299
+ return current;
300
+ return serializeAsk({
301
+ ...doc,
302
+ resolvedAt: resolved ? resolvedAt : null,
303
+ resolvedBy: resolved ? resolvedBy : null,
304
+ });
305
+ });
306
+ const ask = mergedAsks(store, branch, task).find((a) => a.id === target.id);
307
+ return { ask: ask ?? { ...target, resolvedAt: resolved ? resolvedAt : null, resolvedBy: resolved ? resolvedBy : null }, branch };
308
+ }
309
+ export function deleteAskRouted(store, key, ref) {
310
+ const branch = claimFor(store, key);
311
+ if (!branch || onClaimBranch(store, branch)) {
312
+ return { ask: store.deleteAsk(key, ref), branch: null };
313
+ }
314
+ const task = store.get(key);
315
+ if (!task)
316
+ throw new Error(`no such task: ${store.displayId(key)}`);
317
+ const union = mergedAsks(store, branch, task);
318
+ const target = findInUnion(store, key, union, ref);
319
+ const onBranch = branchAsks(store, branch, key).some((a) => a.id === target.id);
320
+ if (!onBranch)
321
+ return { ask: store.deleteAsk(key, target.id), branch: null };
322
+ const dir = askDirOnBranch(store, key);
323
+ writeOnClaimBranch(store, branch, `${dir}/${target.id}.md`, `chore(board): delete ask [${target.ordinal}] on ${store.displayId(key)}`, () => null);
324
+ // The local copy of a both-sides ask goes too, or the union resurrects it.
325
+ if (task.asks.some((a) => a.id === target.id))
326
+ store.deleteAsk(key, target.id);
327
+ return { ask: target, branch };
328
+ }
329
+ /** Ordinal-or-id against the union — the numbering the inbox shows for claimed tickets. */
330
+ function findInUnion(store, key, union, ref) {
331
+ const trimmed = ref.trim();
332
+ const byOrdinal = /^\d+$/.test(trimmed)
333
+ ? union.find((a) => a.ordinal === Number(trimmed))
334
+ : undefined;
335
+ const ask = byOrdinal ?? union.find((a) => a.id === trimmed);
336
+ if (!ask) {
337
+ const id = store.displayId(key);
338
+ throw new Error(union.length === 0
339
+ ? `${id} has no asks`
340
+ : `no such ask on ${id}: ${ref} — ordinals run 1-${union.length} (\`task inbox\` lists them for claimed tickets)`);
341
+ }
342
+ return ask;
343
+ }
344
+ //# sourceMappingURL=claim-io.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-io.js","sourceRoot":"","sources":["../src/claim-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM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EAAE,KAAK,MAAM,CAAC,EAAE,CAAC;QAAE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAChC,CAAC;AAED,2FAA2F;AAC3F,SAAS,WAAW,CAAC,KAAY,EAAE,GAAW,EAAE,KAAY,EAAE,GAAW;IACvE,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAA;IAC1B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QACrC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC,SAAS,CAAA;IACb,MAAM,GAAG,GAAG,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAA;IAC5D,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAC/B,MAAM,IAAI,KAAK,CACb,KAAK,CAAC,MAAM,KAAK,CAAC;YAChB,CAAC,CAAC,GAAG,EAAE,cAAc;YACrB,CAAC,CAAC,kBAAkB,EAAE,KAAK,GAAG,qBAAqB,KAAK,CAAC,MAAM,kDAAkD,CACpH,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
package/dist/claim.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * against `origin`. PR/session awareness belongs to whatever drives the claim
10
10
  * (the implement-task skill, a human).
11
11
  */
12
- import type { Store } from "./store.ts";
12
+ import { type Store } from "./store.ts";
13
13
  import type { ProjectConfig, Task } from "./types.ts";
14
14
  /**
15
15
  * The branch namespace claims live under when the board doesn't configure
@@ -22,13 +22,25 @@ import type { ProjectConfig, Task } from "./types.ts";
22
22
  */
23
23
  export declare const DEFAULT_CLAIM_PREFIX = "task/claim/";
24
24
  /**
25
- * The board's claim namespace: configured `claimPrefix` (a trailing slash is
25
+ * The board's claim namespace: `claims.branchPrefix` (a trailing slash is
26
26
  * implied) or the default. Validated here because it becomes a git ref and an
27
27
  * ls-remote glob — a malformed value must fail the claim, not corrupt it.
28
+ *
29
+ * The pre-0.8 top-level `claimPrefix` spelling is not honored — no consumers,
30
+ * no compat (TAS-41) — but silently *defaulting* over it would be worse than
31
+ * a shim: the board's committed lock convention would change under every
32
+ * worker at once. So its presence refuses, loudly, by name.
28
33
  */
29
34
  export declare function claimNamespace(config: ProjectConfig): string;
30
- /** { prefix: "TAS" }, 21 → "task/claim/tas-21" (or under the configured namespace). */
31
- export declare function claimBranch(config: ProjectConfig, number: number): string;
35
+ /**
36
+ * The repo-wide cap on open claims: `claims.maxOpenCount` read from the
37
+ * *root* board's config (the outermost `.task/` above `root`), never the
38
+ * nearest one — a WIP cap each board could set for itself is no cap at all.
39
+ * Absent, unparseable or nonsensical values all mean "no cap".
40
+ */
41
+ export declare function openClaimCap(root: string): number | undefined;
42
+ /** { prefix: "TAS" }, "x7k4m" → "task/claim/tas-x7k4m" (or under the configured namespace). */
43
+ export declare function claimBranch(config: ProjectConfig, key: string): string;
32
44
  /**
33
45
  * Why a claim was refused: "claimed" (someone holds the branch — exit 1, pick
34
46
  * the next ticket) vs "invalid" (the ticket or the tree isn't claimable —
@@ -45,6 +57,10 @@ export interface ClaimResult {
45
57
  branch: string;
46
58
  base: string;
47
59
  }
60
+ export interface ClaimOptions {
61
+ /** Claim past the root board's `claims.maxOpenCount` cap. */
62
+ force?: boolean;
63
+ }
48
64
  /**
49
65
  * Claim `number`: validate, branch off origin's default branch, flip the
50
66
  * ticket to in_progress as the branch's first commit, and push. The push
@@ -54,7 +70,7 @@ export interface ClaimResult {
54
70
  * someone pre-created without a claim commit can't be hijacked by a plain
55
71
  * fast-forward. Leaves the winner checked out on the claim branch.
56
72
  */
57
- export declare function claim(store: Store, number: number): ClaimResult;
73
+ export declare function claim(store: Store, key: string, options?: ClaimOptions): ClaimResult;
58
74
  export interface ReleaseResult {
59
75
  branch: string;
60
76
  /** Whether a branch was actually there to delete, per side. */
@@ -66,11 +82,47 @@ export interface ReleaseResult {
66
82
  * flip only ever existed as a commit on that branch, so deleting it *is* the
67
83
  * revert — the default branch never saw in_progress.
68
84
  */
69
- export declare function release(store: Store, number: number): ReleaseResult;
85
+ export declare function release(store: Store, key: string): ReleaseResult;
70
86
  /**
71
- * The dispatcher's queue view: `todo` in position order, minus needs-human,
72
- * minus blocked, minus tickets whose claim branch already exists on origin
73
- * (one ls-remote for the whole namespace). The top entry is next up.
87
+ * The dispatcher's queue view: `todo` in position order, minus blocked, minus
88
+ * tickets whose claim branch already exists on origin (one ls-remote for the
89
+ * whole namespace). The top entry is next up. Open asks don't exclude a
90
+ * ticket — see assertClaimable.
74
91
  */
75
92
  export declare function claimableTasks(store: Store): Task[];
93
+ export interface PromoteResult {
94
+ task: Task;
95
+ /** Claim-time gates still in the way — promoted, but not claimable yet. */
96
+ holds: string[];
97
+ }
98
+ /**
99
+ * `task promote` — the human "build this" call, as a verb: `backlog` → `todo`.
100
+ * No quality gate: planning happens at claim time (the worker's plan tick),
101
+ * so a one-line backlog ticket is promotable. Blockers are claim-time facts
102
+ * that `claim`/`--claimable` already enforce live, so promoting a blocked
103
+ * ticket is legitimate sequencing ("build this once NIC-11 lands") — reported
104
+ * as a hold, never refused. Open asks aren't a hold at all: they don't gate
105
+ * claiming, only done. Writes the ticket like `update` does; committing is
106
+ * the caller's job.
107
+ */
108
+ export declare function promote(store: Store, key: string): PromoteResult;
109
+ /**
110
+ * The boards `claim --next` and `list --claimable` select over, in priority
111
+ * order. Resolution: an explicit `--board` list > the root board's top-level
112
+ * `boards` key > the nearest board alone. The list is *selection scope*, not
113
+ * permission — `task claim <id>` works on any board regardless — and it's
114
+ * read from the repo's root board only, so a vendored board can't opt itself
115
+ * into a repo's automation by shipping a config.
116
+ */
117
+ export declare function selectionBoards(cwd: string, prefixes?: string[]): Store[];
118
+ /**
119
+ * `task claim --next`: walk the selection scope in priority order and claim
120
+ * the first ticket that sticks. Losing a race for one ticket (another worker
121
+ * pushed its branch first) means *try the next*, so every ClaimError inside
122
+ * the loop is a skip — which is why the repo-level preconditions (dirty tree,
123
+ * malformed prefix, WIP cap) are asserted up front, where they still mean
124
+ * "stop and fix something" (exit 2) instead of draining the queue to a bogus
125
+ * "nothing claimable". Returns null when the queue really is empty (exit 1).
126
+ */
127
+ export declare function claimNext(stores: Store[], options?: ClaimOptions): ClaimResult | null;
76
128
  //# sourceMappingURL=claim.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../src/claim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,gBAAgB,CAAA;AAKjD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAU5D;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAA;gBACxB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS;CAIzD;AA6CD,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAQxE;AA4BD,MAA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