{"id":42807947,"url":"https://github.com/lertsoft/difflearn","last_synced_at":"2026-02-19T16:06:32.083Z","repository":{"id":335390489,"uuid":"1145571065","full_name":"lertsoft/DiffLearn","owner":"lertsoft","description":"Understand the different commits better using DiffLearn. Download any repo and start asking question about what each commit is doing using your existing Claude Code, Codex, or Gemini CLI subscription :D","archived":false,"fork":false,"pushed_at":"2026-01-30T02:56:40.000Z","size":116,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-30T14:24:25.428Z","etag":null,"topics":["ai-assistant","cli","git-diff"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lertsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-30T00:11:45.000Z","updated_at":"2026-01-30T02:56:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lertsoft/DiffLearn","commit_stats":null,"previous_names":["lertsoft/difflearn"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lertsoft/DiffLearn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lertsoft%2FDiffLearn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lertsoft%2FDiffLearn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lertsoft%2FDiffLearn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lertsoft%2FDiffLearn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lertsoft","download_url":"https://codeload.github.com/lertsoft/DiffLearn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lertsoft%2FDiffLearn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29140049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T23:14:48.546Z","status":"ssl_error","status_checked_at":"2026-02-05T23:14:35.724Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-assistant","cli","git-diff"],"created_at":"2026-01-30T04:26:03.226Z","updated_at":"2026-02-06T00:00:58.490Z","avatar_url":"https://github.com/lertsoft.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DiffLearn 🔍\n\n**Interactive git diff learning tool with LLM-powered explanations**\n\nDiffLearn helps developers understand code changes through an interactive terminal UI with AI-powered explanations. Navigate diffs with keyboard controls, click on changes to ask questions, and get instant AI insights.\n\n![Demo](DiffLearn_Demo.gif)\n\n## Features\n\n- **🎨 Interactive Diff Viewer** - Red/green syntax highlighting with keyboard navigation\n- **💬 Click-to-Ask** - Select any change and ask questions about it\n- **🚀 Unified Dashboard** - View local, staged, and history on one screen in the terminal\n- **🔀 Commit Comparison** - Select any two commits in Web or CLI to see and analyze the diff between them\n- **🌐 Remote Web UI** - Beautiful local web interface with comparison support and AI chat\n- **🆓 Use Your Subscriptions** - Works with Gemini CLI, Claude Code, Cursor (no API fees!)\n- **🤖 API Support** - Native support for OpenAI, Anthropic, and Google AI APIs\n- **🔌 MCP Server** - Full integration with Cursor, Claude Code, and other MCP clients\n- **⌨️ Keyboard First** - Full scrolling and windowing support for large diffs and histories\n\n\n## Getting Started\n\n### One-Line Install (Recommended)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/lertsoft/DiffLearn/master/install.sh | bash\n```\n\n### Manual Installation\n\n```bash\n# Clone and install\ngit clone https://github.com/lertsoft/DiffLearn.git\ncd DiffLearn\nbun install\n\n# Run directly\nbun run dev\n\n# Or install globally\nbun link\n```\n\n### Development\n\n```bash\n# Clone and install\ngit clone https://github.com/lertsoft/DiffLearn.git\ncd DiffLearn\nbun run dev\n\n# Launch web UI\nbun run web\n\n# Run tests\nbun test\n\n# Run lint\nbun run lint\n\n# Auto-fix lint\nbun run lint:fix\n```\n\n\n## Quick Start\n\n```bash\n# 🌐 Launch the Web UI (recommended!)\ndifflearn web\n\n# Terminal: View local changes interactively\ndifflearn local\n\n# View staged changes only\ndifflearn local --staged\n\n# Compare commits\ndifflearn commit abc123\ndifflearn commit abc123 --compare def456\n\n# Compare branches\ndifflearn branch main feature/new-auth\n\n# Quick AI explanations (non-interactive)\ndifflearn explain\ndifflearn review\ndifflearn summary\n\n# Interactive Compare\ndifflearn local       # Use Tab to switch to History, then Enter to select\ndifflearn web         # Click '+' buttons next to commits to compare two SHAs\n```\n\n## Web UI Accessibility \u0026 Controls\n\nThe Web Interface (`difflearn web`) is fully accessible and keyboard-friendly:\n\n| Key | Action |\n|-----|--------|\n| `s`/`j`/`↓` | Select next commit in list |\n| `w`/`k`/`↑` | Select previous commit in list |\n| `Enter` | Select currently focused commit / Confirm comparison |\n| `a`/`←` | Switch to previous view (e.g. History → Staged) |\n| `d`/`→` | Switch to next view (e.g. Local → Staged) |\n| `/` | Focus Chat Input |\n| `Esc` | Close panels / Exit comparison mode |\n| `+` (Web) | Click the '+' button next to commits to select for comparison (max 2) |\n\n## CLI Interactive Controls\n\n| Key | Action |\n|-----|--------|\n| `Tab` | Switch between Local Changes, Staged Changes, and History |\n| `↑`/`↓` | Navigate history list or scroll long AI responses |\n| `Enter` | View diff for selected commit or file |\n| `/` / `i` | Focus AI Chat input |\n| `Esc` | Exit chat/scrolling mode back to dashboard |\n| `q` | Quit or go back from current view |\n| `c` (Chat) | Clear current chat history |\n\n### Slash Commands (type `/` in chat)\n\n| Command | Description |\n|---------|-------------|\n| `/explain` | Get AI explanation of current changes |\n| `/review` | Get AI code review with suggestions |\n| `/summarize` | Get a quick summary of changes |\n| `/update` | Check for updates |\n| `/export` | Export diff as markdown |\n| `/web` | Open web UI in browser |\n| `/config` | Show LLM configuration status |\n\n## LLM Configuration\n\n### Quick Setup (Recommended)\n\nThe easiest way to configure DiffLearn is with the interactive wizard:\n\n```bash\ndifflearn config\n```\n\nThis will:\n- Show available providers (CLI-based and API-based)\n- Guide you through authentication\n- Save configuration securely to `~/.difflearn`\n\n### CLI-Based Providers (Use your current Subscription!)\n\nUse your existing AI subscriptions without extra API costs:\n\n| Provider | Requirement |\n|----------|-------------|\n| **Gemini CLI** | [Install gemini-cli](https://github.com/google-gemini/gemini-cli) |\n| **Claude Code** | [Install claude](https://docs.anthropic.com/en/docs/claude-code) |\n| **OpenAI Codex** | [Install codex](https://github.com/openai/codex) |\n| **Cursor** | [Install Cursor CLI](https://cursor.com/docs/cli/overview) |\n\nLogin commands (provider-specific):\n\n```bash\n# Gemini CLI (interactive login selection)\ngemini\n\n# Claude Code (interactive, then type /login)\nclaude\n\n# OpenAI Codex\ncodex login\n\n# Cursor CLI\nagent login\n```\n\n```bash\n# Check which providers are available\ndifflearn config --status\n\n# Example: Use Gemini CLI\nexport DIFFLEARN_LLM_PROVIDER=gemini-cli\n```\n\n### Local LLM Providers (Free \u0026 Private!)\n\nRun AI locally on your machine with no API costs and full privacy:\n\n| Provider | Default URL | Setup |\n|----------|-------------|-------|\n| **Ollama** | `localhost:11434` | [Install Ollama](https://ollama.com) + `ollama pull llama3.2` |\n| **LM Studio** | `localhost:1234` | [Install LM Studio](https://lmstudio.ai) + start local server |\n\nThe easiest way to configure is with the wizard, which detects your downloaded models:\n\n```bash\ndifflearn config\n# Select Ollama or LM Studio, then choose from your available models\n```\n\nOr set environment variables directly:\n\n```bash\n# Use Ollama\nexport DIFFLEARN_LLM_PROVIDER=ollama\nexport DIFFLEARN_MODEL=llama3.2\n\n# Use LM Studio\nexport DIFFLEARN_LLM_PROVIDER=lmstudio\n\n# Custom base URL (if not using default port)\nexport DIFFLEARN_BASE_URL=http://localhost:8080/v1\n```\n\n### API-Based Providers\n\nFor direct API access (pay-per-use):\n\n```bash\n# Option 1: OpenAI (default)\nexport OPENAI_API_KEY=sk-...\n\n# Option 2: Anthropic\nexport ANTHROPIC_API_KEY=sk-ant-...\nexport DIFFLEARN_LLM_PROVIDER=anthropic\n\n# Option 3: Google AI\nexport GOOGLE_AI_API_KEY=...\nexport DIFFLEARN_LLM_PROVIDER=google\n\n# Optional: Custom model\nexport DIFFLEARN_MODEL=gpt-4o-mini\n```\n\n### Configuration File\n\nDiffLearn stores config in `~/.difflearn`:\n\n```bash\n# ~/.difflearn\nDIFFLEARN_LLM_PROVIDER=gemini-cli\nOPENAI_API_KEY=sk-...\n```\n\nEnvironment variables override the config file.\n\n\u003e **Note:** DiffLearn works without an API key! When no LLM is configured, it outputs formatted prompts you can use with any AI tool.\n\n## MCP Integration\n\n### Cursor / Claude Code\n\nAdd to your MCP configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"difflearn\": {\n      \"command\": \"bun\",\n      \"args\": [\"run\", \"/path/to/DiffLearn/src/mcp/server.ts\"]\n    }\n  }\n}\n```\n\n### Available MCP Tools\n\n- `get_local_diff` - Get uncommitted changes\n- `get_commit_diff` - Get diff for a commit\n- `get_branch_diff` - Compare branches\n- `get_commit_history` - List recent commits\n- `explain_diff` - AI explanation of changes\n- `review_diff` - AI code review\n- `ask_about_diff` - Ask questions about changes\n\n## REST API\n\n```bash\n# Start API server\ndifflearn serve --api --port 3000\n\n# Endpoints\nGET  /diff/local                    # Local changes\nGET  /diff/commit/:sha              # Single commit or comparison (using ?compare=sha2)\nGET  /diff/branch/:b1/:b2          # Branch diff\nGET  /history                       # Commit history with windowing support\nPOST /explain                       # AI explanation (supports commit/staged/compare)\nPOST /review                        # AI code review (supports commit/staged/compare)\nPOST /ask                           # Ask questions (supports commit/staged/compare)\nPOST /summary                       # Quick summary (supports commit/staged/compare)\n```\n\n## CLI Commands\n\n| Command | Description |\n|---------|-------------|\n| `local [--staged]` | View local changes interactively |\n| `commit \u003csha\u003e [--compare \u003csha2\u003e]` | View commit diff |\n| `branch \u003cb1\u003e \u003cb2\u003e` | Compare branches |\n| `explain [--staged]` | AI explanation |\n| `review [--staged]` | AI code review |\n| `summary [--staged]` | Quick summary |\n| `export [--format json\\|markdown]` | Export diff |\n| `history [-n count]` | List commits |\n| `web [-p port]` | Launch the web UI |\n| `config [--status]` | Configure LLM provider |\n| `serve --mcp\\|--api` | Start server |\n\n\n## Architecture\n\n```\nsrc/\n├── cli/\n│   ├── index.tsx         # CLI entry point\n│   └── components/\n│       ├── App.tsx       # Main app component\n│       ├── DiffViewer.tsx # Interactive diff viewer\n│       └── ChatPanel.tsx  # Q\u0026A chat panel\n├── git/\n│   ├── extractor.ts      # Git operations\n│   ├── parser.ts         # Diff parsing\n│   └── formatter.ts      # Output formatting\n├── llm/\n│   ├── client.ts         # LLM providers\n│   └── prompts.ts        # Prompt templates\n├── mcp/\n│   └── server.ts         # MCP server\n└── api/\n    └── server.ts         # REST API\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flertsoft%2Fdifflearn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flertsoft%2Fdifflearn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flertsoft%2Fdifflearn/lists"}