@secretenvs/cli 0.0.0-stage → 1.1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -2
  3. package/dist/index.js +1258 -0
  4. package/package.json +49 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ankit Yadav
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 CHANGED
@@ -1,3 +1,80 @@
1
- # Temporary Holding Version
1
+ # @secretenvs/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The `secretenvs` command reads and manages SecretEnvs variables from the
4
+ terminal. It is built on `@secretenvs/sdk` and `@secretenvs/contracts`, which
5
+ are bundled into the build, so the packed tarball installs on its own.
6
+
7
+ ## Commands
8
+
9
+ | Command | What it does |
10
+ | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
11
+ | `secretenvs login [--url <baseUrl>]` | Prompts for email and password (hidden), stores an API token. |
12
+ | `secretenvs logout` | Deletes the stored credentials. |
13
+ | `secretenvs whoami` | Shows the server, account and token prefix, and checks the token still works. |
14
+ | `secretenvs projects` | Lists accessible projects (slug, role, name). |
15
+ | `secretenvs envs -p <project>` | Lists the environments of a project. |
16
+ | `secretenvs list -p <project> -e <env> [--reveal]` | Lists keys and their source (`env` / `shared`). Values are masked. |
17
+ | `secretenvs set KEY=VALUE -p <project> -e <env>` | Creates or updates an environment variable (needs EDITOR). |
18
+ | `secretenvs history KEY -p <project> -e <env> [--shared] [--limit]` | Lists versions: number, change, author, time. Values are never shown. |
19
+ | `secretenvs rollback KEY --to <n> -p <project> -e <env> [--shared] [--yes]` | Restores version `n` as a **new** version (needs EDITOR). Asks to confirm. |
20
+ | `secretenvs pull -p <project> -e <env> [--out .env] [--format dotenv\|json] [--force]` | Writes the resolved variables to a file (mode `0600`). |
21
+ | `secretenvs run -p <project> -e <env> -- <command...>` | Runs a command with the variables injected into its environment. |
22
+
23
+ Every command supports `--help`. Failures print a message to stderr and exit
24
+ with a non-zero code. `run` exits with the code of the command it started.
25
+
26
+ ## Configuration
27
+
28
+ | Setting | Precedence |
29
+ | ------------- | ---------------------------------------------------------------------------- |
30
+ | Token | `SECRETENVS_TOKEN` > stored credentials |
31
+ | Server URL | `--url` (login) > `SECRETENVS_URL` > stored credentials |
32
+ | Project / env | `-p` / `-e` > `SECRETENVS_PROJECT` / `SECRETENVS_ENV` > `.secretenvsrc.json` |
33
+
34
+ Credentials live in `~/.config/secretenvs/credentials.json` (mode `0600`, in a
35
+ `0700` directory). `.secretenvsrc.json` in the current directory sets
36
+ project and environment defaults only; a file that contains a token is rejected:
37
+
38
+ ```json
39
+ { "project": "my-app", "environment": "development" }
40
+ ```
41
+
42
+ ## Behaviour worth knowing
43
+
44
+ - `https` is required; `http` is accepted only for `localhost`. TLS verification
45
+ is never disabled.
46
+ - The CLI never prints tokens or values unless you ask (`list --reveal`, `pull`).
47
+ - `list` uses the keys-only endpoints, so values are not even fetched without
48
+ `--reveal`.
49
+ - `pull` refuses to overwrite an existing file without `--force` and always
50
+ writes with mode `0600`.
51
+ - `run` starts the command without a shell (arguments are passed as an array,
52
+ never interpreted). Variables from the vault override inherited ones, and
53
+ `SECRETENVS_TOKEN` is not passed on to the child process.
54
+ - `rollback` asks for confirmation unless `--yes` is given, and refuses to run
55
+ without a terminal.
56
+ - `logout` only removes the local file. The token stays valid until you revoke
57
+ it in the web app (Settings > Tokens).
58
+
59
+ ## Build and install locally
60
+
61
+ Inside the dev container:
62
+
63
+ ```sh
64
+ yarn workspace @secretenvs/cli build
65
+ yarn workspace @secretenvs/cli pack --out /tmp/secretenvs-cli.tgz
66
+ ```
67
+
68
+ Install the tarball in another project or globally:
69
+
70
+ ```sh
71
+ npm install -g /tmp/secretenvs-cli.tgz # or: yarn add /tmp/secretenvs-cli.tgz
72
+ secretenvs --help
73
+ ```
74
+
75
+ For development you can also run the build directly
76
+ (`node packages/cli/dist/index.js --help`) or use `yarn link`.
77
+
78
+ The CLI is ESM only and has no importable API, so unlike the other packages it
79
+ builds a single `dist/index.js` and has no `main`, `exports` or type
80
+ declarations.