fix(doctor): detect missing git repo and improve daemon startup message (#890)

When not in a git repository:
- Daemon startup now shows clear message immediately instead of waiting
  5 seconds: "Note: No git repository initialized — running without
  background sync"
- Added new doctor check "Git Sync Setup" that explains the situation

Doctor check now shows three states:
1. No git repo → Warning with fix: "Run 'git init' to enable background sync"
2. Git repo, no sync-branch → OK with hint about team collaboration benefits
3. Git repo + sync-branch → OK, fully configured

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kustrun
2026-01-04 20:13:48 +01:00
committed by GitHub
parent 661556ae62
commit 28b44edd13
5 changed files with 157 additions and 1 deletions

View File

@@ -310,6 +310,14 @@ func determineSocketPath(socketPath string) string {
}
func startDaemonProcess(socketPath string) bool {
// Early check: daemon requires a git repository (unless --local mode)
// Skip attempting to start and avoid the 5-second wait if not in git repo
if !isGitRepo() {
debugLog("not in a git repository, skipping daemon start")
fmt.Fprintf(os.Stderr, "%s No git repository initialized - running without background sync\n", ui.RenderMuted("Note:"))
return false
}
binPath, err := executableFn()
if err != nil {
binPath = os.Args[0]