feat(skills): add installer execution stub command

This commit is contained in:
William Valentin
2026-02-12 18:26:09 -08:00
parent 1bb791c7dd
commit e8d5d01d4d
3 changed files with 117 additions and 2 deletions
+35
View File
@@ -15,6 +15,8 @@ import {
renderSkillInstallerPlan,
toSkillInstallPreflightView,
renderSkillInstallPreflight,
toSkillInstallerExecutionStubView,
renderSkillInstallerExecutionStub,
} from './skills.js';
import type { Skill } from '../skills/index.js';
@@ -212,6 +214,39 @@ describe('skills CLI helpers', () => {
expect(output).toContain('[download] download https://example.com/tool.tgz -> <default destination>');
});
it('builds installer execution stub view from skill plan', () => {
const view = toSkillInstallerExecutionStubView(
buildSkill({
manifest: {
name: 'exec-stub',
description: 'Execution stub test',
version: '1.1.0',
tier: 'managed',
installers: [{ type: 'download', url: 'https://example.com/tool.tgz' }],
},
}),
);
expect(view.execution).toBe('stub');
expect(view.wouldRun.length).toBe(1);
expect(view.wouldRun[0]).toContain('download https://example.com/tool.tgz');
});
it('renders installer execution stub output text', () => {
const output = renderSkillInstallerExecutionStub({
skill: { name: 'exec-stub', tier: 'bundled', version: '1.0.0' },
execution: 'stub',
wouldRun: ['brew install jq'],
skipped: [{ installerType: 'node', reason: 'neither pnpm nor npm available in PATH' }],
});
expect(output).toContain("Installer execution stub for 'exec-stub'");
expect(output).toContain('No installer commands were executed.');
expect(output).toContain('Would run:');
expect(output).toContain('- brew install jq');
expect(output).toContain('Skipped:');
});
it('summarizes refresh counts across status and tiers', () => {
const summary = summarizeSkillsRefresh([
buildSkill({ manifest: { name: 'a', description: 'a', version: '1.0.0', tier: 'bundled' } }),