package main import ( "context" "fmt" "io" "path/filepath" "runtime" "amadan.net/oficina/equipo/internal/runner/provider/opencode" ) // installOpenCode installs the pinned OpenCode under root, for a Linux // runner's OpenCode Go connections (connectors spec ยง3, "Pinning", slice // S5): the two packages the committed lockfile names, each checked // against its integrity before it is unpacked and no script run, the // tree sealed read-only, then the tree and the binary held to the // committed digests (opencode.Verify). It prints the line for the // runner's environment file. An install that does not verify is removed. func installOpenCode(ctx context.Context, args []string, output, errout io.Writer) int { if len(args) != 1 || !filepath.IsAbs(args[0]) || filepath.Clean(args[0]) != args[0] { fmt.Fprintln(errout, "usage: equipo-runner install-opencode ") return 2 } root := args[0] if err := opencode.InstallPinned(ctx, root, runtime.GOARCH, opencode.Fetch(fetchTool)); err != nil { fmt.Fprintln(errout, "equipo-runner: the pinned OpenCode could not be installed:", err) return 1 } fmt.Fprintf(output, "EQUIPO_OPENCODE_ROOT=%q\n", root) return 0 }