@zshuangmu/agenthub 0.4.14 → 0.4.16
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/LICENSE +21 -21
- package/README.md +268 -268
- package/package.json +41 -41
- package/src/api-server.js +518 -244
- package/src/cli.js +714 -671
- package/src/commands/api.js +9 -9
- package/src/commands/doctor.js +335 -335
- package/src/commands/info.js +15 -15
- package/src/commands/install.js +56 -56
- package/src/commands/list.js +78 -78
- package/src/commands/pack.js +249 -156
- package/src/commands/publish-remote.js +9 -9
- package/src/commands/publish.js +7 -7
- package/src/commands/rollback.js +59 -59
- package/src/commands/search.js +14 -14
- package/src/commands/serve.js +9 -9
- package/src/commands/stats.js +105 -105
- package/src/commands/uninstall.js +76 -76
- package/src/commands/update.js +54 -54
- package/src/commands/verify.js +133 -133
- package/src/commands/versions.js +75 -75
- package/src/commands/web.js +9 -9
- package/src/index.js +18 -18
- package/src/lib/auth.js +301 -0
- package/src/lib/bundle-transfer.js +58 -58
- package/src/lib/colors.js +60 -60
- package/src/lib/database.js +450 -244
- package/src/lib/debug.js +135 -135
- package/src/lib/fs-utils.js +107 -50
- package/src/lib/html.js +2163 -1824
- package/src/lib/http.js +168 -168
- package/src/lib/install.js +60 -60
- package/src/lib/manifest.js +124 -124
- package/src/lib/openclaw-config.js +40 -40
- package/src/lib/permissions.js +105 -0
- package/src/lib/privacy-engine.js +220 -0
- package/src/lib/registry.js +130 -130
- package/src/lib/remote.js +11 -11
- package/src/lib/security-scanner.js +233 -233
- package/src/lib/signing.js +158 -0
- package/src/lib/version-manager.js +77 -77
- package/src/server.js +176 -176
- package/src/web-server.js +135 -135
package/src/commands/verify.js
CHANGED
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { pathExists, readJson } from "../lib/fs-utils.js";
|
|
3
|
-
import { parseSpec } from "../lib/registry.js";
|
|
4
|
-
import { infoCommand } from "./info.js";
|
|
5
|
-
import { success, error, warning, info as infoColor, highlight, muted, symbols } from "../lib/colors.js";
|
|
6
|
-
|
|
7
|
-
export async function verifyCommand(agentSpec, options = {}) {
|
|
8
|
-
const targetWorkspace = path.resolve(options.targetWorkspace || process.cwd());
|
|
9
|
-
const installRecordPath = path.join(targetWorkspace, ".agenthub", "install.json");
|
|
10
|
-
const appliedConfigPath = path.join(targetWorkspace, ".agenthub", "OPENCLAW.applied.json");
|
|
11
|
-
|
|
12
|
-
const checks = [];
|
|
13
|
-
|
|
14
|
-
if (!(await pathExists(installRecordPath))) {
|
|
15
|
-
return {
|
|
16
|
-
ok: false,
|
|
17
|
-
verified: false,
|
|
18
|
-
targetWorkspace,
|
|
19
|
-
reason: "install record missing",
|
|
20
|
-
checks: [{ name: "install_record", ok: false, detail: installRecordPath }],
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const installRecord = await readJson(installRecordPath);
|
|
25
|
-
const expectedSlug = agentSpec ? parseSpec(agentSpec).slug : installRecord.slug;
|
|
26
|
-
if (expectedSlug && installRecord.slug !== expectedSlug) {
|
|
27
|
-
checks.push({
|
|
28
|
-
name: "slug_match",
|
|
29
|
-
ok: false,
|
|
30
|
-
detail: `installed=${installRecord.slug}, expected=${expectedSlug}`,
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
ok: false,
|
|
34
|
-
verified: false,
|
|
35
|
-
targetWorkspace,
|
|
36
|
-
installRecord,
|
|
37
|
-
checks,
|
|
38
|
-
reason: "installed slug mismatch",
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
checks.push({ name: "install_record", ok: true, detail: installRecordPath });
|
|
43
|
-
|
|
44
|
-
const configExists = await pathExists(appliedConfigPath);
|
|
45
|
-
checks.push({ name: "applied_config", ok: configExists, detail: appliedConfigPath });
|
|
46
|
-
|
|
47
|
-
let manifest = null;
|
|
48
|
-
try {
|
|
49
|
-
manifest = await infoCommand(`${installRecord.slug}:${installRecord.version}`, options);
|
|
50
|
-
checks.push({ name: "manifest_lookup", ok: true, detail: `${installRecord.slug}@${installRecord.version}` });
|
|
51
|
-
} catch (error) {
|
|
52
|
-
checks.push({
|
|
53
|
-
name: "manifest_lookup",
|
|
54
|
-
ok: false,
|
|
55
|
-
detail: error.message,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const requiredFiles = ["AGENTS.md", "SOUL.md", "USER.md"];
|
|
60
|
-
for (const fileName of requiredFiles) {
|
|
61
|
-
const filePath = path.join(targetWorkspace, fileName);
|
|
62
|
-
checks.push({
|
|
63
|
-
name: `workspace_file:${fileName}`,
|
|
64
|
-
ok: await pathExists(filePath),
|
|
65
|
-
detail: filePath,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const verified = checks.every((check) => check.ok);
|
|
70
|
-
return {
|
|
71
|
-
ok: verified,
|
|
72
|
-
verified,
|
|
73
|
-
targetWorkspace,
|
|
74
|
-
installRecord,
|
|
75
|
-
manifest,
|
|
76
|
-
checks,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function formatVerifyOutput(result) {
|
|
81
|
-
const lines = [];
|
|
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 信息
|
|
91
|
-
if (result.installRecord) {
|
|
92
|
-
lines.push(`${highlight("Agent:")} ${result.installRecord.slug}@${result.installRecord.version}`);
|
|
93
|
-
}
|
|
94
|
-
lines.push(`${highlight("Workspace:")} ${result.targetWorkspace}`);
|
|
95
|
-
lines.push("");
|
|
96
|
-
|
|
97
|
-
// 检查结果
|
|
98
|
-
lines.push(`${infoColor("检查项目:")}`);
|
|
99
|
-
for (const check of result.checks || []) {
|
|
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
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 失败原因
|
|
111
|
-
if (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
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return lines.join("\n");
|
|
133
|
-
}
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { pathExists, readJson } from "../lib/fs-utils.js";
|
|
3
|
+
import { parseSpec } from "../lib/registry.js";
|
|
4
|
+
import { infoCommand } from "./info.js";
|
|
5
|
+
import { success, error, warning, info as infoColor, highlight, muted, symbols } from "../lib/colors.js";
|
|
6
|
+
|
|
7
|
+
export async function verifyCommand(agentSpec, options = {}) {
|
|
8
|
+
const targetWorkspace = path.resolve(options.targetWorkspace || process.cwd());
|
|
9
|
+
const installRecordPath = path.join(targetWorkspace, ".agenthub", "install.json");
|
|
10
|
+
const appliedConfigPath = path.join(targetWorkspace, ".agenthub", "OPENCLAW.applied.json");
|
|
11
|
+
|
|
12
|
+
const checks = [];
|
|
13
|
+
|
|
14
|
+
if (!(await pathExists(installRecordPath))) {
|
|
15
|
+
return {
|
|
16
|
+
ok: false,
|
|
17
|
+
verified: false,
|
|
18
|
+
targetWorkspace,
|
|
19
|
+
reason: "install record missing",
|
|
20
|
+
checks: [{ name: "install_record", ok: false, detail: installRecordPath }],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const installRecord = await readJson(installRecordPath);
|
|
25
|
+
const expectedSlug = agentSpec ? parseSpec(agentSpec).slug : installRecord.slug;
|
|
26
|
+
if (expectedSlug && installRecord.slug !== expectedSlug) {
|
|
27
|
+
checks.push({
|
|
28
|
+
name: "slug_match",
|
|
29
|
+
ok: false,
|
|
30
|
+
detail: `installed=${installRecord.slug}, expected=${expectedSlug}`,
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
ok: false,
|
|
34
|
+
verified: false,
|
|
35
|
+
targetWorkspace,
|
|
36
|
+
installRecord,
|
|
37
|
+
checks,
|
|
38
|
+
reason: "installed slug mismatch",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
checks.push({ name: "install_record", ok: true, detail: installRecordPath });
|
|
43
|
+
|
|
44
|
+
const configExists = await pathExists(appliedConfigPath);
|
|
45
|
+
checks.push({ name: "applied_config", ok: configExists, detail: appliedConfigPath });
|
|
46
|
+
|
|
47
|
+
let manifest = null;
|
|
48
|
+
try {
|
|
49
|
+
manifest = await infoCommand(`${installRecord.slug}:${installRecord.version}`, options);
|
|
50
|
+
checks.push({ name: "manifest_lookup", ok: true, detail: `${installRecord.slug}@${installRecord.version}` });
|
|
51
|
+
} catch (error) {
|
|
52
|
+
checks.push({
|
|
53
|
+
name: "manifest_lookup",
|
|
54
|
+
ok: false,
|
|
55
|
+
detail: error.message,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const requiredFiles = ["AGENTS.md", "SOUL.md", "USER.md"];
|
|
60
|
+
for (const fileName of requiredFiles) {
|
|
61
|
+
const filePath = path.join(targetWorkspace, fileName);
|
|
62
|
+
checks.push({
|
|
63
|
+
name: `workspace_file:${fileName}`,
|
|
64
|
+
ok: await pathExists(filePath),
|
|
65
|
+
detail: filePath,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const verified = checks.every((check) => check.ok);
|
|
70
|
+
return {
|
|
71
|
+
ok: verified,
|
|
72
|
+
verified,
|
|
73
|
+
targetWorkspace,
|
|
74
|
+
installRecord,
|
|
75
|
+
manifest,
|
|
76
|
+
checks,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function formatVerifyOutput(result) {
|
|
81
|
+
const lines = [];
|
|
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 信息
|
|
91
|
+
if (result.installRecord) {
|
|
92
|
+
lines.push(`${highlight("Agent:")} ${result.installRecord.slug}@${result.installRecord.version}`);
|
|
93
|
+
}
|
|
94
|
+
lines.push(`${highlight("Workspace:")} ${result.targetWorkspace}`);
|
|
95
|
+
lines.push("");
|
|
96
|
+
|
|
97
|
+
// 检查结果
|
|
98
|
+
lines.push(`${infoColor("检查项目:")}`);
|
|
99
|
+
for (const check of result.checks || []) {
|
|
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
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 失败原因
|
|
111
|
+
if (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
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return lines.join("\n");
|
|
133
|
+
}
|
package/src/commands/versions.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Versions Command
|
|
3
|
-
* 查看 Agent 的所有可用版本
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { pathExists, readJson } from "../lib/fs-utils.js";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import { fetchRemoteJson } from "../lib/remote.js";
|
|
9
|
-
import { parseSpec, compareVersionsDesc } from "../lib/registry.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 将 agent 条目转换为版本信息
|
|
13
|
-
*/
|
|
14
|
-
function mapToVersionInfo(entries, slug) {
|
|
15
|
-
return entries
|
|
16
|
-
.filter((entry) => entry.slug === slug)
|
|
17
|
-
.map((entry) => ({
|
|
18
|
-
version: entry.version,
|
|
19
|
-
name: entry.name,
|
|
20
|
-
description: entry.description,
|
|
21
|
-
updatedAt: entry.updatedAt || entry.createdAt,
|
|
22
|
-
}))
|
|
23
|
-
.sort(compareVersionsDesc);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export async function versionsCommand(agentSpec, options = {}) {
|
|
27
|
-
const { slug } = parseSpec(agentSpec);
|
|
28
|
-
|
|
29
|
-
if (!options.registry) {
|
|
30
|
-
const result = await fetchRemoteJson(`/api/agents?q=${encodeURIComponent(slug)}`, options);
|
|
31
|
-
return mapToVersionInfo(result.agents || [], slug);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const registryDir = path.resolve(options.registry);
|
|
35
|
-
const indexPath = path.join(registryDir, "index.json");
|
|
36
|
-
if (!(await pathExists(indexPath))) {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const index = await readJson(indexPath);
|
|
41
|
-
return mapToVersionInfo(index.agents, slug);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function formatVersionsOutput(slug, versions, currentVersion = null) {
|
|
45
|
-
const lines = [];
|
|
46
|
-
lines.push(`\n📋 ${slug} 可用版本:\n`);
|
|
47
|
-
lines.push("─".repeat(50));
|
|
48
|
-
|
|
49
|
-
for (const v of versions) {
|
|
50
|
-
const isLatest = v === versions[0];
|
|
51
|
-
const isCurrent = currentVersion && v.version === currentVersion;
|
|
52
|
-
const marker = isCurrent ? "✓" : isLatest ? "*" : " ";
|
|
53
|
-
const latestTag = isLatest ? " (latest)" : "";
|
|
54
|
-
const currentTag = isCurrent ? " (installed)" : "";
|
|
55
|
-
|
|
56
|
-
lines.push(` ${marker} ${v.version}${latestTag}${currentTag}`);
|
|
57
|
-
if (v.description) {
|
|
58
|
-
lines.push(` ${v.description.substring(0, 60)}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
lines.push("─".repeat(50));
|
|
63
|
-
|
|
64
|
-
if (currentVersion) {
|
|
65
|
-
lines.push(`\n当前安装: ${currentVersion}`);
|
|
66
|
-
if (versions.length > 0 && versions[0].version !== currentVersion) {
|
|
67
|
-
lines.push(`可更新到: ${versions[0].version}`);
|
|
68
|
-
lines.push(`\n更新命令: agenthub update ${slug}`);
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
lines.push(`\n安装命令: agenthub install ${slug}`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return lines.join("\n");
|
|
75
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Versions Command
|
|
3
|
+
* 查看 Agent 的所有可用版本
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { pathExists, readJson } from "../lib/fs-utils.js";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { fetchRemoteJson } from "../lib/remote.js";
|
|
9
|
+
import { parseSpec, compareVersionsDesc } from "../lib/registry.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 将 agent 条目转换为版本信息
|
|
13
|
+
*/
|
|
14
|
+
function mapToVersionInfo(entries, slug) {
|
|
15
|
+
return entries
|
|
16
|
+
.filter((entry) => entry.slug === slug)
|
|
17
|
+
.map((entry) => ({
|
|
18
|
+
version: entry.version,
|
|
19
|
+
name: entry.name,
|
|
20
|
+
description: entry.description,
|
|
21
|
+
updatedAt: entry.updatedAt || entry.createdAt,
|
|
22
|
+
}))
|
|
23
|
+
.sort(compareVersionsDesc);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function versionsCommand(agentSpec, options = {}) {
|
|
27
|
+
const { slug } = parseSpec(agentSpec);
|
|
28
|
+
|
|
29
|
+
if (!options.registry) {
|
|
30
|
+
const result = await fetchRemoteJson(`/api/agents?q=${encodeURIComponent(slug)}`, options);
|
|
31
|
+
return mapToVersionInfo(result.agents || [], slug);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const registryDir = path.resolve(options.registry);
|
|
35
|
+
const indexPath = path.join(registryDir, "index.json");
|
|
36
|
+
if (!(await pathExists(indexPath))) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const index = await readJson(indexPath);
|
|
41
|
+
return mapToVersionInfo(index.agents, slug);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function formatVersionsOutput(slug, versions, currentVersion = null) {
|
|
45
|
+
const lines = [];
|
|
46
|
+
lines.push(`\n📋 ${slug} 可用版本:\n`);
|
|
47
|
+
lines.push("─".repeat(50));
|
|
48
|
+
|
|
49
|
+
for (const v of versions) {
|
|
50
|
+
const isLatest = v === versions[0];
|
|
51
|
+
const isCurrent = currentVersion && v.version === currentVersion;
|
|
52
|
+
const marker = isCurrent ? "✓" : isLatest ? "*" : " ";
|
|
53
|
+
const latestTag = isLatest ? " (latest)" : "";
|
|
54
|
+
const currentTag = isCurrent ? " (installed)" : "";
|
|
55
|
+
|
|
56
|
+
lines.push(` ${marker} ${v.version}${latestTag}${currentTag}`);
|
|
57
|
+
if (v.description) {
|
|
58
|
+
lines.push(` ${v.description.substring(0, 60)}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
lines.push("─".repeat(50));
|
|
63
|
+
|
|
64
|
+
if (currentVersion) {
|
|
65
|
+
lines.push(`\n当前安装: ${currentVersion}`);
|
|
66
|
+
if (versions.length > 0 && versions[0].version !== currentVersion) {
|
|
67
|
+
lines.push(`可更新到: ${versions[0].version}`);
|
|
68
|
+
lines.push(`\n更新命令: agenthub update ${slug}`);
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
lines.push(`\n安装命令: agenthub install ${slug}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return lines.join("\n");
|
|
75
|
+
}
|
package/src/commands/web.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createWebServer } from "../web-server.js";
|
|
2
|
-
|
|
3
|
-
export async function webCommand(options) {
|
|
4
|
-
const port = parseInt(options.port || "3000", 10);
|
|
5
|
-
const apiBase = options.apiBase || "http://127.0.0.1:3001";
|
|
6
|
-
const host = options.host || "0.0.0.0";
|
|
7
|
-
|
|
8
|
-
return createWebServer({ port, apiBase, host });
|
|
9
|
-
}
|
|
1
|
+
import { createWebServer } from "../web-server.js";
|
|
2
|
+
|
|
3
|
+
export async function webCommand(options) {
|
|
4
|
+
const port = parseInt(options.port || "3000", 10);
|
|
5
|
+
const apiBase = options.apiBase || "http://127.0.0.1:3001";
|
|
6
|
+
const host = options.host || "0.0.0.0";
|
|
7
|
+
|
|
8
|
+
return createWebServer({ port, apiBase, host });
|
|
9
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { packCommand } from "./commands/pack.js";
|
|
2
|
-
export { publishCommand } from "./commands/publish.js";
|
|
3
|
-
export { publishRemoteCommand } from "./commands/publish-remote.js";
|
|
4
|
-
export { searchCommand } from "./commands/search.js";
|
|
5
|
-
export { infoCommand } from "./commands/info.js";
|
|
6
|
-
export { installCommand } from "./commands/install.js";
|
|
7
|
-
export { uninstallCommand } from "./commands/uninstall.js";
|
|
8
|
-
export { verifyCommand, formatVerifyOutput } from "./commands/verify.js";
|
|
9
|
-
export { serveCommand } from "./commands/serve.js";
|
|
10
|
-
export { versionsCommand, formatVersionsOutput } from "./commands/versions.js";
|
|
11
|
-
export { updateCommand } from "./commands/update.js";
|
|
12
|
-
export { rollbackCommand } from "./commands/rollback.js";
|
|
13
|
-
export { statsCommand, formatStatsOutput } from "./commands/stats.js";
|
|
14
|
-
export { listCommand, formatListOutput } from "./commands/list.js";
|
|
15
|
-
export { apiCommand } from "./commands/api.js";
|
|
16
|
-
export { webCommand } from "./commands/web.js";
|
|
17
|
-
export { doctorCommand } from "./commands/doctor.js";
|
|
18
|
-
export { parseSpec, compareVersionsDesc, getLatestVersion, sortByDownloadsAndTime } from "./lib/registry.js";
|
|
1
|
+
export { packCommand } from "./commands/pack.js";
|
|
2
|
+
export { publishCommand } from "./commands/publish.js";
|
|
3
|
+
export { publishRemoteCommand } from "./commands/publish-remote.js";
|
|
4
|
+
export { searchCommand } from "./commands/search.js";
|
|
5
|
+
export { infoCommand } from "./commands/info.js";
|
|
6
|
+
export { installCommand } from "./commands/install.js";
|
|
7
|
+
export { uninstallCommand } from "./commands/uninstall.js";
|
|
8
|
+
export { verifyCommand, formatVerifyOutput } from "./commands/verify.js";
|
|
9
|
+
export { serveCommand } from "./commands/serve.js";
|
|
10
|
+
export { versionsCommand, formatVersionsOutput } from "./commands/versions.js";
|
|
11
|
+
export { updateCommand } from "./commands/update.js";
|
|
12
|
+
export { rollbackCommand } from "./commands/rollback.js";
|
|
13
|
+
export { statsCommand, formatStatsOutput } from "./commands/stats.js";
|
|
14
|
+
export { listCommand, formatListOutput } from "./commands/list.js";
|
|
15
|
+
export { apiCommand } from "./commands/api.js";
|
|
16
|
+
export { webCommand } from "./commands/web.js";
|
|
17
|
+
export { doctorCommand } from "./commands/doctor.js";
|
|
18
|
+
export { parseSpec, compareVersionsDesc, getLatestVersion, sortByDownloadsAndTime } from "./lib/registry.js";
|