slashvibe-mcp 0.3.21 → 0.3.23

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 (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +280 -47
  3. package/auto-update.js +10 -15
  4. package/config.js +36 -31
  5. package/crypto.js +1 -6
  6. package/debug.js +12 -0
  7. package/discord.js +19 -19
  8. package/eslint.config.js +54 -0
  9. package/index.js +217 -207
  10. package/intelligence/index.js +2 -9
  11. package/intelligence/infer.js +10 -16
  12. package/intelligence/patterns.js +23 -18
  13. package/intelligence/proactive.js +16 -15
  14. package/intelligence/serendipity.js +57 -20
  15. package/memory.js +13 -8
  16. package/migrate-v2.js +72 -0
  17. package/notification-emitter.js +2 -2
  18. package/notify.js +39 -14
  19. package/package.json +28 -29
  20. package/post-install.js +141 -0
  21. package/presence.js +2 -2
  22. package/prompts.js +5 -9
  23. package/protocol/index.js +123 -87
  24. package/protocol/telegram-commands.js +36 -37
  25. package/store/api.js +358 -529
  26. package/store/local.js +9 -10
  27. package/store/profiles.js +48 -192
  28. package/store/reservations.js +2 -9
  29. package/store/skills.js +69 -71
  30. package/store/sqlite.js +355 -0
  31. package/test-skills-bootstrap.js +20 -0
  32. package/test-v2-integration.js +385 -0
  33. package/tools/_actions.js +48 -387
  34. package/tools/_connection-queue.js +45 -56
  35. package/tools/_discovery-enhanced.js +52 -57
  36. package/tools/_discovery.js +87 -185
  37. package/tools/{l2-status.js → _experimental/l2-status.js} +68 -70
  38. package/tools/{shipback.js → _experimental/shipback.js} +4 -3
  39. package/tools/_proactive-discovery.js +60 -73
  40. package/tools/_shared/index.js +41 -64
  41. package/tools/admin-inbox.js +10 -15
  42. package/tools/agents.js +1 -1
  43. package/tools/artifact-create.js +13 -23
  44. package/tools/artifact-view.js +4 -4
  45. package/tools/{_deprecated/back.js → back.js} +1 -1
  46. package/tools/bye.js +3 -5
  47. package/tools/consent.js +2 -2
  48. package/tools/context.js +9 -10
  49. package/tools/crossword.js +3 -2
  50. package/tools/discover.js +94 -356
  51. package/tools/dm.js +27 -86
  52. package/tools/doctor.js +12 -41
  53. package/tools/drawing.js +34 -20
  54. package/tools/echo.js +11 -11
  55. package/tools/feed.js +30 -58
  56. package/tools/follow.js +64 -187
  57. package/tools/{_deprecated/forget.js → forget.js} +4 -7
  58. package/tools/game.js +144 -48
  59. package/tools/handoff.js +6 -8
  60. package/tools/help.js +3 -3
  61. package/tools/idea.js +15 -27
  62. package/tools/inbox.js +121 -293
  63. package/tools/init.js +54 -151
  64. package/tools/invite.js +8 -21
  65. package/tools/migrate.js +27 -24
  66. package/tools/multiplayer-game.js +50 -40
  67. package/tools/{_deprecated/mute.js → mute.js} +4 -3
  68. package/tools/notifications.js +58 -48
  69. package/tools/observe.js +12 -15
  70. package/tools/onboarding.js +8 -11
  71. package/tools/open.js +13 -144
  72. package/tools/party-game.js +23 -12
  73. package/tools/patterns.js +2 -1
  74. package/tools/ping.js +5 -7
  75. package/tools/react.js +28 -30
  76. package/tools/{_deprecated/recall.js → recall.js} +5 -10
  77. package/tools/release.js +4 -2
  78. package/tools/{_deprecated/remember.js → remember.js} +4 -6
  79. package/tools/report.js +2 -2
  80. package/tools/request.js +6 -26
  81. package/tools/reserve.js +1 -1
  82. package/tools/session-fork.js +97 -0
  83. package/tools/session-save.js +109 -0
  84. package/tools/settings.js +30 -99
  85. package/tools/ship.js +74 -56
  86. package/tools/{_deprecated/skills-exchange.js → skills-exchange.js} +38 -39
  87. package/tools/social-inbox.js +22 -28
  88. package/tools/social-post.js +24 -27
  89. package/tools/solo-game.js +54 -46
  90. package/tools/start.js +14 -148
  91. package/tools/status.js +21 -68
  92. package/tools/submit.js +4 -2
  93. package/tools/suggest-tags.js +36 -33
  94. package/tools/summarize.js +19 -16
  95. package/tools/tag-suggestions.js +72 -73
  96. package/tools/test.js +1 -1
  97. package/tools/{_deprecated/tictactoe.js → tictactoe.js} +26 -26
  98. package/tools/token.js +4 -4
  99. package/tools/update.js +1 -2
  100. package/tools/watch.js +132 -112
  101. package/tools/who.js +20 -40
  102. package/tools/{_deprecated/wordassociation.js → wordassociation.js} +23 -20
  103. package/tools/workshop-buddy.js +52 -53
  104. package/tools/x-mentions.js +0 -1
  105. package/tools/x-reply.js +0 -1
  106. package/twitter.js +14 -20
  107. package/version.json +8 -10
  108. package/webhook-runner.js +132 -0
  109. package/auth-store.js +0 -148
  110. package/bridges/bridge-monitor.js +0 -388
  111. package/bridges/discord-bot.js +0 -431
  112. package/bridges/farcaster.js +0 -299
  113. package/bridges/telegram.js +0 -261
  114. package/bridges/webhook-health.js +0 -420
  115. package/bridges/webhook-server.js +0 -437
  116. package/bridges/whatsapp.js +0 -441
  117. package/bridges/x-webhook.js +0 -423
  118. package/games/arcade.js +0 -406
  119. package/games/chess.js +0 -451
  120. package/games/colorguess.js +0 -343
  121. package/games/crossword-words.js +0 -171
  122. package/games/crossword.js +0 -461
  123. package/games/drawing.js +0 -347
  124. package/games/gameroulette.js +0 -300
  125. package/games/gamerouter.js +0 -336
  126. package/games/gamestatus.js +0 -337
  127. package/games/guessnumber.js +0 -209
  128. package/games/hangman.js +0 -279
  129. package/games/memory.js +0 -338
  130. package/games/multiplayer-tictactoe.js +0 -389
  131. package/games/pixelart.js +0 -399
  132. package/games/quickduel.js +0 -354
  133. package/games/riddle.js +0 -371
  134. package/games/rockpaperscissors.js +0 -291
  135. package/games/snake.js +0 -406
  136. package/games/storybuilder.js +0 -343
  137. package/games/tictactoe.js +0 -345
  138. package/games/twentyquestions.js +0 -286
  139. package/games/twotruths.js +0 -207
  140. package/games/werewolf.js +0 -508
  141. package/games/wordassociation.js +0 -247
  142. package/games/wordchain.js +0 -135
  143. package/intelligence/interests.js +0 -369
  144. package/setup.js +0 -480
  145. package/smart-inbox.js +0 -276
  146. package/tools/_deprecated/auto-suggest-connections.js +0 -304
  147. package/tools/_deprecated/bootstrap-skills.js +0 -231
  148. package/tools/_deprecated/bridge-dashboard.js +0 -342
  149. package/tools/_deprecated/bridge-health.js +0 -400
  150. package/tools/_deprecated/bridge-live.js +0 -384
  151. package/tools/_deprecated/bridges.js +0 -383
  152. package/tools/_deprecated/colorguess.js +0 -281
  153. package/tools/_deprecated/discover-insights.js +0 -379
  154. package/tools/_deprecated/discover-momentum.js +0 -256
  155. package/tools/_deprecated/discovery-analytics.js +0 -345
  156. package/tools/_deprecated/discovery-auto-suggest.js +0 -275
  157. package/tools/_deprecated/discovery-bootstrap.js +0 -267
  158. package/tools/_deprecated/discovery-daily.js +0 -375
  159. package/tools/_deprecated/discovery-dashboard.js +0 -385
  160. package/tools/_deprecated/discovery-digest.js +0 -314
  161. package/tools/_deprecated/discovery-hub.js +0 -357
  162. package/tools/_deprecated/discovery-insights.js +0 -384
  163. package/tools/_deprecated/discovery-momentum.js +0 -281
  164. package/tools/_deprecated/discovery-monitor.js +0 -319
  165. package/tools/_deprecated/discovery-proactive.js +0 -300
  166. package/tools/_deprecated/draw.js +0 -317
  167. package/tools/_deprecated/farcaster.js +0 -307
  168. package/tools/_deprecated/games-catalog.js +0 -376
  169. package/tools/_deprecated/games.js +0 -313
  170. package/tools/_deprecated/guessnumber.js +0 -194
  171. package/tools/_deprecated/hangman.js +0 -129
  172. package/tools/_deprecated/multiplayer-tictactoe.js +0 -303
  173. package/tools/_deprecated/riddle.js +0 -240
  174. package/tools/_deprecated/run-bootstrap.js +0 -69
  175. package/tools/_deprecated/skills-analytics.js +0 -349
  176. package/tools/_deprecated/skills-bootstrap.js +0 -301
  177. package/tools/_deprecated/skills-dashboard.js +0 -268
  178. package/tools/_deprecated/skills.js +0 -380
  179. package/tools/_deprecated/smart-intro.js +0 -353
  180. package/tools/_deprecated/storybuilder.js +0 -331
  181. package/tools/_deprecated/telegram-bot.js +0 -183
  182. package/tools/_deprecated/telegram-setup.js +0 -214
  183. package/tools/_deprecated/twentyquestions.js +0 -143
  184. package/tools/_shared.js +0 -234
  185. package/tools/_work-context.js +0 -338
  186. package/tools/_work-context.manual-test.js +0 -199
  187. package/tools/_work-context.test.js +0 -260
  188. package/tools/activity.js +0 -220
  189. package/tools/agent-treasury.js +0 -288
  190. package/tools/analytics.js +0 -191
  191. package/tools/approve.js +0 -197
  192. package/tools/arcade.js +0 -173
  193. package/tools/artifacts-price.js +0 -107
  194. package/tools/ask-expert.js +0 -160
  195. package/tools/available.js +0 -120
  196. package/tools/become-expert.js +0 -150
  197. package/tools/broadcast.js +0 -325
  198. package/tools/chat.js +0 -202
  199. package/tools/collaborative-drawing.js +0 -286
  200. package/tools/connection-status.js +0 -178
  201. package/tools/earnings.js +0 -126
  202. package/tools/friends.js +0 -207
  203. package/tools/genesis.js +0 -233
  204. package/tools/gig-browse.js +0 -206
  205. package/tools/gig-complete.js +0 -144
  206. package/tools/health.js +0 -87
  207. package/tools/leaderboard.js +0 -117
  208. package/tools/lib/git-apply.js +0 -206
  209. package/tools/lib/git-bundle.js +0 -407
  210. package/tools/mint.js +0 -377
  211. package/tools/plan.js +0 -225
  212. package/tools/profile.js +0 -219
  213. package/tools/proof-of-work.js +0 -144
  214. package/tools/pulse.js +0 -218
  215. package/tools/reply.js +0 -166
  216. package/tools/reputation.js +0 -175
  217. package/tools/schedule.js +0 -367
  218. package/tools/search-messages.js +0 -123
  219. package/tools/session.js +0 -467
  220. package/tools/session_price.js +0 -128
  221. package/tools/smart-check.js +0 -201
  222. package/tools/social-processor.js +0 -445
  223. package/tools/streak.js +0 -147
  224. package/tools/stuck.js +0 -297
  225. package/tools/subscribe.js +0 -148
  226. package/tools/subscriptions.js +0 -134
  227. package/tools/tip.js +0 -193
  228. package/tools/wallet.js +0 -269
  229. package/tools/webhook-test.js +0 -388
  230. package/tools/withdraw.js +0 -145
  231. package/tools/work-summary.js +0 -96
  232. package/tools/workshop.js +0 -327
  233. /package/tools/{l2-bridge.js → _experimental/l2-bridge.js} +0 -0
  234. /package/tools/{l2.js → _experimental/l2.js} +0 -0
  235. /package/tools/{_deprecated/away.js → away.js} +0 -0
@@ -1,384 +0,0 @@
1
- /**
2
- * vibe discovery-insights — Discovery System Analytics
3
- *
4
- * Provides insights into connection patterns, popular skills,
5
- * and optimization recommendations for better matching.
6
- *
7
- * Commands:
8
- * - discovery-insights stats — Show discovery system statistics
9
- * - discovery-insights skills — Most popular/requested skills
10
- * - discovery-insights gaps — Identify skill gaps in community
11
- * - discovery-insights trends — Recent activity trends
12
- */
13
-
14
- const config = require('../config');
15
- const store = require('../store');
16
- const userProfiles = require('../store/profiles');
17
- const { formatTimeAgo, requireInit } = require('./_shared');
18
-
19
- const definition = {
20
- name: 'vibe_discovery_insights',
21
- description: 'Analytics and insights for the discovery system to optimize matching.',
22
- inputSchema: {
23
- type: 'object',
24
- properties: {
25
- command: {
26
- type: 'string',
27
- enum: ['stats', 'skills', 'gaps', 'trends'],
28
- description: 'Discovery insights command to run'
29
- }
30
- }
31
- }
32
- };
33
-
34
- // Analyze community profiles
35
- async function analyzeProfiles() {
36
- const allProfiles = await userProfiles.getAllProfiles();
37
-
38
- const stats = {
39
- totalUsers: allProfiles.length,
40
- withBuilding: 0,
41
- withTags: 0,
42
- withInterests: 0,
43
- avgSkillsPerUser: 0,
44
- avgInterestsPerUser: 0,
45
- completionRate: 0
46
- };
47
-
48
- let totalSkills = 0;
49
- let totalInterests = 0;
50
-
51
- for (const profile of allProfiles) {
52
- if (profile.building) stats.withBuilding++;
53
- if (profile.tags && profile.tags.length > 0) {
54
- stats.withTags++;
55
- totalSkills += profile.tags.length;
56
- }
57
- if (profile.interests && profile.interests.length > 0) {
58
- stats.withInterests++;
59
- totalInterests += profile.interests.length;
60
- }
61
- }
62
-
63
- stats.avgSkillsPerUser = Math.round((totalSkills / Math.max(stats.withTags, 1)) * 10) / 10;
64
- stats.avgInterestsPerUser = Math.round((totalInterests / Math.max(stats.withInterests, 1)) * 10) / 10;
65
- stats.completionRate = Math.round((stats.withBuilding + stats.withTags + stats.withInterests) / (stats.totalUsers * 3) * 100);
66
-
67
- return stats;
68
- }
69
-
70
- // Analyze skill distribution
71
- async function analyzeSkills() {
72
- const allProfiles = await userProfiles.getAllProfiles();
73
- const skillExchanges = await store.getSkillExchanges() || [];
74
-
75
- const skillCounts = {};
76
- const requestedSkills = {};
77
- const offeredSkills = {};
78
-
79
- // Count skills from profiles
80
- for (const profile of allProfiles) {
81
- if (profile.tags) {
82
- for (const skill of profile.tags) {
83
- skillCounts[skill] = (skillCounts[skill] || 0) + 1;
84
- }
85
- }
86
- }
87
-
88
- // Count skills from exchanges
89
- for (const exchange of skillExchanges) {
90
- if (exchange.type === 'offer') {
91
- offeredSkills[exchange.skill] = (offeredSkills[exchange.skill] || 0) + 1;
92
- } else if (exchange.type === 'request') {
93
- requestedSkills[exchange.skill] = (requestedSkills[exchange.skill] || 0) + 1;
94
- }
95
- }
96
-
97
- // Sort by popularity
98
- const popularSkills = Object.entries(skillCounts)
99
- .sort(([,a], [,b]) => b - a)
100
- .slice(0, 10);
101
-
102
- const topRequested = Object.entries(requestedSkills)
103
- .sort(([,a], [,b]) => b - a)
104
- .slice(0, 5);
105
-
106
- const topOffered = Object.entries(offeredSkills)
107
- .sort(([,a], [,b]) => b - a)
108
- .slice(0, 5);
109
-
110
- return {
111
- popular: popularSkills,
112
- requested: topRequested,
113
- offered: topOffered,
114
- totalSkills: Object.keys(skillCounts).length
115
- };
116
- }
117
-
118
- // Identify skill gaps (high demand, low supply)
119
- async function identifySkillGaps() {
120
- const skillExchanges = await store.getSkillExchanges() || [];
121
- const allProfiles = await userProfiles.getAllProfiles();
122
-
123
- const requests = {};
124
- const offers = {};
125
- const profileSkills = {};
126
-
127
- // Count requests and offers
128
- for (const exchange of skillExchanges) {
129
- if (exchange.type === 'request') {
130
- requests[exchange.skill] = (requests[exchange.skill] || 0) + 1;
131
- } else if (exchange.type === 'offer') {
132
- offers[exchange.skill] = (offers[exchange.skill] || 0) + 1;
133
- }
134
- }
135
-
136
- // Count skills in profiles
137
- for (const profile of allProfiles) {
138
- if (profile.tags) {
139
- for (const skill of profile.tags) {
140
- profileSkills[skill] = (profileSkills[skill] || 0) + 1;
141
- }
142
- }
143
- }
144
-
145
- // Find gaps (requested but not available)
146
- const gaps = [];
147
- for (const [skill, requestCount] of Object.entries(requests)) {
148
- const offerCount = offers[skill] || 0;
149
- const profileCount = profileSkills[skill] || 0;
150
- const totalSupply = offerCount + profileCount;
151
-
152
- if (requestCount > totalSupply) {
153
- gaps.push({
154
- skill,
155
- demand: requestCount,
156
- supply: totalSupply,
157
- gap: requestCount - totalSupply
158
- });
159
- }
160
- }
161
-
162
- return gaps.sort((a, b) => b.gap - a.gap);
163
- }
164
-
165
- // Analyze recent trends
166
- async function analyzeTrends() {
167
- const skillExchanges = await store.getSkillExchanges() || [];
168
- const allProfiles = await userProfiles.getAllProfiles();
169
-
170
- const now = Date.now();
171
- const day = 24 * 60 * 60 * 1000;
172
- const week = 7 * day;
173
-
174
- // Recent skill exchange activity
175
- const recentExchanges = skillExchanges.filter(e => (now - e.timestamp) < week);
176
- const todayExchanges = skillExchanges.filter(e => (now - e.timestamp) < day);
177
-
178
- // Active users (updated recently)
179
- const activeUsers = allProfiles.filter(p => p.lastSeen && (now - p.lastSeen) < day);
180
-
181
- // Trending skills (most mentioned recently)
182
- const recentSkills = {};
183
- for (const exchange of recentExchanges) {
184
- recentSkills[exchange.skill] = (recentSkills[exchange.skill] || 0) + 1;
185
- }
186
-
187
- const trending = Object.entries(recentSkills)
188
- .sort(([,a], [,b]) => b - a)
189
- .slice(0, 5);
190
-
191
- return {
192
- recentExchanges: recentExchanges.length,
193
- todayExchanges: todayExchanges.length,
194
- activeUsers: activeUsers.length,
195
- trending,
196
- weeklyGrowth: Math.round((recentExchanges.length / Math.max(skillExchanges.length - recentExchanges.length, 1)) * 100)
197
- };
198
- }
199
-
200
- async function handler(args) {
201
- const initCheck = requireInit();
202
- if (initCheck) return initCheck;
203
-
204
- const command = args.command || 'stats';
205
-
206
- let display = '';
207
-
208
- try {
209
- switch (command) {
210
- case 'stats': {
211
- const stats = await analyzeProfiles();
212
-
213
- display = `## Discovery System Statistics 📊\n\n`;
214
-
215
- display += `### Community Profile Health\n`;
216
- display += `**Total Users:** ${stats.totalUsers}\n`;
217
- display += `**Profile Completion:** ${stats.completionRate}%\n\n`;
218
-
219
- display += `**Profile Elements:**\n`;
220
- display += `• Building something: ${stats.withBuilding} users\n`;
221
- display += `• Have skill tags: ${stats.withTags} users\n`;
222
- display += `• Listed interests: ${stats.withInterests} users\n\n`;
223
-
224
- display += `**Depth Metrics:**\n`;
225
- display += `• Avg skills per user: ${stats.avgSkillsPerUser}\n`;
226
- display += `• Avg interests per user: ${stats.avgInterestsPerUser}\n\n`;
227
-
228
- // Recommendations
229
- display += `### Optimization Recommendations\n`;
230
- if (stats.completionRate < 60) {
231
- display += `🎯 **Focus:** Encourage profile completion (${100 - stats.completionRate}% missing data)\n`;
232
- }
233
- if (stats.withTags < stats.totalUsers * 0.5) {
234
- display += `🏷️ **Priority:** More users need skill tags for better matching\n`;
235
- }
236
- if (stats.withBuilding < stats.totalUsers * 0.7) {
237
- display += `🔨 **Opportunity:** Encourage users to share what they're building\n`;
238
- }
239
-
240
- display += `\n**Commands:**\n`;
241
- display += `• \`discovery-insights skills\` — Popular skills analysis\n`;
242
- display += `• \`discovery-insights gaps\` — Identify skill shortages\n`;
243
- display += `• \`discovery-insights trends\` — Recent activity patterns`;
244
- break;
245
- }
246
-
247
- case 'skills': {
248
- const analysis = await analyzeSkills();
249
-
250
- display = `## Skills Analysis 🛠️\n\n`;
251
-
252
- if (analysis.popular.length > 0) {
253
- display += `### Most Popular Skills in Community\n`;
254
- for (const [skill, count] of analysis.popular) {
255
- const bar = '▓'.repeat(Math.min(Math.round(count / analysis.popular[0][1] * 10), 10));
256
- display += `**${skill}** (${count}) ${bar}\n`;
257
- }
258
- display += `\n`;
259
- }
260
-
261
- if (analysis.requested.length > 0) {
262
- display += `### Most Requested Skills\n`;
263
- for (const [skill, count] of analysis.requested) {
264
- display += `• **${skill}** — ${count} requests\n`;
265
- }
266
- display += `\n`;
267
- }
268
-
269
- if (analysis.offered.length > 0) {
270
- display += `### Most Offered Skills\n`;
271
- for (const [skill, count] of analysis.offered) {
272
- display += `• **${skill}** — ${count} offers\n`;
273
- }
274
- display += `\n`;
275
- }
276
-
277
- display += `**Total unique skills:** ${analysis.totalSkills}\n\n`;
278
-
279
- display += `**Skills marketplace health:**\n`;
280
- if (analysis.requested.length === 0 && analysis.offered.length === 0) {
281
- display += `📋 Skills exchange is empty - encourage first posts!\n`;
282
- } else {
283
- display += `✅ Active skills marketplace with ${analysis.requested.length} requests, ${analysis.offered.length} offers\n`;
284
- }
285
- break;
286
- }
287
-
288
- case 'gaps': {
289
- const gaps = await identifySkillGaps();
290
-
291
- display = `## Skill Gap Analysis 📈\n\n`;
292
-
293
- if (gaps.length === 0) {
294
- display += `✅ **No skill gaps detected!**\n\n`;
295
- display += `The community has good skill coverage. All requested skills have available providers.\n\n`;
296
- display += `**Growth opportunities:**\n`;
297
- display += `• Encourage more skill exchanges\n`;
298
- display += `• Promote underutilized skills\n`;
299
- display += `• Expand into new skill domains`;
300
- } else {
301
- display += `_Skills with high demand but limited supply:_\n\n`;
302
-
303
- for (const gap of gaps.slice(0, 8)) {
304
- display += `**${gap.skill}**\n`;
305
- display += `Demand: ${gap.demand} requests | Supply: ${gap.supply} providers\n`;
306
- display += `Gap: **${gap.gap} unmet requests**\n\n`;
307
- }
308
-
309
- display += `### Recommendations\n`;
310
- display += `**Recruit for high-demand skills:**\n`;
311
- for (const gap of gaps.slice(0, 3)) {
312
- display += `• Find ${gap.skill} experts to join the community\n`;
313
- }
314
-
315
- display += `\n**Encourage existing users:**\n`;
316
- display += `• Share these gaps in community updates\n`;
317
- display += `• Ask if anyone has hidden expertise in these areas`;
318
- }
319
- break;
320
- }
321
-
322
- case 'trends': {
323
- const trends = await analyzeTrends();
324
-
325
- display = `## Discovery Activity Trends 📈\n\n`;
326
-
327
- display += `### Recent Activity (7 days)\n`;
328
- display += `**Skill exchanges:** ${trends.recentExchanges}\n`;
329
- display += `**Today:** ${trends.todayExchanges}\n`;
330
- display += `**Active users:** ${trends.activeUsers}\n`;
331
- display += `**Growth rate:** ${trends.weeklyGrowth}%\n\n`;
332
-
333
- if (trends.trending.length > 0) {
334
- display += `### Trending Skills\n`;
335
- for (const [skill, mentions] of trends.trending) {
336
- display += `🔥 **${skill}** (${mentions} mentions)\n`;
337
- }
338
- display += `\n`;
339
- }
340
-
341
- display += `### Community Health\n`;
342
- if (trends.recentExchanges === 0) {
343
- display += `📭 No recent skill exchange activity\n`;
344
- display += `**Suggestions:** Encourage first exchanges, share success stories\n`;
345
- } else if (trends.recentExchanges < 5) {
346
- display += `🌱 Growing activity - encourage more participation\n`;
347
- } else {
348
- display += `🚀 Active community with healthy skill exchange\n`;
349
- }
350
-
351
- if (trends.activeUsers < 3) {
352
- display += `\n👥 Small but focused community - prioritize engagement\n`;
353
- } else {
354
- display += `\n✅ Good user activity - ${trends.activeUsers} active recently\n`;
355
- }
356
- break;
357
- }
358
-
359
- default:
360
- display = `## Discovery Insights Commands
361
-
362
- **\`discovery-insights stats\`** — Overall system statistics and health
363
- **\`discovery-insights skills\`** — Popular and requested skills analysis
364
- **\`discovery-insights gaps\`** — Identify skill shortages in community
365
- **\`discovery-insights trends\`** — Recent activity and growth patterns
366
-
367
- **Perfect for:**
368
- - Understanding community needs
369
- - Identifying recruitment priorities
370
- - Optimizing matching algorithms
371
- - Planning community growth strategies`;
372
- }
373
- } catch (error) {
374
- display = `## Discovery Insights Error
375
-
376
- ${error.message}
377
-
378
- Try: \`discovery-insights\` for available commands`;
379
- }
380
-
381
- return { display };
382
- }
383
-
384
- module.exports = { definition, handler };
@@ -1,281 +0,0 @@
1
- /**
2
- * Discovery Momentum — Enhanced matching based on shipping velocity and recent activity
3
- *
4
- * This tool improves connection quality by analyzing:
5
- * - Recent shipping activity (who's building similar things)
6
- * - Building momentum (active vs. stalled projects)
7
- * - Collaborative potential (complementary recent ships)
8
- * - Timing patterns (when people are most active)
9
- */
10
-
11
- const config = require('../config');
12
- const userProfiles = require('../store/profiles');
13
- const store = require('../store');
14
- const { formatTimeAgo } = require('./_shared');
15
-
16
- // Analyze shipping momentum and patterns
17
- function analyzeShippingMomentum(profile) {
18
- const now = Date.now();
19
- const oneWeekAgo = now - (7 * 24 * 60 * 60 * 1000);
20
- const oneMonthAgo = now - (30 * 24 * 60 * 60 * 1000);
21
-
22
- const ships = profile.ships || [];
23
- const recentShips = ships.filter(s => s.timestamp > oneWeekAgo);
24
- const monthlyShips = ships.filter(s => s.timestamp > oneMonthAgo);
25
-
26
- // Calculate momentum score
27
- let momentum = 0;
28
-
29
- if (recentShips.length > 0) {
30
- momentum += recentShips.length * 20; // High weight for recent activity
31
- }
32
-
33
- if (monthlyShips.length > 2) {
34
- momentum += 15; // Consistent builder bonus
35
- }
36
-
37
- // Analyze ship content for collaboration signals
38
- const shipTexts = ships.map(s => s.what.toLowerCase()).join(' ');
39
- const collaborationKeywords = [
40
- 'looking for', 'need help', 'seeking', 'collaboration', 'partner',
41
- 'feedback wanted', 'beta testers', 'contributors'
42
- ];
43
-
44
- const hasCollaborationSignals = collaborationKeywords.some(keyword =>
45
- shipTexts.includes(keyword)
46
- );
47
-
48
- if (hasCollaborationSignals) {
49
- momentum += 25; // Actively seeking collaboration
50
- }
51
-
52
- // Project type analysis
53
- const projectTypes = [];
54
- const typeKeywords = {
55
- 'frontend': ['react', 'vue', 'ui', 'interface', 'web', 'frontend'],
56
- 'backend': ['api', 'server', 'database', 'backend', 'service'],
57
- 'mobile': ['ios', 'android', 'mobile', 'app'],
58
- 'ai': ['ai', 'ml', 'machine learning', 'gpt', 'llm'],
59
- 'devtools': ['cli', 'tool', 'script', 'automation', 'workflow'],
60
- 'design': ['design', 'figma', 'prototype', 'mockup', 'ui/ux']
61
- };
62
-
63
- for (const [type, keywords] of Object.entries(typeKeywords)) {
64
- if (keywords.some(keyword => shipTexts.includes(keyword))) {
65
- projectTypes.push(type);
66
- }
67
- }
68
-
69
- return {
70
- score: momentum,
71
- recentShips: recentShips.length,
72
- totalShips: ships.length,
73
- seekingCollaboration: hasCollaborationSignals,
74
- projectTypes,
75
- lastShip: ships[0]?.timestamp || null
76
- };
77
- }
78
-
79
- // Enhanced matching that considers shipping patterns
80
- function calculateMomentumMatch(user1, user2) {
81
- const momentum1 = analyzeShippingMomentum(user1);
82
- const momentum2 = analyzeShippingMomentum(user2);
83
-
84
- let score = 0;
85
- const reasons = [];
86
-
87
- // Both users have recent shipping activity
88
- if (momentum1.recentShips > 0 && momentum2.recentShips > 0) {
89
- score += 30;
90
- reasons.push(`Both actively shipping (${momentum1.recentShips + momentum2.recentShips} recent ships)`);
91
- }
92
-
93
- // One seeks collaboration, other is active
94
- if ((momentum1.seekingCollaboration && momentum2.recentShips > 0) ||
95
- (momentum2.seekingCollaboration && momentum1.recentShips > 0)) {
96
- score += 40;
97
- reasons.push('One seeking collaboration, other actively building');
98
- }
99
-
100
- // Both seeking collaboration
101
- if (momentum1.seekingCollaboration && momentum2.seekingCollaboration) {
102
- score += 25;
103
- reasons.push('Both looking for collaboration partners');
104
- }
105
-
106
- // Complementary project types
107
- const complementaryPairs = [
108
- ['frontend', 'backend'],
109
- ['design', 'frontend'],
110
- ['ai', 'backend'],
111
- ['mobile', 'backend']
112
- ];
113
-
114
- for (const [type1, type2] of complementaryPairs) {
115
- if ((momentum1.projectTypes.includes(type1) && momentum2.projectTypes.includes(type2)) ||
116
- (momentum1.projectTypes.includes(type2) && momentum2.projectTypes.includes(type1))) {
117
- score += 35;
118
- reasons.push(`Complementary skills: ${type1} + ${type2}`);
119
- break;
120
- }
121
- }
122
-
123
- // Similar project types (potential knowledge sharing)
124
- const similarTypes = momentum1.projectTypes.filter(type =>
125
- momentum2.projectTypes.includes(type)
126
- );
127
- if (similarTypes.length > 0) {
128
- score += 20;
129
- reasons.push(`Similar focus: ${similarTypes.join(', ')}`);
130
- }
131
-
132
- // Both consistent builders
133
- if (momentum1.totalShips > 3 && momentum2.totalShips > 3) {
134
- score += 15;
135
- reasons.push('Both experienced builders');
136
- }
137
-
138
- // Activity timing alignment
139
- const now = Date.now();
140
- const bothRecentlyActive =
141
- momentum1.lastShip && momentum1.lastShip > (now - 7 * 24 * 60 * 60 * 1000) &&
142
- momentum2.lastShip && momentum2.lastShip > (now - 7 * 24 * 60 * 60 * 1000);
143
-
144
- if (bothRecentlyActive) {
145
- score += 20;
146
- reasons.push('Both shipped recently - great timing to connect');
147
- }
148
-
149
- // Calculate confidence based on data quality
150
- const dataQuality1 = (user1.building ? 1 : 0) + (user1.interests?.length || 0) + (user1.tags?.length || 0);
151
- const dataQuality2 = (user2.building ? 1 : 0) + (user2.interests?.length || 0) + (user2.tags?.length || 0);
152
- const confidence = Math.min(1.0, (dataQuality1 + dataQuality2) / 8);
153
-
154
- return {
155
- score: Math.round(score * confidence),
156
- reasons: reasons.slice(0, 3),
157
- confidence,
158
- momentum1,
159
- momentum2
160
- };
161
- }
162
-
163
- // Find momentum-based matches for a user
164
- async function findMomentumMatches(targetHandle, limit = 5) {
165
- const targetProfile = await userProfiles.getProfile(targetHandle);
166
- const allProfiles = await userProfiles.getAllProfiles();
167
-
168
- const candidates = allProfiles.filter(p =>
169
- p.handle !== targetHandle &&
170
- p.ships && p.ships.length > 0 // Must have shipping history
171
- );
172
-
173
- const matches = [];
174
-
175
- for (const candidate of candidates) {
176
- // Skip if already connected recently
177
- const alreadyConnected = await userProfiles.hasBeenConnected(targetHandle, candidate.handle);
178
- if (alreadyConnected) continue;
179
-
180
- const match = calculateMomentumMatch(targetProfile, candidate);
181
-
182
- if (match.score >= 25) { // Quality threshold
183
- matches.push({
184
- handle: candidate.handle,
185
- score: match.score,
186
- confidence: match.confidence,
187
- reasons: match.reasons,
188
- building: candidate.building,
189
- momentum: match.momentum2,
190
- lastShip: candidate.ships?.[0]
191
- });
192
- }
193
- }
194
-
195
- return matches.sort((a, b) => b.score - a.score).slice(0, limit);
196
- }
197
-
198
- // Identify collaboration opportunities
199
- async function findCollaborationOpportunities() {
200
- const profiles = await userProfiles.getAllProfiles();
201
- const now = Date.now();
202
- const oneWeekAgo = now - (7 * 24 * 60 * 60 * 1000);
203
-
204
- const seekingCollaboration = [];
205
- const activeBuilders = [];
206
-
207
- for (const profile of profiles) {
208
- if (!profile.ships || profile.ships.length === 0) continue;
209
-
210
- const momentum = analyzeShippingMomentum(profile);
211
-
212
- if (momentum.seekingCollaboration) {
213
- seekingCollaboration.push({
214
- ...profile,
215
- momentum,
216
- lastShip: profile.ships[0]
217
- });
218
- } else if (momentum.recentShips > 0) {
219
- activeBuilders.push({
220
- ...profile,
221
- momentum,
222
- lastShip: profile.ships[0]
223
- });
224
- }
225
- }
226
-
227
- const opportunities = [];
228
-
229
- // Match seekers with active builders
230
- for (const seeker of seekingCollaboration) {
231
- for (const builder of activeBuilders) {
232
- const match = calculateMomentumMatch(seeker, builder);
233
-
234
- if (match.score >= 30) {
235
- opportunities.push({
236
- seeker: seeker.handle,
237
- builder: builder.handle,
238
- score: match.score,
239
- reasons: match.reasons,
240
- seekerProject: seeker.lastShip?.what,
241
- builderProject: builder.lastShip?.what
242
- });
243
- }
244
- }
245
- }
246
-
247
- return {
248
- totalSeekers: seekingCollaboration.length,
249
- totalActiveBuilders: activeBuilders.length,
250
- opportunities: opportunities.sort((a, b) => b.score - a.score).slice(0, 8)
251
- };
252
- }
253
-
254
- // Generate shipping-based recommendations
255
- async function generateShippingRecommendations(targetHandle) {
256
- const matches = await findMomentumMatches(targetHandle);
257
- const opportunities = await findCollaborationOpportunities();
258
- const targetProfile = await userProfiles.getProfile(targetHandle);
259
- const targetMomentum = analyzeShippingMomentum(targetProfile);
260
-
261
- return {
262
- targetMomentum,
263
- momentumMatches: matches,
264
- collaborationOpportunities: opportunities.opportunities.filter(
265
- opp => opp.seeker === targetHandle || opp.builder === targetHandle
266
- ),
267
- recommendations: {
268
- connect: matches.slice(0, 3),
269
- collaborate: opportunities.opportunities.slice(0, 2),
270
- ship: targetMomentum.score < 20 ? 'Consider shipping something to increase visibility' : null
271
- }
272
- };
273
- }
274
-
275
- module.exports = {
276
- analyzeShippingMomentum,
277
- calculateMomentumMatch,
278
- findMomentumMatches,
279
- findCollaborationOpportunities,
280
- generateShippingRecommendations
281
- };