Skip to main content

OnePaste

PyPI Python License

Collect project code into LLM-ready Markdown. Select a directory, press Enter, copy and paste.

Installation

pipx (recommended)

brew install pipx
pipx ensurepath
pipx install onepaste

# Optional: exact token counting via tiktoken
pipx install "onepaste[tokens]"

Without the tokens extra, token counts use a fast characters/4 estimate.

From source (for development)

git clone https://github.com/emVisible/onepaste.git
cd onepaste
pipx install -e .

Uninstall / reinstall (for updates & debugging)

# Uninstall package
onepaste --uninstall

# Uninstall and remove ~/.config/onepaste
onepaste --uninstall --purge-config

# Reinstall editable from local source
cd /path/to/OnePaste
pipx install -e .

Quick Start

# Interactive: navigate to folder → select "Collect this directory" → Enter
onepaste

# Collect current directory (.gitignore filtering on automatically inside git repos)
onepaste .

# Pipe straight into another tool — no file written
onepaste . --stdout | llm "Explain what this project does"

# Only TypeScript sources, skip tests
onepaste . --include "src/**/*.ts" --exclude-pattern "*.test.ts"

Output is a single Markdown file (code_collection.md) ready to copy-paste into any LLM.

Usage

# Interactive mode
onepaste
onepaste -i                    # force .gitignore filter (deprecated: auto inside git)

# Collect a specific directory
onepaste /path/to/project
onepaste . --no-gitignore      # include gitignored files too

# Non-recursive (current directory only)
onepaste . -n

# Custom output
onepaste . -o my_project.md
onepaste . -d ./collected

# Glob filtering (repeatable)
onepaste . --include "src/**"
onepaste . --include "*.py" --include "*.md"
onepaste . --exclude-pattern "*.min.js" --exclude-pattern "tests/*"

# Split large output (default: 2MB per part)
onepaste . --max-output-size 5

# Preview without writing
onepaste . --dry-run

# Extra exclusions
onepaste . --exclude vendor --exclude tmp

Options

Option Description
path Directory to onepaste (default: interactive picker)
-i Force-enable .gitignore filtering (deprecated alias; see below)
--no-gitignore Disable .gitignore filtering
-n, --non-recursive Only current directory, skip subdirectories
-o, --output Output filename (default: code_collection.md)
-d, --output-dir Output directory (default: current working directory)
--max-output-size MB Max output size per file; auto-split when exceeded (default: 2)
--exclude DIR Extra directory to exclude (repeatable)
--include GLOB Only onepaste files matching glob (repeatable; overrides extension whitelist)
--exclude-pattern GLOB Skip files matching glob (repeatable)
--stdout Write collection to stdout; progress goes to stderr; no file written
--dry-run Preview collection without writing output
--force Overwrite existing output instead of auto-incrementing
--config Path to config file (merged with global config)
--init-config Generate default config at ~/.config/onepaste/config.json
--uninstall Uninstall onepaste via pipx and/or pip
--purge-config Also remove ~/.config/onepaste (with --uninstall)
-v, --version Show version
-h, --help Show help

.gitignore defaults

Inside a git work tree, .gitignore filtering is on by default. Outside git repos it is off. Explicit flags win over the default: -i forces it on, --no-gitignore forces it off. (-i used to be required to enable filtering; it still works but the default has changed.)

Glob patterns

--include / --exclude-pattern match against paths relative to the collected root using fnmatch semantics:

Pattern Matches
*.py any .py file anywhere
src/** everything under src/
tests/* files directly inside tests/
*_test.go Go test files anywhere

When --include patterns are given they replace the extension whitelist — you get exactly the matched files (still respecting excludes, size limits and binary detection).

Token counting

Summaries show total tokens plus per-file counts, with a Top-10 table of the largest files. With the optional tokens extra installed, counts are exact (tiktoken, o200k_base); otherwise an estimate (~4 chars/token) is shown and labelled as such.

Output Format

All output is detailed Markdown optimized for LLM consumption:

  • Summary with metadata, token totals, top files by tokens, directory tree, and file list
  • Each source file as a ### heading with line count, size, tokens, and a fenced code block (fences auto-lengthen so source containing backticks never breaks rendering)
  • Auto-split into parts for large projects, each with Part X of N header

Output Behavior

Auto-increment (no overwrite)

If code_collection.md already exists, the next run writes to code_collection_1.md, then _2.md, etc.

Use --force to overwrite.

Auto-split

When output exceeds the size limit, files are split at source-file boundaries. A manifest JSON is written alongside multi-part output.

--stdout never splits; it warns on stderr if the limit would have been exceeded. It also requires an explicit path — the interactive picker would otherwise mix its own output into the piped stream.

Configuration

onepaste --init-config

Edit ~/.config/onepaste/config.json:

{
  "exclude_dirs": [
    "node_modules",
    ".git",
    "__pycache__",
    "venv",
    "dist",
    "build"
  ],
  "include_extensions": [".py", ".js", ".ts", ".go", ".rs", ".java"],
  "include_patterns": [],
  "exclude_patterns": [],
  "max_file_size_mb": 5.0,
  "max_output_size_mb": 2.0,
  "auto_increment_output": true,
  "write_manifest": true
}

.gitignore filtering is intentionally not stored in the config file — it resolves automatically per run (on inside git work trees) unless overridden by -i or --no-gitignore.

Requirements

  • Python 3.8+
  • pipx (for installation)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onepaste-1.3.1.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

onepaste-1.3.1-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file onepaste-1.3.1.tar.gz.

File metadata

  • Download URL: onepaste-1.3.1.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for onepaste-1.3.1.tar.gz
Algorithm Hash digest
SHA256 7b7d824adb3b013115484f79d1f0f15747be8752bd1bc76f76faa00982aa0611
MD5 47178982717e1cd3f025b039ee5f4e50
BLAKE2b-256 bd9fe14cb4d0ba8c580ca5acc13ec5da157539e5f73474b82be5f4962d9965cd

See more details on using hashes here.

File details

Details for the file onepaste-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: onepaste-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for onepaste-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ae75b57f30b605c36df0c1223dab4690dd3ba23101ec612eb49558309cb4e5e
MD5 373c1f60152b995f32389f6e4ace76b6
BLAKE2b-256 204c07ae71ce0068ea8e44a7c1330b71f64948b3dbe432a730f28e626e912482

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.2

2 files

This release

1.3.1 This release

2 files

1.3.0

2 files

Supported by

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