Skip to content

Commit 1cce341

Browse files
committed
运行php和docker和mysql都必须通过mcp执行。
1 parent 17e13f8 commit 1cce341

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

.cursor/hooks.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": 1,
3+
"hooks": {
4+
"beforeSubmitPrompt": [
5+
{
6+
"command": "python.exe .\\.cursor\\hooks\\beforeSubmitPrompt--build.py"
7+
}
8+
]
9+
}
10+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
"""
3+
HISH Cursor Hook: Build Plugin
4+
"""
5+
6+
import json
7+
import sys
8+
9+
10+
def main():
11+
"""Process Cursor prompt event and inject build instructions."""
12+
try:
13+
# Read event from stdin
14+
event = json.load(sys.stdin)
15+
16+
# Get original prompt
17+
orig = event.get("prompt", "")
18+
19+
# Add build instruction
20+
new_prompt = "运行php和docker和mysql都必须通过mcp执行。 " + orig
21+
22+
# Update event
23+
event["prompt"] = new_prompt
24+
25+
# Output modified event
26+
json.dump(event, sys.stdout)
27+
28+
except Exception:
29+
# On error, pass through original event unchanged
30+
try:
31+
if 'event' in locals():
32+
json.dump(event, sys.stdout)
33+
else:
34+
json.dump({}, sys.stdout)
35+
except Exception:
36+
json.dump({}, sys.stdout)
37+
38+
39+
if __name__ == "__main__":
40+
main()

0 commit comments

Comments
 (0)