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
27 lines
1 KiB
Go
27 lines
1 KiB
Go
package toolingplan
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type pythonDetector struct{}
|
|
|
|
func (pythonDetector) detect(_ context.Context, repoRoot string, managedTools map[string]struct{}) detectionResult {
|
|
if alreadyManaged("python", managedTools) {
|
|
return detectionResult{Skips: []SkipNote{{Target: "python", Reason: "already managed by repo mise declarations"}}}
|
|
}
|
|
value, ok, err := readRepoFile(repoRoot, ".python-version")
|
|
if err != nil {
|
|
return detectionResult{Skips: []SkipNote{{Target: "python", Reason: fmt.Sprintf("could not read .python-version: %v", err)}}}
|
|
}
|
|
if !ok {
|
|
return detectionResult{Skips: []SkipNote{{Target: "python", Reason: "no .python-version"}}}
|
|
}
|
|
version, ok := normalizeExactVersion(strings.TrimSpace(value))
|
|
if !ok {
|
|
return detectionResult{Skips: []SkipNote{{Target: "python", Reason: ".python-version does not pin an exact version"}}}
|
|
}
|
|
return detectionResult{Steps: []InstallStep{{Tool: "python", Version: version, Source: ".python-version", Reason: "exact runtime version"}}}
|
|
}
|