feat: add Agent Skill for S1 to S2 migration#9778
Conversation
…ching import and could miss v3 imports when an @react-spectrum/s2 import appears first
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
|
||
| To install the migration skill and the general S2 skill, run: | ||
|
|
||
| <Command command="npx skills add https://react-spectrum.adobe.com --skill migrate-react-spectrum-v3-to-s2 --skill react-spectrum-s2" /> |
There was a problem hiding this comment.
I decide to have this command include both skills (migrate-react-spectrum-v3-to-s2 and react-spectrum-s2) since the main S2 skill is useful for referencing component docs during migration.
packages/dev/s2-docs/migration-references/focused-manual-fixes.md
Outdated
Show resolved
Hide resolved
|
Build successful! 🎉 |
| function generateMigrationSkillMd(skillConfig) { | ||
| return `${generateFrontmatter(skillConfig)}# React Spectrum v3 to S2 migration | ||
|
|
||
| Upgrade React Spectrum v3 codebases to S2 by following these seven steps in order. |
There was a problem hiding this comment.
The agent skill is still spinning its wheels for me for now, but one interesting thing I noticed, I'll add more as it runs:
- it only installed S2
0.9.0since it saw the project was still using React 18, maybe it should attempt to always use latest since it is technically compatible. Otherwise maybe it should let the user know to attempt an upgrade to React 19?
There was a problem hiding this comment.
Interestingly enough it began to degrade the version of S2 to attempt to find something to match the React 18 dependency, and began trying to fix some Next configs which seemed unrelated. Should we also add instructions so that it stays strictly in bounds of the codemod? Or is this something I messed up on my end?
There was a problem hiding this comment.
Added a new Scope section at the beginning, as well as a final step to generate a report with any follow-up needed. This should indicate to the Agent not to do any massive upgrades (like React major version bumps), but to mention them in the final report as follow-up work.
|
Build successful! 🎉 |
LFDanLu
left a comment
There was a problem hiding this comment.
I tested this again against my sample repo again, it works pretty well. I will note that it still ended up bumping the project's Next version for some reason, as well as writing a patch for isRTL...
I verified that the agent SKILL.md had the proper "Scope" section that forbids major upgrades, so it seems like the the "Scope" section of the skill isn't being 100% followed by the agent, not sure if there is much we can do about that.
Maybe we can add some guidance around this in the future, will have to see how often that may come up.
This PR adds an Agent Skill that helps users upgrade from v3 to S2. TLDR is that it tells the agent how to effectively run the codemods, then fix everything the codemod couldn't fix automatically.
✅ Pull Request Checklist:
📝 Test Instructions:
Install the skill:
and invoke it when upgrading your project.
Important
The skill mentions running the codemod with "--agent". This has not been released yet, so you may need to manually update the skill to point to a nightly release, which does include it: https://www.npmjs.com/package/@react-spectrum/codemods?activeTab=versions.
Example: Replace
npx @react-spectrum/codemods s1-to-s2 --agentwithnpx @react-spectrum/codemods@3.0.0-nightly-7ba11ce33-260324 s1-to-s2 --agent🧢 Your Project: