Skip to content

Agent CLI: describe, apply, and an editor that follows project.json - #31

Open
ryanrhughes wants to merge 4 commits into
masterfrom
agent-cli
Open

ryanrhughes wants to merge 4 commits into
masterfrom
agent-cli

Conversation

@ryanrhughes

Copy link
Copy Markdown
Contributor

The first step toward letting AI agents (and scripts) edit recordings: read the edited timeline as JSON, run checked edits, and have an open editor follow along.

omareel describe BUNDLE
Prints the edited timeline as JSON:

  • the recording and the output (duration, aspect, export size);
  • clips and zooms, each with its source span and the output spans where it plays;
  • activity mapped onto the edited timeline: clicks (normalized positions), keyboard shortcuts, and idle stretches of 2 s or more;
  • the rest of project.json as settings;
  • the speeds, layouts and fits the editor allows.

omareel apply BUNDLE OPS.json|-

  • Runs edit operations through editor::Document, so they are checked exactly as the editor checks them.
  • Operations: split, delete, trim, remove-clip, merge, move-clip, reset-trims, speed, layout, fit, insert, zoom, edit-zoom, remove-zoom, clear-zooms, regenerate-zooms, set.
  • Times are output seconds by default. "timeline": "source" gives recording times instead, which no edit moves.
  • All or nothing: a failing operation saves nothing, and the JSON report names it ("operation 2 (speed): speed must be one of …"). Video copies made by insert are removed again.
  • --dry-run checks without writing anything; --describe adds the resulting timeline to the report.
  • describe and apply open bundles read-only (a project.json that needs a defaults migration is migrated in memory) and run before any Qt application is created.

Live reload in the editor

  • The editor checks project.json's modification time and size every 400 ms and before every save (autosave, Ctrl+S, export).
  • A project another program wrote is taken in as one undoable change: the editor's own state, unsaved edits included, becomes the undo step. The top bar shows "Updated from project.json" for a few seconds.
  • The reload makes the same corrections opening a bundle does, so the editor and describe agree.
  • A file that doesn't parse yet is left alone, and autosave waits ("project.json can't be read · Ctrl+S overwrites it"). An explicit save or an export replaces it.
  • A window closing with unsaved edits keeps a project.json written since its last look.

Tested

  • cargo test -p omareel_core: 226 unit tests and 58 goldens. The new tests cover:
    • every operation and the errors it can give;
    • source-time batches across cuts;
    • all-or-nothing saving;
    • dry-run and failed-batch inserts leaving media/ untouched;
    • zoom edges at cuts;
    • the editor reload: its undo step, unreadable files, and the open-time corrections.
  • QT_QPA_PLATFORM=offscreen ctest: 4/4 pass.
  • By hand, with omareel edit running offscreen on a generated bundle:
    • apply was taken in and saved by the editor once, about 0.7 s later, with the applied edits intact;
    • a broken project.json was left alone;
    • a non-UTF-8 argument gives an error instead of aborting.
  • An independent review found 8 issues. All are fixed in the second commit, which explains each one.

A follow-up PR, stacked on this one, ships an agent skill that teaches coding agents to use these commands.

🤖 Generated with Claude Code

ryanrhughes and others added 2 commits November 11, 2026 23:12
`omareel describe BUNDLE` prints the edited timeline as JSON for scripts and AI agents: the
recording and output, clips and zooms with their source and output spans, clicks (normalized
positions), keyboard shortcuts and idle stretches mapped onto the edited timeline, the rest of
project.json as settings, and the speeds, layouts and fits the editor allows.

`omareel apply BUNDLE OPS.json|-` runs edit operations (split, delete, trim, speed, layout,
zoom, set and the rest) through editor::Document, so they are checked as the editor checks
them. All or nothing: a failing operation saves nothing and the JSON report names it.
Operations take output seconds, or source seconds with "timeline": "source". --dry-run checks
without saving; --describe adds the resulting timeline. Both commands run before any Qt
application is made.

The editor polls project.json's modification time and size every 400 ms and before each
autosave. A project another program wrote is taken in as one undoable change (the editor's
own state, unsaved edits included, is the undo step) instead of being overwritten, and the
top bar says "Updated from project.json" for a few seconds. A file that doesn't parse yet is
left until it does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s more

