Repository navigation
fix(setup): never delete or overwrite an existing project without --overwrite - #2
Merged
Merged
Conversation
…hout --overwrite setup_project.py <folder> ran shutil.rmtree on <folder>/assets, <folder>/dashboard and <folder>/.agents whenever they existed, and copy2-overwrote AGENTS.md, LICENSE, .gitignore and the status file, with no prompt. Reproduced on throw-away trees: pointing it at an existing app that has an assets/ folder and its own .gitignore deleted assets/precious.png and replaced the .gitignore. Pointing it at the framework checkout itself deleted the sources it was about to copy. Now it lists every conflicting path and exits 2 without touching anything unless --overwrite is given, and refuses a target that is, or lies inside, the framework checkout, or that is an existing file. Fresh folders behave as before. bootstrap_new_project() returns True/False and main(argv) exposes the exit codes (1 usage, 2 refused). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner
|
Thanks @KiloMusician for the thorough audit, security proposals, and the extensive test harness! We have already merged PR #2. Regarding PR #1
Thanks again for your contribution!" |
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
python setup_project.py <folder>runsshutil.rmtreeon<folder>/assets,<folder>/dashboardand<folder>/.agentswhenever they exist, and overwritesAGENTS.md,LICENSE,.gitignoreand the status file, without asking. On throw-away trees I reproduced:assets/folder and its own.gitignoredeletedassets/precious.pngand replaced the.gitignore;Change
--overwriteis given.bootstrap_new_project()now returnsTrue/Falseandmain(argv)exposes the exit codes so they can be tested.Two files change:
setup_project.pyand a newtests/test_setup_project.py(8 tests, standard-libraryunittest, temp directories only).Verification
python -I -m unittest discover -s testson head0aa8949:ci.ymlpins), no networkThe new tests fail on the previous
setup_project.py(4 failures and 9 errors when run againstd9e2c27).Not verified
Only temp directories were used; nothing was run against a real project. Anyone who relied on the old silent overwrite now needs to pass
--overwrite.Prepared with AI coding assistants (OpenAI GPT and Anthropic Claude) on behalf of @KiloMusician, who submits it. Commands and counts above were run on the head named. MIT licence and notices untouched.