- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6
Add plugin get command #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implement 'mcpd config plugins get' command to display top-level plugin config, or config for a specific plugin within a category.
| WalkthroughAdds a fully implemented  Changes
 Possibly related PRs
 Suggested labels
 Suggested reviewers
 Pre-merge checks and finishing touches❌ Failed checks (1 warning)
 ✅ Passed checks (2 passed)
 ✨ Finishing touches
 🧪 Generate unit tests (beta)
 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
 🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-10-27T14:06:41.058ZApplied to files: 
 🧬 Code graph analysis (1)cmd/config/plugins/get.go (7)
 🔇 Additional comments (6)
 Comment  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (11)
- cmd/config/plugins/get.go(1 hunks)
- cmd/config/plugins/get_test.go(1 hunks)
- cmd/config/plugins/helpers_test.go(1 hunks)
- cmd/config/plugins/list_test.go(10 hunks)
- internal/cmd/basecmd.go(2 hunks)
- internal/cmd/basecmd_test.go(1 hunks)
- internal/config/config.go(1 hunks)
- internal/printer/plugin_config_printer.go(1 hunks)
- internal/printer/plugin_config_printer_test.go(1 hunks)
- internal/printer/plugin_entry_printer.go(1 hunks)
- internal/printer/plugin_entry_printer_test.go(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-24T09:54:59.278Z
Learnt from: peteski22
PR: mozilla-ai/mcpd#215
File: internal/plugin/types_test.go:83-90
Timestamp: 2025-10-24T09:54:59.278Z
Learning: In internal/plugin/types_test.go, TestOrderedCategories_ReturnsCorrectOrder uses hard-coded assertions to act as a regression check. If the category order changes in the config package, this test will catch it. This is intentional to ensure order stability.
Applied to files:
- cmd/config/plugins/get_test.go
🧬 Code graph analysis (9)
internal/cmd/basecmd.go (1)
internal/runtime/runtimes.go (1)
Join(40-46)
internal/printer/plugin_config_printer_test.go (1)
internal/printer/plugin_config_printer.go (2)
PluginConfigResult(13-15)
PluginConfigPrinter(18-21)
cmd/config/plugins/get.go (7)
internal/cmd/basecmd.go (2)
BaseCmd(45-47)
FormatHandler(170-186)internal/cmd/output/types.go (1)
Printer(27-42)internal/printer/plugin_config_printer.go (2)
PluginConfigResult(13-15)
PluginConfigPrinter(18-21)internal/printer/plugin_entry_printer.go (2)
PluginEntryResult(14-18)
PluginEntryPrinter(21-24)internal/cmd/format.go (3)
OutputFormat(9-9)
FormatText(16-16)
AllowedOutputFormats(19-29)internal/config/plugin_config.go (3)
Category(76-76)
OrderedCategories(488-490)
PluginEntry(111-124)internal/cmd/options/options.go (1)
CmdOption(10-10)
internal/printer/plugin_config_printer.go (1)
internal/cmd/output/types.go (2)
Printer(27-42)
WriteFunc(25-25)
internal/printer/plugin_entry_printer_test.go (2)
internal/printer/plugin_entry_printer.go (2)
PluginEntryResult(14-18)
PluginEntryPrinter(21-24)internal/config/plugin_config.go (5)
PluginEntry(111-124)
Flow(79-79)
FlowRequest(38-38)
FlowResponse(41-41)
Category(76-76)
cmd/config/plugins/get_test.go (7)
internal/cmd/basecmd.go (1)
BaseCmd(45-47)cmd/config/plugins/get.go (1)
NewGetCmd(45-98)internal/config/types.go (1)
Config(83-88)internal/config/plugin_config.go (8)
PluginConfig(84-108)
PluginEntry(111-124)
Flow(79-79)
FlowRequest(38-38)
FlowResponse(41-41)
CategoryObservability(30-30)
Category(76-76)
CategoryAudit(33-33)internal/cmd/options/options.go (1)
WithConfigLoader(43-48)internal/printer/plugin_config_printer.go (1)
PluginConfigResult(13-15)internal/printer/plugin_entry_printer.go (1)
PluginEntryResult(14-18)
internal/printer/plugin_entry_printer.go (2)
internal/cmd/output/types.go (2)
Printer(27-42)
WriteFunc(25-25)internal/config/plugin_config.go (2)
PluginEntry(111-124)
Category(76-76)
cmd/config/plugins/helpers_test.go (1)
internal/config/types.go (1)
Config(83-88)
internal/cmd/basecmd_test.go (1)
internal/cmd/basecmd.go (1)
BaseCmd(45-47)
🔇 Additional comments (21)
internal/config/config.go (1)
137-137: LGTM!The added blank line improves readability by visually separating the early return from the subsequent logic.
internal/cmd/basecmd_test.go (1)
13-122: LGTM!Comprehensive test coverage for the
RequireTogethervalidation method. The test cases cover all relevant scenarios including edge cases (single flag, partial provision of multiple flags, and sorting validation). The assertions properly verify both error presence and message content.internal/cmd/basecmd.go (1)
203-219: LGTM!The
RequireTogethervalidation method is well-implemented with clear logic and helpful error messaging. Sorting the flag names ensures consistent error output regardless of the order in which flags are specified.cmd/config/plugins/list_test.go (1)
151-151: LGTM!The migration from
mockLoaderForListto the unifiedmockLoadertest helper is consistent across all test cases and maintains the existing test behaviour.Also applies to: 252-252, 336-336, 432-432, 491-491, 545-545, 569-569, 608-608, 634-634, 684-684
cmd/config/plugins/helpers_test.go (1)
1-18: LGTM!The
mockLoadertest helper provides a clean and simple mock implementation forconfig.Loader, enabling deterministic testing by injecting either a predefined configuration or an error.internal/printer/plugin_config_printer_test.go (2)
11-50: LGTM!The test cases appropriately verify the
PluginConfigPrinter.Itembehaviour for both configured and unconfigured directory states, ensuring user-friendly output in each scenario.
52-102: LGTM!The header and footer customisation tests comprehensively verify both the hook functionality and the default behaviour when hooks are not set.
internal/printer/plugin_entry_printer_test.go (2)
13-94: LGTM!The test cases thoroughly verify the
PluginEntryPrinter.Itembehaviour across various field combinations, including the correct handling of optional fields and the defaultRequired: falsebehaviour when nil.
96-146: LGTM!The header and footer tests follow the same solid testing pattern as the
PluginConfigPrintertests, ensuring consistent behaviour across printer implementations.cmd/config/plugins/get_test.go (6)
17-35: LGTM!The flag constant and command initialisation tests provide basic sanity checks ensuring the command is properly configured.
37-174: LGTM!The plugin-level configuration tests comprehensively verify all output formats (text, JSON, YAML) across different configuration states (configured, nil, empty).
176-323: LGTM!The specific plugin entry tests thoroughly verify retrieval and rendering of individual plugin entries across all output formats, with good coverage of optional field handling.
325-378: LGTM!The flag validation tests properly verify that the
categoryandnameflags must be provided together, ensuring theRequireTogethervalidation is correctly applied.
380-454: LGTM!The error case tests comprehensively verify error handling for invalid categories and missing plugins, including the edge case where plugin configuration is nil.
456-490: LGTM!The case-insensitive category test verifies user-friendly input handling whilst ensuring the canonical category name appears in the output.
cmd/config/plugins/get.go (3)
100-105: Flag pairing validation looks good.
111-129: Top‑level config branch is null‑safe and printer integration is correct.
130-146: Entry lookup and error path are sound.Found‑case printing is correctly delegated; not‑found error matches the documented example.
internal/printer/plugin_config_printer.go (1)
35-46: LGTM: clear, user‑friendly text output with sensible empty handling.The “(not configured)” fallback is helpful; header/footer hooks are properly optional.
internal/printer/plugin_entry_printer.go (2)
38-47: Text rendering for an entry reads well; JSON/YAML marshalling via embedding is appropriate.
38-47: No issues found—helpers exist and nil handling is correct.Both
formatFlows()andformatRequired()are defined ininternal/printer/plugin_list_printer.go. TheformatRequired()function properly handles nil by returning"false", which is a sensible default. The code usage is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing!
Summary
Implement
mcpd config plugins getcommand to display top-level plugin config, or config for a specific plugin within a category.Get top-level plugin config:
Get plugin config for named plugin in category:
result: pluginentry: name: tool-audit-plugin flows: - request category: auditMissing plugin:
No plugin config
Different formats:
JSON
{ "result": { "name": "tool-audit-plugin", "flows": [ "request" ], "category": "audit" } }YAML
Summary by CodeRabbit
New Features
Bug Fixes / Validation
Tests