Skip to content

Resolve CLI help consistency gaps across init, trial, mcp add, and logs#27861

Merged
pelikhan merged 2 commits intomainfrom
copilot/cli-consistency-fixes
Apr 22, 2026
Merged

Resolve CLI help consistency gaps across init, trial, mcp add, and logs#27861
pelikhan merged 2 commits intomainfrom
copilot/cli-consistency-fixes

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

CLI consistency inspection found four help-text mismatches across command docs and flag descriptions. This PR applies focused copy updates so help output is structurally clean, semantically accurate, and internally consistent.

  • init: remove duplicate/embedded usage section

    • Removed the inline Usage: block from init Long help so Cobra’s canonical Usage: section is the single source shown to users.
  • trial: clarify --clone-repo semantics

    • Reworded --clone-repo flag help to describe its actual behavior (cloning source repo contents into the host repo) instead of framing it as an alternative to --logical-repo.
  • mcp add: normalize transport value capitalization

    • Updated --transport help text values to stdio, HTTP, Docker to match capitalization used elsewhere in MCP command help/prose.
  • logs: complete --safe-output examples

    • Added missing valid values (noop, report-incomplete) to both command examples and the --safe-output flag description.
  • Targeted guardrails in tests

    • Added/updated help-text assertions in command tests to lock in these consistency rules and prevent regressions.
// before
logsCmd.Flags().String("safe-output", "", "Filter to runs containing a specific safe output type (e.g., create-issue, missing-tool, missing-data)")

// after
logsCmd.Flags().String("safe-output", "", "Filter to runs containing a specific safe output type (e.g., create-issue, missing-tool, missing-data, noop, report-incomplete)")

Copilot AI changed the title [WIP] Fix CLI consistency issues in command help text Resolve CLI help consistency gaps across init, trial, mcp add, and logs Apr 22, 2026
Copilot AI requested a review from pelikhan April 22, 2026 15:01
@pelikhan pelikhan marked this pull request as ready for review April 22, 2026 15:10
Copilot AI review requested due to automatic review settings April 22, 2026 15:10
@pelikhan pelikhan merged commit 00881d1 into main Apr 22, 2026
19 of 20 checks passed
@pelikhan pelikhan deleted the copilot/cli-consistency-fixes branch April 22, 2026 15:10
@github-actions github-actions Bot mentioned this pull request Apr 22, 2026
Copy link
Copy Markdown
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 CLI help-text consistency across several commands (init, trial, mcp add, logs) and adds/updates tests to guard against regressions in help output.

Changes:

  • Removed embedded Usage: block from init long help and added a test assertion to prevent reintroduction.
  • Updated trial --clone-repo help text to match actual behavior and added a targeted help-text test.
  • Expanded logs --safe-output examples/flag description to include noop and report-incomplete, with corresponding test coverage.
Show a summary per file
File Description
pkg/cli/trial_command.go Updates --clone-repo flag help copy for clarity/accuracy.
pkg/cli/trial_command_test.go Adds a unit test to enforce the updated --clone-repo help semantics.
pkg/cli/mcp_add.go Changes --transport help text to list stdio, HTTP, Docker.
pkg/cli/mcp_add_test.go Updates the transport help-text assertion to require HTTP and Docker.
pkg/cli/logs_command.go Adds missing --safe-output example values and extends flag description.
pkg/cli/logs_command_test.go Adds assertions ensuring new --safe-output examples and flag usage mention the added values.
pkg/cli/init_command.go Removes embedded Usage: from init long help.
pkg/cli/init_command_test.go Adds an assertion ensuring init long help does not include a Usage: section.

Copilot's findings

Tip

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

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

Comment thread pkg/cli/mcp_add.go

cmd.Flags().StringVar(&registryURL, "registry", "", "MCP registry URL (default: https://api.mcp.github.com/v0.1)")
cmd.Flags().StringVar(&transportType, "transport", "", "Preferred transport type (stdio, http, docker)")
cmd.Flags().StringVar(&transportType, "transport", "", "Preferred transport type (stdio, HTTP, Docker)")
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The --transport help text lists values "HTTP" and "Docker", but the implementation only accepts lowercase values (see createMCPToolConfig switch on preferredTransport: "stdio", "http", "docker"). As written, users following the help and passing "--transport HTTP" or "--transport Docker" will get an unsupported transport error. Either keep the help values lowercase, or normalize the flag value (e.g., strings.ToLower) and update the error message so the documented values are actually accepted.

Suggested change
cmd.Flags().StringVar(&transportType, "transport", "", "Preferred transport type (stdio, HTTP, Docker)")
cmd.Flags().StringVar(&transportType, "transport", "", "Preferred transport type (stdio, http, docker)")

