Files
ai-terminal-assistant/package.json
T
kurihada 630ce9fd4b feat: 实现 Hook 系统
参考 open-code 的实现,添加工具执行前后的 hook 功能:

- 添加 Hook 类型定义 (tool.execute.before/after, file.edited/created/deleted 等)
- 实现 HookManager 管理器,支持插件注册和事件触发
- 实现配置文件加载器,支持 .ai-assistant.json/jsonc 格式
- 支持 glob 模式匹配文件触发 shell 命令
- 集成到 Agent 工具执行流程
- 添加 minimatch 依赖用于 glob 匹配
- 编写完整测试用例 (27 个测试)

配置示例:
```json
{
  "hooks": {
    "file_edited": {
      "*.ts": [{ "command": ["npx", "tsc", "--noEmit"] }]
    }
  }
}
```
2025-12-11 23:12:04 +08:00

60 lines
1.5 KiB
JSON

{
"name": "ai-terminal-assistant",
"version": "1.0.0",
"description": "A terminal-based AI coding assistant powered by Claude",
"main": "dist/index.js",
"bin": {
"ai-assist": "./dist/index.js"
},
"type": "module",
"scripts": {
"build": "tsc && mkdir -p dist/tools/descriptions && cp -r src/tools/descriptions/* dist/tools/descriptions/",
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
"lint": "eslint src/**/*.ts",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
},
"keywords": [
"ai",
"cli",
"assistant",
"claude",
"terminal"
],
"author": "",
"license": "MIT",
"dependencies": {
"@ai-sdk/anthropic": "^2.0.54",
"@ai-sdk/deepseek": "^1.0.31",
"@ai-sdk/openai": "^2.0.80",
"@tavily/core": "^0.6.0",
"ai": "^5.0.108",
"chalk": "^5.3.0",
"commander": "^12.1.0",
"inquirer": "^12.0.0",
"js-yaml": "^4.1.1",
"minimatch": "^10.1.1",
"ora": "^8.1.0",
"qwen-ai-provider-v5": "^1.0.2",
"tree-sitter-bash": "^0.25.1",
"uuid": "^13.0.0",
"vscode-jsonrpc": "^8.2.1",
"vscode-languageserver-protocol": "^3.17.5",
"web-tree-sitter": "^0.25.10",
"yaml": "^2.8.2",
"zod": "^4.1.13"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/json-schema": "^7.0.15",
"@types/node": "^22.0.0",
"@types/uuid": "^10.0.0",
"@vitest/coverage-v8": "^4.0.15",
"tsx": "^4.19.0",
"typescript": "^5.6.0",
"vitest": "^4.0.15"
}
}