feat: support plugins option on cli - #198
Conversation
WalkthroughA plugin system was integrated into the CLI framework by updating the CLI options and core logic to accept and apply user-provided plugins in addition to built-in ones. Type definitions and constants were updated to support the new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant BuiltInPlugins
participant UserPlugins
participant PluginSystem
participant Command
User->>CLI: Invoke CLI with options (including plugins)
CLI->>BuiltInPlugins: Collect built-in plugins
CLI->>UserPlugins: Collect user-provided plugins
CLI->>PluginSystem: Apply built-in + user plugins
PluginSystem->>Command: Decorate/modify command execution
User->>CLI: Run command
CLI->>Command: Execute (with plugins applied)
Command-->>CLI: Return result (possibly modified by plugins)
CLI-->>User: Output result
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
commit: |
Deploying gunshi with
|
| Latest commit: |
5d8c535
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0aad9338.gunshi.pages.dev |
| Branch Preview URL: | https://feat-accept-user-plugin.gunshi.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/gunshi/src/cli.test.ts(2 hunks)packages/gunshi/src/cli.ts(1 hunks)packages/gunshi/src/constants.ts(1 hunks)packages/gunshi/src/types.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`packages/gunshi/src/**/*.ts`: All source code must be written in TypeScript with strict mode enabled. Use ES modules throughout the codebase. Follow the existing code style, which...
packages/gunshi/src/**/*.ts: All source code must be written in TypeScript with strict mode enabled.
Use ES modules throughout the codebase.
Follow the existing code style, which is enforced by ESLint and Prettier.
packages/gunshi/src/constants.tspackages/gunshi/src/cli.tspackages/gunshi/src/types.tspackages/gunshi/src/cli.test.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
packages/gunshi/src/types.ts (2)
7-9: LGTM! Clean import organization and type integration.The Plugin import is properly placed and the reorganized import structure improves readability.
258-261: Well-defined plugins property in CliOptions interface.The optional
pluginsproperty is correctly typed asPlugin[]and properly documented, maintaining consistency with the rest of the interface.packages/gunshi/src/constants.ts (1)
69-70: Consistent default value for plugins option.The
plugins: undefineddefault value aligns perfectly with the optional nature of the plugins property in the CliOptions interface.packages/gunshi/src/cli.ts (1)
57-57: Excellent plugin integration implementation.The concatenation of built-in plugins with user plugins using the spread operator and safe fallback
(options.plugins || [])correctly handles both defined and undefined plugin arrays.packages/gunshi/src/cli.test.ts (2)
6-6: Good addition of plugin import.The import is correctly added to support the new plugin functionality test.
1156-1192: Comprehensive test case for plugin functionality.The test effectively demonstrates the plugin system by:
- Creating a logger plugin that decorates command execution
- Testing plugin integration with the CLI
- Verifying expected logging behavior
This provides good coverage for the new plugin functionality.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
package.json(1 hunks)packages/gunshi/src/cli.test.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/gunshi/src/cli.test.ts
Description
Linked Issues
Additional context
Summary by CodeRabbit