Files
cleveragents-core/features/cli/plugin_cli.feature
T
HAL9000 d55e610f90 test(plugin-cli): expand BDD tests to cover all happy paths and long-description truncation
Add mock-based @given steps and 14 new scenarios covering the rich
table list, show, enable, disable, remove happy paths, the abort
confirmation flow, and the description truncation branch
(plugin.py:134). The @when step now patches _get_plugin_manager via
context so PluginManager isolation works without a singleton.

ISSUES CLOSED: #5756
2026-06-15 06:36:16 -04:00

97 lines
3.8 KiB
Gherkin

Feature: Plugin CLI Commands
As a user
I want to manage plugins through the CLI
So that I can list, enable, disable, and manage plugins
# --- Negative / error path scenarios ---
Scenario: List plugins when none are installed
When I run "agents plugin list"
Then the output should contain "No plugins found"
Scenario: Show plugin details for non-existent plugin
When I run "agents plugin show non-existent-plugin"
Then the output should contain "non-existent-plugin"
Scenario: Enable a non-existent plugin shows error
When I run "agents plugin enable non-existent-plugin"
Then the output should contain "non-existent-plugin"
Scenario: Disable a non-existent plugin shows error
When I run "agents plugin disable non-existent-plugin"
Then the output should contain "non-existent-plugin"
Scenario: List plugins with JSON output when none installed
When I run "agents plugin list --format json"
Then the plugin CLI output should be valid JSON
Scenario: Install plugin from PyPI by package name
When I run "agents plugin install some-package"
Then the output should contain "some-package"
Scenario: Install plugin from existing local path
When I run "agents plugin install /tmp"
Then the output should contain "/tmp"
Scenario: Remove a non-existent plugin shows error
When I run "agents plugin remove non-existent-plugin --yes"
Then the output should contain "non-existent-plugin"
# --- Happy path scenarios with mocked plugin manager ---
Scenario: List plugins in rich format when plugins are present
Given a plugin manager with one active plugin
When I run "agents plugin list"
Then the output should contain "test-plugin"
Scenario: List plugins in JSON format when plugins are present
Given a plugin manager with one active plugin
When I run "agents plugin list --format json"
Then the plugin CLI output should be valid JSON
Scenario: List plugins truncates long descriptions in the table
Given a plugin manager with one plugin having a long description
When I run "agents plugin list"
Then the output should contain "..."
Scenario: Show existing plugin details in rich format
Given a plugin manager with one active plugin
When I run "agents plugin show test-plugin"
Then the output should contain "test-plugin"
Scenario: Show existing plugin details in JSON format
Given a plugin manager with one active plugin
When I run "agents plugin show test-plugin --format json"
Then the plugin CLI output should be valid JSON
Scenario: Enable a plugin that is already active
Given a plugin manager with one active plugin
When I run "agents plugin enable test-plugin"
Then the output should contain "already enabled"
Scenario: Enable a plugin that is currently inactive
Given a plugin manager with one inactive plugin
When I run "agents plugin enable test-plugin"
Then the output should contain "Enabled"
Scenario: Disable a plugin that is currently active
Given a plugin manager with one active plugin
When I run "agents plugin disable test-plugin"
Then the output should contain "Disabled"
Scenario: Disable a plugin that is already inactive
Given a plugin manager with one inactive plugin
When I run "agents plugin disable test-plugin"
Then the output should contain "not active"
Scenario: Remove a plugin with confirmation skipped using --yes
Given a plugin manager with one active plugin
When I run "agents plugin remove test-plugin --yes"
Then the output should contain "Removed"
Scenario: Remove a plugin and abort on user confirmation
Given a plugin manager with one active plugin
And the next prompt answer is "n"
When I run "agents plugin remove test-plugin"
Then the output should contain "Aborted"