Skip to main content

OnePaste

PyPI Python License Publish

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.2.tar.gz (36.9 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.2-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: onepaste-1.3.2.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for onepaste-1.3.2.tar.gz
Algorithm Hash digest
SHA256 fe6cfd45181b4f4fdd2fab4aa591199f3031312c67f26b4822506efb4e150d33
MD5 c7be1021213e9aff1727e63c5b5703dd
BLAKE2b-256 a23cda5e3af927cb7b2fe10cb22f746f0b22bc733fcb5a4b9c0f1c6ecfe35556

See more details on using hashes here.

Provenance

The following attestation bundles were made for onepaste-1.3.2.tar.gz:

Publisher: publish.yml on emVisible/onepaste

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: onepaste-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for onepaste-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 def5dbfb671a456887889a87941749c3dcd4504ff1a4c4359a914e4fc10a3f53
MD5 0cc26540c30b3df3d880cda7b99ce54f
BLAKE2b-256 14fee91c699fde68473ab627307f2d46ea3d554007d91a41eb0715674b8a6ba0

See more details on using hashes here.

Provenance

The following attestation bundles were made for onepaste-1.3.2-py3-none-any.whl:

Publisher: publish.yml on emVisible/onepaste

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 files

1.3.1

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