package storage import ( "os/exec" "strings" "github.com/thepeterstone/claudomator/internal/task" ) // SeedProjects upserts the default project registry on startup. func (s *DB) SeedProjects() error { projects := []*task.Project{ { ID: "claudomator", Name: "claudomator", LocalPath: "/workspace/claudomator", RemoteURL: localBareRemote("/workspace/claudomator"), Type: "web", DeployScript: "/workspace/claudomator/scripts/deploy", }, { ID: "nav", Name: "nav", LocalPath: "/workspace/nav", RemoteURL: localBareRemote("/workspace/nav"), Type: "android", }, { ID: "doot", Name: "doot", LocalPath: "/workspace/doot", RemoteURL: localBareRemote("/workspace/doot"), Type: "web", DeployScript: "/workspace/doot/scripts/deploy", }, } for _, p := range projects { if err := s.UpsertProject(p); err != nil { return err } } return nil } // localBareRemote returns the URL of the "local" git remote for dir, // falling back to dir itself if the remote is not configured. func localBareRemote(dir string) string { out, err := exec.Command("git", "-C", dir, "remote", "get-url", "local").Output() if err == nil { if url := strings.TrimSpace(string(out)); url != "" { return url } } return dir }