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

Method GetInstallationSteps

pkg/workflow/pi_engine.go:211–256  ·  view source on GitHub ↗

GetInstallationSteps returns the GitHub Actions steps needed to install the Pi CLI. If engine.extensions is configured, additional `pi install ` steps are emitted after the main CLI install step.

(workflowData *WorkflowData)

Source from the content-addressed store, hash-verified

209// If engine.extensions is configured, additional `pi install <extension>` steps are emitted
210// after the main CLI install step.
211func (e *PiEngine) GetInstallationSteps(workflowData *WorkflowData) []GitHubActionStep {
212 piLog.Printf("Generating installation steps for Pi engine: workflow=%s", workflowData.Name)
213
214 if workflowData.EngineConfig != nil && workflowData.EngineConfig.Command != "" {
215 piLog.Printf("Skipping installation steps: custom command specified (%s)", workflowData.EngineConfig.Command)
216 return []GitHubActionStep{}
217 }
218
219 version := string(constants.DefaultPiVersion)
220 if workflowData.EngineConfig != nil && workflowData.EngineConfig.Version != "" {
221 version = workflowData.EngineConfig.Version
222 }
223
224 npmSteps := GenerateNpmInstallSteps(
225 "@earendil-works/pi-coding-agent",
226 version,
227 "Install Pi CLI",
228 "pi",
229 true, // Include Node.js setup
230 false, // Engine CLI installs must never run install scripts
231 false, // Pi installs should not apply the default npm release-age cooldown
232 )
233
234 steps := BuildNpmEngineInstallStepsWithAWF(npmSteps, workflowData)
235
236 // Install extensions declared in engine.extensions: [...]
237 // Each extension is installed via `pi install <extension>` before the agent runs.
238 if workflowData.EngineConfig != nil && len(workflowData.EngineConfig.Extensions) > 0 {
239 commandName := "pi"
240 if workflowData.EngineConfig.Command != "" {
241 commandName = workflowData.EngineConfig.Command
242 }
243
244 for _, ext := range workflowData.EngineConfig.Extensions {
245 installCmd := fmt.Sprintf("%s install %s", commandName, shellEscapeArg(ext))
246 stepLines := []string{
247 " - name: Install Pi extension " + ext,
248 }
249 stepLines = FormatStepWithCommandAndEnv(stepLines, installCmd, nil)
250 steps = append(steps, GitHubActionStep(stepLines))
251 }
252 piLog.Printf("Added %d Pi extension install steps", len(workflowData.EngineConfig.Extensions))
253 }
254
255 return steps
256}
257
258// GetDeclaredOutputFiles returns the output files that Pi may produce.
259// The streaming JSONL log is the primary artifact for post-run analysis.

Calls 6

GenerateNpmInstallStepsFunction · 0.85
shellEscapeArgFunction · 0.85
GitHubActionStepTypeAlias · 0.85
PrintfMethod · 0.45