| 1 | package config |
| 2 | |
| 3 | import ( |
| 4 | "path/filepath" |
| 5 | "strings" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | // TestCommandDirsIncludeConventions verifies command discovery covers the |
| 10 | // cross-tool convention dirs (so .claude/commands etc. migrate in) and that the |
| 11 | // canonical .reasonix project dir is highest priority (last, since command.Load |
| 12 | // lets a later dir win on a name clash). |
| 13 | func TestCommandDirsIncludeConventions(t *testing.T) { |
| 14 | dirs := CommandDirs() |
| 15 | joined := strings.Join(dirs, "\n") |
| 16 | for _, want := range []string{ |
| 17 | filepath.Join(".claude", "commands"), |
| 18 | filepath.Join(".agents", "commands"), |
| 19 | filepath.Join(".agent", "commands"), |
| 20 | filepath.Join(".reasonix", "commands"), |
| 21 | } { |
| 22 | if !strings.Contains(joined, want) { |
| 23 | t.Errorf("CommandDirs missing %q\ngot:\n%s", want, joined) |
| 24 | } |
| 25 | } |
| 26 | // The project's .reasonix/commands must be the highest-priority (last) entry. |
| 27 | if last := dirs[len(dirs)-1]; last != filepath.Join(".reasonix", "commands") { |
| 28 | t.Errorf("project .reasonix/commands should be highest priority (last), got %q", last) |
| 29 | } |
| 30 | } |
| 31 |