on main help sign in
fix: on windows, also load skills from `$HOME/.config/crush/skills`
db043c3Andrey Nering
internal/config/load.go+20−12
@@ -796,23 +796,31 @@ func GlobalSkillsDirs() []string {
796 return []string{crushSkills}
796 return []string{crushSkills}
797 }
797 }
798
798
799− // Determine the base config directory.
799+ configHome := cmp.Or(
800− var configBase string
801− if xdgConfigHome := os.Getenv("XDG_CONFIG_HOME"); xdgConfigHome != "" {
800+ os.Getenv("XDG_CONFIG_HOME"),
802− configBase = xdgConfigHome
801+ filepath.Join(home.Dir(), ".config"),
802+ )
803+
804+ paths := []string{
805+ filepath.Join(configHome, appName, "skills"),
806+ filepath.Join(configHome, "agents", "skills"),
807+ }
808+
809+ // On Windows, also load from app data on top of `$HOME/.config/crush`.
810+ // This is here mostly for backwards compatibility.
803− } else if runtime.GOOS == "windows" {
811+ if runtime.GOOS == "windows" {
804− configBase = cmp.Or(
812+ appData := cmp.Or(
805 os.Getenv("LOCALAPPDATA"),
813 os.Getenv("LOCALAPPDATA"),
806 filepath.Join(os.Getenv("USERPROFILE"), "AppData", "Local"),
814 filepath.Join(os.Getenv("USERPROFILE"), "AppData", "Local"),
807 )
815 )
808− } else {
816+ paths = append(
809− configBase = filepath.Join(home.Dir(), ".config")
817+ paths,
818+ filepath.Join(appData, appName, "skills"),
819+ filepath.Join(appData, "agents", "skills"),
820+ )
810 }
821 }
811
822
812− return []string{
823+ return paths
813− filepath.Join(configBase, appName, "skills"),
814− filepath.Join(configBase, "agents", "skills"),
815− }
816}
824}
817
825
818func isAppleTerminal() bool { return os.Getenv("TERM_PROGRAM") == "Apple_Terminal" }
826func isAppleTerminal() bool { return os.Getenv("TERM_PROGRAM") == "Apple_Terminal" }