@shipstatic/ship 1.0.2 → 2.0.0-beta.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.
package/README.md CHANGED
@@ -40,7 +40,7 @@ ship config # paste your API key when prompted
40
40
  ```
41
41
 
42
42
  ```javascript
43
- const ship = new Ship({ apiKey: 'ship-...' });
43
+ const ship = new Ship({ token: 'ship-...' });
44
44
  ```
45
45
 
46
46
  ### Deployments
@@ -158,8 +158,7 @@ Available on every command:
158
158
 
159
159
  | Flag | Description |
160
160
  |------|-------------|
161
- | `--api-key <key>` | API key for authenticated requests |
162
- | `--deploy-token <token>` | Deploy token for authenticated deployments |
161
+ | `--token <token>` | Any ship token: API key (`ship-…`) or deploy token (`deploy-…`) |
163
162
  | `--api-url <url>` | API URL override (for development) |
164
163
  | `--config <file>` | Custom config file path |
165
164
  | `--json` | Output results in JSON format |
@@ -183,8 +182,7 @@ Available on `ship <path>` and `ship deployments upload`:
183
182
 
184
183
  | Var | Purpose |
185
184
  |---|---|
186
- | `SHIP_API_KEY` | Default for `--api-key` |
187
- | `SHIP_DEPLOY_TOKEN` | Default for `--deploy-token` |
185
+ | `SHIP_TOKEN` | Default for `--token` |
188
186
  | `SHIP_API_URL` | Default for `--api-url` |
189
187
  | `SHIP_PASSWORD` | Default for `--password` (empty string normalized to absence) |
190
188
 
@@ -193,18 +191,26 @@ Available on `ship <path>` and `ship deployments upload`:
193
191
  ### Authentication
194
192
 
195
193
  ```javascript
196
- // No credentials — deploy only, 3-day expiry
194
+ // No token — deploy only: lands in the public account with a claim URL, 3-day expiry
197
195
  const ship = new Ship();
198
196
 
199
- // API key — permanent, full access
200
- const ship = new Ship({ apiKey: 'ship-...' });
197
+ // API key — durable, full account
198
+ const ship = new Ship({ token: 'ship-...' });
201
199
 
202
200
  // Deploy token — scoped to deploys, optional TTL, revocable
203
- const ship = new Ship({ deployToken: 'token-...' });
201
+ const ship = new Ship({ token: 'deploy-...' });
204
202
 
205
- // Set credentials after construction
206
- ship.setApiKey('ship-...');
207
- ship.setDeployToken('token-...');
203
+ // OAuth access token — delegated, short-lived, sent verbatim
204
+ const ship = new Ship({ token: accessToken });
205
+
206
+ // Token provider — invoked per request; refresh lives with you
207
+ const ship = new Ship({ token: () => mintToken() });
208
+
209
+ // Cookie session — first-party browser apps
210
+ const ship = new Ship({ session: true });
211
+
212
+ // Set or rotate the token after construction
213
+ ship.setToken('ship-...');
208
214
  ```
209
215
 
210
216
  ### Deploy Options
@@ -221,9 +227,6 @@ ship.deploy(input, {
221
227
  maxConcurrency?: number, // Concurrent uploads (default: 4)
222
228
  timeout?: number, // Request timeout in ms
223
229
  via?: string, // Client identifier
224
- apiUrl?: string, // Per-request API URL override
225
- apiKey?: string, // Per-request API key override
226
- deployToken?: string, // Per-request deploy token override
227
230
  });
228
231
  ```
229
232
 
@@ -246,7 +249,7 @@ The CLI also reads `SHIP_PASSWORD` from the environment when `--password` is not
246
249
  ```javascript
247
250
  import Ship from '@shipstatic/ship';
248
251
 
249
- const ship = new Ship({ apiKey: 'ship-...' });
252
+ const ship = new Ship({ token: 'ship-...' });
250
253
 
251
254
  // From file input
252
255
  const deployment = await ship.deploy(fileInput.files);
@@ -308,21 +311,23 @@ try {
308
311
 
309
312
  ## Configuration
310
313
 
311
- The **CLI** (`ship`) resolves credentials in this order:
314
+ The **CLI** (`ship`) resolves its token in this order:
312
315
 
313
- 1. CLI flags: `--api-key`, `--api-url`, `--deploy-token`
314
- 2. Environment variables: `SHIP_API_KEY`, `SHIP_API_URL`, `SHIP_DEPLOY_TOKEN`
316
+ 1. CLI flag: `--token`
317
+ 2. Environment variable: `SHIP_TOKEN`
315
318
  3. Config files: `.shiprc` or `package.json` `"ship"` key (run `ship config` to create one)
316
319
 
317
- The **SDK** (`new Ship(...)`) resolves credentials in this order:
320
+ The **SDK** (`new Ship(...)`) resolves its token in this order:
321
+
322
+ 1. Constructor option: `new Ship({ token })`
323
+ 2. Environment variable: `SHIP_TOKEN`
318
324
 
319
- 1. Constructor options: `new Ship({ apiUrl, apiKey })`
320
- 2. Environment variables: `SHIP_API_KEY`, `SHIP_API_URL`, `SHIP_DEPLOY_TOKEN`
325
+ `--api-url` / `SHIP_API_URL` / `apiUrl` resolve the same way for the API endpoint.
321
326
 
322
327
  The SDK never reads `.shiprc` or `package.json` — file resolution is a CLI feature, not an SDK feature. This keeps `new Ship({})` safe to use from embedded contexts (MCP, n8n, library wrappers) without inheriting the host developer's personal credentials.
323
328
 
324
329
  ```bash
325
- SHIP_API_KEY=ship-... ship deployments list
330
+ SHIP_TOKEN=ship-... ship deployments list
326
331
  ```
327
332
 
328
333
  ## TypeScript
package/SKILL.md CHANGED
@@ -106,12 +106,12 @@ Deploy works without credentials. Everything else requires an API key.
106
106
  | Permanent deploys, domains, tokens, account | Deploy (public, 3-day TTL) |
107
107
 
108
108
  ```bash
109
- export SHIP_API_KEY=<key> # Environment variable (best for automation)
110
- ship --api-key <key> ... # Per-command override
109
+ export SHIP_TOKEN=<token> # Environment variable (best for automation)
110
+ ship --token <token> ... # Per-command override
111
111
  ship config # Interactive setup → ~/.shiprc (requires TTY)
112
112
  ```
113
113
 
114
- Deploy tokens (`--deploy-token`) are scoped, revocable deploy credentials. Set a short TTL for one-shot CI/CD workflows.
114
+ Any ship token works: an API key (`ship-…`, durable, full account) or a deploy token (`deploy-…`, scoped, revocable set a short TTL for one-shot CI/CD workflows).
115
115
 
116
116
  Free API key: https://my.shipstatic.com/api-key
117
117
 
@@ -271,8 +271,7 @@ ship tokens remove <token> # Revoke
271
271
  |------|---------|
272
272
  | `--json` | JSON output |
273
273
  | `-q, --quiet` | Identifier only |
274
- | `--api-key <key>` | API key for this command |
275
- | `--deploy-token <token>` | Single-use deploy token |
274
+ | `--token <token>` | Any ship token: API key or deploy token |
276
275
  | `--label <label>` | Set label (repeatable, replaces all) |
277
276
  | `--password <pwd>` | Password-protect deployment (6–128 chars) |
278
277
  | `--no-path-detect` | Skip build output auto-detection |