Files
cleveragents-core/features/checkpoint_cli_commands.feature
HAL9000 7b8bf8c943 feat(plans): add plan checkpoint management cli
- align checkpoint list table headers with spec language and append a
  field summary footer for clarity
- support optional checkpoint IDs in cp delete command to surface a
  custom validation error and reuse confirmation logic
- update CLI BDD coverage and changelog entry for checkpoint
  management tooling

ISSUES CLOSED: #8559
2026-05-03 00:39:15 +00:00

136 lines
7.3 KiB
Gherkin

Feature: Checkpoint listing and management CLI commands
As a user
I want to list and delete checkpoints for a plan
So that I can view and manage rollback points through the CLI
# ===================================================================
# checkpoint-list: empty state
# ===================================================================
Scenario: Listing checkpoints when none exist shows empty message
Given a cp-cli mocked checkpoint service with no checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" in default format
Then the cp-cli command should succeed
And the cp-cli output should contain "No checkpoints found"
Scenario: Listing checkpoints in json format when none exist returns empty list
Given a cp-cli mocked checkpoint service with no checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with format "json"
Then the cp-cli command should succeed
And the cp-cli output should contain "[]"
# ===================================================================
# checkpoint-list: populated state
# ===================================================================
Scenario: Listing multiple checkpoints shows table with IDs and timestamps
Given a cp-cli mocked checkpoint service with 3 checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" in default format
Then the cp-cli command should succeed
And the cp-cli output should contain "Fields: checkpoint_id"
Scenario: Listing checkpoints in json format returns structured data
Given a cp-cli mocked checkpoint service with 2 checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with format "json"
Then the cp-cli command should succeed
And the cp-cli output should contain "checkpoint_id"
And the cp-cli output should contain "plan_id"
Scenario: Listing checkpoints in yaml format returns structured data
Given a cp-cli mocked checkpoint service with 2 checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with format "yaml"
Then the cp-cli command should succeed
And the cp-cli output should contain "checkpoint_id"
Scenario: Listing checkpoints in table format returns structured data
Given a cp-cli mocked checkpoint service with 2 checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with format "table"
Then the cp-cli command should succeed
And the cp-cli output should contain "checkpoint_id"
# ===================================================================
# checkpoint-list: sort options
# ===================================================================
Scenario: Listing checkpoints with sort desc returns newest first
Given a cp-cli mocked checkpoint service with 3 checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with sort "desc"
Then the cp-cli command should succeed
Scenario: Listing checkpoints with sort asc returns oldest first
Given a cp-cli mocked checkpoint service with 3 checkpoints for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with sort "asc"
Then the cp-cli command should succeed
# ===================================================================
# checkpoint-list: type filter
# ===================================================================
Scenario: Listing checkpoints filtered by type manual
Given a cp-cli mocked checkpoint service with checkpoints of mixed types for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with type filter "manual"
Then the cp-cli command should succeed
Scenario: Listing checkpoints filtered by type pre_write
Given a cp-cli mocked checkpoint service with checkpoints of mixed types for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV"
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" with type filter "pre_write"
Then the cp-cli command should succeed
# ===================================================================
# checkpoint-list: error handling
# ===================================================================
Scenario: Listing checkpoints when service raises CleverAgentsError aborts
Given a cp-cli mocked checkpoint service that raises CleverAgentsError on list
When I invoke cp-cli checkpoint-list for plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" in default format
Then the cp-cli command should abort
And the cp-cli output should contain "Error"
# ===================================================================
# checkpoint-delete: single deletion
# ===================================================================
Scenario: Deleting a single checkpoint with --yes succeeds
Given a cp-cli mocked checkpoint service that can delete checkpoints
When I invoke cp-cli checkpoint-delete "01ARZ3NDEKTSV4RRFFQ69G5FAV" with yes flag
Then the cp-cli command should succeed
And the cp-cli output should contain "deleted"
Scenario: Deleting a single checkpoint in json format returns structured data
Given a cp-cli mocked checkpoint service that can delete checkpoints
When I invoke cp-cli checkpoint-delete "01ARZ3NDEKTSV4RRFFQ69G5FAV" with yes flag and format "json"
Then the cp-cli command should succeed
And the cp-cli output should contain "deleted_count"
# ===================================================================
# checkpoint-delete: batch deletion
# ===================================================================
Scenario: Deleting multiple checkpoints in batch with --yes succeeds
Given a cp-cli mocked checkpoint service that can delete checkpoints
When I invoke cp-cli checkpoint-delete multiple IDs with yes flag
Then the cp-cli command should succeed
And the cp-cli output should contain "deleted"
# ===================================================================
# checkpoint-delete: error handling
# ===================================================================
Scenario: Deleting a non-existent checkpoint shows error message
Given a cp-cli mocked checkpoint service that raises ResourceNotFoundError on delete
When I invoke cp-cli checkpoint-delete "01ARZ3NDEKTSV4RRFFQ69G5FAV" with yes flag
Then the cp-cli command should abort
And the cp-cli output should contain "not found"
Scenario: Deleting with no checkpoint IDs aborts
Given a cp-cli mocked checkpoint service that can delete checkpoints
When I invoke cp-cli checkpoint-delete with no IDs
Then the cp-cli command should abort
And the cp-cli output should contain "At least one checkpoint ID is required"
Scenario: Cancelling deletion confirmation aborts
Given a cp-cli mocked checkpoint service that can delete checkpoints
When I invoke cp-cli checkpoint-delete "01ARZ3NDEKTSV4RRFFQ69G5FAV" and decline confirmation
Then the cp-cli command should abort
And the cp-cli output should contain "Deletion cancelled"