slashvibe-mcp 0.2.8 → 0.3.13
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/README.md +41 -58
- package/analytics.js +107 -0
- package/auth-store.js +148 -0
- package/auto-update.js +130 -0
- package/bridges/bridge-monitor.js +388 -0
- package/bridges/discord-bot.js +431 -0
- package/bridges/farcaster.js +299 -0
- package/bridges/telegram.js +261 -0
- package/bridges/webhook-health.js +420 -0
- package/bridges/webhook-server.js +437 -0
- package/bridges/whatsapp.js +441 -0
- package/bridges/x-webhook.js +423 -0
- package/config.js +27 -15
- package/games/arcade.js +406 -0
- package/games/chess.js +451 -0
- package/games/colorguess.js +343 -0
- package/games/crossword-words.js +171 -0
- package/games/crossword.js +461 -0
- package/games/drawing.js +347 -0
- package/games/gameroulette.js +300 -0
- package/games/gamerouter.js +336 -0
- package/games/gamestatus.js +337 -0
- package/games/guessnumber.js +209 -0
- package/games/hangman.js +279 -0
- package/games/memory.js +338 -0
- package/games/multiplayer-tictactoe.js +389 -0
- package/games/pixelart.js +399 -0
- package/games/quickduel.js +354 -0
- package/games/riddle.js +371 -0
- package/games/rockpaperscissors.js +291 -0
- package/games/snake.js +406 -0
- package/games/storybuilder.js +343 -0
- package/games/tictactoe.js +345 -0
- package/games/twentyquestions.js +286 -0
- package/games/twotruths.js +207 -0
- package/games/werewolf.js +508 -0
- package/games/wordassociation.js +247 -0
- package/games/wordchain.js +135 -0
- package/index.js +77 -53
- package/intelligence/index.js +9 -2
- package/intelligence/interests.js +369 -0
- package/notification-emitter.js +77 -0
- package/notify.js +5 -1
- package/package.json +18 -6
- package/prompts.js +1 -1
- package/protocol/index.js +73 -0
- package/setup.js +402 -0
- package/store/api.js +436 -211
- package/store/profiles.js +160 -12
- package/tools/_actions.js +362 -21
- package/tools/_discovery.js +119 -26
- package/tools/_shared/index.js +64 -0
- package/tools/_shared.js +234 -0
- package/tools/_work-context.js +338 -0
- package/tools/_work-context.manual-test.js +199 -0
- package/tools/_work-context.test.js +260 -0
- package/tools/activity.js +220 -0
- package/tools/analytics.js +191 -0
- package/tools/approve.js +197 -0
- package/tools/artifact-create.js +14 -3
- package/tools/artifacts-price.js +107 -0
- package/tools/available.js +120 -0
- package/tools/broadcast.js +286 -0
- package/tools/chat.js +202 -0
- package/tools/collaborative-drawing.js +1 -1
- package/tools/connection-status.js +178 -0
- package/tools/discover.js +350 -34
- package/tools/dm.js +80 -8
- package/tools/earnings.js +126 -0
- package/tools/feed.js +35 -4
- package/tools/follow.js +224 -0
- package/tools/friends.js +207 -0
- package/tools/gig-browse.js +206 -0
- package/tools/gig-complete.js +144 -0
- package/tools/help.js +3 -3
- package/tools/idea.js +9 -2
- package/tools/inbox.js +289 -105
- package/tools/init.js +106 -27
- package/tools/invite.js +15 -4
- package/tools/migrate.js +3 -3
- package/tools/multiplayer-game.js +1 -1
- package/tools/onboarding.js +7 -7
- package/tools/open.js +143 -12
- package/tools/party-game.js +1 -1
- package/tools/plan.js +225 -0
- package/tools/proof-of-work.js +144 -0
- package/tools/reply.js +166 -0
- package/tools/report.js +1 -1
- package/tools/request.js +17 -3
- package/tools/schedule.js +367 -0
- package/tools/search-messages.js +123 -0
- package/tools/session.js +420 -0
- package/tools/session_price.js +128 -0
- package/tools/settings.js +90 -2
- package/tools/ship.js +30 -7
- package/tools/smart-check.js +201 -0
- package/tools/start.js +147 -12
- package/tools/status.js +53 -6
- package/tools/stuck.js +297 -0
- package/tools/subscribe.js +148 -0
- package/tools/subscriptions.js +134 -0
- package/tools/suggest-tags.js +6 -8
- package/tools/tag-suggestions.js +1 -1
- package/tools/tip.js +150 -77
- package/tools/token.js +4 -4
- package/tools/update.js +1 -1
- package/tools/wallet.js +221 -79
- package/tools/watch.js +157 -0
- package/tools/who.js +30 -1
- package/tools/withdraw.js +145 -0
- package/tools/work-summary.js +96 -0
- package/version.json +10 -8
- package/LICENSE +0 -21
- package/store/sqlite.js +0 -347
- /package/tools/{auto-suggest-connections.js → _deprecated/auto-suggest-connections.js} +0 -0
- /package/tools/{away.js → _deprecated/away.js} +0 -0
- /package/tools/{back.js → _deprecated/back.js} +0 -0
- /package/tools/{bootstrap-skills.js → _deprecated/bootstrap-skills.js} +0 -0
- /package/tools/{bridge-dashboard.js → _deprecated/bridge-dashboard.js} +0 -0
- /package/tools/{bridge-health.js → _deprecated/bridge-health.js} +0 -0
- /package/tools/{bridge-live.js → _deprecated/bridge-live.js} +0 -0
- /package/tools/{bridges.js → _deprecated/bridges.js} +0 -0
- /package/tools/{colorguess.js → _deprecated/colorguess.js} +0 -0
- /package/tools/{discover-insights.js → _deprecated/discover-insights.js} +0 -0
- /package/tools/{discover-momentum.js → _deprecated/discover-momentum.js} +0 -0
- /package/tools/{discovery-analytics.js → _deprecated/discovery-analytics.js} +0 -0
- /package/tools/{discovery-auto-suggest.js → _deprecated/discovery-auto-suggest.js} +0 -0
- /package/tools/{discovery-bootstrap.js → _deprecated/discovery-bootstrap.js} +0 -0
- /package/tools/{discovery-daily.js → _deprecated/discovery-daily.js} +0 -0
- /package/tools/{discovery-dashboard.js → _deprecated/discovery-dashboard.js} +0 -0
- /package/tools/{discovery-digest.js → _deprecated/discovery-digest.js} +0 -0
- /package/tools/{discovery-hub.js → _deprecated/discovery-hub.js} +0 -0
- /package/tools/{discovery-insights.js → _deprecated/discovery-insights.js} +0 -0
- /package/tools/{discovery-momentum.js → _deprecated/discovery-momentum.js} +0 -0
- /package/tools/{discovery-monitor.js → _deprecated/discovery-monitor.js} +0 -0
- /package/tools/{discovery-proactive.js → _deprecated/discovery-proactive.js} +0 -0
- /package/tools/{draw.js → _deprecated/draw.js} +0 -0
- /package/tools/{farcaster.js → _deprecated/farcaster.js} +0 -0
- /package/tools/{forget.js → _deprecated/forget.js} +0 -0
- /package/tools/{games-catalog.js → _deprecated/games-catalog.js} +0 -0
- /package/tools/{games.js → _deprecated/games.js} +0 -0
- /package/tools/{guessnumber.js → _deprecated/guessnumber.js} +0 -0
- /package/tools/{hangman.js → _deprecated/hangman.js} +0 -0
- /package/tools/{multiplayer-tictactoe.js → _deprecated/multiplayer-tictactoe.js} +0 -0
- /package/tools/{mute.js → _deprecated/mute.js} +0 -0
- /package/tools/{recall.js → _deprecated/recall.js} +0 -0
- /package/tools/{remember.js → _deprecated/remember.js} +0 -0
- /package/tools/{riddle.js → _deprecated/riddle.js} +0 -0
- /package/tools/{run-bootstrap.js → _deprecated/run-bootstrap.js} +0 -0
- /package/tools/{skills-analytics.js → _deprecated/skills-analytics.js} +0 -0
- /package/tools/{skills-bootstrap.js → _deprecated/skills-bootstrap.js} +0 -0
- /package/tools/{skills-dashboard.js → _deprecated/skills-dashboard.js} +0 -0
- /package/tools/{skills-exchange.js → _deprecated/skills-exchange.js} +0 -0
- /package/tools/{skills.js → _deprecated/skills.js} +0 -0
- /package/tools/{smart-intro.js → _deprecated/smart-intro.js} +0 -0
- /package/tools/{storybuilder.js → _deprecated/storybuilder.js} +0 -0
- /package/tools/{telegram-bot.js → _deprecated/telegram-bot.js} +0 -0
- /package/tools/{telegram-setup.js → _deprecated/telegram-setup.js} +0 -0
- /package/tools/{tictactoe.js → _deprecated/tictactoe.js} +0 -0
- /package/tools/{twentyquestions.js → _deprecated/twentyquestions.js} +0 -0
- /package/tools/{wordassociation.js → _deprecated/wordassociation.js} +0 -0
package/README.md
CHANGED
|
@@ -1,87 +1,70 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vibe-mcp
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## What is /vibe?
|
|
6
|
-
|
|
7
|
-
/vibe brings social connection to the terminal. While you're building with Claude Code, /vibe lets you:
|
|
8
|
-
|
|
9
|
-
- **See who's online** - Know when other developers are in flow
|
|
10
|
-
- **Send DMs** - Message fellow builders without leaving your terminal
|
|
11
|
-
- **Share your presence** - Let others know what you're working on
|
|
12
|
-
- **Build reputation** - Your sessions become proof of work
|
|
3
|
+
Social layer for Claude Code. DMs, presence, and connection between AI-assisted developers.
|
|
13
4
|
|
|
14
5
|
## Installation
|
|
15
6
|
|
|
16
7
|
```bash
|
|
17
|
-
|
|
8
|
+
# Install globally
|
|
9
|
+
npm install -g vibe-mcp
|
|
10
|
+
|
|
11
|
+
# Or add to Claude Code MCP config
|
|
12
|
+
claude mcp add vibe-mcp
|
|
18
13
|
```
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
## Manual Setup
|
|
16
|
+
|
|
17
|
+
Add to `~/.claude.json`:
|
|
21
18
|
|
|
22
19
|
```json
|
|
23
20
|
{
|
|
24
21
|
"mcpServers": {
|
|
25
22
|
"vibe": {
|
|
26
23
|
"command": "npx",
|
|
27
|
-
"args": ["-
|
|
24
|
+
"args": ["vibe-mcp"],
|
|
25
|
+
"env": {
|
|
26
|
+
"VIBE_API_URL": "https://www.slashvibe.dev"
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
1. Install the MCP server
|
|
36
|
-
2. Authenticate: `vibe_auth` tool will guide you
|
|
37
|
-
3. Check who's online: `vibe_presence`
|
|
38
|
-
4. Send a message: `vibe_dm`
|
|
39
|
-
|
|
40
|
-
## Available Tools
|
|
33
|
+
## Features
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
| `vibe_inbox` | Check your messages |
|
|
48
|
-
| `vibe_ship` | Announce what you shipped |
|
|
49
|
-
| `vibe_idea` | Share an idea with the community |
|
|
50
|
-
| `vibe_discover` | Find interesting builders |
|
|
51
|
-
| `vibe_remember` | Save context about a connection |
|
|
52
|
-
| `vibe_recall` | Recall memories about someone |
|
|
35
|
+
- **Presence** - See who's online building with Claude Code
|
|
36
|
+
- **DMs** - Direct messages between developers
|
|
37
|
+
- **Memory** - Remember context about connections
|
|
38
|
+
- **Status** - Share what you're working on
|
|
39
|
+
- **Games** - Play tic-tac-toe while coding
|
|
53
40
|
|
|
54
|
-
##
|
|
41
|
+
## Commands
|
|
55
42
|
|
|
56
|
-
|
|
43
|
+
Once installed, use these in Claude Code:
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
45
|
+
| Command | Description |
|
|
46
|
+
|---------|-------------|
|
|
47
|
+
| `vibe` | Check inbox and see who's online |
|
|
48
|
+
| `vibe who` | List online users |
|
|
49
|
+
| `vibe dm @handle "message"` | Send a DM |
|
|
50
|
+
| `vibe status shipping` | Set your status |
|
|
51
|
+
| `vibe remember @handle "note"` | Save a memory |
|
|
52
|
+
| `vibe recall @handle` | Recall memories |
|
|
61
53
|
|
|
62
|
-
##
|
|
54
|
+
## API
|
|
63
55
|
|
|
64
|
-
|
|
56
|
+
The MCP server connects to `slashvibe.dev` for:
|
|
57
|
+
- User presence and discovery
|
|
58
|
+
- Message routing
|
|
59
|
+
- Identity verification
|
|
65
60
|
|
|
66
|
-
|
|
61
|
+
## Related
|
|
67
62
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- Report bugs via [GitHub Issues](https://github.com/VibeCodingInc/vibe-mcp/issues)
|
|
73
|
-
- Propose features via [Discussions](https://github.com/VibeCodingInc/vibe-mcp/discussions)
|
|
74
|
-
- Submit PRs for review
|
|
63
|
+
- [GitHub](https://github.com/VibeCodingInc/vibe-mcp) - Source code
|
|
64
|
+
- [slashvibe.dev](https://slashvibe.dev) - Web presence
|
|
65
|
+
- [Spirit Protocol](https://spiritprotocol.io) - Parent ecosystem
|
|
66
|
+
- [AIRC](https://airc.chat) - Agent identity protocol
|
|
75
67
|
|
|
76
68
|
## License
|
|
77
69
|
|
|
78
|
-
MIT
|
|
79
|
-
|
|
80
|
-
## Links
|
|
81
|
-
|
|
82
|
-
- [slashvibe.dev](https://slashvibe.dev) - The platform
|
|
83
|
-
- [Twitter](https://twitter.com/slashvibe) - Updates
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
Built with obsession by [Slash Vibe, Inc.](https://slashvibe.dev)
|
|
70
|
+
MIT
|
package/analytics.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics — Retention event tracking from MCP server
|
|
3
|
+
*
|
|
4
|
+
* Logs events to the /api/analytics/event endpoint for measuring
|
|
5
|
+
* user engagement and retention funnel performance.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const analytics = require('./analytics');
|
|
9
|
+
* analytics.track('empty_inbox_action', { action: 'discover', source: 'inbox' });
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const config = require('./config');
|
|
13
|
+
|
|
14
|
+
const API_URL = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Track an analytics event (fire and forget)
|
|
18
|
+
* @param {string} eventType - Event type (from valid types in api/lib/events.js)
|
|
19
|
+
* @param {object} data - Additional event data
|
|
20
|
+
*/
|
|
21
|
+
async function track(eventType, data = {}) {
|
|
22
|
+
const handle = config.getHandle();
|
|
23
|
+
if (!handle) return; // Skip if not initialized
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
// Fire and forget - don't await or block
|
|
27
|
+
fetch(`${API_URL}/api/analytics/events`, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: { 'Content-Type': 'application/json' },
|
|
30
|
+
body: JSON.stringify({
|
|
31
|
+
type: eventType,
|
|
32
|
+
handle,
|
|
33
|
+
data: {
|
|
34
|
+
...data,
|
|
35
|
+
client: 'mcp-server',
|
|
36
|
+
timestamp: Date.now()
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
}).catch(() => {}); // Silently ignore errors
|
|
40
|
+
} catch (e) {
|
|
41
|
+
// Analytics should never block or fail user flows
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Track empty inbox interaction
|
|
47
|
+
* @param {string} action - Which action was taken (or 'none' if user closed)
|
|
48
|
+
* @param {object} context - Context about the state (hadOnboardingTask, hadRecentShips, etc.)
|
|
49
|
+
*/
|
|
50
|
+
function trackEmptyInbox(action, context = {}) {
|
|
51
|
+
// Track that user reached empty inbox state
|
|
52
|
+
track('empty_inbox_reached', {
|
|
53
|
+
hadRecentThreads: context.recentThreads?.length > 0,
|
|
54
|
+
hadOnboardingTask: !!context.onboardingTask,
|
|
55
|
+
hadRecentShips: context.recentShips?.length > 0
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// If an action was taken, track it
|
|
59
|
+
if (action && action !== 'none') {
|
|
60
|
+
track('empty_inbox_action', {
|
|
61
|
+
action,
|
|
62
|
+
...context
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Track lurk mode state change
|
|
69
|
+
* @param {boolean} enabled - Whether lurk mode was enabled or disabled
|
|
70
|
+
*/
|
|
71
|
+
function trackLurkMode(enabled) {
|
|
72
|
+
track(enabled ? 'lurk_mode_enabled' : 'lurk_mode_disabled', {});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Track onboarding task completion
|
|
77
|
+
* @param {string} taskId - The task that was completed
|
|
78
|
+
*/
|
|
79
|
+
function trackOnboardingTask(taskId) {
|
|
80
|
+
track('onboarding_task_completed', { taskId });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Track discovery initiation
|
|
85
|
+
* @param {string} source - Where discovery was initiated from (inbox, start, etc.)
|
|
86
|
+
*/
|
|
87
|
+
function trackDiscovery(source) {
|
|
88
|
+
track('discovery_initiated', { source });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Track session lifecycle
|
|
93
|
+
* @param {string} event - 'started' or 'ended'
|
|
94
|
+
* @param {object} sessionData - Session metrics (duration, actions, etc.)
|
|
95
|
+
*/
|
|
96
|
+
function trackSession(event, sessionData = {}) {
|
|
97
|
+
track(event === 'started' ? 'session_started' : 'session_ended', sessionData);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
module.exports = {
|
|
101
|
+
track,
|
|
102
|
+
trackEmptyInbox,
|
|
103
|
+
trackLurkMode,
|
|
104
|
+
trackOnboardingTask,
|
|
105
|
+
trackDiscovery,
|
|
106
|
+
trackSession
|
|
107
|
+
};
|
package/auth-store.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Store - In-memory singleton for authentication state
|
|
3
|
+
*
|
|
4
|
+
* This is the SOURCE OF TRUTH for auth during MCP runtime.
|
|
5
|
+
* File persistence (config.json) is only for durability across restarts.
|
|
6
|
+
*
|
|
7
|
+
* Why this exists:
|
|
8
|
+
* - OAuth callback and API calls happen in the same MCP process
|
|
9
|
+
* - File-based auth was unreliable due to per-PID session files and caching
|
|
10
|
+
* - In-memory state is immediate and deterministic
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* - Startup: authStore.hydrate() loads from disk once
|
|
14
|
+
* - OAuth: authStore.setToken(token) updates immediately
|
|
15
|
+
* - API calls: authStore.getToken() returns current token (no file I/O)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// In-memory state - the single source of truth during runtime
|
|
19
|
+
let _token = null;
|
|
20
|
+
let _handle = null;
|
|
21
|
+
let _oneLiner = null;
|
|
22
|
+
let _hydrated = false;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Hydrate auth state from disk (call once at MCP startup)
|
|
26
|
+
* This loads persisted state from config.json
|
|
27
|
+
*/
|
|
28
|
+
function hydrate() {
|
|
29
|
+
if (_hydrated) return; // Only hydrate once
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const config = require('./config');
|
|
33
|
+
const cfg = config.load();
|
|
34
|
+
|
|
35
|
+
_token = cfg.authToken || cfg.privyToken || null;
|
|
36
|
+
_handle = cfg.handle || cfg.username || null;
|
|
37
|
+
_oneLiner = cfg.one_liner || cfg.workingOn || null;
|
|
38
|
+
_hydrated = true;
|
|
39
|
+
|
|
40
|
+
if (_token) {
|
|
41
|
+
console.error('[auth-store] Hydrated from disk: @' + _handle);
|
|
42
|
+
} else {
|
|
43
|
+
console.error('[auth-store] Hydrated from disk: no token');
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.error('[auth-store] Hydration failed:', e.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Set auth token (call after OAuth completes)
|
|
52
|
+
* @param {string} token - JWT token
|
|
53
|
+
*/
|
|
54
|
+
function setToken(token) {
|
|
55
|
+
const hadToken = !!_token;
|
|
56
|
+
_token = token;
|
|
57
|
+
|
|
58
|
+
if (!hadToken && token) {
|
|
59
|
+
console.error('[auth-store] Token set (was empty)');
|
|
60
|
+
} else if (hadToken && token && token !== _token) {
|
|
61
|
+
console.error('[auth-store] Token updated');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get current auth token
|
|
67
|
+
* @returns {string|null} Current token or null
|
|
68
|
+
*/
|
|
69
|
+
function getToken() {
|
|
70
|
+
return _token;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set user handle
|
|
75
|
+
* @param {string} handle - User handle (without @)
|
|
76
|
+
*/
|
|
77
|
+
function setHandle(handle) {
|
|
78
|
+
_handle = handle;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get current handle
|
|
83
|
+
* @returns {string|null} Current handle or null
|
|
84
|
+
*/
|
|
85
|
+
function getHandle() {
|
|
86
|
+
return _handle;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Set one-liner (what user is building)
|
|
91
|
+
* @param {string} oneLiner - One-liner description
|
|
92
|
+
*/
|
|
93
|
+
function setOneLiner(oneLiner) {
|
|
94
|
+
_oneLiner = oneLiner;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get current one-liner
|
|
99
|
+
* @returns {string|null} Current one-liner or null
|
|
100
|
+
*/
|
|
101
|
+
function getOneLiner() {
|
|
102
|
+
return _oneLiner;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Check if user is authenticated
|
|
107
|
+
* @returns {boolean} True if token exists
|
|
108
|
+
*/
|
|
109
|
+
function isAuthenticated() {
|
|
110
|
+
return !!_token;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Clear all auth state (for logout/reset)
|
|
115
|
+
*/
|
|
116
|
+
function clear() {
|
|
117
|
+
_token = null;
|
|
118
|
+
_handle = null;
|
|
119
|
+
_oneLiner = null;
|
|
120
|
+
console.error('[auth-store] Cleared');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Get full auth state (for debugging)
|
|
125
|
+
* @returns {object} Current auth state
|
|
126
|
+
*/
|
|
127
|
+
function getState() {
|
|
128
|
+
return {
|
|
129
|
+
token: _token ? _token.substring(0, 20) + '...' : null,
|
|
130
|
+
handle: _handle,
|
|
131
|
+
oneLiner: _oneLiner,
|
|
132
|
+
hydrated: _hydrated,
|
|
133
|
+
isAuthenticated: !!_token
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
module.exports = {
|
|
138
|
+
hydrate,
|
|
139
|
+
setToken,
|
|
140
|
+
getToken,
|
|
141
|
+
setHandle,
|
|
142
|
+
getHandle,
|
|
143
|
+
setOneLiner,
|
|
144
|
+
getOneLiner,
|
|
145
|
+
isAuthenticated,
|
|
146
|
+
clear,
|
|
147
|
+
getState
|
|
148
|
+
};
|
package/auto-update.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-update mechanism for /vibe MCP server
|
|
3
|
+
* Checks for updates and prompts user to update
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const { exec } = require('child_process');
|
|
7
|
+
const { promisify } = require('util');
|
|
8
|
+
const fs = require('fs').promises;
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const execAsync = promisify(exec);
|
|
12
|
+
|
|
13
|
+
async function checkForUpdates() {
|
|
14
|
+
try {
|
|
15
|
+
// Read local version
|
|
16
|
+
const versionPath = path.join(__dirname, 'version.json');
|
|
17
|
+
const localVersion = JSON.parse(await fs.readFile(versionPath, 'utf-8'));
|
|
18
|
+
|
|
19
|
+
// Check remote version
|
|
20
|
+
const response = await fetch('https://www.slashvibe.dev/api/version', {
|
|
21
|
+
headers: { 'User-Agent': 'vibe-mcp-client' }
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
return null; // Silent fail - don't block startup
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const remoteVersion = await response.json();
|
|
29
|
+
|
|
30
|
+
// Compare versions
|
|
31
|
+
if (compareVersions(remoteVersion.version, localVersion.version) > 0) {
|
|
32
|
+
return {
|
|
33
|
+
current: localVersion.version,
|
|
34
|
+
latest: remoteVersion.version,
|
|
35
|
+
changelog: remoteVersion.changelog,
|
|
36
|
+
features: remoteVersion.features,
|
|
37
|
+
breaking: remoteVersion.breaking
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return null; // Up to date
|
|
42
|
+
} catch (error) {
|
|
43
|
+
// Silent fail - don't block startup
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function performUpdate() {
|
|
49
|
+
try {
|
|
50
|
+
const repoPath = path.join(__dirname, '..');
|
|
51
|
+
|
|
52
|
+
// Check if we're in a git repo
|
|
53
|
+
try {
|
|
54
|
+
await execAsync('git rev-parse --git-dir', { cwd: repoPath });
|
|
55
|
+
} catch {
|
|
56
|
+
throw new Error('Not a git repository. Manual update required.');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Stash any local changes
|
|
60
|
+
await execAsync('git stash', { cwd: repoPath });
|
|
61
|
+
|
|
62
|
+
// Pull latest
|
|
63
|
+
const { stdout, stderr } = await execAsync('git pull origin main', { cwd: repoPath });
|
|
64
|
+
|
|
65
|
+
// Pop stash if we had changes
|
|
66
|
+
try {
|
|
67
|
+
await execAsync('git stash pop', { cwd: repoPath });
|
|
68
|
+
} catch {
|
|
69
|
+
// No stash to pop, that's fine
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
output: stdout,
|
|
75
|
+
message: 'Update successful! Restart /vibe to apply changes.'
|
|
76
|
+
};
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
error: error.message
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function compareVersions(v1, v2) {
|
|
86
|
+
const parts1 = v1.split('.').map(Number);
|
|
87
|
+
const parts2 = v2.split('.').map(Number);
|
|
88
|
+
|
|
89
|
+
for (let i = 0; i < 3; i++) {
|
|
90
|
+
if (parts1[i] > parts2[i]) return 1;
|
|
91
|
+
if (parts1[i] < parts2[i]) return -1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function formatUpdateNotification(update) {
|
|
98
|
+
if (!update) return null;
|
|
99
|
+
|
|
100
|
+
let message = `\n${'='.repeat(60)}\n`;
|
|
101
|
+
message += `📦 /vibe UPDATE AVAILABLE\n`;
|
|
102
|
+
message += `${'='.repeat(60)}\n\n`;
|
|
103
|
+
message += `Current: v${update.current}\n`;
|
|
104
|
+
message += `Latest: v${update.latest}${update.breaking ? ' ⚠️ BREAKING' : ''}\n\n`;
|
|
105
|
+
message += `${update.changelog}\n\n`;
|
|
106
|
+
|
|
107
|
+
if (update.features && update.features.length > 0) {
|
|
108
|
+
message += `New features:\n`;
|
|
109
|
+
update.features.forEach(f => {
|
|
110
|
+
message += ` • ${f}\n`;
|
|
111
|
+
});
|
|
112
|
+
message += `\n`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
message += `Update now:\n`;
|
|
116
|
+
message += ` vibe update\n`;
|
|
117
|
+
message += `\n`;
|
|
118
|
+
message += `Or manually:\n`;
|
|
119
|
+
message += ` cd ~/.vibe/vibe-repo && git pull origin main\n`;
|
|
120
|
+
message += `${'='.repeat(60)}\n`;
|
|
121
|
+
|
|
122
|
+
return message;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
module.exports = {
|
|
126
|
+
checkForUpdates,
|
|
127
|
+
performUpdate,
|
|
128
|
+
compareVersions,
|
|
129
|
+
formatUpdateNotification
|
|
130
|
+
};
|