Skip to main content

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)

Uploaded Source

Built Distribution

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

p2ctx-0.1.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

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

Hashes for p2ctx-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4529a49fda9e410bc1a65dbbdf5f1e8ecb00c5e5fbe67896b87caf6edb017ca4
MD5 e38f17ce699868ac848e48e3d597e6ed
BLAKE2b-256 7461ec009f9e70732e3f9c4cc9d95efcfe229a53860fdcb9739eb2edf5af5a68

See more details on using hashes here.

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

Hashes for p2ctx-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5804d6e79db2d831d31ecc52e9404bf706d88106d1ae52317ac0b6215a41c9b5
MD5 75a2a02002ace7e7147eef74750a4595
BLAKE2b-256 50db7f8f07a1424d30bf55bb419e11dfa5e9e527d5ba852ab98f3e572a68e1bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page