Metadata-Version: 2.4
Name: autocode-agent
Version: 1.0.0
Summary: Autonomous AI coding agent CLI — like Claude Code, works with any OpenAI-compatible API
Author: AutoCode
Author-email: ALLAY_XD_20 <allay.xd.20@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/ALLAY-XD-20/autocode-agent
Project-URL: Repository, https://github.com/ALLAY-XD-20/autocode-agent
Project-URL: Documentation, https://github.com/ALLAY-XD-20/autocode-agent#readme
Project-URL: Bug Tracker, https://github.com/ALLAY-XD-20/autocode-agent/issues
Project-URL: Changelog, https://github.com/ALLAY-XD-20/autocode-agent/releases
Keywords: ai,agent,coding,cli,llm,autonomous,code-review,debugging,refactoring,git,testing,claude,gpt,openai,developer-tools
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1
Requires-Dist: httpx>=0.27
Requires-Dist: rich>=13.0
Requires-Dist: prompt_toolkit>=3.0
Requires-Dist: pathspec>=0.12
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: ruff>=0.3; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Dynamic: license-file

# AutoCode Agent

<div align="center">

```
   ▄████████ ███    █▄      ███      ▄██████▄     ▄████████  ▄██████▄  ████████▄     ▄████████
  ███    ███ ███    ███ ▀█████████▄ ███    ███   ███    ███ ███    ███ ███   ▀███   ███    ███
  ███    ███ ███    ███    ▀███▀▀██ ███    ███   ███    █▀  ███    ███ ███    ███   ███    █▀
  ███    ███ ███    ███     ███   ▀ ███    ███  ▄███▄▄▄     ███    ███ ███    ███  ▄███▄▄▄
▀███████████ ███    ███     ███     ███    ███ ▀▀███▀▀▀     ███    ███ ███    ███ ▀▀███▀▀▀
  ███    ███ ███    ███     ███     ███    ███   ███    █▄  ███    ███ ███    ███   ███    █▄
  ███    ███ ███    ███     ███     ███    ███   ███    ███ ███    ███ ███   ▄███   ███    ███
  ███    █▀  ████████▀     ▄████▀   ▀██████▀    ██████████  ▀██████▀  ████████▀    ██████████
```

**The Autonomous AI Coding Agent — Powered by Any OpenAI-Compatible API**

