refactor(genui): add @lynx-js/genui#2712
Conversation
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughConsolidates multiple a2ui/openui packages into a new root ChangesGenUI Package Consolidation
🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested reviewers:
🚥 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)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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/genui/cli/bin/cli.js`:
- Around line 135-137: Replace the hard-coded relative dist imports in the CLI
bootstrap with package entrypoint imports: instead of importing
'../../a2ui-catalog-extractor/dist/cli.js' and
'../../a2ui-prompt/dist/index.js', import from the package names (e.g. import {
runCli as runCatalogExtractorCli } from 'a2ui-catalog-extractor' or from the
package's published subpath like 'a2ui-catalog-extractor/cli' depending on that
package's exports) so the CLI delegates via package exports; update the two
dynamic imports in packages/genui/cli/bin/cli.js that create
runCatalogExtractorCli and the prompt runner to use the appropriate package
entrypoint identifiers (runCli or exported names) instead of sibling dist paths.
🪄 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: 9638494e-4667-4841-9145-c4fd760b4e68
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (53)
packages/genui/.gitignorepackages/genui/README.mdpackages/genui/a2ui-catalog-extractor/README.mdpackages/genui/a2ui-catalog-extractor/package.jsonpackages/genui/a2ui-catalog-extractor/readme.zh_cn.mdpackages/genui/a2ui-catalog-extractor/tsconfig.build.jsonpackages/genui/a2ui-cli/AGENTS.mdpackages/genui/a2ui-cli/package.jsonpackages/genui/a2ui-playground/AGENTS.mdpackages/genui/a2ui-playground/examples/README.mdpackages/genui/a2ui-playground/examples/io-mock/mockAgent.tspackages/genui/a2ui-playground/lynx-src/a2ui/App.tsxpackages/genui/a2ui-playground/lynx-src/openui/App.tsxpackages/genui/a2ui-playground/package.jsonpackages/genui/a2ui-playground/src/catalog/a2ui.tspackages/genui/a2ui-playground/src/components/UsageSection.tsxpackages/genui/a2ui-playground/src/styles.csspackages/genui/a2ui-prompt/AGENTS.mdpackages/genui/a2ui-prompt/README.mdpackages/genui/a2ui-prompt/package.jsonpackages/genui/a2ui-prompt/src/index.tspackages/genui/a2ui/AGENTS.mdpackages/genui/a2ui/README.mdpackages/genui/a2ui/package.jsonpackages/genui/a2ui/src/catalog/Button/index.tsxpackages/genui/a2ui/src/catalog/Card/index.tsxpackages/genui/a2ui/src/catalog/Column/index.tsxpackages/genui/a2ui/src/catalog/List/index.tsxpackages/genui/a2ui/src/catalog/Modal/index.tsxpackages/genui/a2ui/src/catalog/README.mdpackages/genui/a2ui/src/catalog/Row/index.tsxpackages/genui/a2ui/src/catalog/Tabs/index.tsxpackages/genui/a2ui/src/catalog/defineCatalog.tspackages/genui/a2ui/src/catalog/index.tspackages/genui/a2ui/src/index.tspackages/genui/a2ui/src/react/A2UI.tsxpackages/genui/a2ui/src/react/index.tspackages/genui/a2ui/src/react/useA2UIContext.tspackages/genui/a2ui/tsconfig.build.jsonpackages/genui/cli/AGENTS.mdpackages/genui/cli/README.mdpackages/genui/cli/bin/cli.jspackages/genui/cli/package.jsonpackages/genui/index.tspackages/genui/openui/README.mdpackages/genui/openui/package.jsonpackages/genui/openui/src/core/renderer.tsxpackages/genui/package.jsonpackages/genui/tsconfig.build.jsonpackages/genui/tsconfig.jsonpackages/genui/turbo.jsonpackages/genui/ui-judge/tests/helpers/playground-preview-server.tspnpm-workspace.yaml
💤 Files with no reviewable changes (3)
- packages/genui/a2ui-cli/AGENTS.md
- packages/genui/a2ui-cli/package.json
- packages/genui/openui/src/core/renderer.tsx
fe6b209 to
ceceafd
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/genui/cli/bin/cli.js (1)
135-137:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse package entrypoint delegation instead of sibling
distimports.These imports bypass the delegated package entrypoints and couple CLI behavior to local folder layout/build artifacts. Switch to package exports (
@lynx-js/genui/a2ui-catalog-extractor/cliand@lynx-js/genui/a2ui-prompt).Proposed fix
- const { runCli: runCatalogExtractorCli } = await import( - '../../a2ui-catalog-extractor/dist/cli.js' - ); + const { runCli: runCatalogExtractorCli } = await import( + '`@lynx-js/genui/a2ui-catalog-extractor/cli`' + ); @@ - } = await import('../../a2ui-prompt/dist/index.js'); + } = await import('`@lynx-js/genui/a2ui-prompt`');#!/bin/bash set -euo pipefail echo "== Current CLI dynamic imports ==" rg -n "a2ui-catalog-extractor|a2ui-prompt|await import\\(" packages/genui/cli/bin/cli.js -n -C2 echo echo "== Validate exported entrypoints in packages/genui/package.json ==" sed -n '1,220p' packages/genui/package.json | rg -n "\"\\./a2ui-catalog-extractor/cli\"|\"\\./a2ui-prompt\"|\"exports\"" -n -C2As per coding guidelines:
packages/genui/cli/bin/cli.js:genui a2ui generate catalogshould delegate to@lynx-js/genui/a2ui-catalog-extractorandgenui a2ui generate promptshould delegate to@lynx-js/genui/a2ui-prompt.Also applies to: 175-180
🤖 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/genui/cli/bin/cli.js` around lines 135 - 137, Replace sibling dist imports with package entrypoint exports: change dynamic imports that currently reference '../../a2ui-catalog-extractor/dist/cli.js' (where runCli is imported as runCatalogExtractorCli) and the similar a2ui-prompt dist import to their exported package paths (e.g. import from '`@lynx-js/genui/a2ui-catalog-extractor/cli`' and from '`@lynx-js/genui/a2ui-prompt`' respectively), updating the await import(...) calls and any renamed imports (runCatalogExtractorCli, the prompt CLI import) so the CLI delegates to package entrypoints rather than local dist artifacts.
🤖 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/genui/tsconfig.json`:
- Line 10: The package tsconfig.json currently has "compilerOptions.composite":
true but empty "references": [] and "include": [], making this config a no-op
for tsc --build; restore the intended project references or add input files so
GenUI is part of the build graph: update the tsconfig.json to populate
"references" with the other GenUI project refs (or alternatively add appropriate
"include" or "files" entries) so the composite build will typecheck and emit for
GenUI; edit the tsconfig.json keys "references", "include", or "files"
accordingly.
---
Duplicate comments:
In `@packages/genui/cli/bin/cli.js`:
- Around line 135-137: Replace sibling dist imports with package entrypoint
exports: change dynamic imports that currently reference
'../../a2ui-catalog-extractor/dist/cli.js' (where runCli is imported as
runCatalogExtractorCli) and the similar a2ui-prompt dist import to their
exported package paths (e.g. import from
'`@lynx-js/genui/a2ui-catalog-extractor/cli`' and from
'`@lynx-js/genui/a2ui-prompt`' respectively), updating the await import(...) calls
and any renamed imports (runCatalogExtractorCli, the prompt CLI import) so the
CLI delegates to package entrypoints rather than local dist artifacts.
🪄 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: 4538df1e-c3ad-4070-a642-4e441d676b11
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (57)
eslint.config.jspackages/genui/.gitignorepackages/genui/README.mdpackages/genui/a2ui-catalog-extractor/README.mdpackages/genui/a2ui-catalog-extractor/bin/a2ui-catalog-extractor.jspackages/genui/a2ui-catalog-extractor/package.jsonpackages/genui/a2ui-catalog-extractor/readme.zh_cn.mdpackages/genui/a2ui-catalog-extractor/tsconfig.build.jsonpackages/genui/a2ui-cli/AGENTS.mdpackages/genui/a2ui-cli/package.jsonpackages/genui/a2ui-playground/AGENTS.mdpackages/genui/a2ui-playground/examples/README.mdpackages/genui/a2ui-playground/examples/io-mock/mockAgent.tspackages/genui/a2ui-playground/lynx-src/a2ui/App.tsxpackages/genui/a2ui-playground/lynx-src/openui/App.tsxpackages/genui/a2ui-playground/package.jsonpackages/genui/a2ui-playground/src/catalog/a2ui.tspackages/genui/a2ui-playground/src/components/UsageSection.tsxpackages/genui/a2ui-playground/src/styles.csspackages/genui/a2ui-prompt/AGENTS.mdpackages/genui/a2ui-prompt/README.mdpackages/genui/a2ui-prompt/package.jsonpackages/genui/a2ui-prompt/src/index.tspackages/genui/a2ui/AGENTS.mdpackages/genui/a2ui/README.mdpackages/genui/a2ui/README_zh.mdpackages/genui/a2ui/package.jsonpackages/genui/a2ui/src/catalog/Button/index.tsxpackages/genui/a2ui/src/catalog/Card/index.tsxpackages/genui/a2ui/src/catalog/Column/index.tsxpackages/genui/a2ui/src/catalog/List/index.tsxpackages/genui/a2ui/src/catalog/Modal/index.tsxpackages/genui/a2ui/src/catalog/README.mdpackages/genui/a2ui/src/catalog/Row/index.tsxpackages/genui/a2ui/src/catalog/Tabs/index.tsxpackages/genui/a2ui/src/catalog/defineCatalog.tspackages/genui/a2ui/src/catalog/index.tspackages/genui/a2ui/src/index.tspackages/genui/a2ui/src/react/A2UI.tsxpackages/genui/a2ui/src/react/index.tspackages/genui/a2ui/src/react/useA2UIContext.tspackages/genui/a2ui/tsconfig.build.jsonpackages/genui/cli/AGENTS.mdpackages/genui/cli/README.mdpackages/genui/cli/bin/cli.jspackages/genui/cli/package.jsonpackages/genui/index.tspackages/genui/openui/README.mdpackages/genui/openui/package.jsonpackages/genui/openui/src/core/renderer.tsxpackages/genui/package.jsonpackages/genui/tsconfig.build.jsonpackages/genui/tsconfig.jsonpackages/genui/turbo.jsonpackages/genui/ui-judge/tests/helpers/playground-preview-server.tspnpm-workspace.yamlwebsite/package.json
💤 Files with no reviewable changes (4)
- packages/genui/a2ui-catalog-extractor/bin/a2ui-catalog-extractor.js
- packages/genui/a2ui-cli/AGENTS.md
- packages/genui/a2ui-cli/package.json
- packages/genui/openui/src/core/renderer.tsx
✅ Files skipped from review due to trivial changes (25)
- packages/genui/.gitignore
- packages/genui/a2ui/src/catalog/Row/index.tsx
- packages/genui/a2ui/src/catalog/List/index.tsx
- packages/genui/a2ui/src/catalog/Tabs/index.tsx
- packages/genui/a2ui-playground/examples/README.md
- packages/genui/a2ui/src/react/index.ts
- packages/genui/a2ui/src/catalog/Column/index.tsx
- packages/genui/a2ui/src/catalog/Modal/index.tsx
- packages/genui/a2ui/src/react/useA2UIContext.ts
- packages/genui/a2ui/tsconfig.build.json
- packages/genui/cli/README.md
- packages/genui/a2ui-prompt/AGENTS.md
- packages/genui/a2ui/src/catalog/README.md
- packages/genui/a2ui/src/react/A2UI.tsx
- packages/genui/tsconfig.build.json
- packages/genui/a2ui-prompt/src/index.ts
- packages/genui/a2ui/src/catalog/Button/index.tsx
- packages/genui/openui/package.json
- pnpm-workspace.yaml
- packages/genui/a2ui-playground/AGENTS.md
- packages/genui/README.md
- packages/genui/a2ui-playground/src/components/UsageSection.tsx
- packages/genui/a2ui-catalog-extractor/README.md
- packages/genui/turbo.json
- packages/genui/openui/README.md
713d069 to
9bcdd87
Compare
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/genui/a2ui-playground/package.json`:
- Line 10: The dev script currently runs "build:lynx" before starting the dev
server which reintroduces a blocking prebuild; update the "dev" npm script in
package.json to stop pre-building Lynx (remove "build:lynx") and instead launch
Lynx in its dev/watch mode concurrently with the standard dev server (i.e., run
Lynx's dev command in parallel with "rsbuild dev"); ensure you reference the
existing "dev" script and the "build:lynx" script name when making the change so
the new script runs Lynx in dev/watch mode rather than invoking the build step.
🪄 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: 43828a02-186d-4bfd-9a10-f4dde4b7c136
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
eslint.config.jspackages/genui/a2ui-catalog-extractor/bin/a2ui-catalog-extractor.jspackages/genui/a2ui-playground/package.jsonpackages/genui/a2ui/README.mdpackages/genui/a2ui/README_zh.mdpackages/genui/tsconfig.jsonwebsite/package.json
💤 Files with no reviewable changes (1)
- packages/genui/a2ui-catalog-extractor/bin/a2ui-catalog-extractor.js
✅ Files skipped from review due to trivial changes (2)
- packages/genui/a2ui/README.md
- packages/genui/a2ui/README_zh.md
ffa7b6a to
ba71668
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
The turbo cache key was only namespaced by the Rust transform sources
(packages/**/src/**/*.rs) and github.sha, with restore-keys that fell
back to any cache for the same OS. Turbo's per-task hash does not fully
capture the compiled ReactLynx snapshot output, so a PR that only changes
the dependency graph (e.g. adding a package) without touching *.rs would
inherit a base-branch .turbo and replay stale compiled snapshots. The
main-thread snapshot registrations and background-thread references then
came from different transform states, producing widespread
'BackgroundSnapshot not found: __snapshot_*' failures in the Vitest jobs.
- Add hashFiles('pnpm-lock.yaml') to the cache key so caches are scoped
by dependency graph as well.
- Drop the over-broad restore-keys fallbacks (the *.rs-only and OS-only
lines) that allowed inheriting a cache from an unrelated graph.
- Align the glob in consumer workflows to packages/**/src/**/*.rs so the
key stays byte-for-byte identical to workflow-build.yml (required by
fail-on-cache-miss).
- Bump turbo-v4 -> turbo-v5 to discard currently-poisoned caches.
Change-Id: I5fe87bae2346ff379340410aad4cc25be8001d85
ba71668 to
0b948da
Compare
Root cause of the 'BackgroundSnapshot not found' failures (51 test files): packages/genui/a2ui depends on published @lynx-js/lynx-ui-*@3.133.0, which peer-depend on @lynx-js/react@^0.121.0. pnpm pulled a published @lynx-js/react@0.121.0 alongside the workspace copy (0.121.1), so the ReactLynx runtime singleton 'snapshotManager' existed twice. Snapshots registered in one copy were not found when looked up via the other, breaking ReactLynx snapshot rendering across the whole monorepo (incl. unrelated tests like lynx/gesture-runtime). Verified locally with a clean, cache-free build: before -> 51 failed (197 'BackgroundSnapshot not found'); after the override -> 0 such failures on both node 22 and node 24. (Remaining webpack/react and rspeedy/react failures are pre-existing macOS-only rspack issues that also fail on main and pass in CI.) - pnpm-workspace.yaml: add override "@lynx-js/react": "workspace:*" so the published lynx-ui peer resolves to the single workspace copy. - Revert the turbo cache-key change (turbo-v5 + pnpm-lock hash) across the 5 workflows: the failure was never a turbo cache staleness issue (a clean cache-free build reproduces it), so that change is unnecessary.
# Conflicts: # pnpm-workspace.yaml
UI JudgeGEQI weighted score: 9.4 / 100 across 8 examples.
DetailsResult 1
Result 2
Result 3
Result 4
Result 5
Result 6
Result 7
Result 8
|
Summary by CodeRabbit
New Features
Documentation
Chores
Checklist