Skip to content

fix(shotcut): add auto-save option for one-shot mode#15

Merged
yuh-yang merged 1 commit intoHKUDS:mainfrom
Jah-yee:fix/shotcut-auto-save
Mar 11, 2026
Merged

fix(shotcut): add auto-save option for one-shot mode#15
yuh-yang merged 1 commit intoHKUDS:mainfrom
Jah-yee:fix/shotcut-auto-save

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 10, 2026

Summary

Add -s/--save flag to automatically save project after each mutation command. This fixes the issue where one-shot commands don't persist changes because each command runs in a new process with a fresh session.

Changes

  • Add auto_save global flag to CLI group
  • Add -s/--save option to the main CLI
  • Implement _auto_save_callback() that runs after each command
  • Auto-save only in one-shot mode (not REPL mode)

Usage

# Before (changes not persisted):
shotcut-cli --project edit.mlt timeline add-track --type video
shotcut-cli --project edit.mlt project info  # track_count: 0

# After (with -s flag):
shotcut-cli --project edit.mlt -s timeline add-track --type video
# Auto-saved to: edit.mlt
shotcut-cli --project edit.mlt project info  # track_count: 1

Test

Verified the fix works:

  • Created new project
  • Added track with -s flag
  • Track persisted in project file

Fixes #14

Add -s/--save flag to automatically save project after each mutation
command. This fixes the issue where one-shot commands don't persist
changes because each command runs in a new process with a fresh session.

Usage:
  shotcut-cli --project edit.mlt -s timeline add-track --type video
  # Now auto-saves after adding the track

Without -s flag, behavior is unchanged (explicit save required).
@jarrodcolburn
Copy link

If the repl subcommand isn't used it might be assumed that that changes will be saved, in which case --save may be redundant requirement to need to save when running commands.

@yuh-yang
Copy link
Collaborator

Nice catch! Can we improve HARNESS.md to solve this fundamentally? I'll merge this first.

@Jah-yee
Copy link
Author

Jah-yee commented Mar 11, 2026

If the repl subcommand isn't used it might be assumed that that changes will be saved, in which case --save may be redundant requirement to need to save when running commands.

@jarrodcolburn
Thanks for the thoughtful feedback on one-shot expectations!
I followed up with a docs PR to clarify the Shotcut CLI execution & persistence model in HARNESS.md and to document how -s/--save behaves in one-shot vs REPL: #29.

This keeps current behavior but makes the design and trade-offs explicit, and also notes the potential future direction of defaulting to auto-save for one-shot with a --no-save opt-out if that better matches real-world usage.

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.

[shotcut] One-shot commands do not persist changes to project file

3 participants