uplink-cli 0.1.37 → 0.1.39

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 (56) hide show
  1. package/AGENTS.md +161 -0
  2. package/LICENSE +21 -0
  3. package/README.md +45 -44
  4. package/cli/src/index.ts +5 -3
  5. package/cli/src/registrars/cloudflare.ts +148 -0
  6. package/cli/src/registrars/godaddy.ts +99 -0
  7. package/cli/src/registrars/hostinger.ts +106 -0
  8. package/cli/src/registrars/http.ts +18 -0
  9. package/cli/src/registrars/index.ts +30 -0
  10. package/cli/src/registrars/namecheap.ts +163 -0
  11. package/cli/src/registrars/secret.ts +66 -0
  12. package/cli/src/registrars/store.ts +55 -0
  13. package/cli/src/registrars/types.ts +40 -0
  14. package/cli/src/subcommands/admin.ts +17 -30
  15. package/cli/src/subcommands/db.ts +63 -57
  16. package/cli/src/subcommands/dev.ts +23 -25
  17. package/cli/src/subcommands/domains.ts +268 -0
  18. package/cli/src/subcommands/host-domains.ts +148 -0
  19. package/cli/src/subcommands/host.ts +106 -32
  20. package/cli/src/subcommands/menu/colors.ts +1 -1
  21. package/cli/src/subcommands/menu/effects/tunnel-clients.ts +87 -14
  22. package/cli/src/subcommands/menu/inline-tree-select.ts +6 -5
  23. package/cli/src/subcommands/menu/io.ts +27 -5
  24. package/cli/src/subcommands/menu/menus/domains.ts +199 -0
  25. package/cli/src/subcommands/menu/menus/hosting.ts +14 -46
  26. package/cli/src/subcommands/menu/menus/index.ts +1 -0
  27. package/cli/src/subcommands/menu/menus/tunnels.ts +25 -67
  28. package/cli/src/subcommands/menu/render.ts +2 -2
  29. package/cli/src/subcommands/menu/tests.ts +1 -1
  30. package/cli/src/subcommands/menu/tunnels.ts +10 -99
  31. package/cli/src/subcommands/menu/types.ts +8 -0
  32. package/cli/src/subcommands/menu.ts +32 -524
  33. package/cli/src/subcommands/system.ts +58 -36
  34. package/cli/src/subcommands/tunnel.ts +124 -33
  35. package/cli/src/templates/index.ts +122 -0
  36. package/cli/src/tui/App.tsx +197 -0
  37. package/cli/src/tui/AppInspector.tsx +114 -0
  38. package/cli/src/tui/HomeStatus.tsx +59 -0
  39. package/cli/src/tui/brand.tsx +20 -0
  40. package/cli/src/tui/format.ts +22 -0
  41. package/cli/src/tui/index.mts +6 -0
  42. package/cli/src/tui/liveTree.ts +40 -0
  43. package/cli/src/tui/package.json +3 -0
  44. package/cli/src/tui/runMenu.tsx +57 -0
  45. package/cli/src/tui/session.mts +382 -0
  46. package/cli/src/tui/snapshot.ts +146 -0
  47. package/cli/src/utils/analyze.ts +27 -43
  48. package/cli/src/utils/framework-output.ts +171 -0
  49. package/cli/src/utils/launchDomainking.ts +64 -0
  50. package/docs/AGENTS.md +113 -146
  51. package/docs/MENU_STRUCTURE.md +56 -288
  52. package/docs/README.md +6 -6
  53. package/package.json +18 -35
  54. package/scripts/tunnel/client-improved.js +127 -38
  55. package/scripts/tunnel/client.js +118 -0
  56. package/assets/cli-screenshot.png +0 -0
@@ -1,337 +1,105 @@
1
1
  # Uplink CLI Menu Structure
2
2
 
3
- > Reference document for the interactive menu hierarchy.
4
- > Last updated: January 2026
3
+ > Interactive menu hierarchy for `uplink` / `uplink menu`.
4
+ > Last updated: August 2026
5
+
6
+ Agents should prefer non-interactive commands in [AGENTS.md](../AGENTS.md).
5
7
 
6
8
  ---
7
9
 
8
10
  ## Overview
9
11
 
