Repository navigation
Description
What
Add a sync-timelines command that repairs a stale CapCut/JianYing timeline mirror, so edits made by the CLI are actually honored by the app on CapCut >= 8.7.
This is the implementation task for the bug already reported in #35. That issue documents the symptom; this one scopes the fix and is a good pickup for a contributor.
Why it matters
On CapCut >= 8.7 (seen on Windows) the app drives the timeline from template-2.tmp / draft_info.json, not draft_content.json. The CLI writes draft_content.json correctly, but the app renders from the mirror, so the edit is silently ignored. That is a data-loss-class failure: the user sees no error and no effect.
doctor already detects the condition. In src/store.ts it emits:
CapCut >= 8.7 detected without a readable template-2.tmp timeline; attach this report to issue #35.
So we detect it but have no repair path. This is the tool's last known version-compatibility gap.
Where in the code
src/store.ts—modernStoragedetection (atLeast(version, "8.7")),STANDARD_FILES(draft_content.json,draft_info.json,draft_meta_info.json,template-2.tmp), and the storage-target ordering. This is the surface the new command builds on.src/index.ts— command dispatch + help text (seerelinkas a model for a repair-style verb).src/command-specs.ts— register the new command spec.
Proposed approach
- Detect the desync: load all readable storage targets, compare the timeline that the app will actually read (mirror) against
draft_content.json. - Reconcile: write the canonical edited timeline back into every mirror target the app reads, including
draft_info.jsonGUID reconciliation for the pre-open mirror case. - Refuse to run while the editor is open (reuse the existing
editorProcesses()guard insrc/draft.ts), with--force-writeto override. - Keep it read-only-safe by default: print a diff/plan, apply on confirmation or
--apply.
Acceptance criteria
-
capcut sync-timelines <project>reconciles a draft whosetemplate-2.tmp/draft_info.jsonmirror has drifted fromdraft_content.json. - After running, an edit made via the CLI is visible when the project is opened in CapCut >= 8.7.
- No-op (exit 0, clear message) when targets already agree.
- Refuses to write while the editor is running unless
--force-write. - Fixture-backed test covering the drifted-mirror case.
-
doctorpoints tosync-timelinesas the remedy instead of deferring to add-video/edit changes ignored by CapCut 8.7 (Windows): timeline may be driven by template-2.tmp + draft_meta_info.json, not draft_content.json #35.
Prior art
The Davidb-2107/capcut-cli fork already ships a sync-timelines command plus draft_info.json GUID reconciliation — a good reference for the reconcile logic. See #36 for the upstreaming context.
Related: #33 (root_meta_info registration), #34 (ffprobe dimension detection). See docs/version-support.md.
Activity
renezander030 commentedon Jul 8, 2026
Shipped in v0.13.0 —
sync-timelines <project-dir> [--apply] [--force-write]reconciles drifted CapCut ≥8.7 timeline mirrors: plan-first, canonicaldraft_content.jsontreated read-only, and an mtime direction guard that refuses to overwrite newer app edits without--force-write. https://github.com/renezander030/capcut-cli/releases/tag/v0.13.0