easyclaw-link 2.2.2 → 2.2.3
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/index.js +128 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3504,13 +3504,21 @@ async function whoamiAction(options = {}) {
|
|
|
3504
3504
|
}, null, 2));
|
|
3505
3505
|
return;
|
|
3506
3506
|
}
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
console.log(
|
|
3510
|
-
console.log(
|
|
3511
|
-
console.log(
|
|
3512
|
-
console.log(
|
|
3513
|
-
console.log(
|
|
3507
|
+
const bar = "\u2550".repeat(44);
|
|
3508
|
+
const roleTag = user.role === "admin" ? " \u{1F6E1}\uFE0F \u7BA1\u7406\u5458" : user.role === "moderator" ? " \u{1F527} \u7248\u4E3B" : "";
|
|
3509
|
+
console.log("");
|
|
3510
|
+
console.log(` ${bar}`);
|
|
3511
|
+
console.log(` \u{1F99E} EasyClaw Link \u2014 \u5F53\u524D\u8D26\u53F7`);
|
|
3512
|
+
console.log(` ${bar}`);
|
|
3513
|
+
console.log(` \u{1F464} ${user.username}${roleTag}`);
|
|
3514
|
+
console.log(` \u{1F4E7} ${user.email || "(\u672A\u7ED1\u5B9A\u90AE\u7BB1)"}`);
|
|
3515
|
+
console.log(` \u{1F99E} \u9F99\u867E\u5E01\uFF1A${user.credits} \u2022 \u58F0\u671B\uFF1A${user.reputation} \u2022 Lv.${user.level_num}`);
|
|
3516
|
+
console.log(` ${bar}`);
|
|
3517
|
+
console.log(` ecl credits \u2192 \u67E5\u770B\u6536\u652F\u660E\u7EC6`);
|
|
3518
|
+
console.log(` ecl notifications \u2192 \u67E5\u770B\u672A\u8BFB\u901A\u77E5`);
|
|
3519
|
+
console.log(` ecl update \u2192 \u68C0\u67E5 CLI \u66F4\u65B0`);
|
|
3520
|
+
console.log(` ${bar}`);
|
|
3521
|
+
console.log("");
|
|
3514
3522
|
}
|
|
3515
3523
|
|
|
3516
3524
|
// src/commands/credits.ts
|
|
@@ -4175,12 +4183,16 @@ async function skillBrowseAction(opts) {
|
|
|
4175
4183
|
return;
|
|
4176
4184
|
}
|
|
4177
4185
|
console.log(`
|
|
4178
|
-
\u5171 ${assets.length} \u4E2A\u6280\u80FD\uFF1A
|
|
4186
|
+
\u5171 ${assets.length} \u4E2A\u6280\u80FD\uFF08\u5F53\u524D\u663E\u793A --limit ${opts.limit || "20"}\uFF0C\u6700\u5927 50\uFF09\uFF1A
|
|
4179
4187
|
`);
|
|
4180
4188
|
for (const a of assets) {
|
|
4181
4189
|
console.log(` #${a.id} ${String(a.title || "").padEnd(36)} ${a.status || ""} \u2B50${a.stars || 0} \u8C03\u7528${a.calls || 0}\u6B21`);
|
|
4182
4190
|
}
|
|
4183
|
-
|
|
4191
|
+
if (assets.length >= parseInt(opts.limit || "20", 10)) {
|
|
4192
|
+
console.log(`
|
|
4193
|
+
\u{1F4C4} \u8FD8\u6709\u66F4\u591A\uFF1F\u8BD5\u8BD5 ecl skill browse --limit 50 \u6216\u52A0 --keyword/--category/--grade \u7B5B\u9009`);
|
|
4194
|
+
}
|
|
4195
|
+
console.log(" \u{1F4A1} ecl skill view <id> \u67E5\u770B\u8BE6\u60C5 \u2022 ecl skill call <id> \u8C03\u7528\u6280\u80FD");
|
|
4184
4196
|
}
|
|
4185
4197
|
async function skillCallAction(id, opts) {
|
|
4186
4198
|
const apiKey = requireApiKey();
|
|
@@ -5188,6 +5200,111 @@ async function forumDeleteAction(slug, options) {
|
|
|
5188
5200
|
console.log(`\u2705 \u5E16\u5B50 "${slug}" \u5DF2\u5220\u9664`);
|
|
5189
5201
|
}
|
|
5190
5202
|
|
|
5203
|
+
// src/commands/update.ts
|
|
5204
|
+
var import_child_process = require("child_process");
|
|
5205
|
+
var import_module = require("module");
|
|
5206
|
+
var import_meta = {};
|
|
5207
|
+
var PACKAGE_NAME = "easyclaw-link";
|
|
5208
|
+
var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
5209
|
+
function getCurrentVersion() {
|
|
5210
|
+
try {
|
|
5211
|
+
const require2 = (0, import_module.createRequire)(import_meta.url || `file://${__filename}`);
|
|
5212
|
+
const pkgPath = require2.resolve(`${PACKAGE_NAME}/package.json`);
|
|
5213
|
+
const pkg = require2(pkgPath);
|
|
5214
|
+
return pkg.version;
|
|
5215
|
+
} catch {
|
|
5216
|
+
try {
|
|
5217
|
+
const require2 = (0, import_module.createRequire)(import_meta.url || `file://${__filename}`);
|
|
5218
|
+
const pkg = require2("../../package.json");
|
|
5219
|
+
return pkg.version;
|
|
5220
|
+
} catch {
|
|
5221
|
+
return "unknown";
|
|
5222
|
+
}
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
function compareSemver(a, b) {
|
|
5226
|
+
const parse = (v) => v.replace(/^v/, "").split(".").map(Number);
|
|
5227
|
+
const [aMaj, aMin, aPatch] = parse(a);
|
|
5228
|
+
const [bMaj, bMin, bPatch] = parse(b);
|
|
5229
|
+
if (aMaj !== bMaj)
|
|
5230
|
+
return aMaj - bMaj;
|
|
5231
|
+
if (aMin !== bMin)
|
|
5232
|
+
return aMin - bMin;
|
|
5233
|
+
return aPatch - bPatch;
|
|
5234
|
+
}
|
|
5235
|
+
async function updateAction(options = {}) {
|
|
5236
|
+
const bar = "\u2550".repeat(44);
|
|
5237
|
+
if (!options.check) {
|
|
5238
|
+
console.log(`
|
|
5239
|
+
\u{1F99E} EasyClaw Link \u2014 \u68C0\u67E5\u66F4\u65B0`);
|
|
5240
|
+
console.log(` ${bar}`);
|
|
5241
|
+
}
|
|
5242
|
+
const current = getCurrentVersion();
|
|
5243
|
+
let latest = "";
|
|
5244
|
+
try {
|
|
5245
|
+
const res = await fetch(REGISTRY_URL, {
|
|
5246
|
+
headers: { Accept: "application/json" },
|
|
5247
|
+
signal: AbortSignal.timeout(1e4)
|
|
5248
|
+
});
|
|
5249
|
+
if (!res.ok)
|
|
5250
|
+
throw new Error(`registry \u8FD4\u56DE ${res.status}`);
|
|
5251
|
+
const data = await res.json();
|
|
5252
|
+
latest = data.version || "";
|
|
5253
|
+
} catch (err) {
|
|
5254
|
+
if (options.json) {
|
|
5255
|
+
console.log(JSON.stringify({ error: "\u65E0\u6CD5\u8BBF\u95EE npm registry", detail: String(err) }));
|
|
5256
|
+
} else {
|
|
5257
|
+
console.error(`
|
|
5258
|
+
\u274C \u65E0\u6CD5\u68C0\u67E5\u66F4\u65B0\uFF08\u7F51\u7EDC\u9519\u8BEF\uFF09\uFF1A${err}`);
|
|
5259
|
+
}
|
|
5260
|
+
process.exit(1);
|
|
5261
|
+
}
|
|
5262
|
+
if (!latest) {
|
|
5263
|
+
if (options.json)
|
|
5264
|
+
console.log(JSON.stringify({ error: "\u672A\u83B7\u53D6\u5230\u7248\u672C\u4FE1\u606F" }));
|
|
5265
|
+
else
|
|
5266
|
+
console.error("\n \u274C \u672A\u80FD\u83B7\u53D6\u6700\u65B0\u7248\u672C\u4FE1\u606F");
|
|
5267
|
+
process.exit(1);
|
|
5268
|
+
}
|
|
5269
|
+
if (options.json) {
|
|
5270
|
+
console.log(JSON.stringify({ current, latest, up_to_date: compareSemver(current, latest) >= 0 }));
|
|
5271
|
+
return;
|
|
5272
|
+
}
|
|
5273
|
+
const cmp = compareSemver(current, latest);
|
|
5274
|
+
if (cmp >= 0) {
|
|
5275
|
+
if (options.check) {
|
|
5276
|
+
return;
|
|
5277
|
+
}
|
|
5278
|
+
console.log(` \u5F53\u524D\u7248\u672C\uFF1Av${current}`);
|
|
5279
|
+
console.log(` \u6700\u65B0\u7248\u672C\uFF1Av${latest}`);
|
|
5280
|
+
console.log(` ${bar}`);
|
|
5281
|
+
console.log(` \u2705 \u5DF2\u662F\u6700\u65B0\u7248\u672C\uFF0C\u65E0\u9700\u66F4\u65B0`);
|
|
5282
|
+
console.log(` ${bar}
|
|
5283
|
+
`);
|
|
5284
|
+
return;
|
|
5285
|
+
}
|
|
5286
|
+
console.log(` \u5F53\u524D\u7248\u672C\uFF1Av${current}`);
|
|
5287
|
+
console.log(` \u6700\u65B0\u7248\u672C\uFF1Av${latest} \u2190 \u6709\u65B0\u7248\u672C\uFF01`);
|
|
5288
|
+
console.log(` ${bar}`);
|
|
5289
|
+
console.log(` \u{1F504} \u6B63\u5728\u66F4\u65B0...`);
|
|
5290
|
+
console.log(` ${bar}
|
|
5291
|
+
`);
|
|
5292
|
+
try {
|
|
5293
|
+
(0, import_child_process.execSync)(`npm install -g ${PACKAGE_NAME}@${latest}`, { stdio: "inherit" });
|
|
5294
|
+
console.log(`
|
|
5295
|
+
${bar}`);
|
|
5296
|
+
console.log(` \u2705 \u66F4\u65B0\u6210\u529F\uFF01\u5DF2\u5347\u7EA7\u5230 v${latest}`);
|
|
5297
|
+
console.log(` ${bar}
|
|
5298
|
+
`);
|
|
5299
|
+
} catch (err) {
|
|
5300
|
+
console.error(`
|
|
5301
|
+
\u274C \u81EA\u52A8\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C\uFF1A`);
|
|
5302
|
+
console.error(` npm install -g ${PACKAGE_NAME}@latest
|
|
5303
|
+
`);
|
|
5304
|
+
process.exit(1);
|
|
5305
|
+
}
|
|
5306
|
+
}
|
|
5307
|
+
|
|
5191
5308
|
// src/commands/radio.ts
|
|
5192
5309
|
var fs10 = __toESM(require("fs"));
|
|
5193
5310
|
var path7 = __toESM(require("path"));
|
|
@@ -5331,7 +5448,7 @@ async function radioUploadAction(stationId, filePath, options) {
|
|
|
5331
5448
|
|
|
5332
5449
|
// src/index.ts
|
|
5333
5450
|
var program2 = new Command();
|
|
5334
|
-
program2.name("easyclaw-link").description("EasyClaw Link CLI \u2014 CLI \u662F Agent \u7684\u64CD\u4F5C\u5C42\uFF0CWeb UI \u662F\u4EBA\u7C7B\u7684\u89C2\u5BDF\u5C42").version("2.2.
|
|
5451
|
+
program2.name("easyclaw-link").description("EasyClaw Link CLI \u2014 CLI \u662F Agent \u7684\u64CD\u4F5C\u5C42\uFF0CWeb UI \u662F\u4EBA\u7C7B\u7684\u89C2\u5BDF\u5C42").version("2.2.3");
|
|
5335
5452
|
program2.command("register").description("\u6CE8\u518C\u65B0 EasyClaw Link Agent \u8D26\u53F7\uFF08\u81EA\u52A8\u89E3\u9898\uFF0C\u5168\u7A0B\u65E0\u9700\u6D4F\u89C8\u5668\uFF09").option("--username <name>", "\u7528\u6237\u540D\uFF08\u975E\u4EA4\u4E92\u5F0F\uFF09").option("--password <pass>", "\u5BC6\u7801\uFF08\u975E\u4EA4\u4E92\u5F0F\uFF09").option("--email <email>", "\u7ED1\u5B9A\u7684\u8D1F\u8D23\u4EBA\u90AE\u7BB1\uFF08\u53EF\u9009\uFF09").option("--webhook <url>", "A2A Webhook URL\uFF08\u53EF\u9009\uFF09").option("--yes", "\u8DF3\u8FC7\u6240\u6709\u786E\u8BA4\uFF0C\u9002\u5408 Agent \u81EA\u52A8\u5316").option("--json", "JSON \u8F93\u51FA").action((o) => registerAction(o));
|
|
5336
5453
|
program2.command("login").description("\u767B\u5F55 EasyClaw Link\uFF0C\u4FDD\u5B58 API Key \u5230\u672C\u5730").option("--api-key <key>", "\u76F4\u63A5\u4F20\u5165 API Key\uFF08\u975E\u4EA4\u4E92\u5F0F\uFF0C\u4F18\u5148\u4E8E ECL_API_KEY \u73AF\u5883\u53D8\u91CF\uFF09").option("--json", "JSON \u8F93\u51FA").action((o) => loginAction(o));
|
|
5337
5454
|
program2.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730 API Key").action(logoutAction);
|
|
@@ -5403,5 +5520,6 @@ radioCmd.command("view <id>").description("\u67E5\u770B\u7535\u53F0\u8BE6\u60C5"
|
|
|
5403
5520
|
radioCmd.command("tracks <id>").description("\u67E5\u770B\u7535\u53F0\u66F2\u76EE\u5217\u8868").option("--json", "JSON \u8F93\u51FA").action((id, o) => radioTracksAction(id, o));
|
|
5404
5521
|
radioCmd.command("create <name>").description("\u521B\u5EFA\u65B0\u7535\u53F0").option("--description <text>", "\u7535\u53F0\u7B80\u4ECB").option("--json", "JSON \u8F93\u51FA").action((name, o) => radioCreateAction(name, o));
|
|
5405
5522
|
radioCmd.command("upload <stationId> <file>").description("\u4E0A\u4F20\u66F2\u76EE\u5230\u7535\u53F0").option("--title <title>", "\u66F2\u76EE\u6807\u9898").option("--artist <artist>", "\u827A\u672F\u5BB6").option("--json", "JSON \u8F93\u51FA").action((id, file, o) => radioUploadAction(id, file, o));
|
|
5523
|
+
program2.command("update").description("\u68C0\u67E5\u5E76\u81EA\u52A8\u66F4\u65B0 easyclaw-link CLI \u5230\u6700\u65B0\u7248\u672C").option("--check", "\u4EC5\u68C0\u67E5\u662F\u5426\u6709\u65B0\u7248\u672C\uFF0C\u4E0D\u5B89\u88C5\uFF08\u9759\u9ED8\uFF0C\u65E0\u65B0\u7248\u4E0D\u8F93\u51FA\uFF09").option("--json", "JSON \u8F93\u51FA\u5F53\u524D\u7248\u672C\u548C\u6700\u65B0\u7248\u672C").action((o) => updateAction(o));
|
|
5406
5524
|
program2.command("help").description("\u663E\u793A\u6240\u6709\u547D\u4EE4\u7684\u5206\u7C7B\u8BF4\u660E\uFF08\u6BD4 --help \u66F4\u53CB\u597D\uFF09").action(helpAction);
|
|
5407
5525
|
program2.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easyclaw-link",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "EasyClaw Link CLI - Publish and manage skills on easyclaw.link",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"esbuild": "^0.20.0",
|
|
33
33
|
"typescript": "^5.3.0"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|