Metadata-Version: 2.4
Name: apex-coder
Version: 1.0.1
Summary: APEX - AI powered terminal coding assistant
Author-email: Parin Prajapati <parin0127@gmail.com>
License: MIT License
        Copyright (c) 2026 Parin Prajapati
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/parinprajapati/apex
Keywords: ai,coding,assistant,agent,terminal,groq,mistral
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: groq
Requires-Dist: openai
Requires-Dist: rich
Requires-Dist: python-dotenv
Requires-Dist: langchain-huggingface
Requires-Dist: langchain-chroma
Requires-Dist: langchain-text-splitters
Requires-Dist: langchain-community
Requires-Dist: requests
Requires-Dist: watchdog
Dynamic: license-file

# ⚡ APEX — Your AI Coding Assistant

![Python](https://img.shields.io/badge/Python-3.10+-blue?style=for-the-badge&logo=python)
![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)
![Powered by Groq](https://img.shields.io/badge/Powered%20by-Groq-orange?style=for-the-badge)
![Mistral](https://img.shields.io/badge/Fallback-Mistral-purple?style=for-the-badge)
![Version](https://img.shields.io/badge/Version-1.0.0-cyan?style=for-the-badge)
![PyPI](https://img.shields.io/badge/PyPI-apex--cli-red?style=for-the-badge&logo=pypi)

> **APEX** is a terminal-based agentic AI coding assistant that helps you write code, fix bugs, run commands, search your project, manage GitHub repos, and automate tasks — all from your terminal.

---

## 📸 Preview

| Dashboard | Auto Mode | Code Generation |
|-----------|-----------|----------------|
| ![Dashboard](assets/APEX.png) | ![Auto](assets/auto.png) | ![Code](assets/code.png) |

| GitHub | RAG Search | Analyze & Test |
|--------|-----------|----------------|
| ![GitHub](assets/github.png) | ![RAG](assets/rag.png) | ![Test](assets/test.png) |

---

## ✨ Features

- ⚡ **Fast AI Responses** — Powered by Groq (llama-3.1, llama-3.3) for ultra-fast inference
- 🧠 **Smart Automation** — `/auto on` lets APEX write, run, and fix code automatically
- 📁 **RAG — Project Search** — Index your codebase and search it with natural language
- 🔧 **Tool Execution** — Run terminal commands safely with dangerous command detection
- 🐙 **GitHub Integration** — List, search, push, pull, create repos from the terminal
- 👀 **Watchdog** — Monitor files and auto-analyze on every save
- 🔍 **Code Analysis** — Scan files for real bugs and auto-fix them
- 🧪 **Unit Test Generator** — Auto-generate and run tests in a safe sandbox
- 💾 **Save Code** — Save any code block from responses with `/save`
- 🌀 **Mistral Fallback** — Automatically falls back to Mistral if Groq is unavailable

---

## 🚀 Installation

```bash
pip install apex-coder
```

Or clone and install manually:

```bash
git clone https://github.com/parinprajapati/apex.git
cd apex
pip install -e .
```

---

## 🔑 Setup

On first run, APEX will ask for:
- **Groq API key** — get it from https://console.groq.com
- **Mistral API key** — get it from https://console.mistral.ai
- Your **experience level** (Beginner / Intermediate / Advanced)
- Whether to allow **auto command execution**

```bash
python -m apex.agent.main
```

---

## 🛠️ Commands
+---------------------------+---------------------------------------------------+
| Command                   | Description                                       |
|---------------------------|---------------------------------------------------|
| `/index <path>`           | Index a project folder for RAG code search        |
| `/save <file>`            | Save the last code block to a file                |
| `/github`                 | GitHub actions (login, push, pull, search, etc.)  |
| `/watch <file>`           | Monitor a file and auto-analyze on every save     |
| `/analyze <file>`         | Scan a file for bugs and bad practices            |
| `/fix <file>`             | Auto-fix issues in a file (shows preview first)   |
| `/test <file>`            | Generate and run unit tests in a safe sandbox     |
| `/auto on\|off`           | Toggle smart automation mode                      |
| `/setting`                | View or update your config (API keys, level)      |
| `/help`                   | Show full help guide                              |
| `exit`                    | Quit APEX                                         |
+---------------------------+---------------------------------------------------+
---

## 🤖 Auto Mode

Enable auto mode and just describe what you want:

```
>: /auto on
>: create a hello world python script and run it
```

APEX will write the file, run it, and show you the output — fully automated.

---

## 📁 RAG — Project Code Search

```
>: /index C:\Users\Parin\Projects\MyApp
>: find the login function
>: where is the database connection?
```

Supports: `.py .js .ts .java .cpp .c .cs .kt .scala .html .md`

---

## 🐙 GitHub Commands

```
/github login <token>
/github list
/github search <keyword>
/github commits <owner/repo>
/github make <repo-name>
/github push <owner/repo> <file> <message>
/github pull <owner/repo> <file>
/github view <owner/repo> <file>
```

---

## 👀 Watchdog

```
/watch myfile.py       # auto-analyze on every save
/analyze myfile.py     # one-time scan
/fix myfile.py         # auto-fix with preview
/test myfile.py        # generate + run tests
/wdstop                # stop watching
```

---

## 🧠 Models Used
+-------------------+---------------------------------------------+
| Purpose           | Models                                      |
|-------------------|---------------------------------------------|
| General coding    | llama-3.1-8b-instant, llama-3.3-70b         |
| Automation        | mistral-large-latest, codestral-latest      |
| Router / Planner  | mistral-small-latest, ministral-3b          |
| Watchdog / Fix    | llama-3.3-70b, codestral-latest             |
+-------------------+---------------------------------------------+
---

## 📂 Project Structure

```
apex/
├── agent/          # Core agent loop, planner, UI
├── auto/           # Auto mode pipelines, stages, memory
├── config/         # Settings, system prompt, help
├── github/         # GitHub integration
├── models/         # LLM fallback + model routing
├── rag/            # RAG indexing and code search
├── tools/          # File, command, and code tools
└── watchdog/       # File watcher, analyzer, fixer, tester
```

---

## 🔒 Safety

APEX detects and blocks dangerous commands like `rm -rf`, `format`, `drop table`, `shutdown`, and many more across Windows, Linux, and macOS. You can also set `auto_run_commands: false` to approve every command manually.

---

## 👨‍💻 Author

**Parin Prajapati**
- 📧 parin0127@gmail.com
- 🐙 [GitHub](https://github.com/parinprajapati)
- 🎂 Age: 19

---

## 📄 License

This project is licensed under the [MIT License](LICENSE).

---

## ⭐ Support

If you find APEX useful, please give it a ⭐ on GitHub — it means a lot!
