@@ -20,64 +20,107 @@ const writeSkill = Effect.fn(function* (
2020} ) ;
2121
2222it . layer ( NodeServices . layer ) ( "discoverClaudeSkills" , ( it ) => {
23- it . effect (
24- "discovers only enabled installed plugin skills with their namespace and metadata " ,
25- ( ) =>
23+ it . effect . each ( [ "default" , "alternate" , "relative alternate" , "root named" , "root fallback" ] ) (
24+ "discovers enabled installed plugin skills with %s layout " ,
25+ ( layout ) =>
2626 Effect . gen ( function * ( ) {
2727 const fs = yield * FileSystem . FileSystem ;
2828 const path = yield * Path . Path ;
2929 const tempDir = yield * fs . makeTempDirectoryScoped ( { prefix : "t3-claude-skills-" } ) ;
3030 const configDir = path . join ( tempDir , "claude-home" ) ;
31- const plugin = path . join ( configDir , "plugins" , "cache" , "shop" , "plugin" , "1.0.0" ) ;
32- yield * writeSkill ( path . join ( plugin , "skills" ) , "plain" , "# Plain" ) ;
31+ const workspace = path . join ( tempDir , "workspace" ) ;
32+ const pluginRoot = layout . includes ( "alternate" )
33+ ? path . join ( workspace , "alternate" )
34+ : path . join ( configDir , "plugins" ) ;
35+ const environment = layout . includes ( "alternate" )
36+ ? { CLAUDE_CODE_PLUGIN_CACHE_DIR : layout === "alternate" ? pluginRoot : "alternate" }
37+ : { } ;
38+ const plugin = path . join ( pluginRoot , "cache" , "shop" , "plugin" , "1.0.0" ) ;
39+ const rootSkill = layout . startsWith ( "root" ) ;
40+ const skillsDirectory = rootSkill ? "custom" : "skills" ;
41+ yield * writeSkill ( path . join ( plugin , skillsDirectory ) , "plain" , "# Plain" ) ;
3342 yield * writeSkill (
34- path . join ( plugin , "skills" , "engineering" ) ,
43+ path . join ( plugin , skillsDirectory , "engineering" ) ,
3544 "review" ,
36- "---\nname: ignored -alias\ndescription: Review changes.\ndisable-model-invocation: yes\nuser-invocable: no\n---\n" ,
45+ "---\nname: review -alias\ndescription: Review changes.\ndisable-model-invocation: yes\nuser-invocable: no\n---\n" ,
3746 ) ;
3847 yield * writeSkill ( path . join ( plugin , "extra" ) , "deploy" , "# Deploy" ) ;
48+ yield * writeSkill ( plugin , "..safe" , "---\nname: safe.name alias_Upper\n---\n" ) ;
49+ const outside = path . resolve ( plugin , "../outside" ) ;
50+ yield * writeSkill ( path . dirname ( outside ) , path . basename ( outside ) , "# Outside" ) ;
51+ if ( path . sep !== "\\" ) yield * fs . symlink ( outside , path . join ( plugin , "linked" ) ) ;
52+ yield * fs . writeFileString (
53+ path . join ( plugin , "SKILL.md" ) ,
54+ layout === "root fallback" ? "# Root" : "---\nname: root-alias\n---\n" ,
55+ ) ;
3956 yield * fs . makeDirectory ( path . join ( plugin , ".claude-plugin" ) , { recursive : true } ) ;
4057 yield * fs . writeFileString (
4158 path . join ( plugin , ".claude-plugin" , "plugin.json" ) ,
42- '{"skills":["./skills/engineering/review","./extra","./skills/plain"]}' ,
59+ `{"name":"manifest-plugin","skills":[
60+ "./${ skillsDirectory } /engineering/review","./extra","./${ skillsDirectory } /plain",
61+ "./..safe","./../outside","${ outside . replaceAll ( "\\" , "/" ) } ","./linked"
62+ ]}` ,
4363 ) ;
4464 yield * fs . writeFileString (
45- path . join ( configDir , "plugins" , "installed_plugins.json" ) ,
65+ path . join ( pluginRoot , "installed_plugins.json" ) ,
4666 `{"version":2,"plugins":{
4767 "plugin@shop":[null,{"scope":"user","installPath":"${ plugin . replaceAll ( "\\" , "/" ) } "}],
4868 "disabled@shop":[{"scope":"user","installPath":"${ plugin . replaceAll ( "\\" , "/" ) } "}],
4969 "unmentioned@shop":[{"scope":"user","installPath":"${ plugin . replaceAll ( "\\" , "/" ) } "}]
5070 }}` ,
5171 ) ;
72+ yield * fs . makeDirectory ( configDir , { recursive : true } ) ;
5273 yield * fs . writeFileString (
5374 path . join ( configDir , "settings.json" ) ,
54- '{ "enabledPlugins": { "plugin@shop": true, "disabled@shop": false, "uninstalled@shop": true }, "skillOverrides": { "plugin:review": "off" } }' ,
75+ '{ "enabledPlugins": { "plugin@shop": true, "disabled@shop": false, "uninstalled@shop": true }, "skillOverrides": { "manifest- plugin:review-alias ": "off" } }' ,
5576 ) ;
5677
57- const skills = yield * discoverClaudeSkills ( { homePath : configDir } ) ;
58- assert . deepEqual ( skills , [
59- {
60- name : "plugin:deploy" ,
61- path : path . join ( plugin , "extra" , "deploy" , "SKILL.md" ) ,
62- enabled : true ,
63- scope : "user" ,
64- } ,
65- {
66- name : "plugin:plain" ,
67- path : path . join ( plugin , "skills" , "plain" , "SKILL.md" ) ,
68- enabled : true ,
69- scope : "user" ,
70- } ,
71- {
72- name : "plugin:review" ,
73- path : path . join ( plugin , "skills" , "engineering" , "review" , "SKILL.md" ) ,
74- enabled : false ,
75- scope : "user" ,
76- description : "Review changes." ,
77- userInvocationOnly : true ,
78- userInvocable : false ,
79- } ,
80- ] ) ;
78+ const skills = yield * discoverClaudeSkills ( { homePath : configDir } , workspace , environment ) ;
79+ assert . deepEqual (
80+ skills ,
81+ [
82+ ...( rootSkill
83+ ? [
84+ {
85+ name :
86+ layout === "root fallback"
87+ ? "manifest-plugin:1-0-0"
88+ : "manifest-plugin:root-alias" ,
89+ path : path . join ( plugin , "SKILL.md" ) ,
90+ enabled : true ,
91+ scope : "user" ,
92+ } ,
93+ ]
94+ : [ ] ) ,
95+ {
96+ name : "manifest-plugin:deploy" ,
97+ path : path . join ( plugin , "extra" , "deploy" , "SKILL.md" ) ,
98+ enabled : true ,
99+ scope : "user" ,
100+ } ,
101+ {
102+ name : "manifest-plugin:plain" ,
103+ path : path . join ( plugin , skillsDirectory , "plain" , "SKILL.md" ) ,
104+ enabled : true ,
105+ scope : "user" ,
106+ } ,
107+ {
108+ name : "manifest-plugin:review-alias" ,
109+ path : path . join ( plugin , skillsDirectory , "engineering" , "review" , "SKILL.md" ) ,
110+ enabled : false ,
111+ scope : "user" ,
112+ description : "Review changes." ,
113+ userInvocationOnly : true ,
114+ userInvocable : false ,
115+ } ,
116+ {
117+ name : "manifest-plugin:safe.name alias_Upper" ,
118+ path : path . join ( plugin , "..safe" , "SKILL.md" ) ,
119+ enabled : true ,
120+ scope : "user" ,
121+ } ,
122+ ] . sort ( ( left , right ) => left . name . localeCompare ( right . name ) ) ,
123+ ) ;
81124 } ) ,
82125 ) ;
83126
0 commit comments