Copilot uses AI. Check for mistakes.
Comment thread pkg/cli/mcp_add_test.go
Comment on lines +160 to 174
func TestMCPAddTransportFlagDescriptionIncludesCapitalizedHTTPAndDocker(t *testing.T) {
cmd := NewMCPAddSubcommand()
transportFlag := cmd.Flags().Lookup("transport")
if transportFlag == nil {
t.Fatal("expected --transport flag to exist")
}

if !strings.Contains(transportFlag.Usage, "docker") {
t.Fatalf("expected --transport usage to include docker, got: %s", transportFlag.Usage)
if !strings.Contains(transportFlag.Usage, "HTTP") {
t.Fatalf("expected --transport usage to include HTTP, got: %s", transportFlag.Usage)
}

if !strings.Contains(transportFlag.Usage, "Docker") {
t.Fatalf("expected --transport usage to include Docker, got: %s", transportFlag.Usage)
}
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

This test enforces capitalized "HTTP"/"Docker" in the --transport usage, but the command currently only supports lowercase transport values ("http", "docker"). Unless the implementation is updated to accept case-insensitive values, this will lock in help text that suggests invalid inputs. Consider asserting for the actual accepted tokens or updating the transport parsing to accept the capitalized forms documented in help.

See below for a potential fix:

func TestMCPAddTransportFlagDescriptionIncludesAcceptedTransportTokens(t *testing.T) {
	cmd := NewMCPAddSubcommand()
	transportFlag := cmd.Flags().Lookup("transport")
	if transportFlag == nil {
		t.Fatal("expected --transport flag to exist")
	}

	if !strings.Contains(transportFlag.Usage, "http") {
		t.Fatalf("expected --transport usage to include http, got: %s", transportFlag.Usage)
	}

	if !strings.Contains(transportFlag.Usage, "docker") {
		t.Fatalf("expected --transport usage to include docker, got: %s", transportFlag.Usage)

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 60/100

⚠️ Acceptable — with suggestions

Metric Value
New/modified tests analyzed 4
✅ Design tests (behavioral contracts) 4 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 0 (0%)
Duplicate test clusters 0
Test inflation detected Yes (3 of 4 files)
🚨 Coding-guideline violations None

Test Classification Details

View Per-Test Classifications (4 tests)
Test File Classification Issues Detected
TestInitCommandHelp (modified) pkg/cli/init_command_test.go:98 ✅ Design No error path; adds negative assertion on help text — appropriate for the change
TestLogsCommandHelpText (modified) pkg/cli/logs_command_test.go:245 ✅ Design Verifies noop/report-incomplete in Long desc and flag usage; require.NotNil guard present
TestMCPAddTransportFlagDescriptionIncludesCapitalizedHTTPAndDocker (renamed+modified) pkg/cli/mcp_add_test.go:160 ✅ Design Updated from lowercase to capitalized assertions; no error path; assertions include inline context via t.Fatalf format string
TestNewTrialCommandCloneRepoFlagDescription (new) pkg/cli/trial_command_test.go:14 ✅ Design Both negative (old text absent) and positive (new text present) assertions; t.Fatal guard on nil flag

Flagged Area — Error Coverage Gap

All 4 changed tests verify observable CLI help text and flag descriptions, which is exactly right for this "help consistency" PR. However, none test error paths (e.g., what happens when a command is given invalid arguments, when clone-repo and logical-repo are both specified, or when flag parsing fails).

This isn't a blocker for this PR given the narrow scope, but future work on these commands should add error-path coverage.


Test Inflation Note

i️ Inflation detail (3 files exceed 2:1 ratio)
Test File Lines Added (test) Lines Added (prod) Ratio
trial_command_test.go +16 +1 16:1
mcp_add_test.go +7 +1 7:1
init_command_test.go +4 0 (deletions only)
logs_command_test.go +7 +4 1.75:1 ✅

The inflation is expected here: the PR's production changes are primarily help-text tweaks (1-line flag description edits, removing an embedded section), which naturally require verbose assertions to verify. This is not harmful test inflation; the tests are appropriate in scope.


Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 4 tests — all unit (//go:build !integration) ✅
  • 🟨 JavaScript (*.test.cjs, *.test.js): 0 tests

Verdict

Check passed. 0% of new/modified tests are implementation tests (threshold: 30%). All 4 tests verify observable, user-facing CLI behavior (help text and flag descriptions), which is appropriate for a "CLI help consistency" PR. The primary suggestion is to add error-path tests for these commands in future iterations.


📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References: §24786157643

🧪 Test quality analysis by Test Quality Sentinel · ● 1.2M ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 60/100. Test quality is acceptable — 0% of new/modified tests are implementation tests (threshold: 30%). All 4 tests verify observable user-facing CLI behavior (help text and flag descriptions), appropriate for this consistency-fix PR. No coding-guideline violations detected.

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.

[cli-consistency] CLI Consistency Issues - 2026-04-22

3 participants