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, 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).
  • 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.

License

Apache 2.0

Metadata

Release files for xtrshow 1.3.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.3.0
File Size Uploaded
xtrshow-1.3.0.tar.gz 46.2 kB Details

Built distribution (wheel)

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

Total release size: 74.9 kB

Release files / xtrshow-1.3.0.tar.gz

Download URL xtrshow-1.3.0.tar.gz
Size 46.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c278f49de74f236a60fb6c2e1ec46d54f0553f4d09ae9e4d585731a289cdf60d
BLAKE2b-256 checksum
How to use checksums
55edcc82e200ae5e2f47dc73d065ce34d4ae0d2fe62f95adef9cf1ad2f3f4932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 29, 2026.

Transparency log

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

Download URL xtrshow-1.3.0-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd5753748ba813ed01b4ff441eb82536b6af4df8771dd556200406ba91999dcd
BLAKE2b-256 checksum
How to use checksums
3daf2080a754791af284b47f34619676b2323688f60e7b12438036a7e71aa3ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

2 release files

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