*by [ALLAY_XD_20](https://github.com/ALLAY-XD-20)*

[![PyPI version](https://img.shields.io/pypi/v/autocode-agent.svg?style=flat-square&color=blue)](https://pypi.org/project/autocode-agent/)
[![Python](https://img.shields.io/pypi/pyversions/autocode-agent?style=flat-square&color=green)](https://pypi.org/project/autocode-agent/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey?style=flat-square)](https://pypi.org/project/autocode-agent/)

</div>

---

AutoCode is a powerful **autonomous coding agent CLI** — like Claude Code or Aider, but works with **any OpenAI-compatible API** provider.
It reads, writes, and creates files; executes shell commands; reviews code; scans for security issues; manages git; runs tests; and much more — all from your terminal.

---

## Features

```
┌─────────────────────────────────────────────────────────────────────────┐
│                        AUTOCODE  FEATURE LIST                          │
├──────────────────────┬──────────────────────┬──────────────────────────┤
│  CODE QUALITY        │  GIT & VERSION       │  TESTING                 │
│  /code-review        │  /git-status         │  /test                   │
│  /lint               │  /git-diff           │  /test-gen               │
│  /type-check         │  /git-log            │  /test-debug             │
│  /refactor           │  /git-commit         │  /build                  │
│  /cleanup            │  /git-branch         │                          │
│  /duplicates         │  /git-push           │  PERFORMANCE             │
│  /syntax-fix         │  /commit-msg         │  /profile                │
│  /explain            │  /merge-fix          │  /mem-check              │
├──────────────────────┼──────────────────────┤  /optimize               │
│  DEBUGGING           │  SECURITY            ├──────────────────────────┤
│  /debug              │  /security           │  INFRASTRUCTURE          │
│  /fix                │  /secrets            │  /docker                 │
│  /trace              │  /vulns              │  /ci-cd                  │
│  /errors             │  /audit              │  /server                 │
│  /logs               │                      │  /deploy                 │
│  /explain-error      │  DEPENDENCIES        │  /env                    │
├──────────────────────┤  /deps               ├──────────────────────────┤
│  GENERATION          │  /install            │  FILE & SEARCH           │
│  /generate           │  /outdated           │  /find                   │
│  /scaffold           │                      │  /replace                │
│  /readme             │  API & DATABASE      │  /regex                  │
│  /docs               │  /api-test           │  /navigate               │
│  /ui-gen             │  /db                 │                          │
│  /backend-gen        │  /db-query           │  INTELLIGENCE            │
│  /api-build          │  /db-migrate         │  /arch                   │
│  /template           │  /json-check         │  /memory                 │
│  /convert            │  /yaml-check         │  /pr-review              │
│  /translate          │                      │  /completion             │
│  /scaffold           │  PACKAGE MANAGERS    │  /explain                │
└──────────────────────┴──────────────────────┴──────────────────────────┘
```

---

## Installation

```bash
pip install autocode-agent
```

**Requirements:** Python 3.9+  |  Works on Windows, macOS, Linux

---

## Quick Start

### Step 1 — Set your API token

AutoCode works with **any OpenAI-compatible API**. Set your credentials:

```bash
# Required
export AUTOCODE_AUTH_TOKEN="your-api-token-here"

# Optional — customize the provider and model
export AUTOCODE_BASE_URL="https://beta.hapuppy.com"   # default
export AUTOCODE_MODEL="claude-sonnet-4-6"             # default
```

**Windows (PowerShell):**
```powershell
$env:AUTOCODE_AUTH_TOKEN = "your-api-token-here"
$env:AUTOCODE_BASE_URL   = "https://beta.hapuppy.com"
$env:AUTOCODE_MODEL      = "claude-sonnet-4-6"
```

### Step 2 — Run it

```bash
# Interactive mode (recommended)
autocode

# One-shot task
autocode "build a REST API with Flask and SQLite"

# List available models
autocode --list-models

# Work in a specific directory
autocode --dir /path/to/my/project

# Use a different model
autocode -m gpt-4 "refactor my codebase"
```

---

## Interactive Mode

When you run `autocode` without arguments, you get a full interactive session:

```
   ▄████████ ███    █▄  ...
  ███    ███ ███    ███ ...

  by ALLAY_XD_20  •  v1.0.0  •  Autonomous Coding Agent

  Features: Code Review • Auto Debug • Security Scan • Git • Tests • Docs
             Refactor • Scaffold • API Test • Docker • CI/CD • + 70 more

  Model    : claude-sonnet-4-6
  Endpoint : https://beta.hapuppy.com/v1/chat/completions

  Commands : /help  /ls  /reset  /model  /features  /git  /security  /test  /exit

❯ _
```

Type any natural language task, or use a `/command`:

```bash
❯ read main.py and fix any bugs you find
❯ /code-review
❯ /security
❯ /test
❯ /git-commit
❯ /scaffold
❯ create a FastAPI app with JWT authentication
```

---

## All Commands

### Built-in Commands

| Command | Description |
|---------|-------------|
| `/help` | Show help and command list |
| `/features` | Show full feature table |
| `/reset` | Clear conversation history |
| `/ls [dir]` | List files in directory |
| `/model` | Show current model and endpoint |
| `/exit` | Quit AutoCode |

### Code Quality

| Command | What It Does |
|---------|-------------|
| `/code-review` | Full code review with issues, bugs, and suggestions |
| `/refactor` | Refactor the codebase (SOLID, clean code) |
| `/cleanup` | Remove dead code, unused imports, formatting |
| `/syntax-fix` | Find and fix all syntax errors |
| `/duplicates` | Detect and eliminate duplicate code |
| `/lint` | Run linter (ruff/flake8/eslint) on all files |
| `/type-check` | Run type checker (mypy/tsc) |
| `/explain` | Explain the codebase architecture |

### Debugging

| Command | What It Does |
|---------|-------------|
| `/debug` | Debug the project — trace and fix errors |
| `/fix` | Find and fix all bugs |
| `/trace` | Analyze a stack trace |
| `/errors` | Find all error-prone areas |
| `/logs` | Analyze log files |
| `/explain-error` | Explain an error message in detail |

### Code Generation

| Command | What It Does |
|---------|-------------|
| `/generate` | Generate code from description |
| `/scaffold` | Scaffold a new project (python/flask/fastapi/node/react/cli) |
| `/ui-gen` | Generate UI components |
| `/backend-gen` | Generate backend code and APIs |
| `/api-build` | Build a full API with endpoints |
| `/readme` | Generate a professional README |
| `/docs` | Generate project documentation |
| `/convert` | Convert code between languages |
| `/translate` | Translate code/content |

### Testing

| Command | What It Does |
|---------|-------------|
| `/test` | Run all tests; fix failures |
| `/test-gen` | Generate comprehensive test suite |
| `/test-debug` | Debug failing tests |
| `/build` | Build the project |

### Security

| Command | What It Does |
|---------|-------------|
| `/security` | Full security audit + auto-fix |
| `/secrets` | Scan for hardcoded secrets/tokens |
| `/vulns` | Check code + dependency vulnerabilities |
| `/audit` | Comprehensive security report |

### Git & Version Control

| Command | What It Does |
|---------|-------------|
| `/git-status` | Show git status |
| `/git-diff` | Show all changes |
| `/git-log` | Show commit history |
| `/git-commit` | Stage, generate message, and commit |
| `/git-branch` | List all branches |
| `/git-push` | Push to remote |
| `/commit-msg` | Generate a commit message from diff |
| `/merge-fix` | Resolve merge conflicts |
| `/pr-review` | Review pull request changes |

### Dependencies & Packages

| Command | What It Does |
|---------|-------------|
| `/deps` | Analyze all dependencies |
| `/install` | Install project dependencies |
| `/outdated` | Show outdated packages |

### Performance

| Command | What It Does |
|---------|-------------|
| `/profile` | Profile Python script performance |
| `/mem-check` | Detect memory leaks |
| `/optimize` | Optimize code for speed |

### Infrastructure

| Command | What It Does |
|---------|-------------|
| `/docker` | Docker operations (build/run/logs) |
| `/ci-cd` | Detect and set up CI/CD pipelines |
| `/server` | Manage running servers |
| `/deploy` | Help deploy the project |
| `/env` | Manage .env variables |

### Database

| Command | What It Does |
|---------|-------------|
| `/db` | Inspect SQLite database |
| `/db-query` | Run SQL queries |
| `/db-migrate` | Create and run migrations |

### File & Search

| Command | What It Does |
|---------|-------------|
| `/find` | Find files by name pattern |
| `/replace` | Global find-and-replace across files |
| `/regex` | Regex search across files |
| `/navigate` | Explore project structure |
| `/json-check` | Validate JSON files |
| `/yaml-check` | Validate YAML files |

### Intelligence

| Command | What It Does |
|---------|-------------|
| `/arch` | Architecture analysis (ASCII diagram) |
| `/memory` | View/store agent session memory |
| `/completion` | AI code completion |
| `/api-test` | Test HTTP API endpoints |

---

## Configuration

All settings via environment variables — **no hardcoded keys ever**:

| Variable | Default | Description |
|----------|---------|-------------|
| `AUTOCODE_AUTH_TOKEN` | *(required)* | Your API bearer token |
| `AUTOCODE_BASE_URL` | `https://beta.hapuppy.com` | API base URL (any OpenAI-compatible) |
| `AUTOCODE_MODEL` | `claude-sonnet-4-6` | Model name |
| `AUTOCODE_MAX_TOKENS` | `8192` | Max response tokens |
| `AUTOCODE_TEMPERATURE` | `0.2` | Response temperature |

### Supported API Providers

AutoCode works with **any OpenAI-compatible API**:

```bash
# HaPuppy (default)
export AUTOCODE_BASE_URL="https://beta.hapuppy.com"
export AUTOCODE_AUTH_TOKEN="sk-hapuppy-..."
export AUTOCODE_MODEL="claude-sonnet-4-6"

# OpenAI
export AUTOCODE_BASE_URL="https://api.openai.com"
export AUTOCODE_AUTH_TOKEN="sk-..."
export AUTOCODE_MODEL="gpt-4o"

# Anthropic (via proxy)
export AUTOCODE_BASE_URL="https://your-proxy.com"
export AUTOCODE_AUTH_TOKEN="sk-ant-..."
export AUTOCODE_MODEL="claude-3-5-sonnet"

# Ollama (local)
export AUTOCODE_BASE_URL="http://localhost:11434"
export AUTOCODE_AUTH_TOKEN="ollama"
export AUTOCODE_MODEL="llama3.1"

# Any OpenAI-compatible endpoint
export AUTOCODE_BASE_URL="https://your-provider.com"
```

---

## Examples

### Fix bugs automatically
```bash
autocode "read app.py, find the bug causing the 500 error, fix it, run the tests"
```

### Build a full project
```bash
autocode "create a FastAPI REST API with user auth, SQLite database, and JWT tokens"
```

### Security audit
```bash
❯ /security
# → Scans all code + dependencies, auto-fixes issues
```

### Git workflow
```bash
❯ /git-commit
# → Stages changes, generates commit message, commits
```

### Scaffold a new project
```bash
❯ /scaffold
# → Asks: project type (flask/fastapi/react/node/cli), name, directory
# → Creates complete project structure
```

### Convert code
```bash
autocode "convert my Flask app in app.py to FastAPI"
```

### Generate tests
```bash
autocode "read utils.py and generate comprehensive pytest tests for every function"
```

---

## CLI Reference

```
Usage: autocode [OPTIONS] [TASK]

  AutoCode Agent — Autonomous AI coding assistant by ALLAY_XD_20.

Options:
  -m, --model TEXT      Model to use         [env: AUTOCODE_MODEL]
  -t, --token TEXT      Auth token           [env: AUTOCODE_AUTH_TOKEN]
  -u, --base-url TEXT   API base URL         [env: AUTOCODE_BASE_URL]
  -v, --verbose         Verbose output
  -d, --dir TEXT        Working directory
  --list-models         List all available models
  --version             Show version
  --help                Show help
```

---

## How It Works

AutoCode uses a **tool-calling agentic loop**:

```
User Input
    │
    ▼
┌─────────────────────────────────────────┐
│           Language Model (LLM)          │
│   Reasons about the task, decides       │
│   which tools to call                   │
└───────────────────┬─────────────────────┘
                    │ tool_calls
                    ▼
┌─────────────────────────────────────────┐
│              Tool Executor              │
│  read_file │ write_file │ run_command   │
│  git_* │ security_scan │ auto_testing  │
│  project_scaffolding │ api_testing     │
│  ... 50+ more tools                    │
└───────────────────┬─────────────────────┘
                    │ results
                    ▼
            Back to LLM (loop)
                    │
                    ▼
            Final Response
```

The agent keeps looping — calling tools, observing results, and adjusting — until the task is fully complete. Up to 15 iterations per turn.

---

## Platform Support

| Platform | Status |
|----------|--------|
| Linux | ✅ Full support |
| macOS | ✅ Full support |
| Windows (PowerShell) | ✅ Full support |
| Windows (CMD) | ✅ Full support |
| WSL | ✅ Full support |
| Termux (Android) | ✅ Full support |
| Any Python 3.9+ environment | ✅ Full support |

AutoCode automatically detects terminal capabilities and adapts:
- **Wide terminal** (≥100 cols) → Full ASCII art banner
- **Medium terminal** (≥50 cols) → Compact banner
- **Narrow/no-unicode** → Minimal text banner
- **No color** → Plain text output (respects `NO_COLOR` env var)

---

## Contributing

Contributions welcome! Open an issue or PR on GitHub.

1. Fork the repo
2. Create a feature branch: `git checkout -b feature/my-feature`
3. Commit: `git commit -m 'feat: add my feature'`
4. Push: `git push origin feature/my-feature`
5. Open a Pull Request

---

## License

MIT License © 2026 ALLAY_XD_20 — free to use, modify, and distribute.

---

<div align="center">

**Built with ❤️ by [ALLAY_XD_20](https://github.com/ALLAY-XD-20)**

*AutoCode — Code smarter, not harder.*

</div>
