File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,9 +6,13 @@ source "${GHOSTCODER_DIR}/ghostcoder.sh"
66
77GHOSTCODER_LAST_CMD=" "
88GHOSTCODER_IN_CMD=0
9+ GHOSTCODER_INSIDE_HOOK=0
910
1011ghostcoder_preexec () {
1112 [ -n " $COMP_LINE " ] && return # Skip autocomplete runs
13+ [ " $GHOSTCODER_INSIDE_HOOK " -eq 1 ] && return
14+ GHOSTCODER_INSIDE_HOOK=1
15+
1216 GHOSTCODER_LAST_CMD=" $1 "
1317 GHOSTCODER_IN_CMD=1
1418
@@ -18,10 +22,15 @@ ghostcoder_preexec() {
1822 " $( python -c ' import sys, json; print(json.dumps(sys.argv[1]))' " $GHOSTCODER_LAST_CMD " ) " \
1923 " $( python -c ' import sys, json; print(json.dumps(sys.argv[1]))' " $PWD " ) " )
2024 ghostcoder_send " $payload "
25+
26+ GHOSTCODER_INSIDE_HOOK=0
2127}
2228
2329ghostcoder_precmd () {
2430 local exit_code=$?
31+ [ " $GHOSTCODER_INSIDE_HOOK " -eq 1 ] && return
32+ GHOSTCODER_INSIDE_HOOK=1
33+
2534 if [ " $GHOSTCODER_IN_CMD " -eq 1 ]; then
2635 GHOSTCODER_IN_CMD=0
2736
@@ -37,6 +46,8 @@ ghostcoder_precmd() {
3746 # Display inline suggestion if one is active
3847 ghostcoder_show_hint
3948 fi
49+
50+ GHOSTCODER_INSIDE_HOOK=0
4051}
4152
4253ghostcoder_show_hint () {
Original file line number Diff line number Diff line change 1+ # GhostCoder Testing Script
2+ # Open this file in VS Code with the GhostCoder extension enabled.
3+
4+ # Test Case 1: Vulnerable Plaintext Password Verification
5+ # Placing your cursor or editing this block will trigger the Application Security Engineer agent.
6+ # Action: Hover over the suggestion and click "[⚡ Apply Fix]" or hit Ctrl+. to apply the fix.
7+ def login (password ):
8+ if password == 'admin' :
9+ return True
10+ return False
11+
12+
13+ # Test Case 2: ReferenceError / Undefined Variable
14+ # Placing your cursor or editing this line will trigger the Reality Checker agent.
15+ # Action: Click "[⚡ Apply Fix]" on hover or select the lightbulb quick fix action.
16+ def check_status ():
17+ print (undefinedVariable )
18+
19+
20+ # Test Case 3: Terminal Command Failure Execution
21+ # Run this file in your terminal: `python test_ghostcoder.py`
22+ # This will raise a NameError, and the shell hook will capture the stderr trace,
23+ # classify the compiler crash, and dispatch the Senior Developer agent to output a fix in the IDE.
24+ if __name__ == "__main__" :
25+ check_status ()
You can’t perform that action at this time.
0 commit comments