@aryam/fixmap 0.8.8 → 0.9.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.
@@ -0,0 +1,308 @@
1
+ import { execFile } from "node:child_process";
2
+ import { mkdir, mkdtemp, rm } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { basename, join, resolve } from "node:path";
5
+ import { promisify } from "node:util";
6
+ import { buildReportFromRepo, isBackupPath, isGeneratedPath, moduleStem, rankByBm25, retrievalQueryTerms, scanRepo, taskMentionsExpectedPath } from "@aryam/fixmap-core";
7
+ const exec = promisify(execFile);
8
+ const MAX_CHANGED_FILES = 30;
9
+ const MAX_BENCHMARK_CASES = 100;
10
+ const MAX_TASK_CHARS = 20_000;
11
+ const GIT_BUFFER = 24 * 1024 * 1024;
12
+ export async function benchmarkRepository(input) {
13
+ const repoRoot = resolve(input.repoRoot);
14
+ const requested = input.last ?? 20;
15
+ if (!Number.isSafeInteger(requested) || requested < 1 || requested > MAX_BENCHMARK_CASES) {
16
+ throw new Error(`--last must be a whole number from 1 to ${MAX_BENCHMARK_CASES}.`);
17
+ }
18
+ await assertGitRepository(repoRoot);
19
+ const checkoutConfig = await safeCheckoutConfig(repoRoot);
20
+ const candidates = await listCandidateCommits(repoRoot, Math.min(MAX_BENCHMARK_CASES * 5, requested * 5));
21
+ const repository = await repositoryLabel(repoRoot);
22
+ const skipped = {};
23
+ const results = [];
24
+ for (const candidate of candidates) {
25
+ if (results.length >= requested)
26
+ break;
27
+ if (candidate.changedFiles.length === 0) {
28
+ increment(skipped, "empty-change");
29
+ continue;
30
+ }
31
+ if (candidate.changedFiles.length > MAX_CHANGED_FILES) {
32
+ increment(skipped, "oversized-change");
33
+ continue;
34
+ }
35
+ if (retrievalQueryTerms(candidate.task).length < 2) {
36
+ increment(skipped, "insufficient-task-text");
37
+ continue;
38
+ }
39
+ input.progress?.(`Benchmarking ${results.length + 1}/${requested}: ${candidate.hash.slice(0, 8)}`);
40
+ const row = await benchmarkCommit(repoRoot, candidate, checkoutConfig);
41
+ if (!row) {
42
+ increment(skipped, "no-preexisting-target");
43
+ continue;
44
+ }
45
+ results.push(row);
46
+ }
47
+ if (results.length === 0) {
48
+ throw new Error("No eligible historical changes were found. Use a repository with descriptive commit messages and at least one prior revision.");
49
+ }
50
+ const all = results;
51
+ const mentioned = results.filter((row) => row.mentionsExpectedPath);
52
+ const unmentioned = results.filter((row) => !row.mentionsExpectedPath);
53
+ const impactSecondaryRows = results.map((row) => row.impactSecondary).filter((row) => row !== null);
54
+ const secondaryHits = impactSecondaryRows.reduce((sum, row) => sum + row.hits, 0);
55
+ const secondaryOf = impactSecondaryRows.reduce((sum, row) => sum + row.of, 0);
56
+ return {
57
+ benchmarkVersion: 1,
58
+ generatedAt: new Date().toISOString(),
59
+ repository,
60
+ requestedCommits: requested,
61
+ eligibleCases: results.length,
62
+ skipped,
63
+ safeguards: {
64
+ parentSnapshots: true,
65
+ historyCutoff: "target-parent",
66
+ maxChangedFiles: MAX_CHANGED_FILES,
67
+ primaryTargets: "changed-maintained-non-test-code",
68
+ sameScannedCorpus: true,
69
+ checkoutFiltersDisabled: true,
70
+ repositoryCodeExecuted: false
71
+ },
72
+ cohorts: {
73
+ all: scoreArms(all),
74
+ mentioned: scoreArms(mentioned),
75
+ unmentioned: scoreArms(unmentioned)
76
+ },
77
+ impactSecondary: {
78
+ hits: secondaryHits,
79
+ of: secondaryOf,
80
+ recall: secondaryOf === 0 ? null : round(secondaryHits / secondaryOf)
81
+ },
82
+ cases: results
83
+ };
84
+ }
85
+ async function benchmarkCommit(repoRoot, candidate, checkoutConfig) {
86
+ const temporaryRoot = await mkdtemp(join(tmpdir(), "fixmap-benchmark-"));
87
+ const snapshot = join(temporaryRoot, "snapshot");
88
+ const emptyHooks = join(temporaryRoot, "hooks-disabled");
89
+ await mkdir(emptyHooks);
90
+ let worktreeAdded = false;
91
+ try {
92
+ await runGit(repoRoot, [
93
+ "-c", `core.hooksPath=${emptyHooks}`,
94
+ ...checkoutConfig,
95
+ "worktree", "add", "--detach", snapshot, candidate.parent
96
+ ]);
97
+ worktreeAdded = true;
98
+ const repo = await scanRepo({ repoRoot: snapshot, includeHistory: true, useCache: false });
99
+ const fileByPath = new Map(repo.files.map((file) => [file.path, file]));
100
+ const changedExisting = candidate.changedFiles.filter((path) => fileByPath.has(path));
101
+ const maintainedStems = new Set(repo.files
102
+ .filter((file) => !isGeneratedPath(file.path) && !isBackupPath(file.path))
103
+ .map((file) => moduleStem(file.path)));
104
+ // Primary retrieval compares like with like: changed maintained implementation code,
105
+ // excluding tests. Generated twins cannot become impossible expected answers when all
106
+ // three retrieval arms deliberately prefer their maintained source.
107
+ const expected = changedExisting.filter((path) => {
108
+ const file = fileByPath.get(path);
109
+ return file?.kind === "code" &&
110
+ !file.isTest &&
111
+ !isBackupPath(path) &&
112
+ !(isGeneratedPath(path) && maintainedStems.has(moduleStem(path)));
113
+ });
114
+ if (expected.length === 0)
115
+ return undefined;
116
+ const report = buildReportFromRepo(repo, { issueText: candidate.task, limit: 5 });
117
+ const fixmap = report.contextFiles.map((file) => file.path).slice(0, 5);
118
+ const bm25 = rankByBm25(repo.files, candidate.task, 5);
119
+ const impact = uniquePaths([
120
+ ...(fixmap[0] ? [fixmap[0]] : []),
121
+ ...(report.impact?.files.map((file) => file.path) ?? []),
122
+ ...fixmap.slice(1)
123
+ ]).slice(0, 5);
124
+ const primary = fixmap.find((path) => expected.includes(path));
125
+ const secondaryExpected = primary
126
+ ? changedExisting.filter((path) => path !== primary && fileByPath.get(path)?.kind === "code")
127
+ : [];
128
+ const impactSecondary = primary && secondaryExpected.length > 0
129
+ ? { hits: secondaryExpected.filter((path) => report.impact?.files.some((file) => file.path === path)).length, of: secondaryExpected.length }
130
+ : null;
131
+ return {
132
+ commit: candidate.hash,
133
+ task: candidate.task,
134
+ expected,
135
+ mentionsExpectedPath: taskMentionsExpectedPath(candidate.task, expected),
136
+ arms: {
137
+ bm25: scoreCase(bm25, expected),
138
+ fixmap: scoreCase(fixmap, expected),
139
+ impact: scoreCase(impact, expected)
140
+ },
141
+ impactSecondary
142
+ };
143
+ }
144
+ finally {
145
+ if (worktreeAdded) {
146
+ try {
147
+ await runGit(repoRoot, ["-c", `core.hooksPath=${emptyHooks}`, ...checkoutConfig, "worktree", "remove", "--force", snapshot]);
148
+ }
149
+ catch (error) {
150
+ throw new Error(`Could not remove temporary benchmark worktree "${snapshot}": ${error instanceof Error ? error.message : String(error)}`);
151
+ }
152
+ }
153
+ await rm(temporaryRoot, { recursive: true, force: true });
154
+ }
155
+ }
156
+ async function listCandidateCommits(repoRoot, limit) {
157
+ const hashes = (await runGit(repoRoot, ["rev-list", "--no-merges", `--max-count=${limit}`, "HEAD"]))
158
+ .split(/\r?\n/).filter(Boolean);
159
+ const candidates = [];
160
+ for (const hash of hashes) {
161
+ const parents = (await runGit(repoRoot, ["show", "-s", "--format=%P", hash])).trim().split(/\s+/).filter(Boolean);
162
+ if (parents.length !== 1)
163
+ continue;
164
+ const task = (await runGit(repoRoot, ["show", "-s", "--format=%B", hash])).slice(0, MAX_TASK_CHARS).trim();
165
+ const changedFiles = (await runGit(repoRoot, [
166
+ "-c", "core.quotepath=false", "diff-tree", "--no-ext-diff", "--no-commit-id", "--name-only", "-r", "-z", hash
167
+ ])).split("\0").filter(Boolean).map((path) => path.replace(/\\/g, "/"));
168
+ candidates.push({ hash, parent: parents[0], task, changedFiles: [...new Set(changedFiles)] });
169
+ }
170
+ return candidates;
171
+ }
172
+ async function safeCheckoutConfig(repoRoot) {
173
+ let names = [];
174
+ try {
175
+ const output = await runGit(repoRoot, [
176
+ "config", "--null", "--name-only", "--get-regexp", "^filter\\..*\\.(clean|smudge|process|required)$"
177
+ ]);
178
+ names = output.split("\0").filter(Boolean);
179
+ }
180
+ catch {
181
+ // `git config --get-regexp` exits 1 when no matching filter is configured.
182
+ }
183
+ const drivers = [...new Set(names.flatMap((name) => {
184
+ const match = name.match(/^filter\.(.+)\.(?:clean|smudge|process|required)$/i);
185
+ return match?.[1] ? [match[1]] : [];
186
+ }))].sort((left, right) => left.localeCompare(right));
187
+ const options = [
188
+ "-c", "core.fsmonitor=false",
189
+ "-c", "core.symlinks=false"
190
+ ];
191
+ for (const driver of drivers) {
192
+ options.push("-c", `filter.${driver}.smudge=`, "-c", `filter.${driver}.process=`, "-c", `filter.${driver}.required=false`);
193
+ }
194
+ return options;
195
+ }
196
+ async function assertGitRepository(repoRoot) {
197
+ try {
198
+ if ((await runGit(repoRoot, ["rev-parse", "--is-inside-work-tree"])).trim() !== "true")
199
+ throw new Error("not a worktree");
200
+ await runGit(repoRoot, ["rev-parse", "--verify", "HEAD"]);
201
+ }
202
+ catch {
203
+ throw new Error(`Benchmark needs a local Git repository with at least one commit: ${repoRoot}`);
204
+ }
205
+ }
206
+ async function repositoryLabel(repoRoot) {
207
+ try {
208
+ const remote = (await runGit(repoRoot, ["remote", "get-url", "origin"])).trim();
209
+ const match = remote.match(/github\.com[/:]([^/]+\/[^/]+?)(?:\.git)?$/i);
210
+ if (match?.[1])
211
+ return match[1];
212
+ }
213
+ catch { /* Local-only repositories have no origin; basename is non-sensitive and stable. */ }
214
+ return basename(repoRoot);
215
+ }
216
+ async function runGit(cwd, args) {
217
+ const { stdout } = await exec("git", args, {
218
+ cwd,
219
+ maxBuffer: GIT_BUFFER,
220
+ env: { ...process.env, GIT_TERMINAL_PROMPT: "0", GIT_CONFIG_NOSYSTEM: "1" }
221
+ });
222
+ return stdout;
223
+ }
224
+ function scoreCase(paths, expected) {
225
+ return {
226
+ top5Paths: paths,
227
+ top1Hit: expected.includes(paths[0] ?? ""),
228
+ top3Hit: expected.some((path) => paths.slice(0, 3).includes(path)),
229
+ top5Hit: expected.some((path) => paths.slice(0, 5).includes(path))
230
+ };
231
+ }
232
+ function scoreArms(rows) {
233
+ return {
234
+ bm25: scoreRows(rows, "bm25"),
235
+ fixmap: scoreRows(rows, "fixmap"),
236
+ impact: scoreRows(rows, "impact")
237
+ };
238
+ }
239
+ function scoreRows(rows, arm) {
240
+ return {
241
+ cases: rows.length,
242
+ top1: rate(rows, arm, "top1Hit"),
243
+ top3: rate(rows, arm, "top3Hit"),
244
+ top5: rate(rows, arm, "top5Hit")
245
+ };
246
+ }
247
+ function rate(rows, arm, key) {
248
+ const hits = rows.filter((row) => row.arms[arm][key]).length;
249
+ return {
250
+ hits,
251
+ of: rows.length,
252
+ rate: rows.length === 0 ? null : round(hits / rows.length),
253
+ interval95: wilsonInterval(hits, rows.length)
254
+ };
255
+ }
256
+ function wilsonInterval(hits, total) {
257
+ if (total === 0)
258
+ return null;
259
+ const z = 1.959963984540054;
260
+ const proportion = hits / total;
261
+ const denominator = 1 + (z * z) / total;
262
+ const center = (proportion + (z * z) / (2 * total)) / denominator;
263
+ const margin = (z / denominator) * Math.sqrt((proportion * (1 - proportion)) / total + (z * z) / (4 * total * total));
264
+ return [round(Math.max(0, center - margin)), round(Math.min(1, center + margin))];
265
+ }
266
+ function round(value) {
267
+ return Number(value.toFixed(3));
268
+ }
269
+ function uniquePaths(paths) {
270
+ return [...new Set(paths)];
271
+ }
272
+ function increment(counts, key) {
273
+ counts[key] = (counts[key] ?? 0) + 1;
274
+ }
275
+ export function renderRepositoryBenchmark(result) {
276
+ const unmentioned = result.cohorts.unmentioned;
277
+ const percent = (rate) => rate === null ? "n/a" : `${Math.round(rate * 100)}%`;
278
+ const lines = [
279
+ "# FixMap Repository Benchmark",
280
+ "",
281
+ `Evaluated ${result.eligibleCases} eligible historical changes from ${result.repository}.`,
282
+ "Every case used the target commit's parent snapshot and history ending at that parent.",
283
+ "",
284
+ "## Unmentioned tasks",
285
+ "",
286
+ "| Arm | Top 1 | Top 3 | Top 5 |",
287
+ "| --- | ---: | ---: | ---: |",
288
+ `| BM25 over code | ${percent(unmentioned.bm25.top1.rate)} | ${percent(unmentioned.bm25.top3.rate)} | ${percent(unmentioned.bm25.top5.rate)} |`,
289
+ `| FixMap context | ${percent(unmentioned.fixmap.top1.rate)} | ${percent(unmentioned.fixmap.top3.rate)} | ${percent(unmentioned.fixmap.top5.rate)} |`,
290
+ `| FixMap + Impact Graph | ${percent(unmentioned.impact.top1.rate)} | ${percent(unmentioned.impact.top3.rate)} | ${percent(unmentioned.impact.top5.rate)} |`,
291
+ "",
292
+ `Impact secondary-file recall: ${result.impactSecondary.of === 0 ? "n/a" : `${result.impactSecondary.hits}/${result.impactSecondary.of} (${percent(result.impactSecondary.recall)})`}.`,
293
+ "",
294
+ "## Safeguards",
295
+ "",
296
+ "- Source was scanned from each target's parent revision.",
297
+ "- Co-change history stopped at that parent revision.",
298
+ `- Merges and commits touching more than ${result.safeguards.maxChangedFiles} files were excluded.`,
299
+ "- BM25, FixMap, and Impact Graph saw the same scanned files.",
300
+ "- Primary hits were scored only against changed maintained non-test code; generated twins, backups, and tests were excluded. Secondary impact recall may include changed tests.",
301
+ "- Repository code, dependencies, scripts, and hooks were not executed.",
302
+ "",
303
+ "A historical commit message is not the same input as its original issue. Treat this as a repository-specific backtest, not proof of agent savings.",
304
+ ""
305
+ ];
306
+ return lines.join("\n");
307
+ }
308
+ //# sourceMappingURL=benchmark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.js","sourceRoot":"","sources":["../src/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,wBAAwB,EACzB,MAAM,oBAAoB,CAAC;AAE5B,MA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LAAiL;QACjL,wEAAwE;QACxE,EAAE;QACF,oJAAoJ;QACpJ,EAAE;KACH,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { type FixMapReport } from "@aryam/fixmap-core";
2
2
  import { type DoctorReport } from "./doctor.js";
3
+ import type { RepositoryBenchmark } from "./benchmark.js";
4
+ import type { WatchRepositoryInput, WatchUpdate } from "./watch.js";
3
5
  import { type RepositoryPlanInput } from "./repository-source.js";
4
6
  export type CliOptions = {
5
7
  command: string;
@@ -9,12 +11,14 @@ export type CliOptions = {
9
11
  diffSpec?: string | undefined;
10
12
  baseRef?: string | undefined;
11
13
  headRef?: string | undefined;
12
- format: "markdown" | "json";
14
+ checkoutRef?: string | undefined;
15
+ format: "markdown" | "json" | "agent";
13
16
  output?: string | undefined;
14
17
  explainPath?: string | undefined;
15
18
  reportPath?: string | undefined;
16
19
  comparePath?: string | undefined;
17
20
  limit?: number | undefined;
21
+ failOn?: "error" | "warning" | undefined;
18
22
  exclude: string[];
19
23
  workingTree: boolean;
20
24
  includeUntracked: boolean;
@@ -25,14 +29,22 @@ export type CliOptions = {
25
29
  export type CliDependencies = {
26
30
  buildReport?: (input: RepositoryPlanInput) => Promise<FixMapReport>;
27
31
  readVersion?: () => string;
28
- runMcpServer?: () => Promise<void>;
32
+ runMcpServer?: (defaultRepo?: string) => Promise<void>;
29
33
  runDoctor?: () => Promise<DoctorReport>;
30
34
  stderr?: (text: string) => void;
31
35
  stdout?: (text: string) => void;
32
36
  writeReport?: (path: string, contents: string) => Promise<void>;
33
37
  readIssueFile?: (path: string | number) => string | Buffer;
38
+ benchmarkRepository?: (input: {
39
+ repoRoot: string;
40
+ last?: number;
41
+ progress?: (message: string) => void;
42
+ }) => Promise<RepositoryBenchmark>;
43
+ renderBenchmark?: (result: RepositoryBenchmark) => string;
44
+ watchRepository?: (input: WatchRepositoryInput) => Promise<WatchUpdate | undefined>;
45
+ renderWatchUpdate?: (update: WatchUpdate, format: "markdown" | "json") => string;
34
46
  };
35
- export declare const USAGE = "FixMap maps an issue, prompt, or diff to context files, test routes, and review risks.\n\nUsage:\n fixmap owner/repository#123\n fixmap https://github.com/owner/repository/issues/123\n fixmap plan --issue \"Users cannot reset passwords\"\n fixmap plan --issue https://github.com/owner/repository/issues/123\n fixmap plan --issue https://github.com/owner/repository/pull/123\n fixmap plan --issue-file task.md\n fixmap plan --issue -\n fixmap plan --issue \"Fix login\" --repo https://github.com/owner/repository\n fixmap plan --diff main...HEAD\n fixmap plan --working-tree --include-untracked --limit 12 --exclude \"docs/**\"\n fixmap plan --issue \"Fix login\" --format json --output plan.json\n fixmap plan --issue \"Fix login in auth middleware\" --compare plan.json\n fixmap plan --base main --head HEAD --format json\n fixmap verify --report plan.json --diff main...HEAD\n fixmap verify --report plan.json --working-tree\n fixmap doctor --format json\n fixmap mcp\n\nCommands:\n plan Generate a FixMap report for a task or diff\n verify Compare a saved report against the diff that followed it\n doctor Check the FixMap install for stale global or npx shadows\n mcp Run FixMap as an MCP server over stdio for AI coding agents\n\nOptions:\n --issue <text|url> Task text, or a public GitHub issue or pull request URL\n --issue-file <file> Read task text from a UTF-8 or UTF-16 file (use - for stdin)\n --diff <spec> Git diff spec, such as main...HEAD (the repository scan can still rank untracked candidates)\n --base <ref> Base ref for diffing when --diff is not given\n --head <ref> Head ref for diffing (defaults to HEAD)\n --working-tree Map staged and unstaged changes against HEAD\n --include-untracked With --working-tree, also include untracked files\n --no-cache Bypass the exact git-state repository scan cache\n --repo <source> Local path or public GitHub HTTPS URL (defaults to current directory)\n --limit <n> Maximum context files to report (default 8, max 20)\n --exclude <glob> Path pattern to leave out of ranking (repeatable)\n --format <fmt> Output format: markdown (default) or json\n --output <file> Write the report or verification to a file instead of stdout\n --explain <path> Explain why one file was ranked where it was, or left out\n --compare <file> Compare this plan against an earlier JSON report\n --report <file> Verify command only: the JSON report the change was planned from\n --help, -h Show this help\n --version, -v Show the FixMap version\n\nA repository may also list exclusion patterns in .fixmapignore, one per line. Supported\nsyntax is *, **, ?, root-leading /, directory-trailing /, comments, and ! negation.\nSet FIXMAP_PROGRESS=1 to print scan and clone phases to stderr.\n";
47
+ export declare const USAGE = "FixMap maps an issue, prompt, or diff to context files, test routes, and review risks.\n\nUsage:\n fixmap owner/repository#123\n fixmap https://github.com/owner/repository/issues/123\n fixmap plan --issue \"Users cannot reset passwords\"\n fixmap plan --issue https://github.com/owner/repository/issues/123\n fixmap plan --issue https://github.com/owner/repository/pull/123\n fixmap plan --issue-file task.md\n fixmap plan --issue -\n fixmap plan --issue \"Fix login\" --repo https://github.com/owner/repository\n fixmap plan --issue \"Fix login\" --repo https://github.com/owner/repository --ref release-2.x\n fixmap plan --diff main...HEAD\n fixmap plan --working-tree --include-untracked --limit 12 --exclude \"docs/**\"\n fixmap plan --no-cache --issue \"Fix login\" --repo .\n fixmap plan --issue \"Fix login\" --format json --output plan.json\n fixmap plan --issue \"Fix login\" --format agent\n fixmap plan --issue \"Fix login in auth middleware\" --compare plan.json\n fixmap plan --base main --head HEAD --format json\n fixmap verify --report plan.json --diff main...HEAD\n fixmap verify --report plan.json --working-tree\n fixmap verify --report plan.json --working-tree --fail-on warning\n fixmap doctor --format json\n fixmap validate plan.json\n fixmap benchmark --repo . --last 50\n fixmap context --issue \"Fix login\" --budget 10000\n fixmap graph --issue \"Fix login\" --format mermaid\n fixmap watch --report plan.json --repo .\n fixmap features\n fixmap setup [--agent claude|cursor|copilot|agents|all] [--repo <path>]\n fixmap mcp [--repo <path>]\n\nCommands:\n plan Generate a FixMap report for a task or diff\n verify Compare a saved report against the diff that followed it\n doctor Check the FixMap install for stale global or npx shadows\n validate Validate a saved FixMap JSON report\n benchmark Backtest BM25, FixMap, and Impact Graph on pre-change snapshots\n context Package the highest-value source ranges within a token budget\n graph Export the evidence-backed Impact Graph as Mermaid or JSON\n watch Recheck working-tree drift and impact whenever edits change\n features List every FixMap capability and its command\n setup Install a discoverable /fixmap command for coding agents\n mcp Run FixMap as an MCP server over stdio for AI coding agents\n\nOptions:\n --issue <text|url> Task text, or a public GitHub issue or pull request URL\n --issue-file <file> Read task text from a UTF-8 or UTF-16 file (use - for stdin)\n --diff <spec> Git diff spec, such as main...HEAD (the repository scan can still rank untracked candidates)\n --base <ref> Base ref for diffing when --diff is not given\n --head <ref> Head ref for diffing (defaults to HEAD)\n --working-tree Map staged and unstaged changes against HEAD\n --include-untracked With --working-tree, also include untracked files\n --no-cache Bypass the exact git-state repository scan cache\n --repo <source> Local path or public GitHub HTTPS URL (defaults to current directory)\n --ref <branch|tag> Branch or tag to scan when --repo is a remote GitHub URL\n --limit <n> Maximum context files to report (default 8, max 20)\n --exclude <glob> Path pattern to leave out of ranking (repeatable)\n --format <fmt> Output format: markdown (default), json, or compact agent\n --output <file> Write the report or verification to a file instead of stdout\n --explain <path> Explain why one file was ranked where it was, or left out\n --compare <file> Compare this plan against an earlier JSON report\n --report <file> Verify command only: the JSON report the change was planned from\n --fail-on <level> Verify exit policy: error (default) or warning\n --help, -h Show this help\n --version, -v Show the FixMap version\n\nA repository may also list exclusion patterns in .fixmapignore, one per line. Supported\nsyntax is *, **, ?, repository-root-leading /, directory-trailing /, comments, and ! negation.\nAbsolute paths pasted from inside the repository are normalized to repository-relative patterns.\nSet FIXMAP_PROGRESS=1 to print scan and clone phases to stderr.\nSet FIXMAP_CACHE_DIR to move the OS scan cache, and FIXMAP_VERBOSE_USAGE=1 to include this full help after argument errors.\n";
36
48
  export declare function runCli(args: string[], dependencies?: CliDependencies): Promise<number>;
37
49
  export declare function expandIssueShorthand(args: string[]): string[];
38
50
  export declare const MAX_CONTEXT_FILE_LIMIT = 20;