Skip to main content

Scriber 2.0: build intelligent code packs from one or more project paths.

Project description

ProjectScriber Logo
ProjectScriber Name

License Latest Version PyPI Version

An intelligent tool to map, analyze, and compile project source code into a single, context-optimized text file for Large Language Models (LLMs). Version 2 brings advanced dependency graph analysis, strict whitelist-based file inclusion, zero-dependency lightweight execution, and progress tracking!


📖 Table of Contents


🤔 Why ProjectScriber?

When working with Large Language Models, providing the full context of a codebase is crucial for getting accurate analysis, documentation, or refactoring suggestions. However, blindly pasting an entire project wastes tokens and introduces noise.

ProjectScriber automates context building using a Whitelist-First philosophy and an Intelligent Scoring Engine. It analyzes your codebase's dependency graph (e.g., Python imports), determines which files are most relevant to the code you're working on, and bundles them into a single, clean markdown file, strictly respecting your token budgets and file-type configurations.

📁 Your Codebase → 📦 ProjectScriber → 📋 LLM-Ready Context


✨ Key Features

Feature Description
🌳 Smart Project Mapping Generates a clear and intuitive tree view of your project's structure.
⚡ Native Rust Acceleration Accelerates heavy I/O and directory scanning natively via a high-performance Rust backend.
🛡️ Whitelist Philosophy By default, only recognized code and support files are included. Binary and lock files are automatically ignored.
🧠 Intelligent Scoring Engine Analyzes import graphs and file proximity to prioritize code modules that are directly related to your provided seed files.
💰 Token Budgets Set a hard limit on --max-tokens. Scriber will fit the most relevant files within your budget to save API costs.
📊 Live Progress & Stats Built-in zero-dependency progress spinner and detailed statistics summary at the end of the run.

🚀 Quick Start

  1. Install Scriber:

    pip install project-scriber
    
  2. Navigate to your project's root and initialize config:

    scriber --init
    

    (This appends a [tool.scriber] block to your pyproject.toml. Use --force to overwrite it.)

  3. Pack your context! Just point it to a file, folder, or let it scan the whole project:

    scriber src/main.py --output context.md
    
  4. Review your stats:

    Scriber build completed.
    ----------------------------------------
     Code files included:    15
     Support files included: 4
     Files omitted/skipped:  2
     Estimated tokens:       12500
    ----------------------------------------
    Scriber pack written to: context.md
    

💾 Installation

ProjectScriber distributes pre-compiled binary wheels for Linux, macOS, and Windows. A simple pip command is all you need:

pip install project-scriber

Or if you use uv:

uv pip install project-scriber

[!NOTE] If a pre-compiled wheel is not available for your platform/architecture, the package will automatically build from source, which requires a Rust compiler toolchain (Rust 1.70+) installed on your machine.


🖥️ Command-Line Usage

Basic Commands

  • Scan the current directory:
    scriber .
    
  • Scan a specific file and its dependencies:
    scriber src/my_module.py
    
  • Interactive Setup: Create/Append a default configuration in pyproject.toml (use --force to overwrite it).
    scriber --init
    

CLI Options

Option Description
paths Project file/folder paths used as seeds. Defaults to current directory.
--profile Preset configuration profile.
--config Path to pyproject.toml. Its parent directory becomes the project root.
--path-base Base directory for relative paths when --config is used.
--format Output format.
--output Output file path, relative to project root unless absolute. Use '-' for stdout.
--only-tree Render only scored tree/map, without file contents.
--modules Enable automatic related module selection.
--no-modules Disable automatic related module selection.
--support Enable support files.
--no-support Disable support files.
--support-content Override default support file content policy.
--max-files Maximum number of files in the pack.
--max-tokens Approximate token budget for included file contents. 0 disables budget.
--min-score Minimum score for non-seed files.
--init Append a default [tool.scriber] config to pyproject.toml and exit.
--force Allow --init to append even if [tool.scriber] already exists.
--project Force project snapshot mode.
--explain, --explain-selection Explain reason for file selection in detail.
--explain-graph Print relation graph statistics and relations.
--why Print exactly which rules/edges pulled the specified file into the pack.
--graph-json Export the RelationGraph as a JSON file to the specified path.
--validate-config Validate pyproject.toml scriber config.
--dry-run Perform a dry run without saving the pack file.
--open Open the output file automatically after creation.
--timings Show execution timings for each phase.
--version Show version information and exit.

Profiles

ProjectScriber comes with several preset profiles to quickly bias the file scoring and inclusion criteria:

Profile Description
default Standard scoring behavior.
audit Boosts tests, config files, CI environments, and dependency files. Assumes full support content inclusion.
debug Boosts direct/reverse dependencies, tests, runtime support, and files close to the seed path.
refactor Boosts files within the same package, related tests, and direct dependencies.
docs Heavily boosts documentation files while suppressing test and code file scores. Assumes tree_only support content by default.

🛠️ IDE Integrations

PyCharm / IntelliJ IDEA (External Tools)

