@zshuangmu/agenthub 0.4.5 → 0.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zshuangmu/agenthub",
3
- "version": "0.4.5",
3
+ "version": "0.4.8",
4
4
  "description": "AI Agent 打包与分发平台 - 一句话打包上传,一键下载获得能力",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/cli.js CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  } from "./index.js";
31
31
 
32
32
  import { success, error, warning, info as infoColor, highlight, muted, symbols } from "./lib/colors.js";
33
+ import { setVerbose, debug } from "./lib/debug.js";
33
34
 
34
35
  import { createRequire } from "node:module";
35
36
  const require = createRequire(import.meta.url);
@@ -76,6 +77,7 @@ AgentHub v${VERSION} - AI Agent 打包与分发平台
76
77
  选项:
77
78
  --help, -h 显示帮助信息
78
79
  --version, -v 显示版本号
80
+ --verbose 显示详细日志信息
79
81
 
80
82
  详细帮助:
81
83
  agenthub <command> --help
@@ -321,6 +323,12 @@ async function main() {
321
323
  const { positionals, options } = parseArgs(process.argv.slice(2));
322
324
  const [command, ...rest] = positionals;
323
325
 
326
+ // 设置 verbose 模式
327
+ if (options.verbose) {
328
+ setVerbose(true);
329
+ debug("Verbose mode enabled");
330
+ }
331
+
324
332
  // 全局选项 - only show version if --version/-v is a boolean flag, not a string value
325
333
  if (options.version === true) {
326
334
  console.log(`AgentHub v${VERSION}`);
@@ -100,7 +100,7 @@ export async function packCommand(options) {
100
100
  openclawTemplate: template,
101
101
  skills: workspaceFiles.skills,
102
102
  prompts: workspaceFiles.prompts,
103
- tags: options.tags ? options.tags.split(",").map((t) => t.trim()) : [],
103
+ tags: options.tags && typeof options.tags === "string" && options.tags.trim() ? options.tags.split(",").map((t) => t.trim()) : [],
104
104
  category: options.category,
105
105
  version,
106
106
  featured: options.featured === true,
package/src/lib/debug.js CHANGED
@@ -3,7 +3,27 @@
3
3
  * 性能日志工具,用于调试和性能分析
4
4
  */
5
5
 
6
- const DEBUG = process.env.AGENTHUB_DEBUG === "true" || process.env.AGENTHUB_DEBUG === "1";
6
+ let verboseMode = false;
7
+
8
+ /**
9
+ * 设置 verbose 模式
10
+ * @param {boolean} enabled - 是否启用
11
+ */
12
+ export function setVerbose(enabled) {
13
+ verboseMode = enabled;
14
+ if (enabled) {
15
+ process.env.AGENTHUB_DEBUG = "true";
16
+ }
17
+ }
18
+
19
+ /**
20
+ * 获取是否处于 debug 模式
21
+ */
22
+ export function isDebug() {
23
+ return verboseMode || process.env.AGENTHUB_DEBUG === "true" || process.env.AGENTHUB_DEBUG === "1";
24
+ }
25
+
26
+ const DEBUG = isDebug();
7
27
 
8
28
  /**
9
29
  * 计时器存储