package config import ( "fmt" "os" "path/filepath" "time" "github.com/BurntSushi/toml" ) type HomeConfig struct { ProjectsDir string `toml:"projects_dir"` Client string `toml:"client"` InstalledAt time.Time `toml:"installed_at"` } func GetHomePath() string { homeDir, _ := os.UserHomeDir() return filepath.Join(homeDir, ".config", "factory", "home.toml") } func LoadHome() (*HomeConfig, error) { path := GetHomePath() data, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("home.toml not found at %s (run L0b bootstrap first)", path) } var cfg HomeConfig if err := toml.Unmarshal(data, &cfg); err != nil { return nil, fmt.Errorf("failed to parse home.toml: %w", err) } // Validate if cfg.ProjectsDir == "" { return nil, fmt.Errorf("projects_dir is required in home.toml") } if cfg.Client == "" { cfg.Client = "claude-code" } return &cfg, nil } func (h *HomeConfig) GetFactoryDir() string { return filepath.Join(h.ProjectsDir, ".factory") } func (h *HomeConfig) GetManifestPath() string { return filepath.Join(h.GetFactoryDir(), "factory.yaml") } func (h *HomeConfig) GetCommonDir() string { return filepath.Join(h.ProjectsDir, ".common") }