@naarang/ccc 1.2.0-beta.9 → 2.0.0-alpha.1

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 (42) hide show
  1. package/README.md +136 -569
  2. package/bin/ccc.cjs +76 -0
  3. package/dist/index.js +2640 -1
  4. package/dist/ngrok.win32-x64-msvc-zjj4rz8c.node +0 -0
  5. package/dist/scripts/postinstall.cjs +84 -0
  6. package/package.json +32 -25
  7. package/scripts/postinstall.cjs +84 -0
  8. package/LICENSE +0 -44
  9. package/bin/ccc.js +0 -45
  10. package/dist/claude/manager.js +0 -1
  11. package/dist/claude/project-setup.js +0 -1
  12. package/dist/claude/session-manager.js +0 -1
  13. package/dist/claude/session-message-parser.js +0 -1
  14. package/dist/claude/session.js +0 -1
  15. package/dist/claude/stream-parser.js +0 -1
  16. package/dist/firebase/admin.js +0 -1
  17. package/dist/hooks/notification_hook.js +0 -306
  18. package/dist/hooks/package-lock.json +0 -550
  19. package/dist/hooks/package.json +0 -16
  20. package/dist/hooks/permissions_hook.js +0 -657
  21. package/dist/mdns/service.js +0 -1
  22. package/dist/mqtt/client.js +0 -1
  23. package/dist/mqtt-broker.js +0 -1
  24. package/dist/ngrok/manager.js +0 -1
  25. package/dist/notifications/handlers.js +0 -1
  26. package/dist/notifications/index.js +0 -1
  27. package/dist/notifications/manager.js +0 -1
  28. package/dist/notifications/preferences-manager.js +0 -1
  29. package/dist/notifications/preferences-storage.js +0 -1
  30. package/dist/notifications/sender.js +0 -1
  31. package/dist/notifications/storage.js +0 -1
  32. package/dist/notifications/types.js +0 -1
  33. package/dist/proxy/router.js +0 -1
  34. package/dist/public/terminal.html +0 -250
  35. package/dist/qr/generator.js +0 -1
  36. package/dist/terminal/server.js +0 -1
  37. package/dist/types/index.js +0 -1
  38. package/dist/utils/auto-update.js +0 -1
  39. package/dist/utils/logger.js +0 -1
  40. package/dist/utils/version.js +0 -1
  41. package/scripts/check-pty.js +0 -142
  42. package/scripts/obfuscate.js +0 -77
