143 lines
5.6 KiB
Gherkin
143 lines
5.6 KiB
Gherkin
Feature: Session CLI commands
|
|
As a developer
|
|
I want to manage sessions via CLI commands
|
|
So that I can create and use persistent conversation threads
|
|
|
|
Background:
|
|
Given a session CLI runner with mocked service
|
|
|
|
# Create command tests
|
|
Scenario: Create session with defaults
|
|
When I run session CLI create with no arguments
|
|
Then the session CLI create should succeed
|
|
And the session CLI output should contain "Session Created"
|
|
|
|
Scenario: Create session with custom actor
|
|
When I run session CLI create with --actor "openai/gpt-4"
|
|
Then the session CLI create should succeed
|
|
And the session CLI output should contain "openai/gpt-4"
|
|
|
|
Scenario: Create session with JSON format
|
|
When I run session CLI create with --format json
|
|
Then the session CLI create should succeed
|
|
And the session CLI output should be valid JSON
|
|
|
|
# List command tests
|
|
Scenario: List sessions when empty
|
|
Given there are no mocked sessions
|
|
When I run session CLI list
|
|
Then the session CLI output should contain "No sessions found"
|
|
|
|
Scenario: List sessions with populated data
|
|
Given there are mocked existing sessions
|
|
When I run session CLI list
|
|
Then the session CLI should show all sessions in a table
|
|
|
|
Scenario: List sessions with JSON format
|
|
Given there are mocked existing sessions
|
|
When I run session CLI list with --format json
|
|
Then the session CLI output should be valid JSON
|
|
And the session CLI JSON should contain "sessions"
|
|
|
|
# Show command tests
|
|
Scenario: Show session with valid ID
|
|
Given there is a mocked session with messages
|
|
When I run session CLI show with a valid session ID
|
|
Then the session CLI show should succeed
|
|
And the session CLI output should contain "Session Details"
|
|
|
|
Scenario: Show session with JSON format
|
|
Given there is a mocked session with messages
|
|
When I run session CLI show with --format json
|
|
Then the session CLI output should be valid JSON
|
|
|
|
Scenario: Show session with invalid ID
|
|
When I run session CLI show with an invalid session ID
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "Session not found"
|
|
|
|
# Delete command tests
|
|
Scenario: Delete session with --yes flag
|
|
Given there is a mocked session to delete
|
|
When I run session CLI delete with --yes
|
|
Then the session CLI delete should succeed
|
|
And the session CLI output should contain "deleted"
|
|
|
|
Scenario: Delete non-existent session
|
|
When I run session CLI delete with a non-existent ID
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "Session not found"
|
|
|
|
# Export command tests
|
|
Scenario: Export session to stdout
|
|
Given there is a mocked session for export
|
|
When I run session CLI export with no output file
|
|
Then the session CLI export should succeed
|
|
And the session CLI output should be valid JSON
|
|
|
|
Scenario: Export session to file
|
|
Given there is a mocked session for export
|
|
When I run session CLI export with --output to a temp file
|
|
Then the session CLI export should succeed
|
|
And the exported file should exist
|
|
|
|
Scenario: Export refuses overwrite without --force
|
|
Given there is a mocked session for export
|
|
And there is an existing export file
|
|
When I run session CLI export to an existing file without --force
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "File already exists"
|
|
|
|
Scenario: Export with --force overwrites file
|
|
Given there is a mocked session for export
|
|
And there is an existing export file
|
|
When I run session CLI export to an existing file with --force
|
|
Then the session CLI export should succeed
|
|
|
|
Scenario: Export non-existent session
|
|
When I run session CLI export with a non-existent session ID
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "Session not found"
|
|
|
|
# Import command tests
|
|
Scenario: Import session from valid file
|
|
Given there is a valid session export file
|
|
When I run session CLI import with the export file
|
|
Then the session CLI import should succeed
|
|
And the session CLI output should contain "Session Imported"
|
|
|
|
Scenario: Import from non-existent file
|
|
When I run session CLI import with a non-existent file
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "File not found"
|
|
|
|
Scenario: Import from corrupt file
|
|
Given there is a corrupt session export file
|
|
When I run session CLI import with the corrupt file
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "Import error"
|
|
|
|
Scenario: Import from invalid JSON file
|
|
Given there is an invalid JSON file
|
|
When I run session CLI import with the invalid JSON file
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "Invalid JSON"
|
|
|
|
# Tell command tests
|
|
Scenario: Tell appends message to session
|
|
Given there is a mocked session for tell
|
|
When I run session CLI tell with a prompt "Hello, world"
|
|
Then the session CLI tell should succeed
|
|
And the session CLI output should contain "Acknowledged"
|
|
|
|
Scenario: Tell with custom actor
|
|
Given there is a mocked session for tell
|
|
When I run session CLI tell with --actor "openai/gpt-4" and prompt "Plan a feature"
|
|
Then the session CLI tell should succeed
|
|
And the session CLI output should contain "openai/gpt-4"
|
|
|
|
Scenario: Tell to non-existent session
|
|
When I run session CLI tell to a non-existent session
|
|
Then the session CLI should exit with error
|
|
And the session CLI output should contain "Session not found"
|