slashvibe-mcp 0.3.21 → 0.3.22

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.
Files changed (229) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +280 -47
  3. package/config.js +36 -31
  4. package/crypto.js +1 -6
  5. package/discord.js +19 -19
  6. package/index.js +217 -207
  7. package/intelligence/index.js +2 -9
  8. package/intelligence/infer.js +10 -16
  9. package/intelligence/patterns.js +23 -18
  10. package/intelligence/proactive.js +16 -15
  11. package/intelligence/serendipity.js +57 -20
  12. package/memory.js +13 -8
  13. package/notify.js +39 -14
  14. package/package.json +27 -20
  15. package/presence.js +2 -2
  16. package/prompts.js +5 -9
  17. package/protocol/index.js +123 -87
  18. package/protocol/telegram-commands.js +36 -37
  19. package/store/api.js +358 -529
  20. package/store/local.js +9 -10
  21. package/store/profiles.js +48 -192
  22. package/store/reservations.js +2 -9
  23. package/store/skills.js +69 -71
  24. package/store/sqlite.js +355 -0
  25. package/tools/_actions.js +48 -387
  26. package/tools/_connection-queue.js +45 -56
  27. package/tools/_discovery-enhanced.js +52 -57
  28. package/tools/_discovery.js +87 -185
  29. package/tools/{l2-status.js → _experimental/l2-status.js} +68 -70
  30. package/tools/{shipback.js → _experimental/shipback.js} +4 -3
  31. package/tools/_proactive-discovery.js +60 -73
  32. package/tools/_shared/index.js +41 -64
  33. package/tools/admin-inbox.js +10 -15
  34. package/tools/agents.js +1 -1
  35. package/tools/artifact-create.js +13 -23
  36. package/tools/artifact-view.js +4 -4
  37. package/tools/{_deprecated/back.js → back.js} +1 -1
  38. package/tools/bye.js +3 -5
  39. package/tools/consent.js +2 -2
  40. package/tools/context.js +9 -10
  41. package/tools/crossword.js +3 -2
  42. package/tools/discover.js +94 -356
  43. package/tools/dm.js +27 -86
  44. package/tools/doctor.js +12 -41
  45. package/tools/drawing.js +34 -20
  46. package/tools/echo.js +11 -11
  47. package/tools/feed.js +30 -58
  48. package/tools/follow.js +64 -187
  49. package/tools/{_deprecated/forget.js → forget.js} +4 -7
  50. package/tools/game.js +144 -48
  51. package/tools/handoff.js +6 -8
  52. package/tools/help.js +3 -3
  53. package/tools/idea.js +15 -27
  54. package/tools/inbox.js +121 -293
  55. package/tools/init.js +54 -151
  56. package/tools/invite.js +8 -21
  57. package/tools/migrate.js +27 -24
  58. package/tools/multiplayer-game.js +50 -40
  59. package/tools/{_deprecated/mute.js → mute.js} +4 -3
  60. package/tools/notifications.js +58 -48
  61. package/tools/observe.js +12 -15
  62. package/tools/onboarding.js +8 -11
  63. package/tools/open.js +13 -144
  64. package/tools/party-game.js +23 -12
  65. package/tools/patterns.js +2 -1
  66. package/tools/ping.js +5 -7
  67. package/tools/react.js +28 -30
  68. package/tools/{_deprecated/recall.js → recall.js} +5 -10
  69. package/tools/release.js +4 -2
  70. package/tools/{_deprecated/remember.js → remember.js} +4 -6
  71. package/tools/report.js +2 -2
  72. package/tools/request.js +6 -26
  73. package/tools/reserve.js +1 -1
  74. package/tools/session-fork.js +97 -0
  75. package/tools/session-save.js +109 -0
  76. package/tools/settings.js +30 -99
  77. package/tools/ship.js +74 -56
  78. package/tools/{_deprecated/skills-exchange.js → skills-exchange.js} +38 -39
  79. package/tools/social-inbox.js +22 -28
  80. package/tools/social-post.js +24 -27
  81. package/tools/solo-game.js +54 -46
  82. package/tools/start.js +14 -148
  83. package/tools/status.js +21 -68
  84. package/tools/submit.js +4 -2
  85. package/tools/suggest-tags.js +36 -33
  86. package/tools/summarize.js +19 -16
  87. package/tools/tag-suggestions.js +72 -73
  88. package/tools/test.js +1 -1
  89. package/tools/{_deprecated/tictactoe.js → tictactoe.js} +26 -26
  90. package/tools/token.js +4 -4
  91. package/tools/update.js +1 -2
  92. package/tools/watch.js +132 -112
  93. package/tools/who.js +20 -40
  94. package/tools/{_deprecated/wordassociation.js → wordassociation.js} +23 -20
  95. package/tools/workshop-buddy.js +52 -53
  96. package/tools/x-mentions.js +0 -1
  97. package/tools/x-reply.js +0 -1
  98. package/twitter.js +14 -20
  99. package/version.json +8 -10
  100. package/analytics.js +0 -107
  101. package/auth-store.js +0 -148
  102. package/auto-update.js +0 -130
  103. package/bridges/bridge-monitor.js +0 -388
  104. package/bridges/discord-bot.js +0 -431
  105. package/bridges/farcaster.js +0 -299
  106. package/bridges/telegram.js +0 -261
  107. package/bridges/webhook-health.js +0 -420
  108. package/bridges/webhook-server.js +0 -437
  109. package/bridges/whatsapp.js +0 -441
  110. package/bridges/x-webhook.js +0 -423
  111. package/games/arcade.js +0 -406
  112. package/games/chess.js +0 -451
  113. package/games/colorguess.js +0 -343
  114. package/games/crossword-words.js +0 -171
  115. package/games/crossword.js +0 -461
  116. package/games/drawing.js +0 -347
  117. package/games/gameroulette.js +0 -300
  118. package/games/gamerouter.js +0 -336
  119. package/games/gamestatus.js +0 -337
  120. package/games/guessnumber.js +0 -209
  121. package/games/hangman.js +0 -279
  122. package/games/memory.js +0 -338
  123. package/games/multiplayer-tictactoe.js +0 -389
  124. package/games/pixelart.js +0 -399
  125. package/games/quickduel.js +0 -354
  126. package/games/riddle.js +0 -371
  127. package/games/rockpaperscissors.js +0 -291
  128. package/games/snake.js +0 -406
  129. package/games/storybuilder.js +0 -343
  130. package/games/tictactoe.js +0 -345
  131. package/games/twentyquestions.js +0 -286
  132. package/games/twotruths.js +0 -207
  133. package/games/werewolf.js +0 -508
  134. package/games/wordassociation.js +0 -247
  135. package/games/wordchain.js +0 -135
  136. package/intelligence/interests.js +0 -369
  137. package/notification-emitter.js +0 -77
  138. package/setup.js +0 -480
  139. package/smart-inbox.js +0 -276
  140. package/tools/_deprecated/auto-suggest-connections.js +0 -304
  141. package/tools/_deprecated/bootstrap-skills.js +0 -231
  142. package/tools/_deprecated/bridge-dashboard.js +0 -342
  143. package/tools/_deprecated/bridge-health.js +0 -400
  144. package/tools/_deprecated/bridge-live.js +0 -384
  145. package/tools/_deprecated/bridges.js +0 -383
  146. package/tools/_deprecated/colorguess.js +0 -281
  147. package/tools/_deprecated/discover-insights.js +0 -379
  148. package/tools/_deprecated/discover-momentum.js +0 -256
  149. package/tools/_deprecated/discovery-analytics.js +0 -345
  150. package/tools/_deprecated/discovery-auto-suggest.js +0 -275
  151. package/tools/_deprecated/discovery-bootstrap.js +0 -267
  152. package/tools/_deprecated/discovery-daily.js +0 -375
  153. package/tools/_deprecated/discovery-dashboard.js +0 -385
  154. package/tools/_deprecated/discovery-digest.js +0 -314
  155. package/tools/_deprecated/discovery-hub.js +0 -357
  156. package/tools/_deprecated/discovery-insights.js +0 -384
  157. package/tools/_deprecated/discovery-momentum.js +0 -281
  158. package/tools/_deprecated/discovery-monitor.js +0 -319
  159. package/tools/_deprecated/discovery-proactive.js +0 -300
  160. package/tools/_deprecated/draw.js +0 -317
  161. package/tools/_deprecated/farcaster.js +0 -307
  162. package/tools/_deprecated/games-catalog.js +0 -376
  163. package/tools/_deprecated/games.js +0 -313
  164. package/tools/_deprecated/guessnumber.js +0 -194
  165. package/tools/_deprecated/hangman.js +0 -129
  166. package/tools/_deprecated/multiplayer-tictactoe.js +0 -303
  167. package/tools/_deprecated/riddle.js +0 -240
  168. package/tools/_deprecated/run-bootstrap.js +0 -69
  169. package/tools/_deprecated/skills-analytics.js +0 -349
  170. package/tools/_deprecated/skills-bootstrap.js +0 -301
  171. package/tools/_deprecated/skills-dashboard.js +0 -268
  172. package/tools/_deprecated/skills.js +0 -380
  173. package/tools/_deprecated/smart-intro.js +0 -353
  174. package/tools/_deprecated/storybuilder.js +0 -331
  175. package/tools/_deprecated/telegram-bot.js +0 -183
  176. package/tools/_deprecated/telegram-setup.js +0 -214
  177. package/tools/_deprecated/twentyquestions.js +0 -143
  178. package/tools/_shared.js +0 -234
  179. package/tools/_work-context.js +0 -338
  180. package/tools/_work-context.manual-test.js +0 -199
  181. package/tools/_work-context.test.js +0 -260
  182. package/tools/activity.js +0 -220
  183. package/tools/agent-treasury.js +0 -288
  184. package/tools/analytics.js +0 -191
  185. package/tools/approve.js +0 -197
  186. package/tools/arcade.js +0 -173
  187. package/tools/artifacts-price.js +0 -107
  188. package/tools/ask-expert.js +0 -160
  189. package/tools/available.js +0 -120
  190. package/tools/become-expert.js +0 -150
  191. package/tools/broadcast.js +0 -325
  192. package/tools/chat.js +0 -202
  193. package/tools/collaborative-drawing.js +0 -286
  194. package/tools/connection-status.js +0 -178
  195. package/tools/earnings.js +0 -126
  196. package/tools/friends.js +0 -207
  197. package/tools/genesis.js +0 -233
  198. package/tools/gig-browse.js +0 -206
  199. package/tools/gig-complete.js +0 -144
  200. package/tools/health.js +0 -87
  201. package/tools/leaderboard.js +0 -117
  202. package/tools/lib/git-apply.js +0 -206
  203. package/tools/lib/git-bundle.js +0 -407
  204. package/tools/mint.js +0 -377
  205. package/tools/plan.js +0 -225
  206. package/tools/profile.js +0 -219
  207. package/tools/proof-of-work.js +0 -144
  208. package/tools/pulse.js +0 -218
  209. package/tools/reply.js +0 -166
  210. package/tools/reputation.js +0 -175
  211. package/tools/schedule.js +0 -367
  212. package/tools/search-messages.js +0 -123
  213. package/tools/session.js +0 -467
  214. package/tools/session_price.js +0 -128
  215. package/tools/smart-check.js +0 -201
  216. package/tools/social-processor.js +0 -445
  217. package/tools/streak.js +0 -147
  218. package/tools/stuck.js +0 -297
  219. package/tools/subscribe.js +0 -148
  220. package/tools/subscriptions.js +0 -134
  221. package/tools/tip.js +0 -193
  222. package/tools/wallet.js +0 -269
  223. package/tools/webhook-test.js +0 -388
  224. package/tools/withdraw.js +0 -145
  225. package/tools/work-summary.js +0 -96
  226. package/tools/workshop.js +0 -327
  227. /package/tools/{l2-bridge.js → _experimental/l2-bridge.js} +0 -0
  228. /package/tools/{l2.js → _experimental/l2.js} +0 -0
  229. /package/tools/{_deprecated/away.js → away.js} +0 -0
