@dendelion/paper-camp 0.38.0 → 0.39.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.
@@ -1,40 +1,40 @@
1
- import { readFile as v, mkdir as P, writeFile as E, readdir as z, stat as jt, rename as Fe, access as Mt } from "node:fs/promises";
2
- import { dirname as M, join as p, basename as Lt } from "node:path";
3
- import { parse as V, stringify as Ft } from "yaml";
1
+ import { readFile as v, mkdir as P, writeFile as E, readdir as z, stat as Ht, rename as He, access as Gt } from "node:fs/promises";
2
+ import { dirname as M, join as p, basename as Bt } from "node:path";
3
+ import { parse as V, stringify as Yt } from "yaml";
4
4
  import { spawn as b } from "node:child_process";
5
- import { AGENT_IDS as L, NIGHT_CHECK_IDS as Ht, NOTIFICATION_SETTING_KINDS as Gt, PLAN_KINDS as Bt } from "../types/index.js";
6
- import { createHash as Yt } from "node:crypto";
7
- import { existsSync as re, readFileSync as He } from "node:fs";
8
- import { fileURLToPath as qt } from "node:url";
9
- import { z as Ut, A as Kt, e as Wt, n as Jt, a as zt, u as Vt } from "./daemon-state.BeDnhzBY.js";
5
+ import { AGENT_IDS as L, NIGHT_CHECK_IDS as qt, NOTIFICATION_SETTING_KINDS as Ut, PLAN_KINDS as Kt } from "../types/index.js";
6
+ import { createHash as Wt } from "node:crypto";
7
+ import { existsSync as ie, readFileSync as Ge } from "node:fs";
8
+ import { fileURLToPath as Jt } from "node:url";
9
+ import { z as zt, A as Vt, e as Xt, n as Zt, a as Qt, u as en } from "./daemon-state.BeDnhzBY.js";
10
10
  import { z as d } from "zod";
