@kaynooo/cli-env 0.15.1 → 0.15.3

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
@@ -16,10 +16,11 @@ bun install -g @kaynooo/cli-env
16
16
  | `ev show <rev>:<file>` | an env file as a git revision holds it, values masked |
17
17
  | `ev set KEY [file]` | sets a key in `.env` (or the file), the value read from stdin or `-F <file>` so it never appears in a command line, `--empty` for an empty value |
18
18
  | `ev unset KEY [file]` | removes a key |
19
+ | `ev set`/`unset` on a `.json`, `.yaml` or `.toml` file | the key is a dotted path (`database.password`), and only its value changes: comments, order, indentation and quoting stay, a number or boolean keeps its type, and an edit that would change anything else is refused |
19
20
  | `--quiet` (`-q`) | on set, unset, cp and mv, prints nothing on success |
20
21
  | `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 |
21
22
  | `ev mv KEY --from <file> --to <file>` | moves a key's line as written, `--force` to replace one the target has |
22
- | `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}` |
23
+ | `ev diff <a> <b>` | names the keys set in one file and not the other, and those set to different values with both masked as `list` shows them, exit 1 when they differ; `--keys` compares the keys only, `--json` prints `{a, b, onlyA, onlyB, differ}` |
23
24
  | `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` |
24
25
  | `ev pins [dir]` | checks an app's tests pin the env that reaches outside (see below), exit 1 when something is unpinned |
25
26
  | `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, never printing a value, with the fix for each, exit 1 when it finds one; it looks down to 5 levels, skipping `node_modules`, `vendor`, `.git` and `.example`, `.sample`, `.template` and `.dist` files, and names a folder it cannot read on stderr |
@@ -27,11 +28,11 @@ bun install -g @kaynooo/cli-env
27
28
 
28
29
  `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. The `dir` is an app, or a monorepo holding apps one level down (the current folder by default); only variable names are read.
29
30
 
30
- 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.
31
+ 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 a `name=value` or `"name": "value"` pair whose name `isSecretName` calls secret, `PGPASSWORD` or `clientSecret` alike, unless it names a setting such as `TOKEN_TTL` or `PASSWORD_FILE`). A variable printed at the start of a line, as `printenv` does, is masked to the end of the line. 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.
31
32
 
32
33
  Files are parsed and written back preserving comments, order, `export KEY=` prefixes, quoting and multiline values; only the lines a command touches change.
33
34
 
34
- Only dotenv files are read: a file named on the command line with a `.json`, `.yaml`, `.toml`, `.ini` or `.xml` extension, or holding lines but no `KEY=value` one, is refused with exit 2 rather than read as empty. `ev redact < file` masks the secrets of those.
35
+ `list`, `get`, `grep`, `show`, `diff` and `missing` also read a JSON (comments allowed), JSON5, YAML or TOML file named on the command line, its keys as dotted paths: `ev get database.password config.yaml`, `servers.0.host` for an array item. Writes stay on dotenv files: `set`, `unset`, `cp` and `mv` refuse those formats with exit 2. A file named with a `.ini` or `.xml` extension, or holding lines but no `KEY=value` one, is refused with exit 2 rather than read as empty; `ev redact < file` masks the secrets of those.
35
36
 
36
37
  ## ev redact
37
38