@bonnard/cli 0.1.12 → 0.1.13
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/bin/bon.mjs +9 -0
- package/dist/docs/topics/getting-started.md +157 -0
- package/package.json +2 -2
package/dist/bin/bon.mjs
CHANGED
|
@@ -2659,6 +2659,15 @@ function getChildTopics(topicId) {
|
|
|
2659
2659
|
function searchTopics(query) {
|
|
2660
2660
|
const results = [];
|
|
2661
2661
|
const queryLower = query.toLowerCase();
|
|
2662
|
+
const index = loadIndex();
|
|
2663
|
+
if (index) {
|
|
2664
|
+
const indexMatches = [];
|
|
2665
|
+
for (const line of index.split("\n")) if (line.toLowerCase().includes(queryLower)) indexMatches.push(line.trim());
|
|
2666
|
+
if (indexMatches.length > 0) results.push({
|
|
2667
|
+
topic: "(index)",
|
|
2668
|
+
matches: indexMatches.slice(0, 3)
|
|
2669
|
+
});
|
|
2670
|
+
}
|
|
2662
2671
|
for (const topic of getAvailableTopics()) {
|
|
2663
2672
|
const content = loadTopic(topic);
|
|
2664
2673
|
if (!content) continue;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
> Set up Bonnard and build your first semantic layer in minutes.
|
|
4
|
+
|
|
5
|
+
## What is Bonnard?
|
|
6
|
+
|
|
7
|
+
Bonnard is a semantic layer platform that sits between your data warehouse and your consumers (BI tools, AI agents, applications). You define your metrics and dimensions once in YAML, then query them through a consistent API.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- **Node.js 18+** — [Install Node.js](https://nodejs.org)
|
|
12
|
+
- **A data warehouse** — PostgreSQL, Snowflake, BigQuery, or Databricks (or use our demo dataset)
|
|
13
|
+
- **A Bonnard account** — [Sign up at app.bonnard.dev](https://app.bonnard.dev)
|
|
14
|
+
|
|
15
|
+
## Install the CLI
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g @bonnard/cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Verify the installation:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bon --version
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Log in
|
|
28
|
+
|
|
29
|
+
Authenticate with your Bonnard account:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bon login
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This opens your browser to complete authentication. Once done, verify with:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bon whoami
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Initialize a project
|
|
42
|
+
|
|
43
|
+
Navigate to your project directory and run:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bon init
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This creates the project structure:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
my-project/
|
|
53
|
+
├── bon.yaml # Project configuration
|
|
54
|
+
├── bonnard/
|
|
55
|
+
│ ├── cubes/ # Cube definitions (measures + dimensions)
|
|
56
|
+
│ └── views/ # View definitions (curated interfaces)
|
|
57
|
+
└── .bon/ # Local config (gitignored)
|
|
58
|
+
└── datasources.yaml
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If you have an existing dbt project, `bon init` will detect it and set up your agent context accordingly.
|
|
62
|
+
|
|
63
|
+
## Connect a data source
|
|
64
|
+
|
|
65
|
+
Add your warehouse connection:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
bon datasource add
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Follow the interactive prompts to configure your connection. If you use dbt, you can import from your profiles:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
bon datasource add --from-dbt
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**No warehouse yet?** Use our demo dataset — a read-only retail database (Contoso) with sales, products, stores, and customer data:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
bon datasource add --demo
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Test the connection:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
bon datasource test contoso_demo
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Create your first cube
|
|
90
|
+
|
|
91
|
+
Create a file at `bonnard/cubes/sales.yaml` (using the demo dataset — adapt table and column names to your own data):
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
cubes:
|
|
95
|
+
- name: sales
|
|
96
|
+
sql_table: contoso.fact_sales
|
|
97
|
+
data_source: contoso_demo
|
|
98
|
+
|
|
99
|
+
measures:
|
|
100
|
+
- name: count
|
|
101
|
+
type: count
|
|
102
|
+
|
|
103
|
+
- name: total_revenue
|
|
104
|
+
type: sum
|
|
105
|
+
sql: sales_amount
|
|
106
|
+
|
|
107
|
+
dimensions:
|
|
108
|
+
- name: sales_key
|
|
109
|
+
type: number
|
|
110
|
+
sql: sales_key
|
|
111
|
+
primary_key: true
|
|
112
|
+
|
|
113
|
+
- name: date
|
|
114
|
+
type: time
|
|
115
|
+
sql: date_key
|
|
116
|
+
|
|
117
|
+
- name: sales_quantity
|
|
118
|
+
type: number
|
|
119
|
+
sql: sales_quantity
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Validate
|
|
123
|
+
|
|
124
|
+
Check your cubes and views for errors:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
bon validate
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Deploy
|
|
131
|
+
|
|
132
|
+
Push your semantic layer to Bonnard:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
bon deploy
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Query
|
|
139
|
+
|
|
140
|
+
Test your deployed semantic layer:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
bon query '{"measures": ["sales.count"]}'
|
|
144
|
+
|
|
145
|
+
# With a dimension
|
|
146
|
+
bon query '{"measures": ["sales.total_revenue"], "dimensions": ["sales.date"]}'
|
|
147
|
+
|
|
148
|
+
# Or use SQL format
|
|
149
|
+
bon query --sql "SELECT MEASURE(total_revenue) FROM sales"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Next steps
|
|
153
|
+
|
|
154
|
+
- Learn about [cubes](/docs/modeling/cubes) — measures, dimensions, joins
|
|
155
|
+
- Learn about [views](/docs/modeling/views) — curated interfaces for consumers
|
|
156
|
+
- Set up [MCP](/docs/workflow/mcp) — connect AI agents to your semantic layer
|
|
157
|
+
- Read the full [workflow guide](/docs/workflow) — validate, deploy, query
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonnard/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bon": "./dist/bin/bon.mjs"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin && cp -r src/templates dist/ && mkdir -p dist/docs/topics dist/docs/schemas && cp ../content/index.md dist/docs/_index.md && cp ../content/modeling/*.md dist/docs/topics/",
|
|
12
|
+
"build": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin && cp -r src/templates dist/ && mkdir -p dist/docs/topics dist/docs/schemas && cp ../content/index.md dist/docs/_index.md && cp ../content/getting-started.md dist/docs/topics/ && cp ../content/modeling/*.md dist/docs/topics/",
|
|
13
13
|
"dev": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin --watch",
|
|
14
14
|
"test": "vitest run"
|
|
15
15
|
},
|