Skip to main content

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.

Metadata

Release files for ast-ai 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ast-ai 0.0.2
File Size Uploaded Provenance
ast_ai-0.0.2.tar.gz 8.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ast-ai 0.0.2
File Interpreter ABI Platform
ast_ai-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / ast_ai-0.0.2.tar.gz

Download URL ast_ai-0.0.2.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5ea299d31c9cb44f58630f96ecb26703a9f84f49389f6111789d183ea983ec87
BLAKE2b-256 checksum
How to use checksums
18e1afc9d7711608310cf669e0db9afdc12a12d84f6dc2e2d80515545c7ab1e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Release files / ast_ai-0.0.2-py3-none-any.whl

Download URL ast_ai-0.0.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dc47255ea66c3cf6a86453b0393f83313fe1905f3fcf392cf451b283b0f5716
BLAKE2b-256 checksum
How to use checksums
dbf36962a04d01a040c716cecb2aff1be7a683ba13e853a4f8bc25922b76b1a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Security for ast-ai 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ast_ai-0.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page