Loading...
Loading...
Author and change a Cube semantic model — add or edit cubes, views, measures, dimensions, joins and pre-aggregations in YAML — using the Cube CLI, on a dev-mode branch, then commit and build. Use whenever someone wants to add a metric, define a measure or dimension, create a cube or view, join two cubes, fix a model error, rename a field, or expose a field to business users. Triggers on "add a metric", "define revenue", "create a view for", "expose this field", "join orders to customers", "fix the model", "add a pre-aggregation". Read the model first with cube-explore-model. To run a query against the result use cube-run-query; to deploy or check build status use cube-deploy.
npx skill4agent add cube-js/cube-agent-skills cube-build-modelcommand -v cube >/dev/null || echo "Cube CLI not installed: curl -fsSL https://raw.githubusercontent.com/cube-js/cube/master/install-cli.sh | sh"
cube whoami || echo "Not authenticated. Interactive: cube login. Headless: set CUBE_API_URL + CUBE_API_KEY."
cube context list # confirm the tenant before writing anythingcube data-model list <deployment> --content --json > /tmp/model.json# 1. See what branches exist
cube data-model branches <deployment>
# 2. Enter dev mode on a base branch. This forks a personal `dev-…` branch
# and PRINTS ITS NAME. Capture it — writes must target it.
cube data-model dev-mode <deployment> main
# 3. Write files to that branch
cube data-model put <deployment> model/cubes/orders.yml --file ./orders.yml --branch <dev-branch>
cube data-model put <deployment> model/views/revenue.yml --content - --branch <dev-branch> # stdin
# 4. Commit
cube data-model commit <deployment> -m "Add revenue view" --branch <dev-branch>
# 5. Confirm it actually builds
cube deployments build-status <deployment> --branch <dev-branch>
# 6. Leave dev mode when done
cube data-model exit-dev-mode <deployment>--branchcube data-model rename <deployment> model/cubes/old.yml model/cubes/new.yml --branch <dev-branch>
cube data-model delete <deployment> model/cubes/dead.yml --branch <dev-branch>cube deployments build-status <deployment> --branch <dev-branch>cube meta --selectors '[{"type":"cube","deploymentId":<id>,"environment":"<dev-branch>"}]'cube-run-querycube deploy <deployment> # uploads the local directory to the deployment and buildssqldescription| Symptom | Cause |
|---|---|
| Write rejected | Not on a dev-mode branch — run |
| Rerun the preflight; do not retry the write |
| Build fails after commit | Real model error — read the build status output and fix the named file |
| Change builds but is not queryable | Not exposed in a view; check |