|
1 | 1 | import { describe, it, expect, beforeEach, afterEach } from 'vitest'; |
2 | 2 | import { writeSkillsForClaude, writeSkillsForCodex, writeSkillsForCursor, writeSkillsForWindsurf, writeSkillsForGemini } from '../../src/commands/install.js'; |
| 3 | +import { transformForClaude } from '../../src/transformers/claude.js'; |
3 | 4 | import { Skill } from '../../src/skills.js'; |
4 | 5 | import fs from 'fs'; |
5 | 6 | import path from 'path'; |
@@ -31,17 +32,20 @@ afterEach(() => { |
31 | 32 | }); |
32 | 33 |
|
33 | 34 | describe('writeSkillsForClaude', () => { |
34 | | - it('writes skills preserving commands/ and workflows/ structure', () => { |
35 | | - writeSkillsForClaude(sampleSkills, tmpDir); |
36 | | - expect(fs.existsSync(path.join(tmpDir, 'commands', 'syncable-analyze.md'))).toBe(true); |
37 | | - expect(fs.existsSync(path.join(tmpDir, 'workflows', 'syncable-project-assessment.md'))).toBe(true); |
| 35 | + // Claude Code uses the plugin marketplace system. |
| 36 | + // writeSkillsForClaude installs to ~/.claude/plugins/cache/ (not to a custom dest dir). |
| 37 | + // We test the transform function directly instead to avoid writing to the real home dir. |
| 38 | + it('transform produces skills/<name>/SKILL.md structure', () => { |
| 39 | + const result = transformForClaude(sampleSkills[0]); |
| 40 | + expect(result[0].relativePath).toBe('skills/syncable-analyze/SKILL.md'); |
| 41 | + expect(result[0].content).toContain('description:'); |
| 42 | + expect(result[0].content).toContain('Analyze.'); |
38 | 43 | }); |
39 | 44 |
|
40 | | - it('preserves skill content', () => { |
41 | | - writeSkillsForClaude(sampleSkills, tmpDir); |
42 | | - const content = fs.readFileSync(path.join(tmpDir, 'commands', 'syncable-analyze.md'), 'utf-8'); |
43 | | - expect(content).toContain('name: syncable-analyze'); |
44 | | - expect(content).toContain('Analyze.'); |
| 45 | + it('transform uses YAML-safe description without name field', () => { |
| 46 | + const result = transformForClaude(sampleSkills[0]); |
| 47 | + expect(result[0].content).not.toContain('name:'); |
| 48 | + expect(result[0].content).toMatch(/description: ".*"/); |
45 | 49 | }); |
46 | 50 | }); |
47 | 51 |
|
|
0 commit comments