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