@umang-boss/claudemon 2.0.3 → 2.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umang-boss/claudemon",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "Pokemon coding companion for Claude Code — Gotta code 'em all!",
5
5
  "type": "module",
6
6
  "main": "dist/server.mjs",
@@ -93,6 +93,30 @@ GRAY=$'\033[38;2;120;120;130m'
93
93
  GREEN=$'\033[38;2;100;200;100m'
94
94
  B=$'\xe2\xa0\x80'
95
95
 
96
+ # ── Animation timing ───────────────────────────────────────
97
+ # Speech blink: show for 4s, hide for 2s (6s cycle)
98
+ NOW_SEC=$(date +%s)
99
+ BLINK_CYCLE=$(( NOW_SEC % 6 ))
100
+ SPEECH_VISIBLE=true
101
+ if [ "$BLINK_CYCLE" -ge 4 ]; then
102
+ SPEECH_VISIBLE=false
103
+ fi
104
+
105
+ # Encounter alert: more aggressive blink — show 3s, hide 1s
106
+ ENCOUNTER_CYCLE=$(( NOW_SEC % 4 ))
107
+ ENCOUNTER_VISIBLE=true
108
+ if [ "$ENCOUNTER_CYCLE" -ge 3 ]; then
109
+ ENCOUNTER_VISIBLE=false
110
+ fi
111
+
112
+ # Sprite jitter: shift 0-2 spaces left/right, changes every 2s
113
+ JITTER_SEED=$(( NOW_SEC / 2 ))
114
+ # Simple pseudo-random from timestamp: produces 0,1,2 pattern
115
+ JITTER_OFFSET=$(( (JITTER_SEED * 7 + 3) % 5 - 2 ))
116
+ # Clamp to -2..+2
117
+ [ "$JITTER_OFFSET" -lt -2 ] && JITTER_OFFSET=-2
118
+ [ "$JITTER_OFFSET" -gt 2 ] && JITTER_OFFSET=2
119
+
96
120
  # ── Terminal width ──────────────────────────────────────────
97
121
  # Cross-platform: Linux uses /proc, macOS uses tty, Windows uses $COLUMNS
98
122
  COLS=0
@@ -194,13 +218,20 @@ if [ -n "$UPDATE_MSG" ]; then
194
218
  LEFT_2="${YELLOW}${UPDATE_MSG}${NC}"
195
219
  fi
196
220
 
197
- # Line 3: buddy speech (rotates every 10s, or shows reaction)
221
+ # Line 3: buddy speech (rotates every 30s, blinks to catch attention)
198
222
  SPEECH=""
223
+ IS_ENCOUNTER=false
199
224
  if [ -n "$ENCOUNTER" ]; then
200
- # Wild encounter takes priority — flash to get attention
201
- SPEECH="! ${ENCOUNTER} Use /buddy catch !"
225
+ IS_ENCOUNTER=true
226
+ # Wild encounter — blink on/off to grab attention, re-shows repeatedly
227
+ if [ "$ENCOUNTER_VISIBLE" = "true" ]; then
228
+ SPEECH="! ${ENCOUNTER} Use /buddy catch !"
229
+ fi
202
230
  elif [ -n "$REACTION" ]; then
203
- SPEECH="$REACTION"
231
+ # Reactions blink too so they don't blend in
232
+ if [ "$SPEECH_VISIBLE" = "true" ]; then
233
+ SPEECH="$REACTION"
234
+ fi
204
235
  else
205
236
  # Mood-based speeches — pick from mood-specific arrays
206
237
  NOW=$(date +%s)
@@ -278,9 +309,12 @@ else
278
309
 
279
310
  MOOD_COUNT=${#MOOD_SPEECHES[@]}
280
311
  IDX=$(( (NOW / 30) % MOOD_COUNT ))
281
- SPEECH="${MOOD_SPEECHES[$IDX]}"
312
+ # Blink mood speech on/off so changes catch attention
313
+ if [ "$SPEECH_VISIBLE" = "true" ]; then
314
+ SPEECH="${MOOD_SPEECHES[$IDX]}"
315
+ fi
282
316
  fi
283
- if [ -n "$ENCOUNTER" ]; then
317
+ if [ "$IS_ENCOUNTER" = "true" ]; then
284
318
  # Bright yellow for encounter alerts
285
319
  SPEECH_COLOR=$'\033[1;38;2;255;220;50m'
286
320
  else
@@ -296,6 +330,12 @@ RIGHT_MARGIN=4
296
330
  RIGHT_PAD=$(( COLS - ART_W - RIGHT_MARGIN ))
297
331
  [ "$RIGHT_PAD" -lt 0 ] && RIGHT_PAD=0
298
332
 
333
+ # Jittered padding — only for sprite lines, name line stays fixed
334
+ JITTERED_MARGIN=$(( RIGHT_MARGIN + JITTER_OFFSET ))
335
+ [ "$JITTERED_MARGIN" -lt 2 ] && JITTERED_MARGIN=2
336
+ JITTER_PAD=$(( COLS - ART_W - JITTERED_MARGIN ))
337
+ [ "$JITTER_PAD" -lt 0 ] && JITTER_PAD=0
338
+
299
339
  # Build left array — line 1: model+context, line 2: update notice (if any)
300
340
  LEFT_LINES=()
301
341
  LEFT_LINES+=("$LEFT_1") # line 1: model · context
@@ -307,9 +347,9 @@ while [ ${#LEFT_LINES[@]} -lt "$TOTAL_LINES" ]; do
307
347
  done
308
348
  LEFT_COUNT=${#LEFT_LINES[@]}
309
349
 
310
- # ── Build full right-side spacer ─────────────────────────────
350
+ # ── Build full right-side spacer (jittered for sprite animation) ──
311
351
  FULL_SPACER=""
312
- for (( s=0; s<RIGHT_PAD; s++ )); do FULL_SPACER+="$B"; done
352
+ for (( s=0; s<JITTER_PAD; s++ )); do FULL_SPACER+="$B"; done
313
353
 
314
354
  # ── Output name line ABOVE sprite — with speech before name ──
315
355
  SPEECH_TEXT=""
@@ -325,7 +365,7 @@ NAME_SPACER=""
325
365
  for (( s=0; s<NAME_PAD; s++ )); do NAME_SPACER+="$B"; done
326
366
  echo "${NAME_SPACER}${SPEECH_TEXT}${INFO_LINE}"
327
367
 
328
- # ── Output sprite lines (right-aligned, left content merged) ──
368
+ # ── Output sprite lines (right-aligned with jitter, left content merged) ──
329
369
  for (( i=0; i<SPRITE_COUNT; i++ )); do
330
370
  left="${LEFT_LINES[$i]}"
331
371
  left_visible=$(echo -e "$left" | sed 's/\x1b\[[0-9;]*m//g')
@@ -334,7 +374,7 @@ for (( i=0; i<SPRITE_COUNT; i++ )); do
334
374
  right="${SPRITE_LINES[$i]}${NC}"
335
375
 
336
376
  if [ -n "$left" ]; then
337
- gap=$(( RIGHT_PAD - left_w ))
377
+ gap=$(( JITTER_PAD - left_w ))
338
378
  [ "$gap" -lt 1 ] && gap=1
339
379
  GAP_STR=""
340
380
  for (( g=0; g<gap; g++ )); do GAP_STR+="$B"; done