diff --git a/crates/maestro-cli/src/cli.rs b/crates/maestro-cli/src/cli.rs index 6c8fdc4..b1c7ac2 100644 --- a/crates/maestro-cli/src/cli.rs +++ b/crates/maestro-cli/src/cli.rs @@ -102,11 +102,6 @@ pub struct SpawnArgs { /// there. #[arg(long)] pub existing_branch: bool, - /// Remove the worktree when the session is killed. Kept for wire - /// compatibility (#56): the daemon now always cleans up on kill, guarded - /// against unsaved work. - #[arg(long, default_value_t = true)] - pub cleanup_on_kill: bool, /// After spawning, attach immediately. #[arg(long, short = 'a')] pub attach: bool, @@ -168,7 +163,6 @@ mod tests { "/repos/foo", "--branch", "feat/x", - "--cleanup-on-kill", "-e", "FOO=bar", "-e", @@ -179,7 +173,6 @@ mod tests { Command::Spawn(a) => { assert_eq!(a.command, "bash"); assert_eq!(a.branch.as_deref(), Some("feat/x")); - assert!(a.cleanup_on_kill); assert_eq!( a.env, vec![("FOO".into(), "bar".into()), ("BAZ".into(), "qux".into()),] @@ -189,27 +182,6 @@ mod tests { } } - #[test] - fn cleanup_on_kill_defaults_true_for_the_wire() { - let cli = Cli::try_parse_from([ - "maestro", - "spawn", - "--cwd", - "/tmp", - "--command", - "bash", - "--worktree-from", - "/repos/foo", - "--branch", - "feat/x", - ]) - .unwrap(); - match cli.command { - Command::Spawn(a) => assert!(a.cleanup_on_kill), - _ => panic!("wrong subcommand"), - } - } - /// Review fix: without a flag the CLI always sent `create_branch: true`, /// so the daemon's existing-branch path was unreachable and spawning onto /// a branch that already existed just failed. diff --git a/crates/maestro-cli/src/sessions.rs b/crates/maestro-cli/src/sessions.rs index dd1b38f..7423ddd 100644 --- a/crates/maestro-cli/src/sessions.rs +++ b/crates/maestro-cli/src/sessions.rs @@ -43,7 +43,6 @@ pub async fn run_spawn(client: &DaemonClient, args: SpawnArgs) -> Result Some(WorktreeSpec { base_repo: repo.clone(), branch: branch.clone(), - cleanup_on_kill: args.cleanup_on_kill, create_branch: !args.existing_branch, }), _ => None, diff --git a/crates/maestro-daemon/tests/local_api.rs b/crates/maestro-daemon/tests/local_api.rs index ce6e071..c5d1ab7 100644 --- a/crates/maestro-daemon/tests/local_api.rs +++ b/crates/maestro-daemon/tests/local_api.rs @@ -363,7 +363,6 @@ async fn delete_a_session_whose_worktree_holds_unsaved_work_returns_409_with_the worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/guarded".into(), - cleanup_on_kill: true, create_branch: true, }), }) @@ -417,7 +416,6 @@ async fn delete_with_force_ends_the_session_and_answers_what_was_retained() { worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/guarded".into(), - cleanup_on_kill: true, create_branch: true, }), }) diff --git a/crates/maestro-daemon/tests/session_manager.rs b/crates/maestro-daemon/tests/session_manager.rs index 234421c..c3574d8 100644 --- a/crates/maestro-daemon/tests/session_manager.rs +++ b/crates/maestro-daemon/tests/session_manager.rs @@ -385,7 +385,6 @@ async fn kill_removes_worktree_even_when_spec_says_keep() { worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/keep".into(), - cleanup_on_kill: false, create_branch: true, }), }) @@ -423,7 +422,6 @@ async fn killing_refuses_a_worktree_with_unsaved_work_and_keeps_the_session() { worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/guarded".into(), - cleanup_on_kill: true, create_branch: true, }), }) @@ -487,7 +485,6 @@ async fn killing_refuses_until_the_branch_is_pushed() { worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/pushed".into(), - cleanup_on_kill: true, create_branch: true, }), }) @@ -539,7 +536,6 @@ async fn force_killing_a_guarded_worktree_retains_it_in_the_store() { worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/forced".into(), - cleanup_on_kill: true, create_branch: true, }), }) @@ -605,7 +601,6 @@ async fn force_on_a_clear_worktree_removes_it_as_usual() { worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/clear".into(), - cleanup_on_kill: true, create_branch: true, }), }) @@ -648,7 +643,6 @@ async fn killing_an_ignored_only_worktree_succeeds() { worktree: Some(WorktreeSpec { base_repo: repo.path().to_path_buf(), branch: "feat/rusty".into(), - cleanup_on_kill: true, create_branch: true, }), }) diff --git a/crates/maestro-protocol/src/lib.rs b/crates/maestro-protocol/src/lib.rs index 3b88d6d..8a24179 100644 --- a/crates/maestro-protocol/src/lib.rs +++ b/crates/maestro-protocol/src/lib.rs @@ -119,11 +119,6 @@ pub enum ActivityState { pub struct WorktreeSpec { pub base_repo: PathBuf, pub branch: String, - /// Kept on the wire for CLI compatibility (#56) but no longer a - /// user-facing choice: the daemon always cleans up on kill, guarded - /// against unsaved work. Defaults to `true`. - #[serde(default = "default_true")] - pub cleanup_on_kill: bool, /// When false, `branch` must already exist and is checked out as-is /// (#56); when true (the default, and what every payload meant before /// the field existed) the daemon creates it with `worktree add -b`. @@ -594,7 +589,6 @@ mod tests { worktree: Some(WorktreeSpec { base_repo: PathBuf::from("/home/naps62/projects/maestro"), branch: "feat/foo".into(), - cleanup_on_kill: true, create_branch: true, }), }; @@ -624,7 +618,6 @@ mod tests { }); let spec: WorktreeSpec = serde_json::from_value(json).unwrap(); assert!(spec.create_branch); - assert!(spec.cleanup_on_kill); } #[test] @@ -632,7 +625,6 @@ mod tests { let spec = WorktreeSpec { base_repo: PathBuf::from("/work"), branch: "feat/foo".into(), - cleanup_on_kill: true, create_branch: false, }; assert_eq!(spec, round_trip(&spec)); diff --git a/crates/maestro-tui/src/draft.rs b/crates/maestro-tui/src/draft.rs index cd76fd2..3e26386 100644 --- a/crates/maestro-tui/src/draft.rs +++ b/crates/maestro-tui/src/draft.rs @@ -549,7 +549,6 @@ impl DraftPane { WorktreeSpec { base_repo, branch: branch.to_string(), - cleanup_on_kill: true, create_branch: true, } } @@ -562,7 +561,6 @@ impl DraftPane { WorktreeSpec { base_repo, branch: name, - cleanup_on_kill: true, create_branch: false, } } @@ -1689,7 +1687,6 @@ mod tests { assert_eq!(wt.base_repo, PathBuf::from("/repos/maestro")); assert_eq!(wt.branch, "crimson-otter", "branch defaults to the name"); assert!(wt.create_branch); - assert!(wt.cleanup_on_kill); } #[test] diff --git a/crates/maestro-tui/src/fast_forward.rs b/crates/maestro-tui/src/fast_forward.rs index 4b8abb3..daa879a 100644 --- a/crates/maestro-tui/src/fast_forward.rs +++ b/crates/maestro-tui/src/fast_forward.rs @@ -80,7 +80,6 @@ impl FastForwardDefaults { .clone() .unwrap_or_else(|| project.path.clone()), branch: name.to_string(), - cleanup_on_kill: true, create_branch: true, }), }) diff --git a/web/src/fastForward.test.ts b/web/src/fastForward.test.ts index 7e46408..9d1d6e5 100644 --- a/web/src/fastForward.test.ts +++ b/web/src/fastForward.test.ts @@ -43,7 +43,6 @@ describe("resolveFastForward (#67)", () => { expect(req.worktree).toEqual({ base_repo: "/repos/fresh", branch: "amber-falcon", - cleanup_on_kill: true, create_branch: true, }); }); diff --git a/web/src/fastForward.ts b/web/src/fastForward.ts index 8ac91fb..39d620c 100644 --- a/web/src/fastForward.ts +++ b/web/src/fastForward.ts @@ -42,7 +42,6 @@ export function buildFastForwardRequest( worktree: { base_repo: project.base_repo ?? project.path, branch: name, - cleanup_on_kill: true, create_branch: true, }, }; diff --git a/web/src/spawnForm.test.ts b/web/src/spawnForm.test.ts index 5deb9ea..34834d2 100644 --- a/web/src/spawnForm.test.ts +++ b/web/src/spawnForm.test.ts @@ -38,7 +38,6 @@ describe("buildSpawnRequest", () => { worktree: { base_repo: "/home/user/project", branch: "feat/foo", - cleanup_on_kill: true, create_branch: true, }, }, @@ -63,7 +62,6 @@ describe("buildSpawnRequest", () => { worktree: { base_repo: "/home/user/project", branch: "spawn-v2", - cleanup_on_kill: true, create_branch: false, }, }, diff --git a/web/src/spawnForm.ts b/web/src/spawnForm.ts index 5a21569..194d71c 100644 --- a/web/src/spawnForm.ts +++ b/web/src/spawnForm.ts @@ -75,9 +75,6 @@ export function buildSpawnRequest( req.worktree = { base_repo: baseRepo, branch, - // The daemon always cleans up, guarded against unsaved work (#56); - // the wire field stays for older daemons. - cleanup_on_kill: true, // Existing-mode picks must check out as-is; the daemon creates // anything else with `worktree add -b` (#56/#61). create_branch: mode !== "existing", diff --git a/web/src/types.ts b/web/src/types.ts index 10a8e43..48040cf 100644 --- a/web/src/types.ts +++ b/web/src/types.ts @@ -113,7 +113,6 @@ export type Projects = Project[]; export interface WorktreeSpec { base_repo: string; branch: string; - cleanup_on_kill?: boolean; /** When false, `branch` already exists and is checked out as-is (#61). * Defaults to true (create a new branch) on older daemons. */ create_branch?: boolean;