claude-code: added 'commandsDir' option to specify commands from filesystem

This commit is contained in:
Sewer56 2025-08-22 22:13:07 +01:00 committed by Austin Horstman
parent a641bbbb9b
commit be37a3492d
5 changed files with 47 additions and 0 deletions

View file

@ -26,11 +26,18 @@
test-agent = "test content";
};
agentsDir = ./agents;
# assert fail: cannot set commands and commandsDir at the same time.
commands = {
test-command = "test content";
};
commandsDir = ./commands;
};
test.asserts.assertions.expected = [
"`programs.claude-code.package` cannot be null when `mcpServers` is configured"
"Cannot specify both `programs.claude-code.memory.text` and `programs.claude-code.memory.source`"
"Cannot specify both `programs.claude-code.agents` and `programs.claude-code.agentsDir`"
"Cannot specify both `programs.claude-code.commands` and `programs.claude-code.commandsDir`"
];
}

View file

@ -0,0 +1,14 @@
{
programs.claude-code = {
enable = true;
commandsDir = ./commands;
};
nmt.script = ''
assertFileExists home-files/.claude/commands/test-command.md
assertLinkExists home-files/.claude/commands/test-command.md
assertFileContent \
home-files/.claude/commands/test-command.md \
${./commands/test-command.md}
'';
}

View file

@ -0,0 +1,6 @@
---
allowed-tools: Bash(echo:*)
description: Test command for commandsDir functionality
---
This is a test command to verify that commandsDir works correctly.

View file

@ -6,4 +6,5 @@
claude-code-memory-management = ./memory-management.nix;
claude-code-memory-from-source = ./memory-from-source.nix;
claude-code-agents-dir = ./agents-dir.nix;
claude-code-commands-dir = ./commands-dir.nix;
}