@shipstatic/ship 0.8.5 → 0.8.7

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
@@ -1,6 +1,6 @@
1
1
  # @shipstatic/ship
2
2
 
3
- Universal SDK and CLI for deploying static files to ShipStatic.
3
+ Universal SDK and CLI for deploying static sites to ShipStatic. No account required — deploy instantly, claim later.
4
4
 
5
5
  ## Installation
6
6
 
@@ -15,7 +15,7 @@ npm install @shipstatic/ship
15
15
  ## CLI Usage
16
16
 
17
17
  ```bash
18
- # Deploy a directory
18
+ # Deploy no account needed, site is live instantly
19
19
  ship ./dist
20
20
 
21
21
  # Deploy with labels
@@ -25,6 +25,8 @@ ship ./dist --label production --label v1.0.0
25
25
  ship ./dist -q | ship domains set www.example.com
26
26
  ```
27
27
 
28
+ Without credentials, deployments are public (3-day TTL) with a claim URL. Configure an API key for permanent deployments: `ship config`
29
+
28
30
  ### Composability
29
31
 
30
32
  The `-q` flag outputs only the resource identifier — perfect for piping and scripting:
@@ -107,27 +109,22 @@ ship completion uninstall
107
109
  ```javascript
108
110
  import Ship from '@shipstatic/ship';
109
111
 
110
- const ship = new Ship({
111
- apiKey: 'ship-your-api-key'
112
- });
113
-
114
- // Deploy (shortcut)
112
+ // Deploy no credentials needed
113
+ const ship = new Ship();
115
114
  const deployment = await ship.deploy('./dist');
116
- console.log(`Deployed: https://${deployment.deployment}`);
115
+ console.log(`Live: https://${deployment.deployment}`);
116
+ console.log(`Claim: ${deployment.claim}`); // User visits to keep permanently
117
117
 
