rtb regenerate¶
Reconcile a scaffolded tree with .rtb/manifest.yaml. Two kinds:
manifest rebuilds the hash map from what is on disk; project
re-renders the preset and writes back.
rtb regenerate manifest¶
Re-hash every file the manifest claims to own, drop entries whose files
have vanished, and rewrite .rtb/manifest.yaml.
| Argument | Type | Default | Notes |
|---|---|---|---|
-p, --path <PATH> |
path | cwd | Project root. |
--dry-run |
flag | off | Print the new manifest as YAML to stdout; write nothing. |
protected: entries pointing at files that no longer exist are dropped
along with the generated: entries, and the count is reported in
parentheses. Use this after a hand edit, a hand port, or a merge that
moved files — it makes regenerate project stop treating an intentional
edit as drift.
rtb regenerate project¶
Re-render the recorded preset with the recorded field values, then decide per file whether to write.
| Argument | Type | Default | Notes |
|---|---|---|---|
-p, --path <PATH> |
path | cwd | Project root. |
--overwrite <POLICY> |
enum | ask |
deny, ask or allow. Aliases: show = deny, prompt = ask, force = allow. |
--force |
flag | off | Equivalent to --overwrite allow. Wins over an explicit --overwrite. |
--dry-run |
flag | off | Write nothing. |
--non-interactive |
flag | off | Currently has no effect — nothing in this command prompts. |
--update-docs |
flag | off | Parsed and ignored. See what RTB does not do. |
How each file is classified¶
For every entry in the manifest's generated: map that the preset still
renders, rtb compares three hashes: the freshly rendered bytes, the
bytes on disk, and the hash the manifest recorded at the last write.
| Classification | Meaning |
|---|---|
| protected | The path is in protected:. Always skipped, whatever the policy. |
| user-edited | On-disk hash differs from the recorded hash — you changed the file. |
| stale | The freshly rendered bytes differ from the recorded hash — the template changed. |
| unchanged | Neither. Skipped silently. |
What each policy does¶
--overwrite |
User-edited file | Stale but untouched file |
|---|---|---|
deny |
Skipped, listed as edited: |
Skipped, counted as "stale (diff only)" |
ask (default) |
Skipped, listed as edited: |
Overwritten |
allow |
Overwritten | Overwritten |
Despite the name, ask never prompts — the interactive per-file prompt
is not implemented, and ask behaves as "refuse to clobber my edits,
refresh everything else". That is also why --non-interactive changes
nothing.
The summary line names the outcome for every file:
$ rtb regenerate project
Wrote 0 files; 0 protected skipped; 1 edited skipped; 0 stale (diff only)
edited: README.md
No diff is ever printed, under any policy — only the file names. The "diff only" wording in the summary counts files, it does not display their contents.
What marker splicing preserves¶
Before comparing, rtb copies the interior of every
// rtb:<id>-begin / // rtb:<id>-end region from the file on disk into
the freshly rendered template. Everything outside the markers comes from
the new template, everything inside comes from your tree. This is what
stops a regeneration wiping the command registrations and settings that
generate command and generate setting wrote, since the base preset
ships those regions empty.
Leading whitespace before a marker is tolerated, so indented markers — like the settings region inside a struct body — splice correctly.
What regeneration does not touch¶
Only files the preset itself renders are considered. Files created by
generate command (for example src/commands/greet.rs) are in the
manifest but are not preset outputs, so they are silently skipped: they
are never refreshed, and never reported as drift. Deleting a file the
preset no longer ships is also out of scope — the stale manifest entry is
skipped rather than cleaned up. Run regenerate manifest for that.
--dry-run reports nothing it would have written¶
Under --dry-run the write counter is only incremented on a real write,
and files chosen for overwrite are not added to any of the skip lists, so
they appear in no column:
$ rtb regenerate project --force --dry-run
Wrote 0 files; 0 protected skipped; 0 edited skipped; 0 stale (diff only)
The same tree without --dry-run overwrites README.md. Treat
--dry-run on this kind as "make no changes", not as a preview.
Related¶
.rtb/manifest.yaml— the hashes and theprotected:list this command reads.- Presets and markers — which marker region governs which edit.