codex: sanitize plugin cache paths

Use sanitized plugin name and version components for cache targets while preserving manifest names in Codex config.
This commit is contained in:
Austin Horstman
2026-06-25 14:21:12 -05:00
parent 64221f9c87
commit 2ebe9c0fe7
3 changed files with 26 additions and 8 deletions
+10 -1
View File
@@ -9,7 +9,10 @@ in
programs.codex = {
enable = true;
package = codexPackage;
plugins = [ ./sample-plugin ];
plugins = [
./sample-plugin
./unsafe-plugin
];
marketplaces.team = ./sample-marketplace;
};
@@ -21,12 +24,15 @@ in
assertFileContains home-files/.codex/config.toml 'source_type = "local"'
assertFileContains home-files/.codex/config.toml 'source = "${./sample-marketplace}"'
assertFileContains home-files/.codex/config.toml '[plugins."sample-plugin@home-manager"]'
assertFileContains home-files/.codex/config.toml '[plugins."../../../outside@home-manager"]'
assertFileContains home-files/.codex/config.toml 'enabled = true'
assertFileExists home-files/.agents/plugins/marketplace.json
assertFileContains home-files/.agents/plugins/marketplace.json '"name": "home-manager"'
assertFileContains home-files/.agents/plugins/marketplace.json '"name": "sample-plugin"'
assertFileContains home-files/.agents/plugins/marketplace.json '"path": "./.codex/plugins/cache/home-manager/sample-plugin/1.0.0"'
assertFileContains home-files/.agents/plugins/marketplace.json '"name": "../../../outside"'
assertFileContains home-files/.agents/plugins/marketplace.json '"path": "./.codex/plugins/cache/home-manager/-..-..-outside/1.0.0-touch-pwned-"'
assertLinkExists home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0
assertFileExists home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0/.codex-plugin/plugin.json
@@ -34,5 +40,8 @@ in
home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0/.codex-plugin/plugin.json \
${./sample-plugin/.codex-plugin/plugin.json}
assertFileExists home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0/skills/sample/SKILL.md
assertLinkExists home-files/.codex/plugins/cache/home-manager/-..-..-outside/1.0.0-touch-pwned-
assertFileExists home-files/.codex/plugins/cache/home-manager/-..-..-outside/1.0.0-touch-pwned-/.codex-plugin/plugin.json
assertPathNotExists home-files/.codex/plugins/outside
'';
}
@@ -0,0 +1,5 @@
{
"name": "../../../outside",
"version": "1.0.0$(touch pwned)",
"description": "Unsafe Codex plugin name for Home Manager tests."
}