@openclaw-cn/cli 1.2.6 → 1.2.8
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/lib/commands/skill.js +43 -2
- package/package.json +1 -1
package/lib/commands/skill.js
CHANGED
|
@@ -23,8 +23,8 @@ const BUILTIN_IGNORE_RULES = [
|
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
async function installSkill(client, skillId) {
|
|
26
|
-
// 1. Get Metadata
|
|
27
|
-
const res = await client.get(`/skills/${encodeURIComponent(skillId)}`);
|
|
26
|
+
// 1. Get Metadata (use /package endpoint which auto-counts installs)
|
|
27
|
+
const res = await client.get(`/skills/${encodeURIComponent(skillId)}/package`);
|
|
28
28
|
const skill = res.data;
|
|
29
29
|
|
|
30
30
|
// 2. Determine Install Path
|
|
@@ -249,6 +249,47 @@ export default function(program) {
|
|
|
249
249
|
}
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
+
skill
|
|
253
|
+
.command('my')
|
|
254
|
+
.description('List your own skills (all statuses)')
|
|
255
|
+
.action(async () => {
|
|
256
|
+
const spinner = ora('Fetching your skills...').start();
|
|
257
|
+
try {
|
|
258
|
+
const client = getClient();
|
|
259
|
+
// Get current user info
|
|
260
|
+
const me = await client.get('/me');
|
|
261
|
+
const userId = me.data.id;
|
|
262
|
+
|
|
263
|
+
// Fetch all statuses for this owner
|
|
264
|
+
const results = [];
|
|
265
|
+
for (const status of ['approved', 'pending', 'rejected']) {
|
|
266
|
+
const res = await client.get(`/skills?owner=${encodeURIComponent(userId)}&status=${status}`);
|
|
267
|
+
results.push(...res.data);
|
|
268
|
+
}
|
|
269
|
+
spinner.stop();
|
|
270
|
+
|
|
271
|
+
if (results.length === 0) {
|
|
272
|
+
console.log('You have not published any skills yet.');
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const statusIcons = { approved: chalk.green('✔ approved'), pending: chalk.yellow('⏳ pending'), rejected: chalk.red('✘ rejected') };
|
|
277
|
+
console.log(chalk.bold(`Your Skills (${results.length}):\n`));
|
|
278
|
+
results.forEach(s => {
|
|
279
|
+
const icon = statusIcons[s.status] || s.status;
|
|
280
|
+
console.log(`${chalk.bold(s.name)} (${s.id}) v${s.version || '?'}`);
|
|
281
|
+
console.log(` ${s.description}`);
|
|
282
|
+
console.log(` Status: ${icon}`);
|
|
283
|
+
if (s.status === 'rejected' && s.review_note) {
|
|
284
|
+
console.log(` ${chalk.red('Reason:')} ${s.review_note}`);
|
|
285
|
+
}
|
|
286
|
+
console.log();
|
|
287
|
+
});
|
|
288
|
+
} catch (err) {
|
|
289
|
+
spinner.fail(chalk.red(formatError(err)));
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
252
293
|
skill
|
|
253
294
|
.command('install <id>')
|
|
254
295
|
.description('Install a skill by ID (e.g. official/openclaw-cn)')
|