@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.
@@ -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
- * Colors are automatically disabled when stdout is not a TTY (piped output, CI, etc.)
6
- * or when the NO_COLOR environment variable is set.
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 stdout is a TTY.
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
- export declare function keyValue(key: string, value: string): string;
31
- export declare function heading(text: string): string;
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
- * Colors are automatically disabled when stdout is not a TTY (piped output, CI, etc.)
7
- * or when the NO_COLOR environment variable is set.
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.keyValue = keyValue;
17
- exports.heading = heading;
18
- const isTTY = process.stdout.isTTY === true;
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 stdout is a TTY.
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
- function keyValue(key, value) {
75
- return `${exports.color.dim(key + ':')} ${value}`;
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.0.2",
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
- "dev": "ts-node src/index.ts",
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.15.2",
33
- "incur": "^0.3.4"
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
  }