ai-engineering-init 1.2.4 → 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);
@@ -1,38 +1,22 @@
1
1
  {
2
+ "version": 1,
2
3
  "hooks": {
3
4
  "beforeSubmitPrompt": [
4
5
  {
5
6
  "matcher": "",
6
- "hooks": [
7
- {
8
- "type": "command",
9
- "command": "node .cursor/hooks/cursor-skill-eval.js"
10
- }
11
- ]
7
+ "command": "node .cursor/hooks/cursor-skill-eval.js"
12
8
  }
13
9
  ],
14
10
  "preToolUse": [
15
11
  {
16
12
  "matcher": "Shell|Write|CreateFile|EditFile",
17
- "hooks": [
18
- {
19
- "type": "command",
20
- "command": "node .cursor/hooks/cursor-pre-tool-use.js",
21
- "timeout": 5000
22
- }
23
- ]
13
+ "command": "node .cursor/hooks/cursor-pre-tool-use.js"
24
14
  }
25
15
  ],
26
16
  "stop": [
27
17
  {
28
18
  "matcher": "",
29
- "hooks": [
30
- {
31
- "type": "command",
32
- "command": "node .claude/hooks/stop.js",
33
- "timeout": 10000
34
- }
35
- ]
19
+ "command": "node .cursor/hooks/stop.js"
36
20
  }
37
21
  ]
38
22
  }
package/README.md CHANGED
@@ -193,6 +193,25 @@ cd ai-engineering-init
193
193
  3. Subagents 会根据任务自动委托:`/code-reviewer`、`/project-manager`
194
194
  4. 在 Settings → MCP 中确认 MCP 服务器已连接
195
195
 
196
+ #### OpenSpec 规格驱动开发(opsx 命令)
197
+
198
+ 基于 [OpenSpec](https://github.com/Fission-AI/OpenSpec) 的规格驱动开发工作流,在 Cursor Chat 中通过 `/opsx-*` 命令使用:
199
+
200
+ | 命令 | 用途 |
201
+ |------|------|
202
+ | `/opsx-new` | 新建变更,描述需求并创建规格文档 |
203
+ | `/opsx-ff` | 快速推进,一次性生成所有制品(规格+任务) |
204
+ | `/opsx-apply` | 开始实现,按任务清单编码 |
205
+ | `/opsx-continue` | 继续变更,创建下一个制品 |
206
+ | `/opsx-verify` | 验证实现是否与规格匹配 |
207
+ | `/opsx-sync` | 将 delta 规格同步到主规格 |
208
+ | `/opsx-archive` | 归档已完成的变更 |
209
+ | `/opsx-bulk-archive` | 批量归档多个变更 |
210
+ | `/opsx-explore` | 探索模式,思维伙伴式问题分析 |
211
+ | `/opsx-onboard` | 新手引导,完整工作流演示 |
212
+
213
+ **标准开发流程**:`/opsx-new` → `/opsx-ff` → `/opsx-apply` → `/opsx-verify` → `/opsx-archive`
214
+
196
215
  ### OpenAI Codex
197
216
 
198
217
  1. 修改 `AGENTS.md` 中的项目说明
@@ -200,11 +219,29 @@ cd ai-engineering-init
200
219
  3. (可选)以 MCP Server 接入 Claude Code:`.claude/settings.json` → `mcpServers.codex`,重启后 Claude 可直接调用 `codex` / `codex-reply` 工具
201
220
  - **Windows 用户**:将 `command` 路径改为 `where codex` 查询到的实际路径(如 `C:\Users\YourName\AppData\Roaming\npm\codex.cmd`)
202
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
+
203
240
  ## 更新日志
204
241
 
205
242
  查看完整更新历史:[CHANGELOG.md](./CHANGELOG.md)
206
243
 
207
- **v1.2.4 优化**:优化 leniu 技能系统触发词精准度;合并冗余技能;新增定制报表技能。
244
+ **v1.2.6 修复**:Cursor stop hook 自包含,不再依赖 Claude Code 安装;修复完成音效无法触发的问题。
208
245
 
209
246
  ## License
210
247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-engineering-init",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "AI 工程化配置初始化工具 — 一键为 Claude Code、OpenAI Codex 等 AI 工具初始化 Skills 和项目规范",
5
5
  "keywords": [
6
6
  "claude-code",