feat(skills): add installer plan command output
This commit is contained in:
@@ -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' } }),
|
||||
|
||||
Reference in New Issue
Block a user