10
- The Uplink CLI (`uplink menu`) provides an interactive terminal interface for managing tunnels, databases, and system administration. The menu adapts based on authentication status and user role.
11
-
12
- ---
13
-
14
- ## Menu States
12
+ The menu adapts by auth and role. Arrow keys + Enter (no numeric entry).
15
13
 
16
- | State | Condition | Available Options |
17
- |-------|-----------|-------------------|
18
- | Unauthenticated | No `AGENTCLOUD_TOKEN` or invalid token | Get Started, Exit |
19
- | User | Valid token with `role: user` | Tunnels, Exit |
20
- | Admin | Valid token with `role: admin` | Tunnels, Usage (all tunnels/dbs), System Status, Manage Tokens, Stop All, Exit |
14
+ | State | Condition | Main options |
15
+ |-------|-----------|--------------|
16
+ | Unauthenticated | No / invalid `AGENTCLOUD_TOKEN` | Get Started, Find a domain, About, Exit |
17
+ | User | Valid token | Share, Hosting, Domains, About, Exit |
18
+ | Admin | `role: admin` | Same as user + Usage, System Status, Manage Tokens |
21
19
 
22
20
  ---
23
21
 
24
- ## Complete Menu Hierarchy
25
-
26
- ### Unauthenticated User
22
+ ## Unauthenticated
27
23
 
28
24
  ```
29
25
  UPLINK
30
26
  ● offline
31
27
 
32
- Get Started
33
- Creates a user token via the API (`POST /v1/signup`)
34
- → Optionally saves `AGENTCLOUD_TOKEN` into your shell rc file
35
-
28
+ Get Started → signup; optional save AGENTCLOUD_TOKEN to shell rc
29
+ Find a domain → domain search TUI if Domainking is available
30
+ About
36
31
  Exit
37
32
  ```
38
33
 
39
34
  ---
40
35
 
41
- ### Authenticated User (Regular)
36
+ ## Authenticated Share
42
37
 
43
- ```
44
- UPLINK
45
- ● connected
46
- ├─ Active 2 tunnels
38
+ Creates tunnels **and** starts the local client (same as `uplink tunnel create`).
47
39
 
48
- Manage Tunnels
49
- ├── Start Tunnel
50
- │ └── [Port Selection]
51
- │ ├── Port 3000 → Creates tunnel & starts client
52
- │ ├── Port 8080 → Creates tunnel & starts client
53
- │ ├── Enter custom port → Prompt → Creates tunnel
54
- │ └── ← Back
55
-
56
- ├── Stop Tunnel
57
- │ └── [Running Tunnels Selection]
58
- │ ├── Port 3000 (abc123...) → Stops tunnel client
59
- │ ├── Port 8080 (def456...) → Stops tunnel client
60
- │ ├── Stop all tunnels → Stops all clients
61
- │ └── ← Back
62
-
63
- ├── View Tunnel Stats
64
- │ └── [Running Tunnel Selection]
65
- │ ├── abc123... Port 3000
66
- │ └── ← Back
67
-
68
- │ → Displays:
69
- │ - Permanent URL (if set)
70
- │ - Connection status (verified via relay)
71
- │ - Total stats (requests, bytes in/out)
72
- │ - Current run stats
73
-
74
- └── Active Tunnels
75
- └── Displays table (only shows tunnels connected to relay):
76
- Token Port Status Permanent URL
77
- ────────────────────────────────────────────────
78
- abc123... 3000 connected myapp.uplink.spot
79
- def456... 8080 connected -
80
-
81
- Manage Aliases (Premium)
82
- ├── My Aliases
83
- │ └── Displays table:
84
- │ Alias Port Status
85
- │ ────────────────────────────────
86
- │ myapp 3000 active
87
- │ api 8080 inactive
88
-
89
- │ (active = tunnel running on that port)
90
-
91
- ├── Create Alias
92
- │ └── [Port Selection]
93
- │ ├── Port 3000 (tunnel running) → Prompt alias name
94
- │ ├── Enter custom port → Prompt port → Prompt alias
95
- │ └── ← Back
96
-
97
- │ → Creates permanent URL at {alias}.uplink.spot
98
- │ → Alias is port-based (persists across tunnel restarts)
99
-
100
- ├── Reassign Alias
101
- │ └── [Alias Selection]
102
- │ ├── myapp → Port 3000
103
- │ └── ← Back
104
-
105
- │ → Select new port for alias
106
-
107
- └── Delete Alias
108
- └── [Alias Selection]
109
- ├── myapp
110
- └── ← Back
111
-
112
- → Removes permanent URL
113
-
114
- Exit
115
40
  ```
