feat(doctor): add env-vars check, remove redundant gtroot check
Adds a new `gt doctor` check that verifies tmux session environment variables match expected values from `config.RoleEnvVars()`. - Checks all Gas Town sessions (gt-*, hq-*) - Compares actual tmux env vars against expected for each role - Reports mismatches with guidance to restart sessions - Treats no sessions as success (valid when Gas Town is down) - Skips deacon (doesn't use standard env vars) Also: - Adds `tmux.GetAllEnvironment()` to retrieve all session env vars - Removes redundant gtroot_check (env-vars check covers GT_ROOT) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
1d88a73eaa
commit
52b9a95f98
@@ -497,6 +497,28 @@ func (t *Tmux) GetEnvironment(session, key string) (string, error) {
|
||||
return parts[1], nil
|
||||
}
|
||||
|
||||
// GetAllEnvironment returns all environment variables for a session.
|
||||
func (t *Tmux) GetAllEnvironment(session string) (map[string]string, error) {
|
||||
out, err := t.run("show-environment", "-t", session)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
env := make(map[string]string)
|
||||
for _, line := range strings.Split(out, "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" || strings.HasPrefix(line, "-") {
|
||||
// Skip empty lines and unset markers (lines starting with -)
|
||||
continue
|
||||
}
|
||||
parts := strings.SplitN(line, "=", 2)
|
||||
if len(parts) == 2 {
|
||||
env[parts[0]] = parts[1]
|
||||
}
|
||||
}
|
||||
return env, nil
|
||||
}
|
||||
|
||||
// RenameSession renames a session.
|
||||
func (t *Tmux) RenameSession(oldName, newName string) error {
|
||||
_, err := t.run("rename-session", "-t", oldName, newName)
|
||||
|
||||
Reference in New Issue
Block a user