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