A semi-autonomous framework for easily developing repo-wide changes
Project description
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.
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
- Directory Content Copying: Quickly copy formatted directory trees and file contents to clipboard
Requirements
- Python 3.11 or 3.12 (untested for others)
- Git installed and available in PATH
- Anthropic API key
- UNIX like OS
Installation
# Install using uvx
uvx diffdev
# Set your Anthropic API key
export ANTHROPIC_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
Commands
select: Open file selector to update contextundo: Rollback last applied changesredo: Reapply last rolled back changesexit: Exit diffdev
Directory Content Copying
To quickly copy a directory's tree structure and file contents:
# Copy current directory
diffdev --copydir
# Copy specific directory
diffdev --copydir /path/to/directory
This formats the output with line numbers and proper tree structure, respecting gitignore patterns.
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
- Files in the current context should be continuously updated as the chat progresses
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diffdev-0.1.8.tar.gz.
File metadata
- Download URL: diffdev-0.1.8.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33239931266c76ab555f3427312ade950d77f77370befe6700f1fa61cb1e8522
|
|
| MD5 |
79f316ab5170429816e273888b9f5e79
|
|
| BLAKE2b-256 |
d64147ef72054abad9da7454f7a674383f0afaf91a1118569e59946e509f7c4d
|
File details
Details for the file diffdev-0.1.8-py3-none-any.whl.
File metadata
- Download URL: diffdev-0.1.8-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6125f6cb612301378e4a4a77ae48887024eac7c95d3775ed91e7bbb7ce90e0b
|
|
| MD5 |
dbcc20cff8a9488109f79a700eed2019
|
|
| BLAKE2b-256 |
341014f78ae53d2289b90eab16a0bd273f110ffe6939a979b8309cc80e13aed6
|