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