@quantiya/codevibe-claude-plugin 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.claude-plugin/plugin.json +22 -0
  2. package/.env.example +28 -0
  3. package/LICENSE +21 -0
  4. package/README.md +301 -0
  5. package/bin/claude-companion-setup +65 -0
  6. package/bin/codevibe-claude +134 -0
  7. package/dist/appsync-client.d.ts +67 -0
  8. package/dist/appsync-client.d.ts.map +1 -0
  9. package/dist/appsync-client.js +858 -0
  10. package/dist/appsync-client.js.map +1 -0
  11. package/dist/auth-cli.d.ts +18 -0
  12. package/dist/auth-cli.d.ts.map +1 -0
  13. package/dist/auth-cli.js +472 -0
  14. package/dist/auth-cli.js.map +1 -0
  15. package/dist/command-executor.d.ts +20 -0
  16. package/dist/command-executor.d.ts.map +1 -0
  17. package/dist/command-executor.js +127 -0
  18. package/dist/command-executor.js.map +1 -0
  19. package/dist/config.d.ts +25 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +106 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/crypto-service.d.ts +115 -0
  24. package/dist/crypto-service.d.ts.map +1 -0
  25. package/dist/crypto-service.js +278 -0
  26. package/dist/crypto-service.js.map +1 -0
  27. package/dist/http-api.d.ts +35 -0
  28. package/dist/http-api.d.ts.map +1 -0
  29. package/dist/http-api.js +334 -0
  30. package/dist/http-api.js.map +1 -0
  31. package/dist/key-manager.d.ts +87 -0
  32. package/dist/key-manager.d.ts.map +1 -0
  33. package/dist/key-manager.js +287 -0
  34. package/dist/key-manager.js.map +1 -0
  35. package/dist/logger.d.ts +2 -0
  36. package/dist/logger.d.ts.map +1 -0
  37. package/dist/logger.js +18 -0
  38. package/dist/logger.js.map +1 -0
  39. package/dist/prompt-responder.d.ts +22 -0
  40. package/dist/prompt-responder.d.ts.map +1 -0
  41. package/dist/prompt-responder.js +132 -0
  42. package/dist/prompt-responder.js.map +1 -0
  43. package/dist/server.d.ts +2 -0
  44. package/dist/server.d.ts.map +1 -0
  45. package/dist/server.js +1154 -0
  46. package/dist/server.js.map +1 -0
  47. package/dist/token-storage.d.ts +39 -0
  48. package/dist/token-storage.d.ts.map +1 -0
  49. package/dist/token-storage.js +169 -0
  50. package/dist/token-storage.js.map +1 -0
  51. package/dist/types.d.ts +110 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +17 -0
  54. package/dist/types.js.map +1 -0
  55. package/hooks/common.sh +121 -0
  56. package/hooks/hooks.json +81 -0
  57. package/hooks/notification.sh +32 -0
  58. package/hooks/permission-request.sh +191 -0
  59. package/hooks/post-tool-use.sh +42 -0
  60. package/hooks/session-end.sh +57 -0
  61. package/hooks/session-start.sh +127 -0
  62. package/hooks/stop.sh +255 -0
  63. package/hooks/user-prompt.sh +32 -0
  64. package/package.json +70 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "codevibe-claude",