116
-
117
- > **Note:**
118
- > - Database features are admin-only. Regular users do not see database options.
119
- > - Aliases are port-based: they persist even when tunnels restart. The same alias always points to the same port.
120
- > - "Active Tunnels" verifies connection status with the relay server (not just local processes).
121
-
122
- ---
123
-
124
- ### Admin User (Additional Sections)
125
-
41
+ Share
42
+ ├── Start tunnel → scan ports / enter port → create + start client
43
+ ├── Stop tunnel → kill local client + delete API record
44
+ ├── View tunnel stats
45
+ ├── Active tunnels → connected tunnels table
46
+ └── Aliases → list / create permanent URLs (premium)
126
47
  ```
127
- Usage (admin-only)
128
- ├── List All Tunnels
129
- │ └── Shows all tunnels across all users
130
-
131
- └── List All Databases
132
- └── Shows all databases across all users
133
-
134
- System Status
135
- ├── View Status
136
- │ └── Displays:
137
- │ - API health
138
- │ - Relay status (online/offline)
139
- │ - Connected tunnels count
140
- │ - Active databases count
141
-
142
- ├── View Connected Tunnels
143
- │ └── Displays table:
144
- │ Token Client IP Port Uptime Connected At
145
- │ ─────────────────────────────────────────────────────────────
146
- │ abc123... 192.168.1.5 3000 2h 15m 2024-12-31T10:00:00
147
-
148
- └── View Traffic Stats
149
- └── Displays table:
150
- Alias Requests In Out Sts Last Seen
151
- ─────────────────────────────────────────────────────────────────────────
152
- chat 1,234 45.2 MB 12.8 MB 200 2024-12-31...
153
48
 
154
- Manage Tokens
155
- ├── List Tokens
156
- │ └── Displays table:
157
- │ ID Prefix Role Label Created
158
- │ ──────────────────────────────────────────────────────────────────────
159
- │ tok_abc... sk-abc... admin Production 2024-12-01...
160
-
161
- ├── Create Token
162
- │ ├── Prompt: "Role (admin/user, default user):"
163
- │ ├── Prompt: "Label (optional):"
164
- │ ├── Prompt: "Expires in days (optional):"
165
- │ └── Displays created token (save immediately!)
166
-
167
- └── Revoke Token
168
- ├── Prompt: "Token ID to revoke:"
169
- └── Confirms revocation
170
-
171
- ⚠️ Stop All Tunnel Clients
172
- └── Emergency kill switch for all local tunnel processes
173
- ```
49
+ Admins also get **Stop ALL Tunnel Clients** under Share.
174
50
 
175
51
  ---
176
52
 
177
- ## Result Displays
178
-
179
- ### Tunnel Created Successfully
53
+ ## Authenticated — Hosting
180
54
 
181
55
  ```
182
- ✓ Tunnel created and client started
183
-
184
- Public URL https://abc123.x.uplink.spot
185
- Token abc123
186
- Local port 3000
187
-
188
- Tunnel client running in background.
189
- Use "Stop Tunnel" to disconnect.
56
+ Hosting
57
+ ├── Setup wizard → analyze + create + deploy
58
+ ├── Deploy deploy to existing app
59
+ ├── List apps
60
+ ├── Analyze project
61
+ ├── Delete app
62
+ └── (Apps subtree may show live apps + logs in the Ink TUI)
190
63
  ```
191
64
 
