Summary
--dry-run is currently honored only by translate and export --batch. Every other draft-mutating command (add-text, cut, apply-template, speed, volume, trim, shift, keyframe, ...) ignores it and writes to disk. A global --dry-run that computes the change and prints the normal JSON result without writing would make the CLI safe to explore and much friendlier for LLM/agent callers (preview, then commit).
What to do
- Make
--dry-run (already parsed into flags.dryRun) suppress the on-disk write for every command that mutates a draft, while still emitting the usual JSON result so callers see what would change.
- Cleanest path: gate the write in
saveDraft() — all write commands funnel through it (34 call sites). Thread the dry-run state in (a module-level flag set from flags.dryRun, or an explicit option) and skip both the writeFileSync and the .bak write when set.
- Add
--dry-run to the global-flags block in the HELP constant.
Acceptance
capcut speed <project> <id> 2 --dry-run (and the other write commands) print the same JSON result as a real run but leave the file and its .bak untouched.
- Existing
translate / export --batch dry-run behavior is unchanged.
- A test under
test/ asserting the draft file is byte-identical after a --dry-run write.
- Documented in
README.md / docs/.
Pointers (verified against master)
- The flag is already parsed:
parseFlags() sets flags.dryRun on --dry-run (src/index.ts).
- All writes go through
saveDraft(filePath, draft) in src/draft.ts (34 call sites in src/index.ts); it also writes ${filePath}.bak.
out(data, flags) is the JSON emitter — keep emitting in dry-run mode.
- Zero runtime dependencies (Node >= 18).
Summary
--dry-runis currently honored only bytranslateandexport --batch. Every other draft-mutating command (add-text,cut,apply-template,speed,volume,trim,shift,keyframe, ...) ignores it and writes to disk. A global--dry-runthat computes the change and prints the normal JSON result without writing would make the CLI safe to explore and much friendlier for LLM/agent callers (preview, then commit).What to do
--dry-run(already parsed intoflags.dryRun) suppress the on-disk write for every command that mutates a draft, while still emitting the usual JSON result so callers see what would change.saveDraft()— all write commands funnel through it (34 call sites). Thread the dry-run state in (a module-level flag set fromflags.dryRun, or an explicit option) and skip both thewriteFileSyncand the.bakwrite when set.--dry-runto the global-flags block in theHELPconstant.Acceptance
capcut speed <project> <id> 2 --dry-run(and the other write commands) print the same JSON result as a real run but leave the file and its.bakuntouched.translate/export --batchdry-run behavior is unchanged.test/asserting the draft file is byte-identical after a--dry-runwrite.README.md/docs/.Pointers (verified against
master)parseFlags()setsflags.dryRunon--dry-run(src/index.ts).saveDraft(filePath, draft)insrc/draft.ts(34 call sites insrc/index.ts); it also writes${filePath}.bak.out(data, flags)is the JSON emitter — keep emitting in dry-run mode.