Skip to content

feat: suggest common mistaken subcommands - #334

Merged
zeroshade merged 4 commits into
columnar-tech:mainfrom
amoeba:feat/provide-subcommand-suggestions
Mar 31, 2026
Merged

zeroshade merged 4 commits into
columnar-tech:mainfrom
amoeba:feat/provide-subcommand-suggestions

Conversation

@amoeba

@amoeba amoeba commented Mar 27, 2026

Copy link
Copy Markdown
Member

This PR adds a way for dbc to suggest commands when the user enters a command
that doesn't exist. It adds a hook to our argument parser's error handler to
augment the error message with a suggestion.

I started with list -> search because I notice that users and/or AI agents like
to hallucinate 'dbc list' and I think this will help by at least reducing the
number of turns it takes for the agent to learn about dbc search.

We might consider a fuzzy suggestion feature (saerch -> search) like other CLI
tools use as a follow-on to this.

@amoeba

amoeba commented Mar 27, 2026

Copy link
Copy Markdown
Member Author

Happy to take ideas on the look of this,

$ ./dbc list
Usage: dbc [--quiet] <command> [<args>]
error: invalid subcommand: list. Did you mean: dbc search?

@amoeba
amoeba requested review from ianmcook and zeroshade March 27, 2026 17:37
Comment thread cmd/dbc/main.go Resolved
Comment thread cmd/dbc/main.go Resolved
Comment thread cmd/dbc/main.go Resolved
@amoeba
amoeba force-pushed the feat/provide-subcommand-suggestions branch from 724e119 to 21a0d6c Compare March 31, 2026 01:11
@amoeba

amoeba commented Mar 31, 2026

Copy link
Copy Markdown
Member Author

I'd like to put the change for printing help text from stdout to stderr in another PR so I addressed just the newline.

@zeroshade did you have any thoughts on the look or wording?

@zeroshade
zeroshade merged commit b51ef3c into columnar-tech:main Mar 31, 2026
13 of 14 checks passed
zeroshade pushed a commit that referenced this pull request Apr 17, 2026
This PR adds a way for dbc to suggest commands when the user enters a
command
that doesn't exist. It adds a hook to our argument parser's error
handler to
augment the error message with a suggestion.

I started with list -> search because I notice that users and/or AI
agents like
to hallucinate 'dbc list' and I think this will help by at least
reducing the
number of turns it takes for the agent to learn about dbc search.

We might consider a fuzzy suggestion feature (saerch -> search) like
other CLI
tools use as a follow-on to this.
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