Skip to content

[code-simplifier] refactor: simplify cli-proxy code from #25013 (early-continue pattern + step numbering)#25037

Merged
pelikhan merged 1 commit intomainfrom
code-simplifier/cli-proxy-cleanup-2026-04-07-a916b90486f120b2
Apr 7, 2026
Merged

[code-simplifier] refactor: simplify cli-proxy code from #25013 (early-continue pattern + step numbering)#25037
pelikhan merged 1 commit intomainfrom
code-simplifier/cli-proxy-cleanup-2026-04-07-a916b90486f120b2

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 7, 2026

Code simplification of recent changes from PR #25013 (Remove cli-proxy-writable feature flag and add read-only gh CLI prompt for cli-proxy).

Files Simplified

  • pkg/workflow/mcp_setup_generator.go — Apply Go's idiomatic early-continue guard clause
  • pkg/workflow/unified_prompt_step.go — Fix sequential step numbering (9b10, 1011)

Improvements Made

1. Early-Continue Guard Clause (mcp_setup_generator.go)

The cli-proxy skip logic was nested inside the standard-MCP-tools if block:

// Before
if toolName == "github" || toolName == "playwright" || ... {
    if toolName == "github" && isFeatureEnabled(constants.CliProxyFeatureFlag, workflowData) {
        mcpSetupGeneratorLog.Print("Skipping...")
        continue
    }
    mcpTools = append(mcpTools, toolName)
}

Moved the guard clause before the block following Go's early-continue idiom, clearly separating "what to skip" from "what to include":

// After
if toolName == "github" && isFeatureEnabled(constants.CliProxyFeatureFlag, workflowData) {
    mcpSetupGeneratorLog.Print("Skipping...")
    continue
}
if toolName == "github" || toolName == "playwright" || ... {
    mcpTools = append(mcpTools, toolName)
}

2. Consistent Step Numbering (unified_prompt_step.go)

The new section was inserted as 9b between 9 and 10. Renumbered to maintain a clean sequential sequence: 9b10, former 1011.

Changes Based On

Recent changes from:

Testing

  • TestCollectPromptSections_CliProxy — all 4 sub-tests pass
  • TestBuildAWFArgsCliProxy — passes
  • go vet ./pkg/workflow/ — clean
  • make build — succeeds
  • ✅ No functional changes — behaviour is identical

Review Focus

Please verify that the early-continue refactor preserves the same tool-registration behaviour and that the step renumbering matches the surrounding comment style.

References: §24067037288

Generated by Code Simplifier · ● 1.5M ·

  • expires on Apr 8, 2026, 6:15 AM UTC

…proxy changes

- mcp_setup_generator.go: move the cli-proxy GitHub MCP skip guard clause
  before the standard tools check, following Go's idiomatic early-continue
  pattern for improved readability and separation of concerns
- unified_prompt_step.go: renumber section comment '9b' to '10' and
  former '10' to '11' for consistent sequential numbering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Apr 7, 2026
@pelikhan pelikhan marked this pull request as ready for review April 7, 2026 08:43
Copilot AI review requested due to automatic review settings April 7, 2026 08:43
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

This PR simplifies recently added cli-proxy logic by making the MCP setup generator use an early-continue guard clause and by renumbering prompt-section step comments to keep them sequential.

Changes:

  • Refactor generateMCPSetup to skip GitHub MCP registration via an early-continue when cli-proxy is enabled (preserving prior behavior).
  • Renumber prompt-section step comments to maintain a clean ...9, 10, 11... sequence.
Show a summary per file
File Description
pkg/workflow/mcp_setup_generator.go Moves the cli-proxy skip for GitHub MCP registration to an early-continue guard clause for clearer control flow.
pkg/workflow/unified_prompt_step.go Renumbers step comment labels (9b10, 1011) to keep ordering consistent.

Copilot's findings

Tip

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

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

@pelikhan pelikhan merged commit f833ced into main Apr 7, 2026
65 of 66 checks passed
@pelikhan pelikhan deleted the code-simplifier/cli-proxy-cleanup-2026-04-07-a916b90486f120b2 branch April 7, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants