Skip to content

fix(cli): add 'detail' subcommand to /context command#3042

Merged
pomelo-nwu merged 1 commit into
QwenLM:mainfrom
YuchenLiang00:fix/context-command-detail-missing
Apr 10, 2026
Merged

fix(cli): add 'detail' subcommand to /context command#3042
pomelo-nwu merged 1 commit into
QwenLM:mainfrom
YuchenLiang00:fix/context-command-detail-missing

Conversation

@YuchenLiang00

Copy link
Copy Markdown
Contributor

Summary

Fixes #3040

The /context command was missing the detail subcommand in the autocomplete dropdown. When users type /context (with a trailing space), no suggestions appeared — unlike /stats which correctly shows model and tools.

Changes

File Description
packages/cli/src/ui/commands/contextCommand.ts Added subCommands array with detail entry (+13 lines)
packages/cli/src/i18n/locales/zh.js Added missing translation key for full description (+2 lines)
docs/users/features/commands.md Updated documentation to show /context detail usage (+1 line)

How it works

The detail subcommand delegates to the main action with "detail" as the argument, reusing existing logic — no code duplication.

subCommands: [
  {
    name: "detail",
    get description() {
      return t("Show per-item context usage breakdown.");
    },
    kind: CommandKind.BUILT_IN,
    action: async (context: CommandContext) => {
      await contextCommand.action!(context, "detail");
    },
  },
],

Before / After

Before: Typing /context shows no suggestions.

After: Typing /context shows detail with description "Show per-item context usage breakdown."

Checklist

  • Code follows project conventions (Conventional Commits, ESM, strict TypeScript)
  • Unit tests pass (useSlashCompletion.test.ts covers subcommand completion)
  • Documentation updated (docs/users/features/commands.md)
  • Small, atomic change — 3 files, +16 lines

The /context command was missing the subcommand autocomplete feature
that other commands like /stats have. Now users can type '/context '
and see 'detail' as a suggestion in the dropdown.

- Added 'detail' subCommand to contextCommand with its own description
- Subcommand delegates to main action with 'detail' arg
- Added missing translation key for full description in zh.js
- Updated commands.md documentation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@pomelo-nwu pomelo-nwu self-assigned this Apr 9, 2026
@pomelo-nwu

Copy link
Copy Markdown
Collaborator

@YuchenLiang00 Thanks for your contribution!It is recommended to add /context main by default; otherwise, the automatic secondary completion of /context detail will make it difficult for users to trigger the /context command.

@YuchenLiang00

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I looked into how /stats handles this — it follows the same pattern: /stats runs the main action (summary), and /stats shows subcommand suggestions (model, tools). There is no main subcommand for /stats either.

The behavior for /context is now consistent with /stats:

  • /context (no trailing space) → executes main action → shows context summary
  • /context (with trailing space) → shows detail subcommand in dropdown
  • /context detail → executes subcommand → shows per-item breakdown

This way, users who just want the summary can simply press Enter after /context, while those who want more detail will see the detail suggestion when they type a space.

@pomelo-nwu

Copy link
Copy Markdown
Collaborator

@YuchenLiang00 Yeah, /stats isn't great either. Let's dig deeper into this — both /stats and /context should probably be modal dialogs, so their content wouldn't be stored in the context. The interaction should work like /permission.

@YuchenLiang00

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestion! I agree that making and modal dialogs (like ) would be a better UX — it keeps the context clean and avoids consuming tokens for these diagnostic views.

This PR was intended as a small fix for the missing autocomplete, but I'm happy to close it if you'd prefer to address this in a larger modal-dialog PR instead. Just let me know what works best — either way, I'm glad to help!

@pomelo-nwu

Copy link
Copy Markdown
Collaborator

@YuchenLiang00 This PR is a minor change that follows our previous approach, so I'm happy to merge it. Thank you once again for your contribution. Additionally, I've just created an issue to track the follow-up work, and you're welcome to submit a PR for it.

@pomelo-nwu pomelo-nwu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pomelo-nwu pomelo-nwu merged commit cf81ac4 into QwenLM:main Apr 10, 2026
14 checks passed
@YuchenLiang00 YuchenLiang00 deleted the fix/context-command-detail-missing branch April 13, 2026 02:54
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
)

Co-authored-by: Pascal Birchler <pascalb@google.com>
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
…-detail-missing

fix(cli): add 'detail' subcommand to /context command
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.

Bug: /context command missing 'detail' subcommand in autocomplete dropdown

2 participants