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