[pull] trunk from cli:trunk - #325
Merged
Merged
Conversation
When an agent misuses a command, the terse usage string does not carry the examples, JSON fields or environment variables it needs to correct itself, forcing a second `--help` invocation. Extract the help renderer out of rootHelpFunc so it can target any writer, then use it from printError when an agent is detected. Rendering directly to stderr avoids cmd.Help(), which writes to stdout and would otherwise split a single failure across two streams. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A user-defined alias is a stub command: its own help carries no flags or examples, only "Alias for ...". NewCmdRoot works around this by pointing the alias's usage and help funcs at the command it expands to, but printError calls root.WriteHelp directly and so bypassed that redirection. The result was that agents got strictly worse output than humans for aliases: `gh prs --badFlag` rendered 384 bytes of alias stub with none of `pr list`'s flags, leaving the agent no way to correct itself. Resolve the alias inside WriteHelp so the behaviour cannot be missed by a future call site. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d6afb36c-b3b5-472f-b540-025e38395b79
Print full help on command misuse for invoking agents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )