@dendelion/paper-camp 0.33.1 → 0.35.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.
@@ -21,7 +21,7 @@ function Me(e) {
21
21
  const n = t.match(Ut);
22
22
  return n ? { key: n[1], value: zt(n[2]) } : null;
23
23
  }
24
- function ni(e) {
24
+ function ti(e) {
25
25
  const t = [];
26
26
  for (const n of e.split(`
27
27
  `)) {
@@ -30,7 +30,7 @@ function ni(e) {
30
30
  }
31
31
  return t;
32
32
  }
33
- function si(e, t) {
33
+ function ni(e, t) {
34
34
  const n = new Map(t.map((i) => [i.key, i.value])), s = e.length > 0 ? e.split(`
35
35
  `) : [], a = [];
36
36
  for (const i of s) {
@@ -48,7 +48,7 @@ function si(e, t) {
48
48
  `)}
49
49
  ` : "";
50
50
  }
51
- function ai(e) {
51
+ function si(e) {
52
52
  return e.archived === !0 || e.status === "done";
53
53
  }
54
54
  function X(e) {
@@ -103,10 +103,10 @@ function Zt(e = []) {
103
103
  kind: t.kind
104
104
  }));
105
105
  }
106
- function ii(e, t, n) {
106
+ function ai(e, t, n) {
107
107
  return [...(e ?? []).filter((s) => !t.includes(s.kind)), ...n];
108
108
  }
109
- function ri(e, t, n, s) {
109
+ function ii(e, t, n, s) {
110
110
  return e.map((a, i) => {
111
111
  if (i !== t) return a;
112
112
  const r = s ? `${a.text}
@@ -117,7 +117,7 @@ ${s}` : a.text;
117
117
  return { ...c, kind: n, text: r };
118
118
  });
119
119
  }
120
- function oi(e = []) {
120
+ function ri(e = []) {
121
121
  const t = e.reduce((n, s, a) => s.kind === "log" ? a : n, -1);
122
122
  return e.slice(t + 1).filter((n) => n.kind === "chat");
123
123
  }
@@ -341,7 +341,7 @@ query($owner: String!, $repo: String!, $number: Int!) {
341
341
  }
342
342
  }
343
343
  }`;
344
- async function ci(e, t) {
344
+ async function oi(e, t) {
345
345
  var i, r, o;
346
346
  const n = M(t);
347
347
  if (!n) return [];
@@ -368,12 +368,12 @@ mutation($threadId: ID!, $body: String!) {
368
368
  comment { id }
369
369
  }
370
370
  }`;
371
- async function di(e, t) {
371
+ async function ci(e, t) {
372
372
  var s, a, i;
373
373
  const n = await ze(e, pn, { threadId: t });
374
374
  return !!((i = (a = (s = n == null ? void 0 : n.data) == null ? void 0 : s.resolveReviewThread) == null ? void 0 : a.thread) != null && i.isResolved);
375
375
  }
376
- async function ui(e, t, n) {
376
+ async function di(e, t, n) {
377
377
  var a, i, r;
378
378
  const s = await ze(e, hn, { threadId: t, body: n });
379
379
  return !!((r = (i = (a = s == null ? void 0 : s.data) == null ? void 0 : a.addPullRequestReviewThreadReply) == null ? void 0 : i.comment) != null && r.id);
@@ -395,7 +395,7 @@ function We(e, t, n) {
395
395
  }), (c = a.stdin) == null || c.end(JSON.stringify(n));
396
396
  });
397
397
  }
398
- async function li(e, t, n) {
398
+ async function ui(e, t, n) {
399
399
  const s = M(t);
400
400
  return s ? We(
401
401
  e,
@@ -403,7 +403,7 @@ async function li(e, t, n) {
403
403
  n
404
404
  ) : { delivered: !1 };
405
405
  }
406
- async function fi(e, t, n) {
406
+ async function li(e, t, n) {
407
407
  const s = M(t);
408
408
  return s ? We(e, `repos/${s.owner}/${s.repo}/dispatches`, {
409
409
  event_type: "paper-camp-review",
@@ -457,11 +457,11 @@ async function Je(e, t = sn) {
457
457
  }
458
458
  return n == null ? void 0 : n.prs;
459
459
  }
460
- function pi(e) {
460
+ function fi(e) {
461
461
  var t;
462
462
  return (t = k.get(e)) == null ? void 0 : t.prs;
463
463
  }
464
- function hi(e, t) {
464
+ function pi(e, t) {
465
465
  const n = (a) => `${a.number}:${a.headSha ?? "unknown"}`, s = [];
466
466
  for (const [a, i] of t) {
467
467
  if (i.reviewDecision !== "changes-requested") continue;
@@ -470,7 +470,7 @@ function hi(e, t) {
470
470
  }
471
471
  return s;
472
472
  }
473
- async function mi(e) {
473
+ async function hi(e) {
474
474
  let t = k.get(e);
475
475
  if (!t) {
476
476
  const n = await Be(e);
@@ -478,7 +478,7 @@ async function mi(e) {
478
478
  }
479
479
  return (t == null ? void 0 : t.fetchedAt) ?? null;
480
480
  }
481
- async function gi(e) {
481
+ async function mi(e) {
482
482
  if (e === void 0) {
483
483
  k.clear();
484
484
  return;
@@ -771,14 +771,14 @@ const et = {
771
771
  }), Fn = d.object({
772
772
  endpoint: d.string(),
773
773
  keys: d.object({ p256dh: d.string(), auth: d.string() })
774
- }), yi = d.discriminatedUnion("transport", [
774
+ }), gi = d.discriminatedUnion("transport", [
775
775
  d.object({
776
776
  transport: d.literal("webpush"),
777
777
  name: d.string(),
778
778
  subscription: Fn
779
779
  }),
780
780
  d.object({ transport: d.literal("expo"), name: d.string(), token: d.string() })
781
- ]), wi = d.discriminatedUnion("transport", [
781
+ ]), yi = d.discriminatedUnion("transport", [
782
782
  d.object({ transport: d.literal("webpush"), endpoint: d.string() }),
783
783
  d.object({ transport: d.literal("expo"), token: d.string() })
784
784
  ]), Hn = d.object({
@@ -887,7 +887,7 @@ function qn(e) {
887
887
  }
888
888
  return s;
889
889
  }
890
- function bi(e) {
890
+ function wi(e) {
891
891
  const t = [], n = [];
892
892
  for (const s of qn(e)) {
893
893
  const a = An.safeParse(s.fields);
@@ -1000,7 +1000,7 @@ function st(e) {
1000
1000
  ...y && { unknownFrontmatter: y }
1001
1001
  }], warnings: t };
1002
1002
  }
1003
- function vi(e) {
1003
+ function bi(e) {
1004
1004
  const t = [], {
1005
1005
  data: n,
1006
1006
  body: s,
@@ -1029,7 +1029,7 @@ function vi(e) {
1029
1029
  review: l
1030
1030
  }], warnings: t };
1031
1031
  }
1032
- function Ei(e) {
1032
+ function vi(e) {
1033
1033
  const {
1034
1034
  data: t,
1035
1035
  body: n,
@@ -1048,7 +1048,7 @@ function Ei(e) {
1048
1048
  }], warnings: s };
1049
1049
  }
1050
1050
  const Kn = /^(IDEA-\d+):\s*/, Wn = /\n---+\n/;
1051
- function ki(e) {
1051
+ function Ei(e) {
1052
1052
  return e.split(Wn).filter(Boolean).map((n) => {
1053
1053
  var c;
1054
1054
  const s = n.match(/^#{1,3}\s+(.+)/m), a = s ? s[1].trim() : ((c = n.trim().split(`
@@ -1095,7 +1095,7 @@ function Vn(e) {
1095
1095
  }
1096
1096
  return n.map((s) => t.get(s));
1097
1097
  }
1098
- function Si(e) {
1098
+ function ki(e) {
1099
1099
  const t = [];
1100
1100
  for (const n of e.split(`
1101
1101
  `)) {
@@ -1110,7 +1110,7 @@ function Si(e) {
1110
1110
  return t;
1111
1111
  }
1112
1112
  const at = /^-\s+(\d{4}-\d{2}-\d{2}):\s+(.+?)\s+—\s+(.*)$/;
1113
- function $i(e) {
1113
+ function Si(e) {
1114
1114
  const t = [];
1115
1115
  for (const n of e.split(`
1116
1116
  `)) {
@@ -1130,7 +1130,7 @@ function Xn(e) {
1130
1130
  };
1131
1131
  });
1132
1132
  }
1133
- function Ii(e) {
1133
+ function $i(e) {
1134
1134
  return e.length === 0 ? "" : `${e.map((t) => `${t.id}${ee}${t.title}`).join(`
1135
1135
  `)}
1136
1136
  `;
@@ -1185,7 +1185,7 @@ async function he(e, t) {
1185
1185
  ]);
1186
1186
  return { entries: n, warnings: s, prs: i, resolved: i !== void 0, mainActivityIds: r };
1187
1187
  }
1188
- async function Ri(e) {
1188
+ async function Ii(e) {
1189
1189
  const { entries: t, warnings: n, prs: s, resolved: a, mainActivityIds: i } = await he(e), r = t.map((c) => ({
1190
1190
  ...c,
1191
1191
  status: W(c, s == null ? void 0 : s.get(c.id), a, i.has(c.id))
@@ -1196,7 +1196,7 @@ async function Ri(e) {
1196
1196
  return { ...c, status: je(u) };
1197
1197
  }), warnings: n };
1198
1198
  }
1199
- async function Ai(e, t) {
1199
+ async function Ri(e, t) {
1200
1200
  const { entries: n, warnings: s, prs: a, resolved: i, mainActivityIds: r } = await he(
1201
1201
  e,
1202
1202
  t
@@ -1208,7 +1208,7 @@ async function Ai(e, t) {
1208
1208
  return { ...u, status: je(l) };
1209
1209
  }), warnings: s, resolved: i };
1210
1210
  }
1211
- async function Pi(e) {
1211
+ async function Ai(e) {
1212
1212
  const { entries: t, prs: n, resolved: s } = await he(e);
1213
1213
  return {
1214
1214
  entries: t.flatMap((a) => {
@@ -1218,7 +1218,7 @@ async function Pi(e) {
1218
1218
  resolved: s
1219
1219
  };
1220
1220
  }
1221
- async function Ti(e) {
1221
+ async function Pi(e) {
1222
1222
  const { entries: t, warnings: n } = await _(e);
1223
1223
  return {
1224
1224
  entries: t.filter((s) => s.kind === "note").map(Qt),
@@ -1304,7 +1304,7 @@ function rt(e) {
1304
1304
  (t, n) => t.file.localeCompare(n.file) || t.line - n.line || Te[B(t)] - Te[B(n)] || t.rule.localeCompare(n.rule)
1305
1305
  );
1306
1306
  }
1307
- function Ni(e) {
1307
+ function Ti(e) {
1308
1308
  const t = rt(e).map((n) => ({
1309
1309
  ...n,
1310
1310
  severity: B(n)
@@ -1315,7 +1315,7 @@ function Ni(e) {
1315
1315
  warningCount: t.filter((n) => n.severity === "warning").length
1316
1316
  };
1317
1317
  }
1318
- function Ci(e) {
1318
+ function Ni(e) {
1319
1319
  const t = rt(e);
1320
1320
  let n = 0, s = 0;
1321
1321
  const a = t.map((r) => {
@@ -1355,12 +1355,12 @@ function ct(e) {
1355
1355
  const t = e == null ? void 0 : e.version;
1356
1356
  return typeof t == "number" ? t : null;
1357
1357
  }
1358
- async function _i(e) {
1358
+ async function Ci(e) {
1359
1359
  const t = ct(await ot(e));
1360
1360
  if (t !== null && t > I)
1361
1361
  throw new ns(t);
1362
1362
  }
1363
- async function xi(e) {
1363
+ async function _i(e) {
1364
1364
  const t = await ot(e);
1365
1365
  if (!t) return null;
1366
1366
  const n = ct(t);
@@ -1663,7 +1663,7 @@ async function xs(e) {
1663
1663
  function Os(e) {
1664
1664
  return Ts.flatMap((t) => t(e));
1665
1665
  }
1666
- async function Oi(e) {
1666
+ async function xi(e) {
1667
1667
  return Os(await xs(e));
1668
1668
  }
1669
1669
  const Ds = {
@@ -1676,7 +1676,7 @@ const Ds = {
1676
1676
  }, Ms = [Ds], js = new Map(
1677
1677
  Ms.map((e) => [e.rule, e])
1678
1678
  );
1679
- function Di(e, t) {
1679
+ function Oi(e, t) {
1680
1680
  const n = new Map(e.files.map((o) => [o.path, o])), s = [], a = [], i = [], r = [];
1681
1681
  for (const o of t) {
1682
1682
  const c = js.get(o.rule), u = n.get(o.file), l = c && u ? c.fix(o, u) : null;
@@ -1755,7 +1755,7 @@ async function Us(e, t) {
1755
1755
  u ? u.push(r) : i.set(c, [r]);
1756
1756
  }), i;
1757
1757
  }
1758
- async function Mi(e, t) {
1758
+ async function Di(e, t) {
1759
1759
  const [{ entries: n }, s, a, i, r, o] = await Promise.all([
1760
1760
  _(f(e, "papercamp", "ideas")),
1761
1761
  Je(e),
@@ -1860,7 +1860,7 @@ function be(e, t, n) {
1860
1860
  return { start: a, end: r };
1861
1861
  }
1862
1862
  }
1863
- function ji(e, t, n, s) {
1863
+ function Mi(e, t, n, s) {
1864
1864
  const a = e.split(`
1865
1865
  `), i = be(a, t, n);
1866
1866
  if (!i) return e;
@@ -1875,7 +1875,7 @@ function ji(e, t, n, s) {
1875
1875
  }
1876
1876
  return e;
1877
1877
  }
1878
- function Li(e, t, n, s) {
1878
+ function ji(e, t, n, s) {
1879
1879
  const a = e.split(`
1880
1880
  `), i = yt(a, t);
1881
1881
  if (!i) return e;
@@ -1884,13 +1884,13 @@ function Li(e, t, n, s) {
1884
1884
  return a.splice(r, 0, `- **${n}** — ${s}`), a.join(`
1885
1885
  `);
1886
1886
  }
1887
- function Fi(e, t, n, s) {
1887
+ function Li(e, t, n, s) {
1888
1888
  const a = e.split(`
1889
1889
  `), i = be(a, t, n);
1890
1890
  return i ? (a.splice(i.end, 0, ` - ${s}`), a.join(`
1891
1891
  `)) : e;
1892
1892
  }
1893
- function Hi(e, t, n, s) {
1893
+ function Fi(e, t, n, s) {
1894
1894
  const a = e.split(`
1895
1895
  `), i = be(a, t, n);
1896
1896
  return i ? (a.splice(i.end, 0, ` - → ${s}`), a.join(`
@@ -1902,7 +1902,7 @@ function Vs(e) {
1902
1902
  ...e.standingConcerns.map((t) => t.name)
1903
1903
  ];
1904
1904
  }
1905
- function Gi(e, t, n = [], s = "") {
1905
+ function Hi(e, t, n = [], s = "") {
1906
1906
  const a = new Map(t.filter((c) => c.id).map((c) => [c.id, c])), i = /* @__PURE__ */ new Map();
1907
1907
  for (const c of n)
1908
1908
  c.planId && i.set(c.planId, (i.get(c.planId) ?? 0) + 1);
@@ -2029,7 +2029,7 @@ function wt(e, t) {
2029
2029
  });
2030
2030
  }
2031
2031
  const ea = 6e4;
2032
- function Bi(e, t, n = ea) {
2032
+ function Gi(e, t, n = ea) {
2033
2033
  return new Promise((s) => {
2034
2034
  var r, o;
2035
2035
  const a = b("gh", ["pr", "diff", t], { cwd: e, stdio: ["ignore", "pipe", "pipe"] });
@@ -2068,7 +2068,7 @@ async function P(e, t) {
2068
2068
  if (r)
2069
2069
  return { id: s, view: n, entry: r };
2070
2070
  }
2071
- async function Yi(e, t) {
2071
+ async function Bi(e, t) {
2072
2072
  const n = await P(e, t);
2073
2073
  if (!n) return;
2074
2074
  const { id: s, entry: a } = n;
@@ -2098,7 +2098,7 @@ function sa(e, t, n) {
2098
2098
  }), a.on("close", (o) => s(o === 0)), a.on("error", () => s(!1)), (r = a.stdin) == null || r.end(n);
2099
2099
  });
2100
2100
  }
2101
- async function qi(e, t) {
2101
+ async function Yi(e, t) {
2102
2102
  const n = await P(e, t);
2103
2103
  if (!(n != null && n.view)) return "unresolved";
2104
2104
  const { view: s, entry: a } = n, i = na(s.body, a.phases);
@@ -2158,7 +2158,7 @@ function oa(e, t, n) {
2158
2158
  }), a.on("close", (r) => s(r === 0)), a.on("error", () => s(!1));
2159
2159
  });
2160
2160
  }
2161
- async function Ui(e, t) {
2161
+ async function qi(e, t) {
2162
2162
  const n = await P(e, t);
2163
2163
  if (!(n != null && n.view)) return "unresolved";
2164
2164
  const { view: s, entry: a } = n, i = aa({ kind: a.type, tags: a.tags }), r = new Set((s.labels ?? []).map((l) => l.name)), o = i.filter((l) => !r.has(l));
@@ -2191,19 +2191,19 @@ function ua(e, t, n) {
2191
2191
  }), a.on("close", (r) => s(r === 0)), a.on("error", () => s(!1));
2192
2192
  });
2193
2193
  }
2194
- async function zi(e, t) {
2194
+ async function Ui(e, t) {
2195
2195
  const n = await P(e, t);
2196
2196
  if (!(n != null && n.view)) return "unresolved";
2197
2197
  const { id: s, view: a, entry: i } = n, r = Et(s, i);
2198
2198
  return a.title === r ? "unchanged" : await ua(e, t, r) ? "updated" : "unresolved";
2199
2199
  }
2200
- async function Ki(e, t) {
2200
+ async function zi(e, t) {
2201
2201
  const n = await wt(e, t);
2202
2202
  if (!n) return "no-pr";
2203
2203
  const s = await P(e, t);
2204
2204
  return s ? n.title === Et(s.id, s.entry) ? "valid" : "invalid" : da(n.title) ? "valid" : "invalid";
2205
2205
  }
2206
- function Wi(e, t) {
2206
+ function Ki(e, t) {
2207
2207
  return new Promise((n) => {
2208
2208
  var i;
2209
2209
  const s = b("gh", ["pr", "merge", t, "--squash"], {
@@ -2243,7 +2243,7 @@ function fa(e, t) {
2243
2243
  }), s.on("close", (i) => n(i === 0)), s.on("error", () => n(!1));
2244
2244
  });
2245
2245
  }
2246
- async function Ji(e, t) {
2246
+ async function Wi(e, t) {
2247
2247
  const n = await P(e, t);
2248
2248
  if (!(n != null && n.view)) return "unresolved";
2249
2249
  const { view: s, entry: a } = n;
@@ -2294,7 +2294,7 @@ function ga(e, t, n, s, a) {
2294
2294
  }), r.on("close", (u) => i(u === 0)), r.on("error", () => i(!1)), (c = r.stdin) == null || c.end(a);
2295
2295
  });
2296
2296
  }
2297
- async function Vi(e, t) {
2297
+ async function Ji(e, t) {
2298
2298
  var g, m;
2299
2299
  const n = await P(e, t);
2300
2300
  if (!((g = n == null ? void 0 : n.view) != null && g.url)) return "unresolved";
@@ -2312,7 +2312,7 @@ async function Vi(e, t) {
2312
2312
  }
2313
2313
  return await ma(e, t, p) ? "created" : "unresolved";
2314
2314
  }
2315
- function Xi(e, t, n) {
2315
+ function Vi(e, t, n) {
2316
2316
  if (!e) return;
2317
2317
  const s = (t ?? "feat").toLowerCase(), a = n.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, ""), i = a.length <= 40 ? a : a[40] === "-" ? a.slice(0, 40) : a.slice(0, 40).replace(/-[^-]*$/, "");
2318
2318
  return `${s}/${e.toLowerCase()}-${i}`;
@@ -2325,7 +2325,7 @@ function V(e, t) {
2325
2325
  function St() {
2326
2326
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
2327
2327
  }
2328
- function Zi(e, t = "log", n) {
2328
+ function Xi(e, t = "log", n) {
2329
2329
  return {
2330
2330
  kind: t,
2331
2331
  date: St(),
@@ -2335,7 +2335,7 @@ function Zi(e, t = "log", n) {
2335
2335
  ...n ? { entityId: n } : {}
2336
2336
  };
2337
2337
  }
2338
- function ya(e) {
2338
+ function Zi(e) {
2339
2339
  const t = [`## ${e.title}`, "", `**Status:** ${e.status}`];
2340
2340
  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(", ")}`);
2341
2341
  const n = [t.join(`
@@ -2349,18 +2349,12 @@ function ya(e) {
2349
2349
 
2350
2350
  `).trimEnd();
2351
2351
  }
2352
- function Qi(e) {
2353
- return e.length === 0 ? "" : `${e.map((t) => ya(t)).join(`
2354
-
2355
- `)}
2356
- `;
2357
- }
2358
2352
  function Ee(e) {
2359
2353
  return `---
2360
2354
  ${xt(e).trimEnd()}
2361
2355
  ---`;
2362
2356
  }
2363
- function er(e) {
2357
+ function Qi(e) {
2364
2358
  const t = {
2365
2359
  id: e.id,
2366
2360
  title: e.title,
@@ -2379,7 +2373,7 @@ function er(e) {
2379
2373
 
2380
2374
  `).trimEnd();
2381
2375
  }
2382
- function wa(e) {
2376
+ function ya(e) {
2383
2377
  const t = {
2384
2378
  id: e.id,
2385
2379
  title: e.title
@@ -2396,7 +2390,7 @@ function wa(e) {
2396
2390
 
2397
2391
  `).trimEnd();
2398
2392
  }
2399
- function tr(e) {
2393
+ function er(e) {
2400
2394
  const t = {
2401
2395
  id: e.id,
2402
2396
  title: e.title
@@ -2409,7 +2403,7 @@ ${e.body}` : s), V(n, [{ entries: e.log, section: j }]), n.join(`
2409
2403
 
2410
2404
  `).trimEnd();
2411
2405
  }
2412
- function nr(e, t) {
2406
+ function tr(e, t) {
2413
2407
  let n = !1;
2414
2408
  const s = e.split(`
2415
2409
  `).filter((a) => {
@@ -2424,7 +2418,7 @@ function nr(e, t) {
2424
2418
  `) : e;
2425
2419
  }
2426
2420
  let U = Promise.resolve();
2427
- async function ba(e, t) {
2421
+ async function wa(e, t) {
2428
2422
  const n = new RegExp(`^${t.toUpperCase()}-(\\d+)\\.md$`), s = [
2429
2423
  f(e, "ideas"),
2430
2424
  f(e, "ideas", "archive"),
@@ -2455,20 +2449,20 @@ async function $t(e, t) {
2455
2449
  return;
2456
2450
  }
2457
2451
  if (!(s != null && s.nextId)) return;
2458
- const a = s.nextId[t] ?? 1, i = await ba(O(e), t), r = Math.max(a, i + 1), o = `${t.toUpperCase()}-${r}`;
2452
+ const a = s.nextId[t] ?? 1, i = await wa(O(e), t), r = Math.max(a, i + 1), o = `${t.toUpperCase()}-${r}`;
2459
2453
  return s.nextId[t] = r + 1, await E(e, `${JSON.stringify(s, null, 2)}
2460
2454
  `), o;
2461
2455
  });
2462
2456
  return U = n.catch(() => {
2463
2457
  }), n;
2464
2458
  }
2465
- async function sr(e) {
2459
+ async function nr(e) {
2466
2460
  return $t(e, "idea");
2467
2461
  }
2468
- async function ar(e) {
2462
+ async function sr(e) {
2469
2463
  return $t(e, "ticket");
2470
2464
  }
2471
- async function ir(e, t) {
2465
+ async function ar(e, t) {
2472
2466
  const n = U.then(async () => {
2473
2467
  let s = null;
2474
2468
  try {
@@ -2483,7 +2477,7 @@ async function ir(e, t) {
2483
2477
  return U = n.catch(() => {
2484
2478
  }), n;
2485
2479
  }
2486
- async function rr(e, t) {
2480
+ async function ir(e, t) {
2487
2481
  const n = f(e, "papercamp", "ideas"), s = f(n, "archive"), a = f(n, `${t}.md`), i = f(s, `${t}.md`);
2488
2482
  await A(s, { recursive: !0 });
2489
2483
  try {
@@ -2493,18 +2487,18 @@ async function rr(e, t) {
2493
2487
  throw r;
2494
2488
  }
2495
2489
  }
2496
- const va = [
2490
+ const ba = [
2497
2491
  ["pnpm-lock.yaml", "pnpm"],
2498
2492
  ["yarn.lock", "yarn"],
2499
2493
  ["bun.lockb", "bun"],
2500
2494
  ["package-lock.json", "npm"]
2501
2495
  ];
2502
2496
  function It(e) {
2503
- for (const [t, n] of va)
2497
+ for (const [t, n] of ba)
2504
2498
  if (se(f(e, t))) return n;
2505
2499
  return "npm";
2506
2500
  }
2507
- function Ea(e) {
2501
+ function va(e) {
2508
2502
  const t = f(e, "package.json");
2509
2503
  if (se(t))
2510
2504
  try {
@@ -2514,26 +2508,26 @@ function Ea(e) {
2514
2508
  }
2515
2509
  }
2516
2510
  const _e = "@dendelion/paper-camp";
2517
- function ka(e) {
2518
- const t = Ea(e);
2511
+ function Ea(e) {
2512
+ const t = va(e);
2519
2513
  if (!t) return !1;
2520
2514
  const n = t.dependencies, s = t.devDependencies;
2521
2515
  return !!(n != null && n[_e] || s != null && s[_e]);
2522
2516
  }
2523
- const Sa = ["*.json", "*.ts", "*.tsx", "*.md", "*.config.*"], $a = ["src/**", "app/**", "scripts/**", "papercamp/**"], Ia = ["git status*", "git diff*", "git log*"], Ra = ["ls*", "cat*", "wc*"], Aa = ["run *", "test*", "install*", "view *", "pack*", "ls*"], Pa = ["npx tsc*", "npx biome check*", "npx vitest*", "npx jest*", "npx expo *"];
2517
+ const ka = ["*.json", "*.ts", "*.tsx", "*.md", "*.config.*"], Sa = ["src/**", "app/**", "scripts/**", "papercamp/**"], $a = ["git status*", "git diff*", "git log*"], Ia = ["ls*", "cat*", "wc*"], Ra = ["run *", "test*", "install*", "view *", "pack*", "ls*"], Aa = ["npx tsc*", "npx biome check*", "npx vitest*", "npx jest*", "npx expo *"];
2524
2518
  function Rt(e) {
2525
- const t = $a.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), n = Sa.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), s = [
2519
+ const t = Sa.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), n = ka.flatMap((a) => [`Edit(${a})`, `Write(${a})`]), s = [
2520
+ ...$a,
2526
2521
  ...Ia,
2527
- ...Ra,
2528
- ...Aa.map((a) => `${e} ${a}`),
2529
- ...Pa
2522
+ ...Ra.map((a) => `${e} ${a}`),
2523
+ ...Aa
2530
2524
  ].map((a) => `Bash(${a})`);
2531
2525
  return [...t, ...n, ...s];
2532
2526
  }
2533
- function Ta(e) {
2534
- return e ? `"${xa}" session-focus` : "paper-camp session-focus";
2527
+ function Pa(e) {
2528
+ return e ? `"${_a}" session-focus` : "paper-camp session-focus";
2535
2529
  }
2536
- function Na(e, t) {
2530
+ function Ta(e, t) {
2537
2531
  let n;
2538
2532
  try {
2539
2533
  n = JSON.parse(e);
@@ -2544,8 +2538,8 @@ function Na(e, t) {
2544
2538
  return r.length === 0 && n.permissions !== void 0 ? e : (n.permissions = { ...a, allow: [...i, ...r] }, `${JSON.stringify(n, null, 2)}
2545
2539
  `);
2546
2540
  }
2547
- function Ca(e) {
2548
- const t = It(e), n = Ta(ka(e));
2541
+ function Na(e) {
2542
+ const t = It(e), n = Pa(Ea(e));
2549
2543
  return `${JSON.stringify(
2550
2544
  {
2551
2545
  permissions: {
@@ -2565,7 +2559,7 @@ function Ca(e) {
2565
2559
  )}
2566
2560
  `;
2567
2561
  }
2568
- const _a = `---
2562
+ const Ca = `---
2569
2563
  name: paper-camp
2570
2564
  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".
2571
2565
  ---
@@ -2634,11 +2628,11 @@ session start from live plan data, not hand-maintained here. It does
2634
2628
  not define the file formats in full; treat the existing files under
2635
2629
  \`papercamp/\` as the grammar reference (mirror their structure exactly rather
2636
2630
  than inventing a new shape).
2637
- `, xa = "$CLAUDE_PROJECT_DIR/node_modules/.bin/paper-camp", Oa = 5;
2638
- function Da() {
2631
+ `, _a = "$CLAUDE_PROJECT_DIR/node_modules/.bin/paper-camp", xa = 5;
2632
+ function Oa() {
2639
2633
  try {
2640
2634
  let e = O(Lt(import.meta.url));
2641
- for (let t = 0; t < Oa; t++) {
2635
+ for (let t = 0; t < xa; t++) {
2642
2636
  const n = f(e, "package.json");
2643
2637
  if (se(n))
2644
2638
  return JSON.parse(De(n, "utf-8")).version ?? "0.0.0";
@@ -2649,8 +2643,8 @@ function Da() {
2649
2643
  return "0.0.0";
2650
2644
  }
2651
2645
  }
2652
- const or = Da();
2653
- class Ma extends Error {
2646
+ const rr = Oa();
2647
+ class Da extends Error {
2654
2648
  constructor(t) {
2655
2649
  super(`Paper Camp is already initialized in ${t} (papercamp/config.json exists).`);
2656
2650
  }
@@ -2662,11 +2656,11 @@ async function T(e) {
2662
2656
  return !1;
2663
2657
  }
2664
2658
  }
2665
- const ja = ["suggestions.md"];
2666
- async function cr(e, t) {
2659
+ const Ma = ["suggestions.md"];
2660
+ async function or(e, t) {
2667
2661
  const n = f(e, "papercamp"), s = f(n, "config.json");
2668
2662
  if (await T(s))
2669
- throw new Ma(e);
2663
+ throw new Da(e);
2670
2664
  const a = {
2671
2665
  version: I,
2672
2666
  projectName: t.projectName,
@@ -2680,7 +2674,7 @@ async function cr(e, t) {
2680
2674
  await A(r, { recursive: !0 });
2681
2675
  const o = f(i, "IDEA-1.md");
2682
2676
  if (!await T(o)) {
2683
- const c = wa({
2677
+ const c = ya({
2684
2678
  id: "IDEA-1",
2685
2679
  title: "Capture your first idea",
2686
2680
  status: "idea",
@@ -2692,19 +2686,19 @@ Use the New idea button to capture what you're building next, or ask an agent fo
2692
2686
  await E(o, `${c}
2693
2687
  `, "utf-8");
2694
2688
  }
2695
- for (const c of ja) {
2689
+ for (const c of Ma) {
2696
2690
  const u = f(n, c);
2697
2691
  await T(u) || await E(u, "", "utf-8");
2698
2692
  }
2699
2693
  await E(s, `${JSON.stringify(a, null, 2)}
2700
- `, "utf-8"), await Fa(e), await Ha(e), await La(e, t.projectName);
2694
+ `, "utf-8"), await La(e), await Fa(e), await ja(e, t.projectName);
2701
2695
  }
2702
- async function La(e, t) {
2696
+ async function ja(e, t) {
2703
2697
  const n = Gt(), s = await Bt(n), { registry: a, created: i } = Yt(s, e, t);
2704
2698
  i && await qt(n, a);
2705
2699
  }
2706
2700
  const Z = "papercamp/.pairing.json";
2707
- async function Fa(e) {
2701
+ async function La(e) {
2708
2702
  const t = f(e, ".gitignore"), n = await T(t) ? await v(t, "utf-8") : "", s = n.length > 0 ? n.split(`
2709
2703
  `) : [];
2710
2704
  if (s.some((i) => i.trim() === Z)) return;
@@ -2723,19 +2717,19 @@ async function Fa(e) {
2723
2717
  s.splice(a + 1, 0, Z), await E(t, s.join(`
2724
2718
  `), "utf-8");
2725
2719
  }
2726
- async function Ha(e) {
2720
+ async function Fa(e) {
2727
2721
  const t = f(e, ".claude", "skills", "paper-camp");
2728
2722
  await A(t, { recursive: !0 });
2729
2723
  const n = f(t, "SKILL.md");
2730
- await T(n) || await E(n, _a, "utf-8");
2724
+ await T(n) || await E(n, Ca, "utf-8");
2731
2725
  const s = f(e, ".claude");
2732
2726
  await A(s, { recursive: !0 });
2733
2727
  const a = f(s, "settings.json");
2734
2728
  if (await T(a)) {
2735
- const i = await v(a, "utf-8"), r = Na(i, e);
2729
+ const i = await v(a, "utf-8"), r = Ta(i, e);
2736
2730
  r !== i && await E(a, r, "utf-8");
2737
2731
  } else
2738
- await E(a, Ca(e), "utf-8");
2732
+ await E(a, Na(e), "utf-8");
2739
2733
  }
2740
2734
  const At = {
2741
2735
  feat: "Features",
@@ -2743,8 +2737,8 @@ const At = {
2743
2737
  refactor: "Code Refactoring",
2744
2738
  docs: "Documentation",
2745
2739
  chore: "Miscellaneous"
2746
- }, Ga = Array.from(new Set(Object.values(At)));
2747
- async function dr(e, t) {
2740
+ }, Ha = Array.from(new Set(Object.values(At)));
2741
+ async function cr(e, t) {
2748
2742
  const n = await Y(f(e, "CHANGELOG.md")), s = Fs(n).find((o) => o.version === t);
2749
2743
  if (!s) return null;
2750
2744
  const [{ entries: a }, i] = await Promise.all([
@@ -2757,12 +2751,12 @@ async function dr(e, t) {
2757
2751
  const u = At[c.type ?? "chore"], l = r.get(u) ?? [];
2758
2752
  l.push({ id: c.id, title: c.title }), r.set(u, l);
2759
2753
  }
2760
- return Ga.filter((o) => r.has(o)).map((o) => ({
2754
+ return Ha.filter((o) => r.has(o)).map((o) => ({
2761
2755
  label: o,
2762
2756
  ideas: r.get(o)
2763
2757
  }));
2764
2758
  }
2765
- function ur(e, t) {
2759
+ function dr(e, t) {
2766
2760
  const n = [`## ${e}`];
2767
2761
  for (const s of t) {
2768
2762
  n.push("", `### ${s.label}`, "");
@@ -2772,24 +2766,24 @@ function ur(e, t) {
2772
2766
  return n.join(`
2773
2767
  `);
2774
2768
  }
2775
- function Ba(e) {
2769
+ function Ga(e) {
2776
2770
  return Math.floor((Date.now() - Date.parse(e)) / 864e5);
2777
2771
  }
2778
- const Ya = (e, t) => e === "question" && (t ?? "open") === "open";
2779
- function qa(e) {
2772
+ const Ba = (e, t) => e === "question" && (t ?? "open") === "open";
2773
+ function Ya(e) {
2780
2774
  return e.flatMap(
2781
- (t) => (t.thread ?? []).filter((n) => Ya(n.kind, n.state)).map((n) => ({
2775
+ (t) => (t.thread ?? []).filter((n) => Ba(n.kind, n.state)).map((n) => ({
2782
2776
  entityId: t.id,
2783
2777
  entityTitle: t.title,
2784
2778
  text: n.text,
2785
2779
  date: n.date,
2786
- ageDays: n.date ? Ba(n.date) : Number.POSITIVE_INFINITY
2780
+ ageDays: n.date ? Ga(n.date) : Number.POSITIVE_INFINITY
2787
2781
  }))
2788
2782
  ).sort((t, n) => n.ageDays - t.ageDays);
2789
2783
  }
2790
- async function lr(e) {
2784
+ async function ur(e) {
2791
2785
  const { entries: t } = await _(e);
2792
- return qa(t);
2786
+ return Ya(t);
2793
2787
  }
2794
2788
  const te = 0.95, Pt = 3e4, ne = {
2795
2789
  implement: { from: 0, to: 0.6 },
@@ -2805,7 +2799,7 @@ function Oe(e, ...t) {
2805
2799
  if (typeof (e == null ? void 0 : e[n]) == "string") return e[n];
2806
2800
  return "";
2807
2801
  }
2808
- function fr(e, t) {
2802
+ function lr(e, t) {
2809
2803
  const n = e.toLowerCase();
2810
2804
  if (n === "bash")
2811
2805
  return (typeof (t == null ? void 0 : t.command) == "string" ? t.command : "").includes("check-types") ? "verify" : null;
@@ -2815,29 +2809,29 @@ function fr(e, t) {
2815
2809
  }
2816
2810
  return null;
2817
2811
  }
2818
- function pr(e, t) {
2812
+ function fr(e, t) {
2819
2813
  return e ? xe[t] > xe[e] ? t : e : t;
2820
2814
  }
2821
- function hr(e, t) {
2815
+ function pr(e, t) {
2822
2816
  return e === void 0 ? !1 : t - e >= Pt;
2823
2817
  }
2824
- function Ua(e) {
2818
+ function qa(e) {
2825
2819
  const t = [...e].sort((s, a) => s - a), n = Math.floor(t.length / 2);
2826
2820
  return t.length % 2 === 0 ? (t[n - 1] + t[n]) / 2 : t[n];
2827
2821
  }
2828
- function mr(e) {
2822
+ function hr(e) {
2829
2823
  const t = e.filter((a) => a.taskKind === "phase" && a.outcome === "done").map(
2830
2824
  (a) => (a.endedAt ? Date.parse(a.endedAt) : Number.NaN) - Date.parse(a.startedAt)
2831
2825
  ).filter((a) => Number.isFinite(a) && a > 0);
2832
2826
  if (t.length === 0) return {};
2833
- const n = Ua(t), s = {};
2827
+ const n = qa(t), s = {};
2834
2828
  for (const a of ["implement", "verify"]) {
2835
2829
  const i = ne[a].to - ne[a].from;
2836
2830
  s[a] = n * i / te;
2837
2831
  }
2838
2832
  return s;
2839
2833
  }
2840
- function gr({
2834
+ function mr({
2841
2835
  anchor: e,
2842
2836
  anchorEnteredAt: t,
2843
2837
  lastStreamAt: n,
@@ -2852,152 +2846,151 @@ function gr({
2852
2846
  return Math.min(i.from + u * (i.to - i.from), te);
2853
2847
  }
2854
2848
  export {
2855
- Pi as $,
2856
- Ma as A,
2849
+ Ai as $,
2850
+ Da as A,
2857
2851
  Et as B,
2858
2852
  ve as C,
2859
2853
  Ts as D,
2860
- li as E,
2854
+ ui as E,
2861
2855
  $ as F,
2862
2856
  aa as G,
2863
2857
  Xs as H,
2864
2858
  Vs as I,
2865
- Ni as J,
2859
+ Ti as J,
2866
2860
  _n as K,
2867
2861
  xn as L,
2868
2862
  Pe as M,
2869
2863
  On as N,
2870
2864
  Cn as O,
2871
- or as P,
2865
+ rr as P,
2872
2866
  It as Q,
2873
- fi as R,
2874
- _a as S,
2875
- ir as T,
2876
- hi as U,
2867
+ li as R,
2868
+ Ca as S,
2869
+ ar as T,
2870
+ pi as U,
2877
2871
  Nn as V,
2878
2872
  nt as W,
2879
2873
  Qt as X,
2880
2874
  Fe as Y,
2881
- Bi as Z,
2882
- ci as _,
2875
+ Gi as Z,
2876
+ oi as _,
2883
2877
  en as a,
2884
- di as a$,
2878
+ Hi as a$,
2885
2879
  Jn as a0,
2886
2880
  pt as a1,
2887
2881
  B as a2,
2888
- wa as a3,
2889
- tr as a4,
2890
- ya as a5,
2891
- er as a6,
2892
- Qi as a7,
2893
- ur as a8,
2894
- mi as a9,
2895
- Di as aA,
2896
- An as aB,
2897
- Pn as aC,
2882
+ ya as a3,
2883
+ er as a4,
2884
+ Zi as a5,
2885
+ Qi as a6,
2886
+ dr as a7,
2887
+ hi as a8,
2888
+ Ea as a9,
2889
+ An as aA,
2890
+ Pn as aB,
2891
+ gi as aC,
2898
2892
  yi as aD,
2899
- wi as aE,
2900
- _ as aF,
2901
- Ri as aG,
2902
- Y as aH,
2903
- Ti as aI,
2904
- lr as aJ,
2905
- Vn as aK,
2906
- Ai as aL,
2907
- ji as aM,
2908
- nr as aN,
2909
- ha as aO,
2910
- na as aP,
2911
- ui as aQ,
2912
- Ci as aR,
2913
- qs as aS,
2914
- Mi as aT,
2915
- Q as aU,
2916
- Us as aV,
2917
- Yi as aW,
2918
- Qs as aX,
2919
- Je as aY,
2920
- dr as aZ,
2921
- Fs as a_,
2922
- ka as aa,
2923
- Tn as ab,
2924
- cr as ac,
2925
- da as ad,
2926
- hr as ae,
2927
- Hi as af,
2928
- mr as ag,
2929
- Na as ah,
2930
- jn as ai,
2931
- Mn as aj,
2932
- Dn as ak,
2933
- Ln as al,
2934
- Hn as am,
2935
- st as an,
2936
- ni as ao,
2937
- pe as ap,
2893
+ _ as aE,
2894
+ Ii as aF,
2895
+ Y as aG,
2896
+ Pi as aH,
2897
+ ur as aI,
2898
+ Vn as aJ,
2899
+ Ri as aK,
2900
+ Mi as aL,
2901
+ tr as aM,
2902
+ ha as aN,
2903
+ na as aO,
2904
+ di as aP,
2905
+ Ni as aQ,
2906
+ qs as aR,
2907
+ Di as aS,
2908
+ Q as aT,
2909
+ Us as aU,
2910
+ Bi as aV,
2911
+ Qs as aW,
2912
+ Je as aX,
2913
+ cr as aY,
2914
+ Fs as aZ,
2915
+ ci as a_,
2916
+ Tn as aa,
2917
+ or as ab,
2918
+ da as ac,
2919
+ pr as ad,
2920
+ Fi as ae,
2921
+ hr as af,
2922
+ Ta as ag,
2923
+ jn as ah,
2924
+ Mn as ai,
2925
+ Dn as aj,
2926
+ Ln as ak,
2927
+ Hn as al,
2928
+ st as am,
2929
+ ti as an,
2930
+ pe as ao,
2931
+ vi as ap,
2938
2932
  Ei as aq,
2939
2933
  ki as ar,
2940
- Si as as,
2941
- vi as at,
2942
- bi as au,
2943
- qn as av,
2944
- Js as aw,
2945
- $i as ax,
2946
- pi as ay,
2947
- gr as az,
2934
+ bi as as,
2935
+ wi as at,
2936
+ qn as au,
2937
+ Js as av,
2938
+ Si as aw,
2939
+ fi as ax,
2940
+ mr as ay,
2941
+ Oi as az,
2948
2942
  Ms as b,
2949
- Gi as b0,
2950
- Oi as b1,
2951
- Os as b2,
2952
- Ha as b3,
2953
- dn as b4,
2954
- Ee as b5,
2955
- rt as b6,
2956
- Wi as b7,
2957
- Gn as b8,
2958
- Vi as b9,
2943
+ xi as b0,
2944
+ Os as b1,
2945
+ Fa as b2,
2946
+ dn as b3,
2947
+ Ee as b4,
2948
+ rt as b5,
2949
+ Ki as b6,
2950
+ Gn as b7,
2951
+ Ji as b8,
2952
+ Yi as b9,
2959
2953
  qi as ba,
2960
- Ui as bb,
2961
- Ji as bc,
2962
- zi as bd,
2963
- St as be,
2964
- Ki as bf,
2965
- Fn as bg,
2966
- et as bh,
2967
- _i as bi,
2968
- Xn as bj,
2969
- Ii as bk,
2970
- ai as bl,
2971
- ri as bm,
2972
- Le as bn,
2973
- C as bo,
2974
- oi as bp,
2975
- ii as bq,
2976
- Jt as br,
2977
- xi as bs,
2954
+ Wi as bb,
2955
+ Ui as bc,
2956
+ St as bd,
2957
+ zi as be,
2958
+ Fn as bf,
2959
+ et as bg,
2960
+ Ci as bh,
2961
+ Xn as bi,
2962
+ $i as bj,
2963
+ si as bk,
2964
+ ii as bl,
2965
+ Le as bm,
2966
+ C as bn,
2967
+ ri as bo,
2968
+ ai as bp,
2969
+ Jt as bq,
2970
+ _i as br,
2978
2971
  es as c,
2979
2972
  ts as d,
2980
2973
  te as e,
2981
2974
  Pt as f,
2982
2975
  at as g,
2983
- Fi as h,
2984
- Li as i,
2985
- pr as j,
2976
+ Li as h,
2977
+ ji as i,
2978
+ fr as j,
2986
2979
  S as k,
2987
- Zi as l,
2988
- si as m,
2989
- rr as n,
2990
- sr as o,
2980
+ Xi as l,
2981
+ ni as m,
2982
+ ir as n,
2983
+ nr as o,
2991
2984
  $t as p,
2992
- ar as q,
2993
- Xi as r,
2994
- Ca as s,
2985
+ sr as q,
2986
+ Vi as r,
2987
+ Na as s,
2995
2988
  Rt as t,
2996
- Ta as u,
2997
- fr as v,
2998
- gi as w,
2989
+ Pa as u,
2990
+ lr as v,
2991
+ mi as w,
2999
2992
  xs as x,
3000
- qa as y,
2993
+ Ya as y,
3001
2994
  Zs as z
3002
2995
  };
3003
- //# sourceMappingURL=phase-progress.cMGsSLa8.js.map
2996
+ //# sourceMappingURL=phase-progress.6EDoT9B0.js.map