easyclaw-link 1.3.0 → 1.3.1
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 +19 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3287,7 +3287,8 @@ function formatNotification(n) {
|
|
|
3287
3287
|
}
|
|
3288
3288
|
async function notificationsAction(options) {
|
|
3289
3289
|
const apiKey = requireApiKey();
|
|
3290
|
-
const
|
|
3290
|
+
const parsed = parseInt(options.limit || "20", 10);
|
|
3291
|
+
const limit = isNaN(parsed) || parsed <= 0 ? 20 : Math.min(parsed, 50);
|
|
3291
3292
|
const res = await fetchWithRetry(
|
|
3292
3293
|
`${BASE_URL}/api/notifications?limit=${limit}`,
|
|
3293
3294
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
@@ -3449,12 +3450,17 @@ async function skillDownloadAction(id, options) {
|
|
|
3449
3450
|
}
|
|
3450
3451
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
3451
3452
|
const outPath = options.out || `skill-${id}.zip`;
|
|
3452
|
-
|
|
3453
|
+
const resolved = path5.resolve(outPath);
|
|
3454
|
+
const dir = path5.dirname(resolved);
|
|
3455
|
+
if (!fs5.existsSync(dir)) {
|
|
3456
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
3457
|
+
}
|
|
3458
|
+
fs5.writeFileSync(resolved, buffer);
|
|
3453
3459
|
if (options.json) {
|
|
3454
|
-
console.log(JSON.stringify({ success: true, path:
|
|
3460
|
+
console.log(JSON.stringify({ success: true, path: resolved, size: buffer.length }));
|
|
3455
3461
|
return;
|
|
3456
3462
|
}
|
|
3457
|
-
console.log(`\u2705 \u6280\u80FD #${id} \u5DF2\u4E0B\u8F7D: ${
|
|
3463
|
+
console.log(`\u2705 \u6280\u80FD #${id} \u5DF2\u4E0B\u8F7D: ${resolved} (${buffer.length} bytes)`);
|
|
3458
3464
|
}
|
|
3459
3465
|
async function skillStarAction(id, options) {
|
|
3460
3466
|
const apiKey = requireApiKey();
|
|
@@ -3497,7 +3503,8 @@ var fs6 = __toESM(require("fs"));
|
|
|
3497
3503
|
async function bountyListAction(options) {
|
|
3498
3504
|
const apiKey = requireApiKey();
|
|
3499
3505
|
const status = options.status || "open";
|
|
3500
|
-
const
|
|
3506
|
+
const parsedLimit = parseInt(options.limit || "20", 10);
|
|
3507
|
+
const limit = isNaN(parsedLimit) || parsedLimit <= 0 ? 20 : Math.min(parsedLimit, 100);
|
|
3501
3508
|
const res = await fetchWithRetry(
|
|
3502
3509
|
`${BASE_URL}/api/bounties?status=${status}&limit=${limit}&sort=date_desc`,
|
|
3503
3510
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
@@ -3602,6 +3609,12 @@ async function bountySubmitAction(id, content, options) {
|
|
|
3602
3609
|
console.error(`\u274C \u6587\u4EF6\u4E0D\u5B58\u5728: ${filePath}`);
|
|
3603
3610
|
process.exit(1);
|
|
3604
3611
|
}
|
|
3612
|
+
const stat = fs6.statSync(filePath);
|
|
3613
|
+
const MAX_SIZE = 512 * 1024;
|
|
3614
|
+
if (stat.size > MAX_SIZE) {
|
|
3615
|
+
console.error(`\u274C \u6587\u4EF6\u8FC7\u5927\uFF08${Math.round(stat.size / 1024)}KB\uFF09\uFF0C\u4E0A\u9650 512KB`);
|
|
3616
|
+
process.exit(1);
|
|
3617
|
+
}
|
|
3605
3618
|
body = fs6.readFileSync(filePath, "utf-8");
|
|
3606
3619
|
}
|
|
3607
3620
|
if (!body.trim()) {
|
|
@@ -3731,7 +3744,7 @@ async function msgSendAction(username, text, options) {
|
|
|
3731
3744
|
|
|
3732
3745
|
// src/index.ts
|
|
3733
3746
|
var program2 = new Command();
|
|
3734
|
-
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("1.3.
|
|
3747
|
+
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("1.3.1");
|
|
3735
3748
|
program2.command("login").description("\u767B\u5F55 EasyClaw Link\uFF0C\u4FDD\u5B58 API Key \u5230\u672C\u5730").action(loginAction);
|
|
3736
3749
|
program2.command("logout").description("\u9000\u51FA\u767B\u5F55\uFF0C\u6E05\u9664\u672C\u5730 API Key").action(logoutAction);
|
|
3737
3750
|
program2.command("whoami").description("\u663E\u793A\u5F53\u524D\u767B\u5F55\u8D26\u53F7\u4FE1\u606F").option("--json", "JSON \u8F93\u51FA").action((_opts) => whoamiAction());
|