@levr-one/cli 0.2.0 → 0.3.1

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
@@ -1,8 +1,13 @@
1
1
  # @levr-one/cli
2
2
 
3
- The command-line interface for [Levr](https://www.levr.one). Push test results
4
- from any CI pipeline, manage authentication, and select workspaces. The binary
5
- is `levr`.
3
+ The command-line interface for [Levr](https://www.levr.one). The binary is
4
+ `levr`, and it does two jobs:
5
+
6
+ - **Connect your AI tools** — `levr mcp add` wires the Levr MCP server into
7
+ the AI clients on your machine (Claude Desktop, Claude Code, Cursor,
8
+ Windsurf, Zed) with one command.
9
+ - **Push test results** — `levr push` uploads results from any terminal or CI
10
+ pipeline.
6
11
 
7
12
  ## Install
8
13
 
@@ -15,71 +20,68 @@ npx @levr-one/cli --help
15
20
  The package is self-contained — no peer setup required. A global install
16
21
  replaces the `levr` bin from the deprecated `@levr-one/setup` package.
17
22
 
18
- ## Get started
19
-
20
- ```bash
21
- npx @levr-one/cli init # authenticate and list your workspaces
22
- ```
23
-
24
- `levr init` is the first-run onboarding command: it logs you in (browser
25
- PKCE by default, `--device-code` for SSH/headless) and lists the workspaces
26
- you can push to. Re-running it reuses your stored session — it never
27
- re-opens the browser unnecessarily.
28
-
29
- ### Shell completion (optional)
23
+ ## Quick start
30
24
 
31
- Tab-completion is an explicit opt-in step (it is not installed automatically):
25
+ **Using an AI client?** Wire the Levr MCP server into it no login needed;
26
+ the client opens a browser to authorize the first time it connects:
32
27
 
33
28
  ```bash
34
- levr install # add shell completion for the current shell
35
- levr uninstall # remove it
29
+ npx @levr-one/cli mcp add
36
30
  ```
37
31
 
38
- ## Authentication
39
-
40
- The CLI supports three authentication modes.
41
-
42
- ### Interactive (browser) — default
32
+ **Pushing test results?** Authentication is all you need — log in once (or
33
+ set `LEVR_TOKEN` in CI):
43
34
 
44
35
  ```bash
45
- levr auth login
36
+ levr auth login # browser PKCE (or --device-code for SSH/headless)
37
+ levr push ./results.xml
46
38
  ```
47
39
 
48
- Opens a browser for PKCE-based OAuth login.
40
+ ## Connect AI clients: `levr mcp add`
49
41
 
50
- ### Device code (SSH / headless)
42
+ Detects the MCP-capable clients installed on your machine, lets you pick
43
+ which to set up, and writes the Levr MCP server into each one's config:
51
44
 
52
45
  ```bash
53
- levr auth login --device-code
46
+ levr mcp add # detect clients and pick interactively
47
+ levr mcp add --all # set up every detected client
48
+ levr mcp add --dry-run # preview the changes without writing
49
+ levr mcp add --client cursor,zed --yes # non-interactive selection
54
50
  ```
55
51
 
56
- A code is displayed in the terminal. Open the provided URL on any device, enter
57
- the code, and approve.
58
-
59
- ### Personal Access Token (CI/CD)
52
+ What it writes is **credential-free** a `levr` server entry that connects
53
+ via `mcp-remote`. No token or secret is stored; your client opens the browser
54
+ to authorize with Levr on its first connection. After a run, restart the
55
+ client(s) and authorize once.
60
56
 
61
- Set the `LEVR_TOKEN` environment variable and the CLI uses it automatically —
62
- no interactive login:
57
+ **Supported clients:**
63
58
 
64
- ```bash
65
- export LEVR_TOKEN=<your-personal-access-token>
66
- levr push ./results.xml
67
- ```
59
+ | Client | How it's configured |
60
+ | -------------- | ------------------------------------------------------------------------------ |
61
+ | Claude Desktop | config file (`claude_desktop_config.json`) |
62
+ | Claude Code | prints the `claude mcp add --transport http levr <url>` command for you to run |
63
+ | Cursor | config file (`~/.cursor/mcp.json`) |
64
+ | Windsurf | config file (`~/.codeium/windsurf/mcp_config.json`) |
65
+ | Zed | config file (`settings.json`, `context_servers`) |
66
+ | VS Code, Codex | listed but not yet installable (coming soon) |
68
67
 
69
- ### Other auth commands
68
+ Config edits are **safe and repeatable**: existing MCP servers and comments
69
+ in your config files are preserved (jsonc-aware merge), and re-running is a
70
+ no-op that reports "already set up".
70
71
 
71
- ```bash
72
- levr auth status # show current authentication state
73
- levr auth logout # clear stored credentials
74
- ```
72
+ **Flags:**
75
73
 
76
- ## Workspaces
74
+ | Flag | Alias | Description |
75
+ | ----------------- | ----- | ----------------------------------------------------- |
76
+ | `--client <id,…>` | | Set up these client ids (comma-separated or repeated) |
77
+ | `--all` | | Set up every detected, installable client |
78
+ | `--yes` | `-y` | Non-interactive; auto-select detected clients |
79
+ | `--dry-run` | | Show the changes without writing |
80
+ | `--url <url>` | | MCP server URL (default derived from the API server) |
77
81
 
78
- ```bash
79
- levr workspace list # list the workspaces you belong to
80
- levr workspace select # choose the active workspace
81
- levr workspace current # show the active workspace
82
- ```
82
+ Runs non-interactively whenever `--all`, `--client`, or `--yes` is passed —
83
+ or automatically when not attached to a terminal (CI). Unknown client ids and
84
+ failed writes exit non-zero.
83
85
 
84
86
  ## Push test results
85
87
 
@@ -157,6 +159,61 @@ withEnv(["LEVR_TOKEN=${LEVR_TOKEN}"]) {
157
159
  }
158
160
  ```
159
161
 
162
+ ## Authentication
163
+
164
+ Needed for `push` and `workspace` commands (`mcp add` needs none). Three modes:
165
+
166
+ ### Interactive (browser) — default
167
+
168
+ ```bash
169
+ levr auth login
170
+ ```
171
+
172
+ Opens a browser for PKCE-based OAuth login.
173
+
174
+ ### Device code (SSH / headless)
175
+
176
+ ```bash
177
+ levr auth login --device-code
178
+ ```
179
+
180
+ A code is displayed in the terminal. Open the provided URL on any device, enter
181
+ the code, and approve.
182
+
183
+ ### Personal Access Token (CI/CD)
184
+
185
+ Set the `LEVR_TOKEN` environment variable and the CLI uses it automatically —
186
+ no interactive login:
187
+
188
+ ```bash
189
+ export LEVR_TOKEN=<your-personal-access-token>
190
+ levr push ./results.xml
191
+ ```
192
+
193
+ ### Other auth commands
194
+
195
+ ```bash
196
+ levr auth status # show current authentication state
197
+ levr auth logout # clear stored credentials
198
+ ```
199
+
200
+ ## Workspaces
201
+
202
+ ```bash
203
+ levr workspace list # list the workspaces you belong to
204
+ levr workspace select # choose the active workspace
205
+ levr workspace current # show the active workspace
206
+ ```
207
+
208
+ ## Shell completion (optional)
209
+
210
+ Tab-completion is an explicit opt-in step (it is not installed automatically):
211
+
212
+ ```bash
213
+ levr install # add shell completion for the current shell
214
+ levr uninstall # remove it
215
+ ```
216
+
160
217
  ## Configuration
161
218
 
162
219
  All configuration is via environment variables. Flags take precedence.
@@ -166,11 +223,20 @@ All configuration is via environment variables. Flags take precedence.
166
223
  | `LEVR_TOKEN` | Personal Access Token (for CI / headless) | |
167
224
  | `LEVR_URL` | API base URL (`--url` flag > `LEVR_URL` > URL stored at login > default) | `https://api.levr.one` |
168
225
  | `LEVR_AUTH_URL` | Auth server URL for the browser login page (derived from the API URL when unset) | derived |
226
+ | `LEVR_MCP_URL` | MCP server URL written by `levr mcp add` (derived from the API URL when unset) | derived |
169
227
  | `LEVR_TEAM_ID` | Default team ID (optional; server resolves from automation source or workspace default) | |
170
228
  | `LEVR_SOURCE` | Automation source name override (groups imports, remembers team) | |
171
229
 
172
230
  ## Troubleshooting
173
231
 
232
+ **The `levr` server doesn't appear in my AI client after `mcp add`** — Restart
233
+ the client; MCP servers are read at startup. Verify the entry with
234
+ `levr mcp add --dry-run` (it reports "already set up" when the config is in
235
+ place).
236
+
237
+ **My client asks me to authorize Levr** — Expected on the first connection:
238
+ the config is credential-free, so each client authorizes once in the browser.
239
+
174
240
  **`Authentication required. Run: levr auth login`** — No valid credentials
175
241
  found. Run `levr auth login` or set `LEVR_TOKEN`.
176
242