Skip to main content

Pack your codebase into a single formatted Markdown string for LLMs.

Project description

📦 ai-pack

Python Version License PyPI version GitHub Stars

Pack your entire codebase, specific files, or uncommitted changes into a single token-optimized Markdown prompt for LLMs (like ChatGPT, Claude, Gemini).


[!IMPORTANT] 📋 Default Clipboard Behavior

By default, running aip automatically copies the generated Markdown payload directly to your system clipboard. No files are saved to disk unless you specify the output file using the -o or --output flag.

Note: It also natively supports remote SSH sessions using the OSC 52 clipboard escape sequence.


⚡ Key Features

  • 📋 Clipboard-First: Automatically copies your prompt, ready to paste straight into ChatGPT, Claude, Gemini, or any LLM interface.
  • 💀 Skeleton Mode (-s / --skeleton): Drastically saves tokens by stripping function/method bodies, keeping only class structures, signatures, and imports.
  • 🎯 Interactive Selector (-i): Choose files interactively via checkbox CLI menu.
  • 🌿 Git-Aware (-c / --changed): Automatically pack only modified, staged, or untracked files.
  • 🛡️ Gitignore-Respecting: Excludes ignored, temporary, or build files automatically (using git ls-files with manual fallback for non-git folders).
  • 💬 Prompt Presets (-p): Instantly prepend pre-configured prompts for code review, bug hunting, or architecture explanations.
  • 📊 Token Estimation: Heuristic token counting warns you if your payload exceeds your limit (--max-tokens).

🚀 Quick Start

Installation

Choose your preferred installation method:

# Option 1: Install official package via pip (Recommended)
pip3 install ai-pack-cli --user

# Option 2: Install via pipx (Isolated environment)
pipx install ai-pack-cli

# Option 3: Install development version directly from GitHub
pip3 install git+https://github.com/iamraydoan/ai-pack.git --user

[!TIP] Skeleton Mode (-s / --skeleton) for non-Python languages: To extract code skeletons for JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin, install ast-grep globally:

npm install -g @ast-grep/cli
# or: cargo install ast-grep

💡 Usage & Common Scenarios

Here are common ways to use ai-pack (using commands aip, ai-pack, or aipack):

1. Pack codebase & copy to clipboard (Default)

aip

2. Pack specific files/folders and save to a file

aip -f src/main.py tests/ -o output.md

3. Pack only uncommitted changes with a code review prompt

aip -c -p review

4. Pack code skeleton to save context window tokens

aip -s -p explain

5. Choose files interactively before packing

aip -i

⚙️ CLI Flags & Interactions

Reference

Flag Short Type Description
--files -f Path(s) Specific files or directories to pack (space-separated).
--changed -c Flag Pack only modified, staged, or untracked Git files.
--interactive -i Flag Select files interactively via a checkbox menu.
--skeleton -s Flag Strip method bodies, leaving only signatures and imports to save tokens.
--prompt -p Choices Prepend preset: review, bug, or explain.
--output -o Path Save output directly to a file instead of copying to clipboard.
--max-tokens Number Count approximate tokens and warn if the limit is exceeded.

🤝 Combining Flags

You can combine flags to narrow down and customize your payload:

  • Filter Git changes (-f + -c / --changed): Only packs files that are both modified/uncommitted AND located inside the specified paths.
    aip -c -f src/
    
  • Interactive selection with filter (-i + -f / -c): Shows only the filtered list (e.g. only changed files) in the interactive checkbox menu instead of the entire repo.
    aip -i -c
    
  • Structure only (-s / --skeleton + any mode): Can be appended to any command to extract skeletons instead of full source code for the selected files.
    aip -i -s
    
  • Redirect output (-o vs Default): By default, everything goes to the clipboard. Use -o filename.md to save to a file instead.

💀 Skeleton Mode Example

Original Code:

def fibonacci(n):
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    sequence = [0, 1]
    while len(sequence) < n:
        sequence.append(sequence[-1] + sequence[-2])
    return sequence

Skeleton Output:

def fibonacci(n): ...

🤝 Contributing

Contributions are welcome! Please check out the Developer & Contributing Guide for local setup, running unit tests, and code formatting guidelines (ruff).

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feat/amazing-feature).
  3. Commit your changes (git commit -m 'feat: add amazing feature').
  4. Push to the branch (git push origin feat/amazing-feature).
  5. Open a Pull Request.

Give this repository a ⭐ if it helped you pack your code for LLMs!

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

ai_pack_cli-0.2.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

ai_pack_cli-0.2.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file ai_pack_cli-0.2.0.tar.gz.

File metadata

  • Download URL: ai_pack_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ai_pack_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7242520e1fe7f4781a66f8d33a158ebdeb85beef187539fdc1eca99dc858d5a5
MD5 01460ce3ff5083eab3e6c802a95d733c
BLAKE2b-256 a6557714bc2d4b7d275121abd78a05bb409d14a448da9171e03f2722a23adbe1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_pack_cli-0.2.0.tar.gz:

Publisher: publish.yml on iamraydoan/ai-pack

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

File details

Details for the file ai_pack_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ai_pack_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ai_pack_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12b55c4ba90fe8df895cd51df522098af7cce4b0c0d7cbea33b71082779fa92d
MD5 7cc8e91d3725cfae749ca1c1fba3726e
BLAKE2b-256 a63a7fa83a6d6eff6c8656f5bbd5a24159d94b45e8a314056859ed377375c7dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_pack_cli-0.2.0-py3-none-any.whl:

Publisher: publish.yml on iamraydoan/ai-pack

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