MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / runCommand

Function runCommand

src/commands/run.ts:52–102  ·  view source on GitHub ↗
(directory?: string)

Source from the content-addressed store, hash-verified

50}
51
52export async function runCommand(directory?: string): Promise<void> {
53 const workDir = directory ? path.resolve(directory) : process.cwd();
54
55 // Ensure workDir exists
56 fs.mkdirSync(workDir, { recursive: true });
57
58 // No skillpack.json → quickly prompt and create one
59 if (!configExists(workDir)) {
60 console.log(chalk.blue("\n No skillpack.json found. Let's set one up.\n"));
61
62 const { name, description } = await inquirer.prompt([
63 {
64 type: "input",
65 name: "name",
66 message: "App name:",
67 validate: (v: string) => v.trim() ? true : "Name is required",
68 },
69 {
70 type: "input",
71 name: "description",
72 message: "Description:",
73 default: "A skill App, powered by SkillPack.sh",
74 },
75 ]);
76
77 const config = createDefaultConfig(name.trim(), description.trim());
78 saveConfig(workDir, config);
79 copyStartTemplates(workDir);
80 console.log(chalk.green(`\n skillpack.json created\n`));
81 }
82
83 const config = loadConfig(workDir);
84
85 // Auto-install missing remote skills
86 const missing = findMissingSkills(workDir, config);
87 if (missing.length > 0) {
88 console.log(chalk.blue(`\n Installing ${missing.length} missing skill(s)...\n`));
89 try {
90 installSkills(workDir, missing);
91 } catch (err) {
92 console.warn(chalk.yellow(` Warning: Some skills could not be installed: ${err}`));
93 }
94 }
95 syncSkillDescriptions(workDir, config);
96 saveConfig(workDir, config);
97
98 // Start the runtime server
99 await startServer({
100 rootDir: workDir,
101 });
102}

Callers 1

cli.tsFile · 0.85

Calls 9

loadConfigFunction · 0.90
configExistsFunction · 0.85
createDefaultConfigFunction · 0.85
saveConfigFunction · 0.85
findMissingSkillsFunction · 0.85
installSkillsFunction · 0.85
syncSkillDescriptionsFunction · 0.85
startServerFunction · 0.85
copyStartTemplatesFunction · 0.70

Tested by

no test coverage detected