@nitrostack/cli 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +82 -9
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +66 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/skills/clone.d.ts +28 -0
- package/dist/skills/clone.d.ts.map +1 -0
- package/dist/skills/clone.js +60 -0
- package/dist/skills/detect-agents.d.ts +8 -0
- package/dist/skills/detect-agents.d.ts.map +1 -0
- package/dist/skills/detect-agents.js +129 -0
- package/dist/skills/discover.d.ts +12 -0
- package/dist/skills/discover.d.ts.map +1 -0
- package/dist/skills/discover.js +45 -0
- package/dist/skills/index.d.ts +21 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +97 -0
- package/dist/skills/installer.d.ts +21 -0
- package/dist/skills/installer.d.ts.map +1 -0
- package/dist/skills/installer.js +48 -0
- package/dist/skills/types.d.ts +39 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +1 -0
- package/dist/skills/ui.d.ts +55 -0
- package/dist/skills/ui.d.ts.map +1 -0
- package/dist/skills/ui.js +102 -0
- package/package.json +1 -1
package/dist/commands/init.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA4IA,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,iBAmPtF"}
|
package/dist/commands/init.js
CHANGED
|
@@ -7,6 +7,80 @@ import inquirer from 'inquirer';
|
|
|
7
7
|
import { execSync } from 'child_process';
|
|
8
8
|
import { NITRO_BANNER_FULL, createSuccessBox, NitroSpinner, log, spacer, nextSteps, brand, showFooter } from '../ui/branding.js';
|
|
9
9
|
import { trackEvent, shutdownAnalytics } from '../analytics/posthog.js';
|
|
10
|
+
import { runSkillsFlow } from '../skills/index.js';
|
|
11
|
+
import readline from 'readline';
|
|
12
|
+
/**
|
|
13
|
+
* Prompts the user with a horizontal YES/NO choice using left/right arrow keys.
|
|
14
|
+
*/
|
|
15
|
+
async function promptYesNoHorizontal(message, defaultValue = false) {
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
let value = defaultValue;
|
|
18
|
+
const stdin = process.stdin;
|
|
19
|
+
const stdout = process.stdout;
|
|
20
|
+
// Save TTY and raw mode state
|
|
21
|
+
const isRaw = stdin.isRaw;
|
|
22
|
+
if (stdin.isTTY) {
|
|
23
|
+
stdin.setRawMode(true);
|
|
24
|
+
}
|
|
25
|
+
readline.emitKeypressEvents(stdin);
|
|
26
|
+
stdin.resume();
|
|
27
|
+
// Hide cursor
|
|
28
|
+
stdout.write('\u001B[?25l');
|
|
29
|
+
const render = () => {
|
|
30
|
+
readline.clearLine(stdout, 0);
|
|
31
|
+
readline.cursorTo(stdout, 0);
|
|
32
|
+
const qMark = chalk.cyan('?');
|
|
33
|
+
const msg = chalk.bold(message);
|
|
34
|
+
const pointer = chalk.dim('›');
|
|
35
|
+
const separator = chalk.dim(' / ');
|
|
36
|
+
const noPart = !value
|
|
37
|
+
? chalk.cyan.underline('No')
|
|
38
|
+
: chalk.dim('No');
|
|
39
|
+
const yesPart = value
|
|
40
|
+
? chalk.cyan.underline('Yes')
|
|
41
|
+
: chalk.dim('Yes');
|
|
42
|
+
stdout.write(`${qMark} ${msg} ${pointer} ${noPart}${separator}${yesPart}`);
|
|
43
|
+
};
|
|
44
|
+
render();
|
|
45
|
+
const onKeypress = (str, key) => {
|
|
46
|
+
if (!key)
|
|
47
|
+
return;
|
|
48
|
+
if (key.name === 'left' || key.name === 'right') {
|
|
49
|
+
value = !value;
|
|
50
|
+
render();
|
|
51
|
+
}
|
|
52
|
+
else if (key.name === 'return' || key.name === 'enter') {
|
|
53
|
+
cleanup();
|
|
54
|
+
// Clear prompt line and print final answer
|
|
55
|
+
readline.clearLine(stdout, 0);
|
|
56
|
+
readline.cursorTo(stdout, 0);
|
|
57
|
+
const checkMark = chalk.green('✔');
|
|
58
|
+
const finalAns = value ? chalk.cyan('Yes') : chalk.cyan('No');
|
|
59
|
+
stdout.write(`${checkMark} ${chalk.white(message)} ${finalAns}\n`);
|
|
60
|
+
// Resolve after a small delay to prevent keypress bleeding into the next prompt
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
resolve(value);
|
|
63
|
+
}, 100);
|
|
64
|
+
}
|
|
65
|
+
else if (key.ctrl && key.name === 'c') {
|
|
66
|
+
cleanup();
|
|
67
|
+
process.exit(130); // SIGINT exit code
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const cleanup = () => {
|
|
71
|
+
// Show cursor
|
|
72
|
+
stdout.write('\u001B[?25h');
|
|
73
|
+
stdin.removeListener('keypress', onKeypress);
|
|
74
|
+
// Consume any data currently sitting in the stream buffer
|
|
75
|
+
stdin.read();
|
|
76
|
+
if (stdin.isTTY) {
|
|
77
|
+
stdin.setRawMode(isRaw);
|
|
78
|
+
}
|
|
79
|
+
stdin.pause();
|
|
80
|
+
};
|
|
81
|
+
stdin.on('keypress', onKeypress);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
10
84
|
// ES module equivalent of __dirname
|
|
11
85
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
86
|
const __dirname = dirname(__filename);
|
|
@@ -69,14 +143,7 @@ export async function initCommand(projectName, options) {
|
|
|
69
143
|
const targetDir = path.join(process.cwd(), finalProjectName);
|
|
70
144
|
// Check if directory exists
|
|
71
145
|
if (fs.existsSync(targetDir)) {
|
|
72
|
-
const
|
|
73
|
-
{
|
|
74
|
-
type: 'confirm',
|
|
75
|
-
name: 'overwrite',
|
|
76
|
-
message: chalk.yellow(`Directory ${finalProjectName} already exists. Overwrite?`),
|
|
77
|
-
default: false,
|
|
78
|
-
},
|
|
79
|
-
]);
|
|
146
|
+
const overwrite = await promptYesNoHorizontal(chalk.yellow(`Directory ${finalProjectName} already exists. Overwrite?`), false);
|
|
80
147
|
if (!overwrite) {
|
|
81
148
|
log('Cancelled', 'warning');
|
|
82
149
|
process.exit(0);
|
|
@@ -99,7 +166,7 @@ export async function initCommand(projectName, options) {
|
|
|
99
166
|
value: 'typescript-pizzaz',
|
|
100
167
|
},
|
|
101
168
|
{
|
|
102
|
-
name: `${brand.signal('
|
|
169
|
+
name: `${brand.signal('Flight booking')} ${chalk.dim('Flight booking with OAuth 2.1 auth')}`,
|
|
103
170
|
value: 'typescript-oauth',
|
|
104
171
|
},
|
|
105
172
|
],
|
|
@@ -152,6 +219,12 @@ export async function initCommand(projectName, options) {
|
|
|
152
219
|
fs.writeJSONSync(packageJsonPath, packageJson, { spaces: 2 });
|
|
153
220
|
}
|
|
154
221
|
spinner.succeed('Project created');
|
|
222
|
+
// Agent skills prompt bypassed - installing project-level skills by default
|
|
223
|
+
// const addAgentSkills = await promptYesNoHorizontal('Add agent skills?', true);
|
|
224
|
+
// if (addAgentSkills) {
|
|
225
|
+
// await runSkillsFlow(options.force ?? false, targetDir);
|
|
226
|
+
// }
|
|
227
|
+
await runSkillsFlow(options.force ?? false, targetDir);
|
|
155
228
|
// Install dependencies
|
|
156
229
|
if (!options.skipInstall) {
|
|
157
230
|
spinner = new NitroSpinner('Installing dependencies...').start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAmCA,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAUD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgD1E;AA2BD;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAa9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAM1D;AAqED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAmM3E"}
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -5,6 +5,10 @@ import fs from 'fs-extra';
|
|
|
5
5
|
import https from 'https';
|
|
6
6
|
import { createHeader, createBox, createSuccessBox, createErrorBox, NitroSpinner, log, spacer, nextSteps, NITRO_BANNER_FULL, showFooter } from '../ui/branding.js';
|
|
7
7
|
import { trackEvent, shutdownAnalytics } from '../analytics/posthog.js';
|
|
8
|
+
import { cloneSkillsRepo } from '../skills/clone.js';
|
|
9
|
+
import { discoverSkills } from '../skills/discover.js';
|
|
10
|
+
import { installSkills } from '../skills/installer.js';
|
|
11
|
+
import { AGENTS } from '../skills/detect-agents.js';
|
|
8
12
|
/**
|
|
9
13
|
* Fetch a package's latest published version from NPM using standard https module.
|
|
10
14
|
*/
|
|
@@ -236,6 +240,68 @@ export async function upgradeCommand(options) {
|
|
|
236
240
|
console.error(error);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
243
|
+
// Upgrade skills
|
|
244
|
+
const rootPackageJson = fs.readJSONSync(rootPackageJsonPath);
|
|
245
|
+
const localSkillsVersion = rootPackageJson.nitrostack?.skillsVersion || '0.0.0';
|
|
246
|
+
let tempSkillsDir = null;
|
|
247
|
+
const skillsSpinner = new NitroSpinner('Checking agent skills...').start();
|
|
248
|
+
try {
|
|
249
|
+
tempSkillsDir = await cloneSkillsRepo();
|
|
250
|
+
const skillsPkgJsonPath = path.join(tempSkillsDir, 'package.json');
|
|
251
|
+
let remoteSkillsVersion = '1.0.0';
|
|
252
|
+
if (fs.existsSync(skillsPkgJsonPath)) {
|
|
253
|
+
const skillsPkgJson = fs.readJSONSync(skillsPkgJsonPath);
|
|
254
|
+
remoteSkillsVersion = skillsPkgJson.version || '1.0.0';
|
|
255
|
+
}
|
|
256
|
+
if (compareVersions(localSkillsVersion, remoteSkillsVersion) < 0) {
|
|
257
|
+
if (dryRun) {
|
|
258
|
+
allResults.push({
|
|
259
|
+
location: 'skills',
|
|
260
|
+
packageName: '@nitrostack/skills',
|
|
261
|
+
previousVersion: localSkillsVersion,
|
|
262
|
+
newVersion: remoteSkillsVersion,
|
|
263
|
+
upgraded: false,
|
|
264
|
+
});
|
|
265
|
+
skillsSpinner.info(`Skills: Updates available (${localSkillsVersion} → ${remoteSkillsVersion})`);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
const skills = await discoverSkills(tempSkillsDir);
|
|
269
|
+
await installSkills(AGENTS, skills, true, 'project', projectRoot);
|
|
270
|
+
// Write new version to package.json
|
|
271
|
+
const updatedPackageJson = fs.readJSONSync(rootPackageJsonPath);
|
|
272
|
+
if (!updatedPackageJson.nitrostack) {
|
|
273
|
+
updatedPackageJson.nitrostack = {};
|
|
274
|
+
}
|
|
275
|
+
updatedPackageJson.nitrostack.skillsVersion = remoteSkillsVersion;
|
|
276
|
+
fs.writeJSONSync(rootPackageJsonPath, updatedPackageJson, { spaces: 2 });
|
|
277
|
+
allResults.push({
|
|
278
|
+
location: 'skills',
|
|
279
|
+
packageName: '@nitrostack/skills',
|
|
280
|
+
previousVersion: localSkillsVersion,
|
|
281
|
+
newVersion: remoteSkillsVersion,
|
|
282
|
+
upgraded: true,
|
|
283
|
+
});
|
|
284
|
+
skillsSpinner.succeed(`Skills: Upgraded from ${localSkillsVersion} to ${remoteSkillsVersion}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
skillsSpinner.info('Skills: All agent skills are up to date');
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
skillsSpinner.fail('Failed to upgrade agent skills');
|
|
293
|
+
console.error(error);
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
if (tempSkillsDir) {
|
|
297
|
+
try {
|
|
298
|
+
fs.removeSync(tempSkillsDir);
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
// best effort
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
239
305
|
// Summary
|
|
240
306
|
spacer();
|
|
241
307
|
if (allResults.length === 0) {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,aAAa,YA6E5B;AAGD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export function createProgram() {
|
|
|
25
25
|
.option('--description <description>', 'Description of the project')
|
|
26
26
|
.option('--author <author>', 'Author of the project')
|
|
27
27
|
.option('--skip-install', 'Skip installing dependencies')
|
|
28
|
+
.option('--force', 'Overwrite existing skill files when adding agent skills')
|
|
28
29
|
.action(initCommand);
|
|
29
30
|
program
|
|
30
31
|
.command('dev')
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const SKILLS_REPO_URL = "https://github.com/nitrocloudofficial/skills.git";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when the skills repository cannot be cloned (git missing, network
|
|
4
|
+
* error, repository not found, etc.). The caller should catch this and
|
|
5
|
+
* display a user-friendly warning rather than crashing the entire init flow.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SkillsCloneError extends Error {
|
|
8
|
+
readonly cause?: unknown | undefined;
|
|
9
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Clones the NitroStack skills repository into a unique temporary directory
|
|
13
|
+
* and returns the absolute path to that directory.
|
|
14
|
+
*
|
|
15
|
+
* The caller is responsible for cleaning up the directory when done:
|
|
16
|
+
* ```ts
|
|
17
|
+
* const tempDir = await cloneSkillsRepo();
|
|
18
|
+
* try {
|
|
19
|
+
* // use tempDir …
|
|
20
|
+
* } finally {
|
|
21
|
+
* await fs.remove(tempDir);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @throws {SkillsCloneError} when git is unavailable or the clone fails.
|
|
26
|
+
*/
|
|
27
|
+
export declare function cloneSkillsRepo(): Promise<string>;
|
|
28
|
+
//# sourceMappingURL=clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/skills/clone.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe,qDAAqD,CAAC;AAElF;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;aACI,KAAK,CAAC,EAAE,OAAO;gBAAhD,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,OAAO,YAAA;CAI7D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAiCvD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import crypto from 'crypto';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
export const SKILLS_REPO_URL = 'https://github.com/nitrocloudofficial/skills.git';
|
|
7
|
+
/**
|
|
8
|
+
* Thrown when the skills repository cannot be cloned (git missing, network
|
|
9
|
+
* error, repository not found, etc.). The caller should catch this and
|
|
10
|
+
* display a user-friendly warning rather than crashing the entire init flow.
|
|
11
|
+
*/
|
|
12
|
+
export class SkillsCloneError extends Error {
|
|
13
|
+
cause;
|
|
14
|
+
constructor(message, cause) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.cause = cause;
|
|
17
|
+
this.name = 'SkillsCloneError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Clones the NitroStack skills repository into a unique temporary directory
|
|
22
|
+
* and returns the absolute path to that directory.
|
|
23
|
+
*
|
|
24
|
+
* The caller is responsible for cleaning up the directory when done:
|
|
25
|
+
* ```ts
|
|
26
|
+
* const tempDir = await cloneSkillsRepo();
|
|
27
|
+
* try {
|
|
28
|
+
* // use tempDir …
|
|
29
|
+
* } finally {
|
|
30
|
+
* await fs.remove(tempDir);
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @throws {SkillsCloneError} when git is unavailable or the clone fails.
|
|
35
|
+
*/
|
|
36
|
+
export async function cloneSkillsRepo() {
|
|
37
|
+
const uniqueId = crypto.randomBytes(6).toString('hex');
|
|
38
|
+
const tempDir = path.join(os.tmpdir(), `nitrostack-skills-${uniqueId}`);
|
|
39
|
+
try {
|
|
40
|
+
execSync(`git clone --depth 1 "${SKILLS_REPO_URL}" "${tempDir}"`, {
|
|
41
|
+
stdio: 'pipe',
|
|
42
|
+
timeout: 60_000,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
// Clean up any partial clone before throwing
|
|
47
|
+
try {
|
|
48
|
+
await fs.remove(tempDir);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// best-effort cleanup
|
|
52
|
+
}
|
|
53
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
54
|
+
if (message.includes('git: command not found') || message.includes("'git' is not recognized")) {
|
|
55
|
+
throw new SkillsCloneError('Git is not installed or not in PATH. Install Git from https://git-scm.com and try again.', err);
|
|
56
|
+
}
|
|
57
|
+
throw new SkillsCloneError(`Failed to clone skills repository: ${message.split('\n')[0]}`, err);
|
|
58
|
+
}
|
|
59
|
+
return tempDir;
|
|
60
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentDescriptor } from './types.js';
|
|
2
|
+
export declare const AGENTS: AgentDescriptor[];
|
|
3
|
+
/**
|
|
4
|
+
* Runs all agent detectors in parallel and returns only the agents that are
|
|
5
|
+
* detected on the current machine.
|
|
6
|
+
*/
|
|
7
|
+
export declare function detectAgents(): Promise<AgentDescriptor[]>;
|
|
8
|
+
//# sourceMappingURL=detect-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-agents.d.ts","sourceRoot":"","sources":["../../src/skills/detect-agents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAkElD,eAAO,MAAM,MAAM,EAAE,eAAe,EAwDnC,CAAC;AAEF;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAa/D"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { exec } from 'child_process';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
const execAsync = promisify(exec);
|
|
7
|
+
/**
|
|
8
|
+
* Returns true when the given CLI command is available in the system PATH.
|
|
9
|
+
* Works cross-platform: uses `where` on Windows, `which` elsewhere.
|
|
10
|
+
*/
|
|
11
|
+
async function commandExists(cmd) {
|
|
12
|
+
try {
|
|
13
|
+
const whichCmd = process.platform === 'win32' ? `where ${cmd}` : `which ${cmd}`;
|
|
14
|
+
await execAsync(whichCmd);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns true when a directory exists at `dirPath`.
|
|
23
|
+
*/
|
|
24
|
+
function dirExists(dirPath) {
|
|
25
|
+
try {
|
|
26
|
+
return fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory();
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const HOME = os.homedir();
|
|
33
|
+
/**
|
|
34
|
+
* Helper to build an AgentDescriptor from a simpler specification,
|
|
35
|
+
* reducing duplicate boilerplate for detect() and getSkillsDir().
|
|
36
|
+
*/
|
|
37
|
+
function createAgentDescriptor(spec) {
|
|
38
|
+
return {
|
|
39
|
+
id: spec.id,
|
|
40
|
+
name: spec.name,
|
|
41
|
+
displayPath: `~/${spec.folderName}/skills`,
|
|
42
|
+
async detect() {
|
|
43
|
+
if (spec.customDetect) {
|
|
44
|
+
return spec.customDetect();
|
|
45
|
+
}
|
|
46
|
+
const hasCmd = spec.cmd ? await commandExists(spec.cmd) : false;
|
|
47
|
+
return hasCmd || dirExists(path.join(HOME, spec.folderName));
|
|
48
|
+
},
|
|
49
|
+
getSkillsDir(scope = 'global', projectDir = process.cwd()) {
|
|
50
|
+
if (spec.getSkillsDir) {
|
|
51
|
+
return spec.getSkillsDir(scope, projectDir);
|
|
52
|
+
}
|
|
53
|
+
const base = scope === 'project' ? projectDir : HOME;
|
|
54
|
+
return path.join(base, spec.folderName, 'skills');
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export const AGENTS = [
|
|
59
|
+
// ── Original 5 agents (must keep indices 0-4 for tests) ───────────────────
|
|
60
|
+
createAgentDescriptor({
|
|
61
|
+
id: 'cursor',
|
|
62
|
+
name: 'Cursor Agent',
|
|
63
|
+
folderName: '.cursor',
|
|
64
|
+
}),
|
|
65
|
+
createAgentDescriptor({
|
|
66
|
+
id: 'codex',
|
|
67
|
+
name: 'Codex',
|
|
68
|
+
folderName: '.codex',
|
|
69
|
+
cmd: 'codex',
|
|
70
|
+
}),
|
|
71
|
+
createAgentDescriptor({
|
|
72
|
+
id: 'claude-code',
|
|
73
|
+
name: 'Claude Code',
|
|
74
|
+
folderName: '.claude',
|
|
75
|
+
cmd: 'claude',
|
|
76
|
+
}),
|
|
77
|
+
createAgentDescriptor({
|
|
78
|
+
id: 'gemini-cli',
|
|
79
|
+
name: 'Gemini CLI',
|
|
80
|
+
folderName: '.gemini',
|
|
81
|
+
cmd: 'gemini',
|
|
82
|
+
}),
|
|
83
|
+
createAgentDescriptor({
|
|
84
|
+
id: 'antigravity',
|
|
85
|
+
name: 'Google Antigravity',
|
|
86
|
+
folderName: '.antigravity',
|
|
87
|
+
cmd: 'agy',
|
|
88
|
+
}),
|
|
89
|
+
// ── Additional coding agents (limited to GitHub Copilot and OpenCode) ──────
|
|
90
|
+
createAgentDescriptor({
|
|
91
|
+
id: 'github-copilot',
|
|
92
|
+
name: 'GitHub Copilot Agent',
|
|
93
|
+
folderName: '.copilot',
|
|
94
|
+
}),
|
|
95
|
+
createAgentDescriptor({
|
|
96
|
+
id: 'opencode',
|
|
97
|
+
name: 'OpenCode Agent',
|
|
98
|
+
// OpenCode stores its config at ~/.config/opencode
|
|
99
|
+
folderName: '.config/opencode',
|
|
100
|
+
cmd: 'opencode',
|
|
101
|
+
getSkillsDir(scope = 'global', projectDir = process.cwd()) {
|
|
102
|
+
if (scope === 'project') {
|
|
103
|
+
return path.join(projectDir, '.opencode', 'skills');
|
|
104
|
+
}
|
|
105
|
+
return path.join(HOME, '.config', 'opencode', 'skills');
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
createAgentDescriptor({
|
|
109
|
+
id: 'agents',
|
|
110
|
+
name: 'Workspace Agents',
|
|
111
|
+
folderName: '.agents',
|
|
112
|
+
}),
|
|
113
|
+
];
|
|
114
|
+
/**
|
|
115
|
+
* Runs all agent detectors in parallel and returns only the agents that are
|
|
116
|
+
* detected on the current machine.
|
|
117
|
+
*/
|
|
118
|
+
export async function detectAgents() {
|
|
119
|
+
const results = await Promise.all(AGENTS.map(async (agent) => {
|
|
120
|
+
try {
|
|
121
|
+
const found = await agent.detect();
|
|
122
|
+
return found ? agent : null;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
return results.filter((a) => a !== null);
|
|
129
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Skill } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Discovers all skills inside the cloned repository.
|
|
4
|
+
*
|
|
5
|
+
* A "skill" is any immediate subdirectory of `<cloneDir>/skills/` whose name
|
|
6
|
+
* does not start with a dot. Regular files and hidden directories are ignored.
|
|
7
|
+
*
|
|
8
|
+
* @param cloneDir - Absolute path to the root of the cloned repository.
|
|
9
|
+
* @returns Array of discovered skills, sorted alphabetically by name.
|
|
10
|
+
*/
|
|
11
|
+
export declare function discoverSkills(cloneDir: string): Promise<Skill[]>;
|
|
12
|
+
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/skills/discover.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAgBxC;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAwBvE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
/**
|
|
4
|
+
* The subdirectory inside the cloned repository that contains individual skill
|
|
5
|
+
* folders. Repository layout:
|
|
6
|
+
*
|
|
7
|
+
* <clone>/
|
|
8
|
+
* skills/
|
|
9
|
+
* remotion/ ← one skill per subdirectory
|
|
10
|
+
* mcp-best-practices/
|
|
11
|
+
* …
|
|
12
|
+
* src/
|
|
13
|
+
* README.md
|
|
14
|
+
*/
|
|
15
|
+
const SKILLS_SUBDIR = 'skills';
|
|
16
|
+
/**
|
|
17
|
+
* Discovers all skills inside the cloned repository.
|
|
18
|
+
*
|
|
19
|
+
* A "skill" is any immediate subdirectory of `<cloneDir>/skills/` whose name
|
|
20
|
+
* does not start with a dot. Regular files and hidden directories are ignored.
|
|
21
|
+
*
|
|
22
|
+
* @param cloneDir - Absolute path to the root of the cloned repository.
|
|
23
|
+
* @returns Array of discovered skills, sorted alphabetically by name.
|
|
24
|
+
*/
|
|
25
|
+
export async function discoverSkills(cloneDir) {
|
|
26
|
+
const skillsRoot = path.join(cloneDir, SKILLS_SUBDIR);
|
|
27
|
+
if (!(await fs.pathExists(skillsRoot))) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const entries = await fs.readdir(skillsRoot, { withFileTypes: true });
|
|
31
|
+
const skills = [];
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
// Skip hidden entries (e.g. .DS_Store, .git)
|
|
34
|
+
if (entry.name.startsWith('.'))
|
|
35
|
+
continue;
|
|
36
|
+
// Only directories are treated as skills
|
|
37
|
+
if (!entry.isDirectory())
|
|
38
|
+
continue;
|
|
39
|
+
skills.push({
|
|
40
|
+
name: entry.name,
|
|
41
|
+
sourcePath: path.join(skillsRoot, entry.name),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs the full agent-skills installation flow.
|
|
3
|
+
*
|
|
4
|
+
* Steps:
|
|
5
|
+
* 1. Clone the skills repository into a temporary directory.
|
|
6
|
+
* 2. Discover all skills in the `skills/` subdirectory.
|
|
7
|
+
* 3. Detect supported AI agents installed on the machine.
|
|
8
|
+
* 4. Prompt the user to select which agents to install skills into.
|
|
9
|
+
* 5. Install the skills and report results.
|
|
10
|
+
* 6. Clean up the temporary clone.
|
|
11
|
+
*
|
|
12
|
+
* Graceful fallbacks:
|
|
13
|
+
* - Git unavailable or clone fails → print warning and return.
|
|
14
|
+
* - No agents detected → print warning and return.
|
|
15
|
+
* - User selects no agents → return silently.
|
|
16
|
+
* - Individual skill copy fails → reported per-agent, does not abort the run.
|
|
17
|
+
*
|
|
18
|
+
* @param force - When true, overwrite existing skill files.
|
|
19
|
+
*/
|
|
20
|
+
export declare function runSkillsFlow(force?: boolean, projectDir?: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,aAAa,CAAC,KAAK,GAAE,OAAe,EAAE,UAAU,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4E7G"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { cloneSkillsRepo, SkillsCloneError } from './clone.js';
|
|
5
|
+
import { discoverSkills } from './discover.js';
|
|
6
|
+
import { AGENTS } from './detect-agents.js';
|
|
7
|
+
import { installSkills } from './installer.js';
|
|
8
|
+
import { printSkillsHeader, printCloned, printSkillList, printInstalling, printSuccess, printCloneError, } from './ui.js';
|
|
9
|
+
/**
|
|
10
|
+
* Runs the full agent-skills installation flow.
|
|
11
|
+
*
|
|
12
|
+
* Steps:
|
|
13
|
+
* 1. Clone the skills repository into a temporary directory.
|
|
14
|
+
* 2. Discover all skills in the `skills/` subdirectory.
|
|
15
|
+
* 3. Detect supported AI agents installed on the machine.
|
|
16
|
+
* 4. Prompt the user to select which agents to install skills into.
|
|
17
|
+
* 5. Install the skills and report results.
|
|
18
|
+
* 6. Clean up the temporary clone.
|
|
19
|
+
*
|
|
20
|
+
* Graceful fallbacks:
|
|
21
|
+
* - Git unavailable or clone fails → print warning and return.
|
|
22
|
+
* - No agents detected → print warning and return.
|
|
23
|
+
* - User selects no agents → return silently.
|
|
24
|
+
* - Individual skill copy fails → reported per-agent, does not abort the run.
|
|
25
|
+
*
|
|
26
|
+
* @param force - When true, overwrite existing skill files.
|
|
27
|
+
*/
|
|
28
|
+
export async function runSkillsFlow(force = false, projectDir = process.cwd()) {
|
|
29
|
+
printSkillsHeader();
|
|
30
|
+
// ── Step 1: Clone ──────────────────────────────────────────────────────────
|
|
31
|
+
let tempDir;
|
|
32
|
+
try {
|
|
33
|
+
tempDir = await cloneSkillsRepo();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
const message = err instanceof SkillsCloneError
|
|
37
|
+
? err.message
|
|
38
|
+
: err instanceof Error
|
|
39
|
+
? err.message
|
|
40
|
+
: String(err);
|
|
41
|
+
printCloneError(message);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
printCloned();
|
|
46
|
+
// ── Step 2: Discover skills ──────────────────────────────────────────────
|
|
47
|
+
const skills = await discoverSkills(tempDir);
|
|
48
|
+
if (skills.length === 0) {
|
|
49
|
+
console.log(chalk.dim(' No skills found in the repository.\n'));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
printSkillList(skills);
|
|
53
|
+
// ── Step 3: Install Project-Level Skills ─────────────────────────────────
|
|
54
|
+
// Installs the skills for all 6 agents by default at project scope
|
|
55
|
+
const results = await installSkills(AGENTS, skills, force, 'project', projectDir);
|
|
56
|
+
printInstalling(results);
|
|
57
|
+
// Read the skills version from the cloned repository's package.json
|
|
58
|
+
let skillsVersion = '1.0.0';
|
|
59
|
+
const skillsPackageJsonPath = path.join(tempDir, 'package.json');
|
|
60
|
+
if (await fs.pathExists(skillsPackageJsonPath)) {
|
|
61
|
+
try {
|
|
62
|
+
const pkgJson = await fs.readJSON(skillsPackageJsonPath);
|
|
63
|
+
if (pkgJson.version) {
|
|
64
|
+
skillsVersion = pkgJson.version;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Ignore read errors
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Write skills version to the project's package.json
|
|
72
|
+
const projectPackageJsonPath = path.join(projectDir, 'package.json');
|
|
73
|
+
if (await fs.pathExists(projectPackageJsonPath)) {
|
|
74
|
+
try {
|
|
75
|
+
const projectPkgJson = await fs.readJSON(projectPackageJsonPath);
|
|
76
|
+
if (!projectPkgJson.nitrostack) {
|
|
77
|
+
projectPkgJson.nitrostack = {};
|
|
78
|
+
}
|
|
79
|
+
projectPkgJson.nitrostack.skillsVersion = skillsVersion;
|
|
80
|
+
await fs.writeJSON(projectPackageJsonPath, projectPkgJson, { spaces: 2 });
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Ignore write errors
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
printSuccess();
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
// ── Cleanup: always remove the temp clone ────────────────────────────────
|
|
90
|
+
try {
|
|
91
|
+
await fs.remove(tempDir);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// best-effort; temp files will be cleaned by the OS
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AgentDescriptor, InstallResult, Skill } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Installs all discovered skills into the skills directory of a single agent.
|
|
4
|
+
*
|
|
5
|
+
* - Creates the target directory if it does not exist.
|
|
6
|
+
* - Skips individual skills whose destination directory already exists,
|
|
7
|
+
* unless `force` is true.
|
|
8
|
+
* - Preserves the full folder structure of each skill.
|
|
9
|
+
*
|
|
10
|
+
* @param agent - The agent to install into.
|
|
11
|
+
* @param skills - All skills discovered from the repository.
|
|
12
|
+
* @param force - When true, overwrite existing skill directories.
|
|
13
|
+
* @returns InstallResult describing what was installed vs skipped.
|
|
14
|
+
*/
|
|
15
|
+
export declare function installSkillsForAgent(agent: AgentDescriptor, skills: Skill[], force: boolean, scope?: 'project' | 'global', projectDir?: string): Promise<InstallResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Installs skills into every selected agent sequentially.
|
|
18
|
+
* Sequential (rather than parallel) installation gives cleaner CLI progress output.
|
|
19
|
+
*/
|
|
20
|
+
export declare function installSkills(agents: AgentDescriptor[], skills: Skill[], force: boolean, scope?: 'project' | 'global', projectDir?: string): Promise<InstallResult[]>;
|
|
21
|
+
//# sourceMappingURL=installer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/skills/installer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,KAAK,EAAE,EACf,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,SAAS,GAAG,QAAmB,EACtC,UAAU,GAAE,MAAsB,GACjC,OAAO,CAAC,aAAa,CAAC,CAwBxB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,eAAe,EAAE,EACzB,MAAM,EAAE,KAAK,EAAE,EACf,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,SAAS,GAAG,QAAmB,EACtC,UAAU,GAAE,MAAsB,GACjC,OAAO,CAAC,aAAa,EAAE,CAAC,CAS1B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
/**
|
|
4
|
+
* Installs all discovered skills into the skills directory of a single agent.
|
|
5
|
+
*
|
|
6
|
+
* - Creates the target directory if it does not exist.
|
|
7
|
+
* - Skips individual skills whose destination directory already exists,
|
|
8
|
+
* unless `force` is true.
|
|
9
|
+
* - Preserves the full folder structure of each skill.
|
|
10
|
+
*
|
|
11
|
+
* @param agent - The agent to install into.
|
|
12
|
+
* @param skills - All skills discovered from the repository.
|
|
13
|
+
* @param force - When true, overwrite existing skill directories.
|
|
14
|
+
* @returns InstallResult describing what was installed vs skipped.
|
|
15
|
+
*/
|
|
16
|
+
export async function installSkillsForAgent(agent, skills, force, scope = 'global', projectDir = process.cwd()) {
|
|
17
|
+
const result = { agent, installed: [], skipped: [] };
|
|
18
|
+
try {
|
|
19
|
+
const skillsDir = agent.getSkillsDir(scope, projectDir);
|
|
20
|
+
await fs.mkdirp(skillsDir);
|
|
21
|
+
for (const skill of skills) {
|
|
22
|
+
const dest = path.join(skillsDir, skill.name);
|
|
23
|
+
const alreadyExists = await fs.pathExists(dest);
|
|
24
|
+
if (alreadyExists && !force) {
|
|
25
|
+
result.skipped.push(skill.name);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
await fs.copy(skill.sourcePath, dest, { overwrite: force });
|
|
29
|
+
result.installed.push(skill.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
result.error = err instanceof Error ? err.message : String(err);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Installs skills into every selected agent sequentially.
|
|
39
|
+
* Sequential (rather than parallel) installation gives cleaner CLI progress output.
|
|
40
|
+
*/
|
|
41
|
+
export async function installSkills(agents, skills, force, scope = 'global', projectDir = process.cwd()) {
|
|
42
|
+
const results = [];
|
|
43
|
+
for (const agent of agents) {
|
|
44
|
+
const result = await installSkillsForAgent(agent, skills, force, scope, projectDir);
|
|
45
|
+
results.push(result);
|
|
46
|
+
}
|
|
47
|
+
return results;
|
|
48
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single skill discovered from the skills repository.
|
|
3
|
+
* Each skill maps to one subdirectory under `skills/` in the cloned repo.
|
|
4
|
+
*/
|
|
5
|
+
export interface Skill {
|
|
6
|
+
/** Directory name — used as the skill identifier and display name */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Absolute path to the skill directory inside the temporary clone */
|
|
9
|
+
sourcePath: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Describes a supported AI coding agent.
|
|
13
|
+
* Add new agents by appending entries to the AGENTS registry in detect-agents.ts.
|
|
14
|
+
*/
|
|
15
|
+
export interface AgentDescriptor {
|
|
16
|
+
/** Machine-readable identifier (kebab-case) */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Human-readable display name shown in the CLI */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Short path hint shown next to the agent name in the selection list */
|
|
21
|
+
displayPath: string;
|
|
22
|
+
/** Returns true when the agent appears to be installed on this machine */
|
|
23
|
+
detect(): Promise<boolean>;
|
|
24
|
+
/** Returns the absolute path of the directory where skills should be installed */
|
|
25
|
+
getSkillsDir(scope?: 'project' | 'global', projectDir?: string): string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Result of installing skills for one agent.
|
|
29
|
+
*/
|
|
30
|
+
export interface InstallResult {
|
|
31
|
+
agent: AgentDescriptor;
|
|
32
|
+
/** Skill names that were successfully copied */
|
|
33
|
+
installed: string[];
|
|
34
|
+
/** Skill names that were skipped because the destination already existed */
|
|
35
|
+
skipped: string[];
|
|
36
|
+
/** Non-fatal error message, if any */
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/skills/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,kFAAkF;IAClF,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzE;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,eAAe,CAAC;IACvB,gDAAgD;IAChD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { InstallResult, Skill } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Prints the skills section header:
|
|
4
|
+
*
|
|
5
|
+
* skills
|
|
6
|
+
*
|
|
7
|
+
* ◇ Source: https://github.com/nitrocloudofficial/skills.git
|
|
8
|
+
* ◇ Repository cloned
|
|
9
|
+
*/
|
|
10
|
+
export declare function printSkillsHeader(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Prints the "Repository cloned" confirmation line.
|
|
13
|
+
* Called after cloneSkillsRepo() succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare function printCloned(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Prints the discovered skill list:
|
|
18
|
+
*
|
|
19
|
+
* ◇ Found 4 skills
|
|
20
|
+
*
|
|
21
|
+
* • nitrostack-sdk
|
|
22
|
+
* • mcp-best-practices
|
|
23
|
+
* …
|
|
24
|
+
*/
|
|
25
|
+
export declare function printSkillList(skills: Skill[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Prints the detected-agent count line:
|
|
28
|
+
*
|
|
29
|
+
* ◇ Detected 3 agents
|
|
30
|
+
*/
|
|
31
|
+
export declare function printDetectedAgents(count: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Prints a warning when no agents are detected so the user knows why the
|
|
34
|
+
* flow is being skipped rather than seeing a silent no-op.
|
|
35
|
+
*/
|
|
36
|
+
export declare function printNoAgentsWarning(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Prints the per-agent installation results:
|
|
39
|
+
*
|
|
40
|
+
* Installing...
|
|
41
|
+
*
|
|
42
|
+
* ✔ Cursor (3 installed)
|
|
43
|
+
* ✔ Claude Code (2 installed, 1 skipped)
|
|
44
|
+
* ⚠ Gemini CLI error: …
|
|
45
|
+
*/
|
|
46
|
+
export declare function printInstalling(results: InstallResult[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Prints the final success message.
|
|
49
|
+
*/
|
|
50
|
+
export declare function printSuccess(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Prints a warning when git is not available or the clone fails.
|
|
53
|
+
*/
|
|
54
|
+
export declare function printCloneError(message: string): void;
|
|
55
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/skills/ui.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAYvD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAQpD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAK3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,CAuB9D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKrD"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { brand } from '../ui/branding.js';
|
|
3
|
+
import { SKILLS_REPO_URL } from './clone.js';
|
|
4
|
+
// ── Private helpers ──────────────────────────────────────────────────────────
|
|
5
|
+
/** Diamond prefix used for info lines — matches Remotion create-video style */
|
|
6
|
+
const diamond = () => chalk.dim('◇');
|
|
7
|
+
/** Bullet used for list items */
|
|
8
|
+
const bullet = () => brand.sky('•');
|
|
9
|
+
// ── Public output functions ──────────────────────────────────────────────────
|
|
10
|
+
/**
|
|
11
|
+
* Prints the skills section header:
|
|
12
|
+
*
|
|
13
|
+
* skills
|
|
14
|
+
*
|
|
15
|
+
* ◇ Source: https://github.com/nitrocloudofficial/skills.git
|
|
16
|
+
* ◇ Repository cloned
|
|
17
|
+
*/
|
|
18
|
+
export function printSkillsHeader() {
|
|
19
|
+
console.log('\n' + chalk.white.bold(' skills') + '\n');
|
|
20
|
+
console.log(` ${diamond()} ${chalk.dim('Source:')} ${brand.sky(SKILLS_REPO_URL)}`);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Prints the "Repository cloned" confirmation line.
|
|
24
|
+
* Called after cloneSkillsRepo() succeeds.
|
|
25
|
+
*/
|
|
26
|
+
export function printCloned() {
|
|
27
|
+
console.log(` ${diamond()} ${chalk.dim('Repository cloned')}\n`);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Prints the discovered skill list:
|
|
31
|
+
*
|
|
32
|
+
* ◇ Found 4 skills
|
|
33
|
+
*
|
|
34
|
+
* • nitrostack-sdk
|
|
35
|
+
* • mcp-best-practices
|
|
36
|
+
* …
|
|
37
|
+
*/
|
|
38
|
+
export function printSkillList(skills) {
|
|
39
|
+
console.log(` ${diamond()} ${chalk.white(`Found ${skills.length} skill${skills.length === 1 ? '' : 's'}`)}\n`);
|
|
40
|
+
for (const skill of skills) {
|
|
41
|
+
console.log(` ${bullet()} ${chalk.white(skill.name)}`);
|
|
42
|
+
}
|
|
43
|
+
console.log('');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Prints the detected-agent count line:
|
|
47
|
+
*
|
|
48
|
+
* ◇ Detected 3 agents
|
|
49
|
+
*/
|
|
50
|
+
export function printDetectedAgents(count) {
|
|
51
|
+
console.log(` ${diamond()} ${chalk.white(`Detected ${count} agent${count === 1 ? '' : 's'}`)}\n`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Prints a warning when no agents are detected so the user knows why the
|
|
55
|
+
* flow is being skipped rather than seeing a silent no-op.
|
|
56
|
+
*/
|
|
57
|
+
export function printNoAgentsWarning() {
|
|
58
|
+
console.log(` ${chalk.hex('#F59E0B')('⚠')} ${chalk.dim('No supported AI agents detected on this machine.')}\n` +
|
|
59
|
+
` ${chalk.dim('Install Cursor, Claude Code, Gemini CLI, or Codex and re-run to add skills.')}\n`);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Prints the per-agent installation results:
|
|
63
|
+
*
|
|
64
|
+
* Installing...
|
|
65
|
+
*
|
|
66
|
+
* ✔ Cursor (3 installed)
|
|
67
|
+
* ✔ Claude Code (2 installed, 1 skipped)
|
|
68
|
+
* ⚠ Gemini CLI error: …
|
|
69
|
+
*/
|
|
70
|
+
export function printInstalling(results) {
|
|
71
|
+
console.log(`\n ${chalk.white.bold('Installing...')}\n`);
|
|
72
|
+
for (const result of results) {
|
|
73
|
+
if (result.error) {
|
|
74
|
+
const label = chalk.hex('#F59E0B')('⚠');
|
|
75
|
+
console.log(` ${label} ${chalk.white(result.agent.name)} ${chalk.dim('error: ' + result.error)}`);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const label = brand.mint('✔');
|
|
79
|
+
const parts = [];
|
|
80
|
+
if (result.installed.length > 0) {
|
|
81
|
+
parts.push(`${result.installed.length} installed`);
|
|
82
|
+
}
|
|
83
|
+
if (result.skipped.length > 0) {
|
|
84
|
+
parts.push(`${result.skipped.length} skipped`);
|
|
85
|
+
}
|
|
86
|
+
const detail = parts.length > 0 ? chalk.dim(` (${parts.join(', ')})`) : '';
|
|
87
|
+
console.log(` ${label} ${chalk.white(result.agent.name)}${detail}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Prints the final success message.
|
|
92
|
+
*/
|
|
93
|
+
export function printSuccess() {
|
|
94
|
+
console.log('\n ' + chalk.white('✨ NitroStack agent skills installed successfully.') + '\n');
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Prints a warning when git is not available or the clone fails.
|
|
98
|
+
*/
|
|
99
|
+
export function printCloneError(message) {
|
|
100
|
+
console.log(`\n ${chalk.hex('#F59E0B')('⚠')} ${chalk.dim('Agent skills skipped:')}\n` +
|
|
101
|
+
` ${chalk.dim(message)}\n`);
|
|
102
|
+
}
|