Files
osmWorkflow/.trellis/tasks/08-25-rc-p2-repo-split/prd.md

81 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Phase 2拆仓库
父任务:`.trellis/tasks/08-25-road-compiler-extraction/`
技术设计:父任务 `design.md` §1.3消费方式、§2模块清单
## Goal
`packages/road-compiler/` 拆成保留 git 历史的独立仓库,
宿主改为锁版本依赖 + 子进程调用消费。
## Requirements
### R2.1 保留 git 历史 🔴
-`git subtree split``git filter-repo` 拆出,**不得**用 `cp` + `git init`
- 理由(父任务 R3.21695 行几何逻辑的 blame 是踩坑记录,
丢了以后没人敢改 `compileGeometry` 里任何一行
- 验证:新仓库内 `git log --follow src/compile/native-road.js` 能看到
08-13 native-road-compiler 以来的完整历史
### R2.2 子进程为主契约
- 宿主 `build-area.js` 改为 `execFileSync` 调编译器 CLI
解析 `NATIVE_ROAD_COMPILE_DONE` stdout 标记(父任务 design §1.3
- in-process `require` 可保留为可选优化路径,但不得是唯一路径
- 与既有 QGIS / GDAL / Blender 调用方式一致
(见 `.trellis/spec/pipeline/external-tools.md`
### R2.3 锁版本依赖
- 开发期:`file:` 或 workspace 依赖
- 稳定后git tag / 私有 npm宿主 `package.json` **锁具体版本,不用 `latest`**
- 契约版本 `native-road-package/v1` 与包版本分开演进:
包可以发 patch契约版本只在破坏性变更时升
### R2.4 K4workbench 依赖自持
- `road-workbench` 的 OpenLayers 从新仓库自己的 `node_modules` 提供
- import map 路径相应调整
### R2.5 基线迁移
- Phase 0 的三区域基线 JSON 搬进新仓库当测试语料(父任务 R4 第三条)
- 新仓库 CI/test 能独立跑 parity无需宿主在场
- **同时**宿主保留一份,用于验证升级编译器版本后产物未变
### R2.6 契约文档迁移
- `docs/native-road-package-v1.md` 搬进新仓库
- 宿主 `.trellis/spec/pipeline/` 留指针,说明契约由编译器仓库拥有
## Acceptance Criteria
- [ ] AC2.1 新仓库 `git log --follow` 能追到搬迁前的历史
- [ ] AC2.2 新仓库 `npm test` 在**未 clone 宿主**的机器上通过
- [ ] AC2.3 宿主从锁版本依赖构建,三区域 parity 对基线全绿
- [ ] AC2.4 `build-area.js` 走子进程路径,`NATIVE_ROAD_COMPILE_DONE` 被正确解析
- [ ] AC2.5 宿主 `package.json` 依赖为具体版本,非 `latest` / 非 `*`
- [ ] AC2.6 编译器仓库对宿主反向依赖数为 0父任务 AC8grep 验证)
- [ ] AC2.7 `npm run road:workbench` 在新仓库内独立可跑
## 依赖与顺序
- **前置**Phase 1 完成且 AC1.1AC1.8 全绿
- **阻塞**Phase 3、Phase 4
## 待决策(进入本阶段时定)
| 项 | 选项 |
|---|---|
| 仓库名 | `road-compiler` / `native-road-compiler` / `osm-road-compiler` |
| 托管 | GitHub 私有 / 公开 / 内部 git |
| 分发 | git tag 依赖 / 私有 npm registry |
| 宿主过渡期 | 是否保留 `packages/road-compiler/` 一段时间做双跑对照 |
## Out of Scope
- layer manifestPhase 3
- drawtonomy 扩展Phase 4
- 任何编译器内部逻辑改动 —— 本阶段代码内容不变,只换位置与消费方式