fix: ensure installed files are owner-writable regardless of source permissions
Description
shutil.copy2 and shutil.copytree (which uses copy2 by default) propagate permission bits from source to destination. When the source lives on a read-only filesystem — the Nix store, any read-only mount, or a permission-restricted directory — installed files land at 0o444 and directories at 0o555. Any subsequent write to .specify/ (re-running specify init, upgrading, editing installed config) then fails with PermissionError.
An install operation should produce owner-writable destinations. The installed file's mtime should also reflect when it was installed, not when the bundled asset was built — so the copy2 → copyfile change is correct on both counts.
I encountered this problem attempting to package spec-kit on NixOS. The repository gets added read-only to the Nix store. specify assumes it can write to the files it creates, but the copy utilities preserve the read-only permissions resulting in an error.
Testing
- [x] Tested locally with
uv run specify --help - [ ] Ran existing tests with
uv sync && uv run pytest - [x] Tested with a sample project (if applicable)
AI Disclosure
- [ ] I did not use AI assistance for this contribution
- [x] I did use AI assistance (describe below)
Fix devised and generated by Claude Opus 4.6
Please address Copilot feedback and rebase on upstream/main
Please address Copilot feedback and rebase on upstream/main