Skip to content

Standardize CLI help section order and GHE note wording#41461

Merged
pelikhan merged 3 commits into
mainfrom
copilot/cli-consistency-fixes
Jun 25, 2026
Merged

Standardize CLI help section order and GHE note wording#41461
pelikhan merged 3 commits into
mainfrom
copilot/cli-consistency-fixes

Conversation

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

CLI help output had two consistency gaps: 7 commands rendered Examples before Usage, and add-wizard used different GitHub Enterprise shorthand-source note wording than add/update. This change normalizes both without altering command behavior.

  • Help output ordering consistency

    • Updated new, remove, enable, disable, compile, run, and version to use Cobra Example field instead of embedding examples in Long.
    • This makes rendered help consistently follow:
      • description
      • Usage:
      • Examples:
      • Flags:
  • GitHub Enterprise note wording consistency

    • Aligned add-wizard note text with add/update:
      • shorthand source specs
      • microsoft/* sources
      • source URLs for other public github.com workflows
  • Focused regression coverage

    • Added a dedicated help-format test ensuring Usage appears before Examples for all affected commands.
    • Updated add-wizard wording assertions to the canonical GHE phrasing.
// before: examples embedded in Long (rendered before Usage for some commands)
Long: `... 
Examples:
  gh aw disable ...
`,

// after: examples moved to Cobra Example field (Usage renders first)
Long: `...`,
Example: `  gh aw disable ...`,

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

⚠️ Assignment failed: Failed to assign copilot coding agent to this issue.

Error: copilot coding agent is not available for this repository

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CLI examples and usage ordering inconsistencies Standardize CLI help section order and GHE note wording Jun 25, 2026
Copilot AI requested a review from pelikhan June 25, 2026 14:25
@pelikhan pelikhan marked this pull request as ready for review June 25, 2026 14:25
Copilot AI review requested due to automatic review settings June 25, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes gh aw CLI help rendering so Usage consistently appears before Examples, and aligns add-wizard’s GitHub Enterprise shorthand note wording with the canonical phrasing used elsewhere. It also adds a regression test to prevent future help-order regressions.

Changes:

  • Moved examples for several commands (new, remove, enable, disable, compile, run, version) into Cobra’s Example field so help output renders Usage before Examples.
  • Updated add-wizard GitHub Enterprise note wording and adjusted its test assertions accordingly.
  • Added a help-format test that asserts Usage precedes Examples for the affected commands.
Show a summary per file
File Description
pkg/cli/add_wizard_command.go Aligns GitHub Enterprise shorthand note wording in add-wizard help text.
pkg/cli/add_wizard_command_test.go Updates assertions to match the new canonical note wording.
cmd/gh-aw/main.go Migrates embedded examples from Long to Cobra Example for consistent help section ordering.
cmd/gh-aw/help_sections_order_test.go Adds a regression test ensuring Usage appears before Examples in help output.
.github/workflows/smoke-copilot.lock.yml Lockfile regenerated; includes compiled strictness/metadata changes.
.github/workflows/smoke-copilot-aoai-entra.lock.yml Lockfile regenerated; includes compiled strictness/metadata changes.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 2

Comment on lines 172 to +176
GH_AW_INFO_AWF_VERSION: "v0.27.10"
GH_AW_INFO_AWMG_VERSION: ""
GH_AW_INFO_FIREWALL_TYPE: "squid"
GH_AW_INFO_FRONTMATTER_EMOJI: "🧪"
GH_AW_COMPILED_STRICT: "true"
GH_AW_COMPILED_STRICT: "false"
Comment on lines 171 to +176
GH_AW_INFO_FIREWALL_ENABLED: "true"
GH_AW_INFO_AWF_VERSION: "v0.27.10"
GH_AW_INFO_AWMG_VERSION: ""
GH_AW_INFO_FIREWALL_TYPE: "squid"
GH_AW_INFO_FRONTMATTER_EMOJI: "🧪"
GH_AW_COMPILED_STRICT: "true"
GH_AW_COMPILED_STRICT: "false"
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel already completed for PR #41461 (workflow run 28177269137). Analysis result: 75/100 Acceptable, 2 design tests, 0 violations, APPROVE submitted. This is a duplicate invocation of the same workflow run.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #41461 does not have the 'implementation' label and has only 6 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions github-actions Bot mentioned this pull request Jun 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Quality Sentinel Report

Test Quality Score: 75/100 - Acceptable

Analyzed 2 test(s): 2 design, 0 implementation, 0 guideline violation(s).

Metrics: 2 tests analyzed

  • New/modified tests analyzed: 2
  • Design tests (behavioral contracts): 2 (100%)
  • Implementation tests (low value): 0 (0%)
  • Tests with error/edge cases: 1 (50%)
  • Duplicate test clusters: 0
  • Test inflation detected: Yes (help_sections_order_test.go +55 lines vs main.go +16 lines, 3.4:1 ratio > 2:1)
  • Coding-guideline violations: 0
Test File Classification Issues
TestUsageAppearsBeforeExamplesInHelpOutput cmd/gh-aw/help_sections_order_test.go:13 Design none
TestAddWizardCommand_UsesStandardThreePartWorkflowSpecWording pkg/cli/add_wizard_command_test.go:20 Design No assertion messages; happy-path only

Go: 2 (*_test.go); JavaScript: 0.

Minor flags

TestAddWizardCommand_UsesStandardThreePartWorkflowSpecWording (pkg/cli/add_wizard_command_test.go:20): bare assert.Contains calls without a descriptive third argument (guideline recommends a context message for every assertion). Also: no error-path coverage. Suggested fix: add a message arg like assert.Contains(t, cmd.Long, "...", "expected GHE note wording in Long help").

Test inflation note: cmd/gh-aw/help_sections_order_test.go adds 55 lines against main.go 16 net additions (ratio 3.4:1). The bulk is legitimate setup/teardown boilerplate for iterating 7 commands with t.Cleanup.

Verdict

Check passed. 0% implementation tests (threshold: 30%). Both tests verify observable user-facing behavior: the help section ordering contract and the exact CLI help text wording.

Score breakdown: 40/40 behavioral + 15/30 edge-case + 20/20 duplication + 0/10 inflation = 75/100

🧪 Test quality analysis by Test Quality Sentinel · 74 AIC · ⌖ 21.9 AIC · ⊞ 8.4K ·

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test Quality Sentinel: 75/100. Test quality is acceptable - 0% of new tests are implementation tests (threshold: 30%). Both tests verify observable user-facing behavior (help section ordering and CLI help text wording).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /improve-codebase-architecture and /zoom-out — approving with one minor suggestion on test coverage scope.

📋 Key Themes & Highlights

Positive Highlights

  • ✅ Correct Cobra pattern: moving examples from Long into the dedicated Example field is exactly how Cobra is meant to be used — it's idiomatic and ensures consistent help rendering across all output formats.
  • ✅ Mechanical consistency: the 7-command refactoring in main.go is uniform and clean, with no behavioral changes.
  • ✅ Regression test added: TestUsageAppearsBeforeExamplesInHelpOutput directly encodes the invariant this PR restores, which is excellent practice.
  • ✅ GHE note wording: the add-wizard alignment with add/update canonical phrasing is precise and the test assertions are updated in lockstep.

Observation

  • The new test hardcodes exactly the 7 commands fixed in this PR. Adding the canonical commands (addCmd, updateCmd, auditCmd) or switching to a dynamic rootCmd.Commands() walk would make the invariant self-enforcing for future contributors (see inline comment).

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 55.3 AIC · ⌖ 9.67 AIC · ⊞ 6.5K

removeCmd,
runCmd,
versionCmd,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/improve-codebase-architecture] The hardcoded list of 7 commands will silently miss any future command added with examples embedded in Long. New contributors have no signal that this list needs updating.

💡 Consider iterating dynamically over rootCmd.Commands()

Since this test lives in package main and has access to rootCmd, iterating over all subcommands would make the test self-maintaining:

for _, cmd := range rootCmd.Commands() {
    if cmd.Example == "" {
        continue // skip commands without examples
    }
    t.Run(cmd.CommandPath(), func(t *testing.T) {
        // ... same assertions ...
    })
}

Alternatively, rounding out the list with addCmd, updateCmd, and auditCmd (the canonical commands this PR aligned add-wizard with) would at least confirm those also remain regression-free.

@pelikhan pelikhan merged commit ff5f947 into main Jun 25, 2026
87 checks passed
@pelikhan pelikhan deleted the copilot/cli-consistency-fixes branch June 25, 2026 14:46

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking issues. The core changes are correct: moving examples to Cobra's Example field is the right fix for help section ordering, the add-wizard wording is now consistent, and the regression test adds meaningful coverage.

Review themes

Lock file recompile (non-blocking): The GH_AW_COMPILED_STRICT flip in both smoke lock files looks alarming but is actually a correction — the source markdown declares strict: false (confirmed). The prior strict: true in the lock files was a pre-existing inconsistency. See inline comment on the cause.

Test maintainability (non-blocking): The help-order test hardcodes the 7 changed commands. This works today but won't automatically cover new commands that reintroduce the embedded-examples pattern. See inline comment for a self-maintaining alternative.

🔎 Code quality review by PR Code Quality Reviewer · 94.3 AIC · ⌖ 6.9 AIC · ⊞ 5.2K

)

func TestUsageAppearsBeforeExamplesInHelpOutput(t *testing.T) {
commands := []*cobra.Command{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hardcoded command list is a maintenance trap: new commands can silently reintroduce the Long-embedded-examples anti-pattern with zero test coverage.

💡 Suggested fix

Drive the test from rootCmd.Commands() rather than a static slice, skipping commands without an Example set:

for _, cmd := range rootCmd.Commands() {
    if cmd.Example == "" {
        continue // no examples to check ordering for
    }
    t.Run(cmd.CommandPath(), func(t *testing.T) {
        // ... existing buffer / Help() / strings.Index logic
    })
}

This makes the check self-maintaining as new commands are added, with no manual list to keep in sync.

GH_AW_INFO_FIREWALL_TYPE: "squid"
GH_AW_INFO_FRONTMATTER_EMOJI: "🧪"
GH_AW_COMPILED_STRICT: "true"
GH_AW_COMPILED_STRICT: "false"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unintentional lock file recompile — result is correct, but traceability is lost. The previous value "true" was inconsistent with the source markdown, which declares strict: false on line 148 of smoke-copilot.md. The new value "false" is accurate.

However, this PR contains no changes to .github/workflows/*.md files, so running make recompile was unnecessary. Per AGENTS.md, the lock-file regeneration flow should only be triggered after workflow markdown changes. The silent fix to a pre-existing inconsistency is hard to audit — it looks like a behavioral change without an obvious cause.

💡 Suggestion

Add a PR description note explaining that the lock files were regenerated as a side effect and that the strictness change aligns with the source strict: false declaration. In future, avoid running make recompile in PRs that don't modify workflow .md sources.

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.

4 participants