fix: check auth in the cli for a few plugin commands#2147
Conversation
WalkthroughUpdated CLI router preAction hook to refine authentication bypass: expands direct bypass to ['compose', 'download-binary', 'compatibility-version'], removes blanket 'plugin' bypass, and adds targeted bypass for 'plugin' subcommands ['build', 'generate', 'init', 'test']; all other commands proceed with checkAuth. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cli/src/commands/router/index.ts (1)
43-49: Nit: extract allowlists to constants for clarity and reuseHard-coding the bypass lists inline makes future maintenance harder. Consider small constants or Sets to keep the hook concise and reduce typos.
Example (outside the changed lines, for illustration):
const NO_AUTH_ROUTER_CMDS = new Set(['compose', 'download-binary', 'compatibility-version']); const NO_AUTH_PLUGIN_SUBCMDS = new Set(['build', 'generate', 'init', 'test']); // ... cmd.hook('preAction', async (_thisCmd, actionCmd) => { const sub = actionCmd?.name?.(); const parent = actionCmd?.parent?.name?.(); if (sub && NO_AUTH_ROUTER_CMDS.has(sub)) return; if (parent === 'plugin' && sub && NO_AUTH_PLUGIN_SUBCMDS.has(sub)) return; await checkAuth(); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
cli/src/commands/router/index.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
cli/src/commands/router/index.ts (2)
43-49: Targeted auth bypass for plugin subcommands looks goodRemoving the blanket 'plugin' bypass and limiting it to ['build', 'generate', 'init', 'test'] is a sensible tightening of scope. Keeping top-level bypasses for ['compose', 'download-binary', 'compatibility-version'] aligns with common unauthenticated workflows.
42-51: It looks like you’ve pasted a large code bundle (several CLI commands, hooks, SVG components, animation utilities, etc.). How can I help you with this? For example, are you looking for:
• A high-level overview or summary?
• Debugging or spotting errors?
• Refactoring suggestions?
• Implementing or verifying a particular feature?Let me know what you need!
Summary by CodeRabbit
Checklist