oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package main
2
3import (
4 "context"
5 "fmt"
6 "io"
7 "path/filepath"
8 "runtime"
9
10 "amadan.net/oficina/equipo/internal/runner/provider/opencode"
11)
12
13// installOpenCode installs the pinned OpenCode under root, for a Linux
14// runner's OpenCode Go connections (connectors spec §3, "Pinning", slice
15// S5): the two packages the committed lockfile names, each checked
16// against its integrity before it is unpacked and no script run, the
17// tree sealed read-only, then the tree and the binary held to the
18// committed digests (opencode.Verify). It prints the line for the
19// runner's environment file. An install that does not verify is removed.
20func installOpenCode(ctx context.Context, args []string, output, errout io.Writer) int {
21 if len(args) != 1 || !filepath.IsAbs(args[0]) || filepath.Clean(args[0]) != args[0] {
22 fmt.Fprintln(errout, "usage: equipo-runner install-opencode <absolute root>")
23 return 2
24 }
25 root := args[0]
26 if err := opencode.InstallPinned(ctx, root, runtime.GOARCH, opencode.Fetch(fetchTool)); err != nil {
27 fmt.Fprintln(errout, "equipo-runner: the pinned OpenCode could not be installed:", err)
28 return 1
29 }
30 fmt.Fprintf(output, "EQUIPO_OPENCODE_ROOT=%q\n", root)
31 return 0
32}
33