@seekrit/cli 0.0.1 → 0.2.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 (3) hide show
  1. package/README.md +131 -0
  2. package/dist/index.js +1072 -821
  3. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # @seekrit/cli
2
+
3
+ The `seekrit` command-line client for [seekrit](https://seekrit.dev) — an
4
+ end-to-end encrypted secrets manager. Secrets are encrypted and decrypted **on
5
+ your machine**; the API only ever stores ciphertext. The CLI is the piece that
6
+ holds your keys, so plaintext, private keys, and passphrases never leave the
7
+ device.
8
+
9
+ Use it to manage secrets from a terminal, inject them into a process
10
+ (`seekrit run`), export them for another tool (`seekrit export`), and give CI or
11
+ agents scoped access via service tokens.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install -g @seekrit/cli # or: pnpm add -g @seekrit/cli
17
+ seekrit --help
18
+ ```
19
+
20
+ Requires Node ≥ 20. You can also run it without installing via
21
+ `npx @seekrit/cli …`.
22
+
23
+ ## Quickstart
24
+
25
+ ```sh
26
+ # 1. Authenticate (a service token, or a dev identity for a local API)
27
+ seekrit login --token skt_…
28
+
29
+ # 2. Set up your encryption keypair (protected by a passphrase that never
30
+ # leaves this machine). Only needed once per account.
31
+ seekrit keys setup
32
+
33
+ # 3. Link the current directory to an org / app / environment. Writes
34
+ # seekrit.json, which is safe to commit.
35
+ seekrit init --org acme --app storefront --env production
36
+
37
+ # 4. Work with secrets
38
+ seekrit secrets set DATABASE_URL 'postgres://…'
39
+ seekrit secrets list
40
+ seekrit run -- ./server # runs ./server with secrets in its env
41
+ seekrit export --format dotenv > .env
42
+ ```
43
+
44
+ New to seekrit? The [Quickstart](https://seekrit.dev/docs/quickstart) walks
45
+ through creating the org/app/environment from scratch, and the
46
+ [CLI guide](https://seekrit.dev/docs/guides/cli) covers day-to-day workflows.
47
+
48
+ ## Commands
49
+
50
+ Run `seekrit <command> --help` for full flags. The
51
+ [CLI reference](https://seekrit.dev/docs/reference/cli) is the complete list.
52
+
53
+ | Command | What it does |
54
+ | --- | --- |
55
+ | `login [--token \| --dev-user] [--api-url]` | Save credentials to the global config. |
56
+ | `whoami` | Show the authenticated identity and org membership. |
57
+ | `keys setup` | Generate your keypair and protect it with a passphrase. |
58
+ | `init --org --app --env` | Link this directory to an environment (`seekrit.json`). |
59
+ | `org create` / `app create` / `env create` | Create organizations, apps, and environments. |
60
+ | `secrets list` | List secret names (never values). |
61
+ | `secrets get <name>` | Decrypt and print one secret value. |
62
+ | `secrets set <name> [value]` | Encrypt and store a secret (reads stdin if value is omitted or `-`). |
63
+ | `secrets rm <name>` | Delete a secret. |
64
+ | `run <command…>` | Run a command with decrypted secrets in its environment. |
65
+ | `export [--format dotenv\|json\|shell]` | Print decrypted secrets in the chosen format. |
66
+ | `grant [--user \| --token]` | Grant a member or service token access to the linked environment. |
67
+ | `token create` / `list` / `revoke` | Manage service tokens for CI, Docker, and agents. |
68
+ | `audit [--limit]` | Show the org audit trail. |
69
+
70
+ `seekrit run` passes flags through to the child command — put them after `--`
71
+ (e.g. `seekrit run -- node app.js --port 3000`). `secrets set NAME -` reads the
72
+ value from stdin, so you can pipe: `printf '%s' "$VALUE" | seekrit secrets set NAME -`.
73
+
74
+ ## Service tokens (CI, Docker, agents)
75
+
76
+ A service token carries its own private key in the token string; the server
77
+ stores only a hash and the public key, so it can be granted access without a
78
+ passphrase.
79
+
80
+ ```sh
81
+ seekrit token create --name ci-deploy --grant # prints the token once — save it
82
+ SEEKRIT_TOKEN=skt_… seekrit run -- ./deploy.sh
83
+ SEEKRIT_TOKEN=skt_… seekrit export --format dotenv
84
+ seekrit token revoke <tokenId>
85
+ ```
86
+
87
+ See the [service tokens guide](https://seekrit.dev/docs/guides/service-tokens).
88
+
89
+ ## Configuration
90
+
91
+ Credentials and defaults are read from (highest precedence first) environment
92
+ variables, then the global config file, then built-in defaults.
93
+
94
+ | Variable | Overrides | Notes |
95
+ | --- | --- | --- |
96
+ | `SEEKRIT_TOKEN` | `token` | Service token (`skt_…`). |
97
+ | `SEEKRIT_DEV_USER` | `devUser` | Dev-mode identity for a local API running with `AUTH_MODE=dev`. |
98
+ | `SEEKRIT_API_URL` | `apiUrl` | API base URL (default `http://localhost:8787`). |
99
+ | `SEEKRIT_PASSPHRASE` | — | Unlocks your private key non-interactively (CI, scripts). |
100
+
101
+ - **Global config** — written by `seekrit login` to
102
+ `$XDG_CONFIG_HOME/seekrit/config.json` (default
103
+ `~/.config/seekrit/config.json`), created with `0600` permissions.
104
+ - **Project config** — `seekrit.json`, written by `seekrit init` and resolved by
105
+ walking up from the current directory. Safe to commit; it holds only
106
+ org/app/environment identifiers, never secrets.
107
+
108
+ ## Local development
109
+
110
+ From the repo root, after building once (`pnpm --filter @seekrit/cli build`),
111
+ you can run the local build against a dev API:
112
+
113
+ ```sh
114
+ alias seekrit="node $PWD/apps/cli/dist/index.js"
115
+ export SEEKRIT_PASSPHRASE=dev-only-passphrase
116
+ seekrit login --dev-user you@example.com --api-url http://localhost:8787
117
+ ```
118
+
119
+ See the root [README](../../README.md) for the full end-to-end local loop.
120
+
121
+ ### Build
122
+
123
+ The CLI is bundled with [tsdown](https://tsdown.dev). Workspace packages
124
+ (`@seekrit/*`) are inlined so the published package's only runtime dependency is
125
+ `commander`.
126
+
127
+ ```sh
128
+ pnpm build # bundle to dist/index.js
129
+ pnpm dev # rebuild on change (tsdown --watch)
130
+ pnpm typecheck # tsc --noEmit
131
+ ```