@aryam/fixmap-core 0.7.0 → 0.7.2

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.
@@ -0,0 +1,4 @@
1
+ export { rankContextFiles } from "./rank.js";
2
+ export { buildTestRoutes } from "./report.js";
3
+ export { tokenizePath, tokenizeText } from "./signals.js";
4
+ export type { RankedFile, RepoFile, RepoMap, TestRoute } from "./types.js";
@@ -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 } from "./types.js";
2
+ export type FileExplanation = {
3
+ path: string;
4
+ status: "ranked" | "below-cutoff" | "excluded" | "not-scanned";
5
+ rank?: number;
6
+ score?: number;
7
+ confidence?: RankedFile["confidence"];
8
+ cutoff?: number;
9
+ reasons: string[];
10
+ summary: string;
11
+ };
12
+ export declare function explainFile(repo: RepoMap, input: {
13
+ issueText?: string | undefined;
14
+ diffText?: string | undefined;
15
+ }, targetPath: string): FileExplanation;
@@ -0,0 +1,101 @@
1
+ // Answers the question a ranked list cannot: "why isn't my file in there?"
2
+ //
3
+ // A report explains the files it chose. The harder and more common question is about a
4
+ // file it left out — and until now the only answer available was silence, which reads
5
+ // like the tool has nothing to say for itself. Every branch below reports a specific,
6
+ // checkable cause rather than a score.
7
+ import { isBackupPath, isGeneratedPath, moduleStem } from "./paths.js";
8
+ import { REPORT_SCORE_CUTOFF, rankContextFiles } from "./rank.js";
9
+ import { extractFileMentions } from "./signals.js";
10
+ export function explainFile(repo, input, targetPath) {
11
+ const path = targetPath.replace(/\\/g, "/").replace(/^\.\//, "");
12
+ const reported = rankContextFiles(repo, input);
13
+ const position = reported.findIndex((file) => file.path === path);
14
+ if (position !== -1) {
15
+ const file = reported[position];
16
+ return {
17
+ path,
18
+ status: "ranked",
19
+ rank: position + 1,
20
+ score: file.score,
21
+ confidence: file.confidence,
22
+ reasons: file.reasons,
23
+ summary: `Ranked ${position + 1} of ${reported.length} at ${file.confidence} confidence, score ${file.score}.`
24
+ };
25
+ }
26
+ const exclusion = describeExclusion(repo, input, path);
27
+ if (exclusion) {
28
+ return { path, status: exclusion.status, reasons: [], summary: exclusion.summary };
29
+ }
30
+ // The file was a candidate and simply did not score highly enough. Report the score it
31
+ // did earn and what it earned it for, which is the only actionable form of this answer.
32
+ const everything = rankContextFiles(repo, input, Number.MAX_SAFE_INTEGER, Number.NEGATIVE_INFINITY);
33
+ const scored = everything.find((file) => file.path === path);
34
+ const lowestReported = reported[reported.length - 1]?.score;
35
+ return {
36
+ path,
37
+ status: "below-cutoff",
38
+ score: scored?.score ?? 0,
39
+ cutoff: lowestReported ?? REPORT_SCORE_CUTOFF,
40
+ reasons: scored?.reasons ?? [],
41
+ summary: `Scored ${scored?.score ?? 0}, below the ${reported.length > 0 ? `lowest reported score of ${lowestReported}` : `reporting cutoff of ${REPORT_SCORE_CUTOFF}`}. ` +
42
+ "Name a symbol, error string, or path from this file in the task to raise it."
43
+ };
44
+ }
45
+ // Mirrors the candidate filter in rankContextFiles. `explain.test.ts` asserts the two
46
+ // agree on every file in a fixture, so this cannot drift silently.
47
+ function describeExclusion(repo, input, path) {
48
+ const file = repo.files.find((entry) => entry.path === path);
49
+ if (!file) {
50
+ const truncated = repo.diagnostics.some((diagnostic) => diagnostic.code === "scan-limit-reached");
51
+ return {
52
+ status: "not-scanned",
53
+ summary: truncated
54
+ ? "Not scanned: the scan reached its file limit before this path. Point FixMap at a narrower directory."
55
+ : "Not scanned: no such path in this repository, or it is ignored by .gitignore."
56
+ };
57
+ }
58
+ const mentioned = [...extractFileMentions(input.issueText ?? "")]
59
+ .some((mention) => path === mention || path.endsWith(`/${mention}`) || mention.endsWith(`/${path}`));
60
+ if (mentioned) {
61
+ return null;
62
+ }
63
+ if (file.isTest) {
64
+ return {
65
+ status: "excluded",
66
+ summary: "Excluded: test files are routed as test commands rather than ranked as edit targets."
67
+ };
68
+ }
69
+ if (!file.isSource) {
70
+ return {
71
+ status: "excluded",
72
+ summary: `Excluded: ${file.extension || "this file type"} is outside the scanned source extensions.`
73
+ };
74
+ }
75
+ if (LOCKFILES.has(path.split("/").pop() ?? "")) {
76
+ return { status: "excluded", summary: "Excluded: lockfiles are never edit targets." };
77
+ }
78
+ if (path.startsWith("benchmarks/")) {
79
+ return {
80
+ status: "excluded",
81
+ summary: "Excluded: benchmark fixtures are ranked only when the task is about evaluation."
82
+ };
83
+ }
84
+ if (isGeneratedPath(path) && !repo.changedFiles.includes(path)) {
85
+ const stem = moduleStem(path);
86
+ const counterpart = repo.files.find((entry) => entry.path !== path &&
87
+ entry.isSource &&
88
+ !isGeneratedPath(entry.path) &&
89
+ !isBackupPath(entry.path) &&
90
+ moduleStem(entry.path) === stem);
91
+ if (counterpart) {
92
+ return {
93
+ status: "excluded",
94
+ summary: `Excluded: generated output for ${counterpart.path}, which the next build overwrites. That file was ranked instead.`
95
+ };
96
+ }
97
+ }
98
+ return null;
99
+ }
100
+ const LOCKFILES = new Set(["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lock"]);
101
+ //# sourceMappingURL=explain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explain.js","sourceRoot":"","sources":["../src/explain.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E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,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC5C,KAAK,CAAC,IAAI,KAAK,IAAI;YACnB,KAAK,CAAC,QAAQ;YACd,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC;YAC5B,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;YACzB,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAChC,CAAC;QACF,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,kCAAkC,WAAW,CAAC,IAAI,kEAAkE;aAC9H,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,CAAC,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,190 @@
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
+ // Same vocabulary, global, for stripping rather than detecting. A `g` regex carries
5
+ // lastIndex between calls, so detection keeps its own non-global copy.
6
+ const VAGUE_TASK_TERMS = new RegExp(VAGUE_TASK_PATTERN.source, "gi");
7
+ export function analyzeTaskGrounding(repo, input) {
8
+ const issueText = input.issueText ?? "";
9
+ const signals = extractTaskSignals({
10
+ issueText,
11
+ diffText: input.diffText ?? "",
12
+ changedFiles: repo.changedFiles
13
+ });
14
+ const anchorIdentifiers = [...signals.identifiers]
15
+ .filter((identifier) => isAnchorIdentifier(identifier, issueText));
16
+ const identifiers = anchorIdentifiers.map((identifier) => groundIdentifier(repo, identifier));
17
+ const unresolvedIdentifiers = identifiers
18
+ .filter((entry) => entry.status === "not-found")
19
+ .map((entry) => entry.identifier);
20
+ const partiallyResolvedIdentifiers = identifiers
21
+ .filter((entry) => entry.status === "partial-definition")
22
+ .map((entry) => entry.identifier);
23
+ const unverifiedIdentifiers = identifiers
24
+ .filter((entry) => entry.status === "unverified")
25
+ .map((entry) => entry.identifier);
26
+ const resolvedIdentifierCount = identifiers.filter((entry) => entry.status === "exact-definition" || entry.status === "exact-text").length;
27
+ const hasMatchedFileMention = [...signals.fileMentions].some((mention) => repo.files.some((file) => pathMatchesMention(file.path, mention)));
28
+ const hasDirectAnchor = repo.changedFiles.length > 0 ||
29
+ hasMatchedFileMention ||
30
+ resolvedIdentifierCount > 0 ||
31
+ partiallyResolvedIdentifiers.length > 0;
32
+ const vague = !hasDirectAnchor && isVagueTask(issueText);
33
+ return {
34
+ specificity: hasDirectAnchor ? "anchored" : vague ? "vague" : "descriptive",
35
+ identifiers,
36
+ unresolvedIdentifiers,
37
+ partiallyResolvedIdentifiers,
38
+ unverifiedIdentifiers,
39
+ scanComplete: !repo.diagnostics.some((diagnostic) => diagnostic.code === "scan-limit-reached")
40
+ };
41
+ }
42
+ export function buildGroundedTaskTokens(grounding, input) {
43
+ if (grounding.unresolvedIdentifiers.length === 0) {
44
+ return extractTaskSignals(input).tokens;
45
+ }
46
+ const sanitizedIssueText = removeIdentifiers(input.issueText ?? "", grounding.unresolvedIdentifiers);
47
+ const sanitizedDiffText = removeIdentifiers(input.diffText ?? "", grounding.unresolvedIdentifiers);
48
+ return extractTaskSignals({
49
+ ...input,
50
+ issueText: sanitizedIssueText,
51
+ diffText: sanitizedDiffText
52
+ }).tokens;
53
+ }
54
+ export function buildRankingShape(contextFiles) {
55
+ const sortedScores = contextFiles
56
+ .map((file) => file.score)
57
+ .sort((a, b) => b - a);
58
+ const topScore = sortedScores[0] ?? null;
59
+ const runnerUpScore = sortedScores[1] ?? null;
60
+ const topGap = topScore === null || runnerUpScore === null
61
+ ? null
62
+ : topScore - runnerUpScore;
63
+ const thirdScore = sortedScores[2];
64
+ const clustered = topScore !== null &&
65
+ thirdScore !== undefined &&
66
+ topScore - thirdScore <= 2;
67
+ return { topScore, runnerUpScore, topGap, clustered };
68
+ }
69
+ export function buildNextAction(grounding, ranking, contextFiles) {
70
+ if (grounding.unresolvedIdentifiers.length > 0) {
71
+ return "Verify or correct the unresolved identifiers before editing ranked files.";
72
+ }
73
+ if (grounding.unverifiedIdentifiers.length > 0) {
74
+ return "Narrow the repository or inspect large unread files before trusting identifier-based recommendations.";
75
+ }
76
+ if (grounding.partiallyResolvedIdentifiers.length > 0) {
77
+ return "Verify the partially matched symbol name in the leading file before editing.";
78
+ }
79
+ if (!grounding.scanComplete) {
80
+ return "Narrow the repository or package scope, then rerun FixMap before treating the ranking as complete.";
81
+ }
82
+ if (grounding.specificity === "vague") {
83
+ return "Add a concrete failing behavior, symbol, error string, command, or file path and rerun FixMap.";
84
+ }
85
+ if (ranking.clustered) {
86
+ return "Treat the leading files as a subsystem neighborhood and verify the exact edit point before changing code.";
87
+ }
88
+ if (contextFiles[0]) {
89
+ return `Inspect ${contextFiles[0].path} and its routed tests before editing.`;
90
+ }
91
+ return "Add a concrete repository anchor and rerun FixMap.";
92
+ }
93
+ function groundIdentifier(repo, identifier) {
94
+ 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`);
95
+ const exactPattern = new RegExp(`(^|[^$A-Za-z0-9_])${escapeRegExp(identifier)}(?=$|[^$A-Za-z0-9_])`);
96
+ const definitionFiles = repo.files
97
+ .filter((file) => definitionPattern.test(file.textSample))
98
+ .map((file) => file.path)
99
+ .slice(0, MAX_IDENTIFIER_MATCHED_FILES);
100
+ if (definitionFiles.length > 0) {
101
+ return {
102
+ identifier,
103
+ status: "exact-definition",
104
+ matchedFiles: definitionFiles
105
+ };
106
+ }
107
+ const textFiles = repo.files
108
+ .filter((file) => exactPattern.test(file.textSample))
109
+ .map((file) => file.path)
110
+ .slice(0, MAX_IDENTIFIER_MATCHED_FILES);
111
+ return textFiles.length > 0
112
+ ? { identifier, status: "exact-text", matchedFiles: textFiles }
113
+ : groundPartialOrUnverifiedIdentifier(repo, identifier);
114
+ }
115
+ function groundPartialOrUnverifiedIdentifier(repo, identifier) {
116
+ const identifierParts = tokenizeText(identifier);
117
+ const partialFiles = repo.files
118
+ .filter((file) => hasDefinitionContainingTokens(file.textSample, identifierParts))
119
+ .map((file) => file.path)
120
+ .slice(0, MAX_IDENTIFIER_MATCHED_FILES);
121
+ if (identifierParts.size >= 2 && partialFiles.length > 0) {
122
+ return {
123
+ identifier,
124
+ status: "partial-definition",
125
+ matchedFiles: partialFiles
126
+ };
127
+ }
128
+ if (repo.files.some((file) => file.isSource && file.textSampleComplete === false)) {
129
+ return { identifier, status: "unverified", matchedFiles: [] };
130
+ }
131
+ return { identifier, status: "not-found", matchedFiles: [] };
132
+ }
133
+ function hasDefinitionContainingTokens(text, expectedTokens) {
134
+ if (expectedTokens.size < 2) {
135
+ return false;
136
+ }
137
+ 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;
138
+ for (const match of text.matchAll(definitionPattern)) {
139
+ const name = match[1];
140
+ if (!name) {
141
+ continue;
142
+ }
143
+ const candidateTokens = tokenizeText(name);
144
+ if ([...expectedTokens].every((token) => candidateTokens.has(token))) {
145
+ return true;
146
+ }
147
+ }
148
+ return false;
149
+ }
150
+ function isAnchorIdentifier(identifier, issueText) {
151
+ if (new RegExp(`\`${escapeRegExp(identifier)}\``).test(issueText)) {
152
+ return true;
153
+ }
154
+ if (/[_$0-9]/.test(identifier)) {
155
+ return true;
156
+ }
157
+ if (/^[a-z][A-Za-z0-9_$]*[A-Z]/.test(identifier)) {
158
+ return true;
159
+ }
160
+ return [...identifier].filter((character) => /[A-Z]/.test(character)).length >= 3;
161
+ }
162
+ // Vagueness is not shortness. "clean this up and make the general performance
163
+ // better overall" is longer than "improve DX" and just as unroutable, because
164
+ // nothing is left once the generic-improvement vocabulary is removed. Counting
165
+ // what survives that removal also keeps a concrete request that merely asks for
166
+ // an improvement — "improve the retry backoff so a 503 stops hammering the
167
+ // upstream host" — out of the vague bucket.
168
+ const MAX_RESIDUAL_TOKENS_FOR_VAGUE = 3;
169
+ function isVagueTask(issueText) {
170
+ if (issueText.trim().length === 0 || !VAGUE_TASK_PATTERN.test(issueText)) {
171
+ return false;
172
+ }
173
+ const residual = tokenizeText(issueText.replace(VAGUE_TASK_TERMS, " "));
174
+ return residual.size <= MAX_RESIDUAL_TOKENS_FOR_VAGUE;
175
+ }
176
+ function removeIdentifiers(text, identifiers) {
177
+ return identifiers.reduce((current, identifier) => current.replace(new RegExp(escapeRegExp(identifier), "g"), " "), text);
178
+ }
179
+ function pathMatchesMention(path, mention) {
180
+ return path === mention || path.endsWith(`/${mention}`) || mention.endsWith(`/${path}`);
181
+ }
182
+ function escapeRegExp(value) {
183
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
184
+ }
185
+ // Kept here instead of comparing raw identifier substrings so compound words from an
186
+ // invented symbol cannot silently become strong ranking evidence.
187
+ export function identifierTokens(identifier) {
188
+ return tokenizeText(identifier);
189
+ }
190
+ //# 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;AAClI,oFAAoF;AACpF,uEAAuE;AACvE,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAKrE,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,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC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U,EAAE,EAAE,CACtB,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EACjE,IAAI,CACL,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY,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,10 @@
1
1
  export { buildFixMapReport } from "./plan.js";
