Repository navigation
refactor(app-ui): move unified icon registry down from app-client - #5557
Conversation
…pe IME lint suppressions
|
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
…r/lower-icon-registry # Conflicts: # apps/desktop/src/renderer/browser-overlay.ts # packages/app-markdown/src/lib/linkTooltip.ts # packages/app-ui/src/index.ts # packages/app-ui/tsconfig.json # scripts/checks/baselines/app-boundaries.json
|
❌ Nix build failed Hash mismatch in
Please update |
…egistry # Conflicts: # apps/desktop/src/renderer/components/UpdateIndicator.vue # packages/app-markdown/src/lib/linkTooltip.ts # packages/app-ui/src/index.ts # packages/app-ui/tsconfig.json # scripts/checks/baselines/app-boundaries.json
…aluated upstream items Port the two kimi icons upstream MoonshotAI#5557 moved, the raw-icon module declaration from MoonshotAI#5068, and the tool-args validator re-export from MoonshotAI#4630. All three are byte-identical to upstream/main; only the paths are adapted. check-check.svg and feedback.svg land in packages/app-client/src/icons/kimi/ because this fork still keeps its 109 kimi SVGs and icons.ts there, while upstream moved the whole set to packages/app-ui/src/icons/. Both resolve verbatim through the build's own unplugin-icons loader, in the component form and in the ?raw form. packages/app-composer/src/icons.d.ts declares ~icons/*?raw as a string. The package tsconfig sets "types": [], so oxlint's type-aware pass saw every raw icon import as an error type and flagged each entry of the icon map. The declaration removes all 16 frozen typescript/no-unsafe-assignment findings in src/shared/icons.ts, and the ratchet baseline drops that one entry accordingly; upstream's own commit carried the same companion change. packages/agent-core-v2/src/tool/executor/validate.ts re-exports @moonshot-ai/core/tool/validate, which this fork already carries as packages/core/src/tool/validate.ts. No changeset: none of the three is user-perceivable.
`bun scripts/upstream-ledger.mjs --refresh` at upstream/main 4eb2919 added 126 rows, so every open upstream commit and every PR it references now has a ledger row: 0/596, down from 125 at 8bf8ba3 and 126 at the fetched tip. The refresh only reads `upstream/main ^ main`, so the three release-2.6.2 commits named by the mission (MoonshotAI#4875/MoonshotAI#4905/MoonshotAI#4922) gained rows with the refresh's row shape. Settled with live probes in this tree: - ported: MoonshotAI#5533 (docs 2.8.1 changelog), MoonshotAI#4875 (registry search_url and feedback_url plus the feedback service), MoonshotAI#4905 (Kimi upload status validation in packages/core), MoonshotAI#4922 (swarm task events in sessionTaskFeed), MoonshotAI#5438 (unload only declared dynamic tools), MoonshotAI#5592 (dynamic tool replacement order), MoonshotAI#5595 (append-log known length), MoonshotAI#5573 (skill roots for every work dir), MoonshotAI#5576 (date reminder cwd comparison), MoonshotAI#5618 (session titles for skill openers), MoonshotAI#5638 (frozen loop tool baseline), MoonshotAI#5626 (legacy turn-input origins) - partial: MoonshotAI#5505 (processLiveness source and consumers present; the upstream unit test file was never carried), MoonshotAI#5571 (program-resume and OSC 7577 present; the upstream test helper was never carried), MoonshotAI#5532 (gitService half present; fsService still leaks the environment lease at fsService.ts:1133 and :1267), MoonshotAI#5557 (app-client icon registry kept; the move to app-ui was never carried) - not-applicable: MoonshotAI#4655 (upstream reverted auto review in MoonshotAI#5649), MoonshotAI#5333 (PLAYBOOK:111 deliberate flat experimental flags) M39's "likely present" list was checked, not trusted: MoonshotAI#5438 is present (upstream test passes), MoonshotAI#5487 is not (nativeStartSettleMs/leg.nativeSettled absent), MoonshotAI#5635 is not (ToolsSettled absent), MoonshotAI#5429 needs a visual probe. The remaining 194 pending rows stay open with their reasons; no feature was ported and no upstream-drift allowlist entry was added. Verification: verify -> 332 closed rows, 332 carry every file of their PR; 317 probes pass, 2 foreign-runner skips, 0 fail; a second verify is byte-identical (ledger sha256 cbf53638...). Probe tests 29 pass; bun run lint and node scripts/checks/ratchet.mjs green.
Requirement or Bug
统一图标注册表(
ICONS、getIcon、iconSvg、IconName)和 111 个kimi/*.svg资产目前放在状态/业务层的packages/app-client中,而基础组件Icon.vue在packages/app-ui中。这迫使底层的app-markdown(代码块换行/行号、宽表复制、链接浮层按钮)向上依赖app-client,并让app-composer仅为了测试时定位 SVG 目录和核对图标字形而在devDependencies中反向依赖app-client,产生 pnpmapp-client <-> app-composer循环依赖警告。本 PR 是 Desktop 分阶段重构的 PR 1.3b,将图标注册表下沉到app-ui,彻底解除app-markdown与app-composer对app-client的依赖。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路
图标是纯 UI 资产,应与
Icon.vue同属app-ui。本 PR 原样搬迁图标注册表与 SVG 目录,通过@moonshot-ai/app-ui/icons子路径导出(不挂到app-ui根入口,避免仅使用基础组件的页面静态拉入全部 SVG),不保留旧路径兼容 re-export。packages/ app-ui/ src/ - icons.ts # IconResolverKey / SIZE_PX / IconSize + iconResolver.ts # 原 icons.ts 改名(100% rename),根入口继续从此导出 + icons/ + icons.ts # 原 app-client/src/icons/icons.ts;SIZE_PX / IconSize 改为复用 ../iconResolver + kimi/*.svg # 原 app-client/src/icons/kimi(111 个 SVG 100% rename) + test/icons.test.ts # 原 app-client/test/icons.test.ts(100% rename) + vitest.config.ts # 新增:接入 vite-preset 的 Vue 与 unplugin-icons app-client/ - src/icons/ # 移除,package.json 移除 "./icons" 导出 app-markdown/package.json - dependencies: @moonshot-ai/app-client app-composer/package.json - devDependencies: @moonshot-ai/app-client + devDependencies: @moonshot-ai/app-ui旧路径功能清单与新归属对照
ICONS、getIcon、iconSvg、type IconName、type IconEntry@moonshot-ai/app-client/icons@moonshot-ai/app-ui/icons(28 个消费方文件更新导入)SIZE_PX、type IconSizeapp-ui/src/icons.ts与app-client/src/icons/icons.ts各有一份相同定义app-ui/src/iconResolver.ts定义;app-ui根入口与@moonshot-ai/app-ui/icons均从该处导出,消除重复定义kimi/*.svg资产目录(iconsDir)app-client/src/icons/kimiapp-ui/src/icons/kimi;app-ui增加./package.json导出,7 处 vite/vitest 配置改为从@moonshot-ai/app-ui/package.json解析browser-overlay.ts、browser-control.ts、BrowserControlSurface.vue)@moonshot-ai/app-client/icons导入getIcon/iconSvg@moonshot-ai/app-ui/icons,浏览器逻辑零改动apps/desktop/tests/renderer/{kbd,tooltip-bubble}.test.ts引用app-ui/src/iconsapp-ui/src/iconResolverapp-ui测试运行配置vitest.config.ts(无法解析~icons/*)packages/app-ui/vitest.config.ts,同时包含test/**/*.test.ts与src/**/*.test.ts(保留markdownColors.test.ts覆盖)基线与工作区检查
app-boundaries的upward-package-import:4 → 1(app-markdown的向上依赖全部清零,仅剩app-ui/toastTypes.ts一处,由 PR 1.4 处理)。oxlint-ratchet:vitest/no-conditional-expect从app-client/test/icons.test.ts1:1 平移至app-ui/test/icons.test.ts(测试文件 100% 原样搬迁,全仓总数不增)。pnpm install不再出现app-client <-> app-composer循环依赖警告;node scripts/check-nix-workspace.mjs通过(未增删工作区成员,flake.nix无需变更)。阅读指南
先看
packages/app-ui/package.json、packages/app-ui/vitest.config.ts与packages/app-ui/src/icons/icons.ts首尾(仅新增../iconResolver导入与 re-export);111 个 SVG、iconResolver.ts、icons.test.ts均为 rename 可略读;其余文件均为单行导入路径替换。Behavior Changes and Affected Users
None。
证据:所有图标组件、原始 SVG 字符串、
applySize尺寸替换逻辑、SIZE_PX像素值(14/16/20)与IconResolverKey注入机制均未改动;未修改任何组件渲染逻辑、分支或契约文件。app-ui图标注册表测试、5 个app-*包全量单测、桌面端渲染端测试及build:web生产构建。验证记录
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-ui packages/app-markdown packages/app-composer packages/app-client packages/app-components apps/desktop/tests/renderer:431 个测试文件中 430 个一次通过(5978 例);唯一超时的browser-overlay-annotation-shortcut.test.ts系新路径下 111 个 SVG 首次冷编译超过 5s 默认超时,单独复跑 4.4s 通过(15/15 用例通过),未改动该测试。pnpm --filter kimi-code-app run build:web:通过。node scripts/check-nix-workspace.mjs:通过。pnpm run check:duplication 8bfa809b96fb9d601674da96259cd71067779fd9(PR 实际 base):通过,无新增重复片段。Checklist
/approve).(内部重构 PR 1.3b,无关联 issue,依赖 refactor(app-ui): lower scrollbar, IME latch and PinScrollKey primitives #5550)icons.test.ts随模块迁移至app-ui/test并全部通过,复用 5 个app-*包与渲染端共 5981 个用例验证)gen-changesetsskill, or this PR needs no changeset.(私有app-*UI 层内部重构,无用户可感知变化,无需 changeset)gen-docsskill, or this PR needs no doc update.(不改变用户可见功能,无需更新用户文档)