buildCopilotSettingsSetup returns shell commands that write the Copilot CLI settings file before the agent runs, disabling the rubber-duck sub-agent.
(settingsContent string, fixOwnershipForCustomCommand bool)
| 74 | // buildCopilotSettingsSetup returns shell commands that write the Copilot CLI settings |
| 75 | // file before the agent runs, disabling the rubber-duck sub-agent. |
| 76 | func buildCopilotSettingsSetup(settingsContent string, fixOwnershipForCustomCommand bool) string { |
| 77 | if settingsContent == "" { |
| 78 | settingsContent = copilotSettingsDefaultContent |
| 79 | } |
| 80 | setup := "mkdir -p \"$HOME/.copilot\"\n" |
| 81 | if fixOwnershipForCustomCommand { |
| 82 | setup += "sudo chown -R \"$(id -u):$(id -g)\" \"$HOME/.copilot\"\n" |
| 83 | } |
| 84 | return setup + fmt.Sprintf("printf '%%s' %s > \"%s\"\n", |
| 85 | shellEscapeArg(settingsContent), copilotSettingsPath) |
| 86 | } |
| 87 | |
| 88 | // buildCopilotSettingsCleanupTrap returns a shell trap command that removes the |
| 89 | // temporary Copilot settings file at step exit. The trap body is single-quoted so |