@emit-vision/cli 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -11
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -551,27 +551,41 @@ async function runLogs(args) {
551
551
  }
552
552
 
553
553
  // src/commands/status.ts
554
- async function runStatus() {
554
+ async function runStatus(args = []) {
555
555
  const config = loadConfig();
556
556
  const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
557
+ const json = args.includes("--json");
557
558
  if (!config.pat) {
558
- console.log("Not logged in.");
559
- console.log(` API: ${apiUrl}`);
560
- console.log("Run `emit-vision login` to authenticate.");
559
+ if (json) {
560
+ console.log(JSON.stringify({ apiUrl, tokenPrefix: null, valid: false }));
561
+ } else {
562
+ console.log("Not logged in.");
563
+ console.log(` API: ${apiUrl}`);
564
+ console.log("Run `emit-vision login` to authenticate.");
565
+ }
561
566
  return;
562
567
  }
563
- console.log(` API: ${apiUrl}`);
564
- console.log(` Token: ${config.pat.slice(0, 12)}\u2026`);
568
+ let valid = false;
565
569
  try {
566
570
  await apiFetch("/v1/management/projects");
567
- console.log(" Auth: valid \u2713");
571
+ valid = true;
568
572
  } catch {
569
- console.log(" Auth: invalid or expired \u2014 run `emit-vision login`");
573
+ }
574
+ if (json) {
575
+ console.log(
576
+ JSON.stringify({ apiUrl, tokenPrefix: config.pat.slice(0, 12), valid })
577
+ );
578
+ } else {
579
+ console.log(` API: ${apiUrl}`);
580
+ console.log(` Token: ${config.pat.slice(0, 12)}\u2026`);
581
+ console.log(
582
+ valid ? " Auth: valid \u2713" : " Auth: invalid or expired \u2014 run `emit-vision login`"
583
+ );
570
584
  }
571
585
  }
572
586
 
573
587
  // src/index.ts
574
- var VERSION = "0.2.1";
588
+ var VERSION = "0.2.2";
575
589
  var [cmd, subcmd, ...rest] = process.argv.slice(2);
576
590
  async function main() {
577
591
  if (cmd === "--version" || cmd === "-v") {
@@ -624,7 +638,7 @@ async function main() {
624
638
  } else if (cmd === "logs") {
625
639
  await runLogs(subcmd ? [subcmd, ...rest] : rest);
626
640
  } else if (cmd === "status") {
627
- await runStatus();
641
+ await runStatus(subcmd ? [subcmd, ...rest] : rest);
628
642
  } else {
629
643
  printHelp();
630
644
  if (cmd !== void 0) process.exit(1);
@@ -653,7 +667,7 @@ Commands:
653
667
  login [--token <pat>] [--api-url <url>] Authenticate (non-interactive: --token or EMIT_VISION_PAT env)
654
668
  login --browser [--yes] [--api-url <url>] Authenticate via browser OAuth
655
669
  logout Clear stored credentials
656
- status Show auth status and verify token
670
+ status [--json] Show auth status and verify token
657
671
 
658
672
  project list List your projects
659
673
  project create <name> [--json] Create a new project
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@emit-vision/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "CLI for emit-vision project management",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "bin": {
9
- "emit-vision": "./dist/index.js"
9
+ "emit-vision": "dist/index.js"
10
10
  },
11
11
  "files": [
12
12
  "dist"