Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
note,
outro,
select,
spinner,
taskLog,
text,
} from '@clack/prompts';
import { determineAgent } from '@vercel/detect-agent';
Expand Down Expand Up @@ -425,25 +425,30 @@ async function runSkillCommand(
];
const command = `npx ${args.join(' ')}`;
log.info(`Running skill install command: ${color.dim(command)}`);
const installationSpinner = spinner();
installationSpinner.start(`Installing skill ${skill.value}`);
const installationTaskLog = taskLog({
title: `Installing skill ${skill.value}`,
});

const result = await x('npx', args, {
const proc = x('npx', args, {
nodeOptions: {
cwd,
stdio: 'pipe',
},
});

for await (const line of proc) {
installationTaskLog.message(line);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to switch back to cross-spawn to use raw stream after bombshell-dev/clack#509 is merged.

}

const result = await proc;

if (result.exitCode !== 0) {
installationSpinner.error(`Failed to install skill ${skill.value}`);
const details = [result.stderr, result.stdout].filter(Boolean).join('\n').trim();
throw new Error(
`Failed to install skill "${skill.value}" from "${skill.source}" using command: ${command}${details ? `\n${details}` : ''}`,
);
const message = `Failed to install skill "${skill.value}" from "${skill.source}" using command: ${command}`;
installationTaskLog.error(message);
throw new Error(message);
}

installationSpinner.stop(`Installed skill ${skill.value}`);
installationTaskLog.success(`Installed skill ${skill.value}`);
}

export async function create({
Expand Down
Loading