feat(skills): add optional shell command runner

This commit is contained in:
William Valentin
2026-02-12 19:18:20 -08:00
parent 3a1bac0891
commit 30fcccd05a
3 changed files with 91 additions and 2 deletions
+28
View File
@@ -23,6 +23,7 @@ import {
mergeInstallerExecutionResults,
runInstallerCommandsWithPolicy,
noOpSkillInstallerCommandRunner,
createShellSkillInstallerCommandRunner,
runSkillInstallAction,
} from './skills.js';
import type { Skill } from '../skills/index.js';
@@ -376,6 +377,33 @@ describe('skills CLI helpers', () => {
expect(runner.run).toHaveBeenCalledWith(['brew install jq']);
});
it('shell command runner reports succeeded command status', () => {
const runner = createShellSkillInstallerCommandRunner();
const results = runner.run(['node -e "process.exit(0)"']);
expect(results).toEqual([
{
command: 'node -e "process.exit(0)"',
status: 'succeeded',
},
]);
});
it('shell command runner reports failed command with exit code reason', () => {
const runner = createShellSkillInstallerCommandRunner();
const results = runner.run(['node -e "process.exit(7)"']);
expect(results).toEqual([
{
command: 'node -e "process.exit(7)"',
status: 'failed',
reason: 'exit_code_7',
},
]);
});
it('maps runner command results into structured per-step statuses', () => {
const attempted = [
{ installer_type: 'brew', command: 'brew install jq' },