@leroylabs/cli 0.1.4 → 0.1.6

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/bin/leroy.mjs +27 -3
  2. package/package.json +2 -6
package/bin/leroy.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { createInterface } from "node:readline/promises";
4
- import { stdin as input, stdout as output } from "node:process";
4
+ import { stdin as input, stderr, stdout as output } from "node:process";
5
5
  import React from "react";
6
6
 
7
7
  import { parseArgs } from "../src/args.mjs";
@@ -29,6 +29,28 @@ function print(value = "") {
29
29
  output.write(`${value}\n`);
30
30
  }
31
31
 
32
+ function printError(value = "") {
33
+ stderr.write(`${value}\n`);
34
+ }
35
+
36
+ function printMissingApiKeyGuidance(options) {
37
+ const plainMessage = "No API key found. Run `leroy connect` or set LEROY_API_KEY.";
38
+ if (!input.isTTY || !stderr.isTTY || options.json) {
39
+ printError(`leroy: ${plainMessage}`);
40
+ return;
41
+ }
42
+
43
+ const colorEnabled = !options.noColor;
44
+ printError();
45
+ printError(`${promptStyle("▲", ["green"], colorEnabled)} ${promptStyle("Connect Leroy", ["bold", "white"], colorEnabled)}`);
46
+ printError();
47
+ printError(` ${promptStyle("Live market evidence requires an MCP key.", ["white"], colorEnabled)}`);
48
+ printError(` ${promptStyle("Create or activate one at", ["neutral"], colorEnabled)}`);
49
+ printError(` ${promptStyle("https://getleroy.com/mcp", ["green"], colorEnabled)}`);
50
+ printError();
51
+ printError(` ${promptStyle("›", ["green"], colorEnabled)} Run ${promptStyle("leroy connect", ["bold", "white"], colorEnabled)} to continue.`);
52
+ }
53
+
32
54
  async function connect(options) {
33
55
  const config = await resolvedConfig(options);
34
56
  let apiKey = config.apiKey;
@@ -71,7 +93,8 @@ async function evaluate(options) {
71
93
  } else {
72
94
  const config = await resolvedConfig(options);
73
95
  if (!config.apiKey) {
74
- throw usageError("No API key found. Run `leroy connect` or set LEROY_API_KEY.");
96
+ printMissingApiKeyGuidance(options);
97
+ return 2;
75
98
  }
76
99
  client = new LeroyMcpClient({ endpoint: config.endpoint, apiKey: config.apiKey });
77
100
  }
@@ -115,7 +138,8 @@ async function watch(options) {
115
138
  } else {
116
139
  const config = await resolvedConfig(options);
117
140
  if (!config.apiKey) {
118
- throw usageError("No API key found. Run `leroy connect` or set LEROY_API_KEY.");
141
+ printMissingApiKeyGuidance(options);
142
+ return 2;
119
143
  }
120
144
  client = new LeroyMcpClient({ endpoint: config.endpoint, apiKey: config.apiKey });
121
145
  }
package/package.json CHANGED
@@ -1,18 +1,14 @@
1
1
  {
2
2
  "name": "@leroylabs/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Command-line access to Leroy market evidence.",
5
+ "homepage": "https://getleroy.com",
5
6
  "type": "module",
6
7
  "files": [
7
8
  "bin",
8
9
  "src",
9
10
  "README.md"
10
11
  ],
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/MakeMeModern/leroy.git",
14
- "directory": "packages/leroy-cli"
15
- },
16
12
  "publishConfig": {
17
13
  "access": "public"
18
14
  },