ghagga-core 2.9.1 → 3.0.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/LICENSE +21 -0
- package/dist/agents/consensus.d.ts.map +1 -1
- package/dist/agents/consensus.js +7 -2
- package/dist/agents/consensus.js.map +1 -1
- package/dist/agents/diagnostic.d.ts.map +1 -1
- package/dist/agents/diagnostic.js +7 -2
- package/dist/agents/diagnostic.js.map +1 -1
- package/dist/agents/fan-out-lenses.d.ts.map +1 -1
- package/dist/agents/fan-out-lenses.js +7 -2
- package/dist/agents/fan-out-lenses.js.map +1 -1
- package/dist/agents/prompts.d.ts +49 -1
- package/dist/agents/prompts.d.ts.map +1 -1
- package/dist/agents/prompts.js +133 -5
- package/dist/agents/prompts.js.map +1 -1
- package/dist/agents/simple.d.ts +1 -1
- package/dist/agents/simple.d.ts.map +1 -1
- package/dist/agents/simple.js +6 -4
- package/dist/agents/simple.js.map +1 -1
- package/dist/agents/workflow.d.ts.map +1 -1
- package/dist/agents/workflow.js +13 -4
- package/dist/agents/workflow.js.map +1 -1
- package/dist/critique/critique.d.ts.map +1 -1
- package/dist/critique/critique.js +14 -6
- package/dist/critique/critique.js.map +1 -1
- package/dist/diff/index.d.ts +12 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +11 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/diff/parse.d.ts +41 -0
- package/dist/diff/parse.d.ts.map +1 -0
- package/dist/diff/parse.js +303 -0
- package/dist/diff/parse.js.map +1 -0
- package/dist/diff/types.d.ts +106 -0
- package/dist/diff/types.d.ts.map +1 -0
- package/dist/diff/types.js +23 -0
- package/dist/diff/types.js.map +1 -0
- package/dist/embed.d.ts +5 -2
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +7 -3
- package/dist/embed.js.map +1 -1
- package/dist/enhance/prompt.d.ts +5 -1
- package/dist/enhance/prompt.d.ts.map +1 -1
- package/dist/enhance/prompt.js +9 -2
- package/dist/enhance/prompt.js.map +1 -1
- package/dist/format.d.ts +31 -0
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +256 -15
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/pageindex/index.d.ts +2 -2
- package/dist/memory/pageindex/index.d.ts.map +1 -1
- package/dist/memory/pageindex/index.js.map +1 -1
- package/dist/memory/pageindex/service.d.ts +10 -1
- package/dist/memory/pageindex/service.d.ts.map +1 -1
- package/dist/memory/pageindex/service.js +2 -2
- package/dist/memory/pageindex/service.js.map +1 -1
- package/dist/memory/persist.d.ts.map +1 -1
- package/dist/memory/persist.js +10 -3
- package/dist/memory/persist.js.map +1 -1
- package/dist/memory/privacy.d.ts.map +1 -1
- package/dist/memory/privacy.js +45 -6
- package/dist/memory/privacy.js.map +1 -1
- package/dist/memory/sqlite.d.ts +1 -13
- package/dist/memory/sqlite.d.ts.map +1 -1
- package/dist/memory/sqlite.js +45 -27
- package/dist/memory/sqlite.js.map +1 -1
- package/dist/memory/taxonomy.d.ts.map +1 -1
- package/dist/memory/taxonomy.js +6 -1
- package/dist/memory/taxonomy.js.map +1 -1
- package/dist/pipeline/degrade.d.ts +61 -0
- package/dist/pipeline/degrade.d.ts.map +1 -0
- package/dist/pipeline/degrade.js +58 -0
- package/dist/pipeline/degrade.js.map +1 -0
- package/dist/pipeline/enrich.d.ts +29 -0
- package/dist/pipeline/enrich.d.ts.map +1 -0
- package/dist/pipeline/enrich.js +271 -0
- package/dist/pipeline/enrich.js.map +1 -0
- package/dist/pipeline/execute.d.ts +22 -0
- package/dist/pipeline/execute.d.ts.map +1 -0
- package/dist/pipeline/execute.js +250 -0
- package/dist/pipeline/execute.js.map +1 -0
- package/dist/pipeline/finalize.d.ts +26 -0
- package/dist/pipeline/finalize.d.ts.map +1 -0
- package/dist/pipeline/finalize.js +52 -0
- package/dist/pipeline/finalize.js.map +1 -0
- package/dist/pipeline/gather-context.d.ts +25 -0
- package/dist/pipeline/gather-context.d.ts.map +1 -0
- package/dist/pipeline/gather-context.js +169 -0
- package/dist/pipeline/gather-context.js.map +1 -0
- package/dist/pipeline/gather-safe.d.ts +39 -0
- package/dist/pipeline/gather-safe.d.ts.map +1 -0
- package/dist/pipeline/gather-safe.js +127 -0
- package/dist/pipeline/gather-safe.js.map +1 -0
- package/dist/pipeline/prepare-graph.d.ts +54 -0
- package/dist/pipeline/prepare-graph.d.ts.map +1 -0
- package/dist/pipeline/prepare-graph.js +174 -0
- package/dist/pipeline/prepare-graph.js.map +1 -0
- package/dist/pipeline/prepare.d.ts +40 -0
- package/dist/pipeline/prepare.d.ts.map +1 -0
- package/dist/pipeline/prepare.js +233 -0
- package/dist/pipeline/prepare.js.map +1 -0
- package/dist/pipeline/providers.d.ts +54 -0
- package/dist/pipeline/providers.d.ts.map +1 -0
- package/dist/pipeline/providers.js +163 -0
- package/dist/pipeline/providers.js.map +1 -0
- package/dist/pipeline/results.d.ts +35 -0
- package/dist/pipeline/results.d.ts.map +1 -0
- package/dist/pipeline/results.js +122 -0
- package/dist/pipeline/results.js.map +1 -0
- package/dist/pipeline/state.d.ts +92 -0
- package/dist/pipeline/state.d.ts.map +1 -0
- package/dist/pipeline/state.js +13 -0
- package/dist/pipeline/state.js.map +1 -0
- package/dist/pipeline.d.ts +10 -9
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +36 -1213
- package/dist/pipeline.js.map +1 -1
- package/dist/providers/gateway.d.ts.map +1 -1
- package/dist/providers/gateway.js +8 -0
- package/dist/providers/gateway.js.map +1 -1
- package/dist/recursive/index.d.ts +1 -0
- package/dist/recursive/index.d.ts.map +1 -1
- package/dist/recursive/index.js +7 -3
- package/dist/recursive/index.js.map +1 -1
- package/dist/recursive/patch-extractor.d.ts +58 -6
- package/dist/recursive/patch-extractor.d.ts.map +1 -1
- package/dist/recursive/patch-extractor.js +207 -26
- package/dist/recursive/patch-extractor.js.map +1 -1
- package/dist/sanitize.d.ts +51 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +90 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/scope/diff-mapper.d.ts +12 -0
- package/dist/scope/diff-mapper.d.ts.map +1 -1
- package/dist/scope/diff-mapper.js +25 -18
- package/dist/scope/diff-mapper.js.map +1 -1
- package/dist/scope/entity-diff.d.ts +21 -4
- package/dist/scope/entity-diff.d.ts.map +1 -1
- package/dist/scope/entity-diff.js +132 -34
- package/dist/scope/entity-diff.js.map +1 -1
- package/dist/scope/types.d.ts +10 -0
- package/dist/scope/types.d.ts.map +1 -1
- package/dist/semantic-diff/index.d.ts +25 -2
- package/dist/semantic-diff/index.d.ts.map +1 -1
- package/dist/semantic-diff/index.js +147 -53
- package/dist/semantic-diff/index.js.map +1 -1
- package/dist/tools/gitleaks-config.toml +35 -0
- package/dist/tools/plugins/gitleaks.d.ts +10 -0
- package/dist/tools/plugins/gitleaks.d.ts.map +1 -1
- package/dist/tools/plugins/gitleaks.js +29 -2
- package/dist/tools/plugins/gitleaks.js.map +1 -1
- package/dist/tools/plugins/semgrep.d.ts +11 -0
- package/dist/tools/plugins/semgrep.d.ts.map +1 -1
- package/dist/tools/plugins/semgrep.js +30 -1
- package/dist/tools/plugins/semgrep.js.map +1 -1
- package/dist/tools/semgrep-rules.yml +305 -0
- package/dist/types.d.ts +51 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/diff.d.ts +22 -2
- package/dist/utils/diff.d.ts.map +1 -1
- package/dist/utils/diff.js +36 -40
- package/dist/utils/diff.js.map +1 -1
- package/package.json +21 -22
- package/dist/providers/fallback.d.ts +0 -54
- package/dist/providers/fallback.d.ts.map +0 -1
- package/dist/providers/fallback.js +0 -102
- package/dist/providers/fallback.js.map +0 -1
- package/dist/providers/index.d.ts +0 -49
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -146
- package/dist/providers/index.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitization for LLM/tool-derived content before it is posted to GitHub.
|
|
3
|
+
*
|
|
4
|
+
* Review output (summary, finding messages, file paths, model labels, ...)
|
|
5
|
+
* is ultimately derived from attacker-controlled PR diffs, so a malicious PR
|
|
6
|
+
* can steer the LLM into emitting payloads that the bot would then post
|
|
7
|
+
* verbatim under its own identity:
|
|
8
|
+
*
|
|
9
|
+
* - "@org/everyone" mention spam (notification bombing)
|
|
10
|
+
* - hidden HTML comments (prompt-injection payloads for OTHER bots
|
|
11
|
+
* reading the thread)
|
|
12
|
+
* - raw HTML (<script>, <img>, hidden text)
|
|
13
|
+
* - table-breaking pipes/newlines that smuggle content outside its cell
|
|
14
|
+
* - megabyte-scale output (comment flooding)
|
|
15
|
+
*
|
|
16
|
+
* These helpers neutralize untrusted VARIABLES only. Trusted markdown
|
|
17
|
+
* literals produced by the formatters themselves (headers, table syntax,
|
|
18
|
+
* the ghagga comment marker) must NOT be passed through these functions.
|
|
19
|
+
*/
|
|
20
|
+
/** Default cap for free-form markdown text (e.g. review summary). */
|
|
21
|
+
export declare const SANITIZE_DEFAULT_TEXT_MAX = 2000;
|
|
22
|
+
/** Default cap for a single markdown table cell. */
|
|
23
|
+
export declare const SANITIZE_DEFAULT_CELL_MAX = 500;
|
|
24
|
+
/**
|
|
25
|
+
* Sanitize untrusted text for inclusion in a GitHub markdown comment.
|
|
26
|
+
*
|
|
27
|
+
* - strips HTML comments (`<!-- ... -->`, including unterminated openers)
|
|
28
|
+
* - escapes `<` as `<` (blocks raw HTML / hidden payloads)
|
|
29
|
+
* - inserts a zero-width space after every `@` (neutralizes mentions
|
|
30
|
+
* without visibly altering the text)
|
|
31
|
+
* - collapses control characters (except \n and \t) to spaces
|
|
32
|
+
* - enforces a maximum length, appending an ellipsis when truncated
|
|
33
|
+
*/
|
|
34
|
+
export declare function sanitizeMarkdownText(input: string, maxLength?: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Sanitize untrusted text for a single GitHub markdown table cell.
|
|
37
|
+
*
|
|
38
|
+
* Applies `sanitizeMarkdownText` and additionally escapes pipes and
|
|
39
|
+
* replaces newlines with spaces so the content cannot break out of its
|
|
40
|
+
* cell (or out of the table entirely).
|
|
41
|
+
*/
|
|
42
|
+
export declare function sanitizeTableCell(input: string, maxLength?: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* Validate a GitHub login (username) before @-mentioning it.
|
|
45
|
+
*
|
|
46
|
+
* GitHub rules: 1-39 chars, alphanumeric or single hyphens, may not start
|
|
47
|
+
* or end with a hyphen. Anything else (e.g. "org/everyone", "x[bot]") is
|
|
48
|
+
* rejected — callers should OMIT the mention rather than escape it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isValidGithubLogin(login: string): boolean;
|
|
51
|
+
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,oDAAoD;AACpD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAI7C;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAkC,GAC5C,MAAM,CAqCR;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAkC,GAC5C,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
package/dist/sanitize.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitization for LLM/tool-derived content before it is posted to GitHub.
|
|
3
|
+
*
|
|
4
|
+
* Review output (summary, finding messages, file paths, model labels, ...)
|
|
5
|
+
* is ultimately derived from attacker-controlled PR diffs, so a malicious PR
|
|
6
|
+
* can steer the LLM into emitting payloads that the bot would then post
|
|
7
|
+
* verbatim under its own identity:
|
|
8
|
+
*
|
|
9
|
+
* - "@org/everyone" mention spam (notification bombing)
|
|
10
|
+
* - hidden HTML comments (prompt-injection payloads for OTHER bots
|
|
11
|
+
* reading the thread)
|
|
12
|
+
* - raw HTML (<script>, <img>, hidden text)
|
|
13
|
+
* - table-breaking pipes/newlines that smuggle content outside its cell
|
|
14
|
+
* - megabyte-scale output (comment flooding)
|
|
15
|
+
*
|
|
16
|
+
* These helpers neutralize untrusted VARIABLES only. Trusted markdown
|
|
17
|
+
* literals produced by the formatters themselves (headers, table syntax,
|
|
18
|
+
* the ghagga comment marker) must NOT be passed through these functions.
|
|
19
|
+
*/
|
|
20
|
+
// ─── Constants ──────────────────────────────────────────────────
|
|
21
|
+
/** Zero-width space — breaks GitHub @-mention linkification invisibly. */
|
|
22
|
+
const ZERO_WIDTH_SPACE = '\u200b';
|
|
23
|
+
/** Default cap for free-form markdown text (e.g. review summary). */
|
|
24
|
+
export const SANITIZE_DEFAULT_TEXT_MAX = 2000;
|
|
25
|
+
/** Default cap for a single markdown table cell. */
|
|
26
|
+
export const SANITIZE_DEFAULT_CELL_MAX = 500;
|
|
27
|
+
// ─── Sanitizers ─────────────────────────────────────────────────
|
|
28
|
+
/**
|
|
29
|
+
* Sanitize untrusted text for inclusion in a GitHub markdown comment.
|
|
30
|
+
*
|
|
31
|
+
* - strips HTML comments (`<!-- ... -->`, including unterminated openers)
|
|
32
|
+
* - escapes `<` as `<` (blocks raw HTML / hidden payloads)
|
|
33
|
+
* - inserts a zero-width space after every `@` (neutralizes mentions
|
|
34
|
+
* without visibly altering the text)
|
|
35
|
+
* - collapses control characters (except \n and \t) to spaces
|
|
36
|
+
* - enforces a maximum length, appending an ellipsis when truncated
|
|
37
|
+
*/
|
|
38
|
+
export function sanitizeMarkdownText(input, maxLength = SANITIZE_DEFAULT_TEXT_MAX) {
|
|
39
|
+
let s = input;
|
|
40
|
+
// HTML comments can carry hidden instructions for other bots/agents
|
|
41
|
+
// reading the thread. Strip closed comments, then any unterminated opener.
|
|
42
|
+
s = s.replace(/<!--[\s\S]*?-->/g, '');
|
|
43
|
+
s = s.replace(/<!--/g, '');
|
|
44
|
+
// Escape raw HTML. This also neutralizes any comment-like remnants.
|
|
45
|
+
s = s.replace(/</g, '<');
|
|
46
|
+
// Neutralize @-mentions: a zero-width space after '@' prevents GitHub
|
|
47
|
+
// from linkifying/notifying while keeping the text readable.
|
|
48
|
+
s = s.replace(/@/g, `@${ZERO_WIDTH_SPACE}`);
|
|
49
|
+
// Collapse control chars (C0 except \t, \n, \r — plus DEL) to spaces;
|
|
50
|
+
// carriage returns are normalized to plain newlines.
|
|
51
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: deliberate control-char filter
|
|
52
|
+
s = s.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, ' ');
|
|
53
|
+
s = s.replace(/\r\n?/g, '\n');
|
|
54
|
+
if (s.length > maxLength) {
|
|
55
|
+
let truncated = s.slice(0, maxLength);
|
|
56
|
+
// s.slice operates on UTF-16 code units, so the cut can land in the
|
|
57
|
+
// MIDDLE of a surrogate pair (e.g. an emoji like 😀 = U+1F600), leaving a
|
|
58
|
+
// lone high surrogate at the end. A lone surrogate renders as � and can
|
|
59
|
+
// corrupt downstream consumers. If the last code unit is a high surrogate
|
|
60
|
+
// (0xD800–0xDBFF) with no matching low surrogate following, drop it before
|
|
61
|
+
// appending the ellipsis.
|
|
62
|
+
const lastUnit = truncated.charCodeAt(truncated.length - 1);
|
|
63
|
+
if (lastUnit >= 0xd800 && lastUnit <= 0xdbff) {
|
|
64
|
+
truncated = truncated.slice(0, -1);
|
|
65
|
+
}
|
|
66
|
+
s = `${truncated}…`;
|
|
67
|
+
}
|
|
68
|
+
return s;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sanitize untrusted text for a single GitHub markdown table cell.
|
|
72
|
+
*
|
|
73
|
+
* Applies `sanitizeMarkdownText` and additionally escapes pipes and
|
|
74
|
+
* replaces newlines with spaces so the content cannot break out of its
|
|
75
|
+
* cell (or out of the table entirely).
|
|
76
|
+
*/
|
|
77
|
+
export function sanitizeTableCell(input, maxLength = SANITIZE_DEFAULT_CELL_MAX) {
|
|
78
|
+
return sanitizeMarkdownText(input, maxLength).replace(/\|/g, '\\|').replace(/\n/g, ' ');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Validate a GitHub login (username) before @-mentioning it.
|
|
82
|
+
*
|
|
83
|
+
* GitHub rules: 1-39 chars, alphanumeric or single hyphens, may not start
|
|
84
|
+
* or end with a hyphen. Anything else (e.g. "org/everyone", "x[bot]") is
|
|
85
|
+
* rejected — callers should OMIT the mention rather than escape it.
|
|
86
|
+
*/
|
|
87
|
+
export function isValidGithubLogin(login) {
|
|
88
|
+
return /^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$/.test(login);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=sanitize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,mEAAmE;AAEnE,0EAA0E;AAC1E,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC,qEAAqE;AACrE,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAE9C,oDAAoD;AACpD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,mEAAmE;AAEnE;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAa,EACb,YAAoB,yBAAyB;IAE7C,IAAI,CAAC,GAAG,KAAK,CAAC;IAEd,oEAAo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KAAK,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,qDAAqD,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -10,6 +10,18 @@ import type { AffectedSymbol, DiffHunk, SymbolInfo } from './types.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* Parse unified diff content to extract hunk line ranges.
|
|
12
12
|
*
|
|
13
|
+
* Thin adapter over the unified parser (`src/diff/parse.ts`): model hunks
|
|
14
|
+
* are mapped down to the 4 captures this module has always returned. Bare
|
|
15
|
+
* hunk fragments WITHOUT any `diff --git` header (a documented input shape —
|
|
16
|
+
* "raw unified diff content for a single file") land in the model's
|
|
17
|
+
* `preamble`, so those lines are scanned with the shared `matchHunkHeader`
|
|
18
|
+
* (THE single hunk-header regex of core, spec R8).
|
|
19
|
+
*
|
|
20
|
+
* KNOWN synthetic-only divergence vs the pre-adapter regex (`\s+`
|
|
21
|
+
* separators): headers with tabs or multiple spaces (`@@ -1,2 +3,4 @@`)
|
|
22
|
+
* no longer match. git only ever emits the single-space form; pinned in
|
|
23
|
+
* `src/diff/__tests__/parity-parse-hunks.test.ts`.
|
|
24
|
+
*
|
|
13
25
|
* @param diffContent - Raw unified diff content for a single file
|
|
14
26
|
* @returns Array of DiffHunk objects with line ranges
|
|
15
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-mapper.d.ts","sourceRoot":"","sources":["../../src/scope/diff-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"diff-mapper.d.ts","sourceRoot":"","sources":["../../src/scope/diff-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIvE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,EAAE,CAqB1D;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,cAAc,EAAE,CAqB3F"}
|
|
@@ -6,34 +6,41 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Pure functions with no side effects.
|
|
8
8
|
*/
|
|
9
|
+
import { matchHunkHeader, parseUnifiedDiff } from '../diff/index.js';
|
|
9
10
|
// ─── Hunk Parsing ──────────────────────────────────────────────
|
|
10
|
-
/**
|
|
11
|
-
* Regex to match unified diff hunk headers.
|
|
12
|
-
* Format: @@ -oldStart[,oldCount] +newStart[,newCount] @@
|
|
13
|
-
*
|
|
14
|
-
* Examples:
|
|
15
|
-
* @@ -10,5 +10,7 @@
|
|
16
|
-
* @@ -1 +1,3 @@
|
|
17
|
-
* @@ -0,0 +1,20 @@
|
|
18
|
-
*/
|
|
19
|
-
const HUNK_HEADER_RE = /^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/;
|
|
20
11
|
/**
|
|
21
12
|
* Parse unified diff content to extract hunk line ranges.
|
|
22
13
|
*
|
|
14
|
+
* Thin adapter over the unified parser (`src/diff/parse.ts`): model hunks
|
|
15
|
+
* are mapped down to the 4 captures this module has always returned. Bare
|
|
16
|
+
* hunk fragments WITHOUT any `diff --git` header (a documented input shape —
|
|
17
|
+
* "raw unified diff content for a single file") land in the model's
|
|
18
|
+
* `preamble`, so those lines are scanned with the shared `matchHunkHeader`
|
|
19
|
+
* (THE single hunk-header regex of core, spec R8).
|
|
20
|
+
*
|
|
21
|
+
* KNOWN synthetic-only divergence vs the pre-adapter regex (`\s+`
|
|
22
|
+
* separators): headers with tabs or multiple spaces (`@@ -1,2 +3,4 @@`)
|
|
23
|
+
* no longer match. git only ever emits the single-space form; pinned in
|
|
24
|
+
* `src/diff/__tests__/parity-parse-hunks.test.ts`.
|
|
25
|
+
*
|
|
23
26
|
* @param diffContent - Raw unified diff content for a single file
|
|
24
27
|
* @returns Array of DiffHunk objects with line ranges
|
|
25
28
|
*/
|
|
26
29
|
export function parseHunks(diffContent) {
|
|
30
|
+
const { preamble, files } = parseUnifiedDiff(diffContent);
|
|
27
31
|
const hunks = [];
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
for (const line of preamble) {
|
|
33
|
+
const match = matchHunkHeader(line);
|
|
34
|
+
if (match)
|
|
35
|
+
hunks.push(match);
|
|
36
|
+
}
|
|
37
|
+
for (const file of files) {
|
|
38
|
+
for (const hunk of file.hunks) {
|
|
32
39
|
hunks.push({
|
|
33
|
-
oldStart:
|
|
34
|
-
oldCount:
|
|
35
|
-
newStart:
|
|
36
|
-
newCount:
|
|
40
|
+
oldStart: hunk.oldStart,
|
|
41
|
+
oldCount: hunk.oldCount,
|
|
42
|
+
newStart: hunk.newStart,
|
|
43
|
+
newCount: hunk.newCount,
|
|
37
44
|
});
|
|
38
45
|
}
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-mapper.js","sourceRoot":"","sources":["../../src/scope/diff-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"diff-mapper.js","sourceRoot":"","sources":["../../src/scope/diff-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGrE,kEAAkE;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAC,WAAW,CAA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IAAI,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,kEAAkE;AAElE;;;;;GAKG;AACH,SAAS,aAAa,CAAC,MAAc,EAAE,IAAY,EAAE,MAAc,EAAE,IAAY;IAC/E,OAAO,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,CAAC;AAC1C,CAAC"}
|
|
@@ -12,11 +12,28 @@
|
|
|
12
12
|
import type { AffectedSymbol, EntityChange, EntityDiffOptions, RenameMatch, SymbolInfo } from './types.js';
|
|
13
13
|
/**
|
|
14
14
|
* Extract the actual addition/deletion lines from a diff that fall
|
|
15
|
-
* within a symbol's line range
|
|
15
|
+
* within a symbol's line range. Symbol ranges are NEW-side line numbers
|
|
16
|
+
* (contract of mapDiffToSymbols: symbols come from the NEW version of the
|
|
17
|
+
* file), so BOTH additions and deletions are attributed by the live
|
|
18
|
+
* new-side position — for a deletion, the new-side line where the removal
|
|
19
|
+
* happened (CORE-M9 fix; previously deletions were compared by their
|
|
20
|
+
* OLD-side line number against the new-side ranges, mis-attributing them
|
|
21
|
+
* whenever earlier hunks made old/new drift apart).
|
|
16
22
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
23
|
+
* Thin adapter over the unified parser (`src/diff/parse.ts`): the walk runs
|
|
24
|
+
* over the byte-exact line stream `[...preamble, ...files[].rawLines]`
|
|
25
|
+
* (≡ `diffContent.split('\n')` by the model's R2 reconstruction invariant),
|
|
26
|
+
* NOT over `hunk.lines` — preserving the historical behaviors the structured
|
|
27
|
+
* hunks do not carry: bare hunk fragments without a `diff --git` header
|
|
28
|
+
* (kept in `preamble`), orphan +/- tails after a genuine empty line
|
|
29
|
+
* mid-hunk, and metadata lines counted as context. Hunk headers are
|
|
30
|
+
* detected with the shared `matchHunkHeader` (THE single hunk-header regex
|
|
31
|
+
* of core, spec R8).
|
|
32
|
+
*
|
|
33
|
+
* KNOWN synthetic-only divergence vs the pre-adapter `\s+` regex: hunk
|
|
34
|
+
* headers with tabs/multiple spaces no longer reset the position counter
|
|
35
|
+
* (git only emits the single-space form); pinned in
|
|
36
|
+
* `src/diff/__tests__/parity-extract-entity-diff-lines.test.ts`.
|
|
20
37
|
*
|
|
21
38
|
* @param diffContent - Raw unified diff content for a single file
|
|
22
39
|
* @param symbol - The symbol whose range to extract lines for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-diff.d.ts","sourceRoot":"","sources":["../../src/scope/entity-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"entity-diff.d.ts","sourceRoot":"","sources":["../../src/scope/entity-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,UAAU,EACX,MAAM,YAAY,CAAC;AAuBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CAoCxF;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,cAAc,EAAE,EACjC,WAAW,EAAE,MAAM,GAClB,YAAY,EAAE,CAqBhB;AAoID;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,cAAc,EAAE,UAAU,EAAE,EAC5B,YAAY,EAAE,UAAU,EAAE,EAC1B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,WAAW,EAAE,CAuDf;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAE1E"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Pure functions with no side effects.
|
|
11
11
|
*/
|
|
12
|
+
import { matchHunkHeader, parseUnifiedDiff } from '../diff/index.js';
|
|
12
13
|
import { ENTITY_CHANGE_KIND } from './types.js';
|
|
13
14
|
// ─── Constants ────────────────────────────────────────────────
|
|
14
15
|
const DEFAULT_SIMILARITY_THRESHOLD = 0.9;
|
|
@@ -28,52 +29,65 @@ const COSMETIC_LINE_PATTERNS = [
|
|
|
28
29
|
// ─── Extract Diff Lines ───────────────────────────────────────
|
|
29
30
|
/**
|
|
30
31
|
* Extract the actual addition/deletion lines from a diff that fall
|
|
31
|
-
* within a symbol's line range
|
|
32
|
+
* within a symbol's line range. Symbol ranges are NEW-side line numbers
|
|
33
|
+
* (contract of mapDiffToSymbols: symbols come from the NEW version of the
|
|
34
|
+
* file), so BOTH additions and deletions are attributed by the live
|
|
35
|
+
* new-side position — for a deletion, the new-side line where the removal
|
|
36
|
+
* happened (CORE-M9 fix; previously deletions were compared by their
|
|
37
|
+
* OLD-side line number against the new-side ranges, mis-attributing them
|
|
38
|
+
* whenever earlier hunks made old/new drift apart).
|
|
32
39
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
40
|
+
* Thin adapter over the unified parser (`src/diff/parse.ts`): the walk runs
|
|
41
|
+
* over the byte-exact line stream `[...preamble, ...files[].rawLines]`
|
|
42
|
+
* (≡ `diffContent.split('\n')` by the model's R2 reconstruction invariant),
|
|
43
|
+
* NOT over `hunk.lines` — preserving the historical behaviors the structured
|
|
44
|
+
* hunks do not carry: bare hunk fragments without a `diff --git` header
|
|
45
|
+
* (kept in `preamble`), orphan +/- tails after a genuine empty line
|
|
46
|
+
* mid-hunk, and metadata lines counted as context. Hunk headers are
|
|
47
|
+
* detected with the shared `matchHunkHeader` (THE single hunk-header regex
|
|
48
|
+
* of core, spec R8).
|
|
49
|
+
*
|
|
50
|
+
* KNOWN synthetic-only divergence vs the pre-adapter `\s+` regex: hunk
|
|
51
|
+
* headers with tabs/multiple spaces no longer reset the position counter
|
|
52
|
+
* (git only emits the single-space form); pinned in
|
|
53
|
+
* `src/diff/__tests__/parity-extract-entity-diff-lines.test.ts`.
|
|
36
54
|
*
|
|
37
55
|
* @param diffContent - Raw unified diff content for a single file
|
|
38
56
|
* @param symbol - The symbol whose range to extract lines for
|
|
39
57
|
* @returns Array of raw diff lines (with +/- prefix) within the symbol range
|
|
40
58
|
*/
|
|
41
59
|
export function extractEntityDiffLines(diffContent, symbol) {
|
|
42
|
-
const
|
|
60
|
+
const { preamble, files } = parseUnifiedDiff(diffContent);
|
|
61
|
+
const stream = [...preamble, ...files.flatMap((f) => f.rawLines)];
|
|
43
62
|
const result = [];
|
|
44
63
|
let currentNewLine = 0;
|
|
45
|
-
let currentOldLine = 0;
|
|
46
64
|
let inHunk = false;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
currentOldLine = Number.parseInt(hunkMatch[1], 10);
|
|
52
|
-
currentNewLine = Number.parseInt(hunkMatch[2], 10);
|
|
65
|
+
for (const line of stream) {
|
|
66
|
+
const hunk = matchHunkHeader(line);
|
|
67
|
+
if (hunk) {
|
|
68
|
+
currentNewLine = hunk.newStart;
|
|
53
69
|
inHunk = true;
|
|
54
70
|
continue;
|
|
55
71
|
}
|
|
56
72
|
if (!inHunk)
|
|
57
73
|
continue;
|
|
58
74
|
if (line.startsWith('+') && !line.startsWith('+++')) {
|
|
59
|
-
// Addition —
|
|
75
|
+
// Addition — lives at the current new-side line, then advances it.
|
|
60
76
|
if (currentNewLine >= symbol.startLine && currentNewLine <= symbol.endLine) {
|
|
61
77
|
result.push(line);
|
|
62
78
|
}
|
|
63
79
|
currentNewLine++;
|
|
64
80
|
}
|
|
65
81
|
else if (line.startsWith('-') && !line.startsWith('---')) {
|
|
66
|
-
// Deletion —
|
|
67
|
-
//
|
|
68
|
-
if (
|
|
82
|
+
// Deletion — attributed to the new-side position where the removal
|
|
83
|
+
// happened (CORE-M9). A deletion does NOT advance the new side.
|
|
84
|
+
if (currentNewLine >= symbol.startLine && currentNewLine <= symbol.endLine) {
|
|
69
85
|
result.push(line);
|
|
70
86
|
}
|
|
71
|
-
currentOldLine++;
|
|
72
87
|
}
|
|
73
88
|
else {
|
|
74
|
-
// Context line — advances
|
|
89
|
+
// Context (or any other) line — advances the new-side position.
|
|
75
90
|
currentNewLine++;
|
|
76
|
-
currentOldLine++;
|
|
77
91
|
}
|
|
78
92
|
}
|
|
79
93
|
return result;
|
|
@@ -134,28 +148,106 @@ function normalizeBody(body) {
|
|
|
134
148
|
.trim();
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
151
|
+
* Defensive cap on LCS input size (CORE-M8). Inputs are normalized entity
|
|
152
|
+
* bodies from a diff, typically well under this. The DP below is O(n*m)
|
|
153
|
+
* time, so two pathological ~100 KB bodies (e.g. a class spanning a whole
|
|
154
|
+
* generated file) would cost ~10^10 cell updates. Beyond the cap the DP
|
|
155
|
+
* compares the first MAX chars of each body only, but the similarity
|
|
156
|
+
* denominator keeps the ORIGINAL lengths — so two giant bodies identical
|
|
157
|
+
* only within the capped prefix score at most `cap / max(original lens)`
|
|
158
|
+
* (e.g. two 15k bodies sharing only their first 10k score ≤ 0.67), never a
|
|
159
|
+
* false 1.0. Trade-off: similarity living past the cap is invisible to the
|
|
160
|
+
* DP, so genuinely-similar giant pairs may be under-scored and missed —
|
|
161
|
+
* degraded detection on pathological inputs, never unbounded CPU.
|
|
162
|
+
*/
|
|
163
|
+
const MAX_SIMILARITY_INPUT_LENGTH = 10_000;
|
|
164
|
+
/**
|
|
165
|
+
* Default total LCS DP work budget for one detectRenames call (CORE-M8
|
|
166
|
+
* fix-forward). detectRenames compares every removed×added pair and each
|
|
167
|
+
* pair that reaches the DP costs n*m cell updates (n, m ≤ the 10k input
|
|
168
|
+
* cap, so a single worst-case pair is 10^8 cells ≈ a few hundred ms).
|
|
169
|
+
* 200M cells keeps the absolute worst case at low single-digit seconds on
|
|
170
|
+
* commodity hardware while covering thousands of realistic pairs (~2000
|
|
171
|
+
* pairs of 300×300-char bodies). Trade-off (same spirit as the input cap):
|
|
172
|
+
* once the budget is exhausted, remaining pairs are reported as
|
|
173
|
+
* not-similar (no rename) — renames can go undetected on pathological
|
|
174
|
+
* diffs, CPU is never unbounded. Overridable per call via
|
|
175
|
+
* `EntityDiffOptions.lcsDpCellBudget`.
|
|
176
|
+
*/
|
|
177
|
+
const DEFAULT_LCS_DP_CELL_BUDGET = 200_000_000;
|
|
178
|
+
/**
|
|
179
|
+
* Compute similarity ratio between two strings (0.0–1.0) as
|
|
180
|
+
* `LCS(a, b) / max(len(a), len(b))` — a real longest-common-subsequence
|
|
181
|
+
* ratio (CORE-M8; the previous implementation claimed LCS but compared
|
|
182
|
+
* characters at the same positions, so a one-char shift like "Xabcde" vs
|
|
183
|
+
* "abcde" scored near 0 instead of high).
|
|
184
|
+
*
|
|
185
|
+
* Classic two-row dynamic programming: O(n*m) time, O(min(n, m)) memory.
|
|
139
186
|
* Returns 1.0 for identical strings, 0.0 for completely different.
|
|
187
|
+
*
|
|
188
|
+
* Guards, in evaluation order (CORE-M8 fix-forward):
|
|
189
|
+
* 1. Identity fast-path on the ORIGINAL strings → exact 1.0 (never on the
|
|
190
|
+
* capped slices — equal capped prefixes of differing bodies are NOT 1.0).
|
|
191
|
+
* 2. Free prefilter: LCS(a, b) ≤ min(len(a), len(b), cap), so when that
|
|
192
|
+
* bound over `max(len)` is already below `threshold` the pair cannot
|
|
193
|
+
* match — skip the O(n*m) DP entirely. Returns 0.0; the caller only
|
|
194
|
+
* compares the result against `threshold`, so any sub-threshold value
|
|
195
|
+
* is equivalent (reported similarities of accepted matches are exact).
|
|
196
|
+
* 3. Capped-identity shortcut: equal capped prefixes have LCS exactly
|
|
197
|
+
* equal to the capped length — score `cap / max(original lens)` with
|
|
198
|
+
* no DP.
|
|
199
|
+
* 4. DP cell budget: each DP run consumes n*m cells from `budget`; a pair
|
|
200
|
+
* that would exceed what remains returns 0.0 (treated as not similar)
|
|
201
|
+
* instead of running.
|
|
140
202
|
*/
|
|
141
|
-
function computeSimilarity(a, b) {
|
|
203
|
+
function computeSimilarity(a, b, threshold, budget) {
|
|
142
204
|
if (a === b)
|
|
143
205
|
return 1.0;
|
|
144
206
|
if (a.length === 0 || b.length === 0)
|
|
145
207
|
return 0.0;
|
|
208
|
+
// Denominator over ORIGINAL lengths: a post-cap denominator let two >10k
|
|
209
|
+
// bodies with identical capped prefixes score a false 1.0.
|
|
146
210
|
const maxLen = Math.max(a.length, b.length);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
211
|
+
const lcsUpperBound = Math.min(a.length, b.length, MAX_SIMILARITY_INPUT_LENGTH);
|
|
212
|
+
if (lcsUpperBound / maxLen < threshold)
|
|
213
|
+
return 0.0;
|
|
214
|
+
const s = a.length > MAX_SIMILARITY_INPUT_LENGTH ? a.slice(0, MAX_SIMILARITY_INPUT_LENGTH) : a;
|
|
215
|
+
const t = b.length > MAX_SIMILARITY_INPUT_LENGTH ? b.slice(0, MAX_SIMILARITY_INPUT_LENGTH) : b;
|
|
216
|
+
if (s === t)
|
|
217
|
+
return s.length / maxLen;
|
|
218
|
+
const cells = s.length * t.length;
|
|
219
|
+
if (cells > budget.cellsRemaining)
|
|
220
|
+
return 0.0;
|
|
221
|
+
budget.cellsRemaining -= cells;
|
|
222
|
+
return lcsLength(s, t) / maxLen;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Length of the longest common subsequence of two strings.
|
|
226
|
+
* Two-row DP over the shorter string to keep memory at O(min(n, m)).
|
|
227
|
+
*/
|
|
228
|
+
function lcsLength(a, b) {
|
|
229
|
+
const longer = a.length >= b.length ? a : b;
|
|
230
|
+
const shorter = a.length >= b.length ? b : a;
|
|
231
|
+
const cols = shorter.length;
|
|
232
|
+
let prev = new Uint32Array(cols + 1);
|
|
233
|
+
let curr = new Uint32Array(cols + 1);
|
|
234
|
+
for (let i = 1; i <= longer.length; i++) {
|
|
235
|
+
const charCode = longer.charCodeAt(i - 1);
|
|
236
|
+
for (let j = 1; j <= cols; j++) {
|
|
237
|
+
if (charCode === shorter.charCodeAt(j - 1)) {
|
|
238
|
+
curr[j] = prev[j - 1] + 1;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
const fromTop = prev[j];
|
|
242
|
+
const fromLeft = curr[j - 1];
|
|
243
|
+
curr[j] = fromTop >= fromLeft ? fromTop : fromLeft;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const swap = prev;
|
|
247
|
+
prev = curr;
|
|
248
|
+
curr = swap;
|
|
157
249
|
}
|
|
158
|
-
return
|
|
250
|
+
return prev[cols];
|
|
159
251
|
}
|
|
160
252
|
/**
|
|
161
253
|
* Detect renamed entities by matching removed symbols with added symbols
|
|
@@ -170,6 +262,12 @@ function computeSimilarity(a, b) {
|
|
|
170
262
|
*/
|
|
171
263
|
export function detectRenames(removedSymbols, addedSymbols, oldSource, newSource, options) {
|
|
172
264
|
const threshold = options?.similarityThreshold ?? DEFAULT_SIMILARITY_THRESHOLD;
|
|
265
|
+
// Shared across ALL removed×added pairs of this call (CORE-M8 fix-forward):
|
|
266
|
+
// bounds total DP work so a pathological diff (many large bodies) degrades
|
|
267
|
+
// to missed renames instead of unbounded CPU.
|
|
268
|
+
const budget = {
|
|
269
|
+
cellsRemaining: options?.lcsDpCellBudget ?? DEFAULT_LCS_DP_CELL_BUDGET,
|
|
270
|
+
};
|
|
173
271
|
const renames = [];
|
|
174
272
|
const matchedAdded = new Set();
|
|
175
273
|
const oldLines = oldSource.split('\n');
|
|
@@ -193,7 +291,7 @@ export function detectRenames(removedSymbols, addedSymbols, oldSource, newSource
|
|
|
193
291
|
const newBody = normalizeBody(newLines.slice(newBodyStart, added.endLine).join('\n'));
|
|
194
292
|
if (newBody.length === 0)
|
|
195
293
|
continue;
|
|
196
|
-
const similarity = computeSimilarity(oldBody, newBody);
|
|
294
|
+
const similarity = computeSimilarity(oldBody, newBody, threshold, budget);
|
|
197
295
|
if (similarity >= threshold && (!bestMatch || similarity > bestMatch.similarity)) {
|
|
198
296
|
bestMatch = { index: i, similarity, symbol: added };
|
|
199
297
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-diff.js","sourceRoot":"","sources":["../../src/scope/entity-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"entity-diff.js","sourceRoot":"","sources":["../../src/scope/entity-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAQrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,iEAAiE;AAEjE,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEzC;;;GAGG;AACH,MAAM,sBAAsB,GAAa;IACvC,OAAO,EAAE,0BAA0B;IACnC,UAAU,EAAE,wCAAwC;IACpD,OAAO,EAAE,8BAA8B;IACvC,WAAW,EAAE,mDAAmD;IAChE,cAAc,EAAE,oBAAoB;IACpC,SAAS,EAAE,6BAA6B;IACxC,SAAS,EAAE,4CAA4C;CACxD,CAAC;AAEF,iEAAiE;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAAmB,EAAE,MAAkB;IAC5E,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,C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AAM,CAAC,IAAI;gBAC9B,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,MAAM,EAAE,SAAS,CAAC,MAAM;aACzB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iEAAiE;AAEjE;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAuB;IACxD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC"}
|
package/dist/scope/types.d.ts
CHANGED
|
@@ -74,6 +74,16 @@ export interface RenameMatch {
|
|
|
74
74
|
export interface EntityDiffOptions {
|
|
75
75
|
/** Minimum body similarity to consider a rename (0.0–1.0). Default: 0.9 */
|
|
76
76
|
similarityThreshold?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Total LCS dynamic-programming cell budget (n*m per compared pair of
|
|
79
|
+
* normalized bodies) for one `detectRenames` call. Once exhausted,
|
|
80
|
+
* remaining pairs are treated as not similar (no rename) instead of
|
|
81
|
+
* running the O(n*m) DP — bounds CPU on pathological diffs with many
|
|
82
|
+
* large removed/added bodies. Identity matches and pairs resolved by
|
|
83
|
+
* the cheap prefilter consume no budget. Default: 200_000_000
|
|
84
|
+
* (~low single-digit seconds worst case).
|
|
85
|
+
*/
|
|
86
|
+
lcsDpCellBudget?: number;
|
|
77
87
|
}
|
|
78
88
|
/** A file with its affected symbols and source content, ready for scoped review. */
|
|
79
89
|
export interface ScopedFile {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scope/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC;AAI1E,iDAAiD;AACjD,MAAM,MAAM,UAAU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