Files
cleveragents-core/features/actor_context_cmds.feature
T
HAL9000 65f1c40533
CI / status-check (push) Blocked by required conditions
CI / benchmark-regression (push) Has been skipped
CI / lint (push) Successful in 48s
CI / typecheck (push) Successful in 1m7s
CI / helm (push) Successful in 32s
CI / push-validation (push) Successful in 34s
CI / quality (push) Successful in 57s
CI / build (push) Successful in 41s
CI / security (push) Successful in 1m15s
CI / integration_tests (push) Successful in 3m41s
CI / e2e_tests (push) Successful in 3m48s
CI / unit_tests (push) Successful in 4m36s
CI / coverage (push) Has started running
CI / docker (push) Successful in 2m18s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 1m21s
CI / benchmark-publish (push) Has been cancelled
CI / build (pull_request) Successful in 47s
CI / unit_tests (pull_request) Successful in 9m25s
CI / e2e_tests (pull_request) Successful in 4m36s
CI / push-validation (pull_request) Successful in 30s
CI / helm (pull_request) Successful in 35s
CI / integration_tests (pull_request) Successful in 3m38s
CI / lint (pull_request) Successful in 45s
CI / typecheck (pull_request) Successful in 1m17s
CI / quality (pull_request) Successful in 1m37s
CI / security (pull_request) Successful in 2m9s
CI / status-check (pull_request) Failing after 4s
CI / coverage (pull_request) Failing after 40s
CI / docker (pull_request) Successful in 1m59s
fix(cli): resolve review blockers for actor context clear command (#6370)
2026-05-05 01:33:31 +00:00

138 lines
6.5 KiB
Gherkin

Feature: Actor context clear, remove, export, and import commands
As a CleverAgents user
I want to manage actor contexts via the CLI
So that I can remove, export, and import conversation contexts
Background:
Given a temporary context directory for actor context tests
# ── context clear ─────────────────────────────────────────
Scenario: Clear a named actor context
Given an actor context named "docs" exists with messages
When I run actor context clear "docs" with --yes
Then the actor context clear command should succeed
And the context "docs" should exist
And the context "docs" should be empty
Scenario: Clear all actor contexts
Given an actor context named "docs" exists with messages
And an actor context named "notes" exists with messages
When I run actor context clear --all with --yes
Then the actor context clear command should succeed
And all actor contexts should be empty
Scenario: Clear non-existent context fails
When I run actor context clear "ghost" with --yes
Then the actor context clear command should fail with exit code 1
Scenario: Clear requires NAME or --all
When I run actor context clear without name or all
Then the actor context clear command should fail with exit code 1
Scenario: Clear rejects NAME with --all
When I run actor context clear "docs" with --all
Then the actor context clear command should fail with exit code 1
Scenario: Clear outputs JSON format
Given an actor context named "docs" exists with messages
When I run actor context clear "docs" with --yes and format "json"
Then the actor context clear command should succeed
And the output should contain valid JSON with key "context_cleared"
And the output JSON key "context_cleared" should contain keys "items, storage"
And the output should contain valid JSON with key "retention"
And the output JSON key "retention" should contain keys "context, files"
# ── context remove ─────────────────────────────────────────
Scenario: Remove a named actor context
Given an actor context named "docs" exists
When I run actor context remove "docs" with --yes
Then the actor context remove command should succeed
And the context "docs" should no longer exist
Scenario: Remove all actor contexts
Given an actor context named "docs" exists
And an actor context named "notes" exists
When I run actor context remove --all with --yes
Then the actor context remove command should succeed
And no actor contexts should remain
Scenario: Remove non-existent context fails
When I run actor context remove "nonexistent" with --yes
Then the actor context remove command should fail with exit code 1
Scenario: Remove requires NAME or --all
When I run actor context remove without name or all
Then the actor context remove command should fail with exit code 1
Scenario: Remove rejects NAME with --all
When I run actor context remove "docs" with --all
Then the actor context remove command should fail with exit code 1
Scenario: Remove outputs JSON format
Given an actor context named "docs" exists
When I run actor context remove "docs" with --yes and format "json"
Then the actor context remove command should succeed
And the output should contain valid JSON with key "context_removed"
# ── context export ─────────────────────────────────────────
Scenario: Export a named actor context to JSON
Given an actor context named "docs" exists with messages
When I run actor context export "docs" to a JSON file
Then the actor context export command should succeed
And the exported file should exist and contain valid JSON
And the exported JSON should contain key "messages"
Scenario: Export a named actor context to YAML
Given an actor context named "docs" exists with messages
When I run actor context export "docs" to a YAML file
Then the actor context export command should succeed
And the exported YAML file should exist and be valid
Scenario: Export non-existent context fails
When I run actor context export "nonexistent" to a JSON file
Then the actor context export command should fail with exit code 1
Scenario: Export outputs JSON format metadata
Given an actor context named "docs" exists with messages
When I run actor context export "docs" to a JSON file with format "json"
Then the actor context export command should succeed
And the output should contain valid JSON with key "context_export"
# ── context import ─────────────────────────────────────────
Scenario: Import a context from a JSON file
Given a valid context JSON file named "imported-ctx.json"
When I run actor context import from that file as "imported-ctx"
Then the actor context import command should succeed
And the context "imported-ctx" should exist
Scenario: Import infers name from file metadata
Given a valid context JSON file with context_name "auto-named"
When I run actor context import from that file without a name
Then the actor context import command should succeed
And the context "auto-named" should exist
Scenario: Import refuses to overwrite without --update
Given an actor context named "existing" exists
And a valid context JSON file named "existing.json"
When I run actor context import from that file as "existing" without update
Then the actor context import command should fail with exit code 1
Scenario: Import with --update replaces existing context
Given an actor context named "existing" exists
And a valid context JSON file named "existing.json"
When I run actor context import from that file as "existing" with --update
Then the actor context import command should succeed
And the context "existing" should exist
Scenario: Export then import round-trip preserves data
Given an actor context named "roundtrip" exists with messages
When I export the context "roundtrip" to a JSON file
And I remove the context "roundtrip"
And I import the context from that JSON file as "roundtrip"
Then the context "roundtrip" should exist
And the imported context should have the same messages as the original