@bonnard/cli 0.2.16 → 0.3.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.
@@ -1,25 +1,14 @@
1
1
  ---
2
- description: "Guide for building and deploying data dashboards using the Bonnard SDK and Chart.js. Use when user says 'build a dashboard', 'create a chart', 'visualize data', or wants to deploy an HTML dashboard."
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 an HTML dashboard powered by the
9
- Bonnard SDK and deploying it as a hosted dashboard.
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: Get the Starter Template
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 3: Build the HTML File
29
+ ## Phase 2: Learn the Format
41
30
 
42
- Create an HTML file that:
43
- 1. Loads `@bonnard/sdk` from CDN (see the template from Phase 1)
44
- 2. Initializes the SDK with a publishable key placeholder
45
- 3. Queries the semantic layer for the data the user wants
46
- 4. Renders charts using Chart.js (or another chart library)
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
- - The SDK uses `Bonnard.query()` to fetch data from the deployed semantic layer
50
- - Use the view names and measure/dimension names from Phase 2
51
- - The publishable key will be provided by the user or can be created with `bon keys create`
52
- - Keep the HTML self-contained (inline CSS/JS, load libraries from CDN)
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
- Save the file (e.g., `dashboard.html`).
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
- Let the user preview the file in their browser before deploying.
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
- # Create a publishable key if needed
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 HTML file as a hosted dashboard on Bonnard:
105
+ Deploy the dashboard to Bonnard:
69
106
 
70
107
  ```bash
71
- bon dashboard deploy dashboard.html
108
+ bon dashboard deploy dashboard.md
72
109
  ```
73
110
 
74
111
  This will:
75
- - Upload the HTML content
112
+ - Upload the markdown content
76
113
  - Assign a slug (derived from filename, or use `--slug`)
77
- - Print the public URL where the dashboard is accessible
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>` — dashboard title (default: from `<title>` tag)
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 the dashboard, edit the HTML file and redeploy:
131
+ To update, edit the `.md` file and redeploy:
94
132
 
95
133
  ```bash
96
- bon dashboard deploy dashboard.html
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 deploy <file>` | Deploy an HTML file as a hosted 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 with SDK + charts: `/bonnard-build-dashboard`
118
+ For building markdown dashboards: `/bonnard-build-dashboard` (see also `bon docs dashboards`)
118
119
 
119
120
  ## Deployment & Change Tracking
120
121