diffdev
diffdev is a command-line tool that helps you make repo-wide code changes using an AI assistant. It allows you to interactively select files, provide a prompt describing the desired changes, and apply the AI-generated modifications as a git patch.
This is half my experimental playground, half useful tool for the community. Pull requests for wacky experiments welcome.
Key Features
- File Selection: Use a TUI to select files to include in the context
- Context-Aware Changes: The AI assistant analyzes the selected files and your prompt to generate contextual changes
- Structured Patch Generation: Changes are returned as a git-style patch for easy application and review
- Revision Control Integration: Apply patches using
git applyand rollback changes when needed - Claude AI Assistant: Leverages the powerful Claude language model from Anthropic
- FrankenClaude Mode: Enhanced capabilities by combining multiple AI models
- Colored Output: Improved readability with color-coded responses
Installation
If you have uv installed, you can just run
uvx diffdev
Make sure you have your Anthropic API key set if you want to use the main tool. If you want to use the FrankenClaude flag you also need to have a DeepSeek key set.
export ANTHROPIC_API_KEY="your-api-key-here"
export DEEPSEEK_API_KEY="your-api-key-here"
Usage
- Navigate to your git repository
- Run
diffdev - Use the TUI to select files for context:
- Space: Toggle file/directory selection
- Tab: Expand/collapse directories
- Enter: Confirm selection
- q: Quit selection
- Enter your prompt describing the desired changes
- Review and confirm the generated patch
Run uvx diffdev --help for additional flags.
Commands
select: Open file selector to update contextundo: Rollback last applied changesredo: Reapply last rolled back changesexit: Exit diffdev
Example
$ cd my-project
$ diffdev
Starting diffdev...
Select files to include in the context:
[ ] + src/
[ ] + tests/
[ ] README.md
# After selecting files and confirming...
Enter command or prompt: Add type hints to the User class methods
# AI will analyze files and generate changes
# Changes are applied as a git patch that can be rolled back if needed
Development
Contributions are welcome! Please feel free to submit a Pull Request.
TODO
- Fix bug in TUI file selector where directories with selected files don't show filled selector
- Add agents functionality (multiple LLMs solving same problem with result aggregation)
- Support OpenAI API compatible endpoints (with port configuration)
- Allow specifying model name to use
- Add general model configuration file
- Add flag to specify API key
- Add retry/refix functionality for failed diffs
- Add retry/fix for invalid JSON LLM responses
- Enhance TUI with more color options
- Improve code modularization
- Add automatic file searching capability
- Add tool support for fetching up-to-date documentation
- Add navigation system for reviewing changes in current session
- Add reference system for previous changes in current session
Metadata
Release files for diffdev 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| diffdev-0.2.6.tar.gz | 22.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| diffdev-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.5 kB
Release files / diffdev-0.2.6.tar.gz
| Download URL | diffdev-0.2.6.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21f75710b2466ee0d9fb8570a7bdd129ab34d0c7020d82c73aa484a3c6bd40ab
|
|
BLAKE2b-256 checksum How to use checksums |
cd1b4dad826fe99a75c2e200157d15964f3ad4b8c340cc189229befa6c543428
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.10
|
Release files / diffdev-0.2.6-py3-none-any.whl
| Download URL | diffdev-0.2.6-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd80e3cb6a4e858c6a50441ef432daa08f996522fccc5053bd70772fe780fa51
|
|
BLAKE2b-256 checksum How to use checksums |
25f633a44c4e4afab28461bdadc8fbe0e9b878d9748c468c62df488efcccaa84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.10
|