uplink-cli 0.1.26 → 0.1.28
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/cli/src/index.ts +2 -4
- package/cli/src/subcommands/menu/tunnels.ts +15 -2
- package/cli/src/subcommands/menu.ts +359 -96
- package/docs/AGENTS.md +139 -0
- package/docs/MENU_STRUCTURE.md +292 -0
- package/docs/OPEN_SOURCE_CLI.md +71 -0
- package/docs/PRODUCT.md +314 -0
- package/docs/guides/MANUAL.md +513 -0
- package/docs/guides/QUICKSTART.md +280 -0
- package/docs/guides/README.md +22 -0
- package/docs/guides/TESTING.md +408 -0
- package/docs/guides/TUNNEL_SETUP.md +134 -0
- package/docs/guides/USAGE.md +247 -0
- package/package.json +3 -2
- package/scripts/tunnel/client-improved.js +14 -2
package/docs/AGENTS.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Agent Integration Guide
|
|
2
|
+
|
|
3
|
+
For agents (Cursor/Claude/GPT/Windsurf) to use Uplink non-interactively.
|
|
4
|
+
|
|
5
|
+
## Auth
|
|
6
|
+
- Use `AGENTCLOUD_TOKEN` (bearer). Avoid argv; prefer stdin:
|
|
7
|
+
```bash
|
|
8
|
+
echo "$TOKEN" | uplink --token-stdin ...
|
|
9
|
+
```
|
|
10
|
+
- API base override: `--api-base https://api.uplink.spot` (or `AGENTCLOUD_API_BASE`).
|
|
11
|
+
|
|
12
|
+
## Signup (no auth required)
|
|
13
|
+
```bash
|
|
14
|
+
uplink signup --json
|
|
15
|
+
uplink signup --label "cursor-agent" --expires-days 30 --json
|
|
16
|
+
```
|
|
17
|
+
JSON example:
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"id": "tok_xxx",
|
|
21
|
+
"token": "abc123...",
|
|
22
|
+
"tokenPrefix": "abc123",
|
|
23
|
+
"role": "user",
|
|
24
|
+
"userId": "user_xxx",
|
|
25
|
+
"label": "cursor-agent",
|
|
26
|
+
"createdAt": "2025-01-01T00:00:00.000Z",
|
|
27
|
+
"expiresAt": "2025-01-31T00:00:00.000Z",
|
|
28
|
+
"message": "Token created successfully. Save this token securely..."
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
Save `token`—shown only once.
|
|
32
|
+
|
|
33
|
+
## Machine-mode contract
|
|
34
|
+
- `--json` → stdout = JSON only; stderr = logs/errors.
|
|
35
|
+
- Exit codes: 0 ok; 2 usage; 10 auth missing/invalid; 20 network; 30 server/unknown.
|
|
36
|
+
- Premium alias gating: alias commands may return `ALIAS_NOT_ENABLED` / `ALIAS_LIMIT_REACHED`.
|
|
37
|
+
|
|
38
|
+
## Core CLI flows (non-interactive)
|
|
39
|
+
```bash
|
|
40
|
+
# Create tunnel (optional alias if enabled)
|
|
41
|
+
echo "$TOKEN" | uplink --token-stdin --api-base https://api.uplink.spot \
|
|
42
|
+
tunnel create --port 3000 --alias myapp --json
|
|
43
|
+
|
|
44
|
+
# List tunnels (includes connection status)
|
|
45
|
+
echo "$TOKEN" | uplink --token-stdin tunnel list --json
|
|
46
|
+
|
|
47
|
+
# Set alias on tunnel
|
|
48
|
+
echo "$TOKEN" | uplink --token-stdin tunnel alias-set --id tun_xxx --alias myapp --json
|
|
49
|
+
|
|
50
|
+
# Delete alias from tunnel
|
|
51
|
+
echo "$TOKEN" | uplink --token-stdin tunnel alias-delete --id tun_xxx --json
|
|
52
|
+
|
|
53
|
+
# Stats
|
|
54
|
+
echo "$TOKEN" | uplink --token-stdin tunnel stats --id tun_xxx --json
|
|
55
|
+
|
|
56
|
+
# Stop/delete tunnel
|
|
57
|
+
echo "$TOKEN" | uplink --token-stdin tunnel stop --id tun_xxx --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### JSON shapes (representative)
|
|
61
|
+
- Create: `{ "tunnel": { id, url?, token?, alias?, aliasUrl?, targetPort, status, connected?, createdAt }, "alias": "myapp"|null, "aliasError": "..."|null }`
|
|
62
|
+
- List: `{ "tunnels": [ { id, url?, token?, alias?, aliasUrl?, targetPort, status, connected, createdAt } ], "count": n }`
|
|
63
|
+
- Stats: alias tunnels include persisted totals + relay overlay; token-only tunnels show in-memory relay stats.
|
|
64
|
+
|
|
65
|
+
**Note:** The `connected` field indicates whether the tunnel is actually connected to the relay server (verified via socket health check).
|
|
66
|
+
|
|
67
|
+
## HTTP API Reference
|
|
68
|
+
|
|
69
|
+
Auth: `Authorization: Bearer <AGENTCLOUD_TOKEN>`
|
|
70
|
+
|
|
71
|
+
### Tunnels
|
|
72
|
+
| Method | Endpoint | Description |
|
|
73
|
+
|--------|----------|-------------|
|
|
74
|
+
| `POST` | `/v1/tunnels` | Create tunnel (body: `{ port, alias? }`) |
|
|
75
|
+
| `GET` | `/v1/tunnels` | List user's tunnels (includes `connected` status) |
|
|
76
|
+
| `GET` | `/v1/tunnels/{id}` | Get tunnel details |
|
|
77
|
+
| `GET` | `/v1/tunnels/{id}/stats` | Get tunnel statistics |
|
|
78
|
+
| `DELETE` | `/v1/tunnels/{id}` | Delete tunnel |
|
|
79
|
+
| `POST` | `/v1/tunnels/{id}/alias` | Set alias on tunnel (body: `{ alias }`) |
|
|
80
|
+
| `DELETE` | `/v1/tunnels/{id}/alias` | Remove alias from tunnel |
|
|
81
|
+
|
|
82
|
+
### Port-Based Aliases (Premium)
|
|
83
|
+
Aliases are now **port-based**: they persist across tunnel restarts and always point to the same port.
|
|
84
|
+
|
|
85
|
+
| Method | Endpoint | Description |
|
|
86
|
+
|--------|----------|-------------|
|
|
87
|
+
| `GET` | `/v1/tunnels/aliases` | List all aliases for user |
|
|
88
|
+
| `POST` | `/v1/tunnels/aliases` | Create alias for port (body: `{ alias, port }`) |
|
|
89
|
+
| `PUT` | `/v1/tunnels/aliases/{alias}` | Reassign alias to different port (body: `{ port }`) |
|
|
90
|
+
| `DELETE` | `/v1/tunnels/aliases/{alias}` | Delete alias |
|
|
91
|
+
|
|
92
|
+
### Example: Create port-based alias
|
|
93
|
+
```bash
|
|
94
|
+
curl -X POST https://api.uplink.spot/v1/tunnels/aliases \
|
|
95
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
96
|
+
-H "Content-Type: application/json" \
|
|
97
|
+
-d '{"alias": "myapp", "port": 3000}'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Response:
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"id": "alias_xxx",
|
|
104
|
+
"alias": "myapp",
|
|
105
|
+
"targetPort": 3000,
|
|
106
|
+
"url": "https://myapp.uplink.spot",
|
|
107
|
+
"createdAt": "2025-01-03T00:00:00.000Z"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Domains
|
|
112
|
+
- Public tunnels: `https://<token>.x.uplink.spot`
|
|
113
|
+
- Permanent URLs (aliases): `https://<alias>.uplink.spot`
|
|
114
|
+
|
|
115
|
+
## Server Deployment (for self-hosted)
|
|
116
|
+
|
|
117
|
+
### Deploy code changes
|
|
118
|
+
```bash
|
|
119
|
+
# On server (via SSH)
|
|
120
|
+
cd /opt/agentcloud
|
|
121
|
+
git pull origin master
|
|
122
|
+
systemctl restart tunnel-relay
|
|
123
|
+
systemctl restart backend-api # if backend changed
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Services
|
|
127
|
+
| Service | Command | Description |
|
|
128
|
+
|---------|---------|-------------|
|
|
129
|
+
| `tunnel-relay` | `systemctl status tunnel-relay` | WebSocket relay for tunnels |
|
|
130
|
+
| `backend-api` | `systemctl status backend-api` | REST API server |
|
|
131
|
+
|
|
132
|
+
### Relay health check
|
|
133
|
+
The relay exposes internal endpoints (protected by `RELAY_INTERNAL_SECRET`):
|
|
134
|
+
- `/internal/connected-tokens` - List connected tunnel tokens (with socket health verification)
|
|
135
|
+
- `/internal/traffic-stats` - Traffic statistics by token/alias
|
|
136
|
+
- `/health` - Basic health check
|
|
137
|
+
|
|
138
|
+
## Optional JS helper
|
|
139
|
+
Use `cli/src/agents/tunnels-client.ts` for the same retry/timeout behavior as the CLI.
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Uplink CLI Menu Structure
|
|
2
|
+
|
|
3
|
+
> Reference document for the interactive menu hierarchy.
|
|
4
|
+
> Last updated: January 2025
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
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
|
|
15
|
+
|
|
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 |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Complete Menu Hierarchy
|
|
25
|
+
|
|
26
|
+
### Unauthenticated User
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
UPLINK
|
|
30
|
+
● offline
|
|
31
|
+
|
|
32
|
+
Get Started
|
|
33
|
+
→ Opens browser to uplink.spot
|
|
34
|
+
→ Displays instructions to create account and get API token
|
|
35
|
+
|
|
36
|
+
Exit
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Authenticated User (Regular)
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
UPLINK
|
|
45
|
+
● connected
|
|
46
|
+
├─ Active 2 tunnels
|
|
47
|
+
|
|
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
|
+
```
|
|
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
|
+
|
|
126
|
+
```
|
|
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
|
+
|
|
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
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Result Displays
|
|
178
|
+
|
|
179
|
+
### Tunnel Created Successfully
|
|
180
|
+
|
|
181
|
+
```
|
|
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.
|
|
190
|
+
```
|
|
191
|
+
|
|
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 |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
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
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Design Decisions
|
|
252
|
+
|
|
253
|
+
### Current Structure Rationale
|
|
254
|
+
|
|
255
|
+
**Regular users** see a focused menu:
|
|
256
|
+
- All tunnel operations in one place ("Manage Tunnels")
|
|
257
|
+
- "My Tunnels" listing included in the same menu
|
|
258
|
+
- No database options (admin feature only)
|
|
259
|
+
|
|
260
|
+
**Admin users** get additional sections:
|
|
261
|
+
- "Usage" for cross-user visibility (all tunnels, all databases)
|
|
262
|
+
- "System Status" for monitoring
|
|
263
|
+
- "Manage Tokens" for access control
|
|
264
|
+
- Emergency kill switch
|
|
265
|
+
|
|
266
|
+
### Future Improvements
|
|
267
|
+
|
|
268
|
+
Consider consolidating admin sections:
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
Admin (consolidated)
|
|
272
|
+
├── Usage
|
|
273
|
+
│ ├── All Tunnels
|
|
274
|
+
│ └── All Databases
|
|
275
|
+
├── System Status
|
|
276
|
+
│ ├── View Status
|
|
277
|
+
│ ├── Connected Tunnels
|
|
278
|
+
│ └── Traffic Stats
|
|
279
|
+
├── Manage Tokens
|
|
280
|
+
│ ├── List / Create / Revoke
|
|
281
|
+
└── Stop All Clients
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
This would reduce top-level clutter for admin users while maintaining all functionality.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Related Documentation
|
|
289
|
+
|
|
290
|
+
- [AGENTS.md](./AGENTS.md) - Programmatic CLI usage for AI agents
|
|
291
|
+
- [QUICKSTART.md](./guides/QUICKSTART.md) - Getting started guide
|
|
292
|
+
- [TUNNEL_SETUP.md](./guides/TUNNEL_SETUP.md) - Tunnel configuration
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Uplink CLI – Public Release Prep
|
|
2
|
+
|
|
3
|
+
This doc captures the steps to make the CLI fully public/open while keeping the core backend/relay private.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
- **Public repo**: `uplink-cli` (new). Contents: `cli/`, `scripts/tunnel/` (clients only), `docs/`, `README.md`, `LICENSE`, `package.json`, `package-lock.json`.
|
|
7
|
+
- **Private repo**: `uplink-core` (current repo or a new private one). Contents: `backend/`, infra scripts, deploy configs, database migrations, relay/server configs, secrets.
|
|
8
|
+
|
|
9
|
+
## Rationale
|
|
10
|
+
- Users and agents can install/audit/contribute to the CLI.
|
|
11
|
+
- Business logic, billing, and infra stay closed; avoids self-hosting churn and preserves premium features (permanent URLs, aliases).
|
|
12
|
+
|
|
13
|
+
## What to Publish in `uplink-cli`
|
|
14
|
+
- `cli/` (all commands).
|
|
15
|
+
- `scripts/tunnel/client-improved.js` and `scripts/tunnel/client.js` (tunnel client only).
|
|
16
|
+
- `docs/` (keep `MENU_STRUCTURE.md`, `AGENTS.md`, any usage guides).
|
|
17
|
+
- `README.md` rewritten for CLI-only usage.
|
|
18
|
+
- `LICENSE` (MIT is fine).
|
|
19
|
+
- `package.json`, `package-lock.json`.
|
|
20
|
+
|
|
21
|
+
## What **Not** to Publish
|
|
22
|
+
- `backend/`, database migrations, infra/relay configs, deploy scripts.
|
|
23
|
+
- Any tokens/keys/configs.
|
|
24
|
+
- Server-side test scripts that hit prod (`scripts/*` that are API smoke tests). Keep only client-side tunnel test if desired.
|
|
25
|
+
|
|
26
|
+
## Repo Split Steps
|
|
27
|
+
1) Create new repo `uplink-cli` (public).
|
|
28
|
+
2) Copy in:
|
|
29
|
+
- `cli/`
|
|
30
|
+
- `scripts/tunnel/client-improved.js` (and `client.js` if still needed)
|
|
31
|
+
- `docs/`
|
|
32
|
+
- `README.md` (rewrite for CLI usage)
|
|
33
|
+
- `LICENSE`
|
|
34
|
+
- `package.json`, `package-lock.json`
|
|
35
|
+
3) Prune `package.json`:
|
|
36
|
+
- Remove backend deps.
|
|
37
|
+
- Keep only CLI deps (`commander`, `node-fetch`, `tsx`, etc.).
|
|
38
|
+
- Set `"files"` to include `cli/`, `scripts/tunnel/`, `docs/`, `README.md`, `LICENSE`.
|
|
39
|
+
- Verify `"bin": { "uplink": "./cli/bin/uplink.js" }`.
|
|
40
|
+
4) Add a minimal `.npmignore` (or rely on `"files"`):
|
|
41
|
+
- Exclude tests not meant for users.
|
|
42
|
+
5) Update `README.md` (CLI-focused):
|
|
43
|
+
- Install: `npm install -g uplink-cli`
|
|
44
|
+
- Auth: set `AGENTCLOUD_TOKEN`
|
|
45
|
+
- Quick start: `uplink tunnel create --port 3000` and `uplink menu`
|
|
46
|
+
- Machine/agent mode: `--json`, `--token-stdin`, `--api-base`.
|
|
47
|
+
- Link to `docs/MENU_STRUCTURE.md` and `docs/AGENTS.md`.
|
|
48
|
+
6) Audit for secrets/tokens (ensure none in docs/logs).
|
|
49
|
+
7) Tag and publish from the new repo:
|
|
50
|
+
- `npm version patch`
|
|
51
|
+
- `npm publish`
|
|
52
|
+
- `git push --tags`
|
|
53
|
+
|
|
54
|
+
## Current Repo (`uplink-core`, private)
|
|
55
|
+
- Keep `backend/`, infra, deployment scripts, smoke tests that touch prod.
|
|
56
|
+
- Keep `scripts/tunnel-smoke.sh`, `scripts/db-api-smoke.sh`, etc. here only.
|
|
57
|
+
- Optionally keep CLI here for internal dev, but treat `uplink-cli` as the public source of truth (mirror changes back as needed).
|
|
58
|
+
|
|
59
|
+
## Optional Hardening Before Public
|
|
60
|
+
- Ensure CLI defaults point to production `api.uplink.spot` and `tunnel.uplink.spot:7071`.
|
|
61
|
+
- Verify `--api-base` override works for staging.
|
|
62
|
+
- Confirm `uplink tunnel create --json` surfaces `url` and `alias` correctly.
|
|
63
|
+
- Keep premium gating server-side (alias limits, etc.).
|
|
64
|
+
|
|
65
|
+
## Release Checklist (CLI)
|
|
66
|
+
- [ ] `npm install && npm test` (CLI scope)
|
|
67
|
+
- [ ] `npm version patch`
|
|
68
|
+
- [ ] `npm publish`
|
|
69
|
+
- [ ] `git push origin main --tags`
|
|
70
|
+
- [ ] Manual sanity: `npm install -g uplink-cli` in a clean shell, run `uplink --version`, `uplink tunnel create --port 3000 --json` (with valid token)
|
|
71
|
+
|