Files
cleveragents-core/features/lsp_cli_new_coverage.feature
freemo 41ca082022
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Failing after 13s
CI / quality (pull_request) Successful in 17s
CI / build (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 34s
CI / security (pull_request) Successful in 33s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 2m31s
CI / unit_tests (pull_request) Successful in 6m43s
CI / docker (pull_request) Has been skipped
Tests: Improved coverage to get us back above 97%
2026-02-22 15:29:41 -05:00

174 lines
7.2 KiB
Gherkin

@phase2 @domain @lsp @lsp_cli @lsp_cli_new_coverage
Feature: LSP CLI commands coverage
As a developer managing LSP server registrations
I want the LSP CLI commands (add, remove, list, show) to work correctly
So that I can register, inspect, and manage language servers from the command line
Background:
Given a clean LSP CLI test environment
# ---------------------------------------------------------------------------
# lsp add
# ---------------------------------------------------------------------------
@lsp_cli_add
Scenario: Add LSP server with valid YAML config
Given a valid LSP server YAML config file
When I run lsp CLI add with --config pointing to the YAML file
Then the lsp CLI command should succeed
And the lsp CLI output should contain "LSP Server Registered"
@lsp_cli_add @error_handling
Scenario: Add LSP server with non-existent config file
When I run lsp CLI add with --config pointing to a non-existent file
Then the lsp CLI command should abort
And the lsp CLI output should contain "not found"
@lsp_cli_add @error_handling
Scenario: Add LSP server with invalid YAML that is not a mapping
Given a YAML config file containing a list instead of a mapping
When I run lsp CLI add with --config pointing to the invalid YAML file
Then the lsp CLI command should abort
And the lsp CLI output should contain "Schema validation error"
@lsp_cli_add
Scenario: Add LSP server with --update flag overwrites existing
Given a valid LSP server YAML config file
And the LSP server has been registered via CLI
When I run lsp CLI add with --config and --update
Then the lsp CLI command should succeed
And the lsp CLI output should contain "LSP Server Registered"
@lsp_cli_add
Scenario: Add LSP server with --format json
Given a valid LSP server YAML config file
When I run lsp CLI add with --config and --format json
Then the lsp CLI command should succeed
And the lsp CLI output should contain "registered"
@lsp_cli_add @error_handling
Scenario: Add duplicate LSP server without --update is rejected
Given a valid LSP server YAML config file
And the LSP server has been registered via CLI
When I run lsp CLI add with --config without --update
Then the lsp CLI command should abort
And the lsp CLI output should contain "already registered"
@lsp_cli_add @error_handling
Scenario: Add LSP server with schema validation error from Pydantic
Given a YAML config file with invalid schema fields
When I run lsp CLI add with --config pointing to the bad schema YAML file
Then the lsp CLI command should abort
And the lsp CLI output should contain "Schema validation error"
# ---------------------------------------------------------------------------
# lsp remove
# ---------------------------------------------------------------------------
@lsp_cli_remove
Scenario: Remove a registered LSP server with --yes
Given a valid LSP server YAML config file
And the LSP server has been registered via CLI
When I run lsp CLI remove with name "local/test-lsp" and --yes
Then the lsp CLI command should succeed
And the lsp CLI output should contain "LSP Server Removed"
@lsp_cli_remove @error_handling
Scenario: Remove an unknown LSP server returns not found error
When I run lsp CLI remove with name "local/nonexistent" and --yes
Then the lsp CLI command should abort
And the lsp CLI output should contain "not found"
@lsp_cli_remove
Scenario: Remove a registered LSP server with --format json
Given a valid LSP server YAML config file
And the LSP server has been registered via CLI
When I run lsp CLI remove with name "local/test-lsp" and --yes and --format json
Then the lsp CLI command should succeed
And the lsp CLI output should contain "removed"
# ---------------------------------------------------------------------------
# lsp list
# ---------------------------------------------------------------------------
@lsp_cli_list
Scenario: List LSP servers when servers are registered
Given multiple LSP servers have been registered via CLI
When I run lsp CLI list
Then the lsp CLI command should succeed
And the lsp CLI output should contain "LSP Servers"
And the lsp CLI output should contain "listed"
@lsp_cli_list
Scenario: List LSP servers when no servers are registered
When I run lsp CLI list
Then the lsp CLI command should succeed
And the lsp CLI output should contain "No LSP servers found"
@lsp_cli_list
Scenario: List LSP servers filtered by namespace
Given multiple LSP servers have been registered via CLI
When I run lsp CLI list with --namespace "local"
Then the lsp CLI command should succeed
And the lsp CLI output should contain "local/test-lsp"
And the lsp CLI output should not contain "devops/clangd"
@lsp_cli_list
Scenario: List LSP servers with --format json
Given multiple LSP servers have been registered via CLI
When I run lsp CLI list with --format json
Then the lsp CLI command should succeed
And the lsp CLI output should be valid JSON
@lsp_cli_list
Scenario: List LSP servers filtered by language
Given multiple LSP servers have been registered via CLI
When I run lsp CLI list with --language "python"
Then the lsp CLI command should succeed
And the lsp CLI output should contain "local/test-lsp"
# ---------------------------------------------------------------------------
# lsp show
# ---------------------------------------------------------------------------
@lsp_cli_show
Scenario: Show details for a registered LSP server
Given a valid LSP server YAML config file
And the LSP server has been registered via CLI
When I run lsp CLI show with name "local/test-lsp"
Then the lsp CLI command should succeed
And the lsp CLI output should contain "LSP Server Details"
And the lsp CLI output should contain "local/test-lsp"
@lsp_cli_show @error_handling
Scenario: Show details for an unknown LSP server returns error
When I run lsp CLI show with name "local/nonexistent"
Then the lsp CLI command should abort
And the lsp CLI output should contain "not found"
@lsp_cli_show
Scenario: Show LSP server with --format json
Given a valid LSP server YAML config file
And the LSP server has been registered via CLI
When I run lsp CLI show with name "local/test-lsp" and --format json
Then the lsp CLI command should succeed
And the lsp CLI output should contain "local/test-lsp"
@lsp_cli_show
Scenario: Show LSP server displays environment variables when present
Given a valid LSP server YAML config file with env vars
And the LSP server with env has been registered via CLI
When I run lsp CLI show with name "local/test-lsp-env"
Then the lsp CLI command should succeed
And the lsp CLI output should contain "Environment"
# ---------------------------------------------------------------------------
# Helper functions
# ---------------------------------------------------------------------------
@lsp_cli_helpers
Scenario: Reset and get registry helpers work correctly
When I call _reset_registry and then _get_registry
Then a new LspRegistry instance should be returned
And the new registry should be empty