Welcome to APC, your friendly command-line utility that prepares project code context for AI consumption. Think of it as a personal assistant for your AI projects, ready to fetch, parse, and present your project's files and directories in a well-structured format. Whether you're building the next AI revolution or just tinkering with code on a rainy afternoon, APC is here to help.
APC is designed to streamline the process of gathering and structuring project data, making it easier for AI models to understand and process your codebase. By respecting ignore rules and providing options for handling large or binary files, APC ensures that your AI gets only the context it needs. And remember, a well-fed AI is a happy AI!
- Directory Structure Generation: automatically generates a structured view of your project's files and directories. No more manual digging through folders!
- File Content Inclusion: includes file contents for context, ensuring your AI has all the information it needs.
- Ignore Rules Respect: honors
.gitignoreand.apcignorefiles, so only the files you care about are included. - Configurable File Size Limits: set your own limits for file sizes to include, because sometimes less is more.
- Binary File Handling: choose whether to include binary files with placeholder content. Perfect for those who like living on the edge.
For those who value speed and efficiency:
curl -fsSL https://raw.githubusercontent.com/fgbm/apc/refs/heads/master/scripts/install.sh | shiwr -useb https://raw.githubusercontent.com/fgbm/apc/refs/heads/master/scripts/install.ps1 | iexPrefer the scenic route? Download the latest binary for your platform from the Releases page.
For the purists who enjoy the journey as much as the destination:
cargo install --git https://github.com/fgbm/apcUsing APC is as easy as pie (or cake, if that's your preference). Below are some common scenarios where APC can save the day:
To generate a complete project context, simply provide the path to your project directory:
apc /path/to/your/projectWant to save the output for later? Use the -o or --output option:
apc /path/to/your/project -o project_context.txtGot a project with some hefty files? Set a maximum file size (in bytes) to include:
apc /path/to/your/project --max-file-size 204800Feeling adventurous? Include binary files with placeholder content:
apc /path/to/your/project --include-binaryIf you're only interested in the directory structure and not the file contents, try structure-only mode:
apc /path/to/your/project --structure-onlyThe .apcignore file is a configuration file used by the APC tool to specify files and directories that should be
excluded from the project context. This is similar to a .gitignore file but specifically tailored for APC's
functionality. By defining a .apcignore file in your project's root or any subdirectory, you can control which parts
of your codebase are included in the context generation process. This helps in reducing noise and focusing only on the
relevant files for AI consumption.
To create a .apcignore file, simply add it to the root of your project or in any subdirectory where you want specific
ignore rules to apply. The syntax is the same as .gitignore, allowing you to specify patterns for files and
directories to be ignored.
# Ignore all log files
*.log
# Ignore all files in the tmp directory
/tmp/
# Specific file to ignore
secret_config.toml
By default, APC will automatically ignore the following directories and files:
.git/.idea/.vscode/.gitignore.apcignore
These defaults ensure that common version control and IDE-specific files do not interfere with the project context.
-
Preparing for AI Training: before feeding your project to an AI model, use APC to create a comprehensive context that highlights all the necessary files and their contents.
-
Code Review and Auditing: quickly generate a structured overview of a project's files and contents for code reviews or audits.
-
Project Documentation: use the output to help document the structure and key components of your project for team members or stakeholders.
Got ideas? Found a bug? Feel like adding a dash of humor to the code comments? We welcome contributions! Check out our repository on GitHub and join the fun.
APC is licensed under the MIT License. Share it, modify it, or just enjoy it as is — the choice is yours!