Skip to content

Conversation

@StarpTech
Copy link
Contributor

@StarpTech StarpTech commented Aug 23, 2025

Summary by CodeRabbit

  • Documentation

    • Replaced brief guide pointers with an explicit "Plugin Structure" section and updated README links to the new docs path.
  • Chores

    • Switched workflows to use a globally installed CLI via a new install step invoked by test/generate/build/publish/compose/download.
    • Simplified plugin initialization command by removing the previous plugin-only flag and updated the post-scaffold docs URL.

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

coderabbitai bot commented Aug 23, 2025

Walkthrough

Adds an install-wgc Makefile target and updates templates to run wgc directly (and depend on install-wgc). Replaces documentation pointers with an explicit plugin structure block. Removes the --only-plugin flag from the router plugin init script and updates user-facing docs URLs.

Changes

Cohort / File(s) Summary
CLI templates: Makefile/tooling and docs
cli/src/commands/router/commands/plugin/templates/plugin.ts, cli/src/commands/router/commands/plugin/templates/project.ts
Adds install-wgc phony target and recipes; makes test/generate/build/publish/compose/download targets depend on install-wgc; switches from npx wgc@latest to wgc CLI; minor Makefile formatting fix; replaces plugin docs pointers with explicit "Plugin structure" block and updates readme links.
Schema script: plugin init
router/__schemas/plugin.sh
Removes the --only-plugin flag from the router plugin init invocation; other scripted commands unchanged.
CLI init command docs update
cli/src/commands/router/commands/plugin/commands/init.ts
Updates the final scaffolding URL from /router/plugins to /connect/plugins.
Router plugin README
router-plugin/README.md
Updates Getting Started link from /router/plugins to /connect/plugins.

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.


📜 Recent 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 e75fd9b and e5cc210.

📒 Files selected for processing (4)
  • cli/src/commands/router/commands/plugin/commands/init.ts (1 hunks)
  • cli/src/commands/router/commands/plugin/templates/plugin.ts (3 hunks)
  • cli/src/commands/router/commands/plugin/templates/project.ts (3 hunks)
  • router-plugin/README.md (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • cli/src/commands/router/commands/plugin/commands/init.ts
  • router-plugin/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • cli/src/commands/router/commands/plugin/templates/plugin.ts
  • cli/src/commands/router/commands/plugin/templates/project.ts
⏰ 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). (11)
  • GitHub Check: build-router
  • GitHub Check: build_push_image
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: integration_test (./events)
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: image_scan
  • GitHub Check: build_test
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dustin/plugin-improvements

🪧 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
Copy link

github-actions bot commented Aug 23, 2025

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-3d3e4148bda7c244bdd0bcc89aa27d8fa4faeca0

Copy link

@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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
cli/src/commands/router/commands/plugin/templates/plugin.ts (4)

9-9: Invalid go directive in go.mod template (patch versions are not allowed)

The go directive must be major.minor (e.g., go 1.24). go 1.24.1 will cause module parsing errors.

Apply this diff:

-go 1.24.1
+go 1.24

Also ensure the Dockerfile base image and CI toolchain match the selected Go minor version.


47-47: Wrong import path for generated service; should use the module’s generated folder

This currently imports from the cosmo repo instead of the generated code of the newly created plugin module, which will not compile.

Apply this diff:

-  service "github.com/wundergraph/cosmo/plugin/generated"
+  service "{modulePath}/generated"

95-99: Same incorrect import path in tests

Update tests to import the generated package from the plugin module.

Apply this diff:

-  service "github.com/wundergraph/cosmo/plugin/generated"
+  service "{modulePath}/generated"

283-285: Unify documentation links to use /router/plugins across all templates

The CLI currently mixes two URL paths for the router plugins guide:

  • The plugin template (plugin.ts) and init command use https://cosmo-docs.wundergraph.com/router/plugins
  • The project template (project.ts) at line 146 mistakenly points to https://cosmo-docs.wundergraph.com/connect/plugins before reverting back to /router/plugins at line 198

Please update the single incorrect instance so that every reference consistently uses /router/plugins.

Files to fix:

  • cli/src/commands/router/commands/plugin/templates/project.ts
    • Line 146: change
      https://cosmo-docs.wundergraph.com/connect/plugins

      https://cosmo-docs.wundergraph.com/router/plugins

After this change, all mentions of the “Cosmo Router Plugins Guide” will point to the same canonical URL.

📜 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 fb585be and e75fd9b.

📒 Files selected for processing (3)
  • cli/src/commands/router/commands/plugin/templates/plugin.ts (2 hunks)
  • cli/src/commands/router/commands/plugin/templates/project.ts (2 hunks)
  • router/__schemas/plugin.sh (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-12T09:13:38.973Z
Learnt from: Noroth
PR: wundergraph/cosmo#2132
File: router-plugin/plugin.go:88-104
Timestamp: 2025-08-12T09:13:38.973Z
Learning: In the Cosmo router plugin system, plugin logs are written to stdout and incorporated by the router into its zap logger, which handles timestamping. Therefore, plugin loggers should use DisableTime: true to avoid redundant timestamps that could interfere with the router's log processing.

Applied to files:

  • cli/src/commands/router/commands/plugin/templates/project.ts
⏰ 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). (9)
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: build_push_image
  • GitHub Check: integration_test (./events)
  • GitHub Check: image_scan
  • GitHub Check: build_test
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: Analyze (go)
🔇 Additional comments (3)
router/__schemas/plugin.sh (1)

5-5: Dropping --only-plugin looks correct, given subsequent steps still target ../plugins/hello-world

The script continues to build/test the plugin at ../plugins/hello-world, so the broader scaffold from init should not break this flow.

cli/src/commands/router/commands/plugin/templates/project.ts (1)

21-29: Nice: compose and download now depend on install-wgc

This guards against missing CLI and reduces flakiness in first-run scenarios.

cli/src/commands/router/commands/plugin/templates/plugin.ts (1)

259-273: Good addition: explicit Plugin structure block

This makes onboarding easier and reduces context switching from external docs.

Copy link
Contributor

@wilsonrivera wilsonrivera left a comment

Choose a reason for hiding this comment

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

LGTM

@StarpTech StarpTech merged commit 1a6b4f2 into main Aug 24, 2025
37 checks passed
@StarpTech StarpTech deleted the dustin/plugin-improvements branch August 24, 2025 14:52
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants