refactor(core): remove unnecessary | null from config types, unify timestamp naming #108

Closed
opened 2026-04-25 01:46:35 +00:00 by xiaoju · 0 comments
Owner

Phase 1 — 最安全的机械替换

1. 去掉无意义的 | null

  • SenseReflexConfig.on: string[] | nullstring[](空数组 = 无条件)
  • SenseReflexConfig.interval: number | nullnumber(0 或默认值 = 不设间隔)
  • NerveConfig.workflows: Record<string, WorkflowConfig> | nullRecord<string, WorkflowConfig>(空对象 = 无 workflow)
  • SenseConfig 里的 throttle/timeout/gracePeriod| null 也审视一下,如果 null 和 0 语义相同就去掉

2. 统一时间戳命名

  • Signal.tsSignal.timestamp(L5)
  • SenseInfo.lastSignalTsSenseInfo.lastSignalTimestamp(L21)
  • 全局搜索 .ts 字段引用,确保所有消费方同步更新

约束

  • 所有消费这些类型的代码(daemon、cli、store、workflow-utils)都要同步改
  • pnpm run check && pnpm run build && pnpm -r run test 全过
  • 不改语义,只改类型表达
## Phase 1 — 最安全的机械替换 ### 1. 去掉无意义的 `| null` - `SenseReflexConfig.on: string[] | null` → `string[]`(空数组 = 无条件) - `SenseReflexConfig.interval: number | null` → `number`(0 或默认值 = 不设间隔) - `NerveConfig.workflows: Record<string, WorkflowConfig> | null` → `Record<string, WorkflowConfig>`(空对象 = 无 workflow) - `SenseConfig` 里的 `throttle`/`timeout`/`gracePeriod` 的 `| null` 也审视一下,如果 null 和 0 语义相同就去掉 ### 2. 统一时间戳命名 - `Signal.ts` → `Signal.timestamp`(L5) - `SenseInfo.lastSignalTs` → `SenseInfo.lastSignalTimestamp`(L21) - 全局搜索 `.ts` 字段引用,确保所有消费方同步更新 ### 约束 - 所有消费这些类型的代码(daemon、cli、store、workflow-utils)都要同步改 - `pnpm run check && pnpm run build && pnpm -r run test` 全过 - 不改语义,只改类型表达
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#108