3
+ "version": "1.0.0",
4
+ "description": "Sync Claude Code sessions with iOS mobile app via AWS backend. Control Claude Code from your iPhone with real-time bidirectional synchronization.",
5
+ "author": {
6
+ "name": "CodeVibe Team"
7
+ },
8
+ "homepage": "https://github.com/hendryyeh/quantiya-codevibe-claude-plugin",
9
+ "repository": "https://github.com/hendryyeh/quantiya-codevibe-claude-plugin.git",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "mobile",
13
+ "sync",
14
+ "ios",
15
+ "remote",
16
+ "control",
17
+ "real-time",
18
+ "appsync",
19
+ "graphql",
20
+ "codevibe"
21
+ ]
22
+ }
package/.env.example ADDED
@@ -0,0 +1,28 @@
1
+ # CodeVibe Plugin Configuration
2
+ # ======================================
3
+ # NOTE: You typically don't need to edit this file manually.
4
+ # Configuration is auto-set after running 'codevibe-claude login'.
5
+ #
6
+ # Copy this file to .env.production or .env.development and fill in values.
7
+
8
+ # Server Configuration
9
+ PORT=3456
10
+ HOST=localhost
11
+
12
+ # AWS Configuration
13
+ # These values are provided by the CodeVibe service
14
+ AWS_REGION=us-east-1
15
+ APPSYNC_URL=https://your-appsync-endpoint.appsync-api.us-east-1.amazonaws.com/graphql
16
+
17
+ # Cognito Configuration (for OAuth authentication)
18
+ COGNITO_USER_POOL_ID=us-east-1_xxxxxxxxx
19
+ COGNITO_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxx
20
+ COGNITO_DOMAIN=your-domain.auth.us-east-1.amazoncognito.com
21
+
22
+ # Claude Configuration
23
+ CLAUDE_COMMAND=claude
24
+ CLAUDE_TIMEOUT=60000
25
+
26
+ # Logging Configuration
27
+ LOG_FILE=/tmp/codevibe-claude-mcp.log
28
+ LOG_LEVEL=info
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Quantiya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,301 @@
1
+ # CodeVibe Claude Plugin
2
+
3
+ Control Claude Code from your iPhone with real-time bidirectional synchronization. This plugin enables seamless communication between your desktop Claude Code sessions and the CodeVibe iOS app.
4
+
5
+ ## Features
6
+
7
+ - **Real-time Sync** - See desktop conversations on mobile instantly (~100-500ms latency)
8
+ - **Mobile Control** - Send prompts from your iPhone that execute in the correct desktop session
9
+ - **Locked Screen Support** - Works even when your Mac screen is locked (via tmux)
10
+ - **Interactive Prompts** - Answer permission dialogs with numbered options (1=Yes, 2=Yes for project, 3=Reject)
11
+ - **Voice Input** - Dictate prompts using iOS speech-to-text
12
+ - **Image Attachments** - Send screenshots and photos with your messages
13
+ - **Markdown Rendering** - Code blocks and formatting displayed beautifully
14
+ - **Secure** - Uses AWS AppSync with Cognito authentication (Sign in with Apple/Google)
15
+ - **Complete Capture** - Syncs user prompts, assistant responses, tool usage, and file changes
16
+ - **Session-Aware** - Multiple Claude Code sessions work independently
17
+ - **Auto-execution** - Mobile prompts execute immediately (same trust model as desktop)
18
+
19
+ ## Prerequisites
20
+
21
+ - **macOS** (darwin platform)
22
+ - **Node.js** 18.0.0 or higher
23
+ - **tmux** (for locked screen support): `brew install tmux`
24
+ - **Claude Code** with plugin system enabled
25
+
26
+ ## Installation
27
+
28
+ ### Step 1: Add Marketplace (One-time)
29
+
30
+ Inside Claude Code, run:
31
+
32
+ ```
33
+ /plugin marketplace add hendryyeh/quantiya-codevibe-marketplace
34
+ ```
35
+
36
+ ### Step 2: Install Plugin (One-time)
37
+
38
+ ```
39
+ /plugin install codevibe-claude
40
+ ```
41
+
42
+ This downloads plugin files to `~/.claude/plugins/codevibe-claude/`.
43
+
44
+ ### Step 3: Run Setup Script (One-time)
45
+
46
+ After installation, run the setup script to configure your PATH:
47
+
48
+ ```bash
49
+ ~/.claude/plugins/codevibe-claude/bin/codevibe-claude-setup
50
+ ```
51
+
52
+ Then reload your shell:
53
+
54
+ ```bash
55
+ source ~/.zshrc # or ~/.bashrc
56
+ ```
57
+
58
+ ### Step 4: Authenticate (One-time)
59
+
60
+ Login to your CodeVibe account:
61
+
62
+ ```bash
63
+ codevibe-claude login
64
+ ```
65
+
66
+ This opens a browser for OAuth authentication (Sign in with Apple or Google). Your tokens are stored securely in `~/.codevibe-claude/`.
67
+
68
+ Other auth commands:
69
+ ```bash
70
+ codevibe-claude status # Check authentication status
71
+ codevibe-claude logout # Sign out and clear tokens
72
+ ```
73
+
74
+ ### Step 5: Start Claude Code with Mobile Support
75
+
76
+ **Important:** You must use the `codevibe-claude` wrapper instead of `claude` directly:
77
+
78
+ ```bash
79
+ codevibe-claude
80
+ ```
81
+
82
+ This wrapper:
83
+ - Creates a tmux session for the Claude Code instance
84
+ - Enables mobile prompts to work even when your Mac screen is locked
85
+ - Supports multiple concurrent Claude Code sessions
86
+
87
+ **Note:** Running `claude` directly without the wrapper will prevent mobile prompts from working when your screen is locked.
88
+
89
+ ### Step 6: Download the iOS App
90
+
91
+ Download "CodeVibe" from the App Store and sign in with the same account you used in Step 4.
92
+
93
+ ## Usage
94
+
95
+ ### Using the `codevibe-claude` Wrapper
96
+
97
+ ```bash
98
+ # Start a new session (same as running `claude`)
99
+ codevibe-claude
100
+
101
+ # Resume the last session
102
+ codevibe-claude --resume
103
+
104
+ # Start with a prompt
105
+ codevibe-claude -p "fix the bug"
106
+
107
+ # All other claude arguments work too
108
+ codevibe-claude --model sonnet
109
+ ```
110
+
111
+ ### Benefits of `codevibe-claude`
112
+
113
+ | Feature | `codevibe-claude` | Regular `claude` |
114
+ |---------|-------------------|------------------|
115
+ | Mobile prompts | Works always | Only when screen unlocked |
116
+ | Screen locked support | Yes (via tmux) | No |
117
+ | Mouse scrolling | Yes | Yes |
118
+ | Same experience | Yes | Yes |
119
+
120
+ ### Desktop to Mobile Sync
121
+
122
+ Everything you do in Claude Code is automatically synced to mobile:
123
+
124
+ - **User Prompts** - Your questions and commands
125
+ - **Assistant Responses** - Claude's complete responses
126
+ - **Tool Usage** - File edits, reads, writes
127
+ - **Interactive Prompts** - Y/n permission requests
128
+ - **Notifications** - System messages
129
+
130
+ ### Mobile to Desktop Control
131
+
132
+ From the iOS app:
133
+
134
+ 1. Open the CodeVibe app
135
+ 2. Select your active session
136
+ 3. Type a message or response
137
+ 4. It executes immediately in your desktop Claude Code session
138
+ 5. See the response on both desktop and mobile
139
+
140
+ ### Responding to Permission Prompts from Mobile
141
+
142
+ When Claude needs permission to edit or write files, you can respond directly from your iPhone.
143
+
144
+ **Available Options:**
145
+
146
+ | Reply | Description |
147
+ |-------|-------------|
148
+ | `1` | **Approve** - Allow this specific file operation |
149
+ | `2` | **Always Allow** - Approve and skip future prompts for this project |
150
+ | `3` | **Reject** - Decline the operation |
151
+ | `3 <message>` | **Reject with Instructions** - Decline and tell Claude what to do instead |
152
+
153
+ **Examples:**
154
+ ```
155
+ 1 -> Approves the edit
156
+ 2 -> Approves and trusts this project
157
+ 3 -> Rejects the edit
158
+ 3 use a different approach -> Rejects and redirects Claude
159
+ ```
160
+
161
+ **Other Inputs:**
162
+ - `Y` / `N` - For yes/no confirmation prompts
163
+ - `exit`, `quit` - To cancel running operations
164
+ - Any other text - Sent as a new prompt to Claude
165
+
166
+ ## Troubleshooting
167
+
168
+ ### "codevibe-claude: command not found"
169
+
170
+ **Cause:** PATH not updated or shell not reloaded.
171
+
172
+ **Solution:**
173
+ ```bash
174
+ source ~/.zshrc # or ~/.bashrc
175
+ ```
176
+
177
+ Or check if PATH was added:
178
+ ```bash
179
+ grep "codevibe-claude" ~/.zshrc
180
+ ```
181
+
182
+ ### "Not authenticated" error
183
+
184
+ **Cause:** User hasn't logged in or tokens expired.
185
+
186
+ **Solution:**
187
+ ```bash
188
+ codevibe-claude login
189
+ ```
190
+
191
+ ### Mobile messages not executing
192
+
193
+ **Cause:** Not using the codevibe-claude wrapper.
194
+
195
+ **Solution:** Start Claude Code with:
196
+ ```bash
197
+ codevibe-claude
198
+ ```
199
+ Not just `claude`.
200
+
201
+ ### Plugin hooks not firing
202
+
203
+ **Cause:** Plugin not properly installed.
204
+
205
+ **Solution:**
206
+ ```
207
+ # In Claude Code
208
+ /plugin list # Check if installed
209
+ /plugin uninstall codevibe-claude
210
+ /plugin install codevibe-claude
211
+ ```
212
+
213
+ ### Port already in use
214
+
215
+ **Error:** `EADDRINUSE: address already in use :::3456`
216
+
217
+ **Solution:** Another MCP server is already running. Kill it:
218
+
219
+ ```bash
220
+ pkill -f "node dist/server.js"
221
+ ```
222
+
223
+ ## Mac Power Settings (for Locked Screen Support)
224
+
225
+ To ensure mobile prompts work when your Mac screen is locked:
226
+
227
+ 1. **System Settings** -> **Battery** (or **Energy**) -> Set "Computer sleep" to **Never** (when on power)
228
+ 2. In Terminal:
229
+ ```bash
230
+ sudo pmset -a tcpkeepalive 1
231
+ sudo pmset -a womp 1
232
+ ```
233
+
234
+ This keeps network connections alive during sleep.
235
+
236
+ ## Architecture
237
+
238
+ ```
239
+ Desktop -> Mobile:
240
+ +-------------+ +----------+ +---------+ +----------+ +--------+
241
+ | Claude Code | -> | Hook | -> | MCP | -> | AppSync | -> | Mobile |
242
+ | | | Scripts | | Server | | GraphQL | | App |
243
+ +-------------+ +----------+ +---------+ +----------+ +--------+
244
+
245
+ Mobile -> Desktop:
246
+ +--------+ +----------+ +---------+ +-------------+
247
+ | Mobile | -> | AppSync | -> | MCP | -> | Claude Code |
248
+ | App | | GraphQL | | Server | | (tmux keys) |
249
+ +--------+ +----------+ +---------+ +-------------+
250
+ ```
251
+
252
+ ## Development
253
+
254
+ If you want to contribute or run from source:
255
+
256
+ ### Clone and Build
257
+
258
+ ```bash
259
+ git clone https://github.com/hendryyeh/quantiya-codevibe-claude-plugin.git
260
+ cd quantiya-codevibe-claude-plugin
261
+ npm install
262
+ npm run build
263
+ ```
264
+
265
+ ### Local Testing
266
+
267
+ For local development and testing:
268
+
269
+ ```bash
270
+ ./install-local.sh
271
+
272
+ # In Claude Code
273
+ /plugin marketplace add ./dev-marketplace
274
+ /plugin install codevibe-claude@codevibe-claude-dev
275
+ ```
276
+
277
+ ### View Logs
278
+
279
+ ```bash
280
+ # MCP Server logs
281
+ tail -f /tmp/codevibe-claude-mcp.log
282
+
283
+ # Hook scripts logs
284
+ tail -f /tmp/codevibe-claude-hooks.log
285
+ ```
286
+
287
+ ## Support
288
+
289
+ - **Issues:** [GitHub Issues](https://github.com/hendryyeh/quantiya-codevibe-claude-plugin/issues)
290
+
291
+ ## Related
292
+
293
+ - **CodeVibe iOS App** - Available on the App Store
294
+
295
+ ## License
296
+
297
+ MIT License - see [LICENSE](LICENSE) file for details.
298
+
299
+ ---
300
+
301
+ **Made with care by the CodeVibe Team**
@@ -0,0 +1,65 @@
1
+ #!/bin/bash
2
+ #
3
+ # CodeVibe Setup Script
4
+ # Run this once after installing the plugin to configure PATH
5
+ #
6
+
7
+ set -e
8
+
9
+ # Determine plugin directory (where this script is located)
10
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
11
+ BIN_PATH="$SCRIPT_DIR"
12
+
13
+ # Detect shell
14
+ if [ -n "$ZSH_VERSION" ] || [ "$SHELL" = "/bin/zsh" ]; then
15
+ SHELL_RC="$HOME/.zshrc"
16
+ SHELL_NAME="zsh"
17
+ elif [ -n "$BASH_VERSION" ] || [ "$SHELL" = "/bin/bash" ]; then
18
+ SHELL_RC="$HOME/.bashrc"
19
+ SHELL_NAME="bash"
20
+ else
21
+ SHELL_RC="$HOME/.profile"
22
+ SHELL_NAME="sh"
23
+ fi
24
+
25
+ # PATH export line
26
+ PATH_EXPORT="export PATH=\"\$PATH:$BIN_PATH\""
27
+
28
+ echo ""
29
+ echo "CodeVibe Setup"
30
+ echo "======================"
31
+ echo ""
32
+
33
+ # Check if already in rc file
34
+ if grep -q "codevibe-claude" "$SHELL_RC" 2>/dev/null; then
35
+ echo "PATH already configured in $SHELL_RC"
36
+ else
37
+ # Add to rc file
38
+ echo "" >> "$SHELL_RC"
39
+ echo "# CodeVibe plugin" >> "$SHELL_RC"
40
+ echo "$PATH_EXPORT" >> "$SHELL_RC"
41
+ echo "Added PATH to $SHELL_RC"
42
+ fi
43
+
44
+ echo ""
45
+ echo "================================================================"
46
+ echo " Setup complete!"
47
+ echo "================================================================"
48
+ echo ""
49
+ echo "Next steps:"
50
+ echo ""
51
+ echo " 1. Reload your shell:"
52
+ echo " source $SHELL_RC"
53
+ echo ""
54
+ echo " 2. Login to your account:"
55
+ echo " codevibe-claude login"
56
+ echo ""
57
+ echo " 3. Start Claude Code with mobile support:"
58
+ echo " codevibe-claude"
59
+ echo ""
60
+ echo " 4. Download the iOS app from the App Store"
61
+ echo " Search \"CodeVibe\" and sign in with the same account"
62
+ echo ""
63
+ echo "----------------------------------------------------------------"
64
+ echo " Documentation: https://github.com/hendryyeh/quantiya-codevibe-claude-plugin"
65
+ echo "----------------------------------------------------------------"
@@ -0,0 +1,134 @@
1
+ #!/bin/bash
2
+ #
3
+ # codevibe-claude - Wrapper to run Claude Code inside tmux for mobile control
4
+ #
5
+ # This script launches Claude Code inside a tmux session, enabling:
6
+ # - Mobile prompts when screen is locked (via tmux send-keys)
7
+ # - Same user experience as regular claude command
8
+ # - Automatic session naming based on Claude session ID
9
+ #
10
+ # Usage:
11
+ # codevibe-claude [claude-args...]
12
+ # codevibe-claude login # Sign in via browser
13
+ # codevibe-claude logout # Sign out
14
+ # codevibe-claude status # Show auth status
15
+ #
16
+ # Environment:
17
+ # ENVIRONMENT # Set to 'production' (default) or 'development'
18
+ #
19
+ # Examples:
20
+ # codevibe-claude # Start new session
21
+ # codevibe-claude --resume # Resume last session
22
+ # codevibe-claude -p "fix the bug" # Start with prompt
23
+ # ENVIRONMENT=development codevibe-claude login # Login to development
24
+ #
25
+
26
+ set -e
27
+
28
+ # Default to production environment if not specified
29
+ # Users can set ENVIRONMENT=development for local development
30
+ export ENVIRONMENT="${ENVIRONMENT:-production}"
31
+
32
+ # Use TMPDIR if set (macOS sets this to user-specific temp), otherwise /tmp
33
+ CODEVIBE_TMPDIR="${TMPDIR:-/tmp}"
34
+
35
+ # Get the directory where this script is located (resolving symlinks)
36
+ # This is needed because npm global installs symlink bin scripts to /usr/local/bin/
37
+ SOURCE="${BASH_SOURCE[0]}"
38
+ while [ -L "$SOURCE" ]; do
39
+ DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
40
+ SOURCE="$(readlink "$SOURCE")"
41
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
42
+ done
43
+ SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
44
+ PLUGIN_DIR="$(dirname "$SCRIPT_DIR")"
45
+
46
+ # Handle auth commands (login, logout, status, reset-device)
47
+ # Delegate to codevibe-core CLI
48
+ case "$1" in
49
+ login|logout|status|reset-device)
50
+ # Use codevibe-core CLI
51
+ CORE_CLI="$PLUGIN_DIR/node_modules/@quantiya/codevibe-core/bin/codevibe.js"
52
+ if [ -f "$CORE_CLI" ]; then
53
+ exec node "$CORE_CLI" "$1"
54
+ else
55
+ echo "Error: codevibe-core not found. Run 'npm install' in the plugin directory first."
56
+ exit 1
57
+ fi
58
+ ;;
59
+ esac
60
+
61
+ # Configuration
62
+ TMUX_SESSION_PREFIX="codevibe-claude"
63
+ LOG_FILE="${CODEVIBE_TMPDIR}/codevibe-claude-wrapper.log"
64
+
65
+ log() {
66
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" >> "$LOG_FILE"
67
+ }
68
+
69
+ # Check if tmux is installed
70
+ if ! command -v tmux &> /dev/null; then
71
+ echo "Error: tmux is required but not installed."
72
+ echo "Install with: brew install tmux"
73
+ exit 1
74
+ fi
75
+
76
+ # Generate a unique session name
77
+ SESSION_NAME="${TMUX_SESSION_PREFIX}-$$"
78
+
79
+ log "Starting codevibe-claude with session: $SESSION_NAME"
80
+ log "Arguments: $*"
81
+
82
+ # Check if we're already inside tmux
83
+ if [ -n "$TMUX" ]; then
84
+ log "Already inside tmux, running claude directly"
85
+ # Already in tmux, just run claude
86
+ exec claude "$@"
87
+ fi
88
+
89
+ # Check if running in a terminal
90
+ if [ ! -t 0 ] || [ ! -t 1 ]; then
91
+ log "Not running in a terminal, running claude directly"
92
+ exec claude "$@"
93
+ fi
94
+
95
+ # Create tmux session and run claude
96
+ # -d: detached initially so we can set up
97
+ # Then attach to it
98
+ log "Creating tmux session: $SESSION_NAME"
99
+
100
+ # Build the claude command with proper escaping
101
+ CLAUDE_CMD="claude"
102
+ for arg in "$@"; do
103
+ # Escape single quotes in arguments
104
+ escaped_arg=$(printf '%s' "$arg" | sed "s/'/'\\\\''/g")
105
+ CLAUDE_CMD="$CLAUDE_CMD '$escaped_arg'"
106
+ done
107
+
108
+ # Create the session running claude, then attach
109
+ # We use a wrapper that:
110
+ # 1. Exports the session name so hooks can find it
111
+ # 2. Runs claude
112
+ # 3. Exits the tmux session when claude exits
113
+
114
+ tmux new-session -d -s "$SESSION_NAME" -x "$(tput cols)" -y "$(tput lines)" \
115
+ "export CODEVIBE_TMUX_SESSION='$SESSION_NAME'; export ENVIRONMENT='$ENVIRONMENT'; $CLAUDE_CMD; exit"
116
+
117
+ # Enable mouse support for scrolling
118
+ tmux set-option -t "$SESSION_NAME" -g mouse on
119
+
120
+ # Enable copy/paste with system clipboard (macOS)
121
+ tmux set-option -t "$SESSION_NAME" set-clipboard on
122
+ tmux set-window-option -t "$SESSION_NAME" mode-keys vi
123
+ tmux bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
124
+ tmux bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
125
+
126
+ # Store session mapping for the MCP server to find
127
+ # The session-start hook will update this with the actual Claude session ID
128
+ echo "$SESSION_NAME" > "${CODEVIBE_TMPDIR}/codevibe-claude-tmux-session-$$"
129
+
130
+ log "Attaching to tmux session: $SESSION_NAME"
131
+
132
+ # Attach to the session
133
+ # This will show claude's UI to the user
134
+ exec tmux attach-session -t "$SESSION_NAME"
@@ -0,0 +1,67 @@
1
+ import { CreateEventInput, CreateSessionInput, UpdateSessionInput, UpdateEventStatusInput, CreateFileChangeInput, Event, Session, EventSource, DownloadUrlResponse } from './types';
2
+ export declare class AppSyncClient {
3
+ private authenticated;
4
+ private currentUserId;
5
+ private currentEmail;
6
+ private storedTokens;
7
+ private activeSubscriptions;
8
+ constructor();
9
+ getCurrentUserId(): string;
10
+ getCurrentUserEmail(): string | null;
11
+ /**
12
+ * Authenticate using stored OAuth tokens from 'codevibe-claude login'
13
+ * Returns true if successfully authenticated, false otherwise
14
+ */
15
+ authenticateWithStoredTokens(): Promise<boolean>;
16
+ /**
17
+ * Refresh expired tokens using the refresh token
18
+ */
19
+ private refreshStoredTokens;
20
+ /**
21
+ * Check if stored tokens exist and are valid
22
+ */
23
+ hasValidStoredTokens(): boolean;
24
+ signOutUser(): void;
25
+ /**
26
+ * Make a direct GraphQL request to AppSync using fetch
27
+ * Uses stored OAuth tokens for Cognito User Pool authentication
28
+ * Automatically refreshes token and retries on 401 errors
29
+ */
30
+ private graphqlRequest;
31
+ createSession(input: CreateSessionInput): Promise<Session>;
32
+ updateSession(input: UpdateSessionInput): Promise<Session>;
33
+ createEvent(input: CreateEventInput): Promise<Event>;
34
+ updateEventStatus(input: UpdateEventStatusInput): Promise<Event>;
35
+ createFileChange(input: CreateFileChangeInput): Promise<any>;
36
+ getSession(sessionId: string): Promise<Session | null>;
37
+ listEvents(sessionId: string, source?: EventSource): Promise<Event[]>;
38
+ subscribeToEvents(sessionId: string, onEvent: (event: Event) => void, onError?: (error: Error) => void): () => void;
39
+ /**
40
+ * Build the AppSync real-time WebSocket URL with authorization
41
+ */
42
+ private buildRealtimeUrl;
43
+ /**
44
+ * Create a custom WebSocket subscription to AppSync
45
+ * This bypasses Amplify which doesn't work with externally stored tokens
46
+ */
47
+ private createSubscription;
48
+ /**
49
+ * Send subscription start message
50
+ */
51
+ private sendSubscriptionStart;
52
+ /**
53
+ * Reset the keep-alive timer - if no message received in 5 minutes, reconnect
54
+ */
55
+ private resetKeepAliveTimer;
56
+ private handleSubscriptionError;
57
+ private cleanupSubscriptionState;
58
+ cleanupSubscriptions(): void;
59
+ getAttachmentDownloadUrl(s3Key: string): Promise<DownloadUrlResponse>;
60
+ listUserDeviceKeys(): Promise<Array<{
61
+ deviceId: string;
62
+ publicKey: string;
63
+ }>>;
64
+ registerDeviceKey(deviceId: string, publicKey: string, platform: string, deviceName: string): Promise<void>;
65
+ isAuthenticated(): boolean;
66
+ }
67
+ //# sourceMappingURL=appsync-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appsync-client.d.ts","sourceRoot":"","sources":["../src/appsync-client.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,EACL,OAAO,EACP,WAAW,EAEX,mBAAmB,EACpB,MAAM,SAAS,CAAC;AA2MjB,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,mBAAmB,CAA6C;;IAOjE,gBAAgB,IAAI,MAAM;IAK1B,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAI3C;;;OAGG;IACU,4BAA4B,IAAI,OAAO,CAAC,OAAO,CAAC;IA2C7D;;OAEG;YACW,mBAAmB;IAoDjC;;OAEG;IACI,oBAAoB,IAAI,OAAO;IAM/B,WAAW,IAAI,IAAI;IAQ1B;;;;OAIG;YACW,cAAc;IAqDf,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAsB1D,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAsB1D,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC;IA8BpD,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,KAAK,CAAC;IAuBhE,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC;IA6B5D,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IActD,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAc3E,iBAAiB,CACtB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAC/B,MAAM,IAAI;IAoCb;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAuI1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA8B7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,uBAAuB;IAoE/B,OAAO,CAAC,wBAAwB;IAgCzB,oBAAoB,IAAI,IAAI;IActB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmBrE,kBAAkB,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAqB7E,iBAAiB,CAC5B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;IAqBT,eAAe,IAAI,OAAO;CAGlC"}