runway-cli 0.8.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,376 @@
1
+ # Runway CLI
2
+
3
+ Command-line tool for deploying projects to Runway deployment server.
4
+
5
+ ## Installation
6
+
7
+ ### From Source (Development)
8
+
9
+ ```bash
10
+ # From the monorepo root
11
+ npm install
12
+ npm run build:cli
13
+
14
+ # Link globally for development
15
+ cd cli
16
+ npm link
17
+ ```
18
+
19
+ ### Global Installation (Production)
20
+
21
+ ```bash
22
+ npm install -g @runway/cli
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ # 1. Configure CLI with your Runway server
29
+ runway init --server https://deploy.example.com
30
+
31
+ # 2. Navigate to your project directory
32
+ cd my-react-app
33
+
34
+ # 3. Deploy
35
+ runway deploy
36
+ ```
37
+
38
+ ## Security Modes
39
+
40
+ The CLI supports two security modes depending on your server configuration:
41
+
42
+ | Mode | Server Config | Token Lifetime | Authentication |
43
+ |------|---------------|----------------|----------------|
44
+ | **HTTPS** (domain-https) | Domain configured with TLS | 12 hours | Direct over TLS |
45
+ | **HTTP** (ip-http) | IP-only access | 15 minutes | RSA key exchange |
46
+
47
+ ### HTTPS Mode (Recommended)
48
+
49
+ When your Runway server has a domain configured with automatic TLS:
50
+ - Credentials are sent directly over HTTPS
51
+ - Tokens are valid for 12 hours
52
+ - Token refresh is supported
53
+
54
+ ### HTTP Mode (Development Only)
55
+
56
+ When accessing the server via IP address without TLS:
57
+ - Credentials are encrypted using RSA public key exchange
58
+ - Tokens expire in 15 minutes for security
59
+ - Token refresh is **not** available (re-authentication required)
60
+ - A warning is displayed about potential MITM vulnerabilities
61
+
62
+ > **Security Note:** RSA key exchange over HTTP is vulnerable to man-in-the-middle attacks. Configure a domain on your server for production use.
63
+
64
+ ## Commands
65
+
66
+ ### `runway init`
67
+
68
+ Configure the CLI with your Runway server URL and credentials.
69
+
70
+ ```bash
71
+ # Interactive mode
72
+ runway init
73
+
74
+ # With server URL
75
+ runway init --server https://deploy.example.com
76
+ ```
77
+
78
+ **Options:**
79
+ - `-s, --server <url>` - Runway server URL
80
+
81
+ **Authentication Flow:**
82
+
83
+ 1. CLI queries the server's security mode
84
+ 2. If HTTPS mode: direct authentication over TLS
85
+ 3. If HTTP mode:
86
+ - Displays security warning
87
+ - Prompts for confirmation to proceed
88
+ - Fetches server's RSA public key
89
+ - Encrypts credentials before sending
90
+ 4. Token and security mode are saved to config
91
+
92
+ The CLI stores configuration in `~/.runway/config.json`.
93
+
94
+ ### `runway deploy`
95
+
96
+ Deploy the current project to Runway.
97
+
98
+ ```bash
99
+ # Interactive mode (prompts for options)
100
+ runway deploy
101
+
102
+ # With options
103
+ runway deploy --name my-app --type react
104
+
105
+ # Build locally before uploading (default, recommended)
106
+ runway deploy --build-local
107
+
108
+ # Upload source and build on server
109
+ runway deploy --build-server
110
+
111
+ # Include environment file
112
+ runway deploy --env-file .env.production
113
+
114
+ # With version tag
115
+ runway deploy --version 1.2.3
116
+ ```
117
+
118
+ **Options:**
119
+ - `-n, --name <name>` - Project name (auto-detected from package.json)
120
+ - `-t, --type <type>` - Project type: `react`, `next`, or `node`
121
+ - `-v, --version <version>` - Version string for this deployment
122
+ - `--build-local` - Build locally before uploading (default)
123
+ - `--build-server` - Upload source code and build on server
124
+ - `-e, --env-file <path>` - Path to environment file
125
+
126
+ **Build Modes:**
127
+
128
+ | Mode | Description | Use Case |
129
+ |------|-------------|----------|
130
+ | `--build-local` | Build on your machine, upload artifacts | Faster deploys, consistent builds |
131
+ | `--build-server` | Upload source, server builds | CI/CD pipelines, no local build tools |
132
+
133
+ ### `runway list`
134
+
135
+ List all deployed projects.
136
+
137
+ ```bash
138
+ runway list
139
+ # or
140
+ runway ls
141
+ ```
142
+
143
+ ### `runway status`
144
+
145
+ Get the status of a deployed project.
146
+
147
+ ```bash
148
+ runway status my-app
149
+ ```
150
+
151
+ ## Supported Project Types
152
+
153
+ The CLI auto-detects your project type:
154
+
155
+ | Type | Detection | Build Output |
156
+ |------|-----------|--------------|
157
+ | **Static** | Has `index.html` (no `package.json` required) | Project root |
158
+ | **React** | Has `react` + build tooling (Vite/CRA) | `dist/` or `build/` folder |
159
+ | **Next.js** | Has `next` dependency | `.next/` folder |
160
+ | **Node.js** | Has `package.json` with `start` script | Full source |
161
+
162
+ ### Detection Priority
163
+
164
+ 1. `index.html` without `package.json` → **Static**
165
+ 2. `next` dependency → **Next.js**
166
+ 3. `react` dependency + build tools → **React**
167
+ 4. `index.html` with `package.json` (no framework) → **Static**
168
+ 5. `start` script or common entry files → **Node.js**
169
+
170
+ ### Unsupported Projects
171
+
172
+ The following project types are **not supported**:
173
+
174
+ - Python, Ruby, Go, or other non-Node.js runtimes
175
+ - PHP applications
176
+ - Docker-only projects (use the web UI instead)
177
+
178
+ ## Build Process
179
+
180
+ ### Local Build Mode (Recommended)
181
+
182
+ 1. **Detect** - Identifies project type from `package.json` or `index.html`
183
+ 2. **Build** - Runs your build command (skipped for static sites)
184
+ 3. **Package** - Creates zip with:
185
+ - Static: All files (excluding `.git`, `node_modules`)
186
+ - React: `dist/`, `package.json`
187
+ - Next.js: `.next/`, `public/`, `package.json`, `next.config.*`
188
+ - Node.js: All source files (excluding `node_modules`, `.git`)
189
+ 4. **Upload** - Sends zip to Runway server
190
+ 5. **Deploy** - Server extracts, configures, and starts your app
191
+
192
+ ### Server Build Mode
193
+
194
+ 1. **Package** - Creates zip with full source code (excluding `node_modules`, `.git`)
195
+ 2. **Upload** - Sends zip to Runway server
196
+ 3. **Install** - Server runs `npm install`
197
+ 4. **Build** - Server runs `npm run build`
198
+ 5. **Deploy** - Server configures and starts your app
199
+
200
+ **Note:** Static sites always use local build mode (no server-side processing needed).
201
+
202
+ ## Package Manager Support
203
+
204
+ The CLI detects and uses your preferred package manager:
205
+
206
+ | Lock File | Package Manager |
207
+ |-----------|-----------------|
208
+ | `pnpm-lock.yaml` | pnpm |
209
+ | `yarn.lock` | yarn |
210
+ | `package-lock.json` | npm |
211
+
212
+ ## Configuration
213
+
214
+ Configuration is stored at `~/.runway/config.json`:
215
+
216
+ ```json
217
+ {
218
+ "serverUrl": "https://deploy.example.com",
219
+ "token": "your-jwt-token",
220
+ "tokenExpiresAt": "2026-01-31T12:00:00.000Z",
221
+ "securityMode": "domain-https",
222
+ "defaultBuildMode": "local"
223
+ }
224
+ ```
225
+
226
+ ### Configuration Options
227
+
228
+ | Key | Description |
229
+ |-----|-------------|
230
+ | `serverUrl` | Runway server URL |
231
+ | `token` | Authentication JWT token |
232
+ | `tokenExpiresAt` | ISO timestamp when the token expires |
233
+ | `securityMode` | Server security mode (`ip-http` or `domain-https`) |
234
+ | `defaultBuildMode` | Default build mode (`local` or `server`) |
235
+
236
+ ## Environment Variables
237
+
238
+ Include environment variables in your deployment:
239
+
240
+ ```bash
241
+ # Create .env.production with your variables
242
+ echo "API_URL=https://api.example.com" > .env.production
243
+
244
+ # Deploy with env file
245
+ runway deploy --env-file .env.production
246
+ ```
247
+
248
+ ## Examples
249
+
250
+ ### Deploy a React App
251
+
252
+ ```bash
253
+ cd my-react-app
254
+ runway deploy --name my-react-app --type react
255
+ ```
256
+
257
+ ### Deploy a Next.js App
258
+
259
+ ```bash
260
+ cd my-nextjs-app
261
+ runway deploy --name my-nextjs-app --type next
262
+ ```
263
+
264
+ ### Deploy a Node.js API
265
+
266
+ ```bash
267
+ cd my-api
268
+ runway deploy --name my-api --type node
269
+ ```
270
+
271
+ ### Deploy a Static HTML Site
272
+
273
+ ```bash
274
+ cd my-static-site
275
+ runway deploy --name my-site --type static
276
+ ```
277
+
278
+ ### CI/CD Integration
279
+
280
+ ```yaml
281
+ # GitHub Actions example
282
+ - name: Deploy to Runway
283
+ run: |
284
+ npm install -g @runway/cli
285
+ runway init --server ${{ secrets.RUNWAY_URL }}
286
+ runway deploy --name my-app --build-local
287
+ ```
288
+
289
+ ## Troubleshooting
290
+
291
+ ### "CLI not configured"
292
+
293
+ Run `runway init` to configure the CLI with your server URL.
294
+
295
+ ### "Token expired" or "Unauthorized"
296
+
297
+ Your authentication token has expired:
298
+ - **HTTP mode (ip-http):** Tokens expire in 15 minutes. Run `runway init` to re-authenticate.
299
+ - **HTTPS mode (domain-https):** Tokens expire in 12 hours. Run `runway init` to re-authenticate.
300
+
301
+ ### "RSA key exchange warning"
302
+
303
+ This appears when connecting to a server without HTTPS:
304
+ - The warning is informational - authentication will still work
305
+ - For production, configure a domain on your Runway server to enable HTTPS
306
+ - RSA encryption provides some protection, but is vulnerable to MITM attacks
307
+
308
+ ### "Build failed"
309
+
310
+ - Check that your project has a valid `build` script in `package.json`
311
+ - Ensure all dependencies are installed locally
312
+ - Try running `npm run build` manually to see errors
313
+
314
+ ### "Upload failed"
315
+
316
+ - Verify the server URL is correct
317
+ - Check that your authentication token is valid (run `runway init` if expired)
318
+ - Ensure the server is running and accessible
319
+
320
+ ### "Project detection failed"
321
+
322
+ - Ensure you're in a directory with a valid `package.json`
323
+ - Check that `package.json` has a `name` field
324
+
325
+ ### "Failed to get security mode"
326
+
327
+ - Verify the server URL is correct
328
+ - Ensure the Runway server is running
329
+ - Check network connectivity to the server
330
+
331
+ ## Development
332
+
333
+ ### Building from Source
334
+
335
+ ```bash
336
+ # Clone the repository
337
+ git clone https://github.com/your-org/runway.git
338
+ cd runway
339
+
340
+ # Install dependencies
341
+ npm install
342
+
343
+ # Build shared types and CLI
344
+ npm run build:cli
345
+
346
+ # Run CLI in development
347
+ cd cli
348
+ npm run dev -- deploy
349
+ ```
350
+
351
+ ### Project Structure
352
+
353
+ ```
354
+ cli/
355
+ ├── src/
356
+ │ ├── index.ts # Entry point, Commander setup
357
+ │ ├── commands/
358
+ │ │ ├── init.ts # runway init
359
+ │ │ ├── deploy.ts # runway deploy
360
+ │ │ ├── list.ts # runway list
361
+ │ │ └── status.ts # runway status
362
+ │ ├── services/
363
+ │ │ ├── authService.ts # Authentication (RSA + standard flows)
364
+ │ │ ├── projectDetector.ts # Auto-detect project type
365
+ │ │ ├── buildService.ts # Run local builds
366
+ │ │ ├── packageService.ts # Create deployment zip
367
+ │ │ └── uploadService.ts # Upload to server
368
+ │ └── utils/
369
+ │ ├── config.ts # CLI configuration & token management
370
+ │ └── logger.ts # Colored output
371
+ └── package.json
372
+ ```
373
+
374
+ ## License
375
+
376
+ MIT
@@ -0,0 +1,12 @@
1
+ import { ProjectType } from '../types';
2
+ interface DeployOptions {
3
+ name?: string;
4
+ type?: ProjectType;
5
+ version?: string;
6
+ buildLocal?: boolean;
7
+ buildServer?: boolean;
8
+ envFile?: string;
9
+ skipEnvPrompt?: boolean;
10
+ }
11
+ export declare function deployCommand(options: DeployOptions): Promise<void>;
12
+ export {};