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 . --structure-only # file and directory structure, without contents
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.2.tar.gz
(7.7 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.2-py3-none-any.whl
(8.6 kB
view details)
File details
Details for the file p2ctx-0.1.2.tar.gz.
File metadata
- Download URL: p2ctx-0.1.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4529a49fda9e410bc1a65dbbdf5f1e8ecb00c5e5fbe67896b87caf6edb017ca4
|
|
| MD5 |
e38f17ce699868ac848e48e3d597e6ed
|
|
| BLAKE2b-256 |
7461ec009f9e70732e3f9c4cc9d95efcfe229a53860fdcb9739eb2edf5af5a68
|
File details
Details for the file p2ctx-0.1.2-py3-none-any.whl.
File metadata
- Download URL: p2ctx-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.6 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 |
5804d6e79db2d831d31ecc52e9404bf706d88106d1ae52317ac0b6215a41c9b5
|
|
| MD5 |
75a2a02002ace7e7147eef74750a4595
|
|
| BLAKE2b-256 |
50db7f8f07a1424d30bf55bb419e11dfa5e9e527d5ba852ab98f3e572a68e1bb
|