From e267975cbdd91fd73082e1e9760d04853c161da4 Mon Sep 17 00:00:00 2001 From: victor-commit Date: Mon, 12 Oct 2026 05:55:13 -0400 Subject: [PATCH 1/2] fix(commands): load from the canonical command directories The default command loader used `.cortex/command` and `Cortex/command` (singular, capital-C), but the canonical directories used by manager.rs and import.rs are `.cortex/commands` and `cortex/commands` (plural, lowercase). On case-sensitive filesystems, commands imported/written to the canonical location were never found by the default loader. Align the defaults (and the doc comment) with the rest of the crate. Fixes #416 --- src/cortex-commands/src/loader.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cortex-commands/src/loader.rs b/src/cortex-commands/src/loader.rs index afaff5331..15e536212 100644 --- a/src/cortex-commands/src/loader.rs +++ b/src/cortex-commands/src/loader.rs @@ -41,17 +41,17 @@ impl CommandLoader { /// Create a new loader with default search paths. /// /// Default paths: - /// 1. `.cortex/command/` (project-local) - /// 2. `~/.config/cortex/command/` (global) + /// 1. `.cortex/commands/` (project-local) + /// 2. `~/.config/cortex/commands/` (global) pub fn new() -> Self { let mut search_dirs = Vec::new(); // Project-local commands - search_dirs.push(PathBuf::from(".cortex/command")); + search_dirs.push(PathBuf::from(".cortex/commands")); // Global commands if let Some(config_dir) = dirs::config_dir() { - search_dirs.push(config_dir.join("Cortex").join("command")); + search_dirs.push(config_dir.join("cortex").join("commands")); } Self { search_dirs } @@ -245,11 +245,11 @@ pub mod sync { let mut dirs = Vec::new(); // Project-local - dirs.push(PathBuf::from(".cortex/command")); + dirs.push(PathBuf::from(".cortex/commands")); // Global if let Some(config_dir) = dirs::config_dir() { - dirs.push(config_dir.join("Cortex").join("command")); + dirs.push(config_dir.join("cortex").join("commands")); } dirs From ece734d5addc3d36cec50ef4e05ab9c1a569734a Mon Sep 17 00:00:00 2001 From: victor-commit Date: Mon, 12 Oct 2026 09:32:42 -0400 Subject: [PATCH 2/2] docs(commands): document the global path through dirs::config_dir() The search order listed the global directory as ~/.config/cortex/commands, but the loader resolves it with dirs::config_dir(), which is ~/.config only on Linux. On macOS it is ~/Library/Application Support and on Windows it is %APPDATA%, so anyone following the documentation on those platforms placed their commands where the loader never looks. Name the resolved directory and give ~/.config as the Linux example rather than the rule. Co-Authored-By: Claude Opus 5 (1M context) --- src/cortex-commands/src/loader.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cortex-commands/src/loader.rs b/src/cortex-commands/src/loader.rs index 15e536212..7e9240031 100644 --- a/src/cortex-commands/src/loader.rs +++ b/src/cortex-commands/src/loader.rs @@ -42,7 +42,9 @@ impl CommandLoader { /// /// Default paths: /// 1. `.cortex/commands/` (project-local) - /// 2. `~/.config/cortex/commands/` (global) + /// 2. `/cortex/commands/` (global), where `` is + /// [`dirs::config_dir`]: `~/.config` on Linux (or `$XDG_CONFIG_HOME`), + /// `~/Library/Application Support` on macOS, `%APPDATA%` on Windows. pub fn new() -> Self { let mut search_dirs = Vec::new();