@@ -7,6 +7,7 @@ import { transformForCursor } from '../transformers/cursor.js';
77import { transformForWindsurf } from '../transformers/windsurf.js' ;
88import { transformForGemini } from '../transformers/gemini.js' ;
99import { SKILL_MARKER_START , SKILL_MARKER_END } from '../constants.js' ;
10+ import { TransformResult } from '../transformers/types.js' ;
1011
1112export function writeSkillsForClaude ( skills : Skill [ ] , _destDir : string ) : void {
1213 // Claude Code uses the plugin marketplace system — destDir is ignored.
@@ -45,27 +46,17 @@ export function writeSkillsForWindsurf(skills: Skill[], destDir: string): void {
4546 }
4647}
4748
48- export function writeSkillsForGemini ( skills : Skill [ ] , filePath : string ) : void {
49- const geminiContent = transformForGemini ( skills ) ;
50- let existing = '' ;
51-
52- if ( fs . existsSync ( filePath ) ) {
53- existing = fs . readFileSync ( filePath , 'utf-8' ) ;
54-
55- // Replace existing section if present
56- const startIdx = existing . indexOf ( SKILL_MARKER_START ) ;
57- const endIdx = existing . indexOf ( SKILL_MARKER_END ) ;
58- if ( startIdx !== - 1 && endIdx !== - 1 ) {
59- const before = existing . slice ( 0 , startIdx ) ;
60- const after = existing . slice ( endIdx + SKILL_MARKER_END . length ) ;
61- fs . writeFileSync ( filePath , before + geminiContent + after ) ;
62- return ;
49+ export function writeSkillsForGemini ( skills : Skill [ ] , destDir : string ) : void {
50+ // Gemini CLI uses skills/<skill-name>/SKILL.md format
51+ // destDir is ~/.gemini/<profile>/skills/
52+ for ( const skill of skills ) {
53+ const results = transformForGemini ( skill ) ;
54+ for ( const { relativePath, content } of results ) {
55+ const fullPath = path . join ( destDir , relativePath ) ;
56+ fs . mkdirSync ( path . dirname ( fullPath ) , { recursive : true } ) ;
57+ fs . writeFileSync ( fullPath , content ) ;
6358 }
6459 }
65-
66- // Append to existing or create new
67- const separator = existing && ! existing . endsWith ( '\n' ) ? '\n\n' : existing ? '\n' : '' ;
68- fs . writeFileSync ( filePath , existing + separator + geminiContent + '\n' ) ;
6960}
7061
7162export interface InstallOptions {
0 commit comments