jinzd-ai-cli 0.4.211 → 0.4.212

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.
Files changed (27) hide show
  1. package/README.md +23 -0
  2. package/README.zh-CN.md +23 -0
  3. package/dist/{batch-DE4RXKZD.js → batch-WIKFEOAZ.js} +2 -2
  4. package/dist/{chat-index-UBCWHBLR.js → chat-index-R2E27VXN.js} +1 -1
  5. package/dist/{chunk-E5XCM4A6.js → chunk-GBBVCZ4W.js} +1 -1
  6. package/dist/{chunk-C3OU2OPF.js → chunk-HW2ALWQJ.js} +2 -2
  7. package/dist/{chunk-6NS6643Y.js → chunk-HX6N6QEY.js} +1 -1
  8. package/dist/{chunk-JBWA73GK.js → chunk-IFZX26K7.js} +1 -1
  9. package/dist/{chunk-ZY2N2N6T.js → chunk-KE4B3NOQ.js} +1 -1
  10. package/dist/{chunk-BE6ERF7M.js → chunk-LU6FBJQ5.js} +1 -1
  11. package/dist/{chunk-ZOPYREL5.js → chunk-N5LB3PPL.js} +258 -52
  12. package/dist/{chunk-UOROWTGG.js → chunk-NYCBOVNF.js} +26 -3
  13. package/dist/{chunk-W7UKO3PS.js → chunk-OQGVGPEK.js} +5 -0
  14. package/dist/{ci-XMUEX526.js → ci-X3LNUFZV.js} +2 -2
  15. package/dist/{constants-AWTIQIWG.js → constants-KDWG4KR4.js} +1 -1
  16. package/dist/{doctor-cli-SSI6ETFT.js → doctor-cli-TJTWIW7U.js} +4 -4
  17. package/dist/electron-server.js +468 -174
  18. package/dist/{hub-INUJND2G.js → hub-JWSV4MKC.js} +1 -1
  19. package/dist/index.js +142 -17
  20. package/dist/{run-tests-PACN4UYX.js → run-tests-D7YBY4XB.js} +1 -1
  21. package/dist/{run-tests-3MHWUF43.js → run-tests-H4Q2PRX6.js} +2 -2
  22. package/dist/{server-7USZJJAH.js → server-OFKGDRYI.js} +4 -4
  23. package/dist/{server-BTSKOPQI.js → server-VNCN7AY5.js} +99 -10
  24. package/dist/{task-orchestrator-OV4O25MX.js → task-orchestrator-AL2E642M.js} +4 -4
  25. package/dist/{usage-T2P6FTE7.js → usage-LB6REWPO.js} +2 -2
  26. package/dist/web/client/app.js +1 -1
  27. package/package.json +1 -1
package/README.md CHANGED
@@ -388,6 +388,29 @@ Built-in profiles:
388
388
  ```
389
389
 
390
390
  Actions are `allow`, `confirm`, or `deny`. Domain entries match the exact host or subdomains; port lists match the resolved URL port. Private/internal hosts such as `localhost`, `127.0.0.1`, `10.0.0.0/8`, `192.168.0.0/16`, and private IPv6 ranges are blocked unless `allowPrivateNetwork` is true.
391
+ ### Trusted Hooks Lifecycle
392
+
393
+ Legacy `preToolExecution` / `postToolExecution` hooks still work. New lifecycle hooks live under `hooks.events.<EventName>` and receive a JSON payload through `AICLI_HOOK_EVENT_JSON`; if the command prints JSON, ai-cli reads decisions such as `allow`, `deny`, `ask`, `warning`, or `warnings`.
394
+
395
+ ```json
396
+ {
397
+ "hooks": {
398
+ "events": {
399
+ "PreToolUse": {
400
+ "command": "node ./scripts/aicli-pre-tool-hook.mjs",
401
+ "source": "project",
402
+ "description": "Block unsafe local commands"
403
+ },
404
+ "UserPromptSubmit": "node ./scripts/aicli-prompt-hook.mjs",
405
+ "Stop": { "command": "npm test -- --runInBand", "timeoutMs": 10000 }
406
+ }
407
+ }
408
+ }
409
+ ```
410
+
411
+ Supported lifecycle names are `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PermissionRequest`, `PostToolUse`, `PreCompact`, `PostCompact`, `Stop`, `SubagentStart`, and `SubagentStop`. Project-sourced hooks must be trusted before execution; ai-cli stores trust records locally under the user config directory, keyed by hook hash, so changing hook content requires re-trust.
412
+
413
+ Use `/hooks list`, `/hooks inspect <id>`, `/hooks trust <id>`, `/hooks untrust <id>`, and `/hooks disable` to manage them. `/status`, `/security status`, and Web status show pending project hooks that require trust.
391
414
  **Recommended minimal config** — auto-approve all read-only tools to reduce y/N prompts:
392
415
 
393
416
  ```json
