diff --git a/desktop/AGENTS.md b/desktop/AGENTS.md index 68c53464..94da05fd 100644 --- a/desktop/AGENTS.md +++ b/desktop/AGENTS.md @@ -2,7 +2,8 @@ These rules apply to `desktop/` changes in addition to the root instructions. -- Reuse the existing desktop design system and component/store/API patterns. Use `lucide-react` for common icons and keep operational UI dense, stable, and readable. +- Before adding or editing anything under `desktop/src/components/`, read `desktop/src/components/AGENTS.md`. It is the authoritative index of reusable components, the placement rules for new ones, and the required style/i18n/a11y/test conventions. Do not add a component that duplicates one listed there, and do not add new files to `components/shared/` or `components/common/`. +- Reuse the existing desktop store/API patterns. Use `lucide-react` for common icons and keep operational UI dense, stable, and readable. - Add focused Vitest or Testing Library coverage for UI, store, or API behavior. Run it first, then follow `bun run check:impact`; desktop product changes normally select `bun run check:desktop`. - Chat transport, WebSocket lifecycle, first-turn runtime selection, reconnect, or session changes also require the offline `bun run check:chat-contract` when selected. - Electron host, sidecar, packaging, or version changes require `bun run check:native` when selected. diff --git a/desktop/docs/component-library-plan.md b/desktop/docs/component-library-plan.md new file mode 100644 index 00000000..0775f819 --- /dev/null +++ b/desktop/docs/component-library-plan.md @@ -0,0 +1,678 @@ +# 桌面端组件库:抽取与迁移计划 + +本文是 [`desktop/src/components/AGENTS.md`](../src/components/AGENTS.md) 的配套执行文档,记录审计证据、待抽组件的 API 草稿和分批落地顺序。 + +审计范围:`desktop/src/**`(492 个 ts/tsx,其中 tsx 235 个)。方法:5 个并行只读 agent 分域扫描(设计 token / 交互原语 / 浮层 / 数据展示 / 共享层与工程约束),结论经主控 agent 抽样复核。 + +> **执行状态(2026-07-26)**:阶段 0–8 已全部落地,`shared/` 与 `common/` 已删除。 +> 落地过程中对本文的偏离与新发现记录在 [附录二](#附二实施记录与对本文的偏离)。**改动清单以那一节为准,本文正文保留为当时的审计快照。** + +--- + +## 一、现状:问题不是"开发者偷懒" + +### 1.1 量化 + +| 指标 | 数值 | +|---|---| +| `components/` 下组件 / 测试文件 | 117 / 67 | +| 原生 `