Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/cli/yaml_frontmatter_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func findAndReplaceInLine(line, oldKey, newKey string) (string, bool) {
return line, false
}

yamlUtilsLog.Printf("Replacing frontmatter key %q with %q", oldKey, newKey)
valueAndComment := parts[1]
return fmt.Sprintf("%s%s:%s", leadingSpace, newKey, valueAndComment), true
}
Expand All @@ -106,6 +107,7 @@ func applyFrontmatterLineTransform(content string, transform func([]string) ([]s
return content, false, nil
}

yamlUtilsLog.Print("Frontmatter transformation applied successfully")
return reconstructContent(result, markdown), true, nil
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/workflow/compiler_github_actions_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var compilerGitHubActionsStepsLog = logger.New("workflow:compiler_github_actions
//
// Returns a string containing the complete script content to be used in a github-script action's "script:" field.
func generateGitHubScriptWithRequire(scriptPath string) string {
compilerGitHubActionsStepsLog.Printf("Generating GitHub script step with require: %s", scriptPath)
var script strings.Builder

// Use the setup_globals helper to store GitHub Actions objects in global scope
Expand All @@ -38,6 +39,7 @@ func generateGitHubScriptWithRequire(scriptPath string) string {
//
// Returns a string containing the complete YAML for the github-script step.
func generateInlineGitHubScriptStep(stepName, script, condition string) string {
compilerGitHubActionsStepsLog.Printf("Generating inline GitHub script step: name=%q, condition=%q", stepName, condition)
var step strings.Builder

step.WriteString(" - name: " + stepName + "\n")
Expand Down
4 changes: 4 additions & 0 deletions pkg/workflow/copilot_engine_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ func (e *CopilotEngine) computeCopilotToolArguments(tools map[string]any, safeOu
// Handle edit tools requirement for file write access
// Note: safe-outputs do not need write permission as they use MCP
if _, hasEdit := tools["edit"]; hasEdit {
copilotEngineToolsLog.Print("Edit tool enabled, adding write permission")
args = append(args, "--allow-tool", "write")
}

// Handle safe_outputs MCP server - allow all tools if safe outputs are enabled
// This includes both safeOutputs config and safeOutputs.Jobs
if HasSafeOutputsEnabled(safeOutputs) {
copilotEngineToolsLog.Print("Safe-outputs enabled, adding MCP server permission")
args = append(args, "--allow-tool", constants.SafeOutputsMCPServerID.String())
}

Expand All @@ -102,6 +104,7 @@ func (e *CopilotEngine) computeCopilotToolArguments(tools map[string]any, safeOu

// Handle web-fetch builtin tool (Copilot CLI uses web_fetch with underscore)
if _, hasWebFetch := tools["web-fetch"]; hasWebFetch {
copilotEngineToolsLog.Print("Web-fetch tool enabled, adding web_fetch permission")
// web-fetch -> web_fetch
args = append(args, "--allow-tool", "web_fetch")
}
Expand Down Expand Up @@ -169,6 +172,7 @@ func (e *CopilotEngine) computeCopilotToolArguments(tools map[string]any, safeOu
// Check if this is an MCP server configuration
if toolConfigMap, ok := toolConfig.(map[string]any); ok {
if hasMcp, _ := hasMCPConfig(toolConfigMap); hasMcp {
copilotEngineToolsLog.Printf("Adding custom MCP server permission: %s", toolName)
// Allow the entire MCP server
args = append(args, "--allow-tool", toolName)

Expand Down
2 changes: 2 additions & 0 deletions pkg/workflow/mcp_config_serena_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func selectSerenaContainer(serenaTool any) string {
// renderSerenaMCPConfigWithOptions generates the Serena MCP server configuration with engine-specific options
// Uses Docker container with stdio transport (ghcr.io/github/serena-mcp-server:latest)
func renderSerenaMCPConfigWithOptions(yaml *strings.Builder, serenaTool any, isLast bool, includeCopilotFields bool, inlineArgs bool, guardPolicies map[string]any) {
mcpSerenaLog.Printf("Rendering Serena MCP config: copilot_fields=%v, inline_args=%v, guard_policies=%v", includeCopilotFields, inlineArgs, len(guardPolicies) > 0)
customArgs := getSerenaCustomArgs(serenaTool)

yaml.WriteString(" \"serena\": {\n")
Expand All @@ -99,6 +100,7 @@ func renderSerenaMCPConfigWithOptions(yaml *strings.Builder, serenaTool any, isL

// Select the appropriate Serena container based on requested languages
containerImage := selectSerenaContainer(serenaTool)
mcpSerenaLog.Printf("Serena container image selected: %s", containerImage)
yaml.WriteString(" \"container\": \"" + containerImage + ":latest\",\n")

// Docker runtime args (--network host for network access)
Expand Down
13 changes: 11 additions & 2 deletions pkg/workflow/mcp_github_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ func getGitHubType(githubTool any) string {
if toolConfig, ok := githubTool.(map[string]any); ok {
if modeSetting, exists := toolConfig["mode"]; exists {
if stringValue, ok := modeSetting.(string); ok {
githubConfigLog.Printf("GitHub MCP mode set explicitly: %s", stringValue)
return stringValue
}
}
}
githubConfigLog.Print("GitHub MCP mode: local (default)")
return "local" // default to local (Docker)
}

Expand Down Expand Up @@ -158,15 +160,20 @@ func getGitHubToolsets(githubTool any) string {
}
toolsetsStr := strings.Join(toolsets, ",")
// Expand "default" to individual toolsets for action-friendly compatibility
return expandDefaultToolset(toolsetsStr)
resolved := expandDefaultToolset(toolsetsStr)
githubConfigLog.Printf("GitHub MCP toolsets resolved: %s", resolved)
return resolved
case []string:
toolsetsStr := strings.Join(v, ",")
// Expand "default" to individual toolsets for action-friendly compatibility
return expandDefaultToolset(toolsetsStr)
resolved := expandDefaultToolset(toolsetsStr)
githubConfigLog.Printf("GitHub MCP toolsets resolved: %s", resolved)
return resolved
}
}
}
// default to action-friendly toolsets (excludes "users" which GitHub Actions tokens don't support)
githubConfigLog.Print("GitHub MCP toolsets: using default action-friendly toolsets")
return strings.Join(ActionFriendlyGitHubToolsets, ",")
}

Expand All @@ -190,6 +197,7 @@ func expandDefaultToolset(toolsetsStr string) string {
}

if toolset == "default" || toolset == "action-friendly" {
githubConfigLog.Printf("Expanding %q keyword to action-friendly toolsets", toolset)
// Expand "default" or "action-friendly" to action-friendly toolsets (excludes "users")
for _, dt := range ActionFriendlyGitHubToolsets {
if !seenToolsets[dt] {
Expand Down Expand Up @@ -415,5 +423,6 @@ func getGitHubDockerImageVersion(githubTool any) string {
}
}
}
githubConfigLog.Printf("GitHub MCP Docker image version: %s", githubDockerImageVersion)
return githubDockerImageVersion
}