@dendelion/paper-camp 0.37.1 → 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,99 +1,102 @@
1
- import { readFile as v, mkdir as P, writeFile as E, readdir as z, stat as jt, rename as Mt, access as Lt } from "node:fs/promises";
2
- import { dirname as M, join as p, basename as Ft } from "node:path";
3
- import { parse as V, stringify as Ht } 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 Gt, NOTIFICATION_SETTING_KINDS as Bt, PLAN_KINDS as Yt } from "../types/index.js";
6
- import { createHash as qt } from "node:crypto";
7
- import { existsSync as ae, readFileSync as He } from "node:fs";
8
- import { fileURLToPath as Ut } from "node:url";
9
- import { z as Kt, A as Wt, e as Jt, n as zt, a as Vt, u as Xt } 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 Zt = /^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/;
12
- function Qt(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
- function Re(e) {
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(Zt);
22
- return n ? { key: n[1], value: Qt(n[2]) } : null;
21
+ const n = t.match(tn);
22
+ return n ? { key: n[1], value: nn(n[2]) } : null;
23
23
  }
24
- function gi(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 yi(e, t) {
34
- const n = new Map(t.map((i) => [i.key, i.value])), s = e.length > 0 ? e.split(`
35
- `) : [], r = [];
36
- for (const i of s) {
37
- const a = Ge(i);
38
- if (!a) {
39
- r.push(i);
33
+ function kr(e, t) {
34
+ const n = new Map(t.map((r) => [r.key, r.value])), s = e.length > 0 ? e.split(`
35
+ `) : [], a = [];
36
+ for (const r of s) {
37
+ const i = Be(r);
38
+ if (!i) {
39
+ a.push(r);
40
40
  continue;
41
41
  }
42
- n.has(a.key) && (r.push(`${a.key}=${Re(n.get(a.key) ?? "")}`), n.delete(a.key));
42
+ n.has(i.key) && (a.push(`${i.key}=${Ie(n.get(i.key) ?? "")}`), n.delete(i.key));
43
43
  }
44
- for (const [i, a] of n)
45
- r.push(`${i}=${Re(a)}`);
46
- for (; r.length > 0 && r[r.length - 1] === ""; ) r.pop();
47
- return r.length > 0 ? `${r.join(`
44
+ for (const [r, i] of n)
45
+ a.push(`${r}=${Ie(i)}`);
46
+ for (; a.length > 0 && a[a.length - 1] === ""; ) a.pop();
47
+ return a.length > 0 ? `${a.join(`
48
48
  `)}
49
49
  ` : "";
50
50
  }
51
- function wi(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 en(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 tn(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 nn(e = [], t = [], n = [], s = []) {
73
- const r = [
74
- ...e.map((a) => ({ kind: "log", date: a.date, text: a.text })),
75
- ...t.map((a) => ({ kind: "clarification", date: a.date, text: a.text })),
76
- ...s.map((a) => ({ kind: "review", date: a.date, text: a.text }))
77
- ].sort((a, o) => a.date.localeCompare(o.date)), i = n.map((a) => ({
78
- kind: a.kind ?? "note",
79
- text: a.anchor.kind === "phase" ? `[phase ${a.anchor.index}] ${a.prose}` : a.prose,
80
- state: a.state
75
+ function rn(e = [], t = [], n = [], s = []) {
76
+ const a = [
77
+ ...e.map((i) => ({ kind: "log", date: i.date, text: i.text })),
78
+ ...t.map((i) => ({ kind: "clarification", date: i.date, text: i.text })),
79
+ ...s.map((i) => ({ kind: "review", date: i.date, text: i.text }))
80
+ ].sort((i, o) => i.date.localeCompare(o.date)), r = n.map((i) => ({
81
+ kind: i.kind ?? "note",
82
+ text: i.anchor.kind === "phase" ? `[phase ${i.anchor.index}] ${i.prose}` : i.prose,
83
+ state: i.state
81
84
  }));
82
- return [...r, ...i];
85
+ return [...a, ...r];
83
86
  }
84
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 = []) {
90
+ function qe(e = []) {
88
91
  return oe(e, "log");
89
92
  }
90
- function sn(e = []) {
93
+ function on(e = []) {
91
94
  return oe(e, "clarification");
92
95
  }
93
- function rn(e = []) {
96
+ function cn(e = []) {
94
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,30 +106,30 @@ function an(e = []) {
103
106
  kind: t.kind
104
107
  }));
105
108
  }
106
- function bi(e, t, n) {
109
+ function $r(e, t, n) {
107
110
  return [...(e ?? []).filter((s) => !t.includes(s.kind)), ...n];
108
111
  }
109
- function vi(e, t, n, s) {
110
- return e.map((r, i) => {
111
- if (i !== t) return r;
112
- const a = s ? `${r.text}
112
+ function Ir(e, t, n, s) {
113
+ return e.map((a, r) => {
114
+ if (r !== t) return a;
115
+ const i = s ? `${a.text}
113
116
 
114
- ${s}` : r.text;
115
- if (n === "decision") return { ...r, kind: n, state: "open", text: a };
116
- const { state: o, ...c } = r;
117
- return { ...c, kind: n, text: a };
117
+ ${s}` : a.text;
118
+ if (n === "decision") return { ...a, kind: n, state: "open", text: i };
119
+ const { state: o, ...c } = a;
120
+ return { ...c, kind: n, text: i };
118
121
  });
119
122
  }
120
- function Ei(e = []) {
121
- const t = e.reduce((n, s, r) => s.kind === "log" ? r : n, -1);
123
+ function Ar(e = []) {
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: en(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: sn(e.thread),
149
- notes: an(e.thread),
150
- review: rn(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 on(e) {
159
+ function un(e) {
157
160
  return {
158
161
  id: e.id,
159
162
  title: e.title,
@@ -163,21 +166,21 @@ function on(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 cn = /^[0-9a-f]{4,40}$/i, dn = /^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
- var i;
175
+ var r;
173
176
  const s = b("git", t, { cwd: e, stdio: ["ignore", "pipe", "ignore"] });
174
- let r = "";
175
- (i = s.stdout) == null || i.on("data", (a) => {
176
- r += a.toString();
177
- }), s.on("close", () => n(r)), s.on("error", () => n(""));
177
+ let a = "";
178
+ (r = s.stdout) == null || r.on("data", (i) => {
179
+ a += i.toString();
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
  }
@@ -187,91 +190,91 @@ function ne(e) {
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 r = n.match(dn);
191
- return r ? r[1].toUpperCase() : null;
193
+ const a = n.match(fn);
194
+ return a ? a[1].toUpperCase() : null;
192
195
  }
193
- function un(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();
198
- for (const r of n.split("")) {
199
- if (!r) continue;
200
- const [i, a = ""] = r.split("\0"), o = a.split(`
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();
201
+ for (const a of n.split("")) {
202
+ if (!a) continue;
203
+ const [r, i = ""] = a.split("\0"), o = i.split(`
201
204
  `).map((u) => u.trim()).filter(Boolean);
202
- if (un(o)) continue;
203
- const c = ne(i.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 = "", ln = `${We}%H${j}%s${j}%cI${j}%D${j}%(trailers:key=Refs,valueonly)`, fn = /^([a-z]+(?:\([^)]*\))?):\s*(.+)$/i;
209
- function pn(e) {
210
- const t = e.match(fn);
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 hn(e, t) {
216
+ function yn(e, t) {
214
217
  const n = [];
215
218
  let s = !1;
216
- for (const r of e.split(",")) {
217
- const i = r.trim().replace(/^HEAD -> /, "");
218
- i && (i.startsWith("tag: ") ? n.push(i.slice(5)) : t && i === t && (s = !0));
219
+ for (const a of e.split(",")) {
220
+ const r = a.trim().replace(/^HEAD -> /, "");
221
+ r && (r.startsWith("tag: ") ? n.push(r.slice(5)) : t && r === t && (s = !0));
219
222
  }
220
223
  return { tags: n, isUpstreamHead: s };
221
224
  }
222
- function mn(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 gn(e, t, n) {
227
- return e.split(We).map((s) => s.trim()).filter(Boolean).map((s) => {
228
- const [r, i = "", a = "", o = "", c = ""] = s.split(j), { prefix: u, subject: l } = pn(i), { tags: f, isUpstreamHead: h } = hn(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
- hash: r,
233
+ hash: a,
231
234
  subject: l,
232
235
  prefix: u,
233
- date: a,
236
+ date: i,
234
237
  tags: f,
235
238
  isUpstreamHead: h,
236
- pushed: t !== null && !n.has(r),
237
- ideaId: mn(c)
239
+ pushed: t !== null && !n.has(a),
240
+ ideaId: wn(c)
238
241
  };
239
242
  });
240
243
  }
241
- async function yn(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 ki(e, t, n = 30) {
245
- const s = await yn(e), r = 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=${ln}`
251
- ]), i = /* @__PURE__ */ new Set();
253
+ `--format=${hn}`
254
+ ]), r = /* @__PURE__ */ new Set();
252
255
  if (s) {
253
256
  const c = await S(e, ["rev-list", `${s}..HEAD`]);
254
257
  for (const u of c.split(`
255
258
  `)) {
256
259
  const l = u.trim();
257
- l && i.add(l);
260
+ l && r.add(l);
258
261
  }
259
262
  }
260
- const a = gn(r, s, i), o = a.length > n;
261
- return { commits: a.slice(0, n), upstream: s, hasMore: o };
263
+ const i = bn(a, s, r), o = i.length > n;
264
+ return { commits: i.slice(0, n), upstream: s, hasMore: o };
262
265
  }
263
- const k = /* @__PURE__ */ new Map(), wn = 5 * 60 * 1e3, ce = (e) => p(e, "papercamp", "pr-map.json");
264
- async function bn(e, t, n) {
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) {
265
268
  const s = ce(e);
266
269
  try {
267
- const r = { fetchedAt: n, prs: Object.fromEntries(t) };
268
- await P(M(s), { recursive: !0 }), await E(s, `${JSON.stringify(r, null, 2)}
270
+ const a = { fetchedAt: n, prs: Object.fromEntries(t) };
271
+ await P(M(s), { recursive: !0 }), await E(s, `${JSON.stringify(a, null, 2)}
269
272
  `, "utf-8");
270
- } catch (r) {
271
- console.error(`papercamp: could not persist PR map for ${e}:`, r);
273
+ } catch (a) {
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
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 };
@@ -279,13 +282,13 @@ async function Je(e) {
279
282
  return;
280
283
  }
281
284
  }
282
- const vn = {
285
+ const Sn = {
283
286
  APPROVED: "approved",
284
287
  CHANGES_REQUESTED: "changes-requested",
285
288
  REVIEW_REQUIRED: "review-required"
286
289
  };
287
- function En(e) {
288
- const t = e.state === "MERGED" ? "merged" : e.state === "CLOSED" ? "closed" : e.isDraft ? "draft" : "open", n = vn[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,
@@ -295,14 +298,14 @@ function En(e) {
295
298
  ...e.headRefName && { headBranch: e.headRefName }
296
299
  };
297
300
  }
298
- const Ae = { merged: 4, open: 3, draft: 2, closed: 1 };
299
- function ze(e, t) {
301
+ const Re = { merged: 4, open: 3, draft: 2, closed: 1 };
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 kn = `
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,32 +316,32 @@ query($owner: String!, $repo: String!, $number: Int!) {
313
316
  }
314
317
  }
315
318
  }`;
316
- function Sn(e, t) {
319
+ function An(e, t) {
317
320
  return `Paper Scout · ${e} · ${t.slice(0, 7)}`;
318
321
  }
319
322
  function F(e) {
320
323
  const t = e.match(/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/);
321
324
  if (!t) return null;
322
- const [, n, s, r] = t;
323
- return { owner: n, repo: s, number: r };
325
+ const [, n, s, a] = t;
326
+ return { owner: n, repo: s, number: a };
324
327
  }
325
- const $n = 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"] });
330
- let r = !1;
331
- const i = (l) => {
332
- r || (r = !0, clearTimeout(a), l());
333
- }, a = setTimeout(() => {
334
- s.kill(), i(() => n(void 0));
335
- }, $n);
333
+ let a = !1;
334
+ const r = (l) => {
335
+ a || (a = !0, clearTimeout(i), l());
336
+ }, i = setTimeout(() => {
337
+ s.kill(), r(() => n(void 0));
338
+ }, Rn);
336
339
  let o = "";
337
340
  (c = s.stdout) == null || c.on("data", (l) => {
338
341
  o += l.toString();
339
342
  }), (u = s.stderr) == null || u.on("data", () => {
340
343
  }), s.on("close", (l) => {
341
- i(() => {
344
+ r(() => {
342
345
  if (l !== 0) {
343
346
  n(void 0);
344
347
  return;
@@ -349,11 +352,11 @@ function Ve(e, t) {
349
352
  n(void 0);
350
353
  }
351
354
  });
352
- }), s.on("error", () => i(() => n(void 0)));
355
+ }), s.on("error", () => r(() => n(void 0)));
353
356
  });
354
357
  }
355
- function Xe(e, t, n, s, r) {
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",
@@ -361,28 +364,28 @@ function Xe(e, t, n, s, r) {
361
364
  "-f",
362
365
  `repo=${s}`,
363
366
  "-F",
364
- `number=${r}`
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
- for (const [r, i] of Object.entries(n))
370
- s.push("-f", `${r}=${i}`);
371
- return Qe(e, s);
372
+ for (const [a, r] of Object.entries(n))
373
+ s.push("-f", `${a}=${r}`);
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 In(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, kn, n.owner, n.repo, n.number), r = (f = (l = s == null ? void 0 : s.data) == null ? void 0 : l.repository) == null ? void 0 : f.pullRequest;
381
- if (!r) return;
382
- const i = r.reviewThreads.nodes.filter((y) => !y.isResolved).length, a = (h = r.commits.nodes[0]) == null ? void 0 : h.commit.committedDate, o = [(g = r.comments.nodes[0]) == null ? void 0 : g.createdAt, (w = r.reviews.nodes.at(-1)) == null ? void 0 : w.createdAt].filter((y) => !!y).sort().at(-1), c = !!(a && o && o > a), u = r.reviews.nodes.map((y) => y.body);
383
- return { unresolvedThreadCount: i, hasNewCommentsSincePush: c, reviewBodies: u };
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;
384
+ if (!a) return;
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);
386
+ return { unresolvedThreadCount: r, hasNewCommentsSincePush: c, reviewBodies: u };
384
387
  }
385
- const Rn = `
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,12 +399,12 @@ query($owner: String!, $repo: String!, $number: Int!) {
396
399
  }
397
400
  }
398
401
  }`;
399
- async function Si(e, t) {
400
- var i, a, o;
402
+ async function Pr(e, t) {
403
+ var r, i, o;
401
404
  const n = F(t);
402
405
  if (!n) return [];
403
- const s = await Xe(e, Rn, n.owner, n.repo, n.number);
404
- return (((o = (a = (i = s == null ? void 0 : s.data) == null ? void 0 : i.repository) == null ? void 0 : a.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 }) => {
406
+ const s = await Ze(e, Cn, n.owner, n.repo, n.number);
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 {
407
410
  id: c,
@@ -412,72 +415,72 @@ async function Si(e, t) {
412
415
  };
413
416
  });
414
417
  }
415
- const An = `
418
+ const _n = `
416
419
  mutation($threadId: ID!) {
417
420
  resolveReviewThread(input: { threadId: $threadId }) {
418
421
  thread { id isResolved }
419
422
  }
420
- }`, Pn = `
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 $i(e, t) {
427
- var s, r, i;
428
- const n = await Ze(e, An, { threadId: t });
429
- return !!((i = (r = (s = n == null ? void 0 : n.data) == null ? void 0 : s.resolveReviewThread) == null ? void 0 : r.thread) != null && i.isResolved);
429
+ async function Cr(e, t) {
430
+ var s, a, r;
431
+ const n = await Qe(e, _n, { threadId: t });
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 Ii(e, t, n) {
432
- var r, i, a;
433
- const s = await Ze(e, Pn, { threadId: t, body: n });
434
- return !!((a = (i = (r = s == null ? void 0 : s.data) == null ? void 0 : r.addPullRequestReviewThreadReply) == null ? void 0 : i.comment) != null && a.id);
434
+ async function _r(e, t, n) {
435
+ var a, r, i;
436
+ const s = await Qe(e, Nn, { threadId: t, body: n });
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
- var a, o, c;
439
- const r = b("gh", ["api", t, "-X", "POST", "--input", "-"], {
441
+ var i, o, c;
442
+ const a = b("gh", ["api", t, "-X", "POST", "--input", "-"], {
440
443
  cwd: e,
441
444
  stdio: ["pipe", "ignore", "pipe"]
442
445
  });
443
- let i = "";
444
- (a = r.stderr) == null || a.on("data", (u) => {
445
- i += u;
446
- }), r.on(
446
+ let r = "";
447
+ (i = a.stderr) == null || i.on("data", (u) => {
448
+ r += u;
449
+ }), a.on(
447
450
  "close",
448
- (u) => s(u === 0 ? { delivered: !0 } : { delivered: !1, body: i.trim() })
449
- ), r.on("error", (u) => s({ delivered: !1, body: u.message })), (o = r.stdin) == null || o.on("error", () => {
450
- }), (c = r.stdin) == null || c.end(JSON.stringify(n));
451
+ (u) => s(u === 0 ? { delivered: !0 } : { delivered: !1, body: r.trim() })
452
+ ), a.on("error", (u) => s({ delivered: !1, body: u.message })), (o = a.stdin) == null || o.on("error", () => {
453
+ }), (c = a.stdin) == null || c.end(JSON.stringify(n));
451
454
  });
452
455
  }
453
- async function Ri(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 Ai(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 Cn(e, t) {
471
+ async function Tn(e, t) {
469
472
  const n = [...t.entries()].filter(
470
- ([, r]) => r.state === "open" || r.state === "draft"
471
- ), s = await Promise.all(n.map(([, r]) => In(e, r.url)));
472
- n.forEach(([r, i], a) => {
473
- const o = s[a];
473
+ ([, a]) => a.state === "open" || a.state === "draft"
474
+ ), s = await Promise.all(n.map(([, a]) => Pn(e, a.url)));
475
+ n.forEach(([a, r], i) => {
476
+ const o = s[i];
474
477
  if (!o) return;
475
- const { reviewBodies: c, ...u } = o, l = !!i.headSha && c.some((f) => f.includes(Sn(r, i.headSha)));
476
- t.set(r, { ...i, ...u, ...l && { scoutReviewObserved: l } });
478
+ const { reviewBodies: c, ...u } = o, l = !!r.headSha && c.some((f) => f.includes(An(a, r.headSha)));
479
+ t.set(a, { ...r, ...u, ...l && { scoutReviewObserved: l } });
477
480
  });
478
481
  }
479
- async function _n(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,50 +493,50 @@ async function _n(e) {
490
493
  if (!t) return;
491
494
  const n = /* @__PURE__ */ new Map();
492
495
  for (const s of t) {
493
- const r = ze(s.body, s.headRefName);
494
- if (!r) continue;
495
- const i = En(s), a = n.get(r);
496
- (!a || Ae[i.state] > Ae[a.state]) && n.set(r, i);
496
+ const a = Ve(s.body, s.headRefName);
497
+ if (!a) continue;
498
+ const r = $n(s), i = n.get(a);
499
+ (!i || Re[r.state] > Re[i.state]) && n.set(a, r);
497
500
  }
498
- return await Cn(e, n), n;
501
+ return await Tn(e, n), n;
499
502
  }
500
- async function tt(e, t = wn) {
503
+ async function nt(e, t = En) {
501
504
  let n = k.get(e);
502
505
  if (!n) {
503
- const r = await Je(e);
504
- r && (k.set(e, r), n = r);
506
+ const a = await ze(e);
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 _n(e);
511
+ const s = await xn(e);
509
512
  if (s !== void 0) {
510
- const r = Date.now();
511
- return k.set(e, { prs: s, fetchedAt: r }), await bn(e, s, r), s;
513
+ const a = Date.now();
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 Pi(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 Ci(e, t) {
520
- const n = (r) => `${r.number}:${r.headSha ?? "unknown"}`, s = [];
521
- for (const [r, i] of t) {
522
- if (i.reviewDecision !== "changes-requested") continue;
523
- const a = e == null ? void 0 : e.get(r);
524
- ((a == null ? void 0 : a.reviewDecision) === "changes-requested" ? n(a) : void 0) !== n(i) && s.push({ entityId: r, pr: i });
522
+ function Or(e, t) {
523
+ const n = (a) => `${a.number}:${a.headSha ?? "unknown"}`, s = [];
524
+ for (const [a, r] of t) {
525
+ if (r.reviewDecision !== "changes-requested") continue;
526
+ const i = e == null ? void 0 : e.get(a);
527
+ ((i == null ? void 0 : i.reviewDecision) === "changes-requested" ? n(i) : void 0) !== n(r) && s.push({ entityId: a, pr: r });
525
528
  }
526
529
  return s;
527
530
  }
528
- async function _i(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 Ti(e) {
539
+ async function jr(e) {
537
540
  if (e === void 0) {
538
541
  k.clear();
539
542
  return;
@@ -542,47 +545,47 @@ async function Ti(e) {
542
545
  t && k.set(e, { ...t, fetchedAt: 0 });
543
546
  const n = ce(e);
544
547
  try {
545
- const s = await v(n, "utf-8"), r = JSON.parse(s);
546
- r.fetchedAt = 0, await E(n, `${JSON.stringify(r, null, 2)}
548
+ const s = await v(n, "utf-8"), a = JSON.parse(s);
549
+ a.fetchedAt = 0, await E(n, `${JSON.stringify(a, null, 2)}
547
550
  `, "utf-8");
548
551
  } catch {
549
552
  }
550
553
  }
551
- const nt = /^#{2,3}\s+/, Y = /^[-*]\s+\[([ xX])\]\s+(.*)$/, Tn = /^\[(review|manual|issue)\]\s+(.*)$/, Nn = /^run:\s*(.+)$/, Pe = /^-\s+(\d{4}-\d{2}-\d{2}):\s*(.*)$/, xn = /^\[(?: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+)?(.*)$/, On = ["note", "decision", "question"];
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"];
552
555
  function de(e, t, n, s) {
553
- const r = [];
554
- let i = t;
555
- for (; i < n; ) {
556
- const a = e[i];
557
- if (a.trim() === "" || !/^\s/.test(a)) break;
558
- const o = a.trimStart();
559
- if (s.test(o) || nt.test(o)) break;
560
- r.push(o), i++;
556
+ const a = [];
557
+ let r = t;
558
+ for (; r < n; ) {
559
+ const i = e[r];
560
+ if (i.trim() === "" || !/^\s/.test(i)) break;
561
+ const o = i.trimStart();
562
+ if (s.test(o) || st.test(o)) break;
563
+ a.push(o), r++;
561
564
  }
562
- return { text: r.join(" "), next: i };
565
+ return { text: a.join(" "), next: r };
563
566
  }
564
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
- let r = t;
570
- for (; r < n; ) {
571
- const i = e[r].match(Y);
572
- if (i) {
573
- const a = i[1].toLowerCase() === "x", o = i[2].trim(), c = o.match(Tn), u = c ? c[2].trim() : o, l = c ? c[1] : void 0, f = [];
572
+ let a = t;
573
+ for (; a < n; ) {
574
+ const r = e[a].match(Y);
575
+ if (r) {
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
- for (r++; r < n; ) {
576
- const g = e[r];
577
- if (g.trim() === "" || Y.test(g) || nt.test(g)) break;
578
+ for (a++; a < n; ) {
579
+ const g = e[a];
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(Nn), m = y ? Kt(y[1]) : void 0;
580
- m ? h = m : f.push(w), r++;
582
+ const w = g.trimStart(), y = w.match(Dn), m = y ? zt(y[1]) : void 0;
583
+ m ? h = m : f.push(w), a++;
581
584
  } else
582
585
  break;
583
586
  }
584
587
  s.push({
585
- done: a,
588
+ done: i,
586
589
  text: u,
587
590
  description: f.length > 0 ? f.join(`
588
591
  `) : void 0,
@@ -590,77 +593,77 @@ function st(e, t, n) {
590
593
  run: h
591
594
  });
592
595
  } else
593
- r++;
596
+ a++;
594
597
  }
595
598
  return s;
596
599
  }
597
600
  function le(e, t, n) {
598
601
  const s = [];
599
- let r = t;
600
- for (; r < n; ) {
601
- const i = e[r].match(Pe);
602
- if (!i) {
603
- r++;
602
+ let a = t;
603
+ for (; a < n; ) {
604
+ const r = e[a].match(Pe);
605
+ if (!r) {
606
+ a++;
604
607
  continue;
605
608
  }
606
- const a = de(e, r + 1, n, Pe);
607
- s.push({ date: i[1], text: ue(i[2], a.text) }), r = a.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
614
  function rt(e, t) {
612
615
  const n = [e];
613
616
  for (const s of t) {
614
- const r = s.source ? `[${s.source}] ${s.text}` : s.text;
615
- if (n.push(`- [${s.done ? "x" : " "}] ${r}`), s.description)
616
- for (const i of s.description.split(`
617
- `)) n.push(` ${i}`);
618
- s.run && n.push(` run: ${Wt(s.run)}`);
617
+ const a = s.source ? `[${s.source}] ${s.text}` : s.text;
618
+ if (n.push(`- [${s.done ? "x" : " "}] ${a}`), s.description)
619
+ for (const r of s.description.split(`
620
+ `)) n.push(` ${r}`);
621
+ s.run && n.push(` run: ${Vt(s.run)}`);
619
622
  }
620
623
  return n;
621
624
  }
622
625
  function fe(e, t) {
623
626
  return [e, ...t.map((n) => `- ${n.date}: ${n.text}`)];
624
627
  }
625
- function Dn(e) {
628
+ function Ln(e) {
626
629
  return e.kind === "phase" ? `[phase:${e.index}]` : "[body]";
627
630
  }
628
- function jn(e, t, n) {
631
+ function Fn(e, t, n) {
629
632
  const s = [];
630
- let r = t;
631
- for (; r < n; ) {
632
- const i = e[r].match(Y), a = i ? i[2].trim().match(xn) : null;
633
- if (!i || !a) {
634
- r++;
633
+ let a = t;
634
+ for (; a < n; ) {
635
+ const r = e[a].match(Y), i = r ? r[2].trim().match(jn) : null;
636
+ if (!r || !i) {
637
+ a++;
635
638
  continue;
636
639
  }
637
- const o = a[1] ? { kind: "phase", index: Number(a[1]) } : { kind: "body" }, c = a[2], u = de(e, r + 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: ue(a[3], u.text),
641
- state: i[1].toLowerCase() === "x" ? "resolved" : "open",
643
+ prose: ue(i[3], u.text),
644
+ state: r[1].toLowerCase() === "x" ? "resolved" : "open",
642
645
  ...c ? { kind: c } : {}
643
- }), r = u.next;
646
+ }), a = u.next;
644
647
  }
645
648
  return s;
646
649
  }
647
- function Mn(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" : " "}] ${Dn(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,
662
+ parseEntries: at,
660
663
  formatLines: (e) => rt("### Phases", e)
661
664
  }, it = {
662
665
  headingRe: /^#{2,3}\s+Fixes\s*$/i,
663
- parseEntries: st,
666
+ parseEntries: at,
664
667
  formatLines: (e) => rt("### Fixes", e)
665
668
  }, H = {
666
669
  headingRe: /^#{2,3}\s+Log\s*$/i,
@@ -672,39 +675,39 @@ const Z = {
672
675
  formatLines: (e) => fe("### Clarifications", e)
673
676
  }, he = {
674
677
  headingRe: /^#{2,3}\s+Notes\s*$/i,
675
- parseEntries: jn,
676
- formatLines: Mn
677
- }, Ln = {
678
+ parseEntries: Fn,
679
+ formatLines: Hn
680
+ }, Gn = {
678
681
  headingRe: /^#{2,3}\s+Review\s*$/i,
679
682
  parseEntries: le,
680
683
  formatLines: (e) => fe("### Review", e)
681
684
  };
682
- function Fn(e, t, n) {
685
+ function Bn(e, t, n) {
683
686
  const s = [];
684
- let r = t;
685
- for (; r < n; ) {
686
- const i = e[r].match(Ce);
687
- if (!i) {
688
- r++;
687
+ let a = t;
688
+ for (; a < n; ) {
689
+ const r = e[a].match(Ce);
690
+ if (!r) {
691
+ a++;
689
692
  continue;
690
693
  }
691
- const a = i[3], o = de(e, r + 1, n, Ce), c = { kind: a, text: ue(i[6], o.text) };
692
- i[2] && (c.date = i[2]), i[4] && (c.from = "agent"), i[5] && (c.entityId = i[5]), On.includes(a) && (c.state = i[1].toLowerCase() === "x" ? "resolved" : "open"), s.push(c), r = 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 Hn(e) {
699
+ function Yn(e) {
697
700
  const t = ["### Thread"];
698
701
  for (const n of e) {
699
- const s = n.state ? n.state === "resolved" : !0, r = n.date ? `${n.date} ` : "", i = n.from === "agent" ? "[agent] " : "", a = n.entityId ? `[[${n.entityId}]] ` : "";
700
- t.push(`- [${s ? "x" : " "}] ${r}[${n.kind}] ${i}${a}${n.text}`);
702
+ const s = n.state ? n.state === "resolved" : !0, a = n.date ? `${n.date} ` : "", r = n.from === "agent" ? "[agent] " : "", i = n.entityId ? `[[${n.entityId}]] ` : "";
703
+ t.push(`- [${s ? "x" : " "}] ${a}[${n.kind}] ${r}${i}${n.text}`);
701
704
  }
702
705
  return t;
703
706
  }
704
- const at = {
707
+ const ot = {
705
708
  headingRe: /^#{2,3}\s+Thread\s*$/i,
706
- parseEntries: Fn,
707
- formatLines: Hn
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 at = {
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"), Gn = 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 at = {
721
724
  created: I,
722
725
  updated: I.optional(),
723
726
  tags: d.string().optional()
724
- }), Bn = 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 at = {
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(), Yn = 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 at = {
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 at = {
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(), qn = 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 at = {
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
- }), Un = 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
- }), Kn = d.object({
798
+ }), zn = d.object({
796
799
  name: d.string(),
797
800
  cmd: d.string(),
798
801
  fixCmd: d.string().optional()
799
- }), Wn = d.object({
802
+ }), Vn = d.object({
800
803
  repo: d.string(),
801
804
  branch: d.string().optional(),
802
805
  releasePlease: d.boolean().optional()
803
- }), Jn = d.object({
804
- services: d.array(Un).optional(),
805
- checks: d.array(Kn).optional(),
806
- ci: Wn.optional()
807
- }), zn = 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
- }), Vn = d.object({
813
+ }), Qn = d.object({
811
814
  name: d.string(),
812
815
  prompt: d.string()
813
- }), Xn = d.object({
816
+ }), es = d.object({
814
817
  ceiling: d.number().optional(),
815
818
  floor: d.number().optional(),
816
- window: zn.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(Gt), d.boolean()).optional(),
821
- customChecks: d.array(Vn).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
- }), Zn = d.object({
825
- kinds: d.record(d.enum(Bt), d.boolean()).optional()
826
- }), Qn = 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
- }), Ni = 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: Qn
836
+ subscription: ns
834
837
  }),
835
838
  d.object({ transport: d.literal("expo"), name: d.string(), token: d.string() })
836
- ]), xi = 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
- ]), es = 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 at = {
862
865
  deskDiscovery: $,
863
866
  nightShift: $
864
867
  }).optional(),
865
- desk: Jn.optional(),
866
- night: Xn.optional(),
867
- notifications: Zn.optional()
868
- }), ts = 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,27 +885,27 @@ const at = {
882
885
  read: d.boolean(),
883
886
  outcome: d.enum(["done", "error"]).optional(),
884
887
  push: d.boolean().optional().default(!0)
885
- }), _e = /^##\s+(.+?)\s*$/, ns = /^\*\*([A-Za-z][A-Za-z-]*):\*\*\s*(.*)$/, ss = /^#{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
- let r = n.length;
893
+ let a = n.length;
891
894
  for (let o = s + 1; o < n.length; o++)
892
- if (ss.test(n[o])) {
893
- r = o;
895
+ if (is.test(n[o])) {
896
+ a = o;
894
897
  break;
895
898
  }
896
- const i = t.parseEntries(n, s + 1, r);
897
- return { body: [...n.slice(0, s), ...n.slice(r)].join(`
898
- `).trim(), entries: i };
899
+ const r = t.parseEntries(n, s + 1, a);
900
+ return { body: [...n.slice(0, s), ...n.slice(a)].join(`
901
+ `).trim(), entries: r };
899
902
  }
900
- const Te = {
903
+ const Ne = {
901
904
  phases: Z,
902
905
  log: H,
903
906
  clarifications: pe,
904
907
  notes: he,
905
- review: Ln
908
+ review: Gn
906
909
  };
907
910
  function me(e) {
908
911
  const t = {
@@ -913,25 +916,25 @@ function me(e) {
913
916
  review: []
914
917
  };
915
918
  let n = e;
916
- for (const s of Object.keys(Te)) {
917
- const r = q(n, Te[s]);
918
- n = r.body, t[s] = r.entries;
919
+ for (const s of Object.keys(Ne)) {
920
+ const a = q(n, Ne[s]);
921
+ n = a.body, t[s] = a.entries;
919
922
  }
920
923
  return { body: n, ...t };
921
924
  }
922
- function rs(e) {
925
+ function os(e) {
923
926
  const t = e.split(`
924
927
  `), n = [];
925
- for (let r = 0; r < t.length; r++)
926
- _e.test(t[r]) && n.push(r);
928
+ for (let a = 0; a < t.length; a++)
929
+ _e.test(t[a]) && n.push(a);
927
930
  const s = [];
928
- for (let r = 0; r < n.length; r++) {
929
- const i = n[r], a = r + 1 < n.length ? n[r + 1] : t.length, o = t[i].match(_e)[1], c = t.slice(i + 1, a);
931
+ for (let a = 0; a < n.length; a++) {
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(ns);
937
+ const G = c[u].match(rs);
935
938
  if (!G) break;
936
939
  l[G[1].toLowerCase()] = G[2].trim(), u++;
937
940
  }
@@ -942,28 +945,28 @@ function rs(e) {
942
945
  }
943
946
  return s;
944
947
  }
945
- function Oi(e) {
948
+ function Fr(e) {
946
949
  const t = [], n = [];
947
- for (const s of rs(e)) {
948
- const r = Gn.safeParse(s.fields);
949
- if (!r.success) {
950
+ for (const s of os(e)) {
951
+ const a = qn.safeParse(s.fields);
952
+ if (!a.success) {
950
953
  n.push({
951
954
  title: s.title,
952
- message: r.error.issues.map((a) => a.message).join("; ")
955
+ message: a.error.issues.map((i) => i.message).join("; ")
953
956
  });
954
957
  continue;
955
958
  }
956
- const i = r.data;
959
+ const r = a.data;
957
960
  t.push({
958
961
  title: s.title,
959
- status: i.status,
960
- kind: i.kind,
961
- id: i.id,
962
- idea: i.idea,
963
- agent: i.agent,
964
- created: i.created,
965
- updated: i.updated,
966
- tags: i.tags ? i.tags.split(",").map((a) => a.trim()).filter(Boolean) : [],
962
+ status: r.status,
963
+ kind: r.kind,
964
+ id: r.id,
965
+ idea: r.idea,
966
+ agent: r.agent,
967
+ created: r.created,
968
+ updated: r.updated,
969
+ tags: r.tags ? r.tags.split(",").map((i) => i.trim()).filter(Boolean) : [],
967
970
  body: s.body,
968
971
  phases: s.phases,
969
972
  log: s.log,
@@ -974,63 +977,63 @@ function Oi(e) {
974
977
  }
975
978
  return { entries: t, warnings: n };
976
979
  }
977
- const is = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/;
980
+ const cs = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/;
978
981
  function ge(e, t) {
979
- const n = [], s = e.match(is);
982
+ const n = [], s = e.match(cs);
980
983
  if (!s)
981
984
  return { data: null, body: e.trim(), warnings: n };
982
- const r = s[1], i = e.slice(s[0].length).trim();
983
- let a;
985
+ const a = s[1], r = e.slice(s[0].length).trim();
986
+ let i;
984
987
  try {
985
- a = V(r);
988
+ i = V(a);
986
989
  } catch (c) {
987
990
  return n.push({
988
991
  title: "(frontmatter)",
989
992
  message: `Invalid YAML frontmatter: ${c.message}`
990
- }), { data: null, body: i, warnings: n };
993
+ }), { data: null, body: r, warnings: n };
991
994
  }
992
- if (typeof a != "object" || a === null || Array.isArray(a))
995
+ if (typeof i != "object" || i === null || Array.isArray(i))
993
996
  return n.push({
994
997
  title: "(frontmatter)",
995
998
  message: "YAML frontmatter did not produce an object"
996
- }), { data: null, body: i, warnings: n };
997
- const o = t.safeParse(a);
999
+ }), { data: null, body: r, warnings: n };
1000
+ const o = t.safeParse(i);
998
1001
  if (!o.success) {
999
- const c = a.id;
1002
+ const c = i.id;
1000
1003
  return n.push({
1001
1004
  title: c ?? "(frontmatter)",
1002
1005
  message: o.error.issues.map((u) => u.message).join("; ")
1003
- }), { data: null, body: i, warnings: n };
1006
+ }), { data: null, body: r, warnings: n };
1004
1007
  }
1005
- return { data: o.data, body: i, warnings: n };
1008
+ return { data: o.data, body: r, warnings: n };
1006
1009
  }
1007
- function as(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
- warnings: r
1018
- } = ge(e, ct);
1019
- if (t.push(...r), !n)
1020
+ warnings: a
1021
+ } = ge(e, dt);
1022
+ if (t.push(...a), !n)
1020
1023
  return { entries: [], warnings: t };
1021
1024
  const {
1022
- body: i,
1023
- phases: a,
1025
+ body: r,
1026
+ phases: i,
1024
1027
  log: o,
1025
1028
  clarifications: c,
1026
1029
  notes: u,
1027
1030
  review: l
1028
- } = me(s), { body: f, entries: h } = q(i, it), { body: g, entries: w } = q(f, at), y = [...w, ...nn(o, c, u, l)];
1029
- n.kind === "note" && a.length > 0 && t.push({
1031
+ } = me(s), { body: f, entries: h } = q(r, it), { body: g, entries: w } = q(f, ot), y = [...w, ...rn(o, c, u, l)];
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 = as(n, qn);
1036
+ const m = ds(n, Wn);
1034
1037
  return { entries: [{
1035
1038
  id: n.id,
1036
1039
  title: n.title,
@@ -1049,21 +1052,21 @@ function dt(e) {
1049
1052
  order: n.order,
1050
1053
  issueSource: n.issueSource,
1051
1054
  body: g,
1052
- phases: a,
1055
+ phases: i,
1053
1056
  ...h.length > 0 && { fixes: h },
1054
1057
  ...y.length > 0 && { thread: y },
1055
1058
  ...m && { unknownFrontmatter: m }
1056
1059
  }], warnings: t };
1057
1060
  }
1058
- function Di(e) {
1061
+ function Hr(e) {
1059
1062
  const t = [], {
1060
1063
  data: n,
1061
1064
  body: s,
1062
- warnings: r
1063
- } = ge(e, Bn);
1064
- if (t.push(...r), !n)
1065
+ warnings: a
1066
+ } = ge(e, Un);
1067
+ if (t.push(...a), !n)
1065
1068
  return { entries: [], warnings: t };
1066
- const { body: i, phases: a, log: o, clarifications: c, notes: u, review: l } = me(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,
@@ -1076,43 +1079,43 @@ function Di(e) {
1076
1079
  audited: n.audited,
1077
1080
  auditedHash: n["audited-hash"],
1078
1081
  tags: n.tags ?? [],
1079
- body: i,
1080
- phases: a,
1082
+ body: r,
1083
+ phases: i,
1081
1084
  log: o,
1082
1085
  clarifications: c,
1083
1086
  notes: u,
1084
1087
  review: l
1085
1088
  }], warnings: t };
1086
1089
  }
1087
- function ji(e) {
1090
+ function Gr(e) {
1088
1091
  const {
1089
1092
  data: t,
1090
1093
  body: n,
1091
1094
  warnings: s
1092
- } = ge(e, Yn);
1095
+ } = ge(e, Kn);
1093
1096
  if (!t)
1094
1097
  return { entries: [], warnings: s };
1095
- const { body: r, entries: i } = q(n, H);
1098
+ const { body: a, entries: r } = q(n, H);
1096
1099
  return { entries: [{
1097
1100
  id: t.id,
1098
1101
  title: t.title,
1099
- body: r || "",
1102
+ body: a || "",
1100
1103
  ...t.kind && { kind: t.kind },
1101
1104
  ...t.status && { status: t.status },
1102
- ...i.length > 0 && { log: i }
1105
+ ...r.length > 0 && { log: r }
1103
1106
  }], warnings: s };
1104
1107
  }
1105
- const os = /^(IDEA-\d+):\s*/, cs = /\n---+\n/;
1106
- function Mi(e) {
1107
- return e.split(cs).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
- const s = n.match(/^#{1,3}\s+(.+)/m), r = s ? s[1].trim() : ((c = n.trim().split(`
1110
- `)[0]) == null ? void 0 : c.trim()) ?? "Untitled", i = r.match(os), a = (i == null ? void 0 : i[1]) ?? null, o = a ? r.slice(i[0].length) : r;
1111
- return { id: a, title: o, body: n.trim() };
1112
+ const s = n.match(/^#{1,3}\s+(.+)/m), a = s ? s[1].trim() : ((c = n.trim().split(`
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;
1114
+ return { id: i, title: o, body: n.trim() };
1112
1115
  });
1113
1116
  }
1114
- const Ne = 40;
1115
- function ds(e, t = []) {
1117
+ const Te = 40;
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({
@@ -1122,60 +1125,60 @@ function ds(e, t = []) {
1122
1125
  planId: s.id,
1123
1126
  message: `Subject "${s.subject}" isn't in the roadmap vocabulary — "${s.title}"`
1124
1127
  }), s.status !== "done" && s.status !== "dropped")) {
1125
- const r = [];
1126
- s.title.length > Ne && r.push(`${s.title.length} chars over the ${Ne}-char limit`), s.title.includes("—") && r.push("em-dash subtitle"), r.length > 0 && n.push({
1128
+ const a = [];
1129
+ s.title.length > Te && a.push(`${s.title.length} chars over the ${Te}-char limit`), s.title.includes("—") && a.push("em-dash subtitle"), a.length > 0 && n.push({
1127
1130
  kind: "title-style",
1128
1131
  section: "plans",
1129
1132
  title: s.title,
1130
1133
  planId: s.id,
1131
- message: `Title style — ${r.join(", ")}; the detail belongs in the body: "${s.title}"`
1134
+ message: `Title style — ${a.join(", ")}; the detail belongs in the body: "${s.title}"`
1132
1135
  });
1133
1136
  }
1134
1137
  return n;
1135
1138
  }
1136
- function us(e) {
1139
+ function ps(e) {
1137
1140
  const t = /* @__PURE__ */ new Map(), n = [];
1138
1141
  for (const s of e.split(`
1139
1142
  `)) {
1140
- const r = s.trim();
1141
- if (!r) continue;
1142
- let i;
1143
+ const a = s.trim();
1144
+ if (!a) continue;
1145
+ let r;
1143
1146
  try {
1144
- i = JSON.parse(r);
1147
+ r = JSON.parse(a);
1145
1148
  } catch {
1146
1149
  continue;
1147
1150
  }
1148
- const a = t.get(i.id);
1149
- a ? t.set(i.id, { ...a, ...i }) : (t.set(i.id, i), n.push(i.id));
1151
+ const i = t.get(r.id);
1152
+ i ? t.set(r.id, { ...i, ...r }) : (t.set(r.id, r), n.push(r.id));
1150
1153
  }
1151
1154
  return n.map((s) => t.get(s));
1152
1155
  }
1153
- function Li(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 r = ts.safeParse(JSON.parse(s));
1161
- r.success && t.push(r.data);
1163
+ const a = as.safeParse(JSON.parse(s));
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 Fi(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
1180
  const se = " — ";
1178
- function ls(e) {
1181
+ function hs(e) {
1179
1182
  return e.split(`
1180
1183
  `).map((t) => t.trim()).filter((t) => t.length > 0).map((t) => {
1181
1184
  const n = t.indexOf(se);
@@ -1185,102 +1188,102 @@ function ls(e) {
1185
1188
  };
1186
1189
  });
1187
1190
  }
1188
- function Hi(e) {
1191
+ function Ur(e) {
1189
1192
  return e.length === 0 ? "" : `${e.map((t) => `${t.id}${se}${t.title}`).join(`
1190
1193
  `)}
1191
1194
  `;
1192
1195
  }
1193
- async function fs(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 ps(e) {
1208
- const t = await lt(p(e, "..", "run-order.md"));
1209
- return new Map(ls(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 r = await ps(e);
1215
- for (const i of [e, p(e, "archive")]) {
1216
- const a = i !== e, o = (await fs(i)).filter((u) => u.endsWith(".md") && u !== "index.md");
1217
+ const a = await gs(e);
1218
+ for (const r of [e, p(e, "archive")]) {
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(i, 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)
1225
1228
  "entries" in u && t.push(
1226
1229
  ...u.entries.map((l) => ({
1227
1230
  ...l,
1228
- archived: a,
1231
+ archived: i,
1229
1232
  storedOrder: l.order,
1230
- order: r.get(l.id) ?? l.order
1233
+ order: a.get(l.id) ?? l.order
1231
1234
  }))
1232
1235
  ), n.push(...u.warnings);
1233
1236
  }
1234
1237
  return { entries: t, warnings: n, fileCount: s };
1235
1238
  }
1236
1239
  async function ye(e, t) {
1237
- const { entries: n, warnings: s } = await x(e), r = p(e, "..", ".."), [i, a] = await Promise.all([
1238
- tt(r, t),
1239
- Ke(r)
1240
+ const { entries: n, warnings: s } = await x(e), a = p(e, "..", ".."), [r, i] = await Promise.all([
1241
+ nt(a, t),
1242
+ We(a)
1240
1243
  ]);
1241
- return { entries: n, warnings: s, prs: i, resolved: i !== void 0, mainActivityIds: a };
1244
+ return { entries: n, warnings: s, prs: r, resolved: r !== void 0, mainActivityIds: i };
1242
1245
  }
1243
- async function Gi(e) {
1244
- const { entries: t, warnings: n, prs: s, resolved: r, mainActivityIds: i } = await ye(e), a = 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
- status: X(c, s == null ? void 0 : s.get(c.id), r, i.has(c.id))
1249
+ status: X(c, s == null ? void 0 : s.get(c.id), a, r.has(c.id))
1247
1250
  }));
1248
- return { entries: a.map((c) => {
1251
+ return { entries: i.map((c) => {
1249
1252
  if (c.kind !== "board" || c.archived || c.status === "done" || c.status === "dropped") return c;
1250
- const u = a.filter((l) => l.kind === "ticket" && l.idea === c.id).map((l) => l.status ?? "idea");
1251
- return { ...c, status: Be(u) };
1253
+ const u = i.filter((l) => l.kind === "ticket" && l.idea === c.id).map((l) => l.status ?? "idea");
1254
+ return { ...c, status: Ye(u) };
1252
1255
  }), warnings: n };
1253
1256
  }
1254
- async function Bi(e, t) {
1255
- const { entries: n, warnings: s, prs: r, resolved: i, mainActivityIds: a } = await ye(
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, r == null ? void 0 : r.get(u.id), i, a.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) };
1264
- }), warnings: s, resolved: i };
1266
+ return { ...u, status: Ye(l) };
1267
+ }), warnings: s, resolved: r };
1265
1268
  }
1266
- async function Yi(e) {
1269
+ async function Jr(e) {
1267
1270
  const { entries: t, prs: n, resolved: s } = await ye(e);
1268
1271
  return {
1269
- entries: t.flatMap((r) => {
1270
- const i = n == null ? void 0 : n.get(r.id);
1271
- return i && tn(r, i) ? [{ id: r.id, title: r.title, pr: i }] : [];
1272
+ entries: t.flatMap((a) => {
1273
+ const r = n == null ? void 0 : n.get(a.id);
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 qi(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(on),
1282
+ entries: t.filter((s) => s.kind === "note").map(un),
1280
1283
  warnings: n
1281
1284
  };
1282
1285
  }
1283
- const hs = [
1286
+ const ys = [
1284
1287
  {
1285
1288
  id: "frontmatter-schema",
1286
1289
  category: "metadata",
@@ -1329,6 +1332,12 @@ const hs = [
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",
@@ -1346,21 +1355,27 @@ const hs = [
1346
1355
  category: "tooling",
1347
1356
  severity: "warning",
1348
1357
  summary: ".claude/settings.json has no permissions.allow list, so a headless run denies every edit and shell command outside the defaults — run `paper-camp init --settings` to add it."
1358
+ },
1359
+ {
1360
+ id: "no-default-agents",
1361
+ category: "tooling",
1362
+ severity: "warning",
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."
1349
1364
  }
1350
- ], ms = Object.fromEntries(
1351
- hs.map((e) => [e.id, e])
1365
+ ], ws = Object.fromEntries(
1366
+ ys.map((e) => [e.id, e])
1352
1367
  );
1353
1368
  function U(e) {
1354
- return ms[e.rule].severity;
1369
+ return ws[e.rule].severity;
1355
1370
  }
1356
1371
  const xe = { error: 0, warning: 1 };
1357
- function ft(e) {
1372
+ function pt(e) {
1358
1373
  return [...e].sort(
1359
1374
  (t, n) => t.file.localeCompare(n.file) || t.line - n.line || xe[U(t)] - xe[U(n)] || t.rule.localeCompare(n.rule)
1360
1375
  );
1361
1376
  }
1362
- function Ui(e) {
1363
- const t = ft(e).map((n) => ({
1377
+ function Vr(e) {
1378
+ const t = pt(e).map((n) => ({
1364
1379
  ...n,
1365
1380
  severity: U(n)
1366
1381
  }));
@@ -1370,29 +1385,29 @@ function Ui(e) {
1370
1385
  warningCount: t.filter((n) => n.severity === "warning").length
1371
1386
  };
1372
1387
  }
1373
- function Ki(e) {
1374
- const t = ft(e);
1388
+ function Xr(e) {
1389
+ const t = pt(e);
1375
1390
  let n = 0, s = 0;
1376
- const r = t.map((a) => {
1377
- const o = U(a);
1378
- return o === "error" ? n++ : s++, `${a.file}:${a.line} ${o.padEnd(7)} ${a.rule} ${a.message}`;
1379
- }), i = t.length === 0 ? "paper-camp doctor: no issues found." : `paper-camp doctor: ${n} error(s), ${s} warning(s).`;
1391
+ const a = t.map((i) => {
1392
+ const o = U(i);
1393
+ return o === "error" ? n++ : s++, `${i.file}:${i.line} ${o.padEnd(7)} ${i.rule} ${i.message}`;
1394
+ }), r = t.length === 0 ? "paper-camp doctor: no issues found." : `paper-camp doctor: ${n} error(s), ${s} warning(s).`;
1380
1395
  return {
1381
- text: [...r, ...r.length > 0 ? [""] : [], i].join(`
1396
+ text: [...a, ...a.length > 0 ? [""] : [], r].join(`
1382
1397
  `),
1383
1398
  errorCount: n,
1384
1399
  warningCount: s
1385
1400
  };
1386
1401
  }
1387
- const R = 1;
1388
- class gs extends Error {
1402
+ const A = 1;
1403
+ class bs extends Error {
1389
1404
  constructor(t) {
1390
1405
  super(
1391
- `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.`
1392
1407
  ), this.name = "CorpusTooNewError";
1393
1408
  }
1394
1409
  }
1395
- async function pt(e) {
1410
+ async function ht(e) {
1396
1411
  let t;
1397
1412
  try {
1398
1413
  t = await v(e, "utf-8");
@@ -1406,25 +1421,25 @@ async function pt(e) {
1406
1421
  return null;
1407
1422
  }
1408
1423
  }
1409
- function ht(e) {
1424
+ function mt(e) {
1410
1425
  const t = e == null ? void 0 : e.version;
1411
1426
  return typeof t == "number" ? t : null;
1412
1427
  }
1413
- async function Wi(e) {
1414
- const t = ht(await pt(e));
1415
- if (t !== null && t > R)
1416
- throw new gs(t);
1428
+ async function Zr(e) {
1429
+ const t = mt(await ht(e));
1430
+ if (t !== null && t > A)
1431
+ throw new bs(t);
1417
1432
  }
1418
- async function Ji(e) {
1419
- const t = await pt(e);
1433
+ async function Qr(e) {
1434
+ const t = await ht(e);
1420
1435
  if (!t) return null;
1421
- const n = ht(t);
1422
- return n !== null && n >= R ? null : (t.version = R, await E(e, `${JSON.stringify(t, null, 2)}
1423
- `, "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 });
1424
1439
  }
1425
- const mt = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/, ys = 2;
1440
+ const gt = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/, vs = 2;
1426
1441
  function we(e) {
1427
- const t = e.content.match(mt);
1442
+ const t = e.content.match(gt);
1428
1443
  if (!t) return null;
1429
1444
  let n = null;
1430
1445
  try {
@@ -1434,105 +1449,105 @@ function we(e) {
1434
1449
  }
1435
1450
  return { yaml: t[1], data: n };
1436
1451
  }
1437
- function gt(e, t) {
1452
+ function yt(e, t) {
1438
1453
  const n = new RegExp(`^\\s*${t}:`), s = e.split(`
1439
- `).findIndex((r) => n.test(r));
1440
- return s === -1 ? 1 : ys + s;
1454
+ `).findIndex((a) => n.test(a));
1455
+ return s === -1 ? 1 : vs + s;
1441
1456
  }
1442
1457
  function be(e) {
1443
1458
  const t = we(e);
1444
- return t ? gt(t.yaml, "id") : 1;
1459
+ return t ? yt(t.yaml, "id") : 1;
1445
1460
  }
1446
- function yt(e) {
1461
+ function wt(e) {
1447
1462
  var n, s;
1448
1463
  const t = (s = (n = we(e)) == null ? void 0 : n.data) == null ? void 0 : s.id;
1449
1464
  return typeof t == "string" ? t : e.id;
1450
1465
  }
1451
- function A(e, t, n, s) {
1466
+ function R(e, t, n, s) {
1452
1467
  return { file: e.path, line: t, rule: n, message: s };
1453
1468
  }
1454
- const ws = ({ files: e }) => e.flatMap((t) => {
1455
- const n = t.content.match(mt);
1469
+ const Es = ({ files: e }) => e.flatMap((t) => {
1470
+ const n = t.content.match(gt);
1456
1471
  if (!n)
1457
- return [A(t, 1, "frontmatter-schema", "missing YAML frontmatter block")];
1472
+ return [R(t, 1, "frontmatter-schema", "missing YAML frontmatter block")];
1458
1473
  let s;
1459
1474
  try {
1460
1475
  s = V(n[1]);
1461
- } catch (i) {
1462
- return [A(t, 1, "frontmatter-schema", `invalid YAML: ${i.message}`)];
1476
+ } catch (r) {
1477
+ return [R(t, 1, "frontmatter-schema", `invalid YAML: ${r.message}`)];
1463
1478
  }
1464
1479
  if (typeof s != "object" || s === null || Array.isArray(s))
1465
- return [A(t, 1, "frontmatter-schema", "frontmatter is not a key/value mapping")];
1466
- const r = ct.safeParse(s);
1467
- return r.success ? [] : r.error.issues.map((i) => {
1468
- const a = String(i.path[0] ?? ""), o = i.path.length > 0 ? `${i.path.join(".")}: ${i.message}` : i.message;
1469
- return A(t, a ? gt(n[1], a) : 1, "frontmatter-schema", o);
1480
+ return [R(t, 1, "frontmatter-schema", "frontmatter is not a key/value mapping")];
1481
+ const a = dt.safeParse(s);
1482
+ return a.success ? [] : a.error.issues.map((r) => {
1483
+ const i = String(r.path[0] ?? ""), o = r.path.length > 0 ? `${r.path.join(".")}: ${r.message}` : r.message;
1484
+ return R(t, i ? yt(n[1], i) : 1, "frontmatter-schema", o);
1470
1485
  });
1471
- }), bs = ({ files: e }) => e.flatMap((t) => {
1472
- var s, r;
1473
- const n = (r = (s = we(t)) == null ? void 0 : s.data) == null ? void 0 : r.id;
1486
+ }), ks = ({ files: e }) => e.flatMap((t) => {
1487
+ var s, a;
1488
+ const n = (a = (s = we(t)) == null ? void 0 : s.data) == null ? void 0 : a.id;
1474
1489
  return typeof n != "string" || n === t.id ? [] : [
1475
- A(
1490
+ R(
1476
1491
  t,
1477
1492
  be(t),
1478
1493
  "filename-id-mismatch",
1479
1494
  `frontmatter id "${n}" does not match file name ${t.id}.md`
1480
1495
  )
1481
1496
  ];
1482
- }), vs = ({ files: e }) => {
1497
+ }), Ss = ({ files: e }) => {
1483
1498
  const t = /* @__PURE__ */ new Map();
1484
1499
  for (const s of e) {
1485
- const r = yt(s), i = t.get(r);
1486
- i ? i.push(s) : t.set(r, [s]);
1500
+ const a = wt(s), r = t.get(a);
1501
+ r ? r.push(s) : t.set(a, [s]);
1487
1502
  }
1488
1503
  const n = [];
1489
- for (const [s, r] of t) {
1490
- if (r.length < 2) continue;
1491
- const i = r.map((a) => a.path).join(", ");
1492
- for (const a of r)
1504
+ for (const [s, a] of t) {
1505
+ if (a.length < 2) continue;
1506
+ const r = a.map((i) => i.path).join(", ");
1507
+ for (const i of a)
1493
1508
  n.push(
1494
- A(
1495
- a,
1496
- be(a),
1509
+ R(
1510
+ i,
1511
+ be(i),
1497
1512
  "duplicate-id",
1498
- `id ${s} is defined by ${r.length} files: ${i}`
1513
+ `id ${s} is defined by ${a.length} files: ${r}`
1499
1514
  )
1500
1515
  );
1501
1516
  }
1502
1517
  return n;
1503
- }, Es = ({ files: e, config: t }) => {
1518
+ }, $s = ({ files: e, config: t }) => {
1504
1519
  var s;
1505
1520
  const n = (s = t == null ? void 0 : t.nextId) == null ? void 0 : s.idea;
1506
- return n == null ? [] : e.flatMap((r) => {
1507
- const i = yt(r), a = i.match(/^IDEA-(\d+)$/);
1508
- return a ? Number(a[1]) < n ? [] : [
1509
- A(
1510
- r,
1511
- be(r),
1521
+ return n == null ? [] : e.flatMap((a) => {
1522
+ const r = wt(a), i = r.match(/^IDEA-(\d+)$/);
1523
+ return i ? Number(i[1]) < n ? [] : [
1524
+ R(
1525
+ a,
1526
+ be(a),
1512
1527
  "id-counter-stale",
1513
- `id ${i} is >= config nextId.idea (${n}); the next minted id would collide`
1528
+ `id ${r} is >= config nextId.idea (${n}); the next minted id would collide`
1514
1529
  )
1515
1530
  ] : [];
1516
1531
  });
1517
- }, ks = ({ config: e }) => {
1532
+ }, Is = ({ config: e }) => {
1518
1533
  const t = e == null ? void 0 : e.version;
1519
- return typeof t != "number" || t <= R ? [] : [
1534
+ return typeof t != "number" || t <= A ? [] : [
1520
1535
  {
1521
1536
  file: "papercamp/config.json",
1522
1537
  line: 1,
1523
1538
  rule: "corpus-format-too-new",
1524
- 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`
1525
1540
  }
1526
1541
  ];
1527
- }, Ss = [
1528
- ws,
1529
- bs,
1530
- vs,
1542
+ }, As = [
1531
1543
  Es,
1532
- ks
1533
- ], $s = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/, Is = /^#{1,6}\s+(.+?)\s*$/, Rs = /^[-*]\s+\[[ xX]\]\s+(.*)$/, As = /^(phases|fixes)$/i, wt = /^#{1,6}\s+Phases\s*$/i, Ps = /^(?:\d{4}-\d{2}-\d{2}\s+)?\[(?:log|clarification|review|note|decision|question|chat)\]/, Cs = /^\[(?:phase:\d+|body)\]/, _s = /\[\[\s*((?:IDEA|TICKET)-\d+)(?:\s*\|[^\]]*)?\s*\]\]/g, Ts = /* @__PURE__ */ new Set(["idea", "planned", "in-progress", "review", "open"]), Ns = /* @__PURE__ */ new Set(["done", "dropped"]);
1534
- function ve(e) {
1535
- const t = e.match($s);
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);
1536
1551
  if (!t) return null;
1537
1552
  try {
1538
1553
  const n = V(t[1]);
@@ -1542,130 +1557,169 @@ function ve(e) {
1542
1557
  }
1543
1558
  return null;
1544
1559
  }
1545
- function xs(e, t) {
1560
+ function kt(e, t) {
1546
1561
  const n = e.split(`
1547
1562
  `).findIndex((s) => t.test(s));
1548
1563
  return n === -1 ? 1 : n + 1;
1549
1564
  }
1550
- function T(e, t, n, s) {
1565
+ function C(e, t, n, s) {
1551
1566
  return { file: e.path, line: t, rule: n, message: s };
1552
1567
  }
1553
- const Os = ({ files: e }) => e.flatMap((t) => {
1568
+ const js = ({ files: e }) => e.flatMap((t) => {
1554
1569
  const n = t.content.split(`
1555
1570
  `), s = [];
1556
- let r = !1;
1557
- for (let i = 0; i < n.length; i++) {
1558
- const a = n[i].match(Is);
1559
- if (a) {
1560
- r = As.test(a[1].trim());
1571
+ let a = !1;
1572
+ for (let r = 0; r < n.length; r++) {
1573
+ const i = n[r].match(bt);
1574
+ if (i) {
1575
+ a = Ps.test(i[1].trim());
1561
1576
  continue;
1562
1577
  }
1563
- if (r) continue;
1564
- const o = n[i].match(Rs);
1578
+ if (a) continue;
1579
+ const o = n[r].match(vt);
1565
1580
  if (!o) continue;
1566
1581
  const c = o[1].trim();
1567
- Ps.test(c) || Cs.test(c) || s.push(
1568
- T(
1582
+ Cs.test(c) || _s.test(c) || s.push(
1583
+ C(
1569
1584
  t,
1570
- i + 1,
1585
+ r + 1,
1571
1586
  "phases-list-split",
1572
- `orphaned phase checkbox outside any Phases section: "${n[i].trim()}"`
1587
+ `orphaned phase checkbox outside any Phases section: "${n[r].trim()}"`
1573
1588
  )
1574
1589
  );
1575
1590
  }
1576
1591
  return s;
1577
- }), Ds = ({ files: e }) => e.flatMap((t) => {
1578
- var r;
1579
- if (((r = ve(t.content)) == null ? void 0 : r.kind) !== "note") return [];
1592
+ }), Ms = ({ files: e }) => e.flatMap((t) => {
1593
+ var a;
1594
+ if (((a = Q(t.content)) == null ? void 0 : a.kind) !== "note") return [];
1580
1595
  const s = t.content.split(`
1581
- `).findIndex((i) => wt.test(i));
1582
- return s === -1 ? [] : [T(t, s + 1, "note-has-phases", "a kind: note entity carries a Phases section")];
1583
- }), js = ({ files: e }) => e.flatMap((t) => t.content.split(`
1584
- `).flatMap((r, i) => wt.test(r) ? [i] : []).slice(1).map(
1585
- (r) => 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(
1586
1601
  t,
1587
- r + 1,
1602
+ a + 1,
1588
1603
  "duplicate-phases-section",
1589
1604
  "a second Phases heading exists — a redraft must replace the existing list in place, not append a new one"
1590
1605
  )
1591
- )), Ms = ({ files: e }) => e.flatMap((t) => {
1592
- var r;
1593
- const n = (r = ve(t.content)) == null ? void 0 : r.status;
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) => {
1635
+ var a;
1636
+ const n = (a = Q(t.content)) == null ? void 0 : a.status;
1594
1637
  if (typeof n != "string") return [];
1595
- const s = xs(t.content, /^status:/);
1638
+ const s = kt(t.content, /^status:/);
1596
1639
  return t.archived && Ts.has(n) ? [
1597
- T(
1640
+ C(
1598
1641
  t,
1599
1642
  s,
1600
1643
  "archive-placement",
1601
1644
  `status "${n}" is active but the file is under ideas/archive/`
1602
1645
  )
1603
- ] : !t.archived && Ns.has(n) ? [
1604
- T(
1646
+ ] : !t.archived && xs.has(n) ? [
1647
+ C(
1605
1648
  t,
1606
1649
  s,
1607
1650
  "archive-placement",
1608
1651
  `status "${n}" is closed but the file is still under ideas/ — it should be archived`
1609
1652
  )
1610
1653
  ] : [];
1611
- }), Ls = ({ files: e }) => {
1654
+ }), Gs = ({ files: e }) => {
1612
1655
  var n;
1613
1656
  const t = /* @__PURE__ */ new Set();
1614
1657
  for (const s of e) {
1615
1658
  t.add(s.id);
1616
- const r = (n = ve(s.content)) == null ? void 0 : n.id;
1617
- typeof r == "string" && t.add(r);
1659
+ const a = (n = Q(s.content)) == null ? void 0 : n.id;
1660
+ typeof a == "string" && t.add(a);
1618
1661
  }
1619
1662
  return e.flatMap((s) => {
1620
- const r = s.content.split(`
1621
- `), i = [];
1622
- for (let a = 0; a < r.length; a++)
1623
- for (const o of r[a].matchAll(_s))
1624
- t.has(o[1]) || i.push(
1625
- T(
1663
+ const a = s.content.split(`
1664
+ `), r = [];
1665
+ for (let i = 0; i < a.length; i++)
1666
+ for (const o of a[i].matchAll(Ns))
1667
+ t.has(o[1]) || r.push(
1668
+ C(
1626
1669
  s,
1627
- a + 1,
1670
+ i + 1,
1628
1671
  "dangling-link",
1629
1672
  `[[${o[1]}]] points at an id no entity in the corpus defines`
1630
1673
  )
1631
1674
  );
1632
- return i;
1675
+ return r;
1633
1676
  });
1634
- }, Fs = [
1635
- Os,
1636
- Ds,
1677
+ }, Bs = [
1637
1678
  js,
1638
1679
  Ms,
1639
- Ls
1640
- ], Hs = ".claude/settings.json", Gs = ({ hasPermissionsAllow: e }) => e === !1 ? [
1680
+ Ls,
1681
+ Fs,
1682
+ Hs,
1683
+ Gs
1684
+ ], Ys = ".claude/settings.json", qs = ({ hasPermissionsAllow: e }) => e === !1 ? [
1641
1685
  {
1642
- file: Hs,
1686
+ file: Ys,
1643
1687
  line: 1,
1644
1688
  rule: "missing-permissions-allow",
1645
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."
1646
1690
  }
1647
- ] : [], Bs = [Gs], Ys = [
1648
- ...Ss,
1649
- ...Fs,
1650
- ...Bs
1691
+ ] : [], Us = ({ config: e }) => e && !e.defaultAgents ? [
1692
+ {
1693
+ file: "papercamp/config.json",
1694
+ line: 1,
1695
+ rule: "no-default-agents",
1696
+ message: "no defaultAgents — every run uses the built-in agent and model; choose them in Settings → General."
1697
+ }
1698
+ ] : [], Ks = [
1699
+ qs,
1700
+ Us
1701
+ ], Ws = [
1702
+ ...As,
1703
+ ...Bs,
1704
+ ...Ks
1651
1705
  ];
1652
- function Ee(e) {
1706
+ function ve(e) {
1653
1707
  return (e == null ? void 0 : e.code) === "ENOENT";
1654
1708
  }
1655
- async function qs(e) {
1709
+ async function Js(e) {
1656
1710
  try {
1657
1711
  return await z(e);
1658
1712
  } catch (t) {
1659
- if (Ee(t)) return [];
1713
+ if (ve(t)) return [];
1660
1714
  throw t;
1661
1715
  }
1662
1716
  }
1663
- async function Us(e) {
1717
+ async function zs(e) {
1664
1718
  let t;
1665
1719
  try {
1666
1720
  t = await v(e, "utf-8");
1667
1721
  } catch (n) {
1668
- if (Ee(n)) return null;
1722
+ if (ve(n)) return null;
1669
1723
  throw n;
1670
1724
  }
1671
1725
  try {
@@ -1674,13 +1728,13 @@ async function Us(e) {
1674
1728
  return null;
1675
1729
  }
1676
1730
  }
1677
- async function Ks(e) {
1731
+ async function Vs(e) {
1678
1732
  var n;
1679
1733
  let t;
1680
1734
  try {
1681
1735
  t = await v(p(e, ".claude", "settings.json"), "utf-8");
1682
1736
  } catch (s) {
1683
- if (Ee(s)) return !1;
1737
+ if (ve(s)) return !1;
1684
1738
  throw s;
1685
1739
  }
1686
1740
  try {
@@ -1690,62 +1744,62 @@ async function Ks(e) {
1690
1744
  return !1;
1691
1745
  }
1692
1746
  }
1693
- async function Ws(e) {
1747
+ async function Xs(e) {
1694
1748
  const t = p(e, "ideas"), n = [], s = [
1695
1749
  { dir: t, archived: !1, names: await z(t) },
1696
1750
  {
1697
1751
  dir: p(t, "archive"),
1698
1752
  archived: !0,
1699
- names: await qs(p(t, "archive"))
1753
+ names: await Js(p(t, "archive"))
1700
1754
  }
1701
1755
  ];
1702
- for (const { dir: r, archived: i, names: a } of s) {
1703
- const o = a.filter((c) => c.endsWith(".md") && c !== "index.md").sort();
1756
+ for (const { dir: a, archived: r, names: i } of s) {
1757
+ const o = i.filter((c) => c.endsWith(".md") && c !== "index.md").sort();
1704
1758
  for (const c of o)
1705
1759
  n.push({
1706
- id: Ft(c, ".md"),
1707
- path: `papercamp/ideas${i ? "/archive" : ""}/${c}`,
1708
- content: await v(p(r, c), "utf-8"),
1709
- archived: i
1760
+ id: Bt(c, ".md"),
1761
+ path: `papercamp/ideas${r ? "/archive" : ""}/${c}`,
1762
+ content: await v(p(a, c), "utf-8"),
1763
+ archived: r
1710
1764
  });
1711
1765
  }
1712
1766
  return {
1713
1767
  files: n,
1714
- config: await Us(p(e, "config.json")),
1715
- hasPermissionsAllow: await Ks(M(e))
1768
+ config: await zs(p(e, "config.json")),
1769
+ hasPermissionsAllow: await Vs(M(e))
1716
1770
  };
1717
1771
  }
1718
- function Js(e) {
1719
- return Ys.flatMap((t) => t(e));
1772
+ function Zs(e) {
1773
+ return Ws.flatMap((t) => t(e));
1720
1774
  }
1721
- async function zi(e) {
1722
- return Js(await Ws(e));
1775
+ async function ei(e) {
1776
+ return Zs(await Xs(e));
1723
1777
  }
1724
- const zs = {
1778
+ const Qs = {
1725
1779
  rule: "archive-placement",
1726
1780
  fix: (e, t) => ({
1727
1781
  kind: "move",
1728
1782
  from: t.path,
1729
1783
  to: t.archived ? t.path.replace("/archive/", "/") : t.path.replace(/\/(?=[^/]+$)/, "/archive/")
1730
1784
  })
1731
- }, Vs = [zs], Xs = new Map(
1732
- Vs.map((e) => [e.rule, e])
1785
+ }, ea = [Qs], ta = new Map(
1786
+ ea.map((e) => [e.rule, e])
1733
1787
  );
1734
- function Vi(e, t) {
1735
- const n = new Map(e.files.map((o) => [o.path, o])), s = [], r = [], i = [], a = [];
1788
+ function ti(e, t) {
1789
+ const n = new Map(e.files.map((o) => [o.path, o])), s = [], a = [], r = [], i = [];
1736
1790
  for (const o of t) {
1737
- 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;
1738
1792
  if (!l) {
1739
- i.push(o);
1793
+ r.push(o);
1740
1794
  continue;
1741
1795
  }
1742
1796
  if (l.kind === "move" && n.has(l.to)) {
1743
- a.push(o);
1797
+ i.push(o);
1744
1798
  continue;
1745
1799
  }
1746
- s.push(l), r.push(o);
1800
+ s.push(l), a.push(o);
1747
1801
  }
1748
- return { actions: s, fixed: r, unfixable: i, rejected: a };
1802
+ return { actions: s, fixed: a, unfixable: r, rejected: i };
1749
1803
  }
1750
1804
  async function K(e) {
1751
1805
  try {
@@ -1754,71 +1808,71 @@ async function K(e) {
1754
1808
  return "";
1755
1809
  }
1756
1810
  }
1757
- function bt(e, t) {
1811
+ function St(e, t) {
1758
1812
  var n;
1759
1813
  return (n = e.split(`
1760
1814
  `).find((s) => s.includes(`(${t})`))) == null ? void 0 : n.trim();
1761
1815
  }
1762
- const Zs = /^## \[.+?\]\(.*\/compare\/(.+?)\.\.\.(.+?)\)/;
1763
- function Qs(e) {
1816
+ const na = /^## \[.+?\]\(.*\/compare\/(.+?)\.\.\.(.+?)\)/;
1817
+ function sa(e) {
1764
1818
  return e.split(`
1765
- `).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]}` }));
1766
1820
  }
1767
- function er(e, t) {
1821
+ function aa(e, t) {
1768
1822
  return e.split(`
1769
1823
  `).find((n) => {
1770
1824
  const s = n.match(/\/commit\/([0-9a-f]+)\)/i);
1771
1825
  return s ? s[1].startsWith(t) || t.startsWith(s[1]) : !1;
1772
1826
  });
1773
1827
  }
1774
- const tr = /^[a-z]+\/([a-z]+-\d+)-/;
1775
- async function nr(e, t) {
1776
- var r;
1828
+ const ra = /^[a-z]+\/([a-z]+-\d+)-/;
1829
+ async function ia(e, t) {
1830
+ var a;
1777
1831
  const n = await S(e, [
1778
1832
  "for-each-ref",
1779
1833
  "--format=%(refname)",
1780
1834
  "refs/heads",
1781
1835
  "refs/remotes"
1782
1836
  ]), s = t.toLowerCase();
1783
- for (const i of n.split(`
1837
+ for (const r of n.split(`
1784
1838
  `)) {
1785
- const a = i.replace(/^refs\/heads\//, "").replace(/^refs\/remotes\/[^/]+\//, "");
1786
- if (((r = tr.exec(a)) == null ? void 0 : r[1]) === s) return a;
1839
+ const i = r.replace(/^refs\/heads\//, "").replace(/^refs\/remotes\/[^/]+\//, "");
1840
+ if (((a = ra.exec(i)) == null ? void 0 : a[1]) === s) return i;
1787
1841
  }
1788
1842
  }
1789
- async function sr(e, t) {
1790
- const n = await nr(e, t);
1843
+ async function oa(e, t) {
1844
+ const n = await ia(e, t);
1791
1845
  if (!n) return [];
1792
- const s = await Ue(e);
1846
+ const s = await Ke(e);
1793
1847
  return (await S(e, ["log", "--format=%s", `${s}..${n}`])).split(`
1794
- `).map((i) => i.trim()).filter(Boolean);
1848
+ `).map((r) => r.trim()).filter(Boolean);
1795
1849
  }
1796
- async function rr(e, t) {
1797
- if (!cn.test(t)) return null;
1850
+ async function ca(e, t) {
1851
+ if (!ln.test(t)) return null;
1798
1852
  const n = await S(e, ["log", "-1", "--format=%B", t]), s = n ? ne(n) : null;
1799
1853
  if (s) return s;
1800
- const r = await K(p(e, "CHANGELOG.md")), i = er(r, t);
1801
- return i ? ne(i) : null;
1854
+ const a = await K(p(e, "CHANGELOG.md")), r = aa(a, t);
1855
+ return r ? ne(r) : null;
1802
1856
  }
1803
- async function ir(e, t) {
1857
+ async function da(e, t) {
1804
1858
  const s = (await S(e, ["log", "--format=%H", "--reverse", t])).split(`
1805
- `).map((a) => a.trim()).filter(Boolean), r = await Promise.all(s.map((a) => rr(e, a))), i = /* @__PURE__ */ new Map();
1806
- return s.forEach((a, o) => {
1807
- const c = r[o];
1859
+ `).map((i) => i.trim()).filter(Boolean), a = await Promise.all(s.map((i) => ca(e, i))), r = /* @__PURE__ */ new Map();
1860
+ return s.forEach((i, o) => {
1861
+ const c = a[o];
1808
1862
  if (!c) return;
1809
- const u = i.get(c);
1810
- u ? u.push(a) : i.set(c, [a]);
1811
- }), i;
1863
+ const u = r.get(c);
1864
+ u ? u.push(i) : r.set(c, [i]);
1865
+ }), r;
1812
1866
  }
1813
- async function Xi(e, t) {
1814
- const [{ entries: n }, s, r, i, a, o] = await Promise.all([
1867
+ async function ni(e, t) {
1868
+ const [{ entries: n }, s, a, r, i, o] = await Promise.all([
1815
1869
  x(p(e, "papercamp", "ideas")),
1816
- tt(e),
1870
+ nt(e),
1817
1871
  K(p(e, "papercamp", "tasks.log")),
1818
1872
  K(p(e, "CHANGELOG.md")),
1819
- sr(e, t),
1820
- Ke(e)
1821
- ]), c = n.find((h) => h.id === t), u = s == null ? void 0 : s.get(t), l = us(r).filter((h) => h.planId === t), f = bt(i, 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);
1822
1876
  return {
1823
1877
  id: t,
1824
1878
  idea: c ? {
@@ -1831,46 +1885,46 @@ async function Xi(e, t) {
1831
1885
  } : { reached: !1 },
1832
1886
  phases: c ? { reached: c.phases.length > 0, data: c.phases } : { reached: !1 },
1833
1887
  taskRuns: l.length > 0 ? { reached: !0, data: l } : { reached: !1 },
1834
- commits: a.length > 0 ? { reached: !0, data: a } : { reached: !1 },
1888
+ commits: i.length > 0 ? { reached: !0, data: i } : { reached: !1 },
1835
1889
  pr: u ? { reached: !0, data: u } : { reached: !1 },
1836
1890
  releaseLine: f ? { reached: !0, data: f } : { reached: !1 }
1837
1891
  };
1838
1892
  }
1839
- const B = /^##\s+/, ar = /^##\s+The goal\s*$/i, vt = /^##\s+(Horizon\s+\d+\s*[—-].*)\r?$/i, or = /^##\s+Standing concerns\s*$/i, N = /^-\s+\*\*(.+?)\*\*\s+[—-]\s+(.*)\r?$/, cr = /^\s+-\s+→\s+(.+?)\r?$/, dr = /^([A-Z]+-\d+)/, Et = /^\s+-\s+✓\s+shipped\s+(.+?)\r?$/, ke = /^\s+-\s+(.+?)\r?$/, Se = /^\s+\S/;
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/;
1840
1894
  function Oe(e, t, n) {
1841
- var i;
1895
+ var r;
1842
1896
  const s = [];
1843
- let r = t;
1844
- for (; r < n; ) {
1845
- const a = e[r].match(N);
1846
- if (!a) {
1847
- r++;
1897
+ let a = t;
1898
+ for (; a < n; ) {
1899
+ const i = e[a].match(T);
1900
+ if (!i) {
1901
+ a++;
1848
1902
  continue;
1849
1903
  }
1850
- const o = [a[2].trim()], c = [], u = [];
1904
+ const o = [i[2].trim()], c = [], u = [];
1851
1905
  let l;
1852
- for (r++; r < n && !N.test(e[r]); ) {
1853
- const f = e[r].match(cr);
1906
+ for (a++; a < n && !T.test(e[a]); ) {
1907
+ const f = e[a].match(fa);
1854
1908
  if (f) {
1855
1909
  const w = f[1].trim();
1856
- u.push(((i = w.match(dr)) == null ? void 0 : i[1]) ?? w), r++;
1910
+ u.push(((r = w.match(pa)) == null ? void 0 : r[1]) ?? w), a++;
1857
1911
  continue;
1858
1912
  }
1859
- const h = e[r].match(Et);
1913
+ const h = e[a].match(It);
1860
1914
  if (h) {
1861
- l = h[1].trim(), r++;
1915
+ l = h[1].trim(), a++;
1862
1916
  continue;
1863
1917
  }
1864
- const g = e[r].match(ke);
1918
+ const g = e[a].match(Ee);
1865
1919
  if (g) {
1866
- c.push(g[1].trim()), r++;
1920
+ c.push(g[1].trim()), a++;
1867
1921
  continue;
1868
1922
  }
1869
- if (!Se.test(e[r])) break;
1870
- o.push(e[r].trim()), r++;
1923
+ if (!ke.test(e[a])) break;
1924
+ o.push(e[a].trim()), a++;
1871
1925
  }
1872
1926
  s.push({
1873
- name: a[1].trim(),
1927
+ name: i[1].trim(),
1874
1928
  description: o.join(" "),
1875
1929
  candidates: c,
1876
1930
  linked: u,
@@ -1879,174 +1933,174 @@ function Oe(e, t, n) {
1879
1933
  }
1880
1934
  return s;
1881
1935
  }
1882
- function ur(e) {
1936
+ function ha(e) {
1883
1937
  const t = e.split(`
1884
1938
  `);
1885
1939
  let n = "";
1886
1940
  const s = [];
1887
- let r = [];
1888
- for (let i = 0; i < t.length; i++) {
1889
- if (ar.test(t[i])) {
1890
- let o = i + 1;
1941
+ let a = [];
1942
+ for (let r = 0; r < t.length; r++) {
1943
+ if (ua.test(t[r])) {
1944
+ let o = r + 1;
1891
1945
  for (; o < t.length && !B.test(t[o]); ) o++;
1892
- n = t.slice(i + 1, o).join(`
1893
- `).trim(), i = o - 1;
1946
+ n = t.slice(r + 1, o).join(`
1947
+ `).trim(), r = o - 1;
1894
1948
  continue;
1895
1949
  }
1896
- const a = t[i].match(vt);
1897
- if (a) {
1898
- let o = i + 1;
1950
+ const i = t[r].match($t);
1951
+ if (i) {
1952
+ let o = r + 1;
1899
1953
  for (; o < t.length && !B.test(t[o]); ) o++;
1900
- let c = i + 1;
1901
- for (; c < o && !N.test(t[c]); ) c++;
1902
- const u = t.slice(i + 1, c).join(`
1954
+ let c = r + 1;
1955
+ for (; c < o && !T.test(t[c]); ) c++;
1956
+ const u = t.slice(r + 1, c).join(`
1903
1957
  `).trim();
1904
1958
  s.push({
1905
- title: a[1].trim(),
1959
+ title: i[1].trim(),
1906
1960
  intro: u,
1907
- items: Oe(t, i + 1, o)
1908
- }), i = o - 1;
1961
+ items: Oe(t, r + 1, o)
1962
+ }), r = o - 1;
1909
1963
  continue;
1910
1964
  }
1911
- if (or.test(t[i])) {
1912
- let o = i + 1;
1965
+ if (la.test(t[r])) {
1966
+ let o = r + 1;
1913
1967
  for (; o < t.length && !B.test(t[o]); ) o++;
1914
- r = Oe(t, i + 1, o), i = o - 1;
1968
+ a = Oe(t, r + 1, o), r = o - 1;
1915
1969
  }
1916
1970
  }
1917
- return { goal: n, horizons: s, standingConcerns: r };
1971
+ return { goal: n, horizons: s, standingConcerns: a };
1918
1972
  }
1919
1973
  function W(e, t) {
1920
1974
  for (let n = 0; n < e.length; n++) {
1921
- const s = e[n].match(vt);
1975
+ const s = e[n].match($t);
1922
1976
  if (!s || s[1].trim() !== t) continue;
1923
- let r = n + 1;
1924
- for (; r < e.length && !B.test(e[r]); ) r++;
1925
- return { start: n + 1, end: r };
1977
+ let a = n + 1;
1978
+ for (; a < e.length && !B.test(e[a]); ) a++;
1979
+ return { start: n + 1, end: a };
1926
1980
  }
1927
1981
  }
1928
1982
  function O(e, t, n) {
1929
1983
  const s = W(e, t);
1930
1984
  if (s)
1931
- for (let r = s.start; r < s.end; r++) {
1932
- const i = e[r].match(N);
1933
- if (!i || i[1].trim() !== n) continue;
1934
- let a = r + 1;
1935
- for (; a < s.end && !N.test(e[a]) && Se.test(e[a]); )
1936
- a++;
1937
- return { start: r, end: a };
1985
+ for (let a = s.start; a < s.end; a++) {
1986
+ const r = e[a].match(T);
1987
+ if (!r || r[1].trim() !== n) continue;
1988
+ let i = a + 1;
1989
+ for (; i < s.end && !T.test(e[i]) && ke.test(e[i]); )
1990
+ i++;
1991
+ return { start: a, end: i };
1938
1992
  }
1939
1993
  }
1940
- function Zi(e, t, n, s) {
1941
- const r = e.split(`
1942
- `), i = O(r, t, n);
1943
- if (!i) return e;
1994
+ function si(e, t, n, s) {
1995
+ const a = e.split(`
1996
+ `), r = O(a, t, n);
1997
+ if (!r) return e;
1944
1998
  if (s === void 0)
1945
- return r.splice(i.start, i.end - i.start), r.join(`
1999
+ return a.splice(r.start, r.end - r.start), a.join(`
1946
2000
  `);
1947
- for (let a = i.start + 1; a < i.end; a++) {
1948
- const o = r[a].match(ke);
2001
+ for (let i = r.start + 1; i < r.end; i++) {
2002
+ const o = a[i].match(Ee);
1949
2003
  if (o && o[1].trim() === s)
1950
- return r.splice(a, 1), r.join(`
2004
+ return a.splice(i, 1), a.join(`
1951
2005
  `);
1952
2006
  }
1953
2007
  return e;
1954
2008
  }
1955
- function Qi(e, t, n, s) {
2009
+ function ai(e, t, n, s) {
1956
2010
  var u, l;
1957
- const r = e.split(`
1958
- `), i = O(r, t, n);
2011
+ const a = e.split(`
2012
+ `), r = O(a, t, n);
2013
+ if (!r) return e;
2014
+ const i = a[r.start].match(T);
1959
2015
  if (!i) return e;
1960
- const a = r[i.start].match(N);
1961
- if (!a) return e;
1962
- const o = ((u = s.name) == null ? void 0 : u.trim()) ?? a[1].trim(), c = ((l = s.description) == null ? void 0 : l.trim()) ?? a[2].trim();
1963
- if (r[i.start] = `- **${o}** — ${c}`, s.description !== void 0)
1964
- for (let f = i.end - 1; f > i.start; f--)
1965
- Se.test(r[f]) && !ke.test(r[f]) && r.splice(f, 1);
1966
- return r.join(`
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();
2017
+ if (a[r.start] = `- **${o}** — ${c}`, s.description !== void 0)
2018
+ for (let f = r.end - 1; f > r.start; f--)
2019
+ ke.test(a[f]) && !Ee.test(a[f]) && a.splice(f, 1);
2020
+ return a.join(`
1967
2021
  `);
1968
2022
  }
1969
- function ea(e, t, n, s) {
2023
+ function ri(e, t, n, s) {
1970
2024
  if (t === s) return e;
1971
- const r = e.split(`
1972
- `), i = O(r, t, n);
1973
- if (!i || !W(r, s)) return e;
1974
- const a = r.splice(i.start, i.end - i.start), o = W(r, s);
2025
+ const a = e.split(`
2026
+ `), r = O(a, t, n);
2027
+ if (!r || !W(a, s)) return e;
2028
+ const i = a.splice(r.start, r.end - r.start), o = W(a, s);
1975
2029
  if (!o) return e;
1976
2030
  let c = o.end;
1977
- for (; c > o.start && r[c - 1].trim() === ""; ) c--;
1978
- return r.splice(c, 0, ...a), r.join(`
2031
+ for (; c > o.start && a[c - 1].trim() === ""; ) c--;
2032
+ return a.splice(c, 0, ...i), a.join(`
1979
2033
  `);
1980
2034
  }
1981
- function ta(e, t, n, s) {
1982
- const r = e.split(`
1983
- `), i = O(r, t, n);
1984
- if (!i) return e;
1985
- let a = i.end;
1986
- for (let o = i.start + 1; o < a; o++)
1987
- if (Et.test(r[o])) {
1988
- r.splice(o, 1), a--;
2035
+ function ii(e, t, n, s) {
2036
+ const a = e.split(`
2037
+ `), r = O(a, t, n);
2038
+ if (!r) return e;
2039
+ let i = r.end;
2040
+ for (let o = r.start + 1; o < i; o++)
2041
+ if (It.test(a[o])) {
2042
+ a.splice(o, 1), i--;
1989
2043
  break;
1990
2044
  }
1991
- return s !== void 0 && r.splice(a, 0, ` - ✓ shipped ${s}`), r.join(`
2045
+ return s !== void 0 && a.splice(i, 0, ` - ✓ shipped ${s}`), a.join(`
1992
2046
  `);
1993
2047
  }
1994
- function na(e, t, n, s) {
1995
- const r = e.split(`
1996
- `), i = W(r, t);
1997
- if (!i) return e;
1998
- let a = i.end;
1999
- for (; a > i.start && r[a - 1].trim() === ""; ) a--;
2000
- return r.splice(a, 0, `- **${n}** — ${s}`), r.join(`
2048
+ function oi(e, t, n, s) {
2049
+ const a = e.split(`
2050
+ `), r = W(a, t);
2051
+ if (!r) return e;
2052
+ let i = r.end;
2053
+ for (; i > r.start && a[i - 1].trim() === ""; ) i--;
2054
+ return a.splice(i, 0, `- **${n}** — ${s}`), a.join(`
2001
2055
  `);
2002
2056
  }
2003
- function sa(e, t, n, s) {
2004
- const r = e.split(`
2005
- `), i = O(r, t, n);
2006
- return i ? (r.splice(i.end, 0, ` - ${s}`), r.join(`
2057
+ function ci(e, t, n, s) {
2058
+ const a = e.split(`
2059
+ `), r = O(a, t, n);
2060
+ return r ? (a.splice(r.end, 0, ` - ${s}`), a.join(`
2007
2061
  `)) : e;
2008
2062
  }
2009
- function ra(e, t, n, s) {
2010
- const r = e.split(`
2011
- `), i = O(r, t, n);
2012
- return i ? (r.splice(i.end, 0, ` - → ${s}`), r.join(`
2063
+ function di(e, t, n, s) {
2064
+ const a = e.split(`
2065
+ `), r = O(a, t, n);
2066
+ return r ? (a.splice(r.end, 0, ` - → ${s}`), a.join(`
2013
2067
  `)) : e;
2014
2068
  }
2015
- function kt(e) {
2069
+ function At(e) {
2016
2070
  return [
2017
2071
  ...e.horizons.flatMap((t) => t.items.map((n) => n.name)),
2018
2072
  ...e.standingConcerns.map((t) => t.name)
2019
2073
  ];
2020
2074
  }
2021
- function lr(e, t, n, s) {
2022
- const r = /* @__PURE__ */ new Map();
2023
- for (const i of t)
2024
- i.id && i.subject === e.name && r.set(i.id, i);
2025
- for (const i of e.linked) {
2026
- const a = n.get(i);
2027
- a && r.set(i, a);
2028
- }
2029
- return [...r.entries()].map(([i, a]) => ({
2030
- id: i,
2031
- title: a.title,
2032
- status: a.status,
2033
- pr: a.pr,
2034
- released: bt(s, i) !== void 0
2075
+ function ma(e, t, n, s) {
2076
+ const a = /* @__PURE__ */ new Map();
2077
+ for (const r of t)
2078
+ r.id && r.subject === e.name && a.set(r.id, r);
2079
+ for (const r of e.linked) {
2080
+ const i = n.get(r);
2081
+ i && a.set(r, i);
2082
+ }
2083
+ return [...a.entries()].map(([r, i]) => ({
2084
+ id: r,
2085
+ title: i.title,
2086
+ status: i.status,
2087
+ pr: i.pr,
2088
+ released: St(s, r) !== void 0
2035
2089
  }));
2036
2090
  }
2037
- function fr(e) {
2091
+ function ga(e) {
2038
2092
  const t = e.filter((s) => s.status !== "dropped"), n = t.filter((s) => s.status === "done").length;
2039
2093
  return { total: t.length, done: n, open: t.length - n };
2040
2094
  }
2041
- function pr(e, t) {
2095
+ function ya(e, t) {
2042
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 };
2043
2097
  }
2044
2098
  function De(e, t, n, s) {
2045
- const r = lr(e, t, n, s), i = fr(r), { state: a, readyToShip: o } = pr(e, i);
2046
- return { ...e, ideas: r, rollup: i, state: a, readyToShip: o };
2099
+ const a = ma(e, t, n, s), r = ga(a), { state: i, readyToShip: o } = ya(e, r);
2100
+ return { ...e, ideas: a, rollup: r, state: i, readyToShip: o };
2047
2101
  }
2048
- function ia(e, t, n = "") {
2049
- const s = new Map(t.filter((c) => c.id).map((c) => [c.id, c])), r = e.horizons.map((c) => {
2102
+ function ui(e, t, n = "") {
2103
+ const s = new Map(t.filter((c) => c.id).map((c) => [c.id, c])), a = e.horizons.map((c) => {
2050
2104
  const u = c.items.map((f) => De(f, t, s, n)), l = u.reduce(
2051
2105
  (f, h) => ({
2052
2106
  total: f.total + h.rollup.total,
@@ -2056,14 +2110,14 @@ function ia(e, t, n = "") {
2056
2110
  { total: 0, done: 0, open: 0 }
2057
2111
  );
2058
2112
  return { title: c.title, intro: c.intro, items: u, rollup: l };
2059
- }), i = e.standingConcerns.map(
2113
+ }), r = e.standingConcerns.map(
2060
2114
  (c) => De(c, t, s, n)
2061
- ), a = new Set(kt(e)), o = t.filter(
2062
- (c) => !c.subject || !a.has(c.subject)
2115
+ ), i = new Set(At(e)), o = t.filter(
2116
+ (c) => !c.subject || !i.has(c.subject)
2063
2117
  );
2064
- return { goal: e.goal, horizons: r, standingConcerns: i, unfiled: o };
2118
+ return { goal: e.goal, horizons: a, standingConcerns: r, unfiled: o };
2065
2119
  }
2066
- function hr(e) {
2120
+ function wa(e) {
2067
2121
  const t = JSON.stringify({
2068
2122
  body: e.body,
2069
2123
  phases: e.phases.map((n) => ({
@@ -2073,9 +2127,9 @@ function hr(e) {
2073
2127
  source: n.source ?? null
2074
2128
  }))
2075
2129
  });
2076
- return qt("sha256").update(t).digest("hex");
2130
+ return Wt("sha256").update(t).digest("hex");
2077
2131
  }
2078
- const $e = /* @__PURE__ */ new Set([
2132
+ const Se = /* @__PURE__ */ new Set([
2079
2133
  "core",
2080
2134
  "cli",
2081
2135
  "app",
@@ -2095,12 +2149,12 @@ const $e = /* @__PURE__ */ new Set([
2095
2149
  "release",
2096
2150
  "main"
2097
2151
  ]);
2098
- function mr(e, t) {
2099
- return (e == null ? void 0 : e.find((n) => $e.has(n))) ?? t;
2152
+ function ba(e, t) {
2153
+ return (e == null ? void 0 : e.find((n) => Se.has(n))) ?? t;
2100
2154
  }
2101
- function St(e, t) {
2155
+ function Rt(e, t) {
2102
2156
  return new Promise((n) => {
2103
- var i, a;
2157
+ var r, i;
2104
2158
  const s = b(
2105
2159
  "gh",
2106
2160
  ["pr", "view", t, "--json", "title,body,headRefName,labels,isDraft,state,url,comments"],
@@ -2109,119 +2163,119 @@ function St(e, t) {
2109
2163
  stdio: ["ignore", "pipe", "pipe"]
2110
2164
  }
2111
2165
  );
2112
- let r = "";
2113
- (i = s.stdout) == null || i.on("data", (o) => {
2114
- r += o.toString();
2115
- }), (a = s.stderr) == null || a.on("data", () => {
2166
+ let a = "";
2167
+ (r = s.stdout) == null || r.on("data", (o) => {
2168
+ a += o.toString();
2169
+ }), (i = s.stderr) == null || i.on("data", () => {
2116
2170
  }), s.on("close", (o) => {
2117
2171
  if (o !== 0) {
2118
2172
  n(void 0);
2119
2173
  return;
2120
2174
  }
2121
2175
  try {
2122
- n(JSON.parse(r));
2176
+ n(JSON.parse(a));
2123
2177
  } catch {
2124
2178
  n(void 0);
2125
2179
  }
2126
2180
  }), s.on("error", () => n(void 0));
2127
2181
  });
2128
2182
  }
2129
- const gr = 6e4;
2130
- function aa(e, t, n = gr) {
2183
+ const va = 6e4;
2184
+ function li(e, t, n = va) {
2131
2185
  return new Promise((s) => {
2132
- var a, o;
2133
- const r = b("gh", ["pr", "diff", t], { cwd: e, stdio: ["ignore", "pipe", "pipe"] });
2134
- let i = "";
2135
- (a = r.stdout) == null || a.on("data", (c) => {
2136
- i += c.toString();
2137
- }), (o = r.stderr) == null || o.on("data", () => {
2138
- }), r.on("close", (c) => {
2186
+ var i, o;
2187
+ const a = b("gh", ["pr", "diff", t], { cwd: e, stdio: ["ignore", "pipe", "pipe"] });
2188
+ let r = "";
2189
+ (i = a.stdout) == null || i.on("data", (c) => {
2190
+ r += c.toString();
2191
+ }), (o = a.stderr) == null || o.on("data", () => {
2192
+ }), a.on("close", (c) => {
2139
2193
  if (c !== 0) {
2140
2194
  s(void 0);
2141
2195
  return;
2142
2196
  }
2143
2197
  s(
2144
- i.length > n ? `${i.slice(0, n)}
2145
- ... (diff truncated, exceeds size cap)` : i
2198
+ r.length > n ? `${r.slice(0, n)}
2199
+ ... (diff truncated, exceeds size cap)` : r
2146
2200
  );
2147
- }), r.on("error", () => s(void 0));
2201
+ }), a.on("error", () => s(void 0));
2148
2202
  });
2149
2203
  }
2150
- async function yr(e, t) {
2204
+ async function Ea(e, t) {
2151
2205
  for (const n of ["ideas", p("ideas", "archive")]) {
2152
2206
  const s = p(e, "papercamp", n, `${t}.md`);
2153
2207
  try {
2154
- return await jt(s), s;
2208
+ return await Ht(s), s;
2155
2209
  } catch {
2156
2210
  }
2157
2211
  }
2158
2212
  return null;
2159
2213
  }
2160
- async function C(e, t) {
2161
- 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);
2162
2216
  if (!s) return;
2163
- const r = await yr(e, s);
2164
- if (!r) return;
2165
- const { entries: i } = dt(await v(r, "utf-8")), a = i[0];
2166
- if (a)
2167
- return { id: s, view: n, entry: a };
2168
- }
2169
- async function oa(e, t) {
2170
- const n = await C(e, t);
2217
+ const a = await Ea(e, s);
2218
+ if (!a) return;
2219
+ const { entries: r } = ut(await v(a, "utf-8")), i = r[0];
2220
+ if (i)
2221
+ return { id: s, view: n, entry: i };
2222
+ }
2223
+ async function fi(e, t) {
2224
+ const n = await _(e, t);
2171
2225
  if (!n) return;
2172
- const { id: s, entry: r } = n;
2173
- return { id: s, kind: r.type, tags: r.tags, phases: r.phases };
2226
+ const { id: s, entry: a } = n;
2227
+ return { id: s, kind: a.type, tags: a.tags, phases: a.phases };
2174
2228
  }
2175
- const $t = "<!-- papercamp:phases:start -->", It = "<!-- papercamp:phases:end -->", je = new RegExp(`${$t}[\\s\\S]*?${It}`);
2176
- function wr(e, t) {
2177
- const n = t.map((i) => `- [${i.done ? "x" : " "}] ${i.text}`).join(`
2178
- `), s = `${$t}
2229
+ const Pt = "<!-- papercamp:phases:start -->", Ct = "<!-- papercamp:phases:end -->", je = new RegExp(`${Pt}[\\s\\S]*?${Ct}`);
2230
+ function ka(e, t) {
2231
+ const n = t.map((r) => `- [${r.done ? "x" : " "}] ${r.text}`).join(`
2232
+ `), s = `${Pt}
2179
2233
  ### Phases
2180
2234
  ${n}
2181
- ${It}`;
2235
+ ${Ct}`;
2182
2236
  if (je.test(e)) return e.replace(je, () => s);
2183
- const r = e.trimEnd();
2184
- return r.length > 0 ? `${r}
2237
+ const a = e.trimEnd();
2238
+ return a.length > 0 ? `${a}
2185
2239
 
2186
2240
  ${s}` : s;
2187
2241
  }
2188
- function br(e, t, n) {
2242
+ function Sa(e, t, n) {
2189
2243
  return new Promise((s) => {
2190
- var i, a;
2191
- const r = b("gh", ["pr", "edit", t, "--body-file", "-"], {
2244
+ var r, i;
2245
+ const a = b("gh", ["pr", "edit", t, "--body-file", "-"], {
2192
2246
  cwd: e,
2193
2247
  stdio: ["pipe", "ignore", "pipe"]
2194
2248
  });
2195
- (i = r.stderr) == null || i.on("data", () => {
2196
- }), r.on("close", (o) => s(o === 0)), r.on("error", () => s(!1)), (a = r.stdin) == null || a.end(n);
2249
+ (r = a.stderr) == null || r.on("data", () => {
2250
+ }), a.on("close", (o) => s(o === 0)), a.on("error", () => s(!1)), (i = a.stdin) == null || i.end(n);
2197
2251
  });
2198
2252
  }
2199
- async function ca(e, t) {
2200
- const n = await C(e, t);
2253
+ async function pi(e, t) {
2254
+ const n = await _(e, t);
2201
2255
  if (!(n != null && n.view)) return "unresolved";
2202
- const { view: s, entry: r } = n, i = wr(s.body, r.phases);
2203
- return i === s.body ? "unchanged" : await br(e, t, i) ? "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";
2204
2258
  }
2205
- function vr(e) {
2259
+ function $a(e) {
2206
2260
  const t = /* @__PURE__ */ new Set();
2207
2261
  e.kind && t.add(e.kind);
2208
2262
  for (const n of e.tags)
2209
- $e.has(n) && t.add(n);
2263
+ Se.has(n) && t.add(n);
2210
2264
  return [...t];
2211
2265
  }
2212
- function Er(e) {
2266
+ function Ia(e) {
2213
2267
  return new Promise((t) => {
2214
- var r, i;
2268
+ var a, r;
2215
2269
  const n = b("gh", ["label", "list", "--limit", "200", "--json", "name"], {
2216
2270
  cwd: e,
2217
2271
  stdio: ["ignore", "pipe", "pipe"]
2218
2272
  });
2219
2273
  let s = "";
2220
- (r = n.stdout) == null || r.on("data", (a) => {
2221
- s += a.toString();
2222
- }), (i = n.stderr) == null || i.on("data", () => {
2223
- }), n.on("close", (a) => {
2224
- if (a !== 0) {
2274
+ (a = n.stdout) == null || a.on("data", (i) => {
2275
+ s += i.toString();
2276
+ }), (r = n.stderr) == null || r.on("data", () => {
2277
+ }), n.on("close", (i) => {
2278
+ if (i !== 0) {
2225
2279
  t(void 0);
2226
2280
  return;
2227
2281
  }
@@ -2234,121 +2288,121 @@ function Er(e) {
2234
2288
  }), n.on("error", () => t(void 0));
2235
2289
  });
2236
2290
  }
2237
- function kr(e, t) {
2291
+ function Aa(e, t) {
2238
2292
  return new Promise((n) => {
2239
- var r;
2293
+ var a;
2240
2294
  const s = b("gh", ["label", "create", t, "--color", "ededed"], {
2241
2295
  cwd: e,
2242
2296
  stdio: ["ignore", "ignore", "pipe"]
2243
2297
  });
2244
- (r = s.stderr) == null || r.on("data", () => {
2245
- }), s.on("close", (i) => n(i === 0)), s.on("error", () => n(!1));
2298
+ (a = s.stderr) == null || a.on("data", () => {
2299
+ }), s.on("close", (r) => n(r === 0)), s.on("error", () => n(!1));
2246
2300
  });
2247
2301
  }
2248
- function Sr(e, t, n) {
2302
+ function Ra(e, t, n) {
2249
2303
  return new Promise((s) => {
2250
- var i;
2251
- const r = b("gh", ["pr", "edit", t, "--add-label", n.join(",")], {
2304
+ var r;
2305
+ const a = b("gh", ["pr", "edit", t, "--add-label", n.join(",")], {
2252
2306
  cwd: e,
2253
2307
  stdio: ["ignore", "ignore", "pipe"]
2254
2308
  });
2255
- (i = r.stderr) == null || i.on("data", () => {
2256
- }), r.on("close", (a) => s(a === 0)), r.on("error", () => s(!1));
2309
+ (r = a.stderr) == null || r.on("data", () => {
2310
+ }), a.on("close", (i) => s(i === 0)), a.on("error", () => s(!1));
2257
2311
  });
2258
2312
  }
2259
- async function da(e, t) {
2260
- const n = await C(e, t);
2313
+ async function hi(e, t) {
2314
+ const n = await _(e, t);
2261
2315
  if (!(n != null && n.view)) return "unresolved";
2262
- const { view: s, entry: r } = n, i = vr({ kind: r.type, tags: r.tags }), a = new Set((s.labels ?? []).map((l) => l.name)), o = i.filter((l) => !a.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));
2263
2317
  if (o.length === 0) return "unchanged";
2264
- const c = await Er(e);
2318
+ const c = await Ia(e);
2265
2319
  if (c) {
2266
2320
  const l = o.filter((f) => !c.has(f));
2267
2321
  for (const f of l)
2268
- await kr(e, f);
2322
+ await Aa(e, f);
2269
2323
  }
2270
- return await Sr(e, t, o) ? "updated" : "unresolved";
2324
+ return await Ra(e, t, o) ? "updated" : "unresolved";
2271
2325
  }
2272
- function Rt(e, t) {
2273
- const n = t.type ?? "feat", s = mr(t.tags, "repo");
2326
+ function _t(e, t) {
2327
+ const n = t.type ?? "feat", s = ba(t.tags, "repo");
2274
2328
  return `${n}(${s}): ${t.title} (${e})`;
2275
2329
  }
2276
- const $r = new RegExp(`^(${Yt.join("|")})\\(([a-z-]+)\\): .+$`);
2277
- function Ir(e) {
2278
- const t = e.match($r);
2279
- return !!t && $e.has(t[2]);
2330
+ const Pa = new RegExp(`^(${Kt.join("|")})\\(([a-z-]+)\\): .+$`);
2331
+ function Ca(e) {
2332
+ const t = e.match(Pa);
2333
+ return !!t && Se.has(t[2]);
2280
2334
  }
2281
- function Rr(e, t, n) {
2335
+ function _a(e, t, n) {
2282
2336
  return new Promise((s) => {
2283
- var i;
2284
- const r = b("gh", ["pr", "edit", t, "--title", n], {
2337
+ var r;
2338
+ const a = b("gh", ["pr", "edit", t, "--title", n], {
2285
2339
  cwd: e,
2286
2340
  stdio: ["ignore", "ignore", "pipe"]
2287
2341
  });
2288
- (i = r.stderr) == null || i.on("data", () => {
2289
- }), r.on("close", (a) => s(a === 0)), r.on("error", () => s(!1));
2342
+ (r = a.stderr) == null || r.on("data", () => {
2343
+ }), a.on("close", (i) => s(i === 0)), a.on("error", () => s(!1));
2290
2344
  });
2291
2345
  }
2292
- async function ua(e, t) {
2293
- const n = await C(e, t);
2346
+ async function mi(e, t) {
2347
+ const n = await _(e, t);
2294
2348
  if (!(n != null && n.view)) return "unresolved";
2295
- const { id: s, view: r, entry: i } = n, a = Rt(s, i);
2296
- return r.title === a ? "unchanged" : await Rr(e, t, a) ? "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";
2297
2351
  }
2298
- async function la(e, t) {
2299
- const n = await St(e, t);
2352
+ async function gi(e, t) {
2353
+ const n = await Rt(e, t);
2300
2354
  if (!n) return "no-pr";
2301
- const s = await C(e, t);
2302
- return s ? n.title === Rt(s.id, s.entry) ? "valid" : "invalid" : Ir(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";
2303
2357
  }
2304
- function fa(e, t) {
2358
+ function yi(e, t) {
2305
2359
  return new Promise((n) => {
2306
- var i;
2360
+ var r;
2307
2361
  const s = b("gh", ["pr", "merge", t, "--squash"], {
2308
2362
  cwd: e,
2309
2363
  stdio: ["ignore", "ignore", "pipe"]
2310
2364
  });
2311
- let r = "";
2312
- (i = s.stderr) == null || i.on("data", (a) => {
2313
- r += a.toString();
2314
- }), s.on("close", (a) => {
2315
- n(a === 0 ? { ok: !0 } : {
2365
+ let a = "";
2366
+ (r = s.stderr) == null || r.on("data", (i) => {
2367
+ a += i.toString();
2368
+ }), s.on("close", (i) => {
2369
+ n(i === 0 ? { ok: !0 } : {
2316
2370
  ok: !1,
2317
- message: r.trim() || `gh pr merge ${t} --squash exited with code ${a}`
2371
+ message: a.trim() || `gh pr merge ${t} --squash exited with code ${i}`
2318
2372
  });
2319
- }), s.on("error", (a) => n({ ok: !1, message: a.message }));
2373
+ }), s.on("error", (i) => n({ ok: !1, message: i.message }));
2320
2374
  });
2321
2375
  }
2322
- function Ar(e, t) {
2376
+ function Na(e, t) {
2323
2377
  return new Promise((n) => {
2324
- var r;
2378
+ var a;
2325
2379
  const s = b("gh", ["pr", "ready", t], {
2326
2380
  cwd: e,
2327
2381
  stdio: ["ignore", "ignore", "pipe"]
2328
2382
  });
2329
- (r = s.stderr) == null || r.on("data", () => {
2330
- }), s.on("close", (i) => n(i === 0)), s.on("error", () => n(!1));
2383
+ (a = s.stderr) == null || a.on("data", () => {
2384
+ }), s.on("close", (r) => n(r === 0)), s.on("error", () => n(!1));
2331
2385
  });
2332
2386
  }
2333
- function Pr(e, t) {
2387
+ function Ta(e, t) {
2334
2388
  return new Promise((n) => {
2335
- var r;
2389
+ var a;
2336
2390
  const s = b("gh", ["pr", "close", t], {
2337
2391
  cwd: e,
2338
2392
  stdio: ["ignore", "ignore", "pipe"]
2339
2393
  });
2340
- (r = s.stderr) == null || r.on("data", () => {
2341
- }), s.on("close", (i) => n(i === 0)), s.on("error", () => n(!1));
2394
+ (a = s.stderr) == null || a.on("data", () => {
2395
+ }), s.on("close", (r) => n(r === 0)), s.on("error", () => n(!1));
2342
2396
  });
2343
2397
  }
2344
- async function pa(e, t) {
2345
- const n = await C(e, t);
2398
+ async function wi(e, t) {
2399
+ const n = await _(e, t);
2346
2400
  if (!(n != null && n.view)) return "unresolved";
2347
- const { view: s, entry: r } = n;
2348
- return r.status === "dropped" ? s.state !== "OPEN" ? "unchanged" : await Pr(e, t) ? "closed" : "unresolved" : !(r.phases.length > 0 && r.phases.every((o) => o.done)) || !s.isDraft ? "unchanged" : await Ar(e, t) ? "ready" : "unresolved";
2401
+ const { view: s, entry: a } = n;
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";
2349
2403
  }
2350
- const At = "<!-- papercamp:consistency:start -->", Cr = "<!-- papercamp:consistency:end -->";
2351
- function _r(e, t) {
2404
+ const Nt = "<!-- papercamp:consistency:start -->", xa = "<!-- papercamp:consistency:end -->";
2405
+ function Oa(e, t) {
2352
2406
  const n = ["### Paper Camp checks", ""];
2353
2407
  if (e.length === 0)
2354
2408
  n.push("No consistency issues found.");
@@ -2357,26 +2411,26 @@ function _r(e, t) {
2357
2411
  n.push(`- **${s.kind}** (${s.section}): ${s.message}`);
2358
2412
  return t && (n.push(""), n.push(
2359
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.`
2360
- )), `${At}
2414
+ )), `${Nt}
2361
2415
  ${n.join(`
2362
2416
  `)}
2363
- ${Cr}`;
2417
+ ${xa}`;
2364
2418
  }
2365
- function Tr(e, t, n) {
2419
+ function Da(e, t, n) {
2366
2420
  return new Promise((s) => {
2367
- var i, a;
2368
- const r = b("gh", ["pr", "comment", t, "--body-file", "-"], {
2421
+ var r, i;
2422
+ const a = b("gh", ["pr", "comment", t, "--body-file", "-"], {
2369
2423
  cwd: e,
2370
2424
  stdio: ["pipe", "ignore", "pipe"]
2371
2425
  });
2372
- (i = r.stderr) == null || i.on("data", () => {
2373
- }), r.on("close", (o) => s(o === 0)), r.on("error", () => s(!1)), (a = r.stdin) == null || a.end(n);
2426
+ (r = a.stderr) == null || r.on("data", () => {
2427
+ }), a.on("close", (o) => s(o === 0)), a.on("error", () => s(!1)), (i = a.stdin) == null || i.end(n);
2374
2428
  });
2375
2429
  }
2376
- function Nr(e, t, n, s, r) {
2377
- return new Promise((i) => {
2430
+ function ja(e, t, n, s, a) {
2431
+ return new Promise((r) => {
2378
2432
  var o, c;
2379
- const a = b(
2433
+ const i = b(
2380
2434
  "gh",
2381
2435
  [
2382
2436
  "api",
@@ -2388,57 +2442,57 @@ function Nr(e, t, n, s, r) {
2388
2442
  ],
2389
2443
  { cwd: e, stdio: ["pipe", "ignore", "pipe"] }
2390
2444
  );
2391
- (o = a.stderr) == null || o.on("data", () => {
2392
- }), a.on("close", (u) => i(u === 0)), a.on("error", () => i(!1)), (c = a.stdin) == null || c.end(r);
2445
+ (o = i.stderr) == null || o.on("data", () => {
2446
+ }), i.on("close", (u) => r(u === 0)), i.on("error", () => r(!1)), (c = i.stdin) == null || c.end(a);
2393
2447
  });
2394
2448
  }
2395
- async function ha(e, t) {
2449
+ async function bi(e, t) {
2396
2450
  var w, y;
2397
- const n = await C(e, t);
2451
+ const n = await _(e, t);
2398
2452
  if (!((w = n == null ? void 0 : n.view) != null && w.url)) return "unresolved";
2399
- const { view: s, entry: r } = n, [{ entries: i }, a] = await Promise.all([
2453
+ const { view: s, entry: a } = n, [{ entries: r }, i] = await Promise.all([
2400
2454
  x(p(e, "papercamp", "ideas")),
2401
2455
  v(p(e, "ROADMAP.md"), "utf-8").catch(() => "")
2402
- ]), o = i.filter((m) => m.kind !== "note").map((m) => qe(m)), c = a ? kt(ur(a)) : [], u = ds(o, c), l = r.audited && r.auditedHash ? {
2403
- audited: r.audited,
2404
- stale: hr(r) !== r.auditedHash
2405
- } : void 0, f = _r(u, l), h = (s.comments ?? []).find((m) => m.body.includes(At));
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 ? {
2457
+ audited: a.audited,
2458
+ stale: wa(a) !== a.auditedHash
2459
+ } : void 0, f = Oa(u, l), h = (s.comments ?? []).find((m) => m.body.includes(Nt));
2406
2460
  if (h) {
2407
2461
  if (h.body === f) return "unchanged";
2408
2462
  const m = F(s.url), D = (y = h.url.match(/issuecomment-(\d+)/)) == null ? void 0 : y[1];
2409
- return !m || !D ? "unresolved" : await Nr(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";
2410
2464
  }
2411
- return await Tr(e, t, f) ? "created" : "unresolved";
2465
+ return await Da(e, t, f) ? "created" : "unresolved";
2412
2466
  }
2413
- function ma(e, t, n) {
2467
+ function vi(e, t, n) {
2414
2468
  if (!e) return;
2415
- const s = (t ?? "feat").toLowerCase(), r = n.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, ""), i = r.length <= 40 ? r : r[40] === "-" ? r.slice(0, 40) : r.slice(0, 40).replace(/-[^-]*$/, "");
2416
- return `${s}/${e.toLowerCase()}-${i}`;
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(/-[^-]*$/, "");
2470
+ return `${s}/${e.toLowerCase()}-${r}`;
2417
2471
  }
2418
- function Q(e, t) {
2472
+ function ee(e, t) {
2419
2473
  for (const { entries: n, section: s } of t)
2420
2474
  n && n.length > 0 && e.push(s.formatLines(n).join(`
2421
2475
  `));
2422
2476
  }
2423
- function Pt() {
2477
+ function Tt() {
2424
2478
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
2425
2479
  }
2426
- function ga(e, t = "log", n) {
2480
+ function Ei(e, t = "log", n) {
2427
2481
  return {
2428
2482
  kind: t,
2429
- date: Pt(),
2483
+ date: Tt(),
2430
2484
  text: e,
2431
2485
  from: "agent",
2432
2486
  ...t === "question" ? { state: "open" } : {},
2433
2487
  ...n ? { entityId: n } : {}
2434
2488
  };
2435
2489
  }
2436
- function ya(e) {
2490
+ function ki(e) {
2437
2491
  const t = [`## ${e.title}`, "", `**Status:** ${e.status}`];
2438
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(", ")}`);
2439
2493
  const n = [t.join(`
2440
2494
  `)];
2441
- return e.body && n.push(e.body), Q(n, [
2495
+ return e.body && n.push(e.body), ee(n, [
2442
2496
  { entries: e.clarifications, section: pe },
2443
2497
  { entries: e.phases, section: Z },
2444
2498
  { entries: e.log, section: H },
@@ -2447,12 +2501,12 @@ function ya(e) {
2447
2501
 
2448
2502
  `).trimEnd();
2449
2503
  }
2450
- function Ie(e) {
2504
+ function $e(e) {
2451
2505
  return `---
2452
- ${Ht(e).trimEnd()}
2506
+ ${Yt(e).trimEnd()}
2453
2507
  ---`;
2454
2508
  }
2455
- function wa(e) {
2509
+ function Si(e) {
2456
2510
  const t = {
2457
2511
  id: e.id,
2458
2512
  title: e.title,
@@ -2461,8 +2515,8 @@ function wa(e) {
2461
2515
  created: e.created
2462
2516
  };
2463
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);
2464
- const n = [Ie(t)];
2465
- return e.body && n.push(e.body), Q(n, [
2518
+ const n = [$e(t)];
2519
+ return e.body && n.push(e.body), ee(n, [
2466
2520
  { entries: e.clarifications, section: pe },
2467
2521
  { entries: e.phases, section: Z },
2468
2522
  { entries: e.log, section: H },
@@ -2471,7 +2525,7 @@ function wa(e) {
2471
2525
 
2472
2526
  `).trimEnd();
2473
2527
  }
2474
- function xr(e) {
2528
+ function Ma(e) {
2475
2529
  const t = {
2476
2530
  id: e.id,
2477
2531
  title: e.title
@@ -2479,35 +2533,35 @@ function xr(e) {
2479
2533
  e.type && (t.type = e.type), e.kind && (t.kind = e.kind), e.status && (t.status = e.status), e.idea && (t.idea = e.idea), t.created = e.created, 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.released && (t.released = e.released), e.tags && e.tags.length > 0 && (t.tags = e.tags), e.subject && (t.subject = e.subject), e.order !== void 0 && (t.order = e.order), e.issueSource && (t.issueSource = e.issueSource);
2480
2534
  for (const s of Object.keys(e.unknownFrontmatter ?? {}).sort())
2481
2535
  t[s] = e.unknownFrontmatter[s];
2482
- const n = [Ie(t)];
2483
- return e.body && n.push(e.body), Q(n, [
2536
+ const n = [$e(t)];
2537
+ return e.body && n.push(e.body), ee(n, [
2484
2538
  { entries: e.phases, section: Z },
2485
2539
  { entries: e.fixes, section: it },
2486
- { entries: e.thread, section: at }
2540
+ { entries: e.thread, section: ot }
2487
2541
  ]), n.join(`
2488
2542
 
2489
2543
  `).trimEnd();
2490
2544
  }
2491
- function ba(e) {
2545
+ function $i(e) {
2492
2546
  const t = {
2493
2547
  id: e.id,
2494
2548
  title: e.title
2495
2549
  };
2496
2550
  e.kind && (t.kind = e.kind), e.status && (t.status = e.status);
2497
- const n = [Ie(t)], s = `## ${e.id}: ${e.title}`;
2551
+ const n = [$e(t)], s = `## ${e.id}: ${e.title}`;
2498
2552
  return n.push(e.body ? `${s}
2499
2553
 
2500
- ${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(`
2501
2555
 
2502
2556
  `).trimEnd();
2503
2557
  }
2504
- function va(e, t) {
2558
+ function Ii(e, t) {
2505
2559
  let n = !1;
2506
2560
  const s = e.split(`
2507
- `).filter((r) => {
2561
+ `).filter((a) => {
2508
2562
  if (!n) {
2509
- const i = r.match(ut);
2510
- if (i && i[1] === t.date && i[2].trim() === t.title && i[3].trim() === t.description)
2563
+ const r = a.match(lt);
2564
+ if (r && r[1] === t.date && r[2].trim() === t.title && r[3].trim() === t.description)
2511
2565
  return n = !0, !1;
2512
2566
  }
2513
2567
  return !0;
@@ -2516,29 +2570,29 @@ function va(e, t) {
2516
2570
  `) : e;
2517
2571
  }
2518
2572
  let J = Promise.resolve();
2519
- async function Or(e, t) {
2573
+ async function La(e, t) {
2520
2574
  const n = new RegExp(`^${t.toUpperCase()}-(\\d+)\\.md$`), s = [
2521
2575
  p(e, "ideas"),
2522
2576
  p(e, "ideas", "archive"),
2523
2577
  p(e, "plans"),
2524
2578
  p(e, "plans", "archive")
2525
2579
  ];
2526
- let r = 0;
2527
- for (const i of s) {
2528
- let a;
2580
+ let a = 0;
2581
+ for (const r of s) {
2582
+ let i;
2529
2583
  try {
2530
- a = await z(i);
2584
+ i = await z(r);
2531
2585
  } catch {
2532
2586
  continue;
2533
2587
  }
2534
- for (const o of a) {
2588
+ for (const o of i) {
2535
2589
  const c = n.exec(o);
2536
- c && (r = Math.max(r, Number(c[1])));
2590
+ c && (a = Math.max(a, Number(c[1])));
2537
2591
  }
2538
2592
  }
2539
- return r;
2593
+ return a;
2540
2594
  }
2541
- async function Ct(e, t) {
2595
+ async function xt(e, t) {
2542
2596
  const n = J.then(async () => {
2543
2597
  let s = null;
2544
2598
  try {
@@ -2547,20 +2601,20 @@ async function Ct(e, t) {
2547
2601
  return;
2548
2602
  }
2549
2603
  if (!(s != null && s.nextId)) return;
2550
- const r = s.nextId[t] ?? 1, i = await Or(M(e), t), a = Math.max(r, i + 1), o = `${t.toUpperCase()}-${a}`;
2551
- return s.nextId[t] = a + 1, await E(e, `${JSON.stringify(s, null, 2)}
2604
+ const a = s.nextId[t] ?? 1, r = await La(M(e), t), i = Math.max(a, r + 1), o = `${t.toUpperCase()}-${i}`;
2605
+ return s.nextId[t] = i + 1, await E(e, `${JSON.stringify(s, null, 2)}
2552
2606
  `), o;
2553
2607
  });
2554
2608
  return J = n.catch(() => {
2555
2609
  }), n;
2556
2610
  }
2557
- async function Ea(e) {
2558
- return Ct(e, "idea");
2611
+ async function Ai(e) {
2612
+ return xt(e, "idea");
2559
2613
  }
2560
- async function ka(e) {
2561
- return Ct(e, "ticket");
2614
+ async function Ri(e) {
2615
+ return xt(e, "ticket");
2562
2616
  }
2563
- async function Sa(e, t) {
2617
+ async function Pi(e, t) {
2564
2618
  const n = J.then(async () => {
2565
2619
  let s = null;
2566
2620
  try {
@@ -2568,80 +2622,89 @@ async function Sa(e, t) {
2568
2622
  } catch {
2569
2623
  return;
2570
2624
  }
2571
- const r = s.subjects ?? [];
2572
- r.includes(t) || (s.subjects = [...r, t], await E(e, `${JSON.stringify(s, null, 2)}
2625
+ const a = s.subjects ?? [];
2626
+ a.includes(t) || (s.subjects = [...a, t], await E(e, `${JSON.stringify(s, null, 2)}
2573
2627
  `));
2574
2628
  });
2575
2629
  return J = n.catch(() => {
2576
2630
  }), n;
2577
2631
  }
2578
- async function $a(e, t) {
2579
- const n = p(e, "papercamp", "ideas"), s = p(n, "archive"), r = p(n, `${t}.md`), i = p(s, `${t}.md`);
2632
+ async function Ci(e, t) {
2633
+ const n = p(e, "papercamp", "ideas"), s = p(n, "archive"), a = p(n, `${t}.md`), r = p(s, `${t}.md`);
2580
2634
  await P(s, { recursive: !0 });
2581
2635
  try {
2582
- return await Mt(r, i), !0;
2583
- } catch (a) {
2584
- if (a.code === "ENOENT") return !1;
2585
- throw a;
2636
+ return await He(a, r), !0;
2637
+ } catch (i) {
2638
+ if (i.code === "ENOENT") return !1;
2639
+ throw i;
2640
+ }
2641
+ }
2642
+ async function _i(e, t) {
2643
+ const n = p(e, "papercamp", "ideas"), s = p(n, "archive", `${t}.md`), a = p(n, `${t}.md`);
2644
+ try {
2645
+ return await He(s, a), !0;
2646
+ } catch (r) {
2647
+ if (r.code === "ENOENT") return !1;
2648
+ throw r;
2586
2649
  }
2587
2650
  }
2588
- const Dr = [
2651
+ const Fa = [
2589
2652
  ["pnpm-lock.yaml", "pnpm"],
2590
2653
  ["yarn.lock", "yarn"],
2591
2654
  ["bun.lockb", "bun"],
2592
2655
  ["package-lock.json", "npm"]
2593
2656
  ];
2594
- function _t(e) {
2595
- for (const [t, n] of Dr)
2596
- if (ae(p(e, t))) return n;
2657
+ function Ot(e) {
2658
+ for (const [t, n] of Fa)
2659
+ if (ie(p(e, t))) return n;
2597
2660
  return "npm";
2598
2661
  }
2599
- function jr(e) {
2662
+ function Ha(e) {
2600
2663
  const t = p(e, "package.json");
2601
- if (ae(t))
2664
+ if (ie(t))
2602
2665
  try {
2603
- return JSON.parse(He(t, "utf-8"));
2666
+ return JSON.parse(Ge(t, "utf-8"));
2604
2667
  } catch {
2605
2668
  return;
2606
2669
  }
2607
2670
  }
2608
2671
  const Me = "@dendelion/paper-camp";
2609
- function Mr(e) {
2610
- const t = jr(e);
2672
+ function Ga(e) {
2673
+ const t = Ha(e);
2611
2674
  if (!t) return !1;
2612
2675
  const n = t.dependencies, s = t.devDependencies;
2613
2676
  return !!(n != null && n[Me] || s != null && s[Me]);
2614
2677
  }
2615
- const Lr = ["*.json", "*.ts", "*.tsx", "*.md", "*.config.*"], Fr = ["src/**", "app/**", "scripts/**", "papercamp/**"], Hr = ["git status*", "git diff*", "git log*"], Gr = ["ls*", "cat*", "wc*"], Br = ["run *", "test*", "install*", "view *", "pack*", "ls*"], Yr = ["npx tsc*", "npx biome check*", "npx vitest*", "npx jest*", "npx expo *"];
2616
- function Tt(e) {
2617
- const t = Fr.flatMap((r) => [`Edit(${r})`, `Write(${r})`]), n = Lr.flatMap((r) => [`Edit(${r})`, `Write(${r})`]), s = [
2618
- ...Hr,
2619
- ...Gr,
2620
- ...Br.map((r) => `${e} ${r}`),
2621
- ...Yr
2622
- ].map((r) => `Bash(${r})`);
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
2685
+ ].map((a) => `Bash(${a})`);
2623
2686
  return [...t, ...n, ...s];
2624
2687
  }
2625
- function qr(e) {
2626
- return e ? `"${Jr}" session-focus` : "paper-camp session-focus";
2688
+ function Ja(e) {
2689
+ return e ? `"${Za}" session-focus` : "paper-camp session-focus";
2627
2690
  }
2628
- function Ur(e, t) {
2691
+ function za(e, t) {
2629
2692
  let n;
2630
2693
  try {
2631
2694
  n = JSON.parse(e);
2632
2695
  } catch {
2633
2696
  return e;
2634
2697
  }
2635
- const s = Tt(_t(t)), r = n.permissions ?? {}, i = Array.isArray(r.allow) ? r.allow : [], a = s.filter((o) => !i.includes(o));
2636
- return a.length === 0 && n.permissions !== void 0 ? e : (n.permissions = { ...r, allow: [...i, ...a] }, `${JSON.stringify(n, null, 2)}
2698
+ const s = Dt(Ot(t)), a = n.permissions ?? {}, r = Array.isArray(a.allow) ? a.allow : [], i = s.filter((o) => !r.includes(o));
2699
+ return i.length === 0 && n.permissions !== void 0 ? e : (n.permissions = { ...a, allow: [...r, ...i] }, `${JSON.stringify(n, null, 2)}
2637
2700
  `);
2638
2701
  }
2639
- function Kr(e) {
2640
- const t = _t(e), n = qr(Mr(e));
2702
+ function Va(e) {
2703
+ const t = Ot(e), n = Ja(Ga(e));
2641
2704
  return `${JSON.stringify(
2642
2705
  {
2643
2706
  permissions: {
2644
- allow: Tt(t)
2707
+ allow: Dt(t)
2645
2708
  },
2646
2709
  hooks: {
2647
2710
  SessionStart: [
@@ -2657,7 +2720,7 @@ function Kr(e) {
2657
2720
  )}
2658
2721
  `;
2659
2722
  }
2660
- const Wr = `---
2723
+ const Xa = `---
2661
2724
  name: paper-camp
2662
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".
2663
2726
  ---
@@ -2726,14 +2789,14 @@ session start from live plan data, not hand-maintained here. It does
2726
2789
  not define the file formats in full; treat the existing files under
2727
2790
  \`papercamp/\` as the grammar reference (mirror their structure exactly rather
2728
2791
  than inventing a new shape).
2729
- `, Jr = "$CLAUDE_PROJECT_DIR/node_modules/.bin/paper-camp", zr = 5;
2730
- function Vr() {
2792
+ `, Za = "$CLAUDE_PROJECT_DIR/node_modules/.bin/paper-camp", Qa = 5;
2793
+ function er() {
2731
2794
  try {
2732
- let e = M(Ut(import.meta.url));
2733
- for (let t = 0; t < zr; t++) {
2795
+ let e = M(Jt(import.meta.url));
2796
+ for (let t = 0; t < Qa; t++) {
2734
2797
  const n = p(e, "package.json");
2735
- if (ae(n))
2736
- 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";
2737
2800
  e = M(e);
2738
2801
  }
2739
2802
  return "0.0.0";
@@ -2741,42 +2804,42 @@ function Vr() {
2741
2804
  return "0.0.0";
2742
2805
  }
2743
2806
  }
2744
- const Ia = Vr();
2745
- class Xr extends Error {
2807
+ const Ni = er();
2808
+ class tr extends Error {
2746
2809
  constructor(t) {
2747
2810
  super(`Paper Camp is already initialized in ${t} (papercamp/config.json exists).`);
2748
2811
  }
2749
2812
  }
2750
- async function _(e) {
2813
+ async function N(e) {
2751
2814
  try {
2752
- return await Lt(e), !0;
2815
+ return await Gt(e), !0;
2753
2816
  } catch {
2754
2817
  return !1;
2755
2818
  }
2756
2819
  }
2757
- const Zr = ["suggestions.md"];
2758
- async function Ra(e, t) {
2820
+ const nr = ["suggestions.md"];
2821
+ async function Ti(e, t) {
2759
2822
  const n = p(e, "papercamp"), s = p(n, "config.json");
2760
- if (await _(s))
2761
- throw new Xr(e);
2762
- const r = {
2763
- version: R,
2823
+ if (await N(s))
2824
+ throw new tr(e);
2825
+ const a = {
2826
+ version: A,
2764
2827
  projectName: t.projectName,
2765
2828
  initializedAt: (/* @__PURE__ */ new Date()).toISOString(),
2766
2829
  nextId: { idea: 2 }
2767
2830
  };
2768
- es.parse(r), await P(n, { recursive: !0 });
2769
- const i = p(n, "ideas");
2831
+ ss.parse(a), await P(n, { recursive: !0 });
2832
+ const r = p(n, "ideas");
2833
+ await P(r, { recursive: !0 });
2834
+ const i = p(r, "archive");
2770
2835
  await P(i, { recursive: !0 });
2771
- const a = p(i, "archive");
2772
- await P(a, { recursive: !0 });
2773
- const o = p(i, "IDEA-1.md");
2774
- if (!await _(o)) {
2775
- const c = xr({
2836
+ const o = p(r, "IDEA-1.md");
2837
+ if (!await N(o)) {
2838
+ const c = Ma({
2776
2839
  id: "IDEA-1",
2777
2840
  title: "Capture your first idea",
2778
2841
  status: "idea",
2779
- created: Pt(),
2842
+ created: Tt(),
2780
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.
2781
2844
 
2782
2845
  Use the New idea button to capture what you're building next, or ask an agent for suggestions.`
@@ -2784,110 +2847,120 @@ Use the New idea button to capture what you're building next, or ask an agent fo
2784
2847
  await E(o, `${c}
2785
2848
  `, "utf-8");
2786
2849
  }
2787
- for (const c of Zr) {
2850
+ for (const c of nr) {
2788
2851
  const u = p(n, c);
2789
- await _(u) || await E(u, "", "utf-8");
2852
+ await N(u) || await E(u, "", "utf-8");
2790
2853
  }
2791
- await E(s, `${JSON.stringify(r, null, 2)}
2792
- `, "utf-8"), await ei(e), await ti(e), await Qr(e, t.projectName);
2793
- }
2794
- async function Qr(e, t) {
2795
- const n = Jt(), s = await zt(n), { registry: r, created: i } = Vt(s, e, t);
2796
- i && await Xt(n, r);
2854
+ await E(s, `${JSON.stringify(a, null, 2)}
2855
+ `, "utf-8"), await rr(e), await ir(e), await sr(e, t.projectName);
2797
2856
  }
2798
- const te = "papercamp/.pairing.json";
2799
- async function ei(e) {
2800
- const t = p(e, ".gitignore"), n = await _(t) ? await v(t, "utf-8") : "", s = n.length > 0 ? n.split(`
2801
- `) : [];
2802
- if (s.some((i) => i.trim() === te)) return;
2803
- const r = s.reduce(
2804
- (i, a, o) => a.startsWith("papercamp/") ? o : i,
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);
2860
+ }
2861
+ const ar = [
2862
+ "papercamp/.pairing.json",
2863
+ "papercamp/.task-logs/",
2864
+ "papercamp/tasks.log",
2865
+ "papercamp/notifications.log",
2866
+ "papercamp/pr-reviews.json",
2867
+ "papercamp/pr-map.json",
2868
+ "papercamp/night.json",
2869
+ "papercamp/run-order.md"
2870
+ ];
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));
2874
+ if (r.length === 0) return;
2875
+ const i = s.reduce(
2876
+ (o, c, u) => c.startsWith("papercamp/") ? u : o,
2805
2877
  -1
2806
2878
  );
2807
- if (r === -1) {
2808
- const i = n.length > 0 && !n.endsWith(`
2879
+ if (i === -1) {
2880
+ const o = n.length > 0 && !n.endsWith(`
2809
2881
  `) ? `
2810
2882
  ` : "";
2811
- await E(t, `${n}${i}${te}
2883
+ await E(t, `${n}${o}${r.join(`
2884
+ `)}
2812
2885
  `, "utf-8");
2813
2886
  return;
2814
2887
  }
2815
- s.splice(r + 1, 0, te), await E(t, s.join(`
2888
+ s.splice(i + 1, 0, ...r), await E(t, s.join(`
2816
2889
  `), "utf-8");
2817
2890
  }
2818
- async function ti(e) {
2891
+ async function ir(e) {
2819
2892
  const t = p(e, ".claude", "skills", "paper-camp");
2820
2893
  await P(t, { recursive: !0 });
2821
2894
  const n = p(t, "SKILL.md");
2822
- await _(n) || await E(n, Wr, "utf-8");
2895
+ await N(n) || await E(n, Xa, "utf-8");
2823
2896
  const s = p(e, ".claude");
2824
2897
  await P(s, { recursive: !0 });
2825
- const r = p(s, "settings.json");
2826
- if (await _(r)) {
2827
- const i = await v(r, "utf-8"), a = Ur(i, e);
2828
- a !== i && await E(r, a, "utf-8");
2898
+ const a = p(s, "settings.json");
2899
+ if (await N(a)) {
2900
+ const r = await v(a, "utf-8"), i = za(r, e);
2901
+ i !== r && await E(a, i, "utf-8");
2829
2902
  } else
2830
- await E(r, Kr(e), "utf-8");
2903
+ await E(a, Va(e), "utf-8");
2831
2904
  }
2832
- const Nt = {
2905
+ const jt = {
2833
2906
  feat: "Features",
2834
2907
  fix: "Bug Fixes",
2835
2908
  refactor: "Code Refactoring",
2836
2909
  docs: "Documentation",
2837
2910
  chore: "Miscellaneous"
2838
- }, ni = Array.from(new Set(Object.values(Nt)));
2839
- async function Aa(e, t) {
2840
- 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);
2841
2914
  if (!s) return null;
2842
- const [{ entries: r }, i] = await Promise.all([
2915
+ const [{ entries: a }, r] = await Promise.all([
2843
2916
  x(p(e, "papercamp", "ideas")),
2844
- ir(e, s.range)
2845
- ]), a = /* @__PURE__ */ new Map();
2846
- for (const o of i.keys()) {
2847
- const c = r.find((f) => f.id === o);
2917
+ da(e, s.range)
2918
+ ]), i = /* @__PURE__ */ new Map();
2919
+ for (const o of r.keys()) {
2920
+ const c = a.find((f) => f.id === o);
2848
2921
  if (!c) continue;
2849
- const u = Nt[c.type ?? "chore"], l = a.get(u) ?? [];
2850
- l.push({ id: c.id, title: c.title }), a.set(u, l);
2922
+ const u = jt[c.type ?? "chore"], l = i.get(u) ?? [];
2923
+ l.push({ id: c.id, title: c.title }), i.set(u, l);
2851
2924
  }
2852
- return ni.filter((o) => a.has(o)).map((o) => ({
2925
+ return or.filter((o) => i.has(o)).map((o) => ({
2853
2926
  label: o,
2854
- ideas: a.get(o)
2927
+ ideas: i.get(o)
2855
2928
  }));
2856
2929
  }
2857
- function Pa(e, t) {
2930
+ function Oi(e, t) {
2858
2931
  const n = [`## ${e}`];
2859
2932
  for (const s of t) {
2860
2933
  n.push("", `### ${s.label}`, "");
2861
- for (const r of s.ideas)
2862
- n.push(`- ${r.title} (${r.id})`);
2934
+ for (const a of s.ideas)
2935
+ n.push(`- ${a.title} (${a.id})`);
2863
2936
  }
2864
2937
  return n.join(`
2865
2938
  `);
2866
2939
  }
2867
- function si(e) {
2940
+ function cr(e) {
2868
2941
  return Math.floor((Date.now() - Date.parse(e)) / 864e5);
2869
2942
  }
2870
- const xt = (e, t) => e === "question" && (t ?? "open") === "open", Ot = (e) => !!e.archived || e.status === "done" || e.status === "dropped";
2871
- function ri(e) {
2872
- return e.filter((t) => !Ot(t)).flatMap(
2873
- (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) => ({
2874
2947
  entityId: t.id,
2875
2948
  entityTitle: t.title,
2876
2949
  text: n.text,
2877
2950
  date: n.date,
2878
- ageDays: n.date ? si(n.date) : Number.POSITIVE_INFINITY
2951
+ ageDays: n.date ? cr(n.date) : Number.POSITIVE_INFINITY
2879
2952
  }))
2880
2953
  ).sort((t, n) => n.ageDays - t.ageDays);
2881
2954
  }
2882
- async function Ca(e) {
2955
+ async function Di(e) {
2883
2956
  const { entries: t } = await x(e);
2884
- return ri(t);
2957
+ return dr(t);
2885
2958
  }
2886
- function _a(e, t) {
2887
- const n = new Set(t.filter(Ot).map((s) => s.id));
2888
- 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);
2889
2962
  }
2890
- const re = 0.95, Dt = 3e4, ie = {
2963
+ const ae = 0.95, Ft = 3e4, re = {
2891
2964
  implement: { from: 0, to: 0.6 },
2892
2965
  verify: { from: 0.6, to: 0.9 },
2893
2966
  checkbox: { from: 0.95, to: 0.95 }
@@ -2901,203 +2974,205 @@ function Fe(e, ...t) {
2901
2974
  if (typeof (e == null ? void 0 : e[n]) == "string") return e[n];
2902
2975
  return "";
2903
2976
  }
2904
- function Ta(e, t) {
2977
+ function Mi(e, t) {
2905
2978
  const n = e.toLowerCase();
2906
2979
  if (n === "bash")
2907
2980
  return (typeof (t == null ? void 0 : t.command) == "string" ? t.command : "").includes("check-types") ? "verify" : null;
2908
2981
  if (n === "edit" || n === "multiedit" || n === "write") {
2909
- const s = Fe(t, "old_string", "oldString"), r = Fe(t, "new_string", "newString");
2910
- return s.includes("- [ ]") && r.includes("- [x]") ? "checkbox" : "implement";
2982
+ const s = Fe(t, "old_string", "oldString"), a = Fe(t, "new_string", "newString");
2983
+ return s.includes("- [ ]") && a.includes("- [x]") ? "checkbox" : "implement";
2911
2984
  }
2912
2985
  return null;
2913
2986
  }
2914
- function Na(e, t) {
2987
+ function Li(e, t) {
2915
2988
  return e ? Le[t] > Le[e] ? t : e : t;
2916
2989
  }
2917
- function xa(e, t) {
2918
- return e === void 0 ? !1 : t - e >= Dt;
2990
+ function Fi(e, t) {
2991
+ return e === void 0 ? !1 : t - e >= Ft;
2919
2992
  }
2920
- function ii(e) {
2921
- const t = [...e].sort((s, r) => s - r), n = Math.floor(t.length / 2);
2993
+ function ur(e) {
2994
+ const t = [...e].sort((s, a) => s - a), n = Math.floor(t.length / 2);
2922
2995
  return t.length % 2 === 0 ? (t[n - 1] + t[n]) / 2 : t[n];
2923
2996
  }
2924
- function Oa(e) {
2925
- const t = e.filter((r) => r.taskKind === "phase" && r.outcome === "done").map(
2926
- (r) => (r.endedAt ? Date.parse(r.endedAt) : Number.NaN) - Date.parse(r.startedAt)
2927
- ).filter((r) => Number.isFinite(r) && r > 0);
2997
+ function Hi(e) {
2998
+ const t = e.filter((a) => a.taskKind === "phase" && a.outcome === "done").map(
2999
+ (a) => (a.endedAt ? Date.parse(a.endedAt) : Number.NaN) - Date.parse(a.startedAt)
3000
+ ).filter((a) => Number.isFinite(a) && a > 0);
2928
3001
  if (t.length === 0) return {};
2929
- const n = ii(t), s = {};
2930
- for (const r of ["implement", "verify"]) {
2931
- const i = ie[r].to - ie[r].from;
2932
- s[r] = n * i / re;
3002
+ const n = ur(t), s = {};
3003
+ for (const a of ["implement", "verify"]) {
3004
+ const r = re[a].to - re[a].from;
3005
+ s[a] = n * r / ae;
2933
3006
  }
2934
3007
  return s;
2935
3008
  }
2936
- function Da({
3009
+ function Gi({
2937
3010
  anchor: e,
2938
3011
  anchorEnteredAt: t,
2939
3012
  lastStreamAt: n,
2940
3013
  now: s,
2941
- medians: r
3014
+ medians: a
2942
3015
  }) {
2943
3016
  if (!e) return 0;
2944
- const i = ie[e], a = Math.min(i.from, re), o = r == null ? void 0 : r[e];
2945
- if (!o || o <= 0 || t === void 0 || i.to === i.from)
2946
- return a;
2947
- const c = n === void 0 ? s : Math.min(s, n + Dt), u = Math.min(1, Math.max(0, c - t) / o);
2948
- return Math.min(i.from + u * (i.to - i.from), re);
3017
+ const r = re[e], i = Math.min(r.from, ae), o = a == null ? void 0 : a[e];
3018
+ if (!o || o <= 0 || t === void 0 || r.to === r.from)
3019
+ return i;
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);
2949
3022
  }
2950
3023
  export {
2951
- ds as $,
2952
- Xr as A,
2953
- Rt as B,
2954
- $e as C,
2955
- Ys as D,
2956
- Ri as E,
2957
- I as F,
2958
- vr as G,
2959
- kt as H,
2960
- Ui as I,
2961
- Kn as J,
2962
- Wn as K,
2963
- Jn as L,
2964
- Ne as M,
2965
- Un as N,
2966
- _t as O,
2967
- Ia as P,
2968
- Ai as Q,
2969
- Sa as R,
2970
- Wr as S,
2971
- Ci as T,
2972
- qn as U,
2973
- ct as V,
2974
- on as W,
2975
- qe as X,
2976
- aa as Y,
2977
- Si as Z,
2978
- Yi as _,
2979
- cn as a,
2980
- Qs as a$,
2981
- bt as a0,
2982
- U as a1,
2983
- xr as a2,
2984
- ba as a3,
2985
- ya as a4,
2986
- wa as a5,
2987
- Pa as a6,
2988
- _i as a7,
2989
- Mr as a8,
2990
- Yn as a9,
2991
- Vi as aA,
2992
- Gn as aB,
2993
- Bn as aC,
2994
- Ni as aD,
2995
- xi as aE,
2996
- x as aF,
2997
- Gi as aG,
2998
- K as aH,
2999
- qi as aI,
3000
- Ca as aJ,
3001
- us as aK,
3002
- Bi as aL,
3003
- Zi as aM,
3004
- va as aN,
3005
- _r as aO,
3006
- wr as aP,
3007
- Ii as aQ,
3008
- Ki as aR,
3009
- _a as aS,
3010
- rr as aT,
3011
- Xi as aU,
3012
- ne as aV,
3013
- ir as aW,
3014
- oa as aX,
3015
- mr as aY,
3016
- tt as aZ,
3017
- Aa as a_,
3018
- Ra as aa,
3019
- Ot as ab,
3020
- Ir as ac,
3021
- xa as ad,
3022
- ra as ae,
3023
- Oa as af,
3024
- Ur as ag,
3025
- ea as ah,
3026
- Xn as ai,
3027
- Vn as aj,
3028
- zn as ak,
3024
+ Jr as $,
3025
+ tr as A,
3026
+ wa as B,
3027
+ Se as C,
3028
+ ar as D,
3029
+ _t as E,
3030
+ Nr as F,
3031
+ I as G,
3032
+ $a as H,
3033
+ At as I,
3034
+ Vr as J,
3035
+ zn as K,
3036
+ Vn as L,
3037
+ Te as M,
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,
3056
+ U as a2,
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,
3070
+ x as aG,
3071
+ Kr as aH,
3072
+ K as aI,
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,
3029
3102
  Zn as al,
3030
- es as am,
3031
- dt as an,
3032
- gi as ao,
3033
- ge as ap,
3034
- ji as aq,
3035
- Mi as ar,
3036
- Li as as,
3037
- Di as at,
3038
- Oi as au,
3039
- rs as av,
3040
- ur as aw,
3041
- Fi as ax,
3042
- Pi as ay,
3043
- Da as az,
3044
- Vs as b,
3045
- $i as b0,
3046
- ia as b1,
3047
- zi as b2,
3048
- Js as b3,
3049
- ti as b4,
3050
- Sn as b5,
3051
- Ie as b6,
3052
- ta as b7,
3053
- ft as b8,
3054
- fa as b9,
3055
- ts as ba,
3056
- ha as bb,
3057
- ca as bc,
3058
- da as bd,
3059
- pa as be,
3060
- ua as bf,
3061
- Pt as bg,
3062
- Qi as bh,
3063
- la as bi,
3064
- Qn as bj,
3065
- at as bk,
3066
- Wi as bl,
3067
- ls as bm,
3068
- Hi as bn,
3069
- wi as bo,
3070
- vi as bp,
3071
- Ye as bq,
3072
- S as br,
3073
- Ei as bs,
3074
- bi as bt,
3075
- ki as bu,
3076
- nn as bv,
3077
- Ji as bw,
3078
- hs as c,
3079
- ms as d,
3080
- re as e,
3081
- Dt as f,
3082
- ut as g,
3083
- sa as h,
3084
- na as i,
3085
- Na as j,
3086
- $ as k,
3087
- ga as l,
3088
- yi as m,
3089
- $a as n,
3090
- Ea as o,
3091
- Ct as p,
3092
- ka as q,
3093
- ma as r,
3094
- Kr as s,
3095
- Tt as t,
3096
- qr as u,
3097
- Ta as v,
3098
- Ti as w,
3099
- Ws as x,
3100
- ri as y,
3101
- hr as z
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,
3125
+ $e as b7,
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,
3147
+ S as bt,
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,
3162
+ $ as l,
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
3102
3177
  };
3103
- //# sourceMappingURL=phase-progress.C97wkNMK.js.map
3178
+ //# sourceMappingURL=phase-progress.2akB88O9.js.map