refactor(onebot): collapse action registration into a single barrel
加一个 action 文件原本要同步改三处手写清单:ApiHandler 的 12 个 register import + 12 行构造调用、各文件的 register footer、action-docs 的 13 import + GROUPS。现收敛 成一个 actions/index.ts barrel 作为「文件→动作 + 分类」的单一真相。 - action-kit:抽 RegisteredActionSpec(describe+register),ActionSpec/ StreamActionSpec extends 它,registerActions 参数放宽到 RegisteredActionSpec[] (它只调 .register),于是 stream 动作也能并入统一注册。 - 新增 actions/index.ts:ACTION_GROUPS(11 组含分类,stream 合并)+ ALL_ACTIONS。 - api-handler:12 import+12 调用 → registerActions(this, context, ALL_ACTIONS); .handle_quick_operation(唯一非 ActionSpec 的裸 handler,需要 h 本身)从 extended 搬进构造器一处显式注册。 - action-docs:改用 barrel 的 ACTION_GROUPS,删本地 GROUPS + 13 import。 - 删 12 个 register footer + 清理因此变 unused 的 ApiHandler/ApiActionContext import。 行为严格不变:注册的动作集合、.handle_quick_operation、文档分类/计数均一致。 onebot 516 全绿、全仓 12 包 typecheck Done;对抗性 Agent 逐条对比 HEAD 确认等价。
This commit is contained in:
16 files changed
+98
-139
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import { defineAction, groupAction, groupUserAction, registerActions, f } from '../action-kit';
|
||||
import type { ApiActionContext, ApiHandler } from '../api-handler';
|
||||
import { defineAction, groupAction, groupUserAction, f } from '../action-kit';
|
||||
import { okResponse } from '../types';
|
||||
|
||||
export const actions = [
|
||||
@@ -126,6 +125,3 @@ export const actions = [
|
||||
}),
|
||||
];
|
||||
|
||||
export function register(h: ApiHandler, ctx: ApiActionContext): void {
|
||||
registerActions(h, ctx, actions);
|
||||
}
|
||||
Reference in new issue
Block a user