feat(skills): support install preflight-only mode

This commit is contained in:
William Valentin
2026-02-12 18:17:46 -08:00
parent 601844c50e
commit 1bb791c7dd
3 changed files with 40 additions and 3 deletions
+18 -1
View File
@@ -340,8 +340,9 @@ export function registerSkillsCommand(program: Command): void {
.command('install <path>')
.description('Install a skill from a local directory')
.option('--json', 'Output preflight and install result as JSON')
.option('--preflight-only', 'Show installer preflight without performing install')
.option('-c, --config <path>', 'Config file path')
.action((pathArg: string, opts: { json?: boolean; config?: string }) => {
.action((pathArg: string, opts: { json?: boolean; preflightOnly?: boolean; config?: string }) => {
const loaded = loadConfigSafe(opts.config);
if (loaded.error || !loaded.config) {
console.error(loaded.error ?? 'Failed to load config');
@@ -353,6 +354,22 @@ export function registerSkillsCommand(program: Command): void {
const installer = new SkillInstaller(loaded.config.skills.managed_dir ?? defaultManagedDir);
const preflight = toSkillInstallPreflightView(pathArg);
if (opts.preflightOnly) {
if (!preflight) {
console.error(`Failed to generate install preflight from '${resolve(pathArg)}'.`);
process.exitCode = 1;
return;
}
if (opts.json) {
console.log(JSON.stringify({ preflight }, null, 2));
return;
}
console.log(renderSkillInstallPreflight(preflight));
return;
}
if (preflight) {
if (opts.json) {
console.log(JSON.stringify({ preflight }, null, 2));