@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/brain-build.js
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Building one repository into a brain, on demand.
|
|
3
|
-
*
|
|
4
|
-
* The whole point of the onboarding flow this serves: someone pastes a
|
|
5
|
-
* repository URL, and a minute later they are looking at rules mined from their
|
|
6
|
-
* own history. Nothing is installed and nobody has signed up yet, so this has to
|
|
7
|
-
* work from the repository name alone.
|
|
8
|
-
*
|
|
9
|
-
* Runs in the app rather than in the platform because only the app has the
|
|
10
|
-
* GitHub App credentials, only it can clone, and only graft can build a symbol
|
|
11
|
-
* graph. What crosses back to the platform is a digest of messages and symbol
|
|
12
|
-
* ids — never source.
|
|
13
|
-
*/
|
|
14
|
-
import { buildGraph } from "../graph/build.js";
|
|
15
|
-
import { contextDirFor } from "../context/node-file.js";
|
|
16
|
-
import { loadGraphCached } from "../graph/load.js";
|
|
17
|
-
import { checkoutRepository } from "./checkout.js";
|
|
18
|
-
import { appJwt, ghHeaders, installationFor, publicReadInstallation, repoAccessGap, } from "./identity.js";
|
|
19
|
-
import { buildDigest, postDigest, readCommits, readSymbols, readThreads } from "./history.js";
|
|
20
|
-
import { budgetSources, readAgentInstructions, readBranchProtection, readCodeowners, readCodifiedRules, readDecisionDocs, readDeclinedIssues, readReverts, readTestNames, } from "./sources.js";
|
|
21
|
-
/** Raised when the App cannot see the repository. Distinct because the caller
|
|
22
|
-
* turns it into a specific answer — "install the app, or run it locally" — and
|
|
23
|
-
* not into a 500. */
|
|
24
|
-
export class RepoNotAccessibleError extends Error {
|
|
25
|
-
gap;
|
|
26
|
-
constructor(message,
|
|
27
|
-
/** Which gap it is, so the caller can send the user to the right place. */
|
|
28
|
-
gap = { reason: "not_installed", ownerId: null, installationId: null }) {
|
|
29
|
-
super(message);
|
|
30
|
-
this.gap = gap;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Can we read this repository at all?
|
|
35
|
-
*
|
|
36
|
-
* The cheap half of a build, on its own: an installation lookup and at most
|
|
37
|
-
* one repository lookup, about a second in total, with no clone and no graph.
|
|
38
|
-
*
|
|
39
|
-
* It exists as its own call because the answer decides which screen the user
|
|
40
|
-
* sees next, and the rest of the read takes minutes. Waiting for the whole
|
|
41
|
-
* build to find out means either holding the person there or guessing from a
|
|
42
|
-
* timer, and a guess is wrong exactly when the box is busy — which is when
|
|
43
|
-
* two people are onboarding at once.
|
|
44
|
-
*/
|
|
45
|
-
export async function checkRepoAccess(job, deps) {
|
|
46
|
-
const api = deps.api ?? "https://api.github.com";
|
|
47
|
-
const installationId = await installationFor(deps.creds, job.owner, job.repo, deps.fetch, (deps.now ?? Date.now)(), api);
|
|
48
|
-
if (installationId !== null) {
|
|
49
|
-
const token = await installationToken(deps, installationId, `${job.owner}/${job.repo}`, api);
|
|
50
|
-
const meta = await repoMeta(job.owner, job.repo, token, deps.fetch, api);
|
|
51
|
-
return { accessible: true, isPrivate: meta?.isPrivate ?? true, via: "installation" };
|
|
52
|
-
}
|
|
53
|
-
const meta = await repoMeta(job.owner, job.repo, await publicReadToken(deps, api), deps.fetch, api);
|
|
54
|
-
if (meta && !meta.isPrivate)
|
|
55
|
-
return { accessible: true, isPrivate: false, via: "public" };
|
|
56
|
-
const gap = await repoAccessGap(deps.creds, job.owner, deps.fetch, (deps.now ?? Date.now)(), api);
|
|
57
|
-
return {
|
|
58
|
-
accessible: false,
|
|
59
|
-
isPrivate: true,
|
|
60
|
-
via: "none",
|
|
61
|
-
reason: gap.reason === "repo_not_selected"
|
|
62
|
-
? `graft is installed on ${job.owner} but ${job.owner}/${job.repo} is not in the list of repositories it can see`
|
|
63
|
-
: `graft is not installed on ${job.owner}`,
|
|
64
|
-
gap,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Decide how this repository gets read, and mint the credential for it.
|
|
69
|
-
*
|
|
70
|
-
* The network half of a build, kept separate from the work: an installation
|
|
71
|
-
* lookup, a token, a repository lookup. About a second, none of it blocking.
|
|
72
|
-
*
|
|
73
|
-
* Throws RepoNotAccessibleError when there is no way in. That is the answer the
|
|
74
|
-
* onboarding UI turns into a choice, which is why it is raised here — before a
|
|
75
|
-
* single byte is cloned — rather than discovered somewhere inside the read.
|
|
76
|
-
*/
|
|
77
|
-
export async function resolveRepoRead(job, deps) {
|
|
78
|
-
const api = deps.api ?? "https://api.github.com";
|
|
79
|
-
const tag = `${job.owner}/${job.repo}`;
|
|
80
|
-
const installationId = await installationFor(deps.creds, job.owner, job.repo, deps.fetch, (deps.now ?? Date.now)(), api);
|
|
81
|
-
if (installationId !== null) {
|
|
82
|
-
const token = await installationToken(deps, installationId, tag, api);
|
|
83
|
-
const meta = await repoMeta(job.owner, job.repo, token, deps.fetch, api);
|
|
84
|
-
return { token, cloneToken: token, meta: meta ?? { isPrivate: true, defaultBranch: "" } };
|
|
85
|
-
}
|
|
86
|
-
// No installation on this repository. That rules out nothing yet: a public
|
|
87
|
-
// repo clones with no credential at all, and its API answers to any token we
|
|
88
|
-
// hold. So find a credential for the reading, then ask whether it is public.
|
|
89
|
-
const token = await publicReadToken(deps, api);
|
|
90
|
-
const meta = await repoMeta(job.owner, job.repo, token, deps.fetch, api);
|
|
91
|
-
if (!meta || meta.isPrivate) {
|
|
92
|
-
// Which of the two gaps it is decides what the UI can offer, so it is
|
|
93
|
-
// resolved here rather than guessed there.
|
|
94
|
-
const gap = await repoAccessGap(deps.creds, job.owner, deps.fetch, (deps.now ?? Date.now)(), api);
|
|
95
|
-
throw new RepoNotAccessibleError(gap.reason === "repo_not_selected"
|
|
96
|
-
? `graft is installed on ${job.owner} but ${tag} is not in the list of repositories it can see`
|
|
97
|
-
: `graft is not installed on ${job.owner}`, gap);
|
|
98
|
-
}
|
|
99
|
-
return { token, cloneToken: "", meta };
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Read the repository and hand its history to the brain.
|
|
103
|
-
*
|
|
104
|
-
* An installation is the preferred way in: it is the only way into a private
|
|
105
|
-
* repository, and it carries a rate limit worth having. It is not required for
|
|
106
|
-
* a public one, though — those clone anonymously and answer the API
|
|
107
|
-
* anonymously — so a failed installation lookup is a reason to try the open
|
|
108
|
-
* door, not a reason to stop. Only a repository that is private or unreadable
|
|
109
|
-
* both ways is one we genuinely cannot see, and that is the case the UI turns
|
|
110
|
-
* into "read it on your machine".
|
|
111
|
-
*/
|
|
112
|
-
export async function buildRepoIntoBrain(job, deps) {
|
|
113
|
-
return readRepository(job, deps, await resolveRepoRead(job, deps));
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* The heavy half: clone, graph, history, digest.
|
|
117
|
-
*
|
|
118
|
-
* Takes its credential rather than minting one, because this is the half that
|
|
119
|
-
* runs somewhere else. Every expensive thing in it is synchronous — the git
|
|
120
|
-
* calls are spawnSync, the parse is a loop of native tree-sitter calls, the
|
|
121
|
-
* graph is written with a blocking stringify — so in the server process it
|
|
122
|
-
* holds the event loop for the whole read, and a second person pasting a URL
|
|
123
|
-
* waits behind the first. See brain-build-process.ts.
|
|
124
|
-
*/
|
|
125
|
-
export async function readRepository(job, deps, auth) {
|
|
126
|
-
const rawLog = deps.log ?? (() => { });
|
|
127
|
-
const api = deps.api ?? "https://api.github.com";
|
|
128
|
-
const tag = `${job.owner}/${job.repo}`;
|
|
129
|
-
const { token, cloneToken, meta } = auth;
|
|
130
|
-
// Every line carries how long we have been at it. A read that feels slow is
|
|
131
|
-
// four things in a trench coat — the clone, the graph build, the
|
|
132
|
-
// pull-request walk, the digest — and without the elapsed time on each, the
|
|
133
|
-
// only observation anyone can make is "it took two minutes".
|
|
134
|
-
const startedAt = (deps.now ?? Date.now)();
|
|
135
|
-
const log = (msg) => rawLog(`[+${(((deps.now ?? Date.now)() - startedAt) / 1000).toFixed(1)}s] ${msg}`);
|
|
136
|
-
const phase = (name) => {
|
|
137
|
-
const at = (deps.now ?? Date.now)();
|
|
138
|
-
return () => log(`${tag}: ${name} took ${(((deps.now ?? Date.now)() - at) / 1000).toFixed(1)}s`);
|
|
139
|
-
};
|
|
140
|
-
const doneClone = phase("clone");
|
|
141
|
-
const checkout = checkoutRepository({
|
|
142
|
-
owner: job.owner,
|
|
143
|
-
repo: job.repo,
|
|
144
|
-
ref: job.ref || meta.defaultBranch,
|
|
145
|
-
token: cloneToken,
|
|
146
|
-
api: deps.githubHost,
|
|
147
|
-
log,
|
|
148
|
-
});
|
|
149
|
-
doneClone();
|
|
150
|
-
try {
|
|
151
|
-
// `graphOnly`: the symbol ids and their hashes are all the digest needs, and
|
|
152
|
-
// the markdown projections cost real time on a large repo.
|
|
153
|
-
const doneGraph = phase("symbol graph");
|
|
154
|
-
await buildGraph(checkout.dir, { graphOnly: true });
|
|
155
|
-
const graph = loadGraphCached(contextDirFor(checkout.dir));
|
|
156
|
-
doneGraph();
|
|
157
|
-
const commits = readCommits(checkout.dir);
|
|
158
|
-
const symbols = readSymbols(graph);
|
|
159
|
-
// The threads are the slow part (two API calls per pull request), and the
|
|
160
|
-
// one most likely to fail on a rate limit. A failure here degrades to a
|
|
161
|
-
// commits-only ingest rather than losing the whole build.
|
|
162
|
-
let threads = [];
|
|
163
|
-
const doneThreads = phase("pull-request discussion");
|
|
164
|
-
try {
|
|
165
|
-
threads = await readThreads(job.owner, job.repo, token, deps.fetch, api);
|
|
166
|
-
}
|
|
167
|
-
catch (e) {
|
|
168
|
-
log(`${tag}: pull-request discussion unavailable (${e instanceof Error ? e.message : e}); mining commits only`);
|
|
169
|
-
}
|
|
170
|
-
doneThreads();
|
|
171
|
-
// Everything the repo already states as a rule. All best-effort: the file
|
|
172
|
-
// readers cannot fail the build, and the two API readers swallow their own
|
|
173
|
-
// errors, so a repo with none of this still gets a brain from its history.
|
|
174
|
-
const doneSources = phase("stated sources");
|
|
175
|
-
const sources = budgetSources([
|
|
176
|
-
...readAgentInstructions(checkout.dir),
|
|
177
|
-
...readDecisionDocs(checkout.dir),
|
|
178
|
-
...readCodeowners(checkout.dir),
|
|
179
|
-
...readCodifiedRules(checkout.dir),
|
|
180
|
-
...readReverts(checkout.dir),
|
|
181
|
-
...readTestNames(symbols.map((s) => ({ name: s.name, path: s.path }))),
|
|
182
|
-
...(await readBranchProtection(job.owner, job.repo, meta.defaultBranch, token, deps.fetch, api)),
|
|
183
|
-
...(await readDeclinedIssues(job.owner, job.repo, token, deps.fetch, api)),
|
|
184
|
-
]);
|
|
185
|
-
doneSources();
|
|
186
|
-
log(`${tag}: read ${commits.length} commits, ${threads.length} threads, ${symbols.length} symbols, ${sources.length} stated sources`);
|
|
187
|
-
const digest = buildDigest({
|
|
188
|
-
owner: job.owner,
|
|
189
|
-
name: job.repo,
|
|
190
|
-
headSha: checkout.headSha,
|
|
191
|
-
defaultBranch: job.ref || meta.defaultBranch,
|
|
192
|
-
isPrivate: meta.isPrivate,
|
|
193
|
-
commits,
|
|
194
|
-
threads,
|
|
195
|
-
symbols,
|
|
196
|
-
sources,
|
|
197
|
-
autoApprove: job.autoApprove ?? false,
|
|
198
|
-
});
|
|
199
|
-
const counts = {
|
|
200
|
-
headSha: checkout.headSha,
|
|
201
|
-
commits: commits.length,
|
|
202
|
-
threads: threads.length,
|
|
203
|
-
symbols: symbols.length,
|
|
204
|
-
sources: sources.length,
|
|
205
|
-
};
|
|
206
|
-
if (!job.brainId || !job.brainToken) {
|
|
207
|
-
return { jobId: "", ...counts, digest };
|
|
208
|
-
}
|
|
209
|
-
const { jobId } = await postDigest(job.brainBaseUrl ?? "https://agents.nanonets.com", job.brainId, job.brainToken, digest, deps.fetch);
|
|
210
|
-
return { jobId, ...counts };
|
|
211
|
-
}
|
|
212
|
-
finally {
|
|
213
|
-
// Always: the clone was made with an installation token and is not something
|
|
214
|
-
// to leave in /tmp.
|
|
215
|
-
checkout.cleanup();
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* The repository's visibility and default branch, in one call.
|
|
220
|
-
*
|
|
221
|
-
* Null when the call did not answer, which is not the same as private and is
|
|
222
|
-
* why this does not fold the two together: with an installation, an unanswered
|
|
223
|
-
* call is a hiccup the read can carry on past; without one, it is the whole
|
|
224
|
-
* decision about whether we can see this repository at all. Callers that only
|
|
225
|
-
* need the fields treat null as private, because saying a repo is public when
|
|
226
|
-
* it is not would leak its name onto a pre-signup screen.
|
|
227
|
-
*/
|
|
228
|
-
async function repoMeta(owner, repo, token, fetchImpl, api) {
|
|
229
|
-
try {
|
|
230
|
-
const res = await fetchImpl(`${api}/repos/${owner}/${repo}`, { headers: ghHeaders(token) });
|
|
231
|
-
if (!res.ok)
|
|
232
|
-
return null;
|
|
233
|
-
const parsed = JSON.parse(await res.text());
|
|
234
|
-
return {
|
|
235
|
-
isPrivate: parsed.private !== false,
|
|
236
|
-
defaultBranch: (parsed.default_branch ?? "").trim(),
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
catch {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* A credential for reading a public repository we are not installed on.
|
|
245
|
-
*
|
|
246
|
-
* Order: a token configured for exactly this, then one of our own
|
|
247
|
-
* installation's, then nothing. Every step of that ladder works — the
|
|
248
|
-
* difference is only the rate limit, and the drop to anonymous is a factor of
|
|
249
|
-
* eighty, so it is worth two extra calls to avoid.
|
|
250
|
-
*/
|
|
251
|
-
async function publicReadToken(deps, api) {
|
|
252
|
-
if (deps.publicToken)
|
|
253
|
-
return deps.publicToken;
|
|
254
|
-
try {
|
|
255
|
-
const id = await publicReadInstallation(deps.creds, deps.publicOwner ?? "trailhq", deps.fetch, (deps.now ?? Date.now)(), api);
|
|
256
|
-
if (id === null)
|
|
257
|
-
return "";
|
|
258
|
-
return await installationToken(deps, id, "public read", api);
|
|
259
|
-
}
|
|
260
|
-
catch {
|
|
261
|
-
return "";
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/** Mint an installation token, the credential every authenticated read uses. */
|
|
265
|
-
async function installationToken(deps, installationId, tag, api) {
|
|
266
|
-
const res = await deps.fetch(`${api}/app/installations/${installationId}/access_tokens`, {
|
|
267
|
-
method: "POST",
|
|
268
|
-
headers: {
|
|
269
|
-
authorization: `Bearer ${appJwt(deps.creds, (deps.now ?? Date.now)())}`,
|
|
270
|
-
accept: "application/vnd.github+json",
|
|
271
|
-
"user-agent": "graft-app",
|
|
272
|
-
},
|
|
273
|
-
});
|
|
274
|
-
if (!res.ok)
|
|
275
|
-
throw new Error(`installation token for ${tag} failed: ${res.status}`);
|
|
276
|
-
return JSON.parse(await res.text()).token;
|
|
277
|
-
}
|
|
278
|
-
//# sourceMappingURL=brain-build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brain-build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163 +0,0 @@
|
|
|
1
|
-
import type { GraphV1 } from "../graph/types.js";
|
|
2
|
-
import { type Fetch } from "./identity.js";
|
|
3
|
-
import type { HistorySource } from "./sources.js";
|
|
4
|
-
/** One commit's rule-bearing content. */
|
|
5
|
-
export interface HistoryCommit {
|
|
6
|
-
sha: string;
|
|
7
|
-
subject: string;
|
|
8
|
-
body: string;
|
|
9
|
-
files: string[];
|
|
10
|
-
}
|
|
11
|
-
/** One pull request's discussion. */
|
|
12
|
-
export interface HistoryThread {
|
|
13
|
-
number: number;
|
|
14
|
-
title: string;
|
|
15
|
-
body: string;
|
|
16
|
-
mergeSha: string;
|
|
17
|
-
comments: Array<{
|
|
18
|
-
body: string;
|
|
19
|
-
path?: string;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
22
|
-
/** One symbol, as the brain needs it to anchor a rule. */
|
|
23
|
-
export interface HistorySymbol {
|
|
24
|
-
id: string;
|
|
25
|
-
path: string;
|
|
26
|
-
name: string;
|
|
27
|
-
kind: string;
|
|
28
|
-
signature: string;
|
|
29
|
-
fingerprint: string;
|
|
30
|
-
}
|
|
31
|
-
/** The whole payload posted to the brain. */
|
|
32
|
-
export interface RepoDigest {
|
|
33
|
-
provider: "github";
|
|
34
|
-
owner: string;
|
|
35
|
-
name: string;
|
|
36
|
-
head_sha: string;
|
|
37
|
-
default_branch: string;
|
|
38
|
-
is_private: boolean;
|
|
39
|
-
commits: Array<{
|
|
40
|
-
sha: string;
|
|
41
|
-
subject: string;
|
|
42
|
-
body: string;
|
|
43
|
-
files: string[];
|
|
44
|
-
symbols: string[];
|
|
45
|
-
}>;
|
|
46
|
-
threads: Array<{
|
|
47
|
-
number: number;
|
|
48
|
-
title: string;
|
|
49
|
-
body: string;
|
|
50
|
-
merge_sha: string;
|
|
51
|
-
comments: Array<{
|
|
52
|
-
body: string;
|
|
53
|
-
path?: string;
|
|
54
|
-
}>;
|
|
55
|
-
}>;
|
|
56
|
-
symbols: HistorySymbol[];
|
|
57
|
-
/** Everything in the repo that is already a rule, or nearly one: instruction
|
|
58
|
-
* files, decision records, config, ownership, reverts, test names. One array
|
|
59
|
-
* rather than a field per kind, so adding a source is adding an entry. */
|
|
60
|
-
sources: HistorySource[];
|
|
61
|
-
auto_approve: boolean;
|
|
62
|
-
/** The agents `graft init` wired this repo for (claude, cursor, agents, …).
|
|
63
|
-
* Trail shows only the context files those agents read. Absent or empty
|
|
64
|
-
* means "not known", and Trail then shows every kind. */
|
|
65
|
-
agents?: string[];
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Commit subjects, bodies and touched files, oldest first.
|
|
69
|
-
*
|
|
70
|
-
* `--no-merges`: a merge commit's message is "Merge pull request #N from …",
|
|
71
|
-
* which establishes nothing — the decision is in the commits it brings in, and
|
|
72
|
-
* in the thread. `--reverse` so a later reversal reads as a reversal downstream;
|
|
73
|
-
* the extraction prompt relies on that ordering.
|
|
74
|
-
*/
|
|
75
|
-
export declare function readCommits(root: string, max?: number): HistoryCommit[];
|
|
76
|
-
/** How many threads' comments are fetched at once. Two requests per pull
|
|
77
|
-
* request, so this is the real cost of a repository read. A pool of 24 (so at
|
|
78
|
-
* most 48 requests in flight) stays well under GitHub's secondary limit on
|
|
79
|
-
* concurrent requests, and a slow thread no longer holds up the seven that
|
|
80
|
-
* happened to share its batch. */
|
|
81
|
-
export declare const THREAD_FETCH_CONCURRENCY = 24;
|
|
82
|
-
/**
|
|
83
|
-
* What one push has already asked GitHub, shared between its reads.
|
|
84
|
-
*
|
|
85
|
-
* The early upload reads the newest pull requests and the full read reads them
|
|
86
|
-
* again as part of the 200. Promises rather than results, so a full read that
|
|
87
|
-
* starts while the early one is still in flight waits on the same request
|
|
88
|
-
* instead of sending a second — and threads with no discussion are remembered
|
|
89
|
-
* too, which a map of finished threads could not say.
|
|
90
|
-
*/
|
|
91
|
-
export interface ThreadReadCache {
|
|
92
|
-
/** Pages of the closed-pull-request list, by page number. */
|
|
93
|
-
pages: Map<number, Promise<PullListItem[] | null>>;
|
|
94
|
-
/** One pull request's discussion, by number; null when it had none. */
|
|
95
|
-
threads: Map<number, Promise<HistoryThread | null>>;
|
|
96
|
-
}
|
|
97
|
-
export declare function newThreadReadCache(): ThreadReadCache;
|
|
98
|
-
/** Run `fn` over `items` with at most `limit` in flight, results in input order. */
|
|
99
|
-
export declare function mapPool<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
100
|
-
export interface PullListItem {
|
|
101
|
-
number?: number;
|
|
102
|
-
title?: string;
|
|
103
|
-
body?: string | null;
|
|
104
|
-
merge_commit_sha?: string | null;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Closed pull requests and their discussion, most-discussed first.
|
|
108
|
-
*
|
|
109
|
-
* Closed only: an open PR's discussion has not concluded, so mining a rule out
|
|
110
|
-
* of it would record a proposal as a decision.
|
|
111
|
-
*
|
|
112
|
-
* Comment counts have to be discovered by fetching, not by reading the list.
|
|
113
|
-
* GitHub's `GET /pulls` list response carries NO `comments` or
|
|
114
|
-
* `review_comments` field — those exist only on the single-PR GET — so an
|
|
115
|
-
* earlier version that pre-filtered on them read `undefined` for every pull
|
|
116
|
-
* request, scored them all zero and skipped the lot. The failure was silent and
|
|
117
|
-
* total: every repository came back with no discussion at all. So the comments
|
|
118
|
-
* are fetched for the most recently updated closed pull requests, and the
|
|
119
|
-
* ranking happens afterwards, on counts that are real.
|
|
120
|
-
*
|
|
121
|
-
* Bot comments are dropped. A CI bot posting a coverage table is the single
|
|
122
|
-
* largest source of text in a busy repo's threads and it establishes nothing.
|
|
123
|
-
*/
|
|
124
|
-
export declare function readThreads(owner: string, repo: string, token: string, fetchImpl: Fetch, api?: string, max?: number, known?: ReadonlyMap<number, HistoryThread>, cache?: ThreadReadCache): Promise<HistoryThread[]>;
|
|
125
|
-
/**
|
|
126
|
-
* Exported symbols from the graph, with the body hash that makes an anchored
|
|
127
|
-
* rule self-invalidating.
|
|
128
|
-
*
|
|
129
|
-
* Exported only, and biggest first: an internal helper is not what a team's
|
|
130
|
-
* rules are about, and the budget is better spent on the surface a rule is
|
|
131
|
-
* likely to govern.
|
|
132
|
-
*/
|
|
133
|
-
export declare function readSymbols(graph: GraphV1 | null, max?: number): HistorySymbol[];
|
|
134
|
-
/**
|
|
135
|
-
* Assemble the digest.
|
|
136
|
-
*
|
|
137
|
-
* Each commit carries the symbol ids its files touched, so a rule mined from a
|
|
138
|
-
* commit message can be anchored even when the message names no symbol — which
|
|
139
|
-
* is most of the time.
|
|
140
|
-
*/
|
|
141
|
-
export declare function buildDigest(input: {
|
|
142
|
-
owner: string;
|
|
143
|
-
name: string;
|
|
144
|
-
headSha: string;
|
|
145
|
-
defaultBranch: string;
|
|
146
|
-
isPrivate: boolean;
|
|
147
|
-
commits: HistoryCommit[];
|
|
148
|
-
threads: HistoryThread[];
|
|
149
|
-
symbols: HistorySymbol[];
|
|
150
|
-
sources: HistorySource[];
|
|
151
|
-
autoApprove: boolean;
|
|
152
|
-
agents?: string[];
|
|
153
|
-
}): RepoDigest;
|
|
154
|
-
/**
|
|
155
|
-
* Post the digest to a brain.
|
|
156
|
-
*
|
|
157
|
-
* Returns the job id so the caller can hand it back to whoever asked for the
|
|
158
|
-
* build, which is what the onboarding screen polls.
|
|
159
|
-
*/
|
|
160
|
-
export declare function postDigest(baseUrl: string, brainId: string, brainToken: string, digest: RepoDigest, fetchImpl: Fetch): Promise<{
|
|
161
|
-
jobId: string;
|
|
162
|
-
}>;
|
|
163
|
-
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/app/history.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,yCAAyC;AAC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