codevf 1.0.4 → 1.0.7
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 +31 -132
- package/dist/commands/cvf-command-content.d.ts +1 -1
- package/dist/commands/cvf-command-content.d.ts.map +1 -1
- package/dist/commands/cvf-command-content.js +5 -0
- package/dist/commands/cvf-command-content.js.map +1 -1
- package/dist/commands/mcp.d.ts +10 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +79 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/setup.d.ts +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +186 -18
- package/dist/commands/setup.js.map +1 -1
- package/dist/index.js +43 -296
- package/dist/index.js.map +1 -1
- package/dist/lib/api/tasks.d.ts +1 -0
- package/dist/lib/api/tasks.d.ts.map +1 -1
- package/dist/lib/api/tasks.js +1 -0
- package/dist/lib/api/tasks.js.map +1 -1
- package/dist/lib/auth/oauth-flow.d.ts.map +1 -1
- package/dist/lib/auth/oauth-flow.js +22 -2
- package/dist/lib/auth/oauth-flow.js.map +1 -1
- package/dist/mcp/index.js +5 -241
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server.d.ts +13 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +262 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/chat.d.ts +1 -0
- package/dist/mcp/tools/chat.d.ts.map +1 -1
- package/dist/mcp/tools/chat.js +1 -0
- package/dist/mcp/tools/chat.js.map +1 -1
- package/dist/mcp/tools/instant.d.ts +1 -0
- package/dist/mcp/tools/instant.d.ts.map +1 -1
- package/dist/mcp/tools/instant.js +1 -0
- package/dist/mcp/tools/instant.js.map +1 -1
- package/dist/tools/consultEngineer.d.ts.map +1 -1
- package/dist/tools/consultEngineer.js +69 -0
- package/dist/tools/consultEngineer.js.map +1 -1
- package/dist/types/index.d.ts +0 -356
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -39
- package/dist/types/index.js.map +1 -1
- package/dist/ui/SessionUI.d.ts.map +1 -1
- package/dist/ui/SessionUI.js +4 -1
- package/dist/ui/SessionUI.js.map +1 -1
- package/dist/utils/errors.js +5 -5
- package/dist/utils/errors.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,158 +1,57 @@
|
|
|
1
1
|
# CodeVF CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Connect Claude Code, Codex, or Gemini to live human engineers.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g codevf
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Quick Start
|
|
11
|
+
## Quick Start (Claude Code)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
1. `codevf setup`
|
|
14
|
+
2. In Claude Code, type `claude`
|
|
15
|
+
3. It works out of the box
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
# Setup MCP server integration with Claude Code
|
|
17
|
-
codevf setup
|
|
17
|
+
Use `/cvf` in Claude Code to force CodeVF.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
## Quick Start (Codex)
|
|
20
|
+
|
|
21
|
+
1. `codevf setup`
|
|
22
|
+
2. In Codex, type `codex`
|
|
23
|
+
3. It works out of the box
|
|
24
|
+
|
|
25
|
+
Use `/mcp` in Codex to confirm CodeVF is connected.
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
## Quick Start (Gemini)
|
|
28
|
+
|
|
29
|
+
1. `codevf setup`
|
|
30
|
+
2. In Gemini, restart the client
|
|
31
|
+
3. It works out of the box
|
|
29
32
|
|
|
30
33
|
## Commands
|
|
31
34
|
|
|
32
|
-
### `codevf setup`
|
|
33
|
-
Configure MCP server integration with Claude Code:
|
|
35
|
+
### `codevf setup`
|
|
36
|
+
Configure MCP server integration with Claude Code, Codex, and Gemini:
|
|
34
37
|
- Authenticate with CodeVF using OAuth
|
|
35
38
|
- Auto-configure Claude Code's `~/.claude.json` file
|
|
36
|
-
- Create
|
|
39
|
+
- Create Claude Code slash commands for CodeVF
|
|
37
40
|
- Select default project for context
|
|
38
41
|
|
|
39
|
-
###
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
**`/cvf [message]` - Smart routing to appropriate tool**
|
|
43
|
-
- Quick questions → `codevf-instant` (4min max, good for validation)
|
|
44
|
-
- Complex debugging → `codevf-chat` (extended sessions up to 2 hours)
|
|
45
|
-
- Local server access → `codevf-tunnel` (share dev servers securely)
|
|
46
|
-
|
|
47
|
-
**Example usage:**
|
|
48
|
-
```
|
|
49
|
-
/cvf Does this authentication fix prevent timing attacks?
|
|
50
|
-
/cvf Complex race condition in WebSocket reconnection needs debugging
|
|
51
|
-
/cvf Create tunnel to my dev server on port 3000
|
|
52
|
-
```
|
|
42
|
+
### `codevf mcp stdio`
|
|
43
|
+
Start the MCP server for non-Claude clients:
|
|
44
|
+
- `codevf mcp stdio` - Launch MCP over stdio (command/args-based clients)
|
|
53
45
|
|
|
54
|
-
###
|
|
55
|
-
|
|
56
|
-
- `codevf
|
|
57
|
-
- `codevf init` - Project initialization (handled via MCP tools)
|
|
58
|
-
- `codevf fix` - Direct CLI debugging sessions (use Claude Code instead)
|
|
59
|
-
- `codevf sync` - Repository sync (handled via MCP tools)
|
|
60
|
-
|
|
61
|
-
## How It Works
|
|
62
|
-
|
|
63
|
-
1. **Setup once** - Run `codevf setup` to configure Claude Code integration
|
|
64
|
-
2. **Work in Claude Code** - Use `/cvf` commands to access human engineers
|
|
65
|
-
3. **Get matched with experts** - Ex-FAANG engineers with expertise in your stack
|
|
66
|
-
4. **Context-aware handoff** - Engineers see your Claude conversation for faster resolution
|
|
67
|
-
5. **Hybrid approach** - AI handles quick questions, humans tackle complex debugging
|
|
68
|
-
6. **Pay per minute** - Only pay for active engineering time
|
|
69
|
-
|
|
70
|
-
## Security & Privacy
|
|
71
|
-
|
|
72
|
-
- **MCP integration** - No direct code access, works through Claude Code's security model
|
|
73
|
-
- **Context sharing** - Engineers see your Claude conversation for better assistance
|
|
74
|
-
- **Explicit permission** - Engineers request specific actions with your approval
|
|
75
|
-
- **Audit trail** - All engineer actions are logged and auditable
|
|
76
|
-
- **Secure tunnels** - Local dev servers shared via encrypted tunnels only when requested
|
|
77
|
-
- **Session-based** - No persistent code storage, only active session context
|
|
78
|
-
|
|
79
|
-
## Configuration
|
|
80
|
-
|
|
81
|
-
After running `codevf setup`, configuration is stored in:
|
|
82
|
-
|
|
83
|
-
**MCP Configuration** (`~/.config/codevf/mcp-config.json`):
|
|
84
|
-
```json
|
|
85
|
-
{
|
|
86
|
-
"auth": {
|
|
87
|
-
"accessToken": "jwt-token",
|
|
88
|
-
"refreshToken": "jwt-token",
|
|
89
|
-
"userId": "user-uuid"
|
|
90
|
-
},
|
|
91
|
-
"defaultProjectId": "project-uuid",
|
|
92
|
-
"baseUrl": "https://app.codevf.com"
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Claude Code Configuration** (auto-configured in `~/.claude.json`):
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"mcpServers": {
|
|
100
|
-
"codevf": {
|
|
101
|
-
"command": "node",
|
|
102
|
-
"args": ["/path/to/codevf/dist/mcp/index.js"]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
```
|
|
46
|
+
### `codevf mcp http --port 3333`
|
|
47
|
+
Start the MCP server over HTTP/SSE for non-Claude clients:
|
|
48
|
+
- `codevf mcp http --port 3333` - Launch MCP over HTTP/SSE (shows endpoints)
|
|
107
49
|
|
|
108
50
|
## Requirements
|
|
109
51
|
|
|
110
|
-
- Node.js 18
|
|
111
|
-
- [Claude Code (Desktop App)](https://claude.ai/download)
|
|
52
|
+
- Node.js 18+
|
|
53
|
+
- [Claude Code (Desktop App)](https://claude.ai/download)
|
|
112
54
|
- Internet connection
|
|
113
|
-
- CodeVF account (created during setup)
|
|
114
|
-
|
|
115
|
-
### Installing Claude Code
|
|
116
|
-
|
|
117
|
-
If you don't have Claude Code installed:
|
|
118
|
-
|
|
119
|
-
**macOS:**
|
|
120
|
-
```bash
|
|
121
|
-
# Download from website
|
|
122
|
-
open https://claude.ai/download
|
|
123
|
-
|
|
124
|
-
# Or using Homebrew
|
|
125
|
-
brew install --cask claude
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Windows:**
|
|
129
|
-
```bash
|
|
130
|
-
# Download installer from website
|
|
131
|
-
start https://claude.ai/download
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Linux:**
|
|
135
|
-
```bash
|
|
136
|
-
# Download AppImage from website
|
|
137
|
-
curl -L https://claude.ai/download -o claude.appimage
|
|
138
|
-
chmod +x claude.appimage
|
|
139
|
-
./claude.appimage
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Note:** Claude Code requires an Anthropic account. Create one at [claude.ai](https://claude.ai) if needed.
|
|
143
|
-
|
|
144
|
-
## Beta Status & Roadmap
|
|
145
|
-
|
|
146
|
-
**Current Beta Features:**
|
|
147
|
-
- ✅ MCP server integration with Claude Code
|
|
148
|
-
- ✅ Three tools: instant, chat, tunnel
|
|
149
|
-
- ✅ OAuth authentication and project selection
|
|
150
|
-
|
|
151
|
-
**Coming Soon:**
|
|
152
|
-
- 🔄 Direct CLI debugging sessions (`codevf fix`)
|
|
153
|
-
- 🔄 Project initialization (`codevf init`)
|
|
154
|
-
- 🔄 Repository sync (`codevf sync`)
|
|
155
|
-
- 🔄 Standalone terminal UI
|
|
156
55
|
|
|
157
56
|
## Support
|
|
158
57
|
|
|
@@ -162,4 +61,4 @@ chmod +x claude.appimage
|
|
|
162
61
|
|
|
163
62
|
## License
|
|
164
63
|
|
|
165
|
-
Commercial license — see `LICENSE`.
|
|
64
|
+
Commercial license — see `LICENSE`.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const commandContent = "---\ndescription: Ask a CodeVF engineer for help with code validation, debugging, or technical questions\n---\n\n# CodeVF Engineer Assistance\n\nPlease help me with the following question or task by consulting a CodeVF engineer using the appropriate MCP tool:\n\n**My request:**\n{{PROMPT}}\n\n---\n\n**Instructions for Claude:**\n\n1. **Analyze the request** to determine which CodeVF tool is most appropriate:\n - Use `codevf-instant` for:\n - Quick validation questions (1-10 credits, ~2 min response)\n - \"Does this fix work?\"\n - \"Is this approach correct?\"\n - \"Can you identify the error?\"\n - UI/visual verification and feedback\n - Simple technical questions\n\n - Use `codevf-chat` for:\n - Complex debugging requiring back-and-forth (4-1920 credits, 2 credits/min)\n - Multi-step troubleshooting\n - Architecture discussions\n - Extended collaboration\n\n - Use `codevf-tunnel` for:\n - Creating secure tunnels to expose local dev servers\n - Testing webhooks, OAuth callbacks, or external integrations\n - Sharing local development environment with engineers\n - No credits required - tunnel remains active for session\n\n2. **For UI/Visual Development Tasks** (Pain-Free Experience):\n\n When implementing UI changes or visual features, follow this iterative flow:\n\n **Step 1 - Initial Implementation:**\n - Make the requested changes to code/styles\n - Create tunnel if needed: `codevf-tunnel` with dev server port\n - Share tunnel URL for visual verification\n\n **Step 2 - Engineer Verification:**\n - Use `codevf-instant` with message like:\n \"Please verify this UI change via [tunnel-url] (password: [password]). Does it match the requested design/functionality?\"\n - **Always include both URL and password** - localtunnel requires password to bypass landing page\n - Include specific areas of focus (layout, spacing, colors, interactions)\n - Allow 5-8 credits for visual review and feedback\n\n **Step 3 - Iterative Refinement:**\n - Apply engineer feedback immediately\n - Use `codevf-instant` again for re-verification:\n \"Applied your feedback (reduced padding to 16px). Please check if this looks better now at [tunnel-url] (same password).\"\n - Continue this cycle until engineer confirms it looks right\n - Each feedback cycle: 3-5 credits\n\n **Example UI Flow:**\n ```\n User: \"Make the UI look like a modern card layout\"\n\n Claude:\n 1. Implements card styling\n 2. Creates tunnel \u2192 https://abc123.loca.lt (password: xyz789)\n 3. codevf-instant: \"Please review the card layout at https://abc123.loca.lt\n (password: xyz789). Does it look modern and clean? Any spacing/styling issues?\" (5 credits)\n\n Engineer: \"Cards look good but margins are too large, reduce to 16px\"\n\n Claude:\n 4. Updates margins to 16px\n 5. codevf-instant: \"Applied 16px margins. Please verify the spacing\n looks better now at https://abc123.loca.lt (password: xyz789).\" (3 credits)\n\n Engineer: \"Perfect! The spacing looks much cleaner now.\"\n ```\n\n3. **Use the appropriate tool:**\n - For instant queries: Call `codevf-instant` with the message and appropriate maxCredits (1-10)\n - For extended sessions: Call `codevf-chat` with the message and appropriate maxCredits (suggest 240 for ~2 hours)\n - For tunnel access: Call `codevf-tunnel` with the port number (e.g., { \"port\": 3000 })\n\n4. **Present the response:**\n - For instant queries: Share the engineer's response directly\n - For chat sessions: Provide the session URL so the user can monitor the conversation\n - For tunnels: Share the public URL that was created\n\n**Credit Guidelines:**\n- Instant validation: 1-10 credits (typically 3-5 credits per question)\n- UI verification: 5-8 credits for initial review, 3-5 credits for follow-up checks\n- Extended chat: 2 credits per minute (240 credits = 2 hours)\n- Tunnel creation: Free (no credits required)\n\n**Planning Integration for Complex Tasks:**\nWhen Claude is planning multi-step implementations, especially UI-heavy tasks:\n- Always include \"Engineer verification checkpoints\" in the plan\n- Budget credits for iterative feedback (typically 15-25 credits total for UI refinement)\n- Create tunnel early in the process for continuous visual validation\n- Plan for 2-4 feedback cycles to achieve the desired result\n\n**Example Usage:**\n- `/cvf Does this authentication fix prevent the timing attack?` \u2192 Use codevf-instant\n- `/cvf Complex race condition in WebSocket reconnection needs debugging` \u2192 Use codevf-chat\n- `/cvf Create tunnel to my dev server on port 3000` \u2192 Use codevf-tunnel\n- `/cvf Make the login form look more modern and user-friendly` \u2192 Use tunnel + iterative codevf-instant feedback\n";
|
|
1
|
+
export declare const commandContent = "---\ndescription: Ask a CodeVF engineer for help with code validation, debugging, or technical questions\n---\n\n# CodeVF Engineer Assistance\n\nPlease help me with the following question or task by consulting a CodeVF engineer using the appropriate MCP tool:\n\n**My request:**\n{{PROMPT}}\n\n---\n\n**Available CodeVF Commands:**\n- `codevf setup` - Configure MCP server for Claude Code, Codex, and Gemini\n- `codevf mcp stdio` - Start MCP server over stdio\n- `codevf mcp http --port 3333` - Start MCP server over HTTP/SSE\n\n**Instructions for Claude:**\n\n1. **Analyze the request** to determine which CodeVF tool is most appropriate:\n - Use `codevf-instant` for:\n - Quick validation questions (1-10 credits, ~2 min response)\n - \"Does this fix work?\"\n - \"Is this approach correct?\"\n - \"Can you identify the error?\"\n - UI/visual verification and feedback\n - Simple technical questions\n\n - Use `codevf-chat` for:\n - Complex debugging requiring back-and-forth (4-1920 credits, 2 credits/min)\n - Multi-step troubleshooting\n - Architecture discussions\n - Extended collaboration\n\n - Use `codevf-tunnel` for:\n - Creating secure tunnels to expose local dev servers\n - Testing webhooks, OAuth callbacks, or external integrations\n - Sharing local development environment with engineers\n - No credits required - tunnel remains active for session\n\n2. **For UI/Visual Development Tasks** (Pain-Free Experience):\n\n When implementing UI changes or visual features, follow this iterative flow:\n\n **Step 1 - Initial Implementation:**\n - Make the requested changes to code/styles\n - Create tunnel if needed: `codevf-tunnel` with dev server port\n - Share tunnel URL for visual verification\n\n **Step 2 - Engineer Verification:**\n - Use `codevf-instant` with message like:\n \"Please verify this UI change via [tunnel-url] (password: [password]). Does it match the requested design/functionality?\"\n - **Always include both URL and password** - localtunnel requires password to bypass landing page\n - Include specific areas of focus (layout, spacing, colors, interactions)\n - Allow 5-8 credits for visual review and feedback\n\n **Step 3 - Iterative Refinement:**\n - Apply engineer feedback immediately\n - Use `codevf-instant` again for re-verification:\n \"Applied your feedback (reduced padding to 16px). Please check if this looks better now at [tunnel-url] (same password).\"\n - Continue this cycle until engineer confirms it looks right\n - Each feedback cycle: 3-5 credits\n\n **Example UI Flow:**\n ```\n User: \"Make the UI look like a modern card layout\"\n\n Claude:\n 1. Implements card styling\n 2. Creates tunnel \u2192 https://abc123.loca.lt (password: xyz789)\n 3. codevf-instant: \"Please review the card layout at https://abc123.loca.lt\n (password: xyz789). Does it look modern and clean? Any spacing/styling issues?\" (5 credits)\n\n Engineer: \"Cards look good but margins are too large, reduce to 16px\"\n\n Claude:\n 4. Updates margins to 16px\n 5. codevf-instant: \"Applied 16px margins. Please verify the spacing\n looks better now at https://abc123.loca.lt (password: xyz789).\" (3 credits)\n\n Engineer: \"Perfect! The spacing looks much cleaner now.\"\n ```\n\n3. **Use the appropriate tool:**\n - For instant queries: Call `codevf-instant` with the message and appropriate maxCredits (1-10)\n - For extended sessions: Call `codevf-chat` with the message and appropriate maxCredits (suggest 240 for ~2 hours)\n - For tunnel access: Call `codevf-tunnel` with the port number (e.g., { \"port\": 3000 })\n\n4. **Present the response:**\n - For instant queries: Share the engineer's response directly\n - For chat sessions: Provide the session URL so the user can monitor the conversation\n - For tunnels: Share the public URL that was created\n\n**Credit Guidelines:**\n- Instant validation: 1-10 credits (typically 3-5 credits per question)\n- UI verification: 5-8 credits for initial review, 3-5 credits for follow-up checks\n- Extended chat: 2 credits per minute (240 credits = 2 hours)\n- Tunnel creation: Free (no credits required)\n\n**Planning Integration for Complex Tasks:**\nWhen Claude is planning multi-step implementations, especially UI-heavy tasks:\n- Always include \"Engineer verification checkpoints\" in the plan\n- Budget credits for iterative feedback (typically 15-25 credits total for UI refinement)\n- Create tunnel early in the process for continuous visual validation\n- Plan for 2-4 feedback cycles to achieve the desired result\n\n**Example Usage:**\n- `/cvf Does this authentication fix prevent the timing attack?` \u2192 Use codevf-instant\n- `/cvf Complex race condition in WebSocket reconnection needs debugging` \u2192 Use codevf-chat\n- `/cvf Create tunnel to my dev server on port 3000` \u2192 Use codevf-tunnel\n- `/cvf Make the login form look more modern and user-friendly` \u2192 Use tunnel + iterative codevf-instant feedback\n";
|
|
2
2
|
//# sourceMappingURL=cvf-command-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cvf-command-content.d.ts","sourceRoot":"","sources":["../../src/commands/cvf-command-content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"cvf-command-content.d.ts","sourceRoot":"","sources":["../../src/commands/cvf-command-content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,+8JAgH1B,CAAC"}
|
|
@@ -11,6 +11,11 @@ Please help me with the following question or task by consulting a CodeVF engine
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
**Available CodeVF Commands:**
|
|
15
|
+
- \`codevf setup\` - Configure MCP server for Claude Code, Codex, and Gemini
|
|
16
|
+
- \`codevf mcp stdio\` - Start MCP server over stdio
|
|
17
|
+
- \`codevf mcp http --port 3333\` - Start MCP server over HTTP/SSE
|
|
18
|
+
|
|
14
19
|
**Instructions for Claude:**
|
|
15
20
|
|
|
16
21
|
1. **Analyze the request** to determine which CodeVF tool is most appropriate:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cvf-command-content.js","sourceRoot":"","sources":["../../src/commands/cvf-command-content.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG
|
|
1
|
+
{"version":3,"file":"cvf-command-content.js","sourceRoot":"","sources":["../../src/commands/cvf-command-content.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgH7B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server commands for stdio and HTTP modes
|
|
3
|
+
*/
|
|
4
|
+
export interface McpHttpOptions {
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function startMcpStdio(): Promise<void>;
|
|
9
|
+
export declare function startMcpHttp(options: McpHttpOptions): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AA0BD,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CASnD;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDzE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server commands for stdio and HTTP modes
|
|
3
|
+
*/
|
|
4
|
+
import { createMcpExpressApp } from '@modelcontextprotocol/sdk/server/express.js';
|
|
5
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
6
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { randomUUID } from 'crypto';
|
|
9
|
+
import { createMcpServer } from '../mcp/server.js';
|
|
10
|
+
import { logger, LogLevel } from '../lib/utils/logger.js';
|
|
11
|
+
async function attachShutdownHandlers(chatTool, tunnelTool, server, onShutdown) {
|
|
12
|
+
process.on('SIGINT', async () => {
|
|
13
|
+
logger.info('Shutting down...');
|
|
14
|
+
try {
|
|
15
|
+
await chatTool.notifyDisconnect();
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
logger.error('Error sending disconnect notification', error);
|
|
19
|
+
}
|
|
20
|
+
await tunnelTool.closeAll();
|
|
21
|
+
if (onShutdown) {
|
|
22
|
+
await onShutdown();
|
|
23
|
+
}
|
|
24
|
+
await server.close();
|
|
25
|
+
process.exit(0);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export async function startMcpStdio() {
|
|
29
|
+
if (process.env.DEBUG) {
|
|
30
|
+
logger.setLevel(LogLevel.DEBUG);
|
|
31
|
+
}
|
|
32
|
+
const { server, chatTool, tunnelTool } = await createMcpServer();
|
|
33
|
+
const transport = new StdioServerTransport();
|
|
34
|
+
await server.connect(transport);
|
|
35
|
+
logger.info('CodeVF MCP Server started');
|
|
36
|
+
await attachShutdownHandlers(chatTool, tunnelTool, server);
|
|
37
|
+
}
|
|
38
|
+
export async function startMcpHttp(options) {
|
|
39
|
+
if (process.env.DEBUG) {
|
|
40
|
+
logger.setLevel(LogLevel.DEBUG);
|
|
41
|
+
}
|
|
42
|
+
const { host, port } = options;
|
|
43
|
+
const { server, chatTool, tunnelTool } = await createMcpServer();
|
|
44
|
+
const app = createMcpExpressApp({ host });
|
|
45
|
+
const transport = new StreamableHTTPServerTransport({
|
|
46
|
+
sessionIdGenerator: () => randomUUID(),
|
|
47
|
+
});
|
|
48
|
+
await server.connect(transport);
|
|
49
|
+
app.get('/sse', (req, res) => {
|
|
50
|
+
transport.handleRequest(req, res).catch((error) => {
|
|
51
|
+
logger.error('SSE request error', error);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
app.post('/messages', (req, res) => {
|
|
55
|
+
transport.handleRequest(req, res, req.body).catch((error) => {
|
|
56
|
+
logger.error('Message request error', error);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
app.all('/mcp', (req, res) => {
|
|
60
|
+
const parsedBody = req.method === 'POST' ? req.body : undefined;
|
|
61
|
+
transport.handleRequest(req, res, parsedBody).catch((error) => {
|
|
62
|
+
logger.error('MCP request error', error);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
console.log(chalk.dim(`# Initializing CodeVF MCP Server in HTTP mode on port ${port}...`));
|
|
66
|
+
const listener = app.listen(port, host, () => {
|
|
67
|
+
const address = listener.address();
|
|
68
|
+
const resolvedPort = address?.port ?? port;
|
|
69
|
+
const hostLabel = host === '0.0.0.0' ? 'localhost' : host;
|
|
70
|
+
const baseUrl = `http://${hostLabel}:${resolvedPort}`;
|
|
71
|
+
console.log(chalk.dim(`# HTTP server listening on port ${resolvedPort}`));
|
|
72
|
+
console.log(chalk.dim(`# SSE endpoint available at ${baseUrl}/sse`));
|
|
73
|
+
console.log(chalk.dim(`# Message endpoint available at ${baseUrl}/messages`));
|
|
74
|
+
});
|
|
75
|
+
await attachShutdownHandlers(chatTool, tunnelTool, server, () => {
|
|
76
|
+
listener.close();
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAIpC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAO1D,KAAK,UAAU,sBAAsB,CACnC,QAAmD,EACnD,UAA6C,EAC7C,MAAsC,EACtC,UAAuC;IAEvC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QAC9B,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEhC,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC5B,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,UAAU,EAAE,CAAC;QACrB,CAAC;QACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,eAAe,EAAE,CAAC;IACjE,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACzC,MAAM,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAuB;IACxD,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,eAAe,EAAE,CAAC;IAEjE,MAAM,GAAG,GAAG,mBAAmB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC;QAClD,kBAAkB,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;KACvC,CAAC,CAAC;IAEH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAoB,EAAE,GAAmB,EAAE,EAAE;QAC5D,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAChD,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAyC,EAAE,GAAmB,EAAE,EAAE;QACvF,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1D,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAyC,EAAE,GAAmB,EAAE,EAAE;QACjF,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAChE,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5D,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CACP,yDAAyD,IAAI,KAAK,CACnE,CACF,CAAC;IAEF,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;QAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAwB,CAAC;QACzD,MAAM,YAAY,GAAG,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC;QAC3C,MAAM,SAAS,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1D,MAAM,OAAO,GAAG,UAAU,SAAS,IAAI,YAAY,EAAE,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,mCAAmC,YAAY,EAAE,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,OAAO,MAAM,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,mCAAmC,OAAO,WAAW,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,MAAM,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE;QAC9D,QAAQ,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/commands/setup.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Setup command for CodeVF MCP Server configuration
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Setup command - configures MCP server for Claude Code
|
|
5
|
+
* Setup command - configures MCP server for Claude Code, Codex, and Gemini
|
|
6
6
|
*/
|
|
7
7
|
export declare function setupCommand(): Promise<void>;
|
|
8
8
|
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0UH;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CA6OlD"}
|
package/dist/commands/setup.js
CHANGED
|
@@ -25,6 +25,48 @@ function getClaudeCodeConfigPath() {
|
|
|
25
25
|
}
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Get Codex MCP config path
|
|
30
|
+
*/
|
|
31
|
+
function getCodexConfigPath() {
|
|
32
|
+
return path.join(os.homedir(), '.codex', 'config.toml');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve Gemini CLI config path based on platform and existing files.
|
|
36
|
+
* Supports common locations used by gemini-cli and similar tools.
|
|
37
|
+
*/
|
|
38
|
+
function getGeminiConfigPath() {
|
|
39
|
+
const homeDir = os.homedir();
|
|
40
|
+
const platform = os.platform();
|
|
41
|
+
const candidates = [];
|
|
42
|
+
if (platform === 'win32') {
|
|
43
|
+
const appData = process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming');
|
|
44
|
+
candidates.push(path.join(appData, 'gemini-cli', 'config.json'));
|
|
45
|
+
candidates.push(path.join(homeDir, '.gemini', 'config.json'));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
candidates.push(path.join(homeDir, '.config', 'gemini-cli', 'config.json'));
|
|
49
|
+
candidates.push(path.join(homeDir, '.config', 'gemini', 'config.json'));
|
|
50
|
+
candidates.push(path.join(homeDir, '.gemini', 'config.json'));
|
|
51
|
+
}
|
|
52
|
+
return candidates.find((candidate) => fs.existsSync(candidate)) || candidates[0];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve installed MCP server path
|
|
56
|
+
*/
|
|
57
|
+
function getMcpServerPath() {
|
|
58
|
+
const codevfPath = process.argv[1]; // Path to codevf binary
|
|
59
|
+
let resolvedPath = codevfPath;
|
|
60
|
+
try {
|
|
61
|
+
// Follow npm/yarn/pnpm bin symlinks to the actual package entrypoint.
|
|
62
|
+
resolvedPath = fs.realpathSync(codevfPath);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Fall back to argv path if it cannot be resolved (e.g. permissions or missing file).
|
|
66
|
+
}
|
|
67
|
+
const packageDir = path.dirname(path.dirname(resolvedPath)); // Go up from dist/index.js
|
|
68
|
+
return path.join(packageDir, 'dist', 'mcp', 'index.js');
|
|
69
|
+
}
|
|
28
70
|
/**
|
|
29
71
|
* Create /cvf slash command for Claude Code
|
|
30
72
|
*/
|
|
@@ -60,6 +102,122 @@ function createCvfSlashCommand() {
|
|
|
60
102
|
return false;
|
|
61
103
|
}
|
|
62
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Auto-configure Codex with MCP server
|
|
107
|
+
*/
|
|
108
|
+
async function autoConfigureCodex() {
|
|
109
|
+
console.log(chalk.bold('\n📋 Codex Configuration\n'));
|
|
110
|
+
const configPath = getCodexConfigPath();
|
|
111
|
+
const { shouldConfigure } = await prompts({
|
|
112
|
+
type: 'confirm',
|
|
113
|
+
name: 'shouldConfigure',
|
|
114
|
+
message: 'Configure Codex to use CodeVF MCP server?',
|
|
115
|
+
initial: true,
|
|
116
|
+
});
|
|
117
|
+
if (!shouldConfigure) {
|
|
118
|
+
console.log(chalk.dim('\n💡 To configure manually, add to ~/.codex/config.toml:'));
|
|
119
|
+
console.log(chalk.dim(' [mcp_servers.codevf]'));
|
|
120
|
+
console.log(chalk.dim(' command = "node"'));
|
|
121
|
+
console.log(chalk.dim(' args = ["<path>/dist/mcp/index.js"]'));
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const configDir = path.dirname(configPath);
|
|
126
|
+
if (!fs.existsSync(configDir)) {
|
|
127
|
+
fs.mkdirSync(configDir, { recursive: true, mode: 0o755 });
|
|
128
|
+
}
|
|
129
|
+
let configContent = '';
|
|
130
|
+
if (fs.existsSync(configPath)) {
|
|
131
|
+
configContent = fs.readFileSync(configPath, 'utf8');
|
|
132
|
+
}
|
|
133
|
+
const hasCodevf = /^\s*\[mcp_servers\.codevf\]\s*$/m.test(configContent);
|
|
134
|
+
if (hasCodevf) {
|
|
135
|
+
console.log(chalk.green('✅ CodeVF MCP server already configured for Codex!'));
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
const mcpServerPath = getMcpServerPath();
|
|
139
|
+
const block = [
|
|
140
|
+
'[mcp_servers.codevf]',
|
|
141
|
+
'command = "node"',
|
|
142
|
+
`args = ["${mcpServerPath}"]`,
|
|
143
|
+
'',
|
|
144
|
+
].join('\n');
|
|
145
|
+
const nextContent = configContent.trim().length === 0
|
|
146
|
+
? `${block}\n`
|
|
147
|
+
: `${configContent.trimEnd()}\n\n${block}\n`;
|
|
148
|
+
fs.writeFileSync(configPath, nextContent, { mode: 0o600 });
|
|
149
|
+
console.log(chalk.green('✅ Codex configured successfully!'));
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
console.error(chalk.red('\n❌ Codex auto-config failed:'), error.message);
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Auto-configure Gemini CLI with MCP server
|
|
159
|
+
*/
|
|
160
|
+
async function autoConfigureGemini() {
|
|
161
|
+
console.log(chalk.bold('\n📋 Gemini Configuration\n'));
|
|
162
|
+
const configPath = getGeminiConfigPath();
|
|
163
|
+
const { shouldConfigure } = await prompts({
|
|
164
|
+
type: 'confirm',
|
|
165
|
+
name: 'shouldConfigure',
|
|
166
|
+
message: 'Configure Gemini to use CodeVF MCP server?',
|
|
167
|
+
initial: true,
|
|
168
|
+
});
|
|
169
|
+
if (!shouldConfigure) {
|
|
170
|
+
console.log(chalk.dim(`\n💡 To configure manually, add to ${configPath}:`));
|
|
171
|
+
console.log(chalk.dim(' {'));
|
|
172
|
+
console.log(chalk.dim(' "mcpServers": {'));
|
|
173
|
+
console.log(chalk.dim(' "codevf": {'));
|
|
174
|
+
console.log(chalk.dim(' "command": "node",'));
|
|
175
|
+
console.log(chalk.dim(' "args": ["<path>/dist/mcp/index.js"]'));
|
|
176
|
+
console.log(chalk.dim(' }'));
|
|
177
|
+
console.log(chalk.dim(' }'));
|
|
178
|
+
console.log(chalk.dim(' }'));
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
// Backup existing config
|
|
183
|
+
if (fs.existsSync(configPath)) {
|
|
184
|
+
const backupPath = `${configPath}.backup`;
|
|
185
|
+
console.log(chalk.dim('\n📋 Backing up existing config...'));
|
|
186
|
+
fs.copyFileSync(configPath, backupPath);
|
|
187
|
+
console.log(chalk.dim(` Backup: ${backupPath}`));
|
|
188
|
+
}
|
|
189
|
+
// Read or create config
|
|
190
|
+
let config = {};
|
|
191
|
+
if (fs.existsSync(configPath)) {
|
|
192
|
+
const content = fs.readFileSync(configPath, 'utf8');
|
|
193
|
+
config = JSON.parse(content);
|
|
194
|
+
}
|
|
195
|
+
const mcpServerPath = getMcpServerPath();
|
|
196
|
+
const mcpKey = config.mcpServers ? 'mcpServers' : config.mcp_servers ? 'mcp_servers' : 'mcpServers';
|
|
197
|
+
if (!config[mcpKey]) {
|
|
198
|
+
config[mcpKey] = {};
|
|
199
|
+
}
|
|
200
|
+
if (config[mcpKey].codevf) {
|
|
201
|
+
console.log(chalk.green('✅ CodeVF MCP server already configured for Gemini!'));
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
config[mcpKey].codevf = {
|
|
205
|
+
command: 'node',
|
|
206
|
+
args: [mcpServerPath],
|
|
207
|
+
};
|
|
208
|
+
const configDir = path.dirname(configPath);
|
|
209
|
+
if (!fs.existsSync(configDir)) {
|
|
210
|
+
fs.mkdirSync(configDir, { recursive: true, mode: 0o755 });
|
|
211
|
+
}
|
|
212
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), { mode: 0o600 });
|
|
213
|
+
console.log(chalk.green('✅ Gemini configured successfully!'));
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error(chalk.red('\n❌ Gemini auto-config failed:'), error.message);
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
63
221
|
/**
|
|
64
222
|
* Auto-configure Claude Code with MCP server
|
|
65
223
|
*/
|
|
@@ -104,10 +262,7 @@ async function autoConfigureClaudeCode() {
|
|
|
104
262
|
const content = fs.readFileSync(configPath, 'utf8');
|
|
105
263
|
config = JSON.parse(content);
|
|
106
264
|
}
|
|
107
|
-
|
|
108
|
-
const codevfPath = process.argv[1]; // Path to codevf binary
|
|
109
|
-
const packageDir = path.dirname(path.dirname(codevfPath)); // Go up from dist/index.js
|
|
110
|
-
const mcpServerPath = path.join(packageDir, 'dist', 'mcp', 'index.js');
|
|
265
|
+
const mcpServerPath = getMcpServerPath();
|
|
111
266
|
// Add or update codevf server
|
|
112
267
|
if (!config.mcpServers) {
|
|
113
268
|
config.mcpServers = {};
|
|
@@ -133,7 +288,7 @@ async function autoConfigureClaudeCode() {
|
|
|
133
288
|
}
|
|
134
289
|
}
|
|
135
290
|
/**
|
|
136
|
-
* Setup command - configures MCP server for Claude Code
|
|
291
|
+
* Setup command - configures MCP server for Claude Code, Codex, and Gemini
|
|
137
292
|
*/
|
|
138
293
|
export async function setupCommand() {
|
|
139
294
|
console.log(chalk.bold.blue('\n╔═══════════════════════════════════════╗'));
|
|
@@ -141,7 +296,7 @@ export async function setupCommand() {
|
|
|
141
296
|
console.log(chalk.bold.blue('╚═══════════════════════════════════════╝\n'));
|
|
142
297
|
const mcpConfigManager = new ConfigManager('mcp-config.json');
|
|
143
298
|
// Check if already configured and reuse base URL if present
|
|
144
|
-
let baseUrl = process.env.CODEVF_API_URL || 'https://
|
|
299
|
+
let baseUrl = process.env.CODEVF_API_URL || 'https://codevf.com';
|
|
145
300
|
if (mcpConfigManager.exists()) {
|
|
146
301
|
const existingConfig = mcpConfigManager.load();
|
|
147
302
|
console.log(chalk.yellow('⚠️ MCP configuration already exists'));
|
|
@@ -154,8 +309,10 @@ export async function setupCommand() {
|
|
|
154
309
|
initial: false,
|
|
155
310
|
});
|
|
156
311
|
if (!reconfigure) {
|
|
157
|
-
//
|
|
312
|
+
// Update client configs without re-authenticating
|
|
158
313
|
await autoConfigureClaudeCode();
|
|
314
|
+
await autoConfigureCodex();
|
|
315
|
+
await autoConfigureGemini();
|
|
159
316
|
console.log(chalk.green('\n🎉 Setup complete!\n'));
|
|
160
317
|
return;
|
|
161
318
|
}
|
|
@@ -308,19 +465,30 @@ export async function setupCommand() {
|
|
|
308
465
|
});
|
|
309
466
|
console.log(chalk.green('\n✅ Authentication complete!'));
|
|
310
467
|
console.log(chalk.dim('Configuration saved to:'), mcpConfigManager.getPath());
|
|
311
|
-
|
|
312
|
-
const
|
|
468
|
+
const configuredClaude = await autoConfigureClaudeCode();
|
|
469
|
+
const configuredCodex = await autoConfigureCodex();
|
|
470
|
+
const configuredGemini = await autoConfigureGemini();
|
|
313
471
|
console.log(chalk.bold.green('\n🎉 Setup complete!\n'));
|
|
314
|
-
if (
|
|
472
|
+
if (configuredClaude || configuredCodex || configuredGemini) {
|
|
315
473
|
console.log(chalk.bold('Next steps:'));
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
474
|
+
if (configuredClaude) {
|
|
475
|
+
console.log(chalk.dim('1. Restart Claude Code to load the MCP server'));
|
|
476
|
+
console.log(chalk.dim('2. Use the /cvf slash command in Claude Code:'));
|
|
477
|
+
console.log(chalk.dim(' Example: ') + chalk.white('/cvf Does this fix work?'));
|
|
478
|
+
console.log(chalk.dim(' Example: ') + chalk.white('/cvf Create tunnel to port 3000'));
|
|
479
|
+
console.log(chalk.dim('3. Or ask Claude to use MCP tools directly:'));
|
|
480
|
+
console.log(chalk.dim(' - codevf-instant: Quick validation (1-10 credits)'));
|
|
481
|
+
console.log(chalk.dim(' - codevf-chat: Extended debugging (2 credits/min)'));
|
|
482
|
+
console.log(chalk.dim(' - codevf-tunnel: Expose local dev server (free)\n'));
|
|
483
|
+
}
|
|
484
|
+
if (configuredCodex) {
|
|
485
|
+
console.log(chalk.dim('1. Restart Codex to load the MCP server'));
|
|
486
|
+
console.log(chalk.dim('2. Use /mcp in Codex to confirm CodeVF is connected\n'));
|
|
487
|
+
}
|
|
488
|
+
if (configuredGemini) {
|
|
489
|
+
console.log(chalk.dim('1. Restart Gemini to load the MCP server'));
|
|
490
|
+
console.log(chalk.dim('2. Confirm CodeVF MCP tools are available\n'));
|
|
491
|
+
}
|
|
324
492
|
}
|
|
325
493
|
}
|
|
326
494
|
catch (error) {
|