@mentio-dev/cli 0.1.1 → 0.2.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/README.md +2 -2
- package/dist/index.js +196 -47
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install -g @mentio-dev/cli
|
|
7
|
-
mentio auth:
|
|
7
|
+
mentio auth:login
|
|
8
8
|
mentio keywords:create --term "acme" --kind brand
|
|
9
9
|
mentio mentions:search --relevant true --sentiment negative --limit 20
|
|
10
10
|
mentio mentions:update mm_7f3a... --status done
|
|
@@ -12,4 +12,4 @@ mentio analytics:summary --range 7d --compare true
|
|
|
12
12
|
mentio mentions:watch --platform reddit | jq -r '.post.url'
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
JSON out, compact when piped and indented on a terminal; `--table` for lists.
|
|
15
|
+
JSON out, compact when piped and indented on a terminal; `--table` for lists. `mentio auth:login` signs in through the browser; keys also come from `--api-key`, `MENTIO_API_KEY`, or `mentio auth:set`. Every command, by area, is at [docs.mentio.dev/cli](https://docs.mentio.dev/cli).
|
package/dist/index.js
CHANGED
|
@@ -8,11 +8,12 @@ var __export = (target, all) => {
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { Command, Option } from "commander";
|
|
10
10
|
import { writeFileSync as writeFileSync2 } from "fs";
|
|
11
|
+
import { hostname } from "os";
|
|
11
12
|
|
|
12
13
|
// package.json
|
|
13
14
|
var package_default = {
|
|
14
15
|
name: "@mentio-dev/cli",
|
|
15
|
-
version: "0.
|
|
16
|
+
version: "0.2.1",
|
|
16
17
|
description: "Command-line client for the Mentio API: one command per endpoint, plus watch and MCP helpers.",
|
|
17
18
|
license: "MIT",
|
|
18
19
|
homepage: "https://docs.mentio.dev/cli",
|
|
@@ -225,6 +226,94 @@ function buildRequest(op, positional, flags, jsonBody) {
|
|
|
225
226
|
return { path, query, body };
|
|
226
227
|
}
|
|
227
228
|
|
|
229
|
+
// src/login.ts
|
|
230
|
+
import { randomBytes } from "crypto";
|
|
231
|
+
import { spawn } from "child_process";
|
|
232
|
+
import { createServer } from "http";
|
|
233
|
+
var DEFAULT_APP_URL = "https://app.mentio.dev";
|
|
234
|
+
var LoginError = class extends Error {
|
|
235
|
+
constructor(message) {
|
|
236
|
+
super(message);
|
|
237
|
+
this.name = "LoginError";
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var newState = () => randomBytes(24).toString("base64url");
|
|
241
|
+
function loginUrl(appUrl, params) {
|
|
242
|
+
const url = new URL("/cli/authorize", `${appUrl.replace(/\/+$/, "")}/`);
|
|
243
|
+
url.searchParams.set("port", String(params.port));
|
|
244
|
+
url.searchParams.set("state", params.state);
|
|
245
|
+
url.searchParams.set("name", params.name);
|
|
246
|
+
url.searchParams.set("scope", params.scope);
|
|
247
|
+
return url.toString();
|
|
248
|
+
}
|
|
249
|
+
var page = (title, body) => `<!doctype html><meta charset="utf-8"><title>${title}</title><body style="font:16px system-ui;padding:3rem;max-width:36rem;margin:auto"><h1 style="font-size:1.25rem">${title}</h1><p>${body}</p></body>`;
|
|
250
|
+
function startCallbackServer(state, timeoutMs) {
|
|
251
|
+
return new Promise((resolveServer, rejectServer) => {
|
|
252
|
+
let settle = null;
|
|
253
|
+
const key = new Promise((resolve, reject) => {
|
|
254
|
+
settle = { resolve, reject };
|
|
255
|
+
});
|
|
256
|
+
const server = createServer((req, res) => {
|
|
257
|
+
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
258
|
+
if (url.pathname !== "/callback") {
|
|
259
|
+
res.writeHead(404, { "content-type": "text/html; charset=utf-8" }).end(page("Not found", "Nothing here."));
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const error = url.searchParams.get("error");
|
|
263
|
+
if (error) {
|
|
264
|
+
res.writeHead(200, { "content-type": "text/html; charset=utf-8" }).end(page("Cancelled", "The CLI was not authorized. You can close this tab."));
|
|
265
|
+
finish(() => settle?.reject(new LoginError(error === "denied" ? "Authorization was declined in the browser." : `Authorization failed: ${error}`)));
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (url.searchParams.get("state") !== state) {
|
|
269
|
+
res.writeHead(400, { "content-type": "text/html; charset=utf-8" }).end(page("State mismatch", "This callback does not belong to the running login. Run mentio auth:login again."));
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const issued = url.searchParams.get("key");
|
|
273
|
+
if (!issued) {
|
|
274
|
+
res.writeHead(400, { "content-type": "text/html; charset=utf-8" }).end(page("Missing key", "The callback carried no key. Run mentio auth:login again."));
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
res.writeHead(200, { "content-type": "text/html; charset=utf-8" }).end(page("Mentio CLI connected", "The key is stored on this computer. You can close this tab and go back to the terminal."));
|
|
278
|
+
finish(() => settle?.resolve(issued));
|
|
279
|
+
});
|
|
280
|
+
const timer = setTimeout(() => finish(() => settle?.reject(new LoginError(`No authorization arrived within ${Math.round(timeoutMs / 1e3)} seconds.`))), timeoutMs);
|
|
281
|
+
const close = () => {
|
|
282
|
+
clearTimeout(timer);
|
|
283
|
+
server.close();
|
|
284
|
+
};
|
|
285
|
+
const finish = (outcome) => {
|
|
286
|
+
setTimeout(() => {
|
|
287
|
+
outcome();
|
|
288
|
+
close();
|
|
289
|
+
}, 50);
|
|
290
|
+
};
|
|
291
|
+
server.on("error", (err) => rejectServer(err));
|
|
292
|
+
server.listen(0, "127.0.0.1", () => {
|
|
293
|
+
const address = server.address();
|
|
294
|
+
if (!address || typeof address === "string") {
|
|
295
|
+
rejectServer(new LoginError("Could not open a loopback port."));
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
key.catch(() => {
|
|
299
|
+
});
|
|
300
|
+
resolveServer({ port: address.port, key, close });
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
function openBrowser(url) {
|
|
305
|
+
try {
|
|
306
|
+
const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
307
|
+
const child = spawn(command, args, { detached: true, stdio: "ignore" });
|
|
308
|
+
child.on("error", () => {
|
|
309
|
+
});
|
|
310
|
+
child.unref();
|
|
311
|
+
return true;
|
|
312
|
+
} catch {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
228
317
|
// src/mcp.ts
|
|
229
318
|
var DEFAULT_MCP_URL = "https://mcp.mentio.dev/mcp";
|
|
230
319
|
function mcpConfig(kind, url, apiKey) {
|
|
@@ -476,10 +565,10 @@ var OPERATIONS = [
|
|
|
476
565
|
},
|
|
477
566
|
{
|
|
478
567
|
"name": "snoozedUntil",
|
|
479
|
-
"type": "
|
|
568
|
+
"type": "string",
|
|
480
569
|
"description": "ISO 8601 (or epoch ms) until which the mention leaves the feed; null wakes it.",
|
|
481
570
|
"required": false,
|
|
482
|
-
"nullable":
|
|
571
|
+
"nullable": false
|
|
483
572
|
},
|
|
484
573
|
{
|
|
485
574
|
"name": "note",
|
|
@@ -665,7 +754,7 @@ var OPERATIONS = [
|
|
|
665
754
|
{
|
|
666
755
|
"name": "since",
|
|
667
756
|
"in": "query",
|
|
668
|
-
"type": "
|
|
757
|
+
"type": "string",
|
|
669
758
|
"description": "Only posts published at or after this instant (ISO 8601, or epoch ms).",
|
|
670
759
|
"required": false,
|
|
671
760
|
"nullable": false
|
|
@@ -673,7 +762,7 @@ var OPERATIONS = [
|
|
|
673
762
|
{
|
|
674
763
|
"name": "until",
|
|
675
764
|
"in": "query",
|
|
676
|
-
"type": "
|
|
765
|
+
"type": "string",
|
|
677
766
|
"description": "Only posts published at or before this instant (ISO 8601, or epoch ms).",
|
|
678
767
|
"required": false,
|
|
679
768
|
"nullable": false
|
|
@@ -863,7 +952,7 @@ var OPERATIONS = [
|
|
|
863
952
|
{
|
|
864
953
|
"name": "since",
|
|
865
954
|
"in": "query",
|
|
866
|
-
"type": "
|
|
955
|
+
"type": "string",
|
|
867
956
|
"description": "Only posts published at or after this instant (ISO 8601, or epoch ms).",
|
|
868
957
|
"required": false,
|
|
869
958
|
"nullable": false
|
|
@@ -871,7 +960,7 @@ var OPERATIONS = [
|
|
|
871
960
|
{
|
|
872
961
|
"name": "until",
|
|
873
962
|
"in": "query",
|
|
874
|
-
"type": "
|
|
963
|
+
"type": "string",
|
|
875
964
|
"description": "Only posts published at or before this instant (ISO 8601, or epoch ms).",
|
|
876
965
|
"required": false,
|
|
877
966
|
"nullable": false
|
|
@@ -935,7 +1024,7 @@ var OPERATIONS = [
|
|
|
935
1024
|
{
|
|
936
1025
|
"name": "since",
|
|
937
1026
|
"in": "query",
|
|
938
|
-
"type": "
|
|
1027
|
+
"type": "string",
|
|
939
1028
|
"description": "Only people whose first matched mention is at or after this instant (ISO 8601, or epoch ms).",
|
|
940
1029
|
"required": false,
|
|
941
1030
|
"nullable": false
|
|
@@ -1123,7 +1212,7 @@ var OPERATIONS = [
|
|
|
1123
1212
|
{
|
|
1124
1213
|
"name": "since",
|
|
1125
1214
|
"in": "query",
|
|
1126
|
-
"type": "
|
|
1215
|
+
"type": "string",
|
|
1127
1216
|
"description": "Only people whose first matched mention is at or after this instant (ISO 8601, or epoch ms).",
|
|
1128
1217
|
"required": false,
|
|
1129
1218
|
"nullable": false
|
|
@@ -1892,28 +1981,36 @@ var OPERATIONS = [
|
|
|
1892
1981
|
{
|
|
1893
1982
|
"name": "keywordIds",
|
|
1894
1983
|
"in": "query",
|
|
1895
|
-
"type": "
|
|
1896
|
-
"description": "
|
|
1984
|
+
"type": "array",
|
|
1985
|
+
"description": "Only these keyword ids. Repeatable, or comma-separated; omit for every keyword.",
|
|
1897
1986
|
"required": false,
|
|
1898
1987
|
"nullable": false
|
|
1899
1988
|
},
|
|
1900
1989
|
{
|
|
1901
1990
|
"name": "platforms",
|
|
1902
1991
|
"in": "query",
|
|
1903
|
-
"type": "
|
|
1904
|
-
"description": "
|
|
1992
|
+
"type": "array",
|
|
1993
|
+
"description": "Only these platforms. Repeatable, or comma-separated; omit for every platform.",
|
|
1994
|
+
"enum": [
|
|
1995
|
+
"bluesky",
|
|
1996
|
+
"hackernews",
|
|
1997
|
+
"github",
|
|
1998
|
+
"stackoverflow",
|
|
1999
|
+
"devto",
|
|
2000
|
+
"reddit",
|
|
2001
|
+
"x",
|
|
2002
|
+
"youtube",
|
|
2003
|
+
"news",
|
|
2004
|
+
"linkedin"
|
|
2005
|
+
],
|
|
1905
2006
|
"required": false,
|
|
1906
2007
|
"nullable": false
|
|
1907
2008
|
},
|
|
1908
2009
|
{
|
|
1909
2010
|
"name": "compare",
|
|
1910
2011
|
"in": "query",
|
|
1911
|
-
"type": "
|
|
2012
|
+
"type": "boolean",
|
|
1912
2013
|
"description": "true adds the period of the same length right before the window as `previous`.",
|
|
1913
|
-
"enum": [
|
|
1914
|
-
"true",
|
|
1915
|
-
"false"
|
|
1916
|
-
],
|
|
1917
2014
|
"required": false,
|
|
1918
2015
|
"nullable": false
|
|
1919
2016
|
},
|
|
@@ -1970,28 +2067,36 @@ var OPERATIONS = [
|
|
|
1970
2067
|
{
|
|
1971
2068
|
"name": "keywordIds",
|
|
1972
2069
|
"in": "query",
|
|
1973
|
-
"type": "
|
|
1974
|
-
"description": "
|
|
2070
|
+
"type": "array",
|
|
2071
|
+
"description": "Only these keyword ids. Repeatable, or comma-separated; omit for every keyword.",
|
|
1975
2072
|
"required": false,
|
|
1976
2073
|
"nullable": false
|
|
1977
2074
|
},
|
|
1978
2075
|
{
|
|
1979
2076
|
"name": "platforms",
|
|
1980
2077
|
"in": "query",
|
|
1981
|
-
"type": "
|
|
1982
|
-
"description": "
|
|
2078
|
+
"type": "array",
|
|
2079
|
+
"description": "Only these platforms. Repeatable, or comma-separated; omit for every platform.",
|
|
2080
|
+
"enum": [
|
|
2081
|
+
"bluesky",
|
|
2082
|
+
"hackernews",
|
|
2083
|
+
"github",
|
|
2084
|
+
"stackoverflow",
|
|
2085
|
+
"devto",
|
|
2086
|
+
"reddit",
|
|
2087
|
+
"x",
|
|
2088
|
+
"youtube",
|
|
2089
|
+
"news",
|
|
2090
|
+
"linkedin"
|
|
2091
|
+
],
|
|
1983
2092
|
"required": false,
|
|
1984
2093
|
"nullable": false
|
|
1985
2094
|
},
|
|
1986
2095
|
{
|
|
1987
2096
|
"name": "compare",
|
|
1988
2097
|
"in": "query",
|
|
1989
|
-
"type": "
|
|
2098
|
+
"type": "boolean",
|
|
1990
2099
|
"description": "true adds the period of the same length right before the window as `previous`.",
|
|
1991
|
-
"enum": [
|
|
1992
|
-
"true",
|
|
1993
|
-
"false"
|
|
1994
|
-
],
|
|
1995
2100
|
"required": false,
|
|
1996
2101
|
"nullable": false
|
|
1997
2102
|
},
|
|
@@ -2072,28 +2177,36 @@ var OPERATIONS = [
|
|
|
2072
2177
|
{
|
|
2073
2178
|
"name": "keywordIds",
|
|
2074
2179
|
"in": "query",
|
|
2075
|
-
"type": "
|
|
2076
|
-
"description": "
|
|
2180
|
+
"type": "array",
|
|
2181
|
+
"description": "Only these keyword ids. Repeatable, or comma-separated; omit for every keyword.",
|
|
2077
2182
|
"required": false,
|
|
2078
2183
|
"nullable": false
|
|
2079
2184
|
},
|
|
2080
2185
|
{
|
|
2081
2186
|
"name": "platforms",
|
|
2082
2187
|
"in": "query",
|
|
2083
|
-
"type": "
|
|
2084
|
-
"description": "
|
|
2188
|
+
"type": "array",
|
|
2189
|
+
"description": "Only these platforms. Repeatable, or comma-separated; omit for every platform.",
|
|
2190
|
+
"enum": [
|
|
2191
|
+
"bluesky",
|
|
2192
|
+
"hackernews",
|
|
2193
|
+
"github",
|
|
2194
|
+
"stackoverflow",
|
|
2195
|
+
"devto",
|
|
2196
|
+
"reddit",
|
|
2197
|
+
"x",
|
|
2198
|
+
"youtube",
|
|
2199
|
+
"news",
|
|
2200
|
+
"linkedin"
|
|
2201
|
+
],
|
|
2085
2202
|
"required": false,
|
|
2086
2203
|
"nullable": false
|
|
2087
2204
|
},
|
|
2088
2205
|
{
|
|
2089
2206
|
"name": "compare",
|
|
2090
2207
|
"in": "query",
|
|
2091
|
-
"type": "
|
|
2208
|
+
"type": "boolean",
|
|
2092
2209
|
"description": "true adds the period of the same length right before the window as `previous`.",
|
|
2093
|
-
"enum": [
|
|
2094
|
-
"true",
|
|
2095
|
-
"false"
|
|
2096
|
-
],
|
|
2097
2210
|
"required": false,
|
|
2098
2211
|
"nullable": false
|
|
2099
2212
|
},
|
|
@@ -2167,28 +2280,36 @@ var OPERATIONS = [
|
|
|
2167
2280
|
{
|
|
2168
2281
|
"name": "keywordIds",
|
|
2169
2282
|
"in": "query",
|
|
2170
|
-
"type": "
|
|
2171
|
-
"description": "
|
|
2283
|
+
"type": "array",
|
|
2284
|
+
"description": "Only these keyword ids. Repeatable, or comma-separated; omit for every keyword.",
|
|
2172
2285
|
"required": false,
|
|
2173
2286
|
"nullable": false
|
|
2174
2287
|
},
|
|
2175
2288
|
{
|
|
2176
2289
|
"name": "platforms",
|
|
2177
2290
|
"in": "query",
|
|
2178
|
-
"type": "
|
|
2179
|
-
"description": "
|
|
2291
|
+
"type": "array",
|
|
2292
|
+
"description": "Only these platforms. Repeatable, or comma-separated; omit for every platform.",
|
|
2293
|
+
"enum": [
|
|
2294
|
+
"bluesky",
|
|
2295
|
+
"hackernews",
|
|
2296
|
+
"github",
|
|
2297
|
+
"stackoverflow",
|
|
2298
|
+
"devto",
|
|
2299
|
+
"reddit",
|
|
2300
|
+
"x",
|
|
2301
|
+
"youtube",
|
|
2302
|
+
"news",
|
|
2303
|
+
"linkedin"
|
|
2304
|
+
],
|
|
2180
2305
|
"required": false,
|
|
2181
2306
|
"nullable": false
|
|
2182
2307
|
},
|
|
2183
2308
|
{
|
|
2184
2309
|
"name": "compare",
|
|
2185
2310
|
"in": "query",
|
|
2186
|
-
"type": "
|
|
2311
|
+
"type": "boolean",
|
|
2187
2312
|
"description": "true adds the period of the same length right before the window as `previous`.",
|
|
2188
|
-
"enum": [
|
|
2189
|
-
"true",
|
|
2190
|
-
"false"
|
|
2191
|
-
],
|
|
2192
2313
|
"required": false,
|
|
2193
2314
|
"nullable": false
|
|
2194
2315
|
},
|
|
@@ -2389,6 +2510,7 @@ var OPERATIONS = [
|
|
|
2389
2510
|
{
|
|
2390
2511
|
"name": "channelName",
|
|
2391
2512
|
"type": "string",
|
|
2513
|
+
"description": "The channel name, for the label.",
|
|
2392
2514
|
"required": false,
|
|
2393
2515
|
"nullable": false
|
|
2394
2516
|
},
|
|
@@ -2403,18 +2525,21 @@ var OPERATIONS = [
|
|
|
2403
2525
|
{
|
|
2404
2526
|
"name": "url",
|
|
2405
2527
|
"type": "string",
|
|
2528
|
+
"description": "Where the signed POSTs go. https in production.",
|
|
2406
2529
|
"required": false,
|
|
2407
2530
|
"nullable": false
|
|
2408
2531
|
},
|
|
2409
2532
|
{
|
|
2410
2533
|
"name": "label",
|
|
2411
2534
|
"type": "string",
|
|
2535
|
+
"description": "A name for the channel; the host of the URL when omitted.",
|
|
2412
2536
|
"required": false,
|
|
2413
2537
|
"nullable": false
|
|
2414
2538
|
},
|
|
2415
2539
|
{
|
|
2416
2540
|
"name": "headers",
|
|
2417
2541
|
"type": "object",
|
|
2542
|
+
"description": "Extra request headers to send, for your own auth.",
|
|
2418
2543
|
"required": false,
|
|
2419
2544
|
"nullable": false
|
|
2420
2545
|
}
|
|
@@ -3663,8 +3788,8 @@ async function watchMentions(options) {
|
|
|
3663
3788
|
if (result.error !== void 0 || !result.response?.ok) {
|
|
3664
3789
|
options.warn(JSON.stringify({ error: result.error ?? { code: `http_${result.response?.status ?? 0}`, message: "poll failed" } }));
|
|
3665
3790
|
} else {
|
|
3666
|
-
const
|
|
3667
|
-
const fresh = takeNew(seen,
|
|
3791
|
+
const page2 = result.data?.data ?? [];
|
|
3792
|
+
const fresh = takeNew(seen, page2);
|
|
3668
3793
|
if (!first || options.fromStart) for (const item of fresh) options.write(JSON.stringify(item));
|
|
3669
3794
|
}
|
|
3670
3795
|
first = false;
|
|
@@ -3744,6 +3869,30 @@ async function readStdin() {
|
|
|
3744
3869
|
return Buffer.concat(chunks).toString("utf8");
|
|
3745
3870
|
}
|
|
3746
3871
|
function registerAuth() {
|
|
3872
|
+
program.command("auth:login").description("Sign in through the browser: the dashboard mints an API key and hands it to this terminal").option("--app-url <url>", "Dashboard URL", DEFAULT_APP_URL).option("--name <label>", "Name of the key the dashboard creates", `CLI on ${hostname()}`).addOption(new Option("--scope <scope>", "read: GET only. write: everything.").choices(["read", "write"]).default("write")).option("--timeout <seconds>", "How long to wait for the browser", "300").option("--no-open", "Print the URL instead of opening the browser").action(async (flags) => {
|
|
3873
|
+
const globals = program.opts();
|
|
3874
|
+
const seconds = Number(flags.timeout);
|
|
3875
|
+
if (!Number.isFinite(seconds) || seconds < 10) fail({ error: { code: "usage", message: "--timeout must be at least 10 seconds" } }, 2);
|
|
3876
|
+
const state = newState();
|
|
3877
|
+
const server = await startCallbackServer(state, seconds * 1e3);
|
|
3878
|
+
const url = loginUrl(flags.appUrl, { port: server.port, state, name: flags.name, scope: flags.scope });
|
|
3879
|
+
const opened = flags.open ? openBrowser(url) : false;
|
|
3880
|
+
process.stderr.write(`${opened ? "Opening your browser to authorize the CLI. If it does not open, visit:" : "Open this URL to authorize the CLI:"}
|
|
3881
|
+
${url}
|
|
3882
|
+
Waiting for the browser (${seconds}s)...
|
|
3883
|
+
`);
|
|
3884
|
+
let key;
|
|
3885
|
+
try {
|
|
3886
|
+
key = await server.key;
|
|
3887
|
+
} catch (err) {
|
|
3888
|
+
fail({ error: { code: "login_failed", message: err instanceof LoginError ? err.message : String(err) } });
|
|
3889
|
+
}
|
|
3890
|
+
const path = writeConfig({ apiKey: key, ...globals.apiUrl ? { apiUrl: globals.apiUrl } : {} });
|
|
3891
|
+
const settings = resolveSettings({ apiKey: key, apiUrl: globals.apiUrl });
|
|
3892
|
+
const result = await clientFor(settings).request({ method: "GET", url: "/v1/company", security: BEARER, throwOnError: false });
|
|
3893
|
+
const company = result.error === void 0 && result.response?.ok ? result.data : void 0;
|
|
3894
|
+
print({ ok: true, workspace: company?.name ?? null, key: keyPrefix(key), scope: flags.scope, file: path }, globals);
|
|
3895
|
+
});
|
|
3747
3896
|
program.command("auth:set").description("Store an API key (and optionally the API host) in ~/.mentio/config.json").requiredOption("--key <key>", "API key from the dashboard or POST /v1/api-keys (mk_live_...)").option("--url <url>", "API host for a self-hosted deployment").action((flags) => {
|
|
3748
3897
|
const path = writeConfig({ apiKey: flags.key, ...flags.url ? { apiUrl: flags.url } : {} });
|
|
3749
3898
|
print({ ok: true, file: path, key: keyPrefix(flags.key) }, program.opts());
|