feat(init): add --dry-run flag to preview changes without writing#1032
Open
hed0rah wants to merge 2 commits intortk-ai:developfrom
Open
feat(init): add --dry-run flag to preview changes without writing#1032hed0rah wants to merge 2 commits intortk-ai:developfrom
hed0rah wants to merge 2 commits intortk-ai:developfrom
Conversation
Adds `--dry-run` to `rtk init` and all sub-modes (default, hook-only, claude-md, codex, cline, windsurf, gemini, copilot, opencode). When `--dry-run` is passed: - No files are created, updated, or patched - Each would-be write prints: `[dry-run] would create/update <abs-path>` - Files already up to date still report their absolute path - Combined with `-v` / `--verbose`: prints the full content that would be written, including for already-present files Examples: rtk init -g --dry-run # preview global install, no side effects rtk init --agent cline --dry-run -v # preview + show full content
…n. footer
In dry-run mode, all final success/confirmation messages ("hook installed",
"Restart X. Test with: git status", "Cascade will now use rtk...") were
printing unconditionally after write-guarded blocks, making the output look
like changes were actually applied.
Gate all per-mode success blocks behind `if !dry_run`. Add a consistent
`[dry-run] Nothing written.` footer to every init sub-mode so users have
unambiguous confirmation that no filesystem changes occurred.
Affected modes: claude-code, hook-only, claude-md, cline, windsurf,
opencode, gemini.
Author
|
suppressed misleading success messages like "Gemini CLI hook installed (global)." and "Restart Gemini CLI. Test with: git status" that were printing even in dry-run, and printed: [dry-run] Nothing written. instead |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--dry-runtortk initso users can preview exactly what files would be created or modified before committing to a global install[dry-run] would write: <abs_path>instead of touching the filesystem--verbose(-v) to also print the full file contents that would be written, making it useful for auditing or CI validationTest plan
rtk init -g --dry-run— prints paths, no files created, verify withrtk init --showstill showing "not installed"rtk init -g --dry-run -v— same as above but also prints file contents inlinertk init -gthenrtk init -g --dry-run— "already up to date" shown for existing files instead of silently skippingrtk init --agent cline --dry-run— shows abs path to.clinerulesin current dirrtk init --agent windsurf --dry-run— same for.windsurfrulesrtk init -g --gemini --dry-run— shows hook file + settings.json patch--dry-run