feat(history): add Atuin context scopes

This commit is contained in:
2026-08-14 13:30:10 +03:00
parent 2b82e016b9
commit e897b4a89a
13 changed files with 560 additions and 30 deletions
+15
View File
@@ -108,6 +108,21 @@ func detectGitInfo(cwd string) (hasGit bool, branch string) {
return hasGit, ""
}
// GitRoot returns the repository root containing cwd, or an empty string.
func GitRoot(cwd string) string {
dir := filepath.Clean(cwd)
for {
if _, err := os.Stat(filepath.Join(dir, ".git")); err == nil {
return dir
}
parent := filepath.Dir(dir)
if parent == dir {
return ""
}
dir = parent
}
}
type cacheEntry struct {
key string // cwd + "|" + dirModTime
info WorkspaceInfo