Skip to content

fix: check auth in the cli for a few plugin commands#2147

Merged
JivusAyrus merged 1 commit intomainfrom
suvij/fix-check-auth-for-few-of-the-plugin-commands
Aug 18, 2025
Merged

fix: check auth in the cli for a few plugin commands#2147
JivusAyrus merged 1 commit intomainfrom
suvij/fix-check-auth-for-few-of-the-plugin-commands

Conversation

@JivusAyrus
Copy link
Copy Markdown
Member

@JivusAyrus JivusAyrus commented Aug 18, 2025

Summary by CodeRabbit

  • New Features
    • Streamlined CLI experience: no login required for compose, download-binary, compatibility-version, and plugin build/generate/init/test commands.
  • Bug Fixes
    • Corrected authentication behavior: other plugin subcommands now properly require login.
    • No changes to CLI command syntax or flags.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/cosmo-docs.
  • I have read the Contributors Guide.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 18, 2025

Walkthrough

Updated 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

Cohort / File(s) Summary
CLI router auth bypass logic
cli/src/commands/router/index.ts
Adjusts preAction auth logic: bypasses for top-level commands compose/download-binary/compatibility-version; introduces granular bypass for plugin subcommands build/generate/init/test; all other cases continue to enforce checkAuth. No API signature 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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch suvij/fix-check-auth-for-few-of-the-plugin-commands

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the cli label Aug 18, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
cli/src/commands/router/index.ts (1)

43-49: Nit: extract allowlists to constants for clarity and reuse

Hard-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.

📥 Commits

Reviewing files that changed from the base of the PR and between c51be85 and 2ecc451.

📒 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 good

Removing 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!

@JivusAyrus JivusAyrus merged commit 88f6b63 into main Aug 18, 2025
26 checks passed
@JivusAyrus JivusAyrus deleted the suvij/fix-check-auth-for-few-of-the-plugin-commands branch August 18, 2025 09:29
@Noroth Noroth mentioned this pull request Sep 30, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants