reskill 0.13.1 → 0.15.0
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/README.md +39 -31
- package/README.zh-CN.md +39 -31
- package/dist/cli/index.js +207 -134
- package/dist/core/git-resolver.d.ts +1 -0
- package/dist/core/git-resolver.d.ts.map +1 -1
- package/dist/core/lock-manager.d.ts +1 -0
- package/dist/core/lock-manager.d.ts.map +1 -1
- package/dist/core/skill-manager.d.ts.map +1 -1
- package/dist/index.js +74 -39
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/git.d.ts +3 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/update-notifier.d.ts +49 -0
- package/dist/utils/update-notifier.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url__ from "node:url";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_commander__ from "commander";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_chalk__ from "chalk";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_semver__ from "semver";
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os__ from "node:os";
|
|
8
9
|
import * as __WEBPACK_EXTERNAL_MODULE_node_child_process__ from "node:child_process";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE_node_util__ from "node:util";
|
|
10
|
-
import * as __WEBPACK_EXTERNAL_MODULE_semver__ from "semver";
|
|
11
11
|
import * as __WEBPACK_EXTERNAL_MODULE__clack_prompts__ from "@clack/prompts";
|
|
12
12
|
import * as __WEBPACK_EXTERNAL_MODULE_ora__ from "ora";
|
|
13
13
|
var __webpack_modules__ = {
|
|
@@ -26,6 +26,81 @@ function __webpack_require__(moduleId) {
|
|
|
26
26
|
return module.exports;
|
|
27
27
|
}
|
|
28
28
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
29
|
+
const logger_logger = {
|
|
30
|
+
info (message) {
|
|
31
|
+
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].blue('ℹ'), message);
|
|
32
|
+
},
|
|
33
|
+
success (message) {
|
|
34
|
+
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('✅'), message);
|
|
35
|
+
},
|
|
36
|
+
warn (message) {
|
|
37
|
+
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('⚠️'), message);
|
|
38
|
+
},
|
|
39
|
+
error (message) {
|
|
40
|
+
console.error(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].red('❌'), message);
|
|
41
|
+
},
|
|
42
|
+
debug (message) {
|
|
43
|
+
if (process.env.DEBUG || process.env.VERBOSE) console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].gray('🔍'), __WEBPACK_EXTERNAL_MODULE_chalk__["default"].gray(message));
|
|
44
|
+
},
|
|
45
|
+
package (message) {
|
|
46
|
+
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan('📦'), message);
|
|
47
|
+
},
|
|
48
|
+
log (message) {
|
|
49
|
+
console.log(message);
|
|
50
|
+
},
|
|
51
|
+
newline () {
|
|
52
|
+
console.log();
|
|
53
|
+
},
|
|
54
|
+
table (headers, rows) {
|
|
55
|
+
const widths = headers.map((h, i)=>{
|
|
56
|
+
const colValues = [
|
|
57
|
+
h,
|
|
58
|
+
...rows.map((r)=>r[i] || '')
|
|
59
|
+
];
|
|
60
|
+
return Math.max(...colValues.map((v)=>v.length));
|
|
61
|
+
});
|
|
62
|
+
const headerRow = headers.map((h, i)=>h.padEnd(widths[i])).join(' ');
|
|
63
|
+
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].bold(headerRow));
|
|
64
|
+
for (const row of rows){
|
|
65
|
+
const rowStr = row.map((cell, i)=>(cell || '').padEnd(widths[i])).join(' ');
|
|
66
|
+
console.log(rowStr);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
async function checkForUpdate(packageName, currentVersion, options = {}) {
|
|
71
|
+
const timeout = options.timeout ?? 3000;
|
|
72
|
+
try {
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const timeoutId = setTimeout(()=>controller.abort(), timeout);
|
|
75
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}`, {
|
|
76
|
+
signal: controller.signal
|
|
77
|
+
});
|
|
78
|
+
clearTimeout(timeoutId);
|
|
79
|
+
if (!response.ok) return null;
|
|
80
|
+
const data = await response.json();
|
|
81
|
+
const latest = data['dist-tags']?.latest;
|
|
82
|
+
if (!latest) return null;
|
|
83
|
+
const hasUpdate = __WEBPACK_EXTERNAL_MODULE_semver__["default"].gt(latest, currentVersion);
|
|
84
|
+
return {
|
|
85
|
+
current: currentVersion,
|
|
86
|
+
latest,
|
|
87
|
+
hasUpdate
|
|
88
|
+
};
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function formatUpdateMessage(result) {
|
|
94
|
+
if (!result.hasUpdate) return '';
|
|
95
|
+
return `
|
|
96
|
+
┌────────────────────────────────────────────────────┐
|
|
97
|
+
│ │
|
|
98
|
+
│ Update available: ${result.current} → ${result.latest.padEnd(10)} │
|
|
99
|
+
│ Run: npm install -g reskill@latest │
|
|
100
|
+
│ │
|
|
101
|
+
└────────────────────────────────────────────────────┘
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
29
104
|
function exists(filePath) {
|
|
30
105
|
return external_node_fs_.existsSync(filePath);
|
|
31
106
|
}
|
|
@@ -112,47 +187,6 @@ function shortenPath(fullPath, cwd) {
|
|
|
112
187
|
if (fullPath.startsWith(currentDir)) return `.${fullPath.slice(currentDir.length)}`;
|
|
113
188
|
return fullPath;
|
|
114
189
|
}
|
|
115
|
-
const logger = {
|
|
116
|
-
info (message) {
|
|
117
|
-
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].blue('ℹ'), message);
|
|
118
|
-
},
|
|
119
|
-
success (message) {
|
|
120
|
-
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('✅'), message);
|
|
121
|
-
},
|
|
122
|
-
warn (message) {
|
|
123
|
-
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('⚠️'), message);
|
|
124
|
-
},
|
|
125
|
-
error (message) {
|
|
126
|
-
console.error(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].red('❌'), message);
|
|
127
|
-
},
|
|
128
|
-
debug (message) {
|
|
129
|
-
if (process.env.DEBUG || process.env.VERBOSE) console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].gray('🔍'), __WEBPACK_EXTERNAL_MODULE_chalk__["default"].gray(message));
|
|
130
|
-
},
|
|
131
|
-
package (message) {
|
|
132
|
-
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan('📦'), message);
|
|
133
|
-
},
|
|
134
|
-
log (message) {
|
|
135
|
-
console.log(message);
|
|
136
|
-
},
|
|
137
|
-
newline () {
|
|
138
|
-
console.log();
|
|
139
|
-
},
|
|
140
|
-
table (headers, rows) {
|
|
141
|
-
const widths = headers.map((h, i)=>{
|
|
142
|
-
const colValues = [
|
|
143
|
-
h,
|
|
144
|
-
...rows.map((r)=>r[i] || '')
|
|
145
|
-
];
|
|
146
|
-
return Math.max(...colValues.map((v)=>v.length));
|
|
147
|
-
});
|
|
148
|
-
const headerRow = headers.map((h, i)=>h.padEnd(widths[i])).join(' ');
|
|
149
|
-
console.log(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].bold(headerRow));
|
|
150
|
-
for (const row of rows){
|
|
151
|
-
const rowStr = row.map((cell, i)=>(cell || '').padEnd(widths[i])).join(' ');
|
|
152
|
-
console.log(rowStr);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
190
|
const agent_registry_home = (0, __WEBPACK_EXTERNAL_MODULE_node_os__.homedir)();
|
|
157
191
|
const agents = {
|
|
158
192
|
amp: {
|
|
@@ -736,6 +770,22 @@ class GitResolver {
|
|
|
736
770
|
let gitUrl = ref;
|
|
737
771
|
let version;
|
|
738
772
|
let subPath;
|
|
773
|
+
const webUrlMatch = ref.match(/^(https?:\/\/[^/]+)\/([^/]+)\/([^/]+)\/(tree|blob|raw)\/([^/]+)(?:\/(.+))?$/);
|
|
774
|
+
if (webUrlMatch) {
|
|
775
|
+
const [, baseUrl, owner, repo, , branch, path] = webUrlMatch;
|
|
776
|
+
gitUrl = `${baseUrl}/${owner}/${repo}.git`;
|
|
777
|
+
version = `branch:${branch}`;
|
|
778
|
+
subPath = path;
|
|
779
|
+
return {
|
|
780
|
+
registry: new URL(baseUrl).hostname,
|
|
781
|
+
owner,
|
|
782
|
+
repo,
|
|
783
|
+
subPath,
|
|
784
|
+
version,
|
|
785
|
+
raw,
|
|
786
|
+
gitUrl
|
|
787
|
+
};
|
|
788
|
+
}
|
|
739
789
|
const gitSuffixIndex = ref.indexOf('.git');
|
|
740
790
|
if (-1 !== gitSuffixIndex) {
|
|
741
791
|
const afterGit = ref.slice(gitSuffixIndex + 4);
|
|
@@ -1125,6 +1175,7 @@ class LockManager {
|
|
|
1125
1175
|
const lockedSkill = {
|
|
1126
1176
|
source: options.source,
|
|
1127
1177
|
version: options.version,
|
|
1178
|
+
ref: options.ref,
|
|
1128
1179
|
resolved: options.resolved,
|
|
1129
1180
|
commit: options.commit,
|
|
1130
1181
|
installedAt: new Date().toISOString()
|
|
@@ -1204,35 +1255,43 @@ class SkillManager {
|
|
|
1204
1255
|
const { force = false, save = true } = options;
|
|
1205
1256
|
const resolved = await this.resolver.resolve(ref);
|
|
1206
1257
|
const { parsed, repoUrl } = resolved;
|
|
1207
|
-
const
|
|
1258
|
+
const gitRef = resolved.ref;
|
|
1208
1259
|
const skillName = parsed.subPath ? __WEBPACK_EXTERNAL_MODULE_node_path__.basename(parsed.subPath) : parsed.repo;
|
|
1209
1260
|
const skillPath = this.getSkillPath(skillName);
|
|
1210
1261
|
if (exists(skillPath) && !force) {
|
|
1211
1262
|
const locked = this.lockManager.get(skillName);
|
|
1212
|
-
|
|
1213
|
-
|
|
1263
|
+
const lockedRef = locked?.ref || locked?.version;
|
|
1264
|
+
if (locked && lockedRef === gitRef) {
|
|
1265
|
+
logger_logger.info(`${skillName}@${gitRef} is already installed`);
|
|
1214
1266
|
const installed = this.getInstalledSkill(skillName);
|
|
1215
1267
|
if (installed) return installed;
|
|
1216
1268
|
}
|
|
1217
1269
|
if (!force) {
|
|
1218
|
-
|
|
1270
|
+
logger_logger.warn(`${skillName} is already installed. Use --force to reinstall.`);
|
|
1219
1271
|
const installed = this.getInstalledSkill(skillName);
|
|
1220
1272
|
if (installed) return installed;
|
|
1221
1273
|
}
|
|
1222
1274
|
}
|
|
1223
|
-
|
|
1224
|
-
let cacheResult = await this.cache.get(parsed,
|
|
1225
|
-
if (cacheResult)
|
|
1275
|
+
logger_logger["package"](`Installing ${skillName}@${gitRef}...`);
|
|
1276
|
+
let cacheResult = await this.cache.get(parsed, gitRef);
|
|
1277
|
+
if (cacheResult) logger_logger.debug(`Using cached ${skillName}@${gitRef}`);
|
|
1226
1278
|
else {
|
|
1227
|
-
|
|
1228
|
-
cacheResult = await this.cache.cache(repoUrl, parsed,
|
|
1279
|
+
logger_logger.debug(`Caching ${skillName}@${gitRef} from ${repoUrl}`);
|
|
1280
|
+
cacheResult = await this.cache.cache(repoUrl, parsed, gitRef, gitRef);
|
|
1229
1281
|
}
|
|
1230
1282
|
ensureDir(this.getInstallDir());
|
|
1231
1283
|
if (exists(skillPath)) remove(skillPath);
|
|
1232
|
-
await this.cache.copyTo(parsed,
|
|
1284
|
+
await this.cache.copyTo(parsed, gitRef, skillPath);
|
|
1285
|
+
let semanticVersion = gitRef;
|
|
1286
|
+
const skillJsonPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(skillPath, 'skill.json');
|
|
1287
|
+
if (exists(skillJsonPath)) try {
|
|
1288
|
+
const skillJson = readJson(skillJsonPath);
|
|
1289
|
+
if (skillJson.version) semanticVersion = skillJson.version;
|
|
1290
|
+
} catch {}
|
|
1233
1291
|
if (!this.isGlobal) this.lockManager.lockSkill(skillName, {
|
|
1234
1292
|
source: `${parsed.registry}:${parsed.owner}/${parsed.repo}${parsed.subPath ? `/${parsed.subPath}` : ''}`,
|
|
1235
|
-
version,
|
|
1293
|
+
version: semanticVersion,
|
|
1294
|
+
ref: gitRef,
|
|
1236
1295
|
resolved: repoUrl,
|
|
1237
1296
|
commit: cacheResult.commit
|
|
1238
1297
|
});
|
|
@@ -1240,8 +1299,9 @@ class SkillManager {
|
|
|
1240
1299
|
this.config.ensureExists();
|
|
1241
1300
|
this.config.addSkill(skillName, ref);
|
|
1242
1301
|
}
|
|
1302
|
+
const displayVersion = semanticVersion !== gitRef ? `${semanticVersion} (${gitRef})` : gitRef;
|
|
1243
1303
|
const locationHint = this.isGlobal ? '(global)' : '';
|
|
1244
|
-
|
|
1304
|
+
logger_logger.success(`Installed ${skillName}@${displayVersion} to ${skillPath} ${locationHint}`.trim());
|
|
1245
1305
|
const installed = this.getInstalledSkill(skillName);
|
|
1246
1306
|
if (!installed) throw new Error(`Failed to get installed skill info for ${skillName}`);
|
|
1247
1307
|
return installed;
|
|
@@ -1256,7 +1316,7 @@ class SkillManager {
|
|
|
1256
1316
|
});
|
|
1257
1317
|
installed.push(skill);
|
|
1258
1318
|
} catch (error) {
|
|
1259
|
-
|
|
1319
|
+
logger_logger.error(`Failed to install ${name}: ${error.message}`);
|
|
1260
1320
|
}
|
|
1261
1321
|
return installed;
|
|
1262
1322
|
}
|
|
@@ -1264,14 +1324,14 @@ class SkillManager {
|
|
|
1264
1324
|
const skillPath = this.getSkillPath(name);
|
|
1265
1325
|
if (!exists(skillPath)) {
|
|
1266
1326
|
const location = this.isGlobal ? '(global)' : '';
|
|
1267
|
-
|
|
1327
|
+
logger_logger.warn(`Skill ${name} is not installed ${location}`.trim());
|
|
1268
1328
|
return false;
|
|
1269
1329
|
}
|
|
1270
1330
|
remove(skillPath);
|
|
1271
1331
|
if (!this.isGlobal) this.lockManager.remove(name);
|
|
1272
1332
|
if (!this.isGlobal && this.config.exists()) this.config.removeSkill(name);
|
|
1273
1333
|
const locationHint = this.isGlobal ? '(global)' : '';
|
|
1274
|
-
|
|
1334
|
+
logger_logger.success(`Uninstalled ${name} ${locationHint}`.trim());
|
|
1275
1335
|
return true;
|
|
1276
1336
|
}
|
|
1277
1337
|
async update(name) {
|
|
@@ -1279,7 +1339,7 @@ class SkillManager {
|
|
|
1279
1339
|
if (name) {
|
|
1280
1340
|
const ref = this.config.getSkillRef(name);
|
|
1281
1341
|
if (!ref) {
|
|
1282
|
-
|
|
1342
|
+
logger_logger.error(`Skill ${name} not found in skills.json`);
|
|
1283
1343
|
return [];
|
|
1284
1344
|
}
|
|
1285
1345
|
const skill = await this.install(ref, {
|
|
@@ -1296,7 +1356,7 @@ class SkillManager {
|
|
|
1296
1356
|
});
|
|
1297
1357
|
updated.push(skill);
|
|
1298
1358
|
} catch (error) {
|
|
1299
|
-
|
|
1359
|
+
logger_logger.error(`Failed to update ${skillName}: ${error.message}`);
|
|
1300
1360
|
}
|
|
1301
1361
|
}
|
|
1302
1362
|
return updated;
|
|
@@ -1313,7 +1373,7 @@ class SkillManager {
|
|
|
1313
1373
|
const linkPath = this.getSkillPath(skillName);
|
|
1314
1374
|
ensureDir(__WEBPACK_EXTERNAL_MODULE_node_path__.dirname(linkPath));
|
|
1315
1375
|
createSymlink(absolutePath, linkPath);
|
|
1316
|
-
|
|
1376
|
+
logger_logger.success(`Linked ${skillName} → ${absolutePath}`);
|
|
1317
1377
|
return {
|
|
1318
1378
|
name: skillName,
|
|
1319
1379
|
path: linkPath,
|
|
@@ -1325,15 +1385,15 @@ class SkillManager {
|
|
|
1325
1385
|
unlink(name) {
|
|
1326
1386
|
const skillPath = this.getSkillPath(name);
|
|
1327
1387
|
if (!exists(skillPath)) {
|
|
1328
|
-
|
|
1388
|
+
logger_logger.warn(`Skill ${name} is not installed`);
|
|
1329
1389
|
return false;
|
|
1330
1390
|
}
|
|
1331
1391
|
if (!isSymlink(skillPath)) {
|
|
1332
|
-
|
|
1392
|
+
logger_logger.warn(`Skill ${name} is not a linked skill`);
|
|
1333
1393
|
return false;
|
|
1334
1394
|
}
|
|
1335
1395
|
remove(skillPath);
|
|
1336
|
-
|
|
1396
|
+
logger_logger.success(`Unlinked ${name}`);
|
|
1337
1397
|
return true;
|
|
1338
1398
|
}
|
|
1339
1399
|
list() {
|
|
@@ -1403,7 +1463,8 @@ class SkillManager {
|
|
|
1403
1463
|
const skills = this.config.getSkills();
|
|
1404
1464
|
for (const [name, ref] of Object.entries(skills))try {
|
|
1405
1465
|
const locked = this.lockManager.get(name);
|
|
1406
|
-
const
|
|
1466
|
+
const currentRef = locked?.ref || locked?.version || 'unknown';
|
|
1467
|
+
const currentVersion = locked?.version || 'unknown';
|
|
1407
1468
|
const parsed = this.resolver.parseRef(ref);
|
|
1408
1469
|
const repoUrl = this.resolver.buildRepoUrl(parsed);
|
|
1409
1470
|
const latestResolved = await this.resolver.resolveVersion(repoUrl, {
|
|
@@ -1412,15 +1473,15 @@ class SkillManager {
|
|
|
1412
1473
|
raw: 'latest'
|
|
1413
1474
|
});
|
|
1414
1475
|
const latest = latestResolved.ref;
|
|
1415
|
-
const updateAvailable =
|
|
1476
|
+
const updateAvailable = currentRef !== latest && 'unknown' !== currentRef;
|
|
1416
1477
|
results.push({
|
|
1417
1478
|
name,
|
|
1418
|
-
current,
|
|
1479
|
+
current: currentVersion !== currentRef ? `${currentVersion} (${currentRef})` : currentRef,
|
|
1419
1480
|
latest,
|
|
1420
1481
|
updateAvailable
|
|
1421
1482
|
});
|
|
1422
1483
|
} catch (error) {
|
|
1423
|
-
|
|
1484
|
+
logger_logger.debug(`Failed to check ${name}: ${error.message}`);
|
|
1424
1485
|
results.push({
|
|
1425
1486
|
name,
|
|
1426
1487
|
current: 'unknown',
|
|
@@ -1434,16 +1495,22 @@ class SkillManager {
|
|
|
1434
1495
|
const { save = true, mode = 'symlink' } = options;
|
|
1435
1496
|
const resolved = await this.resolver.resolve(ref);
|
|
1436
1497
|
const { parsed, repoUrl } = resolved;
|
|
1437
|
-
const
|
|
1498
|
+
const gitRef = resolved.ref;
|
|
1438
1499
|
const skillName = parsed.subPath ? __WEBPACK_EXTERNAL_MODULE_node_path__.basename(parsed.subPath) : parsed.repo;
|
|
1439
|
-
|
|
1440
|
-
let cacheResult = await this.cache.get(parsed,
|
|
1441
|
-
if (cacheResult)
|
|
1500
|
+
logger_logger["package"](`Installing ${skillName}@${gitRef} to ${targetAgents.length} agent(s)...`);
|
|
1501
|
+
let cacheResult = await this.cache.get(parsed, gitRef);
|
|
1502
|
+
if (cacheResult) logger_logger.debug(`Using cached ${skillName}@${gitRef}`);
|
|
1442
1503
|
else {
|
|
1443
|
-
|
|
1444
|
-
cacheResult = await this.cache.cache(repoUrl, parsed,
|
|
1504
|
+
logger_logger.debug(`Caching ${skillName}@${gitRef} from ${repoUrl}`);
|
|
1505
|
+
cacheResult = await this.cache.cache(repoUrl, parsed, gitRef, gitRef);
|
|
1445
1506
|
}
|
|
1446
|
-
const sourcePath = this.cache.getCachePath(parsed,
|
|
1507
|
+
const sourcePath = this.cache.getCachePath(parsed, gitRef);
|
|
1508
|
+
let semanticVersion = gitRef;
|
|
1509
|
+
const skillJsonPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(sourcePath, 'skill.json');
|
|
1510
|
+
if (exists(skillJsonPath)) try {
|
|
1511
|
+
const skillJson = readJson(skillJsonPath);
|
|
1512
|
+
if (skillJson.version) semanticVersion = skillJson.version;
|
|
1513
|
+
} catch {}
|
|
1447
1514
|
const installer = new Installer({
|
|
1448
1515
|
cwd: this.projectRoot,
|
|
1449
1516
|
global: this.isGlobal
|
|
@@ -1453,7 +1520,8 @@ class SkillManager {
|
|
|
1453
1520
|
});
|
|
1454
1521
|
if (!this.isGlobal) this.lockManager.lockSkill(skillName, {
|
|
1455
1522
|
source: `${parsed.registry}:${parsed.owner}/${parsed.repo}${parsed.subPath ? `/${parsed.subPath}` : ''}`,
|
|
1456
|
-
version,
|
|
1523
|
+
version: semanticVersion,
|
|
1524
|
+
ref: gitRef,
|
|
1457
1525
|
resolved: repoUrl,
|
|
1458
1526
|
commit: cacheResult.commit
|
|
1459
1527
|
});
|
|
@@ -1463,12 +1531,13 @@ class SkillManager {
|
|
|
1463
1531
|
}
|
|
1464
1532
|
const successCount = Array.from(results.values()).filter((r)=>r.success).length;
|
|
1465
1533
|
const failCount = results.size - successCount;
|
|
1466
|
-
|
|
1467
|
-
|
|
1534
|
+
const displayVersion = semanticVersion !== gitRef ? `${semanticVersion} (${gitRef})` : gitRef;
|
|
1535
|
+
if (0 === failCount) logger_logger.success(`Installed ${skillName}@${displayVersion} to ${successCount} agent(s)`);
|
|
1536
|
+
else logger_logger.warn(`Installed ${skillName}@${displayVersion} to ${successCount} agent(s), ${failCount} failed`);
|
|
1468
1537
|
const skill = {
|
|
1469
1538
|
name: skillName,
|
|
1470
1539
|
path: sourcePath,
|
|
1471
|
-
version,
|
|
1540
|
+
version: semanticVersion,
|
|
1472
1541
|
source: `${parsed.registry}:${parsed.owner}/${parsed.repo}${parsed.subPath ? `/${parsed.subPath}` : ''}`
|
|
1473
1542
|
};
|
|
1474
1543
|
return {
|
|
@@ -1508,7 +1577,7 @@ class SkillManager {
|
|
|
1508
1577
|
if (!this.isGlobal) this.lockManager.remove(name);
|
|
1509
1578
|
if (!this.isGlobal && this.config.exists()) this.config.removeSkill(name);
|
|
1510
1579
|
const successCount = Array.from(results.values()).filter((r)=>r).length;
|
|
1511
|
-
|
|
1580
|
+
logger_logger.success(`Uninstalled ${name} from ${successCount} agent(s)`);
|
|
1512
1581
|
return results;
|
|
1513
1582
|
}
|
|
1514
1583
|
}
|
|
@@ -1520,41 +1589,41 @@ const infoCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('info').de
|
|
|
1520
1589
|
return;
|
|
1521
1590
|
}
|
|
1522
1591
|
if (!info.installed && !info.config) {
|
|
1523
|
-
|
|
1592
|
+
logger_logger.error(`Skill ${skillName} not found`);
|
|
1524
1593
|
process.exit(1);
|
|
1525
1594
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1595
|
+
logger_logger.log(`Skill: ${skillName}`);
|
|
1596
|
+
logger_logger.newline();
|
|
1528
1597
|
if (info.config) {
|
|
1529
|
-
|
|
1530
|
-
|
|
1598
|
+
logger_logger.log("Configuration (skills.json):");
|
|
1599
|
+
logger_logger.log(` Reference: ${info.config}`);
|
|
1531
1600
|
}
|
|
1532
1601
|
if (info.locked) {
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1602
|
+
logger_logger.log("Locked Version (skills.lock):");
|
|
1603
|
+
logger_logger.log(` Version: ${info.locked.version}`);
|
|
1604
|
+
logger_logger.log(` Source: ${info.locked.source}`);
|
|
1605
|
+
logger_logger.log(` Commit: ${info.locked.commit}`);
|
|
1606
|
+
logger_logger.log(` Installed: ${info.locked.installedAt}`);
|
|
1538
1607
|
}
|
|
1539
1608
|
if (info.installed) {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1609
|
+
logger_logger.log("Installed:");
|
|
1610
|
+
logger_logger.log(` Path: ${info.installed.path}`);
|
|
1611
|
+
logger_logger.log(` Version: ${info.installed.version}`);
|
|
1612
|
+
logger_logger.log(` Linked: ${info.installed.isLinked ? 'Yes' : 'No'}`);
|
|
1544
1613
|
if (info.installed.metadata) {
|
|
1545
1614
|
const meta = info.installed.metadata;
|
|
1546
|
-
|
|
1547
|
-
if (meta.description)
|
|
1548
|
-
if (meta.author)
|
|
1549
|
-
if (meta.license)
|
|
1550
|
-
if (meta.keywords?.length)
|
|
1615
|
+
logger_logger.log("Metadata (skill.json):");
|
|
1616
|
+
if (meta.description) logger_logger.log(` Description: ${meta.description}`);
|
|
1617
|
+
if (meta.author) logger_logger.log(` Author: ${meta.author}`);
|
|
1618
|
+
if (meta.license) logger_logger.log(` License: ${meta.license}`);
|
|
1619
|
+
if (meta.keywords?.length) logger_logger.log(` Keywords: ${meta.keywords.join(', ')}`);
|
|
1551
1620
|
}
|
|
1552
|
-
} else
|
|
1621
|
+
} else logger_logger.warn(`Skill ${skillName} is not installed`);
|
|
1553
1622
|
});
|
|
1554
1623
|
const initCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('init').description('Initialize a new skills.json configuration').option('-n, --name <name>', 'Project name').option('-r, --registry <registry>', 'Default registry', 'github').option('-d, --install-dir <dir>', 'Skills installation directory', '.skills').option('-y, --yes', 'Skip prompts and use defaults').action(async (options)=>{
|
|
1555
1624
|
const configLoader = new ConfigLoader();
|
|
1556
1625
|
if (configLoader.exists()) {
|
|
1557
|
-
|
|
1626
|
+
logger_logger.warn('skills.json already exists');
|
|
1558
1627
|
return;
|
|
1559
1628
|
}
|
|
1560
1629
|
const config = configLoader.create({
|
|
@@ -1564,16 +1633,16 @@ const initCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('init').de
|
|
|
1564
1633
|
installDir: options.installDir
|
|
1565
1634
|
}
|
|
1566
1635
|
});
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1636
|
+
logger_logger.success('Created skills.json');
|
|
1637
|
+
logger_logger.newline();
|
|
1638
|
+
logger_logger.log('Configuration:');
|
|
1639
|
+
logger_logger.log(` Name: ${config.name || '(not set)'}`);
|
|
1640
|
+
logger_logger.log(` Default registry: ${config.defaults?.registry}`);
|
|
1641
|
+
logger_logger.log(` Install directory: ${config.defaults?.installDir}`);
|
|
1642
|
+
logger_logger.newline();
|
|
1643
|
+
logger_logger.log('Next steps:');
|
|
1644
|
+
logger_logger.log(' reskill install <skill> Install a skill');
|
|
1645
|
+
logger_logger.log(' reskill list List installed skills');
|
|
1577
1646
|
});
|
|
1578
1647
|
function formatAgentNames(agentTypes, maxShow = 5) {
|
|
1579
1648
|
const names = agentTypes.map((a)=>agents[a].displayName);
|
|
@@ -1826,9 +1895,9 @@ const linkCmd = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('link').descri
|
|
|
1826
1895
|
const skillManager = new SkillManager();
|
|
1827
1896
|
try {
|
|
1828
1897
|
const linked = skillManager.link(localPath, options.name);
|
|
1829
|
-
|
|
1898
|
+
logger_logger.log(`Linked skill available at: ${linked.path}`);
|
|
1830
1899
|
} catch (error) {
|
|
1831
|
-
|
|
1900
|
+
logger_logger.error(error.message);
|
|
1832
1901
|
process.exit(1);
|
|
1833
1902
|
}
|
|
1834
1903
|
});
|
|
@@ -1847,7 +1916,7 @@ const listCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('list').al
|
|
|
1847
1916
|
const skills = skillManager.list();
|
|
1848
1917
|
if (0 === skills.length) {
|
|
1849
1918
|
const location = isGlobal ? 'globally' : 'in this project';
|
|
1850
|
-
|
|
1919
|
+
logger_logger.info(`No skills installed ${location}`);
|
|
1851
1920
|
return;
|
|
1852
1921
|
}
|
|
1853
1922
|
if (options.json) {
|
|
@@ -1855,8 +1924,8 @@ const listCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('list').al
|
|
|
1855
1924
|
return;
|
|
1856
1925
|
}
|
|
1857
1926
|
const locationLabel = isGlobal ? __WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(' (global)') : '';
|
|
1858
|
-
|
|
1859
|
-
|
|
1927
|
+
logger_logger.log(`Installed Skills (${skillManager.getInstallDir()})${locationLabel}:`);
|
|
1928
|
+
logger_logger.newline();
|
|
1860
1929
|
const headers = [
|
|
1861
1930
|
'Name',
|
|
1862
1931
|
'Version',
|
|
@@ -1867,19 +1936,19 @@ const listCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('list').al
|
|
|
1867
1936
|
skill.isLinked ? `${skill.version} (linked)` : skill.version,
|
|
1868
1937
|
skill.source || '-'
|
|
1869
1938
|
]);
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1939
|
+
logger_logger.table(headers, rows);
|
|
1940
|
+
logger_logger.newline();
|
|
1941
|
+
logger_logger.log(`Total: ${skills.length} skill(s)`);
|
|
1873
1942
|
});
|
|
1874
1943
|
const outdatedCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('outdated').description('Check for outdated skills').option('-j, --json', 'Output as JSON').action(async (options)=>{
|
|
1875
1944
|
const configLoader = new ConfigLoader();
|
|
1876
1945
|
if (!configLoader.exists()) {
|
|
1877
|
-
|
|
1946
|
+
logger_logger.error("skills.json not found. Run 'reskill init' first.");
|
|
1878
1947
|
process.exit(1);
|
|
1879
1948
|
}
|
|
1880
1949
|
const skills = configLoader.getSkills();
|
|
1881
1950
|
if (0 === Object.keys(skills).length) {
|
|
1882
|
-
|
|
1951
|
+
logger_logger.info('No skills defined in skills.json');
|
|
1883
1952
|
return;
|
|
1884
1953
|
}
|
|
1885
1954
|
const skillManager = new SkillManager();
|
|
@@ -1893,11 +1962,11 @@ const outdatedCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('outda
|
|
|
1893
1962
|
}
|
|
1894
1963
|
const outdated = results.filter((r)=>r.updateAvailable);
|
|
1895
1964
|
if (0 === outdated.length) {
|
|
1896
|
-
|
|
1965
|
+
logger_logger.success('All skills are up to date!');
|
|
1897
1966
|
return;
|
|
1898
1967
|
}
|
|
1899
|
-
|
|
1900
|
-
|
|
1968
|
+
logger_logger["package"]('Checking for updates...');
|
|
1969
|
+
logger_logger.newline();
|
|
1901
1970
|
const headers = [
|
|
1902
1971
|
'Skill',
|
|
1903
1972
|
'Current',
|
|
@@ -1910,15 +1979,15 @@ const outdatedCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('outda
|
|
|
1910
1979
|
r.latest,
|
|
1911
1980
|
r.updateAvailable ? __WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('⬆️ Update available') : __WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('✅ Up to date')
|
|
1912
1981
|
]);
|
|
1913
|
-
|
|
1914
|
-
|
|
1982
|
+
logger_logger.table(headers, rows);
|
|
1983
|
+
logger_logger.newline();
|
|
1915
1984
|
if (outdated.length > 0) {
|
|
1916
|
-
|
|
1917
|
-
|
|
1985
|
+
logger_logger.log(`Run ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan('reskill update')} to update all skills`);
|
|
1986
|
+
logger_logger.log(`Or ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan('reskill update <skill>')} to update a specific skill`);
|
|
1918
1987
|
}
|
|
1919
1988
|
} catch (error) {
|
|
1920
1989
|
spinner.fail('Check failed');
|
|
1921
|
-
|
|
1990
|
+
logger_logger.error(error.message);
|
|
1922
1991
|
process.exit(1);
|
|
1923
1992
|
}
|
|
1924
1993
|
});
|
|
@@ -1933,7 +2002,7 @@ const uninstallCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('unin
|
|
|
1933
2002
|
const updateCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('update').alias('up').description('Update installed skills').argument('[skill]', 'Skill name to update (updates all if not specified)').action(async (skill)=>{
|
|
1934
2003
|
const configLoader = new ConfigLoader();
|
|
1935
2004
|
if (!configLoader.exists()) {
|
|
1936
|
-
|
|
2005
|
+
logger_logger.error("skills.json not found. Run 'reskill init' first.");
|
|
1937
2006
|
process.exit(1);
|
|
1938
2007
|
}
|
|
1939
2008
|
const skillManager = new SkillManager();
|
|
@@ -1942,14 +2011,14 @@ const updateCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('update'
|
|
|
1942
2011
|
const updated = await skillManager.update(skill);
|
|
1943
2012
|
spinner.stop();
|
|
1944
2013
|
if (0 === updated.length) {
|
|
1945
|
-
|
|
2014
|
+
logger_logger.info('No skills to update');
|
|
1946
2015
|
return;
|
|
1947
2016
|
}
|
|
1948
|
-
|
|
1949
|
-
for (const s of updated)
|
|
2017
|
+
logger_logger.success(`Updated ${updated.length} skill(s):`);
|
|
2018
|
+
for (const s of updated)logger_logger.log(` - ${s.name}@${s.version}`);
|
|
1950
2019
|
} catch (error) {
|
|
1951
2020
|
spinner.fail('Update failed');
|
|
1952
|
-
|
|
2021
|
+
logger_logger.error(error.message);
|
|
1953
2022
|
process.exit(1);
|
|
1954
2023
|
}
|
|
1955
2024
|
});
|
|
@@ -1966,4 +2035,8 @@ program.addCommand(outdatedCommand);
|
|
|
1966
2035
|
program.addCommand(uninstallCommand);
|
|
1967
2036
|
program.addCommand(linkCommand);
|
|
1968
2037
|
program.addCommand(unlinkCommand);
|
|
1969
|
-
|
|
2038
|
+
const updateCheckPromise = checkForUpdate(packageJson.name, packageJson.version);
|
|
2039
|
+
program.parseAsync().then(async ()=>{
|
|
2040
|
+
const result = await updateCheckPromise;
|
|
2041
|
+
if (result?.hasUpdate) logger_logger.log(formatUpdateMessage(result));
|
|
2042
|
+
});
|
|
@@ -39,6 +39,7 @@ export declare class GitResolver {
|
|
|
39
39
|
* - git@github.com:user/repo.git/subpath@v1.0.0
|
|
40
40
|
* - https://github.com/user/repo.git
|
|
41
41
|
* - https://github.com/user/repo.git@v1.0.0
|
|
42
|
+
* - https://github.com/user/repo/tree/branch/path (GitHub web URL)
|
|
42
43
|
*/
|
|
43
44
|
private parseGitUrlRef;
|
|
44
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-resolver.d.ts","sourceRoot":"","sources":["../../src/core/git-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAUvE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,eAAe,CAAS;gBAEpB,eAAe,SAAW;IAItC;;;;;;;;;OASG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc;IAmDrC
|
|
1
|
+
{"version":3,"file":"git-resolver.d.ts","sourceRoot":"","sources":["../../src/core/git-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAUvE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,eAAe,CAAS;gBAEpB,eAAe,SAAW;IAItC;;;;;;;;;OASG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc;IAmDrC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,cAAc;IAmFtB;;OAEG;IACH,YAAY,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa;IA+BjD;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM;IAQ5C;;OAEG;IACG,cAAc,CAClB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,aAAa,GACzB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAkD5C;;OAEG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAClC,MAAM,EAAE,cAAc,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CAaH;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock-manager.d.ts","sourceRoot":"","sources":["../../src/core/lock-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQjE;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAA2B;gBAE/B,WAAW,CAAC,EAAE,MAAM;IAKhC;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACH,IAAI,IAAI,UAAU;IAsBlB;;OAEG;IACH,MAAM,IAAI,UAAU;IAKpB;;OAEG;IACH,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IASnC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAK1C;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;IAM3C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAU7B;;OAEG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,GACA,WAAW;
|
|
1
|
+
{"version":3,"file":"lock-manager.d.ts","sourceRoot":"","sources":["../../src/core/lock-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQjE;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAA2B;gBAE/B,WAAW,CAAC,EAAE,MAAM;IAKhC;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACH,IAAI,IAAI,UAAU;IAsBlB;;OAEG;IACH,MAAM,IAAI,UAAU;IAKpB;;OAEG;IACH,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IASnC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAK1C;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;IAM3C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAU7B;;OAEG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,GACA,WAAW;IAcd;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IAKrC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK1B;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAQtD;;OAEG;IACH,KAAK,IAAI,IAAI;IAQb;;OAEG;IACH,MAAM,IAAI,IAAI;CAOf;AAED,eAAe,WAAW,CAAC"}
|