@nanonets/graft 0.16.0 → 0.19.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/README.md +10 -3
- package/dist/app/brain-build-process.d.ts +22 -0
- package/dist/app/brain-build-process.d.ts.map +1 -0
- package/dist/app/brain-build-process.js +129 -0
- package/dist/app/brain-build-process.js.map +1 -0
- package/dist/app/brain-build-worker.d.ts +35 -0
- package/dist/app/brain-build-worker.d.ts.map +1 -0
- package/dist/app/brain-build-worker.js +56 -0
- package/dist/app/brain-build-worker.js.map +1 -0
- package/dist/app/brain-build.d.ts +160 -0
- package/dist/app/brain-build.d.ts.map +1 -0
- package/dist/app/brain-build.js +278 -0
- package/dist/app/brain-build.js.map +1 -0
- package/dist/app/checkout.d.ts +53 -3
- package/dist/app/checkout.d.ts.map +1 -1
- package/dist/app/checkout.js +195 -27
- package/dist/app/checkout.js.map +1 -1
- package/dist/app/events.d.ts +7 -0
- package/dist/app/events.d.ts.map +1 -1
- package/dist/app/events.js +7 -2
- package/dist/app/events.js.map +1 -1
- package/dist/app/history.d.ts +128 -0
- package/dist/app/history.d.ts.map +1 -0
- package/dist/app/history.js +266 -0
- package/dist/app/history.js.map +1 -0
- package/dist/app/identity.d.ts +56 -0
- package/dist/app/identity.d.ts.map +1 -1
- package/dist/app/identity.js +119 -0
- package/dist/app/identity.js.map +1 -1
- package/dist/app/main.js +14 -0
- package/dist/app/main.js.map +1 -1
- package/dist/app/pages.d.ts +17 -0
- package/dist/app/pages.d.ts.map +1 -1
- package/dist/app/pages.js +112 -5
- package/dist/app/pages.js.map +1 -1
- package/dist/app/review-process.d.ts +66 -0
- package/dist/app/review-process.d.ts.map +1 -0
- package/dist/app/review-process.js +199 -0
- package/dist/app/review-process.js.map +1 -0
- package/dist/app/review-worker.d.ts +2 -0
- package/dist/app/review-worker.d.ts.map +1 -0
- package/dist/app/review-worker.js +108 -0
- package/dist/app/review-worker.js.map +1 -0
- package/dist/app/review.d.ts.map +1 -1
- package/dist/app/review.js +4 -1
- package/dist/app/review.js.map +1 -1
- package/dist/app/server.d.ts +31 -2
- package/dist/app/server.d.ts.map +1 -1
- package/dist/app/server.js +130 -3
- package/dist/app/server.js.map +1 -1
- package/dist/app/sources.d.ts +68 -0
- package/dist/app/sources.d.ts.map +1 -0
- package/dist/app/sources.js +342 -0
- package/dist/app/sources.js.map +1 -0
- package/dist/ask/ask.d.ts +6 -0
- package/dist/ask/ask.d.ts.map +1 -1
- package/dist/ask/ask.js +30 -2
- package/dist/ask/ask.js.map +1 -1
- package/dist/brain/attach.d.ts +44 -0
- package/dist/brain/attach.d.ts.map +1 -0
- package/dist/brain/attach.js +63 -0
- package/dist/brain/attach.js.map +1 -0
- package/dist/brain/connect.d.ts +59 -0
- package/dist/brain/connect.d.ts.map +1 -0
- package/dist/brain/connect.js +80 -0
- package/dist/brain/connect.js.map +1 -0
- package/dist/brain/link.d.ts +89 -0
- package/dist/brain/link.d.ts.map +1 -0
- package/dist/brain/link.js +146 -0
- package/dist/brain/link.js.map +1 -0
- package/dist/brain/push.d.ts +72 -0
- package/dist/brain/push.d.ts.map +1 -0
- package/dist/brain/push.js +191 -0
- package/dist/brain/push.js.map +1 -0
- package/dist/brain/signup.d.ts +73 -0
- package/dist/brain/signup.d.ts.map +1 -0
- package/dist/brain/signup.js +186 -0
- package/dist/brain/signup.js.map +1 -0
- package/dist/brain/watch.d.ts +136 -0
- package/dist/brain/watch.d.ts.map +1 -0
- package/dist/brain/watch.js +172 -0
- package/dist/brain/watch.js.map +1 -0
- package/dist/brain/wire.d.ts +38 -0
- package/dist/brain/wire.d.ts.map +1 -0
- package/dist/brain/wire.js +133 -0
- package/dist/brain/wire.js.map +1 -0
- package/dist/claude/format.d.ts.map +1 -1
- package/dist/claude/format.js +10 -3
- package/dist/claude/format.js.map +1 -1
- package/dist/claude/hooks.d.ts.map +1 -1
- package/dist/claude/hooks.js +32 -1
- package/dist/claude/hooks.js.map +1 -1
- package/dist/claude/init.d.ts +5 -0
- package/dist/claude/init.d.ts.map +1 -1
- package/dist/claude/init.js +9 -1
- package/dist/claude/init.js.map +1 -1
- package/dist/claude/session-metrics.d.ts +10 -0
- package/dist/claude/session-metrics.d.ts.map +1 -1
- package/dist/claude/session-metrics.js +25 -0
- package/dist/claude/session-metrics.js.map +1 -1
- package/dist/claude/settings-merge.d.ts +18 -0
- package/dist/claude/settings-merge.d.ts.map +1 -1
- package/dist/claude/settings-merge.js +42 -8
- package/dist/claude/settings-merge.js.map +1 -1
- package/dist/claude/skill-template.d.ts.map +1 -1
- package/dist/claude/skill-template.js +6 -0
- package/dist/claude/skill-template.js.map +1 -1
- package/dist/claude/state.d.ts +14 -0
- package/dist/claude/state.d.ts.map +1 -1
- package/dist/claude/state.js.map +1 -1
- package/dist/claude/tally.d.ts +27 -0
- package/dist/claude/tally.d.ts.map +1 -1
- package/dist/claude/tally.js +74 -1
- package/dist/claude/tally.js.map +1 -1
- package/dist/cli.js +310 -3
- package/dist/cli.js.map +1 -1
- package/dist/context/node-file.d.ts +4 -10
- package/dist/context/node-file.d.ts.map +1 -1
- package/dist/context/node-file.js +6 -2
- package/dist/context/node-file.js.map +1 -1
- package/dist/context/price.d.ts +49 -0
- package/dist/context/price.d.ts.map +1 -0
- package/dist/context/price.js +83 -0
- package/dist/context/price.js.map +1 -0
- package/dist/context/savings.d.ts +13 -3
- package/dist/context/savings.d.ts.map +1 -1
- package/dist/context/savings.js +44 -5
- package/dist/context/savings.js.map +1 -1
- package/dist/hosts/claude-global.d.ts +33 -0
- package/dist/hosts/claude-global.d.ts.map +1 -0
- package/dist/hosts/claude-global.js +118 -0
- package/dist/hosts/claude-global.js.map +1 -0
- package/dist/hosts/plan.d.ts.map +1 -1
- package/dist/hosts/plan.js +5 -1
- package/dist/hosts/plan.js.map +1 -1
- package/dist/hosts/retract.d.ts.map +1 -1
- package/dist/hosts/retract.js +33 -13
- package/dist/hosts/retract.js.map +1 -1
- package/dist/hosts/sections.d.ts +23 -2
- package/dist/hosts/sections.d.ts.map +1 -1
- package/dist/hosts/sections.js +25 -9
- package/dist/hosts/sections.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +33 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +5 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/telemetry/contract.d.ts +12 -0
- package/dist/telemetry/contract.d.ts.map +1 -1
- package/dist/telemetry/contract.js +19 -0
- package/dist/telemetry/contract.js.map +1 -1
- package/dist/telemetry/gate.d.ts +14 -0
- package/dist/telemetry/gate.d.ts.map +1 -1
- package/dist/telemetry/gate.js +18 -2
- package/dist/telemetry/gate.js.map +1 -1
- package/dist/upkeep-run.d.ts.map +1 -1
- package/dist/upkeep-run.js +12 -2
- package/dist/upkeep-run.js.map +1 -1
- package/dist/upkeep.d.ts +18 -0
- package/dist/upkeep.d.ts.map +1 -1
- package/dist/upkeep.js +38 -0
- package/dist/upkeep.js.map +1 -1
- package/dist/util/state.d.ts +9 -0
- package/dist/util/state.d.ts.map +1 -1
- package/dist/util/state.js.map +1 -1
- package/package.json +1 -1
package/dist/app/checkout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/app/checkout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,8EAA8E;AAC9E,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,cAAc,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src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AC5E,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,KAAa;IAChD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/app/events.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ export interface ReviewJob {
|
|
|
26
26
|
* a bot commenting on every push to one is the fastest way to be uninstalled.
|
|
27
27
|
* `ready_for_review` is in the accepted set so the comment appears the moment the
|
|
28
28
|
* author asks for eyes.
|
|
29
|
+
*
|
|
30
|
+
* A CLOSED pull request is not skipped. The graph is most useful to whoever reads
|
|
31
|
+
* the PR later, and a merged PR is exactly what gets read — so the comment has to
|
|
32
|
+
* keep working after the merge. This costs nothing on live traffic: none of the
|
|
33
|
+
* four accepted actions fire on an already-merged PR, so in practice this only
|
|
34
|
+
* admits a `synchronize` that raced a merge, and a deliberate re-delivery. The
|
|
35
|
+
* accepted-action set, not the PR state, is what bounds the work.
|
|
29
36
|
*/
|
|
30
37
|
export declare function reviewJobFor(event: string, payload: unknown): {
|
|
31
38
|
job: ReviewJob;
|
package/dist/app/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/app/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb;;6BAEyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,QAAQ,EAAE,OAAO,CAAC;CACnB;AAmBD
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/app/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb;;6BAEyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,QAAQ,EAAE,OAAO,CAAC;CACnB;AAmBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAoCnG;AAED,sFAAsF;AACtF,eAAO,MAAM,MAAM,GAAI,GAAG,SAAS,KAAG,MAA4C,CAAC"}
|
package/dist/app/events.js
CHANGED
|
@@ -14,6 +14,13 @@ const ACTIONS = new Set(["opened", "synchronize", "reopened", "ready_for_review"
|
|
|
14
14
|
* a bot commenting on every push to one is the fastest way to be uninstalled.
|
|
15
15
|
* `ready_for_review` is in the accepted set so the comment appears the moment the
|
|
16
16
|
* author asks for eyes.
|
|
17
|
+
*
|
|
18
|
+
* A CLOSED pull request is not skipped. The graph is most useful to whoever reads
|
|
19
|
+
* the PR later, and a merged PR is exactly what gets read — so the comment has to
|
|
20
|
+
* keep working after the merge. This costs nothing on live traffic: none of the
|
|
21
|
+
* four accepted actions fire on an already-merged PR, so in practice this only
|
|
22
|
+
* admits a `synchronize` that raced a merge, and a deliberate re-delivery. The
|
|
23
|
+
* accepted-action set, not the PR state, is what bounds the work.
|
|
17
24
|
*/
|
|
18
25
|
export function reviewJobFor(event, payload) {
|
|
19
26
|
if (event === "ping")
|
|
@@ -36,8 +43,6 @@ export function reviewJobFor(event, payload) {
|
|
|
36
43
|
}
|
|
37
44
|
if (pr?.draft === true && action !== "ready_for_review")
|
|
38
45
|
return { skip: "draft" };
|
|
39
|
-
if (pr?.state === "closed")
|
|
40
|
-
return { skip: "closed" };
|
|
41
46
|
const base = pr?.base?.repo?.full_name;
|
|
42
47
|
const head = pr?.head?.repo?.full_name;
|
|
43
48
|
return {
|
package/dist/app/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/app/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH,mFAAmF;AACnF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEnF
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/app/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH,mFAAmF;AACnF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEnF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAgB;IAC1D,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC9C,IAAI,KAAK,KAAK,cAAc;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,EAAE,EAAE,CAAC;IAEhE,MAAM,CAAC,GAAG,OAAyB,CAAC;IACpC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CA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C,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Commit subjects, bodies and touched files, oldest first.
|
|
65
|
+
*
|
|
66
|
+
* `--no-merges`: a merge commit's message is "Merge pull request #N from …",
|
|
67
|
+
* which establishes nothing — the decision is in the commits it brings in, and
|
|
68
|
+
* in the thread. `--reverse` so a later reversal reads as a reversal downstream;
|
|
69
|
+
* the extraction prompt relies on that ordering.
|
|
70
|
+
*/
|
|
71
|
+
export declare function readCommits(root: string, max?: number): HistoryCommit[];
|
|
72
|
+
/**
|
|
73
|
+
* Closed pull requests and their discussion, most-discussed first.
|
|
74
|
+
*
|
|
75
|
+
* Closed only: an open PR's discussion has not concluded, so mining a rule out
|
|
76
|
+
* of it would record a proposal as a decision.
|
|
77
|
+
*
|
|
78
|
+
* Comment counts have to be discovered by fetching, not by reading the list.
|
|
79
|
+
* GitHub's `GET /pulls` list response carries NO `comments` or
|
|
80
|
+
* `review_comments` field — those exist only on the single-PR GET — so an
|
|
81
|
+
* earlier version that pre-filtered on them read `undefined` for every pull
|
|
82
|
+
* request, scored them all zero and skipped the lot. The failure was silent and
|
|
83
|
+
* total: every repository came back with no discussion at all. So the comments
|
|
84
|
+
* are fetched for the most recently updated closed pull requests, and the
|
|
85
|
+
* ranking happens afterwards, on counts that are real.
|
|
86
|
+
*
|
|
87
|
+
* Bot comments are dropped. A CI bot posting a coverage table is the single
|
|
88
|
+
* largest source of text in a busy repo's threads and it establishes nothing.
|
|
89
|
+
*/
|
|
90
|
+
export declare function readThreads(owner: string, repo: string, token: string, fetchImpl: Fetch, api?: string, max?: number): Promise<HistoryThread[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Exported symbols from the graph, with the body hash that makes an anchored
|
|
93
|
+
* rule self-invalidating.
|
|
94
|
+
*
|
|
95
|
+
* Exported only, and biggest first: an internal helper is not what a team's
|
|
96
|
+
* rules are about, and the budget is better spent on the surface a rule is
|
|
97
|
+
* likely to govern.
|
|
98
|
+
*/
|
|
99
|
+
export declare function readSymbols(graph: GraphV1 | null, max?: number): HistorySymbol[];
|
|
100
|
+
/**
|
|
101
|
+
* Assemble the digest.
|
|
102
|
+
*
|
|
103
|
+
* Each commit carries the symbol ids its files touched, so a rule mined from a
|
|
104
|
+
* commit message can be anchored even when the message names no symbol — which
|
|
105
|
+
* is most of the time.
|
|
106
|
+
*/
|
|
107
|
+
export declare function buildDigest(input: {
|
|
108
|
+
owner: string;
|
|
109
|
+
name: string;
|
|
110
|
+
headSha: string;
|
|
111
|
+
defaultBranch: string;
|
|
112
|
+
isPrivate: boolean;
|
|
113
|
+
commits: HistoryCommit[];
|
|
114
|
+
threads: HistoryThread[];
|
|
115
|
+
symbols: HistorySymbol[];
|
|
116
|
+
sources: HistorySource[];
|
|
117
|
+
autoApprove: boolean;
|
|
118
|
+
}): RepoDigest;
|
|
119
|
+
/**
|
|
120
|
+
* Post the digest to a brain.
|
|
121
|
+
*
|
|
122
|
+
* Returns the job id so the caller can hand it back to whoever asked for the
|
|
123
|
+
* build, which is what the onboarding screen polls.
|
|
124
|
+
*/
|
|
125
|
+
export declare function postDigest(baseUrl: string, brainId: string, brainToken: string, digest: RepoDigest, fetchImpl: Fetch): Promise<{
|
|
126
|
+
jobId: string;
|
|
127
|
+
}>;
|
|
128
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,K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AKG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,KAAK,GACf,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB5B"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a repository's history into a rule-bearing digest.
|
|
3
|
+
*
|
|
4
|
+
* What a code graph cannot tell you is why the code is the way it is. That
|
|
5
|
+
* lives in two places: commit messages, and the discussion under pull requests.
|
|
6
|
+
* This module reads both, plus the symbol ids from the graph so a rule mined
|
|
7
|
+
* out of them can be anchored to the code it governs.
|
|
8
|
+
*
|
|
9
|
+
* It deliberately sends NO source code onward. The digest is messages, titles,
|
|
10
|
+
* comments, symbol ids and hashes — nothing a reader could reconstruct a private
|
|
11
|
+
* codebase from.
|
|
12
|
+
*/
|
|
13
|
+
import { spawnSync } from "node:child_process";
|
|
14
|
+
import { ghHeaders } from "./identity.js";
|
|
15
|
+
/** Field separators inside one `git log` record. Chosen for being bytes no
|
|
16
|
+
* commit message contains, the same trick blast/owners.ts uses. */
|
|
17
|
+
const REC = "\x01";
|
|
18
|
+
const FIELD = "\x02";
|
|
19
|
+
/** Most commits read out of one repository. Above the brain's own per-ingest
|
|
20
|
+
* cap, so the trim happens here where the ordering is known. */
|
|
21
|
+
const MAX_COMMITS = 1_000;
|
|
22
|
+
/** Run git in `root`, or null when git fails. */
|
|
23
|
+
function git(root, args) {
|
|
24
|
+
const res = spawnSync("git", ["-c", "core.quotePath=false", ...args], {
|
|
25
|
+
cwd: root,
|
|
26
|
+
encoding: "utf8",
|
|
27
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
28
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
29
|
+
});
|
|
30
|
+
if (res.error || res.status !== 0 || typeof res.stdout !== "string")
|
|
31
|
+
return null;
|
|
32
|
+
return res.stdout;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Commit subjects, bodies and touched files, oldest first.
|
|
36
|
+
*
|
|
37
|
+
* `--no-merges`: a merge commit's message is "Merge pull request #N from …",
|
|
38
|
+
* which establishes nothing — the decision is in the commits it brings in, and
|
|
39
|
+
* in the thread. `--reverse` so a later reversal reads as a reversal downstream;
|
|
40
|
+
* the extraction prompt relies on that ordering.
|
|
41
|
+
*/
|
|
42
|
+
export function readCommits(root, max = MAX_COMMITS) {
|
|
43
|
+
const fmt = `${REC}%H${FIELD}%s${FIELD}%b${FIELD}`;
|
|
44
|
+
const out = git(root, [
|
|
45
|
+
"log",
|
|
46
|
+
"--no-merges",
|
|
47
|
+
"--reverse",
|
|
48
|
+
`-n`,
|
|
49
|
+
String(max),
|
|
50
|
+
`--format=${fmt}`,
|
|
51
|
+
"--name-only",
|
|
52
|
+
]);
|
|
53
|
+
if (!out)
|
|
54
|
+
return [];
|
|
55
|
+
const commits = [];
|
|
56
|
+
for (const record of out.split(REC)) {
|
|
57
|
+
if (!record.trim())
|
|
58
|
+
continue;
|
|
59
|
+
const [sha = "", subject = "", body = "", rest = ""] = record.split(FIELD);
|
|
60
|
+
const files = rest
|
|
61
|
+
.split("\n")
|
|
62
|
+
.map((l) => l.trim())
|
|
63
|
+
.filter((l) => l !== "");
|
|
64
|
+
// A commit with no subject is a broken record, not a commit worth mining.
|
|
65
|
+
if (!sha.trim() || !subject.trim())
|
|
66
|
+
continue;
|
|
67
|
+
commits.push({ sha: sha.trim(), subject: subject.trim(), body: body.trim(), files });
|
|
68
|
+
}
|
|
69
|
+
return commits;
|
|
70
|
+
}
|
|
71
|
+
/** How many pull requests to read, and how many comment pages per thread. */
|
|
72
|
+
const MAX_THREADS = 200;
|
|
73
|
+
const MAX_COMMENT_PAGES = 3;
|
|
74
|
+
/** How many threads' comments are fetched at once. Two requests per pull
|
|
75
|
+
* request, so this is the real cost of a repository read; 8 keeps it quick
|
|
76
|
+
* without crowding an installation's rate limit. */
|
|
77
|
+
const THREAD_FETCH_CONCURRENCY = 8;
|
|
78
|
+
/**
|
|
79
|
+
* Closed pull requests and their discussion, most-discussed first.
|
|
80
|
+
*
|
|
81
|
+
* Closed only: an open PR's discussion has not concluded, so mining a rule out
|
|
82
|
+
* of it would record a proposal as a decision.
|
|
83
|
+
*
|
|
84
|
+
* Comment counts have to be discovered by fetching, not by reading the list.
|
|
85
|
+
* GitHub's `GET /pulls` list response carries NO `comments` or
|
|
86
|
+
* `review_comments` field — those exist only on the single-PR GET — so an
|
|
87
|
+
* earlier version that pre-filtered on them read `undefined` for every pull
|
|
88
|
+
* request, scored them all zero and skipped the lot. The failure was silent and
|
|
89
|
+
* total: every repository came back with no discussion at all. So the comments
|
|
90
|
+
* are fetched for the most recently updated closed pull requests, and the
|
|
91
|
+
* ranking happens afterwards, on counts that are real.
|
|
92
|
+
*
|
|
93
|
+
* Bot comments are dropped. A CI bot posting a coverage table is the single
|
|
94
|
+
* largest source of text in a busy repo's threads and it establishes nothing.
|
|
95
|
+
*/
|
|
96
|
+
export async function readThreads(owner, repo, token, fetchImpl, api = "https://api.github.com", max = MAX_THREADS) {
|
|
97
|
+
const headers = ghHeaders(token);
|
|
98
|
+
const pulls = [];
|
|
99
|
+
// 100 per page, up to the cap. Sorted by GitHub as most-recently-updated,
|
|
100
|
+
// which is the right window: rules decided two years ago that still hold get
|
|
101
|
+
// restated in newer threads, and ones that do not are usually superseded.
|
|
102
|
+
for (let page = 1; pulls.length < max && page <= Math.ceil(max / 100); page++) {
|
|
103
|
+
const res = await fetchImpl(`${api}/repos/${owner}/${repo}/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=${page}`, { headers });
|
|
104
|
+
if (!res.ok)
|
|
105
|
+
break;
|
|
106
|
+
const batch = JSON.parse(await res.text());
|
|
107
|
+
if (!Array.isArray(batch) || batch.length === 0)
|
|
108
|
+
break;
|
|
109
|
+
pulls.push(...batch);
|
|
110
|
+
}
|
|
111
|
+
const candidates = pulls.filter((p) => typeof p.number === "number").slice(0, max);
|
|
112
|
+
// Bounded concurrency rather than one at a time: two requests per pull
|
|
113
|
+
// request over 200 of them is 400 sequential round trips, which is minutes of
|
|
114
|
+
// a person waiting on a progress screen.
|
|
115
|
+
const threads = [];
|
|
116
|
+
for (let i = 0; i < candidates.length; i += THREAD_FETCH_CONCURRENCY) {
|
|
117
|
+
const slice = candidates.slice(i, i + THREAD_FETCH_CONCURRENCY);
|
|
118
|
+
const fetched = await Promise.all(slice.map(async (p) => {
|
|
119
|
+
const [issueComments, reviewComments] = await Promise.all([
|
|
120
|
+
readComments(`${api}/repos/${owner}/${repo}/issues/${p.number}/comments`, headers, fetchImpl),
|
|
121
|
+
readComments(`${api}/repos/${owner}/${repo}/pulls/${p.number}/comments`, headers, fetchImpl),
|
|
122
|
+
]);
|
|
123
|
+
const comments = [...issueComments, ...reviewComments];
|
|
124
|
+
if (comments.length === 0)
|
|
125
|
+
return null;
|
|
126
|
+
return {
|
|
127
|
+
number: p.number,
|
|
128
|
+
title: (p.title ?? "").trim(),
|
|
129
|
+
body: (p.body ?? "").trim(),
|
|
130
|
+
mergeSha: (p.merge_commit_sha ?? "").trim(),
|
|
131
|
+
comments,
|
|
132
|
+
};
|
|
133
|
+
}));
|
|
134
|
+
for (const t of fetched)
|
|
135
|
+
if (t)
|
|
136
|
+
threads.push(t);
|
|
137
|
+
}
|
|
138
|
+
// Most-discussed first, because the digest renderer spends its budget in this
|
|
139
|
+
// order and a twenty-comment thread contains an argument while a one-comment
|
|
140
|
+
// thread contains a rubber stamp.
|
|
141
|
+
threads.sort((a, b) => b.comments.length - a.comments.length);
|
|
142
|
+
return threads;
|
|
143
|
+
}
|
|
144
|
+
/** One comment endpoint, paginated, bots removed. */
|
|
145
|
+
async function readComments(url, headers, fetchImpl) {
|
|
146
|
+
const out = [];
|
|
147
|
+
for (let page = 1; page <= MAX_COMMENT_PAGES; page++) {
|
|
148
|
+
const res = await fetchImpl(`${url}?per_page=100&page=${page}`, { headers });
|
|
149
|
+
if (!res.ok)
|
|
150
|
+
break;
|
|
151
|
+
let batch;
|
|
152
|
+
try {
|
|
153
|
+
batch = JSON.parse(await res.text());
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
if (!Array.isArray(batch) || batch.length === 0)
|
|
159
|
+
break;
|
|
160
|
+
for (const c of batch) {
|
|
161
|
+
const body = (c.body ?? "").trim();
|
|
162
|
+
if (!body)
|
|
163
|
+
continue;
|
|
164
|
+
if (c.user?.type === "Bot")
|
|
165
|
+
continue;
|
|
166
|
+
out.push(c.path ? { body, path: c.path } : { body });
|
|
167
|
+
}
|
|
168
|
+
if (batch.length < 100)
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
/** Most symbols to send. The brain only needs enough to anchor rules against. */
|
|
174
|
+
const MAX_SYMBOLS = 4_000;
|
|
175
|
+
/**
|
|
176
|
+
* Exported symbols from the graph, with the body hash that makes an anchored
|
|
177
|
+
* rule self-invalidating.
|
|
178
|
+
*
|
|
179
|
+
* Exported only, and biggest first: an internal helper is not what a team's
|
|
180
|
+
* rules are about, and the budget is better spent on the surface a rule is
|
|
181
|
+
* likely to govern.
|
|
182
|
+
*/
|
|
183
|
+
export function readSymbols(graph, max = MAX_SYMBOLS) {
|
|
184
|
+
if (!graph)
|
|
185
|
+
return [];
|
|
186
|
+
return graph.nodes
|
|
187
|
+
.filter((n) => n.exported && n.kind !== "file")
|
|
188
|
+
.sort((a, b) => (b.chars ?? 0) - (a.chars ?? 0))
|
|
189
|
+
.slice(0, max)
|
|
190
|
+
.map((n) => ({
|
|
191
|
+
id: n.id,
|
|
192
|
+
path: n.path,
|
|
193
|
+
name: n.name,
|
|
194
|
+
kind: n.kind,
|
|
195
|
+
signature: n.signature ?? "",
|
|
196
|
+
fingerprint: n.body_hash,
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Assemble the digest.
|
|
201
|
+
*
|
|
202
|
+
* Each commit carries the symbol ids its files touched, so a rule mined from a
|
|
203
|
+
* commit message can be anchored even when the message names no symbol — which
|
|
204
|
+
* is most of the time.
|
|
205
|
+
*/
|
|
206
|
+
export function buildDigest(input) {
|
|
207
|
+
const byPath = new Map();
|
|
208
|
+
for (const s of input.symbols) {
|
|
209
|
+
const bucket = byPath.get(s.path);
|
|
210
|
+
if (bucket)
|
|
211
|
+
bucket.push(s.id);
|
|
212
|
+
else
|
|
213
|
+
byPath.set(s.path, [s.id]);
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
provider: "github",
|
|
217
|
+
owner: input.owner,
|
|
218
|
+
name: input.name,
|
|
219
|
+
head_sha: input.headSha,
|
|
220
|
+
default_branch: input.defaultBranch,
|
|
221
|
+
is_private: input.isPrivate,
|
|
222
|
+
commits: input.commits.map((c) => ({
|
|
223
|
+
sha: c.sha,
|
|
224
|
+
subject: c.subject,
|
|
225
|
+
body: c.body,
|
|
226
|
+
files: c.files,
|
|
227
|
+
// Capped per commit: a sweeping refactor touches hundreds of files, and
|
|
228
|
+
// listing every symbol in all of them would drown the message it belongs to.
|
|
229
|
+
symbols: c.files.flatMap((f) => byPath.get(f) ?? []).slice(0, 20),
|
|
230
|
+
})),
|
|
231
|
+
threads: input.threads.map((t) => ({
|
|
232
|
+
number: t.number,
|
|
233
|
+
title: t.title,
|
|
234
|
+
body: t.body,
|
|
235
|
+
merge_sha: t.mergeSha,
|
|
236
|
+
comments: t.comments,
|
|
237
|
+
})),
|
|
238
|
+
symbols: input.symbols,
|
|
239
|
+
sources: input.sources,
|
|
240
|
+
auto_approve: input.autoApprove,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Post the digest to a brain.
|
|
245
|
+
*
|
|
246
|
+
* Returns the job id so the caller can hand it back to whoever asked for the
|
|
247
|
+
* build, which is what the onboarding screen polls.
|
|
248
|
+
*/
|
|
249
|
+
export async function postDigest(baseUrl, brainId, brainToken, digest, fetchImpl) {
|
|
250
|
+
const res = await fetchImpl(`${baseUrl.replace(/\/+$/, "")}/api/brains/${encodeURIComponent(brainId)}/repo`, {
|
|
251
|
+
method: "POST",
|
|
252
|
+
headers: {
|
|
253
|
+
authorization: `Bearer ${brainToken}`,
|
|
254
|
+
"content-type": "application/json",
|
|
255
|
+
accept: "application/json",
|
|
256
|
+
},
|
|
257
|
+
body: JSON.stringify(digest),
|
|
258
|
+
});
|
|
259
|
+
const text = await res.text();
|
|
260
|
+
if (!res.ok) {
|
|
261
|
+
throw new Error(`brain ingest failed: ${res.status} ${text.slice(0, 300)}`);
|
|
262
|
+
}
|
|
263
|
+
const parsed = JSON.parse(text);
|
|
264
|
+
return { jobId: String(parsed.job_id ?? "") };
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/app/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AAsDtD;mEACmE;AACnE,MAAM,GAAG,GAAG,MAAM,CAAC;AACnB,MAAM,KAAK,GAAG,MAAM,CAAC;AAErB;gEACgE;AAChE,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,iDAAiD;AACjD,SAAS,GAAG,CAAC,IAAY,EAAE,IAAc;IACvC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC,EAAE;QACpE,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;KAC5B,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M,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/app/identity.d.ts
CHANGED
|
@@ -31,6 +31,62 @@ export type Fetch = (url: string, init?: {
|
|
|
31
31
|
* Tokens last an hour and a busy repository can fire a dozen webhooks a minute;
|
|
32
32
|
* without the cache every one of them spends a round trip and a signature.
|
|
33
33
|
*/
|
|
34
|
+
/**
|
|
35
|
+
* The installation id for one repository.
|
|
36
|
+
*
|
|
37
|
+
* Every existing caller gets the id from a webhook payload, because every
|
|
38
|
+
* existing caller is reacting to one. A request that names a repository instead
|
|
39
|
+
* has to look it up, and this is the only endpoint that answers it: it is
|
|
40
|
+
* App-JWT authed, so it works before any installation token exists.
|
|
41
|
+
*
|
|
42
|
+
* Returns null when the App is not installed on the repository — which is the
|
|
43
|
+
* expected answer for "the user pasted a repo we cannot see", not an error.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Headers for a GitHub REST call, with or without a token.
|
|
47
|
+
*
|
|
48
|
+
* An empty token means anonymous, and anonymous has to mean NO authorization
|
|
49
|
+
* header — `Bearer ` with nothing after it is a 401, not a fallback. That
|
|
50
|
+
* distinction is the whole reason this is a function: a public repository read
|
|
51
|
+
* without an installation goes down exactly this path.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ghHeaders(token: string): Record<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* An installation token for reading PUBLIC repositories the App is not
|
|
56
|
+
* installed on.
|
|
57
|
+
*
|
|
58
|
+
* GitHub answers any public resource to any installation token, at 5,000
|
|
59
|
+
* requests an hour. Anonymous answers the same resources at 60 an hour for the
|
|
60
|
+
* whole box, which one repository's pull-request walk spends in a minute — so
|
|
61
|
+
* without this, the second public repo of the hour reads as "we cannot see it".
|
|
62
|
+
*
|
|
63
|
+
* `owner` is our own account, so this borrows OUR installation's rate limit
|
|
64
|
+
* rather than some customer's. Falls back to the first installation, and to
|
|
65
|
+
* null when the App has none, in which case the caller reads anonymously.
|
|
66
|
+
*/
|
|
67
|
+
export declare function publicReadInstallation(creds: AppCredentials, owner: string, fetchImpl: Fetch, nowMs?: number, api?: string): Promise<number | null>;
|
|
68
|
+
export declare function installationFor(creds: AppCredentials, owner: string, repo: string, fetchImpl: Fetch, nowMs?: number, api?: string): Promise<number | null>;
|
|
69
|
+
/**
|
|
70
|
+
* Why a repository is unreachable, and where to send the user to fix it.
|
|
71
|
+
*
|
|
72
|
+
* Two failures look identical from `/repos/{o}/{r}/installation` — both 404 —
|
|
73
|
+
* and they need different sentences and different links. Either the App is not
|
|
74
|
+
* on the account at all, so they install it; or it is installed and this
|
|
75
|
+
* repository simply is not in its selected list, so they edit that list. Telling
|
|
76
|
+
* someone to install an App they already installed is the kind of dead end that
|
|
77
|
+
* ends the session.
|
|
78
|
+
*
|
|
79
|
+
* ownerId is the account's numeric id, which preselects the right account on
|
|
80
|
+
* GitHub's install screen. There is no equivalent for preselecting a repository;
|
|
81
|
+
* GitHub owns that checkbox list.
|
|
82
|
+
*/
|
|
83
|
+
export interface RepoAccessGap {
|
|
84
|
+
reason: "not_installed" | "repo_not_selected";
|
|
85
|
+
ownerId: number | null;
|
|
86
|
+
installationId: number | null;
|
|
87
|
+
}
|
|
88
|
+
/** Which of the two gaps applies to owner/repo. */
|
|
89
|
+
export declare function repoAccessGap(creds: AppCredentials, owner: string, fetchImpl: Fetch, nowMs?: number, api?: string): Promise<RepoAccessGap>;
|
|
34
90
|
export declare class InstallationTokens {
|
|
35
91
|
private readonly creds;
|
|
36
92
|
private readonly fetchImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/app/identity.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK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