DiffGraph-CLI is a powerful command-line tool that visualizes code changes using AI. It reads your current git diffs and untracked files, uses AI to understand the implications of your changes, and generates a beautiful, shareable HTML report with a dependency graph.
- 📊 Visualizes code changes as a dependency graph
- 🤖 AI-powered analysis of code changes
- 🌙 Dark mode support
- 📝 Markdown-formatted summaries
- 🔍 Syntax highlighting for code blocks
- 📱 Responsive design
- 🔄 Works with both tracked and untracked files
- Clone the repository:
git clone https://github.com/yourusername/DiffGraph-CLI.git
cd DiffGraph-CLI- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows, use: venv\Scripts\activate- Install the package:
pip install -e .- Set up your OpenAI API key:
# Create a .env file in the project root
cp .env.example .env # On Windows, use: type nul > .envAdd your OpenAI API key to the .env file
Note: The
.envfile is git-ignored for security reasons. Make sure to keep your API key secure and never commit it to version control.
Basic usage:
wildThis will:
- Read your current git changes
- Analyze them using AI
- Generate an HTML report (
diffgraph.html) - Open the report in your default browser
--api-key: Specify your OpenAI API key (defaults to OPENAI_API_KEY environment variable)--outputor-o: Specify the output HTML file path (default: diffgraph.html)--no-open: Don't automatically open the HTML report in browser--structural-json: Write a local Python structural DiffGraph v2 artifact to the given path (-for stdout). Applies towild diffonly.--version: Show version information
Example:
wild --output my-report.html --no-openA deterministic, network-free Python baseline can be written as a validated DiffGraph v2 artifact without changing the existing AI/HTML default:
wild --structural-json diffgraph.json diff
wild --structural-json staged.json diff --staged -- src/
wild --structural-json - diff -- path/to/file.pyThis increment intentionally supports only local unstaged (index → working
tree) and staged (HEAD → index) snapshots. Put pathspecs after --.
Pathspecs are interpreted relative to the directory where wild is invoked,
matching Git's command-line behavior. Commit ranges are rejected rather than
analyzed with guessed semantics.
Python (.py) is the only language with structural symbol/import extraction in
this baseline. Other changed files remain in files[] and receive a scoped
UNSUPPORTED_LANGUAGE warning. Syntax/decoding failures receive a scoped
PARSE_FAILURE warning and do not produce invented symbol changes. Import
targets are explicitly labeled unresolved/external; no project-wide resolution
is claimed. Every file records old/new paths, modes, Git object IDs, and content
SHA-256 values in structural evidence, while symbol/relationship evidence names
the parser package, query revision, and source blob identity.
The generated HTML report includes:
- A summary of code changes
- A Mermaid.js dependency graph
- Syntax-highlighted code blocks
- Dark mode support
- Responsive design for all screen sizes
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Mermaid.js for graph visualization
- Highlight.js for syntax highlighting
- Tailwind CSS for styling
- OpenAI for AI capabilities