Metadata-Version: 2.4
Name: asicode
Version: 0.2.7
Summary: Autonomous Software Improvement — AST-precise code editing agent with verification gates (CLI + MCP server)
Author-email: socialherb <junddory@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/socialherb/asicode
Project-URL: Repository, https://github.com/socialherb/asicode
Project-URL: Issues, https://github.com/socialherb/asicode/issues
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0
Requires-Dist: requests>=2.31
Requires-Dist: rich>=13.7
Requires-Dist: libcst>=1.4
Requires-Dist: prompt-toolkit>=3.0
Requires-Dist: httpx>=0.27
Requires-Dist: ruff>=0.6
Requires-Dist: tree-sitter-language-pack>=1.10
Requires-Dist: networkx>=3.0
Requires-Dist: packaging>=21
Provides-Extra: webapp
Requires-Dist: fastapi>=0.110; extra == "webapp"
Requires-Dist: uvicorn>=0.27; extra == "webapp"
Requires-Dist: jinja2>=3.1; extra == "webapp"
Provides-Extra: vulture
Requires-Dist: vulture>=2.11; extra == "vulture"
Provides-Extra: collaborate
Requires-Dist: claude-agent-sdk>=0.2; extra == "collaborate"
Provides-Extra: rag
Requires-Dist: sentence-transformers>=3.0; extra == "rag"
Requires-Dist: faiss-cpu>=1.8; extra == "rag"
Requires-Dist: numpy>=1.24; extra == "rag"
Provides-Extra: vision
Requires-Dist: Pillow>=10.0; extra == "vision"
Requires-Dist: pytesseract>=0.3; extra == "vision"
Provides-Extra: browser
Requires-Dist: playwright>=1.40; extra == "browser"
Provides-Extra: config
Requires-Dist: pyyaml>=6.0; extra == "config"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-xdist>=3.6; extra == "dev"
Requires-Dist: pre-commit>=4.0; extra == "dev"
Provides-Extra: lint
Requires-Dist: mypy>=1.10; extra == "lint"
Requires-Dist: pyright[nodejs]>=1.1; extra == "lint"
Provides-Extra: search
Requires-Dist: ripgrep>=15.0; extra == "search"
Provides-Extra: all
Requires-Dist: asicode[vulture]; extra == "all"
Requires-Dist: asicode[collaborate]; extra == "all"
Requires-Dist: asicode[rag]; extra == "all"
Requires-Dist: asicode[vision]; extra == "all"
Requires-Dist: asicode[browser]; extra == "all"
Requires-Dist: asicode[config]; extra == "all"
Requires-Dist: asicode[lint]; extra == "all"
Requires-Dist: asicode[search]; extra == "all"
Dynamic: license-file

# asicode

**Autonomous Software Improvement** — local safe patch runner and code editing tool: an AI-powered assistant for reading, analyzing, and modifying codebases with deterministic AST-level operations, transparent shell execution, and multi-language support.

## Features

- **Multi-language code editing**: Python, TypeScript, JavaScript, Go, Java, Kotlin, Rust, and more via tree-sitter AST parsing
- **AST-precise modifications**: Edit symbols by name, insert/delete lines by anchor, apply typed AST operations (Python)
- **Vector search & RAG**: Semantic code search with FAISS + sentence-transformers embedding
- **Structural analysis**: Dead code detection, duplicate finding, unused import scanning, contradictory logic detection
- **Interactive CLI**: Rich terminal interface with prompt-toolkit, command history, completion, and multi-line editing
- **Headless & automation modes**: single-shot runs (`asi -p`), JSON/NDJSON output, and multi-agent orchestration (`--orchestrate`)
- **Design chat**: Persistent conversation session with auto-compression and insight management
- **Shell shim layer**: macOS/Linux compatibility layer for BSD-style command-line tools

## Quick Start

```bash
# Recommended for CLI use: pipx installs into an isolated env and puts
# `asi` on your PATH, no venv activation needed
pipx install 'asicode @ git+https://github.com/socialherb/asicode.git'

# Or plain pip (inside a venv of your choice):
pip install git+https://github.com/socialherb/asicode.git

# Or with all features:
pip install 'asicode[all] @ git+https://github.com/socialherb/asicode.git'

# Start the interactive CLI
asi
```

## Installation Options

```bash
# Core (includes tree-sitter AST parsing — one package covers 300+ languages)
pip install asicode

# With RAG (vector search for code)
pip install 'asicode[rag]'

# With browser automation
pip install 'asicode[browser]'

# Development tools
pip install 'asicode[dev,lint]'

# Everything
pip install 'asicode[all]'
```

## Architecture

```
asicode/
├── asi.py              # Interactive CLI (REPL)
├── external_llm/           # Core engine
│   ├── agent/              # Agent loop, tool handlers, verification
│   ├── languages/          # Multi-language providers (Python, TS, Go, etc.)
│   ├── editor/             # Code editing (AST, anchor, text, patch)
│   └── repl/               # Design chat session management
├── scripts/                # Lint/reachability guards (CI)
└── tests/                  # Test suite (unit + integration)
```

## Key Concepts

### Agent Tool Loop
Every request runs through a single LLM tool-use loop: the model reads,
searches, and edits the repository through typed tools, and each write is
followed by verification. Headless mode (`asi -p`) and orchestration mode
(`--orchestrate`, which decomposes a request and dispatches it to parallel
sub-agent workers) drive the same loop.

### Deterministic Editing
All code modifications are validated through multiple layers:
- Syntax validation (AST parse gate)
- Structural analysis (dependency graph, import consistency)
- Verification loop (edit → verify → repair if needed)

## Requirements

### Python
- Python 3.10+
- macOS or Linux (BSD shim layer for macOS)

### Bundled with the install
- **`ruff`** — the linter used for post-edit verification (F821 undefined-name checks). It is a
  core dependency, so `pip install asicode` installs it automatically. No separate step needed.
- **tree-sitter** — powers AST-based symbol/call/import detection for precise multi-language
  editing. The core install ships `tree-sitter-language-pack` (~2 MB) — a single package with
  full prebuilt-wheel platform coverage that covers every supported language out of the box
  (it also pulls in the `tree-sitter` core library automatically).

### Recommended system tools
asicode degrades gracefully when these are missing, but installing them improves results:

| Tool | Used for | Required when | Behavior if absent |
|------|----------|---------------|--------------------|
| `git` | Version control, diff/apply, change-impact analysis | Almost always | Core features expect git |
| `ripgrep` (`rg`) | Fast code search (`grep` tool) | Recommended | Falls back to system `grep` |
| `node` | TypeScript/JavaScript editing & validation | Only when editing JS/TS | JS/TS features disabled |
| `gofmt` / `golangci-lint` | Go formatting & linting | Only when editing Go | Go linting disabled |
| `docker` | Sandboxed web search (SearXNG) | Only for isolated web search | Web search disabled |

Install `git` and `ripgrep` on macOS:
```bash
brew install git ripgrep
```

`ripgrep` can also be installed via the optional `search` extra (`pip install asicode` is unaffected if it fails — the `grep` fallback applies):
```bash
pip install 'asicode[search]'
```
> Prebuilt wheels exist for macOS-arm64 and linux-x86_64; other platforms build from source.

## Development

```bash
# Clone and install in editable mode
git clone <repo-url>
cd asicode
pip install -e '.[dev,lint,rag]'

# Run tests
pytest

# Run linting
ruff check
ruff format --check

# Run type checking
pyright
```
