Files
cleveragents-core/features/project_context_cli.feature
HAL9000 388fc458c5 fix(cli): fix project context set JSON/YAML output structure (#6319)
Implemented spec-compliant JSON, YAML, plain, and rich outputs for `agents project context set`. Added BDD coverage verifying the new output structure across formats.\n\nISSUES CLOSED: #6319
2026-06-03 17:30:22 -04:00

130 lines
6.5 KiB
Gherkin

Feature: Project context CLI commands (B2.cli)
As a CleverAgents user
I want to manage project context policies via CLI commands
So that I can control what resources and files are visible per ACMS phase
Background:
Given a project context CLI in-memory database is initialized
And a project "local/ctx-app" exists for context CLI
# ── context set basic options ────────────────────────────────
Scenario: Set default view with include resources
When I run context set on "local/ctx-app" with view "default" and include-resource "db-*"
Then the context set command should succeed
And the stored policy default view should include resource "db-*"
Scenario: Set default view with exclude resources
When I run context set on "local/ctx-app" with view "default" and exclude-resource "db-test"
Then the context set command should succeed
And the stored policy default view should exclude resource "db-test"
Scenario: Set default view with include paths
When I run context set on "local/ctx-app" with view "default" and include-path "src/**/*.py"
Then the context set command should succeed
And the stored policy default view should include path "src/**/*.py"
Scenario: Set default view with exclude paths
When I run context set on "local/ctx-app" with view "default" and exclude-path "*.pyc"
Then the context set command should succeed
And the stored policy default view should exclude path "*.pyc"
Scenario: Set default view with max file size
When I run context set on "local/ctx-app" with view "default" and max-file-size 1048576
Then the context set command should succeed
And the stored policy default view max file size should be 1048576
Scenario: Set default view with max total size
When I run context set on "local/ctx-app" with view "default" and max-total-size 10485760
Then the context set command should succeed
And the stored policy default view max total size should be 10485760
Scenario: Set strategize view
When I run context set on "local/ctx-app" with view "strategize" and include-resource "cache-*"
Then the context set command should succeed
And the stored policy strategize view should include resource "cache-*"
Scenario: Set invalid view name fails
When I run context set on "local/ctx-app" with invalid view "bogus"
Then the context set command should fail
Scenario: Set view on nonexistent project fails
When I run context set on "local/no-such-project" with view "default" and include-resource "x"
Then the context set command should fail
# ── context set --clear ─────────────────────────────────────
Scenario: Clear a view resets it to inherit
Given I have set a strategize view on "local/ctx-app" with defaults
When I run context set on "local/ctx-app" with view "strategize" and clear flag
Then the context set command should succeed
And the stored policy strategize view should be None
# ── context show ─────────────────────────────────────────────
Scenario: Show displays the policy for a project
Given I have set a default view on "local/ctx-app" with include-resource "db-*"
When I run context show on "local/ctx-app" without options
Then the context show command should succeed
Scenario: Show with view displays resolved view
Given I have set a default view on "local/ctx-app" with include-resource "db-*"
When I run context show on "local/ctx-app" with view "default"
Then the context show command should succeed
Scenario: Show on nonexistent project fails
When I run context show on "local/nonexistent-proj" without options
Then the context show command should fail
# ── inspect now wired to ACMS tier service ─────────────────
Scenario: Inspect succeeds and shows tier state
When I run context inspect on "local/ctx-app"
Then the context inspect command should succeed
# ── simulate now wired to ACMS tier service ────────────────
Scenario: Simulate succeeds and shows assembly result
When I run context simulate on "local/ctx-app"
Then the context simulate command should succeed
# ── view inheritance ─────────────────────────────────────────
Scenario: Execute inherits from strategize when not overridden
Given I have set a strategize view on "local/ctx-app" with include-resource "strat-res"
When I run context show on "local/ctx-app" with view "execute"
Then the resolved view should include resource "strat-res"
Scenario: Apply inherits from execute when not overridden
Given I have set an execute view on "local/ctx-app" with include-resource "exec-res"
When I run context show on "local/ctx-app" with view "apply"
Then the resolved view should include resource "exec-res"
Scenario: Strategize inherits from default when not overridden
Given I have set a default view on "local/ctx-app" with include-resource "def-res"
When I run context show on "local/ctx-app" with view "strategize"
Then the resolved view should include resource "def-res"
# ── JSON format output ──────────────────────────────────────
Scenario: Show with JSON format returns valid JSON
Given I have set a default view on "local/ctx-app" with include-resource "db-*"
When I run context show on "local/ctx-app" with format "json"
Then the context show command should succeed
And the context output should be valid JSON
Scenario: Context set JSON output matches spec structure
When I run context set spec example on "local/ctx-app" with format "json"
Then the context set command should succeed
And the context set JSON output should match the spec envelope
Scenario: Context set YAML output matches spec structure
When I run context set spec example on "local/ctx-app" with format "yaml"
Then the context set command should succeed
And the context set YAML output should match the spec envelope
Scenario: Context set rich output matches spec presentation
When I run context set spec example on "local/ctx-app" with format "rich"
Then the context set command should succeed
And the context set rich output should include spec panels