chore: add migrate-component skill for promoting shared template components#2099
chore: add migrate-component skill for promoting shared template components#2099Adi-204 wants to merge 2 commits into
Conversation
|
What reviewer looks at during PR reviewThe following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughConsolidates the ChangesHandleError Component Consolidation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
|
🚀 Docs preview deployed |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/skills/migrate-component/SKILL.md:
- Line 9: Update the path pattern used in this migration instruction: replace
the literal "packages/templates/clients/<protocol>/<lang>/components/"
occurrences in SKILL.md with a generic, recursive pattern such as
"packages/templates/clients/<protocol>/<templatePath...>/components/" so
multi-level framework/language folders (e.g., java/quarkus/components) are
matched; ensure every later step in the file reuses that same
"<protocol>/<templatePath...>/components" shape so downstream commands and
examples operate on the correct, generic source path.
- Around line 145-146: The current search example using grep -rn "from
'./<Component>'" is too strict and misses other valid import forms; update the
instructions in SKILL.md to recommend a regex-based search that matches both
single and double quotes and flexible spacing (e.g., a pattern matching
from\s+['"]\./<Component>['"]), and mention using grep -P or ripgrep (rg) with
that regex so imports like from "./<Component>" or from'./<Component>' and
variants are found; reference the exact string being replaced ("from
'./<Component>'") and the file section containing the example so reviewers can
locate and replace it.
In `@packages/components/src/components/HandleError.js`:
- Around line 80-96: The JSDoc for the exported HandleError function is missing
`@throws` tags for the errors it can raise; update the comment above export
function HandleError({ language, framework = '' }) to include `@throws` entries
that describe each thrown condition (e.g., invalid or unsupported language,
invalid/unsupported framework) and the type of error thrown so callers know what
to catch; reference the function name HandleError and the parameters language
and framework in the descriptions.
In `@packages/components/test/components/HandleError.test.js`:
- Around line 5-23: Add an integration snapshot test that renders the
HandleError component using a real AsyncAPI fixture: require a fixture JSON from
the test fixtures directory, wrap HandleError in the same AsyncAPI
context/provider your app uses (or pass the relevant parsed AsyncAPI
document/operation props), call render(...) and
expect(result.trim()).toMatchSnapshot(); name the test something like "renders
HandleError with real AsyncAPI fixture (integration snapshot)". Ensure you
import the same helper render function used by other tests and reference the
HandleError component so the new test sits alongside the existing unit
snapshots.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9b3d24f8-d9a3-4a3c-a957-df9511bfd3b2
⛔ Files ignored due to path filters (1)
packages/components/test/components/__snapshots__/HandleError.test.js.snapis excluded by!**/*.snap
📒 Files selected for processing (11)
.claude/skills/migrate-component/SKILL.mdapps/generator/docs/api_components.mdpackages/components/src/components/HandleError.jspackages/components/src/index.jspackages/components/test/components/HandleError.test.jspackages/templates/clients/websocket/dart/components/ClientClass.jspackages/templates/clients/websocket/dart/components/HandleError.jspackages/templates/clients/websocket/java/quarkus/components/EchoWebSocket.jspackages/templates/clients/websocket/java/quarkus/components/HandleError.jspackages/templates/clients/websocket/python/components/ClientClass.jspackages/templates/clients/websocket/python/components/HandleError.js
💤 Files with no reviewable changes (3)
- packages/templates/clients/websocket/java/quarkus/components/HandleError.js
- packages/templates/clients/websocket/dart/components/HandleError.js
- packages/templates/clients/websocket/python/components/HandleError.js
|



Description
Codifies the workflow for moving a duplicated React/JSX component out of a template-local
components/directory into the shared@asyncapi/generator-componentspackage. The skill captures the preconditions (two-template threshold, naming-collision check), the research artifacts (file list, props table, union signature) and the ten-step execution flow (author, export, test, snapshot, delete, update consumers, regenerate integration snapshots, diff, regenerate api_components.md, full test/lint), with references to canonical examples already in the repo. Validated end-to-end against the duplicated HandleError component across the python, dart, and java/quarkus websocket clients — integration snapshots unchanged across all four clientsRelated issue(s)
Fixes #2098
Summary by CodeRabbit
New Features
Documentation
Tests