Skip to content

Commit 8ebc77b

Browse files
committed
docs: cli focus
1 parent 2f2b8a1 commit 8ebc77b

File tree

27 files changed

+186
-185
lines changed

27 files changed

+186
-185
lines changed

packages/cli/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @cipherstash/cli
22

3-
> Renamed from `@cipherstash/stack-forge`. The standalone `@cipherstash/wizard` package was absorbed into this CLI as `stash wizard`. The single binary is now `stash` (replaces `stash-forge` and `cipherstash-wizard`).
3+
> Renamed from `@cipherstash/stack-forge`. The standalone `@cipherstash/wizard` package was absorbed into this CLI as `npx @cipherstash/cli wizard`. The single binary is now invoked via `npx @cipherstash/cli` (replaces `stash-forge` and `cipherstash-wizard`).
44
55
## 0.4.0
66

packages/cli/README.md

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ The single CLI for CipherStash. It handles authentication, project initializatio
1111

1212
```bash
1313
npm install -D @cipherstash/cli
14-
npx stash auth login # authenticate with CipherStash
15-
npx stash init # scaffold encryption schema and stash.config.ts
16-
npx stash db setup # connect to your database and install EQL
17-
npx stash wizard # AI agent wires encryption into your codebase
14+
npx @cipherstash/cli auth login # authenticate with CipherStash
15+
npx @cipherstash/cli init # scaffold encryption schema and stash.config.ts
16+
npx @cipherstash/cli db setup # connect to your database and install EQL
17+
npx @cipherstash/cli wizard # AI agent wires encryption into your codebase
1818
```
1919

2020
What each step does:
@@ -29,14 +29,14 @@ What each step does:
2929
## Recommended flow
3030

3131
```
32-
stash init
33-
└── stash db setup
34-
└── stash wizard ← fast path: AI edits your files
32+
npx @cipherstash/cli init
33+
└── npx @cipherstash/cli db setup
34+
└── npx @cipherstash/cli wizard ← fast path: AI edits your files
3535
OR
3636
Edit schema files by hand ← escape hatch
3737
```
3838

39-
`stash wizard` is the recommended path after `db setup`. It detects your framework (Drizzle, Supabase, Prisma, raw SQL), introspects your database, and integrates encryption directly into your existing schema definitions. If you prefer to write the schema by hand, skip the wizard and edit your encryption client file directly.
39+
`npx @cipherstash/cli wizard` is the recommended path after `db setup`. It detects your framework (Drizzle, Supabase, Prisma, raw SQL), introspects your database, and integrates encryption directly into your existing schema definitions. If you prefer to write the schema by hand, skip the wizard and edit your encryption client file directly.
4040

4141
---
4242

@@ -66,59 +66,59 @@ Commands that consume `stash.config.ts`: `db install`, `db upgrade`, `db setup`,
6666

6767
## Commands reference
6868

69-
### `stash init`
69+
### `npx @cipherstash/cli init`
7070

7171
Scaffold CipherStash for your project. Generates an encryption client file, writes initial schema code, and installs `@cipherstash/cli` as a dev dependency.
7272

7373
```bash
74-
npx stash init [--supabase] [--drizzle]
74+
npx @cipherstash/cli init [--supabase] [--drizzle]
7575
```
7676

7777
| Flag | Description |
7878
|------|-------------|
7979
| `--supabase` | Use the Supabase-specific setup flow |
8080
| `--drizzle` | Use the Drizzle-specific setup flow |
8181

82-
After `init` completes, the Next Steps output tells you to run `stash db setup`, then either `stash wizard` or edit the schema manually.
82+
After `init` completes, the Next Steps output tells you to run `npx @cipherstash/cli db setup`, then either `npx @cipherstash/cli wizard` or edit the schema manually.
8383

8484
---
8585

86-
### `stash auth login`
86+
### `npx @cipherstash/cli auth login`
8787

8888
Authenticate with CipherStash using a browser-based device code flow.
8989

9090
```bash
91-
npx stash auth login
91+
npx @cipherstash/cli auth login
9292
```
9393

9494
Saves the token to `~/.cipherstash/auth.json`. The wizard checks for this file as a prerequisite before running.
9595

9696
---
9797

98-
### `stash wizard`
98+
### `npx @cipherstash/cli wizard`
9999

100100
AI-powered encryption setup. The wizard reads your codebase, detects your framework, introspects your database schema, and edits your existing schema files to add encrypted column definitions.
101101

102102
```bash
103-
npx stash wizard
103+
npx @cipherstash/cli wizard
104104
```
105105

106106
Prerequisites:
107-
- Authenticated (`stash auth login` completed).
108-
- `stash.config.ts` present (run `stash db setup` first).
107+
- Authenticated (`npx @cipherstash/cli auth login` completed).
108+
- `stash.config.ts` present (run `npx @cipherstash/cli db setup` first).
109109

110110
Supported integrations: Drizzle ORM, Supabase JS Client, Prisma (experimental), raw SQL / other.
111111

112112
The wizard uses the CipherStash-hosted LLM gateway. No Anthropic API key is required.
113113

114114
---
115115

116-
### `stash secrets`
116+
### `npx @cipherstash/cli secrets`
117117

118118
Manage end-to-end encrypted secrets.
119119

120120
```bash
121-
npx stash secrets <subcommand> [options]
121+
npx @cipherstash/cli secrets <subcommand> [options]
122122
```
123123

124124
| Subcommand | Description |
@@ -141,21 +141,21 @@ npx stash secrets <subcommand> [options]
141141
**Examples:**
142142

143143
```bash
144-
npx stash secrets set -n DATABASE_URL -V "postgres://..." -e production
145-
npx stash secrets get -n DATABASE_URL -e production
146-
npx stash secrets get-many -n DATABASE_URL,API_KEY -e production
147-
npx stash secrets list -e production
148-
npx stash secrets delete -n DATABASE_URL -e production -y
144+
npx @cipherstash/cli secrets set -n DATABASE_URL -V "postgres://..." -e production
145+
npx @cipherstash/cli secrets get -n DATABASE_URL -e production
146+
npx @cipherstash/cli secrets get-many -n DATABASE_URL,API_KEY -e production
147+
npx @cipherstash/cli secrets list -e production
148+
npx @cipherstash/cli secrets delete -n DATABASE_URL -e production -y
149149
```
150150

151151
---
152152

153-
### `stash db setup`
153+
### `npx @cipherstash/cli db setup`
154154

155-
Configure your database and install EQL extensions. Run this after `stash init`.
155+
Configure your database and install EQL extensions. Run this after `npx @cipherstash/cli init`.
156156

157157
```bash
158-
npx stash db setup [options]
158+
npx @cipherstash/cli db setup [options]
159159
```
160160

161161
The interactive wizard:
@@ -178,12 +178,12 @@ The interactive wizard:
178178

179179
---
180180

181-
### `stash db install`
181+
### `npx @cipherstash/cli db install`
182182

183183
Install CipherStash EQL extensions into your database. Uses bundled SQL by default for offline, deterministic installs.
184184

185185
```bash
186-
npx stash db install [options]
186+
npx @cipherstash/cli db install [options]
187187
```
188188

189189
| Flag | Description |
@@ -203,12 +203,12 @@ The `--supabase` flag uses a Supabase-specific SQL variant and grants `USAGE`, t
203203
204204
---
205205

206-
### `stash db upgrade`
206+
### `npx @cipherstash/cli db upgrade`
207207

208208
Upgrade an existing EQL installation to the version bundled with the package (or the latest from GitHub).
209209

210210
```bash
211-
npx stash db upgrade [options]
211+
npx @cipherstash/cli db upgrade [options]
212212
```
213213

214214
| Flag | Description |
@@ -218,16 +218,16 @@ npx stash db upgrade [options]
218218
| `--exclude-operator-family` | Skip operator family creation |
219219
| `--latest` | Fetch the latest EQL from GitHub |
220220

221-
The install SQL is idempotent and safe to re-run. If EQL is not installed, the command suggests running `stash db install` instead.
221+
The install SQL is idempotent and safe to re-run. If EQL is not installed, the command suggests running `npx @cipherstash/cli db install` instead.
222222

223223
---
224224

225-
### `stash db push`
225+
### `npx @cipherstash/cli db push`
226226

227227
Push your encryption schema to the database. **Only required when using CipherStash Proxy.** If you use the SDK directly with Drizzle, Supabase, or plain PostgreSQL, skip this step.
228228

229229
```bash
230-
npx stash db push [--dry-run]
230+
npx @cipherstash/cli db push [--dry-run]
231231
```
232232

233233
| Flag | Description |
@@ -249,12 +249,12 @@ When pushing, the CLI loads the encryption client from `stash.config.ts`, runs s
249249

250250
---
251251

252-
### `stash db validate`
252+
### `npx @cipherstash/cli db validate`
253253

254254
Validate your encryption schema for common misconfigurations.
255255

256256
```bash
257-
npx stash db validate [--supabase] [--exclude-operator-family]
257+
npx @cipherstash/cli db validate [--supabase] [--exclude-operator-family]
258258
```
259259

260260
| Rule | Severity |
@@ -268,62 +268,62 @@ The command exits with code 1 on errors (not on warnings or info). Validation al
268268

269269
---
270270

271-
### `stash db migrate`
271+
### `npx @cipherstash/cli db migrate`
272272

273273
Run pending encrypt config migrations.
274274

275275
```bash
276-
npx stash db migrate
276+
npx @cipherstash/cli db migrate
277277
```
278278

279279
> **Good to know:** This command is not yet implemented.
280280
281281
---
282282

283-
### `stash db status`
283+
### `npx @cipherstash/cli db status`
284284

285285
Show the current state of EQL in your database.
286286

287287
```bash
288-
npx stash db status
288+
npx @cipherstash/cli db status
289289
```
290290

291291
Reports EQL installation status and version, database permission status, and whether an active encrypt config exists in `eql_v2_configuration` (relevant only for CipherStash Proxy).
292292

293293
---
294294

295-
### `stash db test-connection`
295+
### `npx @cipherstash/cli db test-connection`
296296

