feat(skills): expose list command for skill visibility

This commit is contained in:
William Valentin
2026-02-12 16:42:00 -08:00
parent 90ce622080
commit b3e5aee333
5 changed files with 168 additions and 4 deletions
+61
View File
@@ -0,0 +1,61 @@
import { describe, it, expect } from 'vitest';
import { toSkillListRows, renderSkillsTable } from './skills.js';
import type { Skill } from '../skills/index.js';
function buildSkill(overrides: Partial<Skill>): Skill {
return {
manifest: {
name: 'sample-skill',
description: 'Sample skill',
version: '1.0.0',
tier: 'workspace',
...overrides.manifest,
},
instructions: '# Sample skill',
directory: '/tmp/sample-skill',
available: true,
...overrides,
};
}
describe('skills CLI helpers', () => {
it('maps and sorts skill rows', () => {
const rows = toSkillListRows([
buildSkill({
manifest: {
name: 'zeta',
description: 'zeta',
version: '1.0.0',
tier: 'managed',
},
}),
buildSkill({
manifest: {
name: 'alpha',
description: 'alpha',
version: '1.0.0',
tier: 'bundled',
},
}),
]);
expect(rows.map((row) => row.name)).toEqual(['alpha', 'zeta']);
expect(rows[0]?.status).toBe('available');
});
it('includes unavailable reason text', () => {
const rows = toSkillListRows([
buildSkill({
available: false,
unavailableReasons: ['Required binary not found', 'Missing API key'],
}),
]);
expect(rows[0]?.status).toBe('unavailable');
expect(rows[0]?.reason).toBe('Required binary not found; Missing API key');
});
it('renders a no-skills message when empty', () => {
expect(renderSkillsTable([])).toBe('No skills found.');
});
});