refactor: 优化项目组织与 ci 流程#2
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the monorepo’s package organization and CI workflow, including renaming internal packages from @repo/* to @youngro/*, extracting/renaming feature packages, and restructuring the icons + token utilities.
Changes:
- Rename and re-wire workspace packages (UI, ESLint/TS configs, feature packages) under the
@youngro/*scope. - Replace
packages/youngro-iconswithpackages/iconsand update icon build outputs/exports. - Consolidate GitHub Actions CI into a single “validate” job with improved caching and updated build steps.
Reviewed changes
Copilot reviewed 85 out of 125 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| turbo.json | Add test task + coverage output configuration. |
| pnpm-lock.yaml | Update workspace dependency graph for renamed/moved packages. |
| package.json | Add repo scripts (format:check/test/validate/clean). |
| README.md | Adjust mermaid subgraph labels (diagram content still needs updates). |
| README.zh-CN.md | Adjust mermaid subgraph labels (diagram content still needs updates). |
| .github/workflows/ci.yml | Consolidate CI jobs and caching; update build steps. |
| .github/workflows/ci-test.yml | Remove experimental CI workflow. |
| .github/workflows/ci-icons-types.yml | Remove legacy icons/typecheck workflow. |
| apps/docs/package.json | Switch dependencies/devDeps to @youngro/*. |
| apps/docs/tsconfig.json | Switch TS config extends to @youngro/typescript-config. |
| apps/docs/eslint.config.js | Switch ESLint config import to @youngro/eslint-config. |
| apps/docs/app/page.tsx | Update UI imports to @youngro/ui. |
| apps/web/package.json | Switch dependencies/devDeps to renamed packages. |
| apps/web/tsconfig.json | Switch TS config extends to @youngro/typescript-config. |
| apps/web/next.config.mjs | Update transpilePackages to new package names. |
| apps/web/eslint.config.js | Switch ESLint config import to @youngro/eslint-config. |
| apps/web/src/data/tencentVoices.json | Add Tencent voice metadata table under src/data/. |
| apps/web/src/data/settings/providers.ts | Minor formatting (trailing commas). |
| apps/web/src/components/ProviderPageHeader.tsx | Update UI import to @youngro/ui. |
| apps/web/src/components/Widgets/AnimatedWave.tsx | Minor formatting (trailing commas). |
| apps/web/src/hooks/useChatAutoScroll.ts | Switch chat store import to @youngro/feature-chat. |
| apps/web/src/hooks/useModulesList.ts | Minor formatting (trailing commas). |
| apps/web/src/hooks/useSpeechPlayback.ts | Switch chat store imports to @youngro/feature-chat. |
| apps/web/src/hooks/useSpeechResources.ts | Minor formatting (trailing commas). |
| apps/web/src/hooks/useStreamingSpeechPlayback.ts | Switch chat store import to @youngro/feature-chat; minor formatting. |
| apps/web/src/hooks/useTurnToPage.ts | Minor formatting (trailing commas). |
| apps/web/src/lib/tts/chunker.ts | Minor formatting (trailing commas). |
| apps/web/src/lib/providers/adapter.ts | Minor formatting (trailing commas). |
| apps/web/src/lib/providers/adapters/openaiCompatible.ts | Minor formatting (trailing commas). |
| apps/web/src/store/providersStore.ts | Minor formatting (trailing commas). |
| apps/web/src/store/speechStore.ts | Minor formatting (trailing commas). |
| apps/web/app/api/chat/route.ts | Minor formatting (trailing commas). |
| apps/web/app/api/speech/providers/shared.ts | Minor formatting (trailing commas). |
| apps/web/app/api/speech/providers/[providerId]/models/route.ts | Minor formatting (trailing commas). |
| apps/web/app/api/speech/providers/[providerId]/synthesize/route.ts | Minor formatting (trailing commas). |
| apps/web/app/api/speech/providers/[providerId]/validate/route.ts | Minor formatting (trailing commas). |
| apps/web/app/api/speech/providers/[providerId]/voices/route.ts | Update Tencent voices import path; minor formatting. |
| apps/web/app/page.tsx | Update UI import to @youngro/ui. |
| apps/web/app/not-found.tsx | Update UI import to @youngro/ui. |
| apps/web/app/components-demo/page.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/layout.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/page.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/providers/page.tsx | Update UI import to @youngro/ui; minor formatting. |
| apps/web/app/settings/providers/components/ClientProviderDetail.tsx | Update UI import to @youngro/ui; minor formatting. |
| apps/web/app/settings/providers/[category]/[id]/page.tsx | Minor formatting (trailing commas). |
| apps/web/app/settings/providers/speech/[id]/ClientSpeechProviderDetail.tsx | Update UI import to @youngro/ui; minor formatting. |
| apps/web/app/settings/modules/page.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/modules/consciousness/page.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/modules/consciousness/ClientConsciousnessPage.tsx | Update UI import to @youngro/ui; minor formatting. |
| apps/web/app/settings/modules/speech/page.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/modules/speech/ClientSpeechPage.tsx | Update UI import to @youngro/ui; minor formatting. |
| apps/web/app/settings/youngro-card/page.tsx | Switch card imports to @youngro/feature-card; update UI imports. |
| apps/web/app/settings/youngro-card/components/CardCreationDialog.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/youngro-card/components/CardDetailDialog.tsx | Switch card types import to @youngro/feature-card. |
| apps/web/app/settings/youngro-card/components/CardListItem.tsx | Update commented UI import path. |
| apps/web/app/settings/youngro-card/components/DeleteConfirmDialog.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/youngro-card/components/SimpleModal.tsx | Update UI import to @youngro/ui. |
| apps/web/app/settings/youngro-card/components/Toolbar.tsx | Update UI import to @youngro/ui. |
| apps/web/app/ai-chat/page.tsx | Move InteractiveArea import to local _components; switch chat store import. |
| apps/web/app/ai-chat/layout.tsx | Update UI import to @youngro/ui; minor formatting. |
| apps/web/app/ai-chat/_components/InteractiveArea.tsx | Switch chat store/UI imports and adjust internal relative imports. |
| apps/web/app/ai-chat/_components/InteractiveArea.module.css | Add CSS module for hidden scrollbars. |
| apps/web/app/ai-chat/_components/ChatToolbar.tsx | Switch chat store/UI imports to new packages. |
| apps/web/app/ai-chat/_components/ChatHistory.tsx | Switch chat store import; adjust hook import path. |
| apps/web/app/ai-chat/_components/AIChatMessage.tsx | Adjust MarkdownRenderer import path. |
| packages/eslint-config/package.json | Rename package to @youngro/eslint-config. |
| packages/typescript-config/package.json | Rename package to @youngro/typescript-config. |
| packages/ui/package.json | Rename UI package to @youngro/ui. |
| packages/ui/tsconfig.json | Switch extends to @youngro/typescript-config. |
| packages/ui/eslint.config.mjs | Switch ESLint config import to @youngro/eslint-config. |
| packages/ui/src/components/RadioCard/RadioCard.tsx | Formatting-only trailing comma changes. |
| packages/ui/src/components/PageHeader/PageHeader.tsx | Formatting-only trailing comma changes. |
| packages/ui/src/components/IconStatusItem/IconStatusItem.tsx | Formatting-only trailing comma changes. |
| packages/feature-card/package.json | Rename to @youngro/feature-card; adjust deps (UI/zod). |
| packages/feature-card/tsconfig.json | Add package TS config. |
| packages/feature-card/src/index.tsx | Export store API; switch UI import to @youngro/ui. |
| packages/feature-card/src/store/index.tsx | Formatting-only trailing comma changes. |
| packages/feature-chat/package.json | Rename to @youngro/feature-chat; adjust scripts/deps. |
| packages/feature-chat/tsconfig.json | Add package TS config. |
| packages/feature-chat/vite.config.ts | Add Vite sandbox config. |
| packages/feature-chat/src/index.ts | Add public exports for types/store. |
| packages/feature-chat/src/types/chat.ts | Add shared chat message/event types. |
| packages/feature-chat/src/stream/ndjsonParser.ts | Formatting-only trailing comma changes. |
| packages/feature-chat/src/stores/useChatStore.ts | Switch imports to @youngro/feature-card + @youngro/llm-tokens; formatting. |
| packages/feature-chat/src/components/ChatDemo.tsx | Add demo component for sandboxing the store. |
| packages/feature-chat/README.md | Add package README (currently outdated vs new name/scripts). |
| packages/llm-tokens/package.json | Rename to @youngro/llm-tokens. |
| packages/llm-tokens/tsconfig.json | Add package TS config (incl. Vitest types). |
| packages/llm-tokens/src/index.ts | Update package header comment. |
| packages/llm-tokens/src/index.test.ts | Add Vitest unit tests for token parsing helpers. |
| packages/llm-tokens/src/stream.test.ts | Add Vitest tests for cross-chunk stream tokenizer. |
| packages/llm-tokens/README.md | Add package README (currently titled with old name). |
| packages/utils/package.json | Add new @youngro/utils package manifest. |
| packages/utils/tsconfig.json | Add new package TS config. |
| packages/utils/src/index.ts | Add invariant/clamp/assertNever utilities. |
| packages/icons/package.json | Add new @youngro/icons package manifest. |
| packages/icons/pnpm-lock.yaml | Add package-level lockfile. |
| packages/icons/src/build-icons.mjs | Update build output structure (root dist index + d.ts). |
| packages/icons/src/generated/index.tsx | New generated icon barrel + default export. |
| packages/icons/src/generated/index.ts | Add dev aggregator (currently partial). |
| packages/icons/src/generated/index.d.ts | Reformat generated type declarations. |
| packages/icons/src/generated/CloseIcon.tsx | Add generated React icon component. |
| packages/icons/src/generated/DeepseekIcon.tsx | Add generated React icon component. |
| packages/icons/src/generated/MenuIcon.tsx | Add generated React icon component. |
| packages/icons/src/generated/MoonshotIcon.tsx | Add generated React icon component. |
| packages/icons/src/generated/SearchIcon.tsx | Add generated React icon component. |
| packages/icons/src/generated/TencentcloudIcon.tsx | Add generated React icon component. |
| packages/icons/src/svg/close.svg | Add source SVG asset. |
| packages/icons/src/svg/deepseek.svg | Add source SVG asset. |
| packages/icons/src/svg/menu.svg | Add source SVG asset. |
| packages/icons/src/svg/moonshot.svg | Add source SVG asset. |
| packages/icons/src/svg/search.svg | Add source SVG asset. |
| packages/icons/src/svg/tencentcloud.svg | Add source SVG asset. |
| packages/youngro-icons/package.json | Remove old icons package manifest. |
| packages/youngro-icons/src/generated/index.tsx | Remove old generated barrel. |
| packages/youngro-icons/src/generated/CloseIcon.tsx | Remove old generated icon component. |
| packages/youngro-icons/src/generated/DeepseekIcon.tsx | Remove old generated icon component. |
| packages/youngro-icons/src/generated/MenuIcon.tsx | Remove old generated icon component. |
| packages/youngro-icons/src/generated/MoonshotIcon.tsx | Remove old generated icon component. |
| packages/youngro-icons/src/generated/SearchIcon.tsx | Remove old generated icon component. |
| packages/youngro-icons/src/generated/TencentcloudIcon.tsx | Remove old generated icon component. |
| packages/lib-utils/package.json | Remove old utils package manifest. |
| packages/store-card/package.json | Remove old store-card package manifest. |
| packages/store-card/tsconfig.json | Remove old store-card TS config. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/icons/src/build-icons.mjs:205
dist/index.d.tsis generated with module specifiers that include the.d.tsextension and re-exports the default from a declaration file. This is brittle and may fail type resolution in some tooling; prefer re-exporting from the module path (e.g../react/index) without the.d.tssuffix, and ensure the default export type is re-exported correctly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| subgraph FeatureStores["Features & Stores"] | ||
| ChatStore[@youngro/chat-zustand] | ||
| CardStore[@youngro/store-card] | ||
| FeatureCard[@youngro/feature-youngro-card] | ||
| ProvidersStore[providersStore.ts] | ||
| end |
There was a problem hiding this comment.
The architecture diagram still references the pre-refactor package names (e.g. @repo/ui, @youngro/chat-zustand, @youngro/store-card, @youngro/feature-youngro-card, @youngro/youngro-icons, @repo/*-config). Since this PR renames/moves these packages, the diagram should be updated to the new names so the repo documentation matches the code.
| subgraph FeatureStores["Features & Stores"] | ||
| ChatStore[@youngro/chat-zustand] | ||
| CardStore[@youngro/store-card] | ||
| FeatureCard[@youngro/feature-youngro-card] | ||
| ProvidersStore[providersStore.ts] | ||
| end |
There was a problem hiding this comment.
The mermaid architecture diagram still uses old package names (e.g. @repo/ui, @youngro/chat-zustand, @youngro/store-card, @youngro/feature-youngro-card, @youngro/youngro-icons, @repo/*-config). This PR renames/moves these packages, so the diagram should be updated to reflect the new structure.
| run: pnpm turbo run build --filter=web... | ||
| - name: Typecheck | ||
| run: pnpm -w check-types | ||
|
|
There was a problem hiding this comment.
CI currently runs lint + typecheck + builds, but does not run the workspace test pipeline. Since this PR adds turbo's test task (and there are existing Vitest specs), add a pnpm -w test / pnpm turbo run test (or pnpm validate) step so tests run in PR gating.
| - name: Test | |
| run: pnpm turbo run test |
优化项目组织与 ci 流程