@bonnard/cli 0.1.13 → 0.2.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.
- package/dist/bin/bon.mjs +305 -620
- package/dist/bin/validate-DEh1XQnH.mjs +365 -0
- package/dist/docs/_index.md +1 -1
- package/dist/docs/topics/cubes.data-source.md +2 -2
- package/dist/docs/topics/cubes.dimensions.format.md +2 -2
- package/dist/docs/topics/cubes.dimensions.md +2 -2
- package/dist/docs/topics/cubes.dimensions.primary-key.md +2 -2
- package/dist/docs/topics/cubes.dimensions.sub-query.md +2 -2
- package/dist/docs/topics/cubes.dimensions.time.md +2 -2
- package/dist/docs/topics/cubes.dimensions.types.md +2 -2
- package/dist/docs/topics/cubes.extends.md +2 -2
- package/dist/docs/topics/cubes.hierarchies.md +2 -2
- package/dist/docs/topics/cubes.joins.md +2 -2
- package/dist/docs/topics/cubes.md +2 -2
- package/dist/docs/topics/cubes.measures.calculated.md +2 -2
- package/dist/docs/topics/cubes.measures.drill-members.md +2 -2
- package/dist/docs/topics/cubes.measures.filters.md +2 -2
- package/dist/docs/topics/cubes.measures.format.md +21 -2
- package/dist/docs/topics/cubes.measures.md +2 -2
- package/dist/docs/topics/cubes.measures.rolling.md +2 -2
- package/dist/docs/topics/cubes.measures.types.md +2 -2
- package/dist/docs/topics/cubes.public.md +2 -2
- package/dist/docs/topics/cubes.refresh-key.md +2 -2
- package/dist/docs/topics/cubes.segments.md +2 -2
- package/dist/docs/topics/cubes.sql.md +2 -2
- package/dist/docs/topics/features.catalog.md +31 -0
- package/dist/docs/topics/features.cli.md +59 -0
- package/dist/docs/topics/features.context-graph.md +18 -0
- package/dist/docs/topics/features.governance.md +84 -0
- package/dist/docs/topics/features.mcp.md +48 -0
- package/dist/docs/topics/features.md +15 -0
- package/dist/docs/topics/features.sdk.md +53 -0
- package/dist/docs/topics/features.semantic-layer.md +50 -0
- package/dist/docs/topics/features.slack-teams.md +18 -0
- package/dist/docs/topics/getting-started.md +2 -143
- package/dist/docs/topics/pre-aggregations.md +2 -2
- package/dist/docs/topics/pre-aggregations.rollup.md +2 -2
- package/dist/docs/topics/syntax.context-variables.md +2 -2
- package/dist/docs/topics/syntax.md +2 -2
- package/dist/docs/topics/syntax.references.md +2 -2
- package/dist/docs/topics/views.cubes.md +2 -2
- package/dist/docs/topics/views.folders.md +2 -2
- package/dist/docs/topics/views.includes.md +2 -2
- package/dist/docs/topics/views.md +2 -2
- package/dist/docs/topics/workflow.deploy.md +79 -14
- package/dist/docs/topics/workflow.mcp.md +19 -13
- package/dist/docs/topics/workflow.md +25 -8
- package/dist/docs/topics/workflow.query.md +2 -2
- package/dist/docs/topics/workflow.validate.md +4 -31
- package/dist/templates/claude/skills/bonnard-get-started/SKILL.md +16 -26
- package/dist/templates/cursor/rules/bonnard-get-started.mdc +16 -26
- package/dist/templates/shared/bonnard.md +31 -6
- package/package.json +4 -8
- package/dist/bin/validate-DiN3DaTl.mjs +0 -110
- /package/dist/bin/{cubes-De1_2_YJ.mjs → cubes-Bf0IPYd7.mjs} +0 -0
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { t as getProjectPaths } from "./bon.mjs";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import YAML from "yaml";
|
|
5
|
-
import { compile } from "@cubejs-backend/schema-compiler";
|
|
6
|
-
|
|
7
|
-
//#region src/lib/validate.ts
|
|
8
|
-
function collectYamlFiles(dir, rootDir) {
|
|
9
|
-
if (!fs.existsSync(dir)) return [];
|
|
10
|
-
const results = [];
|
|
11
|
-
function walk(current) {
|
|
12
|
-
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
13
|
-
const fullPath = path.join(current, entry.name);
|
|
14
|
-
if (entry.isDirectory()) walk(fullPath);
|
|
15
|
-
else if (entry.name.endsWith(".yaml") || entry.name.endsWith(".yml")) results.push({
|
|
16
|
-
fileName: path.relative(rootDir, fullPath),
|
|
17
|
-
content: fs.readFileSync(fullPath, "utf-8")
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
walk(dir);
|
|
22
|
-
return results;
|
|
23
|
-
}
|
|
24
|
-
function checkMissingDescriptions(files) {
|
|
25
|
-
const missing = [];
|
|
26
|
-
for (const file of files) try {
|
|
27
|
-
const parsed = YAML.parse(file.content);
|
|
28
|
-
if (!parsed) continue;
|
|
29
|
-
const cubes = parsed.cubes || [];
|
|
30
|
-
for (const cube of cubes) {
|
|
31
|
-
if (!cube.name) continue;
|
|
32
|
-
if (!cube.description) missing.push({
|
|
33
|
-
parent: cube.name,
|
|
34
|
-
type: "cube",
|
|
35
|
-
name: cube.name
|
|
36
|
-
});
|
|
37
|
-
const measures = cube.measures || [];
|
|
38
|
-
for (const measure of measures) if (measure.name && !measure.description) missing.push({
|
|
39
|
-
parent: cube.name,
|
|
40
|
-
type: "measure",
|
|
41
|
-
name: measure.name
|
|
42
|
-
});
|
|
43
|
-
const dimensions = cube.dimensions || [];
|
|
44
|
-
for (const dimension of dimensions) if (dimension.name && !dimension.description) missing.push({
|
|
45
|
-
parent: cube.name,
|
|
46
|
-
type: "dimension",
|
|
47
|
-
name: dimension.name
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
const views = parsed.views || [];
|
|
51
|
-
for (const view of views) {
|
|
52
|
-
if (!view.name) continue;
|
|
53
|
-
if (!view.description) missing.push({
|
|
54
|
-
parent: view.name,
|
|
55
|
-
type: "view",
|
|
56
|
-
name: view.name
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
} catch {}
|
|
60
|
-
return missing;
|
|
61
|
-
}
|
|
62
|
-
function createModelRepository(projectPath) {
|
|
63
|
-
const paths = getProjectPaths(projectPath);
|
|
64
|
-
const cubesDir = paths.cubes;
|
|
65
|
-
const viewsDir = paths.views;
|
|
66
|
-
return {
|
|
67
|
-
localPath: () => projectPath,
|
|
68
|
-
dataSchemaFiles: () => {
|
|
69
|
-
const files = [...collectYamlFiles(cubesDir, projectPath), ...collectYamlFiles(viewsDir, projectPath)];
|
|
70
|
-
return Promise.resolve(files);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
async function validate(projectPath) {
|
|
75
|
-
const repo = createModelRepository(projectPath);
|
|
76
|
-
const files = await repo.dataSchemaFiles();
|
|
77
|
-
if (files.length === 0) return {
|
|
78
|
-
valid: true,
|
|
79
|
-
errors: [],
|
|
80
|
-
cubes: [],
|
|
81
|
-
views: [],
|
|
82
|
-
missingDescriptions: []
|
|
83
|
-
};
|
|
84
|
-
try {
|
|
85
|
-
const { cubeEvaluator } = await compile(repo, {});
|
|
86
|
-
const cubes = [];
|
|
87
|
-
const views = [];
|
|
88
|
-
for (const cube of cubeEvaluator.cubeNames()) if (cubeEvaluator.cubeFromPath(cube).isView) views.push(cube);
|
|
89
|
-
else cubes.push(cube);
|
|
90
|
-
return {
|
|
91
|
-
valid: true,
|
|
92
|
-
errors: [],
|
|
93
|
-
cubes,
|
|
94
|
-
views,
|
|
95
|
-
missingDescriptions: checkMissingDescriptions(files)
|
|
96
|
-
};
|
|
97
|
-
} catch (err) {
|
|
98
|
-
const raw = err.messages ?? err.message ?? String(err);
|
|
99
|
-
return {
|
|
100
|
-
valid: false,
|
|
101
|
-
errors: Array.isArray(raw) ? raw : [raw],
|
|
102
|
-
cubes: [],
|
|
103
|
-
views: [],
|
|
104
|
-
missingDescriptions: []
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
//#endregion
|
|
110
|
-
export { validate };
|
|
File without changes
|