Files
cleveragents-core/features/plan_cli_v3_only.feature
CoreRasurae cc24d8c8ac fix(cli): remove legacy plan commands from help output
Completely removed all legacy plan commands from the CLI:
    - Removed tell, build, new, current, cd, continue CLI commands
    - Removed programmatic wrapper functions (tell_command, build_command, etc.)
    - Removed legacy deprecation message
    - Updated help text to indicate V3 Plan Lifecycle exclusively
    - Removed stale references to tell/build in help output and command validation

    Removes the legacy 'tell' and 'build' CLI shortcuts from main.py:
    - Removed echo lines advertising tell/build commands
    - Removed tell/build from valid_cmds list
    - Removed tell/build from _LIGHTWEIGHT_COMMANDS frozenset
    - These dead entries were preventing helpful error messages

    Test infrastructure improvements:
    - Event bus exception test: Patch the module-level logger during emit() so that
      structlog.testing.capture_logs() can capture the logs. Without patching, the
      module-level logger created at import time is not captured by the context manager.
    - Session create/list commands: Suppress cleveragents.mcp logger to CRITICAL level
      during JSON/YAML output formatting to prevent health check warnings with ANSI codes
      from being written to stdout before JSON output, which breaks JSON parsing.
    - Extended plan_cli_coverage_boost with scenarios for estimation_result,
      invariants, execution_environment, validation_summary, and checkpoint
      coverage in _plan_spec_dict

    Documentation:
    - Created docs/Legacy_to_V3_Guide.md with comprehensive migration instructions
    - Updated CONTRIBUTING.md to document removal of legacy workflow
    - Updated CHANGELOG.md to reference issue #4181 instead of PR #10800

ISSUES CLOSED: #4181
2026-05-05 02:01:49 +00:00

232 lines
10 KiB
Gherkin

