fablecut 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md CHANGED
@@ -21,7 +21,7 @@ Every Claude Code session then has these tools:
21
21
  - `fablecut_get_project` / `fablecut_set_project` — read / replace the timeline JSON.
22
22
  `fablecut_get_project {compact:true}` returns a one-line-per-clip summary instead.
23
23
  - `fablecut_patch_project` — apply targeted ops (add/update/remove clip/media,
24
- set project fields) without round-tripping the document. **Prefer this for edits.**
24
+ set project fields, add and open sequences) without round-tripping the document. **Prefer this for edits.**
25
25
  - `fablecut_import_media` — copy a local file (or download an `https://` URL)
26
26
  into `./media/` and register it. The stored `src` is always `/media/…`.
27
27
  - `fablecut_analyze_reference` — turn a reference video into an edit blueprint
@@ -54,6 +54,11 @@ Every Claude Code session then has these tools:
54
54
  - `fablecut_proxy` — make, check or delete proxies: light copies of heavy footage
55
55
  the editor plays while editing (export always reads the originals). See
56
56
  "Media management" below.
57
+ - `fablecut_projects` — list, open, create (from a canvas or a saved template),
58
+ duplicate, rename, annotate, archive and delete projects. `./project.json` is
59
+ always the open one. See "Projects" below.
60
+ - `fablecut_versions` — a project's saved versions: save one before big edits, compare
61
+ a version with now, restore one (never destructive), mark the final cut. See "Versions" below.
57
62
 
58
63
  ### Token-efficient editing (important for agents)
59
64
 
@@ -138,9 +143,9 @@ then `/plugin install fablecut@fablecut`) does the registration for you.
138
143
 
139
144
  ### Where the files are
140
145
 
141
- `project.json`, `media/`, `exports/`, `analysis/` and `library/` normally sit in
146
+ `project.json`, `projects/`, `media/`, `exports/`, `analysis/` and `library/` normally sit in
142
147
  the repo next to `server.js`; installed from npm (`npx fablecut`) they sit in
143
- `~/FableCut`. Set **`FABLECUT_DATA_DIR`** to move all five
148
+ `~/FableCut`. Set **`FABLECUT_DATA_DIR`** to move all six
144
149
  somewhere else; the code and the static app files stay in the install directory
145
150
  either way. The plugin sets this so a plugin update can replace the install
146
151
  directory without touching anyone's timeline or footage. **Don't assume
@@ -292,11 +297,13 @@ Examples in `library/svg/`: `sparkles.svg` (loop), `lower-third.svg`,
292
297
  { "id": "A4", "kind": "audio" }
293
298
  ],
294
299
  "buses": [ { "id": "B1", "name": "Dialogue", "gain": -2, "fx": [ { "type": "compressor" } ] } ],
300
+ // ^ optional — submix buses B1…B8: name, gain (dB), pan, mute, fx; tracks route in with `out`
295
301
  "collections": [ { "id": "col_sel", "name": "Selects", "media": [ "m_abc" ] } ],
296
302
  // ^ optional — Project-bin collections: media grouped across folders; see "Media management"
297
303
  "comps": [ { "id": "lt", "name": "Lower third", "width": 1280, "height": 720, "duration": 5, "clips": [ /* … */ ] } ],
298
304
  // ^ optional — compositions (nested sequences), placed with kind:"comp" clips; see "Compositions (nested sequences)"
