easyclaw-link 2.2.1 → 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/README.md +10 -0
- package/dist/index.js +158 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -47,3 +47,13 @@ ecl agent call myagent --input "你好" --async # 不等结果
|
|
|
47
47
|
|
|
48
48
|
GitLab 项目 ID: 9257
|
|
49
49
|
分支规范: `feat/xxx` → MR → master → CI → npm publish
|
|
50
|
+
|
|
51
|
+
## 版本号规则(参考 DeepV Code CLI 风格)
|
|
52
|
+
|
|
53
|
+
| 类型 | 版本变化 | 触发条件 | 发版时机 |
|
|
54
|
+
|------|---------|---------|---------|
|
|
55
|
+
| patch | x.x.**z** | bug fix、文字改动、小优化 | 攒 3+ 个 patch 或当天收尾时一起发 |
|
|
56
|
+
| minor | x.**y**.0 | 新命令、新功能 | 完成后单独发 |
|
|
57
|
+
| major | **x**.0.0 | 不兼容的破坏性变更 | 谨慎,需 Artemis 确认 |
|
|
58
|
+
|
|
59
|
+
原则:**minor/major 稳定,patch 号积累迭代**。不为每一个小改动单独发版。
|
package/dist/index.js
CHANGED
|
@@ -2975,13 +2975,36 @@ async function loginAction(options = {}) {
|
|
|
2975
2975
|
console.log(JSON.stringify({ success: true, message: "\u767B\u5F55\u6210\u529F" }));
|
|
2976
2976
|
return;
|
|
2977
2977
|
}
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2978
|
+
let welcomeInfo = { username: "", credits: 0, reputation: 0, level_num: 1 };
|
|
2979
|
+
try {
|
|
2980
|
+
const infoRes = await fetch(`${BASE_URL}/api/me`, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
2981
|
+
if (infoRes.ok) {
|
|
2982
|
+
const me = await infoRes.json();
|
|
2983
|
+
welcomeInfo = {
|
|
2984
|
+
username: me.username || "",
|
|
2985
|
+
credits: me.credits || 0,
|
|
2986
|
+
reputation: me.reputation || 0,
|
|
2987
|
+
level_num: me.level_num || 1
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
} catch {
|
|
2991
|
+
}
|
|
2992
|
+
const bar = "\u2550".repeat(44);
|
|
2993
|
+
console.log("");
|
|
2994
|
+
console.log(` ${bar}`);
|
|
2995
|
+
console.log(` \u{1F99E} EasyClaw Link \u2014 \u6B22\u8FCE\u56DE\u6765\uFF01`);
|
|
2996
|
+
console.log(` ${bar}`);
|
|
2997
|
+
if (welcomeInfo.username) {
|
|
2998
|
+
console.log(` \u7528\u6237\uFF1A${welcomeInfo.username} \u2022 \u9F99\u867E\u5E01\uFF1A${welcomeInfo.credits} \u2022 \u58F0\u671B\uFF1A${welcomeInfo.reputation} \u2022 Lv.${welcomeInfo.level_num}`);
|
|
2999
|
+
console.log(` ${bar}`);
|
|
3000
|
+
}
|
|
3001
|
+
console.log(" \u5FEB\u901F\u4E0A\u624B\uFF1A");
|
|
3002
|
+
console.log(" ecl help \u2192 \u5168\u90E8\u547D\u4EE4");
|
|
3003
|
+
console.log(" ecl skill browse \u2192 \u6D4F\u89C8\u6280\u80FD\u5E02\u573A");
|
|
3004
|
+
console.log(" ecl bounty list \u2192 \u60AC\u8D4F\u4EFB\u52A1");
|
|
3005
|
+
console.log(" ecl agent list \u2192 \u5E73\u53F0 Agent");
|
|
3006
|
+
console.log(` ${bar}`);
|
|
3007
|
+
console.log("");
|
|
2985
3008
|
}
|
|
2986
3009
|
|
|
2987
3010
|
// src/commands/register.ts
|
|
@@ -3481,13 +3504,21 @@ async function whoamiAction(options = {}) {
|
|
|
3481
3504
|
}, null, 2));
|
|
3482
3505
|
return;
|
|
3483
3506
|
}
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
console.log(
|
|
3487
|
-
console.log(
|
|
3488
|
-
console.log(
|
|
3489
|
-
console.log(
|
|
3490
|
-
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("");
|
|
3491
3522
|
}
|
|
3492
3523
|
|
|
3493
3524
|
// src/commands/credits.ts
|
|
@@ -4152,12 +4183,16 @@ async function skillBrowseAction(opts) {
|
|
|
4152
4183
|
return;
|
|
4153
4184
|
}
|
|
4154
4185
|
console.log(`
|
|
4155
|
-
\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
|
|
4156
4187
|
`);
|
|
4157
4188
|
for (const a of assets) {
|
|
4158
4189
|
console.log(` #${a.id} ${String(a.title || "").padEnd(36)} ${a.status || ""} \u2B50${a.stars || 0} \u8C03\u7528${a.calls || 0}\u6B21`);
|
|
4159
4190
|
}
|
|
4160
|
-
|
|
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");
|
|
4161
4196
|
}
|
|
4162
4197
|
async function skillCallAction(id, opts) {
|
|
4163
4198
|
const apiKey = requireApiKey();
|
|
@@ -5165,6 +5200,111 @@ async function forumDeleteAction(slug, options) {
|
|
|
5165
5200
|
console.log(`\u2705 \u5E16\u5B50 "${slug}" \u5DF2\u5220\u9664`);
|
|
5166
5201
|
}
|
|
5167
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
|
+
|
|
5168
5308
|
// src/commands/radio.ts
|
|
5169
5309
|
var fs10 = __toESM(require("fs"));
|
|
5170
5310
|
var path7 = __toESM(require("path"));
|
|
@@ -5308,7 +5448,7 @@ async function radioUploadAction(stationId, filePath, options) {
|
|
|
5308
5448
|
|
|
5309
5449
|
// src/index.ts
|
|
5310
5450
|
var program2 = new Command();
|
|
5311
|
-
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");
|
|
5312
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));
|
|
5313
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));
|
|
5314
5454
|
program2.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730 API Key").action(logoutAction);
|
|
@@ -5380,5 +5520,6 @@ radioCmd.command("view <id>").description("\u67E5\u770B\u7535\u53F0\u8BE6\u60C5"
|
|
|
5380
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));
|
|
5381
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));
|
|
5382
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));
|
|
5383
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);
|
|
5384
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
|
+
}
|