@lumerahq/cli 0.15.0 → 0.15.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/dist/{auth-7RGL7GXU.js → auth-YQXLYQZZ.js} +7 -5
- package/dist/{chunk-UP3GV4HN.js → chunk-FZPONF23.js} +1 -1
- package/dist/chunk-PNKVD2UK.js +26 -0
- package/dist/{chunk-NL6MEHA3.js → chunk-RWPUF6L7.js} +4 -2
- package/dist/chunk-WZMAQXDY.js +163 -0
- package/dist/{dev-5EAZUQ2S.js → dev-NN766QJW.js} +7 -6
- package/dist/index.js +18 -17
- package/dist/{init-4JSHTLX2.js → init-ZI3FZSRE.js} +3 -2
- package/dist/{migrate-2DZ6RQ5K.js → migrate-MW5Q2HS6.js} +2 -1
- package/dist/{resources-BFT7V6UR.js → resources-26TZX2XU.js} +7 -6
- package/dist/{run-SPC4YXWR.js → run-WD5CKV3S.js} +7 -6
- package/dist/{skills-LKXXSJJS.js → skills-6TSSUJYR.js} +3 -2
- package/dist/{status-E4IHEUKO.js → status-ZFEEIK4O.js} +6 -5
- package/dist/{templates-6KMZWOYH.js → templates-ESFQ4QO4.js} +1 -0
- package/package.json +1 -1
- package/dist/chunk-D2BLSEGR.js +0 -59
- package/dist/chunk-NDLYGKS6.js +0 -77
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getBaseUrl,
|
|
2
3
|
getCredentials,
|
|
3
|
-
getTokenSource
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-D2BLSEGR.js";
|
|
4
|
+
getTokenSource,
|
|
5
|
+
init_auth
|
|
6
|
+
} from "./chunk-WZMAQXDY.js";
|
|
7
|
+
import "./chunk-PNKVD2UK.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/auth.ts
|
|
10
|
+
init_auth();
|
|
10
11
|
import pc from "picocolors";
|
|
11
12
|
import { createServer } from "http";
|
|
12
13
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
|
@@ -204,6 +205,7 @@ async function login(args) {
|
|
|
204
205
|
const userInfo = await fetchUserInfo(result.token);
|
|
205
206
|
const credentials = {
|
|
206
207
|
token: result.token,
|
|
208
|
+
base_url: baseUrl,
|
|
207
209
|
user: userInfo.email,
|
|
208
210
|
company: userInfo.company,
|
|
209
211
|
created: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
__esm,
|
|
24
|
+
__export,
|
|
25
|
+
__toCommonJS
|
|
26
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getToken
|
|
3
|
-
|
|
2
|
+
getToken,
|
|
3
|
+
init_auth
|
|
4
|
+
} from "./chunk-WZMAQXDY.js";
|
|
4
5
|
|
|
5
6
|
// src/lib/api.ts
|
|
7
|
+
init_auth();
|
|
6
8
|
import { readFileSync } from "fs";
|
|
7
9
|
import { fileURLToPath } from "url";
|
|
8
10
|
import { dirname, resolve } from "path";
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm,
|
|
3
|
+
__export,
|
|
4
|
+
__toCommonJS
|
|
5
|
+
} from "./chunk-PNKVD2UK.js";
|
|
6
|
+
|
|
7
|
+
// src/lib/auth.ts
|
|
8
|
+
var auth_exports = {};
|
|
9
|
+
__export(auth_exports, {
|
|
10
|
+
getCredentials: () => getCredentials,
|
|
11
|
+
getToken: () => getToken,
|
|
12
|
+
getTokenSource: () => getTokenSource
|
|
13
|
+
});
|
|
14
|
+
import { existsSync, readFileSync } from "fs";
|
|
15
|
+
import { homedir } from "os";
|
|
16
|
+
import { join } from "path";
|
|
17
|
+
function getLocalCredsPath(cwd = process.cwd()) {
|
|
18
|
+
return join(cwd, ".lumera", "credentials.json");
|
|
19
|
+
}
|
|
20
|
+
function getToken(cwd = process.cwd()) {
|
|
21
|
+
if (process.env.LUMERA_TOKEN) {
|
|
22
|
+
return process.env.LUMERA_TOKEN;
|
|
23
|
+
}
|
|
24
|
+
const localCredsPath = getLocalCredsPath(cwd);
|
|
25
|
+
if (existsSync(localCredsPath)) {
|
|
26
|
+
try {
|
|
27
|
+
const creds = JSON.parse(readFileSync(localCredsPath, "utf-8"));
|
|
28
|
+
if (creds.token) return creds.token;
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (existsSync(GLOBAL_CREDS_PATH)) {
|
|
33
|
+
try {
|
|
34
|
+
const creds = JSON.parse(readFileSync(GLOBAL_CREDS_PATH, "utf-8"));
|
|
35
|
+
if (creds.token) return creds.token;
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
throw new Error(
|
|
40
|
+
"No Lumera token found.\n Run `lumera login` to authenticate, or\n Set LUMERA_TOKEN environment variable"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function getTokenSource(cwd = process.cwd()) {
|
|
44
|
+
if (process.env.LUMERA_TOKEN) {
|
|
45
|
+
return "environment (LUMERA_TOKEN)";
|
|
46
|
+
}
|
|
47
|
+
const localCredsPath = getLocalCredsPath(cwd);
|
|
48
|
+
if (existsSync(localCredsPath)) {
|
|
49
|
+
try {
|
|
50
|
+
const creds = JSON.parse(readFileSync(localCredsPath, "utf-8"));
|
|
51
|
+
if (creds.token) return `project (${localCredsPath})`;
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (existsSync(GLOBAL_CREDS_PATH)) {
|
|
56
|
+
try {
|
|
57
|
+
const creds = JSON.parse(readFileSync(GLOBAL_CREDS_PATH, "utf-8"));
|
|
58
|
+
if (creds.token) return `global (${GLOBAL_CREDS_PATH})`;
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
function getCredentials(cwd = process.cwd()) {
|
|
65
|
+
const localCredsPath = getLocalCredsPath(cwd);
|
|
66
|
+
if (existsSync(localCredsPath)) {
|
|
67
|
+
try {
|
|
68
|
+
const creds = JSON.parse(readFileSync(localCredsPath, "utf-8"));
|
|
69
|
+
if (creds.token) return creds;
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (existsSync(GLOBAL_CREDS_PATH)) {
|
|
74
|
+
try {
|
|
75
|
+
const creds = JSON.parse(readFileSync(GLOBAL_CREDS_PATH, "utf-8"));
|
|
76
|
+
if (creds.token) return creds;
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
var GLOBAL_CONFIG_DIR, GLOBAL_CREDS_PATH;
|
|
83
|
+
var init_auth = __esm({
|
|
84
|
+
"src/lib/auth.ts"() {
|
|
85
|
+
"use strict";
|
|
86
|
+
GLOBAL_CONFIG_DIR = join(homedir(), ".config", "lumera");
|
|
87
|
+
GLOBAL_CREDS_PATH = join(GLOBAL_CONFIG_DIR, "credentials.json");
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// src/lib/config.ts
|
|
92
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
93
|
+
import { resolve, join as join2 } from "path";
|
|
94
|
+
function findProjectRoot(startDir = process.cwd()) {
|
|
95
|
+
let dir = startDir;
|
|
96
|
+
while (dir !== "/") {
|
|
97
|
+
if (existsSync2(join2(dir, "package.json"))) {
|
|
98
|
+
return dir;
|
|
99
|
+
}
|
|
100
|
+
dir = resolve(dir, "..");
|
|
101
|
+
}
|
|
102
|
+
throw new Error("Could not find project root (no package.json found)");
|
|
103
|
+
}
|
|
104
|
+
function readPackageJson(projectRoot) {
|
|
105
|
+
const pkgPath = join2(projectRoot, "package.json");
|
|
106
|
+
if (!existsSync2(pkgPath)) {
|
|
107
|
+
throw new Error(`package.json not found at ${pkgPath}`);
|
|
108
|
+
}
|
|
109
|
+
return JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
110
|
+
}
|
|
111
|
+
function getAppName(projectRoot) {
|
|
112
|
+
const pkg = readPackageJson(projectRoot);
|
|
113
|
+
return pkg.name;
|
|
114
|
+
}
|
|
115
|
+
function getAppTitle(projectRoot) {
|
|
116
|
+
const pkg = readPackageJson(projectRoot);
|
|
117
|
+
return pkg.lumera?.name || pkg.name;
|
|
118
|
+
}
|
|
119
|
+
function detectProjectVersion(projectRoot) {
|
|
120
|
+
const pkg = readPackageJson(projectRoot);
|
|
121
|
+
if (pkg.lumera?.version !== void 0) {
|
|
122
|
+
return pkg.lumera.version;
|
|
123
|
+
}
|
|
124
|
+
if (existsSync2(join2(projectRoot, "lumera_platform"))) {
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
if (existsSync2(join2(projectRoot, "platform"))) {
|
|
128
|
+
return 1;
|
|
129
|
+
}
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
function getBaseUrl() {
|
|
133
|
+
const envBase = process.env.LUMERA_BASE_URL || process.env.LUMERA_API_URL;
|
|
134
|
+
if (envBase) {
|
|
135
|
+
return envBase.replace(/\/api\/?$/, "").replace(/\/$/, "");
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
const { getCredentials: getCredentials2 } = (init_auth(), __toCommonJS(auth_exports));
|
|
139
|
+
const creds = getCredentials2();
|
|
140
|
+
if (creds?.base_url) {
|
|
141
|
+
return creds.base_url.replace(/\/api\/?$/, "").replace(/\/$/, "");
|
|
142
|
+
}
|
|
143
|
+
} catch {
|
|
144
|
+
}
|
|
145
|
+
return "https://app.lumerahq.com";
|
|
146
|
+
}
|
|
147
|
+
function getApiUrl() {
|
|
148
|
+
return `${getBaseUrl()}/api`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
getToken,
|
|
153
|
+
getTokenSource,
|
|
154
|
+
getCredentials,
|
|
155
|
+
init_auth,
|
|
156
|
+
findProjectRoot,
|
|
157
|
+
readPackageJson,
|
|
158
|
+
getAppName,
|
|
159
|
+
getAppTitle,
|
|
160
|
+
detectProjectVersion,
|
|
161
|
+
getBaseUrl,
|
|
162
|
+
getApiUrl
|
|
163
|
+
};
|
|
@@ -4,22 +4,23 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createApiClient,
|
|
6
6
|
loadEnv
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
getToken
|
|
10
|
-
} from "./chunk-NDLYGKS6.js";
|
|
7
|
+
} from "./chunk-RWPUF6L7.js";
|
|
11
8
|
import {
|
|
12
9
|
findProjectRoot,
|
|
13
10
|
getApiUrl,
|
|
14
11
|
getAppName,
|
|
15
|
-
getAppTitle
|
|
16
|
-
|
|
12
|
+
getAppTitle,
|
|
13
|
+
getToken,
|
|
14
|
+
init_auth
|
|
15
|
+
} from "./chunk-WZMAQXDY.js";
|
|
16
|
+
import "./chunk-PNKVD2UK.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/dev.ts
|
|
19
19
|
import pc from "picocolors";
|
|
20
20
|
import { execFileSync, execSync } from "child_process";
|
|
21
21
|
import { existsSync } from "fs";
|
|
22
22
|
import { join } from "path";
|
|
23
|
+
init_auth();
|
|
23
24
|
function parseFlags(args) {
|
|
24
25
|
const result = {};
|
|
25
26
|
for (let i = 0; i < args.length; i++) {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import "./chunk-PNKVD2UK.js";
|
|
2
3
|
|
|
3
4
|
// src/index.ts
|
|
4
5
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -212,59 +213,59 @@ async function main() {
|
|
|
212
213
|
switch (command) {
|
|
213
214
|
// Resource commands
|
|
214
215
|
case "plan":
|
|
215
|
-
await import("./resources-
|
|
216
|
+
await import("./resources-26TZX2XU.js").then((m) => m.plan(args.slice(1)));
|
|
216
217
|
break;
|
|
217
218
|
case "apply":
|
|
218
|
-
await import("./resources-
|
|
219
|
+
await import("./resources-26TZX2XU.js").then((m) => m.apply(args.slice(1)));
|
|
219
220
|
break;
|
|
220
221
|
case "pull":
|
|
221
|
-
await import("./resources-
|
|
222
|
+
await import("./resources-26TZX2XU.js").then((m) => m.pull(args.slice(1)));
|
|
222
223
|
break;
|
|
223
224
|
case "destroy":
|
|
224
|
-
await import("./resources-
|
|
225
|
+
await import("./resources-26TZX2XU.js").then((m) => m.destroy(args.slice(1)));
|
|
225
226
|
break;
|
|
226
227
|
case "list":
|
|
227
|
-
await import("./resources-
|
|
228
|
+
await import("./resources-26TZX2XU.js").then((m) => m.list(args.slice(1)));
|
|
228
229
|
break;
|
|
229
230
|
case "show":
|
|
230
|
-
await import("./resources-
|
|
231
|
+
await import("./resources-26TZX2XU.js").then((m) => m.show(args.slice(1)));
|
|
231
232
|
break;
|
|
232
233
|
case "diff":
|
|
233
|
-
await import("./resources-
|
|
234
|
+
await import("./resources-26TZX2XU.js").then((m) => m.diff(args.slice(1)));
|
|
234
235
|
break;
|
|
235
236
|
// Development
|
|
236
237
|
case "dev":
|
|
237
|
-
await import("./dev-
|
|
238
|
+
await import("./dev-NN766QJW.js").then((m) => m.dev(args.slice(1)));
|
|
238
239
|
break;
|
|
239
240
|
case "run":
|
|
240
|
-
await import("./run-
|
|
241
|
+
await import("./run-WD5CKV3S.js").then((m) => m.run(args.slice(1)));
|
|
241
242
|
break;
|
|
242
243
|
// Project
|
|
243
244
|
case "init":
|
|
244
|
-
await import("./init-
|
|
245
|
+
await import("./init-ZI3FZSRE.js").then((m) => m.init(args.slice(1)));
|
|
245
246
|
break;
|
|
246
247
|
case "templates":
|
|
247
|
-
await import("./templates-
|
|
248
|
+
await import("./templates-ESFQ4QO4.js").then((m) => m.templates(subcommand, args.slice(2)));
|
|
248
249
|
break;
|
|
249
250
|
case "status":
|
|
250
|
-
await import("./status-
|
|
251
|
+
await import("./status-ZFEEIK4O.js").then((m) => m.status(args.slice(1)));
|
|
251
252
|
break;
|
|
252
253
|
case "migrate":
|
|
253
|
-
await import("./migrate-
|
|
254
|
+
await import("./migrate-MW5Q2HS6.js").then((m) => m.migrate(args.slice(1)));
|
|
254
255
|
break;
|
|
255
256
|
// Skills
|
|
256
257
|
case "skills":
|
|
257
|
-
await import("./skills-
|
|
258
|
+
await import("./skills-6TSSUJYR.js").then((m) => m.skills(subcommand, args.slice(2)));
|
|
258
259
|
break;
|
|
259
260
|
// Auth
|
|
260
261
|
case "login":
|
|
261
|
-
await import("./auth-
|
|
262
|
+
await import("./auth-YQXLYQZZ.js").then((m) => m.login(args.slice(1)));
|
|
262
263
|
break;
|
|
263
264
|
case "logout":
|
|
264
|
-
await import("./auth-
|
|
265
|
+
await import("./auth-YQXLYQZZ.js").then((m) => m.logout(args.slice(1)));
|
|
265
266
|
break;
|
|
266
267
|
case "whoami":
|
|
267
|
-
await import("./auth-
|
|
268
|
+
await import("./auth-YQXLYQZZ.js").then((m) => m.whoami());
|
|
268
269
|
break;
|
|
269
270
|
// Convenience aliases
|
|
270
271
|
case "help":
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
installAllSkills,
|
|
3
3
|
syncClaudeMd
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FZPONF23.js";
|
|
5
5
|
import {
|
|
6
6
|
listAllTemplates,
|
|
7
7
|
resolveTemplate
|
|
8
8
|
} from "./chunk-CHRKCAIZ.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-WZMAQXDY.js";
|
|
10
|
+
import "./chunk-PNKVD2UK.js";
|
|
10
11
|
|
|
11
12
|
// src/commands/init.ts
|
|
12
13
|
import pc2 from "picocolors";
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createApiClient,
|
|
6
6
|
loadEnv
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
getToken
|
|
10
|
-
} from "./chunk-NDLYGKS6.js";
|
|
7
|
+
} from "./chunk-RWPUF6L7.js";
|
|
11
8
|
import {
|
|
12
9
|
findProjectRoot,
|
|
13
10
|
getApiUrl,
|
|
14
11
|
getAppName,
|
|
15
|
-
getAppTitle
|
|
16
|
-
|
|
12
|
+
getAppTitle,
|
|
13
|
+
getToken,
|
|
14
|
+
init_auth
|
|
15
|
+
} from "./chunk-WZMAQXDY.js";
|
|
16
|
+
import "./chunk-PNKVD2UK.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/resources.ts
|
|
19
19
|
import pc from "picocolors";
|
|
@@ -21,6 +21,7 @@ import prompts from "prompts";
|
|
|
21
21
|
import { execFileSync, execSync } from "child_process";
|
|
22
22
|
import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
23
23
|
import { join, resolve } from "path";
|
|
24
|
+
init_auth();
|
|
24
25
|
function detectPackageManager() {
|
|
25
26
|
for (const pm of ["bun", "pnpm", "yarn", "npm"]) {
|
|
26
27
|
try {
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiClient,
|
|
3
3
|
loadEnv
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
getToken
|
|
7
|
-
} from "./chunk-NDLYGKS6.js";
|
|
4
|
+
} from "./chunk-RWPUF6L7.js";
|
|
8
5
|
import {
|
|
9
6
|
findProjectRoot,
|
|
10
|
-
getApiUrl
|
|
11
|
-
|
|
7
|
+
getApiUrl,
|
|
8
|
+
getToken,
|
|
9
|
+
init_auth
|
|
10
|
+
} from "./chunk-WZMAQXDY.js";
|
|
11
|
+
import "./chunk-PNKVD2UK.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/run.ts
|
|
14
14
|
import pc from "picocolors";
|
|
15
15
|
import { spawn } from "child_process";
|
|
16
16
|
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
17
17
|
import { resolve, extname, join } from "path";
|
|
18
|
+
init_auth();
|
|
18
19
|
function showHelp() {
|
|
19
20
|
console.log(`
|
|
20
21
|
${pc.dim("Usage:")}
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
installAllSkills,
|
|
7
7
|
slugToFilename,
|
|
8
8
|
syncClaudeMd
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-FZPONF23.js";
|
|
10
|
+
import "./chunk-WZMAQXDY.js";
|
|
11
|
+
import "./chunk-PNKVD2UK.js";
|
|
11
12
|
|
|
12
13
|
// src/commands/skills.ts
|
|
13
14
|
import pc from "picocolors";
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getToken,
|
|
3
|
-
getTokenSource
|
|
4
|
-
} from "./chunk-NDLYGKS6.js";
|
|
5
1
|
import {
|
|
6
2
|
detectProjectVersion,
|
|
7
3
|
findProjectRoot,
|
|
8
4
|
getAppName,
|
|
9
5
|
getAppTitle,
|
|
10
6
|
getBaseUrl,
|
|
7
|
+
getToken,
|
|
8
|
+
getTokenSource,
|
|
9
|
+
init_auth,
|
|
11
10
|
readPackageJson
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WZMAQXDY.js";
|
|
12
|
+
import "./chunk-PNKVD2UK.js";
|
|
13
13
|
|
|
14
14
|
// src/commands/status.ts
|
|
15
15
|
import pc from "picocolors";
|
|
16
16
|
import { existsSync, readdirSync } from "fs";
|
|
17
17
|
import { join } from "path";
|
|
18
|
+
init_auth();
|
|
18
19
|
async function validateToken(token) {
|
|
19
20
|
const baseUrl = getBaseUrl();
|
|
20
21
|
try {
|
package/package.json
CHANGED
package/dist/chunk-D2BLSEGR.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// src/lib/config.ts
|
|
2
|
-
import { existsSync, readFileSync } from "fs";
|
|
3
|
-
import { resolve, join } from "path";
|
|
4
|
-
function findProjectRoot(startDir = process.cwd()) {
|
|
5
|
-
let dir = startDir;
|
|
6
|
-
while (dir !== "/") {
|
|
7
|
-
if (existsSync(join(dir, "package.json"))) {
|
|
8
|
-
return dir;
|
|
9
|
-
}
|
|
10
|
-
dir = resolve(dir, "..");
|
|
11
|
-
}
|
|
12
|
-
throw new Error("Could not find project root (no package.json found)");
|
|
13
|
-
}
|
|
14
|
-
function readPackageJson(projectRoot) {
|
|
15
|
-
const pkgPath = join(projectRoot, "package.json");
|
|
16
|
-
if (!existsSync(pkgPath)) {
|
|
17
|
-
throw new Error(`package.json not found at ${pkgPath}`);
|
|
18
|
-
}
|
|
19
|
-
return JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
20
|
-
}
|
|
21
|
-
function getAppName(projectRoot) {
|
|
22
|
-
const pkg = readPackageJson(projectRoot);
|
|
23
|
-
return pkg.name;
|
|
24
|
-
}
|
|
25
|
-
function getAppTitle(projectRoot) {
|
|
26
|
-
const pkg = readPackageJson(projectRoot);
|
|
27
|
-
return pkg.lumera?.name || pkg.name;
|
|
28
|
-
}
|
|
29
|
-
function detectProjectVersion(projectRoot) {
|
|
30
|
-
const pkg = readPackageJson(projectRoot);
|
|
31
|
-
if (pkg.lumera?.version !== void 0) {
|
|
32
|
-
return pkg.lumera.version;
|
|
33
|
-
}
|
|
34
|
-
if (existsSync(join(projectRoot, "lumera_platform"))) {
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
if (existsSync(join(projectRoot, "platform"))) {
|
|
38
|
-
return 1;
|
|
39
|
-
}
|
|
40
|
-
return 1;
|
|
41
|
-
}
|
|
42
|
-
function getBaseUrl() {
|
|
43
|
-
let base = process.env.LUMERA_BASE_URL || process.env.LUMERA_API_URL || "https://app.lumerahq.com";
|
|
44
|
-
base = base.replace(/\/api\/?$/, "").replace(/\/$/, "");
|
|
45
|
-
return base;
|
|
46
|
-
}
|
|
47
|
-
function getApiUrl() {
|
|
48
|
-
return `${getBaseUrl()}/api`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
findProjectRoot,
|
|
53
|
-
readPackageJson,
|
|
54
|
-
getAppName,
|
|
55
|
-
getAppTitle,
|
|
56
|
-
detectProjectVersion,
|
|
57
|
-
getBaseUrl,
|
|
58
|
-
getApiUrl
|
|
59
|
-
};
|
package/dist/chunk-NDLYGKS6.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// src/lib/auth.ts
|
|
2
|
-
import { existsSync, readFileSync } from "fs";
|
|
3
|
-
import { homedir } from "os";
|
|
4
|
-
import { join } from "path";
|
|
5
|
-
var GLOBAL_CONFIG_DIR = join(homedir(), ".config", "lumera");
|
|
6
|
-
var GLOBAL_CREDS_PATH = join(GLOBAL_CONFIG_DIR, "credentials.json");
|
|
7
|
-
function getLocalCredsPath(cwd = process.cwd()) {
|
|
8
|
-
return join(cwd, ".lumera", "credentials.json");
|
|
9
|
-
}
|
|
10
|
-
function getToken(cwd = process.cwd()) {
|
|
11
|
-
if (process.env.LUMERA_TOKEN) {
|
|
12
|
-
return process.env.LUMERA_TOKEN;
|
|
13
|
-
}
|
|
14
|
-
const localCredsPath = getLocalCredsPath(cwd);
|
|
15
|
-
if (existsSync(localCredsPath)) {
|
|
16
|
-
try {
|
|
17
|
-
const creds = JSON.parse(readFileSync(localCredsPath, "utf-8"));
|
|
18
|
-
if (creds.token) return creds.token;
|
|
19
|
-
} catch {
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (existsSync(GLOBAL_CREDS_PATH)) {
|
|
23
|
-
try {
|
|
24
|
-
const creds = JSON.parse(readFileSync(GLOBAL_CREDS_PATH, "utf-8"));
|
|
25
|
-
if (creds.token) return creds.token;
|
|
26
|
-
} catch {
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
throw new Error(
|
|
30
|
-
"No Lumera token found.\n Run `lumera login` to authenticate, or\n Set LUMERA_TOKEN environment variable"
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
function getTokenSource(cwd = process.cwd()) {
|
|
34
|
-
if (process.env.LUMERA_TOKEN) {
|
|
35
|
-
return "environment (LUMERA_TOKEN)";
|
|
36
|
-
}
|
|
37
|
-
const localCredsPath = getLocalCredsPath(cwd);
|
|
38
|
-
if (existsSync(localCredsPath)) {
|
|
39
|
-
try {
|
|
40
|
-
const creds = JSON.parse(readFileSync(localCredsPath, "utf-8"));
|
|
41
|
-
if (creds.token) return `project (${localCredsPath})`;
|
|
42
|
-
} catch {
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (existsSync(GLOBAL_CREDS_PATH)) {
|
|
46
|
-
try {
|
|
47
|
-
const creds = JSON.parse(readFileSync(GLOBAL_CREDS_PATH, "utf-8"));
|
|
48
|
-
if (creds.token) return `global (${GLOBAL_CREDS_PATH})`;
|
|
49
|
-
} catch {
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
function getCredentials(cwd = process.cwd()) {
|
|
55
|
-
const localCredsPath = getLocalCredsPath(cwd);
|
|
56
|
-
if (existsSync(localCredsPath)) {
|
|
57
|
-
try {
|
|
58
|
-
const creds = JSON.parse(readFileSync(localCredsPath, "utf-8"));
|
|
59
|
-
if (creds.token) return creds;
|
|
60
|
-
} catch {
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (existsSync(GLOBAL_CREDS_PATH)) {
|
|
64
|
-
try {
|
|
65
|
-
const creds = JSON.parse(readFileSync(GLOBAL_CREDS_PATH, "utf-8"));
|
|
66
|
-
if (creds.token) return creds;
|
|
67
|
-
} catch {
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
getToken,
|
|
75
|
-
getTokenSource,
|
|
76
|
-
getCredentials
|
|
77
|
-
};
|