A modern, blazing-fast CLI tool to weave code files into well-formatted prompts for Large Language Models.
- π Fast: Built in Rust with parallel processing for large codebases
- π¨ Multiple Formats: Plain text, Claude XML, and Markdown with fenced code blocks
- π Smart Filtering: Respects
.gitignore, supports custom patterns and file extensions - π Token Estimation: Estimate LLM context usage before sending
- π― Progress Tracking: Visual progress bars for large operations
- π Beautiful Output: Colorized terminal output with clear error messages
- π Line Numbers: Optional line numbering for better code reference
- π Stdin Support: Pipe in file lists from other commands
- 50+ Languages: Intelligent language detection for Markdown code blocks
Linux / macOS
curl -fsSL https://raw.githubusercontent.com/casperakos/codeweave/main/install.sh | shWindows (PowerShell)
irm https://raw.githubusercontent.com/casperakos/codeweave/main/install.ps1 | iexThe installer will:
- β Auto-detect your platform and architecture
- β Download the appropriate binary
- β
Install to
/usr/local/bin(or~/.local/binif no sudo) - β Add to PATH automatically (Windows)
Specify version:
curl -fsSL https://raw.githubusercontent.com/casperakos/codeweave/main/install.sh | CODEWEAVE_VERSION=v0.1.0 shSpecify install directory:
curl -fsSL https://raw.githubusercontent.com/casperakos/codeweave/main/install.sh | CODEWEAVE_INSTALL_DIR=~/.local/bin shDownload pre-built binaries from the releases page:
- Linux (x86_64):
codeweave-linux-x86_64.tar.gz - Linux (ARM64):
codeweave-linux-aarch64.tar.gz - macOS (Intel):
codeweave-macos-x86_64.tar.gz - macOS (Apple Silicon):
codeweave-macos-aarch64.tar.gz - Windows:
codeweave-windows-x86_64.exe.zip
git clone https://github.com/casperakos/codeweave.git
cd codeweave
cargo install --path .cargo install codeweave# Process current directory
codeweave
# Process specific files/directories
codeweave src/ README.md
# Only include Rust files
codeweave src/ --ext rs
# Output as Markdown
codeweave src/ --format markdown
# Save to file with token estimation
codeweave . --output prompt.txt --tokens
# Show progress for large directories
codeweave /large/project --progresscodeweave [OPTIONS] [PATHS]...
| Flag | Description |
|---|---|
-e, --ext <EXT> |
Only include files with specified extensions (repeatable) |
--include-hidden |
Include hidden files and directories |
--ignore <PATTERN> |
Ignore patterns (repeatable) |
--ignore-files-only |
Apply ignore patterns only to files, not directories |
--ignore-gitignore |
Don't respect .gitignore files |
-n, --line-numbers |
Add line numbers to output |
-f, --format <FORMAT> |
Output format: plain, xml, or markdown (default: plain) |
-o, --output <FILE> |
Write to file instead of stdout |
-p, --progress |
Show progress bar |
--tokens |
Estimate token count |
-0, --null |
Read NUL-separated paths from stdin |
-q, --quiet |
Suppress warnings |
# Process all files in current directory
codeweave .
# Process specific directories
codeweave src/ tests/
# Process with multiple file extensions
codeweave . --ext rs --ext toml --ext mdPlain Text (Default)
codeweave src/src/main.rs
---
fn main() {
println!("Hello, world!");
}
---
Claude XML Format
codeweave src/ --format xml<documents>
<document index="1">
<source>src/main.rs</source>
<document_content>
fn main() {
println!("Hello, world!");
}
</document_content>
</document>
</documents>Markdown Format
codeweave src/ --format markdownsrc/main.rs
```rust
fn main() {
println!("Hello, world!");
}
```
# Only Python files
codeweave . --ext py
# Ignore test files
codeweave . --ignore "*test*" --ignore "*.tmp"
# Include hidden files
codeweave . --include-hidden
# Ignore .gitignore rules
codeweave . --ignore-gitignore# With line numbers for better reference
codeweave src/ --line-numbers --format markdown
# Large project with progress and token estimation
codeweave /big/project --progress --tokens --output context.txt
# Pipe from find
find src/ -name "*.rs" | codeweave
# Pipe from fd (faster alternative to find)
fd -e rs | codeweave --format markdown
# NUL-separated for filenames with spaces
find . -name "*.py" -print0 | codeweave --nullPreparing context for Claude/GPT
codeweave src/ --format xml --tokens --output claude-context.xmlCode review preparation
codeweave src/ --ext rs --line-numbers --format markdown > review.mdDocumentation generation
codeweave src/ docs/ --ext rs --ext md --format markdown > full-context.mdFocus on specific module
codeweave src/auth/ --ext rs --line-numbersβ Found 42 files to process
[00:00:02] ======================================== 42/42 src/processor.rs
β Processed 42 files
βΉ Estimated tokens: ~15,420
β Found 100 files to process
β Large file detected: src/data.json (15.3 MB)
β Processed 99 files
! Skipped 1 files due to errors
βΉ Estimated tokens: ~125,430
β Large context size! Consider filtering files.
CodeWeave intelligently detects 50+ programming languages for Markdown code blocks:
- Systems: Rust, C, C++, Go, Zig, V
- Web: JavaScript, TypeScript, HTML, CSS, SCSS
- Backend: Python, Java, Kotlin, C#, PHP, Ruby, Swift
- Functional: Haskell, OCaml, Elixir, Erlang, Clojure, Scala
- Data: JSON, YAML, TOML, XML, SQL, GraphQL
- Shell: Bash, Zsh, Fish, PowerShell
- And many more!
- Parallel Processing: Uses Rayon for concurrent file reading
- Smart Walking: Leverages the
ignorecrate for fast directory traversal - Memory Efficient: Streams output for large files
- Gitignore Aware: Automatically respects
.gitignore,.git/info/exclude, and global gitignore
Contributions are welcome! This project is open source under the MIT license.
git clone https://github.com/yourusername/codeweave.git
cd codeweave
cargo build
cargo testcargo test
cargo test -- --nocapture # Show outputcargo build --release
# Binary at target/release/codeweaveMIT License - see LICENSE for details
Built with:
- clap - Command line argument parsing
- ignore - Gitignore matching
- rayon - Parallel processing
- colored - Terminal colors
- indicatif - Progress bars
- anyhow - Error handling
Inspired by files-to-prompt by Simon Willison
Made with β€οΈ and Rust