@aryam/fixmap-core 0.7.0 → 0.7.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/dist/browser.d.ts +4 -0
- package/dist/browser.js +6 -0
- package/dist/browser.js.map +1 -0
- package/dist/grounding.d.ts +15 -0
- package/dist/grounding.js +176 -0
- package/dist/grounding.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +13 -0
- package/dist/paths.js +88 -0
- package/dist/paths.js.map +1 -0
- package/dist/plan.js +94 -1
- package/dist/plan.js.map +1 -1
- package/dist/rank.js +159 -23
- package/dist/rank.js.map +1 -1
- package/dist/repo-scan.js +16 -14
- package/dist/repo-scan.js.map +1 -1
- package/dist/report.js +9 -0
- package/dist/report.js.map +1 -1
- package/dist/signals.d.ts +2 -0
- package/dist/signals.js +43 -9
- package/dist/signals.js.map +1 -1
- package/dist/types.d.ts +25 -1
- package/package.json +6 -1
package/dist/browser.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Browser-safe entrypoint: these modules are deterministic and do not access
|
|
2
|
+
// the filesystem, child processes, or other Node-only APIs.
|
|
3
|
+
export { rankContextFiles } from "./rank.js";
|
|
4
|
+
export { buildTestRoutes } from "./report.js";
|
|
5
|
+
export { tokenizePath, tokenizeText } from "./signals.js";
|
|
6
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RankedFile, RepoMap, TaskAnalysis } from "./types.js";
|
|
2
|
+
export type TaskGrounding = TaskAnalysis["grounding"];
|
|
3
|
+
export type RankingShape = TaskAnalysis["ranking"];
|
|
4
|
+
export declare function analyzeTaskGrounding(repo: RepoMap, input: {
|
|
5
|
+
issueText?: string | undefined;
|
|
6
|
+
diffText?: string | undefined;
|
|
7
|
+
}): TaskGrounding;
|
|
8
|
+
export declare function buildGroundedTaskTokens(grounding: TaskGrounding, input: {
|
|
9
|
+
issueText?: string | undefined;
|
|
10
|
+
diffText?: string | undefined;
|
|
11
|
+
changedFiles?: string[];
|
|
12
|
+
}): Set<string>;
|
|
13
|
+
export declare function buildRankingShape(contextFiles: RankedFile[]): RankingShape;
|
|
14
|
+
export declare function buildNextAction(grounding: TaskGrounding, ranking: RankingShape, contextFiles: RankedFile[]): string;
|
|
15
|
+
export declare function identifierTokens(identifier: string): Set<string>;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { extractTaskSignals, tokenizeText } from "./signals.js";
|
|
2
|
+
const MAX_IDENTIFIER_MATCHED_FILES = 5;
|
|
3
|
+
const VAGUE_TASK_PATTERN = /\b(?:improve|better|clean\s+up|cleanup|refactor|developer\s+experience|dx|general|overall|errors?|reliability|performance)\b/i;
|
|
4
|
+
export function analyzeTaskGrounding(repo, input) {
|
|
5
|
+
const issueText = input.issueText ?? "";
|
|
6
|
+
const signals = extractTaskSignals({
|
|
7
|
+
issueText,
|
|
8
|
+
diffText: input.diffText ?? "",
|
|
9
|
+
changedFiles: repo.changedFiles
|
|
10
|
+
});
|
|
11
|
+
const anchorIdentifiers = [...signals.identifiers]
|
|
12
|
+
.filter((identifier) => isAnchorIdentifier(identifier, issueText));
|
|
13
|
+
const identifiers = anchorIdentifiers.map((identifier) => groundIdentifier(repo, identifier));
|
|
14
|
+
const unresolvedIdentifiers = identifiers
|
|
15
|
+
.filter((entry) => entry.status === "not-found")
|
|
16
|
+
.map((entry) => entry.identifier);
|
|
17
|
+
const partiallyResolvedIdentifiers = identifiers
|
|
18
|
+
.filter((entry) => entry.status === "partial-definition")
|
|
19
|
+
.map((entry) => entry.identifier);
|
|
20
|
+
const unverifiedIdentifiers = identifiers
|
|
21
|
+
.filter((entry) => entry.status === "unverified")
|
|
22
|
+
.map((entry) => entry.identifier);
|
|
23
|
+
const resolvedIdentifierCount = identifiers.filter((entry) => entry.status === "exact-definition" || entry.status === "exact-text").length;
|
|
24
|
+
const hasMatchedFileMention = [...signals.fileMentions].some((mention) => repo.files.some((file) => pathMatchesMention(file.path, mention)));
|
|
25
|
+
const hasDirectAnchor = repo.changedFiles.length > 0 ||
|
|
26
|
+
hasMatchedFileMention ||
|
|
27
|
+
resolvedIdentifierCount > 0 ||
|
|
28
|
+
partiallyResolvedIdentifiers.length > 0;
|
|
29
|
+
const vague = !hasDirectAnchor && isVagueTask(issueText, signals.tokens.size);
|
|
30
|
+
return {
|
|
31
|
+
specificity: hasDirectAnchor ? "anchored" : vague ? "vague" : "descriptive",
|
|
32
|
+
identifiers,
|
|
33
|
+
unresolvedIdentifiers,
|
|
34
|
+
partiallyResolvedIdentifiers,
|
|
35
|
+
unverifiedIdentifiers,
|
|
36
|
+
scanComplete: !repo.diagnostics.some((diagnostic) => diagnostic.code === "scan-limit-reached")
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function buildGroundedTaskTokens(grounding, input) {
|
|
40
|
+
if (grounding.unresolvedIdentifiers.length === 0) {
|
|
41
|
+
return extractTaskSignals(input).tokens;
|
|
42
|
+
}
|
|
43
|
+
const sanitizedIssueText = removeIdentifiers(input.issueText ?? "", grounding.unresolvedIdentifiers);
|
|
44
|
+
const sanitizedDiffText = removeIdentifiers(input.diffText ?? "", grounding.unresolvedIdentifiers);
|
|
45
|
+
return extractTaskSignals({
|
|
46
|
+
...input,
|
|
47
|
+
issueText: sanitizedIssueText,
|
|
48
|
+
diffText: sanitizedDiffText
|
|
49
|
+
}).tokens;
|
|
50
|
+
}
|
|
51
|
+
export function buildRankingShape(contextFiles) {
|
|
52
|
+
const sortedScores = contextFiles
|
|
53
|
+
.map((file) => file.score)
|
|
54
|
+
.sort((a, b) => b - a);
|
|
55
|
+
const topScore = sortedScores[0] ?? null;
|
|
56
|
+
const runnerUpScore = sortedScores[1] ?? null;
|
|
57
|
+
const topGap = topScore === null || runnerUpScore === null
|
|
58
|
+
? null
|
|
59
|
+
: topScore - runnerUpScore;
|
|
60
|
+
const thirdScore = sortedScores[2];
|
|
61
|
+
const clustered = topScore !== null &&
|
|
62
|
+
thirdScore !== undefined &&
|
|
63
|
+
topScore - thirdScore <= 2;
|
|
64
|
+
return { topScore, runnerUpScore, topGap, clustered };
|
|
65
|
+
}
|
|
66
|
+
export function buildNextAction(grounding, ranking, contextFiles) {
|
|
67
|
+
if (grounding.unresolvedIdentifiers.length > 0) {
|
|
68
|
+
return "Verify or correct the unresolved identifiers before editing ranked files.";
|
|
69
|
+
}
|
|
70
|
+
if (grounding.unverifiedIdentifiers.length > 0) {
|
|
71
|
+
return "Narrow the repository or inspect large unread files before trusting identifier-based recommendations.";
|
|
72
|
+
}
|
|
73
|
+
if (grounding.partiallyResolvedIdentifiers.length > 0) {
|
|
74
|
+
return "Verify the partially matched symbol name in the leading file before editing.";
|
|
75
|
+
}
|
|
76
|
+
if (!grounding.scanComplete) {
|
|
77
|
+
return "Narrow the repository or package scope, then rerun FixMap before treating the ranking as complete.";
|
|
78
|
+
}
|
|
79
|
+
if (grounding.specificity === "vague") {
|
|
80
|
+
return "Add a concrete failing behavior, symbol, error string, command, or file path and rerun FixMap.";
|
|
81
|
+
}
|
|
82
|
+
if (ranking.clustered) {
|
|
83
|
+
return "Treat the leading files as a subsystem neighborhood and verify the exact edit point before changing code.";
|
|
84
|
+
}
|
|
85
|
+
if (contextFiles[0]) {
|
|
86
|
+
return `Inspect ${contextFiles[0].path} and its routed tests before editing.`;
|
|
87
|
+
}
|
|
88
|
+
return "Add a concrete repository anchor and rerun FixMap.";
|
|
89
|
+
}
|
|
90
|
+
function groundIdentifier(repo, identifier) {
|
|
91
|
+
const definitionPattern = new RegExp(`\\b(?:export\\s+)?(?:async\\s+)?(?:const|let|var|function|class|interface|type|enum|def|fn|struct|trait)\\s+${escapeRegExp(identifier)}\\b`);
|
|
92
|
+
const exactPattern = new RegExp(`(^|[^$A-Za-z0-9_])${escapeRegExp(identifier)}(?=$|[^$A-Za-z0-9_])`);
|
|
93
|
+
const definitionFiles = repo.files
|
|
94
|
+
.filter((file) => definitionPattern.test(file.textSample))
|
|
95
|
+
.map((file) => file.path)
|
|
96
|
+
.slice(0, MAX_IDENTIFIER_MATCHED_FILES);
|
|
97
|
+
if (definitionFiles.length > 0) {
|
|
98
|
+
return {
|
|
99
|
+
identifier,
|
|
100
|
+
status: "exact-definition",
|
|
101
|
+
matchedFiles: definitionFiles
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const textFiles = repo.files
|
|
105
|
+
.filter((file) => exactPattern.test(file.textSample))
|
|
106
|
+
.map((file) => file.path)
|
|
107
|
+
.slice(0, MAX_IDENTIFIER_MATCHED_FILES);
|
|
108
|
+
return textFiles.length > 0
|
|
109
|
+
? { identifier, status: "exact-text", matchedFiles: textFiles }
|
|
110
|
+
: groundPartialOrUnverifiedIdentifier(repo, identifier);
|
|
111
|
+
}
|
|
112
|
+
function groundPartialOrUnverifiedIdentifier(repo, identifier) {
|
|
113
|
+
const identifierParts = tokenizeText(identifier);
|
|
114
|
+
const partialFiles = repo.files
|
|
115
|
+
.filter((file) => hasDefinitionContainingTokens(file.textSample, identifierParts))
|
|
116
|
+
.map((file) => file.path)
|
|
117
|
+
.slice(0, MAX_IDENTIFIER_MATCHED_FILES);
|
|
118
|
+
if (identifierParts.size >= 2 && partialFiles.length > 0) {
|
|
119
|
+
return {
|
|
120
|
+
identifier,
|
|
121
|
+
status: "partial-definition",
|
|
122
|
+
matchedFiles: partialFiles
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (repo.files.some((file) => file.isSource && file.textSampleComplete === false)) {
|
|
126
|
+
return { identifier, status: "unverified", matchedFiles: [] };
|
|
127
|
+
}
|
|
128
|
+
return { identifier, status: "not-found", matchedFiles: [] };
|
|
129
|
+
}
|
|
130
|
+
function hasDefinitionContainingTokens(text, expectedTokens) {
|
|
131
|
+
if (expectedTokens.size < 2) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
const definitionPattern = /\b(?:export\s+)?(?:async\s+)?(?:const|let|var|function|class|interface|type|enum|def|fn|struct|trait)\s+([$A-Za-z_][$A-Za-z0-9_]*)\b/g;
|
|
135
|
+
for (const match of text.matchAll(definitionPattern)) {
|
|
136
|
+
const name = match[1];
|
|
137
|
+
if (!name) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const candidateTokens = tokenizeText(name);
|
|
141
|
+
if ([...expectedTokens].every((token) => candidateTokens.has(token))) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
function isAnchorIdentifier(identifier, issueText) {
|
|
148
|
+
if (new RegExp(`\`${escapeRegExp(identifier)}\``).test(issueText)) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (/[_$0-9]/.test(identifier)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
if (/^[a-z][A-Za-z0-9_$]*[A-Z]/.test(identifier)) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
return [...identifier].filter((character) => /[A-Z]/.test(character)).length >= 3;
|
|
158
|
+
}
|
|
159
|
+
function isVagueTask(issueText, tokenCount) {
|
|
160
|
+
return issueText.trim().length > 0 && tokenCount <= 5 && VAGUE_TASK_PATTERN.test(issueText);
|
|
161
|
+
}
|
|
162
|
+
function removeIdentifiers(text, identifiers) {
|
|
163
|
+
return identifiers.reduce((current, identifier) => current.replace(new RegExp(escapeRegExp(identifier), "g"), " "), text);
|
|
164
|
+
}
|
|
165
|
+
function pathMatchesMention(path, mention) {
|
|
166
|
+
return path === mention || path.endsWith(`/${mention}`) || mention.endsWith(`/${path}`);
|
|
167
|
+
}
|
|
168
|
+
function escapeRegExp(value) {
|
|
169
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
170
|
+
}
|
|
171
|
+
// Kept here instead of comparing raw identifier substrings so compound words from an
|
|
172
|
+
// invented symbol cannot silently become strong ranking evidence.
|
|
173
|
+
export function identifierTokens(identifier) {
|
|
174
|
+
return tokenizeText(identifier);
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=grounding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grounding.js","sourceRoot":"","sources":["../src/grounding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQhE,MAAM,4BAA4B,GAAG,CAAC,CAAC;AACvC,MAAM,kBAAkB,GACtB,+HAA+H,CAAC;AAKlI,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,KAAwE;IAExE,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,kBAAkB,CAAC;QACjC,SAAS;QACT,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE;QAC9B,YAAY,EAAE,IAAI,CAAC,YAAY;KAChC,CAAC,CAAC;IACH,MAAM,iBAAiB,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;SAC/C,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;IACrE,MAAM,WAAW,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;IAC9F,MAAM,qBAAqB,GAAG,WAAW;SACtC,MAAM,CAAC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,EAAE,OAAe;IACvD,OAAO,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,OAAO,EAAE,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC;AAED,qFAAqF;AACrF,kEAAkE;AAClE,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { buildFixMapReport } from "./plan.js";
|
|
2
|
+
export { analyzeTaskGrounding, buildGroundedTaskTokens, buildNextAction, buildRankingShape } from "./grounding.js";
|
|
2
3
|
export { buildImportGraph, findImportProximity } from "./import-graph.js";
|
|
3
4
|
export { rankContextFiles } from "./rank.js";
|
|
4
5
|
export { buildRiskNotes, buildSummary, buildTestRoutes, renderJsonReport, renderMarkdownReport } from "./report.js";
|
|
5
6
|
export { scanRepo } from "./repo-scan.js";
|
|
6
7
|
export { findGatedTestDiagnostics } from "./test-gates.js";
|
|
7
|
-
export type { FixMapInput, FixMapReport, PackageScript, RankedFile, RepoFile, RepoMap, RiskNote, ScanDiagnostic, TestRoute } from "./types.js";
|
|
8
|
+
export type { FixMapInput, FixMapReport, IdentifierGrounding, PackageScript, RankedFile, RepoFile, RepoMap, RiskNote, ScanDiagnostic, TaskAnalysis, TestRoute } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { buildFixMapReport } from "./plan.js";
|
|
2
|
+
export { analyzeTaskGrounding, buildGroundedTaskTokens, buildNextAction, buildRankingShape } from "./grounding.js";
|
|
2
3
|
export { buildImportGraph, findImportProximity } from "./import-graph.js";
|
|
3
4
|
export { rankContextFiles } from "./rank.js";
|
|
4
5
|
export { buildRiskNotes, buildSummary, buildTestRoutes, renderJsonReport, renderMarkdownReport } from "./report.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ALWAYS_IGNORED_DIRS: Set<string>;
|
|
2
|
+
export declare const GENERATED_DIRS: Set<string>;
|
|
3
|
+
/** True when the path sits inside a directory that normally holds generated or vendored output. */
|
|
4
|
+
export declare function isGeneratedPath(path: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* The path reduced to the module it names, with the extension, generated roots, and source
|
|
7
|
+
* roots removed. Two paths share a stem only when the whole remaining path matches, so
|
|
8
|
+
* `dist/color.js` pairs with `src/color.ts` while chalk's `source/vendor/supports-color/
|
|
9
|
+
* index.js` (stem `supports-color/index`) stays distinct from `source/index.js` (`index`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function moduleStem(path: string): string;
|
|
12
|
+
/** True when the path looks like a retired copy: a backup directory, or a tool-left duplicate filename. */
|
|
13
|
+
export declare function isBackupPath(path: string): boolean;
|
package/dist/paths.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Directories that never hold first-party source and can be large enough to exhaust the
|
|
2
|
+
// scan budget on their own. These are skipped in every scan mode.
|
|
3
|
+
export const ALWAYS_IGNORED_DIRS = new Set([".cache", ".git", ".venv", "node_modules"]);
|
|
4
|
+
// Conventionally generated output. `git ls-files --exclude-standard` already drops these
|
|
5
|
+
// through .gitignore, so a file git still reports from one of them was committed on
|
|
6
|
+
// purpose — chalk keeps its first-party color detection in `source/vendor/`. Those files
|
|
7
|
+
// are scanned and deprioritized rather than dropped. A plain directory walk has no
|
|
8
|
+
// .gitignore to consult, so it still skips them outright.
|
|
9
|
+
export const GENERATED_DIRS = new Set([
|
|
10
|
+
".idea",
|
|
11
|
+
".netlify",
|
|
12
|
+
".next",
|
|
13
|
+
".nuxt",
|
|
14
|
+
".output",
|
|
15
|
+
".turbo",
|
|
16
|
+
".vercel",
|
|
17
|
+
".vscode",
|
|
18
|
+
"build",
|
|
19
|
+
"coverage",
|
|
20
|
+
"dist",
|
|
21
|
+
"target",
|
|
22
|
+
"vendor"
|
|
23
|
+
]);
|
|
24
|
+
// Words that mark a directory as a retired copy rather than maintained source. Matched
|
|
25
|
+
// per word inside a path segment, so "untracked quarantine" and "src/legacy" both count
|
|
26
|
+
// while "archiver" and "bold" do not.
|
|
27
|
+
const BACKUP_SEGMENT_WORDS = new Set([
|
|
28
|
+
"archive",
|
|
29
|
+
"archived",
|
|
30
|
+
"archives",
|
|
31
|
+
"backup",
|
|
32
|
+
"backups",
|
|
33
|
+
"bak",
|
|
34
|
+
"deprecated",
|
|
35
|
+
"legacy",
|
|
36
|
+
"old",
|
|
37
|
+
"quarantine"
|
|
38
|
+
]);
|
|
39
|
+
// Filenames editors, patch tools, and file-sync clients leave beside the real file.
|
|
40
|
+
const BACKUP_FILE_PATTERNS = [
|
|
41
|
+
/\.(?:bak|orig|rej|old|save|swp)$/i,
|
|
42
|
+
/~$/,
|
|
43
|
+
/\bconflicted copy\b/i,
|
|
44
|
+
/\bconflict(?:ed)?[-_ ]copy\b/i,
|
|
45
|
+
/[-_ ]copy(?:\s*\(\d+\))?\.[^.]+$/i,
|
|
46
|
+
/\s\(\d+\)\.[^.]+$/
|
|
47
|
+
];
|
|
48
|
+
function segmentWords(segment) {
|
|
49
|
+
return segment.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
50
|
+
}
|
|
51
|
+
function directorySegments(path) {
|
|
52
|
+
return path.split("/").slice(0, -1);
|
|
53
|
+
}
|
|
54
|
+
/** True when the path sits inside a directory that normally holds generated or vendored output. */
|
|
55
|
+
export function isGeneratedPath(path) {
|
|
56
|
+
return directorySegments(path).some((segment) => GENERATED_DIRS.has(segment.toLowerCase()));
|
|
57
|
+
}
|
|
58
|
+
// Conventional source roots. Stripping these alongside the generated roots lets a build
|
|
59
|
+
// artifact line up with the file it was produced from: `packages/action/dist/index.mjs`
|
|
60
|
+
// and `packages/action/src/index.ts` both reduce to `packages/action/index`.
|
|
61
|
+
const SOURCE_ROOT_DIRS = new Set(["lib", "source", "src"]);
|
|
62
|
+
/**
|
|
63
|
+
* The path reduced to the module it names, with the extension, generated roots, and source
|
|
64
|
+
* roots removed. Two paths share a stem only when the whole remaining path matches, so
|
|
65
|
+
* `dist/color.js` pairs with `src/color.ts` while chalk's `source/vendor/supports-color/
|
|
66
|
+
* index.js` (stem `supports-color/index`) stays distinct from `source/index.js` (`index`).
|
|
67
|
+
*/
|
|
68
|
+
export function moduleStem(path) {
|
|
69
|
+
return path
|
|
70
|
+
.replace(/\.[^./]+$/, "")
|
|
71
|
+
.split("/")
|
|
72
|
+
.filter((segment) => {
|
|
73
|
+
const normalized = segment.toLowerCase();
|
|
74
|
+
return !GENERATED_DIRS.has(normalized) && !SOURCE_ROOT_DIRS.has(normalized);
|
|
75
|
+
})
|
|
76
|
+
.join("/");
|
|
77
|
+
}
|
|
78
|
+
/** True when the path looks like a retired copy: a backup directory, or a tool-left duplicate filename. */
|
|
79
|
+
export function isBackupPath(path) {
|
|
80
|
+
const inBackupDirectory = directorySegments(path)
|
|
81
|
+
.some((segment) => segmentWords(segment).some((word) => BACKUP_SEGMENT_WORDS.has(word)));
|
|
82
|
+
if (inBackupDirectory) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
const fileName = path.split("/").pop() ?? "";
|
|
86
|
+
return BACKUP_FILE_PATTERNS.some((pattern) => pattern.test(fileName));
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,kEAAkE;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;AAExF,yFAAyF;AACzF,oFAAoF;AACpF,yFAAyF;AACzF,mFAAmF;AACnF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IACpC,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,SAAS;IACT,QA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AAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACzC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC9E,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,IAAI,CAAC;SAC9C,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3F,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAC7C,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
package/dist/plan.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
import { analyzeTaskGrounding, buildNextAction, buildRankingShape } from "./grounding.js";
|
|
1
2
|
import { rankContextFiles } from "./rank.js";
|
|
2
3
|
import { buildRiskNotes, buildSummary, buildTestRoutes } from "./report.js";
|
|
3
4
|
import { scanRepo } from "./repo-scan.js";
|
|
5
|
+
import { extractTaskSignals } from "./signals.js";
|
|
4
6
|
import { findGatedTestDiagnostics } from "./test-gates.js";
|
|
7
|
+
const MAX_REPORTED_TERMS = 8;
|
|
5
8
|
export async function buildFixMapReport(input) {
|
|
6
9
|
const repo = await scanRepo(input);
|
|
7
10
|
const contextFiles = rankContextFiles(repo, {
|
|
8
11
|
issueText: input.issueText,
|
|
9
12
|
diffText: repo.diffText
|
|
10
13
|
});
|
|
14
|
+
const grounding = analyzeTaskGrounding(repo, {
|
|
15
|
+
issueText: input.issueText,
|
|
16
|
+
diffText: repo.diffText
|
|
17
|
+
});
|
|
18
|
+
const ranking = buildRankingShape(contextFiles);
|
|
11
19
|
const contextPaths = contextFiles.map((file) => file.path);
|
|
12
20
|
const testRoutes = buildTestRoutes(repo, contextPaths);
|
|
13
21
|
const routedTestPaths = [...new Set(testRoutes.flatMap((route) => route.relatedFiles))];
|
|
@@ -17,7 +25,92 @@ export async function buildFixMapReport(input) {
|
|
|
17
25
|
testRoutes,
|
|
18
26
|
risks: buildRiskNotes(contextPaths, repo.changedFiles),
|
|
19
27
|
changedFiles: repo.changedFiles,
|
|
20
|
-
diagnostics: [
|
|
28
|
+
diagnostics: [
|
|
29
|
+
...repo.diagnostics,
|
|
30
|
+
...findGatedTestDiagnostics(repo.files, routedTestPaths),
|
|
31
|
+
...findTaskDiagnostics(grounding, ranking),
|
|
32
|
+
...findEmptyResultDiagnostics(repo, contextFiles, input.issueText ?? "")
|
|
33
|
+
],
|
|
34
|
+
analysis: {
|
|
35
|
+
grounding,
|
|
36
|
+
ranking,
|
|
37
|
+
nextAction: buildNextAction(grounding, ranking, contextFiles)
|
|
38
|
+
}
|
|
21
39
|
};
|
|
22
40
|
}
|
|
41
|
+
function findTaskDiagnostics(grounding, ranking) {
|
|
42
|
+
const diagnostics = [];
|
|
43
|
+
if (grounding.unresolvedIdentifiers.length > 0) {
|
|
44
|
+
diagnostics.push({
|
|
45
|
+
code: "unresolved-identifier",
|
|
46
|
+
severity: "warning",
|
|
47
|
+
message: `Identifier${grounding.unresolvedIdentifiers.length === 1 ? "" : "s"} not found exactly in the scanned repository: ` +
|
|
48
|
+
`${grounding.unresolvedIdentifiers.join(", ")}. Component words from unresolved identifiers were ignored, ` +
|
|
49
|
+
"and unsupported recommendations were capped at low confidence."
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (grounding.partiallyResolvedIdentifiers.length > 0) {
|
|
53
|
+
diagnostics.push({
|
|
54
|
+
code: "partially-resolved-identifier",
|
|
55
|
+
severity: "info",
|
|
56
|
+
message: `Identifier${grounding.partiallyResolvedIdentifiers.length === 1 ? "" : "s"} matched a longer repository symbol by component terms: ` +
|
|
57
|
+
`${grounding.partiallyResolvedIdentifiers.join(", ")}. The component terms were retained, but confidence was capped at medium.`
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (grounding.unverifiedIdentifiers.length > 0) {
|
|
61
|
+
diagnostics.push({
|
|
62
|
+
code: "identifier-unverified",
|
|
63
|
+
severity: "warning",
|
|
64
|
+
message: `Identifier${grounding.unverifiedIdentifiers.length === 1 ? "" : "s"} could not be verified because one or more source files exceeded the text-sampling limit: ` +
|
|
65
|
+
`${grounding.unverifiedIdentifiers.join(", ")}. FixMap did not claim that the identifier was absent, and confidence was capped at low without another anchor.`
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (grounding.specificity === "vague") {
|
|
69
|
+
diagnostics.push({
|
|
70
|
+
code: "vague-task",
|
|
71
|
+
severity: "warning",
|
|
72
|
+
message: "The task is broad and has no verified symbol, file, or diff anchor. Treat the ranking as subsystem guidance only, " +
|
|
73
|
+
"or add a failing behavior, error string, command, symbol, or file path."
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (ranking.clustered && grounding.specificity !== "anchored") {
|
|
77
|
+
diagnostics.push({
|
|
78
|
+
code: "flat-ranking",
|
|
79
|
+
severity: "warning",
|
|
80
|
+
message: "The leading files have tightly clustered scores, so FixMap cannot identify a decisive edit point. " +
|
|
81
|
+
"Use them as a starting neighborhood and verify the exact file before editing."
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return diagnostics;
|
|
85
|
+
}
|
|
86
|
+
// An empty report is the one result that explains nothing on its own. Say whether the task
|
|
87
|
+
// text carried no searchable terms or whether the terms simply matched no file, so the
|
|
88
|
+
// reader knows which end to fix.
|
|
89
|
+
function findEmptyResultDiagnostics(repo, contextFiles, issueText) {
|
|
90
|
+
if (contextFiles.length > 0 || repo.files.length === 0) {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
const signals = extractTaskSignals({
|
|
94
|
+
issueText,
|
|
95
|
+
diffText: repo.diffText,
|
|
96
|
+
changedFiles: repo.changedFiles
|
|
97
|
+
});
|
|
98
|
+
const terms = [...signals.tokens].sort();
|
|
99
|
+
if (terms.length === 0 && signals.identifiers.size === 0 && signals.fileMentions.size === 0) {
|
|
100
|
+
return [{
|
|
101
|
+
code: "no-task-terms",
|
|
102
|
+
severity: "warning",
|
|
103
|
+
message: "No context files: the task text contained no searchable term. Every word was a common word, " +
|
|
104
|
+
"a language keyword, or shorter than three characters. Name the failing behavior, a symbol, or a file path."
|
|
105
|
+
}];
|
|
106
|
+
}
|
|
107
|
+
const preview = terms.slice(0, MAX_REPORTED_TERMS).join(", ");
|
|
108
|
+
const remainder = terms.length > MAX_REPORTED_TERMS ? ` (+${terms.length - MAX_REPORTED_TERMS} more)` : "";
|
|
109
|
+
return [{
|
|
110
|
+
code: "no-context-match",
|
|
111
|
+
severity: "warning",
|
|
112
|
+
message: `No context files: no file in the ${repo.files.length} scanned matched the task terms ${preview}${remainder}. ` +
|
|
113
|
+
"The repository may not contain this behavior, or it may name it differently."
|
|
114
|
+
}];
|
|
115
|
+
}
|
|
23
116
|
//# sourceMappingURL=plan.js.map
|
package/dist/plan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;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