| 63 | } |
| 64 | |
| 65 | func cacheDir() string { |
| 66 | if d := os.Getenv("CBM_CACHE_DIR"); d != "" { |
| 67 | return d |
| 68 | } |
| 69 | switch runtime.GOOS { |
| 70 | case "windows": |
| 71 | if d := os.Getenv("LOCALAPPDATA"); d != "" { |
| 72 | return filepath.Join(d, "codebase-memory-mcp") |
| 73 | } |
| 74 | case "darwin": |
| 75 | if home, err := os.UserHomeDir(); err == nil { |
| 76 | return filepath.Join(home, "Library", "Caches", "codebase-memory-mcp") |
| 77 | } |
| 78 | } |
| 79 | if d := os.Getenv("XDG_CACHE_HOME"); d != "" { |
| 80 | return filepath.Join(d, "codebase-memory-mcp") |
| 81 | } |
| 82 | if home, err := os.UserHomeDir(); err == nil { |
| 83 | return filepath.Join(home, ".cache", "codebase-memory-mcp") |
| 84 | } |
| 85 | return filepath.Join(os.TempDir(), "codebase-memory-mcp") |
| 86 | } |
| 87 | |
| 88 | func goos() string { |
| 89 | switch runtime.GOOS { |