vaultsy-cli 0.1.4 → 0.1.6
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 +143 -47
- package/dist/index.js +336 -261
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# vaultsy-cli
|
|
2
2
|
|
|
3
|
-
Official CLI for [Vaultsy](https://vaultsy.app) — pull, push, and inject secrets from your terminal without secrets ever living outside your encrypted store.
|
|
3
|
+
Official CLI for [Vaultsy](https://vaultsy.vercel.app) — pull, push, and inject secrets from your terminal without secrets ever living outside your encrypted store.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/vaultsy-cli)
|
|
6
|
+
[](https://www.npmjs.com/package/vaultsy-cli)
|
|
7
|
+
[](./LICENSE)
|
|
4
8
|
|
|
5
9
|
---
|
|
6
10
|
|
|
@@ -17,19 +21,22 @@ bun add -g vaultsy-cli
|
|
|
17
21
|
## Quick Start
|
|
18
22
|
|
|
19
23
|
```sh
|
|
20
|
-
# 1. Authenticate
|
|
24
|
+
# 1. Authenticate (opens a token prompt — no URL needed)
|
|
21
25
|
vaultsy login
|
|
22
26
|
|
|
23
|
-
# 2.
|
|
27
|
+
# 2. Create a new project (or skip if you already have one)
|
|
28
|
+
vaultsy create
|
|
29
|
+
|
|
30
|
+
# 3. Pin a project to the current directory (optional but recommended)
|
|
24
31
|
vaultsy init
|
|
25
32
|
|
|
26
|
-
#
|
|
33
|
+
# 4. Pull secrets to a local .env file
|
|
27
34
|
vaultsy pull
|
|
28
35
|
|
|
29
|
-
#
|
|
36
|
+
# 5. Push local changes back up
|
|
30
37
|
vaultsy push
|
|
31
38
|
|
|
32
|
-
#
|
|
39
|
+
# 6. Run a command with secrets injected — nothing ever touches disk
|
|
33
40
|
vaultsy run -- node server.js
|
|
34
41
|
```
|
|
35
42
|
|
|
@@ -37,29 +44,29 @@ vaultsy run -- node server.js
|
|
|
37
44
|
|
|
38
45
|
## Authentication
|
|
39
46
|
|
|
40
|
-
Vaultsy uses API tokens.
|
|
47
|
+
Vaultsy uses API tokens. Create one at [vaultsy.vercel.app/dashboard/settings](https://vaultsy.vercel.app/dashboard/settings).
|
|
41
48
|
|
|
42
49
|
```sh
|
|
43
50
|
vaultsy login
|
|
44
51
|
```
|
|
45
52
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
The CLI will:
|
|
54
|
+
1. Show you a link to create a token at the dashboard
|
|
55
|
+
2. Ask you to paste the token
|
|
56
|
+
3. Verify it against the server
|
|
57
|
+
4. Save it to `~/.vaultsy/config.json` with `600` permissions (owner read/write only)
|
|
51
58
|
|
|
52
59
|
### Options
|
|
53
60
|
|
|
54
61
|
| Flag | Description |
|
|
55
62
|
|---|---|
|
|
56
63
|
| `-t, --token <token>` | Provide the token directly (skips the interactive prompt) |
|
|
57
|
-
| `-u, --base-url <url>` |
|
|
64
|
+
| `-u, --base-url <url>` | Override the base URL (for self-hosted instances) |
|
|
58
65
|
|
|
59
66
|
### Non-interactive / CI usage
|
|
60
67
|
|
|
61
68
|
```sh
|
|
62
|
-
vaultsy login --token "$VAULTSY_TOKEN"
|
|
69
|
+
vaultsy login --token "$VAULTSY_TOKEN"
|
|
63
70
|
```
|
|
64
71
|
|
|
65
72
|
---
|
|
@@ -72,7 +79,10 @@ Authenticate and save credentials to `~/.vaultsy/config.json`.
|
|
|
72
79
|
|
|
73
80
|
```sh
|
|
74
81
|
vaultsy login
|
|
75
|
-
vaultsy login --token <token>
|
|
82
|
+
vaultsy login --token <token>
|
|
83
|
+
|
|
84
|
+
# Self-hosted instance
|
|
85
|
+
vaultsy login --token <token> --base-url https://my-vaultsy.example.com
|
|
76
86
|
```
|
|
77
87
|
|
|
78
88
|
---
|
|
@@ -87,20 +97,42 @@ vaultsy logout
|
|
|
87
97
|
|
|
88
98
|
---
|
|
89
99
|
|
|
100
|
+
### `vaultsy create`
|
|
101
|
+
|
|
102
|
+
Create a new project on your Vaultsy instance.
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
# Interactive prompt
|
|
106
|
+
vaultsy create
|
|
107
|
+
|
|
108
|
+
# With project title
|
|
109
|
+
vaultsy create --title "My Project"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
You'll be asked if you want to save the project config to `vaultsy.json` in the current directory. This is optional but recommended.
|
|
113
|
+
|
|
114
|
+
#### Options
|
|
115
|
+
|
|
116
|
+
| Flag | Description |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `-t, --title <title>` | Project title (skips the interactive prompt) |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
90
122
|
### `vaultsy whoami`
|
|
91
123
|
|
|
92
124
|
Show the currently authenticated user.
|
|
93
125
|
|
|
94
126
|
```sh
|
|
95
127
|
vaultsy whoami
|
|
96
|
-
#
|
|
128
|
+
# ✓ Logged in as John Doe <john@example.com>
|
|
97
129
|
```
|
|
98
130
|
|
|
99
131
|
---
|
|
100
132
|
|
|
101
133
|
### `vaultsy init`
|
|
102
134
|
|
|
103
|
-
Create a `vaultsy.json` in the current directory.
|
|
135
|
+
Create a `vaultsy.json` in the current directory. Pins a project ID and default environment so every other command works with no arguments.
|
|
104
136
|
|
|
105
137
|
```sh
|
|
106
138
|
vaultsy init
|
|
@@ -115,7 +147,55 @@ Creates `vaultsy.json`:
|
|
|
115
147
|
}
|
|
116
148
|
```
|
|
117
149
|
|
|
118
|
-
Commit this file — it contains only a project ID, never any secret values.
|
|
150
|
+
The CLI walks up the directory tree to find `vaultsy.json`, the same way `git` finds `.git`. Commit this file safely — it contains only a project ID, never any secret values.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### `vaultsy envs [project]`
|
|
155
|
+
|
|
156
|
+
Show all secrets for a project across all four environments at once. Values are hidden by default.
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
# Interactive project picker
|
|
160
|
+
vaultsy envs
|
|
161
|
+
|
|
162
|
+
# Explicit project
|
|
163
|
+
vaultsy envs <project-id>
|
|
164
|
+
|
|
165
|
+
# Single environment only
|
|
166
|
+
vaultsy envs --env production
|
|
167
|
+
|
|
168
|
+
# Reveal secret values
|
|
169
|
+
vaultsy envs --show-values
|
|
170
|
+
vaultsy envs --env staging --show-values
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Output example:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
● DEVELOPMENT
|
|
177
|
+
────────────────────────────────────────────────────────────
|
|
178
|
+
KEY VALUE
|
|
179
|
+
·······································
|
|
180
|
+
DATABASE_URL ●●●●●●●●●●●●
|
|
181
|
+
NEXT_PUBLIC_URL ●●●●●●●●●●●●
|
|
182
|
+
2 secrets
|
|
183
|
+
|
|
184
|
+
● STAGING
|
|
185
|
+
────────────────────────────────────────────────────────────
|
|
186
|
+
KEY VALUE
|
|
187
|
+
·······································
|
|
188
|
+
DATABASE_URL ●●●●●●●●●●●●
|
|
189
|
+
SECRET_KEY ●●●●●●●●●●●●
|
|
190
|
+
2 secrets
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### Options
|
|
194
|
+
|
|
195
|
+
| Flag | Description |
|
|
196
|
+
|---|---|
|
|
197
|
+
| `-e, --env <env>` | Show only one environment (`development`, `staging`, `preview`, `production`) |
|
|
198
|
+
| `-s, --show-values` | Reveal secret values in the output |
|
|
119
199
|
|
|
120
200
|
---
|
|
121
201
|
|
|
@@ -127,7 +207,7 @@ Pull all secrets for an environment and write them to a local `.env` file.
|
|
|
127
207
|
# Interactive — picks project and env from a list
|
|
128
208
|
vaultsy pull
|
|
129
209
|
|
|
130
|
-
# With vaultsy.json in the current directory
|
|
210
|
+
# With vaultsy.json in the current directory (no args needed)
|
|
131
211
|
vaultsy pull
|
|
132
212
|
|
|
133
213
|
# Explicit
|
|
@@ -138,10 +218,13 @@ vaultsy pull <project-id> production --output .env.local
|
|
|
138
218
|
```
|
|
139
219
|
|
|
140
220
|
**Default output file:**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
221
|
+
|
|
222
|
+
| Environment | File |
|
|
223
|
+
|---|---|
|
|
224
|
+
| `development` | `.env` |
|
|
225
|
+
| `staging` | `.env.staging` |
|
|
226
|
+
| `preview` | `.env.preview` |
|
|
227
|
+
| `production` | `.env.production` |
|
|
145
228
|
|
|
146
229
|
The CLI warns you if the output file is not in `.gitignore`.
|
|
147
230
|
|
|
@@ -168,7 +251,7 @@ vaultsy push <project-id> production
|
|
|
168
251
|
# Push from a custom file
|
|
169
252
|
vaultsy push <project-id> production --input .env.local
|
|
170
253
|
|
|
171
|
-
# Skip the confirmation prompt
|
|
254
|
+
# Skip the confirmation prompt (useful in CI)
|
|
172
255
|
vaultsy push <project-id> production --yes
|
|
173
256
|
```
|
|
174
257
|
|
|
@@ -259,7 +342,8 @@ vaultsy run -- node server.js
|
|
|
259
342
|
**Precedence:** variables already set in your shell take priority over secrets from Vaultsy. This lets you override a single variable locally without editing the remote store:
|
|
260
343
|
|
|
261
344
|
```sh
|
|
262
|
-
PORT
|
|
345
|
+
# PORT comes from your shell; everything else comes from Vaultsy
|
|
346
|
+
PORT=4000 vaultsy run -- node server.js
|
|
263
347
|
```
|
|
264
348
|
|
|
265
349
|
The child process shares `stdin`, `stdout`, and `stderr` with the CLI. Signals (`SIGINT`, `SIGTERM`, `SIGHUP`) are forwarded to the child, so `Ctrl+C` works as expected.
|
|
@@ -268,7 +352,7 @@ The child process shares `stdin`, `stdout`, and `stderr` with the CLI. Signals (
|
|
|
268
352
|
|
|
269
353
|
## Project Config (`vaultsy.json`)
|
|
270
354
|
|
|
271
|
-
Placing a `vaultsy.json` in your project root
|
|
355
|
+
Placing a `vaultsy.json` in your project root means you never have to pass `<project-id>` or `<env>` as arguments.
|
|
272
356
|
|
|
273
357
|
```json
|
|
274
358
|
{
|
|
@@ -280,59 +364,71 @@ Placing a `vaultsy.json` in your project root lets you run all commands without
|
|
|
280
364
|
| Field | Required | Description |
|
|
281
365
|
|---|---|---|
|
|
282
366
|
| `project` | Yes | The project ID from your Vaultsy dashboard |
|
|
283
|
-
| `defaultEnv` | No | Default environment
|
|
284
|
-
|
|
285
|
-
The CLI walks up the directory tree to find `vaultsy.json`, the same way `git` finds `.git`. You can commit this file safely — it contains no secrets.
|
|
367
|
+
| `defaultEnv` | No | Default environment when no `[env]` argument is given |
|
|
286
368
|
|
|
287
369
|
---
|
|
288
370
|
|
|
289
371
|
## CI/CD Usage
|
|
290
372
|
|
|
291
|
-
### GitHub Actions
|
|
373
|
+
### GitHub Actions — pull secrets before build
|
|
292
374
|
|
|
293
375
|
```yaml
|
|
294
376
|
- name: Pull secrets
|
|
295
377
|
env:
|
|
296
378
|
VAULTSY_TOKEN: ${{ secrets.VAULTSY_TOKEN }}
|
|
297
379
|
run: |
|
|
298
|
-
npx vaultsy-cli login --token "$VAULTSY_TOKEN"
|
|
299
|
-
npx vaultsy-cli pull
|
|
380
|
+
npx vaultsy-cli login --token "$VAULTSY_TOKEN"
|
|
381
|
+
npx vaultsy-cli pull <project-id> production --output .env --yes
|
|
300
382
|
```
|
|
301
383
|
|
|
302
|
-
###
|
|
384
|
+
### GitHub Actions — inject secrets into a command
|
|
303
385
|
|
|
304
386
|
```yaml
|
|
305
|
-
- name:
|
|
387
|
+
- name: Run with secrets injected
|
|
306
388
|
env:
|
|
307
389
|
VAULTSY_TOKEN: ${{ secrets.VAULTSY_TOKEN }}
|
|
308
390
|
run: |
|
|
309
391
|
npx vaultsy-cli login --token "$VAULTSY_TOKEN"
|
|
310
|
-
npx vaultsy-cli run
|
|
392
|
+
npx vaultsy-cli run <project-id> production -- node server.js
|
|
311
393
|
```
|
|
312
394
|
|
|
395
|
+
> Store your Vaultsy API token as a GitHub Actions secret (`VAULTSY_TOKEN`) in your repository settings under **Settings → Secrets and variables → Actions**.
|
|
396
|
+
|
|
313
397
|
---
|
|
314
398
|
|
|
315
399
|
## Security
|
|
316
400
|
|
|
317
|
-
- The API token is stored in `~/.vaultsy/config.json` with `0600` permissions — never readable by other users.
|
|
318
|
-
- Secret **values** are never printed to stdout unless
|
|
319
|
-
- The `run` command uses `shell: false` when spawning the child process to prevent secrets
|
|
320
|
-
- The `pull` command warns if the output `.env` file is not in `.gitignore`.
|
|
321
|
-
-
|
|
401
|
+
- The API token is stored in `~/.vaultsy/config.json` with `0600` permissions — never readable by other users on the machine.
|
|
402
|
+
- Secret **values** are never printed to stdout unless you explicitly pass `--show-values`.
|
|
403
|
+
- The `run` command uses `shell: false` when spawning the child process to prevent secrets appearing in `ps` output.
|
|
404
|
+
- The `pull` command warns if the output `.env` file is not listed in `.gitignore`.
|
|
405
|
+
- All communication with the server uses HTTPS. Use `--base-url http://...` only for local development.
|
|
322
406
|
|
|
323
407
|
---
|
|
324
408
|
|
|
325
409
|
## Environments
|
|
326
410
|
|
|
327
|
-
| Name | Description |
|
|
328
|
-
|
|
329
|
-
| `development` | Local development
|
|
330
|
-
| `staging` | Staging / QA
|
|
331
|
-
| `preview` | Preview / PR deployments |
|
|
332
|
-
| `production` | Production
|
|
411
|
+
| Name | Description | Default file |
|
|
412
|
+
|---|---|---|
|
|
413
|
+
| `development` | Local development | `.env` |
|
|
414
|
+
| `staging` | Staging / QA | `.env.staging` |
|
|
415
|
+
| `preview` | Preview / PR deployments | `.env.preview` |
|
|
416
|
+
| `production` | Production | `.env.production` |
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Self-Hosting
|
|
421
|
+
|
|
422
|
+
If you run your own instance of Vaultsy, pass `--base-url` when logging in:
|
|
423
|
+
|
|
424
|
+
```sh
|
|
425
|
+
vaultsy login --base-url https://my-vaultsy.example.com
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
The base URL is saved to `~/.vaultsy/config.json` and used for all subsequent commands automatically.
|
|
333
429
|
|
|
334
430
|
---
|
|
335
431
|
|
|
336
432
|
## License
|
|
337
433
|
|
|
338
|
-
MIT
|
|
434
|
+
MIT © [Ayush Kumar](https://github.com/Ayushkumar48)
|