|
| 1 | +# 🤖 AI Dev Copilot |
| 2 | + |
| 3 | +> Review, test and document your Python code with **Google Gemini** — three developer agents in one clean CLI. |
| 4 | +
|
| 5 | +[](https://github.com/Meriam-Inoubli/ai-dev-copilot/actions/workflows/ci.yaml) |
| 6 | +[](https://www.python.org/) |
| 7 | +[](https://ai.google.dev/) |
| 8 | +[](LICENSE) |
| 9 | + |
| 10 | +**AI Dev Copilot** bundles three focused agents behind a single command: |
| 11 | + |
| 12 | +| Agent | What it does | |
| 13 | +|-------|--------------| |
| 14 | +| 🔍 **Reviewer** | Structured review — bugs, security, performance, style, with concrete fixes | |
| 15 | +| 🧪 **Tester** | Generates a ready-to-run `pytest` suite (happy paths, edge cases, errors) | |
| 16 | +| 📝 **Documenter** | Writes a professional README and adds Google-style docstrings | |
| 17 | + |
| 18 | +Run them individually, or run **`all`** to review + test + document a file in one pass. |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## ✨ Why this exists |
| 23 | + |
| 24 | +Most "AI agent" demos are single throwaway scripts, each reinventing its own LLM |
| 25 | +plumbing. AI Dev Copilot is built like a small product instead: |
| 26 | + |
| 27 | +- **One shared Gemini client** (`llm.py`) — consistent config, one place to change models. |
| 28 | +- **Pure, tested helpers** — AST-based structure extraction and fence-stripping are unit-tested with **no API key required**, so CI stays green and free. |
| 29 | +- **Zero-setup demo** — every command falls back to a bundled example file, so you can try it before wiring up your own code. |
| 30 | +- **Proper packaging** — installable, with a `devcopilot` entry point, `ruff` linting and CI across Python 3.10–3.12. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 🚀 Quick Start |
| 35 | + |
| 36 | +```bash |
| 37 | +git clone https://github.com/Meriam-Inoubli/ai-dev-copilot.git |
| 38 | +cd ai-dev-copilot |
| 39 | + |
| 40 | +python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate |
| 41 | +pip install -e . |
| 42 | + |
| 43 | +cp .env.example .env # then paste your free Gemini key |
| 44 | +``` |
| 45 | + |
| 46 | +Get a free key at **[aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey)**. |
| 47 | + |
| 48 | +```bash |
| 49 | +# Try it instantly on the bundled demo (no --file needed) |
| 50 | +devcopilot review |
| 51 | + |
| 52 | +# Point it at your own code |
| 53 | +devcopilot review --file path/to/app.py |
| 54 | +devcopilot test --file path/to/app.py --output tests/test_app.py |
| 55 | +devcopilot doc --file path/to/app.py --mode readme |
| 56 | +devcopilot all --file path/to/app.py |
| 57 | +``` |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## 🧑💻 Use it as a library |
| 62 | + |
| 63 | +```python |
| 64 | +from ai_dev_copilot import review_code, generate_tests, generate_readme |
| 65 | + |
| 66 | +code = open("app.py").read() |
| 67 | + |
| 68 | +print(review_code(code)) # markdown review |
| 69 | +open("test_app.py", "w").write(generate_tests(code, "app")) |
| 70 | +open("README_app.md", "w").write(generate_readme(code, "app.py")) |
| 71 | +``` |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## 🏗️ Architecture |
| 76 | + |
| 77 | +``` |
| 78 | +src/ai_dev_copilot/ |
| 79 | +├── llm.py # single Gemini client (system + user prompt → text) |
| 80 | +├── utils.py # pure helpers: AST outline, code-fence stripping (unit-tested) |
| 81 | +├── reviewer.py # 🔍 review_code() |
| 82 | +├── tester.py # 🧪 generate_tests() |
| 83 | +├── documenter.py # 📄 generate_readme() + add_docstrings() |
| 84 | +└── cli.py # devcopilot: review | test | doc | all |
| 85 | +``` |
| 86 | + |
| 87 | +Each agent is just a focused prompt over the shared client — easy to read, extend, or swap the model. |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## ⚙️ Configuration |
| 92 | + |
| 93 | +| Variable | Default | Description | |
| 94 | +|----------|---------|-------------| |
| 95 | +| `GEMINI_API_KEY` | — | Your Gemini API key (required for live calls) | |
| 96 | +| `GEMINI_MODEL` | `gemini-2.0-flash` | Model override | |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 🧪 Development |
| 101 | + |
| 102 | +```bash |
| 103 | +pip install -e ".[dev]" |
| 104 | +pytest -v # runs offline — no API key needed |
| 105 | +ruff check . |
| 106 | +``` |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## 🙏 Credits |
| 111 | + |
| 112 | +The three agent ideas were inspired by the excellent |
| 113 | +[500 AI Agents Projects](https://github.com/ashishpatel26/500-AI-Agents-Projects) |
| 114 | +collection (MIT). This project reimplements them from scratch on **Gemini**, unified |
| 115 | +into one tested, installable package. |
| 116 | + |
| 117 | +## 📄 License |
| 118 | + |
| 119 | +[MIT](LICENSE) © 2026 Meriam Inoubli |
0 commit comments