@envshipcom/cli 0.2.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/LICENSE +21 -0
- package/README.md +264 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +10 -0
- package/dist/index.js +2192 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EnvShip
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# EnvShip CLI
|
|
2
|
+
|
|
3
|
+
EnvShip delivers encrypted `.env` bundles to CI, Docker, VPS, Laravel, Node, and other deployments. Humans set up workspaces, projects, bundles, channels, and access in the OAuth/passkey Dashboard. The open source CLI is the deploy and automation surface: connect CLI Workstations, install scoped machines, pull encrypted current bundles, and run processes without sending plaintext secrets to EnvShip.
|
|
4
|
+
|
|
5
|
+
Package name: `@envshipcom/cli`
|
|
6
|
+
Binary command: `envship`
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm dlx @envshipcom/cli --help
|
|
12
|
+
npx @envshipcom/cli --help
|
|
13
|
+
npm install -g @envshipcom/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
For people:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
envship auth connect --code <one-time-code>
|
|
22
|
+
envship channel pull web/staging --out .env --force
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Dashboard generates short-lived setup codes after a trusted device unlock. The CLI saves a local Workstation identity and handles the encryption details behind the scenes.
|
|
26
|
+
|
|
27
|
+
For one-off servers:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
envship machine install --name web-production --channel web/production
|
|
31
|
+
envship channel pull web/production --out .env --force
|
|
32
|
+
envship channel run web/production -- npm start
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For CI, autoscaling, and fresh spinups:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
envship machine deploy-token-create --project <project-id> --channel web/production
|
|
39
|
+
ENVSHIP_DEPLOY_TOKEN=edt_...
|
|
40
|
+
envship machine install --deploy-token "$ENVSHIP_DEPLOY_TOKEN" --name web-production
|
|
41
|
+
envship channel pull web/production --out .env --force
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For live file updates from the CDN runtime path:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
envship envsync watch --channel web/production --out .env
|
|
48
|
+
envship envsync install --channel web/production --out /etc/envship/web.env --interval 60s
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Check runtime compatibility:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
envship update check
|
|
55
|
+
envship update autoupdate off
|
|
56
|
+
envship update autoupdate on
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Security Model
|
|
60
|
+
|
|
61
|
+
- OAuth proves account identity; it does not decrypt secrets by itself.
|
|
62
|
+
- Human browser editing unlocks with a Trusted Browser Device in the Dashboard. Passkey PRF is the high-security upgrade where supported.
|
|
63
|
+
- Browser Dashboard access is included with the signed-in account. CLI Workstations cover trusted coding environments like a laptop, desktop, dev container, or Codespace.
|
|
64
|
+
- Machine identities are project-scoped installed online servers/runners, separate from human CLI Workstations.
|
|
65
|
+
- Runtime slots are shared by active manual machine identities and reusable deploy-token reserved capacity. Use the pool in any mix, such as all manual machines, all reserved deploy-token capacity, or a combination.
|
|
66
|
+
- For autoscaling platforms such as AWS Elastic Beanstalk, reserve enough Runtime slots on the reusable deploy token for the number of active instances that token is allowed to run.
|
|
67
|
+
- If active runtime identities exceed the workspace plan, EnvShip allows a 7-day upgrade grace before blocking new machine installs. The recommended PayPal upgrade path is a separate difference subscription unless billing can be consolidated safely.
|
|
68
|
+
- Reusable deploy tokens are separate bootstrap credentials for fresh installs/autoscaling. They reserve Runtime slots while active, are shown once, hashed server-side, scoped to allowed channels, revocable, rotatable, and audited. Rotating a token does not consume another slot.
|
|
69
|
+
- Runtime pulls prefer public encrypted current descriptors and immutable encrypted bundle objects from the EnvShip CDN. The public CDN contains ciphertext, hashes, and signed runtime metadata only.
|
|
70
|
+
- Workspace admins may define encrypted identity overlays for one CLI Workstation, machine, or deploy token. The CLI decrypts the shared channel env locally, applies the authorized identity overlay locally, and writes or runs with the merged result.
|
|
71
|
+
- EnvShip never receives plaintext dotenv values, private vault keys, passkey PRF outputs, vault unlock keys, private machine keys, or unwrapped bundle keys.
|
|
72
|
+
|
|
73
|
+
## Commands
|
|
74
|
+
|
|
75
|
+
### `envship auth login`
|
|
76
|
+
|
|
77
|
+
Creates a device approval code and opens the browser authorization URL.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
envship auth login
|
|
81
|
+
envship auth login --headless
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### `envship auth connect`
|
|
85
|
+
|
|
86
|
+
Connects a CLI Workstation with a one-time Dashboard code. Browser Dashboard use is included with the account; each connected CLI Workstation counts against the user's workstation allowance.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
envship auth connect --code cli_xxxxxxxxxxxxxxxxxxxx
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `envship auth whoami` and `envship auth logout`
|
|
93
|
+
|
|
94
|
+
Inspect or clear the local EnvShip session and machine credential.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
envship auth whoami
|
|
98
|
+
envship auth logout
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### `envship setup`
|
|
102
|
+
|
|
103
|
+
Creates the first workspace, project, bundle, and channels for the signed-in session. Dashboard onboarding is the recommended path for production setup because it also walks humans through Authorized Devices and plan selection.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
envship setup --workspace "My Workspace" --project "My First Project" --bundle web --channels staging,production
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `envship machine install`
|
|
110
|
+
|
|
111
|
+
Installs a scoped machine identity. Use interactive approval for one-off servers, or a reusable deploy token for CI/autoscaling/fresh spinups. Machine identities are the installed runtime identities.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
envship machine install --name github-actions-production --channel web/production
|
|
115
|
+
envship machine install --deploy-token "$ENVSHIP_DEPLOY_TOKEN" --name elastic-beanstalk-web
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Inspect or revoke a machine:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
envship machine status
|
|
122
|
+
envship machine revoke --yes
|
|
123
|
+
envship machine revoke --id 00000000-0000-0000-0000-000000000000 --yes
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Deploy Tokens
|
|
127
|
+
|
|
128
|
+
Create, list, revoke, or rotate reusable deploy tokens. Tokens are shown once; store them like any other production deploy credential. Listing and status output never re-show token values. Active deploy tokens reserve Runtime slots for autoscaling/fresh installs while manual machine identities use Runtime slots directly.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
envship machine deploy-token-create --project <project-id> --channel web/production
|
|
132
|
+
envship machine deploy-token-list --project <project-id>
|
|
133
|
+
envship machine deploy-token-revoke <token-id> --yes
|
|
134
|
+
envship machine deploy-token-rotate <token-id> --yes
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### `envship channel pull`
|
|
138
|
+
|
|
139
|
+
Fetches the current encrypted channel, verifies signed hashes, decrypts locally with the installed Workstation or machine identity, applies any authorized identity overlay, and writes dotenv output.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
envship channel pull web/staging --out .env --force
|
|
143
|
+
envship channel pull web/staging --out -
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
When the channel has a public encrypted descriptor, the CLI fetches the descriptor and bundle from the CDN path so runtime pulls do not hit Worker/D1 on every request. If the descriptor is unavailable in local/debug environments, the CLI falls back to the Worker pull route. Production runtime pulls always respect the CDN descriptor path; Dashboard Deploy History shows whether a saved encrypted version is runtime-ready or waiting for CDN refresh.
|
|
147
|
+
|
|
148
|
+
### `envship channel run`
|
|
149
|
+
|
|
150
|
+
Runs a command with locally decrypted env values, including any authorized identity overlay.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
envship channel run web/production -- npm run deploy
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### `envship envsync`
|
|
157
|
+
|
|
158
|
+
EnvSync keeps an already-authorized channel output file current without polling Worker/D1.
|
|
159
|
+
|
|
160
|
+
Watch mode runs in the foreground:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
envship envsync watch --channel web/production --out .env
|
|
164
|
+
envship envsync watch --channel web/production --out .env --on-change -- npm run reload
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Daemon mode writes a service configuration for your operating system. Review and install it with your normal service manager:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
envship envsync install --channel web/production --out /etc/envship/web.env --interval 60s
|
|
171
|
+
envship envsync status --name web-production
|
|
172
|
+
envship envsync uninstall --name web-production --yes
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
EnvSync uses the local scoped runtime profile created by machine install or deploy-token install, then checks the stable public descriptor URL with cache validators. If nothing changed, it skips immutable bundle downloads. If a descriptor changes, EnvSync verifies the channel scope and encrypted bundle hash, decrypts locally, writes the target file atomically, and only then runs an optional `--on-change` hook.
|
|
176
|
+
|
|
177
|
+
There is no freshness bypass. EnvSync remains cache-respecting by design so runtime traffic stays on R2/CDN instead of becoming a Worker/D1 hot path.
|
|
178
|
+
|
|
179
|
+
### `envship update`
|
|
180
|
+
|
|
181
|
+
Checks the signed cacheable runtime-version descriptor and reports whether this CLI is current, recommended to update, or below the minimum supported version. AutoUpdate is on by default for Free/FreeEnv-compatible identities where supported. Paid workspaces may pin or disable AutoUpdate per Workstation or machine, but EnvShip will warn when a pinned runtime approaches a compatibility cutoff.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
envship update check
|
|
185
|
+
envship update autoupdate off
|
|
186
|
+
envship update autoupdate on
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Channel Inspection And Rollback
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
envship channel list
|
|
193
|
+
envship channel versions web/staging
|
|
194
|
+
envship channel rollback web/staging --version-id 00000000-0000-0000-0000-000000000000 --yes
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Grants And Administration
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
envship grant create web/staging --keyset kst_example --preset editor
|
|
201
|
+
envship grant list web/staging
|
|
202
|
+
envship invite create --email teammate@example.com --role viewer
|
|
203
|
+
envship invite list
|
|
204
|
+
envship member list
|
|
205
|
+
envship project list
|
|
206
|
+
envship audit list
|
|
207
|
+
envship billing status
|
|
208
|
+
envship billing checkout --plan pro
|
|
209
|
+
envship doctor
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Use `--json` on any command for machine-readable output. Commands that intentionally write decrypted dotenv data to stdout, such as `envship channel pull --out -`, cannot be combined with `--json`.
|
|
213
|
+
|
|
214
|
+
## Configuration
|
|
215
|
+
|
|
216
|
+
EnvShip stores local CLI config at:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
~/.envship/config.json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The config file may contain a session cookie and machine signing credential. It is written with owner-only permissions where the operating system supports them. Do not share it, paste it into support requests, or commit it.
|
|
223
|
+
|
|
224
|
+
Safe inspection:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
envship config get
|
|
228
|
+
envship config get apiBaseUrl
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
`envship config get` redacts credential-bearing fields and only exposes safe config keys.
|
|
232
|
+
|
|
233
|
+
Useful environment variables:
|
|
234
|
+
|
|
235
|
+
- `ENVSHIP_API_BASE_URL`: API origin. Defaults to `https://api.envship.com`.
|
|
236
|
+
- `ENVSHIP_APP_URL`: browser app origin. Defaults to `https://envship.com`.
|
|
237
|
+
- `ENVSHIP_SESSION`: session cookie value for local tests or explicit automation.
|
|
238
|
+
- `ENVSHIP_DEPLOY_TOKEN`: reusable deploy token for non-interactive machine install.
|
|
239
|
+
- `ENVSHIP_RUNTIME_VERSION_SIGNING_PUBLIC_JWK`: optional local trust anchor for verifying signed runtime-version metadata in development and staging.
|
|
240
|
+
|
|
241
|
+
Do not commit `ENVSHIP_SESSION`, `ENVSHIP_DEPLOY_TOKEN`, or `~/.envship/config.json`.
|
|
242
|
+
|
|
243
|
+
## Troubleshooting
|
|
244
|
+
|
|
245
|
+
- `Channel web/staging was not found`: run Dashboard setup or `envship setup`, then check that the machine is scoped to that channel.
|
|
246
|
+
- `machine_not_configured`: run `envship machine install` or install with a reusable deploy token.
|
|
247
|
+
- `deploy_token_invalid`: create or rotate a deploy token from a project manager/owner session.
|
|
248
|
+
- `json_stdout_conflict`: write decrypted dotenv output to a file, or omit `--json` when using `--out -`.
|
|
249
|
+
- `envship doctor --json` exits nonzero when readiness checks fail, while keeping stdout as one parseable JSON object.
|
|
250
|
+
- `Encrypted bundle hash mismatch`: EnvShip refused to decrypt because the fetched object did not match signed metadata.
|
|
251
|
+
- `missing_publish_capability`: your user or machine is not allowed to publish this channel.
|
|
252
|
+
- Local development should prefer `--api-url http://127.0.0.1:8787` for CLI smoke checks. The CLI does not disable TLS verification globally.
|
|
253
|
+
|
|
254
|
+
## npm Publish Checklist
|
|
255
|
+
|
|
256
|
+
1. Create or join the npm organization/scope `envshipcom`.
|
|
257
|
+
2. Run `npm login`.
|
|
258
|
+
3. Confirm package metadata in `packages/cli/package.json`.
|
|
259
|
+
4. Build: `pnpm --filter @envshipcom/cli build`.
|
|
260
|
+
5. Dry run: `npm pack --dry-run` from `packages/cli`.
|
|
261
|
+
6. Run package smoke from the repo root: `pnpm smoke:cli-package`.
|
|
262
|
+
7. Publish only after explicit approval: `npm publish --access public` from `packages/cli`.
|
|
263
|
+
8. Verify: `https://www.npmjs.com/package/@envshipcom/cli`.
|
|
264
|
+
9. Test from a clean directory: `pnpm dlx @envshipcom/cli --help` and `npx @envshipcom/cli --help`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|