Skip to content

feat: global --dry-run and restore command (#15, #16)#25

Merged
renezander030 merged 1 commit into
masterfrom
feat/dry-run-and-restore
Jun 3, 2026
Merged

feat: global --dry-run and restore command (#15, #16)#25
renezander030 merged 1 commit into
masterfrom
feat/dry-run-and-restore

Conversation

@renezander030
Copy link
Copy Markdown
Owner

Closes #15. Closes #16.

#15 — global --dry-run

Every draft-mutating command now honors --dry-run. Gated at the single write choke point (saveDraft), so all ~35 write commands are covered at once: the on-disk write and the .bak snapshot are skipped, while out() stamps the JSON result with "dryRun":true so agents/scripts can distinguish a preview from a commit. translate / export --batch keep their existing dry-run behavior (they write through their own paths, not saveDraft).

$ capcut speed ./project a1b2c3 2.0 --dry-run
{"ok":true,"id":"a1b2c3...","old_speed":1,"new_speed":2,"dryRun":true}   # nothing written

#16restore

capcut restore <project> copies <draft>.bak back over the draft to undo the last write. Single-step (one backup generation kept); dies with a clear message when no .bak exists; honors --dry-run.

Tests & docs

  • test/dry-run.test.mjs + test/restore.test.mjs — 5 tests covering: byte-identical draft after dry-run, no .bak in dry-run, real write still mutates, restore round-trip, no-.bak exits non-zero, dry-run restore is a no-op.
  • Full suite 129/129 green via the pre-commit hook (build + tests).
  • README (Dry-run output mode, Edit section, Troubleshooting) + CHANGELOG updated.

#17 (prune) is intentionally left for a follow-up — see its scoping comment.

🤖 Generated with Claude Code

#15 — every draft-mutating command now honors --dry-run. Gated in
saveDraft (the single write choke point), so all ~35 write commands are
covered at once: the on-disk write and the .bak snapshot are skipped,
while out() stamps the JSON result with "dryRun":true so callers can
tell a preview from a commit. translate / export --batch keep their own
dry-run paths.

#16 — `capcut restore <project>` copies <draft>.bak back over the draft
to undo the last write. Single-step (one backup generation kept); dies
with a clear message when no .bak exists; honors --dry-run.

Adds test/dry-run.test.mjs and test/restore.test.mjs (5 tests). README
+ CHANGELOG updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@renezander030 renezander030 merged commit 2253fea into master Jun 3, 2026
4 checks passed
@renezander030 renezander030 deleted the feat/dry-run-and-restore branch June 3, 2026 14:08
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.

Add a 'restore' command to undo the last write (.bak) Honor --dry-run on all draft-mutating commands

1 participant