Speed up first use of repo backed VMs by bootstrapping obvious tools before the best effort LLM harness runs. Add a host side tooling plan for pinned Go, Node, Python, and Rust versions, summarize that plan in the uploaded prompt, and run repo mise install plus guest global mise use -g --pin steps before the bounded opencode inspection. Keep the harness non fatal, prefer host opencode attach when the client supports it, fall back to guest opencode over SSH for older clients, and cover the new flow with CLI plus planner tests. Validation: - go test ./internal/cli ./internal/toolingplan - GOCACHE=/tmp/banger-gocache go test ./... - make build
26 lines
907 B
Go
26 lines
907 B
Go
package toolingplan
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
type goDetector struct{}
|
|
|
|
func (goDetector) detect(_ context.Context, repoRoot string, managedTools map[string]struct{}) detectionResult {
|
|
if alreadyManaged("go", managedTools) {
|
|
return detectionResult{Skips: []SkipNote{{Target: "go", Reason: "already managed by repo mise declarations"}}}
|
|
}
|
|
goMod, ok, err := readRepoFile(repoRoot, "go.mod")
|
|
if err != nil {
|
|
return detectionResult{Skips: []SkipNote{{Target: "go", Reason: fmt.Sprintf("could not read go.mod: %v", err)}}}
|
|
}
|
|
if !ok {
|
|
return detectionResult{Skips: []SkipNote{{Target: "go", Reason: "no go.mod"}}}
|
|
}
|
|
version, ok := parseGoDirective(goMod)
|
|
if !ok {
|
|
return detectionResult{Skips: []SkipNote{{Target: "go", Reason: "go.mod has no exact go directive"}}}
|
|
}
|
|
return detectionResult{Steps: []InstallStep{{Tool: "go", Version: version, Source: "go.mod", Reason: "go directive"}}}
|
|
}
|