Commit 04c71b7
fix(setup): don't re-copy examples on setup re-runs
User report: `example-source.md` was being copied back into the
workspace every time `thesis setup` ran. That meant a user who
deleted the example on purpose had it restored uninvited.
Root cause: Step 5 (Copy examples) treated every invocation as a
first run. Non-interactive / quickstart modes auto-copied; the
interactive prompt defaulted to Yes; the `_copy_examples` helper
silently skipped existing files (so the re-copy only created files
the user had since deleted, which is exactly the surprise they
reported).
Changes
- setup() now captures `first_run = not .env.exists()` at entry.
- Step 5 branching:
* `--skip-examples` → always skip
* `--with-examples` → always copy (new flag; explicit opt-in
for re-runs)
* `--overwrite-examples` → now implies copy too, so the flag
isn't a silent no-op on re-runs
* non-interactive / quickstart on a re-run → skip with a clear
message naming the escape hatch
* interactive on a re-run → prompt defaults to No and the
wording says why ("you've run setup
before; default is No so deleted
examples don't come back")
* first run everywhere → behaves as before (copy by default)
Tests (1 new, 1 rewritten; 271 total passing)
- test_second_run_skips_examples_by_default: locks in that
a re-run without flags neither copies nor re-creates deleted
examples, and the output names `--with-examples`.
- test_second_run_with_examples_flag_copies_and_reports_already_present:
explicit opt-in path still works.
- Regression smoke verified manually: deleted
research/raw/example-source.md, re-ran `thesis setup`, file
stayed gone.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8579eff commit 04c71b7
2 files changed
Lines changed: 46 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
226 | 230 | | |
227 | 231 | | |
228 | 232 | | |
| |||
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
247 | 255 | | |
248 | 256 | | |
249 | 257 | | |
| |||
348 | 356 | | |
349 | 357 | | |
350 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
351 | 364 | | |
352 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
353 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
354 | 381 | | |
355 | 382 | | |
356 | 383 | | |
357 | | - | |
358 | | - | |
| 384 | + | |
| 385 | + | |
359 | 386 | | |
360 | 387 | | |
361 | 388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
105 | 119 | | |
106 | | - | |
107 | 120 | | |
108 | | - | |
109 | 121 | | |
110 | 122 | | |
111 | 123 | | |
| |||
0 commit comments