Files
home-manager/tests/modules/programs/claude-code/assertion.nix
Austin Horstman 1c029fb0dc claude-code: load plugins without wrapper
Persist managed plugins in Claude Code's personal skills directory so strict-parser subcommands do not receive injected --plugin-dir arguments. Retain version-gated legacy behavior for older and unversioned packages.
2026-07-10 14:19:11 -05:00

55 lines
1.4 KiB
Nix

{ config, ... }:
{
programs.claude-code = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "claude-code";
version = "2.1.75";
buildScript = ''
mkdir -p $out/bin
touch $out/bin/claude
chmod 755 $out/bin/claude
'';
};
mcpServers = {
filesystem = {
type = "stdio";
command = "npx";
args = [
"-y"
"@modelcontextprotocol/server-filesystem"
"/tmp"
];
};
};
# assert fail: cannot set agents and agentsDir at the same time.
agents = {
test-agent = "test content";
};
agentsDir = ./agents;
# assert fail: cannot set commands and commandsDir at the same time.
commands = {
test-command = "test content";
};
commandsDir = ./commands;
# assert fail: cannot set hooks and hooksDir at the same time.
hooks = {
test-hook = "test content";
};
hooksDir = ./hooks;
};
test.asserts.assertions.expected = [
"Managed Claude Code MCP, LSP, and plugins require `programs.claude-code.package` version 2.1.76 or later"
"Cannot specify both `programs.claude-code.agents` and `programs.claude-code.agentsDir`"
"Cannot specify both `programs.claude-code.commands` and `programs.claude-code.commandsDir`"
"Cannot specify both `programs.claude-code.hooks` and `programs.claude-code.hooksDir`"
];
}