@kaynooo/cli-env 0.8.1 → 0.9.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/README.md CHANGED
@@ -10,7 +10,7 @@ bun install -g @kaynooo/cli-env
10
10
 
11
11
  | Command | What it does |
12
12
  | --- | --- |
13
- | `ev list [file]` | every key of the folder's `.env*` files (or one file), secrets masked |
13
+ | `ev list [file]` | every key of the folder's `.env*` files (or one file), secrets masked; `--json` prints `[{file, key, value, secret}]` (as for `get`, `grep` and `show`) |
14
14
  | `ev get KEY [file]` | one key's masked value, from every file that sets it or from one |
15
15
  | `ev grep [-i] <regex> [file...]` | the keys matching the regex (matched against the key, never the value), values masked |
16
16
  | `ev show <rev>:<file>` | an env file as a git revision holds it, values masked |
@@ -18,12 +18,14 @@ bun install -g @kaynooo/cli-env
18
18
  | `ev unset KEY [file]` | removes a key |
19
19
  | `ev cp KEY --from <file> --to <file>` | copies a key's value to another file without printing it, replacing the key there or appending it, `--as NEWKEY` to rename |
20
20
  | `ev mv KEY --from <file> --to <file>` | moves a key's line as written, `--force` to replace one the target has |
21
- | `ev diff <a> <b>` | names the keys set in one file and not the other, exit 1 when they differ |
22
- | `ev missing [file]` | names the keys of `.env.example` (`--against`) that the file lacks, exit 1 when some are |
23
- | `ev pins [dir]` | checks an app's tests pin the env that reaches outside: lists the optional URL, key, token, secret, password and host variables of its `defineEnv` schema that no `.env.test` entry, test `overrideEnv` or local bunfig preload dropping what `.env` sets pins, and each test file calling `testSite` or `proxyKeyTests` without pinning them (`// ev pins: none reached, <why>` exempts one), names only, exit 1 when something is unpinned |
21
+ | `ev diff <a> <b>` | names the keys set in one file and not the other, exit 1 when they differ; `--json` prints `{a, b, onlyA, onlyB}` |
22
+ | `ev missing [file]` | names the keys of `.env.example` (`--against`) that the file lacks, exit 1 when some are; `--json` prints `{a, b, onlyA, onlyB}` with the reference as `a` |
23
+ | `ev pins [dir]` | checks an app's tests pin the env that reaches outside (see below), exit 1 when something is unpinned |
24
24
  | `ev audit [dir...]` | lists the `.env` files any account can read or git tracks, and the compose files any account can read that write a secret or URL password out, with the fix for each, exit 1 when it finds one |
25
25
  | `ev audit --fix [dir...]` | moves each secret a listed compose file writes out into the `.env` beside it as `${KEY}` (a key the `.env` sets to another value stays put), puts it back when `docker compose config` resolves differently, and shuts other accounts out of both files and of every listed `.env`; exit 1 when something is left |
26
26
 
27
+ `ev pins` lists, by name only, the optional URL, key, token, secret, password and host variables of the app's `defineEnv` schema that no `.env.test` entry, test `overrideEnv` or local bunfig preload dropping what `.env` sets pins, and each test file calling `testSite` or `proxyKeyTests` without pinning them. `// ev pins: none reached, <why>` exempts a file.
28
+
27
29
  A value is masked when its key is named like a secret (`TOKEN`, `SECRET`, `PASSWORD`, `PASS`, `PWD`, `KEY`, `PRIVATE`, `DSN`, `AUTH`, `SALT`, `COOKIE`, `CREDENTIALS`, the definition `isSecretName` of `@kaynooo/cli-kit` that `db` shares), when it equals a secret value of the folder's `.env*` files whatever its own key, when it is a private key (PEM or PGP, also escaped on one line), or in the password part of any URL (`postgres://user:***@host/db`) and any known token format (GitHub, GitLab, Slack, AWS, npm, Stripe, Google, SendGrid, `sk-`, JWTs, `Authorization` credentials and `password=`/`secret=` pairs). A URL is also masked where it carries a token, whatever its key is named: the last segment of a Discord, Slack, Uptime Kuma push or healthchecks.io ping URL, any path segment of 20 or more characters of `A-Za-z0-9_-` mixing lowercase, uppercase and digits, any path segment of 32 or more letters and digits of any case (hex, base32, dashless UUIDs), and the value of a query parameter named `token`, `key`, `apikey`, `secret`, `password`, `sig`, `signature`, `auth` or ending in `_token` or `_secret`; the host and the rest of the URL stay readable. A masked value keeps a few leading characters and its length (`ghp***(40)`) so two values can be told apart. There is no flag that prints a secret unmasked.
28
30
 
29
31
  Files are parsed and written back preserving comments, order, `export KEY=` prefixes, quoting and multiline values; only the lines a command touches change.