
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
A command-line tool that bundles your code files into a single text or XML file, optimized for AI code review and analysis. It helps developers prepare their codebase for productive conversations with AI language models by combining multiple source files into a well-formatted context.
pip install promptpack-for-code
You can use the tool with its full name promptpack-for-code
or with the convenient short aliases: ppc
or packcode
.
Basic usage with a single directory:
ppc /path/to/your/code
Process multiple directories:
ppc dir1 dir2 dir3
Specify root directory for tree structure and full relative paths:
ppc /path/to/specific/folder -r /path/to/project/root
Specify output file path (default is output.xml):
ppc /path/to/src -o /path/to/output/result.xml
Generate text output instead of XML (XML is now the default):
ppc /path/to/src --format text
Use full XML tags instead of compact format:
ppc /path/to/src --no-compact-xml
Ignore specific patterns:
ppc /path/to/src --ignore "*.log" "*.tmp"
Show progress bar during processing:
ppc /path/to/src --progress
Force overwrite existing output file:
ppc /path/to/src -f
.git
, __pycache__
, etc.)promptpack-for-code
, ppc
, and packcode
The generated text output file contains:
Example text output:
Project Directory Structure:
==========================
project-name
├── src
│ ├── main.py
│ └── utils
│ └── helper.py
└── tests
└── test_main.py
File Contents from Selected Directories:
===================================
====
File: src/main.py
----
[file content here]
The generated XML output file provides a structured representation with:
By default, the tool produces compact XML with minimal tags and no indentation to reduce file size. It includes a legend comment at the beginning of the file explaining all tags:
<!--
XML Tag Legend:
- p: project (root element)
- n: name (project name)
- s: structure (directory structure)
- d: directory
- f: file
- c: contents (file contents section)
- p attribute: path of file or directory
- s inside directory: skipped directory
- e: error
-->
<p><n>project-name</n><s><d p="src"><f p="main.py"/><d p="utils"><f p="helper.py"/></d></d><d p="tests"><f p="test_main.py"/></d></s><c><f p="src/main.py">[file content here]</f></c></p>
For better readability, you can use the --no-compact-xml
option to get full tags with proper indentation:
<project>
<name>project-name</name>
<structure>
<directory path="src">
<file path="main.py" />
<directory path="utils">
<file path="helper.py" />
</directory>
</directory>
<directory path="tests">
<file path="test_main.py" />
</directory>
</structure>
<contents>
<file path="src/main.py">
<content>
[file content here]
</content>
</file>
<!-- Other file contents -->
</contents>
</project>
The XML format offers better structure and is easier to parse programmatically, making it ideal for automated analysis or integration with other tools.
For convenience, this tool provides three command aliases:
promptpack-for-code
: The full nameppc
: Short alias for quicker typingpackcode
: Alternative aliasAll commands provide identical functionality:
# These all do the same thing (generate compact XML by default):
promptpack-for-code /path/to/src
ppc /path/to/src
packcode /path/to/src
# These all generate text output:
promptpack-for-code /path/to/src --format text
ppc /path/to/src --format text
packcode /path/to/src --format text
To contribute to this project:
git clone https://github.com/changyy/py-promptpack-for-code.git
cd py-promptpack-for-code
pip install -e .
MIT License - see LICENSE file for details
FAQs
A tool to bundle code files into a single file for AI analysis
We found that promptpack-for-code demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.