feat(cli): add --seed-react-version option to add and add-all#1720
Conversation
🦋 Changeset detectedLatest commit: d86868b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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 (6)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
Changes--seed-react-version 옵션 추가
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. 🔧 markdownlint-cli2 (0.22.1).changeset/cli-seed-version-option.mdmarkdownlint-cli2 v0.22.1 (markdownlint v0.40.0) skills/seed-design/references/migration.mdmarkdownlint-cli2 v0.22.1 (markdownlint v0.40.0) 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 |
Alpha Preview (Stackflow SPA)
|
Alpha Preview (Storybook)
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@packages/cli/src/utils/registry-source.ts`:
- Around line 38-40: The condition checking opts.seedReactVersion uses a truthy
check, which causes empty strings to be ignored and bypass validation. Change
the condition from a truthy check to explicitly check whether
opts.seedReactVersion is not undefined (using !== undefined or typeof check), so
that empty string inputs will be passed to the seedVersionToBaseUrl function
where proper validation and error handling occurs, as designed in the function
and verified by the test in registry-source.test.ts.
🪄 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: f010e4b5-6206-468c-9ec0-0cdd9d6e1630
📒 Files selected for processing (7)
.changeset/cli-seed-version-option.mddocs/content/react/getting-started/cli/commands.mdxpackages/cli/src/commands/add-all.tspackages/cli/src/commands/add.tspackages/cli/src/tests/registry-source.test.tspackages/cli/src/utils/registry-source.tsskills/seed-design/references/migration.md
Alpha Preview (Docs)
|
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/cli/src/utils/registry-source.ts (1)
38-40: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
--seed-react-version ""입력이 검증 없이 무시됩니다.현재 truthy 체크라서 빈 문자열이 들어오면
null로 빠져 기본 레지스트리 경로로 진행됩니다.seedVersionToBaseUrl함수는 빈 문자열을 입력받으면 에러를 던지도록 설계되어 있으므로(테스트 registry-source.test.ts:21), 옵션을 명시한 경우에는undefined여부로 분기해 빈 문자열도 버전 검증을 타도록 변경해주세요.제안 수정안
export function resolveSeedVersion(opts: { seedReactVersion?: string; }): { framework: "react"; baseUrl: string } | null { - if (opts.seedReactVersion) { + if (opts.seedReactVersion !== undefined) { return { framework: "react", baseUrl: seedVersionToBaseUrl(opts.seedReactVersion) }; } return null; }🤖 Prompt for 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. In `@packages/cli/src/utils/registry-source.ts` around lines 38 - 40, The current truthy check for opts.seedReactVersion in the if condition allows empty strings to bypass validation. Change the condition from checking truthiness of opts.seedReactVersion to explicitly checking if it is not undefined. This ensures that empty strings are passed to the seedVersionToBaseUrl function, which is designed to validate and throw an error for invalid inputs including empty strings, as verified by the test in registry-source.test.ts line 21.
🤖 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.
Duplicate comments:
In `@packages/cli/src/utils/registry-source.ts`:
- Around line 38-40: The current truthy check for opts.seedReactVersion in the
if condition allows empty strings to bypass validation. Change the condition
from checking truthiness of opts.seedReactVersion to explicitly checking if it
is not undefined. This ensures that empty strings are passed to the
seedVersionToBaseUrl function, which is designed to validate and throw an error
for invalid inputs including empty strings, as verified by the test in
registry-source.test.ts line 21.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 80ee09f4-607f-4fa0-941d-ecc27775e1b3
📒 Files selected for processing (7)
.changeset/cli-seed-version-option.mddocs/content/react/getting-started/cli/commands.mdxpackages/cli/src/commands/add-all.tspackages/cli/src/commands/add.tspackages/cli/src/tests/registry-source.test.tspackages/cli/src/utils/registry-source.tsskills/seed-design/references/migration.md
✅ Files skipped from review due to trivial changes (3)
- .changeset/cli-seed-version-option.md
- skills/seed-design/references/migration.md
- docs/content/react/getting-started/cli/commands.mdx
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/cli/src/tests/registry-source.test.ts
- packages/cli/src/commands/add-all.ts
- packages/cli/src/commands/add.ts
Maps a supported SEED React version (1.0/1.1/1.2) to its archived registry domain (https://v1-2.seed-design.io) so users don't need the exact baseUrl; unsupported versions throw with the allowed list. Sets framework=react and takes precedence over --baseUrl/--framework. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
요약
add/add-all에--seed-react-version옵션을 추가했어요. 설치한 SEED React 버전만 지정하면 해당 버전의 스니펫 레지스트리 주소를 CLI가 자동으로 찾아줍니다. 정확한--baseUrl을 외울 필요가 없어요.동작
X.Y→https://vX-Y.seed-design.io로 매핑 (patch는 무시, major-minor만 사용)framework를react로 고정--baseUrl/--framework보다 우선 (이 둘은 레거시로 유지)설계 노트: 왜 React 전용인가
버전 도메인(
vX-Y.seed-design.io)은 React/모노레포 버전 라인 기준이에요.@seed-design/lynx-react는 현재0.2.0으로 완전히 별개 라인이라 버전→도메인 매핑이 무의미합니다. 그래서--seed-lynx-version은 만들지 않았고, lynx는 기본값(latest)을 쓰거나 필요 시--baseUrl로 직접 지정합니다.변경 파일
packages/cli/src/utils/registry-source.ts(신규):seedVersionToBaseUrl,resolveSeedVersionpackages/cli/src/commands/add.ts,add-all.ts: 옵션 + 해석 로직packages/cli/src/tests/registry-source.test.ts(신규): resolver 단위 테스트commands.mdx,migration.md검증
bun --filter @seed-design/cli build통과, biome 클린v1-0/v1-2/ latest react 200,v1-2lynx 200참고 (이 PR 범위 밖, 별도 후속)
v1-1.seed-design.io(=1.1브랜치 배포)에는 framework-scoped 레지스트리(__registry__/react/)가 없어--seed-react-version 1.1은 404예요. 백포트 PR #1657이 OPEN이지만 충돌로 머지 안 된 상태 →1.1재배포 필요. (v1-0/v1-2는 정상)seed-design.io에서 서빙되고v2-0도메인은 없어요. 최신 스니펫은 옵션 없이 기본값을 쓰면 됩니다.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
add와add-all명령에서--seed-react-version옵션을 지원해, 설치한 SEED React 버전에 맞는 스니펫 레지스트리를 자동으로 찾을 수 있습니다.--baseUrl및--framework보다 우선 적용됩니다.Documentation