Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ast_ai-0.0.2.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ast_ai-0.0.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

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

Hashes for ast_ai-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5ea299d31c9cb44f58630f96ecb26703a9f84f49389f6111789d183ea983ec87
MD5 e840dfa143982065c09fc141dec9787b
BLAKE2b-256 18e1afc9d7711608310cf669e0db9afdc12a12d84f6dc2e2d80515545c7ab1e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ast_ai-0.0.2.tar.gz:

Publisher: publish.yml on tjarrier/ast-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for ast_ai-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8dc47255ea66c3cf6a86453b0393f83313fe1905f3fcf392cf451b283b0f5716
MD5 1edc40e4a764a1a2025b101f5db0e9cb
BLAKE2b-256 dbf36962a04d01a040c716cecb2aff1be7a683ba13e853a4f8bc25922b76b1a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ast_ai-0.0.2-py3-none-any.whl:

Publisher: publish.yml on tjarrier/ast-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page