Skip to content

Commit 37e6faf

Browse files
nicksenapclaude
andcommitted
Address code review: gate doctor nudge on ~/.claude, log write errors
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent dfc0c6d commit 37e6faf

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

cmd/create.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,16 @@ func init() {
166166
createCmd.RegisterFlagCompletionFunc("preset", completePresetNames)
167167
}
168168

169-
170169
// TODO: remove when matured — legacy fallback for users without [hooks] config.
171170
func copyParentCLAUDEmd(wsPath string) {
172171
src := filepath.Join(wsPath, "..", "CLAUDE.md")
173172
data, err := os.ReadFile(src)
174173
if err != nil {
175174
return
176175
}
177-
os.WriteFile(filepath.Join(wsPath, "CLAUDE.md"), data, 0o644)
176+
if err := os.WriteFile(filepath.Join(wsPath, "CLAUDE.md"), data, 0o644); err != nil {
177+
console.Warningf("legacy CLAUDE.md copy failed: %s", err)
178+
}
178179
}
179180

180181
func deriveName(branch string) string {

cmd/doctor.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66
"os"
7+
"path/filepath"
78

89
"github.com/nicksenap/grove/internal/config"
910
"github.com/nicksenap/grove/internal/console"
@@ -77,11 +78,15 @@ func checkMissingHooks() []models.DoctorIssue {
7778
}
7879

7980
if _, ok := cfg.Hooks["post_create"]; !ok {
80-
issues = append(issues, models.DoctorIssue{
81-
Workspace: "—",
82-
Issue: "no post_create hook configured (using legacy CLAUDE.md copy)",
83-
SuggestedAction: `add [hooks] post_create = "cp {path}/../CLAUDE.md {path}/CLAUDE.md 2>/dev/null || true"`,
84-
})
81+
// Only flag if ~/.claude exists — user is a Claude Code user.
82+
home, _ := os.UserHomeDir()
83+
if _, err := os.Stat(filepath.Join(home, ".claude")); err == nil {
84+
issues = append(issues, models.DoctorIssue{
85+
Workspace: "—",
86+
Issue: "no post_create hook configured (using legacy CLAUDE.md copy)",
87+
SuggestedAction: `add [hooks] post_create = "cp {path}/../CLAUDE.md {path}/CLAUDE.md 2>/dev/null || true"`,
88+
})
89+
}
8590
}
8691

8792
return issues

0 commit comments

Comments
 (0)