Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,23 @@ FixMap follows bounded imports and dependents, then joins existing tests, contra
review ownership, and architecture policy. A missing `--add` path stays unresolved. FixMap does
not interpret what "checkout" means, call an API or LLM, or require an account.

Ask who could review a change:

```bash
fixmap reviewers --diff main...HEAD
fixmap reviewers --working-tree --no-history-authors
fixmap reviewers --report plan.json --format json
```

Each changed path lists suggested reviewers with the exact reason: the highest-precedence
CODEOWNERS file (the last matching rule wins) with its line, active annotation owners,
architecture-policy reviewers, and up to three frequent authors from the newest 250 non-merge
commits. Commit authors are canonicalized through the repository's `.mailmap` when one exists.
`--no-history-authors` leaves commit authors out entirely and reads no commit history. Names are
printed without `@`, so pasting the output into a pull request notifies nobody, and FixMap never
requests reviews. A name is not evidence of identity, employment, or current availability. The
MCP tool `fixmap_reviewers` takes the same inputs and is read-only.

Persist a reviewed product-to-implementation map without persisting generated conclusions:

```bash
Expand All @@ -239,7 +256,7 @@ contract, decision, test-association, reviewer, and architecture evidence.

## Complete feature catalog

> **Preview features.** `change-scope`, `capability` / `capabilities`, `workspace`, `ask`, `migrate`, `reverse-docs`, `history`, `supply-chain`, `runtime`, `sandbox`, `editor`, `--semantic-model`, `--evidence`, and their MCP tools are previews: they work and are tested, but their output and options may change before v0.10.0. Language support beyond JavaScript and TypeScript is also preview quality while testing on unseen repositories continues. `fixmap features` lists which features are previews.
> **Preview features.** `change-scope`, `reviewers`, `capability` / `capabilities`, `workspace`, `ask`, `migrate`, `reverse-docs`, `history`, `supply-chain`, `runtime`, `sandbox`, `editor`, `--semantic-model`, `--evidence`, and their MCP tools are previews: they work and are tested, but their output and options may change before v0.10.0. Language support beyond JavaScript and TypeScript is also preview quality while testing on unseen repositories continues. `fixmap features` lists which features are previews.

### Inputs and repository mapping

Expand Down
22 changes: 16 additions & 6 deletions packages/action/dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7893,7 +7893,11 @@ function routeReviewers(repo, input) {
addCodeOwners(repo, changedPaths, accumulated, diagnostics);
addAnnotations(repo, changedPaths, input.now, accumulated, diagnostics);
addPolicy(repo, changedPaths, accumulated, diagnostics);
addHistory(repo, changedPaths, accumulated);
if (input.includeHistoryAuthors === false) {
diagnostics.push({ source: "git-history", severity: "info", message: "Commit-author suggestions were turned off; only CODEOWNERS, annotations, and architecture policy were used." });
} else {
addHistory(repo, changedPaths, accumulated, diagnostics);
}
const suggestions = [...accumulated].map(([reviewer, value]) => ({
reviewer,
confidence: value.confidence,
Expand Down Expand Up @@ -8008,7 +8012,12 @@ function addPolicy(repo, paths, accumulated, diagnostics) {
diagnostics.push({ source: ".fixmap/policy.json", severity: "warning", message: `Policy reviewers were skipped: ${error instanceof Error ? error.message : String(error)}` });
}
}
function addHistory(repo, paths, accumulated) {
function addHistory(repo, paths, accumulated, diagnostics) {
if (repo.history?.shallow) {
diagnostics.push({ source: "git-history", severity: "warning", message: "Commit history is shallow, so commit-author suggestions only reflect the commits present in this clone." });
} else if (repo.history?.truncated) {
diagnostics.push({ source: "git-history", severity: "info", message: `Commit-author suggestions use only the newest ${Math.min(repo.history.inspectedCommits, MAX_HISTORY_COMMITS2).toLocaleString()} non-merge commits.` });
}
for (const path of paths) {
const counts = /* @__PURE__ */ new Map();
for (const commit of (repo.history?.commits ?? []).slice(0, MAX_HISTORY_COMMITS2)) {
Expand Down Expand Up @@ -8039,8 +8048,9 @@ function add(accumulated, reviewer, confidence, path, evidence) {
if (confidenceOrder(confidence) < confidenceOrder(existing.confidence))
existing.confidence = confidence;
existing.paths.add(path);
if (!existing.evidence.some((entry2) => evidenceKey(entry2) === evidenceKey(evidence)))
existing.evidence.push(evidence);
const routed = { ...evidence, changedPath: path };
if (!existing.evidence.some((entry2) => evidenceKey(entry2) === evidenceKey(routed)))
existing.evidence.push(routed);
accumulated.set(identity, existing);
}
function normalizePaths(values) {
Expand All @@ -8057,10 +8067,10 @@ function validOwner(value) {
return value.length <= 200 && (/^@[A-Za-z0-9][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9][A-Za-z0-9_.-]*)?$/.test(value) || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value));
}
function evidenceKey(value) {
return `${value.kind}\0${value.sourceFingerprint}\0${value.path ?? ""}\0${value.line ?? ""}\0${value.detail}`;
return `${value.kind}\0${value.sourceFingerprint}\0${value.path ?? ""}\0${value.line ?? ""}\0${value.changedPath ?? ""}\0${value.detail}`;
}
function evidenceOrder(a, b) {
return a.kind.localeCompare(b.kind) || (a.path ?? "").localeCompare(b.path ?? "") || (a.line ?? 0) - (b.line ?? 0);
return a.kind.localeCompare(b.kind) || (a.changedPath ?? "").localeCompare(b.changedPath ?? "") || (a.path ?? "").localeCompare(b.path ?? "") || (a.line ?? 0) - (b.line ?? 0);
}
function confidenceOrder(value) {
return value === "high" ? 0 : value === "medium" ? 1 : 2;
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ For long task text, use `--issue-file task.md`, pipe it directly to `fixmap plan
- **Context Pack** — use `fixmap context` to package deterministic line ranges from primary and impact files within an estimated source-token budget. Markdown is readable by people and agents; JSON preserves roles, reasons, line ranges, truncation, and omitted-file diagnostics.
- **Graph export** — use `fixmap graph` to export the evidence-backed Impact Graph as portable Mermaid or versioned JSON while preserving relationship direction.
- **Change scope** — use `fixmap change-scope --touch <path> [--add <path>]` to expand only caller-selected product work surfaces over bounded dependencies/dependents, then join existing tests, contracts, decisions, reviewers, and policy evidence. Missing additions remain unresolved; no product semantics are inferred.
- **Reviewer suggestions** (preview) — use `fixmap reviewers --diff <spec> | --working-tree | --report <plan.json>` to list suggested reviewers per changed path from CODEOWNERS (last matching rule wins, with the source line), annotation owners, architecture policy, and `.mailmap`-canonical commit authors. `--no-history-authors` drops commit authors. Names print without `@` so nobody is notified; FixMap never requests reviews or infers availability. MCP: `fixmap_reviewers`.
- **Product capabilities** — use `fixmap capability create|update|remove` to maintain a locked, atomic `.fixmap/capabilities.json` of human names, explicit anchors, and bounds; use `fixmap capability <id>` or `fixmap capabilities` to rebuild/show current evidence. `fixmap capability diff <id> <from>..<to>` compares exact immutable Git objects without checkout mutation. Generated conclusions are never stored.
- **Cross-repository workspace** — use `fixmap workspace --config <file> --seed <repository-id>` to resolve local Node, Python, and Maven package providers and trace downstream consumers with versioned identity, manifest, import, and submodule evidence.
- **Repository Q&A** — use `fixmap ask --report <plan.json> --question <text>` to answer structural context, impact, test, risk, policy, ADR, and annotation questions from bounded report evidence with citations and explicit unknowns.
Expand Down Expand Up @@ -230,6 +231,7 @@ fixmap supply-chain Import normalized external scanner and SBOM evidence
fixmap runtime Map redaction-reviewed runtime evidence to exact files
fixmap sandbox Run one explicitly consented command in an isolated container
fixmap change-scope Expand explicit planned paths into structural consequences
fixmap reviewers Suggest reviewers per changed path without notifying anyone
fixmap capability Create, update, remove, or show one product capability
fixmap capabilities List persistent product capability definitions
fixmap verify Compare a saved plan with the diff that followed
Expand Down
11 changes: 11 additions & 0 deletions packages/cli/src/cli-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Usage:
fixmap validate plan.json
fixmap benchmark --repo . --last 50
fixmap change-scope --touch src/auth --touch packages/api --add db/migrations
fixmap reviewers --diff main...HEAD --no-history-authors
fixmap editor --issue "Investigate authentication" --repo .
fixmap capability create checkout --touch src/routes/checkout.ts --touch packages/payments
fixmap capability checkout
Expand Down Expand Up @@ -129,6 +130,7 @@ Commands:
validate Validate a saved FixMap JSON report
benchmark Backtest BM25, FixMap, and Impact Graph on pre-change snapshots
change-scope Preview: Expand explicit planned paths into bounded structural consequences
reviewers Preview: Suggest reviewers per changed path from CODEOWNERS, owners, policy, and history
editor Preview: Serve a local read-only NDJSON editor session
capability Preview: Create, update, remove, or show a persistent product capability
capabilities Preview: List persistent product capabilities declared by the repository
Expand Down Expand Up @@ -462,6 +464,15 @@ export async function runCli(args: string[], dependencies: CliDependencies = {})
});
}

