mirror of
https://github.com/motajs/template.git
synced 2026-10-17 03:10:17 +08:00
docs(quick-260913-qtq): event built-ins refactor and anon-tokyo import rename
This commit is contained in:
parent
f0fd2f54a1
commit
e5f6d492b2
@ -6,9 +6,9 @@ current_phase: 4
|
||||
current_phase_name: 渲染适配与双布局
|
||||
status: planning
|
||||
stopped_at: Phase 3 complete — session stopped by user; next is Phase 4 discuss/plan
|
||||
last_updated: "2026-09-12T05:40:08.183Z"
|
||||
last_activity: 2026-09-12
|
||||
last_activity_desc: Phase 03 complete, transitioned to Phase 4
|
||||
last_updated: "2026-09-13T11:20:00.000Z"
|
||||
last_activity: 2026-09-13
|
||||
last_activity_desc: Completed quick task 260913-qtq (event built-ins refactor + anon-tokyo import rename)
|
||||
progress:
|
||||
total_phases: 3
|
||||
completed_phases: 3
|
||||
@ -134,6 +134,9 @@ Recent decisions affecting current work:
|
||||
- [Phase 03]: Plan 03-18 preserves the approved eight-name order, awaited event semantics, direct Statement[] insertion, safe missing-target behavior, and legacy/save/decorator boundaries.
|
||||
- [Phase 03]: Plan 03-19: script/check-touched-jsdoc.ts derives its inventory from the passed files (top-level functions plus class methods) and enumerates constructors as explicit exemptions.
|
||||
- [Phase 03]: Plan 03-19: multiline JSDoc requires the opener alone on its line and the closing marker on its own line; the cleanup is scoped to replay/event correction files only.
|
||||
- [quick 260913-qtq]: 内建函数名改用短名(setBlock/moveBlock/... ),删除 EventBuiltinName 枚举;类内使用字面量名称。
|
||||
- [quick 260913-qtq]: anon-tokyo 以内嵌 workspace 包 @motajs/anon-tokyo 为唯一来源,全仓统一引用并声明 workspace 依赖。
|
||||
- [quick 260913-qtq]: 事件注册收口为单一 createEventRegistrations(),不做分类包装;共享工具放 event/utils.ts 且不经 index 导出。
|
||||
|
||||
### Pending Todos
|
||||
|
||||
@ -147,6 +150,12 @@ None yet.
|
||||
- Plan 01-12 leaves the repository-wide type gate blocked only by pre-existing diagnostics outside the plan-owned files; these are recorded in the phase deferred-items ledger.
|
||||
- Plan 01-13 records the same repository-wide type gate diagnostics outside its implementation and test files in the phase deferred-items ledger.
|
||||
|
||||
### Quick Tasks Completed
|
||||
|
||||
| # | Description | Date | Commit | Directory |
|
||||
|---|-------------|------|--------|-----------|
|
||||
| 260913-qtq | event built-ins refactor and anon-tokyo import rename | 2026-09-13 | f0fd2f5 | [260913-qtq-event-built-ins-refactor-and-anon-tokyo-](./quick/260913-qtq-event-built-ins-refactor-and-anon-tokyo-/) |
|
||||
|
||||
## Deferred Items
|
||||
|
||||
| Category | Item | Status | Deferred At | Milestone |
|
||||
@ -156,6 +165,6 @@ None yet.
|
||||
|
||||
## Session Continuity
|
||||
|
||||
Last session: 2026-09-12T05:40:08.149Z
|
||||
Stopped at: Phase 3 complete — session stopped by user; next is Phase 4 discuss/plan
|
||||
Last session: 2026-09-13T11:20:00.000Z
|
||||
Stopped at: Completed quick task 260913-qtq (event built-ins refactor + anon-tokyo import rename)
|
||||
Resume file: None
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
---
|
||||
quick_id: 260913-qtq
|
||||
slug: event-built-ins-refactor-and-anon-tokyo
|
||||
date: 2026-09-13
|
||||
status: complete
|
||||
tags: [events, anon-tokyo, data-state, refactor]
|
||||
---
|
||||
|
||||
# Quick Task 260913-qtq: 事件内建函数改造 + anon-tokyo 引用统一
|
||||
|
||||
## Objective
|
||||
|
||||
把内嵌的 `@motajs/anon-tokyo` 作为唯一 anon-tokyo 来源接入全部包,并把
|
||||
`data-state` 的全部事件内建函数改为与用户手写的 `EventSetBlock` 一致的
|
||||
类式写法,注册收口为单一函数,共享工具收敛到 `utils.ts`。
|
||||
|
||||
> 说明:本记录为追溯补录。代码已先行完成并提交(`a701aa6`、`f0fd2f5`),
|
||||
> 现补 PLAN/SUMMARY/STATE 记录以保证可追溯。
|
||||
|
||||
## Scope
|
||||
|
||||
- `packages-user/data-common`、`packages-user/data-system`、`packages-user/data-state`
|
||||
|
||||
## Tasks
|
||||
|
||||
1. **anon-tokyo 引用统一**
|
||||
- 全部 `from 'anon-tokyo'` → `from '@motajs/anon-tokyo'`
|
||||
- `data-common` / `data-system` 声明 `@motajs/anon-tokyo: workspace:*`,刷新 lockfile
|
||||
|
||||
2. **事件内建函数类式重写**
|
||||
- `map.ts` / `hero.ts` / `event.ts` 每个内建函数改为
|
||||
`EventXxx implements BuiltInFunction<P, E>`,`name` 使用短名 + `func` 方法
|
||||
- 删除落单函数;共享工具迁至 `event/utils.ts`(不经 index 导出)
|
||||
- 非公共功能性函数改为类私有方法
|
||||
- 移动序列改用 `IObjectMover.push`,删除 `appendMoveSteps`
|
||||
- `registrations.ts` 仅保留 `createEventRegistrations()`,按三类顺序写入八条
|
||||
- 删除 `EventBuiltinName`
|
||||
|
||||
3. **验证**
|
||||
- 数据包 type 门禁、`vitest run`、Prettier/ESLint
|
||||
- 对齐 `46a38fa` 遗留的 replay 测试红点
|
||||
|
||||
## must_haves
|
||||
|
||||
- [x] 源码中不再有裸 `anon-tokyo` 引用
|
||||
- [x] 八个内建函数均为类实现,名称稳定为 `setBlock/moveBlock/deleteBlock/moveHero/moveHeroStep/touchFront/insertEvents/insertEvent`
|
||||
- [x] `event/utils.ts` 存在且不被 `event/index.ts` 导出
|
||||
- [x] `createEventRegistrations()` 为唯一注册入口,顺序稳定
|
||||
- [x] 全量测试通过,type 门禁 0 in-scope 诊断
|
||||
@ -0,0 +1,100 @@
|
||||
---
|
||||
quick_id: 260913-qtq
|
||||
slug: event-built-ins-refactor-and-anon-tokyo
|
||||
date: 2026-09-13
|
||||
status: complete
|
||||
completed: 2026-09-13
|
||||
tags: [events, anon-tokyo, data-state, refactor]
|
||||
key-decisions:
|
||||
- "内建函数名改用短名(setBlock 等),删除 EventBuiltinName 枚举"
|
||||
- "anon-tokyo 以内嵌 workspace 包 @motajs/anon-tokyo 为唯一来源"
|
||||
- "事件注册收口为单函数 createEventRegistrations,不做分类包装"
|
||||
- "共享工具放 event/utils.ts 且不经 index 导出"
|
||||
key-files:
|
||||
created:
|
||||
- packages-user/data-state/src/event/utils.ts
|
||||
modified:
|
||||
- packages-user/data-state/src/event/{map,hero,event,types,registrations,index}.ts
|
||||
- packages-user/data-state/src/event/event.test.ts
|
||||
- packages-user/data-state/src/core.ts
|
||||
- packages-user/data-state/test/fixtures/closed-loop.ts
|
||||
- packages-user/data-common/src/event/{types,event}.ts
|
||||
- packages-user/data-common/src/store/eventStore.test.ts
|
||||
- packages-user/data-system/src/event/{types,system,executor,eventDispatch.test}.ts
|
||||
- packages-user/data-common/package.json
|
||||
- packages-user/data-system/package.json
|
||||
- pnpm-lock.yaml
|
||||
commits:
|
||||
- a701aa6 refactor(anon-tokyo): import embedded workspace package everywhere
|
||||
- f0fd2f5 refactor(event): class-based built-ins, shared utils, single registration
|
||||
---
|
||||
|
||||
# Quick Task 260913-qtq Summary
|
||||
|
||||
**八个事件内建全部改为类式 `BuiltInFunction` 实现,注册收口为单一 `createEventRegistrations()`,anon-tokyo 统一走内嵌 `@motajs/anon-tokyo`**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Completed:** 2026-09-13
|
||||
- **Commits:** 2 (`a701aa6`, `f0fd2f5`)
|
||||
|
||||
## Accomplishments
|
||||
|
||||
- 全部 `anon-tokyo` 引用改为 `@motajs/anon-tokyo`;`data-common` / `data-system` 声明 workspace 依赖,lockfile 同步。
|
||||
- `map.ts` / `hero.ts` / `event.ts` 八个内建函数改为类式实现,`name` 采用短名,`func` 为类方法;不再有落单函数。
|
||||
- 共享工具收敛到 `event/utils.ts`(`getPossibleMap` / `getPossibleLayer` / `getEventExecutor` / `enterEventInsert` / `exitEventInsert`),不经 `event/index.ts` 导出。
|
||||
- 非公共功能性函数改为类私有方法(`EventTouchFront.collectInvocations`、`EventInsertEvents.collectInvocations`)。
|
||||
- 移动序列使用 `IObjectMover.push`,删除逐方法调用辅助。
|
||||
- `registrations.ts` 仅保留 `createEventRegistrations()`,按地图/玩家/事件三类顺序写入八条,注释分隔。
|
||||
- 删除 `EventBuiltinName`;`core.ts` 改用 `createEventRegistrations()`。
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `packages-user/data-state/src/event/utils.ts`(新增)— 共享事件工具,不在 barrel 导出
|
||||
- `packages-user/data-state/src/event/{map,hero,event,registrations,index,types}.ts` — 类式重写
|
||||
- `packages-user/data-state/src/event/event.test.ts` — 按新类与注册函数重写
|
||||
- `packages-user/data-state/src/core.ts` — 使用 `createEventRegistrations()`
|
||||
- `packages-user/data-state/test/fixtures/closed-loop.ts` — 内建名改短名
|
||||
- `packages-user/data-common`、`packages-user/data-system` — import 重命名 + 依赖声明
|
||||
|
||||
## Decisions Made
|
||||
|
||||
- 内建函数名改用短名(`setBlock` 等)并删除 `EventBuiltinName`(用户确认)。
|
||||
- anon-tokyo 内嵌为 workspace 包,全仓统一引用 `@motajs/anon-tokyo`。
|
||||
- 注册不做分类包装,`createEventRegistrations()` 内按顺序直写八条。
|
||||
- `utils.ts` 只放共享功能性函数,不经 index 导出。
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 3 - Blocking] 对齐 replay 命令测试的先行红点**
|
||||
- **Found during:** 验证阶段
|
||||
- **Issue:** 用户上一提交 `46a38fa` 将 `ReplayCommandCode.AutoPathfindToPoint` 改名 `Teleport`、`registerReplayCommand` 改名复数、并简化 equip/unequip 逻辑,但未同步测试,导致 `commands.test.ts` 3 例失败。
|
||||
- **Fix:** 按实现更新测试预期(Teleport 名称、registerReplayCommands、equip/unequip 只校验最终槽位、错误码 2007/2008)。
|
||||
- **Files modified:** `packages-user/data-state/src/replay/commands.test.ts`
|
||||
- **Verification:** `vitest run` 19 files / 112 tests 全通过。
|
||||
- **Committed in:** `f0fd2f5`
|
||||
|
||||
**总偏差:** 1 处(Rule 3)。属恢复全套件绿色所必需,无范围蔓延。
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
- 两个 git 提交命令并发执行触发 `index.lock`,`commands.test.ts` 被并入 `f0fd2f5`;内容正确,仅提交信息未单列。工作树最终干净。
|
||||
|
||||
## Verification
|
||||
|
||||
- 数据包 type 门禁:`Type gate passed: zero in-scope data-package diagnostics`
|
||||
- `vitest run`:19 files / 112 tests passed
|
||||
- 改动文件 Prettier 通过、ESLint 退出码 0
|
||||
|
||||
## Follow-ups / 未决
|
||||
|
||||
- 根 `package.json` 仍保留外部依赖 `anon-tokyo@0.0.0-alpha.0`,现已无人引用,可移除。
|
||||
- `packages-user/legacy-plugin-data/src/fallback.ts` 的 `'eventMoveHero'` 为 legacy 全局补丁名,留给 Phase 5。
|
||||
- `03-REPLAY-CONTRACT.md` 等契约文档尚未同步为新的短名 / 单一注册设计。
|
||||
|
||||
---
|
||||
|
||||
*Quick task: 260913-qtq*
|
||||
*Completed: 2026-09-13*
|
||||
Loading…
Reference in New Issue
Block a user