Skip to content

[BUG] Default command loader scans wrong dirs (command/Cortex vs commands/cortex); imported global commands never load #416

Open

Description

@victor-commit

Summary

CommandLoader::new() / default() and sync::default_search_dirs() default to command directories that don't match the canonical ones used everywhere else in the crate, so commands imported/written to the standard location are never found by the default loader on case-sensitive filesystems.

Location

src/cortex-commands/src/loader.rs:50 and :54 (duplicated at :248 and :252), at commit 7954d021 (current main).

The loader uses:

  • .cortex/command (project-local) — singular command
  • config_dir.join("Cortex").join("command") — capital-C Cortex, singular command

But the canonical dirs everywhere else are plural / lowercase:

  • .cortex/commands and cortex/commands — manager.rs:110,118,166,170; import.rs:344,348; builtin/commands_cmd.rs.

The loader's own doc comment (loader.rs:44-45) even says lowercase ~/.config/cortex/command/, contradicting the code's "Cortex".

Reproduction

  1. Import/place a global command at ~/.config/cortex/commands/foo.md (where CommandManager::import_from / default_command_target write).
  2. Call CommandRegistry::load_default() (registry.rs:31-35, uses CommandLoader::new()) or sync::load_all() (builtin/commands_cmd.rs:66).

Expected: foo is loaded.
Actual: not loaded — the loader scans .cortex/command / Cortex/command instead.

Suggested fix

Change both default-dir sites (and the :248/:252 duplicate) to .cortex/commands and config_dir.join("cortex").join("commands"), matching the rest of the crate.

Activity

  1. added 2 commits that reference this issue on Oct 12, 2026
    6668ae5
    e267975
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions