@emit-vision/cli 0.2.4 โ 0.2.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.
- package/README.md +102 -0
- package/dist/index.js +114 -35
- package/package.json +25 -10
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @emit-vision/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for [Emit Vision](https://emitvision.com) โ the self-hostable analytics, error tracking, and feature-flag stack.
|
|
4
|
+
|
|
5
|
+
Query telemetry, manage projects and ingest keys, and control feature flags from your terminal, a deploy script, or a coding agent.
|
|
6
|
+
|
|
7
|
+
๐ **[Full CLI reference โ](https://emitvision.com/docs/cli)**
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @emit-vision/cli
|
|
13
|
+
# or: pnpm add -g @emit-vision/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Authentication
|
|
17
|
+
|
|
18
|
+
Log in once โ credentials are stored locally and reused by every command.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
emit-vision login --browser # browser OAuth
|
|
22
|
+
emit-vision login --token <pat> # non-interactive (or set EMIT_VISION_PAT)
|
|
23
|
+
emit-vision status # verify the stored token
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Point at a self-hosted instance with `--api-url`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
emit-vision login --token <pat> --api-url https://api.your-host.com
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Feature flags
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
emit-vision flags list <projectId>
|
|
36
|
+
emit-vision flags enable <projectId> compare-pages
|
|
37
|
+
emit-vision flags rollout <projectId> new-checkout 25
|
|
38
|
+
emit-vision flags create <projectId> dark-mode --name "Dark Mode"
|
|
39
|
+
emit-vision flags evaluate <projectId> --environment production
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Flags are referenced by their **key**, not an internal id. Creating, updating,
|
|
43
|
+
enabling, disabling, and archiving require a token with the admin role;
|
|
44
|
+
listing and evaluating do not.
|
|
45
|
+
|
|
46
|
+
For multivariate flags, pipe a full definition in:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cat flag.json | emit-vision flags create <projectId> --from-json -
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Querying telemetry
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
emit-vision overview <projectId>
|
|
56
|
+
emit-vision events recent <projectId> --limit 20
|
|
57
|
+
emit-vision errors grouped <projectId> --environment production
|
|
58
|
+
emit-vision logs <projectId> --severity error
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Most commands accept `--from`/`--to` (ISO timestamps), `--environment`, `--limit`, and `--json`.
|
|
62
|
+
|
|
63
|
+
## Projects and keys
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
emit-vision project list
|
|
67
|
+
emit-vision project create "My App"
|
|
68
|
+
emit-vision key get <projectId>
|
|
69
|
+
emit-vision key rotate <projectId> --yes
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Scripting and agents
|
|
73
|
+
|
|
74
|
+
Every read command supports `--json`, so output pipes cleanly into `jq` or an agent's tool loop:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Top error groups as JSON
|
|
78
|
+
emit-vision errors grouped <projectId> --json | jq '.[0:5]'
|
|
79
|
+
|
|
80
|
+
# Gate a deploy step on a flag
|
|
81
|
+
if [ "$(emit-vision flags evaluate <projectId> --environment production --flag safe-deploy --json | jq -r '."safe-deploy".variantValue')" = "true" ]; then
|
|
82
|
+
./deploy.sh
|
|
83
|
+
fi
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Destructive commands (`key rotate`, `flags archive`) prompt for confirmation and
|
|
87
|
+
require `--yes` to run non-interactively โ they fail rather than prompt when
|
|
88
|
+
stdin isn't a TTY, so a script can't hang waiting on input.
|
|
89
|
+
|
|
90
|
+
Run `emit-vision --help` for the complete command list, or `emit-vision --version`.
|
|
91
|
+
|
|
92
|
+
## Documentation
|
|
93
|
+
|
|
94
|
+
- [CLI reference](https://emitvision.com/docs/cli) โ every command, flag, and example
|
|
95
|
+
- [Getting started](https://emitvision.com/docs/introduction)
|
|
96
|
+
- [Installation & configuration](https://emitvision.com/docs/installation)
|
|
97
|
+
- [Browser SDK](https://emitvision.com/docs/sdk-js) ยท [Node SDK](https://emitvision.com/docs/sdk-node)
|
|
98
|
+
- [Troubleshooting](https://emitvision.com/docs/troubleshooting)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,34 @@ var ApiError = class extends Error {
|
|
|
42
42
|
}
|
|
43
43
|
status;
|
|
44
44
|
};
|
|
45
|
+
var ApiShapeError = class extends Error {
|
|
46
|
+
constructor(path, missing, received) {
|
|
47
|
+
super(
|
|
48
|
+
`Unexpected response shape from ${path}
|
|
49
|
+
missing field(s): ${missing.join(", ")}
|
|
50
|
+
response had: ${received.join(", ") || "(no fields)"}
|
|
51
|
+
This usually means the CLI is out of date with the API. Try \`npm i -g @emit-vision/cli@latest\`, or re-run with --json to see the raw response.`
|
|
52
|
+
);
|
|
53
|
+
this.path = path;
|
|
54
|
+
this.missing = missing;
|
|
55
|
+
this.received = received;
|
|
56
|
+
this.name = "ApiShapeError";
|
|
57
|
+
}
|
|
58
|
+
path;
|
|
59
|
+
missing;
|
|
60
|
+
received;
|
|
61
|
+
};
|
|
62
|
+
function assertShape(data, expect, path) {
|
|
63
|
+
const sample = Array.isArray(data) ? data[0] : data;
|
|
64
|
+
if (sample === void 0 || sample === null || typeof sample !== "object") {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const received = Object.keys(sample);
|
|
68
|
+
const missing = expect.filter((field) => !received.includes(field));
|
|
69
|
+
if (missing.length > 0) {
|
|
70
|
+
throw new ApiShapeError(path, missing, received);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
45
73
|
async function apiFetch(path, options = {}) {
|
|
46
74
|
const config = loadConfig();
|
|
47
75
|
const apiUrl = options.apiUrl ?? config.apiUrl ?? DEFAULT_API_URL;
|
|
@@ -70,7 +98,10 @@ async function apiFetch(path, options = {}) {
|
|
|
70
98
|
} catch {
|
|
71
99
|
}
|
|
72
100
|
const suffix = code ? ` (${code})` : "";
|
|
73
|
-
throw new ApiError(
|
|
101
|
+
throw new ApiError(
|
|
102
|
+
401,
|
|
103
|
+
`Not authenticated${suffix}. Run \`emit-vision login\` first.`
|
|
104
|
+
);
|
|
74
105
|
}
|
|
75
106
|
if (!res.ok) {
|
|
76
107
|
let msg = `HTTP ${res.status}`;
|
|
@@ -82,7 +113,11 @@ async function apiFetch(path, options = {}) {
|
|
|
82
113
|
throw new ApiError(res.status, msg);
|
|
83
114
|
}
|
|
84
115
|
if (res.status === 204) return void 0;
|
|
85
|
-
|
|
116
|
+
const data = await res.json();
|
|
117
|
+
if (options.expect) {
|
|
118
|
+
assertShape(data, options.expect, path.split("?")[0] ?? path);
|
|
119
|
+
}
|
|
120
|
+
return data;
|
|
86
121
|
}
|
|
87
122
|
|
|
88
123
|
// src/commands/login.ts
|
|
@@ -316,14 +351,16 @@ async function runProjectEnvCreate(args) {
|
|
|
316
351
|
console.log(result.rawIngestKey);
|
|
317
352
|
}
|
|
318
353
|
}
|
|
354
|
+
var EMPTY_CELL = "\u2014";
|
|
319
355
|
function printTable(headers, rows) {
|
|
356
|
+
const cells = rows.map((row) => headers.map((_, i) => row[i] ?? EMPTY_CELL));
|
|
320
357
|
const widths = headers.map(
|
|
321
|
-
(h, i) => Math.max(h.length, ...
|
|
358
|
+
(h, i) => Math.max(h.length, ...cells.map((r) => r[i].length))
|
|
322
359
|
);
|
|
323
|
-
const line = (
|
|
360
|
+
const line = (row) => row.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
324
361
|
console.log(line(headers));
|
|
325
362
|
console.log(widths.map((w) => "-".repeat(w)).join(" "));
|
|
326
|
-
|
|
363
|
+
cells.forEach((r) => console.log(line(r)));
|
|
327
364
|
}
|
|
328
365
|
|
|
329
366
|
// src/commands/key.ts
|
|
@@ -357,7 +394,10 @@ async function runKeyRotate(args) {
|
|
|
357
394
|
);
|
|
358
395
|
process.exit(1);
|
|
359
396
|
}
|
|
360
|
-
const rl = createInterface2({
|
|
397
|
+
const rl = createInterface2({
|
|
398
|
+
input: process.stdin,
|
|
399
|
+
output: process.stdout
|
|
400
|
+
});
|
|
361
401
|
const answer = await new Promise((resolve) => {
|
|
362
402
|
rl.question(
|
|
363
403
|
"Rotate the ingest key? This will invalidate the current key. [y/N] ",
|
|
@@ -403,11 +443,30 @@ function parseFlags(args) {
|
|
|
403
443
|
function buildQs(projectId, flags, extras) {
|
|
404
444
|
const params = new URLSearchParams({ projectId });
|
|
405
445
|
const merged = { ...flags, ...extras };
|
|
406
|
-
for (const key of [
|
|
446
|
+
for (const key of [
|
|
447
|
+
"from",
|
|
448
|
+
"to",
|
|
449
|
+
"environment",
|
|
450
|
+
"release",
|
|
451
|
+
"limit",
|
|
452
|
+
"severity"
|
|
453
|
+
]) {
|
|
407
454
|
if (merged[key]) params.set(key, merged[key]);
|
|
408
455
|
}
|
|
409
456
|
return params.toString();
|
|
410
457
|
}
|
|
458
|
+
var RECENT_FIELDS = ["event_id", "event_name", "timestamp"];
|
|
459
|
+
var GROUPED_FIELDS = [
|
|
460
|
+
"fingerprint",
|
|
461
|
+
"sampleMessage",
|
|
462
|
+
"count",
|
|
463
|
+
"lastSeen"
|
|
464
|
+
];
|
|
465
|
+
var OVERVIEW_FIELDS = ["totalEvents", "totalErrors"];
|
|
466
|
+
var LOG_FIELDS = ["timestamp", "severity_text", "body"];
|
|
467
|
+
function truncate(value, max) {
|
|
468
|
+
return value.length > max ? `${value.slice(0, max - 3)}...` : value;
|
|
469
|
+
}
|
|
411
470
|
async function runEventsRecent(args) {
|
|
412
471
|
const [projectId, ...rest2] = args;
|
|
413
472
|
if (!projectId) {
|
|
@@ -418,7 +477,8 @@ async function runEventsRecent(args) {
|
|
|
418
477
|
}
|
|
419
478
|
const flags = parseFlags(rest2);
|
|
420
479
|
const events = await apiFetch(
|
|
421
|
-
`/v1/events/recent?${buildQs(projectId, flags)}
|
|
480
|
+
`/v1/events/recent?${buildQs(projectId, flags)}`,
|
|
481
|
+
{ expect: RECENT_FIELDS }
|
|
422
482
|
);
|
|
423
483
|
if (flags.json) {
|
|
424
484
|
console.log(JSON.stringify(events, null, 2));
|
|
@@ -432,9 +492,9 @@ async function runEventsRecent(args) {
|
|
|
432
492
|
["Timestamp", "Name", "User", "Environment"],
|
|
433
493
|
events.map((e) => [
|
|
434
494
|
new Date(e.timestamp).toLocaleString(),
|
|
435
|
-
e.
|
|
436
|
-
e.
|
|
437
|
-
e.environment
|
|
495
|
+
e.event_name,
|
|
496
|
+
e.user_id || null,
|
|
497
|
+
e.environment || null
|
|
438
498
|
])
|
|
439
499
|
);
|
|
440
500
|
}
|
|
@@ -448,7 +508,8 @@ async function runErrorsRecent(args) {
|
|
|
448
508
|
}
|
|
449
509
|
const flags = parseFlags(rest2);
|
|
450
510
|
const errors = await apiFetch(
|
|
451
|
-
`/v1/errors/recent?${buildQs(projectId, flags)}
|
|
511
|
+
`/v1/errors/recent?${buildQs(projectId, flags)}`,
|
|
512
|
+
{ expect: RECENT_FIELDS }
|
|
452
513
|
);
|
|
453
514
|
if (flags.json) {
|
|
454
515
|
console.log(JSON.stringify(errors, null, 2));
|
|
@@ -462,9 +523,9 @@ async function runErrorsRecent(args) {
|
|
|
462
523
|
["Timestamp", "Name", "User", "Environment"],
|
|
463
524
|
errors.map((e) => [
|
|
464
525
|
new Date(e.timestamp).toLocaleString(),
|
|
465
|
-
e.
|
|
466
|
-
e.
|
|
467
|
-
e.environment
|
|
526
|
+
e.event_name,
|
|
527
|
+
e.user_id || null,
|
|
528
|
+
e.environment || null
|
|
468
529
|
])
|
|
469
530
|
);
|
|
470
531
|
}
|
|
@@ -478,7 +539,8 @@ async function runErrorsGrouped(args) {
|
|
|
478
539
|
}
|
|
479
540
|
const flags = parseFlags(rest2);
|
|
480
541
|
const groups = await apiFetch(
|
|
481
|
-
`/v1/errors/grouped?${buildQs(projectId, flags)}
|
|
542
|
+
`/v1/errors/grouped?${buildQs(projectId, flags)}`,
|
|
543
|
+
{ expect: GROUPED_FIELDS }
|
|
482
544
|
);
|
|
483
545
|
if (flags.json) {
|
|
484
546
|
console.log(JSON.stringify(groups, null, 2));
|
|
@@ -494,7 +556,7 @@ async function runErrorsGrouped(args) {
|
|
|
494
556
|
String(g.count),
|
|
495
557
|
g.status,
|
|
496
558
|
new Date(g.lastSeen).toLocaleString(),
|
|
497
|
-
g.
|
|
559
|
+
truncate(g.sampleMessage, 60)
|
|
498
560
|
])
|
|
499
561
|
);
|
|
500
562
|
}
|
|
@@ -508,7 +570,8 @@ async function runOverview(args) {
|
|
|
508
570
|
}
|
|
509
571
|
const flags = parseFlags(rest2);
|
|
510
572
|
const data = await apiFetch(
|
|
511
|
-
`/v1/overview?${buildQs(projectId, flags)}
|
|
573
|
+
`/v1/overview?${buildQs(projectId, flags)}`,
|
|
574
|
+
{ expect: OVERVIEW_FIELDS }
|
|
512
575
|
);
|
|
513
576
|
if (flags.json) {
|
|
514
577
|
console.log(JSON.stringify(data, null, 2));
|
|
@@ -539,6 +602,7 @@ async function runLogs(args) {
|
|
|
539
602
|
const { logs } = await apiFetch(
|
|
540
603
|
`/v1/logs?${buildQs(projectId, flags)}`
|
|
541
604
|
);
|
|
605
|
+
assertShape(logs, LOG_FIELDS, "/v1/logs");
|
|
542
606
|
if (flags.json) {
|
|
543
607
|
console.log(JSON.stringify(logs, null, 2));
|
|
544
608
|
return;
|
|
@@ -551,8 +615,8 @@ async function runLogs(args) {
|
|
|
551
615
|
["Timestamp", "Severity", "Message"],
|
|
552
616
|
logs.map((l) => [
|
|
553
617
|
new Date(l.timestamp).toLocaleString(),
|
|
554
|
-
l.
|
|
555
|
-
l.body
|
|
618
|
+
l.severity_text,
|
|
619
|
+
truncate(l.body, 80)
|
|
556
620
|
])
|
|
557
621
|
);
|
|
558
622
|
}
|
|
@@ -662,7 +726,10 @@ async function runUsersList(args) {
|
|
|
662
726
|
String(u.error_count),
|
|
663
727
|
u.last_seen ? new Date(u.last_seen).toLocaleDateString() : "\u2014"
|
|
664
728
|
]);
|
|
665
|
-
printTable(
|
|
729
|
+
printTable(
|
|
730
|
+
["User ID", "Email", "Name", "Events", "Errors", "Last Seen"],
|
|
731
|
+
rows
|
|
732
|
+
);
|
|
666
733
|
}
|
|
667
734
|
async function runAudienceExport(args) {
|
|
668
735
|
const [projectId, ...rest2] = args;
|
|
@@ -749,8 +816,7 @@ async function runAudienceSync(args) {
|
|
|
749
816
|
);
|
|
750
817
|
const preview = contacts.slice(0, 5);
|
|
751
818
|
console.log(JSON.stringify(preview, null, 2));
|
|
752
|
-
if (contacts.length > 5)
|
|
753
|
-
console.log(`... and ${contacts.length - 5} more`);
|
|
819
|
+
if (contacts.length > 5) console.log(`... and ${contacts.length - 5} more`);
|
|
754
820
|
return;
|
|
755
821
|
}
|
|
756
822
|
const CHUNK = 5e3;
|
|
@@ -792,10 +858,12 @@ function printSnippets(pingUrl, intervalSeconds, filter) {
|
|
|
792
858
|
process.exit(1);
|
|
793
859
|
}
|
|
794
860
|
const types = filter ? [filter] : SNIPPET_TYPES;
|
|
861
|
+
const releaseUrl = `"${pingUrl}?release=$BUILD_NUMBER"`;
|
|
795
862
|
const snippets = {
|
|
796
863
|
curl: [
|
|
797
864
|
"# cURL",
|
|
798
|
-
|
|
865
|
+
"# Optionally report the release/build this ping is running (blank is fine \u2014 omit the query param entirely to skip it)",
|
|
866
|
+
`curl -fsS -o /dev/null ${releaseUrl} \\`,
|
|
799
867
|
` -H "Authorization: Bearer $EMIT_VISION_INGEST_KEY"`
|
|
800
868
|
].join("\n"),
|
|
801
869
|
docker: [
|
|
@@ -806,6 +874,7 @@ function printSnippets(pingUrl, intervalSeconds, filter) {
|
|
|
806
874
|
" restart: unless-stopped",
|
|
807
875
|
" environment:",
|
|
808
876
|
" - EMIT_VISION_INGEST_KEY=${EMIT_VISION_INGEST_KEY}",
|
|
877
|
+
" - BUILD_NUMBER=${BUILD_NUMBER}",
|
|
809
878
|
` - PULSE_URL=${pingUrl}`,
|
|
810
879
|
` - PING_INTERVAL=${intervalSeconds}`,
|
|
811
880
|
" entrypoint: /bin/sh",
|
|
@@ -814,7 +883,7 @@ function printSnippets(pingUrl, intervalSeconds, filter) {
|
|
|
814
883
|
" - |",
|
|
815
884
|
" while true; do",
|
|
816
885
|
' wget -q --header="Authorization: Bearer $$EMIT_VISION_INGEST_KEY" \\',
|
|
817
|
-
' -O /dev/null "$$PULSE_URL" || true',
|
|
886
|
+
' -O /dev/null "$$PULSE_URL?release=$$BUILD_NUMBER" || true',
|
|
818
887
|
" sleep $$PING_INTERVAL",
|
|
819
888
|
" done"
|
|
820
889
|
].join("\n"),
|
|
@@ -826,7 +895,9 @@ function printSnippets(pingUrl, intervalSeconds, filter) {
|
|
|
826
895
|
"",
|
|
827
896
|
"[Service]",
|
|
828
897
|
"Type=oneshot",
|
|
829
|
-
|
|
898
|
+
"# BUILD_NUMBER as set by your deploy tooling (systemd expands ${VAR} from Environment=/EnvironmentFile=)",
|
|
899
|
+
"EnvironmentFile=-/etc/emit-vision/release.env",
|
|
900
|
+
`ExecStart=/usr/bin/curl -fsS -o /dev/null ${releaseUrl} -H "Authorization: Bearer %d/ingest-key"`,
|
|
830
901
|
"",
|
|
831
902
|
"# /etc/systemd/system/pulse-ping.timer",
|
|
832
903
|
"[Unit]",
|
|
@@ -843,7 +914,8 @@ function printSnippets(pingUrl, intervalSeconds, filter) {
|
|
|
843
914
|
const minutes = Math.max(1, Math.floor(intervalSeconds / 60));
|
|
844
915
|
return [
|
|
845
916
|
"# crontab entry",
|
|
846
|
-
|
|
917
|
+
"# BUILD_NUMBER must be exported by whatever sources this job's environment",
|
|
918
|
+
`*/${minutes} * * * * curl -fsS -o /dev/null ${releaseUrl} -H "Authorization: Bearer $EMIT_VISION_INGEST_KEY"`
|
|
847
919
|
].join("\n");
|
|
848
920
|
})()
|
|
849
921
|
};
|
|
@@ -935,9 +1007,13 @@ async function runPulseList(args) {
|
|
|
935
1007
|
c.slug,
|
|
936
1008
|
c.status,
|
|
937
1009
|
c.lastPingAt ? new Date(c.lastPingAt).toLocaleString() : "never",
|
|
1010
|
+
c.lastReportedRelease ?? "-",
|
|
938
1011
|
`${c.expectedIntervalSeconds}s`
|
|
939
1012
|
]);
|
|
940
|
-
printTable(
|
|
1013
|
+
printTable(
|
|
1014
|
+
["Name", "Slug", "Status", "Last Ping", "Release", "Interval"],
|
|
1015
|
+
rows
|
|
1016
|
+
);
|
|
941
1017
|
}
|
|
942
1018
|
var STATUS_COLORS = {
|
|
943
1019
|
up: "\x1B[32m",
|
|
@@ -987,11 +1063,12 @@ async function runPulseStatus(args) {
|
|
|
987
1063
|
statusLabel,
|
|
988
1064
|
lastPing,
|
|
989
1065
|
nextExpected,
|
|
1066
|
+
c.lastReportedRelease ?? "-",
|
|
990
1067
|
`${c.expectedIntervalSeconds}s`
|
|
991
1068
|
];
|
|
992
1069
|
});
|
|
993
1070
|
printTable(
|
|
994
|
-
["Name", "Status", "Last Ping", "Next Expected", "Interval"],
|
|
1071
|
+
["Name", "Status", "Last Ping", "Next Expected", "Release", "Interval"],
|
|
995
1072
|
rows
|
|
996
1073
|
);
|
|
997
1074
|
}
|
|
@@ -1010,9 +1087,7 @@ async function verifyPing(pingUrl) {
|
|
|
1010
1087
|
if (res.ok) {
|
|
1011
1088
|
console.log("\u2713 First ping successful \u2014 check is now UP");
|
|
1012
1089
|
} else {
|
|
1013
|
-
console.error(
|
|
1014
|
-
`\u2717 Ping failed: HTTP ${res.status}`
|
|
1015
|
-
);
|
|
1090
|
+
console.error(`\u2717 Ping failed: HTTP ${res.status}`);
|
|
1016
1091
|
}
|
|
1017
1092
|
} catch (err) {
|
|
1018
1093
|
console.error(
|
|
@@ -1207,7 +1282,10 @@ async function runFlagsArchive(args) {
|
|
|
1207
1282
|
);
|
|
1208
1283
|
process.exit(1);
|
|
1209
1284
|
}
|
|
1210
|
-
const rl = createInterface3({
|
|
1285
|
+
const rl = createInterface3({
|
|
1286
|
+
input: process.stdin,
|
|
1287
|
+
output: process.stdout
|
|
1288
|
+
});
|
|
1211
1289
|
const answer = await new Promise((resolve) => {
|
|
1212
1290
|
rl.question(
|
|
1213
1291
|
`Archive flag "${flagKey}"? This cannot be undone. [y/N] `,
|
|
@@ -1388,7 +1466,8 @@ async function createBoolean(projectId, key, rest2) {
|
|
|
1388
1466
|
variants: booleanVariants()
|
|
1389
1467
|
};
|
|
1390
1468
|
if (description !== void 0) body.description = description;
|
|
1391
|
-
if (rolloutPercentage !== void 0)
|
|
1469
|
+
if (rolloutPercentage !== void 0)
|
|
1470
|
+
body.rolloutPercentage = rolloutPercentage;
|
|
1392
1471
|
const { flag } = await apiFetch(
|
|
1393
1472
|
`/v1/flags?projectId=${encodeURIComponent(projectId)}`,
|
|
1394
1473
|
{ method: "POST", body }
|
|
@@ -1461,7 +1540,7 @@ At least one of --name, --description, --environments, --default-variant is requ
|
|
|
1461
1540
|
}
|
|
1462
1541
|
|
|
1463
1542
|
// src/index.ts
|
|
1464
|
-
var VERSION = "0.2.
|
|
1543
|
+
var VERSION = "0.2.5";
|
|
1465
1544
|
var [cmd, subcmd, ...rest] = process.argv.slice(2);
|
|
1466
1545
|
async function main() {
|
|
1467
1546
|
if (cmd === "--version" || cmd === "-v") {
|
package/package.json
CHANGED
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emit-vision/cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "CLI for
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"description": "CLI for Emit Vision โ query telemetry, manage projects and ingest keys, and control feature flags from the terminal.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"emit-vision",
|
|
10
|
+
"analytics",
|
|
11
|
+
"error-tracking",
|
|
12
|
+
"feature-flags",
|
|
13
|
+
"observability",
|
|
14
|
+
"cli"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://emitvision.com/docs/cli",
|
|
17
|
+
"repository": {
|
|
18
|
+
"url": "https://emitvision.com/docs/cli"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"email": "hello@emit-vision.dev"
|
|
22
|
+
},
|
|
8
23
|
"bin": {
|
|
9
24
|
"emit-vision": "dist/index.js"
|
|
10
25
|
},
|
|
11
26
|
"files": [
|
|
12
27
|
"dist",
|
|
13
|
-
"LICENSE"
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"README.md"
|
|
14
30
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsup --config tsup.config.ts",
|
|
17
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
18
|
-
"test": "vitest run",
|
|
19
|
-
"prepack": "pnpm run build"
|
|
20
|
-
},
|
|
21
31
|
"publishConfig": {
|
|
22
32
|
"access": "public"
|
|
23
33
|
},
|
|
24
34
|
"devDependencies": {
|
|
25
35
|
"vitest": "^4.0.15"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup --config tsup.config.ts",
|
|
39
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
40
|
+
"test": "vitest run"
|
|
26
41
|
}
|
|
27
|
-
}
|
|
42
|
+
}
|