11
- const Xt = /^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/;
12
- function Zt(e) {
11
+ const tn = /^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/;
12
+ function nn(e) {
13
13
  return e.length >= 2 && (e.startsWith('"') && e.endsWith('"') || e.startsWith("'") && e.endsWith("'")) ? e.slice(1, -1) : e;
14
14
  }
15
15
  function Ie(e) {
16
16
  return e === "" || /[\s#"]/.test(e) ? `"${e.replace(/"/g, '\\"')}"` : e;
17
17
  }
18
- function Ge(e) {
18
+ function Be(e) {
19
19
  const t = e.trim();
20
20
  if (!t || t.startsWith("#")) return null;
21
- const n = t.match(Xt);
22
- return n ? { key: n[1], value: Zt(n[2]) } : null;
21
+ const n = t.match(tn);
22
+ return n ? { key: n[1], value: nn(n[2]) } : null;
23
23
  }
24
- function yr(e) {
24
+ function Er(e) {
25
25
  const t = [];
26
26
  for (const n of e.split(`
27
27
  `)) {
28
- const s = Ge(n);
28
+ const s = Be(n);
29
29
  s && t.push(s);
30
30
  }
31
31
  return t;
32
32
  }
33
- function wr(e, t) {
33
+ function kr(e, t) {
34
34
  const n = new Map(t.map((r) => [r.key, r.value])), s = e.length > 0 ? e.split(`
35
35
  `) : [], a = [];
36
36
  for (const r of s) {
37
- const i = Ge(r);
37
+ const i = Be(r);
38
38
  if (!i) {
39
39
  a.push(r);
40
40
  continue;
@@ -48,28 +48,31 @@ function wr(e, t) {
48
48
  `)}
49
49
  ` : "";
50
50
  }
51
- function br(e) {
51
+ function Sr(e) {
52
52
  return e.archived === !0 || e.status === "done";
53
53
  }
54
- function ee(e) {
55
- const t = e.phases.length > 0 && e.phases.every((s) => s.done), n = (e.fixes ?? []).every((s) => s.done);
54
+ function Ae(e) {
55
+ return e.filter((t) => t.source !== "manual").every((t) => t.done);
56
+ }
57
+ function te(e) {
58
+ const t = e.phases.length > 0 && Ae(e.phases), n = Ae(e.fixes ?? []);
56
59
  return t && n;
57
60
  }
58
61
  function X(e, t, n, s = !1) {
59
- return e.kind === "note" || e.status === "dropped" ? e.status : e.archived ? "done" : t ? t.state === "merged" ? ee(e) ? "done" : "planned" : t.state === "closed" ? "dropped" : ee(e) ? "review" : "in-progress" : n ? e.status === "review" || e.status === "done" ? e.status : s && e.phases.length > 0 ? ee(e) ? "review" : "in-progress" : e.phases.length > 0 ? "planned" : "idea" : e.status ?? (e.phases.length > 0 ? "planned" : "idea");
62
+ return e.kind === "note" || e.status === "dropped" ? e.status : e.archived ? "done" : t ? t.state === "merged" ? te(e) ? "done" : "planned" : t.state === "closed" ? "dropped" : te(e) ? "review" : "in-progress" : n ? e.status === "review" || e.status === "done" ? e.status : s && e.phases.length > 0 ? te(e) ? "review" : "in-progress" : e.phases.length > 0 ? "planned" : "idea" : e.status ?? (e.phases.length > 0 ? "planned" : "idea");
60
63
  }
61
- function Qt(e, t, n) {
64
+ function sn(e, t, n) {
62
65
  return e.kind === "note" || e.kind === "board" || e.status === "dropped" || e.archived || t ? !1 : !n;
63
66
  }
64
- function en(e, t) {
67
+ function an(e, t) {
65
68
  if (e.kind === "note" || e.archived || (t == null ? void 0 : t.state) !== "merged") return !1;
66
69
  const n = X(e, t, !0);
67
70
  return n === "review" || n === "done";
68
71
  }
69
- function Be(e) {
72
+ function Ye(e) {
70
73
  return e.length === 0 ? "idea" : e.every((t) => t === "done" || t === "dropped") ? "review" : e.some((t) => t !== "idea" && t !== "planned") ? "in-progress" : "planned";
71
74
  }
72
- function tn(e = [], t = [], n = [], s = []) {
75
+ function rn(e = [], t = [], n = [], s = []) {
73
76
  const a = [
74
77
  ...e.map((i) => ({ kind: "log", date: i.date, text: i.text })),
75
78
  ...t.map((i) => ({ kind: "clarification", date: i.date, text: i.text })),
@@ -81,19 +84,19 @@ function tn(e = [], t = [], n = [], s = []) {
81
84
  }));
82
85
  return [...a, ...r];
83
86
  }
84
- function ie(e, t) {
87
+ function oe(e, t) {
85
88
  return e.filter((n) => n.kind === t).map((n) => ({ date: n.date ?? "", text: n.text }));
86
89
  }
87
- function Ye(e = []) {
88
- return ie(e, "log");
90
+ function qe(e = []) {
91
+ return oe(e, "log");
89
92
  }
90
- function nn(e = []) {
91
- return ie(e, "clarification");
93
+ function on(e = []) {
94
+ return oe(e, "clarification");
92
95
  }
93
- function sn(e = []) {
94
- return ie(e, "review");
96
+ function cn(e = []) {
97
+ return oe(e, "review");
95
98
  }
96
- function an(e = []) {
99
+ function dn(e = []) {
97
100
  return e.filter(
98
101
  (t) => t.kind === "note" || t.kind === "decision" || t.kind === "question"
99
102
  ).map((t) => ({
@@ -103,10 +106,10 @@ function an(e = []) {
103
106
  kind: t.kind
104
107
  }));
105
108
  }
106
- function vr(e, t, n) {
109
+ function $r(e, t, n) {
107
110
  return [...(e ?? []).filter((s) => !t.includes(s.kind)), ...n];
108
111
  }
109
- function Er(e, t, n, s) {
112
+ function Ir(e, t, n, s) {
110
113
  return e.map((a, r) => {
111
114
  if (r !== t) return a;
112
115
  const i = s ? `${a.text}
@@ -117,16 +120,16 @@ ${s}` : a.text;
117
120
  return { ...c, kind: n, text: i };
118
121
  });
119
122
  }
120
- function kr(e = []) {
123
+ function Ar(e = []) {
121
124
  const t = e.reduce((n, s, a) => s.kind === "log" ? a : n, -1);
122
125
  return e.slice(t + 1).filter((n) => n.kind === "chat");
123
126
  }
124
- function qe(e, t, n = !1, s = !1) {
127
+ function Ue(e, t, n = !1, s = !1) {
125
128
  return {
126
129
  title: e.title,
127
130
  // Non-note entities can't carry the note-only 'open' (schema-enforced).
128
131
  status: X(e, t, n, s),
129
- statusFallback: Qt(e, t, n),
132
+ statusFallback: sn(e, t, n),
130
133
  kind: e.type,
131
134
  entityKind: e.kind === "note" ? void 0 : e.kind,
132
135
  id: e.id,
@@ -144,16 +147,16 @@ function qe(e, t, n = !1, s = !1) {
144
147
  body: e.body,
145
148
  phases: e.phases,
146
149
  fixes: e.fixes,
147
- log: Ye(e.thread),
148
- clarifications: nn(e.thread),
149
- notes: an(e.thread),
150
- review: sn(e.thread),
150
+ log: qe(e.thread),
151
+ clarifications: on(e.thread),
152
+ notes: dn(e.thread),
153
+ review: cn(e.thread),
151
154
  thread: e.thread,
152
155
  archived: e.archived,
153
156
  pr: t
154
157
  };
155
158
  }
156
- function rn(e) {
159
+ function un(e) {
157
160
  return {
158
161
  id: e.id,
159
162
  title: e.title,
@@ -163,10 +166,10 @@ function rn(e) {
163
166
  subject: e.subject,
164
167
  order: e.order,
165
168
  created: e.created,
166
- log: Ye(e.thread)
169
+ log: qe(e.thread)
167
170
  };
168
171
  }
169
- const on = /^[0-9a-f]{4,40}$/i, cn = /^Merge pull request #\d+ from \S+\/([a-z]+-\d+)-/i;
172
+ const ln = /^[0-9a-f]{4,40}$/i, fn = /^Merge pull request #\d+ from \S+\/([a-z]+-\d+)-/i;
170
173
  function S(e, t) {
171
174
  return new Promise((n) => {
172
175
  var r;
@@ -177,40 +180,40 @@ function S(e, t) {
177
180
  }), s.on("close", () => n(a)), s.on("error", () => n(""));
178
181
  });
179
182
  }
180
- async function Ue(e) {
183
+ async function Ke(e) {
181
184
  var n;
182
185
  return ((n = (await S(e, ["symbolic-ref", "refs/remotes/origin/HEAD"])).trim().match(/refs\/remotes\/origin\/(.+)/)) == null ? void 0 : n[1]) ?? "main";
183
186
  }
184
- function te(e) {
187
+ function ne(e) {
185
188
  const t = e.match(/^Refs:\s*([A-Za-z]+-\d+)\s*$/m);
186
189
  if (t) return t[1].toUpperCase();
187
190
  const n = e.split(`
188
191
  `, 1)[0], s = n.match(/\(([A-Za-z]+-\d+)\)/);
189
192
  if (s) return s[1].toUpperCase();
190
- const a = n.match(cn);
193
+ const a = n.match(fn);
191
194
  return a ? a[1].toUpperCase() : null;
192
195
  }
193
- function dn(e) {
196
+ function pn(e) {
194
197
  return e.length > 0 && e.every((t) => t.startsWith("papercamp/"));
195
198
  }
196
- async function Ke(e) {
197
- const t = await Ue(e), n = await S(e, ["log", "--format=%x02%B%x00", "--name-only", t]), s = /* @__PURE__ */ new Set();
199
+ async function We(e) {
200
+ const t = await Ke(e), n = await S(e, ["log", "--format=%x02%B%x00", "--name-only", t]), s = /* @__PURE__ */ new Set();
198
201
  for (const a of n.split("")) {
199
202
  if (!a) continue;
200
203
  const [r, i = ""] = a.split("\0"), o = i.split(`
201
204
  `).map((u) => u.trim()).filter(Boolean);
202
- if (dn(o)) continue;
203
- const c = te(r.trim());
205
+ if (pn(o)) continue;
206
+ const c = ne(r.trim());
204
207
  c && s.add(c);
205
208
  }
206
209
  return s;
207
210
  }
208
- const We = "", j = "", un = `${We}%H${j}%s${j}%cI${j}%D${j}%(trailers:key=Refs,valueonly)`, ln = /^([a-z]+(?:\([^)]*\))?):\s*(.+)$/i;
209
- function fn(e) {
210
- const t = e.match(ln);
211
+ const Je = "", j = "", hn = `${Je}%H${j}%s${j}%cI${j}%D${j}%(trailers:key=Refs,valueonly)`, mn = /^([a-z]+(?:\([^)]*\))?):\s*(.+)$/i;
212
+ function gn(e) {
213
+ const t = e.match(mn);
211
214
  return t ? { prefix: t[1], subject: t[2] } : { prefix: "", subject: e };
212
215
  }
213
- function pn(e, t) {
216
+ function yn(e, t) {
214
217
  const n = [];
215
218
  let s = !1;
216
219
  for (const a of e.split(",")) {
@@ -219,13 +222,13 @@ function pn(e, t) {
219
222
  }
220
223
  return { tags: n, isUpstreamHead: s };
221
224
  }
222
- function hn(e) {
225
+ function wn(e) {
223
226
  const t = e.trim();
224
227
  return /^[A-Za-z]+-\d+$/.test(t) ? t.toUpperCase() : null;
225
228
  }
226
- function mn(e, t, n) {
227
- return e.split(We).map((s) => s.trim()).filter(Boolean).map((s) => {
228
- const [a, r = "", i = "", o = "", c = ""] = s.split(j), { prefix: u, subject: l } = fn(r), { tags: f, isUpstreamHead: h } = pn(o, t);
229
+ function bn(e, t, n) {
230
+ return e.split(Je).map((s) => s.trim()).filter(Boolean).map((s) => {
231
+ const [a, r = "", i = "", o = "", c = ""] = s.split(j), { prefix: u, subject: l } = gn(r), { tags: f, isUpstreamHead: h } = yn(o, t);
229
232
  return {
230
233
  hash: a,
231
234
  subject: l,
@@ -234,20 +237,20 @@ function mn(e, t, n) {
234
237
  tags: f,
235
238
  isUpstreamHead: h,
236
239
  pushed: t !== null && !n.has(a),
237
- ideaId: hn(c)
240
+ ideaId: wn(c)
238
241
  };
239
242
  });
240
243
  }
241
- async function gn(e) {
244
+ async function vn(e) {
242
245
  return (await S(e, ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"])).trim() || null;
243
246
  }
244
- async function Sr(e, t, n = 30) {
245
- const s = await gn(e), a = await S(e, [
247
+ async function Rr(e, t, n = 30) {
248
+ const s = await vn(e), a = await S(e, [
246
249
  "log",
247
250
  "--first-parent",
248
251
  `--max-count=${n + 1}`,
249
252
  `--skip=${t}`,
250
- `--format=${un}`
253
+ `--format=${hn}`
251
254
  ]), r = /* @__PURE__ */ new Set();
252
255
  if (s) {
253
256
  const c = await S(e, ["rev-list", `${s}..HEAD`]);
@@ -257,12 +260,12 @@ async function Sr(e, t, n = 30) {
257
260
  l && r.add(l);
258
261
  }
259
262
  }
260
- const i = mn(a, s, r), o = i.length > n;
263
+ const i = bn(a, s, r), o = i.length > n;
261
264
  return { commits: i.slice(0, n), upstream: s, hasMore: o };
262
265
  }
263
- const k = /* @__PURE__ */ new Map(), yn = 5 * 60 * 1e3, oe = (e) => p(e, "papercamp", "pr-map.json");
264
- async function wn(e, t, n) {
265
- const s = oe(e);
266
+ const k = /* @__PURE__ */ new Map(), En = 5 * 60 * 1e3, ce = (e) => p(e, "papercamp", "pr-map.json");
267
+ async function kn(e, t, n) {
268
+ const s = ce(e);
266
269
  try {
267
270
  const a = { fetchedAt: n, prs: Object.fromEntries(t) };
268
271
  await P(M(s), { recursive: !0 }), await E(s, `${JSON.stringify(a, null, 2)}
@@ -271,21 +274,21 @@ async function wn(e, t, n) {
271
274
  console.error(`papercamp: could not persist PR map for ${e}:`, a);
272
275
  }
273
276
  }
274
- async function Je(e) {
277
+ async function ze(e) {
275
278
  try {
276
- const t = await v(oe(e), "utf-8"), n = JSON.parse(t);
279
+ const t = await v(ce(e), "utf-8"), n = JSON.parse(t);
277
280
  return { prs: new Map(Object.entries(n.prs)), fetchedAt: n.fetchedAt };
278
281
  } catch {
279
282
  return;
280
283
  }
281
284
  }
282
- const bn = {
285
+ const Sn = {
283
286
  APPROVED: "approved",
284
287
  CHANGES_REQUESTED: "changes-requested",
285
288
  REVIEW_REQUIRED: "review-required"
286
289
  };
287
- function vn(e) {
288
- const t = e.state === "MERGED" ? "merged" : e.state === "CLOSED" ? "closed" : e.isDraft ? "draft" : "open", n = bn[e.reviewDecision];
290
+ function $n(e) {
291
+ const t = e.state === "MERGED" ? "merged" : e.state === "CLOSED" ? "closed" : e.isDraft ? "draft" : "open", n = Sn[e.reviewDecision];
289
292
  return {
290
293
  number: e.number,
291
294
  url: e.url,
@@ -296,13 +299,13 @@ function vn(e) {
296
299
  };
297
300
  }
298
301
  const Re = { merged: 4, open: 3, draft: 2, closed: 1 };
299
- function ze(e, t) {
302
+ function Ve(e, t) {
300
303
  const n = e == null ? void 0 : e.match(/\*\*Plan:\*\*\s*`?([A-Za-z]+-\d+)`?/);
301
304
  if (n) return n[1].toUpperCase();
302
305
  const s = t == null ? void 0 : t.match(/^[a-z]+\/([a-z]+-\d+)-/);
303
306
  return s ? s[1].toUpperCase() : null;
304
307
  }
305
- const En = `
308
+ const In = `
306
309
  query($owner: String!, $repo: String!, $number: Int!) {
307
310
  repository(owner: $owner, name: $repo) {
308
311
  pullRequest(number: $number) {
@@ -313,7 +316,7 @@ query($owner: String!, $repo: String!, $number: Int!) {
313
316
  }
314
317
  }
315
318
  }`;
316
- function kn(e, t) {
319
+ function An(e, t) {
317
320
  return `Paper Scout · ${e} · ${t.slice(0, 7)}`;
318
321
  }
319
322
  function F(e) {
@@ -322,8 +325,8 @@ function F(e) {
322
325
  const [, n, s, a] = t;
323
326
  return { owner: n, repo: s, number: a };
324
327
  }
325
- const Sn = 15e3;
326
- function Ve(e, t) {
328
+ const Rn = 15e3;
329
+ function Xe(e, t) {
327
330
  return new Promise((n) => {
328
331
  var c, u;
329
332
  const s = b("gh", t, { cwd: e, stdio: ["ignore", "pipe", "pipe"] });
@@ -332,7 +335,7 @@ function Ve(e, t) {
332
335
  a || (a = !0, clearTimeout(i), l());
333
336
  }, i = setTimeout(() => {
334
337
  s.kill(), r(() => n(void 0));
335
- }, Sn);
338
+ }, Rn);
336
339
  let o = "";
337
340
  (c = s.stdout) == null || c.on("data", (l) => {
338
341
  o += l.toString();
@@ -352,8 +355,8 @@ function Ve(e, t) {
352
355
  }), s.on("error", () => r(() => n(void 0)));
353
356
  });
354
357
  }
355
- function Xe(e, t, n, s, a) {
356
- return Qe(e, [
358
+ function Ze(e, t, n, s, a) {
359
+ return et(e, [
357
360
  "-f",
358
361
  `query=${t}`,
359
362
  "-f",
@@ -364,25 +367,25 @@ function Xe(e, t, n, s, a) {
364
367
  `number=${a}`
365
368
  ]);
366
369
  }
367
- function Ze(e, t, n) {
370
+ function Qe(e, t, n) {
368
371
  const s = ["-f", `query=${t}`];
369
372
  for (const [a, r] of Object.entries(n))
370
373
  s.push("-f", `${a}=${r}`);
371
- return Qe(e, s);
374
+ return et(e, s);
372
375
  }
373
- function Qe(e, t) {
374
- return Ve(e, ["api", "graphql", ...t]);
376
+ function et(e, t) {
377
+ return Xe(e, ["api", "graphql", ...t]);
375
378
  }
376
- async function $n(e, t) {
379
+ async function Pn(e, t) {
377
380
  var l, f, h, g, w;
378
381
  const n = F(t);
379
382
  if (!n) return;
380
- const s = await Xe(e, En, n.owner, n.repo, n.number), a = (f = (l = s == null ? void 0 : s.data) == null ? void 0 : l.repository) == null ? void 0 : f.pullRequest;
383
+ const s = await Ze(e, In, n.owner, n.repo, n.number), a = (f = (l = s == null ? void 0 : s.data) == null ? void 0 : l.repository) == null ? void 0 : f.pullRequest;
381
384
  if (!a) return;
382
385
  const r = a.reviewThreads.nodes.filter((y) => !y.isResolved).length, i = (h = a.commits.nodes[0]) == null ? void 0 : h.commit.committedDate, o = [(g = a.comments.nodes[0]) == null ? void 0 : g.createdAt, (w = a.reviews.nodes.at(-1)) == null ? void 0 : w.createdAt].filter((y) => !!y).sort().at(-1), c = !!(i && o && o > i), u = a.reviews.nodes.map((y) => y.body);
383
386
  return { unresolvedThreadCount: r, hasNewCommentsSincePush: c, reviewBodies: u };
384
387
  }
385
- const In = `
388
+ const Cn = `
386
389
  query($owner: String!, $repo: String!, $number: Int!) {
387
390
  repository(owner: $owner, name: $repo) {
388
391
  pullRequest(number: $number) {
@@ -396,11 +399,11 @@ query($owner: String!, $repo: String!, $number: Int!) {
396
399
  }
397
400
  }
398
401
  }`;
399
- async function $r(e, t) {
402
+ async function Pr(e, t) {
400
403
  var r, i, o;
401
404
  const n = F(t);
402
405
  if (!n) return [];
403
- const s = await Xe(e, In, n.owner, n.repo, n.number);
406
+ const s = await Ze(e, Cn, n.owner, n.repo, n.number);
404
407
  return (((o = (i = (r = s == null ? void 0 : s.data) == null ? void 0 : r.repository) == null ? void 0 : i.pullRequest) == null ? void 0 : o.reviewThreads.nodes) ?? []).filter((c) => !c.isResolved).map((c) => ({ id: c.id, comment: c.comments.nodes[0] })).filter((c) => !!c.comment).map(({ id: c, comment: u }) => {
405
408
  var l;
406
409
  return {
@@ -412,28 +415,28 @@ async function $r(e, t) {
412
415
  };
413
416
  });
414
417
  }
415
- const Rn = `
418
+ const _n = `
416
419
  mutation($threadId: ID!) {
417
420
  resolveReviewThread(input: { threadId: $threadId }) {
418
421
  thread { id isResolved }
419
422
  }
420
- }`, An = `
423
+ }`, Nn = `
421
424
  mutation($threadId: ID!, $body: String!) {
422
425
  addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) {
423
426
  comment { id }
424
427
  }
425
428
  }`;
426
- async function Ir(e, t) {
429
+ async function Cr(e, t) {
427
430
  var s, a, r;
428
- const n = await Ze(e, Rn, { threadId: t });
431
+ const n = await Qe(e, _n, { threadId: t });
429
432
  return !!((r = (a = (s = n == null ? void 0 : n.data) == null ? void 0 : s.resolveReviewThread) == null ? void 0 : a.thread) != null && r.isResolved);
430
433
  }
431
- async function Rr(e, t, n) {
434
+ async function _r(e, t, n) {
432
435
  var a, r, i;
433
- const s = await Ze(e, An, { threadId: t, body: n });
436
+ const s = await Qe(e, Nn, { threadId: t, body: n });
434
437
  return !!((i = (r = (a = s == null ? void 0 : s.data) == null ? void 0 : a.addPullRequestReviewThreadReply) == null ? void 0 : r.comment) != null && i.id);
435
438
  }
436
- function et(e, t, n) {
439
+ function tt(e, t, n) {
437
440
  return new Promise((s) => {
438
441
  var i, o, c;
439
442
  const a = b("gh", ["api", t, "-X", "POST", "--input", "-"], {
@@ -450,34 +453,34 @@ function et(e, t, n) {
450
453
  }), (c = a.stdin) == null || c.end(JSON.stringify(n));
451
454
  });
452
455
  }
453
- async function Ar(e, t, n) {
456
+ async function Nr(e, t, n) {
454
457
  const s = F(t);
455
- return s ? et(
458
+ return s ? tt(
456
459
  e,
457
460
  `repos/${s.owner}/${s.repo}/pulls/${s.number}/reviews`,
458
461
  n
459
462
  ) : { delivered: !1 };
460
463
  }
461
- async function Pr(e, t, n) {
464
+ async function Tr(e, t, n) {
462
465
  const s = F(t);
463
- return s ? et(e, `repos/${s.owner}/${s.repo}/dispatches`, {
466
+ return s ? tt(e, `repos/${s.owner}/${s.repo}/dispatches`, {
464
467
  event_type: "paper-camp-review",
465
468
  client_payload: { review: { number: Number(s.number), ...n } }
466
469
  }) : { delivered: !1 };
467
470
  }
468
- async function Pn(e, t) {
471
+ async function Tn(e, t) {
469
472
  const n = [...t.entries()].filter(
470
473
  ([, a]) => a.state === "open" || a.state === "draft"
471
- ), s = await Promise.all(n.map(([, a]) => $n(e, a.url)));
474
+ ), s = await Promise.all(n.map(([, a]) => Pn(e, a.url)));
472
475
  n.forEach(([a, r], i) => {
473
476
  const o = s[i];
474
477
  if (!o) return;
475
- const { reviewBodies: c, ...u } = o, l = !!r.headSha && c.some((f) => f.includes(kn(a, r.headSha)));
478
+ const { reviewBodies: c, ...u } = o, l = !!r.headSha && c.some((f) => f.includes(An(a, r.headSha)));
476
479
  t.set(a, { ...r, ...u, ...l && { scoutReviewObserved: l } });
477
480
  });
478
481
  }
479
- async function Cn(e) {
480
- const t = await Ve(e, [
482
+ async function xn(e) {
483
+ const t = await Xe(e, [
481
484
  "pr",
482
485
  "list",
483
486
  "--state",
@@ -490,33 +493,33 @@ async function Cn(e) {
490
493
  if (!t) return;
491
494
  const n = /* @__PURE__ */ new Map();
492
495
  for (const s of t) {
493
- const a = ze(s.body, s.headRefName);
496
+ const a = Ve(s.body, s.headRefName);
494
497
  if (!a) continue;
495
- const r = vn(s), i = n.get(a);
498
+ const r = $n(s), i = n.get(a);
496
499
  (!i || Re[r.state] > Re[i.state]) && n.set(a, r);
497
500
  }
498
- return await Pn(e, n), n;
501
+ return await Tn(e, n), n;
499
502
  }
500
- async function tt(e, t = yn) {
503
+ async function nt(e, t = En) {
501
504
  let n = k.get(e);
502
505
  if (!n) {
503
- const a = await Je(e);
506
+ const a = await ze(e);
504
507
  a && (k.set(e, a), n = a);
505
508
  }
506
509
  if (n && Date.now() - n.fetchedAt < t) return n.prs;
507
510
  if (!Number.isFinite(t)) return n == null ? void 0 : n.prs;
508
- const s = await Cn(e);
511
+ const s = await xn(e);
509
512
  if (s !== void 0) {
510
513
  const a = Date.now();
511
- return k.set(e, { prs: s, fetchedAt: a }), await wn(e, s, a), s;
514
+ return k.set(e, { prs: s, fetchedAt: a }), await kn(e, s, a), s;
512
515
  }
513
516
  return n == null ? void 0 : n.prs;
514
517
  }
515
- function Cr(e) {
518
+ function xr(e) {
516
519
  var t;
517
520
  return (t = k.get(e)) == null ? void 0 : t.prs;
518
521
  }
519
- function _r(e, t) {
522
+ function Or(e, t) {
520
523
  const n = (a) => `${a.number}:${a.headSha ?? "unknown"}`, s = [];
521
524
  for (const [a, r] of t) {
522
525
  if (r.reviewDecision !== "changes-requested") continue;
@@ -525,22 +528,22 @@ function _r(e, t) {
525
528
  }
526
529
  return s;
527
530
  }
528
- async function Tr(e) {
531
+ async function Dr(e) {
529
532
  let t = k.get(e);
530
533
  if (!t) {
531
- const n = await Je(e);
534
+ const n = await ze(e);
532
535
  n && (k.set(e, n), t = n);
533
536
  }
534
537
  return (t == null ? void 0 : t.fetchedAt) ?? null;
535
538
  }
536
- async function Nr(e) {
539
+ async function jr(e) {
537
540
  if (e === void 0) {
538
541
  k.clear();
539
542
  return;
540
543
  }
541
544
  const t = k.get(e);
542
545
  t && k.set(e, { ...t, fetchedAt: 0 });
543
- const n = oe(e);
546
+ const n = ce(e);
544
547
  try {
545
548
  const s = await v(n, "utf-8"), a = JSON.parse(s);
546
549
  a.fetchedAt = 0, await E(n, `${JSON.stringify(a, null, 2)}
@@ -548,35 +551,35 @@ async function Nr(e) {
548
551
  } catch {
549
552
  }
550
553
  }
551
- const nt = /^#{2,3}\s+/, Y = /^[-*]\s+\[([ xX])\]\s+(.*)$/, _n = /^\[(review|manual|issue)\]\s+(.*)$/, Tn = /^run:\s*(.+)$/, Ae = /^-\s+(\d{4}-\d{2}-\d{2}):\s*(.*)$/, Nn = /^\[(?:phase:(\d+)|body)\]\s+(?:\[(decision|question)\]\s+)?(.*)$/, Pe = /^-\s+\[([ xX])\]\s+(?:(\d{4}-\d{2}-\d{2})\s+)?\[(log|clarification|review|note|decision|question|chat)\]\s+(\[agent\]\s+)?(?:\[\[([A-Za-z]+-\d+)\]\]\s+)?(.*)$/, xn = ["note", "decision", "question"];
552
- function ce(e, t, n, s) {
554
+ const st = /^#{2,3}\s+/, Y = /^[-*]\s+\[([ xX])\]\s+(.*)$/, On = /^\[(review|manual|issue)\]\s+(.*)$/, Dn = /^run:\s*(.+)$/, Pe = /^-\s+(\d{4}-\d{2}-\d{2}):\s*(.*)$/, jn = /^\[(?:phase:(\d+)|body)\]\s+(?:\[(decision|question)\]\s+)?(.*)$/, Ce = /^-\s+\[([ xX])\]\s+(?:(\d{4}-\d{2}-\d{2})\s+)?\[(log|clarification|review|note|decision|question|chat)\]\s+(\[agent\]\s+)?(?:\[\[([A-Za-z]+-\d+)\]\]\s+)?(.*)$/, Mn = ["note", "decision", "question"];
555
+ function de(e, t, n, s) {
553
556
  const a = [];
554
557
  let r = t;
555
558
  for (; r < n; ) {
556
559
  const i = e[r];
557
560
  if (i.trim() === "" || !/^\s/.test(i)) break;
558
561
  const o = i.trimStart();
559
- if (s.test(o) || nt.test(o)) break;
562
+ if (s.test(o) || st.test(o)) break;
560
563
  a.push(o), r++;
561
564
  }
562
565
  return { text: a.join(" "), next: r };
563
566
  }
564
- function de(e, t) {
567
+ function ue(e, t) {
565
568
  return t ? `${e.trim()} ${t}` : e.trim();
566
569
  }
567
- function st(e, t, n) {
570
+ function at(e, t, n) {
568
571
  const s = [];
569
572
  let a = t;
570
573
  for (; a < n; ) {
571
574
  const r = e[a].match(Y);
572
575
  if (r) {
573
- const i = r[1].toLowerCase() === "x", o = r[2].trim(), c = o.match(_n), u = c ? c[2].trim() : o, l = c ? c[1] : void 0, f = [];
576
+ const i = r[1].toLowerCase() === "x", o = r[2].trim(), c = o.match(On), u = c ? c[2].trim() : o, l = c ? c[1] : void 0, f = [];
574
577
  let h;
575
578
  for (a++; a < n; ) {
576
579
  const g = e[a];
577
- if (g.trim() === "" || Y.test(g) || nt.test(g)) break;
580
+ if (g.trim() === "" || Y.test(g) || st.test(g)) break;
578
581
  if (/^\s/.test(g)) {
579
- const w = g.trimStart(), y = w.match(Tn), m = y ? Ut(y[1]) : void 0;
582
+ const w = g.trimStart(), y = w.match(Dn), m = y ? zt(y[1]) : void 0;
580
583
  m ? h = m : f.push(w), a++;
581
584
  } else
582
585
  break;
@@ -594,106 +597,106 @@ function st(e, t, n) {
594
597
  }
595
598
  return s;
596
599
  }
597
- function ue(e, t, n) {
600
+ function le(e, t, n) {
598
601
  const s = [];
599
602
  let a = t;
600
603
  for (; a < n; ) {
601
- const r = e[a].match(Ae);
604
+ const r = e[a].match(Pe);
602
605
  if (!r) {
603
606
  a++;
604
607
  continue;
605
608
  }
606
- const i = ce(e, a + 1, n, Ae);
607
- s.push({ date: r[1], text: de(r[2], i.text) }), a = i.next;
609
+ const i = de(e, a + 1, n, Pe);
610
+ s.push({ date: r[1], text: ue(r[2], i.text) }), a = i.next;
608
611
  }
609
612
  return s;
610
613
  }
611
- function at(e, t) {
614
+ function rt(e, t) {
612
615
  const n = [e];
613
616
  for (const s of t) {
614
617
  const a = s.source ? `[${s.source}] ${s.text}` : s.text;
615
618
  if (n.push(`- [${s.done ? "x" : " "}] ${a}`), s.description)
616
619
  for (const r of s.description.split(`
617
620
  `)) n.push(` ${r}`);
618
- s.run && n.push(` run: ${Kt(s.run)}`);
621
+ s.run && n.push(` run: ${Vt(s.run)}`);
619
622
  }
620
623
  return n;
621
624
  }
622
- function le(e, t) {
625
+ function fe(e, t) {
623
626
  return [e, ...t.map((n) => `- ${n.date}: ${n.text}`)];
624
627
  }
625
- function On(e) {
628
+ function Ln(e) {
626
629
  return e.kind === "phase" ? `[phase:${e.index}]` : "[body]";
627
630
  }
628
- function Dn(e, t, n) {
631
+ function Fn(e, t, n) {
629
632
  const s = [];
630
633
  let a = t;
631
634
  for (; a < n; ) {
632
- const r = e[a].match(Y), i = r ? r[2].trim().match(Nn) : null;
635
+ const r = e[a].match(Y), i = r ? r[2].trim().match(jn) : null;
633
636
  if (!r || !i) {
634
637
  a++;
635
638
  continue;
636
639
  }
637
- const o = i[1] ? { kind: "phase", index: Number(i[1]) } : { kind: "body" }, c = i[2], u = ce(e, a + 1, n, Y);
640
+ const o = i[1] ? { kind: "phase", index: Number(i[1]) } : { kind: "body" }, c = i[2], u = de(e, a + 1, n, Y);
638
641
  s.push({
639
642
  anchor: o,
640
- prose: de(i[3], u.text),
643
+ prose: ue(i[3], u.text),
641
644
  state: r[1].toLowerCase() === "x" ? "resolved" : "open",
642
645
  ...c ? { kind: c } : {}
643
646
  }), a = u.next;
644
647
  }
645
648
  return s;
646
649
  }
647
- function jn(e) {
650
+ function Hn(e) {
648
651
  const t = ["### Notes"];
649
652
  for (const n of e) {
650
653
  const s = n.kind && n.kind !== "note" ? `[${n.kind}] ` : "";
651
654
  t.push(
652
- `- [${n.state === "resolved" ? "x" : " "}] ${On(n.anchor)} ${s}${n.prose}`
655
+ `- [${n.state === "resolved" ? "x" : " "}] ${Ln(n.anchor)} ${s}${n.prose}`
653
656
  );
654
657
  }
655
658
  return t;
656
659
  }
657
660
  const Z = {
658
661
  headingRe: /^#{2,3}\s+Phases\s*$/i,
659
- parseEntries: st,
660
- formatLines: (e) => at("### Phases", e)
661
- }, rt = {
662
+ parseEntries: at,
663
+ formatLines: (e) => rt("### Phases", e)
664
+ }, it = {
662
665
  headingRe: /^#{2,3}\s+Fixes\s*$/i,
663
- parseEntries: st,
664
- formatLines: (e) => at("### Fixes", e)
666
+ parseEntries: at,
667
+ formatLines: (e) => rt("### Fixes", e)
665
668
  }, H = {
666
669
  headingRe: /^#{2,3}\s+Log\s*$/i,
667
- parseEntries: ue,
668
- formatLines: (e) => le("### Log", e)
669
- }, fe = {
670
- headingRe: /^#{2,3}\s+Clarifications\s*$/i,
671
- parseEntries: ue,
672
- formatLines: (e) => le("### Clarifications", e)
670
+ parseEntries: le,
671
+ formatLines: (e) => fe("### Log", e)
673
672
  }, pe = {
673
+ headingRe: /^#{2,3}\s+Clarifications\s*$/i,
674
+ parseEntries: le,
675
+ formatLines: (e) => fe("### Clarifications", e)
676
+ }, he = {
674
677
  headingRe: /^#{2,3}\s+Notes\s*$/i,
675
- parseEntries: Dn,
676
- formatLines: jn
677
- }, Mn = {
678
+ parseEntries: Fn,
679
+ formatLines: Hn
680
+ }, Gn = {
678
681
  headingRe: /^#{2,3}\s+Review\s*$/i,
679
- parseEntries: ue,
680
- formatLines: (e) => le("### Review", e)
682
+ parseEntries: le,
683
+ formatLines: (e) => fe("### Review", e)
681
684
  };
682
- function Ln(e, t, n) {
685
+ function Bn(e, t, n) {
683
686
  const s = [];
684
687
  let a = t;
685
688
  for (; a < n; ) {
686
- const r = e[a].match(Pe);
689
+ const r = e[a].match(Ce);
687
690
  if (!r) {
688
691
  a++;
689
692
  continue;
690
693
  }
691
- const i = r[3], o = ce(e, a + 1, n, Pe), c = { kind: i, text: de(r[6], o.text) };
692
- r[2] && (c.date = r[2]), r[4] && (c.from = "agent"), r[5] && (c.entityId = r[5]), xn.includes(i) && (c.state = r[1].toLowerCase() === "x" ? "resolved" : "open"), s.push(c), a = o.next;
694
+ const i = r[3], o = de(e, a + 1, n, Ce), c = { kind: i, text: ue(r[6], o.text) };
695
+ r[2] && (c.date = r[2]), r[4] && (c.from = "agent"), r[5] && (c.entityId = r[5]), Mn.includes(i) && (c.state = r[1].toLowerCase() === "x" ? "resolved" : "open"), s.push(c), a = o.next;
693
696
  }
694
697
  return s;
695
698
  }
696
- function Fn(e) {
699
+ function Yn(e) {
697
700
  const t = ["### Thread"];
698
701
  for (const n of e) {
699
702
  const s = n.state ? n.state === "resolved" : !0, a = n.date ? `${n.date} ` : "", r = n.from === "agent" ? "[agent] " : "", i = n.entityId ? `[[${n.entityId}]] ` : "";
@@ -701,10 +704,10 @@ function Fn(e) {
701
704
  }
702
705
  return t;
703
706
  }
704
- const it = {
707
+ const ot = {
705
708
  headingRe: /^#{2,3}\s+Thread\s*$/i,
706
- parseEntries: Ln,
707
- formatLines: Fn
709
+ parseEntries: Bn,
710
+ formatLines: Yn
708
711
  }, $ = d.preprocess(
709
712
  (e) => typeof e == "string" ? { agent: e } : e,
710
713
  d.object({
@@ -712,7 +715,7 @@ const it = {
712
715
  model: d.string().optional(),
713
716
  effort: d.string().optional()
714
717
  })
715
- ), I = d.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected YYYY-MM-DD"), Hn = d.object({
718
+ ), I = d.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected YYYY-MM-DD"), qn = d.object({
716
719
  status: d.enum(["idea", "planned", "in-progress", "review", "done", "dropped"]),
717
720
  kind: d.enum(["feat", "fix", "chore", "docs", "refactor"]).optional(),
718
721
  id: d.string().optional(),
@@ -721,7 +724,7 @@ const it = {
721
724
  created: I,
722
725
  updated: I.optional(),
723
726
  tags: d.string().optional()
724
- }), Gn = d.object({
727
+ }), Un = d.object({
725
728
  id: d.string().describe("Permanent plan ID, e.g. FEAT-24"),
726
729
  title: d.string().describe('Human-readable plan name, e.g. "Plan storage architecture"'),
727
730
  kind: d.enum(["feat", "fix", "chore", "docs", "refactor"]).describe("Plan kind matching Conventional Commits types"),
@@ -733,7 +736,7 @@ const it = {
733
736
  audited: I.optional().describe("Date of last successful convergence audit (YYYY-MM-DD)"),
734
737
  "audited-hash": d.string().optional().describe("Content hash of the plan at last audit, used to detect edits regardless of mtime"),
735
738
  tags: d.array(d.string()).optional().describe("Tagging categories")
736
- }).passthrough(), Bn = d.object({
739
+ }).passthrough(), Kn = d.object({
737
740
  id: d.string().describe("Permanent idea ID, e.g. IDEA-20"),
738
741
  title: d.string().describe("Short idea headline (3-6 words)"),
739
742
  kind: d.enum(["idea", "note"]).optional().describe('"note" for ideas that never need a plan; omitted means a plan-bearing idea'),
@@ -741,7 +744,7 @@ const it = {
741
744
  }).passthrough().refine((e) => e.status === void 0 || e.kind === "note", {
742
745
  message: "status is only valid on ideas with kind: note",
743
746
  path: ["status"]
744
- }), ot = d.object({
747
+ }), ct = d.object({
745
748
  id: d.string().describe("Permanent lifetime entity ID, e.g. IDEA-45 — never changes"),
746
749
  title: d.string().describe("Human-readable entity name"),
747
750
  type: d.enum(["feat", "fix", "chore", "docs", "refactor"]).optional().describe(
@@ -770,9 +773,9 @@ const it = {
770
773
  issueSource: d.string().optional().describe(
771
774
  "sourceKind:sourceKey of the Issue (IDEA-192) this entity was promoted from, if any"
772
775
  )
773
- }).passthrough(), Yn = new Set(
774
- Object.keys(ot.shape)
775
- ), ct = ot.refine(
776
+ }).passthrough(), Wn = new Set(
777
+ Object.keys(ct.shape)
778
+ ), dt = ct.refine(
776
779
  (e) => e.kind !== "note" || e.status === void 0 || ["open", "done", "dropped"].includes(e.status),
777
780
  {
778
781
  message: "a note entity must use status open, done, or dropped",
@@ -787,56 +790,56 @@ const it = {
787
790
  }).refine((e) => e.kind !== "ticket" || e.idea !== void 0, {
788
791
  message: "a kind: ticket entity requires an idea: link to its board",
789
792
  path: ["idea"]
790
- }), qn = d.object({
793
+ }), Jn = d.object({
791
794
  name: d.string(),
792
795
  cmd: d.string(),
793
796
  port: d.number().int().positive().optional(),
794
797
  healthcheck: d.string().optional()
795
- }), Un = d.object({
798
+ }), zn = d.object({
796
799
  name: d.string(),
797
800
  cmd: d.string(),
798
801
  fixCmd: d.string().optional()
799
- }), Kn = d.object({
802
+ }), Vn = d.object({
800
803
  repo: d.string(),
801
804
  branch: d.string().optional(),
802
805
  releasePlease: d.boolean().optional()
803
- }), Wn = d.object({
804
- services: d.array(qn).optional(),
805
- checks: d.array(Un).optional(),
806
- ci: Kn.optional()
807
- }), Jn = d.object({
806
+ }), Xn = d.object({
807
+ services: d.array(Jn).optional(),
808
+ checks: d.array(zn).optional(),
809
+ ci: Vn.optional()
810
+ }), Zn = d.object({
808
811
  from: d.string(),
809
812
  to: d.string()
810
- }), zn = d.object({
813
+ }), Qn = d.object({
811
814
  name: d.string(),
812
815
  prompt: d.string()
813
- }), Vn = d.object({
816
+ }), es = d.object({
814
817
  ceiling: d.number().optional(),
815
818
  floor: d.number().optional(),
816
- window: Jn.optional(),
819
+ window: Zn.optional(),
817
820
  roots: d.array(d.string()).optional(),
818
821
  maxChunks: d.number().int().positive().optional(),
819
822
  threshold: d.number().min(0).max(100).optional(),
820
- checks: d.record(d.enum(Ht), d.boolean()).optional(),
821
- customChecks: d.array(zn).optional(),
823
+ checks: d.record(d.enum(qt), d.boolean()).optional(),
824
+ customChecks: d.array(Qn).optional(),
822
825
  maxTurns: d.number().int().positive().optional(),
823
826
  maxCostUsd: d.number().positive().optional()
824
- }), Xn = d.object({
825
- kinds: d.record(d.enum(Gt), d.boolean()).optional()
826
- }), Zn = d.object({
827
+ }), ts = d.object({
828
+ kinds: d.record(d.enum(Ut), d.boolean()).optional()
829
+ }), ns = d.object({
827
830
  endpoint: d.string(),
828
831
  keys: d.object({ p256dh: d.string(), auth: d.string() })
829
- }), xr = d.discriminatedUnion("transport", [
832
+ }), Mr = d.discriminatedUnion("transport", [
830
833
  d.object({
831
834
  transport: d.literal("webpush"),
832
835
  name: d.string(),
833
- subscription: Zn
836
+ subscription: ns
834
837
  }),
835
838
  d.object({ transport: d.literal("expo"), name: d.string(), token: d.string() })
836
- ]), Or = d.discriminatedUnion("transport", [
839
+ ]), Lr = d.discriminatedUnion("transport", [
837
840
  d.object({ transport: d.literal("webpush"), endpoint: d.string() }),
838
841
  d.object({ transport: d.literal("expo"), token: d.string() })
839
- ]), Qn = d.object({
842
+ ]), ss = d.object({
840
843
  version: d.number().int().describe("Corpus format version (see CORPUS_FORMAT_VERSION), not the package version"),
841
844
  projectName: d.string(),
842
845
  initializedAt: d.string(),
@@ -862,10 +865,10 @@ const it = {
862
865
  deskDiscovery: $,
863
866
  nightShift: $
864
867
  }).optional(),
865
- desk: Wn.optional(),
866
- night: Vn.optional(),
867
- notifications: Xn.optional()
868
- }), es = d.object({
868
+ desk: Xn.optional(),
869
+ night: es.optional(),
870
+ notifications: ts.optional()
871
+ }), as = d.object({
869
872
  id: d.string(),
870
873
  kind: d.enum([
871
874
  "completed",
@@ -882,14 +885,14 @@ const it = {
882
885
  read: d.boolean(),
883
886
  outcome: d.enum(["done", "error"]).optional(),
884
887
  push: d.boolean().optional().default(!0)
885
- }), Ce = /^##\s+(.+?)\s*$/, ts = /^\*\*([A-Za-z][A-Za-z-]*):\*\*\s*(.*)$/, ns = /^#{2,3}\s+/;
888
+ }), _e = /^##\s+(.+?)\s*$/, rs = /^\*\*([A-Za-z][A-Za-z-]*):\*\*\s*(.*)$/, is = /^#{2,3}\s+/;
886
889
  function q(e, t) {
887
890
  const n = e.split(`
888
891
  `), s = n.findIndex((o) => t.headingRe.test(o));
889
892
  if (s === -1) return { body: e, entries: [] };
890
893
  let a = n.length;
891
894
  for (let o = s + 1; o < n.length; o++)
892
- if (ns.test(n[o])) {
895
+ if (is.test(n[o])) {
893
896
  a = o;
894
897
  break;
895
898
  }
@@ -897,14 +900,14 @@ function q(e, t) {
897
900
  return { body: [...n.slice(0, s), ...n.slice(a)].join(`
898
901
  `).trim(), entries: r };
899
902
  }
900
- const _e = {
903
+ const Ne = {
901
904
  phases: Z,
902
905
  log: H,
903
- clarifications: fe,
904
- notes: pe,
905
- review: Mn
906
+ clarifications: pe,
907
+ notes: he,
908
+ review: Gn
906
909
  };
907
- function he(e) {
910
+ function me(e) {
908
911
  const t = {
909
912
  phases: [],
910
913
  log: [],
@@ -913,39 +916,39 @@ function he(e) {
913
916
  review: []
914
917
  };
915
918
  let n = e;
916
- for (const s of Object.keys(_e)) {
917
- const a = q(n, _e[s]);
919
+ for (const s of Object.keys(Ne)) {
920
+ const a = q(n, Ne[s]);
918
921
  n = a.body, t[s] = a.entries;
919
922
  }
920
923
  return { body: n, ...t };
921
924
  }
922
- function ss(e) {
925
+ function os(e) {
923
926
  const t = e.split(`
924
927
  `), n = [];
925
928
  for (let a = 0; a < t.length; a++)
926
- Ce.test(t[a]) && n.push(a);
929
+ _e.test(t[a]) && n.push(a);
927
930
  const s = [];
928
931
  for (let a = 0; a < n.length; a++) {
929
- const r = n[a], i = a + 1 < n.length ? n[a + 1] : t.length, o = t[r].match(Ce)[1], c = t.slice(r + 1, i);
932
+ const r = n[a], i = a + 1 < n.length ? n[a + 1] : t.length, o = t[r].match(_e)[1], c = t.slice(r + 1, i);
930
933
  let u = 0;
931
934
  for (; u < c.length && c[u].trim() === ""; ) u++;
932
935
  const l = {};
933
936
  for (; u < c.length; ) {
934
- const G = c[u].match(ts);
937
+ const G = c[u].match(rs);
935
938
  if (!G) break;
936
939
  l[G[1].toLowerCase()] = G[2].trim(), u++;
937
940
  }
938
941
  for (; u < c.length && c[u].trim() === ""; ) u++;
939
942
  const f = c.slice(u).join(`
940
- `).trim(), { body: h, phases: g, log: w, clarifications: y, notes: m, review: D } = he(f);
943
+ `).trim(), { body: h, phases: g, log: w, clarifications: y, notes: m, review: D } = me(f);
941
944
  s.push({ title: o, fields: l, body: h, phases: g, log: w, clarifications: y, notes: m, review: D });
942
945
  }
943
946
  return s;
944
947
  }
945
- function Dr(e) {
948
+ function Fr(e) {
946
949
  const t = [], n = [];
947
- for (const s of ss(e)) {
948
- const a = Hn.safeParse(s.fields);
950
+ for (const s of os(e)) {
951
+ const a = qn.safeParse(s.fields);
949
952
  if (!a.success) {
950
953
  n.push({
951
954
  title: s.title,
@@ -974,9 +977,9 @@ function Dr(e) {
974
977
  }
975
978
  return { entries: t, warnings: n };
976
979
  }
977
- const as = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/;
978
- function me(e, t) {
979
- const n = [], s = e.match(as);
980
+ const cs = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/;
981
+ function ge(e, t) {
982
+ const n = [], s = e.match(cs);
980
983
  if (!s)
981
984
  return { data: null, body: e.trim(), warnings: n };
982
985
  const a = s[1], r = e.slice(s[0].length).trim();
@@ -1004,18 +1007,18 @@ function me(e, t) {
1004
1007
  }
1005
1008
  return { data: o.data, body: r, warnings: n };
1006
1009
  }
1007
- function rs(e, t) {
1010
+ function ds(e, t) {
1008
1011
  const n = Object.fromEntries(
1009
1012
  Object.entries(e).filter(([s]) => !t.has(s))
1010
1013
  );
1011
1014
  return Object.keys(n).length > 0 ? n : void 0;
1012
1015
  }
1013
- function dt(e) {
1016
+ function ut(e) {
1014
1017
  const t = [], {
1015
1018
  data: n,
1016
1019
  body: s,
1017
1020
  warnings: a
1018
- } = me(e, ct);
1021
+ } = ge(e, dt);
1019
1022
  if (t.push(...a), !n)
1020
1023
  return { entries: [], warnings: t };
1021
1024
  const {
@@ -1025,12 +1028,12 @@ function dt(e) {
1025
1028
  clarifications: c,
1026
1029
  notes: u,
1027
1030
  review: l
1028
- } = he(s), { body: f, entries: h } = q(r, rt), { body: g, entries: w } = q(f, it), y = [...w, ...tn(o, c, u, l)];
1031
+ } = me(s), { body: f, entries: h } = q(r, it), { body: g, entries: w } = q(f, ot), y = [...w, ...rn(o, c, u, l)];
1029
1032
  n.kind === "note" && i.length > 0 && t.push({
1030
1033
  title: n.title,
1031
1034
  message: "note entities must not carry a Phases section — kept, but fix the file"
1032
1035
  });
1033
- const m = rs(n, Yn);
1036
+ const m = ds(n, Wn);
1034
1037
  return { entries: [{
1035
1038
  id: n.id,
1036
1039
  title: n.title,
@@ -1055,15 +1058,15 @@ function dt(e) {
1055
1058
  ...m && { unknownFrontmatter: m }
1056
1059
  }], warnings: t };
1057
1060
  }
1058
- function jr(e) {
1061
+ function Hr(e) {
1059
1062
  const t = [], {
1060
1063
  data: n,
1061
1064
  body: s,
1062
1065
  warnings: a
1063
- } = me(e, Gn);
1066
+ } = ge(e, Un);
1064
1067
  if (t.push(...a), !n)
1065
1068
  return { entries: [], warnings: t };
1066
- const { body: r, phases: i, log: o, clarifications: c, notes: u, review: l } = he(s);
1069
+ const { body: r, phases: i, log: o, clarifications: c, notes: u, review: l } = me(s);
1067
1070
  return { entries: [{
1068
1071
  title: n.title,
1069
1072
  status: n.status,
@@ -1084,12 +1087,12 @@ function jr(e) {
1084
1087
  review: l
1085
1088
  }], warnings: t };
1086
1089
  }
1087
- function Mr(e) {
1090
+ function Gr(e) {
1088
1091
  const {
1089
1092
  data: t,
1090
1093
  body: n,
1091
1094
  warnings: s
1092
- } = me(e, Bn);
1095
+ } = ge(e, Kn);
1093
1096
  if (!t)
1094
1097
  return { entries: [], warnings: s };
1095
1098
  const { body: a, entries: r } = q(n, H);
@@ -1102,17 +1105,17 @@ function Mr(e) {
1102
1105
  ...r.length > 0 && { log: r }
1103
1106
  }], warnings: s };
1104
1107
  }
1105
- const is = /^(IDEA-\d+):\s*/, os = /\n---+\n/;
1106
- function Lr(e) {
1107
- return e.split(os).filter(Boolean).map((n) => {
1108
+ const us = /^(IDEA-\d+):\s*/, ls = /\n---+\n/;
1109
+ function Br(e) {
1110
+ return e.split(ls).filter(Boolean).map((n) => {
1108
1111
  var c;
1109
1112
  const s = n.match(/^#{1,3}\s+(.+)/m), a = s ? s[1].trim() : ((c = n.trim().split(`
1110
- `)[0]) == null ? void 0 : c.trim()) ?? "Untitled", r = a.match(is), i = (r == null ? void 0 : r[1]) ?? null, o = i ? a.slice(r[0].length) : a;
1113
+ `)[0]) == null ? void 0 : c.trim()) ?? "Untitled", r = a.match(us), i = (r == null ? void 0 : r[1]) ?? null, o = i ? a.slice(r[0].length) : a;
1111
1114
  return { id: i, title: o, body: n.trim() };
1112
1115
  });
1113
1116
  }
1114
1117
  const Te = 40;
1115
- function cs(e, t = []) {
1118
+ function fs(e, t = []) {
1116
1119
  const n = [];
1117
1120
  for (const s of e)
1118
1121
  if (!s.archived && (t.length > 0 && s.subject && !t.includes(s.subject) && n.push({
@@ -1133,7 +1136,7 @@ function cs(e, t = []) {
1133
1136
  }
1134
1137
  return n;
1135
1138
  }
1136
- function ds(e) {
1139
+ function ps(e) {
1137
1140
  const t = /* @__PURE__ */ new Map(), n = [];
1138
1141
  for (const s of e.split(`
1139
1142
  `)) {
@@ -1150,75 +1153,75 @@ function ds(e) {
1150
1153
  }
1151
1154
  return n.map((s) => t.get(s));
1152
1155
  }
1153
- function Fr(e) {
1156
+ function Yr(e) {
1154
1157
  const t = [];
1155
1158
  for (const n of e.split(`
1156
1159
  `)) {
1157
1160
  const s = n.trim();
1158
1161
  if (s)
1159
1162
  try {
1160
- const a = es.safeParse(JSON.parse(s));
1163
+ const a = as.safeParse(JSON.parse(s));
1161
1164
  a.success && t.push(a.data);
1162
1165
  } catch {
1163
1166
  }
1164
1167
  }
1165
1168
  return t;
1166
1169
  }
1167
- const ut = /^-\s+(\d{4}-\d{2}-\d{2}):\s+(.+?)\s+—\s+(.*)$/;
1168
- function Hr(e) {
1170
+ const lt = /^-\s+(\d{4}-\d{2}-\d{2}):\s+(.+?)\s+—\s+(.*)$/;
1171
+ function qr(e) {
1169
1172
  const t = [];
1170
1173
  for (const n of e.split(`
1171
1174
  `)) {
1172
- const s = n.match(ut);
1175
+ const s = n.match(lt);
1173
1176
  s && t.push({ date: s[1], title: s[2].trim(), description: s[3].trim() });
1174
1177
  }
1175
1178
  return t;
1176
1179
  }
1177
- const ne = " — ";
1178
- function us(e) {
1180
+ const se = " — ";
1181
+ function hs(e) {
1179
1182
  return e.split(`
1180
1183
  `).map((t) => t.trim()).filter((t) => t.length > 0).map((t) => {
1181
- const n = t.indexOf(ne);
1184
+ const n = t.indexOf(se);
1182
1185
  return n === -1 ? { id: t, title: "" } : {
1183
1186
  id: t.slice(0, n).trim(),
1184
- title: t.slice(n + ne.length).trim()
1187
+ title: t.slice(n + se.length).trim()
1185
1188
  };
1186
1189
  });
1187
1190
  }
1188
- function Gr(e) {
1189
- return e.length === 0 ? "" : `${e.map((t) => `${t.id}${ne}${t.title}`).join(`
1191
+ function Ur(e) {
1192
+ return e.length === 0 ? "" : `${e.map((t) => `${t.id}${se}${t.title}`).join(`
1190
1193
  `)}
1191
1194
  `;
1192
1195
  }
1193
- async function ls(e) {
1196
+ async function ms(e) {
1194
1197
  try {
1195
1198
  return await z(e);
1196
1199
  } catch {
1197
1200
  return [];
1198
1201
  }
1199
1202
  }
1200
- async function lt(e) {
1203
+ async function ft(e) {
1201
1204
  try {
1202
1205
  return await v(e, "utf-8");
1203
1206
  } catch {
1204
1207
  return "";
1205
1208
  }
1206
1209
  }
1207
- async function fs(e) {
1208
- const t = await lt(p(e, "..", "run-order.md"));
1209
- return new Map(us(t).map((n, s) => [n.id, s + 1]));
1210
+ async function gs(e) {
1211
+ const t = await ft(p(e, "..", "run-order.md"));
1212
+ return new Map(hs(t).map((n, s) => [n.id, s + 1]));
1210
1213
  }
1211
1214
  async function x(e) {
1212
1215
  const t = [], n = [];
1213
1216
  let s = 0;
1214
- const a = await fs(e);
1217
+ const a = await gs(e);
1215
1218
  for (const r of [e, p(e, "archive")]) {
1216
- const i = r !== e, o = (await ls(r)).filter((u) => u.endsWith(".md") && u !== "index.md");
1219
+ const i = r !== e, o = (await ms(r)).filter((u) => u.endsWith(".md") && u !== "index.md");
1217
1220
  s += o.length;
1218
1221
  const c = await Promise.all(
1219
1222
  o.map(async (u) => {
1220
- const l = await lt(p(r, u));
1221
- return l ? dt(l) : { warnings: [{ title: u, message: "Could not read entity file" }] };
1223
+ const l = await ft(p(r, u));
1224
+ return l ? ut(l) : { warnings: [{ title: u, message: "Could not read entity file" }] };
1222
1225
  })
1223
1226
  );
1224
1227
  for (const u of c)
@@ -1233,54 +1236,54 @@ async function x(e) {
1233
1236
  }
1234
1237
  return { entries: t, warnings: n, fileCount: s };
1235
1238
  }
1236
- async function ge(e, t) {
1239
+ async function ye(e, t) {
1237
1240
  const { entries: n, warnings: s } = await x(e), a = p(e, "..", ".."), [r, i] = await Promise.all([
1238
- tt(a, t),
1239
- Ke(a)
1241
+ nt(a, t),
1242
+ We(a)
1240
1243
  ]);
1241
1244
  return { entries: n, warnings: s, prs: r, resolved: r !== void 0, mainActivityIds: i };
1242
1245
  }
1243
- async function Br(e) {
1244
- const { entries: t, warnings: n, prs: s, resolved: a, mainActivityIds: r } = await ge(e), i = t.map((c) => ({
1246
+ async function Kr(e) {
1247
+ const { entries: t, warnings: n, prs: s, resolved: a, mainActivityIds: r } = await ye(e), i = t.map((c) => ({
1245
1248
  ...c,
1246
1249
  status: X(c, s == null ? void 0 : s.get(c.id), a, r.has(c.id))
1247
1250
  }));
1248
1251
  return { entries: i.map((c) => {
1249
1252
  if (c.kind !== "board" || c.archived || c.status === "done" || c.status === "dropped") return c;
1250
1253
  const u = i.filter((l) => l.kind === "ticket" && l.idea === c.id).map((l) => l.status ?? "idea");
1251
- return { ...c, status: Be(u) };
1254
+ return { ...c, status: Ye(u) };
1252
1255
  }), warnings: n };
1253
1256
  }
1254
- async function Yr(e, t) {
1255
- const { entries: n, warnings: s, prs: a, resolved: r, mainActivityIds: i } = await ge(
1257
+ async function Wr(e, t) {
1258
+ const { entries: n, warnings: s, prs: a, resolved: r, mainActivityIds: i } = await ye(
1256
1259
  e,
1257
1260
  t
1258
- ), o = n.filter((u) => u.kind !== "note").map((u) => qe(u, a == null ? void 0 : a.get(u.id), r, i.has(u.id)));
1261
+ ), o = n.filter((u) => u.kind !== "note").map((u) => Ue(u, a == null ? void 0 : a.get(u.id), r, i.has(u.id)));
1259
1262
  return { entries: o.map((u) => {
1260
1263
  if (u.entityKind !== "board" || u.archived || u.status === "done" || u.status === "dropped")
1261
1264
  return u;
1262
1265
  const l = o.filter((f) => f.entityKind === "ticket" && f.idea === u.id).map((f) => f.status);
1263
- return { ...u, status: Be(l) };
1266
+ return { ...u, status: Ye(l) };
1264
1267
  }), warnings: s, resolved: r };
1265
1268
  }
1266
- async function qr(e) {
1267
- const { entries: t, prs: n, resolved: s } = await ge(e);
1269
+ async function Jr(e) {
1270
+ const { entries: t, prs: n, resolved: s } = await ye(e);
1268
1271
  return {
1269
1272
  entries: t.flatMap((a) => {
1270
1273
  const r = n == null ? void 0 : n.get(a.id);
1271
- return r && en(a, r) ? [{ id: a.id, title: a.title, pr: r }] : [];
1274
+ return r && an(a, r) ? [{ id: a.id, title: a.title, pr: r }] : [];
1272
1275
  }),
1273
1276
  resolved: s
1274
1277
  };
1275
1278
  }
1276
- async function Ur(e) {
1279
+ async function zr(e) {
1277
1280
  const { entries: t, warnings: n } = await x(e);
1278
1281
  return {
1279
- entries: t.filter((s) => s.kind === "note").map(rn),
1282
+ entries: t.filter((s) => s.kind === "note").map(un),
1280
1283
  warnings: n
1281
1284
  };
1282
1285
  }
1283
- const ps = [
1286
+ const ys = [
1284
1287
  {
1285
1288
  id: "frontmatter-schema",
1286
1289
  category: "metadata",
@@ -1329,6 +1332,12 @@ const ps = [
1329
1332
  severity: "error",
1330
1333
  summary: "A file carries more than one Phases heading — a redraft appended instead of replacing the existing list in place."
1331
1334
  },
1335
+ {
1336
+ id: "no-agent-phase",
1337
+ category: "structural",
1338
+ severity: "warning",
1339
+ summary: "A planned/in-progress/review entity has no phase an agent can run — every phase is `[manual]` or the Phases section is empty, so the idea can never move on its own."
1340
+ },
1332
1341
  {
1333
1342
  id: "archive-placement",
1334
1343
  category: "structural",
@@ -1353,20 +1362,20 @@ const ps = [
1353
1362
  severity: "warning",
1354
1363
  summary: "config.json has no defaultAgents, so every run uses the built-in agent and model — choose them in Settings → General so a project never runs on a fallback it did not pick."
1355
1364
  }
1356
- ], hs = Object.fromEntries(
1357
- ps.map((e) => [e.id, e])
1365
+ ], ws = Object.fromEntries(
1366
+ ys.map((e) => [e.id, e])
1358
1367
  );
1359
1368
  function U(e) {
1360
- return hs[e.rule].severity;
1369
+ return ws[e.rule].severity;
1361
1370
  }
1362
- const Ne = { error: 0, warning: 1 };
1363
- function ft(e) {
1371
+ const xe = { error: 0, warning: 1 };
1372
+ function pt(e) {
1364
1373
  return [...e].sort(
1365
- (t, n) => t.file.localeCompare(n.file) || t.line - n.line || Ne[U(t)] - Ne[U(n)] || t.rule.localeCompare(n.rule)
1374
+ (t, n) => t.file.localeCompare(n.file) || t.line - n.line || xe[U(t)] - xe[U(n)] || t.rule.localeCompare(n.rule)
1366
1375
  );
1367
1376
  }
1368
- function Kr(e) {
1369
- const t = ft(e).map((n) => ({
1377
+ function Vr(e) {
1378
+ const t = pt(e).map((n) => ({
1370
1379
  ...n,
1371
1380
  severity: U(n)
1372
1381
  }));
@@ -1376,8 +1385,8 @@ function Kr(e) {
1376
1385
  warningCount: t.filter((n) => n.severity === "warning").length
1377
1386
  };
1378
1387
  }
1379
- function Wr(e) {
1380
- const t = ft(e);
1388
+ function Xr(e) {
1389
+ const t = pt(e);
1381
1390
  let n = 0, s = 0;
1382
1391
  const a = t.map((i) => {
1383
1392
  const o = U(i);
@@ -1390,15 +1399,15 @@ function Wr(e) {
1390
1399
  warningCount: s
1391
1400
  };
1392
1401
  }
1393
- const R = 1;
1394
- class ms extends Error {
1402
+ const A = 1;
1403
+ class bs extends Error {
1395
1404
  constructor(t) {
1396
1405
  super(
1397
- `This corpus is in format version ${t}, newer than the format version ${R} this paper-camp understands. Writes are refused so a field this version doesn’t recognise is never dropped — upgrade paper-camp to edit this corpus.`
1406
+ `This corpus is in format version ${t}, newer than the format version ${A} this paper-camp understands. Writes are refused so a field this version doesn’t recognise is never dropped — upgrade paper-camp to edit this corpus.`
1398
1407
  ), this.name = "CorpusTooNewError";
1399
1408
  }
1400
1409
  }
1401
- async function pt(e) {
1410
+ async function ht(e) {
1402
1411
  let t;
1403
1412
  try {
1404
1413
  t = await v(e, "utf-8");
@@ -1412,25 +1421,25 @@ async function pt(e) {
1412
1421
  return null;
1413
1422
  }
1414
1423
  }
1415
- function ht(e) {
1424
+ function mt(e) {
1416
1425
  const t = e == null ? void 0 : e.version;
1417
1426
  return typeof t == "number" ? t : null;
1418
1427
  }
1419
- async function Jr(e) {
1420
- const t = ht(await pt(e));
1421
- if (t !== null && t > R)
1422
- throw new ms(t);
1428
+ async function Zr(e) {
1429
+ const t = mt(await ht(e));
1430
+ if (t !== null && t > A)
1431
+ throw new bs(t);
1423
1432
  }
1424
- async function zr(e) {
1425
- const t = await pt(e);
1433
+ async function Qr(e) {
1434
+ const t = await ht(e);
1426
1435
  if (!t) return null;
1427
- const n = ht(t);
1428
- return n !== null && n >= R ? null : (t.version = R, await E(e, `${JSON.stringify(t, null, 2)}
1429
- `, "utf-8"), { from: n, to: R });
1436
+ const n = mt(t);
1437
+ return n !== null && n >= A ? null : (t.version = A, await E(e, `${JSON.stringify(t, null, 2)}
1438
+ `, "utf-8"), { from: n, to: A });
1430
1439
  }
1431
- const mt = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/, gs = 2;
1432
- function ye(e) {
1433
- const t = e.content.match(mt);
1440
+ const gt = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/, vs = 2;
1441
+ function we(e) {
1442
+ const t = e.content.match(gt);
1434
1443
  if (!t) return null;
1435
1444
  let n = null;
1436
1445
  try {
@@ -1440,55 +1449,55 @@ function ye(e) {
1440
1449
  }
1441
1450
  return { yaml: t[1], data: n };
1442
1451
  }
1443
- function gt(e, t) {
1452
+ function yt(e, t) {
1444
1453
  const n = new RegExp(`^\\s*${t}:`), s = e.split(`
1445
1454
  `).findIndex((a) => n.test(a));
1446
- return s === -1 ? 1 : gs + s;
1455
+ return s === -1 ? 1 : vs + s;
1447
1456
  }
1448
- function we(e) {
1449
- const t = ye(e);
1450
- return t ? gt(t.yaml, "id") : 1;
1457
+ function be(e) {
1458
+ const t = we(e);
1459
+ return t ? yt(t.yaml, "id") : 1;
1451
1460
  }
1452
- function yt(e) {
1461
+ function wt(e) {
1453
1462
  var n, s;
1454
- const t = (s = (n = ye(e)) == null ? void 0 : n.data) == null ? void 0 : s.id;
1463
+ const t = (s = (n = we(e)) == null ? void 0 : n.data) == null ? void 0 : s.id;
1455
1464
  return typeof t == "string" ? t : e.id;
1456
1465
  }
1457
- function A(e, t, n, s) {
1466
+ function R(e, t, n, s) {
1458
1467
  return { file: e.path, line: t, rule: n, message: s };
1459
1468
  }
1460
- const ys = ({ files: e }) => e.flatMap((t) => {
1461
- const n = t.content.match(mt);
1469
+ const Es = ({ files: e }) => e.flatMap((t) => {
1470
+ const n = t.content.match(gt);
1462
1471
  if (!n)
1463
- return [A(t, 1, "frontmatter-schema", "missing YAML frontmatter block")];
1472
+ return [R(t, 1, "frontmatter-schema", "missing YAML frontmatter block")];
1464
1473
  let s;
1465
1474
  try {
1466
1475
  s = V(n[1]);
1467
1476
  } catch (r) {
1468
- return [A(t, 1, "frontmatter-schema", `invalid YAML: ${r.message}`)];
1477
+ return [R(t, 1, "frontmatter-schema", `invalid YAML: ${r.message}`)];
1469
1478
  }
1470
1479
  if (typeof s != "object" || s === null || Array.isArray(s))
1471
- return [A(t, 1, "frontmatter-schema", "frontmatter is not a key/value mapping")];
1472
- const a = ct.safeParse(s);
1480
+ return [R(t, 1, "frontmatter-schema", "frontmatter is not a key/value mapping")];
1481
+ const a = dt.safeParse(s);
1473
1482
  return a.success ? [] : a.error.issues.map((r) => {
1474
1483
  const i = String(r.path[0] ?? ""), o = r.path.length > 0 ? `${r.path.join(".")}: ${r.message}` : r.message;
1475
- return A(t, i ? gt(n[1], i) : 1, "frontmatter-schema", o);
1484
+ return R(t, i ? yt(n[1], i) : 1, "frontmatter-schema", o);
1476
1485
  });
1477
- }), ws = ({ files: e }) => e.flatMap((t) => {
1486
+ }), ks = ({ files: e }) => e.flatMap((t) => {
1478
1487
  var s, a;
1479
- const n = (a = (s = ye(t)) == null ? void 0 : s.data) == null ? void 0 : a.id;
1488
+ const n = (a = (s = we(t)) == null ? void 0 : s.data) == null ? void 0 : a.id;
1480
1489
  return typeof n != "string" || n === t.id ? [] : [
1481
- A(
1490
+ R(
1482
1491
  t,
1483
- we(t),
1492
+ be(t),
1484
1493
  "filename-id-mismatch",
1485
1494
  `frontmatter id "${n}" does not match file name ${t.id}.md`
1486
1495
  )
1487
1496
  ];
1488
- }), bs = ({ files: e }) => {
1497
+ }), Ss = ({ files: e }) => {
1489
1498
  const t = /* @__PURE__ */ new Map();
1490
1499
  for (const s of e) {
1491
- const a = yt(s), r = t.get(a);
1500
+ const a = wt(s), r = t.get(a);
1492
1501
  r ? r.push(s) : t.set(a, [s]);
1493
1502
  }
1494
1503
  const n = [];
@@ -1497,48 +1506,48 @@ const ys = ({ files: e }) => e.flatMap((t) => {
1497
1506
  const r = a.map((i) => i.path).join(", ");
1498
1507
  for (const i of a)
1499
1508
  n.push(
1500
- A(
1509
+ R(
1501
1510
  i,
1502
- we(i),
1511
+ be(i),
1503
1512
  "duplicate-id",
1504
1513
  `id ${s} is defined by ${a.length} files: ${r}`
1505
1514
  )
1506
1515
  );
1507
1516
  }
1508
1517
  return n;
1509
- }, vs = ({ files: e, config: t }) => {
1518
+ }, $s = ({ files: e, config: t }) => {
1510
1519
  var s;
1511
1520
  const n = (s = t == null ? void 0 : t.nextId) == null ? void 0 : s.idea;
1512
1521
  return n == null ? [] : e.flatMap((a) => {
1513
- const r = yt(a), i = r.match(/^IDEA-(\d+)$/);
1522
+ const r = wt(a), i = r.match(/^IDEA-(\d+)$/);
1514
1523
  return i ? Number(i[1]) < n ? [] : [
1515
- A(
1524
+ R(
1516
1525
  a,
1517
- we(a),
1526
+ be(a),
1518
1527
  "id-counter-stale",
1519
1528
  `id ${r} is >= config nextId.idea (${n}); the next minted id would collide`
1520
1529
  )
1521
1530
  ] : [];
1522
1531
  });
1523
- }, Es = ({ config: e }) => {
1532
+ }, Is = ({ config: e }) => {
1524
1533
  const t = e == null ? void 0 : e.version;
1525
- return typeof t != "number" || t <= R ? [] : [
1534
+ return typeof t != "number" || t <= A ? [] : [
1526
1535
  {
1527
1536
  file: "papercamp/config.json",
1528
1537
  line: 1,
1529
1538
  rule: "corpus-format-too-new",
1530
- message: `config.version ${t} is newer than the format version ${R} this paper-camp understands; writes are refused until it's upgraded`
1539
+ message: `config.version ${t} is newer than the format version ${A} this paper-camp understands; writes are refused until it's upgraded`
1531
1540
  }
1532
1541
  ];
1533
- }, ks = [
1534
- ys,
1535
- ws,
1536
- bs,
1537
- vs,
1538
- Es
1539
- ], Ss = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/, $s = /^#{1,6}\s+(.+?)\s*$/, Is = /^[-*]\s+\[[ xX]\]\s+(.*)$/, Rs = /^(phases|fixes)$/i, wt = /^#{1,6}\s+Phases\s*$/i, As = /^(?:\d{4}-\d{2}-\d{2}\s+)?\[(?:log|clarification|review|note|decision|question|chat)\]/, Ps = /^\[(?:phase:\d+|body)\]/, Cs = /\[\[\s*((?:IDEA|TICKET)-\d+)(?:\s*\|[^\]]*)?\s*\]\]/g, _s = /* @__PURE__ */ new Set(["idea", "planned", "in-progress", "review", "open"]), Ts = /* @__PURE__ */ new Set(["done", "dropped"]);
1540
- function be(e) {
1541
- const t = e.match(Ss);
1542
+ }, As = [
1543
+ Es,
1544
+ ks,
1545
+ Ss,
1546
+ $s,
1547
+ Is
1548
+ ], Rs = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/, bt = /^#{1,6}\s+(.+?)\s*$/, vt = /^[-*]\s+\[[ xX]\]\s+(.*)$/, Ps = /^(phases|fixes)$/i, Et = /^#{1,6}\s+Phases\s*$/i, Cs = /^(?:\d{4}-\d{2}-\d{2}\s+)?\[(?:log|clarification|review|note|decision|question|chat)\]/, _s = /^\[(?:phase:\d+|body)\]/, Ns = /\[\[\s*((?:IDEA|TICKET)-\d+)(?:\s*\|[^\]]*)?\s*\]\]/g, Ts = /* @__PURE__ */ new Set(["idea", "planned", "in-progress", "review", "open"]), xs = /* @__PURE__ */ new Set(["done", "dropped"]), Os = /* @__PURE__ */ new Set(["planned", "in-progress", "review"]), Ds = /^\[manual\]\s+/;
1549
+ function Q(e) {
1550
+ const t = e.match(Rs);
1542
1551
  if (!t) return null;
1543
1552
  try {
1544
1553
  const n = V(t[1]);
@@ -1548,30 +1557,30 @@ function be(e) {
1548
1557
  }
1549
1558
  return null;
1550
1559
  }
1551
- function Ns(e, t) {
1560
+ function kt(e, t) {
1552
1561
  const n = e.split(`
1553
1562
  `).findIndex((s) => t.test(s));
1554
1563
  return n === -1 ? 1 : n + 1;
1555
1564
  }
1556
- function T(e, t, n, s) {
1565
+ function C(e, t, n, s) {
1557
1566
  return { file: e.path, line: t, rule: n, message: s };
1558
1567
  }
1559
- const xs = ({ files: e }) => e.flatMap((t) => {
1568
+ const js = ({ files: e }) => e.flatMap((t) => {
1560
1569
  const n = t.content.split(`
1561
1570
  `), s = [];
1562
1571
  let a = !1;
1563
1572
  for (let r = 0; r < n.length; r++) {
1564
- const i = n[r].match($s);
1573
+ const i = n[r].match(bt);
1565
1574
  if (i) {
1566
- a = Rs.test(i[1].trim());
1575
+ a = Ps.test(i[1].trim());
1567
1576
  continue;
1568
1577
  }
1569
1578
  if (a) continue;
1570
- const o = n[r].match(Is);
1579
+ const o = n[r].match(vt);
1571
1580
  if (!o) continue;
1572
1581
  const c = o[1].trim();
1573
- As.test(c) || Ps.test(c) || s.push(
1574
- T(
1582
+ Cs.test(c) || _s.test(c) || s.push(
1583
+ C(
1575
1584
  t,
1576
1585
  r + 1,
1577
1586
  "phases-list-split",
@@ -1580,55 +1589,83 @@ const xs = ({ files: e }) => e.flatMap((t) => {
1580
1589
  );
1581
1590
  }
1582
1591
  return s;
1583
- }), Os = ({ files: e }) => e.flatMap((t) => {
1592
+ }), Ms = ({ files: e }) => e.flatMap((t) => {
1584
1593
  var a;
1585
- if (((a = be(t.content)) == null ? void 0 : a.kind) !== "note") return [];
1594
+ if (((a = Q(t.content)) == null ? void 0 : a.kind) !== "note") return [];
1586
1595
  const s = t.content.split(`
1587
- `).findIndex((r) => wt.test(r));
1588
- return s === -1 ? [] : [T(t, s + 1, "note-has-phases", "a kind: note entity carries a Phases section")];
1589
- }), Ds = ({ files: e }) => e.flatMap((t) => t.content.split(`
1590
- `).flatMap((a, r) => wt.test(a) ? [r] : []).slice(1).map(
1591
- (a) => T(
1596
+ `).findIndex((r) => Et.test(r));
1597
+ return s === -1 ? [] : [C(t, s + 1, "note-has-phases", "a kind: note entity carries a Phases section")];
1598
+ }), Ls = ({ files: e }) => e.flatMap((t) => t.content.split(`
1599
+ `).flatMap((a, r) => Et.test(a) ? [r] : []).slice(1).map(
1600
+ (a) => C(
1592
1601
  t,
1593
1602
  a + 1,
1594
1603
  "duplicate-phases-section",
1595
1604
  "a second Phases heading exists — a redraft must replace the existing list in place, not append a new one"
1596
1605
  )
1597
- )), js = ({ files: e }) => e.flatMap((t) => {
1606
+ )), Fs = ({ files: e }) => e.flatMap((t) => {
1607
+ const n = Q(t.content), s = typeof (n == null ? void 0 : n.kind) == "string" ? n.kind : void 0;
1608
+ if (s === "note" || s === "board") return [];
1609
+ const a = typeof (n == null ? void 0 : n.status) == "string" ? n.status : void 0;
1610
+ if (!a || !Os.has(a)) return [];
1611
+ const r = t.content.split(`
1612
+ `);
1613
+ let i = !1, o = -1, c = !1;
1614
+ for (let l = 0; l < r.length; l++) {
1615
+ const f = r[l].match(bt);
1616
+ if (f) {
1617
+ i = /^phases$/i.test(f[1].trim()), i && o === -1 && (o = l);
1618
+ continue;
1619
+ }
1620
+ if (!i) continue;
1621
+ const h = r[l].match(vt);
1622
+ h && (Ds.test(h[1].trim()) || (c = !0));
1623
+ }
1624
+ if (c) return [];
1625
+ const u = o === -1 ? kt(t.content, /^status:/) : o + 1;
1626
+ return [
1627
+ C(
1628
+ t,
1629
+ u,
1630
+ "no-agent-phase",
1631
+ `status "${a}" but no agent-runnable phase — only manual phases (or none at all), which reads as a note wearing an idea's clothes`
1632
+ )
1633
+ ];
1634
+ }), Hs = ({ files: e }) => e.flatMap((t) => {
1598
1635
  var a;
1599
- const n = (a = be(t.content)) == null ? void 0 : a.status;
1636
+ const n = (a = Q(t.content)) == null ? void 0 : a.status;
1600
1637
  if (typeof n != "string") return [];
1601
- const s = Ns(t.content, /^status:/);
1602
- return t.archived && _s.has(n) ? [
1603
- T(
1638
+ const s = kt(t.content, /^status:/);
1639
+ return t.archived && Ts.has(n) ? [
1640
+ C(
1604
1641
  t,
1605
1642
  s,
1606
1643
  "archive-placement",
1607
1644
  `status "${n}" is active but the file is under ideas/archive/`
1608
1645
  )
1609
- ] : !t.archived && Ts.has(n) ? [
1610
- T(
1646
+ ] : !t.archived && xs.has(n) ? [
1647
+ C(
1611
1648
  t,
1612
1649
  s,
1613
1650
  "archive-placement",
1614
1651
  `status "${n}" is closed but the file is still under ideas/ — it should be archived`
1615
1652
  )
1616
1653
  ] : [];
1617
- }), Ms = ({ files: e }) => {
1654
+ }), Gs = ({ files: e }) => {
1618
1655
  var n;
1619
1656
  const t = /* @__PURE__ */ new Set();
1620
1657
  for (const s of e) {
1621
1658
  t.add(s.id);
1622
- const a = (n = be(s.content)) == null ? void 0 : n.id;
1659
+ const a = (n = Q(s.content)) == null ? void 0 : n.id;
1623
1660
  typeof a == "string" && t.add(a);
1624
1661
  }
1625
1662
  return e.flatMap((s) => {
1626
1663
  const a = s.content.split(`
1627
1664
  `), r = [];
1628
1665
  for (let i = 0; i < a.length; i++)
1629
- for (const o of a[i].matchAll(Cs))
1666
+ for (const o of a[i].matchAll(Ns))
1630
1667
  t.has(o[1]) || r.push(
1631
- T(
1668
+ C(
1632
1669
  s,
1633
1670
  i + 1,
1634
1671
  "dangling-link",
@@ -1637,38 +1674,39 @@ const xs = ({ files: e }) => e.flatMap((t) => {
1637
1674
  );
1638
1675
  return r;
1639
1676
  });
1640
- }, Ls = [
1641
- xs,
1642
- Os,
1643
- Ds,
1677
+ }, Bs = [
1644
1678
  js,
1645
- Ms
1646
- ], Fs = ".claude/settings.json", Hs = ({ hasPermissionsAllow: e }) => e === !1 ? [
1679
+ Ms,
1680
+ Ls,
1681
+ Fs,
1682
+ Hs,
1683
+ Gs
1684
+ ], Ys = ".claude/settings.json", qs = ({ hasPermissionsAllow: e }) => e === !1 ? [
1647
1685
  {
1648
- file: Fs,
1686
+ file: Ys,
1649
1687
  line: 1,
1650
1688
  rule: "missing-permissions-allow",
1651
1689
  message: "no permissions.allow list — headless runs deny every edit and shell command outside the defaults; run `paper-camp init --settings` to add it."
1652
1690
  }
1653
- ] : [], Gs = ({ config: e }) => e && !e.defaultAgents ? [
1691
+ ] : [], Us = ({ config: e }) => e && !e.defaultAgents ? [
1654
1692
  {
1655
1693
  file: "papercamp/config.json",
1656
1694
  line: 1,
1657
1695
  rule: "no-default-agents",
1658
1696
  message: "no defaultAgents — every run uses the built-in agent and model; choose them in Settings → General."
1659
1697
  }
1660
- ] : [], Bs = [
1661
- Hs,
1662
- Gs
1663
- ], Ys = [
1664
- ...ks,
1665
- ...Ls,
1666
- ...Bs
1698
+ ] : [], Ks = [
1699
+ qs,
1700
+ Us
1701
+ ], Ws = [
1702
+ ...As,
1703
+ ...Bs,
1704
+ ...Ks
1667
1705
  ];
1668
1706
  function ve(e) {
1669
1707
  return (e == null ? void 0 : e.code) === "ENOENT";
1670
1708
  }
1671
- async function qs(e) {
1709
+ async function Js(e) {
1672
1710
  try {
1673
1711
  return await z(e);
1674
1712
  } catch (t) {
@@ -1676,7 +1714,7 @@ async function qs(e) {
1676
1714
  throw t;
1677
1715
  }
1678
1716
  }
1679
- async function Us(e) {
1717
+ async function zs(e) {
1680
1718
  let t;
1681
1719
  try {
1682
1720
  t = await v(e, "utf-8");
@@ -1690,7 +1728,7 @@ async function Us(e) {
1690
1728
  return null;
1691
1729
  }
1692
1730
  }
1693
- async function Ks(e) {
1731
+ async function Vs(e) {
1694
1732
  var n;
1695
1733
  let t;
1696
1734
  try {
@@ -1706,20 +1744,20 @@ async function Ks(e) {
1706
1744
  return !1;
1707
1745
  }
1708
1746
  }
1709
- async function Ws(e) {
1747
+ async function Xs(e) {
1710
1748
  const t = p(e, "ideas"), n = [], s = [
1711
1749
  { dir: t, archived: !1, names: await z(t) },
1712
1750
  {
1713
1751
  dir: p(t, "archive"),
1714
1752
  archived: !0,
1715
- names: await qs(p(t, "archive"))
1753
+ names: await Js(p(t, "archive"))
1716
1754
  }
1717
1755
  ];
1718
1756
  for (const { dir: a, archived: r, names: i } of s) {
1719
1757
  const o = i.filter((c) => c.endsWith(".md") && c !== "index.md").sort();
1720
1758
  for (const c of o)
1721
1759
  n.push({
1722
- id: Lt(c, ".md"),
1760
+ id: Bt(c, ".md"),
1723
1761
  path: `papercamp/ideas${r ? "/archive" : ""}/${c}`,
1724
1762
  content: await v(p(a, c), "utf-8"),
1725
1763
  archived: r
@@ -1727,30 +1765,30 @@ async function Ws(e) {
1727
1765
  }
1728
1766
  return {
1729
1767
  files: n,
1730
- config: await Us(p(e, "config.json")),
1731
- hasPermissionsAllow: await Ks(M(e))
1768
+ config: await zs(p(e, "config.json")),
1769
+ hasPermissionsAllow: await Vs(M(e))
1732
1770
  };
1733
1771
  }
1734
- function Js(e) {
1735
- return Ys.flatMap((t) => t(e));
1772
+ function Zs(e) {
1773
+ return Ws.flatMap((t) => t(e));
1736
1774
  }
1737
- async function Vr(e) {
1738
- return Js(await Ws(e));
1775
+ async function ei(e) {
1776
+ return Zs(await Xs(e));
1739
1777
  }
1740
- const zs = {
1778
+ const Qs = {
1741
1779
  rule: "archive-placement",
1742
1780
  fix: (e, t) => ({
1743
1781
  kind: "move",
1744
1782
  from: t.path,
1745
1783
  to: t.archived ? t.path.replace("/archive/", "/") : t.path.replace(/\/(?=[^/]+$)/, "/archive/")
1746
1784
  })
1747
- }, Vs = [zs], Xs = new Map(
1748
- Vs.map((e) => [e.rule, e])
1785
+ }, ea = [Qs], ta = new Map(
1786
+ ea.map((e) => [e.rule, e])
1749
1787
  );
1750
- function Xr(e, t) {
1788
+ function ti(e, t) {
1751
1789
  const n = new Map(e.files.map((o) => [o.path, o])), s = [], a = [], r = [], i = [];
1752
1790
  for (const o of t) {
1753
- const c = Xs.get(o.rule), u = n.get(o.file), l = c && u ? c.fix(o, u) : null;
1791
+ const c = ta.get(o.rule), u = n.get(o.file), l = c && u ? c.fix(o, u) : null;
1754
1792
  if (!l) {
1755
1793
  r.push(o);
1756
1794
  continue;
@@ -1770,25 +1808,25 @@ async function K(e) {
1770
1808
  return "";
1771
1809
  }
1772
1810
  }
1773
- function bt(e, t) {
1811
+ function St(e, t) {
1774
1812
  var n;
1775
1813
  return (n = e.split(`
1776
1814
  `).find((s) => s.includes(`(${t})`))) == null ? void 0 : n.trim();
1777
1815
  }
1778
- const Zs = /^## \[.+?\]\(.*\/compare\/(.+?)\.\.\.(.+?)\)/;
1779
- function Qs(e) {
1816
+ const na = /^## \[.+?\]\(.*\/compare\/(.+?)\.\.\.(.+?)\)/;
1817
+ function sa(e) {
1780
1818
  return e.split(`
1781
- `).map((t) => Zs.exec(t)).filter((t) => t !== null).map((t) => ({ version: t[2], range: `${t[1]}..${t[2]}` }));
1819
+ `).map((t) => na.exec(t)).filter((t) => t !== null).map((t) => ({ version: t[2], range: `${t[1]}..${t[2]}` }));
1782
1820
  }
1783
- function ea(e, t) {
1821
+ function aa(e, t) {
1784
1822
  return e.split(`
1785
1823
  `).find((n) => {
1786
1824
  const s = n.match(/\/commit\/([0-9a-f]+)\)/i);
1787
1825
  return s ? s[1].startsWith(t) || t.startsWith(s[1]) : !1;
1788
1826
  });
1789
1827
  }
1790
- const ta = /^[a-z]+\/([a-z]+-\d+)-/;
1791
- async function na(e, t) {
1828
+ const ra = /^[a-z]+\/([a-z]+-\d+)-/;
1829
+ async function ia(e, t) {
1792
1830
  var a;
1793
1831
  const n = await S(e, [
1794
1832
  "for-each-ref",
@@ -1799,26 +1837,26 @@ async function na(e, t) {
1799
1837
  for (const r of n.split(`
1800
1838
  `)) {
1801
1839
  const i = r.replace(/^refs\/heads\//, "").replace(/^refs\/remotes\/[^/]+\//, "");
1802
- if (((a = ta.exec(i)) == null ? void 0 : a[1]) === s) return i;
1840
+ if (((a = ra.exec(i)) == null ? void 0 : a[1]) === s) return i;
1803
1841
  }
1804
1842
  }
1805
- async function sa(e, t) {
1806
- const n = await na(e, t);
1843
+ async function oa(e, t) {
1844
+ const n = await ia(e, t);
1807
1845
  if (!n) return [];
1808
- const s = await Ue(e);
1846
+ const s = await Ke(e);
1809
1847
  return (await S(e, ["log", "--format=%s", `${s}..${n}`])).split(`
1810
1848
  `).map((r) => r.trim()).filter(Boolean);
1811
1849
  }
1812
- async function aa(e, t) {
1813
- if (!on.test(t)) return null;
1814
- const n = await S(e, ["log", "-1", "--format=%B", t]), s = n ? te(n) : null;
1850
+ async function ca(e, t) {
1851
+ if (!ln.test(t)) return null;
1852
+ const n = await S(e, ["log", "-1", "--format=%B", t]), s = n ? ne(n) : null;
1815
1853
  if (s) return s;
1816
- const a = await K(p(e, "CHANGELOG.md")), r = ea(a, t);
1817
- return r ? te(r) : null;
1854
+ const a = await K(p(e, "CHANGELOG.md")), r = aa(a, t);
1855
+ return r ? ne(r) : null;
1818
1856
  }
1819
- async function ra(e, t) {
1857
+ async function da(e, t) {
1820
1858
  const s = (await S(e, ["log", "--format=%H", "--reverse", t])).split(`
1821
- `).map((i) => i.trim()).filter(Boolean), a = await Promise.all(s.map((i) => aa(e, i))), r = /* @__PURE__ */ new Map();
1859
+ `).map((i) => i.trim()).filter(Boolean), a = await Promise.all(s.map((i) => ca(e, i))), r = /* @__PURE__ */ new Map();
1822
1860
  return s.forEach((i, o) => {
1823
1861
  const c = a[o];
1824
1862
  if (!c) return;
@@ -1826,15 +1864,15 @@ async function ra(e, t) {
1826
1864
  u ? u.push(i) : r.set(c, [i]);
1827
1865
  }), r;
1828
1866
  }
1829
- async function Zr(e, t) {
1867
+ async function ni(e, t) {
1830
1868
  const [{ entries: n }, s, a, r, i, o] = await Promise.all([
1831
1869
  x(p(e, "papercamp", "ideas")),
1832
- tt(e),
1870
+ nt(e),
1833
1871
  K(p(e, "papercamp", "tasks.log")),
1834
1872
  K(p(e, "CHANGELOG.md")),
1835
- sa(e, t),
1836
- Ke(e)
1837
- ]), c = n.find((h) => h.id === t), u = s == null ? void 0 : s.get(t), l = ds(a).filter((h) => h.planId === t), f = bt(r, t);
1873
+ oa(e, t),
1874
+ We(e)
1875
+ ]), c = n.find((h) => h.id === t), u = s == null ? void 0 : s.get(t), l = ps(a).filter((h) => h.planId === t), f = St(r, t);
1838
1876
  return {
1839
1877
  id: t,
1840
1878
  idea: c ? {
@@ -1852,27 +1890,27 @@ async function Zr(e, t) {
1852
1890
  releaseLine: f ? { reached: !0, data: f } : { reached: !1 }
1853
1891
  };
1854
1892
  }
1855
- const B = /^##\s+/, ia = /^##\s+The goal\s*$/i, vt = /^##\s+(Horizon\s+\d+\s*[—-].*)\r?$/i, oa = /^##\s+Standing concerns\s*$/i, N = /^-\s+\*\*(.+?)\*\*\s+[—-]\s+(.*)\r?$/, ca = /^\s+-\s+→\s+(.+?)\r?$/, da = /^([A-Z]+-\d+)/, Et = /^\s+-\s+✓\s+shipped\s+(.+?)\r?$/, Ee = /^\s+-\s+(.+?)\r?$/, ke = /^\s+\S/;
1856
- function xe(e, t, n) {
1893
+ const B = /^##\s+/, ua = /^##\s+The goal\s*$/i, $t = /^##\s+(Horizon\s+\d+\s*[—-].*)\r?$/i, la = /^##\s+Standing concerns\s*$/i, T = /^-\s+\*\*(.+?)\*\*\s+[—-]\s+(.*)\r?$/, fa = /^\s+-\s+→\s+(.+?)\r?$/, pa = /^([A-Z]+-\d+)/, It = /^\s+-\s+✓\s+shipped\s+(.+?)\r?$/, Ee = /^\s+-\s+(.+?)\r?$/, ke = /^\s+\S/;
1894
+ function Oe(e, t, n) {
1857
1895
  var r;
1858
1896
  const s = [];
1859
1897
  let a = t;
1860
1898
  for (; a < n; ) {
1861
- const i = e[a].match(N);
1899
+ const i = e[a].match(T);
1862
1900
  if (!i) {
1863
1901
  a++;
1864
1902
  continue;
1865
1903
  }
1866
1904
  const o = [i[2].trim()], c = [], u = [];
1867
1905
  let l;
1868
- for (a++; a < n && !N.test(e[a]); ) {
1869
- const f = e[a].match(ca);
1906
+ for (a++; a < n && !T.test(e[a]); ) {
1907
+ const f = e[a].match(fa);
1870
1908
  if (f) {
1871
1909
  const w = f[1].trim();
1872
- u.push(((r = w.match(da)) == null ? void 0 : r[1]) ?? w), a++;
1910
+ u.push(((r = w.match(pa)) == null ? void 0 : r[1]) ?? w), a++;
1873
1911
  continue;
1874
1912
  }
1875
- const h = e[a].match(Et);
1913
+ const h = e[a].match(It);
1876
1914
  if (h) {
1877
1915
  l = h[1].trim(), a++;
1878
1916
  continue;
@@ -1895,46 +1933,46 @@ function xe(e, t, n) {
1895
1933
  }
1896
1934
  return s;
1897
1935
  }
1898
- function ua(e) {
1936
+ function ha(e) {
1899
1937
  const t = e.split(`
1900
1938
  `);
1901
1939
  let n = "";
1902
1940
  const s = [];
1903
1941
  let a = [];
1904
1942
  for (let r = 0; r < t.length; r++) {
1905
- if (ia.test(t[r])) {
1943
+ if (ua.test(t[r])) {
1906
1944
  let o = r + 1;
1907
1945
  for (; o < t.length && !B.test(t[o]); ) o++;
1908
1946
  n = t.slice(r + 1, o).join(`
1909
1947
  `).trim(), r = o - 1;
1910
1948
  continue;
1911
1949
  }
1912
- const i = t[r].match(vt);
1950
+ const i = t[r].match($t);
1913
1951
  if (i) {
1914
1952
  let o = r + 1;
1915
1953
  for (; o < t.length && !B.test(t[o]); ) o++;
1916
1954
  let c = r + 1;
1917
- for (; c < o && !N.test(t[c]); ) c++;
1955
+ for (; c < o && !T.test(t[c]); ) c++;
1918
1956
  const u = t.slice(r + 1, c).join(`
1919
1957
  `).trim();
1920
1958
  s.push({
1921
1959
  title: i[1].trim(),
1922
1960
  intro: u,
1923
- items: xe(t, r + 1, o)
1961
+ items: Oe(t, r + 1, o)
1924
1962
  }), r = o - 1;
1925
1963
  continue;
1926
1964
  }
1927
- if (oa.test(t[r])) {
1965
+ if (la.test(t[r])) {
1928
1966
  let o = r + 1;
1929
1967
  for (; o < t.length && !B.test(t[o]); ) o++;
1930
- a = xe(t, r + 1, o), r = o - 1;
1968
+ a = Oe(t, r + 1, o), r = o - 1;
1931
1969
  }
1932
1970
  }
1933
1971
  return { goal: n, horizons: s, standingConcerns: a };
1934
1972
  }
1935
1973
  function W(e, t) {
1936
1974
  for (let n = 0; n < e.length; n++) {
1937
- const s = e[n].match(vt);
1975
+ const s = e[n].match($t);
1938
1976
  if (!s || s[1].trim() !== t) continue;
1939
1977
  let a = n + 1;
1940
1978
  for (; a < e.length && !B.test(e[a]); ) a++;
@@ -1945,15 +1983,15 @@ function O(e, t, n) {
1945
1983
  const s = W(e, t);
1946
1984
  if (s)
1947
1985
  for (let a = s.start; a < s.end; a++) {
1948
- const r = e[a].match(N);
1986
+ const r = e[a].match(T);
1949
1987
  if (!r || r[1].trim() !== n) continue;
1950
1988
  let i = a + 1;
1951
- for (; i < s.end && !N.test(e[i]) && ke.test(e[i]); )
1989
+ for (; i < s.end && !T.test(e[i]) && ke.test(e[i]); )
1952
1990
  i++;
1953
1991
  return { start: a, end: i };
1954
1992
  }
1955
1993
  }
1956
- function Qr(e, t, n, s) {
1994
+ function si(e, t, n, s) {
1957
1995
  const a = e.split(`
1958
1996
  `), r = O(a, t, n);
1959
1997
  if (!r) return e;
@@ -1968,12 +2006,12 @@ function Qr(e, t, n, s) {
1968
2006
  }
1969
2007
  return e;
1970
2008
  }
1971
- function ei(e, t, n, s) {
2009
+ function ai(e, t, n, s) {
1972
2010
  var u, l;
1973
2011
  const a = e.split(`
1974
2012
  `), r = O(a, t, n);
1975
2013
  if (!r) return e;
1976
- const i = a[r.start].match(N);
2014
+ const i = a[r.start].match(T);
1977
2015
  if (!i) return e;
1978
2016
  const o = ((u = s.name) == null ? void 0 : u.trim()) ?? i[1].trim(), c = ((l = s.description) == null ? void 0 : l.trim()) ?? i[2].trim();
1979
2017
  if (a[r.start] = `- **${o}** — ${c}`, s.description !== void 0)
@@ -1982,7 +2020,7 @@ function ei(e, t, n, s) {
1982
2020
  return a.join(`
1983
2021
  `);
1984
2022
  }
1985
- function ti(e, t, n, s) {
2023
+ function ri(e, t, n, s) {
1986
2024
  if (t === s) return e;
1987
2025
  const a = e.split(`
1988
2026
  `), r = O(a, t, n);
@@ -1994,20 +2032,20 @@ function ti(e, t, n, s) {
1994
2032
  return a.splice(c, 0, ...i), a.join(`
1995
2033
  `);
1996
2034
  }
1997
- function ni(e, t, n, s) {
2035
+ function ii(e, t, n, s) {
1998
2036
  const a = e.split(`
1999
2037
  `), r = O(a, t, n);
2000
2038
  if (!r) return e;
2001
2039
  let i = r.end;
2002
2040
  for (let o = r.start + 1; o < i; o++)
2003
- if (Et.test(a[o])) {
2041
+ if (It.test(a[o])) {
2004
2042
  a.splice(o, 1), i--;
2005
2043
  break;
2006
2044
  }
2007
2045
  return s !== void 0 && a.splice(i, 0, ` - ✓ shipped ${s}`), a.join(`
2008
2046
  `);
2009
2047
  }
2010
- function si(e, t, n, s) {
2048
+ function oi(e, t, n, s) {
2011
2049
  const a = e.split(`
2012
2050
  `), r = W(a, t);
2013
2051
  if (!r) return e;
@@ -2016,25 +2054,25 @@ function si(e, t, n, s) {
2016
2054
  return a.splice(i, 0, `- **${n}** — ${s}`), a.join(`
2017
2055
  `);
2018
2056
  }
2019
- function ai(e, t, n, s) {
2057
+ function ci(e, t, n, s) {
2020
2058
  const a = e.split(`
2021
2059
  `), r = O(a, t, n);
2022
2060
  return r ? (a.splice(r.end, 0, ` - ${s}`), a.join(`
2023
2061
  `)) : e;
2024
2062
  }
2025
- function ri(e, t, n, s) {
2063
+ function di(e, t, n, s) {
2026
2064
  const a = e.split(`
2027
2065
  `), r = O(a, t, n);
2028
2066
  return r ? (a.splice(r.end, 0, ` - → ${s}`), a.join(`
2029
2067
  `)) : e;
2030
2068
  }
2031
- function kt(e) {
2069
+ function At(e) {
2032
2070
  return [
2033
2071
  ...e.horizons.flatMap((t) => t.items.map((n) => n.name)),
2034
2072
  ...e.standingConcerns.map((t) => t.name)
2035
2073
  ];
2036
2074
  }
2037
- function la(e, t, n, s) {
2075
+ function ma(e, t, n, s) {
2038
2076
  const a = /* @__PURE__ */ new Map();
2039
2077
  for (const r of t)
2040
2078
  r.id && r.subject === e.name && a.set(r.id, r);
@@ -2047,23 +2085,23 @@ function la(e, t, n, s) {
2047
2085
  title: i.title,
2048
2086
  status: i.status,
2049
2087
  pr: i.pr,
2050
- released: bt(s, r) !== void 0
2088
+ released: St(s, r) !== void 0
2051
2089
  }));
2052
2090
  }
2053
- function fa(e) {
2091
+ function ga(e) {
2054
2092
  const t = e.filter((s) => s.status !== "dropped"), n = t.filter((s) => s.status === "done").length;
2055
2093
  return { total: t.length, done: n, open: t.length - n };
2056
2094
  }
2057
- function pa(e, t) {
2095
+ function ya(e, t) {
2058
2096
  return e.shippedOn !== void 0 ? { state: "shipped", readyToShip: !1 } : t.total === 0 ? { state: "not-started", readyToShip: !1 } : { state: "in-progress", readyToShip: t.done === t.total };
2059
2097
  }
2060
- function Oe(e, t, n, s) {
2061
- const a = la(e, t, n, s), r = fa(a), { state: i, readyToShip: o } = pa(e, r);
2098
+ function De(e, t, n, s) {
2099
+ const a = ma(e, t, n, s), r = ga(a), { state: i, readyToShip: o } = ya(e, r);
2062
2100
  return { ...e, ideas: a, rollup: r, state: i, readyToShip: o };
2063
2101
  }
2064
- function ii(e, t, n = "") {
2102
+ function ui(e, t, n = "") {
2065
2103
  const s = new Map(t.filter((c) => c.id).map((c) => [c.id, c])), a = e.horizons.map((c) => {
2066
- const u = c.items.map((f) => Oe(f, t, s, n)), l = u.reduce(
2104
+ const u = c.items.map((f) => De(f, t, s, n)), l = u.reduce(
2067
2105
  (f, h) => ({
2068
2106
  total: f.total + h.rollup.total,
2069
2107
  done: f.done + h.rollup.done,
@@ -2073,13 +2111,13 @@ function ii(e, t, n = "") {
2073
2111
  );
2074
2112
  return { title: c.title, intro: c.intro, items: u, rollup: l };
2075
2113
  }), r = e.standingConcerns.map(
2076
- (c) => Oe(c, t, s, n)
2077
- ), i = new Set(kt(e)), o = t.filter(
2114
+ (c) => De(c, t, s, n)
2115
+ ), i = new Set(At(e)), o = t.filter(
2078
2116
  (c) => !c.subject || !i.has(c.subject)
2079
2117
  );
2080
2118
  return { goal: e.goal, horizons: a, standingConcerns: r, unfiled: o };
2081
2119
  }
2082
- function ha(e) {
2120
+ function wa(e) {
2083
2121
  const t = JSON.stringify({
2084
2122
  body: e.body,
2085
2123
  phases: e.phases.map((n) => ({
@@ -2089,7 +2127,7 @@ function ha(e) {
2089
2127
  source: n.source ?? null
2090
2128
  }))
2091
2129
  });
2092
- return Yt("sha256").update(t).digest("hex");
2130
+ return Wt("sha256").update(t).digest("hex");
2093
2131
  }
2094
2132
  const Se = /* @__PURE__ */ new Set([
2095
2133
  "core",
@@ -2111,10 +2149,10 @@ const Se = /* @__PURE__ */ new Set([
2111
2149
  "release",
2112
2150
  "main"
2113
2151
  ]);
2114
- function ma(e, t) {
2152
+ function ba(e, t) {
2115
2153
  return (e == null ? void 0 : e.find((n) => Se.has(n))) ?? t;
2116
2154
  }
2117
- function St(e, t) {
2155
+ function Rt(e, t) {
2118
2156
  return new Promise((n) => {
2119
2157
  var r, i;
2120
2158
  const s = b(
@@ -2142,8 +2180,8 @@ function St(e, t) {
2142
2180
  }), s.on("error", () => n(void 0));
2143
2181
  });
2144
2182
  }
2145
- const ga = 6e4;
2146
- function oi(e, t, n = ga) {
2183
+ const va = 6e4;
2184
+ function li(e, t, n = va) {
2147
2185
  return new Promise((s) => {
2148
2186
  var i, o;
2149
2187
  const a = b("gh", ["pr", "diff", t], { cwd: e, stdio: ["ignore", "pipe", "pipe"] });
@@ -2163,45 +2201,45 @@ function oi(e, t, n = ga) {
2163
2201
  }), a.on("error", () => s(void 0));
2164
2202
  });
2165
2203
  }
2166
- async function ya(e, t) {
2204
+ async function Ea(e, t) {
2167
2205
  for (const n of ["ideas", p("ideas", "archive")]) {
2168
2206
  const s = p(e, "papercamp", n, `${t}.md`);
2169
2207
  try {
2170
- return await jt(s), s;
2208
+ return await Ht(s), s;
2171
2209
  } catch {
2172
2210
  }
2173
2211
  }
2174
2212
  return null;
2175
2213
  }
2176
- async function C(e, t) {
2177
- const n = await St(e, t), s = ze(n == null ? void 0 : n.body, (n == null ? void 0 : n.headRefName) ?? t);
2214
+ async function _(e, t) {
2215
+ const n = await Rt(e, t), s = Ve(n == null ? void 0 : n.body, (n == null ? void 0 : n.headRefName) ?? t);
2178
2216
  if (!s) return;
2179
- const a = await ya(e, s);
2217
+ const a = await Ea(e, s);
2180
2218
  if (!a) return;
2181
- const { entries: r } = dt(await v(a, "utf-8")), i = r[0];
2219
+ const { entries: r } = ut(await v(a, "utf-8")), i = r[0];
2182
2220
  if (i)
2183
2221
  return { id: s, view: n, entry: i };
2184
2222
  }
2185
- async function ci(e, t) {
2186
- const n = await C(e, t);
2223
+ async function fi(e, t) {
2224
+ const n = await _(e, t);
2187
2225
  if (!n) return;
2188
2226
  const { id: s, entry: a } = n;
2189
2227
  return { id: s, kind: a.type, tags: a.tags, phases: a.phases };
2190
2228
  }
2191
- const $t = "<!-- papercamp:phases:start -->", It = "<!-- papercamp:phases:end -->", De = new RegExp(`${$t}[\\s\\S]*?${It}`);
2192
- function wa(e, t) {
2229
+ const Pt = "<!-- papercamp:phases:start -->", Ct = "<!-- papercamp:phases:end -->", je = new RegExp(`${Pt}[\\s\\S]*?${Ct}`);
2230
+ function ka(e, t) {
2193
2231
  const n = t.map((r) => `- [${r.done ? "x" : " "}] ${r.text}`).join(`
2194
- `), s = `${$t}
2232
+ `), s = `${Pt}
2195
2233
  ### Phases
2196
2234
  ${n}
2197
- ${It}`;
2198
- if (De.test(e)) return e.replace(De, () => s);
2235
+ ${Ct}`;
2236
+ if (je.test(e)) return e.replace(je, () => s);
2199
2237
  const a = e.trimEnd();
2200
2238
  return a.length > 0 ? `${a}
2201
2239
 
2202
2240
  ${s}` : s;
2203
2241
  }
2204
- function ba(e, t, n) {
2242
+ function Sa(e, t, n) {
2205
2243
  return new Promise((s) => {
2206
2244
  var r, i;
2207
2245
  const a = b("gh", ["pr", "edit", t, "--body-file", "-"], {
@@ -2212,20 +2250,20 @@ function ba(e, t, n) {
2212
2250
  }), a.on("close", (o) => s(o === 0)), a.on("error", () => s(!1)), (i = a.stdin) == null || i.end(n);
2213
2251
  });
2214
2252
  }
2215
- async function di(e, t) {
2216
- const n = await C(e, t);
2253
+ async function pi(e, t) {
2254
+ const n = await _(e, t);
2217
2255
  if (!(n != null && n.view)) return "unresolved";
2218
- const { view: s, entry: a } = n, r = wa(s.body, a.phases);
2219
- return r === s.body ? "unchanged" : await ba(e, t, r) ? "updated" : "unresolved";
2256
+ const { view: s, entry: a } = n, r = ka(s.body, a.phases);
2257
+ return r === s.body ? "unchanged" : await Sa(e, t, r) ? "updated" : "unresolved";
2220
2258
  }
2221
- function va(e) {
2259
+ function $a(e) {
2222
2260
  const t = /* @__PURE__ */ new Set();
2223
2261
  e.kind && t.add(e.kind);
2224
2262
  for (const n of e.tags)
2225
2263
  Se.has(n) && t.add(n);
2226
2264
  return [...t];
2227
2265
  }
2228
- function Ea(e) {
2266
+ function Ia(e) {
2229
2267
  return new Promise((t) => {
2230
2268
  var a, r;
2231
2269
  const n = b("gh", ["label", "list", "--limit", "200", "--json", "name"], {
@@ -2250,7 +2288,7 @@ function Ea(e) {
2250
2288
  }), n.on("error", () => t(void 0));
2251
2289
  });
2252
2290
  }
2253
- function ka(e, t) {
2291
+ function Aa(e, t) {
2254
2292
  return new Promise((n) => {
2255
2293
  var a;
2256
2294
  const s = b("gh", ["label", "create", t, "--color", "ededed"], {
@@ -2261,7 +2299,7 @@ function ka(e, t) {
2261
2299
  }), s.on("close", (r) => n(r === 0)), s.on("error", () => n(!1));
2262
2300
  });
2263
2301
  }
2264
- function Sa(e, t, n) {
2302
+ function Ra(e, t, n) {
2265
2303
  return new Promise((s) => {
2266
2304
  var r;
2267
2305
  const a = b("gh", ["pr", "edit", t, "--add-label", n.join(",")], {
@@ -2272,29 +2310,29 @@ function Sa(e, t, n) {
2272
2310
  }), a.on("close", (i) => s(i === 0)), a.on("error", () => s(!1));
2273
2311
  });
2274
2312
  }
2275
- async function ui(e, t) {
2276
- const n = await C(e, t);
2313
+ async function hi(e, t) {
2314
+ const n = await _(e, t);
2277
2315
  if (!(n != null && n.view)) return "unresolved";
2278
- const { view: s, entry: a } = n, r = va({ kind: a.type, tags: a.tags }), i = new Set((s.labels ?? []).map((l) => l.name)), o = r.filter((l) => !i.has(l));
2316
+ const { view: s, entry: a } = n, r = $a({ kind: a.type, tags: a.tags }), i = new Set((s.labels ?? []).map((l) => l.name)), o = r.filter((l) => !i.has(l));
2279
2317
  if (o.length === 0) return "unchanged";
2280
- const c = await Ea(e);
2318
+ const c = await Ia(e);
2281
2319
  if (c) {
2282
2320
  const l = o.filter((f) => !c.has(f));
2283
2321
  for (const f of l)
2284
- await ka(e, f);
2322
+ await Aa(e, f);
2285
2323
  }
2286
- return await Sa(e, t, o) ? "updated" : "unresolved";
2324
+ return await Ra(e, t, o) ? "updated" : "unresolved";
2287
2325
  }
2288
- function Rt(e, t) {
2289
- const n = t.type ?? "feat", s = ma(t.tags, "repo");
2326
+ function _t(e, t) {
2327
+ const n = t.type ?? "feat", s = ba(t.tags, "repo");
2290
2328
  return `${n}(${s}): ${t.title} (${e})`;
2291
2329
  }
2292
- const $a = new RegExp(`^(${Bt.join("|")})\\(([a-z-]+)\\): .+$`);
2293
- function Ia(e) {
2294
- const t = e.match($a);
2330
+ const Pa = new RegExp(`^(${Kt.join("|")})\\(([a-z-]+)\\): .+$`);
2331
+ function Ca(e) {
2332
+ const t = e.match(Pa);
2295
2333
  return !!t && Se.has(t[2]);
2296
2334
  }
2297
- function Ra(e, t, n) {
2335
+ function _a(e, t, n) {
2298
2336
  return new Promise((s) => {
2299
2337
  var r;
2300
2338
  const a = b("gh", ["pr", "edit", t, "--title", n], {
@@ -2305,19 +2343,19 @@ function Ra(e, t, n) {
2305
2343
  }), a.on("close", (i) => s(i === 0)), a.on("error", () => s(!1));
2306
2344
  });
2307
2345
  }
2308
- async function li(e, t) {
2309
- const n = await C(e, t);
2346
+ async function mi(e, t) {
2347
+ const n = await _(e, t);
2310
2348
  if (!(n != null && n.view)) return "unresolved";
2311
- const { id: s, view: a, entry: r } = n, i = Rt(s, r);
2312
- return a.title === i ? "unchanged" : await Ra(e, t, i) ? "updated" : "unresolved";
2349
+ const { id: s, view: a, entry: r } = n, i = _t(s, r);
2350
+ return a.title === i ? "unchanged" : await _a(e, t, i) ? "updated" : "unresolved";
2313
2351
  }
2314
- async function fi(e, t) {
2315
- const n = await St(e, t);
2352
+ async function gi(e, t) {
2353
+ const n = await Rt(e, t);
2316
2354
  if (!n) return "no-pr";
2317
- const s = await C(e, t);
2318
- return s ? n.title === Rt(s.id, s.entry) ? "valid" : "invalid" : Ia(n.title) ? "valid" : "invalid";
2355
+ const s = await _(e, t);
2356
+ return s ? n.title === _t(s.id, s.entry) ? "valid" : "invalid" : Ca(n.title) ? "valid" : "invalid";
2319
2357
  }
2320
- function pi(e, t) {
2358
+ function yi(e, t) {
2321
2359
  return new Promise((n) => {
2322
2360
  var r;
2323
2361
  const s = b("gh", ["pr", "merge", t, "--squash"], {
@@ -2335,7 +2373,7 @@ function pi(e, t) {
2335
2373
  }), s.on("error", (i) => n({ ok: !1, message: i.message }));
2336
2374
  });
2337
2375
  }
2338
- function Aa(e, t) {
2376
+ function Na(e, t) {
2339
2377
  return new Promise((n) => {
2340
2378
  var a;
2341
2379
  const s = b("gh", ["pr", "ready", t], {
@@ -2346,7 +2384,7 @@ function Aa(e, t) {
2346
2384
  }), s.on("close", (r) => n(r === 0)), s.on("error", () => n(!1));
2347
2385
  });
2348
2386
  }
2349
- function Pa(e, t) {
2387
+ function Ta(e, t) {
2350
2388
  return new Promise((n) => {
2351
2389
  var a;
2352
2390
  const s = b("gh", ["pr", "close", t], {
@@ -2357,14 +2395,14 @@ function Pa(e, t) {
2357
2395
  }), s.on("close", (r) => n(r === 0)), s.on("error", () => n(!1));
2358
2396
  });
2359
2397
  }
2360
- async function hi(e, t) {
2361
- const n = await C(e, t);
2398
+ async function wi(e, t) {
2399
+ const n = await _(e, t);
2362
2400
  if (!(n != null && n.view)) return "unresolved";
2363
2401
  const { view: s, entry: a } = n;
2364
- return a.status === "dropped" ? s.state !== "OPEN" ? "unchanged" : await Pa(e, t) ? "closed" : "unresolved" : !(a.phases.length > 0 && a.phases.every((o) => o.done)) || !s.isDraft ? "unchanged" : await Aa(e, t) ? "ready" : "unresolved";
2402
+ return a.status === "dropped" ? s.state !== "OPEN" ? "unchanged" : await Ta(e, t) ? "closed" : "unresolved" : !(a.phases.length > 0 && a.phases.every((o) => o.done)) || !s.isDraft ? "unchanged" : await Na(e, t) ? "ready" : "unresolved";
2365
2403
  }
2366
- const At = "<!-- papercamp:consistency:start -->", Ca = "<!-- papercamp:consistency:end -->";
2367
- function _a(e, t) {
2404
+ const Nt = "<!-- papercamp:consistency:start -->", xa = "<!-- papercamp:consistency:end -->";
2405
+ function Oa(e, t) {
2368
2406
  const n = ["### Paper Camp checks", ""];
2369
2407
  if (e.length === 0)
2370
2408
  n.push("No consistency issues found.");
@@ -2373,12 +2411,12 @@ function _a(e, t) {
2373
2411
  n.push(`- **${s.kind}** (${s.section}): ${s.message}`);
2374
2412
  return t && (n.push(""), n.push(
2375
2413
  t.stale ? `Convergence audit: last run \`${t.audited}\`, plan has changed since — due for a re-audit.` : `Convergence audit: last run \`${t.audited}\`, still current.`
2376
- )), `${At}
2414
+ )), `${Nt}
2377
2415
  ${n.join(`
2378
2416
  `)}
2379
- ${Ca}`;
2417
+ ${xa}`;
2380
2418
  }
2381
- function Ta(e, t, n) {
2419
+ function Da(e, t, n) {
2382
2420
  return new Promise((s) => {
2383
2421
  var r, i;
2384
2422
  const a = b("gh", ["pr", "comment", t, "--body-file", "-"], {
@@ -2389,7 +2427,7 @@ function Ta(e, t, n) {
2389
2427
  }), a.on("close", (o) => s(o === 0)), a.on("error", () => s(!1)), (i = a.stdin) == null || i.end(n);
2390
2428
  });
2391
2429
  }
2392
- function Na(e, t, n, s, a) {
2430
+ function ja(e, t, n, s, a) {
2393
2431
  return new Promise((r) => {
2394
2432
  var o, c;
2395
2433
  const i = b(
@@ -2408,67 +2446,67 @@ function Na(e, t, n, s, a) {
2408
2446
  }), i.on("close", (u) => r(u === 0)), i.on("error", () => r(!1)), (c = i.stdin) == null || c.end(a);
2409
2447
  });
2410
2448
  }
2411
- async function mi(e, t) {
2449
+ async function bi(e, t) {
2412
2450
  var w, y;
2413
- const n = await C(e, t);
2451
+ const n = await _(e, t);
2414
2452
  if (!((w = n == null ? void 0 : n.view) != null && w.url)) return "unresolved";
2415
2453
  const { view: s, entry: a } = n, [{ entries: r }, i] = await Promise.all([
2416
2454
  x(p(e, "papercamp", "ideas")),
2417
2455
  v(p(e, "ROADMAP.md"), "utf-8").catch(() => "")
2418
- ]), o = r.filter((m) => m.kind !== "note").map((m) => qe(m)), c = i ? kt(ua(i)) : [], u = cs(o, c), l = a.audited && a.auditedHash ? {
2456
+ ]), o = r.filter((m) => m.kind !== "note").map((m) => Ue(m)), c = i ? At(ha(i)) : [], u = fs(o, c), l = a.audited && a.auditedHash ? {
2419
2457
  audited: a.audited,
2420
- stale: ha(a) !== a.auditedHash
2421
- } : void 0, f = _a(u, l), h = (s.comments ?? []).find((m) => m.body.includes(At));
2458
+ stale: wa(a) !== a.auditedHash
2459
+ } : void 0, f = Oa(u, l), h = (s.comments ?? []).find((m) => m.body.includes(Nt));
2422
2460
  if (h) {
2423
2461
  if (h.body === f) return "unchanged";
2424
2462
  const m = F(s.url), D = (y = h.url.match(/issuecomment-(\d+)/)) == null ? void 0 : y[1];
2425
- return !m || !D ? "unresolved" : await Na(e, m.owner, m.repo, D, f) ? "updated" : "unresolved";
2463
+ return !m || !D ? "unresolved" : await ja(e, m.owner, m.repo, D, f) ? "updated" : "unresolved";
2426
2464
  }
2427
- return await Ta(e, t, f) ? "created" : "unresolved";
2465
+ return await Da(e, t, f) ? "created" : "unresolved";
2428
2466
  }
2429
- function gi(e, t, n) {
2467
+ function vi(e, t, n) {
2430
2468
  if (!e) return;
2431
2469
  const s = (t ?? "feat").toLowerCase(), a = n.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, ""), r = a.length <= 40 ? a : a[40] === "-" ? a.slice(0, 40) : a.slice(0, 40).replace(/-[^-]*$/, "");
2432
2470
  return `${s}/${e.toLowerCase()}-${r}`;
2433
2471
  }
2434
- function Q(e, t) {
2472
+ function ee(e, t) {
2435
2473
  for (const { entries: n, section: s } of t)
2436
2474
  n && n.length > 0 && e.push(s.formatLines(n).join(`
2437
2475
  `));
2438
2476
  }
2439
- function Pt() {
2477
+ function Tt() {
2440
2478
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
2441
2479
  }
2442
- function yi(e, t = "log", n) {
2480
+ function Ei(e, t = "log", n) {
2443
2481
  return {
2444
2482
  kind: t,
2445
- date: Pt(),
2483
+ date: Tt(),
2446
2484
  text: e,
2447
2485
  from: "agent",
2448
2486
  ...t === "question" ? { state: "open" } : {},
2449
2487
  ...n ? { entityId: n } : {}
2450
2488
  };
2451
2489
  }
2452
- function wi(e) {
2490
+ function ki(e) {
2453
2491
  const t = [`## ${e.title}`, "", `**Status:** ${e.status}`];
2454
2492
  e.kind && t.push(`**Kind:** ${e.kind}`), e.id && t.push(`**Id:** ${e.id}`), e.idea && t.push(`**Idea:** ${e.idea}`), e.agent && t.push(`**Agent:** ${e.agent}`), t.push(`**Created:** ${e.created}`), e.updated && t.push(`**Updated:** ${e.updated}`), e.tags && e.tags.length > 0 && t.push(`**Tags:** ${e.tags.join(", ")}`);
2455
2493
  const n = [t.join(`
2456
2494
  `)];
2457
- return e.body && n.push(e.body), Q(n, [
2458
- { entries: e.clarifications, section: fe },
2495
+ return e.body && n.push(e.body), ee(n, [
2496
+ { entries: e.clarifications, section: pe },
2459
2497
  { entries: e.phases, section: Z },
2460
2498
  { entries: e.log, section: H },
2461
- { entries: e.notes, section: pe }
2499
+ { entries: e.notes, section: he }
2462
2500
  ]), n.join(`
2463
2501
 
2464
2502
  `).trimEnd();
2465
2503
  }
2466
2504
  function $e(e) {
2467
2505
  return `---
2468
- ${Ft(e).trimEnd()}
2506
+ ${Yt(e).trimEnd()}
2469
2507
  ---`;
2470
2508
  }
2471
- function bi(e) {
2509
+ function Si(e) {
2472
2510
  const t = {
2473
2511
  id: e.id,
2474
2512
  title: e.title,
@@ -2478,16 +2516,16 @@ function bi(e) {
2478
2516
  };
2479
2517
  e.idea && (t.idea = e.idea), e.agent && (t.agent = e.agent), e.updated && (t.updated = e.updated), e.audited && (t.audited = e.audited), e.auditedHash && (t["audited-hash"] = e.auditedHash), e.tags && e.tags.length > 0 && (t.tags = e.tags);
2480
2518
  const n = [$e(t)];
2481
- return e.body && n.push(e.body), Q(n, [
2482
- { entries: e.clarifications, section: fe },
2519
+ return e.body && n.push(e.body), ee(n, [
2520
+ { entries: e.clarifications, section: pe },
2483
2521
  { entries: e.phases, section: Z },
2484
2522
  { entries: e.log, section: H },
2485
- { entries: e.notes, section: pe }
2523
+ { entries: e.notes, section: he }
2486
2524
  ]), n.join(`
2487
2525
 
2488
2526
  `).trimEnd();
2489
2527
  }
2490
- function xa(e) {
2528
+ function Ma(e) {
2491
2529
  const t = {
2492
2530
  id: e.id,
2493
2531
  title: e.title
@@ -2496,15 +2534,15 @@ function xa(e) {
2496
2534
  for (const s of Object.keys(e.unknownFrontmatter ?? {}).sort())
2497
2535
  t[s] = e.unknownFrontmatter[s];
2498
2536
  const n = [$e(t)];
2499
- return e.body && n.push(e.body), Q(n, [
2537
+ return e.body && n.push(e.body), ee(n, [
2500
2538
  { entries: e.phases, section: Z },
2501
- { entries: e.fixes, section: rt },
2502
- { entries: e.thread, section: it }
2539
+ { entries: e.fixes, section: it },
2540
+ { entries: e.thread, section: ot }
2503
2541
  ]), n.join(`
2504
2542
 
2505
2543
  `).trimEnd();
2506
2544
  }
2507
- function vi(e) {
2545
+ function $i(e) {
2508
2546
  const t = {
2509
2547
  id: e.id,
2510
2548
  title: e.title
@@ -2513,16 +2551,16 @@ function vi(e) {
2513
2551
  const n = [$e(t)], s = `## ${e.id}: ${e.title}`;
2514
2552
  return n.push(e.body ? `${s}
2515
2553
 
2516
- ${e.body}` : s), Q(n, [{ entries: e.log, section: H }]), n.join(`
2554
+ ${e.body}` : s), ee(n, [{ entries: e.log, section: H }]), n.join(`
2517
2555
 
2518
2556
  `).trimEnd();
2519
2557
  }
2520
- function Ei(e, t) {
2558
+ function Ii(e, t) {
2521
2559
  let n = !1;
2522
2560
  const s = e.split(`
2523
2561
  `).filter((a) => {
2524
2562
  if (!n) {
2525
- const r = a.match(ut);
2563
+ const r = a.match(lt);
2526
2564
  if (r && r[1] === t.date && r[2].trim() === t.title && r[3].trim() === t.description)
2527
2565
  return n = !0, !1;
2528
2566
  }
@@ -2532,7 +2570,7 @@ function Ei(e, t) {
2532
2570
  `) : e;
2533
2571
  }
2534
2572
  let J = Promise.resolve();
2535
- async function Oa(e, t) {
2573
+ async function La(e, t) {
2536
2574
  const n = new RegExp(`^${t.toUpperCase()}-(\\d+)\\.md$`), s = [
2537
2575
  p(e, "ideas"),
2538
2576
  p(e, "ideas", "archive"),
@@ -2554,7 +2592,7 @@ async function Oa(e, t) {
2554
2592
  }
2555
2593
  return a;
2556
2594
  }
2557
- async function Ct(e, t) {
2595
+ async function xt(e, t) {
2558
2596
  const n = J.then(async () => {
2559
2597
  let s = null;
2560
2598
  try {
@@ -2563,20 +2601,20 @@ async function Ct(e, t) {
2563
2601
  return;
2564
2602
  }
2565
2603
  if (!(s != null && s.nextId)) return;
2566
- const a = s.nextId[t] ?? 1, r = await Oa(M(e), t), i = Math.max(a, r + 1), o = `${t.toUpperCase()}-${i}`;
2604
+ const a = s.nextId[t] ?? 1, r = await La(M(e), t), i = Math.max(a, r + 1), o = `${t.toUpperCase()}-${i}`;
2567
2605
  return s.nextId[t] = i + 1, await E(e, `${JSON.stringify(s, null, 2)}
2568
2606
  `), o;
2569
2607
  });
2570
2608
  return J = n.catch(() => {
2571
2609
  }), n;
2572
2610
  }
2573
- async function ki(e) {
2574
- return Ct(e, "idea");
2611
+ async function Ai(e) {
2612
+ return xt(e, "idea");
2575
2613
  }
2576
- async function Si(e) {
2577
- return Ct(e, "ticket");
2614
+ async function Ri(e) {
2615
+ return xt(e, "ticket");
2578
2616
  }
2579
- async function $i(e, t) {
2617
+ async function Pi(e, t) {
2580
2618
  const n = J.then(async () => {
2581
2619
  let s = null;
2582
2620
  try {
@@ -2591,82 +2629,82 @@ async function $i(e, t) {
2591
2629
  return J = n.catch(() => {
2592
2630
  }), n;
2593
2631
  }
2594
- async function Ii(e, t) {
2632
+ async function Ci(e, t) {
2595
2633
  const n = p(e, "papercamp", "ideas"), s = p(n, "archive"), a = p(n, `${t}.md`), r = p(s, `${t}.md`);
2596
2634
  await P(s, { recursive: !0 });
2597
2635
  try {
2598
- return await Fe(a, r), !0;
2636
+ return await He(a, r), !0;
2599
2637
  } catch (i) {
2600
2638
  if (i.code === "ENOENT") return !1;
2601
2639
  throw i;
2602
2640
  }
2603
2641
  }
2604
- async function Ri(e, t) {
2642
+ async function _i(e, t) {
2605
2643
  const n = p(e, "papercamp", "ideas"), s = p(n, "archive", `${t}.md`), a = p(n, `${t}.md`);
2606
2644
  try {
2607
- return await Fe(s, a), !0;
2645
+ return await He(s, a), !0;
2608
2646
  } catch (r) {
2609
2647
  if (r.code === "ENOENT") return !1;
2610
2648
  throw r;
2611
2649
  }
2612
2650
  }
2613
- const Da = [
2651
+ const Fa = [
2614
2652
  ["pnpm-lock.yaml", "pnpm"],
2615
2653
  ["yarn.lock", "yarn"],
2616
2654
  ["bun.lockb", "bun"],
2617
2655
  ["package-lock.json", "npm"]
2618
2656
  ];
2619
- function _t(e) {
2620
- for (const [t, n] of Da)
2621
- if (re(p(e, t))) return n;
2657
+ function Ot(e) {
2658
+ for (const [t, n] of Fa)
2659
+ if (ie(p(e, t))) return n;
2622
2660
  return "npm";
2623
2661
  }
2624
- function ja(e) {
2662
+ function Ha(e) {
2625
2663
  const t = p(e, "package.json");
2626
- if (re(t))
2664
+ if (ie(t))
2627
2665
  try {
2628
- return JSON.parse(He(t, "utf-8"));
2666
+ return JSON.parse(Ge(t, "utf-8"));
2629
2667
  } catch {
2630
2668
  return;
2631
2669
  }
2632
2670
  }
2633
- const je = "@dendelion/paper-camp";
2634
- function Ma(e) {
2635
- const t = ja(e);
2671
+ const Me = "@dendelion/paper-camp";
2672
+ function Ga(e) {
2673
+ const t = Ha(e);
2636
2674
  if (!t) return !1;
2637
2675
  const n = t.dependencies, s = t.devDependencies;
2638
- return !!(n != null && n[je] || s != null && s[je]);
2639
- }
2640
- const La = ["*.json", "*.ts", "*.tsx", "*.md", "*.config.*"], Fa = ["src/**", "app/**", "scripts/**", "papercamp/**"], Ha = ["git status*", "git diff*", "git log*"], Ga = ["ls*", "cat*", "wc*"], Ba = ["run *", "test*", "install*", "view *", "pack*", "ls*"], Ya = ["npx tsc*", "npx biome check*", "npx vitest*", "npx jest*", "npx expo *"];
2641
- function Tt(e) {
2642
- const t = Fa.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), n = La.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), s = [
2643
- ...Ha,
2644
- ...Ga,
2645
- ...Ba.map((a) => `${e} ${a}`),
2646
- ...Ya
2676
+ return !!(n != null && n[Me] || s != null && s[Me]);
2677
+ }
2678
+ const Ba = ["*.json", "*.ts", "*.tsx", "*.md", "*.config.*"], Ya = ["src/**", "app/**", "scripts/**", "papercamp/**"], qa = ["git status*", "git diff*", "git log*"], Ua = ["ls*", "cat*", "wc*"], Ka = ["run *", "test*", "install*", "view *", "pack*", "ls*"], Wa = ["npx tsc*", "npx biome check*", "npx vitest*", "npx jest*", "npx expo *"];
2679
+ function Dt(e) {
2680
+ const t = Ya.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), n = Ba.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), s = [
2681
+ ...qa,
2682
+ ...Ua,
2683
+ ...Ka.map((a) => `${e} ${a}`),
2684
+ ...Wa
2647
2685
  ].map((a) => `Bash(${a})`);
2648
2686
  return [...t, ...n, ...s];
2649
2687
  }
2650
- function qa(e) {
2651
- return e ? `"${Ja}" session-focus` : "paper-camp session-focus";
2688
+ function Ja(e) {
2689
+ return e ? `"${Za}" session-focus` : "paper-camp session-focus";
2652
2690
  }
2653
- function Ua(e, t) {
2691
+ function za(e, t) {
2654
2692
  let n;
2655
2693
  try {
2656
2694
  n = JSON.parse(e);
2657
2695
  } catch {
2658
2696
  return e;
2659
2697
  }
2660
- const s = Tt(_t(t)), a = n.permissions ?? {}, r = Array.isArray(a.allow) ? a.allow : [], i = s.filter((o) => !r.includes(o));
2698
+ const s = Dt(Ot(t)), a = n.permissions ?? {}, r = Array.isArray(a.allow) ? a.allow : [], i = s.filter((o) => !r.includes(o));
2661
2699
  return i.length === 0 && n.permissions !== void 0 ? e : (n.permissions = { ...a, allow: [...r, ...i] }, `${JSON.stringify(n, null, 2)}
2662
2700
  `);
2663
2701
  }
2664
- function Ka(e) {
2665
- const t = _t(e), n = qa(Ma(e));
2702
+ function Va(e) {
2703
+ const t = Ot(e), n = Ja(Ga(e));
2666
2704
  return `${JSON.stringify(
2667
2705
  {
2668
2706
  permissions: {
2669
- allow: Tt(t)
2707
+ allow: Dt(t)
2670
2708
  },
2671
2709
  hooks: {
2672
2710
  SessionStart: [
@@ -2682,7 +2720,7 @@ function Ka(e) {
2682
2720
  )}
2683
2721
  `;
2684
2722
  }
2685
- const Wa = `---
2723
+ const Xa = `---
2686
2724
  name: paper-camp
2687
2725
  description: Work inside a project that has a papercamp/ folder — its unified idea entities (each holding its plan as a section), with decisions and open questions logged as notes on the idea they bind. Use this whenever the working directory contains papercamp/ (papercamp/ideas/), and especially before starting, continuing, or completing any plan phase, drafting an idea, logging a decision, or answering "what are we working on / what's next".
2688
2726
  ---
@@ -2751,14 +2789,14 @@ session start from live plan data, not hand-maintained here. It does
2751
2789
  not define the file formats in full; treat the existing files under
2752
2790
  \`papercamp/\` as the grammar reference (mirror their structure exactly rather
2753
2791
  than inventing a new shape).
2754
- `, Ja = "$CLAUDE_PROJECT_DIR/node_modules/.bin/paper-camp", za = 5;
2755
- function Va() {
2792
+ `, Za = "$CLAUDE_PROJECT_DIR/node_modules/.bin/paper-camp", Qa = 5;
2793
+ function er() {
2756
2794
  try {
2757
- let e = M(qt(import.meta.url));
2758
- for (let t = 0; t < za; t++) {
2795
+ let e = M(Jt(import.meta.url));
2796
+ for (let t = 0; t < Qa; t++) {
2759
2797
  const n = p(e, "package.json");
2760
- if (re(n))
2761
- return JSON.parse(He(n, "utf-8")).version ?? "0.0.0";
2798
+ if (ie(n))
2799
+ return JSON.parse(Ge(n, "utf-8")).version ?? "0.0.0";
2762
2800
  e = M(e);
2763
2801
  }
2764
2802
  return "0.0.0";
@@ -2766,42 +2804,42 @@ function Va() {
2766
2804
  return "0.0.0";
2767
2805
  }
2768
2806
  }
2769
- const Ai = Va();
2770
- class Xa extends Error {
2807
+ const Ni = er();
2808
+ class tr extends Error {
2771
2809
  constructor(t) {
2772
2810
  super(`Paper Camp is already initialized in ${t} (papercamp/config.json exists).`);
2773
2811
  }
2774
2812
  }
2775
- async function _(e) {
2813
+ async function N(e) {
2776
2814
  try {
2777
- return await Mt(e), !0;
2815
+ return await Gt(e), !0;
2778
2816
  } catch {
2779
2817
  return !1;
2780
2818
  }
2781
2819
  }
2782
- const Za = ["suggestions.md"];
2783
- async function Pi(e, t) {
2820
+ const nr = ["suggestions.md"];
2821
+ async function Ti(e, t) {
2784
2822
  const n = p(e, "papercamp"), s = p(n, "config.json");
2785
- if (await _(s))
2786
- throw new Xa(e);
2823
+ if (await N(s))
2824
+ throw new tr(e);
2787
2825
  const a = {
2788
- version: R,
2826
+ version: A,
2789
2827
  projectName: t.projectName,
2790
2828
  initializedAt: (/* @__PURE__ */ new Date()).toISOString(),
2791
2829
  nextId: { idea: 2 }
2792
2830
  };
2793
- Qn.parse(a), await P(n, { recursive: !0 });
2831
+ ss.parse(a), await P(n, { recursive: !0 });
2794
2832
  const r = p(n, "ideas");
2795
2833
  await P(r, { recursive: !0 });
2796
2834
  const i = p(r, "archive");
2797
2835
  await P(i, { recursive: !0 });
2798
2836
  const o = p(r, "IDEA-1.md");
2799
- if (!await _(o)) {
2800
- const c = xa({
2837
+ if (!await N(o)) {
2838
+ const c = Ma({
2801
2839
  id: "IDEA-1",
2802
2840
  title: "Capture your first idea",
2803
2841
  status: "idea",
2804
- created: Pt(),
2842
+ created: Tt(),
2805
2843
  body: `This is an example idea, in the format Paper Camp expects: a short title, a status, and a paragraph of context. Read it, then archive or delete it once you've written your own.
2806
2844
 
2807
2845
  Use the New idea button to capture what you're building next, or ask an agent for suggestions.`
@@ -2809,18 +2847,18 @@ Use the New idea button to capture what you're building next, or ask an agent fo
2809
2847
  await E(o, `${c}
2810
2848
  `, "utf-8");
2811
2849
  }
2812
- for (const c of Za) {
2850
+ for (const c of nr) {
2813
2851
  const u = p(n, c);
2814
- await _(u) || await E(u, "", "utf-8");
2852
+ await N(u) || await E(u, "", "utf-8");
2815
2853
  }
2816
2854
  await E(s, `${JSON.stringify(a, null, 2)}
2817
- `, "utf-8"), await tr(e), await nr(e), await Qa(e, t.projectName);
2855
+ `, "utf-8"), await rr(e), await ir(e), await sr(e, t.projectName);
2818
2856
  }
2819
- async function Qa(e, t) {
2820
- const n = Wt(), s = await Jt(n), { registry: a, created: r } = zt(s, e, t);
2821
- r && await Vt(n, a);
2857
+ async function sr(e, t) {
2858
+ const n = Xt(), s = await Zt(n), { registry: a, created: r } = Qt(s, e, t);
2859
+ r && await en(n, a);
2822
2860
  }
2823
- const er = [
2861
+ const ar = [
2824
2862
  "papercamp/.pairing.json",
2825
2863
  "papercamp/.task-logs/",
2826
2864
  "papercamp/tasks.log",
@@ -2830,9 +2868,9 @@ const er = [
2830
2868
  "papercamp/night.json",
2831
2869
  "papercamp/run-order.md"
2832
2870
  ];
2833
- async function tr(e) {
2834
- const t = p(e, ".gitignore"), n = await _(t) ? await v(t, "utf-8") : "", s = n.length > 0 ? n.split(`
2835
- `) : [], a = new Set(s.map((o) => o.trim())), r = er.filter((o) => !a.has(o));
2871
+ async function rr(e) {
2872
+ const t = p(e, ".gitignore"), n = await N(t) ? await v(t, "utf-8") : "", s = n.length > 0 ? n.split(`
2873
+ `) : [], a = new Set(s.map((o) => o.trim())), r = ar.filter((o) => !a.has(o));
2836
2874
  if (r.length === 0) return;
2837
2875
  const i = s.reduce(
2838
2876
  (o, c, u) => c.startsWith("papercamp/") ? u : o,
@@ -2850,46 +2888,46 @@ async function tr(e) {
2850
2888
  s.splice(i + 1, 0, ...r), await E(t, s.join(`
2851
2889
  `), "utf-8");
2852
2890
  }
2853
- async function nr(e) {
2891
+ async function ir(e) {
2854
2892
  const t = p(e, ".claude", "skills", "paper-camp");
2855
2893
  await P(t, { recursive: !0 });
2856
2894
  const n = p(t, "SKILL.md");
2857
- await _(n) || await E(n, Wa, "utf-8");
2895
+ await N(n) || await E(n, Xa, "utf-8");
2858
2896
  const s = p(e, ".claude");
2859
2897
  await P(s, { recursive: !0 });
2860
2898
  const a = p(s, "settings.json");
2861
- if (await _(a)) {
2862
- const r = await v(a, "utf-8"), i = Ua(r, e);
2899
+ if (await N(a)) {
2900
+ const r = await v(a, "utf-8"), i = za(r, e);
2863
2901
  i !== r && await E(a, i, "utf-8");
2864
2902
  } else
2865
- await E(a, Ka(e), "utf-8");
2903
+ await E(a, Va(e), "utf-8");
2866
2904
  }
2867
- const Nt = {
2905
+ const jt = {
2868
2906
  feat: "Features",
2869
2907
  fix: "Bug Fixes",
2870
2908
  refactor: "Code Refactoring",
2871
2909
  docs: "Documentation",
2872
2910
  chore: "Miscellaneous"
2873
- }, sr = Array.from(new Set(Object.values(Nt)));
2874
- async function Ci(e, t) {
2875
- const n = await K(p(e, "CHANGELOG.md")), s = Qs(n).find((o) => o.version === t);
2911
+ }, or = Array.from(new Set(Object.values(jt)));
2912
+ async function xi(e, t) {
2913
+ const n = await K(p(e, "CHANGELOG.md")), s = sa(n).find((o) => o.version === t);
2876
2914
  if (!s) return null;
2877
2915
  const [{ entries: a }, r] = await Promise.all([
2878
2916
  x(p(e, "papercamp", "ideas")),
2879
- ra(e, s.range)
2917
+ da(e, s.range)
2880
2918
  ]), i = /* @__PURE__ */ new Map();
2881
2919
  for (const o of r.keys()) {
2882
2920
  const c = a.find((f) => f.id === o);
2883
2921
  if (!c) continue;
2884
- const u = Nt[c.type ?? "chore"], l = i.get(u) ?? [];
2922
+ const u = jt[c.type ?? "chore"], l = i.get(u) ?? [];
2885
2923
  l.push({ id: c.id, title: c.title }), i.set(u, l);
2886
2924
  }
2887
- return sr.filter((o) => i.has(o)).map((o) => ({
2925
+ return or.filter((o) => i.has(o)).map((o) => ({
2888
2926
  label: o,
2889
2927
  ideas: i.get(o)
2890
2928
  }));
2891
2929
  }
2892
- function _i(e, t) {
2930
+ function Oi(e, t) {
2893
2931
  const n = [`## ${e}`];
2894
2932
  for (const s of t) {
2895
2933
  n.push("", `### ${s.label}`, "");
@@ -2899,76 +2937,76 @@ function _i(e, t) {
2899
2937
  return n.join(`
2900
2938
  `);
2901
2939
  }
2902
- function ar(e) {
2940
+ function cr(e) {
2903
2941
  return Math.floor((Date.now() - Date.parse(e)) / 864e5);
2904
2942
  }
2905
- const xt = (e, t) => e === "question" && (t ?? "open") === "open", Ot = (e) => !!e.archived || e.status === "done" || e.status === "dropped";
2906
- function rr(e) {
2907
- return e.filter((t) => !Ot(t)).flatMap(
2908
- (t) => (t.thread ?? []).filter((n) => xt(n.kind, n.state)).map((n) => ({
2943
+ const Mt = (e, t) => e === "question" && (t ?? "open") === "open", Lt = (e) => !!e.archived || e.status === "done" || e.status === "dropped";
2944
+ function dr(e) {
2945
+ return e.filter((t) => !Lt(t)).flatMap(
2946
+ (t) => (t.thread ?? []).filter((n) => Mt(n.kind, n.state)).map((n) => ({
2909
2947
  entityId: t.id,
2910
2948
  entityTitle: t.title,
2911
2949
  text: n.text,
2912
2950
  date: n.date,
2913
- ageDays: n.date ? ar(n.date) : Number.POSITIVE_INFINITY
2951
+ ageDays: n.date ? cr(n.date) : Number.POSITIVE_INFINITY
2914
2952
  }))
2915
2953
  ).sort((t, n) => n.ageDays - t.ageDays);
2916
2954
  }
2917
- async function Ti(e) {
2955
+ async function Di(e) {
2918
2956
  const { entries: t } = await x(e);
2919
- return rr(t);
2957
+ return dr(t);
2920
2958
  }
2921
- function Ni(e, t) {
2922
- const n = new Set(t.filter(Ot).map((s) => s.id));
2923
- return e.map((s) => xt(s.kind, s.state) && s.entityId && n.has(s.entityId) ? { ...s, state: "resolved" } : s);
2959
+ function ji(e, t) {
2960
+ const n = new Set(t.filter(Lt).map((s) => s.id));
2961
+ return e.map((s) => Mt(s.kind, s.state) && s.entityId && n.has(s.entityId) ? { ...s, state: "resolved" } : s);
2924
2962
  }
2925
- const se = 0.95, Dt = 3e4, ae = {
2963
+ const ae = 0.95, Ft = 3e4, re = {
2926
2964
  implement: { from: 0, to: 0.6 },
2927
2965
  verify: { from: 0.6, to: 0.9 },
2928
2966
  checkbox: { from: 0.95, to: 0.95 }
2929
- }, Me = {
2967
+ }, Le = {
2930
2968
  implement: 0,
2931
2969
  verify: 1,
2932
2970
  checkbox: 2
2933
2971
  };
2934
- function Le(e, ...t) {
2972
+ function Fe(e, ...t) {
2935
2973
  for (const n of t)
2936
2974
  if (typeof (e == null ? void 0 : e[n]) == "string") return e[n];
2937
2975
  return "";
2938
2976
  }
2939
- function xi(e, t) {
2977
+ function Mi(e, t) {
2940
2978
  const n = e.toLowerCase();
2941
2979
  if (n === "bash")
2942
2980
  return (typeof (t == null ? void 0 : t.command) == "string" ? t.command : "").includes("check-types") ? "verify" : null;
2943
2981
  if (n === "edit" || n === "multiedit" || n === "write") {
2944
- const s = Le(t, "old_string", "oldString"), a = Le(t, "new_string", "newString");
2982
+ const s = Fe(t, "old_string", "oldString"), a = Fe(t, "new_string", "newString");
2945
2983
  return s.includes("- [ ]") && a.includes("- [x]") ? "checkbox" : "implement";
2946
2984
  }
2947
2985
  return null;
2948
2986
  }
2949
- function Oi(e, t) {
2950
- return e ? Me[t] > Me[e] ? t : e : t;
2987
+ function Li(e, t) {
2988
+ return e ? Le[t] > Le[e] ? t : e : t;
2951
2989
  }
2952
- function Di(e, t) {
2953
- return e === void 0 ? !1 : t - e >= Dt;
2990
+ function Fi(e, t) {
2991
+ return e === void 0 ? !1 : t - e >= Ft;
2954
2992
  }
2955
- function ir(e) {
2993
+ function ur(e) {
2956
2994
  const t = [...e].sort((s, a) => s - a), n = Math.floor(t.length / 2);
2957
2995
  return t.length % 2 === 0 ? (t[n - 1] + t[n]) / 2 : t[n];
2958
2996
  }
2959
- function ji(e) {
2997
+ function Hi(e) {
2960
2998
  const t = e.filter((a) => a.taskKind === "phase" && a.outcome === "done").map(
2961
2999
  (a) => (a.endedAt ? Date.parse(a.endedAt) : Number.NaN) - Date.parse(a.startedAt)
2962
3000
  ).filter((a) => Number.isFinite(a) && a > 0);
2963
3001
  if (t.length === 0) return {};
2964
- const n = ir(t), s = {};
3002
+ const n = ur(t), s = {};
2965
3003
  for (const a of ["implement", "verify"]) {
2966
- const r = ae[a].to - ae[a].from;
2967
- s[a] = n * r / se;
3004
+ const r = re[a].to - re[a].from;
3005
+ s[a] = n * r / ae;
2968
3006
  }
2969
3007
  return s;
2970
3008
  }
2971
- function Mi({
3009
+ function Gi({
2972
3010
  anchor: e,
2973
3011
  anchorEnteredAt: t,
2974
3012
  lastStreamAt: n,
@@ -2976,165 +3014,165 @@ function Mi({
2976
3014
  medians: a
2977
3015
  }) {
2978
3016
  if (!e) return 0;
2979
- const r = ae[e], i = Math.min(r.from, se), o = a == null ? void 0 : a[e];
3017
+ const r = re[e], i = Math.min(r.from, ae), o = a == null ? void 0 : a[e];
2980
3018
  if (!o || o <= 0 || t === void 0 || r.to === r.from)
2981
3019
  return i;
2982
- const c = n === void 0 ? s : Math.min(s, n + Dt), u = Math.min(1, Math.max(0, c - t) / o);
2983
- return Math.min(r.from + u * (r.to - r.from), se);
3020
+ const c = n === void 0 ? s : Math.min(s, n + Ft), u = Math.min(1, Math.max(0, c - t) / o);
3021
+ return Math.min(r.from + u * (r.to - r.from), ae);
2984
3022
  }
2985
3023
  export {
2986
- qr as $,
2987
- Xa as A,
2988
- ha as B,
3024
+ Jr as $,
3025
+ tr as A,
3026
+ wa as B,
2989
3027
  Se as C,
2990
- er as D,
2991
- Rt as E,
2992
- Ar as F,
3028
+ ar as D,
3029
+ _t as E,
3030
+ Nr as F,
2993
3031
  I as G,
2994
- va as H,
2995
- kt as I,
2996
- Kr as J,
2997
- Un as K,
2998
- Kn as L,
3032
+ $a as H,
3033
+ At as I,
3034
+ Vr as J,
3035
+ zn as K,
3036
+ Vn as L,
2999
3037
  Te as M,
3000
- Wn as N,
3001
- qn as O,
3002
- Ai as P,
3003
- _t as Q,
3004
- Pr as R,
3005
- Wa as S,
3006
- $i as T,
3007
- _r as U,
3008
- Yn as V,
3009
- ct as W,
3010
- rn as X,
3011
- qe as Y,
3012
- oi as Z,
3013
- $r as _,
3014
- on as a,
3015
- Ci as a$,
3016
- cs as a0,
3017
- bt as a1,
3038
+ Xn as N,
3039
+ Jn as O,
3040
+ Ni as P,
3041
+ Ot as Q,
3042
+ Tr as R,
3043
+ Xa as S,
3044
+ Pi as T,
3045
+ Or as U,
3046
+ Wn as V,
3047
+ dt as W,
3048
+ un as X,
3049
+ Ue as Y,
3050
+ li as Z,
3051
+ Pr as _,
3052
+ ln as a,
3053
+ xi as a$,
3054
+ fs as a0,
3055
+ St as a1,
3018
3056
  U as a2,
3019
- xa as a3,
3020
- vi as a4,
3021
- wi as a5,
3022
- bi as a6,
3023
- _i as a7,
3024
- Tr as a8,
3025
- Ma as a9,
3026
- Mi as aA,
3027
- Xr as aB,
3028
- Hn as aC,
3029
- Gn as aD,
3030
- xr as aE,
3031
- Or as aF,
3057
+ Ma as a3,
3058
+ $i as a4,
3059
+ ki as a5,
3060
+ Si as a6,
3061
+ Oi as a7,
3062
+ Dr as a8,
3063
+ Ga as a9,
3064
+ Gi as aA,
3065
+ ti as aB,
3066
+ qn as aC,
3067
+ Un as aD,
3068
+ Mr as aE,
3069
+ Lr as aF,
3032
3070
  x as aG,
3033
- Br as aH,
3071
+ Kr as aH,
3034
3072
  K as aI,
3035
- Ur as aJ,
3036
- Ti as aK,
3037
- ds as aL,
3038
- Yr as aM,
3039
- Qr as aN,
3040
- Ei as aO,
3041
- _a as aP,
3042
- wa as aQ,
3043
- Rr as aR,
3044
- Wr as aS,
3045
- Ni as aT,
3046
- aa as aU,
3047
- Zr as aV,
3048
- te as aW,
3049
- ra as aX,
3050
- ci as aY,
3051
- ma as aZ,
3052
- tt as a_,
3053
- Bn as aa,
3054
- Pi as ab,
3055
- Ot as ac,
3056
- Ia as ad,
3057
- Di as ae,
3058
- ri as af,
3059
- ji as ag,
3060
- Ua as ah,
3061
- ti as ai,
3062
- Vn as aj,
3063
- zn as ak,
3064
- Jn as al,
3065
- Xn as am,
3066
- Qn as an,
3067
- dt as ao,
3068
- yr as ap,
3069
- me as aq,
3070
- Mr as ar,
3071
- Lr as as,
3072
- Fr as at,
3073
- jr as au,
3074
- Dr as av,
3075
- ss as aw,
3076
- ua as ax,
3077
- Hr as ay,
3078
- Cr as az,
3079
- Ys as b,
3080
- Qs as b0,
3081
- Ir as b1,
3082
- ii as b2,
3083
- Vr as b3,
3084
- Js as b4,
3085
- nr as b5,
3086
- kn as b6,
3073
+ zr as aJ,
3074
+ Di as aK,
3075
+ ps as aL,
3076
+ Wr as aM,
3077
+ si as aN,
3078
+ Ii as aO,
3079
+ Oa as aP,
3080
+ ka as aQ,
3081
+ _r as aR,
3082
+ Xr as aS,
3083
+ ji as aT,
3084
+ ca as aU,
3085
+ ni as aV,
3086
+ ne as aW,
3087
+ da as aX,
3088
+ fi as aY,
3089
+ ba as aZ,
3090
+ nt as a_,
3091
+ Kn as aa,
3092
+ Ti as ab,
3093
+ Lt as ac,
3094
+ Ca as ad,
3095
+ Fi as ae,
3096
+ di as af,
3097
+ Hi as ag,
3098
+ za as ah,
3099
+ ri as ai,
3100
+ es as aj,
3101
+ Qn as ak,
3102
+ Zn as al,
3103
+ ts as am,
3104
+ ss as an,
3105
+ ut as ao,
3106
+ Er as ap,
3107
+ ge as aq,
3108
+ Gr as ar,
3109
+ Br as as,
3110
+ Yr as at,
3111
+ Hr as au,
3112
+ Fr as av,
3113
+ os as aw,
3114
+ ha as ax,
3115
+ qr as ay,
3116
+ xr as az,
3117
+ Ws as b,
3118
+ sa as b0,
3119
+ Cr as b1,
3120
+ ui as b2,
3121
+ ei as b3,
3122
+ Zs as b4,
3123
+ ir as b5,
3124
+ An as b6,
3087
3125
  $e as b7,
3088
- ni as b8,
3089
- ft as b9,
3090
- pi as ba,
3091
- es as bb,
3092
- mi as bc,
3093
- di as bd,
3094
- ui as be,
3095
- hi as bf,
3096
- li as bg,
3097
- Pt as bh,
3098
- Ri as bi,
3099
- ei as bj,
3100
- fi as bk,
3101
- Zn as bl,
3102
- it as bm,
3103
- Jr as bn,
3104
- us as bo,
3105
- Gr as bp,
3106
- br as bq,
3107
- Er as br,
3108
- Ye as bs,
3126
+ ii as b8,
3127
+ pt as b9,
3128
+ yi as ba,
3129
+ as as bb,
3130
+ bi as bc,
3131
+ pi as bd,
3132
+ hi as be,
3133
+ wi as bf,
3134
+ mi as bg,
3135
+ Tt as bh,
3136
+ _i as bi,
3137
+ ai as bj,
3138
+ gi as bk,
3139
+ ns as bl,
3140
+ ot as bm,
3141
+ Zr as bn,
3142
+ hs as bo,
3143
+ Ur as bp,
3144
+ Sr as bq,
3145
+ Ir as br,
3146
+ qe as bs,
3109
3147
  S as bt,
3110
- kr as bu,
3111
- vr as bv,
3112
- Sr as bw,
3113
- tn as bx,
3114
- zr as by,
3115
- Vs as c,
3116
- ps as d,
3117
- hs as e,
3118
- se as f,
3119
- Dt as g,
3120
- ut as h,
3121
- ai as i,
3122
- si as j,
3123
- Oi as k,
3148
+ Ar as bu,
3149
+ $r as bv,
3150
+ Rr as bw,
3151
+ rn as bx,
3152
+ Qr as by,
3153
+ ea as c,
3154
+ ys as d,
3155
+ ws as e,
3156
+ ae as f,
3157
+ Ft as g,
3158
+ lt as h,
3159
+ ci as i,
3160
+ oi as j,
3161
+ Li as k,
3124
3162
  $ as l,
3125
- yi as m,
3126
- wr as n,
3127
- Ii as o,
3128
- ki as p,
3129
- Ct as q,
3130
- Si as r,
3131
- gi as s,
3132
- Ka as t,
3133
- Tt as u,
3134
- qa as v,
3135
- xi as w,
3136
- Nr as x,
3137
- Ws as y,
3138
- rr as z
3163
+ Ei as m,
3164
+ kr as n,
3165
+ Ci as o,
3166
+ Ai as p,
3167
+ xt as q,
3168
+ Ri as r,
3169
+ vi as s,
3170
+ Va as t,
3171
+ Dt as u,
3172
+ Ja as v,
3173
+ Mi as w,
3174
+ jr as x,
3175
+ Xs as y,
3176
+ dr as z
3139
3177
  };
3140
- //# sourceMappingURL=phase-progress.6zt0NNtr.js.map
3178
+ //# sourceMappingURL=phase-progress.2akB88O9.js.map