@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.
package/dist/data.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type { ChartSpec, Row } from './spec';
2
+ /** Minimal RFC 4180 CSV parser (quoted fields, escaped quotes, CRLF). Numbers become numbers. */
3
+ export declare function parseCsv(text: string): Row[];
4
+ /** Rows from file text by extension (.csv / .json — array, or { data: [...] }). */
5
+ export declare function parseData(text: string, filename: string): Row[];
6
+ export interface Suggestion {
7
+ reason: {
8
+ ko: string;
9
+ en: string;
10
+ };
11
+ spec: ChartSpec;
12
+ }
13
+ /** Look at the columns and propose charts that fit (most fitting first). */
14
+ export declare function suggestCharts(rows: Row[]): Suggestion[];
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,66 @@
1
+ export type CliLocale = 'ko' | 'en';
2
+ export declare const messages: (locale?: CliLocale) => {
3
+ readonly required: (f: string) => string;
4
+ readonly unknownField: (f: string, hint: string | null) => string;
5
+ readonly wrongType: (f: string, want: string) => string;
6
+ readonly notOneOf: (f: string, list: string) => string;
7
+ readonly unknownType: (t: string, hint: string | null) => string;
8
+ readonly noColumn: (f: string, col: string, cols: string, hint: string | null) => string;
9
+ readonly notNumeric: (f: string, col: string) => string;
10
+ readonly emptyData: 'data: 데이터가 비어 있어요.';
11
+ readonly valid: '스펙에 문제가 없어요.';
12
+ readonly invalid: (n: number) => string;
13
+ readonly wrote: (p: string) => string;
14
+ readonly usage: `funnest-charts — Funnest Charts 명령줄 도구
15
+
16
+ 사용법: funnest-charts <명령> [옵션]
17
+
18
+ 명령:
19
+ list 차트 목록
20
+ info <type> 항목, 예시, React 코드
21
+ example <type> [--out f] 시작용 스펙
22
+ schema <type> [--out f] JSON 스키마
23
+ validate <spec.json> 스펙 검사 (오류가 있으면 1로 끝나요)
24
+ render <spec.json> --out f SVG · PNG · HTML로 그리기 (--theme light|dark, --scale 2)
25
+ suggest <data.csv|json> 데이터에 맞는 차트 추천 (--out-dir charts)
26
+ init <dir> [--type line] 시작 폴더 만들기 (spec.json, Chart.tsx)
27
+
28
+ 모든 명령에 --locale ko|en 을 붙일 수 있어요.`;
29
+ readonly unknownCommand: (c: string) => string;
30
+ readonly needArg: (what: string) => string;
31
+ readonly pngMissing: 'PNG로 그리려면 @resvg/resvg-js가 필요해요: npm i @resvg/resvg-js';
32
+ readonly suggested: (n: number) => string;
33
+ readonly initDone: (dir: string) => string;
34
+ } | {
35
+ readonly required: (f: string) => string;
36
+ readonly unknownField: (f: string, hint: string | null) => string;
37
+ readonly wrongType: (f: string, want: string) => string;
38
+ readonly notOneOf: (f: string, list: string) => string;
39
+ readonly unknownType: (t: string, hint: string | null) => string;
40
+ readonly noColumn: (f: string, col: string, cols: string, hint: string | null) => string;
41
+ readonly notNumeric: (f: string, col: string) => string;
42
+ readonly emptyData: 'data: is empty.';
43
+ readonly valid: 'Spec is valid.';
44
+ readonly invalid: (n: number) => string;
45
+ readonly wrote: (p: string) => string;
46
+ readonly usage: `funnest-charts — Funnest Charts command line
47
+
48
+ Usage: funnest-charts <command> [options]
49
+
50
+ Commands:
51
+ list List charts
52
+ info <type> Fields, example, React code
53
+ example <type> [--out f] Starter spec
54
+ schema <type> [--out f] JSON Schema
55
+ validate <spec.json> Check a spec (exits 1 on errors)
56
+ render <spec.json> --out f Render to SVG, PNG or HTML (--theme light|dark, --scale 2)
57
+ suggest <data.csv|json> Suggest charts for your data (--out-dir charts)
58
+ init <dir> [--type line] Create a starter folder (spec.json, Chart.tsx)
59
+
60
+ Every command accepts --locale ko|en.`;
61
+ readonly unknownCommand: (c: string) => string;
62
+ readonly needArg: (what: string) => string;
63
+ readonly pngMissing: 'PNG output needs @resvg/resvg-js: npm i @resvg/resvg-js';
64
+ readonly suggested: (n: number) => string;
65
+ readonly initDone: (dir: string) => string;
66
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @funnest/charts-cli — chart specs for tools and AI agents.
3
+ *
4
+ * A JSON spec ({ type, data, x, y, … }) is validated, turned into JSON Schema, rendered to
5
+ * SVG/PNG/HTML with the same React components apps use, or translated into React code.
6
+ * The `funnest-charts` command and @funnest/charts-mcp are thin layers over these functions.
7
+ */
8
+ export { CHARTS, CHART_TYPES, chartSchema, closest, exampleSpec, validateSpec, type ChartDef, type ChartSpec, type ChartType, type FieldDef, type PointSpec, type ReferenceLineSpec, type Row, type ValidationIssue, } from './spec';
9
+ export { reactCode, renderHtml, renderPng, renderSvg, valueFormatter, type RenderOptions } from './render';
10
+ export { parseCsv, parseData, suggestCharts, type Suggestion } from './data';
11
+ export { messages, type CliLocale } from './i18n';
12
+ export { datafeedTemplate, type DatafeedTemplateKind } from './templates';