@levr-one/cli 0.2.0 → 0.3.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/dist/cli.js CHANGED
@@ -53,41 +53,64 @@ function buildContext(process$1) {
53
53
  }
54
54
 
55
55
  //#endregion
56
- //#region src/commands/init.ts
57
- const initCommand = buildCommand({
56
+ //#region src/commands/mcp/add.ts
57
+ const mcpAddCommand = buildCommand({
58
58
  docs: {
59
- brief: "First-run setup: authenticate and list your workspaces",
60
- fullDescription: `Set up the Levr CLI: authenticate (if needed) and list your workspaces.
59
+ brief: "Add the Levr MCP server to installed AI clients",
60
+ fullDescription: `Detect MCP-capable clients on this machine (Claude Desktop,
61
+ Claude Code, Cursor, Windsurf, Zed) and write the Levr MCP server into each
62
+ one's config. The entry is credential-free — the client opens a browser to
63
+ authorize with Levr the first time it connects.
61
64
 
62
- Reuses an existing session when one is stored — running init again never
63
- re-opens the browser unnecessarily. For headless environments (SSH,
64
- containers), use --device-code.
65
+ Interactive by default; non-interactive when --all/--client/--yes is passed
66
+ or when not running in a terminal (CI). Config edits preserve existing
67
+ servers and comments, and re-running is a no-op.
65
68
 
66
69
  Examples:
67
- npx @levr-one/cli init # First-run onboarding
68
- levr init --device-code # Headless/SSH onboarding
69
- levr init --url <api-url> # Target a non-default API server`
70
+ npx @levr-one/cli mcp add # detect clients and pick interactively
71
+ levr mcp add --all # set up every detected client
72
+ levr mcp add --client cursor --yes
73
+ levr mcp add --dry-run # preview without writing
74
+ levr mcp add --url <mcp-url> # target a non-default MCP server`
70
75
  },
71
76
  parameters: {
72
77
  flags: {
73
- "device-code": {
78
+ client: {
79
+ kind: "parsed",
80
+ parse: String,
81
+ brief: "Set up these client ids (comma-separated or repeated)",
82
+ placeholder: "id[,id]",
83
+ variadic: true,
84
+ optional: true
85
+ },
86
+ all: {
74
87
  kind: "boolean",
75
88
  default: false,
76
- brief: "Use device code flow (for SSH/headless environments)"
89
+ brief: "Set up every detected, installable client"
90
+ },
91
+ yes: {
92
+ kind: "boolean",
93
+ default: false,
94
+ brief: "Non-interactive; auto-select detected clients"
95
+ },
96
+ "dry-run": {
97
+ kind: "boolean",
98
+ default: false,
99
+ brief: "Show changes without writing"
77
100
  },
78
101
  url: {
79
102
  kind: "parsed",
80
103
  parse: String,
81
- brief: "API base URL (default: https://api.levr.one)",
104
+ brief: "MCP server URL (default derived from the API server)",
82
105
  placeholder: "url",
83
106
  optional: true
84
107
  }
85
108
  },
86
- aliases: { d: "device-code" }
109
+ aliases: { y: "yes" }
87
110
  },
88
111
  loader: async () => {
89
- const { initHandler } = await import("./initHandler-JN92u8td.js");
90
- return initHandler;
112
+ const { mcpAddHandler } = await import("./addHandler-boWTd9yY.js");
113
+ return mcpAddHandler;
91
114
  }
92
115
  });
93
116
 
@@ -124,7 +147,7 @@ Examples:
124
147
  aliases: { d: "device-code" }
125
148
  },
126
149
  loader: async () => {
127
- const { loginHandler } = await import("./loginHandler-uZCrwdcR.js");
150
+ const { loginHandler } = await import("./loginHandler-BfIUQJrC.js");
128
151
  return loginHandler;
129
152
  }
130
153
  });
@@ -143,7 +166,7 @@ Examples:
143
166
  },
144
167
  parameters: {},
145
168
  loader: async () => {
146
- const { logoutHandler } = await import("./logoutHandler-jWPGhzls.js");
169
+ const { logoutHandler } = await import("./logoutHandler-BC8laIAB.js");
147
170
  return logoutHandler;
148
171
  }
149
172
  });
@@ -163,7 +186,7 @@ Examples:
163
186
  },
164
187
  parameters: {},
165
188
  loader: async () => {
166
- const { statusHandler } = await import("./statusHandler-D6YAxhoN.js");
189
+ const { statusHandler } = await import("./statusHandler-BaQB40t7.js");
167
190
  return statusHandler;
168
191
  }
169
192
  });
@@ -274,7 +297,7 @@ Examples:
274
297
  }
275
298
  },
