Skip to content

Add sync-timelines: repair stale CapCut >=8.7 timeline mirror (implements fix for #35) #39

Description

@renezander030

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.tsmodernStorage detection (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 (see relink as a model for a repair-style verb).
  • src/command-specs.ts — register the new command spec.

Proposed approach

  1. Detect the desync: load all readable storage targets, compare the timeline that the app will actually read (mirror) against draft_content.json.
  2. Reconcile: write the canonical edited timeline back into every mirror target the app reads, including draft_info.json GUID reconciliation for the pre-open mirror case.
  3. Refuse to run while the editor is open (reuse the existing editorProcesses() guard in src/draft.ts), with --force-write to override.
  4. Keep it read-only-safe by default: print a diff/plan, apply on confirmation or --apply.

Acceptance criteria

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions