Repository navigation
fix(commands): 斜杠命令 /review 从未出现——两处契约违约 - #39
Merged
Merged
Conversation
The slash command never appeared. Two contract violations, both of which throw
inside the plugin and get swallowed by its own try/catch:
1. `input` was a string. dsh-commands requires an object with a `hint`
string, so register() threw 'input hint must be a string'.
2. handler returned a bare string. The registry requires a CommandResult
({ kind: success|error, text? }), which would have thrown on invoke.
Also sets definitionId so the host can pair registration with disposal.
Verified against the host rules transcribed from dsh-commands: both
normalizeDefinition and normalizeResult now pass on the real registration.
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.
问题
斜杠命令
/review从来没出现过(输入/re只出 skill)。根因:两处违约,都被自己的 try/catch 吞掉
DSH 的
dsh-commands在register()和调用时各有一次严格校验:input: 'repo_path [mode] [focus]'(字符串)input若给,必须是{ hint: string }register抛 TypeErrorhandler返回纯字符串{ kind: 'success' | 'error', text? }两处都在
try/catch里,所以表现是静默失败:命令不出现,日志里什么都没有。修法
input改为{ hint }handler返回{ kind, text }definitionId,让宿主能配对注册与卸载证据
按
dsh-commands源码复刻normalizeDefinition/normalizeResult,直接喂真实注册对象:并新增两条回归测试锁住这两个形状(防止再被 try/catch 静默吞掉)。
影响
只改命令注册与返回值,不影响工具调用、评审流程与配置。
本 PR 由 DeepSeek Harness 辅助创建