Simplify Go installation and support standard OpenCode releases

This commit is contained in:
2026-10-08 23:17:38 +01:00
parent 0f30a001c2
commit accbe63e39
101 changed files with 1331 additions and 682 deletions
+5 -10
View File
@@ -19,18 +19,13 @@ type Config struct {
Path string `json:"path"`
}
// Load finds the manifest next to the actual Go binary, including via a system PATH symlink.
// A standalone go-installed CLI can also select a prefix with PIPELINES_PREFIX.
// Load selects a legacy managed installation only via an explicit PIPELINES_PREFIX.
func Load(executable string) (*Config, error) {
resolved, err := filepath.EvalSymlinks(executable)
if err != nil {
return nil, err
}
prefix := os.Getenv("PIPELINES_PREFIX")
if prefix == "" {
prefix = filepath.Dir(filepath.Dir(resolved))
return nil, nil
}
prefix, err = filepath.Abs(prefix)
prefix, err := filepath.Abs(prefix)
if err != nil {
return nil, err
}
@@ -60,8 +55,8 @@ func (c Config) Environment() error {
}
}
}
for key, value := range map[string]string{"PIPELINES_URL": "ws://127.0.0.1:" + strconv.Itoa(c.ServerPort) + "/connect", "PIPELINES_OPENCODE": c.OpenCode, "PATH": c.Path} {
if key != "PATH" && os.Getenv(key) != "" {
for key, value := range map[string]string{"PIPELINES_URL": "ws://127.0.0.1:" + strconv.Itoa(c.ServerPort) + "/connect", "PIPELINES_OPENCODE": c.OpenCode} {
if os.Getenv(key) != "" {
continue
}
if err := os.Setenv(key, value); err != nil {