Files
cleveragents-core/features/plan_commands_coverage.feature
freemo 48cff5cfe0 refactor(cli): rename plan lifecycle-list and lifecycle-apply to match specification
Renames `plan lifecycle-list` to `plan list` and `plan lifecycle-apply` to `plan apply` to align with the specification's canonical command names. Removes legacy V2 plan commands that occupied those names.

- Renamed CLI command registrations from lifecycle-list/lifecycle-apply to list/apply
- Removed legacy V2 apply and list commands (~200 lines)
- Updated apply shortcut in main.py to delegate to v3 lifecycle
- Added defensive null check for plan existence in apply command
- Updated 63+ test, doc, and benchmark files for consistency

Closes #881

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 19:09:04 +00:00

243 lines
11 KiB
Gherkin

@mock_only
Feature: Plan Commands Coverage
As a developer
I want to test all plan command paths
So that plan.py has >90% test coverage
Scenario: Tell command creates a new plan with prompt
Given I have a temporary test directory
And I have a plan test project initialized
When I execute plan tell with prompt "Create a REST API"
Then the plan tell should execute successfully
And the plan should be created with name and prompt
Scenario: Tell command creates a plan with custom name
Given I have a temporary test directory
And I have a plan test project initialized
When I execute plan tell with prompt "Create a REST API" and name "api-plan"
Then the plan tell should execute successfully
And the plan should be created with custom name "api-plan"
Scenario: Tell command handles validation errors
Given I have a temporary test directory
And I have a plan test project initialized
When I execute plan tell with invalid prompt causing validation error
Then the plan tell should abort with validation error
Scenario: Tell command handles plan errors
Given I have a temporary test directory
And I have a plan test project initialized
When I execute plan tell causing plan error
Then the plan tell should abort with plan error
Scenario: Tell command handles general errors
Given I have a temporary test directory
And I have a plan test project initialized
When I execute plan tell causing general error
Then the plan tell should abort with general error
Scenario: Tell command streaming mode invokes async runner
Given I have a temporary test directory
And I have a plan test project initialized
When I execute plan tell streaming with prompt "Stream coverage details"
Then the plan tell streaming path should execute successfully
Scenario: Build command builds current plan successfully
Given I have a temporary test directory
And I have an initialized project with current plan
When I execute plan build
Then the plan build should execute successfully
And plan changes should be generated
Scenario: Build command with verbose flag
Given I have a temporary test directory
And I have an initialized project with current plan
When I execute plan build with verbose flag
Then the plan build should execute successfully with verbose output
Scenario: Build command with no changes generated
Given I have a temporary test directory
And I have an initialized project with empty plan
When I execute plan build generating no changes
Then the build should complete with no changes message
Scenario: Build command handles plan errors
Given I have a temporary test directory
And I have an initialized project
When I execute plan build causing plan error
Then the plan build should abort with plan error
Scenario: Build command handles general errors
Given I have a temporary test directory
And I have an initialized project
When I execute plan build causing general error
Then the plan build should abort with general error
Scenario: New command creates empty plan
Given I have a temporary test directory
And I have an initialized project
When I execute plan new with name "feature-plan"
Then the plan new should execute successfully
And empty plan "feature-plan" should be created
Scenario: New command handles validation errors
Given I have a temporary test directory
And I have an initialized project
When I execute plan new with invalid name
Then the plan new should abort with validation error
Scenario: New command handles general errors
Given I have a temporary test directory
And I have an initialized project
When I execute plan new causing general error
Then the plan new should abort with general error
Scenario: New command aborts when no project exists
Given I have a temporary test directory
When I execute plan new without an initialized project
Then the plan new should abort due to missing project
Scenario: Current command shows active plan
Given I have a temporary test directory
And I have an initialized project with current plan
When I execute plan current
Then the plan current should execute successfully
And current plan details should be displayed
Scenario: Current command with no active plan
Given I have a temporary test directory
And I have an initialized project with no plans
When I execute plan current
Then the current should exit with no plan message
Scenario: Current command handles errors
Given I have a temporary test directory
And I have an initialized project
When I execute plan current causing error
Then the plan current should abort with error
Scenario: CD command switches to different plan
Given I have a temporary test directory
And I have an initialized project with multiple plans
When I execute plan cd to "other-plan"
Then the plan cd should execute successfully
And current plan should be "other-plan"
Scenario: CD command handles plan not found
Given I have a temporary test directory
And I have an initialized project
When I execute plan cd to non-existent plan
Then the plan cd should abort with validation error
Scenario: CD command handles general errors
Given I have a temporary test directory
And I have an initialized project
When I execute plan cd causing error
Then the plan cd should abort with error
Scenario: Continue command adds to current plan
Given I have a temporary test directory
And I have an initialized project with current plan
When I execute plan continue with prompt "Add more features"
Then the plan continue should execute successfully
And instructions should be added to plan
Scenario: Continue command without prompt
Given I have a temporary test directory
And I have an initialized project with current plan
When I execute plan continue without prompt
Then the plan continue should execute successfully
And continue message should be displayed
Scenario: Continue command with no current plan
Given I have a temporary test directory
And I have an initialized project with no plans
When I execute plan continue without prompt
Then the continue should abort with no plan error
Scenario: Continue command handles errors
Given I have a temporary test directory
And I have an initialized project
When I execute plan continue causing error
Then the plan continue should abort with error
Scenario: Programmatic tell command fails without an initialized project
Given I have a temporary test directory
When I call plan tell_command without a project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic build command fails without an initialized project
Given I have a temporary test directory
When I call plan build_command without a project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic apply command returns applied change count
Given I have a temporary test directory
When I call plan apply_command successfully
Then the programmatic plan apply_command should report 3 applied changes
Scenario: Programmatic apply command fails without an initialized project
Given I have a temporary test directory
When I call plan apply_command without a project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic new command fails without an initialized project
Given I have a temporary test directory
When I call plan new_command without a project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic current command returns active plan instance
Given I have a temporary test directory
When I call plan current_command successfully
Then the programmatic current_command should return the mock plan
Scenario: Programmatic current command fails without an initialized project
Given I have a temporary test directory
When I call plan current_command without a project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic list command returns empty list when no plans exist
Given I have a temporary test directory
When I call plan list_command with no stored plans
Then the programmatic list command should return an empty list
Scenario: Programmatic list command fails without an initialized project
Given I have a temporary test directory
When I call plan list_command without a project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic cd command fails without an initialized project
Given I have a temporary test directory
When I call plan cd_command without a project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic cd command switches to requested plan
Given I have a temporary test directory
When I call plan cd_command successfully to "feature-stream"
Then the programmatic cd command should switch to plan "feature-stream"
Scenario: Programmatic continue command with prompt forwards instructions
Given I have a temporary test directory
When I call plan continue_command with prompt "Ship it"
Then the programmatic continue command should forward prompt "Ship it"
Scenario: Programmatic continue command without prompt uses the current plan
Given I have a temporary test directory
When I call plan continue_command without prompt and an active plan
Then the programmatic continue command should keep the current plan active
Scenario: Programmatic continue command without prompt fails when no plan exists
Given I have a temporary test directory
When I call plan continue_command without prompt and no current plan
Then a CleverAgentsError should be raised with message "No current plan to continue."
Scenario: Programmatic continue command fails without project context
Given I have a temporary test directory
When I call plan continue_command without an initialized project
Then a CleverAgentsError should be raised with message "No project found. Run 'agents init' first."
Scenario: Programmatic helper get_current_project aborts without initialized project
Given I have a temporary test directory
When I call the plan helper to fetch current project without initialization
Then a typer Abort should be raised for missing project