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.
- package/LICENSE +21 -0
- package/README.md +280 -47
- package/auto-update.js +10 -15
- package/config.js +36 -31
- package/crypto.js +1 -6
- package/debug.js +12 -0
- package/discord.js +19 -19
- package/eslint.config.js +54 -0
- package/index.js +217 -207
- package/intelligence/index.js +2 -9
- package/intelligence/infer.js +10 -16
- package/intelligence/patterns.js +23 -18
- package/intelligence/proactive.js +16 -15
- package/intelligence/serendipity.js +57 -20
- package/memory.js +13 -8
- package/migrate-v2.js +72 -0
- package/notification-emitter.js +2 -2
- package/notify.js +39 -14
- package/package.json +28 -29
- package/post-install.js +141 -0
- package/presence.js +2 -2
- package/prompts.js +5 -9
- package/protocol/index.js +123 -87
- package/protocol/telegram-commands.js +36 -37
- package/store/api.js +358 -529
- package/store/local.js +9 -10
- package/store/profiles.js +48 -192
- package/store/reservations.js +2 -9
- package/store/skills.js +69 -71
- package/store/sqlite.js +355 -0
- package/test-skills-bootstrap.js +20 -0
- package/test-v2-integration.js +385 -0
- package/tools/_actions.js +48 -387
- package/tools/_connection-queue.js +45 -56
- package/tools/_discovery-enhanced.js +52 -57
- package/tools/_discovery.js +87 -185
- package/tools/{l2-status.js → _experimental/l2-status.js} +68 -70
- package/tools/{shipback.js → _experimental/shipback.js} +4 -3
- package/tools/_proactive-discovery.js +60 -73
- package/tools/_shared/index.js +41 -64
- package/tools/admin-inbox.js +10 -15
- package/tools/agents.js +1 -1
- package/tools/artifact-create.js +13 -23
- package/tools/artifact-view.js +4 -4
- package/tools/{_deprecated/back.js → back.js} +1 -1
- package/tools/bye.js +3 -5
- package/tools/consent.js +2 -2
- package/tools/context.js +9 -10
- package/tools/crossword.js +3 -2
- package/tools/discover.js +94 -356
- package/tools/dm.js +27 -86
- package/tools/doctor.js +12 -41
- package/tools/drawing.js +34 -20
- package/tools/echo.js +11 -11
- package/tools/feed.js +30 -58
- package/tools/follow.js +64 -187
- package/tools/{_deprecated/forget.js → forget.js} +4 -7
- package/tools/game.js +144 -48
- package/tools/handoff.js +6 -8
- package/tools/help.js +3 -3
- package/tools/idea.js +15 -27
- package/tools/inbox.js +121 -293
- package/tools/init.js +54 -151
- package/tools/invite.js +8 -21
- package/tools/migrate.js +27 -24
- package/tools/multiplayer-game.js +50 -40
- package/tools/{_deprecated/mute.js → mute.js} +4 -3
- package/tools/notifications.js +58 -48
- package/tools/observe.js +12 -15
- package/tools/onboarding.js +8 -11
- package/tools/open.js +13 -144
- package/tools/party-game.js +23 -12
- package/tools/patterns.js +2 -1
- package/tools/ping.js +5 -7
- package/tools/react.js +28 -30
- package/tools/{_deprecated/recall.js → recall.js} +5 -10
- package/tools/release.js +4 -2
- package/tools/{_deprecated/remember.js → remember.js} +4 -6
- package/tools/report.js +2 -2
- package/tools/request.js +6 -26
- package/tools/reserve.js +1 -1
- package/tools/session-fork.js +97 -0
- package/tools/session-save.js +109 -0
- package/tools/settings.js +30 -99
- package/tools/ship.js +74 -56
- package/tools/{_deprecated/skills-exchange.js → skills-exchange.js} +38 -39
- package/tools/social-inbox.js +22 -28
- package/tools/social-post.js +24 -27
- package/tools/solo-game.js +54 -46
- package/tools/start.js +14 -148
- package/tools/status.js +21 -68
- package/tools/submit.js +4 -2
- package/tools/suggest-tags.js +36 -33
- package/tools/summarize.js +19 -16
- package/tools/tag-suggestions.js +72 -73
- package/tools/test.js +1 -1
- package/tools/{_deprecated/tictactoe.js → tictactoe.js} +26 -26
- package/tools/token.js +4 -4
- package/tools/update.js +1 -2
- package/tools/watch.js +132 -112
- package/tools/who.js +20 -40
- package/tools/{_deprecated/wordassociation.js → wordassociation.js} +23 -20
- package/tools/workshop-buddy.js +52 -53
- package/tools/x-mentions.js +0 -1
- package/tools/x-reply.js +0 -1
- package/twitter.js +14 -20
- package/version.json +8 -10
- package/webhook-runner.js +132 -0
- package/auth-store.js +0 -148
- package/bridges/bridge-monitor.js +0 -388
- package/bridges/discord-bot.js +0 -431
- package/bridges/farcaster.js +0 -299
- package/bridges/telegram.js +0 -261
- package/bridges/webhook-health.js +0 -420
- package/bridges/webhook-server.js +0 -437
- package/bridges/whatsapp.js +0 -441
- package/bridges/x-webhook.js +0 -423
- package/games/arcade.js +0 -406
- package/games/chess.js +0 -451
- package/games/colorguess.js +0 -343
- package/games/crossword-words.js +0 -171
- package/games/crossword.js +0 -461
- package/games/drawing.js +0 -347
- package/games/gameroulette.js +0 -300
- package/games/gamerouter.js +0 -336
- package/games/gamestatus.js +0 -337
- package/games/guessnumber.js +0 -209
- package/games/hangman.js +0 -279
- package/games/memory.js +0 -338
- package/games/multiplayer-tictactoe.js +0 -389
- package/games/pixelart.js +0 -399
- package/games/quickduel.js +0 -354
- package/games/riddle.js +0 -371
- package/games/rockpaperscissors.js +0 -291
- package/games/snake.js +0 -406
- package/games/storybuilder.js +0 -343
- package/games/tictactoe.js +0 -345
- package/games/twentyquestions.js +0 -286
- package/games/twotruths.js +0 -207
- package/games/werewolf.js +0 -508
- package/games/wordassociation.js +0 -247
- package/games/wordchain.js +0 -135
- package/intelligence/interests.js +0 -369
- package/setup.js +0 -480
- package/smart-inbox.js +0 -276
- package/tools/_deprecated/auto-suggest-connections.js +0 -304
- package/tools/_deprecated/bootstrap-skills.js +0 -231
- package/tools/_deprecated/bridge-dashboard.js +0 -342
- package/tools/_deprecated/bridge-health.js +0 -400
- package/tools/_deprecated/bridge-live.js +0 -384
- package/tools/_deprecated/bridges.js +0 -383
- package/tools/_deprecated/colorguess.js +0 -281
- package/tools/_deprecated/discover-insights.js +0 -379
- package/tools/_deprecated/discover-momentum.js +0 -256
- package/tools/_deprecated/discovery-analytics.js +0 -345
- package/tools/_deprecated/discovery-auto-suggest.js +0 -275
- package/tools/_deprecated/discovery-bootstrap.js +0 -267
- package/tools/_deprecated/discovery-daily.js +0 -375
- package/tools/_deprecated/discovery-dashboard.js +0 -385
- package/tools/_deprecated/discovery-digest.js +0 -314
- package/tools/_deprecated/discovery-hub.js +0 -357
- package/tools/_deprecated/discovery-insights.js +0 -384
- package/tools/_deprecated/discovery-momentum.js +0 -281
- package/tools/_deprecated/discovery-monitor.js +0 -319
- package/tools/_deprecated/discovery-proactive.js +0 -300
- package/tools/_deprecated/draw.js +0 -317
- package/tools/_deprecated/farcaster.js +0 -307
- package/tools/_deprecated/games-catalog.js +0 -376
- package/tools/_deprecated/games.js +0 -313
- package/tools/_deprecated/guessnumber.js +0 -194
- package/tools/_deprecated/hangman.js +0 -129
- package/tools/_deprecated/multiplayer-tictactoe.js +0 -303
- package/tools/_deprecated/riddle.js +0 -240
- package/tools/_deprecated/run-bootstrap.js +0 -69
- package/tools/_deprecated/skills-analytics.js +0 -349
- package/tools/_deprecated/skills-bootstrap.js +0 -301
- package/tools/_deprecated/skills-dashboard.js +0 -268
- package/tools/_deprecated/skills.js +0 -380
- package/tools/_deprecated/smart-intro.js +0 -353
- package/tools/_deprecated/storybuilder.js +0 -331
- package/tools/_deprecated/telegram-bot.js +0 -183
- package/tools/_deprecated/telegram-setup.js +0 -214
- package/tools/_deprecated/twentyquestions.js +0 -143
- package/tools/_shared.js +0 -234
- package/tools/_work-context.js +0 -338
- package/tools/_work-context.manual-test.js +0 -199
- package/tools/_work-context.test.js +0 -260
- package/tools/activity.js +0 -220
- package/tools/agent-treasury.js +0 -288
- package/tools/analytics.js +0 -191
- package/tools/approve.js +0 -197
- package/tools/arcade.js +0 -173
- package/tools/artifacts-price.js +0 -107
- package/tools/ask-expert.js +0 -160
- package/tools/available.js +0 -120
- package/tools/become-expert.js +0 -150
- package/tools/broadcast.js +0 -325
- package/tools/chat.js +0 -202
- package/tools/collaborative-drawing.js +0 -286
- package/tools/connection-status.js +0 -178
- package/tools/earnings.js +0 -126
- package/tools/friends.js +0 -207
- package/tools/genesis.js +0 -233
- package/tools/gig-browse.js +0 -206
- package/tools/gig-complete.js +0 -144
- package/tools/health.js +0 -87
- package/tools/leaderboard.js +0 -117
- package/tools/lib/git-apply.js +0 -206
- package/tools/lib/git-bundle.js +0 -407
- package/tools/mint.js +0 -377
- package/tools/plan.js +0 -225
- package/tools/profile.js +0 -219
- package/tools/proof-of-work.js +0 -144
- package/tools/pulse.js +0 -218
- package/tools/reply.js +0 -166
- package/tools/reputation.js +0 -175
- package/tools/schedule.js +0 -367
- package/tools/search-messages.js +0 -123
- package/tools/session.js +0 -467
- package/tools/session_price.js +0 -128
- package/tools/smart-check.js +0 -201
- package/tools/social-processor.js +0 -445
- package/tools/streak.js +0 -147
- package/tools/stuck.js +0 -297
- package/tools/subscribe.js +0 -148
- package/tools/subscriptions.js +0 -134
- package/tools/tip.js +0 -193
- package/tools/wallet.js +0 -269
- package/tools/webhook-test.js +0 -388
- package/tools/withdraw.js +0 -145
- package/tools/work-summary.js +0 -96
- package/tools/workshop.js +0 -327
- /package/tools/{l2-bridge.js → _experimental/l2-bridge.js} +0 -0
- /package/tools/{l2.js → _experimental/l2.js} +0 -0
- /package/tools/{_deprecated/away.js → away.js} +0 -0
package/tools/gig-complete.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vibe_gig_complete - Mark a gig as completed
|
|
3
|
-
*
|
|
4
|
-
* When a gig is completed:
|
|
5
|
-
* - Links deliverables (session, artifacts, notes)
|
|
6
|
-
* - Boosts hired person's reputation
|
|
7
|
-
* - Auto-posts celebration to the board
|
|
8
|
-
* - Records rating
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const config = require('../config');
|
|
12
|
-
const { requireInit, normalizeHandle, displayHandle, success, error, header, divider } = require('./_shared');
|
|
13
|
-
const { actions, formatActions } = require('./_actions');
|
|
14
|
-
|
|
15
|
-
const BASE_URL = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
|
|
16
|
-
|
|
17
|
-
const definition = {
|
|
18
|
-
name: 'vibe_gig_complete',
|
|
19
|
-
description: 'Mark a gig as completed with deliverables and rating. Boosts reputation and posts to board.',
|
|
20
|
-
inputSchema: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
gig_id: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
description: 'The gig ID to complete (e.g., gig_abc123)'
|
|
26
|
-
},
|
|
27
|
-
session_id: {
|
|
28
|
-
type: 'string',
|
|
29
|
-
description: 'Optional: Link a session as primary deliverable'
|
|
30
|
-
},
|
|
31
|
-
artifact_ids: {
|
|
32
|
-
type: 'array',
|
|
33
|
-
items: { type: 'string' },
|
|
34
|
-
description: 'Optional: Array of artifact IDs created during the gig'
|
|
35
|
-
},
|
|
36
|
-
notes: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
description: 'Optional: Completion notes or summary'
|
|
39
|
-
},
|
|
40
|
-
rating: {
|
|
41
|
-
type: 'number',
|
|
42
|
-
minimum: 1,
|
|
43
|
-
maximum: 5,
|
|
44
|
-
description: 'Rating for the hired person (1-5 stars)'
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
required: ['gig_id', 'rating']
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
async function handler(args) {
|
|
52
|
-
const initCheck = requireInit();
|
|
53
|
-
if (initCheck) return initCheck;
|
|
54
|
-
|
|
55
|
-
// Check if gigs are enabled by making a quick check
|
|
56
|
-
try {
|
|
57
|
-
const checkResponse = await fetch(`${BASE_URL}/api/gigs`);
|
|
58
|
-
const checkData = await checkResponse.json();
|
|
59
|
-
if (checkData.coming_soon) {
|
|
60
|
-
return {
|
|
61
|
-
display: header('🚀 Gigs Marketplace', 2) + '\n\n' +
|
|
62
|
-
'Launching Wednesday Jan 22!\n\n' +
|
|
63
|
-
'Gig completion will be available after launch.'
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
} catch (e) {
|
|
67
|
-
// Continue with request if check fails
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const {
|
|
71
|
-
gig_id,
|
|
72
|
-
session_id = null,
|
|
73
|
-
artifact_ids = [],
|
|
74
|
-
notes = null,
|
|
75
|
-
rating
|
|
76
|
-
} = args;
|
|
77
|
-
|
|
78
|
-
const handle = config.getHandle();
|
|
79
|
-
|
|
80
|
-
// Validate rating
|
|
81
|
-
if (rating < 1 || rating > 5) {
|
|
82
|
-
return { display: error('Rating must be between 1 and 5 stars') };
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
try {
|
|
86
|
-
const response = await fetch(`${BASE_URL}/api/gigs/complete`, {
|
|
87
|
-
method: 'POST',
|
|
88
|
-
headers: { 'Content-Type': 'application/json' },
|
|
89
|
-
body: JSON.stringify({
|
|
90
|
-
gig_id,
|
|
91
|
-
completed_by: handle,
|
|
92
|
-
deliverables: {
|
|
93
|
-
session_id,
|
|
94
|
-
artifact_ids,
|
|
95
|
-
notes
|
|
96
|
-
},
|
|
97
|
-
rating
|
|
98
|
-
})
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
const data = await response.json();
|
|
102
|
-
|
|
103
|
-
if (!data.success) {
|
|
104
|
-
return { display: error(data.error || 'Failed to complete gig') };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Format success display
|
|
108
|
-
let display = success('Gig Completed!') + '\n\n';
|
|
109
|
-
|
|
110
|
-
display += header('Gig Details', 3) + '\n';
|
|
111
|
-
display += `**Title:** ${data.gig?.title || gig_id}\n`;
|
|
112
|
-
display += `**Hired:** ${displayHandle(data.gig?.hired_handle)}\n`;
|
|
113
|
-
display += `**Rating:** ${'⭐'.repeat(rating)}\n`;
|
|
114
|
-
|
|
115
|
-
if (session_id) {
|
|
116
|
-
display += `**Session:** ${session_id}\n`;
|
|
117
|
-
}
|
|
118
|
-
if (artifact_ids.length > 0) {
|
|
119
|
-
display += `**Artifacts:** ${artifact_ids.length} linked\n`;
|
|
120
|
-
}
|
|
121
|
-
if (notes) {
|
|
122
|
-
display += `**Notes:** ${notes}\n`;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
display += divider();
|
|
126
|
-
display += `${displayHandle(data.gig?.hired_handle)} earned **+50 vibe points** for completing this gig!\n`;
|
|
127
|
-
|
|
128
|
-
if (data.posted_to_board) {
|
|
129
|
-
display += `\n🎉 Celebration posted to the board`;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Build result with bonus tip action
|
|
133
|
-
const result = { display };
|
|
134
|
-
result.actions = formatActions(actions.afterGigComplete(data.gig));
|
|
135
|
-
|
|
136
|
-
return result;
|
|
137
|
-
|
|
138
|
-
} catch (e) {
|
|
139
|
-
console.error('[gig-complete] Error:', e);
|
|
140
|
-
return { display: error(`Failed to complete gig: ${e.message}`) };
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
module.exports = { definition, handler };
|
package/tools/health.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vibe_health — Check /vibe platform health status
|
|
3
|
-
*
|
|
4
|
-
* Shows service status, latency, and user stats.
|
|
5
|
-
* Useful for debugging connection issues or monitoring uptime.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const config = require('../config');
|
|
9
|
-
|
|
10
|
-
const API_URL = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
|
|
11
|
-
|
|
12
|
-
const definition = {
|
|
13
|
-
name: 'vibe_health',
|
|
14
|
-
description: 'Check /vibe platform health and service status',
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
full: {
|
|
19
|
-
type: 'boolean',
|
|
20
|
-
description: 'Include detailed service checks (default: false)'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
async function handler(args) {
|
|
27
|
-
const { full = false } = args;
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const endpoint = `${API_URL}/api/health${full ? '?full=true' : ''}`;
|
|
31
|
-
const response = await fetch(endpoint);
|
|
32
|
-
const data = await response.json();
|
|
33
|
-
|
|
34
|
-
let display = `## /vibe Health Check\n\n`;
|
|
35
|
-
|
|
36
|
-
// Overall status
|
|
37
|
-
const statusEmoji = data.status === 'healthy' ? '\u2705' : data.status === 'degraded' ? '\u26a0\ufe0f' : '\u274c';
|
|
38
|
-
display += `**Status:** ${statusEmoji} ${data.status.toUpperCase()}\n`;
|
|
39
|
-
display += `**Version:** ${data.version}\n`;
|
|
40
|
-
display += `**Response Time:** ${data.responseTime}ms\n\n`;
|
|
41
|
-
|
|
42
|
-
// Service checks
|
|
43
|
-
if (data.checks) {
|
|
44
|
-
display += `### Services\n\n`;
|
|
45
|
-
display += `| Service | Status | Latency |\n`;
|
|
46
|
-
display += `|---------|--------|--------|\n`;
|
|
47
|
-
|
|
48
|
-
for (const [service, check] of Object.entries(data.checks)) {
|
|
49
|
-
const emoji = check.status === 'healthy' ? '\u2705' : check.status === 'not_configured' ? '\u2796' : '\u274c';
|
|
50
|
-
const latency = check.latency ? `${check.latency}ms` : '-';
|
|
51
|
-
display += `| ${service} | ${emoji} ${check.status} | ${latency} |\n`;
|
|
52
|
-
}
|
|
53
|
-
display += '\n';
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Stats (only in full mode)
|
|
57
|
-
if (data.stats) {
|
|
58
|
-
display += `### Platform Stats\n\n`;
|
|
59
|
-
display += `- **Registered Handles:** ${data.stats.registeredHandles}\n`;
|
|
60
|
-
display += `- **Active This Week:** ${data.stats.activeThisWeek}\n`;
|
|
61
|
-
display += `- **Total Tips:** ${data.stats.totalTips}\n\n`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Vibe Beats (activity metrics)
|
|
65
|
-
if (data.vibeBeats) {
|
|
66
|
-
display += `### Vibe Beats (Activity)\n\n`;
|
|
67
|
-
display += `| Period | Active Users |\n`;
|
|
68
|
-
display += `|--------|-------------|\n`;
|
|
69
|
-
display += `| Online (30 min) | ${data.vibeBeats.online} |\n`;
|
|
70
|
-
display += `| Hourly | ${data.vibeBeats.hourly} |\n`;
|
|
71
|
-
display += `| Daily (DAU) | ${data.vibeBeats.daily} |\n`;
|
|
72
|
-
display += `| Weekly (WAU) | ${data.vibeBeats.weekly} |\n`;
|
|
73
|
-
display += `| Monthly (MAU) | ${data.vibeBeats.monthly} |\n`;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
display += `\n_Checked at ${data.timestamp}_`;
|
|
77
|
-
|
|
78
|
-
return { display };
|
|
79
|
-
|
|
80
|
-
} catch (e) {
|
|
81
|
-
return {
|
|
82
|
-
display: `## /vibe Health Check\n\n\u274c **Connection Failed**\n\nError: ${e.message}\n\nMake sure you have internet connectivity and try again.`
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
module.exports = { definition, handler };
|
package/tools/leaderboard.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vibe_leaderboard — See top builders on /vibe
|
|
3
|
-
*
|
|
4
|
-
* Shows the leaderboard ranked by Vibe Score:
|
|
5
|
-
* - Ships posted (building stuff)
|
|
6
|
-
* - Reactions received (quality signal)
|
|
7
|
-
* - Comments given (helping others)
|
|
8
|
-
* - Streak consistency (showing up)
|
|
9
|
-
* - Invites redeemed (growing community)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const config = require('../config');
|
|
13
|
-
|
|
14
|
-
const API_URL = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
|
|
15
|
-
|
|
16
|
-
const definition = {
|
|
17
|
-
name: 'vibe_leaderboard',
|
|
18
|
-
description: 'See top builders on /vibe ranked by Vibe Score',
|
|
19
|
-
inputSchema: {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
category: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
enum: ['overall', 'ships', 'streaks', 'reactions', 'helpful'],
|
|
25
|
-
description: 'Leaderboard category (default: overall)'
|
|
26
|
-
},
|
|
27
|
-
limit: {
|
|
28
|
-
type: 'number',
|
|
29
|
-
description: 'Number of entries to show (default: 10, max: 50)'
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
async function handler(args) {
|
|
36
|
-
const { category = 'overall', limit = 10 } = args;
|
|
37
|
-
const maxLimit = Math.min(limit, 50);
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
const endpoint = `${API_URL}/api/growth/leaderboard?category=${category}&limit=${maxLimit}`;
|
|
41
|
-
const response = await fetch(endpoint);
|
|
42
|
-
const data = await response.json();
|
|
43
|
-
|
|
44
|
-
if (!data.success) {
|
|
45
|
-
return { display: `\u274c Failed to load leaderboard: ${data.error}` };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const myHandle = config.isInitialized() ? config.getHandle() : null;
|
|
49
|
-
|
|
50
|
-
let display = `## /vibe Leaderboard\n`;
|
|
51
|
-
display += `**Category:** ${category} | **Showing:** Top ${maxLimit}\n\n`;
|
|
52
|
-
|
|
53
|
-
if (data.leaderboard.length === 0) {
|
|
54
|
-
display += `_No entries yet. Be the first to ship!_\n`;
|
|
55
|
-
return { display };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Table header
|
|
59
|
-
display += `| Rank | Builder | Vibe Score | Ships | Streak |\n`;
|
|
60
|
-
display += `|------|---------|------------|-------|--------|\n`;
|
|
61
|
-
|
|
62
|
-
for (const entry of data.leaderboard) {
|
|
63
|
-
const isMe = myHandle && entry.handle.toLowerCase() === myHandle.toLowerCase();
|
|
64
|
-
const highlight = isMe ? '**' : '';
|
|
65
|
-
|
|
66
|
-
// Position change indicator
|
|
67
|
-
let posIndicator = '';
|
|
68
|
-
if (entry.positionChange > 0) {
|
|
69
|
-
posIndicator = ` \u2191${entry.positionChange}`;
|
|
70
|
-
} else if (entry.positionChange < 0) {
|
|
71
|
-
posIndicator = ` \u2193${Math.abs(entry.positionChange)}`;
|
|
72
|
-
} else if (entry.isNew) {
|
|
73
|
-
posIndicator = ' \u2728';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Tier emoji
|
|
77
|
-
const tierEmoji = entry.tierDisplay?.emoji || '';
|
|
78
|
-
|
|
79
|
-
display += `| ${highlight}#${entry.rank}${posIndicator}${highlight} | ${highlight}@${entry.handle}${highlight} ${tierEmoji} | ${entry.vibeScore} | ${entry.stats?.ships || 0} | ${entry.streak || 0}d |\n`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Stats summary
|
|
83
|
-
if (data.stats) {
|
|
84
|
-
display += `\n### Community Stats\n`;
|
|
85
|
-
display += `- **Total Builders:** ${data.stats.total}\n`;
|
|
86
|
-
display += `- **Ships Posted:** ${data.stats.shipsCount}\n`;
|
|
87
|
-
display += `- **Active Today:** ${data.stats.activeToday}\n`;
|
|
88
|
-
display += `- **Avg Vibe Score:** ${data.stats.averageVibeScore}\n`;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Highlights
|
|
92
|
-
if (data.highlights?.movers?.length > 0) {
|
|
93
|
-
display += `\n### \ud83d\ude80 Biggest Movers\n`;
|
|
94
|
-
for (const mover of data.highlights.movers.slice(0, 3)) {
|
|
95
|
-
display += `- @${mover.handle} +${mover.change} (now #${mover.rank})\n`;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (data.highlights?.newEntries?.length > 0) {
|
|
100
|
-
display += `\n### \u2728 New Entries\n`;
|
|
101
|
-
for (const entry of data.highlights.newEntries.slice(0, 3)) {
|
|
102
|
-
display += `- @${entry.handle} joined at #${entry.rank}\n`;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
display += `\n_${data.note}_`;
|
|
107
|
-
|
|
108
|
-
return { display };
|
|
109
|
-
|
|
110
|
-
} catch (e) {
|
|
111
|
-
return {
|
|
112
|
-
display: `## /vibe Leaderboard\n\n\u274c **Failed to load**\n\nError: ${e.message}`
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
module.exports = { definition, handler };
|
package/tools/lib/git-apply.js
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Git Apply Library
|
|
3
|
-
*
|
|
4
|
-
* Downloads and applies git bundles from session forks.
|
|
5
|
-
* Used by session.js fork command to get actual code.
|
|
6
|
-
*
|
|
7
|
-
* Key functions:
|
|
8
|
-
* - downloadBundle(url) - Download bundle from signed URL
|
|
9
|
-
* - applyBundleFromUrl(url, branchName) - Download and apply in one step
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const { execSync } = require('child_process');
|
|
13
|
-
const fs = require('fs');
|
|
14
|
-
const path = require('path');
|
|
15
|
-
const os = require('os');
|
|
16
|
-
const https = require('https');
|
|
17
|
-
const http = require('http');
|
|
18
|
-
|
|
19
|
-
const { isGitRepo, validateBundle, applyBundle } = require('./git-bundle');
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Download a bundle from a URL
|
|
23
|
-
* @param {string} url - The signed download URL
|
|
24
|
-
* @returns {Promise<object>} - { success, buffer, error? }
|
|
25
|
-
*/
|
|
26
|
-
async function downloadBundle(url) {
|
|
27
|
-
return new Promise((resolve) => {
|
|
28
|
-
const protocol = url.startsWith('https') ? https : http;
|
|
29
|
-
|
|
30
|
-
const request = protocol.get(url, (response) => {
|
|
31
|
-
// Handle redirects
|
|
32
|
-
if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
33
|
-
downloadBundle(response.headers.location).then(resolve);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (response.statusCode !== 200) {
|
|
38
|
-
resolve({
|
|
39
|
-
success: false,
|
|
40
|
-
error: `HTTP ${response.statusCode}: ${response.statusMessage}`,
|
|
41
|
-
});
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const chunks = [];
|
|
46
|
-
response.on('data', (chunk) => chunks.push(chunk));
|
|
47
|
-
response.on('end', () => {
|
|
48
|
-
const buffer = Buffer.concat(chunks);
|
|
49
|
-
resolve({
|
|
50
|
-
success: true,
|
|
51
|
-
buffer,
|
|
52
|
-
size: buffer.length,
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
response.on('error', (err) => {
|
|
56
|
-
resolve({ success: false, error: err.message });
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
request.on('error', (err) => {
|
|
61
|
-
resolve({ success: false, error: err.message });
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Timeout after 60 seconds
|
|
65
|
-
request.setTimeout(60000, () => {
|
|
66
|
-
request.destroy();
|
|
67
|
-
resolve({ success: false, error: 'Download timeout (60s)' });
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Download and apply a bundle from a URL
|
|
74
|
-
* @param {string} url - The signed download URL
|
|
75
|
-
* @param {string} branchName - Name for the new branch (default: 'forked-session')
|
|
76
|
-
* @returns {Promise<object>} - { success, branch, commits?, error? }
|
|
77
|
-
*/
|
|
78
|
-
async function applyBundleFromUrl(url, branchName = 'forked-session') {
|
|
79
|
-
// Check we're in a git repo
|
|
80
|
-
if (!isGitRepo()) {
|
|
81
|
-
return { success: false, error: 'Not in a git repository' };
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Download the bundle
|
|
85
|
-
console.log(`[git-apply] Downloading bundle...`);
|
|
86
|
-
const downloadResult = await downloadBundle(url);
|
|
87
|
-
|
|
88
|
-
if (!downloadResult.success) {
|
|
89
|
-
return { success: false, error: `Download failed: ${downloadResult.error}` };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
console.log(`[git-apply] Downloaded ${downloadResult.size} bytes`);
|
|
93
|
-
|
|
94
|
-
// Validate the bundle
|
|
95
|
-
const validation = validateBundle(downloadResult.buffer);
|
|
96
|
-
if (!validation.success) {
|
|
97
|
-
return { success: false, error: `Invalid bundle: ${validation.error}` };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Apply the bundle
|
|
101
|
-
console.log(`[git-apply] Applying bundle to branch: ${branchName}`);
|
|
102
|
-
const applyResult = applyBundle(downloadResult.buffer, branchName);
|
|
103
|
-
|
|
104
|
-
if (!applyResult.success) {
|
|
105
|
-
return { success: false, error: `Apply failed: ${applyResult.error}` };
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
success: true,
|
|
110
|
-
branch: applyResult.branch,
|
|
111
|
-
refs: applyResult.refs,
|
|
112
|
-
size: downloadResult.size,
|
|
113
|
-
message: `Bundle applied to branch '${applyResult.branch}'. Use 'git checkout ${applyResult.branch}' to view.`,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Check out the forked branch
|
|
119
|
-
* @param {string} branchName - Branch to checkout
|
|
120
|
-
* @returns {object} - { success, error? }
|
|
121
|
-
*/
|
|
122
|
-
function checkoutBranch(branchName) {
|
|
123
|
-
try {
|
|
124
|
-
execSync(`git checkout ${branchName}`, {
|
|
125
|
-
stdio: 'pipe',
|
|
126
|
-
encoding: 'utf8',
|
|
127
|
-
});
|
|
128
|
-
return { success: true };
|
|
129
|
-
} catch (error) {
|
|
130
|
-
return { success: false, error: error.message };
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Get info about a branch
|
|
136
|
-
* @param {string} branchName - Branch name
|
|
137
|
-
* @returns {object} - { exists, current, commits? }
|
|
138
|
-
*/
|
|
139
|
-
function getBranchInfo(branchName) {
|
|
140
|
-
try {
|
|
141
|
-
// Check if branch exists
|
|
142
|
-
const branches = execSync('git branch --list', {
|
|
143
|
-
stdio: 'pipe',
|
|
144
|
-
encoding: 'utf8',
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
const branchList = branches.split('\n').map((b) => b.replace(/^\*?\s*/, '').trim());
|
|
148
|
-
const exists = branchList.includes(branchName);
|
|
149
|
-
|
|
150
|
-
// Check current branch
|
|
151
|
-
const currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
152
|
-
stdio: 'pipe',
|
|
153
|
-
encoding: 'utf8',
|
|
154
|
-
}).trim();
|
|
155
|
-
|
|
156
|
-
const result = {
|
|
157
|
-
exists,
|
|
158
|
-
current: currentBranch === branchName,
|
|
159
|
-
currentBranch,
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// Get commit count if branch exists
|
|
163
|
-
if (exists) {
|
|
164
|
-
try {
|
|
165
|
-
const commitCount = execSync(`git rev-list --count ${branchName}`, {
|
|
166
|
-
stdio: 'pipe',
|
|
167
|
-
encoding: 'utf8',
|
|
168
|
-
});
|
|
169
|
-
result.commits = parseInt(commitCount.trim(), 10);
|
|
170
|
-
} catch (e) {
|
|
171
|
-
// Branch might not have commits yet
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return result;
|
|
176
|
-
} catch (error) {
|
|
177
|
-
return { exists: false, current: false, error: error.message };
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Delete a branch
|
|
183
|
-
* @param {string} branchName - Branch to delete
|
|
184
|
-
* @param {boolean} force - Force delete even if not merged
|
|
185
|
-
* @returns {object} - { success, error? }
|
|
186
|
-
*/
|
|
187
|
-
function deleteBranch(branchName, force = false) {
|
|
188
|
-
try {
|
|
189
|
-
const flag = force ? '-D' : '-d';
|
|
190
|
-
execSync(`git branch ${flag} ${branchName}`, {
|
|
191
|
-
stdio: 'pipe',
|
|
192
|
-
encoding: 'utf8',
|
|
193
|
-
});
|
|
194
|
-
return { success: true };
|
|
195
|
-
} catch (error) {
|
|
196
|
-
return { success: false, error: error.message };
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
module.exports = {
|
|
201
|
-
downloadBundle,
|
|
202
|
-
applyBundleFromUrl,
|
|
203
|
-
checkoutBranch,
|
|
204
|
-
getBranchInfo,
|
|
205
|
-
deleteBranch,
|
|
206
|
-
};
|