p2ctx
Bundles a project's source (code, structure, Go dependency graph) into a single compact JSON or Markdown file, ready to feed to an LLM.
Compresses function/method bodies down to signatures + docstrings/JSDoc for Go, Python, and JS/TS/JSX/TSX, so tokens aren't spent on implementation details the model doesn't need to see.
Install
pip install p2ctx
Usage
p2ctx . # current dir -> <dirname>_context.json
p2ctx /path/to/proj -o out.json
p2ctx . --format md # markdown instead of JSON
p2ctx . --stdout | pbcopy # print to stdout instead of a file
p2ctx . --copy # copy result straight to clipboard
p2ctx . --include "*.py" --exclude "tests/*"
p2ctx . --respect-gitignore
p2ctx . --no-compress-go # skip Go compression
p2ctx . --no-compress-py # skip Python compression
p2ctx . --no-compress-js # skip JS/TS/JSX/TSX compression
p2ctx . --no-compress # skip all compression
p2ctx . --max-size 300000
p2ctx . --tiktoken # exact token count
Optional dependencies
pip install p2ctx[clipboard] # for --copy
pip install p2ctx[tokens] # for --tiktoken
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
p2ctx-0.1.1.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
p2ctx-0.1.1-py3-none-any.whl
(8.2 kB
view details)
File details
Details for the file p2ctx-0.1.1.tar.gz.
File metadata
- Download URL: p2ctx-0.1.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00aa91a159f6bfd6b4ed45b4e671b5842053c23502f99245879db36f3d9a2f13
|
|
| MD5 |
5051382c2d4e7c2906b7983337e1c5a1
|
|
| BLAKE2b-256 |
f06aff5d8e52f20a87e957930360e7883987c844eeff4294aa3e1ae8d50676c3
|
File details
Details for the file p2ctx-0.1.1-py3-none-any.whl.
File metadata
- Download URL: p2ctx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63d904bb09084b5f32cbce2284b958bb2bf1bc5d8dd75fab6f845d17a5bca396
|
|
| MD5 |
5e17a1ef2539fa73957eaa0ebeeb709a
|
|
| BLAKE2b-256 |
59a4d26dba46ea8debaefb0f7a684811bf4866dfe52a5d2a40326e3f6ac458dd
|