Skip to main content

Package your entire codebase into a single text file for AI consumption

Project description

Blobify Blobify

Package your entire codebase into a single text file for AI consumption

PyPI version Python version License Tests Code style: black VS Code Extension

Feed your project to Claude, ChatGPT, or other AI assistants for code analysis, debugging, refactoring, documentation, or feature development.

Quick Start

Install:

pip install blobify

Basic usage:

# Package current directory to clipboard
bfy . --copy-to-clipboard=true

# Or run without directory if .blobify exists
bfy --copy-to-clipboard=true

Command Line Options

bfy [directory] [options]
  • directory - Directory to scan (optional, defaults to current directory if .blobify file exists)
  • --output-filename <file> - Output file path (optional, defaults to stdout)
  • -x, --context [name] - Use specific context from .blobify file, or list available contexts if no name provided
  • -f, --filter <"name","regex","filepattern"> - Content filter: extract only lines matching regex pattern, optionally restricted to files matching filepattern (can be used multiple times)
  • --debug=true|false - Enable debug output for gitignore and .blobify processing (default: false)
  • --enable-scrubbing=true|false - Enable scrubadub processing of sensitive data (default: true)
  • --output-line-numbers=true|false - Include line numbers in file content output (default: true)
  • --output-index=true|false - Include file index section at start of output (default: true)
  • --output-content=true|false - Include file contents in output (default: true)
  • --output-metadata=true|false - Include file metadata (size, timestamps, status) in output (default: true)
  • --show-excluded=true|false - Show excluded files in file contents section (default: true)
  • --copy-to-clipboard=true|false - Copy output to clipboard (default: false)
  • --suppress-timestamps=true|false - Suppress timestamps in output for reproducible builds (default: false)
  • --list-patterns=none|ignored|contexts - List patterns and exit: 'ignored' shows built-in patterns, 'contexts' shows available contexts (default: none)

Key features: Respects .gitignore, automatic sensitive data scrubbing, includes line numbers, supports custom filtering via .blobify configuration, content filters for extracting specific patterns with file targeting, context listing for easy discovery, cross-platform clipboard support, context inheritance for reusable configurations.

Important Notice: The scrubbing feature is not guaranteed to work; it may not detect some sensitive data. Consider it a best-effort helper only. Always review output before sharing.

Content Filters

You can add multiple filters to extract specific patterns from files.

The filter syntax is: "name","regex","filepattern" where:

  • name - Filter identifier (for display)
  • regex - Regular expression to match content lines
  • filepattern - Optional file glob pattern (defaults to * for all files if omitted)

If you provide only two values like "name","regex", the filter applies to all matched files. Single values like "regex" use the regex as both name and pattern.

Basic Filters

# Function and class definitions
bfy . --filter '"signatures","^(def|class)\s+"' --copy-to-clipboard=true

# Multiple filters (OR logic)
bfy . --filter '"funcs","^def"' --filter '"imports","^import"' --copy-to-clipboard=true

File-Targeted Filters

Target specific file types with the file pattern syntax:

# Python functions only
bfy . --filter '"py-functions","^def","*.py"' --copy-to-clipboard=true

# Backend API analysis: routes from Python + SQL from migrations
bfy . --filter '"api-routes","@app\.","*.py"' --filter '"queries","^(SELECT|INSERT)","*.sql"' --copy-to-clipboard=true

.blobify Configuration

Create a .blobify file in your project directory for custom configurations. When a .blobify file exists in your current directory, you can run bfy without specifying a directory argument.

VS Code Extension: For .blobify file syntax highlighting and validation, install the Blobify Format extension from the VS Code Marketplace.

Basic Configuration

  • @option=value - Set default configuration option (@debug=true, @copy-to-clipboard=true, @output-content=false, etc.)
  • @filter="name","regex","filepattern" - Set default content filter with CSV format for file targeting
  • +pattern - Include files (overrides gitignore)
  • -pattern - Exclude files
  • [context-name] - Define named contexts
  • [context-name:parent] - Define context with single inheritance
  • [context-name:parent1,parent2] - Define context with multiple inheritance
  • ## instruction - Add LLM/AI analysis instructions (appears in output header)
  • Supports * and ** wildcards
# Default configuration options
@copy-to-clipboard=true
@show-excluded=false
@suppress-timestamps=true

# Content filters with file targeting (CSV format)
@filter="signatures","^(def|class)\s+","*.py"
@filter="imports","^(import|from)","*.py"
@filter="routes","@app\.(get|post)","app.py"

