MCPcopy Create free account
hub / github.com/github/gh-aw / isGitHubCLIModeEnabled

Function isGitHubCLIModeEnabled

pkg/workflow/mcp_github_config.go:96–121  ·  view source on GitHub ↗

isGitHubCLIModeEnabled returns true when GitHub prompt/runtime mode is explicitly set to `tools.github.mode: gh-proxy`. If mode is explicitly set to `local` or `remote`, it takes precedence over the legacy features.cli-proxy flag (treated as MCP mode). When mode is not explicitly set, this returns t

(data *WorkflowData)

Source from the content-addressed store, hash-verified

94// When mode is not explicitly set, this returns the legacy `features.cli-proxy` flag
95// value for backward compatibility.
96func isGitHubCLIModeEnabled(data *WorkflowData) bool {
97 if data == nil {
98 return false
99 }
100 githubTool, hasGitHub := data.Tools["github"]
101 if hasGitHub && githubTool == false {
102 return false
103 }
104 if hasGitHub {
105 if toolConfig, ok := githubTool.(map[string]any); ok {
106 if modeSetting, exists := toolConfig["mode"]; exists {
107 if stringValue, ok := modeSetting.(string); ok {
108 switch GitHubMCPMode(strings.ToLower(strings.TrimSpace(stringValue))) {
109 case GitHubMCPModeGHProxy, GitHubMCPModeCLI:
110 return true
111 case GitHubMCPModeLocal, GitHubMCPModeRemote:
112 return false
113 default:
114 githubConfigLog.Printf("Unrecognized tools.github.mode value: %s, falling back to legacy behavior", stringValue)
115 }
116 }
117 }
118 }
119 }
120 return isFeatureEnabled(constants.CliProxyFeatureFlag, data)
121}
122
123// normalizeGitHubType normalizes and validates GitHub MCP transport values.
124// Supported values are `local` and `remote`.

Callers 8

isCliProxyNeededFunction · 0.85
BuildAWFArgsFunction · 0.85
addCliProxyGHTokenToEnvFunction · 0.85
collectMCPToolsFunction · 0.85
collectPromptSectionsMethod · 0.85

Calls 4

GitHubMCPModeTypeAlias · 0.85
isFeatureEnabledFunction · 0.85
ToLowerMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected