@bonnard/cli 0.1.3 → 0.1.5
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 +1919 -100
- package/dist/bin/models-IsV2sX74.mjs +76 -0
- package/dist/bin/{validate-Bd1D39Bj.mjs → validate-C4EHvJzJ.mjs} +47 -4
- package/dist/docs/README.md +78 -0
- package/dist/docs/_index.md +70 -0
- package/dist/docs/topics/cubes.data-source.md +92 -0
- package/dist/docs/topics/cubes.dimensions.format.md +195 -0
- package/dist/docs/topics/cubes.dimensions.md +184 -0
- package/dist/docs/topics/cubes.dimensions.primary-key.md +106 -0
- package/dist/docs/topics/cubes.dimensions.sub-query.md +174 -0
- package/dist/docs/topics/cubes.dimensions.time.md +111 -0
- package/dist/docs/topics/cubes.dimensions.types.md +107 -0
- package/dist/docs/topics/cubes.extends.md +149 -0
- package/dist/docs/topics/cubes.hierarchies.md +174 -0
- package/dist/docs/topics/cubes.joins.md +115 -0
- package/dist/docs/topics/cubes.md +117 -0
- package/dist/docs/topics/cubes.measures.calculated.md +99 -0
- package/dist/docs/topics/cubes.measures.drill-members.md +158 -0
- package/dist/docs/topics/cubes.measures.filters.md +86 -0
- package/dist/docs/topics/cubes.measures.format.md +153 -0
- package/dist/docs/topics/cubes.measures.md +162 -0
- package/dist/docs/topics/cubes.measures.rolling.md +119 -0
- package/dist/docs/topics/cubes.measures.types.md +122 -0
- package/dist/docs/topics/cubes.public.md +172 -0
- package/dist/docs/topics/cubes.refresh-key.md +153 -0
- package/dist/docs/topics/cubes.segments.md +121 -0
- package/dist/docs/topics/cubes.sql.md +61 -0
- package/dist/docs/topics/pre-aggregations.md +126 -0
- package/dist/docs/topics/pre-aggregations.rollup.md +162 -0
- package/dist/docs/topics/syntax.context-variables.md +153 -0
- package/dist/docs/topics/syntax.md +133 -0
- package/dist/docs/topics/syntax.references.md +174 -0
- package/dist/docs/topics/views.cubes.md +162 -0
- package/dist/docs/topics/views.folders.md +154 -0
- package/dist/docs/topics/views.includes.md +139 -0
- package/dist/docs/topics/views.md +138 -0
- package/dist/docs/topics/workflow.deploy.md +128 -0
- package/dist/docs/topics/workflow.mcp.md +100 -0
- package/dist/docs/topics/workflow.md +147 -0
- package/dist/docs/topics/workflow.query.md +198 -0
- package/dist/docs/topics/workflow.validate.md +152 -0
- package/dist/templates/claude/rules/bonnard.md +15 -0
- package/dist/templates/claude/settings.json +7 -0
- package/dist/templates/claude/skills/bonnard-cli/SKILL.md +59 -0
- package/dist/templates/claude/skills/bonnard-queries/SKILL.md +68 -0
- package/dist/templates/cursor/rules/bonnard-cli.mdc +47 -0
- package/dist/templates/cursor/rules/bonnard-queries.mdc +49 -0
- package/dist/templates/cursor/rules/bonnard.mdc +20 -0
- package/dist/templates/shared/bonnard.md +81 -0
- package/package.json +13 -8
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# workflow.validate
|
|
2
|
+
|
|
3
|
+
> Check models for errors before deploying.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The `bon validate` command checks your YAML models for syntax errors, schema violations, and optionally tests data source connections. Run this before deploying to catch issues early.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Basic validation
|
|
13
|
+
bon validate
|
|
14
|
+
|
|
15
|
+
# Also test data source connections
|
|
16
|
+
bon validate --test-connection
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## What Gets Validated
|
|
20
|
+
|
|
21
|
+
### YAML Syntax
|
|
22
|
+
|
|
23
|
+
- Valid YAML format
|
|
24
|
+
- Proper indentation
|
|
25
|
+
- Correct quoting
|
|
26
|
+
|
|
27
|
+
### Schema Compliance
|
|
28
|
+
|
|
29
|
+
- Required fields present (name, type, sql)
|
|
30
|
+
- Valid field values (known measure types, relationship types)
|
|
31
|
+
- Consistent naming conventions
|
|
32
|
+
|
|
33
|
+
### Reference Integrity
|
|
34
|
+
|
|
35
|
+
- Referenced cubes exist
|
|
36
|
+
- Referenced members exist
|
|
37
|
+
- Join relationships are valid
|
|
38
|
+
|
|
39
|
+
### Connection Testing (--test-connection)
|
|
40
|
+
|
|
41
|
+
- Data source credentials work
|
|
42
|
+
- Database is accessible
|
|
43
|
+
- Tables/schemas exist
|
|
44
|
+
|
|
45
|
+
## Example Output
|
|
46
|
+
|
|
47
|
+
### Success
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
✓ Validating YAML syntax...
|
|
51
|
+
✓ Checking models/orders.yaml
|
|
52
|
+
✓ Checking models/users.yaml
|
|
53
|
+
✓ Checking views/orders_overview.yaml
|
|
54
|
+
|
|
55
|
+
All models valid.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Errors
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
✗ Validating YAML syntax...
|
|
62
|
+
|
|
63
|
+
models/orders.yaml:15:5
|
|
64
|
+
error: Unknown measure type "counts"
|
|
65
|
+
|
|
66
|
+
Did you mean "count"?
|
|
67
|
+
|
|
68
|
+
14: measures:
|
|
69
|
+
15: - name: order_count
|
|
70
|
+
16: type: counts <-- here
|
|
71
|
+
17: sql: id
|
|
72
|
+
|
|
73
|
+
1 error found.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Connection Warnings
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
✓ Validating YAML syntax...
|
|
80
|
+
✓ All models valid.
|
|
81
|
+
|
|
82
|
+
⚠ Testing connections...
|
|
83
|
+
⚠ datasource "analytics": Connection timed out
|
|
84
|
+
(This won't block deploy, but queries may fail)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Common Errors
|
|
88
|
+
|
|
89
|
+
### Missing Required Field
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
# Error: "sql" is required
|
|
93
|
+
measures:
|
|
94
|
+
- name: count
|
|
95
|
+
type: count
|
|
96
|
+
# Missing: sql: id
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Invalid Type
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
# Error: Unknown dimension type "text"
|
|
103
|
+
dimensions:
|
|
104
|
+
- name: status
|
|
105
|
+
type: text # Should be: string
|
|
106
|
+
sql: status
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Reference Not Found
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
# Error: Cube "user" not found (did you mean "users"?)
|
|
113
|
+
joins:
|
|
114
|
+
- name: user
|
|
115
|
+
relationship: many_to_one
|
|
116
|
+
sql: "{CUBE}.user_id = {user.id}"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### YAML Syntax
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
# Error: Bad indentation
|
|
123
|
+
measures:
|
|
124
|
+
- name: count # Should be indented
|
|
125
|
+
type: count
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Options
|
|
129
|
+
|
|
130
|
+
| Option | Description |
|
|
131
|
+
|--------|-------------|
|
|
132
|
+
| `--test-connection` | Also test datasource connections |
|
|
133
|
+
|
|
134
|
+
## Exit Codes
|
|
135
|
+
|
|
136
|
+
| Code | Meaning |
|
|
137
|
+
|------|---------|
|
|
138
|
+
| 0 | All validations passed |
|
|
139
|
+
| 1 | Validation errors found |
|
|
140
|
+
|
|
141
|
+
## Best Practices
|
|
142
|
+
|
|
143
|
+
1. **Run before every deploy** — `bon validate && bon deploy`
|
|
144
|
+
2. **Add to CI/CD** — validate on pull requests
|
|
145
|
+
3. **Fix errors first** — don't deploy with validation errors
|
|
146
|
+
4. **Test connections periodically** — catch credential issues early
|
|
147
|
+
|
|
148
|
+
## See Also
|
|
149
|
+
|
|
150
|
+
- workflow
|
|
151
|
+
- workflow.deploy
|
|
152
|
+
- syntax
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Bonnard Analytics
|
|
2
|
+
|
|
3
|
+
This project uses Bonnard for semantic layer analytics.
|
|
4
|
+
|
|
5
|
+
## Quick Reference
|
|
6
|
+
|
|
7
|
+
| Command | Purpose |
|
|
8
|
+
|---------|---------|
|
|
9
|
+
| `bon validate` | Validate models and views |
|
|
10
|
+
| `bon deploy` | Deploy to Cube |
|
|
11
|
+
| `bon query <ds> <sql>` | Run SQL query |
|
|
12
|
+
| `bon datasource list` | List data sources |
|
|
13
|
+
|
|
14
|
+
For detailed CLI help: `/bonnard-cli`
|
|
15
|
+
For query patterns: `/bonnard-queries`
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bonnard-cli
|
|
3
|
+
description: Bonnard CLI reference. Use when user needs help with bon commands, data sources, or deployments.
|
|
4
|
+
allowed-tools: Bash(bon *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Bonnard CLI
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
### Project Setup
|
|
12
|
+
```bash
|
|
13
|
+
bon init # Initialize new project
|
|
14
|
+
bon login # Authenticate with Bonnard
|
|
15
|
+
bon logout # Clear credentials
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Data Sources
|
|
19
|
+
```bash
|
|
20
|
+
bon datasource add # Add new data source (interactive)
|
|
21
|
+
bon datasource list # List all data sources
|
|
22
|
+
bon datasource test <name> # Test connection
|
|
23
|
+
bon datasource remove <name> # Remove data source
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Development
|
|
27
|
+
```bash
|
|
28
|
+
bon validate # Validate models and views
|
|
29
|
+
bon deploy # Deploy to Bonnard Cube
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Data Exploration (Local)
|
|
33
|
+
```bash
|
|
34
|
+
bon preview <datasource> "<sql>" # Preview data with raw SQL
|
|
35
|
+
bon preview <datasource> "<sql>" --format json # JSON output
|
|
36
|
+
bon preview <datasource> "<sql>" --limit 100 # Limit rows
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Semantic Layer Queries (Deployed)
|
|
40
|
+
```bash
|
|
41
|
+
# JSON format (default)
|
|
42
|
+
bon cube query '{"measures": ["orders.count"]}'
|
|
43
|
+
bon cube query '{"measures": ["orders.total_revenue"], "dimensions": ["orders.status"]}'
|
|
44
|
+
|
|
45
|
+
# SQL format
|
|
46
|
+
bon cube query --sql "SELECT status, MEASURE(count) FROM orders GROUP BY 1"
|
|
47
|
+
bon cube query --sql "SELECT city, SUM(amount) FROM orders GROUP BY 1" --limit 10
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Documentation
|
|
51
|
+
```bash
|
|
52
|
+
bon docs # Show all topics
|
|
53
|
+
bon docs <topic> # View topic (e.g., cubes.measures)
|
|
54
|
+
bon docs <topic> --recursive # Topic + all children
|
|
55
|
+
bon docs --search "<query>" # Search all docs
|
|
56
|
+
bon docs <topic> --format json # Structured output
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Key topics:** `cubes`, `cubes.measures`, `cubes.dimensions`, `cubes.joins`, `views`, `pre-aggregations`, `syntax`
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bonnard-queries
|
|
3
|
+
description: How to write Cube queries and work with models. Use when user asks about metrics, dimensions, or data modeling.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bonnard Query Patterns
|
|
7
|
+
|
|
8
|
+
## Model Structure (YAML)
|
|
9
|
+
|
|
10
|
+
```yaml
|
|
11
|
+
cubes:
|
|
12
|
+
- name: orders
|
|
13
|
+
sql: SELECT * FROM public.orders
|
|
14
|
+
|
|
15
|
+
measures:
|
|
16
|
+
- name: count
|
|
17
|
+
type: count
|
|
18
|
+
description: Total number of orders
|
|
19
|
+
|
|
20
|
+
- name: total_amount
|
|
21
|
+
type: sum
|
|
22
|
+
sql: amount
|
|
23
|
+
description: Sum of order amounts in dollars
|
|
24
|
+
|
|
25
|
+
dimensions:
|
|
26
|
+
- name: status
|
|
27
|
+
type: string
|
|
28
|
+
sql: status
|
|
29
|
+
description: Order status (pending, completed, cancelled)
|
|
30
|
+
|
|
31
|
+
- name: created_at
|
|
32
|
+
type: time
|
|
33
|
+
sql: created_at
|
|
34
|
+
description: When the order was placed
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## View Structure (YAML)
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
views:
|
|
41
|
+
- name: orders_overview
|
|
42
|
+
cubes:
|
|
43
|
+
- join_path: orders
|
|
44
|
+
includes:
|
|
45
|
+
- count
|
|
46
|
+
- total_amount
|
|
47
|
+
- status
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Workflow
|
|
51
|
+
|
|
52
|
+
1. Define models in `models/*.yaml`
|
|
53
|
+
2. Define views in `views/*.yaml`
|
|
54
|
+
3. Run `bon validate` to check syntax
|
|
55
|
+
4. Run `bon deploy` to publish
|
|
56
|
+
|
|
57
|
+
## Learn More
|
|
58
|
+
|
|
59
|
+
Use `bon docs` for comprehensive documentation:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
bon docs cubes.measures.types # All 12 measure types
|
|
63
|
+
bon docs cubes.dimensions.types # All 6 dimension types
|
|
64
|
+
bon docs cubes.joins # Relationship types
|
|
65
|
+
bon docs cubes.segments # Predefined filters
|
|
66
|
+
bon docs views.cubes # View composition
|
|
67
|
+
bon docs --search "rolling" # Search for concepts
|
|
68
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Bonnard CLI reference. Use when user needs help with bon commands, data sources, or deployments."
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bonnard CLI
|
|
7
|
+
|
|
8
|
+
## Commands
|
|
9
|
+
|
|
10
|
+
### Project Setup
|
|
11
|
+
```bash
|
|
12
|
+
bon init # Initialize new project
|
|
13
|
+
bon login # Authenticate with Bonnard
|
|
14
|
+
bon logout # Clear credentials
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Data Sources
|
|
18
|
+
```bash
|
|
19
|
+
bon datasource add # Add new data source (interactive)
|
|
20
|
+
bon datasource list # List all data sources
|
|
21
|
+
bon datasource test <name> # Test connection
|
|
22
|
+
bon datasource remove <name> # Remove data source
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Development
|
|
26
|
+
```bash
|
|
27
|
+
bon validate # Validate models and views
|
|
28
|
+
bon deploy # Deploy to Bonnard Cube
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Data Exploration (Local)
|
|
32
|
+
```bash
|
|
33
|
+
bon preview <datasource> "<sql>" # Preview data with raw SQL
|
|
34
|
+
bon preview <datasource> "<sql>" --format json # JSON output
|
|
35
|
+
bon preview <datasource> "<sql>" --limit 100 # Limit rows
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Semantic Layer Queries (Deployed)
|
|
39
|
+
```bash
|
|
40
|
+
# JSON format (default)
|
|
41
|
+
bon cube query '{"measures": ["orders.count"]}'
|
|
42
|
+
bon cube query '{"measures": ["orders.total_revenue"], "dimensions": ["orders.status"]}'
|
|
43
|
+
|
|
44
|
+
# SQL format
|
|
45
|
+
bon cube query --sql "SELECT status, MEASURE(count) FROM orders GROUP BY 1"
|
|
46
|
+
bon cube query --sql "SELECT city, SUM(amount) FROM orders GROUP BY 1" --limit 10
|
|
47
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "How to write Cube queries and work with models. Use when user asks about metrics, dimensions, or data modeling."
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bonnard Query Patterns
|
|
7
|
+
|
|
8
|
+
## Model Structure (YAML)
|
|
9
|
+
|
|
10
|
+
```yaml
|
|
11
|
+
cubes:
|
|
12
|
+
- name: orders
|
|
13
|
+
sql: SELECT * FROM public.orders
|
|
14
|
+
|
|
15
|
+
measures:
|
|
16
|
+
- name: count
|
|
17
|
+
type: count
|
|
18
|
+
- name: total_amount
|
|
19
|
+
type: sum
|
|
20
|
+
sql: amount
|
|
21
|
+
|
|
22
|
+
dimensions:
|
|
23
|
+
- name: status
|
|
24
|
+
type: string
|
|
25
|
+
sql: status
|
|
26
|
+
- name: created_at
|
|
27
|
+
type: time
|
|
28
|
+
sql: created_at
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## View Structure (YAML)
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
views:
|
|
35
|
+
- name: orders_overview
|
|
36
|
+
cubes:
|
|
37
|
+
- join_path: orders
|
|
38
|
+
includes:
|
|
39
|
+
- count
|
|
40
|
+
- total_amount
|
|
41
|
+
- status
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Workflow
|
|
45
|
+
|
|
46
|
+
1. Define models in `models/*.yaml`
|
|
47
|
+
2. Define views in `views/*.yaml`
|
|
48
|
+
3. Run `bon validate` to check syntax
|
|
49
|
+
4. Run `bon deploy` to publish
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Bonnard analytics project context"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bonnard Analytics
|
|
7
|
+
|
|
8
|
+
This project uses Bonnard for semantic layer analytics.
|
|
9
|
+
|
|
10
|
+
## Quick Reference
|
|
11
|
+
|
|
12
|
+
| Command | Purpose |
|
|
13
|
+
|---------|---------|
|
|
14
|
+
| `bon validate` | Validate models and views |
|
|
15
|
+
| `bon deploy` | Deploy to Cube |
|
|
16
|
+
| `bon query <ds> <sql>` | Run SQL query |
|
|
17
|
+
| `bon datasource list` | List data sources |
|
|
18
|
+
|
|
19
|
+
For detailed CLI help, ask about "bonnard cli commands".
|
|
20
|
+
For query patterns, ask about "bonnard queries".
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Bonnard Semantic Layer
|
|
2
|
+
|
|
3
|
+
Bonnard is a semantic layer platform that sits between your data warehouse and end users (analysts, dashboards, AI agents). It provides consistent metrics and dimensions via a type-safe API.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Data Warehouse (Snowflake, Postgres, BigQuery, Databricks)
|
|
9
|
+
↓
|
|
10
|
+
Cube Models (measures, dimensions, joins)
|
|
11
|
+
↓
|
|
12
|
+
Views (curated subsets for specific use cases)
|
|
13
|
+
↓
|
|
14
|
+
Bonnard API (deployed Cube instance)
|
|
15
|
+
↓
|
|
16
|
+
Consumers (MCP tools, dashboards, analysts)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Key Concepts
|
|
20
|
+
|
|
21
|
+
**Cubes** — Define metrics (measures) and attributes (dimensions) on top of database tables. Each cube typically maps to one table or a base SQL query.
|
|
22
|
+
|
|
23
|
+
**Views** — Compose cubes into focused interfaces for specific use cases. Views expose only the relevant measures/dimensions, hiding complexity.
|
|
24
|
+
|
|
25
|
+
**Datasources** — Warehouse connections stored locally in `.bon/datasources.yaml`. Referenced by cubes via the `data_source` property.
|
|
26
|
+
|
|
27
|
+
## Project Structure
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
my-project/
|
|
31
|
+
├── bon.yaml # Project config
|
|
32
|
+
├── models/ # Cube definitions
|
|
33
|
+
│ ├── orders.yaml
|
|
34
|
+
│ └── customers.yaml
|
|
35
|
+
├── views/ # View definitions
|
|
36
|
+
│ └── sales_overview.yaml
|
|
37
|
+
└── .bon/ # Local state (gitignored)
|
|
38
|
+
└── datasources.yaml # Warehouse connections
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick Reference
|
|
42
|
+
|
|
43
|
+
| Command | Purpose |
|
|
44
|
+
|---------|---------|
|
|
45
|
+
| `bon init` | Initialize new project |
|
|
46
|
+
| `bon datasource add` | Add warehouse connection |
|
|
47
|
+
| `bon datasource add --from-dbt` | Import from dbt profiles |
|
|
48
|
+
| `bon datasource test <name>` | Test connection |
|
|
49
|
+
| `bon validate` | Validate YAML syntax |
|
|
50
|
+
| `bon validate --test-connection` | Validate + test connections |
|
|
51
|
+
| `bon deploy` | Deploy to Bonnard (requires login) |
|
|
52
|
+
| `bon docs` | Browse Cube documentation |
|
|
53
|
+
|
|
54
|
+
## Learning Cube Syntax
|
|
55
|
+
|
|
56
|
+
Use `bon docs` to explore Cube data modeling concepts:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
bon docs # Show all topics
|
|
60
|
+
bon docs cubes # Learn about cubes
|
|
61
|
+
bon docs cubes.measures # Learn about measures
|
|
62
|
+
bon docs cubes.measures.types # See all 12 measure types
|
|
63
|
+
bon docs cubes.joins # Learn about relationships
|
|
64
|
+
bon docs views # Learn about views
|
|
65
|
+
bon docs --search "primary key" # Search for a concept
|
|
66
|
+
bon docs cubes.measures -r # Topic + all children
|
|
67
|
+
bon docs cubes --format json # Structured output
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Topics follow dot notation (e.g., `cubes.dimensions.time`). Use `--recursive` to see a topic and all its children.
|
|
71
|
+
|
|
72
|
+
## Workflow
|
|
73
|
+
|
|
74
|
+
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`
|
|
77
|
+
4. **Validate** — `bon validate --test-connection`
|
|
78
|
+
5. **Deploy** — `bon login` then `bon deploy`
|
|
79
|
+
|
|
80
|
+
For CLI details: `/bonnard-cli`
|
|
81
|
+
For YAML patterns: `/bonnard-queries`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonnard/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bon": "./dist/bin/bon.mjs"
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin && cp -r src/templates dist/ && cp -r src/docs dist/",
|
|
13
|
+
"dev": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin --watch",
|
|
14
|
+
"test": "vitest run"
|
|
15
|
+
},
|
|
11
16
|
"dependencies": {
|
|
12
17
|
"@inquirer/prompts": "^7.0.0",
|
|
13
18
|
"@toon-format/toon": "^2.1.0",
|
|
@@ -15,7 +20,12 @@
|
|
|
15
20
|
"open": "^11.0.0",
|
|
16
21
|
"@cubejs-backend/schema-compiler": "^1.6.7",
|
|
17
22
|
"@cubejs-backend/shared": "^1.6.7",
|
|
18
|
-
"picocolors": "^1.0.0"
|
|
23
|
+
"picocolors": "^1.0.0",
|
|
24
|
+
"yaml": "^2.8.0"
|
|
25
|
+
},
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"snowflake-sdk": "^2.3.3",
|
|
28
|
+
"pg": "^8.18.0"
|
|
19
29
|
},
|
|
20
30
|
"devDependencies": {
|
|
21
31
|
"tsdown": "^0.20.1",
|
|
@@ -23,10 +33,5 @@
|
|
|
23
33
|
},
|
|
24
34
|
"engines": {
|
|
25
35
|
"node": ">=20.0.0"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin",
|
|
29
|
-
"dev": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin --watch",
|
|
30
|
-
"test": "vitest run"
|
|
31
36
|
}
|
|
32
|
-
}
|
|
37
|
+
}
|