192
- ### Alias Created
193
-
194
- ```
195
- ✓ Alias created
196
-
197
- → Alias my-app
198
- → Port 3000
199
- → URL https://my-app.uplink.spot
200
-
201
- Your tunnel will now be accessible at this permanent URL.
202
- Alias is port-based - it will persist across tunnel restarts.
203
- ```
204
-
205
- ### Error: Premium Feature Required
206
-
207
- ```
208
- ❌ Permanent URLs are a premium feature
209
-
210
- Contact us on Discord at uplink.spot to upgrade your account.
211
- ```
212
-
213
- ### Error: URL Limit Reached
214
-
215
- ```
216
- ❌ URL limit reached
217
-
218
- You've reached your URL limit. Contact us to increase it.
219
- ```
220
-
221
- ### Error: URL Already Taken
222
-
223
- ```
224
- ❌ Alias "my-app" is already in use. Try a different name.
225
- ```
226
-
227
- ---
228
-
229
- ## Navigation Controls
230
-
231
- | Key | Action |
232
- |-----|--------|
233
- | `↑` / `↓` | Navigate menu items |
234
- | `Enter` | Select item |
235
- | `←` | Go back to parent menu |
236
- | `Ctrl+C` | Exit immediately |
65
+ CLI equivalents: `uplink host setup|deploy|list|status|logs|delete|analyze|preflight`.
237
66
 
238
67
  ---
239
68
 
240
- ## Environment Variables
241
-
242
- | Variable | Description | Default |
243
- |----------|-------------|---------|
244
- | `AGENTCLOUD_TOKEN` | API authentication token | (required) |
245
- | `AGENTCLOUD_API_BASE` | API base URL | `https://api.uplink.spot` |
246
- | `TUNNEL_CTRL` | Tunnel relay control endpoint | `tunnel.uplink.spot:7071` |
247
- | `TUNNEL_DOMAIN` | Tunnel URL domain | `x.uplink.spot` |
248
- | `RELAY_HEALTH_URL` | Optional: show API/relay banner in menu | (unset) |
249
-
250
- ---
251
-
252
- ## Design Decisions
253
-
254
- ### Current Structure Rationale
255
-
256
- **Regular users** see a focused menu:
257
- - All tunnel operations in one place ("Manage Tunnels")
258
- - "My Tunnels" listing included in the same menu
259
- - No database options (admin feature only)
260
-
261
- **Admin users** get additional sections:
262
- - "Usage" for cross-user visibility (all tunnels, all databases)
263
- - "System Status" for monitoring
264
- - "Manage Tokens" for access control
265
- - Emergency kill switch
266
-
267
- ### Future Improvements
268
-
269
- Consider consolidating admin sections:
69
+ ## Authenticated — Domains
270
70
 
271
71
  ```
272
- Admin (consolidated)
273
- ├── Usage
274
- ├── All Tunnels
275
- │ └── All Databases
276
- ├── System Status
277
- ├── View Status
278
- ├── Connected Tunnels
279
- │ └── Traffic Stats
280
- ├── Manage Tokens
281
- │ ├── List / Create / Revoke
282
- └── Stop All Clients
72
+ Domains
73
+ ├── My domains → uplink domains list
74
+ ├── Connect registrar → providers connect (token via env)
75
+ ├── Check availability → domains check
76
+ ├── Attach to app → host domains add
77
+ ├── Verify → host domains verify
78
+ ├── List attached → host domains list
79
+ ├── Detach → host domains remove
80
+ └── Search (optional TUI) → Domainking if DOMAINKING_ENTRY / sibling repo exists
283
81
  ```
284
82
 
285
- This would reduce top-level clutter for admin users while maintaining all functionality.
83
+ Bare `uplink domains` opens the search TUI when available; otherwise it prints agent-friendly command hints.
286
84
 
287
85
  ---
288
86
 
