2d423bdfcd
The `action create` CLI command was the only action subcommand missing the `--format`/`-f` parameter. All other action subcommands (`list`, `show`, `archive`) already accepted `--format` and routed through `_print_action()`. Running `action create --config action.yaml --format plain` failed with a Typer unrecognized-option error. Added the `fmt` parameter (with `--format`/`-f` aliases, defaulting to `rich`) to the `create()` function signature and passed it through to the existing `_print_action()` helper which already handles all output formats. Added Behave BDD scenarios for `--format plain` and `--format json` to `action_cli_spec_alignment.feature`. ISSUES CLOSED: #959
133 lines
5.9 KiB
Gherkin
133 lines
5.9 KiB
Gherkin
Feature: Action CLI spec alignment
|
|
As a developer
|
|
I want the action CLI commands aligned to the v3 spec
|
|
So that actions are created via config-only and legacy flags are rejected
|
|
|
|
Background:
|
|
Given a spec alignment CLI runner
|
|
And a spec alignment mocked lifecycle service
|
|
|
|
# Config-only create (valid YAML creates action)
|
|
Scenario: Config-only create with valid YAML creates action
|
|
Given a spec alignment valid config file
|
|
When I run spec alignment create with --config
|
|
Then the spec alignment create should succeed
|
|
And the spec alignment output should contain "Action Created"
|
|
And the spec alignment output should contain "Namespaced Name"
|
|
And the spec alignment output should contain "Short Name"
|
|
And the spec alignment output should contain "State"
|
|
|
|
# Config create with --format flag
|
|
Scenario: Config-only create with --format plain produces plain output
|
|
Given a spec alignment valid config file
|
|
When I run spec alignment create with --config and --format "plain"
|
|
Then the spec alignment create should succeed
|
|
And the spec alignment output should contain "local/spec-action"
|
|
|
|
Scenario: Config-only create with --format json produces JSON output
|
|
Given a spec alignment valid config file
|
|
When I run spec alignment create with --config and --format "json"
|
|
Then the spec alignment create should succeed
|
|
And the spec alignment output should contain "namespaced_name"
|
|
|
|
# Legacy flag rejection
|
|
Scenario: Legacy --name flag is rejected
|
|
When I run spec alignment create with legacy flag "--name" "local/test"
|
|
Then the spec alignment command should fail with unrecognized option
|
|
|
|
Scenario: Legacy --strategy-actor flag is rejected
|
|
When I run spec alignment create with legacy flag "--strategy-actor" "openai/gpt-4"
|
|
Then the spec alignment command should fail with unrecognized option
|
|
|
|
Scenario: Legacy --execution-actor flag is rejected
|
|
When I run spec alignment create with legacy flag "--execution-actor" "openai/gpt-4"
|
|
Then the spec alignment command should fail with unrecognized option
|
|
|
|
Scenario: Legacy --definition-of-done flag is rejected
|
|
When I run spec alignment create with legacy flag "--definition-of-done" "Test passes"
|
|
Then the spec alignment command should fail with unrecognized option
|
|
|
|
Scenario: Legacy --arg flag is rejected
|
|
When I run spec alignment create with legacy flag "--arg" "x:string:required"
|
|
Then the spec alignment command should fail with unrecognized option
|
|
|
|
# List filters
|
|
Scenario: List with --namespace filter
|
|
Given spec alignment actions exist
|
|
When I run spec alignment list with namespace "local"
|
|
Then the spec alignment list should show filtered results
|
|
And the spec alignment service list should use namespace "local"
|
|
|
|
Scenario: List with --state filter
|
|
Given spec alignment actions exist
|
|
When I run spec alignment list with state "available"
|
|
Then the spec alignment list should succeed
|
|
|
|
Scenario: List with regex filter
|
|
Given spec alignment actions exist
|
|
When I run spec alignment list with regex "action-a"
|
|
Then the spec alignment list should show filtered results
|
|
|
|
Scenario: List with invalid regex pattern
|
|
Given spec alignment actions exist
|
|
When I run spec alignment list with regex "[invalid"
|
|
Then the spec alignment command should abort
|
|
|
|
# Show by namespaced name
|
|
Scenario: Show by namespaced name
|
|
Given a spec alignment action exists with name "local/my-action"
|
|
When I run spec alignment show with name "local/my-action"
|
|
Then the spec alignment show should display details
|
|
And the spec alignment output should contain "Namespaced Name"
|
|
And the spec alignment output should contain "Short Name"
|
|
And the spec alignment output should contain "Definition of Done"
|
|
|
|
# Archive by namespaced name
|
|
Scenario: Archive by namespaced name
|
|
Given a spec alignment action exists for archive "local/my-action"
|
|
When I run spec alignment archive with name "local/my-action"
|
|
Then the spec alignment archive should succeed
|
|
|
|
# Invalid config file errors
|
|
Scenario: Missing config file produces error
|
|
When I run spec alignment create with missing config
|
|
Then the spec alignment command should abort
|
|
And the spec alignment output should contain "Config file error"
|
|
|
|
Scenario: Invalid YAML config produces schema error
|
|
Given a spec alignment invalid YAML config file
|
|
When I run spec alignment create with --config
|
|
Then the spec alignment command should abort
|
|
|
|
Scenario: Config with schema errors produces validation error
|
|
Given a spec alignment config with missing required fields
|
|
When I run spec alignment create with --config
|
|
Then the spec alignment command should abort
|
|
And the spec alignment output should contain "validation error"
|
|
|
|
# Show with long definition of done truncates to summary
|
|
Scenario: Show action with long definition of done
|
|
Given a spec alignment action with long definition of done
|
|
When I run spec alignment show with name "local/long-dod"
|
|
Then the spec alignment show should display details
|
|
And the spec alignment output should contain "..."
|
|
|
|
# List with long definition of done truncates to summary
|
|
Scenario: List with long definition of done
|
|
Given spec alignment actions with long definition of done
|
|
When I run spec alignment list all
|
|
Then the spec alignment list should succeed
|
|
And the spec alignment list output should contain truncated dod
|
|
|
|
# ValueError from config validation
|
|
Scenario: Config with ValueError from Action.from_config
|
|
Given a spec alignment config that triggers value error
|
|
When I run spec alignment create with --config
|
|
Then the spec alignment command should abort
|
|
And the spec alignment output should contain "config validation error"
|
|
|
|
# Available command removed
|
|
Scenario: Available subcommand no longer exists
|
|
When I run spec alignment available command
|
|
Then the spec alignment command should fail with unrecognized command
|