ba8c424897
CI / lint (pull_request) Successful in 1m3s
CI / typecheck (pull_request) Successful in 1m24s
CI / quality (pull_request) Successful in 1m28s
CI / helm (pull_request) Successful in 1m10s
CI / build (pull_request) Successful in 1m16s
CI / security (pull_request) Successful in 1m42s
CI / push-validation (pull_request) Successful in 25s
CI / unit_tests (pull_request) Successful in 5m56s
CI / docker (pull_request) Successful in 1m41s
CI / integration_tests (pull_request) Successful in 16m43s
CI / coverage (pull_request) Successful in 12m47s
CI / status-check (pull_request) Successful in 3s
CI / lint (push) Successful in 40s
CI / helm (push) Successful in 1m2s
CI / typecheck (push) Successful in 1m10s
CI / quality (push) Successful in 1m18s
CI / build (push) Successful in 1m21s
CI / security (push) Successful in 2m20s
CI / push-validation (push) Successful in 26s
CI / e2e_tests (push) Successful in 57s
CI / unit_tests (push) Successful in 10m14s
CI / docker (push) Successful in 2m47s
CI / integration_tests (push) Successful in 16m51s
CI / coverage (push) Successful in 12m57s
CI / status-check (push) Successful in 4s
CI / benchmark-regression (push) Has started running
CI / benchmark-publish (push) Has been cancelled
Add a Behave scenario that adds an fs-directory resource at a seeded directory via the CLI. This exercises the if-children branch in resource_add (lines 857-887 of resource.py), including _short_resource_id, _format_child_status, and the Rich child table rendering — all previously uncovered because no existing scenario produced auto-discovered children through the resource add command path. ISSUES CLOSED: #6464
168 lines
7.0 KiB
Gherkin
168 lines
7.0 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 "Resource registered"
|
|
And the resource output should contain "Auto-discovered Children"
|
|
And the resource output should contain "local/my-repo"
|
|
|
|
Scenario: Add a git-checkout resource in JSON format
|
|
Given built-in types are bootstrapped
|
|
And the resource CLI output format is "json"
|
|
When I run resource add "git-checkout" "local/json-add" with path "/tmp/json-add"
|
|
Then the resource output should be valid JSON
|
|
And the resource JSON output should contain key "children"
|
|
And the resource JSON output should contain key "children_count"
|
|
|
|
Scenario: Add an fs-directory resource shows auto-discovered children in rich output
|
|
Given built-in types are bootstrapped
|
|
And a seeded directory exists at "/tmp/fs-dir-cli-add"
|
|
When I run resource add "fs-directory" "local/fs-dir-cli-add" with path "/tmp/fs-dir-cli-add"
|
|
Then the resource output should contain "Auto-discovered Children"
|
|
And the resource output should contain "child resource"
|
|
|
|
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"
|
|
|
|
Scenario: Resource add rolls back when auto discovery fails
|
|
Given built-in types are bootstrapped
|
|
And auto discovery will fail during resource registration
|
|
When I run resource add "git-checkout" "local/atomic-failure" with path "/tmp/atomic"
|
|
Then the resource command should fail
|
|
And the resource registry should not contain resource "local/atomic-failure"
|
|
|
|
# ---- 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"
|