You can integrate ProjectScriber directly into PyCharm's right-click context menu to quickly generate LLM context packs for any selected file or folder!

  1. Open Settings / PreferencesToolsExternal Tools.
  2. Click the + button to add a new tool.
  3. Configure it as follows:
  • Name: Scriber
  • Group: External Tools
  • Description: Runs ProjectScriber on the selected directory and copies output to clipboard
  • Program: scriber (or the absolute path to your scriber.exe e.g., C:\Tools\Python\Python313\Scripts\scriber.exe)
  • Arguments: "$FilePath$" --config $ProjectFileDir$/pyproject.toml
  • Working directory: $ProjectFileDir$

Now, you can simply right-click any file or directory in your Project tree, select External ToolsScriber, and the context pack will be generated instantly based on your project configuration!


⚙️ Configuration

ProjectScriber 2.1.0 configures itself through the standard pyproject.toml using the [tool.scriber] table. Generate the default block using:

scriber --init

Example pyproject.toml

[!NOTE] This is a minimal example. Run scriber --init to generate the full default configuration.

[tool.scriber]
format = "md"
max_tokens = 0        # 0 means unlimited
max_files = 0         # 0 means unlimited
only_tree = false     # If true, file contents are omitted
allow_external_paths = false

[tool.scriber.modules]
enabled = true
content_min_score = 50

[tool.scriber.tokens]
estimator = "chars"
chars_per_token = 4

[tool.scriber.code_files]
# Only files matching these are considered "Code"
patterns = [
    "**/*.py",
    "**/*.js",
    "**/*.ts",
    "**/*.tsx"
]

[tool.scriber.support_files]
enabled = true
# Only files matching these are considered "Support"
patterns = [
    "pyproject.toml",
    "Dockerfile",
    "**/*.svg"
]

[tool.scriber.support_files.content]
default = "auto"
auto_max_bytes = 10000
full = [
    "pyproject.toml",
    "requirements.txt",
    "README.md"
]
tree_only = [
    "**/*.svg"
]

[tool.scriber.hard_ignore]
# Folders ignored entirely during the initial scan
patterns = [
    ".git/**",
    "__pycache__/**",
    "node_modules/**",
    ".venv/**"
]

Whitelist Policy

ProjectScriber 2.1.0 uses a strict whitelist approach:

  1. Files must match either a code_pattern or a support_pattern to be considered.
  2. Unrecognized extensions and binary files are automatically excluded, keeping your LLM context safe from binary garbage.
  3. Lock files are included in the tree by default, but their contents are omitted to save tokens.
  4. Support files can be marked as tree_only (e.g., **/*.svg), meaning they'll show up in the project map but their contents won't be read.

🤝 Contributing & Development

Contributions are welcome!

Development Setup

  1. Clone the Repository:

    git clone https://github.com/SunneV/ProjectScriber.git
    cd ProjectScriber
    
  2. Install Dependencies & Compile Extension (using uv is recommended):

    uv sync --all-extras
    

    (This synchronizes the virtual environment and compiles the native Rust extension automatically!)

  3. Run Tests:

    uv run pytest
    

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

project_scriber-2.1.0.tar.gz (96.2 kB view details)

Uploaded Source

Built Distributions

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

project_scriber-2.1.0-cp310-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

project_scriber-2.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

project_scriber-2.1.0-cp310-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file project_scriber-2.1.0.tar.gz.

File metadata

  • Download URL: project_scriber-2.1.0.tar.gz
  • Upload date:
  • Size: 96.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for project_scriber-2.1.0.tar.gz
Algorithm Hash digest
SHA256 c532bbeadd8b614d49651ffcb0ce6b97e09e8fe9e8633ad99c0ca259fd6c46ea
MD5 ec4802943251c7dc606662422f8ed314
BLAKE2b-256 1e5743f359a9011122e7470703f6720ba9de1743c9709c3992fe5a28e0f00b12

See more details on using hashes here.

Provenance

The following attestation bundles were made for project_scriber-2.1.0.tar.gz:

Publisher: release.yml on SunneV/ProjectScriber

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

File details

Details for the file project_scriber-2.1.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for project_scriber-2.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5d3f40223c6d063b6926fee58fd6262b0a302cfeb91c1913fd196c10ce28d1da
MD5 223bf3d064a4af6dfc520e4f60dc3df7
BLAKE2b-256 7566d4a2a68792afb00897af8119d71a8385a65945dfcfc03cb423f79ed17a14

See more details on using hashes here.

Provenance

The following attestation bundles were made for project_scriber-2.1.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on SunneV/ProjectScriber

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

File details

Details for the file project_scriber-2.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for project_scriber-2.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f5f676bb372dfa824ea653c71fc0a2297cdaf6d3c7ae742512ea148b16d8ee5
MD5 2e2326c7c0907fda2f97b8c2b94b5930
BLAKE2b-256 8c234f02e31353c74f268853e83000fd2bccc360f57987b52ef7ff4013386d3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for project_scriber-2.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on SunneV/ProjectScriber

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

File details

Details for the file project_scriber-2.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for project_scriber-2.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0909d3bf3046cbdde82ea0ae0ccaa8e01dda050819f3a6f666e57f1fb4e26b55
MD5 8e27c7cb6047c805151b63a3666b6cab
BLAKE2b-256 fceeedd5e46bc033ca96ce2f26b4f32d34a79519853ec57395aa1521c0bd5d69

See more details on using hashes here.

Provenance

The following attestation bundles were made for project_scriber-2.1.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on SunneV/ProjectScriber

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

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