From review:
- Ctrl+S, the Save button and export saved without looking at project.json, so an apply
  landing within one poll was overwritten and never shown. Every save now takes in
  another program's project first. Autosave leaves a project.json that doesn't parse
  alone and the top bar says so ("project.json can't be read · Ctrl+S overwrites it").
  An explicit save or an export replaces it. A window closing with unsaved edits keeps a
  project.json written since its last look.
- The reload applies the corrections opening a bundle makes (the recording back as the
  first clip of a timeline of inserted videos; audio the recording lacks stays off), so
  the editor and `describe` agree and a touched file doesn't count as a change.
- describe and apply open read-only: a project.json needing a defaults migration is
  migrated in memory and written only when apply saves.
- apply --dry-run copies no inserted video into media/, and a failing batch removes the
  copies it made.
- edit-zoom's `to` keeps the zoom before a cut, as zoom's does. zoom refuses a span under a
  second, levels outside 1–4, and output times past the end, as delete does too.
- Arguments that aren't UTF-8 no longer abort through rust::String.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The reviewed changes appear safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds JSON commands to describe and edit recordings, plus editor reloads when project.json changes.

  • Scripts can apply checked edit batches to a recording project.
  • Scripts can read an edited recording timeline as JSON.
  • The open editor follows project changes made outside its window.

Reviews (3) · Last reviewed commit: "Agent CLI: a refused apply removes only ..." · Reviewed by Greptile

Comment thread crates/omareel_core/src/agent/apply.rs Resolved
Comment thread crates/omareel_core/src/agent/apply.rs Resolved
Comment thread crates/omareel_core/src/agent/apply.rs Resolved
Comment thread crates/omareel_qt/src/editor.rs Resolved
Comment thread crates/omareel_core/src/agent/apply.rs Resolved
Comment thread crates/omareel_core/src/agent/apply.rs Resolved
…paths

Fixes from the 0.6 review of #31:

- apply saved project.json without checking it was still the file it read, so an editor
  autosave during the operations (an insert's copy takes a while) was overwritten. It now
  refuses to save when the file changed meanwhile, says so, and removes the videos it copied.
  The same cleanup runs when the save itself fails.
- `{"ops": {...}}` (not a list) parsed as an empty batch and reported success; it's an error.
- `set` checked the path's first part before set_project_value dropped empty parts, so
  ".clips" got past the guard. The path is normalised first, and `version` and
  `defaultsVersion` are refused too.
- A dry-run insert predicts the name the real import picks (`clip-2.mp4` when taken).
- describe lists each shortcut at its own time; shortcuts pressed within 0.6 s shared the
  first one's.
- The editor's "can't be read" warning cleared only on the next save or reload; putting the
  file back as the editor has it now clears it (projectReadable).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread crates/omareel_core/src/agent/apply.rs Resolved
ryanrhughes added a commit that referenced this pull request Nov 26, 2026
…mes its real file

Fixes from the 0.6 review of #36 (after merging the leaves' review fixes):

- `delete` with output-timeline `ranges` cut each range from the last without joining them,
  so after [2,4] the times in [1,3] had moved: [[1,3],[2,4]] removed 4 s instead of 3. The
  ranges are all checked against the video as it is, joined, then cut.
- A dry-run `music` reported `media/<name as given>`; it names the file the import would make
  (sanitised, -2 when taken), through the same helper the insert's dry run now uses.
- The leaves' media naming (#31's planned names, #34's own partial file per copy) is one helper,
  free_media_name, with the fallback name the music import passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found by the 0.6 adversarial review: when apply refused to save (project.json changed
meanwhile, or the save failed) it removed every file new in media/ since it started, which
included a video the editor or another apply had just inserted and saved. It now removes only
the copies its own inserts made (apply_ops_copying).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ryanrhughes added a commit that referenced this pull request Nov 26, 2026
… kept in the bundle

Merges #31's fix (a refused apply removes only its own copies; Applied carries them).

Found by the 0.6 adversarial review of #42: inside an agent's scope a background image in the
scratch directory was allowed, but the runner removes that directory when the run ends,
leaving the project pointing at nothing. apply copies such an image into media/ and points
the project there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant