From 41e80a21a175693621a06eec8e10fe1278cab76b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:45:00 +0000 Subject: [PATCH 1/2] Initial plan From 23f3e0f17a0dd86f827692da5409eb9333cb03c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:59:35 +0000 Subject: [PATCH 2/2] fix(cli): align help text and flag descriptions for consistency Agent-Logs-Url: https://github.com/github/gh-aw/sessions/dfc7a04f-f6a0-4185-b149-eb4ed7d7917c Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/cli/init_command.go | 3 --- pkg/cli/init_command_test.go | 4 ++++ pkg/cli/logs_command.go | 4 +++- pkg/cli/logs_command_test.go | 7 +++++++ pkg/cli/mcp_add.go | 2 +- pkg/cli/mcp_add_test.go | 10 +++++++--- pkg/cli/trial_command.go | 2 +- pkg/cli/trial_command_test.go | 16 ++++++++++++++++ 8 files changed, 39 insertions(+), 9 deletions(-) diff --git a/pkg/cli/init_command.go b/pkg/cli/init_command.go index 65a5f7d6b3a..fa13da01708 100644 --- a/pkg/cli/init_command.go +++ b/pkg/cli/init_command.go @@ -17,9 +17,6 @@ func NewInitCommand() *cobra.Command { Short: "Initialize the repository for agentic workflows", Long: `Initialize the repository for agentic workflows by configuring .gitattributes and creating the dispatcher agent file. -Usage: - gh aw init - This command performs non-interactive repository setup and does not prompt for engine selection or secret configuration. diff --git a/pkg/cli/init_command_test.go b/pkg/cli/init_command_test.go index ad33ebb067f..564fe7e11c2 100644 --- a/pkg/cli/init_command_test.go +++ b/pkg/cli/init_command_test.go @@ -117,6 +117,10 @@ func TestInitCommandHelp(t *testing.T) { if !strings.Contains(helpText, "non-interactive repository setup") { t.Error("Expected help text to mention non-interactive setup") } + + if strings.Contains(helpText, "Usage:") { + t.Error("Expected init long help text to not embed a Usage section") + } } func TestInitCommandInteractiveModeDetection(t *testing.T) { diff --git a/pkg/cli/logs_command.go b/pkg/cli/logs_command.go index 5b7dcd7393f..a6eaf90ad42 100644 --- a/pkg/cli/logs_command.go +++ b/pkg/cli/logs_command.go @@ -71,6 +71,8 @@ Examples: ` + string(constants.CLIExtensionPrefix) + ` logs --safe-output missing-tool # Filter logs with missing-tool messages ` + string(constants.CLIExtensionPrefix) + ` logs --safe-output missing-data # Filter logs with missing-data messages ` + string(constants.CLIExtensionPrefix) + ` logs --safe-output create-issue # Filter logs with create-issue messages + ` + string(constants.CLIExtensionPrefix) + ` logs --safe-output noop # Filter logs with noop messages + ` + string(constants.CLIExtensionPrefix) + ` logs --safe-output report-incomplete # Filter logs with report-incomplete messages ` + string(constants.CLIExtensionPrefix) + ` logs --ref main # Filter logs by branch or tag ` + string(constants.CLIExtensionPrefix) + ` logs --ref feature-xyz # Filter logs by feature branch ` + string(constants.CLIExtensionPrefix) + ` logs --filtered-integrity # Filter logs with DIFC (data integrity flow control) integrity-filtered items in the gateway logs @@ -202,7 +204,7 @@ Examples: logsCmd.Flags().Bool("no-staged", false, "Filter out staged workflow runs") logsCmd.Flags().Bool("firewall", false, "Filter to only runs with firewall enabled") logsCmd.Flags().Bool("no-firewall", false, "Filter to only runs without firewall enabled") - logsCmd.Flags().String("safe-output", "", "Filter to runs containing a specific safe output type (e.g., create-issue, missing-tool, missing-data)") + 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)") logsCmd.Flags().Bool("filtered-integrity", false, "Filter to runs with DIFC (data integrity flow control) integrity-filtered items in the gateway logs") logsCmd.Flags().Bool("parse", false, "Run JavaScript parsers on agent logs and firewall logs, writing Markdown to log.md and firewall.md") addJSONFlag(logsCmd) diff --git a/pkg/cli/logs_command_test.go b/pkg/cli/logs_command_test.go index 45079cd3e83..935bd4adc22 100644 --- a/pkg/cli/logs_command_test.go +++ b/pkg/cli/logs_command_test.go @@ -251,9 +251,16 @@ func TestLogsCommandHelpText(t *testing.T) { "Downloaded artifacts include:", "Examples:", "gh aw logs", + "--safe-output noop", + "--safe-output report-incomplete", } for _, section := range expectedSections { assert.Contains(t, cmd.Long, section, "Long description should contain: %s", section) } + + safeOutputFlag := cmd.Flags().Lookup("safe-output") + require.NotNil(t, safeOutputFlag, "safe-output flag should exist") + assert.Contains(t, safeOutputFlag.Usage, "noop", "safe-output flag help should mention noop") + assert.Contains(t, safeOutputFlag.Usage, "report-incomplete", "safe-output flag help should mention report-incomplete") } diff --git a/pkg/cli/mcp_add.go b/pkg/cli/mcp_add.go index 0a140801f66..6ddf1cad9a5 100644 --- a/pkg/cli/mcp_add.go +++ b/pkg/cli/mcp_add.go @@ -361,7 +361,7 @@ Registry URL defaults to: https://api.mcp.github.com/v0.1`, } cmd.Flags().StringVar(®istryURL, "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)") cmd.Flags().StringVar(&customToolID, "tool-id", "", "Custom tool ID to use in the workflow (default: uses server ID)") return cmd diff --git a/pkg/cli/mcp_add_test.go b/pkg/cli/mcp_add_test.go index b908a6480f2..3128b3ff0e2 100644 --- a/pkg/cli/mcp_add_test.go +++ b/pkg/cli/mcp_add_test.go @@ -157,15 +157,19 @@ This is a test workflow. } } -func TestMCPAddTransportFlagDescriptionUsesLowercaseDocker(t *testing.T) { +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) } } diff --git a/pkg/cli/trial_command.go b/pkg/cli/trial_command.go index 9391dfc53e0..69dcb3155ea 100644 --- a/pkg/cli/trial_command.go +++ b/pkg/cli/trial_command.go @@ -118,7 +118,7 @@ Trial results are saved both locally (in trials/ directory) and in the host repo // Add flags cmd.Flags().StringP("logical-repo", "l", "", "Repository to simulate workflow execution against, as if the workflow was installed there (defaults to current repository)") - cmd.Flags().String("clone-repo", "", "Alternative to --logical-repo: clone the contents of the specified repo into the host repo instead of using logical repository simulation") + cmd.Flags().String("clone-repo", "", "Clone the contents of the specified repository into the host repository before execution (useful for testing against actual repository state)") cmd.Flags().String("host-repo", "", "Custom host repository slug (defaults to '/gh-aw-trial'). Use '.' for current repository") cmd.Flags().String("repo", "", "Alias for --host-repo: the repository where workflows are installed and run (note: different semantics from --repo in other commands)") diff --git a/pkg/cli/trial_command_test.go b/pkg/cli/trial_command_test.go index 3cefbf98f8c..19c28351b32 100644 --- a/pkg/cli/trial_command_test.go +++ b/pkg/cli/trial_command_test.go @@ -11,6 +11,22 @@ import ( "github.com/github/gh-aw/pkg/testutil" ) +func TestNewTrialCommandCloneRepoFlagDescription(t *testing.T) { + cmd := NewTrialCommand(func(string) error { return nil }) + cloneRepoFlag := cmd.Flags().Lookup("clone-repo") + if cloneRepoFlag == nil { + t.Fatal("Expected 'clone-repo' flag to be defined") + } + + if strings.Contains(cloneRepoFlag.Usage, "Alternative to --logical-repo") { + t.Errorf("Expected clone-repo help text to avoid describing itself as an alternative to logical-repo, got: %s", cloneRepoFlag.Usage) + } + + if !strings.Contains(cloneRepoFlag.Usage, "Clone the contents of the specified repository") { + t.Errorf("Expected clone-repo help text to describe clone behavior, got: %s", cloneRepoFlag.Usage) + } +} + // Test the host repo slug processing logic with dot notation func TestHostRepoSlugProcessing(t *testing.T) { testCases := []struct {