be69a49eff
CI / security (push) Has been cancelled
CI / quality (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / build (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / docker (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / helm (push) Has been cancelled
CI / unit_tests (push) Has been cancelled
Add the missing `-u` short-form alias for the `--update` option on the
`lsp add` command, aligning the implementation with the specification
(spec line 8645: `agents lsp add [--update|-u] (--config|-c) <FILE>`).
The Typer option declaration in `lsp.py` now includes `"-u"` alongside
`"--update"`. A new Behave scenario ("Add LSP server with -u short form
overwrites existing") and its step definition verify the short form works
end-to-end through the CLI runner.
No conflicts exist — `-u` was not claimed by any other option on
`lsp add` (existing short forms: `-c` for `--config`, `-f` for
`--format`).
ISSUES CLOSED: #912
Co-authored-by: Jeffrey Phillips Freeman <jeffrey.freeman@cleverthis.com>
Co-committed-by: Jeffrey Phillips Freeman <jeffrey.freeman@cleverthis.com>
182 lines
7.6 KiB
Gherkin
182 lines
7.6 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 -u short form 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 -u short form
|
|
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
|