144 lines
6.0 KiB
Gherkin
144 lines
6.0 KiB
Gherkin
Feature: Core CLI Commands for Project, Context and Plan Management
|
|
As a developer
|
|
I want to use CleverAgents core CLI commands
|
|
So that I can manage projects, context, and plans through the command line
|
|
|
|
Background:
|
|
Given I have a minimal test environment
|
|
|
|
Scenario: CLI shows help with all command groups
|
|
When I run "cleveragents --help"
|
|
Then the exit code should be 0
|
|
And the output should contain "AI-powered development assistant"
|
|
And the output should contain "project"
|
|
And the output should contain "context"
|
|
And the output should contain "plan"
|
|
And the output should contain "init"
|
|
And the output should contain "tell"
|
|
And the output should contain "build"
|
|
And the output should contain "apply"
|
|
|
|
Scenario: Initialize a new project
|
|
Given I am in a temporary directory
|
|
When I run "cleveragents init test-project"
|
|
Then the exit code should be 0
|
|
And the output should contain "Project 'test-project' initialized successfully"
|
|
And the directory ".cleveragents" should exist
|
|
And the test file ".cleveragents/db.sqlite" should exist
|
|
And the test file ".cleveragents/config.yaml" should exist
|
|
And the test file ".cleveragents/current" should exist
|
|
And the file ".cleveragents/current" should contain "main"
|
|
|
|
Scenario: Cannot initialize project twice without force
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
When I run "cleveragents init another-project"
|
|
Then the exit code should be 1
|
|
And the output should contain "Project already initialized"
|
|
And the output should contain "--force"
|
|
|
|
Scenario: Force reinitialize a project
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
When I run "cleveragents init another-project --force"
|
|
Then the exit code should be 0
|
|
And the output should contain "Project 'another-project' initialized successfully"
|
|
|
|
Scenario: Project status command works
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
When I run "cleveragents project status"
|
|
Then the exit code should be 0
|
|
And the output should contain "Project: test-project"
|
|
And the output should contain "Plans: 1"
|
|
And the output should contain "Context Files: 0"
|
|
|
|
Scenario: Project status fails without project
|
|
Given I am in a temporary directory
|
|
When I run "cleveragents project status"
|
|
Then the exit code should be 1
|
|
And the output should contain "No project found"
|
|
|
|
Scenario: Context add command works with files
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created a plan with "Test plan"
|
|
And I have created a file "test.py" with content "print('hello')"
|
|
When I run "cleveragents context add test.py"
|
|
Then the exit code should be 0
|
|
And the output should contain "Added 1 file(s) to context"
|
|
And the output should contain "test.py"
|
|
|
|
Scenario: Context list shows added files
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created a plan with "Test plan"
|
|
And I have created a file "test.py" with content "print('hello')"
|
|
And I have added path "test.py" to context
|
|
When I run "cleveragents context list"
|
|
Then the exit code should be 0
|
|
And the output should contain "test.py"
|
|
And the output should contain "bytes"
|
|
|
|
Scenario: Context clear removes all files
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created a plan with "Test plan"
|
|
And I have created a file "test.py" with content "print('hello')"
|
|
And I have added path "test.py" to context
|
|
When I run "cleveragents context clear --yes"
|
|
Then the exit code should be 0
|
|
And the output should contain "Cleared all files from context"
|
|
|
|
Scenario: Plan tell creates a new plan
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
When I run "cleveragents tell 'Add error handling to the main function'"
|
|
Then the exit code should be 0
|
|
And the output should contain "Plan created"
|
|
And the output should contain "Add error handling"
|
|
|
|
Scenario: Plan build generates changes
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created a plan with "Add error handling"
|
|
When I run "cleveragents build"
|
|
Then the exit code should be 0
|
|
And the output should contain "Plan built successfully"
|
|
And the output should contain "Generated"
|
|
And the output should contain "change(s)"
|
|
|
|
Scenario: Plan apply writes changes
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created and built a plan
|
|
When I run "cleveragents apply --yes"
|
|
Then the exit code should be 0
|
|
And the output should contain "Successfully applied"
|
|
And the test file "example.py" should exist
|
|
|
|
Scenario: Plan list shows all plans
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created a plan with "First plan"
|
|
When I run "cleveragents plan list"
|
|
Then the exit code should be 0
|
|
And the output should contain "Plans (2 total)"
|
|
|
|
Scenario: Plan current shows active plan
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created a plan with "Test plan"
|
|
When I run "cleveragents plan current"
|
|
Then the exit code should be 0
|
|
And the output should contain "Current Plan"
|
|
And the output should contain "Test plan"
|
|
|
|
Scenario: Shortcuts work for common commands
|
|
Given I am in a temporary directory
|
|
And I have initialized a project "test-project"
|
|
And I have created a plan with "Test plan"
|
|
And I have created a file "test.py" with content "print('hello')"
|
|
When I run "cleveragents context-load test.py"
|
|
Then the exit code should be 0
|
|
And the output should contain "Added 1 file(s) to context" |