Skip to content

feat(command): /review 参数解析(repo/mode/focus 不再被忽略) - #40

Merged
Nicholas023 merged 1 commit into
mainfrom
fix/slash-command-contract
Nov 4, 2026
Merged

Nicholas023 merged 1 commit into
mainfrom
fix/slash-command-contract

Conversation

@Nicholas023

Copy link
Copy Markdown
Owner

问题

/review 的命令提示写着 repo_path [mode] [focus],但 handler 从来不看 invocation.rawInput,永远用会话 cwd 评审。

也就是说:提示在骗人。上一版 PR #39 修好了"命令不出现"(契约不符),这一版修"提示与行为不一致"。

做法

新增 parseReviewCommand()(纯函数,可注入存在性判定,19 个测试):

写法 结果
/review 会话 cwd + uncommitted
/review D:/repo 指定仓库
/review D:/repo scan 仓库 + 全仓扫描
/review scan 重点看并发 模式 + 重点
/review D:/r branch base=main head=dev 分支对比
/review commit=abc123 隐含 mode=commit
/review repo=D:/x focus=鉴权 纯 key=value

判定顺序:先抽 key=value,再按位置认「像路径的」和「模式关键字」,剩下拼成 focus。

不静默丢弃:未知 mode、空值都会以 ⚠ 附在回执里。

验证

  • tsc 干净
  • 全量 491 passed
  • CI 期待三 job 全绿

本 PR 由 DeepSeek Harness 辅助创建

The hint promised `repo_path [mode] [focus]`, but the handler never read
invocation.rawInput and always reviewed the session cwd. The hint was a lie.

parseReviewCommand() now handles positional args (path / mode keyword /
remaining text as focus) and key=value pairs (repo=, base=, head=,
commit=, focus=, mode=), with commit= implying mode=commit. Unknown ids and
empty values are reported back instead of being dropped silently.

19 new tests. Full suite: 491 passed.
@Nicholas023
Nicholas023 marked this pull request as draft November 4, 2026 16:04
@Nicholas023
Nicholas023 marked this pull request as ready for review November 4, 2026 16:04
@Nicholas023 Nicholas023 closed this Nov 4, 2026
@Nicholas023 Nicholas023 reopened this Nov 4, 2026
@Nicholas023
Nicholas023 merged commit 7823f72 into main Nov 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant