Nothing touches disk until you say so.
A deterministic desktop tool for reviewing, validating, and applying unified diff patches to a local project directory.
Patch Studio exists because command-line patch tools will happily half-apply a diff and leave you to work out what happened. This one won't: nothing touches disk until a dry-run has succeeded and you have explicitly confirmed it.
Normalize → Parse → Preflight → Preview → Apply. Every stage is visible, every write is backed up, every path is bound to the workspace root.
- Select a workspace root. Every patch path resolves relative to it. Anything that escapes the root is blocked.
- Load a patch from a file or paste it in. Git, index-style, and classic unified diffs are detected automatically.
- Preflight. Resolves each referenced file and reports what's ready, missing, blocked, or binary — before anything runs.
- Preview. A full in-memory simulation. Conflicts surface here, not on your filesystem.
- Apply. Enabled only after a clean preview. Backs up, then writes atomically.
Apply stays disabled until preview succeeds. Conflicted output stays blocked unless you explicitly unblock it in Advanced.
Diff dialects: diff --git, index-format, classic unified. Dialect detection is automatic.
Operations: create, modify, delete, rename (gated), mode change (gated).
Preview engine: in-memory simulation, conflict detection ahead of apply, explicit blocking on unsafe conditions, no silent partial application.
Backups: every modified file is copied to <root>/.patchstudio_backups/<timestamp>/ before it is touched. Writes are atomic.
Advanced controls (hidden by default — these deliberately relax the gates):
| Control | Effect |
|---|---|
| Strict filename match | Refuse near-miss path resolution |
| Best-effort fuzzy apply | Search a window around the expected line |
| Ignore whitespace differences | Match context ignoring leading/trailing space |
| Conflict marker mode | Emit 3-way style markers instead of failing |
| Allow rename/delete/mode changes | Ungate metadata operations |
| Partial apply per-file override | Let a file apply with some hunks failed |
| Preserve original line endings | Keep CRLF/LF as found (on by default) |
| Allow writing conflicted output | Write files containing conflict markers |
| Skip unsupported binary files | Continue past binary hunks (on by default) |
Dark instrument-panel aesthetic: obsidian ground, teal for focus and active state, phosphor green for go, amber for gated, red for blocked. Monospace throughout, zero-radius controls, hairline rules.
State is carried by colour, not decoration. Each session card has an accent rail — grey for nothing loaded, teal for loaded, green for armed, amber for gated, red for blocked — so the state of the apply gate is legible at a glance.
Every colour in the app comes from one token table in patchstudio/ui/theme.py. Nothing else in the package hard-codes an RGB value, so retheming is a single-file edit.
Requires Python 3.10+ and PyQt6.
pip install -r requirements.txtRun from the src directory:
python -m patchstudio.appOr via the entry script:
python run_patchstudio.pyBuilt-in engine checks, no GUI required:
python -m patchstudio.app --selftestTest suite — run from the repo root:
pytestpytest.ini puts src/ on the path, so pytest src/tests and pytest both work from anywhere in the tree. Headless environments need QT_QPA_PLATFORM=offscreen.
Package layout:
patchstudio/
core/ normalizer · parser · applier · diffgen · models · selftests
ui/ theme · main_window · models · delegates · dialogs
Core carries no Qt dependency and can be driven headlessly.
- Determinism over automation
- Operator visibility over silent correction
- Explicit gating over implicit behaviour
- Safety over speed
- Reversibility over convenience
Patch Studio is not a Git client, a history manager, a 3-way merge tool, or a CI/CD replacement. It operates strictly on the current filesystem state.
- CLI-only execution mode
- Patch signing and integrity verification
- Richer conflict visualisation
- Structured log export
Apache License 2.0 — see LICENSE and NOTICE.
Copyright © 2026 Leon Priest (7h3v01d).
