@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 +114 -48
- package/dist/addHandler-boWTd9yY.js +688 -0
- package/dist/cli.js +68 -40
- package/dist/{currentHandler-Dzg819Np.js → currentHandler-Bm7GFMkj.js} +1 -1
- package/dist/{env-hpzB56ay.js → env-NxtzJJPk.js} +1 -1
- package/dist/{listHandler-DDd6scZ8.js → listHandler-7DZhE8jn.js} +6 -4
- package/dist/{loginHandler-BSrs0mHq.js → loginHandler-Dfg89AD2.js} +5 -4
- package/dist/{logoutHandler-jWPGhzls.js → logoutHandler-BC8laIAB.js} +2 -2
- package/dist/{pushHandler-DG96IOVd.js → pushHandler-CC709aNJ.js} +6 -6
- package/dist/{resolve-token-DizP2xRY.js → resolve-token-BRPrqdG-.js} +3 -3
- package/dist/{resolve-workspace-EpjKI71z.js → resolve-workspace-vJZku4FK.js} +2 -2
- package/dist/{sdk-client-BCOB2qNU.js → sdk-client-BWrIbeUg.js} +192 -2
- package/dist/{selectHandler-CkIbO2qH.js → selectHandler-nOUsPW9p.js} +5 -5
- package/dist/{statusHandler-D6YAxhoN.js → statusHandler-DljfUcC2.js} +3 -3
- package/dist/{token-refresh-BYu4XO3G.js → token-refresh-Cz-FqDtC.js} +1 -1
- package/package.json +3 -1
- package/dist/initHandler-JN92u8td.js +0 -51
- package/dist/listHandler-5L3YE52T.js +0 -8
- package/dist/loginHandler-uZCrwdcR.js +0 -7
- /package/dist/{workspace-store-BcyMJAht.js → workspace-store-4hfvsEHS.js} +0 -0
package/dist/cli.js
CHANGED
|
@@ -53,41 +53,64 @@ function buildContext(process$1) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
|
-
//#region src/commands/
|
|
57
|
-
const
|
|
56
|
+
//#region src/commands/mcp/add.ts
|
|
57
|
+
const mcpAddCommand = buildCommand({
|
|
58
58
|
docs: {
|
|
59
|
-
brief: "
|
|
60
|
-
fullDescription: `
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
68
|
-
levr
|
|
69
|
-
levr
|
|
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
|
-
|
|
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: "
|
|
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: "
|
|
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: {
|
|
109
|
+
aliases: { y: "yes" }
|
|
87
110
|
},
|
|
88
111
|
loader: async () => {
|
|
89
|
-
const {
|
|
90
|
-
return
|
|
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-
|
|
150
|
+
const { loginHandler } = await import("./loginHandler-Dfg89AD2.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-
|
|
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-
|
|
189
|
+
const { statusHandler } = await import("./statusHandler-DljfUcC2.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-
|
|
300
|
+
const { pushHandler } = await import("./pushHandler-CC709aNJ.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-
|
|
321
|
+
const { listHandler } = await import("./listHandler-7DZhE8jn.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-
|
|
354
|
+
const { selectHandler } = await import("./selectHandler-nOUsPW9p.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-
|
|
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.
|
|
378
|
+
var version = "0.3.1";
|
|
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
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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 })
|
|
@@ -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.
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import "./env-NxtzJJPk.js";
|
|
2
|
+
import { authGetSitesV1, configureClient } from "./sdk-client-BWrIbeUg.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
|
|
51
|
+
export { listHandler };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CLI_CLIENT_ID, getApiUrl, getAuthUrl, setSessionApiUrl, writeCredentials } from "./env-
|
|
2
|
-
import { configureClient } from "./sdk-client-
|
|
3
|
-
import
|
|
1
|
+
import { CLI_CLIENT_ID, getApiUrl, getAuthUrl, setSessionApiUrl, writeCredentials } from "./env-NxtzJJPk.js";
|
|
2
|
+
import { configureClient } from "./sdk-client-BWrIbeUg.js";
|
|
3
|
+
import "./workspace-store-4hfvsEHS.js";
|
|
4
|
+
import { autoSelectWorkspace } from "./resolve-workspace-vJZku4FK.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
|
|
388
|
+
export { loginHandler };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { deleteCredentials, getPatToken } from "./env-
|
|
2
|
-
import { clearWorkspace } from "./workspace-store-
|
|
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-
|
|
2
|
-
import { client, configureClient, uploadAutomationIngest, uploadImport } from "./sdk-client-
|
|
3
|
-
import "./workspace-store-
|
|
4
|
-
import { resolveWorkspace } from "./resolve-workspace-
|
|
5
|
-
import "./token-refresh-
|
|
6
|
-
import { resolveToken } from "./resolve-token-
|
|
1
|
+
import { getApiUrl, getAutomationSourceIdOverride, getSourceOverride, getTeamId } from "./env-NxtzJJPk.js";
|
|
2
|
+
import { client, configureClient, uploadAutomationIngest, uploadImport } from "./sdk-client-BWrIbeUg.js";
|
|
3
|
+
import "./workspace-store-4hfvsEHS.js";
|
|
4
|
+
import { resolveWorkspace } from "./resolve-workspace-vJZku4FK.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-
|
|
2
|
-
import { isTokenExpired, refreshToken } from "./token-refresh-
|
|
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 {
|
|
48
|
+
export { resolveToken };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { authGetSitesV1 } from "./sdk-client-
|
|
2
|
-
import { clearWorkspace, loadWorkspace, saveWorkspace } from "./workspace-store-
|
|
1
|
+
import { authGetSitesV1 } from "./sdk-client-BWrIbeUg.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() {
|