A CLI tool to scan and compress project AST for LLM context.
Project description
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:
# 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:
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:
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:
ast-ai get src/main.py
3. Clear the cache
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ast_ai-0.0.2.tar.gz.
File metadata
- Download URL: ast_ai-0.0.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ea299d31c9cb44f58630f96ecb26703a9f84f49389f6111789d183ea983ec87
|
|
| MD5 |
e840dfa143982065c09fc141dec9787b
|
|
| BLAKE2b-256 |
18e1afc9d7711608310cf669e0db9afdc12a12d84f6dc2e2d80515545c7ab1e7
|
Provenance
The following attestation bundles were made for ast_ai-0.0.2.tar.gz:
Publisher:
publish.yml on tjarrier/ast-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ast_ai-0.0.2.tar.gz -
Subject digest:
5ea299d31c9cb44f58630f96ecb26703a9f84f49389f6111789d183ea983ec87 - Sigstore transparency entry: 1091938395
- Sigstore integration time:
-
Permalink:
tjarrier/ast-ai@1d9118eaa74705438cc279d0b863685d86a4fc50 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tjarrier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d9118eaa74705438cc279d0b863685d86a4fc50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ast_ai-0.0.2-py3-none-any.whl.
File metadata
- Download URL: ast_ai-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dc47255ea66c3cf6a86453b0393f83313fe1905f3fcf392cf451b283b0f5716
|
|
| MD5 |
1edc40e4a764a1a2025b101f5db0e9cb
|
|
| BLAKE2b-256 |
dbf36962a04d01a040c716cecb2aff1be7a683ba13e853a4f8bc25922b76b1a8
|
Provenance
The following attestation bundles were made for ast_ai-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on tjarrier/ast-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ast_ai-0.0.2-py3-none-any.whl -
Subject digest:
8dc47255ea66c3cf6a86453b0393f83313fe1905f3fcf392cf451b283b0f5716 - Sigstore transparency entry: 1091938516
- Sigstore integration time:
-
Permalink:
tjarrier/ast-ai@1d9118eaa74705438cc279d0b863685d86a4fc50 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tjarrier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d9118eaa74705438cc279d0b863685d86a4fc50 -
Trigger Event:
push
-
Statement type: