@zshuangmu/agenthub 0.4.1 → 0.4.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 +15 -0
- package/package.json +1 -1
- package/src/cli.js +25 -10
package/README.md
CHANGED
|
@@ -161,6 +161,9 @@ agenthub verify code-review-assistant --registry ./.registry --target-workspace
|
|
|
161
161
|
### HTTP API
|
|
162
162
|
|
|
163
163
|
```bash
|
|
164
|
+
# 健康检查
|
|
165
|
+
curl http://localhost:3001/api/health
|
|
166
|
+
|
|
164
167
|
# 列出所有 Agent
|
|
165
168
|
curl http://localhost:3001/api/agents
|
|
166
169
|
|
|
@@ -170,8 +173,20 @@ curl "http://localhost:3001/api/agents?q=react"
|
|
|
170
173
|
# 获取 Agent 详情
|
|
171
174
|
curl http://localhost:3001/api/agents/my-agent
|
|
172
175
|
|
|
176
|
+
# 下载 Agent Bundle
|
|
177
|
+
curl http://localhost:3001/api/agents/my-agent/download
|
|
178
|
+
|
|
173
179
|
# 获取统计信息
|
|
174
180
|
curl http://localhost:3001/api/stats
|
|
181
|
+
|
|
182
|
+
# 获取下载排行
|
|
183
|
+
curl "http://localhost:3001/api/stats/ranking?limit=10"
|
|
184
|
+
|
|
185
|
+
# 发布 Agent (POST)
|
|
186
|
+
curl -X POST http://localhost:3001/api/publish -H "Content-Type: application/json" -d '{"slug":"my-agent","version":"1.0.0"}'
|
|
187
|
+
|
|
188
|
+
# 上传发布 Agent (POST)
|
|
189
|
+
curl -X POST http://localhost:3001/api/publish-upload -H "Content-Type: application/json" -d '{"bundleData":"..."}'
|
|
175
190
|
```
|
|
176
191
|
|
|
177
192
|
### AI 自动发现
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -158,23 +158,28 @@ agenthub search - 搜索 Agent
|
|
|
158
158
|
|
|
159
159
|
选项:
|
|
160
160
|
--registry <dir> Registry 目录 (必需)
|
|
161
|
+
--json JSON 格式输出
|
|
161
162
|
|
|
162
163
|
示例:
|
|
163
164
|
agenthub search "code review" --registry ./.registry
|
|
164
165
|
agenthub search "" --registry ./.registry # 列出所有
|
|
166
|
+
agenthub search "code" --registry ./.registry --json
|
|
165
167
|
`,
|
|
166
168
|
list: `
|
|
167
169
|
agenthub list - 列出已安装 Agent
|
|
168
170
|
|
|
169
171
|
用法:
|
|
170
|
-
agenthub list [--target-workspace <dir>]
|
|
172
|
+
agenthub list [--target-workspace <dir>] [--json]
|
|
171
173
|
|
|
172
174
|
选项:
|
|
173
175
|
--target-workspace <dir> 指定工作区目录(可选)
|
|
176
|
+
--json JSON 格式输出
|
|
174
177
|
|
|
175
178
|
示例:
|
|
176
179
|
agenthub list
|
|
177
180
|
agenthub list --target-workspace ./my-workspace
|
|
181
|
+
agenthub list --json
|
|
182
|
+
agenthub list --target-workspace ./my-workspace
|
|
178
183
|
`,
|
|
179
184
|
verify: `
|
|
180
185
|
agenthub verify - 校验已安装 Agent
|
|
@@ -363,7 +368,9 @@ async function main() {
|
|
|
363
368
|
|
|
364
369
|
case "search": {
|
|
365
370
|
const results = await searchCommand(rest[0] || "", options);
|
|
366
|
-
if (
|
|
371
|
+
if (options.json) {
|
|
372
|
+
console.log(JSON.stringify({ agents: results, count: results.length, query: rest[0] || "" }, null, 2));
|
|
373
|
+
} else if (results.length === 0) {
|
|
367
374
|
console.log(warning("未找到匹配的 Agent"));
|
|
368
375
|
} else {
|
|
369
376
|
console.log(`\n${infoColor(`找到 ${results.length} 个 Agent:`)}\n`);
|
|
@@ -377,14 +384,18 @@ async function main() {
|
|
|
377
384
|
case "info": {
|
|
378
385
|
if (!requireArg(rest[0], "错误: 需要指定 agent slug")) return;
|
|
379
386
|
const result = await infoCommand(rest[0], options);
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
console.log(` ${muted("
|
|
387
|
+
if (options.json) {
|
|
388
|
+
console.log(JSON.stringify(result, null, 2));
|
|
389
|
+
} else {
|
|
390
|
+
console.log(`\n${highlight("📦")} ${result.name} (${result.slug}@${result.version})`);
|
|
391
|
+
console.log(` ${result.description}`);
|
|
392
|
+
console.log(` ${muted("Runtime:")} ${result.runtime?.type || "openclaw"} ${result.runtime?.version || ""}`);
|
|
393
|
+
const mem = result.includes?.memory || {};
|
|
394
|
+
if (mem.count > 0) {
|
|
395
|
+
console.log(` ${muted("Memory:")} ${mem.count} 条 (public: ${mem.public}, portable: ${mem.portable})`);
|
|
396
|
+
}
|
|
397
|
+
console.log(`\n ${infoColor("安装命令:")} agenthub install ${result.slug}`);
|
|
386
398
|
}
|
|
387
|
-
console.log(`\n ${infoColor("安装命令:")} agenthub install ${result.slug}`);
|
|
388
399
|
return;
|
|
389
400
|
}
|
|
390
401
|
|
|
@@ -399,7 +410,11 @@ async function main() {
|
|
|
399
410
|
|
|
400
411
|
case "list": {
|
|
401
412
|
const list = await listCommand(options);
|
|
402
|
-
|
|
413
|
+
if (options.json) {
|
|
414
|
+
console.log(JSON.stringify({ agents: list, count: list.length }, null, 2));
|
|
415
|
+
} else {
|
|
416
|
+
console.log(formatListOutput(list));
|
|
417
|
+
}
|
|
403
418
|
return;
|
|
404
419
|
}
|
|
405
420
|
|