ghcc-client 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.
package/README.md ADDED
@@ -0,0 +1,258 @@
1
+ # GhCC-Client
2
+
3
+ A Node.js CLI utility tool that allows its users to remotely interact with a GitHub Copilot CLI session from their mobiles, tablets and any other devices that support web-browsers.
4
+
5
+ ## Features
6
+
7
+ - **Persistent Copilot sessions** — Runs Copilot CLI inside tmux so your session survives disconnects, terminal closures, and even host reboots
8
+ - **Browser-based terminal** — Uses ttyd to expose the tmux session as a web interface compatible with mobile and desktop browsers
9
+ - **Native keyboard toolbar UI** — Custom mobile keyboard toolbar components inspired by Termux app, providing quick access to common terminal shortcuts (Ctrl, Alt, Tab, arrow keys, etc.) for seamless mobile interactions
10
+ - **Portrait-based resizing** — Automatically adapts terminal layout for portrait and landscape orientations, optimizing readability on mobile devices
11
+ - **Public tunneling** — Optional localtunnel integration creates temporary public URLs with QR codes for quick mobile access
12
+
13
+ ## Requirements
14
+
15
+ Before using ghcc-client, ensure the following are installed and configured:
16
+
17
+ ### 1. Node.js 14.0 or newer
18
+
19
+ **Install from:** [https://nodejs.org/](https://nodejs.org/)
20
+
21
+ ### 2. tmux (Terminal Multiplexer)
22
+
23
+ **Official docs:** [https://github.com/tmux/tmux/wiki](https://github.com/tmux/tmux/wiki)
24
+
25
+ Required for persistent Copilot sessions that survive disconnects, terminal closures, and reboots.
26
+
27
+ - **Linux:** Available in default repos. Install with your package manager (apt, dnf, pacman, etc.)
28
+ - **macOS:** Pre-installed or available via Homebrew
29
+ - **Windows:** Requires WSL2 (see point 5)
30
+
31
+
32
+ ### 3. GitHub Copilot CLI
33
+
34
+ **Install from:** [https://github.com/github/copilot-cli](https://github.com/github/copilot-cli)
35
+
36
+ ```bash
37
+ npm install -g @github/copilot
38
+ ```
39
+
40
+ **Authentication (Recommended):**
41
+ While you *can* authenticate directly within your ghcc-client session, it's recommended to authenticate beforehand for better security and reliability:
42
+
43
+ ```bash
44
+ copilot login
45
+ ```
46
+
47
+ ### 4. ttyd (Web Terminal)
48
+
49
+ **Good news:** ttyd binaries are bundled with ghcc-client for your operating system, so no separate installation needed.
50
+
51
+ **Official docs:** [https://github.com/tsl0922/ttyd](https://github.com/tsl0922/ttyd)
52
+
53
+ ### 5. Windows Users: WSL2 Required
54
+
55
+ On Windows, tmux is not supported by default and is available via **WSL2 (Windows Subsystem for Linux 2)**.
56
+
57
+ **Quick setup:**
58
+
59
+ ```powershell
60
+ # PowerShell as Administrator
61
+ wsl --install
62
+ ```
63
+
64
+ Then install in WSL:
65
+ ```bash
66
+ sudo apt-get update
67
+ sudo apt-get install nodejs npm tmux
68
+ npm install -g ghcc-client
69
+ ```
70
+
71
+ **Official guide for WSL:** [https://learn.microsoft.com/en-us/windows/wsl/install](https://learn.microsoft.com/en-us/windows/wsl/install)
72
+
73
+ ## Installation
74
+
75
+ ### From npm (Recommended)
76
+
77
+ ```bash
78
+ npm install -g ghcc-client
79
+ ```
80
+
81
+ ### From source
82
+
83
+ ```bash
84
+ git clone https://github.com/tanay-787/ghcc-client.git
85
+ cd ghcc-client
86
+ npm install
87
+ npm run build
88
+ npm link # Optional: make CLI available globally for testing
89
+ ```
90
+
91
+ ## Getting Started
92
+
93
+ ### 1. Start a session
94
+
95
+ ```bash
96
+ # Start with auto-assigned port
97
+ ghcc-client
98
+
99
+ # Or specify a port
100
+ ghcc-client -p 7681
101
+ ```
102
+
103
+ ### 2. Access from browser
104
+
105
+ Open the Access URLs in any browser. The output will show:
106
+ - Local address: `http://localhost:7681` (or your chosen port)
107
+ - Public URL: if tunneling is enabled (scan the QR code for easier mobile access)
108
+
109
+ ### 3. Stop the session
110
+
111
+ Press `Ctrl+C` to stop, or use `/quit` command inside the Copilot CLI session.
112
+
113
+ ## CLI Reference
114
+
115
+ ```
116
+ ghcc-client [options]
117
+
118
+ Options:
119
+ -p, --port <port> Specify port for ttyd (default: auto-assign)
120
+ --help Display help and exit
121
+ --public Use localtunnel to generate public access URLs
122
+ ```
123
+
124
+ ## How It Works
125
+
126
+ ghcc-client orchestrates three core components:
127
+
128
+ | Component | Role |
129
+ |-----------|------|
130
+ | **tmux** | Terminal multiplexer that keeps the Copilot session alive and persistent |
131
+ | **ttyd** | WebSocket-based terminal server that exposes tmux to HTTP clients |
132
+ | **localtunnel** (optional) | Creates temporary public URLs for remote browser access with QR codes |
133
+
134
+ The workflow:
135
+ 1. ghcc-client spawns a tmux session and launches Copilot CLI within it
136
+ 2. ttyd binds to the specified port and serves the tmux session over HTTP/WebSocket
137
+ 3. Any browser can connect and interact with the terminal
138
+ 4. The session remains alive even if the browser disconnects or closes
139
+ 5. Optional public tunneling allows access from outside your local network
140
+
141
+
142
+ ## Security Considerations
143
+
144
+ **Public tunnels expose your terminal to the internet.** Review these practices:
145
+
146
+ - Treat all data visible in a publicly tunneled session as potentially visible to anyone with the URL
147
+ - Never expose secrets, API keys, or sensitive credentials in a public session
148
+ - Review firewall and network access control policies before enabling public tunnels
149
+ - Localtunnel URLs are temporary and expire when the session ends
150
+
151
+ For sensitive operations, always use a local connection (`http://localhost:PORT`) or a private network.
152
+
153
+ ## Troubleshooting
154
+
155
+ ### Common issues and solutions
156
+
157
+ | Issue | Solution |
158
+ |-------|----------|
159
+ | **"Copilot CLI not found"** | Install and authenticate: `npm install -g @github/copilot && copilot auth login` |
160
+ | **"tmux not found"** | Install tmux: `brew install tmux` (macOS) or `sudo apt-get install tmux` (Linux/WSL) |
161
+ | **"ttyd binary not found"** | Reinstall the package or manually place the correct ttyd binary in `binaries/` |
162
+ | **"Port already in use"** | Use a different port: `ghcc-client -p 8080` or stop the conflicting service |
163
+ | **Windows: Cannot connect** | Ensure you're running inside WSL2 and accessing via WSL IP or `localhost` from WSL |
164
+
165
+ ### Enable debug logging
166
+
167
+ If you encounter issues, check the terminal output for error messages. The client will report failures during startup.
168
+
169
+ ## Development
170
+
171
+ ### Local setup
172
+
173
+ ```bash
174
+ # Clone and install dependencies
175
+ git clone https://github.com/tanay-787/ghcc-client.git
176
+ cd ghcc-client
177
+ npm install
178
+
179
+ # Build the project
180
+ npm run build
181
+
182
+ # Link for local testing
183
+ npm link
184
+ ghcc-client
185
+
186
+ # Unlink when finished
187
+ npm unlink
188
+ ```
189
+
190
+ ### Project structure
191
+
192
+ ```
193
+ ghcc-client/
194
+ ├── src/ # TypeScript source code
195
+ ├── dist/ # Compiled JavaScript output
196
+ ├── assets/ # Static HTML/CSS for browser interface
197
+ ├── binaries/ # Platform-specific ttyd executables
198
+ ├── package.json # Dependencies and build scripts
199
+ ├── tsconfig.json # TypeScript configuration
200
+ └── README.md # This file
201
+ ```
202
+
203
+ ## Contributing
204
+
205
+ We welcome contributions! Please follow these steps:
206
+
207
+ 1. **Discuss larger changes** — Open an issue to discuss your idea before implementing
208
+ 2. **Create a feature branch** — `git checkout -b feature/your-feature-name`
209
+ 3. **Implement and test** — Write code, test thoroughly, and verify no regressions
210
+ 4. **Open a pull request** — Include a clear description of the problem and solution
211
+ 5. **Provide testing steps** — Help reviewers understand how to test your changes
212
+
213
+ ### Development setup
214
+
215
+ - Run `npm install` to install dependencies.
216
+ - Run `npm run build` to compile TypeScript sources.
217
+ - If you want to set up the binaries (as the postinstall step would), run `npm run postinstall` manually after building.
218
+ - Note: The postinstall script is only triggered automatically when installing from npm (not from source).
219
+
220
+ For bug reports, include:
221
+ - Steps to reproduce
222
+ - Expected vs. actual behavior
223
+ - Your environment (OS, Node.js version, Copilot CLI version)
224
+
225
+ ## License
226
+
227
+ This project is licensed under the **GNU General Public License v3.0** (GPL-3.0).
228
+
229
+ See the [LICENSE](./LICENSE) file for full details.
230
+
231
+ ```
232
+ Copyright (c) 2026 All rights reserved - Licensed under GPL-3.0
233
+ ```
234
+
235
+ ## Dependencies
236
+
237
+ This project relies on the following third-party components:
238
+
239
+ | Component | Purpose |
240
+ |-----------|---------|
241
+ | **ttyd** | Terminal-to-web server using WebSockets and HTTP |
242
+ | **tmux** | Session persistence and terminal multiplexing |
243
+ | **localtunnel** | Optional public URL and tunneling for remote access |
244
+ | **qrcode-terminal** | QR code generation for mobile access links |
245
+
246
+ ## Support & Feedback
247
+
248
+ - **GitHub Profile:** [tanay-787](https://github.com/tanay-787)
249
+ - **Bug reports & features:** [Issue tracker](https://github.com/tanay-787/ghcc-client/issues)
250
+ - **General discussion:** [Discussions](https://github.com/tanay-787/ghcc-client/discussions)
251
+ - **Security concerns:** See [SECURITY.md](./SECURITY.md)
252
+
253
+ Have questions or ideas? Open an issue—we're here to help!
254
+
255
+ ---
256
+
257
+ **Co-authored by:** Tanay Gupte & GitHub Copilot CLI
258
+ **Last updated:** 2026 | Built with TypeScript and Node.js
@@ -0,0 +1,123 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes, viewport-fit=cover">
6
+ <meta name="apple-mobile-web-app-capable" content="yes">
7
+ <meta name="mobile-web-app-capable" content="yes">
8
+ <title>GitHub Copilot - {{SESSION_NAME}}</title>
9
+
10
+ <!-- GitHub Copilot Favicon -->
11
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M7.5 0a7.5 7.5 0 0 0-2.372 14.617.75.75 0 0 1-.116.062c-.39.198-.62.652-.62 1.121v.25c0 .966.784 1.75 1.75 1.75h2.5a1.75 1.75 0 0 0 1.75-1.75v-.25c0-.469-.23-.923-.62-1.121a.75.75 0 0 1-.116-.062A7.5 7.5 0 0 0 7.5 0z'/%3E%3C/svg%3E">
12
+
13
+ <style>
14
+ * {
15
+ margin: 0;
16
+ padding: 0;
17
+ box-sizing: border-box;
18
+ }
19
+
20
+ html, body {
21
+ width: 100%;
22
+ height: 100%;
23
+ overflow: hidden;
24
+ background: #1e1e1e;
25
+ }
26
+
27
+ body {
28
+ font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
29
+ -webkit-font-smoothing: antialiased;
30
+ -moz-osx-font-smoothing: grayscale;
31
+ touch-action: manipulation;
32
+ }
33
+
34
+ #terminal-container {
35
+ width: 100%;
36
+ height: 100%;
37
+ padding: 8px;
38
+ background: #1e1e1e;
39
+ }
40
+
41
+ #terminal {
42
+ width: 100%;
43
+ height: 100%;
44
+ }
45
+
46
+ /* Mobile optimizations */
47
+ @media (max-width: 768px) {
48
+ #terminal-container {
49
+ padding: 4px;
50
+ }
51
+ }
52
+
53
+ /* Portrait mode - smaller font */
54
+ @media (orientation: portrait) {
55
+ #terminal-container {
56
+ padding: 2px;
57
+ }
58
+ }
59
+
60
+ /* Landscape mode - better spacing */
61
+ @media (orientation: landscape) {
62
+ #terminal-container {
63
+ padding: 8px;
64
+ }
65
+ }
66
+
67
+ /* Loading state */
68
+ .loading {
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ height: 100vh;
73
+ color: #d4d4d4;
74
+ font-size: 14px;
75
+ }
76
+
77
+ /* Prevent text selection on double-tap (mobile) */
78
+ .xterm {
79
+ -webkit-tap-highlight-color: transparent;
80
+ }
81
+
82
+ /* Ensure scrolling works on mobile */
83
+ .xterm .xterm-viewport {
84
+ overflow-y: auto !important;
85
+ -webkit-overflow-scrolling: touch;
86
+ }
87
+
88
+ /* Hide scrollbars but keep functionality */
89
+ .xterm-viewport::-webkit-scrollbar {
90
+ width: 8px;
91
+ }
92
+
93
+ .xterm-viewport::-webkit-scrollbar-track {
94
+ background: #1e1e1e;
95
+ }
96
+
97
+ .xterm-viewport::-webkit-scrollbar-thumb {
98
+ background: #3e3e3e;
99
+ border-radius: 4px;
100
+ }
101
+ </style>
102
+ </head>
103
+ <body>
104
+ <div id="terminal-container">
105
+ <div class="loading">Connecting to terminal...</div>
106
+ <div id="terminal" style="display: none;"></div>
107
+ </div>
108
+
109
+ <script>
110
+ // This is a placeholder - ttyd will inject its own JavaScript
111
+ // ttyd serves the actual terminal at runtime with WebSocket connection
112
+ // This HTML is just the wrapper with mobile optimizations
113
+
114
+ // When ttyd loads, it will:
115
+ // 1. Initialize xterm.js
116
+ // 2. Connect via WebSocket
117
+ // 3. Handle terminal I/O
118
+ // 4. Auto-fit terminal to container
119
+
120
+ // Mobile-specific enhancements will be handled by ttyd's built-in client
121
+ </script>
122
+ </body>
123
+ </html>