@ramarivera/coding-buddy 0.6.0 → 0.7.1
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/marketplace.json +6 -6
- package/.claude-plugin/plugin.json +4 -4
- package/README.md +12 -11
- package/adapters/omp/renderers.ts +61 -4
- package/adapters/omp/ui.ts +1 -1
- package/cli/install.ts +12 -6
- package/cli/pick.ts +26 -8
- package/cli/upgrade.ts +44 -11
- package/hooks/buddy-comment.sh +10 -85
- package/hooks/file-type-react.sh +10 -400
- package/hooks/hooks.json +19 -5
- package/hooks/legacy/file-type-react.sh +403 -0
- package/hooks/legacy/mood-react.sh +210 -0
- package/hooks/legacy/name-react.sh +178 -0
- package/hooks/legacy/react.sh +1364 -0
- package/hooks/mood-react.sh +10 -207
- package/hooks/name-react.sh +10 -178
- package/hooks/react.sh +10 -1367
- package/hooks/suggest.sh +10 -54
- package/package.json +3 -3
- package/scripts/paths.sh +16 -1
- package/server/art.ts +1 -1
- package/server/hooks/buddy-comment.ts +93 -0
- package/server/hooks/common.ts +95 -0
- package/server/hooks/legacy-bash.ts +34 -0
- package/server/hooks/suggest.ts +60 -0
- package/server/state.ts +14 -2
- package/statusline/buddy-status.sh +20 -12
- package/statusline/combined-status.sh +9 -8
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# coding-buddy UserPromptSubmit hook
|
|
3
|
+
# Detects the buddy's name in the user's message → status line reaction.
|
|
4
|
+
# No cooldown — name mentions are intentional.
|
|
5
|
+
|
|
6
|
+
# shellcheck source=../scripts/paths.sh
|
|
7
|
+
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/paths.sh"
|
|
8
|
+
|
|
9
|
+
STATE_DIR="$BUDDY_STATE_DIR"
|
|
10
|
+
STATUS_FILE="$STATE_DIR/status.json"
|
|
11
|
+
# Per-session ID resolved by paths.sh (CLAUDE_CODE_SESSION_ID > TMUX_PANE > default)
|
|
12
|
+
SID="$BUDDY_SID"
|
|
13
|
+
|
|
14
|
+
[ -f "$STATUS_FILE" ] || exit 0
|
|
15
|
+
|
|
16
|
+
INPUT=$(cat)
|
|
17
|
+
|
|
18
|
+
# Claude Code sends the prompt in different fields depending on version
|
|
19
|
+
PROMPT=$(echo "$INPUT" | jq -r '
|
|
20
|
+
.prompt // .message // .user_message //
|
|
21
|
+
(.messages[-1].content // "") | if type=="array" then .[0].text else . end
|
|
22
|
+
' 2>/dev/null)
|
|
23
|
+
[ -z "$PROMPT" ] && exit 0
|
|
24
|
+
|
|
25
|
+
NAME=$(jq -r '.name // ""' "$STATUS_FILE" 2>/dev/null)
|
|
26
|
+
[ -z "$NAME" ] && exit 0
|
|
27
|
+
|
|
28
|
+
# Case-insensitive whole-word match
|
|
29
|
+
echo "$PROMPT" | grep -qiE "(^|[^a-zA-Z])${NAME}([^a-zA-Z]|$)" 2>/dev/null || exit 0
|
|
30
|
+
|
|
31
|
+
SPECIES=$(jq -r '.species // "blob"' "$STATUS_FILE" 2>/dev/null)
|
|
32
|
+
MUTED=$(jq -r '.muted // false' "$STATUS_FILE" 2>/dev/null)
|
|
33
|
+
[ "$MUTED" = "true" ] && exit 0
|
|
34
|
+
|
|
35
|
+
# Species-specific name-call reactions
|
|
36
|
+
case "$SPECIES" in
|
|
37
|
+
dragon)
|
|
38
|
+
REACTIONS=(
|
|
39
|
+
"*one eye opens slowly*"
|
|
40
|
+
"...you called?"
|
|
41
|
+
"*smoke curls from nostril* yes."
|
|
42
|
+
"*regards you from above*"
|
|
43
|
+
) ;;
|
|
44
|
+
owl)
|
|
45
|
+
REACTIONS=(
|
|
46
|
+
"*swivels head 180°*"
|
|
47
|
+
"*blinks once, deliberately*"
|
|
48
|
+
"hm."
|
|
49
|
+
"*adjusts perch*"
|
|
50
|
+
) ;;
|
|
51
|
+
cat)
|
|
52
|
+
REACTIONS=(
|
|
53
|
+
"*ear flicks*"
|
|
54
|
+
"...what."
|
|
55
|
+
"*ignores you, but heard*"
|
|
56
|
+
"*opens one eye*"
|
|
57
|
+
) ;;
|
|
58
|
+
duck)
|
|
59
|
+
REACTIONS=(
|
|
60
|
+
"*quack*"
|
|
61
|
+
"*looks up mid-waddle*"
|
|
62
|
+
"*attentive duck noises*"
|
|
63
|
+
) ;;
|
|
64
|
+
ghost)
|
|
65
|
+
REACTIONS=(
|
|
66
|
+
"*materialises*"
|
|
67
|
+
"...boo?"
|
|
68
|
+
"*phases closer*"
|
|
69
|
+
) ;;
|
|
70
|
+
robot)
|
|
71
|
+
REACTIONS=(
|
|
72
|
+
"NAME DETECTED."
|
|
73
|
+
"*whirrs attentively*"
|
|
74
|
+
"STANDING BY."
|
|
75
|
+
) ;;
|
|
76
|
+
capybara)
|
|
77
|
+
REACTIONS=(
|
|
78
|
+
"*barely moves*"
|
|
79
|
+
"*blinks slowly*"
|
|
80
|
+
"...yes, friend."
|
|
81
|
+
) ;;
|
|
82
|
+
axolotl)
|
|
83
|
+
REACTIONS=(
|
|
84
|
+
"*gill flutter*"
|
|
85
|
+
"*smiles gently*"
|
|
86
|
+
"oh! hello."
|
|
87
|
+
) ;;
|
|
88
|
+
blob)
|
|
89
|
+
REACTIONS=(
|
|
90
|
+
"*jiggles*"
|
|
91
|
+
"*oozes toward you*"
|
|
92
|
+
"*wobbles excitedly*"
|
|
93
|
+
) ;;
|
|
94
|
+
turtle)
|
|
95
|
+
REACTIONS=(
|
|
96
|
+
"*slowly extends neck*"
|
|
97
|
+
"...you called?"
|
|
98
|
+
"*ancient eyes open*"
|
|
99
|
+
"*shell creaks thoughtfully*"
|
|
100
|
+
"*blinks once, patiently*"
|
|
101
|
+
) ;;
|
|
102
|
+
goose)
|
|
103
|
+
REACTIONS=(
|
|
104
|
+
"HONK."
|
|
105
|
+
"*necks aggressively*"
|
|
106
|
+
"*wing flap*"
|
|
107
|
+
"*honks in recognition*"
|
|
108
|
+
) ;;
|
|
109
|
+
octopus)
|
|
110
|
+
REACTIONS=(
|
|
111
|
+
"*eight eyes open*"
|
|
112
|
+
"*curls an arm toward you*"
|
|
113
|
+
"*changes color curiously*"
|
|
114
|
+
"...yes, friend?"
|
|
115
|
+
) ;;
|
|
116
|
+
penguin)
|
|
117
|
+
REACTIONS=(
|
|
118
|
+
"*adjusts tie*"
|
|
119
|
+
"*dignified waddle*"
|
|
120
|
+
"*bows slightly*"
|
|
121
|
+
"...yes, quite?"
|
|
122
|
+
) ;;
|
|
123
|
+
snail)
|
|
124
|
+
REACTIONS=(
|
|
125
|
+
"*slow head extension*"
|
|
126
|
+
"...mmm?"
|
|
127
|
+
"*trails slowly toward you*"
|
|
128
|
+
"*antenna twitches*"
|
|
129
|
+
) ;;
|
|
130
|
+
cactus)
|
|
131
|
+
REACTIONS=(
|
|
132
|
+
"*stands silent*"
|
|
133
|
+
"...hm."
|
|
134
|
+
"*spine twitches*"
|
|
135
|
+
"*slowly rotates*"
|
|
136
|
+
) ;;
|
|
137
|
+
rabbit)
|
|
138
|
+
REACTIONS=(
|
|
139
|
+
"*ears perk up*"
|
|
140
|
+
"*nose twitches*"
|
|
141
|
+
"yes?"
|
|
142
|
+
"*hops closer*"
|
|
143
|
+
) ;;
|
|
144
|
+
mushroom)
|
|
145
|
+
REACTIONS=(
|
|
146
|
+
"*releases a tiny spore*"
|
|
147
|
+
"*cap tilts*"
|
|
148
|
+
"*stands mysterious*"
|
|
149
|
+
"...yes?"
|
|
150
|
+
) ;;
|
|
151
|
+
chonk)
|
|
152
|
+
REACTIONS=(
|
|
153
|
+
"*barely opens one eye*"
|
|
154
|
+
"...mrrp?"
|
|
155
|
+
"*yawns heavily*"
|
|
156
|
+
"*rolls over toward you*"
|
|
157
|
+
) ;;
|
|
158
|
+
*)
|
|
159
|
+
REACTIONS=(
|
|
160
|
+
"*perks up*"
|
|
161
|
+
"...yes?"
|
|
162
|
+
"*looks your way*"
|
|
163
|
+
) ;;
|
|
164
|
+
esac
|
|
165
|
+
|
|
166
|
+
N=${#REACTIONS[@]}
|
|
167
|
+
REACTION="${REACTIONS[$((RANDOM % N))]}"
|
|
168
|
+
|
|
169
|
+
mkdir -p "$STATE_DIR"
|
|
170
|
+
|
|
171
|
+
TMP=$(mktemp)
|
|
172
|
+
jq --arg r "$REACTION" '.reaction = $r' "$STATUS_FILE" > "$TMP" 2>/dev/null && mv "$TMP" "$STATUS_FILE"
|
|
173
|
+
|
|
174
|
+
jq -n --arg r "$REACTION" --arg ts "$(date +%s)000" \
|
|
175
|
+
'{reaction: $r, timestamp: ($ts | tonumber), reason: "name"}' \
|
|
176
|
+
> "$STATE_DIR/reaction.$SID.json"
|
|
177
|
+
|
|
178
|
+
exit 0
|