package/README.zh-CN.md CHANGED
@@ -370,6 +370,29 @@ HTTPS_PROXY=http://127.0.0.1:10809 aicli
370
370
  }
371
371
  ```
372
372
 
373
+ ### 可信 Hooks 生命周期
374
+
375
+ 旧版 `preToolExecution` / `postToolExecution` 仍然兼容。新版生命周期 hooks 配置在 `hooks.events.<EventName>` 下,通过 `AICLI_HOOK_EVENT_JSON` 接收 JSON 事件;命令 stdout 如果输出 JSON,ai-cli 会读取 `allow`、`deny`、`ask`、`warning` 或 `warnings` 等决策。
376
+
377
+ ```json
378
+ {
379
+ "hooks": {
380
+ "events": {
381
+ "PreToolUse": {
382
+ "command": "node ./scripts/aicli-pre-tool-hook.mjs",
383
+ "source": "project",
384
+ "description": "Block unsafe local commands"
385
+ },
386
+ "UserPromptSubmit": "node ./scripts/aicli-prompt-hook.mjs",
387
+ "Stop": { "command": "npm test -- --runInBand", "timeoutMs": 10000 }
388
+ }
389
+ }
390
+ }
391
+ ```
392
+
393
+ 支持的事件包括 `SessionStart`、`UserPromptSubmit`、`PreToolUse`、`PermissionRequest`、`PostToolUse`、`PreCompact`、`PostCompact`、`Stop`、`SubagentStart`、`SubagentStop`。`source: "project"` 的 hook 默认不会执行,必须通过 `/hooks trust <id>` 写入本地信任记录;命令内容变化后 hash 会变化,需要重新信任。
394
+
395
+ 使用 `/hooks list`、`/hooks inspect <id>`、`/hooks trust <id>`、`/hooks untrust <id>`、`/hooks disable` 管理 hooks。`/status`、`/security status` 和 Web 状态栏会显示待信任项目 hooks 数量。
373
396
  ### 环境变量
374
397
 
375
398
  | 变量 | 说明 |
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigManager
4
- } from "./chunk-UOROWTGG.js";
4
+ } from "./chunk-NYCBOVNF.js";
5
5
  import "./chunk-TZQHYZKT.js";
6
- import "./chunk-E5XCM4A6.js";
6
+ import "./chunk-GBBVCZ4W.js";
7
7
  import {
8
8
  atomicWriteFileSync
9
9
  } from "./chunk-IW3Q7AE5.js";
@@ -5,7 +5,7 @@ import {
5
5
  getChatIndexStatus,
6
6
  loadChatIndex,
7
7
  searchChatMemory
8
- } from "./chunk-W7UKO3PS.js";
8
+ } from "./chunk-OQGVGPEK.js";
9
9
  import "./chunk-JV5N65KN.js";
10
10
  import "./chunk-6BUTA5VW.js";
11
11
  export {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.211";
4
+ var VERSION = "0.4.212";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  truncateForPersist
4
- } from "./chunk-ZOPYREL5.js";
4
+ } from "./chunk-N5LB3PPL.js";
5
5
  import {
6
6
  APP_NAME,
7
7
  CONFIG_DIR_NAME,
@@ -13,7 +13,7 @@ import {
13
13
  MCP_PROTOCOL_VERSION,
14
14
  MCP_TOOL_PREFIX,
15
15
  VERSION
16
- } from "./chunk-E5XCM4A6.js";
16
+ } from "./chunk-GBBVCZ4W.js";
17
17
  import {
18
18
  atomicWriteFileSync
19
19
  } from "./chunk-IW3Q7AE5.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-E5XCM4A6.js";
4
+ } from "./chunk-GBBVCZ4W.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CONFIG_DIR_NAME
4
- } from "./chunk-E5XCM4A6.js";
4
+ } from "./chunk-GBBVCZ4W.js";
5
5
  import {
6
6
  atomicWriteFileSync
7
7
  } from "./chunk-IW3Q7AE5.js";
@@ -6,7 +6,7 @@ import { platform } from "os";
6
6
  import chalk from "chalk";
7
7
 
8
8
  // src/core/constants.ts
9
- var VERSION = "0.4.211";
9
+ var VERSION = "0.4.212";
10
10
  var APP_NAME = "ai-cli";
11
11
  var CONFIG_DIR_NAME = ".aicli";
12
12
  var CONFIG_FILE_NAME = "config.json";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CONFIG_DIR_NAME,
4
4
  VERSION
5
- } from "./chunk-E5XCM4A6.js";
5
+ } from "./chunk-GBBVCZ4W.js";
6
6
 
7
7
  // src/diagnostics/crash-log.ts
8
8
  import {