diff --git a/toolsrv/transport.go b/toolsrv/transport.go index 3c2d0cd..ba5e605 100644 --- a/toolsrv/transport.go +++ b/toolsrv/transport.go @@ -37,8 +37,8 @@ func localDial(ctx context.Context, cwd string, opts ...Option) (*transport, err return nil, fmt.Errorf("bootstrap: ollie-remote not found") } - // Bootstrap: verify tools directory. - toolsDir := filepath.Join(os.Getenv("HOME"), ".config", "ollie", "tools") + // Verify tools directory is accessible via ToolsPath(). + toolsDir := ToolsPath() if _, err := os.Stat(toolsDir); err != nil { return nil, fmt.Errorf("bootstrap: tools directory not found at %s", toolsDir) } @@ -64,9 +64,10 @@ func localDial(ctx context.Context, cwd string, opts ...Option) (*transport, err Pdeathsig: syscall.SIGTERM, } - // XXX: set OLLIE_TOOLS_PATH explicitly until ToolsPath() default is updated. + // Inherit environment — OLLIE_TOOLS_PATH flows through naturally. + // ollie-remote reads it via ToolsPath() at runtime, picking up new + // tools from disk without restart. cmd.Env = os.Environ() - cmd.Env = appendEnvVar(cmd.Env, "OLLIE_TOOLS_PATH", toolsDir) // Watch stderr for readiness signal. stderrPipe, err := cmd.StderrPipe() @@ -283,18 +284,6 @@ func shellEscape(s string) string { return "'" + strings.ReplaceAll(s, "'", "'\\''") + "'" } -// appendEnvVar replaces or appends a KEY=VALUE in an env slice. -func appendEnvVar(env []string, key, value string) []string { - prefix := key + "=" - for i, e := range env { - if strings.HasPrefix(e, prefix) { - env[i] = prefix + value - return env - } - } - return append(env, prefix+value) -} - // runtimeDir returns XDG_RUNTIME_DIR or a fallback. func runtimeDir() string { if d := os.Getenv("XDG_RUNTIME_DIR"); d != "" {