Conversation
…rence in AGENTS.md Agent-Logs-Url: https://github.com/github/gh-aw/sessions/227f441a-3020-4a42-ab3b-68614001b640 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Documents previously undocumented exported functions in pkg/console and corrects an invalid stringutil function reference in AGENTS.md.
Changes:
- Expanded
pkg/console/README.mdto cover additional exported formatting, rendering, interactive prompt, layout, terminal control, verbose logging, and utility functions. - Fixed
AGENTS.mdto referencestringutil.StripANSI()(existing) instead ofstringutil.StripANSIEscapeCodes()(nonexistent).
Show a summary per file
| File | Description |
|---|---|
| pkg/console/README.md | Adds API documentation for multiple exported console functions, including new sections for layout/terminal/verbose utilities. |
| AGENTS.md | Corrects the documented ANSI-stripping helper name to match the actual stringutil API. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
pkg/console/README.md:583
PromptInputWithValidationis documented as an interactive WASM-only prompt, but the WASM implementation always returns an error (pkg/console/input_wasm.go) and there is no non-WASM implementation. Please update the documentation to match the current behavior/availability so callers don’t expect this to work.
### `PromptInputWithValidation(title, description, placeholder string, validate func(string) error) (string, error)`
Like `PromptInput` but accepts a validation function that is called on the entered value before the form is submitted.
```go
value, err := console.PromptInputWithValidation(
"Workflow name", "Must be kebab-case", "my-workflow",
func(s string) error {
if s == "" {
return errors.New("name cannot be empty")
}
return nil
},
)
Note:
PromptInputWithValidationis only available in WASM builds.
**pkg/console/README.md:631**
* `RunForm` is documented as a working WASM-only form runner, but the only implementation (`pkg/console/form_wasm.go`) always returns an error (`interactive forms not available in Wasm`). Please update this section to reflect that it’s currently unsupported/unimplemented, or adjust the docs to the actual supported path.
RunForm(fields []FormField) error
Runs a multi-field interactive form defined by a slice of FormField values. Populates the Value pointer of each field and returns an error if the form is cancelled or fails.
var name, token string
err := console.RunForm([]console.FormField{
{Type: "input", Title: "Name", Value: &name},
{Type: "password", Title: "Token", Value: &token},
})Note:
RunFormis only available in WASM builds. Usehuhforms directly in non-WASM builds.
</details>
- **Files reviewed:** 2/2 changed files
- **Comments generated:** 5
| ### `ShowInteractiveList(title string, items []ListItem) (string, error)` | ||
|
|
||
| Displays an interactive single-selection list using arrow key navigation. Returns the value of the selected `ListItem`. Returns an error if the list is empty or the prompt is cancelled. Falls back to a numbered text list in non-TTY environments. | ||
|
|
There was a problem hiding this comment.
ShowInteractiveList has a WASM stub that always returns an error (pkg/console/list_wasm.go), but this doc block describes interactive behavior and a non-TTY fallback without mentioning the WASM behavior. Please document that WASM builds return an error / the function is unavailable there, to avoid misleading consumers.
| ### `PromptInput(title, description, placeholder string) (string, error)` | ||
|
|
||
| Displays a single-line text input prompt. Returns the entered string or an error. | ||
|
|
||
| ```go | ||
| value, err := console.PromptInput("Repository name", "Enter the full owner/repo", "owner/repo") | ||
| ``` | ||
|
|
||
| > **Note**: `PromptInput` is only available in WASM builds. Use `huh` forms directly in non-WASM builds. | ||
|
|
There was a problem hiding this comment.
This section says PromptInput is “only available in WASM builds”, but the WASM implementation (pkg/console/input_wasm.go) always returns an error (interactive input not available in Wasm) and there is no non-WASM implementation. The README should reflect the actual behavior (currently unimplemented / always errors) and clarify availability across build targets.
This issue also appears on line 566 of the same file.
| ### `PromptSelect(title, description string, options []SelectOption) (string, error)` | ||
|
|
||
| Displays a single-select dropdown prompt. Returns the `Value` of the chosen `SelectOption` or an error. | ||
|
|
||
| ```go | ||
| opt, err := console.PromptSelect( | ||
| "Engine", "Choose an AI engine", | ||
| []console.SelectOption{ | ||
| {Label: "Copilot", Value: "copilot"}, | ||
| {Label: "Claude", Value: "claude"}, | ||
| }, | ||
| ) | ||
| ``` | ||
|
|
||
| > **Note**: `PromptSelect` is only available in WASM builds. | ||
|
|
||
| ### `PromptMultiSelect(title, description string, options []SelectOption, limit int) ([]string, error)` | ||
|
|
||
| Displays a multi-select prompt. Returns a slice of selected `Value` strings or an error. Pass `limit ≤ 0` for no selection limit. | ||
|
|
||
| ```go | ||
| selected, err := console.PromptMultiSelect( | ||
| "Toolsets", "Choose toolsets to enable", | ||
| []console.SelectOption{ | ||
| {Label: "Default", Value: "default"}, | ||
| {Label: "Issues", Value: "issues"}, | ||
| {Label: "PRs", Value: "pull_requests"}, | ||
| }, | ||
| 0, | ||
| ) | ||
| ``` | ||
|
|
||
| > **Note**: `PromptMultiSelect` is only available in WASM builds. | ||
|
|
There was a problem hiding this comment.
PromptSelect/PromptMultiSelect are documented as functional interactive prompts, but in WASM builds they always return an error (pkg/console/select_wasm.go) and there are no non-WASM implementations. The README should clarify that these currently aren’t available (or document the supported alternative API).
This issue also appears on line 618 of the same file.
|
|
||
| ## Terminal Control Functions | ||
|
|
||
| These functions emit ANSI control sequences to manage the terminal display. They are no-ops when stderr is not a TTY. |
There was a problem hiding this comment.
The section header says “These functions … are no-ops when stderr is not a TTY”, but ShowWelcomeBanner still prints the banner/description even when stderr isn’t a TTY (only ClearScreen is gated). Please narrow the statement to ClearScreen/ClearLine, or document the actual behavior of ShowWelcomeBanner in non-TTY environments.
| These functions emit ANSI control sequences to manage the terminal display. They are no-ops when stderr is not a TTY. | |
| These functions emit ANSI control sequences to manage the terminal display. `ClearScreen` and `ClearLine` are no-ops when stderr is not a TTY. |
|
|
||
| ```go |
There was a problem hiding this comment.
RenderTree is only defined under //go:build js || wasm (see pkg/console/console_wasm.go), so it isn’t available in non-WASM builds. The README section should explicitly note this (or document the non-WASM equivalent, if any).
| ```go | |
| **Note:** `RenderTree` is only available in `js/wasm` builds (it is defined behind a build tag), so it cannot be used from non-WASM targets. | |
| ```go | |
| // Available only when building for GOOS=js / GOARCH=wasm. |
pkg/console/README.mdcovered ~58% of the package's public API — 21 exported functions acrossrender.go,terminal.go,verbose.go,layout_wasm.go,input*.go,select_wasm.go,form_wasm.go, andconsole_wasm.gohad no documentation. Additionally,AGENTS.mdreferencedstringutil.StripANSIEscapeCodes()which does not exist; the correct name isstringutil.StripANSI().AGENTS.mdstringutil.StripANSIEscapeCodes()→stringutil.StripANSI()pkg/console/README.mdFormatListHeader,FormatLocationMessage,FormatCountMessage(WASM-only, noted as such)RenderTreeShowInteractiveList,PromptInput,PromptSecretInput,PromptInputWithValidation,PromptSelect,PromptMultiSelect,RunForm; WASM-only and non-TTY availability noted per functionLayoutTitleBox,LayoutInfoSection,LayoutEmphasisBox,LayoutJoinVertical; all WASM-onlyClearScreen,ClearLine,ShowWelcomeBannerLogVerboseFormatNumber,ToRelativePath,FormatErrorWithSuggestions