05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package harness
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os/exec"
|
|
)
|
|
|
|
func Command(ctx context.Context, name, directory, prompt, skill string) (*exec.Cmd, error) {
|
|
c, err := Load()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if name == "" {
|
|
name = c.Default
|
|
}
|
|
p, ok := c.Profiles[name]
|
|
if !ok {
|
|
return nil, fmt.Errorf("harness %q is not configured; run pipelines harness setup opencode or pi", name)
|
|
}
|
|
var args []string
|
|
switch name {
|
|
case "opencode":
|
|
// V2's full CLI has no --model flag. Mini selects it explicitly per session,
|
|
// without mutating shared OpenCode/project model defaults.
|
|
args = []string{"mini", "--model", p.Model}
|
|
if prompt != "" {
|
|
args = append(args, "--prompt", prompt)
|
|
}
|
|
case "pi":
|
|
args = []string{"--model", p.Model}
|
|
if skill != "" {
|
|
args = append(args, "--skill", skill)
|
|
}
|
|
if prompt != "" {
|
|
args = append(args, "--", prompt)
|
|
}
|
|
default:
|
|
return nil, fmt.Errorf("unsupported harness %q", name)
|
|
}
|
|
var cmd *exec.Cmd
|
|
if p.DockerDirectory != "" {
|
|
prefix := []string{"compose", "--project-directory", p.DockerDirectory, "exec", "--workdir", directory, "pipelines", name}
|
|
cmd = exec.CommandContext(ctx, "docker", append(prefix, args...)...)
|
|
} else {
|
|
cmd = exec.CommandContext(ctx, p.Executable, args...)
|
|
}
|
|
cmd.Dir = directory
|
|
return cmd, nil
|
|
}
|