(command string)
| 667 | } |
| 668 | |
| 669 | func buildEngineCommandScriptSetup(command string) string { |
| 670 | // engine.command intentionally accepts shell-form commands from trusted workflow |
| 671 | // configuration authored in-repo; preserve shell semantics and forward driver args. |
| 672 | scriptContent := fmt.Sprintf("#!/usr/bin/env bash\nset +o histexpand\nset -eo pipefail\n%s \"$@\"\n", command) |
| 673 | heredocDelimiter := "GH_AW_ENGINE_COMMAND_EOF" |
| 674 | for strings.Contains(scriptContent, heredocDelimiter) { |
| 675 | heredocDelimiter += "_X" |
| 676 | } |
| 677 | |
| 678 | return fmt.Sprintf(`mkdir -p /tmp/gh-aw |
| 679 | umask 0177 |
| 680 | cat > %s <<'%s' |
| 681 | %s |
| 682 | %s |
| 683 | chmod 700 %s`, customEngineCommandScriptPath, heredocDelimiter, scriptContent, heredocDelimiter, customEngineCommandScriptPath) |
| 684 | } |
| 685 | |
| 686 | // generateCopilotSessionFileCopyStep generates a step to copy the entire Copilot |
| 687 | // session-state directory from ~/.copilot/session-state/ to /tmp/gh-aw/sandbox/agent/logs/ |
no outgoing calls