vaultsy-cli 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +114 -43
  2. package/dist/index.js +7 -13
  3. 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
+ [![npm version](https://img.shields.io/npm/v/vaultsy-cli)](https://www.npmjs.com/package/vaultsy-cli)
6
+ [![npm downloads](https://img.shields.io/npm/dm/vaultsy-cli)](https://www.npmjs.com/package/vaultsy-cli)
7
+ [![license](https://img.shields.io/npm/l/vaultsy-cli)](./LICENSE)
4
8
 
5
9
  ---
6
10
 
@@ -17,7 +21,7 @@ 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
27
  # 2. Pin a project to the current directory (optional but recommended)
@@ -37,29 +41,29 @@ vaultsy run -- node server.js
37
41
 
38
42
  ## Authentication
39
43
 
40
- Vaultsy uses API tokens. Tokens are created in the web dashboard under **Settings → API Tokens**.
44
+ Vaultsy uses API tokens. Create one at [vaultsy.vercel.app/dashboard/settings](https://vaultsy.vercel.app/dashboard/settings).
41
45
 
42
46
  ```sh
43
47
  vaultsy login
44
48
  ```
45
49
 
46
- You will be prompted for:
47
- - Your Vaultsy base URL (default: `https://vaultsy.app`)
48
- - Your API token (paste it from the dashboard)
49
-
50
- The token is verified against the server and saved to `~/.vaultsy/config.json` with `600` permissions (owner read/write only).
50
+ The CLI will:
51
+ 1. Show you a link to create a token at the dashboard
52
+ 2. Ask you to paste the token
53
+ 3. Verify it against the server
54
+ 4. Save it to `~/.vaultsy/config.json` with `600` permissions (owner read/write only)
51
55
 
52
56
  ### Options
53
57
 
54
58
  | Flag | Description |
55
59
  |---|---|
56
60
  | `-t, --token <token>` | Provide the token directly (skips the interactive prompt) |
57
- | `-u, --base-url <url>` | Base URL of your Vaultsy instance |
61
+ | `-u, --base-url <url>` | Override the base URL (for self-hosted instances) |
58
62
 
59
63
  ### Non-interactive / CI usage
60
64
 
61
65
  ```sh
62
- vaultsy login --token "$VAULTSY_TOKEN" --base-url https://vaultsy.app
66
+ vaultsy login --token "$VAULTSY_TOKEN"
63
67
  ```
64
68
 
65
69
  ---
@@ -72,7 +76,10 @@ Authenticate and save credentials to `~/.vaultsy/config.json`.
72
76
 
73
77
  ```sh
74
78
  vaultsy login
75
- vaultsy login --token <token> --base-url https://vaultsy.app
79
+ vaultsy login --token <token>
80
+
81
+ # Self-hosted instance
82
+ vaultsy login --token <token> --base-url https://my-vaultsy.example.com
76
83
  ```
77
84
 
78
85
  ---
@@ -93,14 +100,14 @@ Show the currently authenticated user.
93
100
 
94
101
  ```sh
95
102
  vaultsy whoami
96
- # Logged in as John Doe <john@example.com>
103
+ # Logged in as John Doe <john@example.com>
97
104
  ```
98
105
 
99
106
  ---
100
107
 
101
108
  ### `vaultsy init`
102
109
 
103
- Create a `vaultsy.json` in the current directory. This pins a project ID and a default environment so you can run `vaultsy pull` / `vaultsy push` with no arguments.
110
+ Create a `vaultsy.json` in the current directory. Pins a project ID and default environment so every other command works with no arguments.
104
111
 
105
112
  ```sh
106
113
  vaultsy init
@@ -115,7 +122,55 @@ Creates `vaultsy.json`:
115
122
  }
116
123
  ```
117
124
 
118
- Commit this file — it contains only a project ID, never any secret values.
125
+ 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.
126
+
127
+ ---
128
+
129
+ ### `vaultsy envs [project]`
130
+
131
+ Show all secrets for a project across all four environments at once. Values are hidden by default.
132
+
133
+ ```sh
134
+ # Interactive project picker
135
+ vaultsy envs
136
+
137
+ # Explicit project
138
+ vaultsy envs <project-id>
139
+
140
+ # Single environment only
141
+ vaultsy envs --env production
142
+
143
+ # Reveal secret values
144
+ vaultsy envs --show-values
145
+ vaultsy envs --env staging --show-values
146
+ ```
147
+
148
+ Output example:
149
+
150
+ ```
151
+ ● DEVELOPMENT
152
+ ────────────────────────────────────────────────────────────
153
+ KEY VALUE
154
+ ·······································
155
+ DATABASE_URL ●●●●●●●●●●●●
156
+ NEXT_PUBLIC_URL ●●●●●●●●●●●●
157
+ 2 secrets
158
+
159
+ ● STAGING
160
+ ────────────────────────────────────────────────────────────
161
+ KEY VALUE
162
+ ·······································
163
+ DATABASE_URL ●●●●●●●●●●●●
164
+ SECRET_KEY ●●●●●●●●●●●●
165
+ 2 secrets
166
+ ```
167
+
168
+ #### Options
169
+
170
+ | Flag | Description |
171
+ |---|---|
172
+ | `-e, --env <env>` | Show only one environment (`development`, `staging`, `preview`, `production`) |
173
+ | `-s, --show-values` | Reveal secret values in the output |
119
174
 
120
175
  ---
121
176
 
@@ -127,7 +182,7 @@ Pull all secrets for an environment and write them to a local `.env` file.
127
182
  # Interactive — picks project and env from a list
128
183
  vaultsy pull
129
184
 
130
- # With vaultsy.json in the current directory
185
+ # With vaultsy.json in the current directory (no args needed)
131
186
  vaultsy pull
132
187
 
133
188
  # Explicit
@@ -138,10 +193,13 @@ vaultsy pull <project-id> production --output .env.local
138
193
  ```
139
194
 
140
195
  **Default output file:**
141
- - `development` → `.env`
142
- - `staging` `.env.staging`
143
- - `preview` → `.env.preview`
144
- - `production` `.env.production`
196
+
197
+ | Environment | File |
198
+ |---|---|
199
+ | `development` | `.env` |
200
+ | `staging` | `.env.staging` |
201
+ | `preview` | `.env.preview` |
202
+ | `production` | `.env.production` |
145
203
 
146
204
  The CLI warns you if the output file is not in `.gitignore`.
147
205
 
@@ -168,7 +226,7 @@ vaultsy push <project-id> production
168
226
  # Push from a custom file
169
227
  vaultsy push <project-id> production --input .env.local
170
228
 
171
- # Skip the confirmation prompt
229
+ # Skip the confirmation prompt (useful in CI)
172
230
  vaultsy push <project-id> production --yes
173
231
  ```
174
232
 
@@ -259,7 +317,8 @@ vaultsy run -- node server.js
259
317
  **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
318
 
261
319
  ```sh
262
- PORT=4000 vaultsy run -- node server.js # PORT=4000 wins; all other secrets come from Vaultsy
320
+ # PORT comes from your shell; everything else comes from Vaultsy
321
+ PORT=4000 vaultsy run -- node server.js
263
322
  ```
264
323
 
265
324
  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 +327,7 @@ The child process shares `stdin`, `stdout`, and `stderr` with the CLI. Signals (
268
327
 
269
328
  ## Project Config (`vaultsy.json`)
270
329
 
271
- Placing a `vaultsy.json` in your project root lets you run all commands without specifying a project ID or environment every time.
330
+ Placing a `vaultsy.json` in your project root means you never have to pass `<project-id>` or `<env>` as arguments.
272
331
 
273
332
  ```json
274
333
  {
@@ -280,59 +339,71 @@ Placing a `vaultsy.json` in your project root lets you run all commands without
280
339
  | Field | Required | Description |
281
340
  |---|---|---|
282
341
  | `project` | Yes | The project ID from your Vaultsy dashboard |
283
- | `defaultEnv` | No | Default environment used when no `[env]` argument is given |
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.
342
+ | `defaultEnv` | No | Default environment when no `[env]` argument is given |
286
343
 
287
344
  ---
288
345
 
289
346
  ## CI/CD Usage
290
347
 
291
- ### GitHub Actions
348
+ ### GitHub Actions — pull secrets before build
292
349
 
293
350
  ```yaml
294
351
  - name: Pull secrets
295
352
  env:
296
353
  VAULTSY_TOKEN: ${{ secrets.VAULTSY_TOKEN }}
297
354
  run: |
298
- npx vaultsy-cli login --token "$VAULTSY_TOKEN" --base-url https://vaultsy.app
299
- npx vaultsy-cli pull my-project production --output .env --yes
355
+ npx vaultsy-cli login --token "$VAULTSY_TOKEN"
356
+ npx vaultsy-cli pull <project-id> production --output .env --yes
300
357
  ```
301
358
 
302
- ### Inject secrets directly into a step
359
+ ### GitHub Actions — inject secrets into a command
303
360
 
304
361
  ```yaml
305
- - name: Start server with secrets injected
362
+ - name: Run with secrets injected
306
363
  env:
307
364
  VAULTSY_TOKEN: ${{ secrets.VAULTSY_TOKEN }}
308
365
  run: |
309
366
  npx vaultsy-cli login --token "$VAULTSY_TOKEN"
310
- npx vaultsy-cli run my-project production -- node server.js
367
+ npx vaultsy-cli run <project-id> production -- node server.js
311
368
  ```
312
369
 
370
+ > Store your Vaultsy API token as a GitHub Actions secret (`VAULTSY_TOKEN`) in your repository settings under **Settings → Secrets and variables → Actions**.
371
+
313
372
  ---
314
373
 
315
374
  ## Security
316
375
 
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 the web dashboard is used directly.
319
- - The `run` command uses `shell: false` when spawning the child process to prevent secrets from appearing in `ps` output.
320
- - The `pull` command warns if the output `.env` file is not in `.gitignore`.
321
- - HTTPS is enforced by default. Use `--base-url http://...` only for local development.
376
+ - The API token is stored in `~/.vaultsy/config.json` with `0600` permissions — never readable by other users on the machine.
377
+ - Secret **values** are never printed to stdout unless you explicitly pass `--show-values`.
378
+ - The `run` command uses `shell: false` when spawning the child process to prevent secrets appearing in `ps` output.
379
+ - The `pull` command warns if the output `.env` file is not listed in `.gitignore`.
380
+ - All communication with the server uses HTTPS. Use `--base-url http://...` only for local development.
322
381
 
323
382
  ---
324
383
 
325
384
  ## Environments
326
385
 
327
- | Name | Description |
328
- |---|---|
329
- | `development` | Local development (default, maps to `.env`) |
330
- | `staging` | Staging / QA environment |
331
- | `preview` | Preview / PR deployments |
332
- | `production` | Production environment |
386
+ | Name | Description | Default file |
387
+ |---|---|---|
388
+ | `development` | Local development | `.env` |
389
+ | `staging` | Staging / QA | `.env.staging` |
390
+ | `preview` | Preview / PR deployments | `.env.preview` |
391
+ | `production` | Production | `.env.production` |
392
+
393
+ ---
394
+
395
+ ## Self-Hosting
396
+
397
+ If you run your own instance of Vaultsy, pass `--base-url` when logging in:
398
+
399
+ ```sh
400
+ vaultsy login --base-url https://my-vaultsy.example.com
401
+ ```
402
+
403
+ The base URL is saved to `~/.vaultsy/config.json` and used for all subsequent commands automatically.
333
404
 
334
405
  ---
335
406
 
336
407
  ## License
337
408
 
338
- MIT
409
+ MIT © [Ayush Kumar](https://github.com/Ayushkumar48)
package/dist/index.js CHANGED
@@ -368,10 +368,7 @@ async function envsCommand(projectArg, opts) {
368
368
  lines.push(` ${chalk.dim("No secrets.")}`);
369
369
  continue;
370
370
  }
371
- const maxKeyLen = Math.min(
372
- Math.max(...result.secrets.map((s) => s.key.length), 3),
373
- 40
374
- );
371
+ const maxKeyLen = Math.min(Math.max(...result.secrets.map((s) => s.key.length), 3), 40);
375
372
  const maxValLen = opts.showValues ? Math.min(Math.max(...result.secrets.map((s) => s.value.length), 5), 60) : 16;
376
373
  const colHeader = " " + chalk.bold(padEnd("KEY", maxKeyLen)) + chalk.dim(" ") + chalk.bold(padEnd(opts.showValues ? "VALUE" : "VALUE", maxValLen));
377
374
  lines.push(colHeader);
@@ -387,16 +384,12 @@ async function envsCommand(projectArg, opts) {
387
384
  lines.push(` ${key} ${value}`);
388
385
  }
389
386
  lines.push(
390
- " " + chalk.dim(
391
- `${result.secrets.length} secret${result.secrets.length !== 1 ? "s" : ""}`
392
- )
387
+ " " + chalk.dim(`${result.secrets.length} secret${result.secrets.length !== 1 ? "s" : ""}`)
393
388
  );
394
389
  }
395
390
  p.log.message(lines.join("\n"));
396
391
  if (!opts.showValues) {
397
- p.log.info(
398
- `Values are hidden. Run with ${chalk.cyan("--show-values")} to reveal them.`
399
- );
392
+ p.log.info(`Values are hidden. Run with ${chalk.cyan("--show-values")} to reveal them.`);
400
393
  }
401
394
  p.outro(
402
395
  `${chalk.bold(projectTitle ?? projectId)} \u2014 ${totalSecrets} secret${totalSecrets !== 1 ? "s" : ""} across ${results.length} environment${results.length !== 1 ? "s" : ""}.`
@@ -412,8 +405,9 @@ function envBadge(env) {
412
405
  const color = ENV_COLORS[env];
413
406
  return ` ${color("\u25CF")} ${chalk.bold(color(env.toUpperCase()))}`;
414
407
  }
408
+ var ANSI_REGEX = new RegExp("\x1B\\[[0-9;]*m", "g");
415
409
  function padEnd(str, length) {
416
- const visible = str.replace(/\u001b\[[0-9;]*m/g, "");
410
+ const visible = str.replace(ANSI_REGEX, "");
417
411
  const pad = Math.max(0, length - visible.length);
418
412
  return str + " ".repeat(pad);
419
413
  }
@@ -955,9 +949,9 @@ async function historyCommand(projectArg, envArg) {
955
949
  );
956
950
  p5.outro(chalk5.dim("Done."));
957
951
  }
958
- var ANSI_REGEX = new RegExp("\x1B\\[[0-9;]*m", "g");
952
+ var ANSI_REGEX2 = new RegExp("\x1B\\[[0-9;]*m", "g");
959
953
  function padEnd2(str, length) {
960
- const visible = str.replace(ANSI_REGEX, "");
954
+ const visible = str.replace(ANSI_REGEX2, "");
961
955
  const pad = Math.max(0, length - visible.length);
962
956
  return str + " ".repeat(pad);
963
957
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vaultsy-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Official CLI for Vaultsy — pull, push, and inject secrets from your terminal",
5
5
  "type": "module",
6
6
  "bin": {