From 5a810c22878a0567d225f0eaffe1e30229b76a42 Mon Sep 17 00:00:00 2001 From: harshitsinghbhandari <24b4506@iitb.ac.in> Date: Thu, 11 Jun 2026 19:59:13 +0530 Subject: [PATCH] chore: change default data/config dir from ~/Library/Application Support to ~/.ao Replaces os.UserConfigDir() + "agent-orchestrator/..." fallback with os.UserHomeDir() + ".ao/..." in resolveRunFilePath() and resolveDataDir(), so the default layout is: ~/.ao/running.json ~/.ao/data/ AO_RUN_FILE and AO_DATA_DIR env overrides are unchanged. Closes #183 Co-Authored-By: Claude Sonnet 4.6 --- backend/internal/config/config.go | 11 +++++------ backend/internal/config/config_test.go | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go index 8fce75e7..1de3b705 100644 --- a/backend/internal/config/config.go +++ b/backend/internal/config/config.go @@ -189,23 +189,22 @@ func resolveRunFilePath() (string, error) { if p, ok := os.LookupEnv("AO_RUN_FILE"); ok && p != "" { return p, nil } - dir, err := os.UserConfigDir() + home, err := os.UserHomeDir() if err != nil { return "", fmt.Errorf("resolve state dir: %w", err) } - return filepath.Join(dir, "agent-orchestrator", "running.json"), nil + return filepath.Join(home, ".ao", "running.json"), nil } // resolveDataDir picks where durable state (the SQLite DB) lives. An explicit -// AO_DATA_DIR wins; otherwise it sits under the per-user config directory -// alongside running.json. +// AO_DATA_DIR wins; otherwise it defaults to ~/.ao/data/. func resolveDataDir() (string, error) { if p, ok := os.LookupEnv("AO_DATA_DIR"); ok && p != "" { return p, nil } - dir, err := os.UserConfigDir() + home, err := os.UserHomeDir() if err != nil { return "", fmt.Errorf("resolve state dir: %w", err) } - return filepath.Join(dir, "agent-orchestrator", "data"), nil + return filepath.Join(home, ".ao", "data"), nil } diff --git a/backend/internal/config/config_test.go b/backend/internal/config/config_test.go index 9a891d71..49fe9ec4 100644 --- a/backend/internal/config/config_test.go +++ b/backend/internal/config/config_test.go @@ -33,14 +33,14 @@ func TestLoadDefaults(t *testing.T) { if cfg.RunFilePath == "" { t.Error("RunFilePath is empty, want a resolved default path") } - if !strings.HasSuffix(cfg.RunFilePath, filepath.Join("agent-orchestrator", "running.json")) { - t.Errorf("RunFilePath = %q, want agent-orchestrator/running.json suffix", cfg.RunFilePath) + if !strings.HasSuffix(cfg.RunFilePath, filepath.Join(".ao", "running.json")) { + t.Errorf("RunFilePath = %q, want .ao/running.json suffix", cfg.RunFilePath) } if cfg.DataDir == "" { t.Error("DataDir is empty, want a resolved default path") } - if !strings.HasSuffix(cfg.DataDir, filepath.Join("agent-orchestrator", "data")) { - t.Errorf("DataDir = %q, want agent-orchestrator/data suffix", cfg.DataDir) + if !strings.HasSuffix(cfg.DataDir, filepath.Join(".ao", "data")) { + t.Errorf("DataDir = %q, want .ao/data suffix", cfg.DataDir) } }