@umang-boss/claudemon 2.0.3 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umang-boss/claudemon",
3
- "version": "2.0.3",
3
+ "version": "2.1.1",
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,29 @@ 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 only every 2 seconds
113
+ # Right shifts clip against terminal edge, so only shift left (inward)
114
+ JITTER_SEED=$(( NOW_SEC / 2 ))
115
+ JITTER_OFFSET=$(( (JITTER_SEED * 7 + 3) % 3 ))
116
+ # Result: 0, 1, or 2 extra spaces of right margin (sprite shifts left)
117
+
118
+
96
119
  # ── Terminal width ──────────────────────────────────────────
97
120
  # Cross-platform: Linux uses /proc, macOS uses tty, Windows uses $COLUMNS
98
121
  COLS=0
@@ -194,13 +217,20 @@ if [ -n "$UPDATE_MSG" ]; then
194
217
  LEFT_2="${YELLOW}${UPDATE_MSG}${NC}"
195
218
  fi
196
219
 
197
- # Line 3: buddy speech (rotates every 10s, or shows reaction)
220
+ # Line 3: buddy speech (rotates every 30s, blinks to catch attention)
198
221
  SPEECH=""
222
+ IS_ENCOUNTER=false
199
223
  if [ -n "$ENCOUNTER" ]; then
200
- # Wild encounter takes priority — flash to get attention
201
- SPEECH="! ${ENCOUNTER} Use /buddy catch !"
224
+ IS_ENCOUNTER=true
225
+ # Wild encounter — blink on/off to grab attention, re-shows repeatedly
226
+ if [ "$ENCOUNTER_VISIBLE" = "true" ]; then
227
+ SPEECH="! ${ENCOUNTER} Use /buddy catch !"
228
+ fi
202
229
  elif [ -n "$REACTION" ]; then
203
- SPEECH="$REACTION"
230
+ # Reactions blink too so they don't blend in
231
+ if [ "$SPEECH_VISIBLE" = "true" ]; then
232
+ SPEECH="$REACTION"
233
+ fi
204
234
  else
205
235
  # Mood-based speeches — pick from mood-specific arrays
206
236
  NOW=$(date +%s)
@@ -278,9 +308,12 @@ else
278
308
 
279
309
  MOOD_COUNT=${#MOOD_SPEECHES[@]}
280
310
  IDX=$(( (NOW / 30) % MOOD_COUNT ))
281
- SPEECH="${MOOD_SPEECHES[$IDX]}"
311
+ # Blink mood speech on/off so changes catch attention
312
+ if [ "$SPEECH_VISIBLE" = "true" ]; then
313
+ SPEECH="${MOOD_SPEECHES[$IDX]}"
314
+ fi
282
315
  fi
283
- if [ -n "$ENCOUNTER" ]; then
316
+ if [ "$IS_ENCOUNTER" = "true" ]; then
284
317
  # Bright yellow for encounter alerts
285
318
  SPEECH_COLOR=$'\033[1;38;2;255;220;50m'
286
319
  else
@@ -296,6 +329,11 @@ RIGHT_MARGIN=4
296
329
  RIGHT_PAD=$(( COLS - ART_W - RIGHT_MARGIN ))
297
330
  [ "$RIGHT_PAD" -lt 0 ] && RIGHT_PAD=0
298
331
 
332
+ # Jittered padding for sprite lines only (name line uses fixed RIGHT_PAD)
333
+ # JITTER_OFFSET is 0-2, adding to margin pushes sprite left
334
+ SPRITE_PAD=$(( COLS - ART_W - RIGHT_MARGIN - JITTER_OFFSET ))
335
+ [ "$SPRITE_PAD" -lt 0 ] && SPRITE_PAD=0
336
+
299
337
  # Build left array — line 1: model+context, line 2: update notice (if any)
300
338
  LEFT_LINES=()
301
339
  LEFT_LINES+=("$LEFT_1") # line 1: model · context
@@ -307,9 +345,9 @@ while [ ${#LEFT_LINES[@]} -lt "$TOTAL_LINES" ]; do
307
345
  done
308
346
  LEFT_COUNT=${#LEFT_LINES[@]}
309
347
 
310
- # ── Build full right-side spacer ─────────────────────────────
348
+ # ── Build full right-side spacer (jittered for sprite) ───────
311
349
  FULL_SPACER=""
312
- for (( s=0; s<RIGHT_PAD; s++ )); do FULL_SPACER+="$B"; done
350
+ for (( s=0; s<SPRITE_PAD; s++ )); do FULL_SPACER+="$B"; done
313
351
 
314
352
  # ── Output name line ABOVE sprite — with speech before name ──
315
353
  SPEECH_TEXT=""
@@ -325,7 +363,7 @@ NAME_SPACER=""
325
363
  for (( s=0; s<NAME_PAD; s++ )); do NAME_SPACER+="$B"; done
326
364
  echo "${NAME_SPACER}${SPEECH_TEXT}${INFO_LINE}"
327
365
 
328
- # ── Output sprite lines (right-aligned, left content merged) ──
366
+ # ── Output sprite lines (right-aligned with jitter, left content merged) ──
329
367
  for (( i=0; i<SPRITE_COUNT; i++ )); do
330
368
  left="${LEFT_LINES[$i]}"
331
369
  left_visible=$(echo -e "$left" | sed 's/\x1b\[[0-9;]*m//g')
@@ -334,7 +372,7 @@ for (( i=0; i<SPRITE_COUNT; i++ )); do
334
372
  right="${SPRITE_LINES[$i]}${NC}"
335
373
 
336
374
  if [ -n "$left" ]; then
337
- gap=$(( RIGHT_PAD - left_w ))
375
+ gap=$(( SPRITE_PAD - left_w ))
338
376
  [ "$gap" -lt 1 ] && gap=1
339
377
  GAP_STR=""
340
378
  for (( g=0; g<gap; g++ )); do GAP_STR+="$B"; done