Skip to content

Commit 6f8de83

Browse files
committed
fix: prime command now searches upward for .beans.yml
- Use FindConfig directly instead of LoadFromDirectory - Silently exit if no config file found in parent directories - Aligns with how other commands discover the project root
1 parent e7019f6 commit 6f8de83

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Fix prime command to search upward for .beans.yml
3+
status: completed
4+
type: bug
5+
created_at: 2025-12-13T10:30:56Z
6+
updated_at: 2025-12-13T10:30:56Z
7+
---
8+
9+
The `beans prime` command was not properly detecting beans projects. It used `LoadFromDirectory` which never fails (returns default config if no file found), then checked if the beans directory exists at cwd.
10+
11+
Fixed to use `FindConfig` directly, which properly searches upward through parent directories for `.beans.yml`. If no config file is found, it silently exits. This aligns with how other commands discover the project root.

cmd/prime.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,16 @@ var primeCmd = &cobra.Command{
2626
Long: `Outputs a prompt that primes AI coding agents on how to use the beans CLI to manage project issues.`,
2727
Args: cobra.NoArgs,
2828
RunE: func(cmd *cobra.Command, args []string) error {
29-
// If no explicit path given, check if a beans project exists
29+
// If no explicit path given, check if a beans project exists by searching
30+
// upward for a .beans.yml config file
3031
if beansPath == "" && configPath == "" {
3132
cwd, err := os.Getwd()
3233
if err != nil {
3334
return nil // Silently exit on error
3435
}
35-
cfg, err := config.LoadFromDirectory(cwd)
36-
if err != nil {
37-
return nil // Silently exit on error
38-
}
39-
// Check if the beans directory exists
40-
beansDir := cfg.ResolveBeansPath()
41-
if _, err := os.Stat(beansDir); os.IsNotExist(err) {
42-
// No beans directory found - silently exit
36+
configFile, err := config.FindConfig(cwd)
37+
if err != nil || configFile == "" {
38+
// No config file found - silently exit
4339
return nil
4440
}
4541
}

0 commit comments

Comments
 (0)