feat(skills): support install preflight-only mode
This commit is contained in:
+18
-1
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user