feat(skills): add installer plan command output

This commit is contained in:
William Valentin
2026-02-12 18:11:38 -08:00
parent bd754d520e
commit d3ba1328f2
3 changed files with 128 additions and 2 deletions
+36
View File
@@ -11,6 +11,8 @@ import {
renderSkillsRefreshSummary,
installSkillFromDirectory,
uninstallSkillByName,
toSkillInstallerPlanView,
renderSkillInstallerPlan,
} from './skills.js';
import type { Skill } from '../skills/index.js';
@@ -124,6 +126,40 @@ describe('skills CLI helpers', () => {
expect(output).toContain('[download] download https://example.com/tool.tgz -> /tmp/tool.tgz');
});
it('builds installer plan view for automation output', () => {
const view = toSkillInstallerPlanView(
buildSkill({
manifest: {
name: 'plan-target',
description: 'Plan me',
version: '3.2.1',
tier: 'managed',
installers: [{ type: 'download', url: 'https://example.com/bin.tar.gz' }],
},
}),
);
expect(view.skill.name).toBe('plan-target');
expect(view.mode).toBe('dry-run');
expect(view.steps.length).toBe(1);
expect(view.steps[0]?.installerType).toBe('download');
});
it('renders installer plan summary text', () => {
const output = renderSkillInstallerPlan({
skill: { name: 'plan-target', tier: 'bundled', version: '1.0.0' },
mode: 'dry-run',
steps: [{ installerType: 'download', command: 'download https://example.com/tool -> /tmp/tool' }],
skipped: [{ installerType: 'brew', reason: 'brew not available in PATH' }],
});
expect(output).toContain("Installer plan for 'plan-target'");
expect(output).toContain('Planned steps:');
expect(output).toContain('[download] download https://example.com/tool -> /tmp/tool');
expect(output).toContain('Skipped steps:');
expect(output).toContain('[brew] brew not available in PATH');
});
it('summarizes refresh counts across status and tiers', () => {
const summary = summarizeSkillsRefresh([
buildSkill({ manifest: { name: 'a', description: 'a', version: '1.0.0', tier: 'bundled' } }),