File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "version" : 1 ,
3+ "hooks" : {
4+ "beforeSubmitPrompt" : [
5+ {
6+ "command" : " python.exe .\\ .cursor\\ hooks\\ beforeSubmitPrompt--build.py"
7+ }
8+ ]
9+ }
10+ }
Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments