feat(junction): expose stage1 structure and standards panel

This commit is contained in:
que01 committed 2026-09-07 14:52:06 +08:00
1 parent 0f804b71d1
commit fc7fe81eff
15 files changed
+434 -17

No files matched your search

@@ -0,0 +1,3 @@
{"file":".trellis/spec/backend/direct-edit-api.md","reason":"Validate response compatibility and diagnostics semantics."}
{"file":".trellis/spec/frontend/direct-edit-client.md","reason":"Check no duplicate client geometry or edit protocol."}
{"file":".trellis/spec/frontend/quality-guidelines.md","reason":"Run frontend quality gates."}
@@ -0,0 +1,19 @@
# 技术设计
## 边界
编译层负责把模型和已发布设施图层投影为统一结构;Workbench server 负责在 state/preview 边界携带它;客户端只消费结构和诊断,不复制拓扑判断。
## 数据流
`compileRoadModel + compiled layers + shape summary -> buildJunctionStructure -> state/edit-state/edit-preview -> JunctionWorkspace`
结构构造器保持纯函数。普通节点以 node key 建立结构,复杂 cluster 以 cluster key 建立结构;有效道路臂取实际 endpoint/road 证据,设施取 crosswalk、stop-line 和 traffic signal 的现有字段。没有证据的对象不生成。
## 兼容
新字段采用可选扩展,旧客户端忽略;结构生成失败时 state 仍返回原 compiled 数据和 `junctionStructure: null`,不影响既有编辑。preview 使用同一编译快照,不能读取上一次 state 的结构。
## 客户端
扩展 `WorkbenchState` 类型和 `JunctionWorkspace` props。对象树按道路臂、角部、过街与控制设施分组;诊断项显示可读消息和级别。当前阶段选择动作只更新既有工作区选中/高亮状态,不创建新的编辑历史。
@@ -0,0 +1,4 @@
{"file":".trellis/spec/backend/direct-edit-api.md","reason":"Preserve compiler ownership and preview/edit-state contracts."}
{"file":".trellis/spec/frontend/direct-edit-client.md","reason":"Keep the existing JunctionTools and preview ownership boundaries."}
{"file":".trellis/spec/frontend/quality-guidelines.md","reason":"Follow component and validation requirements."}
{"file":".trellis/spec/guides/cross-layer-thinking-guide.md","reason":"Trace compiler to API to client data flow."}
@@ -0,0 +1,8 @@
# 实施清单
1. 新增编译层 junction structure projection:从 model、layers、signals、shape summary 生成稳定对象键和可读标签。
2. 新增标准诊断投影:保留现有编译 diagnostics,并为结构规则生成 pass/warning/blocking 的对象引用。
3. 将 structure/profile/standardsDiagnostics 接入 `/api/state`、`/api/edit-state` 和 `/api/edit-preview`。
4. 扩展客户端 state 类型、API 响应和 JunctionWorkspace 的只读结构/标准面板。
5. 增加 Node 与客户端测试,覆盖普通/T 字/复杂/设施缺失和诊断定位。
6. 运行 `npm test`、`npm run test:client:unit -- --run`、`npm run test:client`、`npm run format:check`、`npm run build`。
@@ -0,0 +1,46 @@
# JunctionTools Stage 1 统一结构与标准面板
## Goal
TBD.
## Requirements
- TBD
## Acceptance Criteria
- [ ] TBD
## Notes
- Keep `prd.md` focused on requirements, constraints, and acceptance criteria.
- Lightweight tasks can remain PRD-only.
- For complex tasks, add `design.md` for technical design and `implement.md` for execution planning before `task.py start`.
# JunctionTools Stage 1:统一结构与标准面板
## 目标
把 Stage 0 的编译层结构契约接入现有 Workbench,让打开路口时能看到编译器提供的可读形态、有效道路臂、角部/设施清单和标准诊断。此阶段只读,不改变保存门禁、编辑文档或几何算法。
## 范围
- 从现有 native-road model、crosswalk/stop-line/signal 图层及 complex junction shape 结果构造 `junctionStructure`。
- `/api/state`、`/api/edit-state`、`/api/edit-preview` 返回同一快照中的结构、标准档和 `pass/warning/blocking` 诊断。
- JunctionWorkspace 顶栏展示可读标题、实际形态、标准档与诊断摘要;对象列表展示道路臂、角部、过街和控制设施。
- 诊断关联稳定对象键,可在工作区定位并高亮当前对象。
## 非范围
- 不实现全局/局部覆盖、撤销模型变化或新的保存阻塞规则。
- 不按客户端节点数量重新分类,不解释参考 GeoJSON `type`。
- 不接入高级导流岛/中央分隔对象,除非编译结果已有明确对象证据。
## 验收标准
1. 普通、T 字、偏置、多臂和复杂路口响应包含结构摘要,形态和有效道路臂来自编译结果。
2. T 字/单行样例不会生成不存在的道路臂、角部或设施;对象键稳定且列表可读。
3. state、edit-state、preview 对同一路口暴露一致的 structure/profile/diagnostics 字段。
4. JunctionWorkspace 显示标准档、形态、道路臂与设施分组;无内部 node/segment ID 作为默认标题。
5. 诊断包含严重度、rule、objectKey/message,并可从列表定位到对应条目;warning 不阻断既有保存路径。
6. 现有 `npm test`、客户端类型检查、单测、构建和格式检查通过。
@@ -0,0 +1,26 @@
{
"id": "junctiontools-stage1-structure-panel",
"name": "junctiontools-stage1-structure-panel",
"title": "JunctionTools Stage 1 统一结构与标准面板",
"description": "",
"status": "in_progress",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "dingkang",
"assignee": "dingkang",
"createdAt": "2026-09-07",
"completedAt": null,
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}