Skip to content

Saik0s/code_diff_doc_gen

Repository files navigation

Code Diff Doc Gen

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.

Features

  • 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

Installation

  1. Install uv:

    pip install uv
  2. Clone the repository:

    git clone https://github.com/your-username/code-diff-doc-gen.git
    cd code-diff-doc-gen
  3. Install dependencies:

    uv sync

Usage

  1. Set your OpenAI API key:

    export OPENAI_API_KEY=your-key-here

    You can also set the OPENROUTER_API_KEY and OPENROUTER_BASE_URL environment variables if you are using OpenRouter.

  2. 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.

CLI Commands

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

Output

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.

Development

  1. Clone the repository:

    git clone https://github.com/your-username/code-diff-doc-gen.git
    cd code-diff-doc-gen
  2. Install dependencies:

    uv sync
  3. Run tests:

    pytest
  4. Format code:

    black src tests

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published