@zshuangmu/agenthub 0.2.0 → 0.2.2

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 CHANGED
@@ -87,6 +87,28 @@ agenthub serve --registry ./.registry --port 3000
87
87
 
88
88
  访问 http://localhost:3000 查看你的 Agent!
89
89
 
90
+ ### 🎯 试用样板 Agent
91
+
92
+ 我们提供了一个官方样板 Agent,帮助你快速体验:
93
+
94
+ ```bash
95
+ # 1. 克隆仓库
96
+ git clone https://github.com/itshaungmu/AgentHub.git
97
+ cd AgentHub
98
+
99
+ # 2. 打包样板 Agent
100
+ agenthub pack --workspace ./samples/code-review-assistant --config ./samples/code-review-assistant/openclaw.json
101
+
102
+ # 3. 发布到本地 Registry
103
+ agenthub publish ./bundles/code-review-assistant-1.0.0.agent --registry ./.registry
104
+
105
+ # 4. 安装到你的 workspace
106
+ agenthub install code-review-assistant --registry ./.registry --target-workspace ./my-workspace
107
+
108
+ # 5. 校验安装
109
+ agenthub verify code-review-assistant --registry ./.registry --target-workspace ./my-workspace
110
+ ```
111
+
90
112
  ---
91
113
 
92
114
  ## 📖 命令文档
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zshuangmu/agenthub",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AI Agent 打包与分发平台 - 一句话打包上传,一键下载获得能力",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -8,6 +8,7 @@ import { getCurrentVersion, updateInstallRecord, buildInstallOptions } from "../
8
8
  import { installBundle } from "../lib/install.js";
9
9
  import { parseSpec } from "../lib/registry.js";
10
10
  import { versionsCommand } from "./versions.js";
11
+ import { success, warning, highlight, muted, symbols } from "../lib/colors.js";
11
12
 