package/README.md CHANGED
@@ -1,569 +1,136 @@
1
- # CCC - UI Interface for Coding Agents like Claude Code
2
-
3
- **Control Claude Code and other coding agents from your mobile device**
4
-
5
- CCC is a powerful CLI tool that creates a bridge between [Claude Code](https://claude.com/claude-code) and your mobile device, allowing you to chat with Claude and execute code operations remotely through a mobile app.
6
-
7
- [![npm version](https://img.shields.io/npm/v/@naarang/ccc.svg?style=flat-square)](https://www.npmjs.com/package/@naarang/ccc)
8
- [![Node Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen?style=flat-square)](https://nodejs.org)
9
-
10
- ![CCC Terminal Screenshot](https://firebasestorage.googleapis.com/v0/b/cc-chat-ui.firebasestorage.app/o/carbon%20(1).png?alt=media&token=1541cc51-0a24-4055-b73f-81e181217f53)
11
-
12
- <p align="center">
13
- <img src="https://firebasestorage.googleapis.com/v0/b/cc-chat-ui.firebasestorage.app/o/Projects.jpg?alt=media&token=098ed213-ed4a-4e22-9447-4cd097e9f485" width="150" />
14
- <img src="https://firebasestorage.googleapis.com/v0/b/cc-chat-ui.firebasestorage.app/o/context.jpg?alt=media&token=4acc826e-544d-44d4-bfee-3dc716023600" width="150" />
15
- <img src="https://firebasestorage.googleapis.com/v0/b/cc-chat-ui.firebasestorage.app/o/permissions.jpg?alt=media&token=1af2c554-e2be-49e6-bb80-620d7e3f4ecd" width="150" />
16
- <img src="https://firebasestorage.googleapis.com/v0/b/cc-chat-ui.firebasestorage.app/o/thinking.jpg?alt=media&token=04e4dff7-78a7-4e6c-ac08-bc3371889b07" width="150" />
17
- </p>
18
-
19
- <p align="center">
20
- <a href="https://play.google.com/store/apps/details?id=com.naarang.ccc">
21
- <img src="https://firebasestorage.googleapis.com/v0/b/cc-chat-ui.firebasestorage.app/o/GetItOnGooglePlay_Badge_Web_color_English.png?alt=media&token=d2f34558-ce96-4882-9225-8ded76f759ba" alt="Get it on Google Play" height="80">
22
- </a>
23
- <br/>
24
- <a href="https://play.google.com/apps/testing/com.naarang.ccc">
25
- <sub>Join Android Beta Testing</sub>
26
- </a>
27
- </p>
28
-
29
- <p align="center">
30
- <a href="https://apps.apple.com/in/app/ccc-ui-for-coding-agents/id6753870766">
31
- <img src="https://developer.apple.com/assets/elements/badges/download-on-the-app-store.svg" alt="Download on the App Store" height="80">
32
- </a>
33
- <br/>
34
- <a href="https://testflight.apple.com/join/bEVNMrNH">
35
- <sub>Join iOS Beta Testing (TestFlight)</sub>
36
- </a>
37
- </p>
38
-
39
- <p align="center">
40
- <a href="https://discord.gg/9EjE8t4YCF">
41
- <img src="https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord">
42
- </a>
43
- </p>
44
-
45
- <p align="center">
46
- <a href="https://getc3.app/support">
47
- <img src="https://img.shields.io/badge/Support-CCC-blue?style=for-the-badge" alt="Support CCC">
48
- </a>
49
- </p>
50
-
51
- <p align="center">
52
- <a href="https://getc3.app">
53
- <img src="https://img.shields.io/badge/Website-getc3.app-green?style=for-the-badge" alt="Visit Website">
54
- </a>
55
- </p>
56
-
57
- ## ✨ Features
58
-
59
- - **Mobile Control** - Chat with Claude from your phone or tablet
60
- - **Real-time Sync** - See Claude's responses instantly on your device
61
- - **Smart Permission System** - Fine-grained control over code modifications
62
- - **Web Terminal Access** 🆕 (Beta) - Full terminal access with auto-generated secure credentials
63
- - **Request Cancellation** 🆕 - Abort ongoing Claude requests from mobile app
64
- - **Dynamic Project Switching** 🆕 - Terminal automatically changes directory when switching projects
65
- - **Remote Access** - Optional ngrok integration for access from anywhere
66
- - **Secure MQTT** - Built-in MQTT broker with authentication support (required for ngrok)
67
- - **Session Management** - Persistent sessions across reconnections
68
- - **Context Awareness** - Full project context and file system access
69
- - **Auto Hook Setup** - Automatic project configuration for permission handling
70
- - **Auto-Update System** 🆕 - Automatic version checks and updates (can be disabled)
71
-
72
- ## Installation
73
-
74
- ### Global Installation (Recommended)
75
-
76
- ```bash
77
- npm install -g @naarang/ccc
78
- ```
79
-
80
- ### Local Installation
81
-
82
- ```bash
83
- npm install @naarang/ccc
84
- npx ccc
85
- ```
86
-
87
- ### Windows Installation
88
-
89
- CCC requires native modules (node-pty) for terminal functionality. On Windows, you need to install build tools first:
90
-
91
- **Option 1: Windows Build Tools (Recommended)**
92
- ```bash
93
- npm install -g windows-build-tools
94
- npm install -g @naarang/ccc
95
- ```
96
-
97
- **Option 2: Visual Studio Build Tools**
98
- 1. Download [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/)
99
- 2. Install with "Desktop development with C++" workload
100
- 3. Run: `npm install -g @naarang/ccc`
101
-
102
- **If you encounter terminal errors after installation:**
103
- ```bash
104
- # Navigate to the CCC installation directory
105
- cd %APPDATA%\npm\node_modules\@naarang\ccc
106
-
107
- # Rebuild node-pty
108
- npm rebuild node-pty
109
- ```
110
-
111
- The postinstall script will automatically check if node-pty is working and provide guidance if there are issues.
112
-
113
- ## Quick Start
114
-
115
- ### 1. Start the Backend Server
116
-
117
- Simply run:
118
-
119
- ```bash
120
- ccc
121
- ```
122
-
123
- The server will start and display:
124
- ```
125
- Terminal server started on localhost:3001
126
- ✓ Path router started on port 8883
127
- Claude Chat Backend v1.1.x started successfully
128
-
129
- Server URLs (Add one of these in the app settings):
130
- Localhost: localhost:8883
131
- Network: 192.168.1.135:8883
132
-
133
- Services:
134
- MQTT: Port 8884 (via /mqtt)
135
- Terminal: Port 3001 (via /terminal) - Auto-secured
136
-
137
- MQTT Auth: Enabled
138
- ```
139
-
140
- ### 2. Configure the Mobile App
141
-
142
- Download the CCC mobile app and add the server connection:
143
-
144
- **For Local Network:**
145
- ```
146
- Server URL: 192.168.x.xxx:8883
147
- ```
148
-
149
- **For Remote Access:**
150
- ```bash
151
- ccc --ngrok-token YOUR_TOKEN
152
- ```
153
- Use the provided ngrok URL in the app.
154
-
155
- ### 3. Start Chatting
156
-
157
- Open the app, create a project pointing to your local directory, and start chatting with Claude!
158
-
159
- ## ⚙️ Configuration
160
-
161
- ### Command Line Options
162
-
163
- ```bash
164
- ccc [options]
165
-
166
- Options:
167
- --debug Enable debug logging
168
- -u, --username <user> MQTT broker username (required for ngrok)
169
- -p, --password <pass> MQTT broker password (required for ngrok)
170
- --mqtt-port <port> Internal MQTT broker port (default: 8884)
171
- --port <port> [DEPRECATED] Use --mqtt-port instead
172
- --router-port <port> Internal Request Router port. This is what the app connects to (default: 8883)
173
- --terminal-port <port> Internal terminal server port (default: 3001)
174
- -t, --ngrok-token <token> ngrok auth token (enables public tunnel, requires MQTT auth)
175
- --ngrok-domain <domain> ngrok static domain
176
- --no-auto-update Disable automatic updates (enabled by default)
177
- -v, --version Show version number
178
- -h, --help Show help message
179
-
180
- Note: Terminal credentials are automatically generated and cannot be configured manually.
181
- ```
182
-
183
- > **Auto-Update**: By default, CCC checks for updates on startup and automatically downloads the latest version. After a successful update, you'll be prompted to manually restart the server. Use `--no-auto-update` to disable this behavior.
184
-
185
- ### Examples
186
-
187
- **Basic usage:**
188
- ```bash
189
- ccc
190
- ```
191
-
192
- **With authentication:**
193
- ```bash
194
- ccc -u admin -p secret
195
- ```
196
-
197
- **With terminal access (Beta):**
198
- ```bash
199
- # Terminal credentials are automatically generated
200
- # No configuration needed - just start the server
201
- ccc
202
-
203
- # Terminal credentials are broadcast to authorized clients via MQTT
204
- # App receives credentials automatically on connection
205
- ```
206
-
207
- **With ngrok for remote access:**
208
- ```bash
209
- ccc --ngrok-token YOUR_NGROK_TOKEN
210
- ```
211
-
212
- **Full example with ngrok and authentication:**
213
- ```bash
214
- # Terminal credentials auto-generated
215
- # MQTT authentication required for ngrok
216
- ccc --ngrok-token YOUR_TOKEN \
217
- -u admin \
218
- -p secret
219
- ```
220
-
221
- **Custom ports with debug logging:**
222
- ```bash
223
- ccc --mqtt-port 9000 --terminal-port 3002 --debug
224
- ```
225
-
226
- ## 🖥️ Terminal Access (Beta)
227
-
228
- CCC now includes a built-in web terminal that can be accessed directly from the mobile app. This feature is currently in **beta** and provides full terminal access to your development environment.
229
-
230
- ### Security Model
231
-
232
- **Terminal credentials are automatically generated** for maximum security. The terminal server:
233
- - ✅ **Auto-generates strong credentials** on startup
234
- - ✅ **Always enabled** - no configuration needed
235
- - ✅ **Credentials shared securely** via MQTT to authorized clients only
236
- - ❌ **Not user-configurable** - prevents weak passwords
237
- - 🔄 **Auto-broadcast on connection** - clients receive credentials automatically
238
-
239
- **MQTT Authentication** is separate and optional:
240
- - ✅ **Optional for localhost** - no auth needed for local development
241
- - ⚠️ **Required for ngrok tunnels** - protects public endpoints (enforced at startup)
242
-
243
- ### How It Works
244
-
245
- 1. **Architecture:**
246
- - Internal terminal server runs on port 3001 (localhost only)
247
- - Proxied through the main router on `/terminal` path
248
- - Full terminal emulation with bash/powershell support
249
-
250
- 2. **Security Features:**
251
- - Basic authentication required for all connections
252
- - Rate limiting: max 5 failed auth attempts (15-minute IP block)
253
- - Session limit: maximum 5 concurrent terminals
254
- - Bound to localhost only (never exposed directly)
255
- - All connections must go through authenticated router
256
-
257
- 3. **Mobile Integration:**
258
- - Terminal embedded in mobile app
259
- - Auto-configures when credentials are provided
260
- - **Automatic authentication** - App automatically authenticates with terminal (no manual login needed)
261
- - **Dynamic path updates** - Terminal working directory changes automatically when switching projects via MQTT
262
- - Starts in your project directory by default
263
-
264
- ### Terminal Features
265
-
266
- - ✅ Full terminal emulation
267
- - ✅ Color support and ANSI escape sequences
268
- - ✅ Responsive design (works on mobile)
269
- - ✅ Multiple concurrent sessions (max 5)
270
- - ✅ Automatic resize on orientation change
271
- - ✅ Custom theme matching app design
272
- - ✅ Scrollback history
273
- - ✅ Auto-generated secure credentials (no manual configuration)
274
- - ✅ Project-aware (changes directory when you switch projects)
275
-
276
- ### Usage from Mobile App
277
-
278
- Once enabled on the backend:
279
- 1. Open CCC mobile app
280
- 2. Navigate to the project
281
- 3. Terminal icon will appear in the toolbar automatically
282
- 4. Tap to open full-screen terminal
283
- 5. Terminal opens directly in your project directory
284
- 6. Use on-screen keyboard or external keyboard
285
-
286
- ### Security Best Practices
287
-
288
- ⚠️ **Important Security Notes:**
289
-
290
- 1. **Terminal Credentials are Auto-Generated:** No weak passwords possible
291
- - System generates 32-char username + 480-char password on startup
292
- - Credentials automatically broadcast to authorized clients via MQTT
293
- - Cannot be manually configured (prevents security mistakes)
294
-
295
- 2. **Use MQTT Authentication for ngrok:** Required for remote access
296
- ```bash
297
- ccc --ngrok-token YOUR_TOKEN \
298
- -u admin \
299
- -p $(openssl rand -base64 32)
300
- ```
301
-
302
- 3. **Monitor Active Sessions:** Check logs for suspicious activity
303
- ```bash
304
- ccc --debug # Enable detailed logging
305
- ```
306
-
307
- 4. **Restrict Network Access:** Only use on trusted networks or via ngrok
308
- - Terminal bound to localhost only
309
- - All access must go through authenticated router
310
-
311
- ### Troubleshooting Terminal
312
-
313
- **Terminal won't connect:**
314
- - Check logs with `--debug` flag to see credential generation
315
- - Ensure port 3001 is not in use
316
- - Verify MQTT connection is established (terminal credentials sent via MQTT)
317
- - Check that app received terminal configuration (should happen automatically)
318
-
319
- **Windows: "Cannot find module '../build/Release/conpty.node'" error:**
320
-
321
- This means node-pty native modules weren't built properly. Fix it with:
322
-
323
- ```bash
324
- # Option 1: Rebuild node-pty in place
325
- cd %APPDATA%\npm\node_modules\@naarang\ccc
326
- npm rebuild node-pty
327
-
328
- # Option 2: Reinstall CCC completely
329
- npm uninstall -g @naarang/ccc
330
- npm install -g windows-build-tools
331
- npm install -g @naarang/ccc
332
-
333
- # Option 3: If you have Visual Studio Build Tools installed
334
- npm uninstall -g @naarang/ccc
335
- npm install -g @naarang/ccc --build-from-source
336
- ```
337
-
338
- If you still have issues, ensure you have:
339
- - Windows Build Tools: `npm install -g windows-build-tools`
340
- - Or Visual Studio with "Desktop development with C++" workload
341
-
342
- **Authentication failures:**
343
- - Check for IP blocking (max 5 failed attempts)
344
- - Wait 15 minutes if blocked
345
- - Restart server to clear blocks and regenerate credentials
346
-
347
- **Terminal not showing in app:**
348
- - Ensure server is running (credentials auto-generated on startup)
349
- - Verify MQTT connection is active
350
- - Check that app received system config via MQTT
351
- - Restart the mobile app to force credential refresh
352
-
353
- ## Permission Modes
354
-
355
- CCC offers four permission modes to balance convenience and security:
356
-
357
- ### 1. Default Mode (Recommended)
358
- - Prompts for approval on first use of each tool/command
359
- - Click "Yes, don't ask again" to add to allowed list
360
- - Granular control over specific commands
361
- - **Use case:** Balanced security and productivity
362
-
363
- ### 2. Accept Edits Mode
364
- - Automatically approves file modifications (Edit, Write, NotebookEdit)
365
- - Still prompts for other operations (Read, Bash, WebFetch)
366
- - **Use case:** Active development sessions
367
-
368
- ### 3. Plan Mode
369
- - Analysis only, no code changes without approval
370
- - Perfect for code review and exploration
371
- - **Use case:** Reviewing unfamiliar code
372
-
373
- ### 4. Bypass All ⚠️
374
- - Skips all permission prompts
375
- - **Use with extreme caution!**
376
- - **Use case:** Controlled environments only
377
-
378
- ### Project Structure
379
-
380
- CCC creates the following in your project:
381
-
382
- ```
383
- your-project/
384
- ├── .claude/
385
- │ ├── hooks/
386
- │ │ ├── permissions_hook.js # Permission handling
387
- │ │ ├── package.json # Hook dependencies
388
- │ │ └── .env # MQTT configuration
389
- │ ├── settings.local.json # Hook registration & allowed tools
390
- │ ├── sessions.json # Session mappings
391
- │ └── session-config.json # Permission modes & backend version
392
- └── [your project files]
393
- ```
394
-
395
- ## Mobile App
396
-
397
- The CCC mobile app is required to interact with the backend.
398
-
399
- <p align="center">
400
- <a href="https://play.google.com/store/apps/details?id=com.naarang.ccc">
401
- <img src="https://firebasestorage.googleapis.com/v0/b/cc-chat-ui.firebasestorage.app/o/GetItOnGooglePlay_Badge_Web_color_English.png?alt=media&token=d2f34558-ce96-4882-9225-8ded76f759ba" alt="Get it on Google Play" height="80">
402
- </a>
403
- <br/>
404
- <a href="https://play.google.com/apps/testing/com.naarang.ccc">
405
- <sub>Join Android Beta Testing</sub>
406
- </a>
407
- </p>
408
-
409
- <p align="center">
410
- <a href="https://apps.apple.com/in/app/ccc-ui-for-coding-agents/id6753870766">
411
- <img src="https://developer.apple.com/assets/elements/badges/download-on-the-app-store.svg" alt="Download on the App Store" height="80">
412
- </a>
413
- <br/>
414
- <a href="https://testflight.apple.com/join/bEVNMrNH">
415
- <sub>Join iOS Beta Testing (TestFlight)</sub>
416
- </a>
417
- </p>
418
-
419
- ### Features
420
- - Multiple project management
421
- - Real-time chat interface
422
- - Permission request handling
423
- - Integrated web terminal (Beta) - auto-configured with secure credentials
424
- - Request cancellation - abort ongoing Claude operations
425
- - Dynamic project switching - terminal follows your active project
426
- - Image attachments support (PNG, JPEG, GIF, WebP - max 5MB each)
427
- - Server profile management
428
- - Connection health monitoring
429
- - Theme support (light/dark)
430
-
431
- ### Connection Setup
432
-
433
- 1. Open the mobile app
434
- 2. Go to Settings → Add Server Profile
435
- 3. Enter server URL
436
- 4. Add credentials if authentication is enabled
437
- 5. Create a project pointing to your code directory
438
-
439
- ## Troubleshooting
440
-
441
- ### Server Won't Start
442
-
443
- **Error: `EADDRINUSE: address already in use`**
444
-
445
- Another process is using the default ports. Find and kill the process, or use different ports:
446
- ```bash
447
- # Find the process using router port (8883)
448
- lsof -i :8883
449
-
450
- # Or MQTT port (8884)
451
- lsof -i :8884
452
-
453
- # Kill it
454
- kill -9 <PID>
455
-
456
- # Or use different ports
457
- ccc --router-port 9000 --mqtt-port 9001
458
- ```
459
-
460
- ### Connection Issues
461
-
462
- **Mobile app can't connect:**
463
-
464
- **Checklist:**
465
- 1. Check you're on the same WiFi network (for local)
466
- 2. Verify server is running (`ccc` should show "started successfully")
467
- 3. Check firewall settings allow port 8883 (router port that app connects to)
468
- 4. Use correct format: `hostname:8883` (no `http://`)
469
- 5. Enable debug mode: `ccc --debug`
470
-
471
- ### Permission Hook Errors
472
-
473
- **Hooks not working:**
474
-
475
- 1. Delete `.claude/` folder and restart server
476
- 2. Check permissions on project directory
477
- 3. Verify Node.js version >=18
478
- 4. Check logs with `--debug` flag
479
-
480
- ### Claude Not Responding
481
-
482
- **Common issues:**
483
-
484
- 1. **Claude not installed:** Run `claude --version`
485
- 2. **Not authenticated:** Run `claude auth status`
486
- 3. **Invalid project path:** Check path exists and is accessible
487
- 4. **API limits:** Check your Claude subscription status
488
-
489
- ## Security Best Practices
490
-
491
- 1. **Use Authentication**
492
- ```bash
493
- ccc -u admin -p $(openssl rand -base64 32)
494
- ```
495
-
496
- 2. **Limit Network Exposure**
497
- - Use ngrok for remote access instead of port forwarding
498
- - Enable firewall rules
499
-
500
- 3. **Review Allowed Tools**
501
- - Check `.claude/settings.local.json` regularly
502
- - Remove unused permissions
503
-
504
- 4. **Use Plan Mode**
505
- - When reviewing unfamiliar code
506
- - For read-only sessions
507
-
508
- 5. **Keep Updated**
509
- ```bash
510
- npm update -g @naarang/ccc
511
- ```
512
-
513
- ## System Requirements
514
-
515
- - **Node.js**: v20.0.0 or higher
516
- - **Claude Code**: Latest version
517
- - **Claude Subscription**: Active Pro or Max account
518
- - **Operating Systems**:
519
- - ✅ Linux (Ubuntu, Debian, Fedora)
520
- - ✅ macOS (10.15+)
521
- - ✅ Windows (via WSL2 recommended)
522
- - **Network**: WiFi or ethernet for mobile connection
523
-
524
- ## Use Cases
525
-
526
- ### Remote Development
527
- Work on code from your couch, bed, or anywhere with your mobile device.
528
-
529
- ### Code Review
530
- Review and discuss code changes with Claude on the go.
531
-
532
- ### Quick Fixes
533
- Make quick code changes without opening your laptop.
534
-
535
- ### Learning
536
- Learn coding concepts by chatting with Claude from mobile.
537
-
538
- ### Pair Programming
539
- Collaborate with Claude on coding tasks remotely.
540
-
541
-
542
- ## Performance
543
-
544
- - **Startup Time**: ~2 seconds
545
- - **Response Latency**: <100ms (local network)
546
- - **Concurrent Sessions**: Unlimited
547
- - **Memory Usage**: ~150MB (varies with active sessions)
548
-
549
- ## Support the Project
550
-
551
- If you find this project useful, consider supporting its development:
552
-
553
- [![Support](https://img.shields.io/badge/Support-CCC-blue?style=for-the-badge)](https://getc3.app/support)
554
-
555
- Visit [getc3.app/support](https://getc3.app/support) for donation options.
556
-
557
- ## Support & Community
558
-
559
- - **Discord**: Join our community at https://discord.gg/9EjE8t4YCF
560
- - **Issues**: Report bugs and request features
561
- - **Discussions**: Ask questions and share ideas
562
- - **Updates**: Check npm for latest version
563
- - **Contact**: Email us at cccuiapp@gmail.com
564
-
565
- **Made with ❤️ by naarang**
566
-
567
- > **Note**: This tool requires an active Claude subscription and Claude Code to function properly.
568
-
569
- **Get Started:** `npm install -g @naarang/ccc && ccc`
1
+ # CCC Backend v2 - Code Chat Connect
2
+
3
+ A clean, modular backend for Code Chat Connect using Bun's native capabilities and modern service-oriented architecture.
4
+
5
+ ## Requirements
6
+
7
+ **Bun runtime is required.** This package will not work with Node.js.
8
+
9
+ Install Bun:
10
+ ```bash
11
+ # Windows (PowerShell)
12
+ powershell -c "irm bun.sh/install.ps1|iex"
13
+
14
+ # macOS / Linux
15
+ curl -fsSL https://bun.sh/install | bash
16
+ ```
17
+
18
+ Learn more: https://bun.sh
19
+
20
+ ## Installation
21
+
22
+ ### Global Install (Recommended)
23
+
24
+ ```bash
25
+ npm install -g @naarang/ccc
26
+ ```
27
+
28
+ Then run:
29
+ ```bash
30
+ ccc
31
+ ```
32
+
33
+ ### Local Development
34
+
35
+ ```bash
36
+ bun install
37
+ bun src/index.ts
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ```bash
43
+ # Start with default settings
44
+ ccc
45
+
46
+ # Enable debug logging
47
+ ccc --debug
48
+
49
+ # With custom ports
50
+ ccc --mqtt-port 8884 --router-port 8883 --terminal-port 3001
51
+
52
+ # With MQTT authentication (required for ngrok)
53
+ ccc --username myuser --password mypass
54
+
55
+ # With ngrok tunnel for remote access
56
+ ccc --username myuser --password mypass --ngrok-token YOUR_TOKEN
57
+ ```
58
+
59
+ ## CLI Options
60
+
61
+ ```
62
+ -d, --debug Enable debug logging
63
+ --mqtt-port <port> MQTT broker port (default: 8884)
64
+ --terminal-port <port> Terminal server port (default: 3001)
65
+ --router-port <port> Router port (default: 8883)
66
+ --username <username> MQTT broker username (optional)
67
+ --password <password> MQTT broker password (optional)
68
+ --ngrok-token <token> ngrok auth token for remote access
69
+ --ngrok-domain <domain> ngrok static domain (paid plan)
70
+ --no-auto-update Disable automatic updates
71
+ -h, --help Show help message
72
+ ```
73
+
74
+ ## Services
75
+
76
+ The backend provides these core services:
77
+
78
+ 1. **MQTT Broker** - Real-time communication with mobile apps (port 8884)
79
+ 2. **Terminal Server** - Secure PTY-based terminal access (port 3001)
80
+ 3. **Router** - Path-based reverse proxy for unified access (port 8883)
81
+ 4. **Claude Agent** - Manages Claude Code CLI sessions
82
+ 5. **File Browser** - Remote file system access
83
+ 6. **Git Service** - Git operations and GitHub integration
84
+ 7. **Notifications** - Push notifications via Expo
85
+
86
+ ## Security
87
+
88
+ - Terminal credentials are auto-generated and never logged
89
+ - MQTT authentication is optional but required for ngrok tunnels
90
+ - MQTT/Terminal services bind to localhost only
91
+ - Router is the only public-facing service
92
+
93
+ ## Architecture
94
+
95
+ ```
96
+ src/
97
+ ├── index.ts # Main entry point
98
+ ├── cli/ # CLI argument parsing
99
+ ├── services/ # Service implementations
100
+ │ ├── mqtt-broker/ # MQTT broker
101
+ │ ├── terminal-server/ # Terminal server
102
+ │ ├── router/ # HTTP/WS proxy
103
+ │ ├── claude-agent/ # Claude Code CLI management
104
+ │ ├── file-browser/ # File system access
105
+ │ ├── git-service/ # Git operations
106
+ │ ├── notification/ # Push notifications
107
+ │ └── ... # Other services
108
+ ├── core/ # Service orchestration
109
+ └── utils/ # Shared utilities
110
+ ```
111
+
112
+ ## Development
113
+
114
+ ```bash
115
+ # Run in development mode
116
+ bun src/index.ts --debug
117
+
118
+ # Type checking
119
+ bun run type-check
120
+
121
+ # Build for distribution
122
+ bun run build
123
+ ```
124
+
125
+ ## Why Bun?
126
+
127
+ This project uses Bun because:
128
+ - Native TypeScript support without transpilation
129
+ - Faster startup and runtime performance
130
+ - Built-in WebSocket server (`Bun.serve()`)
131
+ - `bun-pty` for reliable PTY handling (node-pty has compatibility issues)
132
+ - Simpler dependency management
133
+
134
+ ## License
135
+
136
+ UNLICENSED - Private package