118
- // Deploy with options
119
- const deployment = await ship.deployments.upload('./dist', {
118
+ // With an API key — deployments are permanent
119
+ const ship = new Ship({ apiKey: 'ship-your-api-key' });
120
+ const deployment = await ship.deploy('./dist', {
120
121
  labels: ['production', 'v1.0'],
121
122
  onProgress: ({ percent }) => console.log(`${percent}%`)
122
123
  });
123
124
 
124
- // Manage domains
125
+ // Manage domains (requires API key)
125
126
  await ship.domains.set('www.example.com', { deployment: deployment.deployment });
126
127
  await ship.domains.list();
127
-
128
- // Update labels
129
- await ship.deployments.set(deployment.deployment, { labels: ['production', 'v1.0'] });
130
- await ship.domains.set('www.example.com', { labels: ['live'] });
131
128
  ```
132
129
 
133
130
  ## Browser Usage
@@ -149,6 +146,8 @@ const deployment = await ship.deploy([
149
146
 
150
147
  ## Authentication
151
148
 
149
+ Deploying works without credentials. For permanent deployments and account features:
150
+
152
151
  ```javascript
153
152
  // API key (persistent access)
154
153
  const ship = new Ship({
@@ -330,6 +329,10 @@ import type {
330
329
  } from '@shipstatic/types';
331
330
  ```
332
331
 
332
+ ## AI Agents
333
+
334
+ This package includes a [SKILL.md](./SKILL.md) file — a portable skill definition that AI agents (Claude Code, Codex, OpenClaw, etc.) use to deploy sites with `ship` autonomously.
335
+
333
336
  ---
334
337
 
335
338
  Part of the [ShipStatic](https://shipstatic.com) platform.
package/SKILL.md CHANGED
@@ -1,14 +1,12 @@
1
1
  ---
2
2
  name: ship
3
- description: Static hosting via ShipStatic. Use when the user wants to deploy a website, upload files, manage deployments, set up domains, or publish static files to shipstatic.com.
3
+ description: "Deploy static websites to ShipStatic. Use when the user wants to deploy a site, publish a website, upload to hosting, go live, set up a custom domain, manage deployments, or share a site URL. No account required — instant deployment. CLI (`ship`) and Node.js/browser SDK."
4
+ compatibility: "Node.js >= 20. Install globally via npm: npm install -g @shipstatic/ship"
4
5
  metadata:
5
6
  openclaw:
6
7
  requires:
7
- env:
8
- - SHIP_API_KEY
9
8
  bins:
10
9
  - ship
11
- primaryEnv: SHIP_API_KEY
12
10
  emoji: "🚀"
13
11
  homepage: https://github.com/shipstatic/ship
14
12
  install:
@@ -17,163 +15,254 @@ metadata:
17
15
  bins: [ship]
18
16
  ---
19
17
 
20
- ## Authenticate
18
+ Deploy static sites. No account, no config — just ship it.
19
+
20
+ ## Deploy
21
21
 
22
22
  ```bash
23
- ship config # Interactive — saves to ~/.shiprc
24
- ship --api-key <key> ... # Per-command
25
- export SHIP_API_KEY=<key> # Environment variable
23
+ ship ./dist
26
24
  ```
27
25
 
28
- Get an API key at https://my.shipstatic.com/settings
26
+ Site is live. Output includes the URL and a claim link.
29
27
 
30
- ## Output Modes
28
+ Pass a build output directory (e.g. `./dist`, `./build`, `./out`) or a single file. Ship strips the directory prefix for clean URLs — `dist/assets/app.js` serves at `/assets/app.js`. A single file keeps its name: `ship page.html` deploys as `/page.html`. Deploying a project root (contains `package.json`, `node_modules`) is rejected — build first, then deploy the output.
31
29
 
32
- Every command supports three output modes:
30
+ Without credentials, deployments are public and expire in 3 days. **Always show the user both the deployment URL and the claim link** — the claim link lets them keep the site permanently.
33
31
 
34
- | Flag | Purpose | Use when |
35
- |------|---------|----------|
36
- | (default) | Human-readable text | Showing results to the user |
37
- | `--json` | Raw JSON on stdout | Parsing output programmatically |
38
- | `-q` | Key identifier only | Piping between commands |
32
+ The deployment ID **is** the URL hostname. Use the full ID (e.g. `happy-cat-abc1234.shipstatic.com`) as the argument to all other commands. The site lives at `https://<deployment>`.
39
33
 
40
- Always use `--json` when you need to parse output. Always use `-q` when piping between commands.
34
+ ### Parsing output
41
35
 
42
- Errors go to stderr in all modes. Exit code 0 = success, 1 = error.
36
+ ```bash
37
+ ship ./dist --json
38
+ ```
43
39
 
44
- ## Deploy
40
+ ```json
41
+ {
42
+ "deployment": "happy-cat-abc1234.shipstatic.com",
43
+ "files": 12,
44
+ "size": 348160,
45
+ "status": "success",
46
+ "config": false,
47
+ "labels": [],
48
+ "via": "cli",
49
+ "created": 1743552000,
50
+ "expires": 1743811200,
51
+ "claim": "https://my.shipstatic.com/claim/abc123"
52
+ }
53
+ ```
54
+
55
+ `claim` and `expires` only appear without credentials. With an API key, deployments are permanent.
56
+
57
+ ### Piping
45
58
 
46
59
  ```bash
47
- ship ./dist # Deploy a directory or file
48
- ship ./dist --json # Parse: {"deployment": "happy-cat-abc1234.shipstatic.com", ...}
49
- ship ./dist -q # Outputs only: happy-cat-abc1234.shipstatic.com
50
- ship ./dist --label v1.0 --label latest # Labels (repeatable, replaces all existing)
60
+ ship ./dist -q # happy-cat-abc1234.shipstatic.com
51
61
  ```
52
62
 
53
- Deployment IDs are their permanent URLs: `word-word-hash.shipstatic.com`. Always use the full ID (including `.shipstatic.com`) as the argument to other commands.
63
+ `-q` outputs only the identifier use it when piping or scripting.
54
64
 
55
- ## Custom Domain Setup (full workflow)
65
+ ### Labels
56
66
 
57
67
  ```bash
58
- # 1. Pre-flight check (exit 0 = valid, exit 1 = invalid)
68
+ ship ./dist --label v1.0 --label production
69
+ ```
70
+
71
+ Labels **replace all existing**, not append. Include current labels to keep them.
72
+
73
+ ### SPA routing
74
+
75
+ Ship auto-detects single-page apps from `index.html` content and configures client-side routing rewrites — all paths serve `index.html`. No action needed. Skipped if a `ship.json` config is already included in the deployment. Disable with `--no-spa-detect`.
76
+
77
+ ## Authentication
78
+
79
+ Deploy works without credentials. Everything else requires an API key.
80
+
81
+ | Needs API key | No auth needed |
82
+ |---------------|----------------|
83
+ | Permanent deploys, domains, tokens, account | Deploy (public, 3-day TTL) |
84
+
85
+ ```bash
86
+ export SHIP_API_KEY=<key> # Environment variable (best for automation)
87
+ ship --api-key <key> ... # Per-command override
88
+ ship config # Interactive setup → ~/.shiprc (requires TTY)
89
+ ```
90
+
91
+ Deploy tokens (`--deploy-token`) are single-use — consumed after one successful deploy. For CI/CD one-shot workflows.
92
+
93
+ Free API key: https://my.shipstatic.com/api-key
94
+
95
+ ## Custom Domains
96
+
97
+ Requires an API key. Full workflow:
98
+
99
+ ```bash
100
+ # 1. Validate
59
101
  ship domains validate www.example.com
60
102
 
61
- # 2. Deploy and link in one pipe
103
+ # 2. Deploy + link in one pipe
62
104
  ship ./dist -q | ship domains set www.example.com
63
105
 
64
- # 3. Get the required DNS records (to show the user)
106
+ # 3. Show DNS records to the user
65
107
  ship domains records www.example.com
66
108
 
67
- # 4. After user configures DNS, trigger verification
109
+ # 4. After user configures DNS verify
68
110
  ship domains verify www.example.com
69
111
  ```
70
112
 
71
- In text mode, step 2 automatically prints the DNS records and a shareable setup link when creating a new external domain. In `--json` mode it does not — use `domains records` separately.
113
+ Step 2 auto-prints DNS records and a setup link in text mode. With `--json`, call `domains records` separately.
114
+
115
+ Verification is async — DNS propagation takes minutes to hours. Check status with `ship domains get <name> --json` and look for `"status": "success"`.
116
+
117
+ ### Domain types
118
+
119
+ | Type | Example | DNS needed | Goes live |
120
+ |------|---------|------------|-----------|
121
+ | Internal | `my-site.shipstatic.com` | No | Instantly |
122
+ | Custom | `www.example.com` | CNAME + A | After DNS verified |
123
+
124
+ **No apex domains.** Always `www.example.com`, not `example.com`. The A record only redirects apex to www.
125
+
126
+ ### Upsert operations
127
+
128
+ `domains set` creates if new, updates if exists:
72
129
 
73
- Additional setup helpers (external domains only):
74
130
  ```bash
75
- ship domains dns www.example.com # DNS provider name (where to configure)
76
- ship domains share www.example.com # Shareable setup link for the user
131
+ ship domains set www.example.com # Reserve (no deployment yet)
132
+ ship domains set www.example.com <deployment> # Link to deployment
133
+ ship domains set www.example.com <other-dep> # Switch (instant rollback)
134
+ ship domains set www.example.com --label prod # Update labels
77
135
  ```
78
136
 
79
- ## Domain Types
137
+ Reads deployment from stdin when piped: `ship ./dist -q | ship domains set www.example.com`
80
138
 
81
- | Type | Example | DNS required | Status |
82
- |------|---------|-------------|--------|
83
- | Internal subdomain | `my-site.shipstatic.com` | No | Instant (`success`) |
84
- | Custom subdomain | `www.example.com` | Yes (CNAME + A) | Starts `pending` until DNS verified |
139
+ **No unlinking.** Once linked, switch deployments or delete the domain. Setting deployment to null returns 400.
85
140
 
86
- **Apex domains are not supported.** Always use a subdomain: `www.example.com`, not `example.com`. The A record exists only to redirect `example.com` to `www.example.com`.
141
+ ### Parsing domain output
87
142
 
88
- ## Domain Operations
143
+ ```bash
144
+ ship domains set www.example.com <dep> --json
145
+ ```
89
146
 
90
- `domains set` is an upsert — creates if new, updates if exists:
147
+ ```json
148
+ {
149
+ "domain": "www.example.com",
150
+ "deployment": "happy-cat-abc1234.shipstatic.com",
151
+ "status": "pending",
152
+ "labels": [],
153
+ "created": 1743552000,
154
+ "linked": 1743552000,
155
+ "links": 1
156
+ }
157
+ ```
91
158
 
92
159
  ```bash
93
- ship domains set www.example.com # Reserve (no deployment)
94
- ship domains set www.example.com <deployment> # Link to deployment
95
- ship domains set www.example.com <other-dep> # Switch (instant rollback)
96
- ship domains set www.example.com --label prod # Update labels
160
+ ship domains records www.example.com --json
97
161
  ```
98
162
 
99
- `domains set` reads deployment from stdin when piped:
163
+ ```json
164
+ {
165
+ "domain": "www.example.com",
166
+ "apex": "example.com",
167
+ "records": [
168
+ {"type": "A", "name": "@", "value": "76.76.21.21"},
169
+ {"type": "CNAME", "name": "www", "value": "cname.shipstatic.com"}
170
+ ]
171
+ }
172
+ ```
173
+
174
+ ### DNS helpers (custom domains only)
175
+
100
176
  ```bash
101
- ship ./dist -q | ship domains set www.example.com
177
+ ship domains dns www.example.com # Provider name
178
+ ship domains share www.example.com # Shareable setup link
179
+ ship domains records www.example.com -q # TYPE NAME VALUE (one per line)
102
180
  ```
103
181
 
104
- `domains validate` uses exit codes as the answer (the `grep`/`test` convention):
182
+ ### Validation
183
+
184
+ Exit codes as the answer:
185
+
105
186
  ```bash
106
187
  ship domains validate www.example.com -q && echo "valid" || echo "invalid"
107
- # valid → exit 0, outputs normalized name
108
- # invalid → exit 1, no output
109
188
  ```
110
189
 
111
- ## Important Behaviors
190
+ Exit 0 = valid (outputs normalized name). Exit 1 = invalid (no output).
191
+
192
+ ## Output Modes
193
+
194
+ Every command supports three modes:
195
+
196
+ | Flag | Output | When to use |
197
+ |------|--------|-------------|
198
+ | *(default)* | Human-readable | Showing results to the user |
199
+ | `--json` | JSON on stdout | Parsing programmatically |
200
+ | `-q` | Identifier only | Piping between commands |
201
+
202
+ Errors go to stderr in all modes. Exit 0 = success, 1 = error.
112
203
 
113
- - **Labels replace, not append.** `--label foo --label bar` sets labels to `["foo", "bar"]`, removing any existing labels. To keep existing labels, include them in the command.
114
- - **`records` quiet mode** outputs one record per line, space-separated: `TYPE NAME VALUE`. Parseable with awk: `ship domains records <name> -q | awk '{print $3}'` extracts values.
115
- - **`domains list` text mode** does not show domain status. Use `--json` to see which domains are `pending` vs `success`.
204
+ List commands return `{"<resource>s": [...], "cursor": null, "total": N}`. `domains list` text mode omits status use `--json` to see `pending` vs `success`.
116
205
 
117
- ## Command Reference
206
+ ## Commands
118
207
 
119
208
  ### Deployments
120
209
 
121
210
  ```bash
122
- ship ./dist # Shortcut for deployments upload
123
- ship deployments upload <path> # Upload directory or file
124
- ship deployments list # List all deployments
125
- ship deployments get <deployment> # Show deployment details
211
+ ship ./dist # Deploy (shortcut)
212
+ ship deployments upload <path> # Deploy (explicit)
213
+ ship deployments list # List all
214
+ ship deployments get <deployment> # Details
126
215
  ship deployments set <deployment> # Update labels (--label)
127
- ship deployments remove <deployment> # Delete permanently (async)
216
+ ship deployments remove <deployment> # Delete (async)
128
217
  ```
129
218
 
130
219
  ### Domains
131
220
 
132
221
  ```bash
133
- ship domains list # List all domains
134
- ship domains get <name> # Show domain details
135
- ship domains set <name> [deployment] # Create, link, or update labels
136
- ship domains validate <name> # Pre-flight check (exit 1 if invalid)
137
- ship domains records <name> # Required DNS records (external only)
138
- ship domains dns <name> # DNS provider lookup (external only)
139
- ship domains share <name> # Shareable setup link (external only)
140
- ship domains verify <name> # Trigger DNS verification (external only)
141
- ship domains remove <name> # Delete permanently
222
+ ship domains list # List all
223
+ ship domains get <name> # Details
224
+ ship domains set <name> [deployment] # Create, link, or update
225
+ ship domains validate <name> # Check validity (exit code)
226
+ ship domains records <name> # Required DNS records
227
+ ship domains dns <name> # DNS provider lookup
228
+ ship domains share <name> # Shareable setup link
229
+ ship domains verify <name> # Trigger DNS verification
230
+ ship domains remove <name> # Delete
142
231
  ```
143
232
 
144
233
  ### Account & Tokens
145
234
 
146
235
  ```bash
147
236
  ship whoami # Account info
148
- ship ping # API connectivity check
149
- ship tokens create # Create deploy token (secret shown once)
237
+ ship ping # Connectivity check
238
+ ship tokens create # New deploy token (shown once)
150
239
  ship tokens create --ttl 3600 # With expiry (seconds)
151
- ship tokens list # List tokens (management IDs only)
152
- ship tokens remove <token> # Delete token
240
+ ship tokens list # List tokens
241
+ ship tokens remove <token> # Revoke
153
242
  ```
154
243
 
155
- ## Global Flags
244
+ ## Flags
156
245
 
157
246
  | Flag | Purpose |
158
247
  |------|---------|
159
248
  | `--json` | JSON output |
160
- | `-q, --quiet` | Key identifier only |
249
+ | `-q, --quiet` | Identifier only |
161
250
  | `--api-key <key>` | API key for this command |
162
251
  | `--deploy-token <token>` | Single-use deploy token |
163
- | `--label <label>` | Set label (repeatable, replaces all existing) |
164
- | `--no-path-detect` | Disable build output auto-detection |
165
- | `--no-spa-detect` | Disable SPA rewrite auto-configuration |
166
- | `--no-color` | Plain text output |
167
- | `--config <file>` | Custom config file path |
168
-
169
- ## Error Patterns
170
-
171
- | Error | Meaning | Action |
172
- |-------|---------|--------|
173
- | `authentication required` | No credentials | Use `--api-key`, `--deploy-token`, or `ship config` |
174
- | `authentication failed` | Invalid credentials | Check key/token validity |
175
- | `not found` | Resource doesn't exist | Verify the ID/name |
176
- | `path does not exist` | Deploy path invalid | Check the file/directory path |
177
- | `invalid domain name` | Bad domain format | Must be a subdomain (e.g., `www.example.com`) |
178
- | `DNS information is only available for external domains` | Used records/dns/share on `*.shipstatic.com` | Only custom domains need DNS setup |
179
- | `DNS verification already requested recently` | Rate limited | Wait and retry |
252
+ | `--label <label>` | Set label (repeatable, replaces all) |
253
+ | `--no-path-detect` | Skip build output auto-detection |
254
+ | `--no-spa-detect` | Skip SPA rewrite auto-configuration |
255
+ | `--no-color` | Disable colors |
256
+ | `--config <file>` | Custom config path |
257
+
258
+ ## Errors
259
+
260
+ | Message | Cause | Fix |
261
+ |---------|-------|-----|
262
+ | `too many requests` | Rate limited | Wait, or set an API key |
263
+ | `authentication failed` | Bad credentials | Check key/token |
264
+ | `not found` | No such resource | Verify the ID/name |
265
+ | `path does not exist` | Bad deploy path | Check file/directory |
266
+ | `invalid domain name` | Not a subdomain | Use `www.example.com`, not `example.com` |
267
+ | `DNS information is only available for external domains` | DNS op on internal domain | Only custom domains need DNS |
268
+ | `DNS verification already requested recently` | Rate limited | Wait |
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _shipstatic_types from '@shipstatic/types';
2
- import { DeploymentUploadOptions, ProgressInfo, StaticFile, Domain, Deployment, DeploymentListResponse, DomainListResponse, DomainDnsResponse, DomainRecordsResponse, DomainValidateResponse, TokenCreateResponse, TokenListResponse, Account, ConfigResponse, ResolvedConfig, DeployInput, AccountResource, DeploymentResource, DomainResource, TokenResource, ValidatableFile, FileValidationResult } from '@shipstatic/types';
2
+ import { DeploymentUploadOptions, ProgressInfo, StaticFile, Domain, DeploymentCreateResponse, DeploymentListResponse, Deployment, DomainListResponse, DomainDnsResponse, DomainRecordsResponse, DomainValidateResponse, TokenCreateResponse, TokenListResponse, Account, ConfigResponse, ResolvedConfig, DeployInput, AccountResource, DeploymentResource, DomainResource, TokenResource, ValidatableFile, FileValidationResult } from '@shipstatic/types';
3
3
  export * from '@shipstatic/types';
4
4
  export { Account, AccountResource, DEFAULT_API, DeployInput, Deployment, DeploymentResource, Domain, DomainResource, ErrorType, FileValidationStatus as FILE_VALIDATION_STATUS, PingResponse, ResolvedConfig, ShipError, StaticFile, TokenResource } from '@shipstatic/types';
5
5
 
@@ -208,7 +208,7 @@ declare class ApiHttp extends SimpleEvents {
208
208
  private parseResponse;
209
209
  private handleResponseError;
210
210
  private handleFetchError;
211
- deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<Deployment>;
211
+ deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<DeploymentCreateResponse>;
212
212
  listDeployments(): Promise<DeploymentListResponse>;
213
213
  getDeployment(id: string): Promise<Deployment>;
214
214
  updateDeploymentLabels(id: string, labels: string[]): Promise<Deployment>;
@@ -230,6 +230,7 @@ declare class ApiHttp extends SimpleEvents {
230
230
  createToken(ttl?: number, labels?: string[]): Promise<TokenCreateResponse>;
231
231
  listTokens(): Promise<TokenListResponse>;
232
232
  removeToken(token: string): Promise<void>;
233
+ fetchAgentToken(): Promise<TokenCreateResponse>;
233
234
  getAccount(): Promise<Account>;
234
235
  getConfig(): Promise<ConfigResponse>;
235
236
  ping(): Promise<boolean>;
@@ -676,7 +677,7 @@ declare function getCurrentConfig(): ConfigResponse;
676
677
  * - **Server-processed** (build/prerender): Source files destined for server-side build.
677
678
  * Junk filtering and MD5 checksums only — the build service validates the output.
678
679
  *
679
- * Both modes share: environment check → extract paths → filter junkoptimize paths → MD5.
680
+ * Both modes share: environment check → extract paths → optimize pathsfilter junk → MD5.
680
681
  */
681
682
 
682
683
  /**