zlh-agent/internal/provision/devcontainer/node/verify.go

36 lines
665 B
Go

package node
import (
"fmt"
"os/exec"
"zlh-agent/internal/state"
)
/*
Verify validates that the Node.js dev container runtime is usable.
Responsibilities:
- Ensure `node` is present and executable
- Ensure `npm` is present and executable
IMPORTANT:
- No installation here
- No state mutation
- Safe to call multiple times
*/
func Verify(cfg state.Config) error {
// Check node binary
if _, err := exec.LookPath("node"); err != nil {
return fmt.Errorf("node binary not found in PATH")
}
// Check npm binary
if _, err := exec.LookPath("npm"); err != nil {
return fmt.Errorf("npm binary not found in PATH")
}
return nil
}