qwen-code/docs/design/slash-command
顾盼 b55b52543a
feat(cli): improve slash command discovery (#3736)
* feat(cli): improve slash command discovery

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(cli): update input prompt completion expectations

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): address review feedback on slash command phase 3

- Fix getBestSlashCommandMatch sort order: completionPriority first,
  recentOrder second — consistent with compareRankedCommandMatches in
  useSlashCompletion.ts so ghost text and dropdown agree on best match

- Fix findSlashCommandTokens to index altNames into commandMap so alias
  tokens (e.g. /usage for /stats) are highlighted as valid instead of
  being marked invalid

- Fix getRecentScore decay formula: 10 * Math.max(0, 1 - ageMs /
  RECENT_DECAY_MS) so the recent boost truly decays to 0 within the
  10-minute window named by RECENT_DECAY_MS

- Fix Help.tsx CommandsHelp scroll indicator to show command count
  range (e.g. 1-12/49) instead of raw line count (18/108), which was
  confusing because each command expands into 2-3 render lines

- Fix Help.tsx CommandLine key prop: use stable type:text:index key
  instead of scrollOffset-index to avoid remounting every line on scroll

- Internationalize Help.tsx tab labels via t() instead of hardcoded
  English strings

- Add Tab/Shift+Tab to switch tabs hint in Help footer alongside Esc

- Add commandMetadata.test.ts with full branch coverage for all 6
  exported functions (getCommandSourceBadge, getCommandSourceGroup,
  formatSupportedModes, getCommandDisplayName, getCommandSubcommandNames,
  formatCommandSourceLabel)

- Add direct unit tests for getBestSlashCommandMatch covering: null on
  empty input, null on no match, null for non-modelInvocable commands,
  completionPriority ordering, recentCommands tie-breaking, argumentHint
  return path, exact-match exclusion without hint, inclusion with hint

- Update Session.test.ts expectation for sendAvailableCommandsUpdate to
  include _meta field that was added in this PR

* test(cli): add missing test coverage for slash completion

- Add test: midInputGhostText is null when only non-modelInvocable commands match
- Add test: recentCommands boosts non-root prefix suggestions via recentScore

Both tests address coverage gaps identified in code review.

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-05-09 14:25:44 +08:00
..
compare.md refactor(cli): replace slash command whitelist with capability-based filtering (Phase 1) (#3283) 2026-04-20 14:34:43 +08:00
phase1-technical-design.md refactor(cli): replace slash command whitelist with capability-based filtering (Phase 1) (#3283) 2026-04-20 14:34:43 +08:00
phase2-technical-design.md feat(cli): Phase 2 — slash command multi-mode expansion, ACP fixes, and UX improvements (#3377) 2026-04-22 19:12:44 +08:00
phase3-technical-design.md feat(cli): improve slash command discovery (#3736) 2026-05-09 14:25:44 +08:00
roadmap.md feat(cli): improve slash command discovery (#3736) 2026-05-09 14:25:44 +08:00