fix(cli): implement --force flag to protect existing skill files#324
Merged
mrgoonie merged 1 commit intoJun 21, 2026
Merged
Conversation
The --force option was accepted by Commander but ignored: writeFile() always overwrote existing files silently. Users expecting protection against accidental overwrites had no way to preserve existing configs. - generatePlatformFiles: check file existence before writing; skip with a clear message when file exists and force=false - generateAllPlatformFiles / templateInstall: propagate force parameter - initCommand: pass options.force through to templateInstall Behavior change: uipro init --ai claude → skips if SKILL.md already exists uipro init --ai claude --force → overwrites regardless Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mrgoonie
approved these changes
Jun 21, 2026
mrgoonie
left a comment
Contributor
There was a problem hiding this comment.
Summary: This is a focused fix for the advertised --force behavior in the template installer path. It correctly threads the force option through init -> templateInstall -> generatePlatformFiles and prevents accidental overwrite of an existing generated skill file when --force is absent.
Risk level: Low
Mandatory gates:
- Duplicate/prior implementation: clear — searched existing issues/PRs for the force/overwrite behavior and found no overlapping implementation besides this PR.
- Project standards: passed — the change stays inside the CLI init/template generation path and reuses the existing fs access helper pattern.
- Strategic necessity: clear value — avoiding silent overwrites protects user-customized skill files and makes the documented --force flag meaningful.
- CI/checks: missing/unstable — no status checks are reported for this PR in GitHub, and this cron environment does not have bun installed to run the package build.
Findings:
- Critical: none.
- Important: none.
- Suggestion: consider adding a small CLI/template unit or smoke test later for the no-force skip path and the --force overwrite path, because this behavior is easy to regress.
Verdict: APPROVE
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.
Problem
--forceis registered inindex.tsand described in the README, but has no effect.template.tscallswriteFile()unconditionally without checking whether the file already exists.This means:
uipro inita second time silently overwrite their customized skill files--forceflag advertised in the README is misleading — it does nothingFix
Add a file existence check in
generatePlatformFilesbefore callingwriteFile:--forcewas not passed → skip with a clear message--forcewas passed → overwrite (previous behavior for all cases)forcethroughgenerateAllPlatformFiles→templateInstall→initCommandBehavior after this PR
🤖 Generated with Claude Code