Structured context
A filtered directory tree and clearly framed file blocks give AI both project structure and code. Set independent filtering rules for the tree when needed.
<file path="src/main.rs">
BUILT FOR DEVELOPERS
OneSource is a local command-line tool that packages your codebase into a single .onesource file. A directory tree and selected file contents form clear, reusable AI context, with an estimated token count.
Token counts are estimates. Actual usage varies by model and tokenizer.
A filtered directory tree and clearly framed file blocks give AI both project structure and code. Set independent filtering rules for the tree when needed.
<file path="src/main.rs">Organize files locally. Default filters respect rules such as .gitignore and skip common sensitive, generated, and dependency paths. Review the output before sharing.
.gitignore · localSave recurring scan settings in .onesourcerc and reuse them with named profiles. Override settings with command-line options whenever you need to.
.onesourcerc02 / THE OUTPUT
Run onesource to create a file with a directory tree followed by the contents of each selected file. Clear file paths give AI the project background it needs to discuss issues and changes.
my-project/
├── Cargo.toml
└── src/
└── main.rs
<file path="Cargo.toml">
[package]
name = "my-project"
</file>
<file path="src/main.rs">
fn main() {
println!("Hello!");
}
</file>03 / CONTROL YOUR CONTEXT
Use include to select file types and exclude to omit unwanted paths. Exclusions take priority; the directory tree can also have its own filtering rules.
onesource -i "*.rs,*.toml" -x "legacy/"A dry run lists selected files and estimates tokens for the full output without creating a file. When ready, you can also copy the context directly to your clipboard.
onesource --dry-run
onesource --copySave named profiles for different tasks. Settings resolve in this order: command-line options → selected profile → built-in defaults.
onesource profile create backend -i "src/**"
onesource -p backendThe explain command reports content and tree decisions separately, including ignore rules, filters, size, and binary checks. Pass an actual file path to inspect its result.
onesource explain ./target
No 'default' profile in .onesourcerc, using CLI defaults.
════════════════════════════════════════
Path 1/1: ./target
Content:
Result: blocked by blacklist
Rule: blacklist = target
Tree:
Result: blocked by blacklist
Rule: blacklist = target
════════════════════════════════════════04 / THE DETAILS
Defaults skip files larger than 500 KiB and common paths such as .env, private keys, node_modules, and target. Size and binary checks decide whether content is attached, but do not remove paths from the directory tree.
Default filters help skip common sensitive paths. Still check the output for secrets and content that should not be shared. File blocks are framing for AI readability, not a security boundary.
Read the full documentation ↗05 / GET STARTED
With Rust installed, install the free, MIT-licensed OneSource CLI using Cargo.
cargo install onesourceThe installer downloads the latest release to /usr/local/bin and may request sudo permission.
curl -sSL https://raw.githubusercontent.com/TW-RF54732/onesource/main/install.sh | bashRun the installer in PowerShell, then restart your terminal to refresh PATH.
irm https://raw.githubusercontent.com/TW-RF54732/onesource/main/install.ps1 | iexRun these commands from your project directory. Preview the selected files first, then create a .onesource file or copy the context to your clipboard. Review the output before sharing it with AI.
Packaging runs locally; it does not upload your code. Token counts are estimates.
Download a portable binary ↗onesource --dry-run
onesource
onesource --copy