🔥 chore(sdk): 移除 commands fs-loader stub 与九个无触发点 hook 事件 - #465
Merged
Conversation
loadCommandDefinitions 硬编码返回空数组,属投机性扩展点残留: - 删 commands/fs-loader.ts 与 commands/types.ts - agent.ts 移除 loadedCommands 装配、getPluginCommands、初始化命令合并 - plugins/loader.ts 移除 LoadedPlugin.commands 死字段 - index.ts 移除对应导出面 sidecar 的 plugin-registry/commands 走自有实现,不受影响。 Fixes #295 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
移除全仓无任何 emit 路径的 9 个死事件: WorktreeCreate/WorktreeRemove/CwdChanged/FileChanged/Notification/ TeammateIdle/Elicitation/ElicitationResult/InstructionsLoaded 保留的 18 个事件逐一核实 emit 路径存在(engine.ts 16 处 + agent-tool.ts SubagentStart/SubagentStop)。sidecar 桥接层仅消费 HookConfig/HookDefinition/HookInput/HookOutput,不受影响。 Fixes #295 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
Review结论通过,可合。两块删除均逐条实证为零风险死代码清理:全仓 grep 确认被删符号与事件在 sdk 之外零消费方,18 个保留事件逐一核对 emit 路径存在,README 已同步修正。无阻塞发现。 发现[P3] agent.test.ts:687 负向断言保护力弱化(无需改动) [P3] 已核实1. LoadedPlugin.commands 删除安全性
2. InitializationResult.commands 契约
3. 九个死事件判定复核
4. 文档同步
5. 测试同步
6. CI / 提交划分 / 文案
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
清理两处投机性接口面(#295):
commands fs-loader stub:
loadCommandDefinitions硬编码返回[],却接入了 agent.loadedCommands、initialization 流程与 index 导出面。整体删除:commands/fs-loader.ts、commands/types.tsloadedCommands字段、两处装配(refreshCwdDependentState / reloadPlugins)、getPluginCommands()、初始化命令合并逻辑LoadedPlugin.commands死字段与 manifest 装配HOOK_EVENTS 收敛 27 → 18:移除全仓无任何 emit 路径的 9 个事件:WorktreeCreate / WorktreeRemove / CwdChanged / FileChanged / Notification / TeammateIdle / Elicitation / ElicitationResult / InstructionsLoaded。保留的 18 个事件逐一核实触发点存在(engine.ts 16 处 + agent-tool.ts SubagentStart/SubagentStop)。
逐项 grep 结论
loadCommandDefinitions/commandDefinitionsToSlashCommands/CommandDefinition/loadedCommands:消费方全部在 SDK 内部死链上,apps/ 无引用;sidecar 已不走 SDK 的 loadPlugins 路径Notification/Elicitation其余匹配均为无关的 SDK 消息类型(SDKTaskNotificationMessage 等)验证
bun run typecheck六包全绿Fixes #295
🤖 Generated with Claude Code