Files
cleveragents-core/features/resource_cli.feature
T
HAL9000 b8eab7c032
CI / push-validation (pull_request) Successful in 20s
CI / lint (pull_request) Successful in 38s
CI / build (pull_request) Successful in 31s
CI / helm (pull_request) Successful in 34s
CI / quality (pull_request) Successful in 59s
CI / typecheck (pull_request) Successful in 1m7s
CI / security (pull_request) Successful in 1m14s
CI / unit_tests (pull_request) Successful in 5m39s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 12m39s
CI / integration_tests (pull_request) Successful in 27m48s
CI / status-check (pull_request) Successful in 2s
fix(resources): delete executable.yaml, fix resource list columns, update docs
- Delete examples/resource-types/executable.yaml (orphaned artifact referencing
  non-existent ExecutableHandler; flagged in 4 prior reviews as blocking)
- Update agents resource list CLI columns from [ID, Name, Type, Status, Kind,
  Location, Description] to spec-required [Name, ID, Type, Phys/Virt, Children,
  Projects] per specification line 11051
- Lifecycle state for container resources now shown as a note below the table
- Update resource_list_lifecycle_state.feature to remove Status column header
  assertions; add spec-column header scenario
- Add BDD scenario in resource_cli.feature verifying new column headers
- Update CHANGELOG.md and CONTRIBUTORS.md

ISSUES CLOSED: #3077
2026-05-30 15:43:56 -04:00

145 lines
5.8 KiB
Gherkin

Feature: Resource CLI commands
As a CleverAgents user
I want to manage resources and resource types via the CLI
So that I can register, inspect, and remove resource types and instances
Background:
Given a fresh in-memory resource registry
# ---- Resource Type List ----
Scenario: List resource types shows built-in types after init
When I run resource type list
Then the resource output should contain "git-checkout"
And the resource output should contain "fs-directory"
@tdd_issue @tdd_issue_4261 @tdd_expected_fail
Scenario: List resource types in JSON format
Given built-in types are bootstrapped
When I run resource type list with format "json"
Then the resource output should be valid JSON
And the resource JSON output should contain key "name"
# ---- Resource Type Show ----
Scenario: Show a built-in resource type
Given built-in types are bootstrapped
When I run resource type show "git-checkout" using default format
Then the resource output should contain "git-checkout"
And the resource output should contain "physical"
Scenario: Show a non-existent resource type
When I run resource type show "nonexistent-type" using default format
Then the resource command should fail
And the resource output should contain "not found"
Scenario: Show resource type in JSON format
Given built-in types are bootstrapped
When I run resource type show "git-checkout" using format "json"
Then the resource output should be valid JSON
# ---- Resource Type Add ----
Scenario: Add a custom resource type from YAML
Given a valid custom resource type YAML file
When I run resource type add with the config file
Then the resource output should contain "Registered resource type"
Scenario: Add resource type with missing config file
When I run resource type add with a nonexistent config file
Then the resource command should fail
And the resource output should contain "not found"
# ---- Resource Type Remove ----
Scenario: Remove a custom resource type
Given a valid custom resource type YAML file
And I run resource type add with the config file
When I run resource type remove "test/custom-type" with yes flag
Then the resource output should contain "Removed resource type"
Scenario: Cannot remove a built-in resource type
Given built-in types are bootstrapped
When I run resource type remove "git-checkout" with yes flag
Then the resource command should fail
And the resource output should contain "Cannot remove built-in"
# ---- Resource Add ----
Scenario: Add a git-checkout resource
Given built-in types are bootstrapped
When I run resource add "git-checkout" "local/my-repo" with path "/tmp/repo"
Then the resource output should contain "Added resource"
And the resource output should contain "local/my-repo"
Scenario: Add a resource with non-existent type
When I run resource add "nonexistent" "local/test" with path "/tmp"
Then the resource command should fail
And the resource output should contain "not found"
# ---- Resource List ----
Scenario: List resources when empty
When I run resource list
Then the resource output should contain "No resources found"
Scenario: List resources after adding one
Given built-in types are bootstrapped
And I run resource add "git-checkout" "local/my-repo" with path "/tmp/repo"
When I run resource list
Then the resource output should contain "local/my-repo"
And the resource output should contain "git-checkout"
Scenario: List resources filtered by type
Given built-in types are bootstrapped
And I run resource add "git-checkout" "local/my-repo" with path "/tmp/repo"
When I run resource list with type filter "git-checkout"
Then the resource output should contain "local/my-repo"
Scenario: List resources in JSON format
Given built-in types are bootstrapped
And I run resource add "git-checkout" "local/test-res" with path "/tmp/test"
When I run resource list with format "json"
Then the resource output should be valid JSON
Scenario: List resources shows spec-required columns
Given built-in types are bootstrapped
And I run resource add "git-checkout" "local/col-test" with path "/tmp/ctest"
When I run resource list
Then the resource output should contain "Phys/Virt"
And the resource output should contain "Children"
And the resource output should contain "Projects"
# ---- Resource Show ----
Scenario: Show a resource by name
Given built-in types are bootstrapped
And I run resource add "git-checkout" "local/show-test" with path "/tmp/show"
When I run resource show "local/show-test" using default format
Then the resource output should contain "local/show-test"
And the resource output should contain "git-checkout"
Scenario: Show a non-existent resource
When I run resource show "nonexistent-resource" using default format
Then the resource command should fail
And the resource output should contain "not found"
Scenario: Show resource in JSON format
Given built-in types are bootstrapped
And I run resource add "git-checkout" "local/json-res" with path "/tmp/json"
When I run resource show "local/json-res" using format "json"
Then the resource output should be valid JSON
# ---- Resource Remove ----
Scenario: Remove a resource
Given built-in types are bootstrapped
And I run resource add "git-checkout" "local/remove-me" with path "/tmp/rm"
When I run resource remove "local/remove-me" with yes flag
Then the resource output should contain "Removed resource"
Scenario: Remove a non-existent resource
When I run resource remove "nonexistent" with yes flag
Then the resource command should fail
And the resource output should contain "not found"