Skip to main content

xtrshow

Code Extraction & Patching Made Easy

PyPI Version Python Versions License

CI Status Downloads

xtrshow is a CLI suite that closes the loop between your local codebase and AI coding assistants (ChatGPT, Claude, Gemini, etc.). It removes the two biggest points of friction in AI-assisted development:

  1. Getting code INTO the LLM — interactively select files and format them with line numbers so the model can anchor edits to exact locations.
  2. Getting code OUT of the LLM — apply the model's changes safely, atomically, and reversibly, without copy-pasting dozens of snippets.

No API keys, no agents, no daemons. It works with any chat interface — including free tiers — because the "protocol" is just text.

Installation

pip install xtrshow

Installs two commands: xtrshow (the extractor) and xtrpatch (the patcher).

Quickstart: Extract → Prompt → Apply

1. Extract context. Select files in the TUI; the formatted output goes to stdout:

xtrshow | pbcopy        # macOS
xtrshow | xclip -sel c  # Linux
xtrshow | clip          # Windows

2. Prompt. Paste the context into your LLM along with the patch-format instructions:

xtrshow -p   # prints a copy-pasteable instruction block

3. Apply. Save the LLM's reply to a file and apply it:

xtrpatch changes.txt

Made a mistake? xtrpatch --revert changes.txt unwinds every file the patch touched.

Tip: Iterating on the same files? xtrshow --update re-exports your last selection without opening the TUI.

👉 Read the Full Getting Started Guide

Why not just use git diffs?

LLMs are unreliable at producing valid unified diffs — line numbers drift, context lines get hallucinated, and one bad hunk poisons the file. xtrpatch uses a Search & Replace block format designed around how models actually fail:

  • Fuzzy whitespace matching absorbs the indentation errors models constantly make.
  • Wildcard anchors (~~~~) let the model match on stable signatures and skip volatile interior lines.
  • Tail context disambiguates near-duplicate blocks with a lookahead check.
  • Per-hunk annotations (@ why this change) surface in the apply report, so failures are self-describing and feed straight back into the LLM for self-correction.

Features

xtrshow (The Extractor)

  • Interactive TUI: fast, keyboard-driven file selection with directory expand/collapse and live size stats.
  • LLM-optimized output: line-numbered content with --- a/path headers the patcher can target.
  • File metadata: each export block carries a # meta: line with size, line count, modified/created dates, permissions (mode 0755 (rwxr-xr-x)), owner, and a SHA-256 digest so the model can tell at a glance whether it has already seen a file (--no-meta to omit the line, --no-hash for just the digest).
  • Smart filtering: ignores node_modules, .git, build artifacts, and friends by default (--no-ignore to disable).
  • Re-export: --update replays your last selection from the saved manifest.
  • Multi-file export: --multi writes one file per selection — useful for RAG pipelines.
  • Prompt printer: -p emits the LLM instruction block for the patch format.

xtrpatch (The Patcher)

  • Safety first: automatic, versioned backups in .xtr/backup/ before every modification.
  • Checksum verification: warns when a file was edited outside the patch loop since the last apply.
  • Conflict detection: overlapping hunks are caught pre-flight and skipped, never blindly stacked.
  • Full lifecycle: modify, insert, create files, delete sections, delete whole files (! DELETE FILE), replace a file wholesale (! DELETE FILE + a create block).
  • Renames: ! REPLACE old => new renames a whole word everywhere in a file, instead of a pile of one-line hunks.
  • Commit requirements: a patch can start with ! REQUIRES <commit>, and is refused until that commit is in your branch.
  • Permissions and ownership: ! CHMOD +x / ! CHMOD 644 and ! CHOWN user:group lines under a file header, applied after that file's hunks and restored by --revert. Adding setuid/setgid/sticky bits needs --allow-special-modes.
  • Idempotent: re-applying a patch detects already-applied hunks and skips them.
  • Error reports: failed applies generate a .rpterr bundle (original + patch + log) you can paste straight back to the LLM.
  • Undo button: --revert restores the most recent backup — per file, or for every file in a patch.
  • Git commit: -gc commits exactly the files the patch changed, with the patch's @ comments as the message. Works with --revert too. Every git check runs before a file is touched.

License

Apache 2.0

Metadata

Release files for xtrshow 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xtrshow 1.4.0
File Size Uploaded Provenance Actions
xtrshow-1.4.0.tar.gz 78.7 kB With provenance Details for xtrshow-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xtrshow 1.4.0
File Interpreter ABI Platform Actions
xtrshow-1.4.0-py3-none-any.whl Python 3 none any Details for xtrshow-1.4.0-py3-none-any.whl

Total release size: 122.7 kB

Release files / xtrshow-1.4.0.tar.gz

Download URL xtrshow-1.4.0.tar.gz
Size 78.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aab5bb8b5dfbf2f719b7c8bddf9450825334decb61fdbeb8f01f3c7453ec132b
BLAKE2b-256 checksum
How to use checksums
854fc736cbdb466ee52f773bb2c8aacaf025e676189445f9e42bae6c414f5faf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / xtrshow-1.4.0-py3-none-any.whl

Download URL xtrshow-1.4.0-py3-none-any.whl
Size 44.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e04d3748dd8355461cd6a553795df998fc65163969da1b2316c05d2bcf54ef7
BLAKE2b-256 checksum
How to use checksums
596601900a596138c7b74af9126018685e679b5facc7f05dc62198401dda7f18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for xtrshow 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xtrshow-1.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page