Feature: CLI Plan and Context Commands - Complete Coverage As a developer I want to verify plan and context workflows work properly So that CleverAgents provides complete functionality Background: Given I have a clean test environment And I have set up the test configuration # Essential Commands (5) Scenario: Initialize a new CleverAgents project Given I am in an empty directory When I run "cleveragents init test-project" Then the command should succeed And a .cleveragents directory should be created And the database should be initialized in current directory And the project should be named "test-project" Scenario: Add files to context with context-load Given I have an initialized project And I have a file "test.py" with content "print('hello')" When I run "cleveragents context-load test.py" Then the command should succeed And the file should be added to context When I run "cleveragents context list" Then I should see "test.py" in the output Scenario: Create a plan with tell command Given I have an initialized project When I run 'cleveragents tell "Add error handling to the main function"' Then the command should succeed And a new plan should be created And the plan should contain the instruction "Add error handling to the main function" Scenario: Build a plan to generate changes Given I have an initialized project with a plan And the plan has an instruction "Add error handling" When I run "cleveragents build" Then the command should succeed And the plan should have generated changes And the changes should be stored in the database Scenario: Build command honors actor selection Given I have an initialized project with a plan And the plan has an instruction "Add error handling" When I run "cleveragents build --actor openai/gpt-cli-test" Then the command should succeed Scenario: Apply built changes to filesystem Given I have an initialized project with a built plan And the plan has a change to create "new_file.py" When I run "cleveragents apply" Then the command should succeed And the file "new_file.py" should exist And the changes should be marked as applied # Supporting Commands (9) Scenario: Create a new empty plan Given I have an initialized project When I run "cleveragents plan new feature-plan" Then the command should succeed And a plan named "feature-plan" should be created And "feature-plan" should be the current plan Scenario: Show the current plan name Given I have an initialized project And I have a plan named "main" And "main" is the current plan When I run "cleveragents plan current" Then the command should succeed And the output should contain "main" Scenario: List all plans in project Given I have an initialized project And I have plans named "main", "feature-1", "feature-2" When I run "cleveragents plan list" Then the command should succeed And the output should contain "main" And the output should contain "feature-1" And the output should contain "feature-2" Scenario: Switch to a different plan Given I have an initialized project And I have plans named "main" and "feature-1" And "main" is the current plan When I run "cleveragents plan cd feature-1" Then the command should succeed And "feature-1" should be the current plan Scenario: Continue working on current plan Given I have an initialized project with a plan And the plan has previous conversation history When I run 'cleveragents plan continue "Also add logging"' Then the command should succeed And the plan should have the additional instruction Scenario: Show context files Given I have an initialized project And I have added files "main.py", "utils.py" to context When I run "cleveragents context list" Then the command should succeed And the output should contain "main.py" And the output should contain "utils.py" Scenario: Display full context content Given I have an initialized project And I have a file "test.py" with content "def hello(): pass" And I have added "test.py" to context When I run "cleveragents context show" Then the command should succeed And the output should contain "def hello(): pass" Scenario: Remove file from context Given I have an initialized project And I have added files "main.py", "utils.py" to context When I run "cleveragents context rm main.py" Then the command should succeed And "main.py" should not be in context And "utils.py" should still be in context Scenario: Clear all context files Given I have an initialized project And I have added files "main.py", "utils.py", "test.py" to context When I run "cleveragents context clear -y" Then the command should succeed And the context should be empty Scenario: Remove a file filter from a project Given I have an initialized project And I run "cleveragents project file-filter add --exclude '**/__pycache__'" When I run "cleveragents project file-filter remove --exclude '**/__pycache__'" Then the command should succeed And the output should not contain "__pycache__" # Error Handling Scenarios Scenario: Cannot initialize project in non-empty directory with existing project Given I have an initialized project When I run "cleveragents init another-project" Then the command should fail And the error message should mention "already initialized" Scenario: Cannot use commands without initialized project Given I am in an empty directory When I run "cleveragents plan tell 'test'" Then the command should fail And the error message should mention "no project found" Scenario: Cannot switch to non-existent plan Given I have an initialized project When I run "cleveragents plan cd non-existent" Then the command should fail And the error message should mention "plan not found" Scenario: Cannot remove non-existent context file Given I have an initialized project When I run "cleveragents context rm non-existent.py" Then the command should fail And the error message should mention "not in context" # Command Aliases and Shortcuts Scenario: Context-load is an alias for context add Given I have an initialized project And I have a file "test.py" When I run "cleveragents context-load test.py" Then the command should succeed When I run "cleveragents context-add test.py" Then the command should succeed And the output should mention "already in context" Scenario: Top-level shortcuts work Given I have an initialized project When I run 'cleveragents tell "test instruction"' Then the command should succeed And it should be equivalent to "cleveragents plan tell" When I run "cleveragents build" Then the command should succeed And it should be equivalent to "cleveragents plan build" When I run "cleveragents apply" Then the command should succeed And it should be equivalent to "cleveragents plan apply"