@dashai/cli 0.18.3 → 0.20.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 CHANGED
@@ -67,6 +67,155 @@ Show the current user + accessible workspaces. Refreshes the cached profile from
67
67
  Flags:
68
68
  - `--json` — Emit a single JSON object `{ ok, user, default_workspace, workspaces, api_url }` for piping into CI / `jq`.
69
69
 
70
+ ### `dashwise mcp` / `dashwise mcp add`
71
+
72
+ Run a local MCP server for one workspace, so Claude can read and write your Dashwise data.
73
+
74
+ ```bash
75
+ # Register it with Claude Code, once, per machine:
76
+ dashwise mcp add --workspace acme
77
+
78
+ # What that registration runs (you never type this yourself):
79
+ dashwise mcp --workspace acme
80
+
81
+ # The same server with a narrowed key: rows of table 412, read-only, enforced by the server:
82
+ dashwise mcp --workspace acme --scope datahub:table=412:r
83
+
84
+ # Register that narrowed form, so every session Claude Code starts carries the grant:
85
+ dashwise mcp add --workspace acme --grant-scope datahub:table=412:r
86
+ ```
87
+
88
+ `dashwise mcp` is short for `dashwise mcp serve`, and `dashwise mcp serve --help` lists the flags below.
89
+
90
+ **Or install the plugin instead.** `plugins/dashwise/` in this repository is a Claude
91
+ Code plugin that registers this same server, ships the `dashwise-data` and
92
+ `dashwise-module-builder` skills with it, and adds a hook that refuses to let a
93
+ `dwk_`, `dwc_` or `dwm_` credential reach the transcript. One install replaces
94
+ `mcp add` plus the manual skill copy. `dashwise agent setup` (below) runs it for you,
95
+ or by hand:
96
+
97
+ ```bash
98
+ claude plugin marketplace add Intuize/dashwise-cli
99
+ claude plugin install dashwise
100
+ ```
101
+
102
+ The plugin is **for Dashwise staff only, for now**: `Intuize/dashwise-cli` is a private
103
+ repository, so the `marketplace add` fails for anyone who cannot read it. Everyone else
104
+ connects with `dashwise mcp add`, which needs no plugin.
105
+
106
+ `plugins/dashwise/README.md` covers prerequisites, what the hook blocks, and how to
107
+ turn it off. `dashwise mcp add` remains the right answer when you want the server
108
+ without the skill or the hook.
109
+
110
+ **Why this exists.** The other way to connect Claude is to paste a URL that *contains* the
111
+ credential. That URL then lives in `~/.claude.json`, in your shell history, and in the screenshot
112
+ you attach to a support ticket. `dashwise mcp` exchanges your `dashwise login` token for an
113
+ endpoint key at startup, keeps it in the process's memory, and drops it on exit. Nothing is written
114
+ to disk, nothing is printed, and `--verbose` logs frame *types and sizes* — never bodies, never the
115
+ key.
116
+
117
+ `dashwise mcp` speaks MCP over stdio and relays every frame to the workspace's Streamable HTTP
118
+ endpoint. It is a pipe: a protocol change on the server needs no CLI release.
119
+
120
+ Flags for `dashwise mcp` (`serve`):
121
+ - `--workspace <slug>` — which workspace to connect. Defaults to `dashwise workspace use`; with one
122
+ workspace, it is picked for you.
123
+ - `--scope <grant>` — narrow this session's key; **the server enforces it**. Repeat the flag to add
124
+ grants, and they add up: `datahub:table=<id>:<ops>`, `datahub:app=<id>:<ops>`,
125
+ `datahub:workspace:<ops>` (ops are one to four of `c`, `r`, `u`, `d`) or
126
+ `governance:workspace:r`. A scope only narrows. Every grant must be within your own access, and
127
+ one that is not is refused with the server's reason (`SCOPE_EXCEEDS_CREATOR_ACCESS`). At startup
128
+ the CLI prints the scopes as the server stored them. The server merges grants on one target, so
129
+ that line can read differently from the flags. If a server mints the session without confirming
130
+ the scopes, the CLI revokes it and exits 1, because running it would hand over an un-narrowed
131
+ key. Without `--scope` the key reaches what your account can. A backend older than this flag
132
+ refuses the field, and the CLI says so.
133
+ - `--endpoint-name <label>` — label for this machine (default: your hostname). Each run gets its
134
+ own endpoint, named `dashwise-cli@<label>#<id>` in the Dashwise endpoints panel; the server adds
135
+ the short id so two sessions on one machine can be told apart, and an admin can revoke either of
136
+ them. Running Claude Code and Claude Desktop side by side needs no special handling — they get
137
+ separate endpoints and neither disturbs the other.
138
+ - `--read-only` — refuse write tools. **This is a client-side guard**: the proxy declines the call,
139
+ and the server is not told. It prevents accidents, which is most of what it is for; it is not a
140
+ fence. For a limit the server enforces, use `--scope` (for example `--scope datahub:workspace:r`).
141
+ - `--verbose` — log frame types and sizes to stderr.
142
+
143
+ Flags for `dashwise mcp add` (`--workspace`, `--read-only` and `--endpoint-name` as above, plus):
144
+ - `--name <server-name>` — the name Claude Code shows (default: `dashwise`).
145
+ - `--scope local|project|user` — **Claude Code's** config scope: where the registration
146
+ is saved (default: `local`). It says nothing about what the key can reach.
147
+ - `--grant-scope <grant>` — the **server's** grant scope, written into the registration
148
+ as `dashwise mcp --scope <grant>`, so every session started from it is narrowed on
149
+ the server. Repeatable, same grammar as `--scope` on `dashwise mcp` above, and checked
150
+ before anything is registered. On `add`, `--scope` was already taken by Claude Code's
151
+ option, which is why the grant has its own name here:
152
+
153
+ ```bash
154
+ dashwise mcp add --workspace acme --scope user --grant-scope datahub:app=7:r --grant-scope governance:workspace:r
155
+ # registers: claude mcp add dashwise --scope user -- dashwise mcp --workspace acme --scope datahub:app=7:r --scope governance:workspace:r
156
+ ```
157
+
158
+ `mcp add` shells out to `claude mcp add` and prints the exact command it runs. If `claude` is not on
159
+ your `PATH`, that printed command is the whole remedy — copy it once Claude Code is installed.
160
+
161
+ **Session lifetime.** Each `dashwise mcp` process owns one endpoint. It revokes that endpoint when
162
+ it exits cleanly (the client closing it, `^C`, or a `SIGTERM`), and the endpoint expires after 24
163
+ hours regardless — so a session left behind by a crash or a hard kill dies the same day rather than
164
+ lingering as a live credential.
165
+
166
+ **Revoking a session.** Open the Dashwise endpoints panel, find the `dashwise-cli@…` row you want,
167
+ and revoke it. That session stops immediately. Starting `dashwise mcp` again gives you a new
168
+ endpoint, which is the intended way back — revoking is about killing the session that is running,
169
+ not about locking the machine out.
170
+
171
+ ### `dashwise agent setup`
172
+
173
+ Install the Dashwise plugin into Claude Code in one command: the skills, the `dashwise`
174
+ MCP server and the secrets guard. **Staff only, for now:** its default source is a
175
+ private repository, so step 3 fails for anyone who cannot read it (see above).
176
+
177
+ ```bash
178
+ dashwise agent setup # adds the marketplace if needed, then installs dashwise@dashwise
179
+ dashwise agent setup --status # what is installed; changes nothing
180
+ ```
181
+
182
+ What it runs, in order:
183
+
184
+ 1. `claude --version`. If Claude Code is not on your `PATH`, it prints the two
185
+ commands below and exits 0. Nothing is installed.
186
+ 2. `claude plugin list --json`. If `dashwise@dashwise` is already installed, it says
187
+ so and stops.
188
+ 3. `claude plugin marketplace list --json`, then `claude plugin marketplace add
189
+ <source>`, but only when no marketplace named `dashwise` is configured.
190
+ 4. `claude plugin install dashwise@dashwise`.
191
+
192
+ The two calls that change something run in your terminal, so you see Claude Code's
193
+ own output. If either fails, the command exits with its code and prints the
194
+ commands that finish the job by hand:
195
+
196
+ ```bash
197
+ claude plugin marketplace add Intuize/dashwise-cli
198
+ claude plugin install dashwise@dashwise
199
+ ```
200
+
201
+ Flags:
202
+ - `--marketplace <source>`: the marketplace to add. It takes anything `claude plugin
203
+ marketplace add` accepts: owner/repo, a git URL, a local path, a URL. The default
204
+ is `Intuize/dashwise-cli`, this repository, and it moves to the public plugin
205
+ repository once that exists. A `dashwise` marketplace already configured from
206
+ somewhere else is not replaced; the command says how to remove it.
207
+ - `--status`: report whether the marketplace is configured and the plugin installed
208
+ (version, scope, enabled or disabled), and change nothing. It exits 1 when Claude
209
+ Code's answer cannot be read, rather than guessing "not installed". With no `claude`
210
+ on your `PATH` it says Claude Code is not installed, and exits 0.
211
+ - `--json`: print one JSON object on stdout and nothing else. With it, Claude Code's
212
+ own output is captured rather than shown.
213
+
214
+ Nothing runs this for you. No other command, `dashwise login` included, calls it or
215
+ suggests it. Afterwards, restart Claude Code, and if you have never run
216
+ `dashwise login` on this machine, run it once. The plugin's MCP server needs it, and
217
+ the plugin's session-start note will say so if you forget.
218
+
70
219
  ### `dashwise workspace list`
71
220
 
72
221
  List workspaces the user belongs to. The default workspace (set via `workspace use`) is marked with `*`.