Repository navigation
Conversation
`vp create` refused any target directory holding more than `.git`, so it could not add a project to an existing repository. `--force` (and a "Keep existing files and continue" choice in the interactive prompt) now scaffolds into a staging directory inside the target and moves over only the files that are not already there. Template files that would replace an existing file are skipped and listed. Staging is needed because create-vite and degit run their own emptiness checks, and the bundled templates copy with overwrite. Refs voidzero-dev#2521 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31f2b52c68
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (result.exitCode !== 0 || !result.projectDir) { | ||
| return result; | ||
| } | ||
| const kept = moveDirKeepingExisting(stagingPath, path.join(workspaceInfo.rootDir, dir)); |
There was a problem hiding this comment.
Finish setup before merging into the preserved tree
When --force targets a directory that already contains a project (for example, package.json plus eslint.config.js), this merge exposes the pre-existing files to the rest of the normal create pipeline: detectEslintProject(fullPath) then triggers promptEslintMigration(..., false), which deletes ESLint configs/dependencies, and rewriteStandaloneProject and vp fmt subsequently rewrite the existing package and source tree. Files reported as kept can therefore still be destructively changed without a prompt; perform the generated-project setup in staging, or otherwise exclude all pre-existing paths, before merging.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid, fixed in 5850315 with a narrower change than moving the whole setup into staging:
- A target that already has a
package.jsonis now refused with--force, and the interactive prompt no longer offers "Keep existing files" for it. That is the case where the ESLint/Prettier migration and thepackage.jsonrewrite would run against the existing project. - The entries that were in the directory before scaffolding are excluded from the final
vp fmt, so kept files are not reformatted. The snapshot case now keeps an unformattedREADME.mdand a file in an existing subdirectory to cover this.
Still additive on existing files: .gitignore entries after git init, and agent/editor config writes, which already have their own handling for existing files.
The setup steps that run after scaffolding still saw the files that were already in the target directory. Refuse a target that already has a package.json, since those steps would rewrite it, and exclude the pre-existing entries from the final format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #2521
Problem
vp createrefuses any target directory that holds more than.git, so it cannot add a project to an existing repository (a repo with aREADME.md, aLICENSE, or even just a.DS_Store). The only interactive choices are "Cancel" and "Remove existing files".Change
--forceflag: scaffold into a non-empty directory and keep the files already there.Without
--force, non-interactive runs still fail, and the hint now mentions the flag.How
When existing files must be kept, the template is scaffolded into a staging directory inside the target (
.vite-plus-create-<random>), then moved over entry by entry; directories that exist on both sides are merged, and the staging directory is removed afterwards.Staging is needed because widening the ignore list in the emptiness check is not enough:
create-viteand degit run their own emptiness checks (create-vite --overwriteempties the directory), and the bundled/monorepo templates copy with overwrite, which would replace an existingREADME.mdor.gitignore.It applies to builtin and bundled
@orgtemplates, the same set that supports--directory. Remote templates are unchanged and reject--force.Open question
On a collision this keeps the existing file. The issue suggested overwriting instead; I went with keeping because it cannot lose user work, but I am happy to switch, or to rename the flag if
--forcereads as "overwrite".Tests
create_force_keeps_existing_files;command_create_helpupdated.create*snapshot cases locally. Two bun cases failed in the parallel run and passed when re-run on their own.🤖 Generated with Claude Code