Repository navigation
refactor(app-components): remove remaining self-package barrel imports - #5549
Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
…ves (#5550) * refactor(app-ui): lower scrollbar, IME latch and PinScrollKey primitives * fix(app-components): import shared anchored menu css directly and scope IME lint suppressions
…ts-remaining-imports # Conflicts: # scripts/checks/baselines/app-boundaries.json # scripts/checks/baselines/oxlint-ratchet.json
Requirement or Bug
继 #5548 清理工具卡片目录后,
packages/app-components内的聊天面板(ChatPane.vue、ActivityRun.vue、TurnFold.vue等)和会话管理页(admin/*.vue)仍有 12 个文件、15 处通过自身公共桶文件@moonshot-ai/app-components导入工具函数、类型、composable 或兄弟组件。这些导入经由index.ts把剩余的 15 个文件绑在同一个运行时循环依赖环中。本 PR 是 Desktop 分阶段重构的 PR 1.2,将app-components的包内自引用与运行时循环依赖彻底清零。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路
只修改剩余 12 个组件的导入来源,使其指向真实定义模块或兄弟组件;同路径导入顺手合并,避免新增重复导入。不改动任何模板、逻辑、props 与
src/index.ts的对外导出,浏览器相关组件未触碰。旧路径功能清单与符号映射
chat/ChatPane.vueturnBlocks、splitAssistantFold、renderBlockKey等)、type AssistantFold、type AssistantRenderBlock../chatTurnRendering(合并值与类型导入)chat/ChatPane.vueformatTokens@moonshot-ai/app-core/lib(合并进已有的copyTextToClipboard, formatMessageTime导入)chat/ActivityRun.vueformatDuration;toolStackKey、type ActivityItem;summarizeActivity、summarizeLive、type SummaryClause、type SummaryTone@moonshot-ai/app-core/lib;../chatTurnRendering;../lib/activitySummary(SummaryClause/SummaryTone由该模块原样 re-export)chat/TurnFold.vueformatDuration;renderBlockKey、turnWorkMs、type AssistantRenderBlock@moonshot-ai/app-core/lib;../chatTurnRenderingchat/ThinkingBlock.vueformatDuration@moonshot-ai/app-core/libchat/TurnDiffPanel.vue、chat/TurnFilesSummary.vuetype TurnFileChange@moonshot-ai/app-core/client/types(TurnDiffPanel合并进已有的DiffViewLine导入)admin/FilterSelect.vue、MultiSelectMenu.vue、SessionAdminMenu.vueuseAnchoredMenu../composables/useAnchoredMenuadmin/SessionAdminPagination.vuepageItems./pageItemsadmin/SessionAdminTable.vueformatAdminTime、formatAdminTimeCompact;type SessionAdminBatchDirection./formatAdminTime;@moonshot-ai/app-client/client(合并进已有的useKimiWebClient导入)admin/SessionAdminView.vuetype SessionAdminBatchDirection;FilterSelect、MultiSelectMenu、SessionAdminTable、SessionAdminPagination@moonshot-ai/app-client/client(合并类型导入);./*.vue默认导入测试与基线
packages/app-components/test/dockTaskStopStates.test.ts:移除已失效的vi.mock('@moonshot-ai/app-components', () => ({ formatDuration: ... }))。refactor(app-components): extract shared tool card and task list setup hooks #5543 抽取useTaskList后,TasksPane/SubagentGrid已从@moonshot-ai/app-core/lib获取formatDuration,且该测试只断言图标、按钮禁用态和状态文案,不再依赖此 mock。node scripts/checks/app-boundaries.mjs --update与node scripts/checks/ratchet.mjs --update,基线只降不升:self-package-import:全仓库清零(基线中该规则条目整体移除)。app-components的runtime-cycle:15 → 0(剩余 15 个文件全部退环;全仓仅剩主进程 12 文件环、浏览器 3 文件环与app-client/stores6 文件环,按计划后续阶段处理)。import/no-cycle在app-components全部清零,import/no-duplicates在SessionAdminView.vue清零、ActivityRun.vue从 3 降至 1。阅读指南
先看
packages/app-components/src/chat/ActivityRun.vue、packages/app-components/src/admin/SessionAdminView.vue与packages/app-components/src/chat/ChatPane.vue(涉及多符号拆分与合并),其余 9 个组件均为单行导入替换;测试与基线文件可略读。Behavior Changes and Affected Users
None。
证据:所有符号均指向
src/index.ts原本 re-export 的同一模块定义;兄弟组件原本就是具名 re-export.vue默认导出,改为相对路径默认导入拿到同一组件对象;未改动任何分支、默认值、模板、样式、公共导出面或契约文件。packages/app-components全部 1063 个单测(含聊天渲染、管理页分页/时间格式化/菜单、任务面板等)。验证记录
pnpm lint:通过(0 退出)。pnpm --filter kimi-code-app run typecheck:通过(主进程tsc --noEmit与渲染端vue-tsc --noEmit -p tsconfig.renderer.json)。pnpm exec vitest run --reporter=agent packages/app-components packages/app-core/test/activitySummary.test.ts:103 个测试文件、1063 个用例全部通过。pnpm run check:duplication 88553c7d2ccc126ccafccac710d62f09f23455ff:通过,无新增重复片段。e2e:headless):本地未运行,因其默认执行pnpm run build触发全量桌面构建;本 PR 仅调整 ESM 导入路径,等价性由类型检查、全量组件单测及 CIbuild/windows任务验证。Checklist
/approve).(内部重构 PR 1.2,无关联 issue,依赖 refactor(app-components): import tool card helpers from their defining modules #5548)app-components现有 1063 个单测与app-boundaries门禁验证;清理dockTaskStopStates.test.ts失效 mock)gen-changesetsskill, or this PR needs no changeset.(私有app-*UI 层内部重构,无用户可感知变化,无需 changeset)gen-docsskill, or this PR needs no doc update.(不改变用户可见功能,无需更新用户文档)