276
299
  loader: async () => {
277
- const { pushHandler } = await import("./pushHandler-DG96IOVd.js");
300
+ const { pushHandler } = await import("./pushHandler-DBBa6hKz.js");
278
301
  return pushHandler;
279
302
  }
280
303
  });
@@ -295,7 +318,7 @@ Examples:
295
318
  },
296
319
  parameters: {},
297
320
  loader: async () => {
298
- const { listHandler } = await import("./listHandler-5L3YE52T.js");
321
+ const { listHandler } = await import("./listHandler-EsB3AeOB.js");
299
322
  return listHandler;
300
323
  }
301
324
  });
@@ -328,7 +351,7 @@ Examples:
328
351
  flags: {}
329
352
  },
330
353
  loader: async () => {
331
- const { selectHandler } = await import("./selectHandler-CkIbO2qH.js");
354
+ const { selectHandler } = await import("./selectHandler-XOUHdyea.js");
332
355
  return selectHandler;
333
356
  }
334
357
  });
@@ -345,36 +368,41 @@ Examples:
345
368
  },
346
369
  parameters: {},
347
370
  loader: async () => {
348
- const { currentHandler } = await import("./currentHandler-Dzg819Np.js");
371
+ const { currentHandler } = await import("./currentHandler-Bm7GFMkj.js");
349
372
  return currentHandler;
350
373
  }
351
374
  });
352
375
 
353
376
  //#endregion
354
377
  //#region package.json
355
- var version = "0.2.0";
378
+ var version = "0.3.0";
356
379
 
357
380
  //#endregion
358
381
  //#region src/app.ts
