@dashai/cli 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.
- package/LICENSE +21 -0
- package/README.md +373 -0
- package/dist/bin.js +4343 -0
- package/dist/bin.js.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DashWise
|
|
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
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# @dashai/cli
|
|
2
|
+
|
|
3
|
+
`dashwise` — the DashWise command-line tool. Log in, author modules, publish to the marketplace.
|
|
4
|
+
|
|
5
|
+
> **New here?** Start with the [building modules walk-through](../../docs/building-modules.md) — covers the full first-module flow (login → scaffold → dev → publish) with diagrams of the auth flow and an annotated manifest. This file is the per-command reference; the walk-through is the tutorial.
|
|
6
|
+
|
|
7
|
+
## Status
|
|
8
|
+
|
|
9
|
+
`0.1.x` — full author workflow + **Query Plane v1 author tooling** + **P7 cross-module-action observability** (shipped 2026-05-20). Commands: `login`, `logout`, `profile`, `workspace`, `module init` (incl. `--custom`) / `connect-git` / `generate` / `dev` / `validate` / `list` / `publish` / `diff` / `pull-data` / `clone` / `query-log` / `action-log`, plus `query` (run AST queries against the local module) and `deps add` / `list` / `remove` / `check`.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @dashai/cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or run via `npx` without installing globally:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx @dashai/cli login
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires Node 20+.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
### `dashwise login`
|
|
28
|
+
|
|
29
|
+
Sign in via the OAuth 2.0 Device Authorization Grant.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
$ dashwise login
|
|
33
|
+
┌ Logging into http://localhost:3000
|
|
34
|
+
|
|
35
|
+
Open the verification URL and confirm the code:
|
|
36
|
+
|
|
37
|
+
URL: http://localhost:3000/cli?user_code=WXYZ-1234
|
|
38
|
+
Code: WXYZ-1234
|
|
39
|
+
|
|
40
|
+
Code expires in 10m. The CLI will keep polling until you approve.
|
|
41
|
+
|
|
42
|
+
◆ Open the verification URL in your browser?
|
|
43
|
+
│ ● Open now
|
|
44
|
+
│ ○ I'll open it manually
|
|
45
|
+
└
|
|
46
|
+
|
|
47
|
+
⠙ Waiting for approval
|
|
48
|
+
✓ Approved.
|
|
49
|
+
✓ Logged in as alice@example.com
|
|
50
|
+
└ You can now run `dashwise profile`, `dashwise workspace list`, etc.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Flags:
|
|
54
|
+
|
|
55
|
+
- `--api-url <url>` — Override the backend URL (default: `$DASHWISE_API_URL` → saved config → `http://localhost:3000`).
|
|
56
|
+
- `--no-prompt` — Skip the "open browser" prompt; just print the URL. Useful in CI / headless environments.
|
|
57
|
+
- `--name <name>` — Suggested label for the minted token (default `dashwise-cli`).
|
|
58
|
+
|
|
59
|
+
### `dashwise logout`
|
|
60
|
+
|
|
61
|
+
Clear the local credentials and revoke the server-side token. Idempotent.
|
|
62
|
+
|
|
63
|
+
### `dashwise profile`
|
|
64
|
+
|
|
65
|
+
Show the current user + accessible workspaces. Refreshes the cached profile from the server; falls back to local cache on network errors.
|
|
66
|
+
|
|
67
|
+
Flags:
|
|
68
|
+
- `--json` — Emit a single JSON object `{ ok, user, default_workspace, workspaces, api_url }` for piping into CI / `jq`.
|
|
69
|
+
|
|
70
|
+
### `dashwise workspace list`
|
|
71
|
+
|
|
72
|
+
List workspaces the user belongs to. The default workspace (set via `workspace use`) is marked with `*`.
|
|
73
|
+
|
|
74
|
+
Flags:
|
|
75
|
+
- `--json` — Emit `{ ok, default_workspace, workspaces }` instead of the column view.
|
|
76
|
+
|
|
77
|
+
### `dashwise workspace use <slug>`
|
|
78
|
+
|
|
79
|
+
Set the default workspace for subsequent commands. Validates that the slug is one the user has access to.
|
|
80
|
+
|
|
81
|
+
### `dashwise dev`
|
|
82
|
+
|
|
83
|
+
One-command local dev loop — collapses the historical two-terminal flow into a single foreground command. Spawns two children:
|
|
84
|
+
|
|
85
|
+
1. `dashwise module dev` — manifest watcher + SDK regen
|
|
86
|
+
2. `next dev` — Next.js dev server (via the project's `dev:next` script if defined, else `npx next dev`)
|
|
87
|
+
|
|
88
|
+
Both children inherit a pre-populated env with `DASHWISE_API_URL`, `DASHWISE_API_TOKEN`, and `DASHWISE_INSTALLATION_ID` automatically resolved from your saved CLI config (`~/.config/dashwise/auth.json`). No more copying tokens into `.env.local` by hand.
|
|
89
|
+
|
|
90
|
+
Output from both children is line-prefixed (`[sdk]` cyan, `[next]` magenta) so a single terminal stays readable. Ctrl-C cleanly terminates both.
|
|
91
|
+
|
|
92
|
+
Flags:
|
|
93
|
+
- `--dir <path>` — Project root (default: current directory).
|
|
94
|
+
- `--installation-id <id>` — Override `DASHWISE_INSTALLATION_ID` (default `"local"`).
|
|
95
|
+
- `--api-url <url>` — Override `DASHWISE_API_URL` (default: saved config value).
|
|
96
|
+
- `--port <number>` — Port for `next dev` (default: Next picks 3000 / next free).
|
|
97
|
+
- `--sdk-only` — Run only the manifest watcher; skip `next dev`.
|
|
98
|
+
- `--next-only` — Run only `next dev`; skip the watcher.
|
|
99
|
+
|
|
100
|
+
Requires `dashwise login` first — the command refuses to start if no token is resolvable.
|
|
101
|
+
|
|
102
|
+
### `dashwise module init [slug]`
|
|
103
|
+
|
|
104
|
+
Scaffold a new DashWise module in a fresh directory. Two flavors:
|
|
105
|
+
|
|
106
|
+
**Hand-authored** (default) — simple module-runtime app (isolate runtime). 10 files: `module.json`, `package.json`, `tsconfig.json`, `next.config.mjs`, `next-env.d.ts`, `.gitignore`, `.env.local.example`, `app/layout.tsx`, `app/page.tsx`, `README.md`.
|
|
107
|
+
|
|
108
|
+
**Custom** (`--custom`) — full Next.js App Router app with SDK auth wired in (machine runtime, lands on Fly Machines once P7 ships). Adds 5 files on top of the hand-authored set: `middleware.ts` (uses `@dashai/sdk/auth/middleware`), `app/dashboard/page.tsx` (auth-gated Server Component example), and three `app/api/auth/*` route handlers (`sign-in`, `callback`, `sign-out`). `module.json` carries `module_kind: 'custom'` + `runtime.kind: 'machine'`.
|
|
109
|
+
|
|
110
|
+
Flags:
|
|
111
|
+
- `--dir <path>` — Target directory (default `./<slug>`).
|
|
112
|
+
- `--name <name>` — Human-readable module name (default: derived from slug).
|
|
113
|
+
- `--force` — Overwrite an existing non-empty directory.
|
|
114
|
+
- `--custom` — Use the full Next.js custom-module scaffold.
|
|
115
|
+
- `--git <url>` — Initial Git repository URL. Written to `module.json#repository.url`.
|
|
116
|
+
|
|
117
|
+
### `dashwise module connect-git <repo-url>`
|
|
118
|
+
|
|
119
|
+
Link the local module to a Git repository — writes `module.json#repository`. Accepts both `https://github.com/owner/repo` and `git@github.com:owner/repo` shapes.
|
|
120
|
+
|
|
121
|
+
The marketplace surfaces the repo URL when set. Future `dashwise module clone <slug>` will fetch from this URL when available.
|
|
122
|
+
|
|
123
|
+
Flags:
|
|
124
|
+
- `--branch <name>` — Default branch (e.g. `main`). Preserved across re-connects if unchanged.
|
|
125
|
+
- `--dir <path>` — Project root.
|
|
126
|
+
|
|
127
|
+
### `dashwise module generate`
|
|
128
|
+
|
|
129
|
+
Read the local `module.json`, POST it to `/api/modules/draft/generate-sdk`, write the returned 13-file SDK tree to `node_modules/@dashai/generated/`. Requires `dashwise login` first.
|
|
130
|
+
|
|
131
|
+
Flags:
|
|
132
|
+
- `--dir <path>` — Project root (default: current directory).
|
|
133
|
+
- `--dry-run` — Print summary without writing files.
|
|
134
|
+
|
|
135
|
+
### `dashwise module dev`
|
|
136
|
+
|
|
137
|
+
Watch `module.json` for changes; auto-regenerate the typed wrappers on every save. Initial regen runs on startup; subsequent regens bump a monotonic `generation` counter so the emitted `package.json#version` shifts and cache-busts naïve consumers.
|
|
138
|
+
|
|
139
|
+
The watcher coalesces editor double-saves with a 250ms debounce. Ctrl-C exits cleanly.
|
|
140
|
+
|
|
141
|
+
Does NOT spawn `next dev` itself — keep that in another terminal (or use `npm run dev:next`) so its output isn't swallowed. The scaffold sets up `npm run dev` to alias to this command.
|
|
142
|
+
|
|
143
|
+
Flags:
|
|
144
|
+
- `--dir <path>` — Project root (default: current directory).
|
|
145
|
+
- `--debounce-ms <n>` — Filesystem-change debounce window (default 250ms).
|
|
146
|
+
|
|
147
|
+
### `dashwise module validate`
|
|
148
|
+
|
|
149
|
+
Send the local `module.json` to the backend's manifest validator (`POST /api/modules/manifest/validate`). On failure, prints a bullet-listed issue array with the field path each issue applies to.
|
|
150
|
+
|
|
151
|
+
Flag: `--dir <path>` — project root (default: current directory).
|
|
152
|
+
|
|
153
|
+
### `dashwise module list`
|
|
154
|
+
|
|
155
|
+
List modules you can author. Defaults to `--owned-only` (modules where you're a workspace admin); pass `--all` to include public modules too. Honors the saved default workspace; override with `--workspace <slug>`.
|
|
156
|
+
|
|
157
|
+
Output is plain text columns (`SLUG`, `VERSION`, `NAME`) so it pipes cleanly into `grep` / `awk` / `column`.
|
|
158
|
+
|
|
159
|
+
Flags:
|
|
160
|
+
- `--all` — Include public modules you can install but do not own.
|
|
161
|
+
- `--workspace <slug>` — Filter to one workspace (default: saved default).
|
|
162
|
+
- `--json` — Emit `{ ok, modules, total }` instead of column-aligned text.
|
|
163
|
+
|
|
164
|
+
### `dashwise module diff`
|
|
165
|
+
|
|
166
|
+
Show what would change at the next `publish` vs the currently-published version. Runs entirely server-side via `POST /api/modules/:id/draft/diff` — local manifest is sent, structured diff comes back.
|
|
167
|
+
|
|
168
|
+
Output groups:
|
|
169
|
+
- **Meta** — top-level field changes (`module.version`, `module.name`, `module_kind`, `runtime`, `repository`)
|
|
170
|
+
- **Tables added / removed / changed** — per-field `+`/`-`/`~` markers under each changed table
|
|
171
|
+
- **Dependencies added / removed**
|
|
172
|
+
|
|
173
|
+
Use this as a pre-publish sanity check. If everything's unchanged, exits 0 with `No changes vs vX.Y.Z`.
|
|
174
|
+
|
|
175
|
+
Flags:
|
|
176
|
+
- `--dir <path>` — Project root (default: current directory).
|
|
177
|
+
- `--json` — Emit the structured diff as JSON `{ ok, current_version, unchanged, meta_changes, tables_added, tables_removed, tables_changed, deps_added, deps_removed }` instead of the human-readable summary. Useful for CI gates ("fail PR if any field-removal lands without a major bump").
|
|
178
|
+
|
|
179
|
+
### `dashwise module pull-data`
|
|
180
|
+
|
|
181
|
+
Export the module's own-table rows from the owner-workspace installation to a local JSON file. Rows are keyed by manifest field slug (NOT `field_<id>` internals), so the output is reusable as test fixtures or local-dev seeds.
|
|
182
|
+
|
|
183
|
+
Capped at 100 rows per table by default; raise with `--limit` (1–1000). Each table reports its `total_rows` even when truncated, so the CLI warns when you're seeing a sample rather than the full dataset.
|
|
184
|
+
|
|
185
|
+
Flags:
|
|
186
|
+
- `--dir <path>` — project root.
|
|
187
|
+
- `--limit <n>` — Max rows per table (1–1000, default 100).
|
|
188
|
+
- `--out <path>` — Output file (default: `./dashwise-data.json`).
|
|
189
|
+
|
|
190
|
+
### `dashwise module clone <slug>`
|
|
191
|
+
|
|
192
|
+
Bring a published module's source into a local directory. Two flavors based on what the backend has:
|
|
193
|
+
|
|
194
|
+
1. **Git mode** (preferred) — when the module's published manifest carries `repository.url`, the CLI shells out to `git clone <url> <target>`. Full history; future `git pull` for updates.
|
|
195
|
+
2. **Manifest-only fallback** — when no Git URL is set, the CLI writes a fresh directory with the published `module.json` + a minimal scaffold (`.gitignore`, `package.json`, `README.md`). User has to recreate `app/`.
|
|
196
|
+
|
|
197
|
+
Refuses to write into a non-empty directory unless `--force` is passed.
|
|
198
|
+
|
|
199
|
+
Flags:
|
|
200
|
+
- `--dir <path>` — Target directory (default: `./<slug>`).
|
|
201
|
+
- `--force` — Overwrite an existing non-empty directory.
|
|
202
|
+
- `--no-git` — Skip `git clone` even when `repository.url` is set; use the manifest-only scaffold.
|
|
203
|
+
|
|
204
|
+
### `dashwise module publish`
|
|
205
|
+
|
|
206
|
+
Pack the current directory into a gzipped tarball + upload it to `POST /api/modules/:id/publish/cli`. Excludes `node_modules`, `.next`, `.git`, `.dashwise`, `dist`, etc. — the full list lives in `src/lib/tarball.ts`. Per-file 10MB cap; tarball total 100MB cap (matches the backend's `BUNDLE_TOO_LARGE` gate).
|
|
207
|
+
|
|
208
|
+
Flow:
|
|
209
|
+
1. Read `module.json` for the slug.
|
|
210
|
+
2. Resolve `slug → module.id` via `GET /api/modules/by-slug/:slug` (404 → "create the module via UI first").
|
|
211
|
+
3. Pack + show a "X files in Y MB" summary.
|
|
212
|
+
4. Prompt for confirmation (skip with `--yes` for CI).
|
|
213
|
+
5. Multipart-POST the tarball with `bump=<patch|minor|major>`.
|
|
214
|
+
6. Print resulting version + bundle URL + hash.
|
|
215
|
+
|
|
216
|
+
Flags:
|
|
217
|
+
- `--bump patch|minor|major` — Required. Will prompt interactively if omitted.
|
|
218
|
+
- `--dry-run` — Backend validates + builds the bundle but doesn't persist the version.
|
|
219
|
+
- `-y, --yes` — Skip the confirmation prompt.
|
|
220
|
+
- `--exclude <pattern...>` — Extra exclude patterns appended to the defaults.
|
|
221
|
+
- `--dir <path>` — Project root.
|
|
222
|
+
|
|
223
|
+
### `dashwise query`
|
|
224
|
+
|
|
225
|
+
Run a typed query against the local module's installation via the `@dashai/sdk/query` plane. Three modes:
|
|
226
|
+
|
|
227
|
+
| Mode | Use |
|
|
228
|
+
| --- | --- |
|
|
229
|
+
| `--inline "<expr>"` | One-liner. `qb`, `deps`, `db` pre-bound. Example: `--inline "qb.tasks.where({done:false}).count()"` |
|
|
230
|
+
| `--file <path>` | Dynamic-import a `.mjs` / `.js` file whose default export is a `Query` / `AggQuery` / `Promise`. |
|
|
231
|
+
| `--repl` | Open a Node REPL with the generated SDK pre-bound. Top-level `await` supported. Ctrl-D exits. |
|
|
232
|
+
|
|
233
|
+
Pretty-prints JSON by default; `--json` emits compact JSON for piping to `jq`.
|
|
234
|
+
|
|
235
|
+
Flags:
|
|
236
|
+
- `--inline <expr>` — Inline JS expression mode.
|
|
237
|
+
- `--file <path>` — File-based query mode (`.mjs` / `.js`; `.ts` not yet supported — use `npx tsx` directly).
|
|
238
|
+
- `--repl` — Interactive REPL mode.
|
|
239
|
+
- `--explain` — Call `.explain()` instead of `.execute()`. Returns the Postgres plan envelope (joined queries fully; bare own/dep/view return `EXPLAIN_NOT_SUPPORTED_YET` until Phase 5+).
|
|
240
|
+
- `--stream` — Stream results as JSON-lines via SSE (one row per line, `\n`-terminated). Lets Ctrl-C cleanly cancel mid-flight. Implies `--json`. Mutually exclusive with `--explain` / `--repl`.
|
|
241
|
+
- `--json` — Compact JSON output (no pretty-print).
|
|
242
|
+
- `--dir <path>` — Project root (default: current directory).
|
|
243
|
+
|
|
244
|
+
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).
|
|
245
|
+
|
|
246
|
+
### `dashwise module query-log`
|
|
247
|
+
|
|
248
|
+
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.
|
|
249
|
+
|
|
250
|
+
Module resolution: `--module <id-or-slug>`, falling back to `module.json#module.slug` in the current directory.
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
$ dashwise module query-log --slow --since 1h --tail
|
|
254
|
+
TIME MS ROWS CODE AST_HASH
|
|
255
|
+
2026-05-20T14:32:01 543 1k ab12cd34
|
|
256
|
+
2026-05-20T14:31:48 612 50 - 9f8e7d6c
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Flags:
|
|
260
|
+
- `--module <id-or-slug>` — Override module resolution.
|
|
261
|
+
- `--slow` — Filter to slow queries only (`duration_ms > 500`, matches the SDK/backend default threshold).
|
|
262
|
+
- `--since <duration>` — Filter to entries with `created_at >= NOW() - <duration>`. Shorthand: `30m`, `1h`, `2d`, `7d`. ISO 8601 timestamps also accepted.
|
|
263
|
+
- `--limit <n>` — Max rows per call (default 50; backend caps at 500).
|
|
264
|
+
- `--tail` — Poll every 5s for new entries. Last-seen `created_at` becomes the next poll's `since`. Stops on Ctrl-C.
|
|
265
|
+
- `--json` — Compact JSON output.
|
|
266
|
+
|
|
267
|
+
### `dashwise module action-log`
|
|
268
|
+
|
|
269
|
+
Read the per-installation server-action audit log (Phase 7 slice 7.5). Shows BOTH cross-module dispatches (consumer module invoked an action on a provider module) AND own-module dispatches. Workspace-member-scoped on the backend.
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
$ dashwise module action-log --module sales --role caller --cross-module-only --since 1h
|
|
273
|
+
TIME MS CROSS CALLER ACTION CODE
|
|
274
|
+
------------------- ----- ----- ------------------ ---------------------- ------------------
|
|
275
|
+
2026-05-20 14:32:01 142 yes sales archiveContact -
|
|
276
|
+
2026-05-20 14:31:48 612 yes sales escalateContact -
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
`--module` resolves the slug to your accessible installation; `--installation` is the direct shape (useful in CI scripts where you already know the id).
|
|
280
|
+
|
|
281
|
+
Flags:
|
|
282
|
+
- `--installation <id>` — Numeric installation id (find via `dashwise module list` or the workspace UI). Mutually exclusive with `--module`.
|
|
283
|
+
- `--module <slug>` — Module slug. Resolves to the caller's accessible installation of that module (first match across the caller's workspaces). Mutually exclusive with `--installation`. Most users will prefer this — pass the slug from your local `module.json`.
|
|
284
|
+
- `--role <caller|provider>` — Which side of cross-module dispatches to show. `caller` (default) shows outbound (this installation invoked actions); `provider` shows inbound (others invoked this installation's actions).
|
|
285
|
+
- `--slow` — Filter to slow actions (elapsed_ms > 500). Uses the partial slow-action index.
|
|
286
|
+
- `--cross-module-only` — Hide own-module dispatches (`cross_module=false` rows). Useful for forensics on consumer ↔ provider call patterns.
|
|
287
|
+
- `--since <duration>` — `30m`, `1h`, `6h`, `2d`, `7d`, or an ISO 8601 timestamp.
|
|
288
|
+
- `--limit <n>` — Max rows per call (default 50; backend caps at 500).
|
|
289
|
+
- `--tail` — Poll every 5s for new entries. Stops on Ctrl-C.
|
|
290
|
+
- `--json` — Compact JSON output (ignored with `--tail`).
|
|
291
|
+
|
|
292
|
+
### `dashwise deps`
|
|
293
|
+
|
|
294
|
+
Manage cross-module dependencies declared in `module.json#dependencies`.
|
|
295
|
+
|
|
296
|
+
**`dashwise deps add <provider-slug>`** — Add a dep. Interactive in a TTY (fetches the provider's published `exposes` block, multi-select tables + fields, prompts for the required `purpose` string). Non-interactive when `--table` + `--fields` + `--purpose` are all passed.
|
|
297
|
+
|
|
298
|
+
Flags: `--table <slug>`, `--fields <comma-list>`, `--purpose <text>`, `--version <semver-range>`, `--dir <path>`.
|
|
299
|
+
|
|
300
|
+
**`dashwise deps list`** — Print the local manifest's declared deps as column-aligned text (provider slug, version range, tables, purpose). `--json` for piping.
|
|
301
|
+
|
|
302
|
+
**`dashwise deps remove <provider-slug>`** — Drop a dep entry from the manifest. Honours `--table <slug>` to remove a single table from a multi-table dep without dropping the whole entry.
|
|
303
|
+
|
|
304
|
+
**`dashwise deps check`** — Verify each declared dep still resolves against a currently-published provider (online command; requires backend reachability). Exits 1 on drift. Reported codes: `PROVIDER_NOT_FOUND`, `NO_MATCHING_VERSION`, `FIELD_NOT_EXPOSED`, `OP_NOT_ALLOWED`. `--json` available for CI integrations.
|
|
305
|
+
|
|
306
|
+
### Module dev loop
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
dashwise login # one-time, saves token to ~/.config/dashwise/auth.json
|
|
310
|
+
dashwise module init my-module --name "My Module"
|
|
311
|
+
cd my-module
|
|
312
|
+
npm install
|
|
313
|
+
dashwise dev # one command: manifest watcher + next dev,
|
|
314
|
+
# auth env vars auto-injected from your CLI config
|
|
315
|
+
# Now edit module.json (add a table), save, see the types update under @dashai/generated/types/rows.d.ts
|
|
316
|
+
|
|
317
|
+
# Sanity-check queries against the local installation:
|
|
318
|
+
dashwise query --inline "qb.tasks.count()"
|
|
319
|
+
dashwise query --file ./scripts/overdue.mjs --stream | jq .
|
|
320
|
+
|
|
321
|
+
# When ready to ship:
|
|
322
|
+
dashwise module validate # local manifest sanity check
|
|
323
|
+
dashwise deps check # verify cross-module deps still resolve
|
|
324
|
+
dashwise module publish --bump patch # pack + upload + version-bump
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
For the two-terminal flow (e.g. when debugging Next separately), substitute step 5 with:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
dashwise module generate # materialize node_modules/@dashai/generated/
|
|
331
|
+
# Terminal 1:
|
|
332
|
+
dashwise module dev # watch module.json + auto-regen
|
|
333
|
+
# Terminal 2:
|
|
334
|
+
npm run dev:next # → next dev on :3000
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Configuration
|
|
338
|
+
|
|
339
|
+
The CLI persists state at `$XDG_CONFIG_HOME/dashwise/auth.json` (typically `~/.config/dashwise/auth.json` on macOS/Linux). The file holds:
|
|
340
|
+
|
|
341
|
+
```jsonc
|
|
342
|
+
{
|
|
343
|
+
"apiUrl": "http://localhost:3000",
|
|
344
|
+
"token": "dwc_<base64url>",
|
|
345
|
+
"tokenId": 42,
|
|
346
|
+
"user": { "id": 7, "email": "alice@example.com", "username": "alice", "firstName": "Alice", "lastName": "" },
|
|
347
|
+
"workspaceSlug": "my-team"
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
- The file is chmod 0600 on Unix; the token is a long-lived bearer credential.
|
|
352
|
+
- `dashwise logout` deletes the file + calls `DELETE /api/auth/cli-tokens/:id` to revoke the server-side row.
|
|
353
|
+
- Move the file to a different user's home and they'll be logged in as you — treat it like an SSH key.
|
|
354
|
+
|
|
355
|
+
### Environment variables
|
|
356
|
+
|
|
357
|
+
| Var | Default | Purpose |
|
|
358
|
+
| --- | --- | --- |
|
|
359
|
+
| `DASHWISE_API_URL` | (saved config) → `http://localhost:3000` | Backend URL |
|
|
360
|
+
| `XDG_CONFIG_HOME` | `~/.config` | Config root |
|
|
361
|
+
| `DASHWISE_DEBUG` | unset | Print full stack traces on uncaught errors |
|
|
362
|
+
|
|
363
|
+
## Exit codes
|
|
364
|
+
|
|
365
|
+
| Code | Meaning |
|
|
366
|
+
| --- | --- |
|
|
367
|
+
| 0 | Success |
|
|
368
|
+
| 1 | Generic failure (network error, validation, unauthorized) |
|
|
369
|
+
| 130 | User cancelled (Ctrl-C / `cancel` from a prompt) |
|
|
370
|
+
|
|
371
|
+
## License
|
|
372
|
+
|
|
373
|
+
MIT
|