@bonnard/cli 0.2.16 → 0.3.0
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/README.md +7 -0
- package/dist/bin/bon.mjs +254 -48
- package/dist/docs/topics/dashboards.components.md +246 -0
- package/dist/docs/topics/dashboards.examples.md +343 -0
- package/dist/docs/topics/dashboards.inputs.md +173 -0
- package/dist/docs/topics/dashboards.md +112 -0
- package/dist/docs/topics/dashboards.queries.md +112 -0
- package/dist/templates/claude/skills/bonnard-build-dashboard/SKILL.md +77 -39
- package/dist/templates/cursor/rules/bonnard-build-dashboard.mdc +76 -38
- package/dist/templates/shared/bonnard.md +3 -2
- package/dist/viewer.html +261 -0
- package/package.json +11 -2
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Guide for building and deploying
|
|
2
|
+
description: "Guide for building and deploying markdown dashboards with built-in chart components. Use when user says 'build a dashboard', 'create a chart', 'visualize data', or wants to create a dashboard."
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Build & Deploy a Dashboard
|
|
6
|
+
# Build & Deploy a Markdown Dashboard
|
|
7
7
|
|
|
8
|
-
This guide walks through creating
|
|
9
|
-
|
|
8
|
+
This guide walks through creating a markdown dashboard with built-in
|
|
9
|
+
chart components and deploying it to Bonnard.
|
|
10
10
|
|
|
11
|
-
## Phase 1:
|
|
12
|
-
|
|
13
|
-
Fetch the SDK + Chart.js starter template:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
bon docs sdk.chartjs
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This shows a working HTML template with `@bonnard/sdk` loaded from CDN and
|
|
20
|
-
a Chart.js example. Copy this as your starting point.
|
|
21
|
-
|
|
22
|
-
## Phase 2: Explore Available Data
|
|
11
|
+
## Phase 1: Explore Available Data
|
|
23
12
|
|
|
24
13
|
Discover what measures and dimensions are available to query:
|
|
25
14
|
|
|
@@ -37,48 +26,97 @@ bon query --sql "SELECT MEASURE(total_revenue), date FROM sales_performance LIMI
|
|
|
37
26
|
Ask the user what data they want to visualize. Match their request to
|
|
38
27
|
available views and measures.
|
|
39
28
|
|
|
40
|
-
## Phase
|
|
29
|
+
## Phase 2: Learn the Format
|
|
41
30
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
Review the dashboard format docs for reference:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bon docs dashboards # Overview + format
|
|
35
|
+
bon docs dashboards.components # Chart components (BigValue, LineChart, BarChart, etc.)
|
|
36
|
+
bon docs dashboards.queries # Query block syntax
|
|
37
|
+
bon docs dashboards.inputs # Interactive filters (DateRange, Dropdown)
|
|
38
|
+
bon docs dashboards.examples # Complete examples
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Phase 3: Build the Markdown File
|
|
42
|
+
|
|
43
|
+
Create a `.md` file with three parts:
|
|
44
|
+
|
|
45
|
+
1. **YAML frontmatter** — title and optional description
|
|
46
|
+
2. **Query blocks** — ` ```query name ` code fences with YAML query options
|
|
47
|
+
3. **Components** — `<BigValue />`, `<LineChart />`, `<BarChart />`, etc.
|
|
47
48
|
|
|
48
49
|
Key points:
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
50
|
+
- All field names must be fully qualified: `orders.total_revenue`, not `total_revenue`
|
|
51
|
+
- Each component references a query by name: `data={query_name}`
|
|
52
|
+
- Consecutive `<BigValue>` components auto-group into a row
|
|
53
|
+
- Use `<Grid cols="2">` to place charts side by side
|
|
54
|
+
- Use `<DateRange>` and `<Dropdown>` for interactive filters
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
Example structure:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
---
|
|
60
|
+
title: Revenue Dashboard
|
|
61
|
+
description: Key revenue metrics and trends
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
` ``query total_revenue
|
|
65
|
+
measures: [orders.total_revenue]
|
|
66
|
+
` ``
|
|
67
|
+
|
|
68
|
+
` ``query order_count
|
|
69
|
+
measures: [orders.count]
|
|
70
|
+
` ``
|
|
71
|
+
|
|
72
|
+
<BigValue data={total_revenue} value="orders.total_revenue" title="Revenue" fmt="eur2" />
|
|
73
|
+
<BigValue data={order_count} value="orders.count" title="Orders" />
|
|
74
|
+
|
|
75
|
+
## Trend
|
|
76
|
+
|
|
77
|
+
` ``query monthly
|
|
78
|
+
measures: [orders.total_revenue]
|
|
79
|
+
timeDimension:
|
|
80
|
+
dimension: orders.created_at
|
|
81
|
+
granularity: month
|
|
82
|
+
` ``
|
|
83
|
+
|
|
84
|
+
<LineChart data={monthly} x="orders.created_at" y="orders.total_revenue" title="Monthly Revenue" yFmt="eur" />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Save the file (e.g., `dashboard.md`).
|
|
55
88
|
|
|
56
89
|
## Phase 4: Preview Locally
|
|
57
90
|
|
|
58
|
-
|
|
59
|
-
They'll need to set a valid publishable key in the HTML first.
|
|
91
|
+
Preview the dashboard with live reload:
|
|
60
92
|
|
|
61
93
|
```bash
|
|
62
|
-
|
|
63
|
-
bon keys create --name "Dashboard" --type publishable
|
|
94
|
+
bon dashboard dev dashboard.md
|
|
64
95
|
```
|
|
65
96
|
|
|
97
|
+
This opens a browser with the rendered dashboard. Edit the `.md` file and
|
|
98
|
+
the preview updates automatically. Queries run against the deployed
|
|
99
|
+
semantic layer using the user's credentials.
|
|
100
|
+
|
|
101
|
+
Requires `bon login` — no API key needed.
|
|
102
|
+
|
|
66
103
|
## Phase 5: Deploy
|
|
67
104
|
|
|
68
|
-
Deploy the
|
|
105
|
+
Deploy the dashboard to Bonnard:
|
|
69
106
|
|
|
70
107
|
```bash
|
|
71
|
-
bon dashboard deploy dashboard.
|
|
108
|
+
bon dashboard deploy dashboard.md
|
|
72
109
|
```
|
|
73
110
|
|
|
74
111
|
This will:
|
|
75
|
-
- Upload the
|
|
112
|
+
- Upload the markdown content
|
|
76
113
|
- Assign a slug (derived from filename, or use `--slug`)
|
|
77
|
-
-
|
|
114
|
+
- Extract the title from frontmatter
|
|
115
|
+
- Print the URL where the dashboard is accessible
|
|
78
116
|
|
|
79
117
|
Options:
|
|
80
118
|
- `--slug <slug>` — custom URL slug (default: derived from filename)
|
|
81
|
-
- `--title <title>` —
|
|
119
|
+
- `--title <title>` — override frontmatter title
|
|
82
120
|
|
|
83
121
|
## Phase 6: View Live
|
|
84
122
|
|
|
@@ -90,10 +128,10 @@ bon dashboard open dashboard
|
|
|
90
128
|
|
|
91
129
|
## Iteration
|
|
92
130
|
|
|
93
|
-
To update
|
|
131
|
+
To update, edit the `.md` file and redeploy:
|
|
94
132
|
|
|
95
133
|
```bash
|
|
96
|
-
bon dashboard deploy dashboard.
|
|
134
|
+
bon dashboard deploy dashboard.md
|
|
97
135
|
```
|
|
98
136
|
|
|
99
137
|
Each deploy increments the version. Use `bon dashboard list` to see all
|
|
@@ -73,7 +73,8 @@ All tables are in the `contoso` schema. The datasource is named `contoso_demo`.
|
|
|
73
73
|
| `bon query '{...}'` | Query the deployed semantic layer (requires `bon deploy` first, not for raw DB access) |
|
|
74
74
|
| `bon mcp` | Show MCP setup instructions for AI agents |
|
|
75
75
|
| `bon docs` | Browse documentation |
|
|
76
|
-
| `bon dashboard
|
|
76
|
+
| `bon dashboard dev <file>` | Preview a markdown dashboard locally with live reload |
|
|
77
|
+
| `bon dashboard deploy <file>` | Deploy a markdown or HTML dashboard |
|
|
77
78
|
| `bon dashboard list` | List deployed dashboards with URLs |
|
|
78
79
|
| `bon dashboard remove <slug>` | Remove a deployed dashboard |
|
|
79
80
|
| `bon dashboard open <slug>` | Open a deployed dashboard in the browser |
|
|
@@ -114,7 +115,7 @@ Topics follow dot notation (e.g., `cubes.dimensions.time`). Use `--recursive` to
|
|
|
114
115
|
For a guided walkthrough: `/bonnard-get-started`
|
|
115
116
|
For projects migrating from Metabase: `/bonnard-metabase-migrate`
|
|
116
117
|
For design principles: `/bonnard-design-guide`
|
|
117
|
-
For building dashboards
|
|
118
|
+
For building markdown dashboards: `/bonnard-build-dashboard` (see also `bon docs dashboards`)
|
|
118
119
|
|
|
119
120
|
## Deployment & Change Tracking
|
|
120
121
|
|