382
+ const authRoutes = buildRouteMap({
383
+ routes: {
384
+ login: loginCommand,
385
+ logout: logoutCommand,
386
+ status: statusCommand
387
+ },
388
+ docs: { brief: "Manage authentication" }
389
+ });
390
+ const workspaceRoutes = buildRouteMap({
391
+ routes: {
392
+ list: listCommand,
393
+ select: selectCommand,
394
+ current: currentCommand
395
+ },
396
+ docs: { brief: "Manage workspace selection" }
397
+ });
359
398
  const routes = buildRouteMap({
360
399
  routes: {
361
- init: initCommand,
362
- auth: buildRouteMap({
363
- routes: {
364
- login: loginCommand,
365
- logout: logoutCommand,
366
- status: statusCommand
367
- },
368
- docs: { brief: "Manage authentication" }
369
- }),
370
- workspace: buildRouteMap({
371
- routes: {
372
- list: listCommand,
373
- select: selectCommand,
374
- current: currentCommand
375
- },
376
- docs: { brief: "Manage workspace selection" }
400
+ mcp: buildRouteMap({
401
+ routes: { add: mcpAddCommand },
402
+ docs: { brief: "Wire the Levr MCP server into installed AI clients" }
377
403
  }),
404
+ auth: authRoutes,
405
+ workspace: workspaceRoutes,
378
406
  push: pushCommand,
379
407
  install: buildInstallCommand("levr", { bash: "levr __complete" }),
380
408
  uninstall: buildUninstallCommand("levr", { bash: true })
@@ -1,4 +1,4 @@
1
- import { loadWorkspace } from "./workspace-store-BcyMJAht.js";
1
+ import { loadWorkspace } from "./workspace-store-4hfvsEHS.js";
2
2
 
3
3
  //#region src/commands/workspace/currentHandler.ts
4
4
  function currentHandler() {
@@ -30,7 +30,7 @@ function deleteCredentials() {
30
30
  const DEFAULT_API_URL = "https://api.levr.one";
31
31
  const KNOWN_AUTH_HOSTS = {
32
32
  "api.levr.one": "auth.levr.one",
33
- "api.levr.one": "auth.levr.one"
33
+ "api.levr.now": "auth.levr.now"
34
34
  };
35
35
  /** OAuth client ID for the CLI (seeded in oauth_clients table) */
36
36
  const CLI_CLIENT_ID = "3";
@@ -1,6 +1,8 @@
1
- import { authGetSitesV1, configureClient } from "./sdk-client-BCOB2qNU.js";
2
- import { loadWorkspace } from "./workspace-store-BcyMJAht.js";
3
- import { resolveToken } from "./resolve-token-DizP2xRY.js";
1
+ import "./env-NxtzJJPk.js";
2
+ import { authGetSitesV1, configureClient } from "./sdk-client-BeE6mXns.js";
3
+ import { loadWorkspace } from "./workspace-store-4hfvsEHS.js";
4
+ import "./token-refresh-Cz-FqDtC.js";
5
+ import { resolveToken } from "./resolve-token-BRPrqdG-.js";
4
6
 
5
7
  //#region src/commands/workspace/listHandler.ts
6
8
  async function listHandler() {
@@ -46,4 +48,4 @@ function printSites(ctx, sites) {
46
48
  }
47
49
 
48
50
  //#endregion
49
- export { listHandler, printSites };
51
+ export { listHandler };
@@ -1,6 +1,7 @@
1
- import { CLI_CLIENT_ID, getApiUrl, getAuthUrl, setSessionApiUrl, writeCredentials } from "./env-hpzB56ay.js";
2
- import { configureClient } from "./sdk-client-BCOB2qNU.js";
3
- import { autoSelectWorkspace } from "./resolve-workspace-EpjKI71z.js";
1
+ import { CLI_CLIENT_ID, getApiUrl, getAuthUrl, setSessionApiUrl, writeCredentials } from "./env-NxtzJJPk.js";
2
+ import { configureClient } from "./sdk-client-BeE6mXns.js";
3
+ import "./workspace-store-4hfvsEHS.js";
4
+ import { autoSelectWorkspace } from "./resolve-workspace-Dj7jgtE3.js";
4
5
  import chalk from "chalk";
5
6
  import { createHash, randomBytes } from "node:crypto";
6
7
  import { createServer } from "node:http";
@@ -384,4 +385,4 @@ async function saveTokensAndFinish(ctx, tokenData) {
384
385
  }
385
386
 
386
387
  //#endregion
387
- export { loginHandler, performLogin };
388
+ export { loginHandler };
@@ -1,5 +1,5 @@
1
- import { deleteCredentials, getPatToken } from "./env-hpzB56ay.js";
2
- import { clearWorkspace } from "./workspace-store-BcyMJAht.js";
1
+ import { deleteCredentials, getPatToken } from "./env-NxtzJJPk.js";
2
+ import { clearWorkspace } from "./workspace-store-4hfvsEHS.js";
3
3
 
4
4
  //#region src/commands/auth/logoutHandler.ts
5
5
  function logoutHandler() {
@@ -1,9 +1,9 @@
1
- import { getApiUrl, getAutomationSourceIdOverride, getSourceOverride, getTeamId } from "./env-hpzB56ay.js";
2
- import { client, configureClient, uploadAutomationIngest, uploadImport } from "./sdk-client-BCOB2qNU.js";
3
- import "./workspace-store-BcyMJAht.js";
4
- import { resolveWorkspace } from "./resolve-workspace-EpjKI71z.js";
5
- import "./token-refresh-BYu4XO3G.js";
6
- import { resolveToken } from "./resolve-token-DizP2xRY.js";
1
+ import { getApiUrl, getAutomationSourceIdOverride, getSourceOverride, getTeamId } from "./env-NxtzJJPk.js";
2
+ import { client, configureClient, uploadAutomationIngest, uploadImport } from "./sdk-client-BeE6mXns.js";
3
+ import "./workspace-store-4hfvsEHS.js";
4
+ import { resolveWorkspace } from "./resolve-workspace-Dj7jgtE3.js";
5
+ import "./token-refresh-Cz-FqDtC.js";
6
+ import { resolveToken } from "./resolve-token-BRPrqdG-.js";
7
7
  import { readFileSync, statSync } from "node:fs";
8
8
  import { basename } from "node:path";
9
9
  import ora from "ora";
@@ -1,5 +1,5 @@
1
- import { getApiUrl, getPatToken, readCredentials } from "./env-hpzB56ay.js";
2
- import { isTokenExpired, refreshToken } from "./token-refresh-BYu4XO3G.js";
1
+ import { getApiUrl, getPatToken, readCredentials } from "./env-NxtzJJPk.js";
2
+ import { isTokenExpired, refreshToken } from "./token-refresh-Cz-FqDtC.js";
3
3
 
4
4
  //#region src/auth/resolve-token.ts
5
5
  /**
@@ -45,4 +45,4 @@ async function resolveToken() {
45
45
  }
46
46
 
47
47
  //#endregion
48
- export { CredentialsMismatchError, resolveToken };
48
+ export { resolveToken };
@@ -1,5 +1,5 @@
1
- import { authGetSitesV1 } from "./sdk-client-BCOB2qNU.js";
2
- import { clearWorkspace, loadWorkspace, saveWorkspace } from "./workspace-store-BcyMJAht.js";
1
+ import { authGetSitesV1 } from "./sdk-client-BeE6mXns.js";
2
+ import { clearWorkspace, loadWorkspace, saveWorkspace } from "./workspace-store-4hfvsEHS.js";
3
3
 
4
4
  //#region src/workspace/resolve-workspace.ts
5
5
  async function fetchSites() {