diff --git a/cmd/recipe.go b/cmd/recipe.go index 0ca6213..c54ee5e 100644 --- a/cmd/recipe.go +++ b/cmd/recipe.go @@ -47,12 +47,14 @@ func runRecipe(cmd *cobra.Command, args []string) error { if kv := strings.SplitN(p, "=", 2); len(kv) == 2 { key := strings.TrimSpace(kv[0]) value := strings.TrimSpace(kv[1]) - // simple bool detection - if value == "true" { + + // Clean bool handling that satisfies staticcheck + switch strings.ToLower(value) { + case "true", "1", "yes", "on": params[key] = true - } else if value == "false" { + case "false", "0", "no", "off": params[key] = false - } else { + default: params[key] = value } } @@ -72,7 +74,7 @@ func runRecipe(cmd *cobra.Command, args []string) error { return runner.Run() } -// resolveRecipePath and findProjectRoot stay exactly as you already have them +// resolveRecipePath and findProjectRoot stay exactly as you have them func resolveRecipePath(nameOrPath string) (string, error) { if strings.Contains(nameOrPath, "/") || strings.HasSuffix(nameOrPath, ".md") { if _, err := os.Stat(nameOrPath); err == nil { @@ -118,16 +120,10 @@ func findProjectRoot() (string, error) { if _, err := os.Stat(filepath.Join(dir, ".git")); err == nil { return dir, nil } - if _, err := os.Stat(filepath.Join(dir, ".grokkit")); err == nil { - return dir, nil - } if _, err := os.Stat(filepath.Join(dir, ".gitignore")); err == nil { return dir, nil } - if _, err := os.Stat(filepath.Join(dir, "pyproject.toml")); err == nil { - return dir, nil - } - if _, err := os.Stat(filepath.Join(dir, "CmakeLists.txt")); err == nil { + if _, err := os.Stat(filepath.Join(dir, ".grokkit")); err == nil { return dir, nil } if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil {