@bonnard/cli 0.1.4 → 0.1.6
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 +576 -91
- package/dist/bin/{models-IsV2sX74.mjs → models-CzOWi3fU.mjs} +5 -3
- package/dist/bin/{validate-C4EHvJzJ.mjs → validate-BUHevw7F.mjs} +4 -2
- package/dist/docs/_index.md +1 -0
- package/dist/docs/topics/cubes.data-source.md +0 -4
- package/dist/docs/topics/cubes.dimensions.format.md +0 -4
- package/dist/docs/topics/cubes.dimensions.md +0 -4
- package/dist/docs/topics/cubes.dimensions.primary-key.md +0 -4
- package/dist/docs/topics/cubes.dimensions.sub-query.md +0 -4
- package/dist/docs/topics/cubes.dimensions.time.md +0 -4
- package/dist/docs/topics/cubes.dimensions.types.md +0 -4
- package/dist/docs/topics/cubes.extends.md +0 -4
- package/dist/docs/topics/cubes.hierarchies.md +0 -4
- package/dist/docs/topics/cubes.joins.md +0 -4
- package/dist/docs/topics/cubes.md +2 -6
- package/dist/docs/topics/cubes.measures.calculated.md +0 -4
- package/dist/docs/topics/cubes.measures.drill-members.md +0 -4
- package/dist/docs/topics/cubes.measures.filters.md +0 -4
- package/dist/docs/topics/cubes.measures.format.md +0 -4
- package/dist/docs/topics/cubes.measures.md +0 -4
- package/dist/docs/topics/cubes.measures.rolling.md +0 -4
- package/dist/docs/topics/cubes.measures.types.md +0 -4
- package/dist/docs/topics/cubes.public.md +0 -4
- package/dist/docs/topics/cubes.refresh-key.md +0 -4
- package/dist/docs/topics/cubes.segments.md +0 -4
- package/dist/docs/topics/cubes.sql.md +0 -4
- package/dist/docs/topics/pre-aggregations.md +0 -4
- package/dist/docs/topics/pre-aggregations.rollup.md +0 -4
- package/dist/docs/topics/syntax.context-variables.md +0 -4
- package/dist/docs/topics/syntax.md +0 -4
- package/dist/docs/topics/syntax.references.md +0 -4
- package/dist/docs/topics/views.cubes.md +0 -4
- package/dist/docs/topics/views.folders.md +0 -4
- package/dist/docs/topics/views.includes.md +0 -4
- package/dist/docs/topics/views.md +2 -6
- package/dist/docs/topics/workflow.deploy.md +8 -12
- package/dist/docs/topics/workflow.mcp.md +100 -0
- package/dist/docs/topics/workflow.md +10 -13
- package/dist/docs/topics/workflow.query.md +0 -5
- package/dist/docs/topics/workflow.validate.md +4 -8
- package/dist/templates/claude/skills/bonnard-queries/SKILL.md +2 -2
- package/dist/templates/cursor/rules/bonnard-queries.mdc +2 -2
- package/dist/templates/shared/bonnard.md +8 -7
- package/package.json +3 -2
- package/dist/docs/README.md +0 -82
- package/dist/templates/claude/rules/bonnard.md +0 -15
- package/dist/templates/cursor/rules/bonnard.mdc +0 -20
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as getProjectPaths } from "./bon.mjs";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import YAML from "yaml";
|
|
@@ -48,12 +49,13 @@ function extractFromFile(filePath) {
|
|
|
48
49
|
return datasourceToCubes;
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
|
-
* Extract all unique datasource references from models/ and views/ directories
|
|
52
|
+
* Extract all unique datasource references from bonnard/models/ and bonnard/views/ directories
|
|
52
53
|
* Returns datasource names mapped to the cubes that use them
|
|
53
54
|
*/
|
|
54
55
|
function extractDatasourcesFromModels(projectPath) {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
56
|
+
const paths = getProjectPaths(projectPath);
|
|
57
|
+
const modelsDir = paths.models;
|
|
58
|
+
const viewsDir = paths.views;
|
|
57
59
|
const allFiles = [...collectYamlFiles(modelsDir), ...collectYamlFiles(viewsDir)];
|
|
58
60
|
const aggregated = /* @__PURE__ */ new Map();
|
|
59
61
|
for (const file of allFiles) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as getProjectPaths } from "./bon.mjs";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import YAML from "yaml";
|
|
@@ -59,8 +60,9 @@ function checkMissingDescriptions(files) {
|
|
|
59
60
|
return missing;
|
|
60
61
|
}
|
|
61
62
|
function createModelRepository(projectPath) {
|
|
62
|
-
const
|
|
63
|
-
const
|
|
63
|
+
const paths = getProjectPaths(projectPath);
|
|
64
|
+
const modelsDir = paths.models;
|
|
65
|
+
const viewsDir = paths.views;
|
|
64
66
|
return {
|
|
65
67
|
localPath: () => projectPath,
|
|
66
68
|
dataSchemaFiles: () => {
|
package/dist/docs/_index.md
CHANGED
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
- [workflow.validate](workflow.validate) - Validate models locally
|
|
59
59
|
- [workflow.deploy](workflow.deploy) - Deploy to Bonnard
|
|
60
60
|
- [workflow.query](workflow.query) - Query the deployed semantic layer
|
|
61
|
+
- [workflow.mcp](workflow.mcp) - Connect AI agents via MCP
|
|
61
62
|
|
|
62
63
|
## Quick Reference
|
|
63
64
|
|
|
@@ -193,7 +193,3 @@ Format support varies by visualization tool. Most tools recognize common formats
|
|
|
193
193
|
- cubes.dimensions
|
|
194
194
|
- cubes.dimensions.types
|
|
195
195
|
- cubes.measures.format
|
|
196
|
-
|
|
197
|
-
## More Information
|
|
198
|
-
|
|
199
|
-
https://cube.dev/docs/reference/data-model/types-and-formats#format
|
|
@@ -90,10 +90,10 @@ cubes:
|
|
|
90
90
|
|
|
91
91
|
## File Organization
|
|
92
92
|
|
|
93
|
-
One cube per file in the `models/` directory:
|
|
93
|
+
One cube per file in the `bonnard/models/` directory:
|
|
94
94
|
|
|
95
95
|
```
|
|
96
|
-
models/
|
|
96
|
+
bonnard/models/
|
|
97
97
|
├── orders.yaml
|
|
98
98
|
├── users.yaml
|
|
99
99
|
├── products.yaml
|
|
@@ -115,7 +115,3 @@ models/
|
|
|
115
115
|
- cubes.dimensions
|
|
116
116
|
- cubes.joins
|
|
117
117
|
- cubes.segments
|
|
118
|
-
|
|
119
|
-
## More Information
|
|
120
|
-
|
|
121
|
-
https://cube.dev/docs/reference/data-model/cube
|
|
@@ -151,7 +151,3 @@ Format support varies by visualization tool. Most tools recognize `percent` and
|
|
|
151
151
|
- cubes.measures
|
|
152
152
|
- cubes.measures.types
|
|
153
153
|
- cubes.dimensions.format
|
|
154
|
-
|
|
155
|
-
## More Information
|
|
156
|
-
|
|
157
|
-
https://cube.dev/docs/reference/data-model/types-and-formats#format
|
|
@@ -113,10 +113,10 @@ views:
|
|
|
113
113
|
|
|
114
114
|
## File Organization
|
|
115
115
|
|
|
116
|
-
Store views in the `views/` directory:
|
|
116
|
+
Store views in the `bonnard/views/` directory:
|
|
117
117
|
|
|
118
118
|
```
|
|
119
|
-
views/
|
|
119
|
+
bonnard/views/
|
|
120
120
|
├── orders_overview.yaml
|
|
121
121
|
├── sales_dashboard.yaml
|
|
122
122
|
└── customer_360.yaml
|
|
@@ -136,7 +136,3 @@ views/
|
|
|
136
136
|
- views.includes
|
|
137
137
|
- views.folders
|
|
138
138
|
- cubes.joins
|
|
139
|
-
|
|
140
|
-
## More Information
|
|
141
|
-
|
|
142
|
-
https://cube.dev/docs/reference/data-model/view
|
|
@@ -32,9 +32,9 @@ bon deploy
|
|
|
32
32
|
bon deploy
|
|
33
33
|
|
|
34
34
|
✓ Validating models...
|
|
35
|
-
✓ models/orders.yaml
|
|
36
|
-
✓ models/users.yaml
|
|
37
|
-
✓ views/orders_overview.yaml
|
|
35
|
+
✓ bonnard/models/orders.yaml
|
|
36
|
+
✓ bonnard/models/users.yaml
|
|
37
|
+
✓ bonnard/views/orders_overview.yaml
|
|
38
38
|
|
|
39
39
|
✓ Testing connections...
|
|
40
40
|
✓ datasource "default" connected
|
|
@@ -58,8 +58,8 @@ bon deploy
|
|
|
58
58
|
├── 2. Test all datasource connections (must succeed)
|
|
59
59
|
│
|
|
60
60
|
├── 3. Upload to Bonnard API
|
|
61
|
-
│ - cubes from models/
|
|
62
|
-
│ - views from views/
|
|
61
|
+
│ - cubes from bonnard/models/
|
|
62
|
+
│ - views from bonnard/views/
|
|
63
63
|
│ - datasource configs
|
|
64
64
|
│
|
|
65
65
|
└── 4. Activate deployment
|
|
@@ -72,7 +72,7 @@ bon deploy
|
|
|
72
72
|
```
|
|
73
73
|
✗ Validating models...
|
|
74
74
|
|
|
75
|
-
models/orders.yaml:15:5
|
|
75
|
+
bonnard/models/orders.yaml:15:5
|
|
76
76
|
error: Unknown measure type "counts"
|
|
77
77
|
|
|
78
78
|
Deploy aborted. Fix validation errors first.
|
|
@@ -102,8 +102,8 @@ Run: bon login
|
|
|
102
102
|
|
|
103
103
|
| Source | Deployed |
|
|
104
104
|
|--------|----------|
|
|
105
|
-
| `models/*.yaml` | All cube definitions |
|
|
106
|
-
| `views/*.yaml` | All view definitions |
|
|
105
|
+
| `bonnard/models/*.yaml` | All cube definitions |
|
|
106
|
+
| `bonnard/views/*.yaml` | All view definitions |
|
|
107
107
|
| `.bon/datasources.yaml` | Connection configs (credentials encrypted) |
|
|
108
108
|
| `bon.yaml` | Project settings |
|
|
109
109
|
|
|
@@ -126,7 +126,3 @@ Run: bon login
|
|
|
126
126
|
- workflow.validate
|
|
127
127
|
- cubes
|
|
128
128
|
- views
|
|
129
|
-
|
|
130
|
-
## More Information
|
|
131
|
-
|
|
132
|
-
https://docs.bonnard.dev/cli/deploy
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# workflow.mcp
|
|
2
|
+
|
|
3
|
+
> Connect AI agents to your semantic layer via MCP.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
After deploying models with `bon deploy`, AI agents (Claude, Cursor, etc.) can query your semantic layer through the Model Context Protocol (MCP). Bonnard's MCP server provides tools for querying cubes and views using natural language.
|
|
8
|
+
|
|
9
|
+
## MCP URL
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
https://mcp.bonnard.dev/mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### Claude Desktop
|
|
18
|
+
|
|
19
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"bonnard": {
|
|
25
|
+
"url": "https://mcp.bonnard.dev/mcp"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Cursor
|
|
32
|
+
|
|
33
|
+
Add to `.cursor/mcp.json` in your project:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"bonnard": {
|
|
39
|
+
"url": "https://mcp.bonnard.dev/mcp"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Claude Code
|
|
46
|
+
|
|
47
|
+
Add to `.mcp.json` in your project:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"bonnard": {
|
|
53
|
+
"type": "url",
|
|
54
|
+
"url": "https://mcp.bonnard.dev/mcp"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Authentication
|
|
61
|
+
|
|
62
|
+
MCP uses OAuth 2.0 with PKCE. When an agent first connects:
|
|
63
|
+
|
|
64
|
+
1. Agent discovers OAuth endpoints via `/.well-known/oauth-authorization-server`
|
|
65
|
+
2. Agent registers as an OAuth client
|
|
66
|
+
3. User is redirected to Bonnard to sign in and authorize
|
|
67
|
+
4. Agent receives an access token (valid for 7 days)
|
|
68
|
+
5. Token persists across server restarts
|
|
69
|
+
|
|
70
|
+
No API keys or manual token management needed.
|
|
71
|
+
|
|
72
|
+
## Testing
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Verify the MCP server is reachable
|
|
76
|
+
bon mcp test
|
|
77
|
+
|
|
78
|
+
# View connection info and config snippets
|
|
79
|
+
bon mcp
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Available Tools
|
|
83
|
+
|
|
84
|
+
Once connected, AI agents can use these MCP tools:
|
|
85
|
+
|
|
86
|
+
| Tool | Description |
|
|
87
|
+
|------|-------------|
|
|
88
|
+
| `query` | Execute a Cube query (measures, dimensions, filters) |
|
|
89
|
+
| `sql_query` | Execute a SQL query via Cube SQL API |
|
|
90
|
+
| `list_cubes` | List available cubes and their members |
|
|
91
|
+
| `list_views` | List available views and their members |
|
|
92
|
+
|
|
93
|
+
## Managing Connections
|
|
94
|
+
|
|
95
|
+
Active MCP connections can be viewed and revoked in the Bonnard dashboard at **Settings > Connections**.
|
|
96
|
+
|
|
97
|
+
## See Also
|
|
98
|
+
|
|
99
|
+
- workflow.deploy
|
|
100
|
+
- workflow.query
|
|
@@ -15,7 +15,7 @@ bon init
|
|
|
15
15
|
# 2. Add a data source
|
|
16
16
|
bon datasource add
|
|
17
17
|
|
|
18
|
-
# 3. Create models in models/ and views in views/
|
|
18
|
+
# 3. Create models in bonnard/models/ and views in bonnard/views/
|
|
19
19
|
|
|
20
20
|
# 4. Validate your models
|
|
21
21
|
bon validate
|
|
@@ -31,10 +31,11 @@ After `bon init`, your project has:
|
|
|
31
31
|
```
|
|
32
32
|
my-project/
|
|
33
33
|
├── bon.yaml # Project configuration
|
|
34
|
-
├──
|
|
35
|
-
│
|
|
36
|
-
|
|
37
|
-
│ └──
|
|
34
|
+
├── bonnard/ # Semantic layer definitions
|
|
35
|
+
│ ├── models/ # Cube definitions
|
|
36
|
+
│ │ └── orders.yaml
|
|
37
|
+
│ └── views/ # View definitions
|
|
38
|
+
│ └── orders_overview.yaml
|
|
38
39
|
└── .bon/ # Local config (gitignored)
|
|
39
40
|
└── datasources.yaml # Data source credentials
|
|
40
41
|
```
|
|
@@ -46,7 +47,7 @@ my-project/
|
|
|
46
47
|
Create cubes that map to your database tables:
|
|
47
48
|
|
|
48
49
|
```yaml
|
|
49
|
-
# models/orders.yaml
|
|
50
|
+
# bonnard/models/orders.yaml
|
|
50
51
|
cubes:
|
|
51
52
|
- name: orders
|
|
52
53
|
sql_table: public.orders
|
|
@@ -66,7 +67,7 @@ cubes:
|
|
|
66
67
|
Create views that expose cubes to consumers:
|
|
67
68
|
|
|
68
69
|
```yaml
|
|
69
|
-
# views/orders_overview.yaml
|
|
70
|
+
# bonnard/views/orders_overview.yaml
|
|
70
71
|
views:
|
|
71
72
|
- name: orders_overview
|
|
72
73
|
cubes:
|
|
@@ -98,7 +99,7 @@ bon deploy
|
|
|
98
99
|
### One Cube Per File
|
|
99
100
|
|
|
100
101
|
```
|
|
101
|
-
models/
|
|
102
|
+
bonnard/models/
|
|
102
103
|
├── orders.yaml
|
|
103
104
|
├── users.yaml
|
|
104
105
|
├── products.yaml
|
|
@@ -108,7 +109,7 @@ models/
|
|
|
108
109
|
### Related Cubes Together
|
|
109
110
|
|
|
110
111
|
```
|
|
111
|
-
models/
|
|
112
|
+
bonnard/models/
|
|
112
113
|
├── sales/
|
|
113
114
|
│ ├── orders.yaml
|
|
114
115
|
│ └── line_items.yaml
|
|
@@ -145,7 +146,3 @@ models/
|
|
|
145
146
|
- workflow.deploy
|
|
146
147
|
- cubes
|
|
147
148
|
- views
|
|
148
|
-
|
|
149
|
-
## More Information
|
|
150
|
-
|
|
151
|
-
https://docs.bonnard.dev/workflow
|
|
@@ -196,8 +196,3 @@ bon cube query '{
|
|
|
196
196
|
- [cubes.measures](cubes.measures) - Define measures
|
|
197
197
|
- [cubes.dimensions](cubes.dimensions) - Define dimensions
|
|
198
198
|
- [views](views) - Create focused query interfaces
|
|
199
|
-
|
|
200
|
-
## More Information
|
|
201
|
-
|
|
202
|
-
- [Cube REST API Query Format](https://cube.dev/docs/product/apis-integrations/rest-api/query-format)
|
|
203
|
-
- [Cube SQL API Query Format](https://cube.dev/docs/product/apis-integrations/sql-api/query-format)
|
|
@@ -48,9 +48,9 @@ bon validate --test-connection
|
|
|
48
48
|
|
|
49
49
|
```
|
|
50
50
|
✓ Validating YAML syntax...
|
|
51
|
-
✓ Checking models/orders.yaml
|
|
52
|
-
✓ Checking models/users.yaml
|
|
53
|
-
✓ Checking views/orders_overview.yaml
|
|
51
|
+
✓ Checking bonnard/models/orders.yaml
|
|
52
|
+
✓ Checking bonnard/models/users.yaml
|
|
53
|
+
✓ Checking bonnard/views/orders_overview.yaml
|
|
54
54
|
|
|
55
55
|
All models valid.
|
|
56
56
|
```
|
|
@@ -60,7 +60,7 @@ All models valid.
|
|
|
60
60
|
```
|
|
61
61
|
✗ Validating YAML syntax...
|
|
62
62
|
|
|
63
|
-
models/orders.yaml:15:5
|
|
63
|
+
bonnard/models/orders.yaml:15:5
|
|
64
64
|
error: Unknown measure type "counts"
|
|
65
65
|
|
|
66
66
|
Did you mean "count"?
|
|
@@ -150,7 +150,3 @@ measures:
|
|
|
150
150
|
- workflow
|
|
151
151
|
- workflow.deploy
|
|
152
152
|
- syntax
|
|
153
|
-
|
|
154
|
-
## More Information
|
|
155
|
-
|
|
156
|
-
https://docs.bonnard.dev/cli/validate
|
|
@@ -49,8 +49,8 @@ views:
|
|
|
49
49
|
|
|
50
50
|
## Workflow
|
|
51
51
|
|
|
52
|
-
1. Define models in `models/*.yaml`
|
|
53
|
-
2. Define views in `views/*.yaml`
|
|
52
|
+
1. Define models in `bonnard/models/*.yaml`
|
|
53
|
+
2. Define views in `bonnard/views/*.yaml`
|
|
54
54
|
3. Run `bon validate` to check syntax
|
|
55
55
|
4. Run `bon deploy` to publish
|
|
56
56
|
|
|
@@ -43,7 +43,7 @@ views:
|
|
|
43
43
|
|
|
44
44
|
## Workflow
|
|
45
45
|
|
|
46
|
-
1. Define models in `models/*.yaml`
|
|
47
|
-
2. Define views in `views/*.yaml`
|
|
46
|
+
1. Define models in `bonnard/models/*.yaml`
|
|
47
|
+
2. Define views in `bonnard/views/*.yaml`
|
|
48
48
|
3. Run `bon validate` to check syntax
|
|
49
49
|
4. Run `bon deploy` to publish
|
|
@@ -29,11 +29,12 @@ Data Warehouse (Snowflake, Postgres, BigQuery, Databricks)
|
|
|
29
29
|
```
|
|
30
30
|
my-project/
|
|
31
31
|
├── bon.yaml # Project config
|
|
32
|
-
├──
|
|
33
|
-
│ ├──
|
|
34
|
-
│
|
|
35
|
-
|
|
36
|
-
│ └──
|
|
32
|
+
├── bonnard/ # Semantic layer definitions
|
|
33
|
+
│ ├── models/ # Cube definitions
|
|
34
|
+
│ │ ├── orders.yaml
|
|
35
|
+
│ │ └── customers.yaml
|
|
36
|
+
│ └── views/ # View definitions
|
|
37
|
+
│ └── sales_overview.yaml
|
|
37
38
|
└── .bon/ # Local state (gitignored)
|
|
38
39
|
└── datasources.yaml # Warehouse connections
|
|
39
40
|
```
|
|
@@ -72,8 +73,8 @@ Topics follow dot notation (e.g., `cubes.dimensions.time`). Use `--recursive` to
|
|
|
72
73
|
## Workflow
|
|
73
74
|
|
|
74
75
|
1. **Setup datasource** — `bon datasource add --from-dbt` or manual
|
|
75
|
-
2. **Create cubes** — Define measures/dimensions in `models/*.yaml`
|
|
76
|
-
3. **Create views** — Compose cubes in `views/*.yaml`
|
|
76
|
+
2. **Create cubes** — Define measures/dimensions in `bonnard/models/*.yaml`
|
|
77
|
+
3. **Create views** — Compose cubes in `bonnard/views/*.yaml`
|
|
77
78
|
4. **Validate** — `bon validate --test-connection`
|
|
78
79
|
5. **Deploy** — `bon login` then `bon deploy`
|
|
79
80
|
|