Skip to content

feat: support in-place scaffolding for create . command - #2419

Open
sachin-duhan wants to merge 2 commits into
BuilderIO:mainfrom
sachin-duhan:main
Open

feat: support in-place scaffolding for create . command#2419
sachin-duhan wants to merge 2 commits into
BuilderIO:mainfrom
sachin-duhan:main

Conversation

@sachin-duhan

Copy link
Copy Markdown

resolves #2418

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Visual recap — skipped

The visual recap job did not run for this pull request. This is informational only and does not block the PR.

Recap skipped for 071380c: external fork PR requires a maintainer to apply the recap label to the current head SHA.

@steve8708

Copy link
Copy Markdown
Contributor

Thanks for the contribution @sachin-duhan!

I walked through the in-place path and think we should tighten the safety boundary before merging:

  • resolveScaffoldTarget() allows .git and other existing files, but both failure paths still call cleanupOnFailure(targetDir). For in-place scaffolding, targetDir is process.cwd(), so a scaffold error could recursively delete the current directory, including .git.
  • The allowlisted files aren’t actually protected: copyDir() overwrites existing files, and renameGitignore() can replace an existing .gitignore.
  • tryGitInit(targetDir) will also initialize, stage, and commit when .git already existed, which could create an unexpected commit in the user’s repository.

I’d suggest staging into a temporary directory, copying only new files into the current directory after success, and cleaning up only the staging directory on failure. We should also detect pre-existing Git metadata and skip init/commit in that case.

Could we add tests covering preservation of .git, README.md, and .gitignore, unchanged Git history, and cleanup after an injected scaffold failure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid name ".". Use lowercase letters, numbers, and hyphens (must start with a letter).

2 participants