Feature: Plan CLI supports only V3 commands (legacy commands removed)
Background:
Given CLI environment is ready for plan command tests
Scenario: Help output shows only V3 commands
When I invoke "--help" on plan app
Then the help contains "use"
And the help contains "execute"
And the help contains "apply"
And the help contains "status"
And the help contains "list"
And the help contains "errors"
Scenario: V3 command group is clearly labeled
When I invoke "--help" on plan app
Then the help contains "V3"
And the help contains "Plan Lifecycle"
Scenario: Legacy command tell is not available
When I invoke "tell --help" on plan app
Then the command fails with exit code non-zero
Scenario: Legacy command build is not available
When I invoke "build --help" on plan app
Then the command fails with exit code non-zero
Scenario: Legacy command new is not available
When I invoke "new --help" on plan app
Then the command fails with exit code non-zero
Scenario: Legacy command current is not available
When I invoke "current --help" on plan app
Then the command fails with exit code non-zero
Scenario: Legacy command cd is not available
When I invoke "cd --help" on plan app
Then the command fails with exit code non-zero
Scenario: Legacy command continue is not available
When I invoke "continue --help" on plan app
Then the command fails with exit code non-zero
Scenario: CLI runner initialization preserves state across commands
When I invoke "--help" on plan app
And I invoke "--help" on plan app again
Then both invocations should have consistent help output
And the context should not leak state between invocations
Scenario: CLI environment handles missing subcommand gracefully
When I invoke "" on plan app
Then the command fails with exit code non-zero
And the output contains help information
Scenario: V3 commands are correctly registered in app
When I invoke "--help" on plan app
Then the help output should contain complete command list
And the help output should not contain deprecated command references
Scenario: CLI resource cleanup after failed commands
Given CLI environment is ready for plan command tests
When I invoke "nonexistent-command" on plan app
Then the command fails with exit code non-zero
And the CLI runner should be in a valid state for next command
When I invoke "--help" on plan app
Then the help output should be available
Scenario: Repeated command invocations maintain consistency
Given CLI environment is ready for plan command tests
When I invoke "--help" on plan app
And I invoke "--help" on plan app again
When I invoke "--help" on plan app again
Then all invocations should have identical output
And the context state should remain clean
Scenario: Failed command does not corrupt context state
Given CLI environment is ready for plan command tests
When I invoke "--help" on plan app
And I save the help output for comparison
And I invoke "invalid-plan-id" on plan app
Then the command fails with exit code non-zero
When I invoke "--help" on plan app
Then the help output should match the saved output
Scenario: ULID validation rejects legacy plan names
When I validate plan ID "my-legacy-plan" as ULID
Then validation should fail with legacy workflow message
Scenario: ULID validation accepts valid ULID identifiers
When I validate plan ID "01HXM8C2ZK4Q7C2B3F2R4VYV6J" as ULID
Then validation should succeed with original plan ID returned
Scenario: Actor name validation requires namespace/name format
When I validate actor name "invalid-actor" as namespaced
Then validation should fail with actor format message
Scenario: Actor name validation accepts openai/gpt-4 format
When I validate actor name "openai/gpt-4" as namespaced
Then validation should succeed with original actor name returned
Scenario: Actor name validation accepts local/custom-actor format
When I validate actor name "local/custom-actor" as namespaced
Then validation should succeed with original actor name returned
Scenario: Relative time formatting shows current timestamp as "just now"
When I format current timestamp as relative time
Then formatted time should be "just now"
Scenario: Relative time formatting shows hours ago correctly
When I format timestamp from 3 hours ago as relative time
Then formatted time should contain "hour"
And formatted time should contain "ago"
Scenario: Relative time formatting shows days ago correctly
When I format timestamp from 5 days ago as relative time
Then formatted time should contain "day"
And formatted time should contain "ago"
Scenario: Multiple validation errors maintain CLI runner state
When I invoke an invalid plan command "execute not-a-ulid"
Then the command should fail
And I invoke another invalid command "apply another-invalid"
Then that command should also fail
And the CLI runner should remain functional
Scenario: Decision label generation for root decisions
When I generate decision label for type "prompt_definition" with ordinal 0
Then the label should be "Root"
Scenario: Decision label generation for strategy choices
When I generate decision label for type "strategy_choice" with ordinal 0
Then the label should be "Strategy"
Scenario: Decision label generation for invariant decisions
When I generate decision label for type "invariant_enforced" with ordinal 1
Then the label should be "Invariant 1"
Scenario: Decision label generation for multiple invariants
When I generate decision label for type "invariant_enforced" with ordinal 3
Then the label should be "Invariant 3"
Scenario: Decision label generation for subplan spawning
When I generate decision label for type "subplan_spawn" with ordinal 1
Then the label should be "Spawn 1"
Scenario: Decision label generation for parallel subplan spawning
When I generate decision label for type "subplan_parallel_spawn" with ordinal 2
Then the label should be "Parallel 2"
Scenario: Decision label generation for implementation choices
When I generate decision label for type "implementation_choice" with ordinal 0
Then the label should be "Implementation"
Scenario: Decision label generation for unknown decision types
When I generate decision label for type "unknown_type" with ordinal 0
Then the label should be "unknown_type"
Scenario: ULID validation rejects empty string
When I validate plan ID "" as ULID
Then validation should fail with legacy workflow message
Scenario: ULID validation rejects whitespace-only string
When I validate plan ID " " as ULID
Then validation should fail with legacy workflow message
Scenario: ULID validation rejects too-short identifiers
When I validate plan ID "01HXM8C" as ULID
Then validation should fail with legacy workflow message
Scenario: ULID validation rejects identifiers with invalid characters
When I validate plan ID "01HXM8C2ZK4Q7C2B3F2R4VYV6@" as ULID
Then validation should fail with legacy workflow message
Scenario: Actor name validation rejects empty string
When I validate actor name "" as namespaced
Then validation should fail with actor format message
Scenario: Actor name validation rejects name with only slash
When I validate actor name "/" as namespaced
Then validation should fail with actor format message
Scenario: Actor name validation rejects uppercase in namespace
When I validate actor name "OpenAI/gpt-4" as namespaced
Then validation should fail with actor format message
Scenario: Actor name validation rejects spaces in actor name
When I validate actor name "openai/gpt 4" as namespaced
Then validation should fail with actor format message
Scenario: Relative time formatting handles 1 minute ago
When I format timestamp from 1 minute ago as relative time
Then formatted time should be "1 minute ago"
Scenario: Relative time formatting handles 2 minutes ago
When I format timestamp from 2 minutes ago as relative time
Then formatted time should be "2 minutes ago"
Scenario: Relative time formatting handles 1 hour ago
When I format timestamp from 1 hour ago as relative time
Then formatted time should be "1 hour ago"
Scenario: Relative time formatting handles 2 hours ago
When I format timestamp from 2 hours ago as relative time
Then formatted time should be "2 hours ago"
Scenario: Relative time formatting handles 1 day ago
When I format timestamp from 1 day ago as relative time
Then formatted time should be "1 day ago"
Scenario: Relative time formatting handles 2 days ago
When I format timestamp from 2 days ago as relative time
Then formatted time should be "2 days ago"
Scenario: Relative time formatting handles very old timestamps
When I format timestamp from 365 days ago as relative time
Then formatted time should contain "365"
And formatted time should contain "day"
Scenario: ULID validation provides helpful error message for human-readable names
When I validate plan ID "my-plan" as ULID
Then validation error should mention "v3 plan lifecycle"
And validation error should mention "ULID"
Scenario: Actor validation provides helpful error message format requirements
When I validate actor name "missing-slash" as namespaced
Then validation error should mention "namespace/name"
Scenario: CLI runner state after consecutive failed validations
When I attempt multiple actor validations
Then all validations should fail appropriately
And the validation context should remain clean