2
+ export { explainFile } from "./explain.js";
3
+ export type { FileExplanation } from "./explain.js";
4
+ export { analyzeTaskGrounding, buildGroundedTaskTokens, buildNextAction, buildRankingShape } from "./grounding.js";
2
5
  export { buildImportGraph, findImportProximity } from "./import-graph.js";
3
6
  export { rankContextFiles } from "./rank.js";
4
7
  export { buildRiskNotes, buildSummary, buildTestRoutes, renderJsonReport, renderMarkdownReport } from "./report.js";
5
8
  export { scanRepo } from "./repo-scan.js";
6
9
  export { findGatedTestDiagnostics } from "./test-gates.js";
7
- export type { FixMapInput, FixMapReport, PackageScript, RankedFile, RepoFile, RepoMap, RiskNote, ScanDiagnostic, TestRoute } from "./types.js";
10
+ export type { FixMapInput, FixMapReport, IdentifierGrounding, PackageScript, RankedFile, RepoFile, RepoMap, RiskNote, ScanDiagnostic, TaskAnalysis, TestRoute } from "./types.js";
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export { buildFixMapReport } from "./plan.js";
2
+ export { explainFile } from "./explain.js";
3
+ export { analyzeTaskGrounding, buildGroundedTaskTokens, buildNextAction, buildRankingShape } from "./grounding.js";
2
4
  export { buildImportGraph, findImportProximity } from "./import-graph.js";
