Output and statistics

Choose an output path or clipboard, inspect a bundle, and interpret file counts and token estimates.

Choose a delivery method

Use file output when you want to inspect, archive or share a reproducible artifact. Use clipboard output when you will paste immediately. Preview first in either case. This page uses a new demo folder so output paths and file counts are predictable:

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: # Demo
  • src/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. Choose and verify the output path

Inside demo, preview a specifically named bundle:

Command
onesource --no-config -o review.onesource --dry-run

Expect the planned path to end in demo/review.onesource and three processed files. No bundle is written. Remove dry-run to create that exact path:

Command
onesource --no-config -o review.onesource

Confirm Output saved to: and open review.onesource in your editor. Omitting -o would use demo.onesource in the working directory. The output location does not automatically follow the scan root. To see this, move to demo’s parent and explicitly place the result inside demo:

Command
cd ..
onesource demo --no-config -o demo/review.onesource --dry-run

Here the positional demo selects the scan root; -o is relative to the parent working directory. The existing review.onesource is excluded as the current output. Without -o, default demo.onesource would be written in the parent. Return before continuing:

Command
cd demo

For a separate output folder, create it before bundling:

Command
mkdir bundles
onesource --no-config -i "src/**" -o bundles/source.onesource

Expect one file block in bundles/source.onesource. OneSource does not create output parent directories. The extension is your choice; it does not select a different format. Repeating file output replaces the chosen existing file after successful rendering, without a confirmation prompt. A failed render preserves the previous output, but a configuration saved before scanning is not rolled back.

Default: canonical scan-root folder name plus .onesource (fallback project.onesource), written in the working directory. -o overrides it; no extension is enforced. Parent directories are not created. The current output is excluded even when blacklist is disabled. File mode renders into a unique temporary file beside output, flushes and syncs it, then replaces output. Render failure preserves previous output. On Windows replacement temporarily renames existing output to a backup and attempts restoration if rename fails. Config saves are separate and not rolled back.

2. Read the bundle rather than terminal progress

Open review.onesource from the previous step. First locate the project tree, then search for file paths. Here is the source block you should find; the rest of the bundle includes Cargo.toml and README.md:

Expected output / excerpt
<file path="src/main.rs">
fn main() {}
</file>

The path is relative to the scan root, making it easy to find the original file. The text between the tags is the attached content. Review that content before sharing. stdout contains the tree, progress and counts, not the full bundle; redirecting stdout does not replace opening the generated file.

Expected output / excerpt
my-project/
└── src/
    └── main.rs
<file path="src/main.rs">
fn main() {}
</file>

UTF-8 text, with optional tree followed by file blocks using relative paths. Path attributes escape &, <, >, quotes and apostrophes. File contents are inserted verbatim except lossy UTF-8 conversion; closing tags in contents are not escaped. This is a text convention, not a guaranteed valid XML document. Existing trailing newlines are kept and another newline is added before the closing tag.

3. Copy intentionally and understand dry-run/save

To paste source directly, preview a source-only selection, then copy it:

Command
onesource --no-config -i "src/**" --dry-run

Expect only src/main.rs. Now send the same bundle to the clipboard:

Command
onesource --no-config -i "src/**" --copy

Expect Output copied to clipboard successfully!. Paste into a text editor and verify the file block. No output file is created or updated. --copy requires a working desktop clipboard; if unavailable, use -o source.onesource instead.

If dry-run and copy are both present, preview wins:

Command
onesource --no-config -i "src/**" --dry-run --copy

Expect NO COPY WAS MADE WHILE DRY RUN; the clipboard remains untouched. Saving configuration is different:

Command
onesource --no-config -i "src/**" --dry-run --save

This creates or merges default in .onesourcerc even though no bundle is written. Open that config to confirm include="src/**". dry-run suppresses bundle and clipboard output, not --save. Use previews without --save while experimenting. For all four combinations, -o still determines the current-output exclusion, even if no file is written.

Copy mode buffers the complete output in memory. For large bundles prefer file mode; reduce selection before copying. The Profiles tutorial explains which settings --save preserves.

4. Interpret counts and tune a content budget

Run a full preview in the original demo root:

Command
onesource --no-config --dry-run

Expected output / excerpt
Files Processed: 3
Files Skipped: 0
Estimated Output Tokens: ...

Generated .onesource files and .onesourcerc are blacklisted, so they do not inflate this count. Processed means attached files, not tree entries. Skipped zero does not mean nothing was filtered out: glob/ignore/blacklist exclusions are not counted there. Numbers shown as ... here are variable, not literal output.

For a recipient with limited context, first reduce files with include/exclude, then rerun the preview and compare estimated output tokens. -m limits each file, not total tokens. For example:

Command
onesource --no-config -i "src/**" -m 1 --dry-run

The sample main.rs is below 1024 bytes, so it remains included. A file of exactly 1024 bytes is allowed; 1025 bytes is skipped. To investigate a size skip, run explain with the same -m and read the actual-byte Rule.

Files Processed counts successfully read attached files. Files Skipped counts inspection failures plus content/tree walk errors; it is not the number excluded by glob, ignore or blacklist and may count traversal errors from both walks. Per-file messages report content tokens only. Estimated Output Tokens uses cl100k_base on separately written tree, opening tag, content and closing fragments; it includes wrappers but can differ from tokenizing the final concatenated text and from your model tokenizer. Dry-run uses the same rendering estimate. No exact context-limit guarantee is provided.