Files
cleveragents-core/features/config_cli.feature
T
freemo 0cff709531 fix(cli): add missing Origin panel, Overridden field, Winner indicator, and JSON envelope in config get output
Implements all spec-required output for `agents config get`:

Rich output:
- Rename panel title from 'Configuration Value' to 'Config' per spec
- Add 'Overridden' field to the Config panel
- Add 'Origin' panel showing File, Line, and Default fields
- Add 'Resolution Chain' panel (always shown, not just with --verbose)
- Add 'Winner' indicator to the Resolution Chain panel
- Use spec-required type strings (string/boolean/integer) instead of
  Python type names (str/bool/int)
- Add '✓ OK Config read' confirmation message

JSON output:
- Wrap result in standard envelope (command, status, exit_code, data,
  timing, messages)
- Add 'overridden' field to data
- Add 'origin' nested object (file, line, default)
- Add 'winner' nested object (source, level)
- Use human-readable source names (CLI flag, Env var, Config file,
  Default) instead of internal enum values
- Add 'started' timestamp to timing

BDD:
- Add features/config_get_spec_output.feature with 20 scenarios
  covering all Rich panels and JSON envelope fields
- Update existing tests to match new spec-compliant output

ISSUES CLOSED: #3423
2026-06-01 23:37:30 -04:00

100 lines
3.5 KiB
Gherkin

Feature: Config CLI commands
As a developer
I want to manage configuration via CLI
So that I can set, get, and list runtime configuration values
Background:
Given a clean config CLI test environment
# --- SET ---
Scenario: Set a configuration value
When I run config set "core.log.level" "DEBUG"
Then the config set should succeed
And the config set output should contain key "core.log.level"
And the config set output should contain value "DEBUG"
Scenario: Set a configuration value with underscore normalization
When I run config set "core_log_level" "INFO"
Then the config set should succeed
And the config set output should contain key "core.log.level"
Scenario: Set an unknown key fails
When I run config set "nonexistent_key" "value"
Then the config set should fail with unknown key error
# --- GET ---
Scenario: Get a configuration value
When I run config get "core.log.level" with verbose
Then the config get should succeed
And the config get output should contain key "core.log.level"
And the config get output should show the resolution chain
Scenario: Get a value after setting it
Given I have set config "core.log.level" to "WARNING"
When I run config get "core.log.level"
Then the config get should succeed
Scenario: Get with underscore alias
When I run config get "plan_concurrency"
Then the config get should succeed
And the config get output should contain key "plan.concurrency"
Scenario: Get an unknown key fails
When I run config get "totally_bogus_key"
Then the config get should fail with unknown key error
# --- LIST ---
Scenario: List all configuration values
When I run config list
Then the config list should succeed
And the config list output should contain multiple settings
Scenario: List with key regex filter
When I run config list "core\.log.*"
Then the config list should succeed
And every listed key should match "core\.log.*"
Scenario: List with value regex filter
When I run config list with --filter-values "FATAL"
Then the config list should succeed
Scenario: List with invalid key regex fails
When I run config list with invalid regex "[invalid"
Then the config list should fail with regex error
Scenario: List with invalid value regex fails
When I run config list with invalid value regex "[bad"
Then the config list should fail with regex error
# --- SECRET MASKING ---
Scenario: Secret values are masked by default
When I run config list
Then secret keys should show masked values
Scenario: Show-secrets reveals secret values
When I run config list with --show-secrets
Then secret keys should show actual values
# --- RESOLUTION CHAIN ---
Scenario: Resolution chain shows default source
When I run config get key "core.log.level" formatted as "json"
Then the resolution chain should include "Default" source
# --- SET/GET ROUNDTRIP ---
Scenario: Set and get roundtrip
Given I have set config "core.log.file-enabled" to "true"
When I run config get key "core.log.file-enabled" formatted as "json"
Then the config get should succeed
And the get value source should be "config"
# --- FORMAT ---
Scenario: Config list with JSON format
When I run config list with format "json"
Then the config list should succeed
And the output should be valid JSON
Scenario: Config get with JSON format
When I run config get key "core.format" formatted as "json"
Then the config get should succeed
And the output should be valid JSON