299
- // ^ optional — submix buses B1…B8: name, gain (dB), pan, mute, fx; tracks route in with `out`
305
+ "sequence": "main", "sequences": [ { "id": "main", "name": "Main" }, { "id": "seq_v9", "name": "Reel 9:16", "width": 1080, "height": 1920, "clips": [ /* … */ ] } ],
306
+ // ^ optional — several timelines in one project; the open one is this top level; see "Sequences"
300
307
  "media": [
301
308
  { "id": "m_abc", "name": "intro.mp4", "kind": "video", // video|audio|image|svg
302
309
  "src": "/media/intro.mp4", // path under ./media or ./library (never a raw https:// URL)
@@ -1509,6 +1516,209 @@ proxy only changes how smoothly the preview runs, never the result.
1509
1516
  be an existing file under `/media/` or `/library/` of the same kind (an
1510
1517
  audio entry may use a video container).
1511
1518
 
1519
+ ### Projects
1520
+
1521
+ One FableCut keeps any number of projects. **`./project.json` is always the
1522
+ open project**: the editor, every MCP tool, the REST API and scripts read and
1523
+ edit that file as before. The others wait in `projects/`, and opening one
1524
+ swaps it in:
1525
+
1526
+ | path | holds |
1527
+ |---|---|
1528
+ | `projects/index.json` | `{active}` — the open project's id |
1529
+ | `projects/<id>/meta.json` | `{id, created, opened, archived, notes, tags, template?}` |
1530
+ | `projects/<id>/project.json` | the document (while that project is open, `./project.json` is the live copy) |
1531
+ | `projects/<id>/thumb.jpg` | the editor's last picture of it |
1532
+ | `library/project-templates/<id>.json` | a saved project template `{name, created, project}` |
1533
+
1534
+ `media/`, `exports/`, `analysis/` and `library/` are shared by every project,
1535
+ so a duplicate or a project made from a template copies no footage. The first
1536
+ time projects are used, the existing `./project.json` becomes the first
1537
+ project, unchanged. Ids look like `p_3f9a01c2de`.
1538
+
1539
+ **Opening a project** saves the open one into its folder, then copies the
1540
+ chosen one to `./project.json` with a `revision` above both. A save based on
1541
+ the project that was open before (an editor tab, an agent's
1542
+ `fablecut_set_project`, a `baseRevision` patch) is therefore refused as a
1543
+ CONFLICT instead of landing in the wrong project. Editor tabs reload, clear
1544
+ their undo history and close an open composition. `GET /api/project` names the
1545
+ open project in the `X-FableCut-Project` header, and the editor sends it back on
1546
+ every save, so an edit made for one project can never be written into another.
1547
+
1548
+ In the editor: **Projects** in the top bar (**Ctrl/Cmd+O**, or a click on the
1549
+ project name) opens the dashboard: cards with a picture, size, frame rate and length; search
1550
+ by name, notes or `#tag`; sort by last opened, last modified, created or name.
1551
+ Pick one to rename it, write notes, tag it, **Open** (or double-click / **Enter** on its card), **Duplicate**, **Save as
1552
+ template** or **Archive** it. **Archived** lists archived projects, where
1553
+ **Unarchive** brings one back and **Delete…** (click twice) removes it; only
1554
+ archived projects can be deleted, and the open one can be neither archived
1555
+ nor deleted. **+ New project** starts one from a canvas (Landscape 16:9 1080p,
1556
+ Vertical 9:16, Square 1:1, Portrait 4:5, 4K UHD, Landscape 720p) or a saved
1557
+ template, with its own frame rate. **Import…** adds a project file from
1558
+ elsewhere (an old backup, another machine); its media must be in `media/`,
1559
+ and Relink finds files that moved.
1560
+
1561
+ **Agents** use `fablecut_projects` (or `GET /api/projects`, `POST /api/projects`):
1562
+
1563
+ - `{}` or `{action:"list", archived?:"only"|"all"}` lists them: id, name, size,
1564
+ length, clips, tags, notes, and which is `(OPEN)`.
1565
+ - `{action:"open", id}` switches the editor to that project; re-read it with
1566
+ `fablecut_get_project {compact:true}` before editing.
1567
+ - `{action:"new", name, template?, fps?, width?, height?, notes?, tags?, open?}` —
1568
+ `template` is `landscape-1080` (default), `vertical-1080`, `square-1080`,
1569
+ `portrait-1350`, `uhd-4k`, `landscape-720` or a saved template's id; it opens
1570
+ unless `open:false`.
1571
+ - `{action:"duplicate", id, name?, open?}` · `{action:"update", id, name?, notes?, tags?}` ·
1572
+ `{action:"archive" | "unarchive" | "delete", id}`.
1573
+ - `fablecut_status` also counts the open project's versions; see "Versions" for them.
1574
+ - `{action:"templates"}` · `{action:"save_template", id, name}` (the project's
1575
+ canvas, tracks, clips and media references) · `{action:"delete_template", template}`.
1576
+ - Opening, archiving or deleting changes what the user sees: do it only when
1577
+ they asked. `fablecut_status` says how many projects there are.
1578
+
1579
+ Recipes: **one edit, three versions** — `duplicate` the project per client
1580
+ cut, put the brief in `notes`; **house canvas** — build an empty project with
1581
+ your tracks, intro and outro, `save_template`, then `new` from it for every
1582
+ episode; **park finished work** — `archive` delivered projects to keep the
1583
+ list short without deleting anything.
1584
+
1585
+ ### Versions
1586
+
1587
+ Every edit is saved as it happens, and undo covers the session. **Versions** are
1588
+ what you come back to later: full copies of a project, kept beside it, that are
1589
+ never overwritten. Restoring one is not destructive either — what is there is
1590
+ saved as a version first, so a restore can be undone by restoring that.
1591
+
1592
+ | path | holds |
1593
+ |---|---|
1594
+ | `projects/<id>/history/v0007.json` | the project as it was |
1595
+ | `projects/<id>/history/v0007.meta.json` | `{v, name, note, kind, created, revision, clips, duration, final}` |
1596
+
1597
+ A version's `kind` says where it came from:
1598
+
1599
+ | kind | made |
1600
+ |---|---|
1601
+ | `manual` | by you (**Save version**, **Ctrl/Cmd+S**) or an agent (`fablecut_versions {action:"save"}`) |
1602
+ | `auto` | every 10 minutes while the open project changes, whoever changes it (`FABLECUT_AUTO_VERSION_MIN` sets the minutes); the newest 30 are kept |
1603
+ | `agent` | before an agent's first edit of a session (again after 10 quiet minutes), and before every `fablecut_set_project` rewrite |
1604
+ | `restore` | what was there just before a restore |
1605
+
1606
+ One version per project can be marked **final** (the cut that went out); a final
1607
+ version can't be deleted until it is unmarked. Manual, agent and restore
1608
+ versions are never pruned.
1609
+
1610
+ **Compare** tells what changed between a version and now (or two versions):
1611
+ clips added, removed and changed (timing, which props, keyframes, effects,
1612
+ transitions, source, track), media added and removed, the length, and project
1613
+ settings (name, canvas, frame rate, IN / OUT, tracks, markers, comps, mix,
1614
+ delivery, …).
1615
+
1616
+ **Backup and recovery.** **Download backup** saves a project with all its
1617
+ versions as one `.fablecut-backup.json` file; **Import…** in the dashboard brings
1618
+ it back, versions included. When `project.json` can't be read as the server
1619
+ starts (another tool crashed mid-write, a bad hand edit), the server keeps the
1620
+ broken file as `project.corrupt-<time>.json` and puts back the newest good copy:
1621
+ the latest version, or the project's last parked copy.
1622
+
1623
+ In the editor: **Ctrl/Cmd+S** saves a version of the open project. In the
1624
+ Projects dashboard, a project's **Versions…** lists its versions, newest first,
1625
+ with **Save version** (name and note), and per version **Compare with now**,
1626
+ **Restore…** (click twice), **Mark final**, **Rename**, **Download** and
1627
+ **Delete…** (click twice). Esc goes back to the projects.
1628
+
1629
+ **Agents** use `fablecut_versions` (or `GET` / `POST /api/versions`):
1630
+
1631
+ - `{}` lists the open project's versions (`project` picks another one).
1632
+ - `{action:"save", name?, note?, final?}` — **save one before a big or risky
1633
+ change** (a restructure, a remake, a new grade on every shot) and when the user
1634
+ is happy with a cut, so there is a named point to go back to.
1635
+ - `{action:"diff", version, to?}` — what changed since that version (to now, or
1636
+ to version `to`). Use it to tell the user what an edit session changed.
1637
+ - `{action:"restore", version}` — only when the user asked; then re-read the
1638
+ project. `{action:"update", version, name?, note?, final?}` ·
1639
+ `{action:"delete", version}`.
1640
+
1641
+ Recipes: **try a bold alternative** — save a version, make the change, compare,
1642
+ and restore if the user prefers the old one; **client rounds** — save "Round 1",
1643
+ "Round 2", … with the feedback in the note, mark the approved one final;
1644
+ **what did the agent do?** — `diff` against the "Before agent edits" version.
1645
+
1646
+ ### Sequences
1647
+
1648
+ A project can hold several **sequences**: timelines of their own that share
1649
+ the project's media, folders, collections and compositions. Typical uses: a
1650
+ 16:9 cut and a 9:16 cut of the same edit, a 30 s and a 15 s version, a client
1651
+ cut beside an alternative, or a stringout of selects next to the edit. A
1652
+ project with one sequence (every project, until you add one) is exactly the
1653
+ document described above.
1654
+
1655
+ **The open sequence is the document's top level.** `clips`, `tracks`,
1656
+ `markers`, `inPoint` / `outPoint`, the canvas (`width`, `height`, `fps`,
1657
+ `background`, `exportFrame`), the mix (`master`, `buses`), the track switches
1658
+ and the delivery settings (`delivery`, `outputs`, `encodeProfile`) are the open
1659
+ sequence's. Every tool, op, export and the compact view work on them, as
1660
+ always. The others wait in `sequences`, each with its own copy of those keys:
1661
+
1662
+ ```jsonc
1663
+ "sequence": "main", // the open one
1664
+ "sequences": [
1665
+ { "id": "main", "name": "Main" }, // the open one: its timeline is the top level
1666
+ { "id": "seq_v9", "name": "Reel 9:16", "width": 1080, "height": 1920, "fps": 30,
1667
+ "clips": [ /* … */ ], "tracks": [ /* … */ ], "markers": [ /* … */ ], "delivery": { "preset": "instagram-reels" } }
1668
+ ]
1669
+ ```
1670
+
1671
+ Opening another sequence parks the top-level keys in the open one's entry and
1672
+ brings the other's up, with a new `revision` — like any edit. A clip in a
1673
+ sequence that isn't open still counts: its media shows "used" in the bin,
1674
+ can't be removed while it is there (`removeMedia` and **Remove from project**
1675
+ refuse and name the sequence), and **Replace file…** trims it too; a comp it
1676
+ places can't be removed either. A project with one sequence named Main has
1677
+ neither key.
1678
+
1679
+ In the editor: the **sequence menu** at the left of the timeline toolbar (it
1680
+ shows the open sequence's name, and how many there are) lists them — click one
1681
+ to open it — and has **New sequence…** (a name, a canvas — the same as the open
1682
+ one, or 16:9, 9:16, 4:5, 1:1 — and, optionally, a copy of the open sequence's
1683
+ timeline to start from), **Duplicate**, **Rename…** and **Delete…** (click
1684
+ twice; the project is first kept as a version, so a deleted sequence can be
1685
+ restored from **Projects → Versions**). For the session each sequence keeps its
1686
+ own undo history, playhead and selection. The Export dialog, the Mixer, IN /
1687
+ OUT and the canvas settings all belong to the open sequence. **Find timeline
1688
+ instances** lists placements in other sequences too; clicking one opens its
1689
+ sequence.
1690
+
1691
+ **Agents** (`fablecut_patch_project`):
1692
+
1693
+ - `{op:"addSequence", name?, id?, from?, width?, height?, fps?, open?:true}` —
1694
+ `from:"empty"` (default; the open sequence's canvas and frame rate, no clips),
1695
+ `"open"` (a copy of the open sequence's timeline) or a sequence id (a copy of
1696
+ that one). `width` / `height` / `fps` change the copy's canvas: the clips keep
1697
+ their positions relative to the centre, and an `exportFrame` is dropped.
1698
+ - `{op:"inSequence", sequence, ops:[…]}` runs ops on a sequence **without
1699
+ opening it**: clip and timeline ops, `setProject` (its canvas, markers, IN /
1700
+ OUT, delivery), `setTrack`, `setBus`, `setFx` on its tracks, and
1701
+ `updateSequence` (name, index) — not `addSequence`, `openSequence`,
1702
+ `removeSequence` or another `inSequence`. The user's editor stays where it is.
1703
+ - `{op:"openSequence", id}` changes what the user's editor shows, and what
1704
+ `fablecut_export`, `fablecut_frame {time}` and `fablecut_scopes` render: do it
1705
+ when the user asked, or to export that sequence.
1706
+ - `{op:"updateSequence", id, set:{name?, index?}}` renames or reorders one;
1707
+ `{op:"removeSequence", id}` deletes one (only when asked; the last one stays,
1708
+ deleting the open one opens its neighbour, and one holding locked clips or
1709
+ tracks needs `force:true`).
1710
+ - The compact view and `fablecut_status` list every sequence (id, name,
1711
+ canvas, clips, length, which is open). A version's **Compare** reports each
1712
+ sequence's changes on its own, sequences added and removed, and which one
1713
+ was open.
1714
+
1715
+ Recipes: **vertical cut of a finished edit** — `addSequence {name:"Reel 9:16",
1716
+ from:"open", width:1080, height:1920}`, then `inSequence` ops to re-position
1717
+ or re-scale the shots and `setProject {delivery:"instagram-reels"}` in it;
1718
+ **cut-downs** — duplicate the edit as "30 s" and "15 s" and tighten each with
1719
+ the trim ops inside `inSequence`; **selects reel** — an empty sequence the
1720
+ user drops favourite takes on, cut into the edit from the Source monitor.
1721
+
1512
1722
  ### Semantics
1513
1723
 
1514
1724
  - Rendering order: V1 is drawn first, then V2, V3, … on top. SVG/image/text clips
@@ -1695,7 +1905,9 @@ obvious cuts were missed, raise it if motion is being misread as cuts.
1695
1905
  - `PUT /api/project` — replace project JSON (body = full document).
1696
1906
  **Conflict-safe**: if the body's `revision` ≤ the revision currently on disk,
1697
1907
  the server rejects with **409** and returns `{"error":"…","revision":<current>}`.
1698
- Append `?force=1` to overwrite unconditionally. Writes are atomic (tmp file +
1908
+ Append `?force=1` to overwrite unconditionally. A request with an `X-FableCut-Project`
1909
+ header (the editor sends the id of the project it loaded) is also refused with 409 when
1910
+ another project is open (see "Projects"). Writes are atomic (tmp file +
1699
1911
  rename), so a crashed write never corrupts the file.
1700
1912
  - `GET /api/media` — list files in ./media (name, src, size)
1701
1913
  - `GET /api/media-info?src=/media/x.mp4` → `{src, info}` · `POST /api/media-info {srcs:[…], stat?}` →
@@ -1715,6 +1927,22 @@ obvious cuts were missed, raise it if motion is being misread as cuts.
1715
1927
  `{candidates:{id:[{src, name, size, score, why}]}}` — where a missing file might be now:
1716
1928
  files under `media/` and `library/` (subfolders included) of the same kind, ranked by
1717
1929
  name (same name, same name with another extension, similar name) and size, best 5 each.
1930
+ - `GET /api/projects[?archived=only|all]` → `{active, projects:[{id, name, active, archived, notes, tags, created,
1931
+ opened, modified, width, height, fps, duration, clips, media, thumb}], templates:[…]}` ·
1932
+ `POST /api/projects {action, …}` — the actions of `fablecut_projects` (plus `import {project, name?}`).
1933
+ The answer depends on the action: `{id, project}` for open / new / duplicate / update / archive /
1934
+ unarchive / import (plus `from` when the open project changed, `already` when it was open), `{id, deleted}`
1935
+ for delete, `{templates}` for templates, `{template}` for save_template (the saved one) and
1936
+ `{template, deleted}` for delete_template · `GET` / `PUT /api/projects/thumb?id=`
1937
+ — a project's JPEG thumbnail (1 MB max). SSE event `projects` (`{action, id, active}`) after each
1938
+ change. See "Projects".
1939
+ - `GET /api/versions[?project=]` → `{project, versions:[{v, name, note, kind, created, revision, clips, duration,
1940
+ final}]}` (newest first; default the open project) · `POST /api/versions {action, project?, version?, …}` —
1941
+ `save {name?, note?, final?}` → `{project, version}` · `diff {version, to?}` → `{same, lines, added, removed,
1942
+ changed, mediaAdded, mediaRemoved, settings}` · `restore {version}` → `{restored, saved}` · `update {version,
1943
+ name?, note?, final?}` → `{version}` · `delete {version}` → `{deleted}`. `GET /api/versions/file?project=&version=`
1944
+ is that version's document; `GET /api/projects/backup?id=` a project with all its versions (import it with
1945
+ `POST /api/projects {action:"import", project:<the backup>}`). SSE event `versions` (`{project, action}`). See "Versions".
1718
1946
  - `GET /api/library?dir=sfx|elements|svg|fonts|presets|templates` — list library assets
1719
1947
  - `GET /api/presets` · `GET /api/templates` — the saved presets / templates, validated (bad files skipped);
1720
1948
  `POST /api/presets {preset}` · `POST /api/templates {template}` — validate one and save it as
@@ -1982,6 +2210,10 @@ Export is the Export button → dialog, or `fablecut_export` from an agent (belo
1982
2210
  ffmpeg, or WebCodecs is unavailable. Plays the timeline once and records it;
1983
2211
  keep the tab focused.
1984
2212
 
2213
+ Fast and WebCodecs export decode MP4 / MOV clips with WebCodecs
2214
+ (`mp4-demux.js` + `VideoDecoder`), frame-exact. Fragmented, rotated or
2215
+ undecodable files and `bgRemove` clips fall back to the `<video>` element.
2216
+
1985
2217
  The exported span is chosen in the Export dialog (**Range**: Entire
1986
2218
  timeline / IN–OUT). IN–OUT is the default when `inPoint` / `outPoint` are
1987
2219
  set; pick Entire timeline to keep those markers for split/trim. Effective
@@ -2169,7 +2401,8 @@ ffmpeg -y -f image2pipe -framerate <fps> -i - [-i audio.wav] <jpeg-color> <args
2169
2401
 
2170
2402
  - **There is no allow-list.** Any codec, filter, container or flag your local ffmpeg
2171
2403
  supports works — ProRes, DNxHD, NVENC/QSV/VideoToolbox, VP9/AV1, 10-bit, HDR tags.
2172
- See the shipped `prores422` and `broadcast1080i50` profiles.
2404
+ See the shipped `prores422`, `broadcast1080i50`, `nvenc-h264` and `nvenc-hevc`
2405
+ profiles (the NVENC ones need an NVIDIA GPU and an ffmpeg built with NVENC).
2173
2406
  - **Args are validated by ffmpeg itself**, not by a schema: when an export starts the
2174
2407
  server dry-runs the profile against a 0.1 s synthetic input (`lavfi`). A typo or an
2175
2408
  encoder your build lacks is rejected up front with ffmpeg's own message, instead of
package/README.md CHANGED
@@ -121,6 +121,9 @@ same time.
121
121
  use `fablecut_denoise`.
122
122
  - **Project bin folders** — tree view with expand/collapse; drag media or folders to nest; right-click the **Project** tab → New folder; drop files onto a folder to import into it
123
123
  - **Media management** — each file's frame rate, codecs, audio channels and size (ffprobe); search by name, codec, resolution or `#tag`; filter by favorites, used / unused, kind, tag or collection; sort by any detail or by times used; a list view with metadata columns; favorites, tags and collections; **Find timeline instances** and **Reveal in project**; offline files flagged with a "Media offline" slate, **Relink…** (finds moved files by name and size) and **Replace file…**
124
+ - **Projects** — a dashboard of every project with pictures, notes and tags: open, create from a canvas or a saved project template, duplicate, rename, archive and delete, import an old project file; media is shared, so copies cost no footage
125
+ - **Sequences** — several timelines in one project (a 16:9 and a 9:16 cut, cut-downs, alternatives) sharing its media and compositions, each with its own canvas, frame rate, mix and delivery settings; switch from the menu at the left of the timeline toolbar
126
+ - **Versions** — non-destructive history: save a version (Ctrl/Cmd+S), automatic versions every 10 minutes and before an agent edits, compare a version with now, restore (the current state is kept as a version first), mark the final cut; backups carry every version, and an unreadable `project.json` is recovered at startup
124
127
  - **Proxies** — light, frame-accurate H.264 copies of 4K / HEVC / ProRes footage made in the background (ffmpeg); edit on the proxy with the monitor's **Proxy** button, export always renders the originals
125
128
  - **Import from URL** — **+ URL** downloads an HTTPS video/audio/image into
126
129
  `./media/` (same-origin after import). Remote SVG is refused. Agents use