Collect repository files into a single document for easy sharing with AI assistants
Project description
RepoScope
RepoScope
RepoScope is a command-line tool designed to simplify the process of sharing repository contents, especially when working with AI assistants or code review platforms. It helps to quickly and easily share the entire context of a code project without manually copying and pasting individual files. It also allows user to define the content of which files they want to see in the generated output file with flexible pattern matching.
Quickstart
Install with pip:
pip install reposcope
Basic Usage
Create a snapshot of your repository:
# In your project directory, run:
reposcope
# This creates context.txt with all your files
Choose which files to include:
# Only share Python source files
reposcope -i "*.py"
# Only share files from src directory and documentation
reposcope -i "src/*" "*.md"
Skip unwanted files:
# Skip log files and build directory
reposcope -x "*.log" "build/"
# Use your existing .gitignore file
reposcope -g # This skips the same files that git ignores
Save your preferred patterns for reuse:
# Create a profile for source code reviews
reposcope profile create source --mode include
reposcope profile add source "src/*.py" "tests/*.py" "*.md"
# Use it later
reposcope -p source
Output Format
RepoScope generates a context.txt file that looks like this:
Repository: my-project
File Tree:
└── src/main.py
└── src/utils.py
└── README.md
File Contents:
--- src/main.py ---
def main():
print("Hello World!")
...
Command Line Options
| Short | Long | Description |
|---|---|---|
| -g | --use-gitignore | Use .gitignore from current dir |
| -x | --exclude | Exclude patterns |
| -X | --exclude-file | File with exclude patterns |
| -i | --include | Include patterns |
| -I | --include-file | File with include patterns |
| -o | --output | Output file (default: context.txt) |
| -d | --dir | Repository directory |
| -v | --verbose | Show debug logs |
| -p | --profile | Use a saved profile |
Key Concepts
Basic File Selection
Two ways to select files:
-
Exclude Mode (
-x): Start with all files, remove unwanted onesreposcope -x "build/" "*.log" # Everything except builds and logs
-
Include Mode (
-i): Start with no files, add wanted onesreposcope -i "src/*.py" "*.md" # Only Python files and docs
Pattern Matching
RepoScope uses .gitignore-style pattern matching:
*matches any characters except /:*.py,src/*.js?matches one character:test?.pymatches test1.py**matches directories:src/**/*.pymatches all Python files under src/at start matches from root:/test.pyonly matches in root/at end matches directories:build/matches directory and contents!negates pattern:!test_*.pyexcludes test files.
⚠ WARNING! In Linux (and other Unix-like shells like Bash, Zsh), the ! character has special meaning - it's used for history expansion. This means:
- Direct use of ! often fails: Using !pattern directly will typically be interpreted by the shell before it gets to your program. Quoting is required: You generally need to quote the ! character to prevent shell interpretation:
- Single quotes: '!pattern' (most reliable)
- Escaped: !pattern (works in some shells)
- Double quotes with escaping: "!pattern" (needed in some contexts)
Pattern Symmetry
Include and exclude modes are imcompatible (you have to pick one for one use!) but complementary:
# These do opposite things:
reposcope -i "*.py" # Only Python files
reposcope -x '!*.py' # Everything except Python files
# These are equivalent:
reposcope -x "*" '!*.py' # Exclude all but Python
reposcope -i "*.py" # Include only Python
Profiles
Profiles help you save and reuse pattern collections. Instead of typing the same patterns repeatedly, you can save them in a profile and reuse them with a single command.
Profile Commands
| Command | Arguments | Description |
|---|---|---|
create |
name --mode [include|exclude] |
Create new profile |
delete |
name |
Delete existing profile |
add |
name pattern [pattern...] |
Add patterns to profile |
remove |
name pattern [pattern...] |
Remove patterns from profile |
import |
name file |
Import patterns from file |
export |
name |
Export patterns to stdout |
list_profiles |
- | List all available profiles |
show |
name |
Show profile details |
Basic Profile Usage
Create and use a profile:
# Create profile for Python development
reposcope profile create python --mode include
reposcope profile add python "*.py" "requirements.txt"
# Use the profile
reposcope -p python
List and inspect profiles:
# See all profiles
reposcope profile list_profiles
# Show specific profile
reposcope profile show python
Organizing Patterns with Profiles
You can create different profiles for different tasks:
# Profile for code review
reposcope profile create review --mode include
reposcope profile add review "src/" "tests/" "*.md"
# Profile for documentation work
reposcope profile create docs --mode include
reposcope profile add docs "**/*.md" "docs/" "examples/"
# Profile for excluding build artifacts
reposcope profile create clean --mode exclude
reposcope profile add clean "build/" "dist/" "*.pyc" "__pycache__/"
Using Pattern Files
You can import patterns from files:
# patterns.txt:
# Source files
*.py
src/
tests/
# Documentation
*.md
docs/
# Import patterns
reposcope profile create dev --mode include
reposcope profile import dev patterns.txt
Export and Share Profiles
Share your profiles with team members:
# Export patterns to a file
reposcope profile export myprofile > myprofile_patterns.txt
# Send file to colleague, they can import it:
reposcope profile create myprofile --mode include
reposcope profile import myprofile myprofile_patterns.txt
Pro Tips for Profiles
-
Combine include and exclude profiles:
# Profile for source code reposcope profile create source --mode include reposcope profile add source "src/**/*.py" # Profile for artifacts to ignore reposcope profile create artifacts --mode exclude reposcope profile add artifacts "*.pyc" "__pycache__" # Use them together (include source, then exclude artifacts) reposcope -p source -x "*.pyc" "__pycache__"
-
Use project-specific profiles:
# Django project profile reposcope profile create django --mode include reposcope profile add django "*.py" "templates/" "static/" # Flask project profile reposcope profile create flask --mode include reposcope profile add flask "*.py" "templates/" "static/" "instance/"
-
Create focused profiles:
# Tests only reposcope profile create tests --mode include reposcope profile add tests "tests/**/*.py" "pytest.ini" "conftest.py" # Database related files reposcope profile create db --mode include reposcope profile add db "models.py" "migrations/" "schema.sql"
Profile Storage
Profiles are stored in ~/.config/reposcope/profiles.json. Each profile maintains:
- Name
- Mode (include/exclude)
- List of patterns
Examples with Explanations
-
Development profile:
reposcope profile create dev --mode include # Add source files reposcope profile add dev "src/**/*.py" # Add test files but exclude integration tests reposcope profile add dev "tests/" '!tests/integration/' # Add documentation reposcope profile add dev "*.md" "docs/"
-
Cleanup profile:
reposcope profile create cleanup --mode exclude # Exclude common build artifacts reposcope profile add cleanup "build/" "dist/" "*.egg-info" # Exclude Python cache files reposcope profile add cleanup "**/__pycache__" "*.pyc" "*.pyo" # Exclude common editor/IDE files reposcope profile add cleanup ".vscode/" ".idea/" "*.swp"
-
Documentation profile:
reposcope profile create docs --mode include # Include all documentation files reposcope profile add docs "**/*.md" "**/*.rst" # Include examples and tutorials reposcope profile add docs "docs/" "examples/" "tutorials/" # Exclude work in progress reposcope profile add docs '!**/draft/' '!**/*_wip.*'
More Examples
AI Code Review
# Share source and tests, exclude temporary files
reposcope -i "src/**/*.py" "tests/**/*.py" '!**/tmp/*'
# Everything except build artifacts and caches
reposcope -g -x "*.pyc" "**/__pycache__/"
Documentation Work
# Only documentation files
reposcope -i "**/*.md" "docs/" "examples/"
# Share docs but exclude drafts
reposcope -i "docs/" '!docs/drafts/'
Pro Tips
-
Combine .gitignore with extra exclusions:
reposcope -g -x "*.tmp" "scratch/"
-
Override .gitignore exclusions:
reposcope -g -x '!build/important.txt'
-
Use directory patterns effectively:
# All files in src except tests reposcope -i "src/" '!src/tests/'
-
Chain patterns for complex selections:
# Python files except tests, plus documentation reposcope -i "*.py" '!test_*.py' "docs/*.md"
Development
-
Install development dependencies:
pip install -e ".[dev]"
-
Run tests:
pytest
Limitations
- Currently Linux-only
- Requires Python 3.9+
- Large repositories might generate very big context files. Proceed carefully. (However, it does skip binary files)
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reposcope-0.3.4.tar.gz.
File metadata
- Download URL: reposcope-0.3.4.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
664ddb3d7d0c193d53f5c49b423308f122f14c602c1413295841cd3d51f9a276
|
|
| MD5 |
c095c2c14947f69bc2527c632ae0eb32
|
|
| BLAKE2b-256 |
ededee28dc5ced87dce58af74261290df0e89c689689dd1104ccccb08168d16e
|
Provenance
The following attestation bundles were made for reposcope-0.3.4.tar.gz:
Publisher:
python-package.yml on AlekseiShevkoplias/reposcope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reposcope-0.3.4.tar.gz -
Subject digest:
664ddb3d7d0c193d53f5c49b423308f122f14c602c1413295841cd3d51f9a276 - Sigstore transparency entry: 190810951
- Sigstore integration time:
-
Permalink:
AlekseiShevkoplias/reposcope@23fd8e747c704b9d394851800fc4dabb82647e9b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AlekseiShevkoplias
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@23fd8e747c704b9d394851800fc4dabb82647e9b -
Trigger Event:
push
-
Statement type:
File details
Details for the file reposcope-0.3.4-py3-none-any.whl.
File metadata
- Download URL: reposcope-0.3.4-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
670a51c6539055dfde7fabca1e497b3995cbd1032c1812f8eacc193f7410ac2f
|
|
| MD5 |
a6f1bd24606520ae4fe24b292ff68d1e
|
|
| BLAKE2b-256 |
bdbc5da76f1b66dac20338c24153cfc03ab543669358f3d89236c6d1fae30550
|
Provenance
The following attestation bundles were made for reposcope-0.3.4-py3-none-any.whl:
Publisher:
python-package.yml on AlekseiShevkoplias/reposcope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reposcope-0.3.4-py3-none-any.whl -
Subject digest:
670a51c6539055dfde7fabca1e497b3995cbd1032c1812f8eacc193f7410ac2f - Sigstore transparency entry: 190811027
- Sigstore integration time:
-
Permalink:
AlekseiShevkoplias/reposcope@23fd8e747c704b9d394851800fc4dabb82647e9b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AlekseiShevkoplias
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@23fd8e747c704b9d394851800fc4dabb82647e9b -
Trigger Event:
push
-
Statement type: