neuvikon 0.2.2 → 0.2.3
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 +1 -1
- package/dist/index.mjs +36 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ as being worked on, by whom, with which tool.
|
|
|
38
38
|
| `neuvikon start --ticket EWWQ-1` | Begin tracking. `--tool claude-code\|codex\|cursor\|other` |
|
|
39
39
|
| `neuvikon stop` | Stop tracking |
|
|
40
40
|
| `neuvikon status` | Login, project setup, current ticket |
|
|
41
|
-
| `neuvikon logout` |
|
|
41
|
+
| `neuvikon logout` | Revoke this machine's token and forget it |
|
|
42
42
|
|
|
43
43
|
`start` also accepts the ticket on stdin, and pulls the reference out of it:
|
|
44
44
|
|
package/dist/index.mjs
CHANGED
|
@@ -366,15 +366,6 @@ async function login(flags) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
//#endregion
|
|
369
|
-
//#region src/commands/logout.ts
|
|
370
|
-
function logout() {
|
|
371
|
-
if (clearCredentials()) {
|
|
372
|
-
success("Logged out.");
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
info("You were not logged in.");
|
|
376
|
-
}
|
|
377
|
-
//#endregion
|
|
378
369
|
//#region src/session.ts
|
|
379
370
|
/**
|
|
380
371
|
* Scoped to the working directory rather than the machine: two checkouts driven
|
|
@@ -409,6 +400,42 @@ function clearSession() {
|
|
|
409
400
|
} catch {}
|
|
410
401
|
}
|
|
411
402
|
//#endregion
|
|
403
|
+
//#region src/commands/logout.ts
|
|
404
|
+
/**
|
|
405
|
+
* Deleting the local file is not enough: the token stays valid until the server
|
|
406
|
+
* is told otherwise, so a copy of it lifted from a backup or a shared machine
|
|
407
|
+
* would still be able to report. Revoking is the part that actually ends the
|
|
408
|
+
* session; forgetting it locally is bookkeeping.
|
|
409
|
+
*/
|
|
410
|
+
async function logout() {
|
|
411
|
+
const credentials = readCredentials();
|
|
412
|
+
if (!credentials) {
|
|
413
|
+
info("You were not logged in.");
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
const session = readSession();
|
|
417
|
+
if (session) {
|
|
418
|
+
await post(credentials.url, "/api/agent/events", {
|
|
419
|
+
token: credentials.token,
|
|
420
|
+
event: "stop",
|
|
421
|
+
sessionKey: session.sessionKey
|
|
422
|
+
}).catch(() => void 0);
|
|
423
|
+
clearSession();
|
|
424
|
+
}
|
|
425
|
+
let revoked = false;
|
|
426
|
+
try {
|
|
427
|
+
revoked = (await post(credentials.url, "/api/cli/auth/revoke", { token: credentials.token })).revoked;
|
|
428
|
+
} catch {}
|
|
429
|
+
if (process.env.NEUVIKON_TOKEN) warn("NEUVIKON_TOKEN is set in your environment — unset it to finish logging out.");
|
|
430
|
+
clearCredentials();
|
|
431
|
+
if (revoked) {
|
|
432
|
+
success("Logged out. That token has been revoked.");
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
success("Logged out on this machine.");
|
|
436
|
+
info(dim(" Could not reach Neuvikon to revoke the token — revoke it in settings if it leaked."));
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
412
439
|
//#region src/ticket.ts
|
|
413
440
|
/**
|
|
414
441
|
* Ticket refs look like `AWKN-14`. This pattern is deliberately looser than the
|