patchpilot-mcp 0.4.1__py3-none-any.whl

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,381 @@
1
+ Metadata-Version: 2.4
2
+ Name: patchpilot-mcp
3
+ Version: 0.4.1
4
+ Summary: Incremental review of explicit source and unified diff text.
5
+ Author: Ahmed Saeed
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/ahmedsaeed1-eng/patchpilot-mcp
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: mcp==1.29.0
12
+ Requires-Dist: pydantic<3,>=2.11
13
+ Requires-Dist: tree-sitter==0.25.2
14
+ Requires-Dist: tree-sitter-javascript==0.25.0
15
+ Requires-Dist: tree-sitter-typescript==0.23.2
16
+ Requires-Dist: tree-sitter-go==0.25.0
17
+ Requires-Dist: tree-sitter-java==0.23.5
18
+ Requires-Dist: tree-sitter-c-sharp==0.24.0
19
+ Requires-Dist: tree-sitter-dart==0.1.0
20
+ Requires-Dist: tomli<3,>=2; python_version < "3.11"
21
+ Provides-Extra: test
22
+ Requires-Dist: mcp==1.29.0; extra == "test"
23
+ Requires-Dist: hypothesis<7,>=6; extra == "test"
24
+ Requires-Dist: ruff==0.17.6; extra == "test"
25
+ Requires-Dist: black==26.10.1; extra == "test"
26
+ Requires-Dist: jsonschema<5,>=4; extra == "test"
27
+ Requires-Dist: coverage<8,>=7; extra == "test"
28
+ Dynamic: license-file
29
+
30
+ # PatchPilot MCP
31
+
32
+ <!-- mcp-name: io.github.ahmedsaeed1-eng/patchpilot-mcp -->
33
+
34
+ ![PatchPilot — review the change, not the entire project](assets/patchpilot.svg)
35
+
36
+ **A focused review loop, not a fresh repository scan.**
37
+
38
+ [![Version](https://img.shields.io/badge/source-v0.4.1-315d85?style=flat-square)](CHANGELOG.md) [![GitHub Actions](https://github.com/ahmedsaeed1-eng/patchpilot-mcp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ahmedsaeed1-eng/patchpilot-mcp/actions/workflows/ci.yml) [![GitHub stars](https://img.shields.io/github/stars/ahmedsaeed1-eng/patchpilot-mcp?style=flat-square&color=e8b04b)](https://github.com/ahmedsaeed1-eng/patchpilot-mcp/stargazers)
39
+
40
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-3776ab?style=flat-square&logo=python&logoColor=white)](pyproject.toml) [![Protocol](https://img.shields.io/badge/MCP-stdio-7047b5?style=flat-square)](https://modelcontextprotocol.io/) [![CLI](https://img.shields.io/badge/CLI-stdin%20%2F%20JSON-e8b04b?style=flat-square)](#quick-start-explicit-cli) [![License](https://img.shields.io/badge/license-MIT-087f8c?style=flat-square)](LICENSE)
41
+
42
+ PatchPilot helps coding agents and developers inspect *explicitly supplied changes* after an edit. It extracts changed line locations, highlights ordinary Python correctness and maintainability issues, strict JSON syntax and duplicate object keys, JavaScript/JSX/TypeScript/TSX grammar and conservative maintainability diagnostics, Go/Java/C#/Dart grammar diagnostics, tracks a change budget and guides targeted testing. A caller-retained manifest allows repeated reviews to skip unchanged, previously reviewed source. It does not execute project code, edit files, inspect the workspace, perform vulnerability discovery or contact external services. It can summarize metadata from externally generated SARIF reports without executing the external tools.
43
+
44
+ > **Review contract:** your agent supplies the diff and the affected source, PatchPilot returns observations and next actions. The agent decides what to fix and runs the relevant project tests.
45
+
46
+ ## Quick start (3 steps)
47
+
48
+ **1. Install** the source in your Python 3.10+ environment:
49
+
50
+ ```sh
51
+ git clone https://github.com/ahmedsaeed1-eng/patchpilot-mcp.git
52
+ cd patchpilot-mcp
53
+ python -m pip install .
54
+ ```
55
+
56
+ **2. Connect** your coding assistant (Codex example):
57
+
58
+ ```sh
59
+ codex mcp add patchpilot -- patchpilot-mcp
60
+ codex mcp list
61
+ ```
62
+
63
+ **3. Review** your current edit in the host: select `review_changed`, provide the unified diff and complete affected source, then address observations and run focused project tests. For a manual local trial:
64
+
65
+ ```sh
66
+ python -m patchpilot changed < examples/changed.json
67
+ ```
68
+
69
+ ### Four core MCP tools
70
+
71
+ | Tool | Purpose |
72
+ |:--|:--|
73
+ | `review_diff` | Map changed lines, budget and test targets. |
74
+ | `review_changed` | Verify post-edit source against the diff; separate changed and outside-line observations. |
75
+ | `review_source` | Review explicit source, choosing language and optional policy. |
76
+ | `review_snapshot` | Reuse caller-retained manifest and review only changed inputs. |
77
+
78
+ Other tools are optional advanced interfaces: `review_python`, `review_json`, `review_javascript` (specialized compatibility tools), `compare_call_signature`, `compact_report`, `suggest_formatting_patch`, `export_sarif`, and `import_external_sarif`. Full arguments below.
79
+
80
+ ![PatchPilot v0.4.1 CLI review demonstration](assets/demo.gif)
81
+
82
+ The demo shows actual v0.4.1 output; try [changed source](examples/demo-changed.json) and [compact report](examples/demo-compact.json). The benchmark slide is labeled v0.4.0 historical evidence.
83
+
84
+ Use the same changed scope after each edit; PatchPilot cannot observe your editor or execute project tests. The host supplies inputs explicitly.
85
+
86
+ ### Additional MCP host configuration
87
+
88
+ The package includes the official MCP Python SDK and static grammar dependencies.
89
+
90
+ If the entry point is not available on your PATH, configure the absolute path to the Python executable in your environment and use the module invocation.
91
+
92
+ Codex MCP configuration:
93
+
94
+ ```toml
95
+ [mcp_servers.patchpilot]
96
+ command = "/absolute/path/to/python"
97
+ args = ["-m", "patchpilot.server"]
98
+ ```
99
+
100
+ Claude Desktop MCP configuration (use the same installed Python environment):
101
+
102
+ ```json
103
+ {
104
+ "mcpServers": {
105
+ "patchpilot": {
106
+ "command": "/absolute/path/to/python",
107
+ "args": ["-m", "patchpilot.server"]
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ Restart or reconnect the host if required. All twelve tools use stdio and expose structured JSON results.
114
+
115
+ ### Quick start: explicit CLI
116
+
117
+ From the checkout, Python/JSON/diff operations need only the Python standard library; Static grammar checks require the listed static parser dependencies. The caller supplies text via stdin.
118
+
119
+ ```sh
120
+ python -m patchpilot diff < examples/inventory.diff
121
+ python -m patchpilot python --path inventory.py --complete-module < inventory.py
122
+ python -m patchpilot json < examples/settings.json
123
+ python -m patchpilot snapshot < examples/snapshot.json
124
+ python -m patchpilot javascript --language typescript --path examples/sample.ts < examples/sample.ts
125
+ python -m patchpilot sarif < report.json
126
+ ```
127
+
128
+ Replace the illustrative filename with an actual affected source file. The tool itself never opens a path; redirection is performed by the calling shell. You can also install the project and call `patchpilot` instead of `python -m patchpilot`.
129
+
130
+ For a caller-controlled Git workflow, supply the particular staged diff:
131
+
132
+ ```sh
133
+ git diff --cached --no-color --no-ext-diff --no-textconv | python -m patchpilot diff
134
+ ```
135
+
136
+ If no staged changes exist, the CLI reports `NO_INPUT`, `syntax_ok: null`, and exit 3 (no review performed). The optional manual pre-commit wrapper checks for an empty staged diff first and treats that intentional no-op as success. The tool never invokes Git; that command is a separate explicit action by the caller. CLI output is JSON on stdout. Exit code 0 means there is no detected error-level finding (warnings may still exist), 1 means an error-level finding (or signature mismatch), 2 means malformed/rejected input, and 3 means missing input or incomplete review coverage without a detected error, including finding caps. Compact, external import, and formatting print projections without an error-level gate.
137
+
138
+ ### Empty input and encoding
139
+
140
+ Direct CLI input is decoded as strict UTF-8. Invalid bytes return a clear encoding error and status 2; they are never replaced. Direct empty stdin and empty diff/Python-fragment/JSON/JS/source requests without explicit complete-file intent return `NO_INPUT` with `syntax_ok: null` and unknown coverage. An intentional empty complete file can be identified with `review_source` (`complete: true`), an explicit snapshot/changed-file entry, or Python CLI `--complete-module`. An empty full Python/JS file may be valid; a full empty JSON document is invalid. Nonempty whitespace-only source is still actual supplied text, not missing input.
141
+
142
+ All direct source parsers count omitted findings; `review_source` reports `checked_incomplete_findings` when output truncation occurs. Snapshot and changed reports carry `omitted_source_findings` as a separately identified unclassified subset of aggregate omissions; no complete replacement stamp is issued for a truncated source. Smaller explicit scopes are needed to recover every observation.
143
+
144
+ ## What the review reports
145
+
146
+ | Finding | Severity | Evidence |
147
+ |:--|:--|:--|
148
+ | NO_INPUT | warning | fact: no source content supplied; no syntax verdict |
149
+ | PYTHON_SYNTAX | error | fact about supplied text in isolation |
150
+ | JS_TS_SYNTAX | error | selected static grammar reports a missing/error node |
151
+ | MUTABLE_DEFAULT | warning | heuristic: literal mutable function default |
152
+ | BARE_EXCEPT | warning | heuristic: broad exception handler |
153
+ | BUILTIN_SHADOWING | info | heuristic: binding shadows a builtin name |
154
+ | POSSIBLY_UNUSED_LOCAL | info | heuristic: no lexical reference in supplied function |
155
+ | JSON_SYNTAX | error | grammar error in supplied JSON text |
156
+ | JSON_DUPLICATE_KEY | warning | repeated decoded key in one JSON object |
157
+ | DUPLICATE_LITERAL_KEY | warning | fact: repeated constant dict key |
158
+ | CHANGE_BUDGET | warning | fact: changed lines or files exceed selected budget |
159
+ | TRAILING_WHITESPACE | info | fact about the added line; removal may be inappropriate |
160
+ | UNREACHABLE_STATEMENT | warning | heuristic: direct statement after unconditional terminator |
161
+ | DUPLICATE_DEFINITION | warning | heuristic: repeated sibling definition |
162
+ | BRANCH_COMPLEXITY | warning | heuristic: branch score meets or exceeds threshold |
163
+ | POSSIBLY_UNUSED_IMPORT | info | heuristic: no explicit read in complete supplied module |
164
+ | NO_TEST_PATH | info | heuristic: common test-path naming conventions |
165
+
166
+ Each MCP/CLI finding contains `id`, `code`, `severity`, `evidence`, `path`, `line`, `message` and `recommendation`. JSON findings and repeated Python literal keys also include a one-based Unicode-character column. IDs deduplicate equal observations and are stable only when label, code, position and message remain equal. They are not guaranteed across line moves. A null line means the observation applies to the diff as a whole. Python checks never execute the submitted source: AST parsing and syntax compilation are used only to validate the supplied text; compiled objects are discarded.
167
+
168
+ The example diff reports two changed files, four additions, one deletion and churn of five. Its test plan points to new lines in `inventory.py` and `tests/test_inventory.py`.
169
+
170
+ ## Tools
171
+
172
+ ### `review_diff`
173
+
174
+ | Argument | Meaning | Default / range |
175
+ |:--|:--|:--|
176
+ | diff | Unified diff text (required) | text |
177
+ | change_budget | Combined additions and removals | 300 / 1–10000 |
178
+ | file_budget | Number of file sections | 10 / 1–100 |
179
+
180
+ Returns counts, per-file added and removed line coordinates, common test paths, focused review suggestions, and budget status. The review effort label describes change size only, not security or a correctness pass. Git rename metadata, quoted UTF-8 paths with C-style escaping, file addition/deletion and mode-only changes are parsed. Each file now includes `change_kind`, `old_mode` and `new_mode`. Binary/copy/combined diffs remain unsupported.
181
+
182
+ ### `review_python`
183
+
184
+ | Argument | Meaning | Default / range |
185
+ |:--|:--|:--|
186
+ | source | Python text (required) | text |
187
+ | path | Display label, not a file path to open | snippet.py |
188
+ | start_line | First original source line represented in snippet | 1 / 1–100000000 |
189
+ | complexity_threshold | Warning threshold of simple branch score | 10 / 2–50 |
190
+ | complete_module | Allow best-effort unused import hints | false |
191
+
192
+ The AST branch score starts at one, then counts selected control-flow branches, boolean transitions, match cases and comprehensions; nested callable bodies are scored independently.
193
+
194
+ ### `review_javascript`
195
+
196
+ Supply `source`, optional `path`, `start_line` (1), and `language` (javascript, jsx, typescript, tsx). The Tree-sitter JavaScript grammar also recognizes JSX; TypeScript/TSX use their respective grammar entry points. Returns `syntax_ok`, `coverage`, bounded diagnostic findings and coordinates. The parser checks grammar, not semantics, types, framework validity or project configuration. If an installed grammar is missing/incompatible, `syntax_ok: null` and `coverage: unknown_parser_unavailable` prevent a false pass.
197
+
198
+ Python checks now also report mutable literal defaults, bare except, builtin name shadowing and possibly unused local bindings. Unused-local hints use compiler symbol tables plus conservative closure and reflection exclusions; they do not establish dead code. No source is executed.
199
+
200
+ ### `review_json`
201
+
202
+ Supply `source` (strict JSON text), optional `path` and `start_line` (defaults `document.json`, 1). Grammar checks include arrays, objects, literals, strings and numbers, including valid large-exponent numbers. Repeated keys are identified per object using their decoded names and exact one-based line/column coordinates. The tool does not validate schemas; duplicate object keys are a warning because different readers may retain different values.
203
+
204
+ ### `review_snapshot` — incremental review
205
+
206
+ A manifest is a small source-identity record, not a storage layer or attestation. Pass a batch of explicit source entries, then retain the returned metadata-only `manifest` for the next invocation.
207
+
208
+ ```json
209
+ {
210
+ "entries": [
211
+ {"path":"inventory.py","source":"def count(): return 3"},
212
+ {"path":"settings.json","source":"{\"quantity\":3}"}
213
+ ],
214
+ "complete_snapshot": true
215
+ }
216
+ ```
217
+
218
+ Next, supply entries from the current edit and the previous response's `manifest` as `previous_manifest`. You may omit unchanged paths in a partial batch, or supply a previously computed SHA-256 digest instead of source. The tool never generates digests by opening files.
219
+
220
+ | Entry field | Meaning |
221
+ |:--|:--|
222
+ | path | Logical display label, unique per batch |
223
+ | source | Explicit UTF-8 file content or fragment |
224
+ | digest | Optional lowercase SHA-256 of exact UTF-8 text; required without source |
225
+ | language | Optional python, json, javascript, jsx, typescript, tsx, go, java, csharp, dart, unknown; inferred from extension otherwise |
226
+ | complete | True for full files (default); false for fragments |
227
+ | start_line | Original line represented by first line; default 1, must equal 1 for complete files |
228
+
229
+ A supplied source and digest must match. Same-digest entries additionally need matching language, completeness, offset and review profile to skip an already reviewed file. Missing review stamp triggers analysis when source is supplied. Use `recheck_unchanged: true` to request another pass, and `complexity_threshold` to change the Python heuristic (2–50, default 10).
230
+
231
+ | Status / coverage | Meaning |
232
+ |:--|:--|
233
+ | added, changed | Identity metadata differs from previous manifest |
234
+ | unchanged | Identity metadata matches; may be checked if previously unchecked |
235
+ | removed | Not included in an explicitly complete inventory |
236
+ | omitted_unknown | Missing from a partial batch; prior metadata retained, current identity unknown |
237
+ | checked_complete / checked_fragment | Source was analyzed in this call; fragment results only cover text supplied |
238
+ | not_rechecked | Previously supplied review stamp and matching profile/digest; no analysis this call |
239
+ | unknown_digest_only / unknown_unsupported_language / unknown_input_limit / unknown_parser_unavailable | No syntax result available |
240
+
241
+ Outputs include per-file coverage, syntax status or null, finding counts, targeted test suggestions, deduplicated findings sorted by severity, and an updated metadata-only manifest.
242
+
243
+ **New in 0.3:** provide the previous report's `open_findings` array as `previous_findings` alongside `previous_manifest`. The existing `findings` array remains changed-only for backward compatibility. A separate `open_findings` array contains new findings (`state: current`) and supplied prior findings that remain relevant or uncertain (`carried_unchanged`, `carried_unknown`). A complete successful syntax review below the per-file finding cap replaces prior findings for that file; explicit removal clears them. Partial/unknown/invalid reviews preserve prior observations conservatively. `omitted_open_findings` reports the aggregate cap; preserve uncapped records separately if needed. A stamp saying `reviewed: true` means reviewed, **not clean**; stamps from callers are not independently verified. A null syntax result never means a pass.
244
+
245
+ Use `complete_snapshot: true` only when the supplied list represents the full inventory; otherwise omission never means deletion. Snapshot requests cap each manifest at 100 entries, each source at 256 KiB/6,000 LF-delimited lines, and combined raw source at 1 MiB. JSON nesting is capped at 100. Up to 100 distinct findings are returned per review; snapshot reports aggregate omitted findings from available per-source results. Run a focused direct review if a source's own cap is reached.
246
+
247
+ Example stdin request: `examples/snapshot.json`. The host can retain the returned manifest between calls; PatchPilot does not persist it.
248
+
249
+ ### `export_sarif`
250
+
251
+ Converts an explicitly supplied `findings` array (including snapshot `open_findings`) to SARIF 2.1.0. Ordinary review rule identifiers, severity, source labels/locations, evidence designation and stable fingerprints are retained. The CLI `patchpilot sarif` accepts a findings array or a report object from stdin and writes SARIF JSON to stdout. No reports are written to disk automatically and no vulnerabilities or security claims are generated.
252
+
253
+ ## What is new in 0.4
254
+
255
+ Supply the **post-edit file** alongside the exact diff, instead of reviewing standalone snippets alone. Added files must match the entire supplied source. Existing files require matching hunk text and coordinates; a supplied baseline additionally verifies outside-hunk text. Unknown input, missing sources and capped findings/diagnostics are not represented as a complete review. A full-file syntax error is reported even outside changed lines.
256
+
257
+ ```sh
258
+ python -m patchpilot changed < examples/changed.json
259
+ python -m patchpilot source < examples/source.json
260
+ python -m patchpilot signature < examples/signature.json
261
+ python -m patchpilot changed < examples/changed.json > review.json
262
+ ```
263
+
264
+ | New MCP tool | Explicit request fields | Contract |
265
+ |:--|:--|:--|
266
+ | `review_source` | `source`, `path`, optional `language`, `config_toml`, `complete`, `start_line`, `complexity_threshold` | Language-specific structured observations; syntax is nullable if unsupported/unavailable. |
267
+ | `review_changed` | `diff`, `entries`, optional `config_toml` | Entries contain `path`, `source`, optional `previous_source` and `language`. Changed-line, immutable full-file syntax, and outside-line findings are separated. |
268
+ | `compare_call_signature` | `call_source`, `signature`, optional `language` | Compares explicit simple direct calls to a supplied Python parameter or JS positional contract. No dynamic/import/type resolution. |
269
+ | `import_external_sarif` | `sarif_text`, optional `diff` | Normalizes already-generated SARIF metadata only. External provenance is unverified; separate locations/results retained; unresolved labels not discarded. |
270
+ | `compact_report` | `report`, optional `max_findings` (1–50 per group) | Prioritizes severity; retains hidden known counts, omitted unknown-severity counts and unknown coverage. Retain full reports for future review. |
271
+ | `suggest_formatting_patch` | `diff`, `entries` | Suggests ordinary formatting-only trailing whitespace corrections for context-validated LF Python/JSON where syntax/AST equivalence checks permit; never applies a patch. |
272
+
273
+ `review_changed` exposes `coverage_complete`, `findings`, `outside_changed_findings`, `suppressed_findings`, `policy_diagnostics`, per-group omission counts and file coverage. Only a matching supplied baseline can mark an unchanged observation `preexisting_verified`. Without it, observations outside added lines remain `outside_changed_lines_unverified`; a matching baseline may instead indicate newly observed behavior. `coverage_complete` refers to the explicitly supplied scope, not proof that code works. Check active findings and tests separately.
274
+
275
+ ### Explicit rule policy
276
+
277
+ Supply this TOML string as `config_toml` with each relevant call. The tool does not load configuration automatically.
278
+
279
+ ```toml
280
+ [review]
281
+ complexity_threshold = 12
282
+ [rules]
283
+ MUTABLE_DEFAULT = "warning"
284
+ [path_rules."tests/*".rules]
285
+ POSSIBLY_UNUSED_LOCAL = "off"
286
+ ```
287
+
288
+ Inline `# patchpilot: ignore=MUTABLE_DEFAULT reason="intentional shared default"` (or an actual `//` comment in JS/TS) applies only to a matching heuristic on the same line. Suppressions and invalid or unmatched directives are reported. Parse errors cannot be suppressed; a factual finding cannot be disabled.
289
+
290
+ ### Language coverage and interoperable output
291
+
292
+ Go, Java, C# and Dart have syntax-only Tree-sitter coverage through `review_source`, `review_changed` and `review_snapshot`. JS/TS additionally has conservative duplicate simple lexical declarations and directly unreachable statement hints. No compiler typechecking, cross-file reference analysis or framework-specific validation. Unsupported grammars explicitly return unknown. The manually selected MCP prompt `bounded_review` explains the incremental workflow; it is not applied automatically. [Versioned result schemas](schemas/tool-results-v0.4.1.json) are generated without connectivity and conformance is tested over actual MCP stdio.
293
+
294
+ ### How it complements other tools
295
+
296
+ | Tool | Scope |
297
+ |:--|:--|
298
+ | PatchPilot | Caller-supplied diff and source, changed-line context, bounded quality heuristics and retained metadata. |
299
+ | [Ruff](https://docs.astral.sh/ruff/) | Python linter and formatter with a broader Python rule catalog; use separately when appropriate. |
300
+ | [Semgrep](https://semgrep.dev/docs/) | Separate pattern analysis engine with a much larger rule ecosystem. PatchPilot does not perform its scanning or reproduce its findings. |
301
+
302
+ PatchPilot is not a replacement for compilers, project tests, dedicated linters or reviewed security tools. It does not estimate provider billing or guarantee savings.
303
+
304
+ See [optional workflows](examples/WORKFLOWS.md) for manual pre-commit, a local container, MCP host configurations and handling a previously reviewed SARIF artifact. These are examples, not evidence of an executed CI, container build, or host installation.
305
+
306
+ ## Measured changed-only performance (v0.4.0)
307
+
308
+ On a **synthetic 60-file project, two edited files**, the earlier v0.4.0 benchmark
309
+ compares fresh full source input with a caller-retained incremental
310
+ manifest. Both paths send the same explicit diff, produce equal complete
311
+ manifests and matching open-finding identities; 58 unchanged files are not
312
+ freshly analyzed.
313
+
314
+ | Measured input / local CLI latency | Full | Incremental |
315
+ |---|---:|---:|
316
+ | UTF-8 bytes | 272,833 | 29,393 |
317
+ | Input tokens (tiktoken 0.14.0, o200k_base) | 76,427 | 11,149 |
318
+ | Median local CLI wall time (11 repeats) | 330.924 ms | 106.526 ms |
319
+
320
+ **85.4% fewer measured tokenizer input tokens** and
321
+ a **3.11× full-to-incremental latency ratio** in this synthetic
322
+ workload. A one-time full baseline is required. This is not actual billed
323
+ API usage, model latency, real-world accuracy, or a general guarantee.
324
+ See [benchmark methodology and reproducible inputs](benchmarks/BENCHMARK.md).
325
+
326
+ A separate hand-labeled check of three benign public commits (six file snapshots) matched both expected unused-import observations and reported no unexpected findings on that tiny selected sample; not a general false-positive estimate.
327
+
328
+ ## Instruction template for coding agents
329
+
330
+ Add the following to your project-specific Codex/Claude instructions if you want a review after every edit:
331
+
332
+ ```text
333
+ After each edit (including new code):
334
+ 1. Supply only the current unified diff to PatchPilot review_diff.
335
+ 2. Supply the changed full source with review_changed, and the matching
336
+ previous_source where available. If only a fragment is available, use
337
+ review_source with the correct offset and complete=false.
338
+ 3. Review changed JSON with review_json and JS/TS/JSX/TSX with
339
+ review_javascript. For repeated batches, carry the
340
+ review_snapshot manifest forward and inspect previously unknown coverage.
341
+ 4. Report error-level findings first; validate warnings and heuristics
342
+ against the surrounding behavior before changing anything.
343
+ 5. Fix verified problems, preserving existing behavior and scope.
344
+ Re-run both reviews on the revised change. Run the smallest relevant
345
+ project test set using the project's normal test tooling.
346
+ 6. Finish with a summary of findings addressed, remaining limitations,
347
+ and actual test results. Never claim tests passed unless they ran.
348
+ ```
349
+
350
+ This is a caller-side convention, not an automatic watcher or enforcement hook. Python, JSON and JS/JSX/TS/TSX have the documented language-specific checks. Go, Java, C# and Dart have grammar-only coverage using installed parsers; other languages are unknown. Unknown coverage is not a syntax pass.
351
+
352
+ ## Boundaries
353
+
354
+ - Each input is capped at 256 KiB and 6,000 lines. Diff sections: 100. Python AST: 20,000 nodes. Findings: 100. Test-plan line targets: first 30 added and first 30 removed lines per file, separately.
355
+ - Standard text unified diffs with file headers and hunks, Git C-style quoted UTF-8 labels, rename and mode-only metadata are supported. Binary, copy, non-UTF-8 labels and combined diffs are unsupported. File labels are never opened; timestamps are supported only when tab-separated.
356
+ - Syntactically valid code can still be wrong. Code fragments depending on omitted context may report syntax errors in isolation. Import hints are conservative, cannot resolve dynamic references or side effects, and must not be interpreted as proof of dead code.
357
+ - No type checking, dependency analysis, whole-project context, runtime behavior validation, vulnerability discovery, test execution, automatic editing or general autoformatting. A formatting-only suggestion may remove trailing whitespace from verified changed lines without applying it.
358
+ - Do not supply secrets or personal data. PatchPilot works with input text only, but the caller controls how text reaches its MCP host.
359
+
360
+ ## Development
361
+
362
+ ```sh
363
+ python -m pip install ".[test]"
364
+ ruff check patchpilot tests tools benchmarks
365
+ black --check patchpilot tests tools benchmarks
366
+ python -m unittest discover -s tests -v
367
+ python tools/generate_schemas.py --check
368
+ python -m tools.self_check
369
+ ```
370
+
371
+ The maintainer-only quality gate reviews this repository’s Python package, tests, tools and benchmark scripts at the normal threshold without an allowlist or a raised threshold. It fails on every finding, unknown coverage, omission or suppression; it is a scoped static check, not a correctness proof.
372
+
373
+ Tests cover diff parsing, exact line mapping, malformed and bounded inputs, Python syntax/context, branch score, dictionary keys, definition and import hints, JSON grammar and duplicate coordinates, changed-only snapshot behavior, profile changes, digest-only coverage, findings caps and stable IDs, CLI output and the official MCP client over a real stdio session. Static grammar checks and five Hypothesis properties (four × 75 and one × 50 generated examples). See the [release evidence](RELEASE_EVIDENCE.md) for actual test counts, coverage and limitations. Docker, pre-commit runner and desktop MCP hosts have not been tested here. The GitHub Actions workflow is configured for Python 3.10 and 3.12 on Linux, Windows and macOS; consult actual workflow results.
374
+
375
+ ## Distribution status and migration
376
+
377
+ Version 0.4.1 preserves all twelve tools and older public Python imports while splitting analysis implementation. Version 0.4.0 introduced six additional tools and one manually selected prompt; 0.4.1 retains these and the manifest fields. Review profiles now include 0.4.1 and explicit rule policy, so old review stamps will not skip a changed-rule review; resupply source for full coverage. See [CHANGELOG.md](CHANGELOG.md).
378
+
379
+ The [server.json](server.json) follows the [official MCP Registry schema](https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json) and prepares future distribution through PyPI. It is metadata only; this 0.4.1 release has not been published or listed in the registry. Install from source as shown above. A manually dispatched release workflow is prepared for future PyPI trusted publishing; it does not publish on pushes and requires an explicitly enabled publish input plus authorized PyPI trusted-publisher configuration.
380
+
381
+ MIT licensed. See [LICENSE](LICENSE) and [THIRD_PARTY.md](THIRD_PARTY.md).
@@ -0,0 +1,24 @@
1
+ patchpilot/__init__.py,sha256=vHzWL2zBxZuXj0tfCtgPFPqV1klsZKSkT2FICokE3z0,91
2
+ patchpilot/__main__.py,sha256=8FtK2eZLrYY0wSIv8AsJfw7b2nOAthN-yk1ijrLj8pI,8121
3
+ patchpilot/analysis.py,sha256=PUlkYRs7VDF_3iLsphLRiONw-g2b0DlOWEp0nNyY0Jk,554
4
+ patchpilot/changed.py,sha256=2ZbOhxD1JOkGITeCAEfWw1mdERE_OTweLGCA77KA-G0,16522
5
+ patchpilot/common.py,sha256=2qe1ak20QrKDApDee-As_ngsKlFbhEpdaU4wJQ6is8k,1952
6
+ patchpilot/compact.py,sha256=SxE4oNt56ZldBWaiMN8MDv-vuL7ogZZoY8v-yZCLbNg,9806
7
+ patchpilot/config.py,sha256=x14NzS1UpCBG6C_OS2nd79VMCO_8ighxantrf01wHAQ,7252
8
+ patchpilot/diff.py,sha256=umyZ01_Pbe-brllCe8_wOHY5QfQsMtISQO-r4WWaipQ,19266
9
+ patchpilot/external_sarif.py,sha256=3IP4_1jUZ8G4bGLD4J2oSAbeM4l_9XdGfpGo13QW3Eg,7343
10
+ patchpilot/formatting.py,sha256=USpxehHb7zVtlMUjtE2_l0ZK5QAYCcHnLsFPDfrZoFs,6040
11
+ patchpilot/js_review.py,sha256=Hjd3UR1sXjVfthudlGVbtT_mjjlFfwQdNVWg3MwI3j8,8585
12
+ patchpilot/json_review.py,sha256=7U_LDOjiXzHzY0Awy52xov-mlNB1BYHovwKAIz1hdyo,5704
13
+ patchpilot/python_review.py,sha256=EF5-taxSKY4kxBPuATK8bES0nKs0d6NwohvPxrV_uwo,10682
14
+ patchpilot/python_rules.py,sha256=5Hx3YhGy5iThETotQqwD0LKbnyHkuOu_EzWBFgwrEsA,7426
15
+ patchpilot/sarif.py,sha256=IyJQZbZ_v7g01cl1oHjWxcu6fQ9DyGP26oaB9JWN9yA,2198
16
+ patchpilot/server.py,sha256=UY9156rwlQfwmGSjOQdSuswjuPnqtIV8FgqXYmynouk,9904
17
+ patchpilot/signatures.py,sha256=fxNhKuam76GQ1yzaSUiQVsqXLmpx7x8QBgS7CwYOWu8,7927
18
+ patchpilot/snapshot.py,sha256=byFfZATyw4vt__T_YqxNzC55jG8vYZPzXNdraJ0p2Fo,18674
19
+ patchpilot_mcp-0.4.1.dist-info/licenses/LICENSE,sha256=NCfqM6lB-F3EsSWS0OfHwYqjFprLg30tHDud5MDIY-I,1068
20
+ patchpilot_mcp-0.4.1.dist-info/METADATA,sha256=aVthBQdCafcN6Lknt79XAKhh8Tq2H87sIBNi3EmQ_L0,28735
21
+ patchpilot_mcp-0.4.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
22
+ patchpilot_mcp-0.4.1.dist-info/entry_points.txt,sha256=rVWPqkTevl8-84gRmQTpINKIRpb6L4o2T9-gssP8x4g,96
23
+ patchpilot_mcp-0.4.1.dist-info/top_level.txt,sha256=l5nQrhPQIeTCpw2myvIejER6Zp4SQlJjBO0_Zrecu7g,11
24
+ patchpilot_mcp-0.4.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ patchpilot = patchpilot.__main__:main
3
+ patchpilot-mcp = patchpilot.server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ahmed Saeed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ patchpilot