3
5
  export { rankContextFiles } from "./rank.js";
4
6
  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,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,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"}
@@ -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,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OAAO;IACP,UAAU;IACV,MAAM;IACN,QAAQ;IACR,QAAQ;CACT,CAAC,CAAC;AAEH,uFAAuF;AACvF,wFAAwF;AACxF,sCAAsC;AACtC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,SAAS;IACT,UAAU;IACV,UAAU;IACV,QAAQ;IACR,SAAS;IACT,KAAK;IACL,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,YAAY;CACb,CAAC,CAAC;AAEH,oFAAoF;AACpF,MAAM,oBAAoB,GAAG;IAC3B,mCAAmC;IACnC,IAAI;IACJ,sBAAsB;IACtB,+BAA+B;IAC/B,mCAAmC;IACnC,mBAAmB;CACpB,CAAC;AAEF,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC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B,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: [...repo.diagnostics, ...findGatedTestDiagnostics(repo.files, routedTestPaths)]
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;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,MAAM,CAAC,KAAK,UAAU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AEzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC5F,OAAO,CAAC;gBACN,IAAI,EAAE,eAAe;gBACrB,QAAQ,EAAE,SAAS;gBACnB,OAAO,EACL,8FAA8F;oBAC9F,4GAA4G;aAC/G,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,GAAG,kBAAkB,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3G,OAAO,CAAC;YACN,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,SAAS;YACnB,OAAO,EACL,oCAAoC,IAAI,CAAC,KAAK,CAAC,MAAM,mCAAmC,OAAO,GAAG,SAAS,IAAI;gBAC/G,8EAA8E;SACjF,CAAC,CAAC;AACL,CAAC"}
package/dist/rank.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { RankedFile, RepoMap } from "./types.js";
2
+ export declare const REPORT_SCORE_CUTOFF = 4;
2
3
  export declare function rankContextFiles(repo: RepoMap, input: {
3
4
  issueText?: string | undefined;
4
5
  diffText?: string | undefined;
5
- }, limit?: number): RankedFile[];
6
+ }, limit?: number, minScore?: number): RankedFile[];