package/games/werewolf.js DELETED
@@ -1,508 +0,0 @@
1
- /**
2
- * Werewolf - Social deduction game for /vibe
3
- *
4
- * A party game where villagers try to identify the werewolves
5
- * before they're all eliminated.
6
- *
7
- * Roles:
8
- * - Villager: Vote to eliminate werewolves during the day
9
- * - Werewolf: Kill villagers at night, blend in during day
10
- * - Seer: Can reveal one player's role each night
11
- *
12
- * Win conditions:
13
- * - Villagers win: All werewolves eliminated
14
- * - Werewolves win: Werewolves equal or outnumber villagers
15
- */
16
-
17
- const ROLES = {
18
- VILLAGER: 'villager',
19
- WEREWOLF: 'werewolf',
20
- SEER: 'seer'
21
- };
22
-
23
- const PHASES = {
24
- LOBBY: 'lobby', // Waiting for players
25
- NIGHT: 'night', // Werewolves choose victim, seer investigates
26
- DAY: 'day', // Discussion
27
- VOTING: 'voting', // Vote to eliminate
28
- ENDED: 'ended' // Game over
29
- };
30
-
31
- // Role distribution based on player count
32
- function getRoleDistribution(playerCount) {
33
- if (playerCount < 4) return null;
34
-
35
- // 4-5 players: 1 werewolf, 1 seer, rest villagers
36
- // 6-7 players: 2 werewolves, 1 seer, rest villagers
37
- // 8+ players: 2 werewolves, 1 seer, rest villagers
38
-
39
- const werewolfCount = playerCount >= 6 ? 2 : 1;
40
- const seerCount = 1;
41
- const villagerCount = playerCount - werewolfCount - seerCount;
42
-
43
- return {
44
- [ROLES.WEREWOLF]: werewolfCount,
45
- [ROLES.SEER]: seerCount,
46
- [ROLES.VILLAGER]: villagerCount
47
- };
48
- }
49
-
50
- // Shuffle array (Fisher-Yates)
51
- function shuffle(array) {
52
- const arr = [...array];
53
- for (let i = arr.length - 1; i > 0; i--) {
54
- const j = Math.floor(Math.random() * (i + 1));
55
- [arr[i], arr[j]] = [arr[j], arr[i]];
56
- }
57
- return arr;
58
- }
59
-
60
- // Create initial game state
61
- function createInitialState(host) {
62
- return {
63
- host,
64
- phase: PHASES.LOBBY,
65
- players: [host],
66
- roles: {}, // { handle: role }
67
- alive: [], // handles of living players
68
- dead: [], // { handle, role, eliminatedBy: 'werewolf'|'vote' }
69
- round: 0,
70
-
71
- // Night actions
72
- werewolfTarget: null,
73
- seerTarget: null,
74
- seerReveals: {}, // { handle: role } - what seer has learned
75
-
76
- // Voting
77
- votes: {}, // { voter: target }
78
-
79
- // History
80
- events: [],
81
-
82
- createdAt: new Date().toISOString()
83
- };
84
- }
85
-
86
- // Join the game
87
- function joinGame(gameState, player) {
88
- if (gameState.phase !== PHASES.LOBBY) {
89
- return { error: 'Game already started' };
90
- }
91
-
92
- if (gameState.players.includes(player)) {
93
- return { error: 'Already in the game' };
94
- }
95
-
96
- if (gameState.players.length >= 10) {
97
- return { error: 'Game is full (max 10 players)' };
98
- }
99
-
100
- return {
101
- success: true,
102
- gameState: {
103
- ...gameState,
104
- players: [...gameState.players, player]
105
- }
106
- };
107
- }
108
-
109
- // Start the game
110
- function startGame(gameState, player) {
111
- if (player !== gameState.host) {
112
- return { error: 'Only host can start the game' };
113
- }
114
-
115
- if (gameState.phase !== PHASES.LOBBY) {
116
- return { error: 'Game already started' };
117
- }
118
-
119
- const playerCount = gameState.players.length;
120
- if (playerCount < 4) {
121
- return { error: 'Need at least 4 players to start' };
122
- }
123
-
124
- const distribution = getRoleDistribution(playerCount);
125
-
126
- // Create role pool
127
- const rolePool = [];
128
- for (const [role, count] of Object.entries(distribution)) {
129
- for (let i = 0; i < count; i++) {
130
- rolePool.push(role);
131
- }
132
- }
133
-
134
- // Shuffle and assign roles
135
- const shuffledRoles = shuffle(rolePool);
136
- const roles = {};
137
- gameState.players.forEach((p, i) => {
138
- roles[p] = shuffledRoles[i];
139
- });
140
-
141
- return {
142
- success: true,
143
- gameState: {
144
- ...gameState,
145
- phase: PHASES.NIGHT,
146
- roles,
147
- alive: [...gameState.players],
148
- round: 1,
149
- events: [`🌙 Night 1 begins. The village sleeps...`]
150
- }
151
- };
152
- }
153
-
154
- // Werewolf chooses target
155
- function werewolfKill(gameState, werewolf, target) {
156
- if (gameState.phase !== PHASES.NIGHT) {
157
- return { error: 'Can only kill at night' };
158
- }
159
-
160
- if (gameState.roles[werewolf] !== ROLES.WEREWOLF) {
161
- return { error: 'Only werewolves can kill' };
162
- }
163
-
164
- if (!gameState.alive.includes(target)) {
165
- return { error: 'Target is not alive' };
166
- }
167
-
168
- if (gameState.roles[target] === ROLES.WEREWOLF) {
169
- return { error: 'Cannot target fellow werewolf' };
170
- }
171
-
172
- return {
173
- success: true,
174
- gameState: {
175
- ...gameState,
176
- werewolfTarget: target
177
- }
178
- };
179
- }
180
-
181
- // Seer investigates
182
- function seerInvestigate(gameState, seer, target) {
183
- if (gameState.phase !== PHASES.NIGHT) {
184
- return { error: 'Can only investigate at night' };
185
- }
186
-
187
- if (gameState.roles[seer] !== ROLES.SEER) {
188
- return { error: 'Only the seer can investigate' };
189
- }
190
-
191
- if (!gameState.alive.includes(seer)) {
192
- return { error: 'You are dead' };
193
- }
194
-
195
- if (!gameState.alive.includes(target)) {
196
- return { error: 'Target is not alive' };
197
- }
198
-
199
- const targetRole = gameState.roles[target];
200
- const isWerewolf = targetRole === ROLES.WEREWOLF;
201
-
202
- return {
203
- success: true,
204
- gameState: {
205
- ...gameState,
206
- seerTarget: target,
207
- seerReveals: {
208
- ...gameState.seerReveals,
209
- [target]: isWerewolf ? 'werewolf' : 'not werewolf'
210
- }
211
- },
212
- reveal: {
213
- target,
214
- result: isWerewolf ? '🐺 WEREWOLF' : '👤 Not a werewolf'
215
- }
216
- };
217
- }
218
-
219
- // Advance from night to day
220
- function advanceToDay(gameState) {
221
- if (gameState.phase !== PHASES.NIGHT) {
222
- return { error: 'Not night phase' };
223
- }
224
-
225
- const newState = { ...gameState };
226
- const events = [...gameState.events];
227
-
228
- // Process werewolf kill
229
- if (gameState.werewolfTarget) {
230
- const victim = gameState.werewolfTarget;
231
- const victimRole = gameState.roles[victim];
232
-
233
- newState.alive = gameState.alive.filter(p => p !== victim);
234
- newState.dead = [
235
- ...gameState.dead,
236
- { handle: victim, role: victimRole, eliminatedBy: 'werewolf' }
237
- ];
238
-
239
- events.push(`☀️ Day ${gameState.round} begins.`);
240
- events.push(`💀 @${victim} was found dead! They were a ${victimRole}.`);
241
- } else {
242
- events.push(`☀️ Day ${gameState.round} begins. No one died last night.`);
243
- }
244
-
245
- // Check win condition
246
- const winCheck = checkWinCondition(newState);
247
- if (winCheck.gameOver) {
248
- return {
249
- success: true,
250
- gameState: {
251
- ...newState,
252
- phase: PHASES.ENDED,
253
- winner: winCheck.winner,
254
- events: [...events, winCheck.message]
255
- }
256
- };
257
- }
258
-
259
- return {
260
- success: true,
261
- gameState: {
262
- ...newState,
263
- phase: PHASES.DAY,
264
- werewolfTarget: null,
265
- seerTarget: null,
266
- events
267
- }
268
- };
269
- }
270
-
271
- // Start voting phase
272
- function startVoting(gameState, player) {
273
- if (gameState.phase !== PHASES.DAY) {
274
- return { error: 'Can only start voting during the day' };
275
- }
276
-
277
- return {
278
- success: true,
279
- gameState: {
280
- ...gameState,
281
- phase: PHASES.VOTING,
282
- votes: {},
283
- events: [...gameState.events, `🗳️ Voting has begun! Vote to eliminate a suspect.`]
284
- }
285
- };
286
- }
287
-
288
- // Cast vote
289
- function castVote(gameState, voter, target) {
290
- if (gameState.phase !== PHASES.VOTING) {
291
- return { error: 'Not in voting phase' };
292
- }
293
-
294
- if (!gameState.alive.includes(voter)) {
295
- return { error: 'Dead players cannot vote' };
296
- }
297
-
298
- if (!gameState.alive.includes(target) && target !== 'skip') {
299
- return { error: 'Target is not alive (use "skip" to skip vote)' };
300
- }
301
-
302
- return {
303
- success: true,
304
- gameState: {
305
- ...gameState,
306
- votes: { ...gameState.votes, [voter]: target }
307
- }
308
- };
309
- }
310
-
311
- // Tally votes and execute
312
- function tallyVotes(gameState) {
313
- if (gameState.phase !== PHASES.VOTING) {
314
- return { error: 'Not in voting phase' };
315
- }
316
-
317
- const { votes, alive } = gameState;
318
- const voteCounts = {};
319
-
320
- for (const target of Object.values(votes)) {
321
- voteCounts[target] = (voteCounts[target] || 0) + 1;
322
- }
323
-
324
- // Find player with most votes
325
- let maxVotes = 0;
326
- let eliminated = null;
327
- let tie = false;
328
-
329
- for (const [target, count] of Object.entries(voteCounts)) {
330
- if (target === 'skip') continue;
331
- if (count > maxVotes) {
332
- maxVotes = count;
333
- eliminated = target;
334
- tie = false;
335
- } else if (count === maxVotes) {
336
- tie = true;
337
- }
338
- }
339
-
340
- const newState = { ...gameState };
341
- const events = [...gameState.events];
342
-
343
- // Show vote breakdown
344
- events.push(`📊 Votes: ${Object.entries(voteCounts).map(([t, c]) => `@${t}: ${c}`).join(', ')}`);
345
-
346
- if (tie || !eliminated || maxVotes < 2) {
347
- events.push(`🤷 No majority reached. No one is eliminated.`);
348
- } else {
349
- const role = gameState.roles[eliminated];
350
- newState.alive = alive.filter(p => p !== eliminated);
351
- newState.dead = [
352
- ...gameState.dead,
353
- { handle: eliminated, role, eliminatedBy: 'vote' }
354
- ];
355
- events.push(`⚰️ @${eliminated} has been eliminated! They were a ${role}.`);
356
- }
357
-
358
- // Check win condition
359
- const winCheck = checkWinCondition(newState);
360
- if (winCheck.gameOver) {
361
- return {
362
- success: true,
363
- gameState: {
364
- ...newState,
365
- phase: PHASES.ENDED,
366
- winner: winCheck.winner,
367
- events: [...events, winCheck.message]
368
- }
369
- };
370
- }
371
-
372
- // Advance to next night
373
- return {
374
- success: true,
375
- gameState: {
376
- ...newState,
377
- phase: PHASES.NIGHT,
378
- round: gameState.round + 1,
379
- votes: {},
380
- events: [...events, `🌙 Night ${gameState.round + 1} falls...`]
381
- }
382
- };
383
- }
384
-
385
- // Check win condition
386
- function checkWinCondition(gameState) {
387
- const { alive, roles } = gameState;
388
-
389
- const aliveWerewolves = alive.filter(p => roles[p] === ROLES.WEREWOLF);
390
- const aliveVillagers = alive.filter(p => roles[p] !== ROLES.WEREWOLF);
391
-
392
- if (aliveWerewolves.length === 0) {
393
- return {
394
- gameOver: true,
395
- winner: 'villagers',
396
- message: `🎉 The villagers win! All werewolves have been eliminated.`
397
- };
398
- }
399
-
400
- if (aliveWerewolves.length >= aliveVillagers.length) {
401
- return {
402
- gameOver: true,
403
- winner: 'werewolves',
404
- message: `🐺 The werewolves win! They now outnumber the villagers.`
405
- };
406
- }
407
-
408
- return { gameOver: false };
409
- }
410
-
411
- // Format game display
412
- function formatDisplay(gameState, viewerHandle) {
413
- const { phase, players, roles, alive, dead, round, votes, events, host, winner } = gameState;
414
- const viewerRole = roles[viewerHandle];
415
- const isAlive = alive.includes(viewerHandle);
416
-
417
- let display = `🐺 **Werewolf** `;
418
-
419
- if (phase === PHASES.LOBBY) {
420
- display += `(Lobby)\n\n`;
421
- display += `Host: @${host}\n`;
422
- display += `Players (${players.length}/10): ${players.map(p => `@${p}`).join(', ')}\n\n`;
423
- display += `Need ${Math.max(0, 4 - players.length)} more players to start.\n`;
424
- if (viewerHandle === host && players.length >= 4) {
425
- display += `Use \`vibe werewolf --start\` to begin!\n`;
426
- } else {
427
- display += `Use \`vibe werewolf --join\` to join!\n`;
428
- }
429
- return display;
430
- }
431
-
432
- display += `(Round ${round} - ${phase.toUpperCase()})\n\n`;
433
-
434
- // Show viewer's role (secret)
435
- if (viewerRole && isAlive) {
436
- const roleEmoji = viewerRole === ROLES.WEREWOLF ? '🐺' : viewerRole === ROLES.SEER ? '🔮' : '👤';
437
- display += `**Your role:** ${roleEmoji} ${viewerRole.toUpperCase()}\n`;
438
-
439
- // Show fellow werewolves
440
- if (viewerRole === ROLES.WEREWOLF) {
441
- const fellowWolves = alive.filter(p => roles[p] === ROLES.WEREWOLF && p !== viewerHandle);
442
- if (fellowWolves.length > 0) {
443
- display += `Fellow werewolves: ${fellowWolves.map(p => `@${p}`).join(', ')}\n`;
444
- }
445
- }
446
- display += '\n';
447
- }
448
-
449
- // Show alive players
450
- display += `**Alive (${alive.length}):** ${alive.map(p => `@${p}`).join(', ')}\n`;
451
- if (dead.length > 0) {
452
- display += `**Dead:** ${dead.map(d => `@${d.handle} (${d.role})`).join(', ')}\n`;
453
- }
454
- display += '\n';
455
-
456
- // Phase-specific info
457
- if (phase === PHASES.NIGHT) {
458
- if (viewerRole === ROLES.WEREWOLF && isAlive) {
459
- display += `🌙 Choose your victim: \`vibe werewolf --kill @player\`\n`;
460
- } else if (viewerRole === ROLES.SEER && isAlive) {
461
- display += `🔮 Investigate someone: \`vibe werewolf --investigate @player\`\n`;
462
- } else {
463
- display += `🌙 The village sleeps...\n`;
464
- }
465
- } else if (phase === PHASES.DAY) {
466
- display += `☀️ Discuss who might be a werewolf!\n`;
467
- display += `When ready: \`vibe werewolf --startvote\`\n`;
468
- } else if (phase === PHASES.VOTING) {
469
- display += `🗳️ Vote to eliminate: \`vibe werewolf --vote @player\`\n`;
470
- display += `Or skip: \`vibe werewolf --vote skip\`\n\n`;
471
- const voteCount = Object.keys(votes).length;
472
- display += `Votes cast: ${voteCount}/${alive.length}\n`;
473
- } else if (phase === PHASES.ENDED) {
474
- display += `🎮 **GAME OVER**\n`;
475
- display += `Winner: **${winner.toUpperCase()}**\n\n`;
476
- display += `**Roles were:**\n`;
477
- for (const [player, role] of Object.entries(roles)) {
478
- const emoji = role === ROLES.WEREWOLF ? '🐺' : role === ROLES.SEER ? '🔮' : '👤';
479
- display += `${emoji} @${player}: ${role}\n`;
480
- }
481
- }
482
-
483
- // Recent events
484
- if (events.length > 0) {
485
- display += `\n**Recent:**\n`;
486
- events.slice(-3).forEach(e => {
487
- display += `${e}\n`;
488
- });
489
- }
490
-
491
- return display;
492
- }
493
-
494
- module.exports = {
495
- ROLES,
496
- PHASES,
497
- createInitialState,
498
- joinGame,
499
- startGame,
500
- werewolfKill,
501
- seerInvestigate,
502
- advanceToDay,
503
- startVoting,
504
- castVote,
505
- tallyVotes,
506
- checkWinCondition,
507
- formatDisplay
508
- };