@zshuangmu/agenthub 0.4.7 → 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 +1 -1
- package/src/cli.js +8 -0
- package/src/lib/debug.js +21 -1
package/package.json
CHANGED
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}`);
|
package/src/lib/debug.js
CHANGED
|
@@ -3,7 +3,27 @@
|
|
|
3
3
|
* 性能日志工具,用于调试和性能分析
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
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
|
* 计时器存储
|