olympus-ai 3.6.2 → 3.6.3
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-plugin/plugin.json +1 -1
- package/dist/hooks/entry.d.ts.map +1 -1
- package/dist/hooks/entry.js +9 -1
- package/dist/hooks/entry.js.map +1 -1
- package/dist/hooks/olympus-hooks.cjs +102 -100
- package/dist/hooks/registrations/learning-capture.d.ts +5 -0
- package/dist/hooks/registrations/learning-capture.d.ts.map +1 -1
- package/dist/hooks/registrations/learning-capture.js +195 -2
- package/dist/hooks/registrations/learning-capture.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.js +1 -1
- package/dist/learning/session-state.d.ts.map +1 -1
- package/dist/learning/session-state.js +4 -0
- package/dist/learning/session-state.js.map +1 -1
- package/package.json +1 -1
- package/scripts/diagnose-hooks.sh +174 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Olympus Hooks Diagnostic Script
|
|
3
|
+
# Tests hook execution and data capture
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "╔═══════════════════════════════════════════════════════╗"
|
|
8
|
+
echo "║ Olympus Hooks Diagnostic Script ║"
|
|
9
|
+
echo "╚═══════════════════════════════════════════════════════╝"
|
|
10
|
+
echo ""
|
|
11
|
+
|
|
12
|
+
HOOKS_FILE="$HOME/.claude/hooks/olympus-hooks.cjs"
|
|
13
|
+
DEBUG_LOG="$HOME/.claude/olympus/learning/hooks-debug.log"
|
|
14
|
+
SESSION_STATE=".olympus/session-state.json"
|
|
15
|
+
FEEDBACK_LOG="$HOME/.claude/olympus/learning/feedback-log.jsonl"
|
|
16
|
+
|
|
17
|
+
# Test 1: Check if hooks file exists
|
|
18
|
+
echo "Test 1: Checking hooks file..."
|
|
19
|
+
if [ -f "$HOOKS_FILE" ]; then
|
|
20
|
+
echo " ✓ Hooks file exists: $HOOKS_FILE"
|
|
21
|
+
echo " Size: $(wc -c < "$HOOKS_FILE") bytes"
|
|
22
|
+
echo " Modified: $(stat -c '%y' "$HOOKS_FILE" 2>/dev/null || stat -f '%Sm' "$HOOKS_FILE")"
|
|
23
|
+
else
|
|
24
|
+
echo " ✗ Hooks file NOT found: $HOOKS_FILE"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
echo ""
|
|
28
|
+
|
|
29
|
+
# Test 2: Check settings.json configuration
|
|
30
|
+
echo "Test 2: Checking settings.json hooks configuration..."
|
|
31
|
+
SETTINGS="$HOME/.claude/settings.json"
|
|
32
|
+
if [ -f "$SETTINGS" ]; then
|
|
33
|
+
if grep -q "olympus-hooks.cjs" "$SETTINGS"; then
|
|
34
|
+
echo " ✓ Hooks configured in settings.json"
|
|
35
|
+
echo " Configured events:"
|
|
36
|
+
grep -o '"[A-Za-z]*": \[' "$SETTINGS" | grep -v hooks | head -5
|
|
37
|
+
else
|
|
38
|
+
echo " ✗ olympus-hooks.cjs NOT found in settings.json"
|
|
39
|
+
fi
|
|
40
|
+
else
|
|
41
|
+
echo " ✗ settings.json NOT found"
|
|
42
|
+
fi
|
|
43
|
+
echo ""
|
|
44
|
+
|
|
45
|
+
# Test 3: Test UserPromptSubmit hook with REAL context structure
|
|
46
|
+
echo "Test 3: Testing UserPromptSubmit hook execution..."
|
|
47
|
+
TEST_INPUT=$(cat <<'EOF'
|
|
48
|
+
{
|
|
49
|
+
"session_id": "diagnostic-test-001",
|
|
50
|
+
"transcript_path": "/tmp/transcript.jsonl",
|
|
51
|
+
"cwd": "$PWD",
|
|
52
|
+
"permission_mode": "default",
|
|
53
|
+
"hook_event_name": "UserPromptSubmit",
|
|
54
|
+
"prompt": "This is a diagnostic test prompt"
|
|
55
|
+
}
|
|
56
|
+
EOF
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
echo " Input JSON:"
|
|
60
|
+
echo "$TEST_INPUT" | head -3
|
|
61
|
+
echo ""
|
|
62
|
+
echo " Executing hook..."
|
|
63
|
+
RESULT=$(echo "$TEST_INPUT" | node "$HOOKS_FILE" --event=UserPromptSubmit 2>&1)
|
|
64
|
+
EXIT_CODE=$?
|
|
65
|
+
echo " Exit code: $EXIT_CODE"
|
|
66
|
+
echo " Output: $RESULT"
|
|
67
|
+
echo ""
|
|
68
|
+
|
|
69
|
+
# Test 4: Test PostToolUse hook
|
|
70
|
+
echo "Test 4: Testing PostToolUse hook execution..."
|
|
71
|
+
TEST_INPUT=$(cat <<'EOF'
|
|
72
|
+
{
|
|
73
|
+
"session_id": "diagnostic-test-001",
|
|
74
|
+
"transcript_path": "/tmp/transcript.jsonl",
|
|
75
|
+
"cwd": "$PWD",
|
|
76
|
+
"permission_mode": "default",
|
|
77
|
+
"hook_event_name": "PostToolUse",
|
|
78
|
+
"tool_name": "Read",
|
|
79
|
+
"tool_input": {"file_path": "/tmp/test.txt"},
|
|
80
|
+
"tool_response": {"success": true}
|
|
81
|
+
}
|
|
82
|
+
EOF
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
RESULT=$(echo "$TEST_INPUT" | node "$HOOKS_FILE" --event=PostToolUse 2>&1)
|
|
86
|
+
EXIT_CODE=$?
|
|
87
|
+
echo " Exit code: $EXIT_CODE"
|
|
88
|
+
echo " Output: $RESULT"
|
|
89
|
+
echo ""
|
|
90
|
+
|
|
91
|
+
# Test 5: Test Stop hook
|
|
92
|
+
echo "Test 5: Testing Stop hook execution..."
|
|
93
|
+
TEST_INPUT=$(cat <<'EOF'
|
|
94
|
+
{
|
|
95
|
+
"session_id": "diagnostic-test-001",
|
|
96
|
+
"transcript_path": "/tmp/transcript.jsonl",
|
|
97
|
+
"cwd": "$PWD",
|
|
98
|
+
"permission_mode": "default",
|
|
99
|
+
"hook_event_name": "Stop",
|
|
100
|
+
"stop_hook_active": true
|
|
101
|
+
}
|
|
102
|
+
EOF
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
RESULT=$(echo "$TEST_INPUT" | node "$HOOKS_FILE" --event=Stop 2>&1)
|
|
106
|
+
EXIT_CODE=$?
|
|
107
|
+
echo " Exit code: $EXIT_CODE"
|
|
108
|
+
echo " Output: $RESULT"
|
|
109
|
+
echo ""
|
|
110
|
+
|
|
111
|
+
# Test 6: Check if session state was updated
|
|
112
|
+
echo "Test 6: Checking session state file..."
|
|
113
|
+
if [ -f "$SESSION_STATE" ]; then
|
|
114
|
+
echo " ✓ Session state exists"
|
|
115
|
+
echo " Last modified: $(stat -c '%y' "$SESSION_STATE" 2>/dev/null || stat -f '%Sm' "$SESSION_STATE")"
|
|
116
|
+
echo " Content preview:"
|
|
117
|
+
head -10 "$SESSION_STATE" | sed 's/^/ /'
|
|
118
|
+
else
|
|
119
|
+
echo " ✗ Session state NOT found: $SESSION_STATE"
|
|
120
|
+
fi
|
|
121
|
+
echo ""
|
|
122
|
+
|
|
123
|
+
# Test 7: Check feedback log
|
|
124
|
+
echo "Test 7: Checking feedback log..."
|
|
125
|
+
if [ -f "$FEEDBACK_LOG" ]; then
|
|
126
|
+
ENTRY_COUNT=$(wc -l < "$FEEDBACK_LOG")
|
|
127
|
+
echo " ✓ Feedback log exists"
|
|
128
|
+
echo " Entries: $ENTRY_COUNT"
|
|
129
|
+
if [ "$ENTRY_COUNT" -gt 0 ]; then
|
|
130
|
+
echo " Latest entry:"
|
|
131
|
+
tail -1 "$FEEDBACK_LOG" | sed 's/^/ /'
|
|
132
|
+
fi
|
|
133
|
+
else
|
|
134
|
+
echo " ✗ Feedback log NOT found: $FEEDBACK_LOG"
|
|
135
|
+
fi
|
|
136
|
+
echo ""
|
|
137
|
+
|
|
138
|
+
# Test 8: Check debug log (if enabled)
|
|
139
|
+
echo "Test 8: Checking debug log..."
|
|
140
|
+
if [ -f "$DEBUG_LOG" ]; then
|
|
141
|
+
LINE_COUNT=$(wc -l < "$DEBUG_LOG")
|
|
142
|
+
echo " ✓ Debug log exists"
|
|
143
|
+
echo " Lines: $LINE_COUNT"
|
|
144
|
+
echo " Recent entries:"
|
|
145
|
+
tail -5 "$DEBUG_LOG" | sed 's/^/ /'
|
|
146
|
+
else
|
|
147
|
+
echo " ℹ Debug log not found (enable with OLYMPUS_DEBUG_HOOKS=1)"
|
|
148
|
+
fi
|
|
149
|
+
echo ""
|
|
150
|
+
|
|
151
|
+
# Test 9: Check for shell profile pollution
|
|
152
|
+
echo "Test 9: Checking for shell profile pollution..."
|
|
153
|
+
PROFILE_OUTPUT=$(/bin/bash -i -c 'exit' 2>&1)
|
|
154
|
+
if [ -n "$PROFILE_OUTPUT" ]; then
|
|
155
|
+
echo " ⚠ WARNING: Shell profile produces output"
|
|
156
|
+
echo " This can break JSON parsing in hooks!"
|
|
157
|
+
echo " Output:"
|
|
158
|
+
echo "$PROFILE_OUTPUT" | head -3 | sed 's/^/ /'
|
|
159
|
+
else
|
|
160
|
+
echo " ✓ No shell profile pollution detected"
|
|
161
|
+
fi
|
|
162
|
+
echo ""
|
|
163
|
+
|
|
164
|
+
# Summary
|
|
165
|
+
echo "╔═══════════════════════════════════════════════════════╗"
|
|
166
|
+
echo "║ Diagnostic Summary ║"
|
|
167
|
+
echo "╚═══════════════════════════════════════════════════════╝"
|
|
168
|
+
echo ""
|
|
169
|
+
echo "Next steps:"
|
|
170
|
+
echo " 1. Enable debug mode: export OLYMPUS_DEBUG_HOOKS=1"
|
|
171
|
+
echo " 2. Start Claude Code session: claude"
|
|
172
|
+
echo " 3. Monitor debug log: tail -f $DEBUG_LOG"
|
|
173
|
+
echo " 4. Send a message and check if hooks capture data"
|
|
174
|
+
echo ""
|