Code Diff Doc Gen is a tool for generating and analyzing code differences with LLM assistance. It automates the process of documenting code changes, generating code implementations from descriptions, and comparing original and generated code to highlight differences.
- Automates code documentation and analysis using LLMs
- Generates code implementations from natural language descriptions
- Compares original and generated code, highlighting key differences
- Provides a clear and easy-to-use CLI interface
- Supports multiple programming languages
- Uses a prompt improvement system to refine code generation
-
Install
uv
:pip install uv
-
Clone the repository:
git clone https://github.com/your-username/code-diff-doc-gen.git cd code-diff-doc-gen
-
Install dependencies:
uv sync
-
Set your OpenAI API key:
export OPENAI_API_KEY=your-key-here
You can also set the
OPENROUTER_API_KEY
andOPENROUTER_BASE_URL
environment variables if you are using OpenRouter. -
Run the tool:
python -m code_diff_doc_gen run ./src --round 1
This command will process the source code in the
./src
directory, generate code implementations, analyze the changes, and generate system prompts for the next round of code generation.
-
run
: Processes source code, generates code, analyzes changes, and generates system prompts.python -m code_diff_doc_gen run <source_dir> --round <round_num>
<source_dir>
: The directory containing the source code to process.--round <round_num>
: The generation round number (default: 0).
See cline_docs/cli_commands.md for more details.
The tool creates a .codescribe
directory with the following structure:
descriptions/
: Contains descriptions of the processed source files.generated/
: Contains the generated code implementations for each round.analysis/
: Contains diffs and analysis reports comparing original and generated code.prompts/
: Contains system prompts used for code generation.
-
Clone the repository:
git clone https://github.com/your-username/code-diff-doc-gen.git cd code-diff-doc-gen
-
Install dependencies:
uv sync
-
Run tests:
pytest
-
Format code:
black src tests
This project is licensed under the MIT License.