Files
cleveragents-core/features/resource_cli.feature
T
Jeffrey Phillips Freeman f7d2f63ab8
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 28s
CI / security (pull_request) Successful in 23s
CI / quality (pull_request) Successful in 15s
CI / integration_tests (pull_request) Successful in 5m11s
CI / build (pull_request) Successful in 16s
CI / unit_tests (pull_request) Successful in 14m31s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 8m18s
CI / lint (push) Successful in 13s
CI / typecheck (push) Successful in 28s
CI / security (push) Successful in 23s
CI / quality (push) Successful in 16s
CI / integration_tests (push) Successful in 4m58s
CI / build (push) Successful in 15s
CI / unit_tests (push) Successful in 15m30s
CI / coverage (push) Has been cancelled
CI / docker (push) Has been cancelled
feat(cli): add resource commands (core)
2026-02-16 16:46:54 -05:00

141 lines
5.5 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 when empty
When I run resource type list
Then the resource output should contain "No resource types registered"
Scenario: List resource types after bootstrap
Given built-in types are bootstrapped
When I run resource type list
Then the resource output should contain "git-checkout"
And the resource output should contain "fs-directory"
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
# ---- 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"