ai-engineering-init 1.2.5 → 1.2.6

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.
Binary file
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Stop Hook - Cursor 回答结束时触发
4
+ * 功能: nul 文件清理 + 完成音效
5
+ */
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const { execSync } = require('child_process');
10
+
11
+ // 清理可能误创建的 nul 文件(Windows 下 > nul 可能创建该文件)
12
+ const findAndDeleteNul = (dir, depth = 0) => {
13
+ if (depth > 5) return;
14
+ try {
15
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
16
+ for (const entry of entries) {
17
+ const fullPath = path.join(dir, entry.name);
18
+ if (entry.isFile() && entry.name === 'nul') {
19
+ fs.unlinkSync(fullPath);
20
+ console.error(`🧹 已清理: ${fullPath}`);
21
+ } else if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules') {
22
+ findAndDeleteNul(fullPath, depth + 1);
23
+ }
24
+ }
25
+ } catch {
26
+ // 访问失败时静默忽略
27
+ }
28
+ };
29
+ findAndDeleteNul(process.cwd());
30
+
31
+ // 播放完成音效(可选)
32
+ // 优先使用 .cursor/audio/,若不存在则尝试 .claude/audio/(兼容两者都安装的情况)
33
+ const cursorAudio = path.join(process.cwd(), '.cursor', 'audio', 'completed.wav');
34
+ const claudeAudio = path.join(process.cwd(), '.claude', 'audio', 'completed.wav');
35
+ const audioFile = fs.existsSync(cursorAudio) ? cursorAudio : (fs.existsSync(claudeAudio) ? claudeAudio : null);
36
+
37
+ try {
38
+ if (audioFile) {
39
+ const platform = process.platform;
40
+ if (platform === 'darwin') {
41
+ execSync(`afplay "${audioFile}"`, { stdio: ['pipe', 'pipe', 'pipe'] });
42
+ } else if (platform === 'win32') {
43
+ execSync(`powershell -c "(New-Object Media.SoundPlayer '${audioFile.replace(/'/g, "''")}').PlaySync()"`, {
44
+ stdio: ['pipe', 'pipe', 'pipe']
45
+ });
46
+ } else if (platform === 'linux') {
47
+ try {
48
+ execSync(`aplay "${audioFile}"`, { stdio: ['pipe', 'pipe', 'pipe'] });
49
+ } catch {
50
+ try {
51
+ execSync(`paplay "${audioFile}"`, { stdio: ['pipe', 'pipe', 'pipe'] });
52
+ } catch {
53
+ // 播放失败,静默忽略
54
+ }
55
+ }
56
+ }
57
+ }
58
+ } catch {
59
+ // 播放失败时静默忽略
60
+ }
61
+
62
+ process.exit(0);
@@ -16,7 +16,7 @@
16
16
  "stop": [
17
17
  {
18
18
  "matcher": "",
19
- "command": "node .claude/hooks/stop.js"
19
+ "command": "node .cursor/hooks/stop.js"
20
20
  }
21
21
  ]
22
22
  }
package/README.md CHANGED
@@ -219,11 +219,29 @@ cd ai-engineering-init
219
219
  3. (可选)以 MCP Server 接入 Claude Code:`.claude/settings.json` → `mcpServers.codex`,重启后 Claude 可直接调用 `codex` / `codex-reply` 工具
220
220
  - **Windows 用户**:将 `command` 路径改为 `where codex` 查询到的实际路径(如 `C:\Users\YourName\AppData\Roaming\npm\codex.cmd`)
221
221
 
222
+ ## 更新已安装的项目
223
+
224
+ 当有新版本发布时,在已安装的项目根目录执行:
225
+
226
+ ```bash
227
+ # 必须加 @latest,确保使用最新源文件
228
+ npx ai-engineering-init@latest update
229
+
230
+ # 只更新指定工具
231
+ npx ai-engineering-init@latest update --tool cursor
232
+ npx ai-engineering-init@latest update --tool claude
233
+
234
+ # 强制更新,包括 settings.json / CLAUDE.md 等保留文件
235
+ npx ai-engineering-init@latest update --force
236
+ ```
237
+
238
+ > **注意**:不加 `@latest` 会使用 npx 本地缓存的旧版本,源文件不是最新的。
239
+
222
240
  ## 更新日志
223
241
 
224
242
  查看完整更新历史:[CHANGELOG.md](./CHANGELOG.md)
225
243
 
226
- **v1.2.4 优化**:优化 leniu 技能系统触发词精准度;合并冗余技能;新增定制报表技能。
244
+ **v1.2.6 修复**:Cursor stop hook 自包含,不再依赖 Claude Code 安装;修复完成音效无法触发的问题。
227
245
 
228
246
  ## License
229
247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-engineering-init",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "AI 工程化配置初始化工具 — 一键为 Claude Code、OpenAI Codex 等 AI 工具初始化 Skills 和项目规范",
5
5
  "keywords": [
6
6
  "claude-code",