12
13
  export async function rollbackCommand(agentSpec, options = {}) {
13
14
  const targetWorkspace = options.targetWorkspace ? path.resolve(options.targetWorkspace) : null;
@@ -41,7 +42,16 @@ export async function rollbackCommand(agentSpec, options = {}) {
41
42
 
42
43
  return {
43
44
  rolledBack: true,
44
- message: `已回滚 ${slug} 从 ${currentVersion || "未知"} 到 ${targetVersion}`,
45
+ message: [
46
+ success(`${symbols.success} 回滚成功`),
47
+ "",
48
+ ` ${highlight("Agent:")} ${slug}`,
49
+ ` ${muted("回滚前:")} ${currentVersion || "未知"}`,
50
+ ` ${highlight("当前版本:")} ${targetVersion}`,
51
+ "",
52
+ ` ${muted("运行")} ${highlight("agenthub verify " + slug)} ${muted("校验安装状态")}`,
53
+ ` ${muted("运行")} ${highlight("agenthub update " + slug)} ${muted("恢复到最新版本")}`,
54
+ ].join("\n"),
45
55
  currentVersion: targetVersion,
46
56
  previousVersion: currentVersion,
47
57
  manifest: result.manifest,
@@ -7,6 +7,7 @@ import path from "node:path";
7
7
  import { getCurrentVersion, performVersionChange } from "../lib/version-manager.js";
8
8
  import { parseSpec } from "../lib/registry.js";
9
9
  import { versionsCommand } from "./versions.js";
10
+ import { success, warning, highlight, muted, symbols } from "../lib/colors.js";
10
11
 
11
12
  export async function updateCommand(agentSpec, options = {}) {
12
13
  const targetWorkspace = options.targetWorkspace ? path.resolve(options.targetWorkspace) : null;
@@ -26,7 +27,7 @@ export async function updateCommand(agentSpec, options = {}) {
26
27
  if (currentVersion === latestVersion) {
27
28
  return {
28
29
  updated: false,
29
- message: `已是最新版本: ${latestVersion}`,
30
+ message: `${success(`${symbols.success} ${slug} 已是最新版本`)} ${muted(`(${latestVersion})`)}`,
30
31
  currentVersion,
31
32
  latestVersion,
32
33
  };
@@ -37,7 +38,15 @@ export async function updateCommand(agentSpec, options = {}) {
37
38
 
38
39
  return {
39
40
  updated: true,
40
- message: `已更新 ${slug} 从 ${currentVersion || "未知"} 到 ${latestVersion}`,
41
+ message: [
42
+ success(`${symbols.success} 更新成功`),
43
+ "",
44
+ ` ${highlight("Agent:")} ${slug}`,
45
+ ` ${muted("旧版本:")} ${currentVersion || "未知"}`,
46
+ ` ${highlight("新版本:")} ${latestVersion}`,
47
+ "",
48
+ ` ${muted("运行")} ${highlight("agenthub verify " + slug)} ${muted("校验安装状态")}`,
49
+ ].join("\n"),
41
50
  currentVersion: latestVersion,
42
51
  previousVersion: currentVersion,
43
52
  manifest: result.manifest,
@@ -2,6 +2,7 @@ import path from "node:path";
2
2
  import { pathExists, readJson } from "../lib/fs-utils.js";
3
3
  import { parseSpec } from "../lib/registry.js";
4
4
  import { infoCommand } from "./info.js";
5
+ import { success, error, warning, info as infoColor, highlight, muted, symbols } from "../lib/colors.js";
5
6
 
6
7
  export async function verifyCommand(agentSpec, options = {}) {
7
8
  const targetWorkspace = path.resolve(options.targetWorkspace || process.cwd());
@@ -78,17 +79,55 @@ export async function verifyCommand(agentSpec, options = {}) {
78
79
 
79
80
  export function formatVerifyOutput(result) {
80
81
  const lines = [];
81
- lines.push(`\n${result.verified ? "✅" : "❌"} Verify ${result.verified ? "passed" : "failed"}\n`);
82
+
83
+ // 标题
84
+ if (result.verified) {
85
+ lines.push(`\n${success(`${symbols.success} 校验通过`)}\n`);
86
+ } else {
87
+ lines.push(`\n${error(`${symbols.error} 校验失败`)}\n`);
88
+ }
89
+
90
+ // Agent 信息
82
91
  if (result.installRecord) {
83
- lines.push(`Agent: ${result.installRecord.slug}@${result.installRecord.version}`);
92
+ lines.push(`${highlight("Agent:")} ${result.installRecord.slug}@${result.installRecord.version}`);
84
93
  }
85
- lines.push(`Workspace: ${result.targetWorkspace}`);
94
+ lines.push(`${highlight("Workspace:")} ${result.targetWorkspace}`);
86
95
  lines.push("");
96
+
97
+ // 检查结果
98
+ lines.push(`${infoColor("检查项目:")}`);
87
99
  for (const check of result.checks || []) {
88
- lines.push(`- ${check.ok ? "PASS" : "FAIL"} ${check.name}: ${check.detail}`);
100
+ const status = check.ok
101
+ ? success(`${symbols.success} PASS`)
102
+ : error(`${symbols.error} FAIL`);
103
+ const checkName = check.name.replace(":", ": ").replace("_", " ");
104
+ lines.push(` ${status} ${muted(checkName)}`);
105
+ if (!check.ok || check.name.includes(":")) {
106
+ lines.push(` ${muted(check.detail)}`);
107
+ }
89
108
  }
109
+
110
+ // 失败原因
90
111
  if (result.reason) {
91
- lines.push(`\nReason: ${result.reason}`);
112
+ lines.push(`\n${warning(`原因: ${result.reason}`)}`);
113
+ }
114
+
115
+ // 健康度建议
116
+ if (result.verified) {
117
+ lines.push(`\n${success("Agent 安装完整,可以正常使用。")}`);
118
+ } else {
119
+ lines.push(`\n${warning("建议:")}`);
120
+ if (result.checks?.some(c => c.name === "install_record" && !c.ok)) {
121
+ lines.push(` - 运行 ${highlight("agenthub install <agent-slug>")} 安装 Agent`);
122
+ }
123
+ if (result.checks?.some(c => c.name.includes("workspace_file") && !c.ok)) {
124
+ lines.push(` - 检查 workspace 文件是否完整`);
125
+ lines.push(` - 尝试重新安装: ${highlight("agenthub install <agent-slug> --force")}`);
126
+ }
127
+ if (result.checks?.some(c => c.name === "applied_config" && !c.ok)) {
128
+ lines.push(` - 配置文件未应用,检查 OPENCLAW.template.json`);
129
+ }
92
130
  }
131
+
93
132
  return lines.join("\n");
94
133
  }