@funnest/charts-cli 0.0.0-stage → 0.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 type { ChartSpec, Row } from './spec';
2
+ export declare function valueFormatter(spec: ChartSpec): (v: number) => string;
3
+ export interface RenderOptions {
4
+ theme?: 'light' | 'dark';
5
+ }
6
+ /** Render a (validated) spec to a standalone SVG document. */
7
+ export declare function renderSvg(spec: ChartSpec, options?: RenderOptions): string;
8
+ export declare function renderHtml(spec: ChartSpec, options?: RenderOptions): string;
9
+ /** PNG via resvg (optional dependency, loaded on demand). */
10
+ export declare function renderPng(spec: ChartSpec, options?: RenderOptions & {
11
+ scale?: number;
12
+ }): Promise<Uint8Array>;
13
+ export declare function reactCode(spec: ChartSpec): string;
14
+ export type { Row };
package/dist/spec.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ import { type CliLocale } from './i18n';
2
+ /** A row of tabular data: column name → value. */
3
+ export type Row = Record<string, unknown>;
4
+ export type ChartType = 'line' | 'area' | 'bar' | 'percentage-bar' | 'sparkline';
5
+ export interface ReferenceLineSpec {
6
+ y?: number;
7
+ /** Row index, or a value of the x column. */
8
+ x?: number | string;
9
+ label?: string;
10
+ color?: string;
11
+ }
12
+ export interface PointSpec {
13
+ /** Row index, or a value of the x column. */
14
+ x: number | string;
15
+ /** Value; omit to sit on `series`. */
16
+ y?: number;
17
+ series?: string;
18
+ label?: string;
19
+ color?: string;
20
+ pulse?: boolean;
21
+ }
22
+ /** Declarative chart description shared by the CLI, the MCP server and AI agents. */
23
+ export interface ChartSpec {
24
+ type: ChartType;
25
+ data: Row[];
26
+ title?: string;
27
+ width?: number;
28
+ height?: number;
29
+ theme?: 'light' | 'dark';
30
+ locale?: CliLocale;
31
+ /** x column (labels/dates). Omit to use the row index. */
32
+ x?: string;
33
+ /** Numeric column(s) to draw. */
34
+ y?: string | string[];
35
+ /** Display names per y column. */
36
+ labels?: Record<string, string>;
37
+ /** Colors per y column (or per row label for percentage-bar). */
38
+ colors?: Record<string, string>;
39
+ /** percentage-bar: the label and value columns. */
40
+ label?: string;
41
+ value?: string;
42
+ curve?: 'monotone' | 'linear' | 'step';
43
+ area?: 'none' | 'gradient' | 'solid';
44
+ stacked?: boolean;
45
+ /** bar: red for ≥ 0, blue for < 0 (Korean convention). */
46
+ colorBySign?: boolean;
47
+ showXAxis?: boolean;
48
+ showYAxis?: boolean;
49
+ legend?: boolean;
50
+ /** Value labels: prefix/suffix/decimals, e.g. { suffix: '원' }. */
51
+ format?: {
52
+ prefix?: string;
53
+ suffix?: string;
54
+ decimals?: number;
55
+ };
56
+ referenceLines?: ReferenceLineSpec[];
57
+ points?: PointSpec[];
58
+ }
59
+ type FieldKind = 'string' | 'number' | 'boolean' | 'string|string[]' | 'record' | 'array' | 'object' | 'rows';
60
+ export interface FieldDef {
61
+ kind: FieldKind;
62
+ required?: boolean;
63
+ enum?: readonly string[];
64
+ /** For string fields naming a data column (checked against the data). */
65
+ column?: 'any' | 'numeric';
66
+ default?: unknown;
67
+ ko: string;
68
+ en: string;
69
+ /** JSON Schema for array items / object properties. */
70
+ items?: Record<string, unknown>;
71
+ }
72
+ export interface ChartDef {
73
+ type: ChartType;
74
+ ko: string;
75
+ en: string;
76
+ /** Which React component the spec maps to. */
77
+ component: string;
78
+ fields: Record<string, FieldDef>;
79
+ example: Omit<ChartSpec, 'type'>;
80
+ }
81
+ export declare const CHARTS: Record<ChartType, ChartDef>;
82
+ export declare const CHART_TYPES: ChartType[];
83
+ export interface ValidationIssue {
84
+ path: string;
85
+ message: string;
86
+ }
87
+ export declare function closest(word: string, options: readonly string[]): string | null;
88
+ /** Check a spec. Returns an empty list when it can be rendered. */
89
+ export declare function validateSpec(input: unknown, locale?: CliLocale): ValidationIssue[];
90
+ export declare function chartSchema(type: ChartType, locale?: CliLocale): Record<string, unknown>;
91
+ export declare const exampleSpec: (type: ChartType) => ChartSpec;
92
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Starter code an agent (or a person) can drop into an app. These are templates for the
3
+ * app's own code — the library itself never ships exchange connections.
4
+ */
5
+ export type DatafeedTemplateKind = 'rest-websocket' | 'polling' | 'static';
6
+ export declare const datafeedTemplate: (kind?: DatafeedTemplateKind) => string;
package/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "@funnest/charts-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Funnest Charts command line: list charts, validate JSON specs, render SVG/PNG/HTML, suggest charts for your data, generate React code",
5
+ "keywords": [
6
+ "chart",
7
+ "cli",
8
+ "svg",
9
+ "png",
10
+ "json-schema",
11
+ "ai",
12
+ "funnest"
13
+ ],
14
+ "license": "Apache-2.0",
15
+ "author": "Funnest",
16
+ "homepage": "https://charts.funnest.xyz/docs/ai/",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/funnest-xyz/funnest-charts.git",
20
+ "directory": "packages/cli"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/funnest-xyz/funnest-charts/issues"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "type": "module",
29
+ "sideEffects": false,
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "bin": {
33
+ "funnest-charts": "./dist/cli.js"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "funnest-source": "./src/index.ts",
38
+ "types": "./dist/index.d.ts",
39
+ "import": "./dist/index.js"
40
+ }
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "README.md",
45
+ "LICENSE",
46
+ "NOTICE"
47
+ ],
48
+ "dependencies": {
49
+ "react": "^19.3.1",
50
+ "react-dom": "^19.3.1",
51
+ "@funnest/charts-react": "0.1.1",
52
+ "@funnest/charts-viz": "0.1.1"
53
+ },
54
+ "optionalDependencies": {
55
+ "@resvg/resvg-js": "^2.6.2"
56
+ },
57
+ "devDependencies": {
58
+ "@types/react": "^19.3.0",
59
+ "@types/react-dom": "^19.3.0"
60
+ },
61
+ "scripts": {
62
+ "build": "tsup && tsc -p tsconfig.build.json",
63
+ "typecheck": "tsc -p tsconfig.json"
64
+ }
6
65
  }