@lotics/cli 0.13.0 → 0.15.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/src/cli.js +10 -17
- package/dist/src/client.d.ts +1 -0
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -81,7 +81,7 @@ function printAuthHelp() {
|
|
|
81
81
|
lotics auth signup <email> Create account, org, workspace, and API key
|
|
82
82
|
lotics auth api-key [key] Save an existing API key (e.g. from the web app)
|
|
83
83
|
lotics auth web Send a magic link email to access the web app
|
|
84
|
-
lotics auth whoami Show the
|
|
84
|
+
lotics auth whoami Show the current account's name, email, and organization
|
|
85
85
|
lotics auth logout Remove saved credentials
|
|
86
86
|
|
|
87
87
|
Signup flags:
|
|
@@ -352,29 +352,22 @@ async function main() {
|
|
|
352
352
|
return;
|
|
353
353
|
}
|
|
354
354
|
if (subcommand === "whoami") {
|
|
355
|
-
const config = loadConfig();
|
|
356
|
-
if (config?.email) {
|
|
357
|
-
console.log(config.email);
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
// No email cached — try fetching from API
|
|
361
355
|
const auth = resolveAuth(flags);
|
|
362
356
|
if (!auth) {
|
|
363
357
|
console.error('Not authenticated. Run "lotics auth signup" or set LOTICS_API_KEY.');
|
|
364
358
|
process.exit(1);
|
|
365
359
|
}
|
|
366
360
|
const client = new LoticsClient({ apiKey: auth.apiKey });
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
console.log(info.email);
|
|
361
|
+
const info = await client.whoami();
|
|
362
|
+
const existing = loadConfig() ?? {};
|
|
363
|
+
saveConfig({ ...existing, email: info.email });
|
|
364
|
+
if (flags.json) {
|
|
365
|
+
console.log(JSON.stringify(info, null, 2));
|
|
373
366
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
console.
|
|
377
|
-
|
|
367
|
+
else {
|
|
368
|
+
console.log(`Name: ${info.name}`);
|
|
369
|
+
console.log(`Email: ${info.email}`);
|
|
370
|
+
console.log(`Org: ${info.organization_name} (${info.organization_id})`);
|
|
378
371
|
}
|
|
379
372
|
return;
|
|
380
373
|
}
|
package/dist/src/client.d.ts
CHANGED