refactor: chats method shebangs; drop chats index (D14). (#11)
Tests / Test (push) Skipped
Tests / Release (semver) (push) Skipped

Parsers and commands live in internal/chats. bin/chats/{sync,import,facts,apply}.go
are tagged shebang mains. Brain ingest is not a chats command.
This commit is contained in:
2026-08-13 17:31:03 +01:00
committed by GitHub
co-authored by GitHub
parent 46310f8773
commit cec0161ff6
25 changed files with 212 additions and 223 deletions
+39
View File
@@ -0,0 +1,39 @@
package chats
import (
"os"
"strings"
)
// Root locates the 2dph project root (KB_ROOT, or walk up for var/ or .git).
func Root() string {
if v := os.Getenv("KB_ROOT"); v != "" {
return v
}
wd, err := os.Getwd()
if err != nil {
return "."
}
for i := 0; i < 10; i++ {
if _, err := os.Stat(wd + "/var"); err == nil {
return wd
}
if _, err := os.Stat(wd + "/.git"); err == nil {
return wd
}
parent := wd
if idx := strings.LastIndex(wd, "/"); idx >= 0 {
parent = wd[:idx]
}
if parent == wd {
break
}
wd = parent
}
return "."
}
// Dir is var/chats under the project root.
func Dir() string {
return Root() + "/var/chats"
}