Metadata-Version: 2.4
Name: ast-ai
Version: 0.0.2
Summary: A CLI tool to scan and compress project AST for LLM context.
Author-email: Thomas JARRIER <jarriert@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/thomasjarrier/ast-ai
Project-URL: Issues, https://github.com/thomasjarrier/ast-ai/issues
Keywords: ast,llm,context,compression,tree-sitter,python
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: tree-sitter>=0.23.0
Requires-Dist: tree-sitter-python
Requires-Dist: tree-sitter-javascript
Requires-Dist: tree-sitter-typescript
Requires-Dist: tree-sitter-java
Requires-Dist: tree-sitter-php
Requires-Dist: tree-sitter-html
Requires-Dist: tree-sitter-json
Requires-Dist: tree-sitter-bash
Requires-Dist: click>=8.1.0
Requires-Dist: tomli; python_version < "3.11"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

# ast-ai 🚀

`ast-ai` is a CLI tool designed to scan your projects and compress their Abstract Syntax Tree (AST) to send it more efficiently into the context of LLMs (Large Language Models).

It supports multiple languages (Python, JavaScript, TypeScript, Java, PHP, HTML, JSON, Bash) and uses incremental caching for optimal performance.

## 📦 Installation

### Recommended: via pipx (Global)

To install `ast-ai` globally and use it in any project without polluting your Python environment:

```bash
# From the GitLab repository (replace with the actual URL)
pipx install git+https://gitlab.com/your-org/ast-ai.git

# OR from the GitLab package registry (if published)
pipx install --index-url https://gitlab.com/api/v4/projects/YOUR_PROJECT_ID/packages/pypi/simple ast-ai
```

### For Development (Local)

If you wish to contribute to the project:

```bash
git clone https://gitlab.com/your-org/ast-ai.git
cd ast-ai
make install-dev
source .venv/bin/activate
```

## 🛠 Usage

Once installed, the `ast-ai` command is available everywhere.

### 1. Scan a project
Scans the current directory and generates the AST cache:
```bash
ast-ai scan
```

Useful options:
- `ast-ai scan --skeleton`: Generates a "skeleton" version (truncates the body of functions/methods).
- `ast-ai scan -e vendor -e node_modules`: Excludes specific directories.

### 2. Retrieve the AST of a file
Displays the compressed AST in JSON format for a specific file:
```bash
ast-ai get src/main.py
```

### 3. Clear the cache
```bash
ast-ai clear
```

## 📂 Project Structure

- `src/ast_ai/`: Main source code.
- `.ast_cache/`: Locally generated directory to store the cache (ignored by git).
- `docs/`: Detailed documentation and tutorials.
- `Makefile`: Useful commands for development.

## 🤝 Development

The project uses a `Makefile` to simplify common tasks:

- `make install-dev`: Prepares the development environment.
- `make lint`: Checks code quality.
- `make test`: Runs the test suite.
- `make build`: Prepares the package for distribution.
- `make clean`: Cleans up temporary files and the virtual environment.

---
Developed with ❤️ to optimize your LLM contexts.
