Skip to content

Conversation

@Konippi
Copy link
Contributor

@Konippi Konippi commented Oct 18, 2025

Issue #, if available:
#3185

Description of changes:
Replace static COMMANDS array with dynamic generation to automatically sync available commands with SlashCommand
enum definition. This prevents inconsistencies like #3185 where unimplemented commands (e.g., /hooks help) appeared in the command list.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Konippi Konippi force-pushed the dynamically-generate-command-list branch from 0e2791b to b06d192 Compare October 18, 2025 14:45
}

// If this command has subcommands, add them too
if subcommand.has_subcommands() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this cover the case /context show --expand

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we're also missing these now -

"/hooks add",
"/hooks rm",
"/hooks enable",
"/hooks disable",
"/hooks enable-all",
"/hooks disable-all",

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend adding the existing commands as tests here -

async fn test_chat_hinter_command_hint() {

Don't need to commit all of those in, only for local testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this cover the case /context show --expand

Why does it only support the “/context show --expand” option? It should only support slash commands and their subcommands.

Looks like we're also missing these now -

"/hooks add",
"/hooks rm",
"/hooks enable",
"/hooks disable",
"/hooks enable-all",
"/hooks disable-all",

These subcommands should not exist at present.

.iter()
.filter(|p| p.starts_with(word))
.map(|s| (*s).to_owned())
.map(|s| s.to_string())
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, seeing this clippy error -

error: calling `to_string` on `&&str`
   --> crates/chat-cli/src/cli/chat/prompt.rs:127:22
    |
127 |             .map(|s| s.to_string())
    |                      ^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*s).to_string()`
    |
    = help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
    = note: `-D clippy::inefficient-to-string` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::inefficient_to_string)]`

error: could not compile `chat_cli` (lib) due to 1 previous error

Can you run -

cargo clippy --locked --workspace --color always -- -D warnings
cargo +nightly fmt

@Konippi Konippi requested a review from kkashilk October 22, 2025 23:28
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.

2 participants