nexscope 1.0.2 → 1.0.4
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/package.json +1 -1
- package/src/commands/install.js +12 -19
package/package.json
CHANGED
package/src/commands/install.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
|
-
const https = require('https');
|
|
5
4
|
const { Listr } = require('listr2');
|
|
6
5
|
|
|
7
6
|
const SKILLS_REPO = 'nexscope-ai/eCommerce-Skills';
|
|
8
|
-
const REPO_API = 'https://api.github.com/repos/nexscope-ai/eCommerce-Skills/contents';
|
|
9
7
|
|
|
10
8
|
function printHelp() {
|
|
11
9
|
console.log(`
|
|
@@ -30,22 +28,17 @@ Examples:
|
|
|
30
28
|
`);
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
function get(url) {
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
https.get(url, { headers: { 'User-Agent': 'nexscope-cli' } }, (res) => {
|
|
36
|
-
let data = '';
|
|
37
|
-
res.on('data', (chunk) => (data += chunk));
|
|
38
|
-
res.on('end', () => {
|
|
39
|
-
if (res.statusCode === 200) resolve(data);
|
|
40
|
-
else reject(new Error(`HTTP ${res.statusCode}: ${url}`));
|
|
41
|
-
});
|
|
42
|
-
}).on('error', reject);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
31
|
async function fetchSkillList() {
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
// --full-depth discovers nested skills inside subdirectories
|
|
33
|
+
const output = await spawnAsync('npx', ['skills', 'add', SKILLS_REPO, '--list', '--full-depth']);
|
|
34
|
+
// Strip ANSI escape codes and extract skill names from lines like "│ <skill-name>"
|
|
35
|
+
const clean = output.replace(/\x1B\[[0-9;?]*[a-zA-Z]/g, '');
|
|
36
|
+
const skills = [];
|
|
37
|
+
for (const line of clean.split('\n')) {
|
|
38
|
+
const match = line.match(/[│|]\s{4}([a-z][a-z0-9-]+)\s*$/);
|
|
39
|
+
if (match) skills.push(match[1]);
|
|
40
|
+
}
|
|
41
|
+
return skills;
|
|
49
42
|
}
|
|
50
43
|
|
|
51
44
|
function parseDirFlags(args) {
|
|
@@ -120,7 +113,7 @@ async function run(args) {
|
|
|
120
113
|
const tasks = new Listr([{
|
|
121
114
|
title: skillName,
|
|
122
115
|
skip: () => installed.includes(skillName) ? 'Already installed' : false,
|
|
123
|
-
task: () => runSkillsSilent(['add', SKILLS_REPO, '--skill', skillName, '-y', ...dirFlags]),
|
|
116
|
+
task: () => runSkillsSilent(['add', SKILLS_REPO, '--skill', skillName, '-y', '--full-depth', ...dirFlags]),
|
|
124
117
|
}], { exitOnError: false });
|
|
125
118
|
|
|
126
119
|
try {
|
|
@@ -142,7 +135,7 @@ async function run(args) {
|
|
|
142
135
|
skills.map((skillName) => ({
|
|
143
136
|
title: skillName,
|
|
144
137
|
skip: () => installed.includes(skillName) ? 'Already installed' : false,
|
|
145
|
-
task: () => spawnAsync('npx', ['skills', 'add', SKILLS_REPO, '--skill', skillName, '-y', ...dirFlags]),
|
|
138
|
+
task: () => spawnAsync('npx', ['skills', 'add', SKILLS_REPO, '--skill', skillName, '-y', '--full-depth', ...dirFlags]),
|
|
146
139
|
})),
|
|
147
140
|
{
|
|
148
141
|
concurrent: true,
|