Documentation
¶
Overview ¶
Package disk provides disk size utilities and filesystem helpers. Uses stdlib only: filepath.WalkDir, os.Stat, os.UserHomeDir. No third-party libraries.
Index ¶
- func ClaudeProjectsDir() (string, error)
- func ClaudeProjectsDirForPath(tomoPath string) (string, error)
- func EngramDBSize() (int64, error)
- func HumanReadable(bytes int64) string
- func OpenInExplorer(path string) error
- func SetDiskExecCommand(fn func(name string, arg ...string) *exec.Cmd)
- func WalkSize(path string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaudeProjectsDir ¶
ClaudeProjectsDir returns the path to ~/.claude/projects/. Returns an error if os.UserHomeDir() fails.
func ClaudeProjectsDirForPath ¶
ClaudeProjectsDirForPath returns the ~/.claude/projects/<key>/ directory for a tomo path. The key is derived by lowercasing the path and replacing path separators and colons with "-". Returns ("", nil) when the derived directory does not exist (best-effort heuristic).
func EngramDBSize ¶
EngramDBSize returns the total byte size of the engram database files: ~/.engram/engram.db + engram.db-wal + engram.db-shm. Missing files are silently treated as 0 bytes (partial WAL is normal). Returns (0, nil) if the ~/.engram/ directory does not exist.
func HumanReadable ¶
HumanReadable formats bytes as a human-readable string. Below 1 KB: "N B" (integer, no decimals). 1 KB and above: "N.NN KB" / "N.NN MB" / "N.NN GB" (2 decimal places). Design R5.5: B / KB / MB / GB units only.
func OpenInExplorer ¶
OpenInExplorer opens Windows Explorer at the given path in a detached process. Uses cmd.exe /c start "" <path> — same pattern as internal/actions/windows.go. Non-blocking: calls Start() not Run().
func SetDiskExecCommand ¶
SetDiskExecCommand replaces the exec.Command seam used by OpenInExplorer. Call defer SetDiskExecCommand(exec.Command) in tests to restore.
Types ¶
This section is empty.