chore(task): archive 09-12-normalize-onetalk-contract-package

This commit is contained in:
YBF
2026-09-12 14:01:51 +08:00
parent 4d46b5b839
commit 84d1cd5b5c
6 changed files with 172 additions and 0 deletions
@@ -0,0 +1,3 @@
{"file":".trellis/spec/project/missing-values.md","reason":"Review the root version synchronization and build-environment invariants after multi-root workspace discovery changes."}
{"file":".trellis/spec/project/module-ownership.md","reason":"Review that the contract's canonical public package import and unique ownership remain unchanged by the physical move."}
{"file":".trellis/spec/mind-test-harness/development/boundary.md","reason":"Review that the test harness remains a one-way consumer and is not accidentally included in production build scope."}
@@ -0,0 +1,50 @@
# OneTalk Contract Package Migration Design
## Boundary
`@trade-message-center/onetalk-contract` remains the same private workspace package. Its
package name, `exports`, TypeScript source, test suite, and every consumer's `workspace:*`
dependency stay unchanged. The migration changes only its physical root from
`apps/onetalk-contract` to `packages/onetalk-contract` and updates repository metadata that
names the physical root.
## Workspace Layout
The root workspace declarations will explicitly include both application and shared-library
directories:
```yaml
packages:
- apps/*
- packages/*
```
The root `package.json#workspaces` mirrors those two globs. pnpm will then rewrite the
lockfile importer from `apps/onetalk-contract` to `packages/onetalk-contract`, and the
relative workspace links from app consumers will resolve as `../../packages/onetalk-contract`.
No consumer manifest needs a dependency-name change.
## Build and Release Metadata
All root commands retain their package-name filters. Only physical path references change:
- Docker copies the package manifest and source from `packages/onetalk-contract`.
- Generated-dist cleanup deletes `packages/onetalk-contract/dist`.
- `.gitignore` covers dist for both `apps/*` and `packages/*`.
- `listWorkspacePackagePaths` enumerates a named, deterministic list of both workspace root
directories. This preserves root-version mirroring for every package and is covered by
fixtures containing one app and one shared package.
## Documentation and Task Coordination
Current specs, the package registry, and non-archived technical docs will point at the new
path. Archived task records remain historical evidence and retain their original locations.
The live structured-message task's worktree registry will receive only the directory mapping;
its source and acceptance plan are not changed.
## Compatibility and Rollback
The package name and public API are stable, so imports and runtime resolution remain
compatible. The only operational compatibility condition is using the updated lockfile together
with the new workspace glob. Reverting is a single Git commit revert that restores the previous
directory and paths; no data migration or deployed protocol rollback is needed.
@@ -0,0 +1,3 @@
{"file":".trellis/spec/project/missing-values.md","reason":"Defines root version mirroring and workspace quality-command invariants affected by adding packages/* discovery."}
{"file":".trellis/spec/project/module-ownership.md","reason":"Defines the OneTalk contract as the canonical cross-package facade and constrains its stable public import path."}
{"file":".trellis/spec/mind-test-harness/development/boundary.md","reason":"Records harness dependency direction and contract consumption that must remain unchanged after relocation."}
@@ -0,0 +1,27 @@
# Implementation Plan
1. Establish the path-impact baseline: run GitNexus impact analysis for
`listWorkspacePackagePaths`, then confirm the package and generated-dist path references
found during planning.
2. Move the complete contract package unchanged from `apps/onetalk-contract/` to
`packages/onetalk-contract/` with Git-aware renames.
3. Update root workspace globs, Docker build copies, generated-dist cleanup, ignore patterns,
Trellis package registry, active-task coordination registry, and current documentation/spec
links. Leave archive paths unchanged.
4. Generalize workspace package discovery to both top-level workspace roots and update the
package-version/release fixtures to assert version mirroring and release file selection for
a shared package.
5. Regenerate the pnpm lockfile through pnpm so importer and link paths are canonical; verify
the frozen lockfile install path without changing dependency versions.
6. Run targeted script tests, contract build/test, root typecheck/test/build, formatting, and
a Dockerfile path/static check. Review the diff for source-content changes under the moved
package, stale non-archive paths, lockfile-only dependency churn, and unexpected execution
flow changes.
## Risk Gates
- Do not alter files below `packages/onetalk-contract/src/` or `test/` other than their Git
rename. A source-content diff is a stop-and-investigate condition.
- Do not update archive task/doc paths: they describe prior checkout state.
- If the live structured-message checkout begins editing the old package during this migration,
pause before destructive conflict resolution; preserve its work and report the required rebase.
@@ -0,0 +1,63 @@
# 规范化 OneTalk 合约包位置
## Goal
将共享 `@trade-message-center/onetalk-contract` 从应用目录迁移到共享库目录,使
monorepo 的目录语义、pnpm workspace 发现、构建和镜像打包路径一致,同时保持包名与
消费者行为不变。
## Confirmed Facts
-`package.json``pnpm-workspace.yaml` 当前仅发现 `apps/*`contract 因此被当作
app 纳入 workspace。
- contract 是 chrome extension、server 和 Mind test harness 的共同依赖,包名均为
`@trade-message-center/onetalk-contract`,依赖声明均为 `workspace:*`
- 根开发、构建、类型检查和测试脚本都按 package name 过滤 contract,因此迁移无需改变
filter 或消费者 import。
- `Dockerfile.server``scripts/clean-generated-dist.mjs`、lockfile importer、Trellis
package registry,以及当前非归档文档/规范中存在旧物理路径。
- `scripts/package-version.mjs` 当前只枚举 `apps/`,若 contract 移至 `packages/`
不调整,该共享包将脱离根版本镜像的校验。
- 另一个进行中的任务
`09-11-onetalk-structured-message-information-collection-classification` 在独立 checkout
中拥有 contract 源码与测试文件;其 task worktree registry 仍列出旧路径。
## Requirements
- R1:将 contract 的完整源码、测试、package manifest 与 TypeScript 配置迁移到
`packages/onetalk-contract/`;包名、exports、版本和 public API 不变。
- R2pnpm workspace 发现范围须同时包含 `apps/*``packages/*`;根 `workspaces` 声明
`pnpm-workspace.yaml` 保持一致。
- R3:所有生产构建、开发启动、清理和 Docker copy 路径必须指向新目录,且 contract 仍
在其消费者启动/构建前完成构建。
- R4:根版本同步/检查必须枚举 apps 和 packages 下全部 workspace package,且测试覆盖
该跨目录发现行为。
- R5:更新反映当前结构的 Trellis package registry、项目/包级规范与非归档技术文档;
不重写 archive 中的历史路径证据。
- R6:更新 pnpm lockfile importer 和 workspace links,使 frozen install 与依赖解析从
新位置工作。
- R7:立即执行迁移;仅做目录与路径/配置修正,不改变 contract 源码内容、协议、导出或
消费者业务逻辑。同步当前结构化消息任务的 worktree registry 路径,避免其后续工作误占
已失效目录。
## Acceptance Criteria
- [ ] AC1`packages/onetalk-contract/package.json` 存在,`apps/onetalk-contract/` 不再
存在,且 Git 识别为源码迁移而非内容重写。
- [ ] AC2`pnpm --filter @trade-message-center/onetalk-contract build`、contract test、
根 typecheck/test/build 在相应范围内成功,并证明 server、extension、harness 仍解析
相同的 workspace package。
- [ ] AC3`pnpm install --frozen-lockfile` 不因 importer 或 link 路径失效;lockfile 的
importer 和消费者 workspace link 均指向 `packages/onetalk-contract`
- [ ] AC4:版本镜像检查覆盖并通过 `apps/*``packages/*`,并有测试防止将来遗漏共享
package。
- [ ] AC5Docker build context 中 contract manifest 与源码 copy 均使用新路径;开发
启动的 dist 清理列表也使用新路径。
- [ ] AC6:当前规范/文档和 Trellis package registry 只指向新目录;归档资料保留原始
历史路径。
## Out of Scope
- 不改变 OneTalk 协议、类型、导出、消费者 import、运行时行为或 package name。
- 不合并、迁移或改写当前进行中任务在另一 checkout 的未合入源码变更。
- 不修改 archive 中作为历史证据记录的路径。
@@ -0,0 +1,26 @@
{
"id": "normalize-onetalk-contract-package",
"name": "normalize-onetalk-contract-package",
"title": "规范化 OneTalk 合约包位置",
"description": "将共享 onetalk-contract 从 apps 迁移到 packages,并更新 workspace 与构建路径引用",
"status": "completed",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "ybf",
"assignee": "ybf",
"createdAt": "2026-09-12",
"completedAt": "2026-09-12",
"branch": "09-12-normalize-onetalk-contract-package",
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}