React code diff viewer with virtual scroll, split/unified/preview modes, syntax highlighting, inline diff, search.
动手前必读三份文档:
- docs/PROCESS.md — PRD 驱动六步闭环(立项→评审→开发→验证→收尾→发布)
- docs/TODO.yaml — 阶段唯一事实源(commit hook 消费;阶段 id 是 feat/fix 提交 scope 的校验依据)
- docs/prd/ — PRD 目录(先 PRD 后开发;从 PRD-TEMPLATE.md 复制)
- 严格按 docs/TODO.yaml 的阶段顺序推进,不跳步、不越权
- 动手前先读相关文档与现有代码,遵循已有模式;不另起一套并行模式
- 不引入未声明的依赖;只改任务范围内的文件
- 改动前确认当前分支:日常开发在
feature/<阶段>-<任务>分支,develop 只 pull 永不本地提交
main永不直接提交;develop只接受 GitHub PR 合入,本地禁止 mergefeat/fix的 scope 必须是 TODO 真实阶段 id,且与分支名阶段 id 交叉校验feat提交暂存必须包含对应阶段 PRD- 规范不靠自觉,全部由
.githooks/本地 hook 强制(clone 后执行一次git config core.hooksPath .githooks)
<type>(<scope>): <subject>,subject 中文。
- type 白名单:feat / fix / prd / todos / docs / refactor / test / style / chore / perf
- feat / fix / prd / todos:scope = TODO 阶段 id(如 B1)
- 其他 type:scope = 模块名(core / engine / virtual / hotkey / theme / demo / docs / hooks / release)
- 一条提交只做一件事
npm run dev— start demo app (App.tsx)npm run build:lib— build library distnpm test— run vitestnpx tsc --noEmit— typecheck
Before publishing, you MUST update CHANGELOG.md:
- Run tests:
npx vitest run - Run typecheck:
npx tsc --noEmit - Build:
npm run build:lib - Bump version in
package.json - Add a new entry to the top of
CHANGELOG.mdwith the version number and all changes - Publish:
npm publish --registry https://registry.npmjs.org --access public - Sync to consumer (
E:\binn\ftre-desktop): updatepnpm-lock.yaml(3 spots: resolution, specifier+version, package entry) +pnpm install --frozen-lockfile
src/code-diff/CodeDiff.tsx— main component, virtual scroll, toolbar, split/unified/preview renderingsrc/code-diff/diff-engine.ts— computeDiff, buildVisibleRows, findChangeBlocks, searchsrc/code-diff/CodeDiff.css— all stylingsrc/code-diff/types.ts— TypeScript interfaces (CodeDiffProps, ToolbarRenderProps, etc.)src/code-diff/default-config.tsx— theme colors, token colors, default configvite.lib.config.ts— library build config (external: react, react-dom, react/jsx-runtime)CHANGELOG.md— version history (MUST update on every publish)