feat(skills): add dry-run installer planning surface

This commit is contained in:
William Valentin
2026-02-12 17:56:51 -08:00
parent 81d04357a1
commit bd754d520e
6 changed files with 206 additions and 3 deletions
+20
View File
@@ -104,6 +104,26 @@ describe('skills CLI helpers', () => {
expect(output).toContain('Unavailable reasons: Required binary not found');
});
it('renders dry-run installer plan when manifest installers are present', () => {
const output = renderSkillInfo(
buildSkill({
manifest: {
name: 'installer-aware',
description: 'Installer-aware skill',
version: '1.0.0',
tier: 'bundled',
installers: [
{ type: 'download', url: 'https://example.com/tool.tgz', destination: '/tmp/tool.tgz' },
],
},
}),
);
expect(output).toContain('Installer plan mode: dry-run');
expect(output).toContain('Installer planned steps:');
expect(output).toContain('[download] download https://example.com/tool.tgz -> /tmp/tool.tgz');
});
it('summarizes refresh counts across status and tiers', () => {
const summary = summarizeSkillsRefresh([
buildSkill({ manifest: { name: 'a', description: 'a', version: '1.0.0', tier: 'bundled' } }),
+18 -1
View File
@@ -2,7 +2,7 @@ import type { Command } from 'commander';
import { resolve } from 'path';
import { homedir } from 'os';
import type { Skill } from '../skills/index.js';
import { loadAllSkills, SkillInstaller } from '../skills/index.js';
import { loadAllSkills, SkillInstaller, buildInstallerPlan } from '../skills/index.js';
import { loadConfigSafe } from './shared.js';
export interface SkillListRow {
@@ -75,6 +75,23 @@ export function renderSkillInfo(skill: Skill): string {
lines.push(`Unavailable reasons: ${skill.unavailableReasons.join('; ')}`);
}
if (skill.manifest.installers && skill.manifest.installers.length > 0) {
const plan = buildInstallerPlan(skill.manifest.installers);
lines.push(`Installer plan mode: ${plan.mode}`);
if (plan.steps.length > 0) {
lines.push('Installer planned steps:');
for (const step of plan.steps) {
lines.push(`- [${step.installerType}] ${step.command}`);
}
}
if (plan.skipped.length > 0) {
lines.push('Installer skipped steps:');
for (const skip of plan.skipped) {
lines.push(`- [${skip.installerType}] ${skip.reason}`);
}
}
}
return lines.join('\n');
}