Feature: Plan diff and artifacts CLI command coverage As a developer I want to cover the plan diff, plan artifacts CLI commands and remaining branches So that plan.py lines 1815-1888 and missing branches are fully covered # ---------- plan diff CLI command (lines 1845-1855) ---------- Scenario: plan_diff_artifacts successful diff prints output Given plan_diff_artifacts the apply service returns diff output "--- a/file.py\n+++ b/file.py" When plan_diff_artifacts I run the diff subcommand for plan "plan-001" Then plan_diff_artifacts the exit code should be 0 And plan_diff_artifacts the output should contain "file.py" Scenario: plan_diff_artifacts diff with custom format Given plan_diff_artifacts the apply service returns diff output '{"entries": []}' When plan_diff_artifacts I run the diff subcommand for plan "plan-002" using format "json" Then plan_diff_artifacts the exit code should be 0 And plan_diff_artifacts the output should contain "entries" Scenario: plan_diff_artifacts diff raises PlanError Given plan_diff_artifacts the apply service diff raises a PlanError "changeset not found" When plan_diff_artifacts I run the diff subcommand for plan "plan-bad" Then plan_diff_artifacts the command should be aborted And plan_diff_artifacts the output should contain "Diff Error" And plan_diff_artifacts the output should contain "changeset not found" Scenario: plan_diff_artifacts diff raises CleverAgentsError Given plan_diff_artifacts the apply service diff raises a CleverAgentsError "service unavailable" When plan_diff_artifacts I run the diff subcommand for plan "plan-err" Then plan_diff_artifacts the command should be aborted And plan_diff_artifacts the output should contain "Error" And plan_diff_artifacts the output should contain "service unavailable" # ---------- plan artifacts CLI command (lines 1878-1888) ---------- Scenario: plan_diff_artifacts successful artifacts prints output Given plan_diff_artifacts the apply service returns artifacts output "changeset-id: cs-001" When plan_diff_artifacts I run the artifacts subcommand for plan "plan-001" Then plan_diff_artifacts the exit code should be 0 And plan_diff_artifacts the output should contain "cs-001" Scenario: plan_diff_artifacts artifacts with custom format Given plan_diff_artifacts the apply service returns artifacts output '{"changeset_id": "cs-002"}' When plan_diff_artifacts I run the artifacts subcommand for plan "plan-003" using format "json" Then plan_diff_artifacts the exit code should be 0 And plan_diff_artifacts the output should contain "cs-002" Scenario: plan_diff_artifacts artifacts raises PlanError Given plan_diff_artifacts the apply service artifacts raises a PlanError "plan not found" When plan_diff_artifacts I run the artifacts subcommand for plan "plan-missing" Then plan_diff_artifacts the command should be aborted And plan_diff_artifacts the output should contain "Artifacts Error" And plan_diff_artifacts the output should contain "plan not found" Scenario: plan_diff_artifacts artifacts raises CleverAgentsError Given plan_diff_artifacts the apply service artifacts raises a CleverAgentsError "timeout" When plan_diff_artifacts I run the artifacts subcommand for plan "plan-timeout" Then plan_diff_artifacts the command should be aborted And plan_diff_artifacts the output should contain "Error" And plan_diff_artifacts the output should contain "timeout" # ---------- _get_apply_service (lines 1815-1822) ---------- Scenario: plan_diff_artifacts _get_apply_service creates PlanApplyService Given plan_diff_artifacts a mock lifecycle service When plan_diff_artifacts I call _get_apply_service Then plan_diff_artifacts a PlanApplyService should be returned # ---------- build command branch: no actor_registry (L646->648) ---------- Scenario: plan_diff_artifacts build command without actor registry Given plan_diff_artifacts a container without actor_registry When plan_diff_artifacts I invoke the build command Then plan_diff_artifacts the build should complete without actor registry calls # ---------- build command branch: testing_mode disabled (L648->652) ---------- Scenario: plan_diff_artifacts build command with testing mode disabled Given plan_diff_artifacts a container with actor_registry but testing mode disabled When plan_diff_artifacts I invoke the build command Then plan_diff_artifacts ensure_default_mock_actor should not be called # ---------- plan show: arguments_order with extra key (L1130->1129) ---------- Scenario: plan_diff_artifacts plan show with arguments_order containing missing key Given plan_diff_artifacts a lifecycle plan with arguments_order having an extra key When plan_diff_artifacts I print the lifecycle plan Then plan_diff_artifacts the output should contain the valid argument And plan_diff_artifacts the output should not contain the missing key value