ai-engineering-init 1.1.0
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/.claude/agents/code-reviewer.md +139 -0
- package/.claude/agents/project-manager.md +159 -0
- package/.claude/audio/completed.wav +0 -0
- package/.claude/commands/add-todo.md +255 -0
- package/.claude/commands/check.md +210 -0
- package/.claude/commands/crud.md +454 -0
- package/.claude/commands/dev.md +503 -0
- package/.claude/commands/init-docs.md +681 -0
- package/.claude/commands/next.md +251 -0
- package/.claude/commands/progress.md +242 -0
- package/.claude/commands/start.md +199 -0
- package/.claude/commands/sync.md +307 -0
- package/.claude/commands/update-status.md +428 -0
- package/.claude/docs/Mixin/344/275/277/347/224/250/346/214/207/345/215/227.md +299 -0
- package/.claude/docs/README.md +167 -0
- package/.claude/docs//345/211/215/347/253/257/345/274/200/345/217/221/346/214/207/345/215/227.md +599 -0
- package/.claude/docs//345/220/216/347/253/257/345/274/200/345/217/221/346/214/207/345/215/227.md +726 -0
- package/.claude/docs//345/267/245/344/275/234/346/265/201/345/274/200/345/217/221/346/214/207/345/215/227.md +714 -0
- package/.claude/docs//345/267/245/345/205/267/347/261/273/344/275/277/347/224/250/346/214/207/345/215/227.md +463 -0
- package/.claude/docs//346/225/260/346/215/256/345/272/223/350/256/276/350/256/241/350/247/204/350/214/203.md +390 -0
- package/.claude/docs//346/226/260/345/212/237/350/203/275/345/274/200/345/217/221/346/265/201/347/250/213/350/247/204/350/214/203.md +688 -0
- package/.claude/docs//346/226/260/351/241/271/347/233/256/345/274/200/345/217/221/346/265/201/347/250/213.md +365 -0
- package/.claude/docs//346/241/206/346/236/266/350/257/264/346/230/216.md +393 -0
- package/.claude/docs//350/267/257/347/224/261/351/205/215/347/275/256/346/214/207/345/215/227.md +246 -0
- package/.claude/framework-config.json +73 -0
- package/.claude/hooks/pre-tool-use.js +117 -0
- package/.claude/hooks/skill-forced-eval.js +167 -0
- package/.claude/hooks/stop.js +58 -0
- package/.claude/settings.json +41 -0
- package/.claude/skills/add-skill/SKILL.md +352 -0
- package/.claude/skills/api-development/SKILL.md +560 -0
- package/.claude/skills/architecture-design/SKILL.md +756 -0
- package/.claude/skills/backend-annotations/SKILL.md +674 -0
- package/.claude/skills/banana-image/CHANGELOG.md +37 -0
- package/.claude/skills/banana-image/README.md +146 -0
- package/.claude/skills/banana-image/SKILL.md +164 -0
- package/.claude/skills/banana-image/assets/logo.png +0 -0
- package/.claude/skills/banana-image/references/advanced-usage.md +189 -0
- package/.claude/skills/banana-image/scripts/apply_template.py +125 -0
- package/.claude/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.claude/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.claude/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.claude/skills/banana-image/scripts/package.json +18 -0
- package/.claude/skills/banana-image/scripts/requirements.txt +10 -0
- package/.claude/skills/banana-image/templates/poster.json +22 -0
- package/.claude/skills/banana-image/templates/product.json +17 -0
- package/.claude/skills/banana-image/templates/social.json +22 -0
- package/.claude/skills/banana-image/templates/thumbnail.json +17 -0
- package/.claude/skills/brainstorm/SKILL.md +648 -0
- package/.claude/skills/bug-detective/SKILL.md +1206 -0
- package/.claude/skills/code-patterns/SKILL.md +590 -0
- package/.claude/skills/collaborating-with-codex/SKILL.md +174 -0
- package/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.claude/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.claude/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.claude/skills/crud-development/SKILL.md +649 -0
- package/.claude/skills/data-permission/SKILL.md +599 -0
- package/.claude/skills/database-ops/SKILL.md +407 -0
- package/.claude/skills/error-handler/SKILL.md +371 -0
- package/.claude/skills/file-oss-management/SKILL.md +863 -0
- package/.claude/skills/git-workflow/SKILL.md +375 -0
- package/.claude/skills/json-serialization/SKILL.md +357 -0
- package/.claude/skills/leniu-api-development/SKILL.md +803 -0
- package/.claude/skills/leniu-architecture-design/SKILL.md +598 -0
- package/.claude/skills/leniu-backend-annotations/SKILL.md +664 -0
- package/.claude/skills/leniu-code-patterns/SKILL.md +365 -0
- package/.claude/skills/leniu-crud-development/SKILL.md +1110 -0
- package/.claude/skills/leniu-data-permission/SKILL.md +256 -0
- package/.claude/skills/leniu-database-ops/SKILL.md +426 -0
- package/.claude/skills/leniu-error-handler/SKILL.md +462 -0
- package/.claude/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.claude/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.claude/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.claude/skills/leniu-java-entity/SKILL.md +751 -0
- package/.claude/skills/leniu-java-export/SKILL.md +560 -0
- package/.claude/skills/leniu-java-logging/SKILL.md +832 -0
- package/.claude/skills/leniu-java-mq/SKILL.md +338 -0
- package/.claude/skills/leniu-java-mybatis/SKILL.md +640 -0
- package/.claude/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/.claude/skills/leniu-java-task/SKILL.md +367 -0
- package/.claude/skills/leniu-java-total-line/SKILL.md +195 -0
- package/.claude/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/.claude/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/.claude/skills/leniu-mealtime/SKILL.md +215 -0
- package/.claude/skills/leniu-redis-cache/SKILL.md +316 -0
- package/.claude/skills/leniu-security-guard/SKILL.md +520 -0
- package/.claude/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/.claude/skills/openspec-apply-change/SKILL.md +156 -0
- package/.claude/skills/openspec-archive-change/SKILL.md +114 -0
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.claude/skills/openspec-continue-change/SKILL.md +118 -0
- package/.claude/skills/openspec-explore/SKILL.md +290 -0
- package/.claude/skills/openspec-ff-change/SKILL.md +101 -0
- package/.claude/skills/openspec-new-change/SKILL.md +74 -0
- package/.claude/skills/openspec-onboard/SKILL.md +529 -0
- package/.claude/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.claude/skills/openspec-verify-change/SKILL.md +168 -0
- package/.claude/skills/performance-doctor/SKILL.md +627 -0
- package/.claude/skills/project-navigator/SKILL.md +305 -0
- package/.claude/skills/redis-cache/SKILL.md +839 -0
- package/.claude/skills/scheduled-jobs/SKILL.md +633 -0
- package/.claude/skills/security-guard/SKILL.md +748 -0
- package/.claude/skills/sms-mail/SKILL.md +766 -0
- package/.claude/skills/social-login/SKILL.md +668 -0
- package/.claude/skills/store-pc/SKILL.md +366 -0
- package/.claude/skills/task-tracker/SKILL.md +307 -0
- package/.claude/skills/tech-decision/SKILL.md +393 -0
- package/.claude/skills/tenant-management/SKILL.md +603 -0
- package/.claude/skills/test-development/SKILL.md +755 -0
- package/.claude/skills/ui-pc/SKILL.md +438 -0
- package/.claude/skills/utils-toolkit/SKILL.md +615 -0
- package/.claude/skills/websocket-sse/SKILL.md +716 -0
- package/.claude/skills/workflow-engine/SKILL.md +676 -0
- package/.claude/templates//345/276/205/345/212/236/346/270/205/345/215/225/346/250/241/346/235/277.md +56 -0
- package/.claude/templates//351/234/200/346/261/202/346/226/207/346/241/243/346/250/241/346/235/277.md +85 -0
- package/.claude/templates//351/241/271/347/233/256/347/212/266/346/200/201/346/250/241/346/235/277.md +43 -0
- package/.codex/skills/add-skill/SKILL.md +352 -0
- package/.codex/skills/add-todo/SKILL.md +269 -0
- package/.codex/skills/api-development/SKILL.md +693 -0
- package/.codex/skills/architecture-design/SKILL.md +628 -0
- package/.codex/skills/backend-annotations/SKILL.md +664 -0
- package/.codex/skills/banana-image/CHANGELOG.md +37 -0
- package/.codex/skills/banana-image/README.md +146 -0
- package/.codex/skills/banana-image/SKILL.md +164 -0
- package/.codex/skills/banana-image/assets/logo.png +0 -0
- package/.codex/skills/banana-image/references/advanced-usage.md +189 -0
- package/.codex/skills/banana-image/scripts/apply_template.py +125 -0
- package/.codex/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.codex/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.codex/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.codex/skills/banana-image/scripts/package.json +18 -0
- package/.codex/skills/banana-image/scripts/requirements.txt +10 -0
- package/.codex/skills/banana-image/templates/poster.json +22 -0
- package/.codex/skills/banana-image/templates/product.json +17 -0
- package/.codex/skills/banana-image/templates/social.json +22 -0
- package/.codex/skills/banana-image/templates/thumbnail.json +17 -0
- package/.codex/skills/brainstorm/SKILL.md +648 -0
- package/.codex/skills/bug-detective/SKILL.md +1206 -0
- package/.codex/skills/check/SKILL.md +367 -0
- package/.codex/skills/code-patterns/SKILL.md +442 -0
- package/.codex/skills/collaborating-with-codex/SKILL.md +174 -0
- package/.codex/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.codex/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.codex/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.codex/skills/crud/SKILL.md +265 -0
- package/.codex/skills/crud-development/SKILL.md +637 -0
- package/.codex/skills/data-permission/SKILL.md +591 -0
- package/.codex/skills/database-ops/SKILL.md +553 -0
- package/.codex/skills/dev/SKILL.md +187 -0
- package/.codex/skills/error-handler/SKILL.md +361 -0
- package/.codex/skills/file-oss-management/SKILL.md +863 -0
- package/.codex/skills/git-workflow/SKILL.md +375 -0
- package/.codex/skills/init-docs/SKILL.md +194 -0
- package/.codex/skills/json-serialization/SKILL.md +357 -0
- package/.codex/skills/leniu-api-development/SKILL.md +803 -0
- package/.codex/skills/leniu-architecture-design/SKILL.md +594 -0
- package/.codex/skills/leniu-backend-annotations/SKILL.md +662 -0
- package/.codex/skills/leniu-code-patterns/SKILL.md +365 -0
- package/.codex/skills/leniu-crud-development/SKILL.md +1110 -0
- package/.codex/skills/leniu-data-permission/SKILL.md +256 -0
- package/.codex/skills/leniu-database-ops/SKILL.md +426 -0
- package/.codex/skills/leniu-error-handler/SKILL.md +462 -0
- package/.codex/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.codex/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.codex/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.codex/skills/leniu-java-entity/SKILL.md +751 -0
- package/.codex/skills/leniu-java-export/SKILL.md +560 -0
- package/.codex/skills/leniu-java-logging/SKILL.md +832 -0
- package/.codex/skills/leniu-java-mq/SKILL.md +338 -0
- package/.codex/skills/leniu-java-mybatis/SKILL.md +640 -0
- package/.codex/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/.codex/skills/leniu-java-task/SKILL.md +367 -0
- package/.codex/skills/leniu-java-total-line/SKILL.md +195 -0
- package/.codex/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/.codex/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/.codex/skills/leniu-mealtime/SKILL.md +215 -0
- package/.codex/skills/leniu-redis-cache/SKILL.md +316 -0
- package/.codex/skills/leniu-security-guard/SKILL.md +520 -0
- package/.codex/skills/leniu-utils-toolkit/SKILL.md +378 -0
- package/.codex/skills/next/SKILL.md +137 -0
- package/.codex/skills/openspec-apply-change/SKILL.md +156 -0
- package/.codex/skills/openspec-archive-change/SKILL.md +114 -0
- package/.codex/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.codex/skills/openspec-continue-change/SKILL.md +118 -0
- package/.codex/skills/openspec-explore/SKILL.md +290 -0
- package/.codex/skills/openspec-ff-change/SKILL.md +101 -0
- package/.codex/skills/openspec-new-change/SKILL.md +74 -0
- package/.codex/skills/openspec-onboard/SKILL.md +529 -0
- package/.codex/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.codex/skills/openspec-verify-change/SKILL.md +168 -0
- package/.codex/skills/performance-doctor/SKILL.md +627 -0
- package/.codex/skills/progress/SKILL.md +193 -0
- package/.codex/skills/project-navigator/SKILL.md +286 -0
- package/.codex/skills/redis-cache/SKILL.md +829 -0
- package/.codex/skills/scheduled-jobs/SKILL.md +633 -0
- package/.codex/skills/security-guard/SKILL.md +739 -0
- package/.codex/skills/sms-mail/SKILL.md +766 -0
- package/.codex/skills/social-login/SKILL.md +668 -0
- package/.codex/skills/start/SKILL.md +154 -0
- package/.codex/skills/store-pc/SKILL.md +491 -0
- package/.codex/skills/sync/SKILL.md +149 -0
- package/.codex/skills/task-tracker/SKILL.md +307 -0
- package/.codex/skills/tech-decision/SKILL.md +393 -0
- package/.codex/skills/tenant-management/SKILL.md +603 -0
- package/.codex/skills/test-development/SKILL.md +755 -0
- package/.codex/skills/ui-pc/SKILL.md +475 -0
- package/.codex/skills/update-status/SKILL.md +159 -0
- package/.codex/skills/utils-toolkit/SKILL.md +593 -0
- package/.codex/skills/websocket-sse/SKILL.md +716 -0
- package/.codex/skills/workflow-engine/SKILL.md +676 -0
- package/.cursor/agents/code-reviewer.md +139 -0
- package/.cursor/agents/project-manager.md +159 -0
- package/.cursor/commands/opsx-apply.md +152 -0
- package/.cursor/commands/opsx-archive.md +157 -0
- package/.cursor/commands/opsx-bulk-archive.md +242 -0
- package/.cursor/commands/opsx-continue.md +114 -0
- package/.cursor/commands/opsx-explore.md +174 -0
- package/.cursor/commands/opsx-ff.md +94 -0
- package/.cursor/commands/opsx-new.md +69 -0
- package/.cursor/commands/opsx-onboard.md +525 -0
- package/.cursor/commands/opsx-sync.md +134 -0
- package/.cursor/commands/opsx-verify.md +164 -0
- package/.cursor/mcp.json +22 -0
- package/.cursor/skills/add-skill/SKILL.md +352 -0
- package/.cursor/skills/api-development/SKILL.md +560 -0
- package/.cursor/skills/architecture-design/SKILL.md +756 -0
- package/.cursor/skills/backend-annotations/SKILL.md +674 -0
- package/.cursor/skills/banana-image/CHANGELOG.md +37 -0
- package/.cursor/skills/banana-image/README.md +146 -0
- package/.cursor/skills/banana-image/SKILL.md +164 -0
- package/.cursor/skills/banana-image/assets/logo.png +0 -0
- package/.cursor/skills/banana-image/references/advanced-usage.md +189 -0
- package/.cursor/skills/banana-image/scripts/apply_template.py +125 -0
- package/.cursor/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.cursor/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.cursor/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.cursor/skills/banana-image/scripts/package.json +18 -0
- package/.cursor/skills/banana-image/scripts/requirements.txt +10 -0
- package/.cursor/skills/banana-image/templates/poster.json +22 -0
- package/.cursor/skills/banana-image/templates/product.json +17 -0
- package/.cursor/skills/banana-image/templates/social.json +22 -0
- package/.cursor/skills/banana-image/templates/thumbnail.json +17 -0
- package/.cursor/skills/brainstorm/SKILL.md +648 -0
- package/.cursor/skills/bug-detective/SKILL.md +1206 -0
- package/.cursor/skills/code-patterns/SKILL.md +590 -0
- package/.cursor/skills/collaborating-with-codex/SKILL.md +174 -0
- package/.cursor/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.cursor/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.cursor/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.cursor/skills/crud-development/SKILL.md +649 -0
- package/.cursor/skills/data-permission/SKILL.md +599 -0
- package/.cursor/skills/database-ops/SKILL.md +407 -0
- package/.cursor/skills/error-handler/SKILL.md +371 -0
- package/.cursor/skills/file-oss-management/SKILL.md +863 -0
- package/.cursor/skills/git-workflow/SKILL.md +375 -0
- package/.cursor/skills/json-serialization/SKILL.md +357 -0
- package/.cursor/skills/leniu-api-development/SKILL.md +803 -0
- package/.cursor/skills/leniu-architecture-design/SKILL.md +598 -0
- package/.cursor/skills/leniu-backend-annotations/SKILL.md +664 -0
- package/.cursor/skills/leniu-code-patterns/SKILL.md +365 -0
- package/.cursor/skills/leniu-crud-development/SKILL.md +1110 -0
- package/.cursor/skills/leniu-data-permission/SKILL.md +256 -0
- package/.cursor/skills/leniu-database-ops/SKILL.md +426 -0
- package/.cursor/skills/leniu-error-handler/SKILL.md +462 -0
- package/.cursor/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.cursor/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.cursor/skills/leniu-java-entity/SKILL.md +751 -0
- package/.cursor/skills/leniu-java-export/SKILL.md +560 -0
- package/.cursor/skills/leniu-java-logging/SKILL.md +832 -0
- package/.cursor/skills/leniu-java-mq/SKILL.md +338 -0
- package/.cursor/skills/leniu-java-mybatis/SKILL.md +640 -0
- package/.cursor/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/.cursor/skills/leniu-java-task/SKILL.md +367 -0
- package/.cursor/skills/leniu-java-total-line/SKILL.md +195 -0
- package/.cursor/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/.cursor/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/.cursor/skills/leniu-mealtime/SKILL.md +215 -0
- package/.cursor/skills/leniu-redis-cache/SKILL.md +316 -0
- package/.cursor/skills/leniu-security-guard/SKILL.md +520 -0
- package/.cursor/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +156 -0
- package/.cursor/skills/openspec-archive-change/SKILL.md +114 -0
- package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.cursor/skills/openspec-continue-change/SKILL.md +118 -0
- package/.cursor/skills/openspec-explore/SKILL.md +290 -0
- package/.cursor/skills/openspec-ff-change/SKILL.md +101 -0
- package/.cursor/skills/openspec-new-change/SKILL.md +74 -0
- package/.cursor/skills/openspec-onboard/SKILL.md +529 -0
- package/.cursor/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.cursor/skills/openspec-verify-change/SKILL.md +168 -0
- package/.cursor/skills/performance-doctor/SKILL.md +627 -0
- package/.cursor/skills/project-navigator/SKILL.md +305 -0
- package/.cursor/skills/redis-cache/SKILL.md +839 -0
- package/.cursor/skills/scheduled-jobs/SKILL.md +633 -0
- package/.cursor/skills/security-guard/SKILL.md +748 -0
- package/.cursor/skills/sms-mail/SKILL.md +766 -0
- package/.cursor/skills/social-login/SKILL.md +668 -0
- package/.cursor/skills/store-pc/SKILL.md +366 -0
- package/.cursor/skills/task-tracker/SKILL.md +307 -0
- package/.cursor/skills/tech-decision/SKILL.md +393 -0
- package/.cursor/skills/tenant-management/SKILL.md +603 -0
- package/.cursor/skills/test-development/SKILL.md +755 -0
- package/.cursor/skills/ui-pc/SKILL.md +438 -0
- package/.cursor/skills/utils-toolkit/SKILL.md +615 -0
- package/.cursor/skills/websocket-sse/SKILL.md +716 -0
- package/.cursor/skills/workflow-engine/SKILL.md +676 -0
- package/AGENTS.md +669 -0
- package/CLAUDE.md +205 -0
- package/README.md +205 -0
- package/bin/index.js +179 -0
- package/init.sh +178 -0
- package/package.json +27 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PreToolUse Hook - 工具使用前触发
|
|
4
|
+
* 功能:
|
|
5
|
+
* 1. 阻止危险命令
|
|
6
|
+
* 2. 提醒敏感操作
|
|
7
|
+
* 3. 自动修正常见错误
|
|
8
|
+
*
|
|
9
|
+
* 适配项目: RuoYi-Vue-Plus (纯后端项目)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
|
|
14
|
+
// 从 stdin 读取输入
|
|
15
|
+
let inputData = '';
|
|
16
|
+
try {
|
|
17
|
+
inputData = fs.readFileSync(0, 'utf8');
|
|
18
|
+
} catch {
|
|
19
|
+
console.log(JSON.stringify({ continue: true }));
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let input;
|
|
24
|
+
try {
|
|
25
|
+
input = JSON.parse(inputData);
|
|
26
|
+
} catch {
|
|
27
|
+
console.log(JSON.stringify({ continue: true }));
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const toolName = input.tool_name;
|
|
32
|
+
const toolInput = input.tool_input || {};
|
|
33
|
+
|
|
34
|
+
// Bash 命令检查
|
|
35
|
+
if (toolName === 'Bash') {
|
|
36
|
+
const command = toolInput.command || '';
|
|
37
|
+
|
|
38
|
+
// 检测 > nul 错误用法(Windows 会创建名为 nul 的文件)
|
|
39
|
+
const nulPattern = /[12]?\s*>\s*nul\b/i;
|
|
40
|
+
if (nulPattern.test(command)) {
|
|
41
|
+
const output = {
|
|
42
|
+
decision: 'block',
|
|
43
|
+
reason: `🚫 **命令被阻止**:检测到 \`> nul\`\n\n**问题**:Windows 下某些 Shell 会创建名为 \`nul\` 的文件\n\n**解决方案**:\n- 移除输出重定向,或\n- 使用 \`> /dev/null 2>&1\`(跨平台)\n\n原命令: \`${command}\``
|
|
44
|
+
};
|
|
45
|
+
console.log(JSON.stringify(output));
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// 危险命令模式
|
|
50
|
+
const dangerousPatterns = [
|
|
51
|
+
{ pattern: /rm\s+-rf\s+\/(?!\w)/, reason: '删除根目录' },
|
|
52
|
+
{ pattern: /rm\s+-rf\s+\*/, reason: '删除所有文件' },
|
|
53
|
+
{ pattern: /drop\s+database/i, reason: '删除数据库' },
|
|
54
|
+
{ pattern: /truncate\s+table/i, reason: '清空表数据' },
|
|
55
|
+
{ pattern: /git\s+push\s+--force\s+(origin\s+)?(main|master)/i, reason: '强制推送到主分支' },
|
|
56
|
+
{ pattern: /git\s+reset\s+--hard\s+HEAD~\d+/, reason: '硬重置多个提交' },
|
|
57
|
+
{ pattern: />\s*\/dev\/sd[a-z]/, reason: '直接写入磁盘设备' },
|
|
58
|
+
{ pattern: /mkfs\./, reason: '格式化文件系统' },
|
|
59
|
+
{ pattern: /:(){ :|:& };:/, reason: 'Fork 炸弹' },
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
for (const { pattern, reason } of dangerousPatterns) {
|
|
63
|
+
if (pattern.test(command)) {
|
|
64
|
+
const output = {
|
|
65
|
+
decision: 'block',
|
|
66
|
+
reason: `⚠️ **危险操作被阻止**\n\n命令: \`${command}\`\n原因: ${reason}\n\n如确需执行,请手动在终端运行`
|
|
67
|
+
};
|
|
68
|
+
console.log(JSON.stringify(output));
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 警告但不阻止的命令
|
|
74
|
+
const warningPatterns = [
|
|
75
|
+
{ pattern: /git\s+push\s+--force/, warning: 'Force push 可能覆盖他人代码' },
|
|
76
|
+
{ pattern: /npm\s+publish/, warning: '即将发布到 npm' },
|
|
77
|
+
{ pattern: /docker\s+system\s+prune/, warning: '将清理所有未使用的 Docker 资源' },
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
for (const { pattern, warning } of warningPatterns) {
|
|
81
|
+
if (pattern.test(command)) {
|
|
82
|
+
const output = {
|
|
83
|
+
continue: true,
|
|
84
|
+
systemMessage: `⚠️ **注意**: ${warning}`
|
|
85
|
+
};
|
|
86
|
+
console.log(JSON.stringify(output));
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Write 工具检查
|
|
93
|
+
if (toolName === 'Write') {
|
|
94
|
+
const filePath = toolInput.file_path || '';
|
|
95
|
+
|
|
96
|
+
// 检查是否写入敏感配置文件
|
|
97
|
+
const sensitiveFiles = [
|
|
98
|
+
'.env.production',
|
|
99
|
+
'application-prod.yml',
|
|
100
|
+
'credentials.json',
|
|
101
|
+
'secrets.json'
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
for (const sensitive of sensitiveFiles) {
|
|
105
|
+
if (filePath.endsWith(sensitive)) {
|
|
106
|
+
const output = {
|
|
107
|
+
continue: true,
|
|
108
|
+
systemMessage: `⚠️ **敏感文件**: 正在写入 \`${sensitive}\`\n\n请确保不要提交敏感信息到 Git`
|
|
109
|
+
};
|
|
110
|
+
console.log(JSON.stringify(output));
|
|
111
|
+
process.exit(0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 默认:允许继续
|
|
117
|
+
console.log(JSON.stringify({ continue: true }));
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* UserPromptSubmit Hook - 强制技能评估 (跨平台版本)
|
|
4
|
+
* 功能: 开发场景下,将 Skills 激活率从约 25% 提升到 90% 以上
|
|
5
|
+
*
|
|
6
|
+
* 适配项目: RuoYi-Vue-Plus (纯后端项目)
|
|
7
|
+
* 架构: 三层架构 (Controller → Service → Mapper)
|
|
8
|
+
* 包名: org.dromara.*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
|
|
13
|
+
// 从 stdin 读取用户输入
|
|
14
|
+
let inputData = '';
|
|
15
|
+
try {
|
|
16
|
+
inputData = fs.readFileSync(0, 'utf8');
|
|
17
|
+
} catch {
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let input;
|
|
22
|
+
try {
|
|
23
|
+
input = JSON.parse(inputData);
|
|
24
|
+
} catch {
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const prompt = (input.prompt || '').trim();
|
|
29
|
+
|
|
30
|
+
// 检测是否是恢复会话(防止上下文溢出死循环)
|
|
31
|
+
const skipPatterns = [
|
|
32
|
+
'continued from a previous conversation',
|
|
33
|
+
'ran out of context',
|
|
34
|
+
'No code restore',
|
|
35
|
+
'Conversation compacted',
|
|
36
|
+
'commands restored',
|
|
37
|
+
'context window',
|
|
38
|
+
'session is being continued'
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const isRecoverySession = skipPatterns.some(pattern =>
|
|
42
|
+
prompt.toLowerCase().includes(pattern.toLowerCase())
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
if (isRecoverySession) {
|
|
46
|
+
// 恢复会话,跳过技能评估以防止死循环
|
|
47
|
+
process.exit(0);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 检测是否是斜杠命令
|
|
51
|
+
// 规则:以 / 开头,且后面不包含第二个 /(排除 /iot/device 这样的路径)
|
|
52
|
+
const isSlashCommand = /^\/[^\/\s]+$/.test(prompt.split(/\s/)[0]);
|
|
53
|
+
|
|
54
|
+
if (isSlashCommand) {
|
|
55
|
+
// 斜杠命令,跳过技能评估
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const instructions = `## 强制技能激活流程(必须执行)
|
|
60
|
+
|
|
61
|
+
### 步骤 1 - 评估(必须在响应中明确展示)
|
|
62
|
+
|
|
63
|
+
针对用户问题,列出匹配的技能:\`技能名: 理由\`,无匹配则写"无匹配技能"
|
|
64
|
+
|
|
65
|
+
可用技能(纯后端项目):
|
|
66
|
+
- crud-development: CRUD/业务模块/Entity/Service/Controller 开发
|
|
67
|
+
- api-development: API设计/RESTful/接口规范
|
|
68
|
+
- database-ops: 数据库/SQL/建表/字典/菜单
|
|
69
|
+
- backend-annotations: 注解/@RateLimiter/@DataScope
|
|
70
|
+
- utils-toolkit: 工具类/StringUtils/MapstructUtils
|
|
71
|
+
- file-oss-management: 文件上传/OSS/云存储/MinIO
|
|
72
|
+
- ai-langchain4j: AI/大模型/ChatGPT/DeepSeek
|
|
73
|
+
- media-processing: 图片处理/二维码/水印/Excel
|
|
74
|
+
- bug-detective: Bug/报错/异常/不工作
|
|
75
|
+
- error-handler: 异常处理/ServiceException
|
|
76
|
+
- performance-doctor: 性能/慢查询/优化/缓存
|
|
77
|
+
- data-permission: 数据权限/@DataPermission/DataScope/行级权限
|
|
78
|
+
- security-guard: 安全/Sa-Token/认证授权/加密
|
|
79
|
+
- architecture-design: 架构/模块划分/重构
|
|
80
|
+
- code-patterns: 规范/禁止/命名/Git提交
|
|
81
|
+
- project-navigator: 项目结构/文件在哪/定位
|
|
82
|
+
- git-workflow: Git/提交/commit/分支
|
|
83
|
+
- task-tracker: 任务跟踪/记录进度/继续任务
|
|
84
|
+
- tech-decision: 技术选型/方案对比
|
|
85
|
+
- brainstorm: 头脑风暴/创意/方案设计
|
|
86
|
+
- collaborating-with-codex: Codex协作/多模型/算法分析
|
|
87
|
+
- collaborating-with-gemini: Gemini协作/前端原型/UI设计
|
|
88
|
+
- workflow-engine: 工作流/审批流/Flowable/流程
|
|
89
|
+
- test-development: 测试/单元测试/@Test/JUnit5/Mockito
|
|
90
|
+
- json-serialization: JSON/序列化/反序列化/JsonUtils/日期格式/BigDecimal/精度/类型转换
|
|
91
|
+
- redis-cache: Redis/缓存/@Cacheable/@CacheEvict/RedisUtils/分布式锁/RLock/限流
|
|
92
|
+
- scheduled-jobs: 定时任务/SnailJob/@Scheduled/@JobExecutor/任务调度/重试机制
|
|
93
|
+
- add-skill: 添加技能/创建技能/新技能/技能开发/写技能
|
|
94
|
+
- banana-image: 生成图片/AI图片/产品图/海报/缩略图/4K/高清/制作图片
|
|
95
|
+
- websocket-sse: WebSocket/SSE/实时推送/消息通知/在线状态/双向通信/实时通信
|
|
96
|
+
- sms-mail: 短信/邮件/SMS/验证码/通知/SMS4j/MailUtils/邮件发送/短信发送
|
|
97
|
+
- social-login: 第三方登录/微信登录/QQ登录/OAuth/OAuth2/JustAuth/社交登录/扫码登录/授权登录
|
|
98
|
+
- tenant-management: 多租户/租户隔离/TenantEntity/TenantHelper/租户ID/tenantId/跨租户/动态租户/SaaS
|
|
99
|
+
- leniu-java-amount-handling: leniu-金额/leniu-分转元/leniu-元转分/leniu-Long金额/leniu-money/fen/leniu-yunshitang/net.xnzn
|
|
100
|
+
- leniu-java-code-style: leniu-代码风格/leniu-命名规范/leniu-类命名/leniu-方法命名/leniu-包结构/leniu-yunshitang/net.xnzn
|
|
101
|
+
- leniu-java-concurrent: leniu-并发/leniu-CompletableFuture/leniu-线程池/leniu-并发安全/leniu-分布式锁/leniu-yunshitang/net.xnzn
|
|
102
|
+
- leniu-java-entity: leniu-Entity/leniu-VO/leniu-DTO/leniu-Param/leniu-实体类/leniu-@TableName/leniu-@TableField/leniu-yunshitang/net.xnzn
|
|
103
|
+
- leniu-java-export: leniu-导出/leniu-Export/leniu-Excel导出/leniu-异步导出/leniu-@ExcelProperty/leniu-yunshitang/net.xnzn
|
|
104
|
+
- leniu-java-logging: leniu-日志/leniu-@Slf4j/leniu-log.info/leniu-log.error/leniu-日志级别/leniu-yunshitang/net.xnzn
|
|
105
|
+
- leniu-java-mq: leniu-消息队列/leniu-MQ/leniu-MqUtil/leniu-@MqConsumer/leniu-延迟消息/leniu-yunshitang/net.xnzn
|
|
106
|
+
- leniu-java-mybatis: leniu-MyBatis/leniu-MyBatisPlus/leniu-Mapper/leniu-LambdaQueryWrapper/leniu-XML映射/leniu-yunshitang/net.xnzn
|
|
107
|
+
- leniu-java-report-query-param: leniu-报表查询/leniu-Param类/leniu-分页参数/leniu-时间范围/leniu-ReportBaseParam/leniu-yunshitang/net.xnzn
|
|
108
|
+
- leniu-java-task: leniu-定时任务/leniu-XXL-Job/leniu-@XxlJob/leniu-TenantLoader/leniu-任务调度/leniu-yunshitang/net.xnzn
|
|
109
|
+
- leniu-java-total-line: leniu-合计行/leniu-totalLine/leniu-报表合计/leniu-SUM合计/leniu-ReportBaseTotalVO/leniu-yunshitang/net.xnzn
|
|
110
|
+
- leniu-crud-development: leniu-yunshitang/leniu-CRUD/leniu-增删改查/leniu-新建模块/leniu-Entity/leniu-DTO/leniu-VO/leniu-Service/leniu-Mapper/leniu-Controller/leniu-分页查询/LeRequest/PageDTO/net.xnzn/leniu-yunshitang
|
|
111
|
+
- leniu-database-ops: leniu-yunshitang/leniu-数据库/leniu-SQL/leniu-建表/leniu-Entity/leniu-双库/leniu-商户库/leniu-系统库/net.xnzn/leniu-yunshitang
|
|
112
|
+
- leniu-utils-toolkit: leniu-yunshitang/leniu-工具类/leniu-BeanUtil/leniu-StrUtil/leniu-CollUtil/leniu-ObjectUtil/leniu-RedisUtil/leniu-JacksonUtil/leniu-LeBeanUtil/net.xnzn/leniu-yunshitang
|
|
113
|
+
- leniu-error-handler: leniu-yunshitang/leniu-异常/leniu-LeException/leniu-全局异常/leniu-参数校验/leniu-日志/leniu-错误码/leniu-I18n/leniu-国际化/net.xnzn/leniu-yunshitang
|
|
114
|
+
- leniu-backend-annotations: leniu-yunshitang/leniu-注解/leniu-@RequiresAuthentication/leniu-@RequiresGuest/leniu-@Validated/leniu-@NotNull/leniu-@Api/leniu-@ApiOperation/leniu-@ApiModelProperty/leniu-分组校验/leniu-InsertGroup/leniu-UpdateGroup/net.xnzn/leniu-yunshitang
|
|
115
|
+
- leniu-api-development: leniu-API/leniu-接口/leniu-Controller/leniu-RESTful/LeResult/云食堂接口/云食堂API/leiu-yunshitang
|
|
116
|
+
- leniu-architecture-design: leniu-架构/云食堂架构/双库架构/商户库/系统库/net.xnzn/pigx框架
|
|
117
|
+
- openspec-new-change: 新建变更/开始新功能/opsx:new/openspec new/创建变更
|
|
118
|
+
- openspec-ff-change: 快速推进/快速生成所有制品/opsx:ff/openspec ff/fast-forward
|
|
119
|
+
- openspec-apply-change: 实现任务/开始实现/opsx:apply/openspec apply/执行变更
|
|
120
|
+
- openspec-continue-change: 继续变更/创建下一个制品/opsx:continue/openspec continue
|
|
121
|
+
- openspec-archive-change: 归档变更/完成变更/opsx:archive/openspec archive/归档
|
|
122
|
+
- openspec-bulk-archive-change: 批量归档/批量完成/opsx:bulk-archive/批量变更
|
|
123
|
+
- openspec-explore: 探索模式/思维伙伴/opsx:explore/openspec explore/探索问题
|
|
124
|
+
- openspec-onboard: 新手引导/学习工作流/opsx:onboard/openspec onboard/入门教程
|
|
125
|
+
- openspec-sync-specs: 同步规格/同步spec/opsx:sync/openspec sync/delta同步
|
|
126
|
+
- openspec-verify-change: 验证变更/检查实现/opsx:verify/openspec verify/验证规格
|
|
127
|
+
|
|
128
|
+
### 步骤 2 - 激活(逐个调用,等待每个完成)
|
|
129
|
+
|
|
130
|
+
⚠️ **必须逐个调用 Skill() 工具,每次调用后等待返回再调用下一个**
|
|
131
|
+
- 有 N 个匹配技能 → 逐个发起 N 次 Skill() 调用(不要并行!)
|
|
132
|
+
- 无匹配技能 → 写"无匹配技能"
|
|
133
|
+
|
|
134
|
+
**调用顺序**:按列出顺序,先调用第一个,等返回后再调用第二个...
|
|
135
|
+
|
|
136
|
+
### 步骤 3 - 实现
|
|
137
|
+
|
|
138
|
+
只有在步骤 2 的所有 Skill() 调用完成后,才能开始实现。
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
**关键规则(违反将导致任务失败)**:
|
|
143
|
+
1. ⛔ 禁止:评估后跳过 Skill() 直接实现
|
|
144
|
+
2. ⛔ 禁止:只调用部分技能(必须全部调用)
|
|
145
|
+
3. ⛔ 禁止:并行调用多个 Skill()(必须串行,一个一个来)
|
|
146
|
+
4. ✅ 正确:评估 → 逐个调用 Skill() → 全部完成后实现
|
|
147
|
+
|
|
148
|
+
**正确示例**:
|
|
149
|
+
用户问:"帮我开发一个优惠券管理功能"
|
|
150
|
+
|
|
151
|
+
匹配技能:
|
|
152
|
+
- crud-development: 涉及业务模块CRUD开发
|
|
153
|
+
- database-ops: 需要建表和字典配置
|
|
154
|
+
|
|
155
|
+
激活技能:
|
|
156
|
+
> Skill(crud-development)
|
|
157
|
+
> Skill(database-ops)
|
|
158
|
+
|
|
159
|
+
[所有技能激活完成后开始实现...]
|
|
160
|
+
|
|
161
|
+
**错误示例(禁止)**:
|
|
162
|
+
❌ 只调用部分技能
|
|
163
|
+
❌ 列出技能但不调用 Skill()
|
|
164
|
+
❌ 并行调用(会导致只有一个生效)`;
|
|
165
|
+
|
|
166
|
+
console.log(instructions);
|
|
167
|
+
process.exit(0);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Stop Hook - Claude 回答结束时触发
|
|
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
|
+
const audioFile = path.join(process.cwd(), '.claude', 'audio', 'completed.wav');
|
|
33
|
+
try {
|
|
34
|
+
if (fs.existsSync(audioFile)) {
|
|
35
|
+
const platform = process.platform;
|
|
36
|
+
if (platform === 'darwin') {
|
|
37
|
+
execSync(`afplay "${audioFile}"`, { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
38
|
+
} else if (platform === 'win32') {
|
|
39
|
+
execSync(`powershell -c "(New-Object Media.SoundPlayer '${audioFile.replace(/'/g, "''")}').PlaySync()"`, {
|
|
40
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
41
|
+
});
|
|
42
|
+
} else if (platform === 'linux') {
|
|
43
|
+
try {
|
|
44
|
+
execSync(`aplay "${audioFile}"`, { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
45
|
+
} catch {
|
|
46
|
+
try {
|
|
47
|
+
execSync(`paplay "${audioFile}"`, { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
48
|
+
} catch {
|
|
49
|
+
// 播放失败,静默忽略
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
} catch {
|
|
55
|
+
// 播放失败时静默忽略
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
process.exit(0);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {},
|
|
3
|
+
"hooks": {
|
|
4
|
+
"UserPromptSubmit": [
|
|
5
|
+
{
|
|
6
|
+
"matcher": "",
|
|
7
|
+
"hooks": [
|
|
8
|
+
{
|
|
9
|
+
"type": "command",
|
|
10
|
+
"command": "node .claude/hooks/skill-forced-eval.js"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"PreToolUse": [
|
|
16
|
+
{
|
|
17
|
+
"matcher": "Bash|Write",
|
|
18
|
+
"hooks": [
|
|
19
|
+
{
|
|
20
|
+
"type": "command",
|
|
21
|
+
"command": "node .claude/hooks/pre-tool-use.js",
|
|
22
|
+
"timeout": 5000
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"Stop": [
|
|
28
|
+
{
|
|
29
|
+
"matcher": "",
|
|
30
|
+
"hooks": [
|
|
31
|
+
{
|
|
32
|
+
"type": "command",
|
|
33
|
+
"command": "node .claude/hooks/stop.js",
|
|
34
|
+
"timeout": 10000
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"mcpServers": {}
|
|
41
|
+
}
|