# Include/exclude patterns
+.github/**
+.pre-commit-config.yaml
-*.log
-temp/**

[docs-only]
# Documentation review context
## Review this documentation for clarity and completeness
## Check for broken links and outdated information
-**
+*.md
+docs/**

[security-review]
## This codebase represents a web application built with Flask
## Focus on security vulnerabilities including SQL injection and XSS
## Pay special attention to authentication and authorization mechanisms
+*.py
+templates/*.html

[todos]
# Find all TODOs and FIXMEs
@filter="todos","(TODO|FIXME|XXX)"
@show-excluded=false
+**

LLM instructions (lines starting with ##) appear in the output header as:

# Instructions for AI/LLM analysis:
# * Review this documentation for clarity and completeness
# * Check for broken links and outdated information

Context Inheritance

  • Use [context:parent] for single inheritance
  • Use [context:parent1,parent2] for multiple inheritance
  • Contexts can only inherit from contexts defined earlier in the file
  • Child contexts inherit all patterns and options from parents, then add their own
  • Cannot redefine the default context - it's automatically created
  • Inheritance order is preserved: parent1 → parent2 → child
  • LLM instructions are also inherited from parent contexts
# Base configuration
@copy-to-clipboard=true
@debug=true
# Match nothing by default
-**

[backend:default]
# Inherits @copy-to-clipboard=true, @debug=true, +*.py, -*.pyc from default
## Analyze backend code for performance and security issues
+*.sql
+migrations/**
@filter="functions","^def","*.py"
@filter="models","^class.*Model","models/*.py"

[frontend:default]
# Also inherits from default
## Focus on component structure and state management
+*.js
+*.vue
+*.css
@filter="components","^(function|const)\s+[A-Z]","*.jsx"

[full:backend,frontend]
# Multiple inheritance - combines backend + frontend
## Perform comprehensive full-stack analysis
+*.md
+docs/**
@show-excluded=false

Development

Setup

1 - Clone and enter directory:

git clone https://github.com/AlexanderParker/blobify.git
cd blobify

2 - Create and activate virtual environment:

python -m venv venv
source venv/bin/activate  # Linux/macOS
# or
venv\Scripts\activate     # Windows

3 - Install with dev dependencies:

pip install -e ".[dev]"
pre-commit install

Run Tests

invoke test        # Run tests
invoke coverage    # Run with coverage
invoke format      # Format code
invoke lint        # Check code quality
invoke all         # Check everything

For Maintainers

Publishing to PyPI:

This package is published to PyPI as blobify. Releases are managed using invoke tasks:

# On branch main - after any release-related PRs are merged in.

# Bump version (choose one):
invoke bump-patch     # 1.0.0 → 1.0.1
invoke bump-minor     # 1.0.0 → 1.1.0
invoke bump-major     # 1.0.0 → 2.0.0
# or set specific version:
invoke set-version 1.2.3

# Ensure all tests pass:
invoke all

# Clean any previous build artifacts:
invoke clean-dist

# Build the package:
invoke build

# Test upload to TestPyPI first (recommended):
invoke publish-test

# Upload to production PyPI (requires appropriate credentials):
invoke publish

# Finally tag the build with the new version number and push the tag to the remote:
invoke tag-release

TestPyPI Testing:

# Install from TestPyPI to verify the package:
invoke test-install

License

MIT License - see the project repository for details.

Project details


Download files

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

Source Distribution

blobify-1.1.0.tar.gz (73.5 kB view details)

Uploaded Source

Built Distribution

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

blobify-1.1.0-py3-none-any.whl (82.5 kB view details)

Uploaded Python 3

File details

Details for the file blobify-1.1.0.tar.gz.

File metadata

  • Download URL: blobify-1.1.0.tar.gz
  • Upload date:
  • Size: 73.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for blobify-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b69ed4f17ea7aa8eceeb8869c4620205e8ec6d6409136c52a41ea8a489632c01
MD5 0844c3c98b3152501920884638b9f6c0
BLAKE2b-256 7bd832649126958e1d64599fcbcf1f3da73a1f36dc174c18c9e474edd713d2ea

See more details on using hashes here.

File details

Details for the file blobify-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: blobify-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 82.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for blobify-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be2fdd4e80ccdd5d32c13588cd195a73f40b0c185fb6e24e3969f40e2aab4116
MD5 1c4cc75d99f797456b14aa5acdcd5fbd
BLAKE2b-256 df5286e22d07664b2dd7d52f403a13d40c572e6d18c7b0eb3d1cabea097f0613

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 Pingdom Monitoring Sentry Error logging StatusPage Status page