| __ \ | | / ____| | | | |
| |__) |__ _ __| |______| | ___ _ __ | |_ _____ _| |_
| ___/ _ \ '__| |______| | / _ \| '_ \| __/ _ \ \/ / __|
| | | __/ | | | | |___| (_) | | | | || __/> <| |_
|_| \___|_| |_| \_____\___/|_| |_|\__\___/_/\_\\__|
pcontext.pl turns a source-code repository into a single, LLM-friendly Markdown dump with:
- a repo + language overview
- a tree view
- annotated file contents in code fences (
```lang:path/to/file)
You 'don't need the repo locally – pcontext.pl can clone it, dump it, and clean up after itself:
perl pcontext.pl --git_url https://github.com/psf/requests.git > requests_context.mdThis will:
-
Clone
https://github.com/psf/requests.gitinto a temp directory -
Walk the repo and print:
- overview + languages
- tree
- file contents in fenced blocks
-
Delete the temporary clone when done
You can then paste parts of requests_context.md into an LLM.
If you already have the repo locally:
# From inside the repo
perl /path/to/pcontext.pl . > repo_context.md
# Or from elsewhere
perl pcontext.pl /path/to/repo > repo_context.mdEverything is configured via environment variables:
# Limit how big a single file may be (bytes)
REPO_DUMP_MAX_BYTES=200000 \
# Limit lines per chunk (0 = no chunking)
REPO_DUMP_MAX_LINES=800 \
# Add line numbers: " 137| some_code()"
REPO_DUMP_LINE_NUMBERS=1 \
# Only dump certain extensions (no dots, comma-separated)
REPO_DUMP_ONLY_EXT="py,js,ts" \
# Extra glob-style excludes (on top of .gitignore)
REPO_DUMP_EXCLUDE="docs/*,__snapshots__/*,*.min.js" \
perl pcontext.pl --git_url https://github.com/psf/requests.git > filtered_context.mdThe generated Markdown is organised into:
-
### REPO OVERVIEW– root, dirs, files, approx tokens, key files -
### LANGUAGE OVERVIEW– per-language file counts / tokens / roles -
### REPO TREE– indented directory tree -
### FILE CONTENTS– for each file:-
metadata (size, language, role, hints)
-
optional
--- CHUNK N of path/to/file ---headers -
a fence like:
```python:src/module/foo.py ...file contents... -
closing
=== FILE END: src/module/foo.py ===
-
Paste only the parts you need into your LLM (overview + selected files/chunks) and refer to files as lang:path/to/file and to specific lines when line numbers are enabled.