Skip to content

bgctl: improve usability feedback and flag guidance (part 1)#578

Open
MaxRink wants to merge 3 commits intomainfrom
fix/issue-544-cli-usability-part1
Open

bgctl: improve usability feedback and flag guidance (part 1)#578
MaxRink wants to merge 3 commits intomainfrom
fix/issue-544-cli-usability-part1

Conversation

@MaxRink
Copy link
Collaborator

@MaxRink MaxRink commented Mar 17, 2026

Summary

  • improve unknown output format errors in bgctl session, bgctl debug, and bgctl escalation commands to include supported format choices
  • clarify watch polling interval help text to include Go duration syntax examples (2s, 1m)
  • clarify debug --state flag help text to mention comma-separated filter values
  • add actionable guidance for missing-context errors in bgctl config delete-context (bgctl config get-contexts)
  • add unit tests for the new output-format error helper and for the config missing-context guidance

Scope

This is a focused first slice of #544 (error/help text and guidance improvements). Remaining items (broader command examples, additional short flags, and update progress UX) can be handled in follow-up PRs.

Refs #544

Validation

  • go test ./pkg/bgctl/cmd -run 'TestUnknownOutputFormatError|TestConfigDeleteContextNotFound'
  • make lint
  • make test

Copilot AI review requested due to automatic review settings March 17, 2026 16:55
@MaxRink MaxRink requested a review from a team as a code owner March 17, 2026 16:55
@github-actions github-actions bot added documentation Improvements or additions to documentation pkg tests size/S labels Mar 17, 2026
@github-actions
Copy link

github-actions bot commented Mar 17, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions
Copy link

github-actions bot commented Mar 17, 2026

Manifest Changes vs v0.1.0-beta.27

base

✅ No changes

debug

✅ No changes

crds

✅ No changes

@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 42.30769% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.73%. Comparing base (4fcd19d) to head (62bb4ed).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/bgctl/cmd/debug.go 19.04% 17 Missing ⚠️
pkg/bgctl/cmd/session.go 11.11% 8 Missing ⚠️
pkg/bgctl/cmd/escalation.go 0.00% 3 Missing ⚠️
pkg/bgctl/cmd/output_format_error.go 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #578   +/-   ##
=======================================
  Coverage   68.72%   68.73%           
=======================================
  Files         159      160    +1     
  Lines       33630    33647   +17     
=======================================
+ Hits        23112    23127   +15     
- Misses       8989     8990    +1     
- Partials     1529     1530    +1     
Flag Coverage Δ
cli 61.74% <42.30%> (+0.13%) ⬆️
controller 71.17% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/bgctl/cmd/config.go 75.83% <100.00%> (ø)
pkg/bgctl/cmd/root.go 86.08% <100.00%> (ø)
pkg/bgctl/cmd/output_format_error.go 88.23% <88.23%> (ø)
pkg/bgctl/cmd/escalation.go 61.64% <0.00%> (ø)
pkg/bgctl/cmd/session.go 42.98% <11.11%> (ø)
pkg/bgctl/cmd/debug.go 60.63% <19.04%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves bgctl CLI usability by making output-format errors and flag help text more actionable, and adds tests + changelog entry to cover the new behavior.

Changes:

  • Add unknownOutputFormatError helper and use it in session, debug, and escalation list-style commands to include supported -o/--output choices in errors.
  • Clarify watch --interval help text with Go duration examples, and clarify debug --state help text as comma-separated.
  • Improve config delete-context missing-context error with an actionable get-contexts hint, and add/extend unit tests + changelog entry.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/bgctl/cmd/session.go Improves watch interval help text; upgrades list command unknown-format error to include supported choices.
pkg/bgctl/cmd/escalation.go Upgrades unknown-format errors in escalation list commands to include supported choices.
pkg/bgctl/cmd/debug.go Upgrades unknown-format errors; improves --interval and --state flag guidance.
pkg/bgctl/cmd/output_format_error.go Adds helper for consistent unknown output format errors with supported choices.
pkg/bgctl/cmd/output_format_error_test.go Adds unit tests for the new helper.
pkg/bgctl/cmd/config.go Adds actionable guidance to missing-context error in delete-context.
pkg/bgctl/cmd/config_commands_test.go Extends unit test to assert the new guidance is present.
CHANGELOG.md Documents the CLI usability improvements under Unreleased.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves bgctl CLI usability by making output-format errors more actionable, clarifying flag help text, and adding guidance for common config mistakes across the CLI command suite.

Changes:

  • Added a shared helper to produce output-format errors that list supported choices, and wired it into session, debug, and escalation commands (including object-returning subcommands).
  • Clarified flag help text for polling intervals (Go duration examples) and debug --state filtering (comma-separated).
  • Improved config delete-context missing-context error guidance and added unit tests + changelog entry.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/bgctl/cmd/session.go Improves --interval help and uses the new output-format error helper / runtime object writer paths.
pkg/bgctl/cmd/debug.go Improves unknown output-format errors, clarifies --interval and --state help, and validates output formats for object-returning commands.
pkg/bgctl/cmd/escalation.go Improves unknown output-format errors and validates output formats for get.
pkg/bgctl/cmd/root.go Updates global --output/-o help text to include wide and note command-dependent support.
pkg/bgctl/cmd/output_format_error.go Introduces helper(s) for validating output formats and producing actionable format errors.
pkg/bgctl/cmd/output_format_error_test.go Adds unit tests for the new output-format validation/error helper.
pkg/bgctl/cmd/config.go Adds actionable guidance when deleting a non-existent context.
pkg/bgctl/cmd/config_commands_test.go Extends test coverage to assert the new missing-context guidance.
CHANGELOG.md Documents the CLI usability improvements under Unreleased changes.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +10 to +37
func validateOutputFormat(format output.Format, supported ...output.Format) error {
for _, value := range supported {
if format == value {
return nil
}
}
return unknownOutputFormatError(format, supported...)
}

func writeRuntimeObject(rt *runtimeState, obj any, supported ...output.Format) error {
format := output.Format(rt.OutputFormat())
if err := validateOutputFormat(format, supported...); err != nil {
return err
}
return output.WriteObject(rt.Writer(), format, obj)
}

func unknownOutputFormatError(format output.Format, supported ...output.Format) error {
if len(supported) == 0 {
return fmt.Errorf("unknown output format: %s", format)
}

choices := make([]string, 0, len(supported))
for _, value := range supported {
choices = append(choices, string(value))
}

return fmt.Errorf("unknown output format: %s (choose from: %s)", format, strings.Join(choices, ", "))
@github-actions
Copy link

📸 UI Screenshots

Captured 22 screenshots (11 light, 11 dark mode)

📥 Download

Pages Captured

Page Light Dark
Home
Session Browser
Pending Approvals
My Requests
Session Review
Debug Sessions
Create Debug Session
404 Not Found
Mobile Views
Tablet Views

Screenshots are generated automatically on each PR that modifies frontend code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation frontend pkg size/M size/S tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants