|
1 | 1 | # @cipherstash/cli |
2 | 2 |
|
| 3 | +## 0.11.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- de9c02c: Rename the CLI package from `@cipherstash/cli` to `stash`. The published code, commands, and flags are unchanged — this is a pure rename so the day-to-day invocation drops from `npx @cipherstash/cli ...` to `npx stash ...`. |
| 8 | + |
| 9 | + **Migration** |
| 10 | + |
| 11 | + 1. Update your `package.json` devDependencies: |
| 12 | + |
| 13 | + ```diff |
| 14 | + - "@cipherstash/cli": "^0.10.0" |
| 15 | + + "stash": "^0.10.1" |
| 16 | + ``` |
| 17 | + |
| 18 | + 2. Update the `defineConfig` import in `stash.config.ts`: |
| 19 | + |
| 20 | + ```diff |
| 21 | + - import { defineConfig } from '@cipherstash/cli' |
| 22 | + + import { defineConfig } from 'stash' |
| 23 | + ``` |
| 24 | + |
| 25 | + 3. Update any `npx @cipherstash/cli ...` / `bunx @cipherstash/cli ...` / `pnpm dlx @cipherstash/cli ...` / `yarn dlx @cipherstash/cli ...` invocations in scripts, CI, READMEs, and team docs to use `stash` instead. Programmatic exports (`defineConfig`, `loadStashConfig`, `EQLInstaller`, `loadBundledEqlSql`, `downloadEqlSql`, `PermissionCheckResult`) are re-exported from `stash` with the same shapes. |
| 26 | + |
| 27 | + **Wizard impact (`@cipherstash/wizard`)** |
| 28 | + |
| 29 | + The wizard's post-agent step and its prerequisite / agent-error hints now reference `stash` (e.g. `Run: bunx stash auth login`, `Running bunx stash db install...`) rather than `@cipherstash/cli`. The wizard package name and `stash-wizard` binary are unchanged — only the strings the wizard prints and the commands it shells out to are affected. |
| 30 | + |
| 31 | +- 8ee11fd: Layered `DATABASE_URL` resolution for DB / schema commands. |
| 32 | + |
| 33 | + Previously, any DB-touching command (`db install`, `db push`, `db upgrade`, `db status`, `db validate`, `db test-connection`, `schema build`) failed with the cryptic Zod error: |
| 34 | + |
| 35 | + ``` |
| 36 | + Error: Invalid stash.config.ts |
| 37 | + - databaseUrl: Invalid input: expected nonoptional, received undefined |
| 38 | + ``` |
| 39 | +
|
| 40 | + if `DATABASE_URL` wasn't already in the environment. The CLI auto-loaded `.env.local` / `.env.development.local` / `.env.development` / `.env`, but had no story for `--database-url` flags, local Supabase, or pasted-once values. |
| 41 | +
|
| 42 | + The scaffolded `stash.config.ts` now calls a resolver directly: |
| 43 | +
|
| 44 | + ```ts |
| 45 | + import { defineConfig, resolveDatabaseUrl } from "stash"; |
| 46 | +
|
| 47 | + export default defineConfig({ |
| 48 | + databaseUrl: await resolveDatabaseUrl(), |
| 49 | + client: "./src/encryption/index.ts", |
| 50 | + }); |
| 51 | + ``` |
| 52 | + |
| 53 | + `resolveDatabaseUrl()` walks sources in order; first hit wins: |
| 54 | + |
| 55 | + 1. `--database-url <url>` flag — new, accepted on all seven DB / schema commands. Used for this run only; never written to disk. |
| 56 | + 2. `process.env.DATABASE_URL` — covers shell exports, mise, direnv, dotenv-cli, the existing dotenv loads. |
| 57 | + 3. `supabase status --output env` → `DB_URL` — auto-engaged when `--supabase` is set or a `supabase/config.toml` is detected. Useful for local Supabase users who haven't exported the URL yet. |
| 58 | + 4. Interactive prompt — opens with a tip listing the alternatives (flag, env, the user's actual dotenv file). Skipped under `CI=true` or non-TTY stdin. |
| 59 | + 5. Hard fail with a source-naming error message. |
| 60 | + |
| 61 | + The connection string is **never persisted to disk** — `stash.config.ts` only contains the `await resolveDatabaseUrl()` call, never a literal URL. The resolver also doesn't mutate `process.env`; CLI flag context is threaded into the config evaluation via `AsyncLocalStorage` so concurrent loads stay isolated. Source labels are logged on non-env paths (`Using DATABASE_URL from --database-url flag` / `from supabase status` / `from prompt`) but the URL itself is never echoed. |
| 62 | + |
| 63 | + `db test-connection`'s connection-failure hint is now source-aware: it points users at `--database-url`, the env var, and the actual dotenv file in their project (`.env.local` if present, `.env` otherwise) — not the misleading `stash.config.ts` it used to suggest. |
| 64 | + |
3 | 65 | ## 0.10.1 |
4 | 66 |
|
5 | 67 | ### Patch Changes |
|
0 commit comments