if (args[0] === "reviewers") {
const { runReviewersCommand } = await import("./reviewers-command.js");
return runReviewersCommand(args.slice(1), {
stdout,
stderr,
...(dependencies.writeReport ? { writeOutput: dependencies.writeReport } : {})
});
}

if (args[0] === "change-scope") {
const { runChangeScopeCommand } = await import("./change-scope-command.js");
return runChangeScopeCommand(args.slice(1), {
Expand Down
52 changes: 51 additions & 1 deletion packages/cli/src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { buildSupplyChainReport, renderSupplyChainMarkdown } from "./supply-chai
import { parseRuntimeInput, renderRuntimeMarkdown } from "./runtime-command.js";
import { runWorkspaceCommand } from "./workspace-command.js";
import { runChangeScopeCommand } from "./change-scope-command.js";
import { runReviewersCommand } from "./reviewers-command.js";
import { runCapabilitiesCommand, runCapabilityCommand } from "./capability-command.js";
import {
buildReportForRepository,
Expand Down Expand Up @@ -304,6 +305,28 @@ const CHANGE_SCOPE_TOOL = {
}
};

const REVIEWERS_TOOL = {
name: "fixmap_reviewers",
title: "FixMap reviewer suggestions",
description:
"Preview (may change before v0.10.0): Suggest reviewers per changed path from the highest-precedence CODEOWNERS file (last matching rule wins), active annotation owners, architecture-policy reviewers, and bounded .mailmap-canonical commit authors. " +
"Read-only: it never requests reviews or notifies anyone, prints names without @, and does not treat a name as evidence of identity, employment, or availability. Provide exactly one of report, diff, or workingTree.",
annotations: { readOnlyHint: true, openWorldHint: false },
inputSchema: {
type: "object" as const,
properties: {
report: { type: "string", description: "Path to a saved FixMap JSON plan; its changed files (or ranked context files) are routed" },
diff: { type: "string", description: "Git diff spec whose changed files are routed, such as main...HEAD" },
workingTree: { type: "boolean", description: "Route staged and unstaged changes against HEAD" },
noHistoryAuthors: { type: "boolean", description: "Leave out commit-author suggestions" },
repo: { type: "string", description: "Local checkout path (defaults to the MCP server repository)" },
format: { type: "string", description: "Output format: markdown (default) or json" },
noCache: { type: "boolean", description: "Bypass repository scan caches" }
},
additionalProperties: false
}
};

const CAPABILITY_TOOL = {
name: "fixmap_capability",
title: "FixMap capability",
Expand Down Expand Up @@ -516,7 +539,7 @@ export function createFixMapMcpServer(
const server = new Server({ name: "fixmap", version: readVersion() }, { capabilities: { tools: {} } });

server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [PLAN_TOOL, CONTEXT_TOOL, GRAPH_TOOL, CHANGE_SCOPE_TOOL, CAPABILITY_TOOL, WORKSPACE_TOOL, ASK_TOOL, MIGRATION_TOOL, REVERSE_DOCS_TOOL, HISTORY_TOOL, SUPPLY_CHAIN_TOOL, RUNTIME_TOOL, VERIFY_TOOL, EXPLAIN_TOOL, COMPARE_TOOL, DOCTOR_TOOL, ANNOTATION_TOOL]
tools: [PLAN_TOOL, CONTEXT_TOOL, GRAPH_TOOL, CHANGE_SCOPE_TOOL, REVIEWERS_TOOL, CAPABILITY_TOOL, WORKSPACE_TOOL, ASK_TOOL, MIGRATION_TOOL, REVERSE_DOCS_TOOL, HISTORY_TOOL, SUPPLY_CHAIN_TOOL, RUNTIME_TOOL, VERIFY_TOOL, EXPLAIN_TOOL, COMPARE_TOOL, DOCTOR_TOOL, ANNOTATION_TOOL]
}));

server.setRequestHandler(CallToolRequestSchema, async (request) => {
Expand Down Expand Up @@ -590,6 +613,33 @@ export function createFixMapMcpServer(
const exitCode = await runChangeScopeCommand(commandArgs, { stdout: (value) => stdout.push(value), stderr: (value) => stderr.push(value) });
return { ...(exitCode === 0 ? {} : { isError: true }), content: [{ type: "text", text: exitCode === 0 ? stdout.join("") : stderr.join("") }] };
}
if (request.params.name === REVIEWERS_TOOL.name) {
const record = request.params.arguments as Record<string, unknown> | undefined;
const invalid = (text: string) => ({ isError: true, content: [{ type: "text", text: `Invalid arguments: ${text}` }] });
const unknown = Object.keys(record ?? {}).filter((key) => !["report", "diff", "workingTree", "noHistoryAuthors", "repo", "format", "noCache"].includes(key));
if (unknown.length > 0) return invalid(`unknown argument${unknown.length === 1 ? "" : "s"}: ${unknown.join(", ")}.`);
for (const key of ["report", "diff", "repo"] as const) {
if (record?.[key] !== undefined && (typeof record[key] !== "string" || !record[key].trim())) return invalid(`"${key}" must be a non-empty string.`);
}
for (const key of ["workingTree", "noHistoryAuthors", "noCache"] as const) {
if (record?.[key] !== undefined && typeof record[key] !== "boolean") return invalid(`"${key}" must be a boolean.`);
}
if (record?.repo && /^https?:\/\//i.test(String(record.repo))) return invalid('"repo" must be a local checkout.');
const sources = Number(record?.report !== undefined) + Number(record?.diff !== undefined) + Number(record?.workingTree === true);
if (sources !== 1) return invalid('provide exactly one of "report", "diff", or "workingTree": true.');
const format = normalizeFormat(record?.format);
if (!format.success) return invalid(format.message);
const commandArgs = ["--repo", typeof record?.repo === "string" ? record.repo.trim() : defaultRepo, "--format", format.value ?? "markdown"];
if (typeof record?.report === "string") commandArgs.push("--report", record.report.trim());
if (typeof record?.diff === "string") commandArgs.push("--diff", record.diff.trim());
if (record?.workingTree === true) commandArgs.push("--working-tree");
if (record?.noHistoryAuthors === true) commandArgs.push("--no-history-authors");
if (record?.noCache === true) commandArgs.push("--no-cache");
const stdout: string[] = [];
const stderr: string[] = [];
const exitCode = await runReviewersCommand(commandArgs, { stdout: (value) => stdout.push(value), stderr: (value) => stderr.push(value) });
return { ...(exitCode === 0 ? {} : { isError: true }), content: [{ type: "text", text: exitCode === 0 ? stdout.join("") : stderr.join("") }] };
}
if (request.params.name === CAPABILITY_TOOL.name) {
const record = request.params.arguments as Record<string, unknown> | undefined;
const unknown = Object.keys(record ?? {}).filter((key) => !["id", "from", "to", "repo", "format", "noCache"].includes(key));
Expand Down
Loading
Loading