@dashai/cli 0.5.0 → 0.6.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.
- package/README.md +78 -6
- package/dist/bin.js +382 -18
- package/dist/bin.js.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## Status
|
|
8
8
|
|
|
9
|
-
`0.
|
|
9
|
+
`0.5.x` — full author workflow + **Query Plane v1 author tooling** + **P7 cross-module-action observability** (shipped 2026-05-20) + **BaaS Phase 1 deploy loop** (`api-keys`, `env export`, `--deploy-target`; shipped 2026-05-24). Commands: `login`, `logout`, `profile`, `workspace`, `init` / `module init` (incl. `--custom`, `--deploy-target railway|vercel|fly`) / `connect-git` / `generate` / `dev` / `validate` / `list` / `publish` / `diff` / `pull-data` / `clone` / `query-log` / `action-log`, plus `query` (run AST queries against the local module), `pull` (sync canonical manifest from backend), `api-keys list|create|revoke`, `env export`, and `deps add` / `list` / `remove` / `check`.
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
@@ -103,23 +103,25 @@ Flags:
|
|
|
103
103
|
|
|
104
104
|
Requires `dashwise login` first — the command refuses to start if no token is resolvable. The runtime-token injection requires `dashwise init <slug>` (LDI-6); the dev session SSO setup works without it.
|
|
105
105
|
|
|
106
|
-
### `dashwise module init [slug]`
|
|
106
|
+
### `dashwise init [slug]` / `dashwise module init [slug]`
|
|
107
107
|
|
|
108
|
-
Scaffold a new DashWise module in a fresh directory. Two flavors:
|
|
108
|
+
Scaffold a new DashWise module in a fresh directory. `dashwise init` is a top-level alias for `dashwise module init` — both accept the same flags. Two flavors:
|
|
109
109
|
|
|
110
|
-
**
|
|
110
|
+
**Custom** (default since 2026-05-18) — full Next.js App Router app with SDK auth wired in (machine runtime, lands on Fly Machines once P7 ships). Files: `module.json`, `package.json`, `tsconfig.json`, `next.config.mjs`, `next-env.d.ts`, `middleware.ts` (uses `@dashai/sdk/auth/middleware`), `app/layout.tsx`, `app/page.tsx`, `app/dashboard/page.tsx` (auth-gated Server Component example), three `app/api/auth/*` route handlers, shadcn primitives + a `globals.css`, plus `CLAUDE.md` / `spec.md` / `agent-log.md` agent-facing docs. `module.json` carries `module_kind: 'custom'` + `runtime.kind: 'machine'`.
|
|
111
111
|
|
|
112
|
-
**
|
|
112
|
+
**Hand-authored** (`--simple`) — the legacy simple module-runtime app (isolate runtime). 10 files total: no middleware, no `/api/auth/*`, no dashboard. Suitable for public viewers / demo modules that don't need SSO.
|
|
113
113
|
|
|
114
114
|
Flags:
|
|
115
115
|
- `--dir <path>` — Target directory (default `./<slug>`).
|
|
116
116
|
- `--name <name>` — Human-readable module name (default: derived from slug).
|
|
117
117
|
- `--force` — Overwrite an existing non-empty directory.
|
|
118
|
-
- `--
|
|
118
|
+
- `--simple` — Use the legacy minimal scaffold (hand-authored, no Next.js auth wiring).
|
|
119
|
+
- `--custom` — *[Deprecated alias — kept for back-compat.]* Equivalent to the default. Will be removed in a future major version.
|
|
119
120
|
- `--git <url>` — Initial Git repository URL. Written to `module.json#repository.url`.
|
|
120
121
|
- `--description <text>` — Module description forwarded to the backend when provisioning the dev installation (HH-CC-LDI-6). No effect under `--no-provision`.
|
|
121
122
|
- `--workspace <slug-or-id>` — Target workspace for the dev installation (HH-CC-LDI-6). When omitted in a TTY, the CLI prompts; auto-picked if your account has one workspace; in non-interactive mode with multiple workspaces, errors with the list.
|
|
122
123
|
- `--no-provision` — Skip the `POST /api/installations/dev` step (HH-CC-LDI-6). Local scaffold is still written, but the module won't have a backing dev installation — `dashwise dev` data-plane calls will fail with `UnauthenticatedError` until you re-run `dashwise init --force` or (once it ships) `dashwise module provision-dev-install`.
|
|
124
|
+
- `--deploy-target railway|vercel|fly` (HH-CC-P1-D2) — Emit a platform deploy config file alongside the scaffold (`railway.json`, `vercel.json`, or `fly.toml`). Default: none (clean repo). Pair with `dashwise env export --format <platform>` to push env vars after provisioning. See [`docs/deploying.md`](../../docs/deploying.md) for the full deploy walkthrough.
|
|
123
125
|
|
|
124
126
|
**Provisioning behavior (HH-CC-LDI-6):** by default, after the local scaffold is written, `dashwise init` provisions a real local-dev installation by calling `POST /api/installations/dev`. The returned runtime token (90-day JWT) is cached in `~/.config/dashwise/auth.json#modules[<slug>]` where `@dashai/sdk`'s `createDevClient({ moduleSlug })` reads it on every dev-server boot. Provisioning failures are surfaced as warnings; the local scaffold remains usable so you can retry later.
|
|
125
127
|
|
|
@@ -297,6 +299,76 @@ Flags:
|
|
|
297
299
|
|
|
298
300
|
Pre-reqs: `dashwise module generate` must have run (the SDK reads `node_modules/@dashai/generated`). `DASHWISE_API_URL`, `DASHWISE_INSTALLATION_ID`, `DASHWISE_API_TOKEN` must be set (the scaffold's `.env.local` is loaded automatically).
|
|
299
301
|
|
|
302
|
+
### `dashwise pull` (HH-CC-P1-E2)
|
|
303
|
+
|
|
304
|
+
Fetch the canonical manifest from the backend and write it to local `module.json`. The inverse of `dashwise table create` / `field add` — useful after dashboard-side schema edits, DashAI mutations, or teammate-driven changes.
|
|
305
|
+
|
|
306
|
+
The backend (`GET /api/installations/:id/schema`) is the source of truth; `pull` materializes that locally. `dashwise dev`'s watcher polls this endpoint automatically, so most authors don't need to invoke `pull` manually.
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
$ dashwise pull
|
|
310
|
+
ℹ Backend at ab12cd34 — local at 9f8e7d6c. Writing module.json…
|
|
311
|
+
✓ module.json updated (3 tables, 18 fields).
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Flags:
|
|
315
|
+
- `--dir <path>` — Project root (default: current directory).
|
|
316
|
+
- `--dry-run` — Print the diff but don't write.
|
|
317
|
+
|
|
318
|
+
### `dashwise api-keys list|create|revoke` (HH-CC-P1-C4)
|
|
319
|
+
|
|
320
|
+
Mint long-lived production credentials for a `production` install. Used by self-hosted deploys (Railway / Vercel / Fly / your own infra) instead of the per-CLI-session runtime token. The key format is `dwk_<43-char-base64url>`; the backend stores only a `sha256` hash so the plaintext is shown exactly once at `create`.
|
|
321
|
+
|
|
322
|
+
```sh
|
|
323
|
+
# Mint a key. Plaintext appears on stdout — copy it now.
|
|
324
|
+
dashwise api-keys create production
|
|
325
|
+
|
|
326
|
+
# Script-friendly: capture the raw key with no other chatter.
|
|
327
|
+
KEY=$(dashwise api-keys create ci --raw-only)
|
|
328
|
+
|
|
329
|
+
# List all keys for the current install.
|
|
330
|
+
dashwise api-keys list
|
|
331
|
+
|
|
332
|
+
# Revoke. Irreversible. Effective on the next request.
|
|
333
|
+
dashwise api-keys revoke <key-id>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
The install is resolved from the cached entry in `~/.config/dashwise/auth.json#modules[<slug>]` (keyed by `module.json#module.slug`). Run from inside the module directory, or pass `--dir <path>`.
|
|
337
|
+
|
|
338
|
+
Pairs with `dashwise env export --key dwk_...` to push the key into a deploy platform without ever copy-pasting it through a shell history.
|
|
339
|
+
|
|
340
|
+
### `dashwise env export` (HH-CC-P1-D1)
|
|
341
|
+
|
|
342
|
+
Emit the four env vars every self-hosted deploy needs:
|
|
343
|
+
|
|
344
|
+
| Var | Source |
|
|
345
|
+
|---|---|
|
|
346
|
+
| `DASHWISE_API_URL` | CLI config (`apiUrl`). |
|
|
347
|
+
| `NEXT_PUBLIC_DASHWISE_API_URL` | Same. |
|
|
348
|
+
| `DASHWISE_INSTALLATION_ID` | `~/.config/dashwise/auth.json#modules[<slug>].installationId` (the dev install cached at `dashwise init`). |
|
|
349
|
+
| `DASHWISE_API_KEY` | Placeholder by default; pass `--key dwk_...` to inline an existing key, or `--new-key <name>` to mint one in-flight. |
|
|
350
|
+
|
|
351
|
+
Five output formats — `env`, `json`, `railway`, `vercel`, `fly`. The platform-specific ones wrap each var in the matching CLI invocation (`railway variables set …`, `vercel env add …`, `fly secrets set …`) so the output is directly pipeable into `sh`.
|
|
352
|
+
|
|
353
|
+
```sh
|
|
354
|
+
# .env syntax — copy/paste into a host that reads .env files.
|
|
355
|
+
dashwise env export --format env > .env.production
|
|
356
|
+
|
|
357
|
+
# Push straight into Railway.
|
|
358
|
+
dashwise env export --key dwk_... --format railway | sh
|
|
359
|
+
|
|
360
|
+
# Mint and inline a new key in one step.
|
|
361
|
+
dashwise env export --new-key prod --format vercel | sh
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Stdout carries only the env block (clean for piping); status chatter goes to stderr.
|
|
365
|
+
|
|
366
|
+
Flags:
|
|
367
|
+
- `--format env|json|railway|vercel|fly` — Output format. Default: `env`.
|
|
368
|
+
- `--key dwk_<...>` — Inline an existing API key.
|
|
369
|
+
- `--new-key <name>` — Mint a new API key and inline its plaintext.
|
|
370
|
+
- `--dir <path>` — Project root.
|
|
371
|
+
|
|
300
372
|
### `dashwise module query-log`
|
|
301
373
|
|
|
302
374
|
Read the per-module SDK query log (each cross-module / `.execute()` / `.stream()` / `.explain()` dispatch writes a row to `module_query_log` server-side). Workspace-member-scoped on the backend.
|