Bootstrap vm run tooling before attach

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
This commit is contained in:
Thales Maciel 2026-03-29 11:38:05 -03:00
parent 1e967140c3
commit 4813e844e2
No known key found for this signature in database
GPG key ID: 33112E6833C34679
10 changed files with 1126 additions and 13 deletions

View file

@ -0,0 +1,27 @@
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"}}}
}