Files
temp/features/resource_list_lifecycle_state.feature
freemo 2637b272dd feat(cli): add devcontainer lifecycle state column to agents resource list output
Add a 'State' column to the 'agents resource list' rich table output that
shows the current lifecycle state for devcontainer-instance and
container-instance resources. For newly-discovered devcontainers the state
displays as 'detected (not built)'; running, stopped, and failed states are
also shown.

Changes:
- Add _get_lifecycle_state_str() helper that queries get_lifecycle_tracker()
  for container resource types and returns a human-readable state string
- Add 'State' column to the rich table in resource_list()
- Show warning banner '⚠ Devcontainer detected at ...' for resources in
  the detected state, matching the spec output for agents resource add
- Update _resource_dict() to include 'lifecycle_state' field in JSON/YAML
  output (null for non-container resources)
- Add BDD feature file and step definitions covering all lifecycle states,
  warning banner behaviour, and JSON output

ISSUES CLOSED: #2596
2026-04-05 18:13:11 +00:00

79 lines
3.8 KiB
Gherkin

Feature: agents resource list shows devcontainer lifecycle state column
As a CleverAgents user
I want the resource list to show the lifecycle state for devcontainer-instance resources
So that I can see whether a devcontainer is detected, running, stopped, or failed
Background:
Given a fresh in-memory resource registry
And built-in types are bootstrapped
Scenario: resource list shows "Status" column header
Given a devcontainer-instance resource is registered
When I run resource list with all flag
Then the resource output should contain "Status"
Scenario: resource list shows "detected (not built)" for a new devcontainer-instance
Given a devcontainer-instance resource is registered
When I run resource list with all flag
Then the resource output should contain "detected (not built)"
Scenario: resource list shows "running" state for a running devcontainer
Given a devcontainer-instance resource is registered
And the devcontainer lifecycle state is "running"
When I run resource list with all flag
Then the resource output should contain "running"
Scenario: resource list shows "stopped" state for a stopped devcontainer
Given a devcontainer-instance resource is registered
And the devcontainer lifecycle state is "stopped"
When I run resource list with all flag
Then the resource output should contain "stopped"
Scenario: resource list shows "failed" state for a failed devcontainer
Given a devcontainer-instance resource is registered
And the devcontainer lifecycle state is "failed"
When I run resource list with all flag
Then the resource output should contain "failed"
Scenario: resource list shows empty state for non-container resources
Given 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: resource list shows warning banner when devcontainer is in detected state
Given a devcontainer-instance resource is registered
When I run resource list with all flag
Then the resource output should contain "Devcontainer detected"
Scenario: resource list does not show warning banner when devcontainer is running
Given a devcontainer-instance resource is registered
And the devcontainer lifecycle state is "running"
When I run resource list with all flag
Then the resource output should not contain "Devcontainer detected"
Scenario: resource list JSON output includes lifecycle_state for devcontainer-instance
Given a devcontainer-instance resource is registered
When I run resource list with all flag and format "json"
Then the resource output should be valid JSON
And the resource JSON output should contain key "lifecycle_state"
Scenario: resource list JSON output has null lifecycle_state for non-container resources
Given I run resource add "git-checkout" "local/my-repo" with path "/tmp/repo"
When I run resource list with format "json"
Then the resource output should be valid JSON
And the resource JSON lifecycle_state should be null for non-container resources
Scenario: resource list shows lifecycle state for container-instance resources
Given a container-instance resource is registered
When I run resource list with all flag
Then the resource output should contain "Status"
And the resource output should contain "detected (not built)"
Scenario: resource list succeeds gracefully when lifecycle tracker raises an error
Given a devcontainer-instance resource is registered
And the lifecycle tracker raises an error for the resource
When I run resource list with all flag
Then the resource list command should succeed
And the resource output should contain "devcontainer-instance"