Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/__tests__/skills.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,30 @@ scope: 'user',
const content = await fse.readFile(contribPath, 'utf-8');
expect(content).toBe('testuser\n');
});

it('should NOT copy .git directory when skill source is a git repo', async () => {
const localSkillDir = path.join(homeDir, '.claude/skills', 'git-skill');
await fse.ensureDir(localSkillDir);
await fse.writeFile(path.join(localSkillDir, 'SKILL.md'), '# Git Skill\nContent here');
await fse.writeFile(path.join(localSkillDir, 'helper.py'), 'print("hello")');
// Simulate a .git directory (as if skill was cloned from a git repo)
await fse.ensureDir(path.join(localSkillDir, '.git', 'objects'));
await fse.writeFile(path.join(localSkillDir, '.git', 'HEAD'), 'ref: refs/heads/main');

const item = {
name: 'git-skill',
type: 'skills' as const,
sourcePath: localSkillDir,
relativePath: 'skills/git-skill',
};

await handler.pushItem(item, teamConfig, localConfig);

const destDir = path.join(localConfig.repo.localPath, 'skills', 'git-skill');
expect(await fse.pathExists(path.join(destDir, 'SKILL.md'))).toBe(true);
expect(await fse.pathExists(path.join(destDir, 'helper.py'))).toBe(true);
expect(await fse.pathExists(path.join(destDir, '.git'))).toBe(false);
});
});

describe('SkillsHandler.readContributors', () => {
Expand Down
1 change: 1 addition & 0 deletions src/utils/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const IGNORED_NAMES = new Set([
'.pyc',
'.DS_Store',
'node_modules',
'.git',
]);

function isIgnored(name: string): boolean {
Expand Down
Loading