Files
cleveragents-core/features/resource_cli.feature
freemo 64cfdc782a
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 51s
CI / unit_tests (pull_request) Successful in 2m20s
CI / docker (pull_request) Successful in 38s
CI / integration_tests (pull_request) Successful in 3m12s
CI / coverage (pull_request) Successful in 4m30s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 15s
CI / security (push) Successful in 32s
CI / typecheck (push) Successful in 34s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 3m45s
CI / docker (push) Successful in 41s
CI / integration_tests (push) Successful in 4m34s
CI / coverage (push) Successful in 4m36s
CI / benchmark-publish (push) Successful in 16m13s
CI / benchmark-regression (pull_request) Successful in 28m59s
fix(resource): call bootstrap_builtin_types during initialization
Add a call to bootstrap_builtin_types() in init_command() (project.py)
immediately after initialize_project() returns.  This seeds the built-in
resource types (fs-directory, git-checkout, etc.) into the database so
that "resource add" commands succeed without "Resource type not found"
errors.

The call is idempotent — invoking it multiple times will not create
duplicate types.

Also fix the TDD robot test (resource_type_bootstrap_git.robot) to
initialize a project before running "resource add", and fix a
pre-existing parallel test failure in plan_commands_new_coverage where
unittest.mock.patch could not reliably intercept PlanApplyService under
behave-parallel fork() workers.

ISSUES CLOSED: #523, #524
2026-03-07 19:36:09 +00:00

136 lines
5.4 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"
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"