289
- ## Implementation Reference (Maintainers)
290
-
291
- This section is a **single source of truth** for how the interactive menu is implemented and how it should evolve. It intentionally stays high-level and avoids security-sensitive details.
292
-
293
- ### Goals
294
- - **Deterministic**: UI output is a function of state (no hidden UI state).
295
- - **Maintainable**: Separate **rendering**, **input/events**, and **side-effects** (API calls, spawning clients).
296
- - **Safe defaults**: Avoid leaking secrets; avoid printing raw tokens except in the explicit signup/token-creation flows.
297
-
298
- ### Proposed refactor shape (Textual-inspired, Node/TS)
299
-
300
- Current `cli/src/subcommands/menu.ts` mixes rendering + input handling + actions in one file. The refactor splits into a tiny internal “menu framework”:
301
-
302
- - `cli/src/subcommands/menu/state.ts`
303
- - Exports `MenuState`, `MenuRole`, `MenuAuthStatus`
304
- - Single state object drives all rendering
305
- - `cli/src/subcommands/menu/events.ts`
306
- - Exports `MenuEvent` (key presses, navigation, action results)
307
- - `cli/src/subcommands/menu/reducer.ts`
308
- - Pure reducer: `(state, event) => { state, effect? }`
309
- - `cli/src/subcommands/menu/effects.ts`
310
- - Side-effects runner (API calls, spawn/kill tunnel clients)
311
- - Dispatches `MenuEvent` results back into the reducer
312
- - `cli/src/subcommands/menu/render.ts`
313
- - `render(state): string[]` (or a single string) composing widget renderers
314
- - `cli/src/subcommands/menu/widgets.ts`
315
- - Small, testable “views”: header, breadcrumbs, menu list, message area, footer, active tunnel panel
316
- - `cli/src/subcommands/menu/menu-tree.ts`
317
- - Build `MenuChoice[]` based on auth status + role (unauth/user/admin)
87
+ ## Admin extras
318
88
 
319
- Existing primitives continue to be reused:
320
- - `cli/src/subcommands/menu/colors.ts` (palette)
321
- - `cli/src/subcommands/menu/io.ts` (prompt/clear/raw-mode helpers)
322
- - `cli/src/subcommands/menu/inline-select.ts` (arrow-key selector)
323
- - `cli/src/subcommands/menu/requests.ts` (unauthenticated API requests)
89
+ - **Usage** cross-user tunnels / databases visibility
90
+ - **System Status** — API health + stats (+ smoke where configured)
91
+ - **Manage Tokens** — create / list / revoke
324
92
 
325
- ### Migration order (keep behavior stable)
326
- 1. Remove duplicate palette + selector from `menu.ts` and use `menu/colors.ts`, `menu/io.ts`, `menu/inline-select.ts`.
327
- 2. Extract a pure `render(state)` and keep current behavior.
328
- 3. Introduce `MenuState` and move mutable globals into state.
329
- 4. Introduce `MenuEvent` + reducer loop (keypress → event → state update → render).
330
- 5. Move actions (API/spawn) into `effects.ts` and keep render side-effect free.
93
+ CLI: `uplink admin status|tunnels|databases|tokens …`
331
94
 
332
95
  ---
333
96
 
334
- ## Related Documentation
97
+ ## Environment
335
98
 
336
- - [AGENTS.md](./AGENTS.md) - Programmatic CLI usage for AI agents
337
- - [README.md](./README.md) - Public docs index
99
+ | Variable | Purpose | Default |
100
+ |----------|---------|---------|
101
+ | `AGENTCLOUD_TOKEN` | Auth bearer | — |
102
+ | `AGENTCLOUD_API_BASE` | API host | `https://api.uplink.spot` |
103
+ | `TUNNEL_CTRL` | Relay | `tunnel.uplink.spot:7071` |
104
+ | `TUNNEL_DOMAIN` | Tunnel DNS suffix | `x.uplink.spot` |
105
+ | `DOMAINKING_ENTRY` | Optional search TUI entry | — |
package/docs/README.md CHANGED
@@ -3,19 +3,19 @@
3
3
  ## Quick Start
4
4
 
5
5
  ```bash
6
- # Install
7
6
  npm install -g uplink-cli
8
-
9
- # Launch interactive menu
10
- uplink menu
7
+ uplink menu # interactive
8
+ uplink --help # commands
11
9
  ```
12
10
 
13
11
  ## Documentation
14
12
 
15
- - **[AGENTS.md](./AGENTS.md)** - Programmatic CLI usage for AI agents and automation
16
- - **[MENU_STRUCTURE.md](./MENU_STRUCTURE.md)** - Interactive menu reference
13
+ - **[AGENTS.md](../AGENTS.md)** (also mirrored here) — programmatic CLI for AI agents
14
+ - **[MENU_STRUCTURE.md](./MENU_STRUCTURE.md)** interactive menu reference
15
+ - **[OPEN_SOURCE_CLI.md](./OPEN_SOURCE_CLI.md)** — public CLI vs private backend scope
17
16
 