297297
Verify that the database URL in your config is valid and the database is reachable.
298298

299299
```bash
300-
npx stash db test-connection
300+
npx @cipherstash/cli db test-connection
301301
```
302302

303303
Reports the database name, connected role, and PostgreSQL server version.
304304

305305
---
306306

307-
### `stash schema build`
307+
### `npx @cipherstash/cli schema build`
308308

309309
Build an encryption client file from your database schema using DB introspection.
310310

311311
```bash
312-
npx stash schema build [--supabase]
312+
npx @cipherstash/cli schema build [--supabase]
313313
```
314314

315-
The first prompt offers `stash wizard` as the recommended path. If you choose the manual builder, the command connects to your database, lets you select tables and columns to encrypt, asks about searchable indexes, and generates a typed encryption client file.
315+
The first prompt offers `npx @cipherstash/cli wizard` as the recommended path. If you choose the manual builder, the command connects to your database, lets you select tables and columns to encrypt, asks about searchable indexes, and generates a typed encryption client file.
316316

317317
Reads `databaseUrl` from `stash.config.ts`.
318318

319319
---
320320

321321
## Drizzle migration mode
322322

323-
Use `--drizzle` with `stash db install` (or `stash db setup`) to add EQL installation to your Drizzle migration history instead of applying it directly.
323+
Use `--drizzle` with `npx @cipherstash/cli db install` (or `npx @cipherstash/cli db setup`) to add EQL installation to your Drizzle migration history instead of applying it directly.
324324

325325
```bash
326-
npx stash db install --drizzle
326+
npx @cipherstash/cli db install --drizzle
327327
npx drizzle-kit migrate
328328
```
329329

@@ -335,7 +335,7 @@ How it works:
335335
With a custom name or output directory:
336336

337337
```bash
338-
npx stash db install --drizzle --name setup-eql --out ./migrations
338+
npx @cipherstash/cli db install --drizzle --name setup-eql --out ./migrations
339339
npx drizzle-kit migrate
340340
```
341341

packages/cli/src/bin/stash.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const pkg = JSON.parse(
2727
const HELP = `
2828
CipherStash CLI v${pkg.version}
2929
30-
Usage: stash <command> [options]
30+
Usage: npx @cipherstash/cli <command> [options]
3131
3232
Commands:
3333
init Initialize CipherStash for your project
@@ -63,14 +63,14 @@ DB Flags:
6363
--latest (setup, install, upgrade) Fetch the latest EQL from GitHub
6464
6565
Examples:
66-
stash init
67-
stash init --supabase
68-
stash auth login
69-
stash wizard
70-
stash db setup
71-
stash db push
72-
stash schema build
73-
stash secrets set -n DATABASE_URL -V "postgres://..." -e production
66+
npx @cipherstash/cli init
67+
npx @cipherstash/cli init --supabase
68+
npx @cipherstash/cli auth login
69+
npx @cipherstash/cli wizard
70+
npx @cipherstash/cli db setup
71+
npx @cipherstash/cli db push
72+
npx @cipherstash/cli schema build
73+
npx @cipherstash/cli secrets set -n DATABASE_URL -V "postgres://..." -e production
7474
`.trim()
7575

7676
interface ParsedArgs {
@@ -164,7 +164,7 @@ async function runDbCommand(
164164
await testConnectionCommand()
165165
break
166166
case 'migrate':
167-
p.log.warn('"stash db migrate" is not yet implemented.')
167+
p.log.warn('"npx @cipherstash/cli db migrate" is not yet implemented.')
168168
break
169169
default:
170170
p.log.error(`Unknown db subcommand: ${sub ?? '(none)'}`)

packages/cli/src/commands/auth/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { bindDevice, login, selectRegion } from './login.js'
22

33
const HELP = `
4-
Usage: stash auth <command> [options]
4+
Usage: npx @cipherstash/cli auth <command> [options]
55
66
Commands:
77
login Authenticate with CipherStash
@@ -11,8 +11,8 @@ Options:
1111
--drizzle Track Drizzle as the referrer
1212
1313
Examples:
14-
stash auth login
15-
stash auth login --supabase
14+
npx @cipherstash/cli auth login
15+
npx @cipherstash/cli auth login --supabase
1616
`.trim()
1717

1818
function referrerFromFlags(flags: Record<string, boolean>): string | undefined {

packages/cli/src/commands/db/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function installCommand(options: {
2323
name?: string
2424
out?: string
2525
}) {
26-
p.intro('stash db install')
26+
p.intro('npx @cipherstash/cli db install')
2727

2828
const s = p.spinner()
2929

packages/cli/src/commands/db/push.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function toEqlConfig(config: EncryptConfig): Record<string, unknown> {
2828
}
2929

3030
export async function pushCommand(options: { dryRun?: boolean }) {
31-
p.intro('stash db push')
31+
p.intro('npx @cipherstash/cli db push')
3232
p.log.info(
3333
'This command pushes the encryption schema to the database for use with CipherStash Proxy.\nIf you are using the SDK directly (Drizzle, Supabase, or plain PostgreSQL), this step is not required.',
3434
)

0 commit comments

Comments
 (0)