@miao-vision/cli 0.1.2

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,54 @@
1
+ title: Sales Dashboard
2
+ description: Example Miao Vision report generated from sales.csv.
3
+ charts:
4
+ - type: bigvalue
5
+ title: Total Sales
6
+ data:
7
+ transform:
8
+ - type: aggregate
9
+ measures:
10
+ - field: sales
11
+ op: sum
12
+ as: total_sales
13
+ encoding:
14
+ value:
15
+ field: total_sales
16
+ - type: line
17
+ title: Monthly Sales Trend
18
+ data:
19
+ transform:
20
+ - type: derive-month
21
+ field: order_date
22
+ as: order_month
23
+ - type: aggregate
24
+ groupBy: [order_month]
25
+ measures:
26
+ - field: sales
27
+ op: sum
28
+ as: total_sales
29
+ - type: sort
30
+ field: order_month
31
+ order: asc
32
+ encoding:
33
+ x:
34
+ field: order_month
35
+ y:
36
+ field: total_sales
37
+ - type: bar
38
+ title: Sales by Region
39
+ data:
40
+ transform:
41
+ - type: aggregate
42
+ groupBy: [region]
43
+ measures:
44
+ - field: sales
45
+ op: sum
46
+ as: total_sales
47
+ - type: sort
48
+ field: total_sales
49
+ order: desc
50
+ encoding:
51
+ x:
52
+ field: region
53
+ y:
54
+ field: total_sales
@@ -0,0 +1,128 @@
1
+ title: Sales Review
2
+ theme: editorial
3
+ slides:
4
+ - layout: cover
5
+ title: "Sales Review"
6
+ claim: "Regional performance and trend analysis"
7
+ eyebrow: "2025 · Miao Vision"
8
+
9
+ - layout: metrics-chart
10
+ eyebrow: "01 · KEY METRICS"
11
+ title: "Quarter at a Glance"
12
+ metrics:
13
+ - label: Total Revenue
14
+ format: "$,.0f"
15
+ data:
16
+ transform:
17
+ - type: aggregate
18
+ measures:
19
+ - field: sales
20
+ op: sum
21
+ as: v
22
+ - label: Total Orders
23
+ format: ",.0f"
24
+ data:
25
+ transform:
26
+ - type: aggregate
27
+ measures:
28
+ - field: orders
29
+ op: sum
30
+ as: v
31
+ - label: Avg Order Value
32
+ format: "$,.0f"
33
+ data:
34
+ transform:
35
+ - type: aggregate
36
+ measures:
37
+ - field: sales
38
+ op: avg
39
+ as: v
40
+ charts:
41
+ - type: line
42
+ title: Monthly Revenue Trend
43
+ data:
44
+ transform:
45
+ - type: derive-month
46
+ field: order_date
47
+ as: month
48
+ - type: aggregate
49
+ groupBy: [month]
50
+ measures:
51
+ - field: sales
52
+ op: sum
53
+ as: total
54
+ - type: sort
55
+ field: month
56
+ order: asc
57
+ encoding:
58
+ x: { field: month }
59
+ y: { field: total }
60
+
61
+ - layout: text-chart
62
+ eyebrow: "02 · REGIONAL"
63
+ title: "Sales by Region"
64
+ annotation: "East region leads in total revenue across all categories."
65
+ bullets:
66
+ - "East: highest absolute revenue"
67
+ - "West: strong order volume"
68
+ - "North: growth opportunity"
69
+ charts:
70
+ - type: bar
71
+ title: Revenue by Region
72
+ data:
73
+ transform:
74
+ - type: aggregate
75
+ groupBy: [region]
76
+ measures:
77
+ - field: sales
78
+ op: sum
79
+ as: total
80
+ - type: sort
81
+ field: total
82
+ order: desc
83
+ encoding:
84
+ x: { field: region }
85
+ y: { field: total }
86
+
87
+ - layout: chart-full
88
+ eyebrow: "03 · CATEGORY"
89
+ title: "Revenue by Category"
90
+ charts:
91
+ - type: bar
92
+ title: Category Breakdown
93
+ data:
94
+ transform:
95
+ - type: aggregate
96
+ groupBy: [category]
97
+ measures:
98
+ - field: sales
99
+ op: sum
100
+ as: total
101
+ - type: sort
102
+ field: total
103
+ order: desc
104
+ encoding:
105
+ x: { field: category }
106
+ y: { field: total }
107
+ color: { field: category }
108
+
109
+ - layout: table-full
110
+ eyebrow: "04 · DETAIL"
111
+ title: "Top Transactions"
112
+ charts:
113
+ - type: table
114
+ title: Top Transactions
115
+ data:
116
+ transform:
117
+ - type: sort
118
+ field: sales
119
+ order: desc
120
+ - type: limit
121
+ value: 12
122
+ encoding:
123
+ x: { field: order_date }
124
+ y: { field: sales }
125
+
126
+ - layout: ending
127
+ title: "Thank you"
128
+ claim: "Miao Vision · Data-driven presentations"
@@ -0,0 +1,5 @@
1
+ order_date,region,category,sales,orders
2
+ 2025-01-01,East,A,100,4
3
+ 2025-01-02,West,B,120,5
4
+ 2025-02-01,East,A,140,6
5
+ 2025-02-02,North,C,90,3
package/dist/types.ts ADDED
@@ -0,0 +1,193 @@
1
+ export type AgentColumnType = 'string' | 'number' | 'boolean' | 'date' | 'unknown'
2
+ export type AgentOutputFormat = 'html' | 'svg' | 'png' | 'pdf'
3
+ export type VizType =
4
+ | 'line'
5
+ | 'bar'
6
+ | 'area'
7
+ | 'scatter'
8
+ | 'pie'
9
+ | 'histogram'
10
+ | 'boxplot'
11
+ | 'bubble'
12
+ | 'radar'
13
+ | 'heatmap'
14
+ | 'sankey'
15
+ | 'treemap'
16
+ | 'funnel'
17
+ | 'waterfall'
18
+ | 'gauge'
19
+ | 'progress'
20
+ | 'sparkline'
21
+ | 'delta'
22
+ | 'bigvalue'
23
+ | 'infographic-list'
24
+ | 'infographic-flow'
25
+ | 'infographic-hierarchy'
26
+ | 'infographic-comparison'
27
+ | 'infographic-kpi'
28
+ | 'table'
29
+ | 'pivot'
30
+ | 'calendar'
31
+
32
+ export interface AgentError {
33
+ ok: false
34
+ code: string
35
+ message: string
36
+ [key: string]: unknown
37
+ }
38
+
39
+ export interface AgentOk<T> {
40
+ ok: true
41
+ value: T
42
+ }
43
+
44
+ export type AgentResult<T> = AgentOk<T> | AgentError
45
+
46
+ export interface LoadedDataset {
47
+ file: string
48
+ rows: Record<string, unknown>[]
49
+ columns: string[]
50
+ sheet?: string
51
+ }
52
+
53
+ export interface HistogramBucket {
54
+ bucket: string
55
+ count: number
56
+ }
57
+
58
+ export interface ValueDistribution {
59
+ value: string
60
+ count: number
61
+ sharePct: number
62
+ }
63
+
64
+ export interface TemporalProfile {
65
+ span: string
66
+ granularity: 'day' | 'month' | 'quarter' | 'year'
67
+ isMonotonic: boolean
68
+ gapCount: number
69
+ }
70
+
71
+ export interface ColumnProfile {
72
+ name: string
73
+ type: AgentColumnType
74
+ role?: 'measure' | 'dimension' | 'time' | 'id' | 'flag' | 'unknown'
75
+ total: number
76
+ nonNullCount: number
77
+ nullCount: number
78
+ nullRate: number
79
+ fillRate: number
80
+ uniqueRate: number
81
+ samples: unknown[]
82
+ distinctCount: number
83
+ // numeric
84
+ min?: number
85
+ max?: number
86
+ sum?: number
87
+ mean?: number
88
+ median?: number
89
+ p25?: number
90
+ p75?: number
91
+ stddev?: number
92
+ skewness?: number
93
+ coefficientOfVariation?: number
94
+ outlierCount?: number
95
+ histogram?: HistogramBucket[]
96
+ // string
97
+ topValue?: unknown
98
+ topSharePct?: number
99
+ distribution?: ValueDistribution[]
100
+ // date
101
+ temporal?: TemporalProfile
102
+ }
103
+
104
+ export interface DataQualityProfile {
105
+ completeness: number
106
+ nullRate: number
107
+ avgUniqueRate: number
108
+ highNullColumns: string[]
109
+ likelyIdColumns: string[]
110
+ duplicateProneDimensions: string[]
111
+ }
112
+
113
+ export interface ProfileInsight {
114
+ type: 'info' | 'warning' | 'suggestion' | 'trend'
115
+ title: string
116
+ description: string
117
+ fields?: string[]
118
+ }
119
+
120
+ export type ProfileHint =
121
+ | { type: 'kpi'; field: string; label: string }
122
+ | { type: 'time-series'; xField: string; yFields: string[] }
123
+ | { type: 'ranking'; groupField: string; measureField: string }
124
+ | { type: 'share'; labelField: string; valueField: string }
125
+ | { type: 'distribution'; field: string; skewed: boolean }
126
+ | { type: 'correlation'; a: string; b: string; r: number }
127
+
128
+ export interface DataProfile {
129
+ file: string
130
+ rows: number
131
+ columns: ColumnProfile[]
132
+ sheet?: string
133
+ quality?: DataQualityProfile
134
+ correlations?: Array<{ a: string; b: string; r: number }>
135
+ hints?: ProfileHint[]
136
+ insights?: ProfileInsight[]
137
+ }
138
+
139
+ export interface AgentFieldEncoding {
140
+ field: string
141
+ type?: 'quantitative' | 'nominal' | 'temporal' | 'ordinal'
142
+ aggregate?: 'sum' | 'avg' | 'count' | 'min' | 'max'
143
+ format?: string
144
+ }
145
+
146
+ export interface AgentDataTransform {
147
+ type: 'derive-month' | 'aggregate' | 'sort' | 'limit' | 'filter'
148
+ field?: string
149
+ as?: string
150
+ groupBy?: string[]
151
+ measures?: Array<{
152
+ field: string
153
+ op: 'sum' | 'avg' | 'count' | 'min' | 'max'
154
+ as: string
155
+ }>
156
+ order?: 'asc' | 'desc'
157
+ value?: unknown
158
+ }
159
+
160
+ export interface AgentChartSpec {
161
+ type: VizType
162
+ title?: string
163
+ data?: {
164
+ source?: string
165
+ transform?: AgentDataTransform[]
166
+ }
167
+ encoding: {
168
+ x?: AgentFieldEncoding
169
+ y?: AgentFieldEncoding
170
+ color?: AgentFieldEncoding
171
+ size?: AgentFieldEncoding
172
+ label?: AgentFieldEncoding
173
+ value?: AgentFieldEncoding
174
+ [key: string]: AgentFieldEncoding | undefined
175
+ }
176
+ style?: Record<string, unknown>
177
+ }
178
+
179
+ export interface AgentReportSpec {
180
+ title?: string
181
+ description?: string
182
+ theme?: 'default' | 'editorial' | 'dark' | 'minimal'
183
+ insights?: string[]
184
+ charts: AgentChartSpec[]
185
+ }
186
+
187
+ export interface RenderJob {
188
+ input: string
189
+ spec: AgentReportSpec
190
+ profile: DataProfile
191
+ formats: AgentOutputFormat[]
192
+ output: string
193
+ }
@@ -0,0 +1,54 @@
1
+ title: Sales Dashboard
2
+ description: Example Miao Vision report generated from sales.csv.
3
+ charts:
4
+ - type: bigvalue
5
+ title: Total Sales
6
+ data:
7
+ transform:
8
+ - type: aggregate
9
+ measures:
10
+ - field: sales
11
+ op: sum
12
+ as: total_sales
13
+ encoding:
14
+ value:
15
+ field: total_sales
16
+ - type: line
17
+ title: Monthly Sales Trend
18
+ data:
19
+ transform:
20
+ - type: derive-month
21
+ field: order_date
22
+ as: order_month
23
+ - type: aggregate
24
+ groupBy: [order_month]
25
+ measures:
26
+ - field: sales
27
+ op: sum
28
+ as: total_sales
29
+ - type: sort
30
+ field: order_month
31
+ order: asc
32
+ encoding:
33
+ x:
34
+ field: order_month
35
+ y:
36
+ field: total_sales
37
+ - type: bar
38
+ title: Sales by Region
39
+ data:
40
+ transform:
41
+ - type: aggregate
42
+ groupBy: [region]
43
+ measures:
44
+ - field: sales
45
+ op: sum
46
+ as: total_sales
47
+ - type: sort
48
+ field: total_sales
49
+ order: desc
50
+ encoding:
51
+ x:
52
+ field: region
53
+ y:
54
+ field: total_sales
@@ -0,0 +1,128 @@
1
+ title: Sales Review
2
+ theme: editorial
3
+ slides:
4
+ - layout: cover
5
+ title: "Sales Review"
6
+ claim: "Regional performance and trend analysis"
7
+ eyebrow: "2025 · Miao Vision"
8
+
9
+ - layout: metrics-chart
10
+ eyebrow: "01 · KEY METRICS"
11
+ title: "Quarter at a Glance"
12
+ metrics:
13
+ - label: Total Revenue
14
+ format: "$,.0f"
15
+ data:
16
+ transform:
17
+ - type: aggregate
18
+ measures:
19
+ - field: sales
20
+ op: sum
21
+ as: v
22
+ - label: Total Orders
23
+ format: ",.0f"
24
+ data:
25
+ transform:
26
+ - type: aggregate
27
+ measures:
28
+ - field: orders
29
+ op: sum
30
+ as: v
31
+ - label: Avg Order Value
32
+ format: "$,.0f"
33
+ data:
34
+ transform:
35
+ - type: aggregate
36
+ measures:
37
+ - field: sales
38
+ op: avg
39
+ as: v
40
+ charts:
41
+ - type: line
42
+ title: Monthly Revenue Trend
43
+ data:
44
+ transform:
45
+ - type: derive-month
46
+ field: order_date
47
+ as: month
48
+ - type: aggregate
49
+ groupBy: [month]
50
+ measures:
51
+ - field: sales
52
+ op: sum
53
+ as: total
54
+ - type: sort
55
+ field: month
56
+ order: asc
57
+ encoding:
58
+ x: { field: month }
59
+ y: { field: total }
60
+
61
+ - layout: text-chart
62
+ eyebrow: "02 · REGIONAL"
63
+ title: "Sales by Region"
64
+ annotation: "East region leads in total revenue across all categories."
65
+ bullets:
66
+ - "East: highest absolute revenue"
67
+ - "West: strong order volume"
68
+ - "North: growth opportunity"
69
+ charts:
70
+ - type: bar
71
+ title: Revenue by Region
72
+ data:
73
+ transform:
74
+ - type: aggregate
75
+ groupBy: [region]
76
+ measures:
77
+ - field: sales
78
+ op: sum
79
+ as: total
80
+ - type: sort
81
+ field: total
82
+ order: desc
83
+ encoding:
84
+ x: { field: region }
85
+ y: { field: total }
86
+
87
+ - layout: chart-full
88
+ eyebrow: "03 · CATEGORY"
89
+ title: "Revenue by Category"
90
+ charts:
91
+ - type: bar
92
+ title: Category Breakdown
93
+ data:
94
+ transform:
95
+ - type: aggregate
96
+ groupBy: [category]
97
+ measures:
98
+ - field: sales
99
+ op: sum
100
+ as: total
101
+ - type: sort
102
+ field: total
103
+ order: desc
104
+ encoding:
105
+ x: { field: category }
106
+ y: { field: total }
107
+ color: { field: category }
108
+
109
+ - layout: table-full
110
+ eyebrow: "04 · DETAIL"
111
+ title: "Top Transactions"
112
+ charts:
113
+ - type: table
114
+ title: Top Transactions
115
+ data:
116
+ transform:
117
+ - type: sort
118
+ field: sales
119
+ order: desc
120
+ - type: limit
121
+ value: 12
122
+ encoding:
123
+ x: { field: order_date }
124
+ y: { field: sales }
125
+
126
+ - layout: ending
127
+ title: "Thank you"
128
+ claim: "Miao Vision · Data-driven presentations"
@@ -0,0 +1,5 @@
1
+ order_date,region,category,sales,orders
2
+ 2025-01-01,East,A,100,4
3
+ 2025-01-02,West,B,120,5
4
+ 2025-02-01,East,A,140,6
5
+ 2025-02-02,North,C,90,3
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@miao-vision/cli",
3
+ "version": "0.1.2",
4
+ "description": "Miao Vision local data visualization CLI for agent workflows",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "miao-viz": "./dist/cli.cjs"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "examples",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "node scripts/build.mjs",
17
+ "prepublishOnly": "node scripts/build.mjs",
18
+ "smoke": "node dist/cli.cjs profile examples/sales.csv"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/guming/miao-vision.git",
23
+ "directory": "packages/miao-viz-cli"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "devDependencies": {
29
+ "esbuild": "^0.24.0",
30
+ "typescript": "^5.7.2",
31
+ "xlsx": "^0.18.5",
32
+ "yaml": "^2.8.2",
33
+ "zod": "^4.4.3"
34
+ },
35
+ "engines": {
36
+ "node": ">=20"
37
+ }
38
+ }