18
17
  ## Links
19
18
 
20
19
  - Website: [uplink.spot](https://uplink.spot)
20
+ - npm: [uplink-cli](https://www.npmjs.com/package/uplink-cli)
21
21
  - API: `https://api.uplink.spot`
package/package.json CHANGED
@@ -1,23 +1,21 @@
1
1
  {
2
2
  "name": "uplink-cli",
3
- "version": "0.1.37",
4
- "description": "Expose localhost to the internet in seconds. Interactive terminal UI, permanent custom domains, zero config. A modern ngrok alternative.",
3
+ "version": "0.1.39",
4
+ "description": "Software for agents — share localhost, host apps, and attach domains from the terminal. JSON-first CLI for Cursor, Claude, Codex, and Windsurf.",
5
5
  "keywords": [
6
+ "ai-agents",
7
+ "agents",
8
+ "cursor",
9
+ "claude-code",
6
10
  "tunnel",
7
11
  "localhost",
8
- "ngrok",
9
- "ngrok-alternative",
10
- "expose",
12
+ "hosting",
11
13
  "cli",
12
14
  "dev-tools",
13
- "webhook",
14
15
  "public-url",
15
- "port-forwarding",
16
- "reverse-proxy",
17
- "tunneling",
18
- "local-development",
19
16
  "https-tunnel",
20
- "custom-domain"
17
+ "custom-domain",
18
+ "agent-cli"
21
19
  ],
22
20
  "homepage": "https://uplink.spot",
23
21
  "repository": {
@@ -38,45 +36,30 @@
38
36
  "files": [
39
37
  "cli/",
40
38
  "scripts/tunnel/client-improved.js",
39
+ "scripts/tunnel/client.js",
41
40
  "README.md",
42
- "assets/",
41
+ "LICENSE",
42
+ "AGENTS.md",
43
43
  "docs/README.md",
44
44
  "docs/AGENTS.md",
45
45
  "docs/MENU_STRUCTURE.md"
46
46
  ],
47
47
  "scripts": {
48
- "dev:relay": "node scripts/tunnel/relay.js",
49
- "dev:stub": "PORT=4100 AGENTCLOUD_TOKEN_DEV=dev-token node scripts/dev/stub-control-plane.js",
50
48
  "dev:cli": "tsx cli/src/index.ts",
51
- "smoke:tunnel": "bash scripts/tunnel-smoke.sh",
52
- "smoke:db": "bash scripts/db-api-smoke.sh",
53
- "smoke:all": "bash scripts/smoke-all.sh",
54
- "test:features": "bash scripts/test-new-features.sh",
55
- "test:comprehensive": "bash scripts/test-comprehensive.sh"
49
+ "pack:check": "npm pack --dry-run"
56
50
  },
57
51
  "dependencies": {
58
- "@sendgrid/mail": "^8.1.6",
59
- "better-sqlite3": "^11.10.0",
60
- "body-parser": "^1.20.3",
61
52
  "commander": "^12.1.0",
62
- "compression": "^1.7.4",
63
- "dotenv": "^16.6.1",
64
- "express": "^4.19.2",
65
- "express-rate-limit": "^8.2.1",
66
- "helmet": "^8.1.0",
53
+ "ink": "^6.8.0",
54
+ "ink-text-input": "^6.0.0",
67
55
  "node-fetch": "^2.7.0",
68
- "pg": "^8.12.0",
69
- "pino": "^10.1.0",
70
- "pino-pretty": "^13.1.3",
71
- "tsx": "^4.21.0",
72
- "zod": "^4.2.1"
56
+ "react": "^19.2.8",
57
+ "tsx": "^4.21.0"
73
58
  },
74
59
  "devDependencies": {
75
- "@types/compression": "^1.7.5",
76
- "@types/express": "^4.17.21",
77
- "@types/express-rate-limit": "^5.1.3",
78
60
  "@types/node": "^22.7.4",
79
61
  "@types/node-fetch": "^2.6.11",
62
+ "@types/react": "^19.2.18",
80
63
  "typescript": "^5.6.2"
81
64
  }
82
65
  }