Feature: Plan lifecycle CLI coverage As a developer I want to exercise v3 plan lifecycle CLI commands So that plan lifecycle branches in plan.py are covered Background: Given a plan lifecycle CLI runner And a mocked lifecycle service for plan commands Scenario: Plan use parses typed arguments When I run plan lifecycle use with parsed arguments Then the plan lifecycle command should succeed And the plan lifecycle use should pass parsed arguments And the plan lifecycle output should contain "Strategize phase" Scenario: Plan use rejects invalid argument format When I run plan lifecycle use with invalid argument "badarg" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Invalid argument format" Scenario: Plan use handles action not available errors When I run plan lifecycle use causing "action not available" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Action not available" Scenario: Plan use handles validation errors When I run plan lifecycle use causing "validation error" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Validation Error" Scenario: Plan use handles general errors When I run plan lifecycle use causing "general error" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Error" Scenario: Plan execute aborts when no plans are ready When I run plan execute without a plan id with 0 complete plans Then the plan lifecycle command should abort And the plan lifecycle output should contain "No plans ready for execution" Scenario: Plan execute aborts when multiple plans are ready When I run plan execute without a plan id with 2 complete plans Then the plan lifecycle command should abort And the plan lifecycle output should contain "Multiple plans ready for execution" Scenario: Plan execute runs when one plan is ready When I run plan execute without a plan id with 1 complete plans Then the plan lifecycle command should succeed And the execute command should run the single ready plan And the plan lifecycle output should contain "Plan Executed" Scenario: Plan execute handles invalid phase transition When I run plan execute for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAV" causing "invalid transition" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Invalid transition" Scenario: Plan execute handles plan not ready When I run plan execute for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAW" causing "plan not ready" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Plan not ready" Scenario: Plan execute handles general errors When I run plan execute for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAX" causing "general error" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Error" Scenario: Plan lifecycle apply aborts when no plans are ready When I run plan lifecycle apply without a plan id with 0 complete plans Then the plan lifecycle command should abort And the plan lifecycle output should contain "No plans ready for apply" Scenario: Plan lifecycle apply aborts when multiple plans are ready When I run plan lifecycle apply without a plan id with 2 complete plans Then the plan lifecycle command should abort And the plan lifecycle output should contain "Multiple plans ready for apply" Scenario: Plan lifecycle apply runs when one plan is ready When I run plan lifecycle apply without a plan id with 1 complete plans Then the plan lifecycle command should succeed And the lifecycle apply command should run the single ready plan And the plan lifecycle output should contain "Apply phase" Scenario: Plan lifecycle apply handles invalid phase transition When I run plan lifecycle apply for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAY" causing "invalid transition" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Invalid transition" Scenario: Plan lifecycle apply handles plan not ready When I run plan lifecycle apply for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAZ" causing "plan not ready" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Plan not ready" Scenario: Plan lifecycle apply handles general errors When I run plan lifecycle apply for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB0" causing "general error" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Error" Scenario: Plan status shows no plans When I run plan status without a plan id and 0 plans exist Then the plan lifecycle command should succeed And the plan lifecycle output should contain "No v3 lifecycle plans found" Scenario: Plan status lists active plans When I run plan status without a plan id and 2 plans exist Then the plan lifecycle command should succeed And the plan lifecycle output should contain "Active Plans" Scenario: Plan status falls back for legacy plan When I run plan status for legacy plan id "01ARZ3NDEKTSV4RRFFQ69G5FB1" Then the plan lifecycle command should succeed And the plan lifecycle output should contain "Plan: legacy-plan" Scenario: Plan status handles general errors When I run plan status causing a general error Then the plan lifecycle command should abort And the plan lifecycle output should contain "Error" Scenario: Plan lifecycle list rejects invalid phase When I run plan lifecycle list with invalid phase "notaphase" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Invalid phase" Scenario: Plan lifecycle list shows no plans When I run plan lifecycle list with no plans Then the plan lifecycle command should succeed And the plan lifecycle output should contain "No plans found" Scenario: Plan lifecycle list shows project summaries When I run plan lifecycle list with plans and phase "execute" Then the plan lifecycle command should succeed And the plan lifecycle output should contain "V3 Lifecycle Plans" And the plan lifecycle output should contain "proj-2" And the plan lifecycle output should contain "more" Scenario: Plan lifecycle list handles general errors When I run plan lifecycle list causing a general error Then the plan lifecycle command should abort And the plan lifecycle output should contain "Error" Scenario: Plan cancel reports cancellation with reason When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB2" with reason "User requested" Then the plan lifecycle command should succeed And the plan lifecycle output should contain "Plan cancelled" And the plan lifecycle output should contain "Reason: User requested" Scenario: Plan cancel reports cancellation without reason When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB3" without reason Then the plan lifecycle command should succeed And the plan lifecycle output should contain "Plan cancelled" And the plan lifecycle output should not contain "Reason:" Scenario: Plan cancel handles plan errors When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB4" causing "plan error" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Cannot cancel" Scenario: Plan cancel handles general errors When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB5" causing "general error" Then the plan lifecycle command should abort And the plan lifecycle output should contain "Error" Scenario: Plan execute shares lifecycle service instance with executor When I run plan execute verifying lifecycle service sharing Then the plan executor should receive the same lifecycle service instance