@formo/cli 1.0.2 → 1.1.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/LICENSE +21 -0
- package/README.md +57 -11
- package/dist/commands/alerts.d.ts +14 -22
- package/dist/commands/alerts.js +26 -48
- package/dist/commands/analytics.d.ts +1 -1
- package/dist/commands/analytics.js +4 -12
- package/dist/commands/boards.d.ts +7 -9
- package/dist/commands/boards.js +4 -14
- package/dist/commands/charts.d.ts +11 -13
- package/dist/commands/charts.js +10 -14
- package/dist/commands/contracts.d.ts +9 -11
- package/dist/commands/contracts.js +7 -17
- package/dist/commands/events.d.ts +1 -1
- package/dist/commands/events.js +6 -5
- package/dist/commands/import.d.ts +1 -1
- package/dist/commands/import.js +3 -0
- package/dist/commands/profiles.d.ts +7 -7
- package/dist/commands/profiles.js +24 -11
- package/dist/commands/query.d.ts +1 -1
- package/dist/commands/segments.d.ts +6 -8
- package/dist/commands/segments.js +8 -22
- package/dist/index.js +40 -27
- package/dist/lib/client.d.ts +18 -3
- package/dist/lib/client.js +11 -2
- package/dist/lib/config.d.ts +1 -0
- package/dist/lib/config.js +32 -18
- package/dist/lib/pagination.d.ts +14 -0
- package/dist/lib/pagination.js +31 -0
- package/dist/lib/ui.d.ts +6 -5
- package/dist/lib/ui.js +10 -12
- package/package.json +10 -13
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'incur';
|
|
2
|
+
export interface PaginationOptions {
|
|
3
|
+
page?: number;
|
|
4
|
+
size?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Shared zod fragments for paginated list commands.
|
|
8
|
+
* Spread into a command's options: `z.object({ ...paginationOptionsSchema })`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const paginationOptionsSchema: {
|
|
11
|
+
page: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
size: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
13
|
+
};
|
|
14
|
+
export declare function buildPaginationParams(options?: PaginationOptions): Record<string, number>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paginationOptionsSchema = void 0;
|
|
4
|
+
exports.buildPaginationParams = buildPaginationParams;
|
|
5
|
+
const incur_1 = require("incur");
|
|
6
|
+
/**
|
|
7
|
+
* Shared zod fragments for paginated list commands.
|
|
8
|
+
* Spread into a command's options: `z.object({ ...paginationOptionsSchema })`.
|
|
9
|
+
*/
|
|
10
|
+
exports.paginationOptionsSchema = {
|
|
11
|
+
page: incur_1.z.coerce
|
|
12
|
+
.number()
|
|
13
|
+
.int()
|
|
14
|
+
.positive()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Page number (1-indexed, default 1)'),
|
|
17
|
+
size: incur_1.z.coerce
|
|
18
|
+
.number()
|
|
19
|
+
.int()
|
|
20
|
+
.positive()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Page size (default 100, max 200)'),
|
|
23
|
+
};
|
|
24
|
+
function buildPaginationParams(options = {}) {
|
|
25
|
+
const params = {};
|
|
26
|
+
if (options.page !== undefined)
|
|
27
|
+
params.page = options.page;
|
|
28
|
+
if (options.size !== undefined)
|
|
29
|
+
params.size = options.size;
|
|
30
|
+
return params;
|
|
31
|
+
}
|
package/dist/lib/ui.d.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Terminal UI utilities for the Formo CLI.
|
|
3
3
|
*
|
|
4
4
|
* Uses raw ANSI escape codes (no dependencies) for coloring and styling.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* All decorated output is written to stderr (stdout is reserved for command
|
|
6
|
+
* results), so color is keyed to stderr being a TTY. Disabled whenever the
|
|
7
|
+
* NO_COLOR environment variable is present (any value, per the spec).
|
|
7
8
|
*/
|
|
8
9
|
export declare const color: {
|
|
9
10
|
green: (t: string) => string;
|
|
@@ -20,12 +21,12 @@ export declare const color: {
|
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* Returns the Formo ASCII art banner in green.
|
|
23
|
-
* Only shown when
|
|
24
|
+
* Only shown when stderr is a TTY.
|
|
24
25
|
*/
|
|
25
26
|
export declare function banner(): string;
|
|
26
27
|
export declare function success(message: string): string;
|
|
27
28
|
export declare function error(message: string): string;
|
|
28
29
|
export declare function warn(message: string): string;
|
|
29
30
|
export declare function info(message: string): string;
|
|
30
|
-
|
|
31
|
-
export declare function
|
|
31
|
+
/** Mask an API key for display, keeping just enough to identify it. */
|
|
32
|
+
export declare function maskKey(key: string): string;
|
package/dist/lib/ui.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Terminal UI utilities for the Formo CLI.
|
|
4
4
|
*
|
|
5
5
|
* Uses raw ANSI escape codes (no dependencies) for coloring and styling.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* All decorated output is written to stderr (stdout is reserved for command
|
|
7
|
+
* results), so color is keyed to stderr being a TTY. Disabled whenever the
|
|
8
|
+
* NO_COLOR environment variable is present (any value, per the spec).
|
|
8
9
|
*/
|
|
9
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
11
|
exports.color = void 0;
|
|
@@ -13,10 +14,9 @@ exports.success = success;
|
|
|
13
14
|
exports.error = error;
|
|
14
15
|
exports.warn = warn;
|
|
15
16
|
exports.info = info;
|
|
16
|
-
exports.
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const noColor = !!process.env.NO_COLOR;
|
|
17
|
+
exports.maskKey = maskKey;
|
|
18
|
+
const isTTY = process.stderr.isTTY === true;
|
|
19
|
+
const noColor = process.env.NO_COLOR !== undefined;
|
|
20
20
|
/** Whether color output is enabled */
|
|
21
21
|
const colorEnabled = isTTY && !noColor;
|
|
22
22
|
// ── ANSI helpers ──
|
|
@@ -47,7 +47,7 @@ const LOGO_LINES = [
|
|
|
47
47
|
];
|
|
48
48
|
/**
|
|
49
49
|
* Returns the Formo ASCII art banner in green.
|
|
50
|
-
* Only shown when
|
|
50
|
+
* Only shown when stderr is a TTY.
|
|
51
51
|
*/
|
|
52
52
|
function banner() {
|
|
53
53
|
if (!isTTY)
|
|
@@ -71,9 +71,7 @@ function info(message) {
|
|
|
71
71
|
return `${exports.color.cyan('ℹ')} ${message}`;
|
|
72
72
|
}
|
|
73
73
|
// ── Formatting helpers ──
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
function heading(text) {
|
|
78
|
-
return exports.color.boldGreen(text);
|
|
74
|
+
/** Mask an API key for display, keeping just enough to identify it. */
|
|
75
|
+
function maskKey(key) {
|
|
76
|
+
return key.length > 12 ? key.slice(0, 8) + '…' + key.slice(-4) : '***';
|
|
79
77
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formo/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"packageManager": "pnpm@11.1.2",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"description": "Formo API CLI — query profiles and analytics data",
|
|
9
|
+
"license": "MIT",
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
8
12
|
"url": "git+https://github.com/getformo/cli.git"
|
|
@@ -21,19 +25,18 @@
|
|
|
21
25
|
],
|
|
22
26
|
"scripts": {
|
|
23
27
|
"build": "tsc",
|
|
24
|
-
"
|
|
28
|
+
"prepublishOnly": "pnpm build",
|
|
29
|
+
"dev": "tsx src/index.ts",
|
|
25
30
|
"start": "node dist/index.js",
|
|
26
31
|
"lint": "eslint src/",
|
|
27
32
|
"lint:fix": "eslint src/ --fix",
|
|
33
|
+
"typecheck": "tsc -p tsconfig.test.json --noEmit",
|
|
28
34
|
"test": "mocha",
|
|
29
35
|
"test:watch": "mocha --watch"
|
|
30
36
|
},
|
|
31
37
|
"dependencies": {
|
|
32
|
-
"axios": "^1.
|
|
33
|
-
"incur": "
|
|
34
|
-
},
|
|
35
|
-
"overrides": {
|
|
36
|
-
"serialize-javascript": ">=7.0.5"
|
|
38
|
+
"axios": "^1.18.0",
|
|
39
|
+
"incur": "0.3.25"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
42
|
"@eslint/js": "^10.0.1",
|
|
@@ -45,14 +48,8 @@
|
|
|
45
48
|
"eslint": "^10.2.0",
|
|
46
49
|
"globals": "^17.4.0",
|
|
47
50
|
"mocha": "^11.7.5",
|
|
48
|
-
"ts-node": "^10.9.2",
|
|
49
51
|
"tsx": "^4.21.0",
|
|
50
52
|
"typescript": "^5.5.4",
|
|
51
53
|
"typescript-eslint": "^8.58.1"
|
|
52
|
-
},
|
|
53
|
-
"pnpm": {
|
|
54
|
-
"overrides": {
|
|
55
|
-
"serialize-javascript": ">=7.0.5"
|
|
56
|
-
}
|
|
57
54
|
}
|
|
58
55
|
}
|