Prepare a small project
Use this page when you want to produce your first bundle and check what you will share. You will preview three files, write a bundle, inspect it, then optionally copy it. A bundle is a text document containing a project tree and file contents; it does not compile or run the project.
In a new folder named demo, create the following files with a text editor. The text after each filename is its content; use a line break for each ↵. Use sample values only. Open a terminal in demo. Do not reuse a folder containing an existing .onesourcerc.
Cargo.toml: [package] ↵ name = "demo" ↵ version = "0.1.0" ↵ edition = "2021"README.md: # Demosrc/main.rs: fn main() {}
OneSource must already be available as onesource. If it is not, follow Installation. All commands on this page start in this folder unless a step explicitly says otherwise.
1. Preview, then write the bundle
Run the preview first. --no-config uses built-in settings instead of loading a profile; --dry-run reads selected files and estimates the output without writing the bundle.
onesource --no-config --dry-runLook for one [EXPECT] line for each prepared file and Files Processed: 3. The preview also prints the tree and planned output path. Token values vary with content and are not a pass/fail condition. No demo.onesource should exist yet.
[EXPECT] Cargo.toml (... content tokens)
[EXPECT] README.md (... content tokens)
[EXPECT] src/main.rs (... content tokens)
Files Processed: 3Once the selection is correct, remove --dry-run. This is the step that creates the file; it uses the same selection rules as the preview.
onesource --no-configExpect Output saved to: followed by the path to demo.onesource. Because your terminal is inside demo, the file is also inside demo. If you run from another working directory, the default output goes there instead.
2. Open and inspect the output
Open demo.onesource with a text editor. The tree gives orientation; each following <file path="…"> block contains the named file’s text. Check filenames and contents before sharing. Seeing a filename in the tree alone does not guarantee that its contents were attached.
demo/
├── Cargo.toml
├── README.md
└── src/
└── main.rs
<file path="Cargo.toml">
[package]
...
</file>
<file path="src/main.rs">
fn main() {}
</file>This is an excerpt: the actual bundle also contains the README block and full Cargo.toml. Terminal progress is not the complete bundle. [SKIP] during preview means a selected candidate could not be attached; inspect its reason before proceeding.
3. Select less content or copy the bundle
To share only the Rust source, add an include filter. -i "src/**" keeps paths under src; -o review.onesource gives the result a deliberate name. Preview that selection before writing it.
onesource --no-config -i "src/**" --dry-runExpect only src/main.rs as an attached candidate, with Files Processed: 1. Now write it:
onesource --no-config -i "src/**" -o review.onesourceFor a clipboard workflow, use the same selection with --copy. It sends the complete bundle to the desktop clipboard instead of creating an output file. Paste into a text editor first to inspect it; then paste into your intended destination.
onesource --no-config -i "src/**" --copyExpect Output copied to clipboard successfully!. This step does not update review.onesource. If clipboard access fails in SSH or a headless session, use the file command above. Learn selection rules in Filtering and saved settings in Profiles.