You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use env.UserHomeDir(ctx) instead of os.UserHomeDir() (#4654)
## Summary
- Convert `os.UserHomeDir()` to `env.UserHomeDir(ctx)` at callsites
where context is available
- Makes home directory resolution context-aware, enabling test overrides
- Covers `cmd/completion`, `libs/databrickscfg`, `experimental/aitools`,
`experimental/ssh/internal/server`, and internal test utilities
- Thread ctx through `InstallMCP` and agent `ConfigDir` function
signatures
- Add `forbidigo` linter rule to reject new `os.UserHomeDir()` calls
- Remaining callsites in `libs/git` and `experimental/ssh` (public API
changes) are annotated with `nolint` and left for separate PRs
## Test plan
- [x] All modified packages compile
- [x] `experimental/aitools` tests pass
- [x] `make lintfull` passes with zero issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: experimental/aitools/lib/agents/claude.go
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
1
package agents
2
2
3
3
import (
4
+
"context"
4
5
"errors"
5
6
"fmt"
6
7
"os"
7
8
"os/exec"
8
9
)
9
10
10
11
// InstallClaude installs the Databricks AI Tools MCP server in Claude Code.
11
-
funcInstallClaude() error {
12
+
funcInstallClaude(_ context.Context) error {
12
13
// Check if claude CLI is available
13
14
if_, err:=exec.LookPath("claude"); err!=nil {
14
15
returnerrors.New("'claude' CLI is not installed or not on PATH\n\nPlease install Claude Code and ensure 'claude' is available on your system PATH.\nFor installation instructions, visit: https://docs.anthropic.com/en/docs/claude-code")
0 commit comments