@nanonets/graft 0.22.0 → 0.22.1
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/README.md +7 -6
- package/dist/app/checkout.d.ts +0 -32
- package/dist/app/checkout.d.ts.map +1 -1
- package/dist/app/checkout.js +0 -45
- package/dist/app/checkout.js.map +1 -1
- package/dist/app/identity.d.ts +0 -56
- package/dist/app/identity.d.ts.map +1 -1
- package/dist/app/identity.js +0 -119
- package/dist/app/identity.js.map +1 -1
- package/dist/app/main.js +0 -8
- package/dist/app/main.js.map +1 -1
- package/dist/app/server.d.ts +0 -20
- package/dist/app/server.d.ts.map +1 -1
- package/dist/app/server.js +0 -121
- package/dist/app/server.js.map +1 -1
- package/dist/check/learning-edits.d.ts +9 -0
- package/dist/check/learning-edits.d.ts.map +1 -0
- package/dist/check/learning-edits.js +62 -0
- package/dist/check/learning-edits.js.map +1 -0
- package/dist/claude/format.d.ts.map +1 -1
- package/dist/claude/format.js +4 -4
- package/dist/claude/format.js.map +1 -1
- package/dist/claude/shim-template.d.ts.map +1 -1
- package/dist/claude/shim-template.js +39 -3
- package/dist/claude/shim-template.js.map +1 -1
- package/dist/claude/skill-template.d.ts.map +1 -1
- package/dist/claude/skill-template.js +18 -7
- package/dist/claude/skill-template.js.map +1 -1
- package/dist/cli-picker.d.ts +15 -0
- package/dist/cli-picker.d.ts.map +1 -1
- package/dist/cli-picker.js +33 -3
- package/dist/cli-picker.js.map +1 -1
- package/dist/cli.js +100 -27
- package/dist/cli.js.map +1 -1
- package/dist/cloud/diff.d.ts +2 -0
- package/dist/cloud/diff.d.ts.map +1 -1
- package/dist/cloud/diff.js +1 -0
- package/dist/cloud/diff.js.map +1 -1
- package/dist/notes/cold-start.d.ts +54 -4
- package/dist/notes/cold-start.d.ts.map +1 -1
- package/dist/notes/cold-start.js +97 -36
- package/dist/notes/cold-start.js.map +1 -1
- package/dist/notes/notes.d.ts +19 -4
- package/dist/notes/notes.d.ts.map +1 -1
- package/dist/notes/notes.js +53 -15
- package/dist/notes/notes.js.map +1 -1
- package/dist/notes/pr-reviews.d.ts +108 -0
- package/dist/notes/pr-reviews.d.ts.map +1 -0
- package/dist/notes/pr-reviews.js +325 -0
- package/dist/notes/pr-reviews.js.map +1 -0
- package/dist/telemetry/contract.d.ts.map +1 -1
- package/dist/telemetry/contract.js +6 -5
- package/dist/telemetry/contract.js.map +1 -1
- package/package.json +1 -1
- package/dist/app/brain-build-process.d.ts +0 -22
- package/dist/app/brain-build-process.d.ts.map +0 -1
- package/dist/app/brain-build-process.js +0 -129
- package/dist/app/brain-build-process.js.map +0 -1
- package/dist/app/brain-build-worker.d.ts +0 -35
- package/dist/app/brain-build-worker.d.ts.map +0 -1
- package/dist/app/brain-build-worker.js +0 -56
- package/dist/app/brain-build-worker.js.map +0 -1
- package/dist/app/brain-build.d.ts +0 -160
- package/dist/app/brain-build.d.ts.map +0 -1
- package/dist/app/brain-build.js +0 -278
- package/dist/app/brain-build.js.map +0 -1
- package/dist/app/history.d.ts +0 -163
- package/dist/app/history.d.ts.map +0 -1
- package/dist/app/history.js +0 -319
- package/dist/app/history.js.map +0 -1
- package/dist/app/sources.d.ts +0 -81
- package/dist/app/sources.d.ts.map +0 -1
- package/dist/app/sources.js +0 -470
- package/dist/app/sources.js.map +0 -1
package/dist/app/sources.js
DELETED
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything in a repository that is already a rule, or nearly one.
|
|
3
|
-
*
|
|
4
|
-
* Commit messages and pull-request discussion say what a team decided in
|
|
5
|
-
* passing. These are the places where they wrote it down on purpose: the
|
|
6
|
-
* instruction files they hand their own agents, the decision records, the linter
|
|
7
|
-
* config, the ownership rules. Higher precision per byte than any amount of
|
|
8
|
-
* history, and most of it is a file read.
|
|
9
|
-
*
|
|
10
|
-
* Every reader returns text, never source code, and every one is best-effort:
|
|
11
|
-
* a repo with none of these still builds a brain from its history.
|
|
12
|
-
*/
|
|
13
|
-
import { readFileSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
14
|
-
import { join, relative } from "node:path";
|
|
15
|
-
import { spawnSync } from "node:child_process";
|
|
16
|
-
import { ghHeaders } from "./identity.js";
|
|
17
|
-
/** Per-file and total caps, so one enormous doc cannot crowd out everything. */
|
|
18
|
-
const MAX_FILE_CHARS = 24_000;
|
|
19
|
-
const MAX_TOTAL_CHARS = 300_000;
|
|
20
|
-
const MAX_SOURCES = 120;
|
|
21
|
-
function readText(root, rel) {
|
|
22
|
-
try {
|
|
23
|
-
const p = join(root, rel);
|
|
24
|
-
if (!existsSync(p) || !statSync(p).isFile())
|
|
25
|
-
return null;
|
|
26
|
-
const raw = readFileSync(p, "utf8");
|
|
27
|
-
const trimmed = raw.trim();
|
|
28
|
-
if (!trimmed)
|
|
29
|
-
return null;
|
|
30
|
-
return trimmed.length > MAX_FILE_CHARS ? `${trimmed.slice(0, MAX_FILE_CHARS)}\n[…truncated]` : trimmed;
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/** Files directly under `rel`, one level deep, matching `test`. */
|
|
37
|
-
function filesIn(root, rel, test) {
|
|
38
|
-
try {
|
|
39
|
-
const dir = join(root, rel);
|
|
40
|
-
if (!existsSync(dir) || !statSync(dir).isDirectory())
|
|
41
|
-
return [];
|
|
42
|
-
return readdirSync(dir)
|
|
43
|
-
.filter(test)
|
|
44
|
-
.map((n) => join(rel, n))
|
|
45
|
-
.sort();
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Instruction files the team already wrote for coding agents.
|
|
53
|
-
*
|
|
54
|
-
* The single highest-precision source in a repository: someone sat down and
|
|
55
|
-
* wrote imperative rules for a machine to follow. Nothing has to be inferred.
|
|
56
|
-
*
|
|
57
|
-
* Graft's own managed blocks are stripped first. Without that the brain reads
|
|
58
|
-
* back graft's instructions about using graft, and then graft carries them into
|
|
59
|
-
* the same file — a loop that fills the rulebook with itself.
|
|
60
|
-
*/
|
|
61
|
-
export function readAgentInstructions(root) {
|
|
62
|
-
const candidates = [
|
|
63
|
-
"CLAUDE.md",
|
|
64
|
-
"AGENTS.md",
|
|
65
|
-
"GEMINI.md",
|
|
66
|
-
".github/copilot-instructions.md",
|
|
67
|
-
".windsurf/rules/graft.md",
|
|
68
|
-
...filesIn(root, ".cursor/rules", (n) => n.endsWith(".mdc") || n.endsWith(".md")),
|
|
69
|
-
// The same files one folder down: a monorepo keeps its frontend's rules in
|
|
70
|
-
// web/CLAUDE.md, and those are as deliberate as the root's.
|
|
71
|
-
...folderInstructionFiles(root),
|
|
72
|
-
// Skills a team wrote for its agents. Graft's own is left out for the same
|
|
73
|
-
// reason its managed blocks are: the brain must not learn graft from graft.
|
|
74
|
-
...skillFiles(root),
|
|
75
|
-
];
|
|
76
|
-
const out = [];
|
|
77
|
-
const seen = new Set();
|
|
78
|
-
for (const rel of candidates) {
|
|
79
|
-
const key = rel.replace(/\\/g, "/");
|
|
80
|
-
if (seen.has(key))
|
|
81
|
-
continue;
|
|
82
|
-
seen.add(key);
|
|
83
|
-
const text = stripManagedBlocks(readText(root, rel) ?? "");
|
|
84
|
-
if (text.trim())
|
|
85
|
-
out.push({ kind: "agent_instructions", path: key, text });
|
|
86
|
-
}
|
|
87
|
-
return out;
|
|
88
|
-
}
|
|
89
|
-
/** Instruction files below the root that are worth reading as instructions. */
|
|
90
|
-
const FOLDER_INSTRUCTION_NAMES = new Set(["CLAUDE.md", "AGENTS.md"]);
|
|
91
|
-
/** How deep below the root a folder instruction file may sit (a/b/c/d/CLAUDE.md). */
|
|
92
|
-
const MAX_FOLDER_DEPTH = 4;
|
|
93
|
-
/** Most folder instruction files, and most skills, carried per push. */
|
|
94
|
-
export const MAX_FOLDER_FILES = 30;
|
|
95
|
-
export const MAX_SKILL_FILES = 30;
|
|
96
|
-
/** Directories never searched for instruction files: dependencies, build
|
|
97
|
-
* output, graft's own cache. Dot-directories are skipped as a class. */
|
|
98
|
-
const SKIP_INSTRUCTION_DIRS = new Set([
|
|
99
|
-
"node_modules",
|
|
100
|
-
"dist",
|
|
101
|
-
"build",
|
|
102
|
-
"out",
|
|
103
|
-
"vendor",
|
|
104
|
-
"graft",
|
|
105
|
-
"target",
|
|
106
|
-
"coverage",
|
|
107
|
-
"__pycache__",
|
|
108
|
-
"venv",
|
|
109
|
-
"bower_components",
|
|
110
|
-
]);
|
|
111
|
-
function skippedSegment(seg) {
|
|
112
|
-
return seg.startsWith(".") || SKIP_INSTRUCTION_DIRS.has(seg);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* `**\/CLAUDE.md` and `**\/AGENTS.md` below the root, shallowest first.
|
|
116
|
-
*
|
|
117
|
-
* Asked of git first, because git already knows what the repository ignores:
|
|
118
|
-
* a CLAUDE.md inside an ignored folder is someone's scratch, not the team's.
|
|
119
|
-
* The walk is the fallback for a checkout git cannot answer for.
|
|
120
|
-
*/
|
|
121
|
-
export function folderInstructionFiles(root, max = MAX_FOLDER_FILES) {
|
|
122
|
-
const keep = (rel) => {
|
|
123
|
-
const parts = rel.split("/");
|
|
124
|
-
const name = parts[parts.length - 1] ?? "";
|
|
125
|
-
const dirs = parts.slice(0, -1);
|
|
126
|
-
if (!FOLDER_INSTRUCTION_NAMES.has(name))
|
|
127
|
-
return false;
|
|
128
|
-
if (dirs.length === 0 || dirs.length > MAX_FOLDER_DEPTH)
|
|
129
|
-
return false;
|
|
130
|
-
return !dirs.some(skippedSegment);
|
|
131
|
-
};
|
|
132
|
-
let found = null;
|
|
133
|
-
const listed = git(root, ["ls-files", "-z", "--cached", "--others", "--exclude-standard", "--", "*CLAUDE.md", "*AGENTS.md"]);
|
|
134
|
-
if (listed !== null)
|
|
135
|
-
found = [...new Set(listed.split("\0").filter(Boolean))].filter(keep);
|
|
136
|
-
if (found === null)
|
|
137
|
-
found = walkFor(root, keep);
|
|
138
|
-
const depth = (p) => p.split("/").length;
|
|
139
|
-
return found
|
|
140
|
-
.filter((rel) => existsSync(join(root, rel)))
|
|
141
|
-
.sort((a, b) => depth(a) - depth(b) || a.localeCompare(b))
|
|
142
|
-
.slice(0, max);
|
|
143
|
-
}
|
|
144
|
-
/** The filesystem walk behind folderInstructionFiles, for a tree git cannot list. */
|
|
145
|
-
function walkFor(root, keep) {
|
|
146
|
-
const out = [];
|
|
147
|
-
const visit = (rel, depth) => {
|
|
148
|
-
if (depth > MAX_FOLDER_DEPTH)
|
|
149
|
-
return;
|
|
150
|
-
let names;
|
|
151
|
-
try {
|
|
152
|
-
names = readdirSync(join(root, rel));
|
|
153
|
-
}
|
|
154
|
-
catch {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
for (const name of names) {
|
|
158
|
-
const child = rel ? `${rel}/${name}` : name;
|
|
159
|
-
let isDir = false;
|
|
160
|
-
try {
|
|
161
|
-
isDir = statSync(join(root, child)).isDirectory();
|
|
162
|
-
}
|
|
163
|
-
catch {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
if (isDir) {
|
|
167
|
-
if (!skippedSegment(name))
|
|
168
|
-
visit(child, depth + 1);
|
|
169
|
-
}
|
|
170
|
-
else if (depth > 0 && keep(child)) {
|
|
171
|
-
out.push(child);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
visit("", 0);
|
|
176
|
-
return out;
|
|
177
|
-
}
|
|
178
|
-
/** `.claude/skills/<name>/SKILL.md`, graft's own skill excluded. */
|
|
179
|
-
export function skillFiles(root, max = MAX_SKILL_FILES) {
|
|
180
|
-
const dir = join(root, ".claude", "skills");
|
|
181
|
-
let names;
|
|
182
|
-
try {
|
|
183
|
-
names = readdirSync(dir).sort();
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
return [];
|
|
187
|
-
}
|
|
188
|
-
const out = [];
|
|
189
|
-
for (const name of names) {
|
|
190
|
-
if (name === "graft" || name.startsWith("."))
|
|
191
|
-
continue;
|
|
192
|
-
const rel = `.claude/skills/${name}/SKILL.md`;
|
|
193
|
-
try {
|
|
194
|
-
if (!statSync(join(root, rel)).isFile())
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
catch {
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
out.push(rel);
|
|
201
|
-
if (out.length >= max)
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
return out;
|
|
205
|
-
}
|
|
206
|
-
/** Remove graft's own fenced regions (trail's too), so the brain never learns graft from graft. */
|
|
207
|
-
function stripManagedBlocks(text) {
|
|
208
|
-
return text
|
|
209
|
-
.replace(/<!--\s*(graft|trail):(brain:)?start\s*-->[\s\S]*?<!--\s*\1:(brain:)?end\s*-->/g, "")
|
|
210
|
-
.trim();
|
|
211
|
-
}
|
|
212
|
-
/** Architecture decision records and the docs that read like them. */
|
|
213
|
-
export function readDecisionDocs(root) {
|
|
214
|
-
const mdIn = (dir) => filesIn(root, dir, (n) => n.endsWith(".md"));
|
|
215
|
-
const candidates = [
|
|
216
|
-
"ARCHITECTURE.md",
|
|
217
|
-
"CONTRIBUTING.md",
|
|
218
|
-
"docs/ARCHITECTURE.md",
|
|
219
|
-
"docs/CONTRIBUTING.md",
|
|
220
|
-
...mdIn("docs/adr"),
|
|
221
|
-
...mdIn("docs/decisions"),
|
|
222
|
-
...mdIn("adr"),
|
|
223
|
-
];
|
|
224
|
-
const out = [];
|
|
225
|
-
for (const rel of candidates) {
|
|
226
|
-
const text = readText(root, rel);
|
|
227
|
-
if (text)
|
|
228
|
-
out.push({ kind: "decision_doc", path: rel, text });
|
|
229
|
-
}
|
|
230
|
-
return out;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Rules the team already encoded for a machine: linters, formatters, and the
|
|
234
|
-
* checks CI insists on. Nothing to infer — extraction only has to phrase them.
|
|
235
|
-
*/
|
|
236
|
-
export function readCodifiedRules(root) {
|
|
237
|
-
const lint = [
|
|
238
|
-
".golangci.yml",
|
|
239
|
-
".golangci.yaml",
|
|
240
|
-
".eslintrc.json",
|
|
241
|
-
".eslintrc.js",
|
|
242
|
-
"eslint.config.js",
|
|
243
|
-
"eslint.config.mjs",
|
|
244
|
-
"ruff.toml",
|
|
245
|
-
".ruff.toml",
|
|
246
|
-
".prettierrc",
|
|
247
|
-
".prettierrc.json",
|
|
248
|
-
"commitlint.config.cjs",
|
|
249
|
-
"commitlint.config.js",
|
|
250
|
-
".editorconfig",
|
|
251
|
-
];
|
|
252
|
-
const out = [];
|
|
253
|
-
for (const rel of lint) {
|
|
254
|
-
const text = readText(root, rel);
|
|
255
|
-
if (text)
|
|
256
|
-
out.push({ kind: "lint_config", path: rel, text });
|
|
257
|
-
}
|
|
258
|
-
for (const rel of filesIn(root, ".github/workflows", (n) => n.endsWith(".yml") || n.endsWith(".yaml"))) {
|
|
259
|
-
const text = readText(root, rel);
|
|
260
|
-
if (text)
|
|
261
|
-
out.push({ kind: "ci_config", path: rel, text });
|
|
262
|
-
}
|
|
263
|
-
return out;
|
|
264
|
-
}
|
|
265
|
-
/** Who must approve what. A hard constraint, stated as a file. */
|
|
266
|
-
export function readCodeowners(root) {
|
|
267
|
-
for (const rel of [".github/CODEOWNERS", "CODEOWNERS", "docs/CODEOWNERS"]) {
|
|
268
|
-
const text = readText(root, rel);
|
|
269
|
-
if (text)
|
|
270
|
-
return [{ kind: "codeowners", path: rel, text }];
|
|
271
|
-
}
|
|
272
|
-
return [];
|
|
273
|
-
}
|
|
274
|
-
/** Run git in `root`, or null when it fails. */
|
|
275
|
-
function git(root, args) {
|
|
276
|
-
const res = spawnSync("git", ["-c", "core.quotePath=false", ...args], {
|
|
277
|
-
cwd: root,
|
|
278
|
-
encoding: "utf8",
|
|
279
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
280
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
281
|
-
});
|
|
282
|
-
if (res.error || res.status !== 0 || typeof res.stdout !== "string")
|
|
283
|
-
return null;
|
|
284
|
-
return res.stdout;
|
|
285
|
-
}
|
|
286
|
-
/** How many reverts to carry. */
|
|
287
|
-
const MAX_REVERTS = 40;
|
|
288
|
-
/**
|
|
289
|
-
* Commits that undid another commit.
|
|
290
|
-
*
|
|
291
|
-
* "We tried this and took it back" is a rule available from nowhere else, and
|
|
292
|
-
* it is the one kind of history that says what NOT to do. The body of a revert
|
|
293
|
-
* usually names the commit it undoes and, when the author bothered, why.
|
|
294
|
-
*/
|
|
295
|
-
export function readReverts(root, max = MAX_REVERTS) {
|
|
296
|
-
const out = git(root, ["log", "--grep=^Revert", "-n", String(max), "--format=%H%x02%s%x02%b%x01"]);
|
|
297
|
-
if (!out)
|
|
298
|
-
return [];
|
|
299
|
-
const sources = [];
|
|
300
|
-
for (const record of out.split("\x01")) {
|
|
301
|
-
if (!record.trim())
|
|
302
|
-
continue;
|
|
303
|
-
const [sha = "", subject = "", body = ""] = record.split("\x02");
|
|
304
|
-
if (!sha.trim() || !subject.trim())
|
|
305
|
-
continue;
|
|
306
|
-
sources.push({
|
|
307
|
-
kind: "revert",
|
|
308
|
-
path: `revert ${sha.trim().slice(0, 12)}`,
|
|
309
|
-
text: [subject.trim(), body.trim()].filter(Boolean).join("\n"),
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
return sources;
|
|
313
|
-
}
|
|
314
|
-
/** How many test names to carry. */
|
|
315
|
-
const MAX_TEST_NAMES = 300;
|
|
316
|
-
/**
|
|
317
|
-
* Test names, which are invariants someone wrote deliberately.
|
|
318
|
-
*
|
|
319
|
-
* `never retries on a card decline` is a rule stated as an assertion. Read from
|
|
320
|
-
* the graph's own symbols rather than by re-parsing, so this costs nothing:
|
|
321
|
-
* a test function is already a node.
|
|
322
|
-
*
|
|
323
|
-
* Only names that read like a sentence are kept. `TestFoo` is a label;
|
|
324
|
-
* `rejects an expired token` is a claim about how the system must behave.
|
|
325
|
-
*/
|
|
326
|
-
export function readTestNames(symbolNames, max = MAX_TEST_NAMES) {
|
|
327
|
-
const out = [];
|
|
328
|
-
for (const s of symbolNames) {
|
|
329
|
-
if (!/(^|[/.])(test|spec)[s]?[/.]|_test\.|\.test\.|\.spec\./i.test(s.path))
|
|
330
|
-
continue;
|
|
331
|
-
const sentence = humanizeTestName(s.name);
|
|
332
|
-
if (!sentence)
|
|
333
|
-
continue;
|
|
334
|
-
out.push({ kind: "test_name", path: s.path, text: sentence });
|
|
335
|
-
if (out.length === max)
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
return out;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* A test's name as a claim, or null when it is only a label.
|
|
342
|
-
*
|
|
343
|
-
* Requires three words after the prefix is stripped: fewer than that
|
|
344
|
-
* ("TestParse", "handles errors") states no invariant worth a rule, and letting
|
|
345
|
-
* those through fills the brain with noise that reads like content.
|
|
346
|
-
*/
|
|
347
|
-
function humanizeTestName(name) {
|
|
348
|
-
let s = name.replace(/^(Test|it|test|should|describe)[_\s]*/i, "");
|
|
349
|
-
// TestRetriesThreeTimes → Retries Three Times
|
|
350
|
-
if (/^[A-Za-z]+$/.test(s) && /[a-z][A-Z]/.test(s))
|
|
351
|
-
s = s.replace(/([a-z0-9])([A-Z])/g, "$1 $2");
|
|
352
|
-
s = s.replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim();
|
|
353
|
-
if (s.split(" ").length < 3)
|
|
354
|
-
return null;
|
|
355
|
-
return s.toLowerCase();
|
|
356
|
-
}
|
|
357
|
-
/** How many declined issues to carry. */
|
|
358
|
-
const MAX_DECLINED = 40;
|
|
359
|
-
/**
|
|
360
|
-
* Issues closed as not planned.
|
|
361
|
-
*
|
|
362
|
-
* A decision NOT to build something, which is half of what a codebase's rules
|
|
363
|
-
* are and is invisible everywhere else — nothing was committed, so no commit
|
|
364
|
-
* message records it.
|
|
365
|
-
*/
|
|
366
|
-
export async function readDeclinedIssues(owner, repo, token, fetchImpl, api = "https://api.github.com", max = MAX_DECLINED) {
|
|
367
|
-
try {
|
|
368
|
-
const res = await fetchImpl(`${api}/repos/${owner}/${repo}/issues?state=closed&per_page=100&sort=updated`, {
|
|
369
|
-
headers: ghHeaders(token),
|
|
370
|
-
});
|
|
371
|
-
if (!res.ok)
|
|
372
|
-
return [];
|
|
373
|
-
const items = JSON.parse(await res.text());
|
|
374
|
-
if (!Array.isArray(items))
|
|
375
|
-
return [];
|
|
376
|
-
const out = [];
|
|
377
|
-
for (const i of items) {
|
|
378
|
-
// The issues endpoint returns pull requests too; they are already mined as
|
|
379
|
-
// threads and would be counted twice.
|
|
380
|
-
if (i.pull_request)
|
|
381
|
-
continue;
|
|
382
|
-
if (i.state_reason !== "not_planned")
|
|
383
|
-
continue;
|
|
384
|
-
if (!i.title?.trim())
|
|
385
|
-
continue;
|
|
386
|
-
out.push({
|
|
387
|
-
kind: "declined_issue",
|
|
388
|
-
path: `issue #${i.number}`,
|
|
389
|
-
text: [i.title.trim(), (i.body ?? "").trim()].filter(Boolean).join("\n").slice(0, MAX_FILE_CHARS),
|
|
390
|
-
url: i.html_url,
|
|
391
|
-
});
|
|
392
|
-
if (out.length === max)
|
|
393
|
-
break;
|
|
394
|
-
}
|
|
395
|
-
return out;
|
|
396
|
-
}
|
|
397
|
-
catch {
|
|
398
|
-
return [];
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
/** Required checks and reviewers on the default branch. */
|
|
402
|
-
export async function readBranchProtection(owner, repo, branch, token, fetchImpl, api = "https://api.github.com") {
|
|
403
|
-
if (!branch)
|
|
404
|
-
return [];
|
|
405
|
-
try {
|
|
406
|
-
const res = await fetchImpl(`${api}/repos/${owner}/${repo}/branches/${encodeURIComponent(branch)}/protection`, {
|
|
407
|
-
headers: ghHeaders(token),
|
|
408
|
-
});
|
|
409
|
-
// 404 simply means the branch is not protected, which is not a failure.
|
|
410
|
-
if (!res.ok)
|
|
411
|
-
return [];
|
|
412
|
-
const p = JSON.parse(await res.text());
|
|
413
|
-
const lines = [];
|
|
414
|
-
const checks = p.required_status_checks?.contexts ?? [];
|
|
415
|
-
if (checks.length)
|
|
416
|
-
lines.push(`Checks that must pass before merging to ${branch}: ${checks.join(", ")}.`);
|
|
417
|
-
const reviews = p.required_pull_request_reviews;
|
|
418
|
-
if (reviews?.required_approving_review_count) {
|
|
419
|
-
lines.push(`${reviews.required_approving_review_count} approving review(s) required to merge to ${branch}.`);
|
|
420
|
-
}
|
|
421
|
-
if (reviews?.require_code_owner_reviews)
|
|
422
|
-
lines.push(`A code owner must approve changes to ${branch}.`);
|
|
423
|
-
if (p.allow_force_pushes?.enabled === false)
|
|
424
|
-
lines.push(`Force pushes to ${branch} are not allowed.`);
|
|
425
|
-
if (!lines.length)
|
|
426
|
-
return [];
|
|
427
|
-
return [{ kind: "branch_protection", path: `branch protection: ${branch}`, text: lines.join("\n") }];
|
|
428
|
-
}
|
|
429
|
-
catch {
|
|
430
|
-
return [];
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Trim the collected sources to a budget, best kinds first.
|
|
435
|
-
*
|
|
436
|
-
* The order is the argument of this whole module: a file the team wrote to
|
|
437
|
-
* instruct an agent outranks a decision doc, which outranks a config, which
|
|
438
|
-
* outranks anything inferred. When the budget runs out it should run out on the
|
|
439
|
-
* weakest evidence.
|
|
440
|
-
*/
|
|
441
|
-
const KIND_RANK = [
|
|
442
|
-
"agent_instructions",
|
|
443
|
-
"decision_doc",
|
|
444
|
-
"codeowners",
|
|
445
|
-
"branch_protection",
|
|
446
|
-
"lint_config",
|
|
447
|
-
"ci_config",
|
|
448
|
-
"revert",
|
|
449
|
-
"declined_issue",
|
|
450
|
-
"test_name",
|
|
451
|
-
];
|
|
452
|
-
export function budgetSources(sources, maxChars = MAX_TOTAL_CHARS, maxCount = MAX_SOURCES) {
|
|
453
|
-
const ranked = [...sources].sort((a, b) => KIND_RANK.indexOf(a.kind) - KIND_RANK.indexOf(b.kind));
|
|
454
|
-
const out = [];
|
|
455
|
-
let spent = 0;
|
|
456
|
-
for (const s of ranked) {
|
|
457
|
-
if (out.length >= maxCount)
|
|
458
|
-
break;
|
|
459
|
-
if (spent + s.text.length > maxChars)
|
|
460
|
-
continue;
|
|
461
|
-
out.push(s);
|
|
462
|
-
spent += s.text.length;
|
|
463
|
-
}
|
|
464
|
-
return out;
|
|
465
|
-
}
|
|
466
|
-
/** Repo-relative path, for readers handed an absolute one. */
|
|
467
|
-
export function relPath(root, abs) {
|
|
468
|
-
return relative(root, abs) || abs;
|
|
469
|
-
}
|
|
470
|
-
//# sourceMappingURL=sources.js.map
|
package/dist/app/sources.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/app/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AAwBtD,gFAAgF;AAChF,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW;IACzC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE;YAAE,OAAO,IAAI,CAAC;QACzD,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,GA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