chore(road-editor): plan direct-edit task tree and add client test infra

Planning: parent design.md becomes the single authoritative contract
(constraint model with 6 kinds, handle manifest, coordinate/unit
layering, preview sequencing, storage layout and lazy migration, area
config snapshot, API contract). Work is split into four independently
verifiable child tasks with per-step gates and rollback points.

Test infra: pin vitest 4.1.11, add test:client:unit for client pure
logic, extend prettier globs to root *.ts so vitest.config.ts is checked.

Add .gitignore: the repo had none, so inputs/, outputs/, workbench-data/
and the client build output were untracked rather than ignored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-26 17:33:42 +08:00
parent 7dc7ede2b8
commit 93f09e399e
41 changed files with 2001 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
# 最小 JunctionTools
父任务:`.trellis/tasks/08-26-direct-manipulation-road-editor`。需求来源与权威合约在父任务的 `prd.md` / `design.md`
## 目标
用专用工作区承载路口编辑验证单一普通路口的进口宽度、cutback 与单个角部圆角,闭合"预览 → 应用到工作区 → 保存 → 取消"四态。这是路口能力的最小可信切片,不是完整路口编辑器。
## 顺序依赖
前置:`direct-edit-solver-api`junction 相关的三个 kind 求解与预览端点)与 `direct-edit-map-editor``EditSession`、ghost/preview 图层、命令栈)。
后继无。cluster 高级编辑、多路口联动为独立后续任务。
## 范围
-`JunctionRef``{type:'node'|'cluster', id}`,本期只走 `node`)的工作区路由与返回主地图的上下文保持。
- 加载该路口的编辑上下文:路口面、进口、相邻道路短上下文、车道/connector、步行带、停止线、斑马线、诊断与当前约束。
- 三项可拖能力进口宽度、cutback、单个角部圆角。
- session draft首次拖拽即 ghost防抖后服务端权威局部预览。
- 「应用到工作区」合并有效草稿为活动副本的未保存约束;「保存」持久化;「取消」丢弃草稿并复原。
- 会话边界:切换相邻路口前必须应用或取消。
## 不做
- cluster 的高级编辑与复合路口模板编排。
- 多个路口的联合会话或联动编辑。
- 控制设施的逐个手工布置。
- 主地图道路区间的编辑(属 `direct-edit-map-editor`)。
- OSM 图拓扑的修改。
## 验收标准
- [ ] 从路口面或诊断可进入工作区,并能带位置返回主地图。
- [ ] 三项能力各自可拖,首次拖拽即有 ghost防抖后显示服务端权威几何。
- [ ] 预览包含全部受影响派生对象道路面、路口面、步行带、车道中心线、connector/movement、停止线、斑马线、标线。
- [ ] 拟合失败时返回最后有效几何加结构化诊断,不把非法图形显示成已应用。
- [ ] 「应用到工作区」后返回主地图仍显示同一几何,且该编辑处于未保存状态、可被主地图 undo/redo 管理。
- [ ] 「取消」后回到进入工作区前的状态,活动副本无残留。
- [ ] 未处理草稿时切换相邻路口被拒绝,并提示先应用或取消。
- [ ] 「保存」后重新编译几何不变,约束状态 `exact`
- [ ] `npm run format:check``npm run test``npm run test:client``npm run test:client:unit``npm run build` 全绿。