@lightdash-tools/mcp 0.7.0 → 0.9.0
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/README.md +113 -170
- package/dist/audit/server-persona.d.ts +10 -0
- package/dist/audit/server-persona.js +19 -0
- package/dist/auth/oauth-broker/pending-store.d.ts +69 -19
- package/dist/auth/oauth-broker/pending-store.js +52 -26
- package/dist/auth/oauth-broker/pending-store.test.d.ts +5 -0
- package/dist/auth/oauth-broker/pending-store.test.js +109 -0
- package/dist/auth/oauth-broker/routes.d.ts +6 -2
- package/dist/auth/oauth-broker/routes.js +25 -20
- package/dist/auth/oauth-broker/routes.test.js +33 -28
- package/dist/auth/request-state-key.d.ts +19 -0
- package/dist/auth/request-state-key.js +49 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +0 -2
- package/dist/auth/resource-server/lightdash-oauth-middleware.js +0 -19
- package/dist/auth/resource-server/www-authenticate.test.js +12 -8
- package/dist/bin.js +30 -2
- package/dist/config/env.d.ts +5 -8
- package/dist/config/env.js +6 -9
- package/dist/config/load-mcp-config.d.ts +0 -4
- package/dist/config/load-mcp-config.js +8 -5
- package/dist/config/load-mcp-config.test.js +7 -0
- package/dist/config/normalize-url.test.js +16 -7
- package/dist/config/runtime.d.ts +3 -3
- package/dist/config/runtime.js +19 -23
- package/dist/config/runtime.test.js +23 -9
- package/dist/config/test-mcp-http-config.js +1 -1
- package/dist/destructive/capability.d.ts +13 -0
- package/dist/destructive/capability.js +37 -0
- package/dist/destructive/capability.test.js +46 -0
- package/dist/destructive/confirmation.d.ts +58 -0
- package/dist/destructive/confirmation.js +99 -0
- package/dist/destructive/confirmation.test.d.ts +1 -0
- package/dist/destructive/confirmation.test.js +75 -0
- package/dist/destructive/content-promote.d.ts +8 -0
- package/dist/destructive/content-promote.js +150 -0
- package/dist/destructive/content-soft-delete.d.ts +7 -0
- package/dist/destructive/content-soft-delete.js +106 -0
- package/dist/destructive/destructive-contract.test.d.ts +1 -0
- package/dist/destructive/destructive-contract.test.js +269 -0
- package/dist/destructive/precondition.d.ts +14 -0
- package/dist/destructive/precondition.js +31 -0
- package/dist/destructive/precondition.test.d.ts +1 -0
- package/dist/destructive/precondition.test.js +72 -0
- package/dist/destructive/promote-contract.test.d.ts +1 -0
- package/dist/destructive/promote-contract.test.js +398 -0
- package/dist/destructive/register-destructive-tool.d.ts +54 -0
- package/dist/destructive/register-destructive-tool.js +283 -0
- package/dist/destructive/request-state.d.ts +12 -0
- package/dist/destructive/request-state.js +41 -0
- package/dist/destructive/types.d.ts +65 -0
- package/dist/destructive/types.js +10 -0
- package/dist/governance/available-projects.d.ts +37 -0
- package/dist/governance/available-projects.js +132 -0
- package/dist/governance/available-projects.test.d.ts +4 -0
- package/dist/governance/available-projects.test.js +107 -0
- package/dist/governance/client-capabilities-cache.d.ts +44 -0
- package/dist/governance/client-capabilities-cache.js +142 -0
- package/dist/governance/client-capabilities-cache.test.d.ts +1 -0
- package/dist/governance/client-capabilities-cache.test.js +148 -0
- package/dist/governance/mcp-client-session.d.ts +10 -0
- package/dist/governance/mcp-client-session.js +31 -0
- package/dist/governance/mcp-client-session.test.d.ts +1 -0
- package/dist/governance/mcp-client-session.test.js +31 -0
- package/dist/governance/project-scope.d.ts +24 -0
- package/dist/governance/project-scope.js +71 -0
- package/dist/governance/project-scope.test.d.ts +4 -0
- package/dist/governance/project-scope.test.js +80 -0
- package/dist/governance/promote-allowlist.d.ts +18 -0
- package/dist/governance/promote-allowlist.js +66 -0
- package/dist/governance/promote-allowlist.test.d.ts +4 -0
- package/dist/governance/promote-allowlist.test.js +87 -0
- package/dist/http.integration.test.js +151 -262
- package/dist/http.test.js +0 -12
- package/dist/index.integration.test.js +0 -4
- package/dist/index.js +3 -1
- package/dist/personas/ai-agent-ops/v1/index.d.ts +8 -0
- package/dist/personas/ai-agent-ops/v1/index.js +41 -0
- package/dist/personas/ai-agent-ops/v1/prompts.d.ts +5 -0
- package/dist/personas/ai-agent-ops/v1/prompts.js +141 -0
- package/dist/personas/ai-agent-ops/v1/prompts.test.d.ts +4 -0
- package/dist/personas/ai-agent-ops/v1/prompts.test.js +26 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks.js +41 -0
- package/dist/personas/content-developer/v1/index.d.ts +10 -0
- package/dist/personas/content-developer/v1/index.js +52 -0
- package/dist/personas/content-developer/v1/prompts.d.ts +8 -0
- package/dist/personas/content-developer/v1/prompts.js +157 -0
- package/dist/personas/content-developer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-developer/v1/prompts.test.js +231 -0
- package/dist/personas/content-developer/v1/resources/playbooks/chart-types.md +123 -0
- package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +22 -0
- package/dist/personas/content-developer/v1/resources/playbooks/core.md +105 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +103 -0
- package/dist/personas/content-developer/v1/resources/playbooks/index.md +15 -0
- package/dist/personas/content-developer/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-developer/v1/resources/playbooks.js +63 -0
- package/dist/personas/content-governance/v1/index.d.ts +9 -0
- package/dist/personas/content-governance/v1/index.js +29 -0
- package/dist/personas/content-governance/v1/prompts.d.ts +5 -0
- package/dist/personas/content-governance/v1/prompts.js +87 -0
- package/dist/personas/content-governance/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-governance/v1/prompts.test.js +75 -0
- package/dist/personas/content-governance/v1/resources/playbooks/charts.md +29 -0
- package/dist/personas/content-governance/v1/resources/playbooks/core.md +52 -0
- package/dist/personas/content-governance/v1/resources/playbooks/dashboards.md +48 -0
- package/dist/personas/content-governance/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/content-governance/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-governance/v1/resources/playbooks.js +41 -0
- package/dist/personas/content-reader/v1/index.d.ts +8 -0
- package/dist/personas/content-reader/v1/index.js +38 -0
- package/dist/personas/content-reader/v1/prompts.d.ts +5 -0
- package/dist/personas/content-reader/v1/prompts.js +162 -0
- package/dist/personas/content-reader/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-reader/v1/prompts.test.js +25 -0
- package/dist/personas/content-reader/v1/resources/playbooks/compare.md +36 -0
- package/dist/personas/content-reader/v1/resources/playbooks/core.md +67 -0
- package/dist/personas/content-reader/v1/resources/playbooks/discover.md +35 -0
- package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +49 -0
- package/dist/personas/content-reader/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/content-reader/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-reader/v1/resources/playbooks.js +49 -0
- package/dist/personas/index.d.ts +4 -0
- package/dist/personas/index.js +31 -10
- package/dist/personas/index.test.js +92 -26
- package/dist/personas/lib/playbook-resources.d.ts +80 -0
- package/dist/personas/lib/playbook-resources.js +169 -0
- package/dist/personas/organization-audit/v1/index.js +2 -2
- package/dist/personas/organization-audit/v1/prompts.js +79 -66
- package/dist/personas/organization-audit/v1/prompts.test.js +4 -4
- package/dist/personas/organization-audit/v1/resources/playbooks/access.md +21 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/content.md +19 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/core.md +69 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +14 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.js +41 -0
- package/dist/personas/persona.parity.test.d.ts +1 -0
- package/dist/personas/persona.parity.test.js +30 -0
- package/dist/personas/semantic-layer/v1/index.js +2 -2
- package/dist/personas/semantic-layer/v1/prompts.js +56 -67
- package/dist/personas/semantic-layer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/semantic-layer/v1/prompts.test.js +19 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +60 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +71 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +79 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.d.ts +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.js +39 -0
- package/dist/personas/types.d.ts +1 -1
- package/dist/policy/content-developer.d.ts +35 -0
- package/dist/policy/content-developer.js +91 -0
- package/dist/policy/content-developer.test.d.ts +4 -0
- package/dist/policy/content-developer.test.js +54 -0
- package/dist/policy/content-reader.d.ts +28 -0
- package/dist/policy/content-reader.js +67 -0
- package/dist/policy/content-reader.test.d.ts +4 -0
- package/dist/policy/content-reader.test.js +23 -0
- package/dist/policy/envelope.d.ts +31 -0
- package/dist/policy/envelope.js +24 -0
- package/dist/policy/preview-ledger-fault.test.d.ts +1 -0
- package/dist/policy/preview-ledger-fault.test.js +202 -0
- package/dist/policy/preview-ledger.d.ts +82 -0
- package/dist/policy/preview-ledger.js +165 -0
- package/dist/policy/preview-ledger.test.d.ts +1 -0
- package/dist/policy/preview-ledger.test.js +393 -0
- package/dist/policy/result-limits.d.ts +32 -0
- package/dist/policy/result-limits.js +106 -0
- package/dist/policy/result-limits.test.d.ts +4 -0
- package/dist/policy/result-limits.test.js +37 -0
- package/dist/server/capabilities.js +3 -1
- package/dist/server/capabilities.test.js +5 -1
- package/dist/server/server.js +16 -1
- package/dist/server/upstream-errors.d.ts +17 -0
- package/dist/server/upstream-errors.js +60 -0
- package/dist/server/upstream-errors.test.d.ts +1 -0
- package/dist/server/upstream-errors.test.js +50 -0
- package/dist/stdio.process.test.js +150 -0
- package/dist/tools/ai-agents/agents.d.ts +7 -0
- package/dist/tools/ai-agents/agents.js +32 -0
- package/dist/tools/ai-agents/agents.test.d.ts +1 -0
- package/dist/tools/ai-agents/agents.test.js +176 -0
- package/dist/tools/ai-agents/discovery.d.ts +9 -0
- package/dist/tools/ai-agents/discovery.js +73 -0
- package/dist/tools/ai-agents/evaluations.d.ts +14 -0
- package/dist/tools/ai-agents/evaluations.js +177 -0
- package/dist/tools/ai-agents/helpers.d.ts +64 -0
- package/dist/tools/ai-agents/helpers.js +323 -0
- package/dist/tools/ai-agents/threads.d.ts +7 -0
- package/dist/tools/ai-agents/threads.js +40 -0
- package/dist/tools/composition/explain-content.d.ts +6 -0
- package/dist/tools/composition/explain-content.js +108 -0
- package/dist/tools/lib/api-errors.d.ts +2 -0
- package/dist/tools/lib/api-errors.js +5 -0
- package/dist/tools/lib/stable-stringify.d.ts +9 -0
- package/dist/tools/lib/stable-stringify.js +35 -0
- package/dist/tools/organization/inventory.js +2 -1
- package/dist/tools/project/content.js +5 -1
- package/dist/tools/project/delete-chart.d.ts +4 -0
- package/dist/tools/project/delete-chart.js +8 -0
- package/dist/tools/project/delete-dashboard.d.ts +4 -0
- package/dist/tools/project/delete-dashboard.js +8 -0
- package/dist/tools/project/developer-content-preview.d.ts +13 -0
- package/dist/tools/project/developer-content-preview.js +291 -0
- package/dist/tools/project/developer-content-shared.d.ts +24 -0
- package/dist/tools/project/developer-content-shared.js +50 -0
- package/dist/tools/project/developer-content-shared.test.d.ts +1 -0
- package/dist/tools/project/developer-content-shared.test.js +25 -0
- package/dist/tools/project/developer-content.d.ts +38 -0
- package/dist/tools/project/developer-content.js +589 -0
- package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
- package/dist/tools/project/developer-get-chart-as-code.js +39 -0
- package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
- package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
- package/dist/tools/project/developer-helpers.d.ts +180 -0
- package/dist/tools/project/developer-helpers.js +484 -0
- package/dist/tools/project/developer-helpers.test.d.ts +1 -0
- package/dist/tools/project/developer-helpers.test.js +509 -0
- package/dist/tools/project/get-dashboard-promote-diff.d.ts +6 -0
- package/dist/tools/project/get-dashboard-promote-diff.js +52 -0
- package/dist/tools/project/invariants.test.d.ts +4 -0
- package/dist/tools/project/invariants.test.js +44 -0
- package/dist/tools/project/parameters.d.ts +7 -0
- package/dist/tools/project/parameters.js +74 -0
- package/dist/tools/project/projects.d.ts +4 -1
- package/dist/tools/project/projects.js +68 -6
- package/dist/tools/project/projects.test.js +77 -1
- package/dist/tools/project/promote-dashboard.d.ts +4 -0
- package/dist/tools/project/promote-dashboard.js +8 -0
- package/dist/tools/project/reader-content.d.ts +9 -0
- package/dist/tools/project/reader-content.js +208 -0
- package/dist/tools/project/reader-execution.d.ts +7 -0
- package/dist/tools/project/reader-execution.js +214 -0
- package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
- package/dist/tools/project/reader-export-chart-image.js +78 -0
- package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
- package/dist/tools/project/reader-export-chart-image.test.js +149 -0
- package/dist/tools/project/schemas/chart-upsert.d.ts +33 -0
- package/dist/tools/project/schemas/chart-upsert.js +66 -0
- package/dist/tools/project/schemas/dashboard-tile.d.ts +29 -0
- package/dist/tools/project/schemas/dashboard-tile.js +57 -0
- package/dist/tools/project/schemas/dashboard.d.ts +70 -0
- package/dist/tools/project/schemas/dashboard.js +101 -0
- package/dist/tools/project/schemas/duplicate.d.ts +30 -0
- package/dist/tools/project/schemas/duplicate.js +86 -0
- package/dist/tools/project/schemas/index.d.ts +7 -0
- package/dist/tools/project/schemas/index.js +26 -0
- package/dist/tools/project/schemas/parse-helpers.d.ts +14 -0
- package/dist/tools/project/schemas/parse-helpers.js +34 -0
- package/dist/tools/project/schemas/payload-schemas.test.d.ts +1 -0
- package/dist/tools/project/schemas/payload-schemas.test.js +204 -0
- package/dist/tools/project/spaces.d.ts +7 -0
- package/dist/tools/project/spaces.js +101 -0
- package/dist/tools/query/bounded-saved-query.d.ts +37 -0
- package/dist/tools/query/bounded-saved-query.js +80 -0
- package/dist/tools/query/bounded-saved-query.test.d.ts +4 -0
- package/dist/tools/query/bounded-saved-query.test.js +82 -0
- package/dist/tools/query/chart-source.d.ts +10 -0
- package/dist/tools/query/chart-source.js +36 -0
- package/dist/tools/query/chart-source.test.d.ts +1 -0
- package/dist/tools/query/chart-source.test.js +62 -0
- package/dist/tools/query/filter-overrides.d.ts +34 -0
- package/dist/tools/query/filter-overrides.js +75 -0
- package/dist/tools/query/filter-overrides.test.d.ts +1 -0
- package/dist/tools/query/filter-overrides.test.js +21 -0
- package/dist/tools/query/lifecycle.d.ts +7 -0
- package/dist/tools/query/lifecycle.js +104 -0
- package/dist/tools/query/query-ledger.d.ts +41 -0
- package/dist/tools/query/query-ledger.js +92 -0
- package/dist/tools/query/query-ledger.test.d.ts +1 -0
- package/dist/tools/query/query-ledger.test.js +75 -0
- package/dist/tools/query/reader-tool-helpers.d.ts +12 -0
- package/dist/tools/query/reader-tool-helpers.js +57 -0
- package/dist/tools/query/reader-tool-helpers.test.d.ts +1 -0
- package/dist/tools/query/reader-tool-helpers.test.js +53 -0
- package/dist/tools/query/result-normalizer.d.ts +27 -0
- package/dist/tools/query/result-normalizer.js +133 -0
- package/dist/tools/query/result-normalizer.test.d.ts +1 -0
- package/dist/tools/query/result-normalizer.test.js +41 -0
- package/dist/tools/query/wait-for-async.d.ts +10 -0
- package/dist/tools/query/wait-for-async.js +46 -0
- package/dist/tools/query/wait-for-async.test.d.ts +1 -0
- package/dist/tools/query/wait-for-async.test.js +45 -0
- package/dist/tools/registry.d.ts +187 -3
- package/dist/tools/registry.js +89 -7
- package/dist/tools/shared.d.ts +52 -10
- package/dist/tools/shared.js +127 -41
- package/dist/tools/shared.test.js +103 -3
- package/dist/transports/streamable-http.js +47 -198
- package/dist/transports/streamable-http.test.js +21 -9
- package/package.json +5 -5
- package/dist/personas/organization-audit/v1/resources/playbook.d.ts +0 -11
- package/dist/personas/organization-audit/v1/resources/playbook.js +0 -40
- package/dist/personas/organization-audit/v1/resources/playbook.md +0 -52
- package/dist/personas/semantic-layer/v1/resources/playbook.d.ts +0 -12
- package/dist/personas/semantic-layer/v1/resources/playbook.js +0 -42
- package/dist/personas/semantic-layer/v1/resources/playbook.md +0 -153
- package/dist/transports/http-request-utils.d.ts +0 -2
- package/dist/transports/http-request-utils.js +0 -13
- package/dist/transports/session-store.d.ts +0 -40
- package/dist/transports/session-store.js +0 -88
- package/dist/transports/session-store.test.js +0 -111
- /package/dist/{transports/session-store.test.d.ts → destructive/capability.test.d.ts} +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-developer prompt/playbook invariants.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const vitest_1 = require("vitest");
|
|
40
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
41
|
+
const index_js_1 = require("./index.js");
|
|
42
|
+
(0, vitest_1.describe)('content-developer prompts/playbook', () => {
|
|
43
|
+
(0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
|
|
44
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
45
|
+
for (const id of index_js_1.CONTENT_DEVELOPER_TOOL_IDS) {
|
|
46
|
+
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
47
|
+
}
|
|
48
|
+
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
49
|
+
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
50
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('terraform');
|
|
51
|
+
});
|
|
52
|
+
(0, vitest_1.it)('forbids space create/update and orphan chart publish', () => {
|
|
53
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
54
|
+
(0, vitest_1.expect)(md).toContain('terraform');
|
|
55
|
+
(0, vitest_1.expect)(md).toContain('dashboardslug');
|
|
56
|
+
(0, vitest_1.expect)(md).toContain('get_chart_as_code');
|
|
57
|
+
(0, vitest_1.expect)(md).toMatch(/dashboard shell first|create the dashboard shell first/);
|
|
58
|
+
(0, vitest_1.expect)(md).toContain('encode');
|
|
59
|
+
(0, vitest_1.expect)(md).toMatch(/xref/);
|
|
60
|
+
(0, vitest_1.expect)(md).toContain('chart-types');
|
|
61
|
+
(0, vitest_1.expect)(md).not.toMatch(/`create_space`/);
|
|
62
|
+
(0, vitest_1.expect)(md).not.toMatch(/`update_space`/);
|
|
63
|
+
(0, vitest_1.expect)(index_js_1.CONTENT_DEVELOPER_TOOL_IDS).not.toContain('create_space');
|
|
64
|
+
(0, vitest_1.expect)(index_js_1.CONTENT_DEVELOPER_TOOL_IDS).not.toContain('update_space');
|
|
65
|
+
(0, vitest_1.expect)(index_js_1.CONTENT_DEVELOPER_TOOL_IDS).toContain('get_chart_as_code');
|
|
66
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('dashboardslug');
|
|
67
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('skinny');
|
|
68
|
+
});
|
|
69
|
+
(0, vitest_1.it)('documents create-chart top-level slug, nested dashboard apply, and chart-type map', () => {
|
|
70
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
71
|
+
(0, vitest_1.expect)(md).toContain('top-level');
|
|
72
|
+
(0, vitest_1.expect)(md).toMatch(/dashboard:\s*\{/);
|
|
73
|
+
(0, vitest_1.expect)(md).toMatch(/does \*\*not\*\* add tiles|does not place the chart|ownership alone does not/);
|
|
74
|
+
(0, vitest_1.expect)(md).toContain('pie');
|
|
75
|
+
(0, vitest_1.expect)(md).toContain('sankey');
|
|
76
|
+
(0, vitest_1.expect)(md).toContain('gauge');
|
|
77
|
+
(0, vitest_1.expect)(md).toContain('map');
|
|
78
|
+
(0, vitest_1.expect)(md).toContain('charts[0].data.uuid');
|
|
79
|
+
(0, vitest_1.expect)(md).toMatch(/≤2 concurrent|<=2 concurrent/);
|
|
80
|
+
});
|
|
81
|
+
(0, vitest_1.it)('documents dashboard-design topic with markdown and filters', () => {
|
|
82
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
83
|
+
(0, vitest_1.expect)(md).toContain('dashboard-design');
|
|
84
|
+
(0, vitest_1.expect)(md).toContain('markdown');
|
|
85
|
+
(0, vitest_1.expect)(md).toContain('empty-value');
|
|
86
|
+
(0, vitest_1.expect)(md).toContain('filters');
|
|
87
|
+
(0, vitest_1.expect)(md).toMatch(/required:\s*true|required:true/);
|
|
88
|
+
(0, vitest_1.expect)(md).toContain('phase design');
|
|
89
|
+
(0, vitest_1.expect)(md).toContain('before any write');
|
|
90
|
+
(0, vitest_1.expect)(md).toContain('design spec');
|
|
91
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('design spec');
|
|
92
|
+
});
|
|
93
|
+
(0, vitest_1.it)('requires objective-first Design Spec and clarify-before-spec language', () => {
|
|
94
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
95
|
+
(0, vitest_1.expect)(md).toContain('objective');
|
|
96
|
+
(0, vitest_1.expect)(md).toMatch(/insight question/);
|
|
97
|
+
(0, vitest_1.expect)(md).toMatch(/clarif/);
|
|
98
|
+
(0, vitest_1.expect)(md).toMatch(/cites an insight|cite an insight|citing insights/);
|
|
99
|
+
(0, vitest_1.expect)(md).toMatch(/only when the user \*\*explicitly\*\* asks|only when the user explicitly/);
|
|
100
|
+
(0, vitest_1.expect)(md).toMatch(/reference map|not a build order/);
|
|
101
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('objective');
|
|
102
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toMatch(/viz-type|all-chart-types|all chart types/);
|
|
103
|
+
});
|
|
104
|
+
(0, vitest_1.it)('documents explore↔filter Spec with tileTargets exclude', () => {
|
|
105
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
106
|
+
(0, vitest_1.expect)(md).toContain('tiletargets');
|
|
107
|
+
(0, vitest_1.expect)(md).toMatch(/exclude/);
|
|
108
|
+
(0, vitest_1.expect)(md).toMatch(/one explore|same-explore/);
|
|
109
|
+
(0, vitest_1.expect)(md).toMatch(/tile uuid|tile uuids/);
|
|
110
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('tiletargets');
|
|
111
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toMatch(/target\.tablename|tablename/);
|
|
112
|
+
});
|
|
113
|
+
(0, vitest_1.it)('requires projectUuid on confirm_preview and multi-viz batch SOP', () => {
|
|
114
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
115
|
+
(0, vitest_1.expect)(md).toMatch(/confirm_preview.*projectuuid|projectuuid.*confirm_preview/);
|
|
116
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('confirm_preview');
|
|
117
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('projectuuid');
|
|
118
|
+
(0, vitest_1.expect)(md).toMatch(/batch sop|shell → create all charts|one.*update_dashboard/);
|
|
119
|
+
(0, vitest_1.expect)(md).toMatch(/diff\.removed|diff noise/);
|
|
120
|
+
(0, vitest_1.expect)(md).toMatch(/tiles.*diff\.removed|diff\.removed.*tiles|omit.*tiles|do \*\*not\*\* apply/);
|
|
121
|
+
(0, vitest_1.expect)(md).toContain('chartuuidorslug');
|
|
122
|
+
(0, vitest_1.expect)(md).toMatch(/persona:\s*content-reader|content-reader.*envelope/);
|
|
123
|
+
});
|
|
124
|
+
(0, vitest_1.it)('documents improve/professionalize Spec delta, cull, and leftover handoff', () => {
|
|
125
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
126
|
+
(0, vitest_1.expect)(md).toMatch(/professionalize|improve \/ professionalize/);
|
|
127
|
+
(0, vitest_1.expect)(md).toMatch(/keep \/ drop \/ rename|keep\/drop\/rename/);
|
|
128
|
+
(0, vitest_1.expect)(md).toMatch(/cull/);
|
|
129
|
+
(0, vitest_1.expect)(md).toMatch(/untiled|leftover/);
|
|
130
|
+
(0, vitest_1.expect)(md).toContain('content-governance');
|
|
131
|
+
});
|
|
132
|
+
(0, vitest_1.it)('does not register standalone build_chart or design_dashboard prompt', async () => {
|
|
133
|
+
const { registerContentDeveloperPrompts } = await Promise.resolve().then(() => __importStar(require('./prompts.js')));
|
|
134
|
+
const names = [];
|
|
135
|
+
const promptArgs = [];
|
|
136
|
+
let publishText = '';
|
|
137
|
+
let authorText = '';
|
|
138
|
+
let refactorText = '';
|
|
139
|
+
const server = {
|
|
140
|
+
registerPrompt: (name, _meta, handler) => {
|
|
141
|
+
names.push(name);
|
|
142
|
+
if (name === 'create_dashboard' ||
|
|
143
|
+
name === 'improve_dashboard' ||
|
|
144
|
+
name === 'refactor_dashboard') {
|
|
145
|
+
promptArgs.push({
|
|
146
|
+
name,
|
|
147
|
+
messages: handler({
|
|
148
|
+
goal: 'x',
|
|
149
|
+
improvementGoal: 'y',
|
|
150
|
+
dashboardUuidOrSlug: 'dash-1',
|
|
151
|
+
}).messages,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (name === 'publish_content') {
|
|
155
|
+
const messages = handler({ contentReferences: 'dash-1' }).messages;
|
|
156
|
+
publishText = messages
|
|
157
|
+
.filter((m) => m.content.type === 'text')
|
|
158
|
+
.map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
|
|
159
|
+
.join('\n')
|
|
160
|
+
.toLowerCase();
|
|
161
|
+
}
|
|
162
|
+
if (name === 'author_chart') {
|
|
163
|
+
const messages = handler({
|
|
164
|
+
goal: 'kpi',
|
|
165
|
+
dashboardSlug: 'my-dash',
|
|
166
|
+
}).messages;
|
|
167
|
+
authorText = messages
|
|
168
|
+
.filter((m) => m.content.type === 'text')
|
|
169
|
+
.map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
|
|
170
|
+
.join('\n')
|
|
171
|
+
.toLowerCase();
|
|
172
|
+
}
|
|
173
|
+
if (name === 'refactor_dashboard') {
|
|
174
|
+
const messages = handler({
|
|
175
|
+
dashboardUuidOrSlug: 'dash-1',
|
|
176
|
+
}).messages;
|
|
177
|
+
refactorText = messages
|
|
178
|
+
.filter((m) => m.content.type === 'text')
|
|
179
|
+
.map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
|
|
180
|
+
.join('\n')
|
|
181
|
+
.toLowerCase();
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
registerContentDeveloperPrompts(server);
|
|
186
|
+
(0, vitest_1.expect)(names).not.toContain('build_chart');
|
|
187
|
+
(0, vitest_1.expect)(names).not.toContain('design_dashboard');
|
|
188
|
+
(0, vitest_1.expect)(names).toContain('author_chart');
|
|
189
|
+
(0, vitest_1.expect)(names).toContain('move_content');
|
|
190
|
+
(0, vitest_1.expect)(names).toContain('create_dashboard');
|
|
191
|
+
(0, vitest_1.expect)(names).toContain('improve_dashboard');
|
|
192
|
+
(0, vitest_1.expect)(names).toContain('refactor_dashboard');
|
|
193
|
+
(0, vitest_1.expect)(names).toContain('publish_content');
|
|
194
|
+
for (const { name, messages } of promptArgs) {
|
|
195
|
+
const typed = messages;
|
|
196
|
+
const text = typed
|
|
197
|
+
.filter((m) => m.content.type === 'text')
|
|
198
|
+
.map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
|
|
199
|
+
.join('\n')
|
|
200
|
+
.toLowerCase();
|
|
201
|
+
(0, vitest_1.expect)(text).toContain('design spec');
|
|
202
|
+
(0, vitest_1.expect)(text).toMatch(/stop until the user proceeds|proceeds \/ approves/);
|
|
203
|
+
const uris = typed
|
|
204
|
+
.filter((m) => m.content.type === 'resource')
|
|
205
|
+
.map((m) => { var _a; return (_a = m.content.resource) === null || _a === void 0 ? void 0 : _a.uri; });
|
|
206
|
+
(0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/core');
|
|
207
|
+
(0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/dashboards');
|
|
208
|
+
(0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/dashboard-design');
|
|
209
|
+
if (name === 'create_dashboard' || name === 'improve_dashboard') {
|
|
210
|
+
(0, vitest_1.expect)(text).toContain('objective');
|
|
211
|
+
(0, vitest_1.expect)(text).toMatch(/clarif/);
|
|
212
|
+
(0, vitest_1.expect)(text).toMatch(/only if the user explicitly asked/);
|
|
213
|
+
(0, vitest_1.expect)(text).toMatch(/tablename|filter apply\/exclude|apply\/exclude/);
|
|
214
|
+
(0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/chart-types');
|
|
215
|
+
}
|
|
216
|
+
if (name === 'improve_dashboard') {
|
|
217
|
+
(0, vitest_1.expect)(text).toMatch(/keep \/ drop \/ rename|professionalize/);
|
|
218
|
+
(0, vitest_1.expect)(text).toMatch(/untiled|leftover/);
|
|
219
|
+
(0, vitest_1.expect)(text).toContain('content-governance');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
(0, vitest_1.expect)(publishText).toContain('objective');
|
|
223
|
+
(0, vitest_1.expect)(publishText).toMatch(/insight/);
|
|
224
|
+
(0, vitest_1.expect)(publishText).toMatch(/tiletargets|exclude\/remap|exclude\/remap/);
|
|
225
|
+
(0, vitest_1.expect)(publishText).toMatch(/untiled|leftover/);
|
|
226
|
+
(0, vitest_1.expect)(publishText).toContain('content-governance');
|
|
227
|
+
(0, vitest_1.expect)(authorText).toContain('board insight');
|
|
228
|
+
(0, vitest_1.expect)(refactorText).toMatch(/approved spec|user request allows/);
|
|
229
|
+
(0, vitest_1.expect)(refactorText).not.toMatch(/unless explicitly requested/);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Content-developer — chart types
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer/chart-types`
|
|
4
|
+
|
|
5
|
+
Pick a viz type to **answer an insight question** from the Design Spec Objective. The table below is a **reference map**, not a build order — do not walk every row unless the user explicitly asked for multi-viz / all chart types. Prefer **clone** (`get_chart_as_code` / `duplicate_chart`) over inventing viz configs. Docs: [overview](https://docs.lightdash.com/references/chart-types/overview).
|
|
6
|
+
|
|
7
|
+
When the user **does** ask for all types: follow dashboards **Multi-viz batch SOP** (shell → ≤2 concurrent chart creates → one tile update). Skip **map** without lat/lon.
|
|
8
|
+
|
|
9
|
+
## UI intent → as-code `chartConfig.type`
|
|
10
|
+
|
|
11
|
+
| User / UI intent | As-code |
|
|
12
|
+
| ----------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| Bar / line / area / scatter / mixed | `cartesian` — series `type` is `bar` \| `line` \| `area` \| `scatter`; mixed = multiple series types |
|
|
14
|
+
| Horizontal bar | `cartesian` + `layout.flipAxes: true` + series `type: bar` |
|
|
15
|
+
| Pie / donut | `pie` (`groupFieldIds`, `metricId`; `isDonut` optional) |
|
|
16
|
+
| Funnel | `funnel` (`fieldId` metric; usually `dataInput: row` + one stage dimension) |
|
|
17
|
+
| Treemap | `treemap` (`groupFieldIds`, `sizeMetricId`) |
|
|
18
|
+
| Sankey | `sankey` (`sourceFieldId`, `targetFieldId`, `metricFieldId`; needs **two** dimensions) |
|
|
19
|
+
| Table | `table` (`config: {}` is fine; keep `tableConfig.columnOrder`) |
|
|
20
|
+
| Big value / KPI | `big_number` (`selectedField`; empty `dimensions`) |
|
|
21
|
+
| Gauge | `gauge` (`selectedField`, numeric `min`/`max` or `maxFieldId`) |
|
|
22
|
+
| Map | `map` — requires lat/lon (or location) fieldIds; **skip** and report if the explore has none |
|
|
23
|
+
| Custom / data-app viz | out of scope unless a rendering seed exists |
|
|
24
|
+
|
|
25
|
+
Bar/line/area/scatter are **series** types under one `cartesian` chart — not separate top-level `chartConfig.type` values.
|
|
26
|
+
|
|
27
|
+
## Required cartesian shape
|
|
28
|
+
|
|
29
|
+
Every series needs `type` **and** `encode.xRef` / `yRef`. Never ship `{ series: [{ type: "bar" }] }` alone (UI can TypeError).
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
chartConfig:
|
|
33
|
+
type: cartesian
|
|
34
|
+
config:
|
|
35
|
+
layout:
|
|
36
|
+
xField: orders_status
|
|
37
|
+
yField:
|
|
38
|
+
- orders_num_unique_order_ids
|
|
39
|
+
eChartsConfig:
|
|
40
|
+
series:
|
|
41
|
+
- type: bar
|
|
42
|
+
encode:
|
|
43
|
+
xRef:
|
|
44
|
+
field: orders_status
|
|
45
|
+
yRef:
|
|
46
|
+
field: orders_num_unique_order_ids
|
|
47
|
+
yAxisIndex: 0
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Mixed charts: one series per metric (e.g. bar + line) with matching encodes; optional dual axis via `yAxisIndex: 0|1`.
|
|
51
|
+
|
|
52
|
+
Horizontal bar: same as bar plus `layout.flipAxes: true`.
|
|
53
|
+
|
|
54
|
+
## Non-cartesian shapes (clone when possible)
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
# pie
|
|
58
|
+
chartConfig:
|
|
59
|
+
type: pie
|
|
60
|
+
config:
|
|
61
|
+
groupFieldIds: [orders_status]
|
|
62
|
+
metricId: orders_num_unique_order_ids
|
|
63
|
+
isDonut: false
|
|
64
|
+
showLegend: true
|
|
65
|
+
showPercentage: true
|
|
66
|
+
showValue: true
|
|
67
|
+
|
|
68
|
+
# funnel (row stages = dimension values)
|
|
69
|
+
chartConfig:
|
|
70
|
+
type: funnel
|
|
71
|
+
config:
|
|
72
|
+
fieldId: orders_num_unique_order_ids
|
|
73
|
+
dataInput: row
|
|
74
|
+
|
|
75
|
+
# treemap
|
|
76
|
+
chartConfig:
|
|
77
|
+
type: treemap
|
|
78
|
+
config:
|
|
79
|
+
groupFieldIds: [orders_status]
|
|
80
|
+
sizeMetricId: orders_num_unique_order_ids
|
|
81
|
+
|
|
82
|
+
# sankey (two dims in metricQuery.dimensions; keep customDimensions if cloned)
|
|
83
|
+
chartConfig:
|
|
84
|
+
type: sankey
|
|
85
|
+
config:
|
|
86
|
+
sourceFieldId: use_coupon
|
|
87
|
+
targetFieldId: orders_status
|
|
88
|
+
metricFieldId: orders_num_unique_order_ids
|
|
89
|
+
|
|
90
|
+
# big_number
|
|
91
|
+
chartConfig:
|
|
92
|
+
type: big_number
|
|
93
|
+
config:
|
|
94
|
+
selectedField: orders_num_unique_order_ids
|
|
95
|
+
showBigNumberLabel: true
|
|
96
|
+
showComparison: false
|
|
97
|
+
comparisonFormat: raw
|
|
98
|
+
|
|
99
|
+
# gauge
|
|
100
|
+
chartConfig:
|
|
101
|
+
type: gauge
|
|
102
|
+
config:
|
|
103
|
+
selectedField: orders_num_unique_order_ids
|
|
104
|
+
min: 0
|
|
105
|
+
max: 200
|
|
106
|
+
showAxisLabels: true
|
|
107
|
+
showPercentage: false
|
|
108
|
+
|
|
109
|
+
# table
|
|
110
|
+
chartConfig:
|
|
111
|
+
type: table
|
|
112
|
+
config: {}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Hard rules
|
|
116
|
+
|
|
117
|
+
- Clone `chartConfig` from a rendering seed on the same `tableName`; change series `type` / top-level type only when needed.
|
|
118
|
+
- FieldIds only from seed / `get_chart` / semantic-layer — never invent. This persona has **no** explore/field list tools.
|
|
119
|
+
- When cloning charts that use SQL/bin custom dims (e.g. coupon flags), copy `metricQuery.customDimensions` verbatim.
|
|
120
|
+
- Every `metricQuery.dimensions` entry must appear in viz layout / group / sankey source-target / pivot — unused dimensions corrupt GROUP BY (“Results may be incorrect”).
|
|
121
|
+
- For dashboard work set `dashboardSlug` **and** tile via `update_dashboard` (ownership alone does not place tiles).
|
|
122
|
+
- `create_chart` success body is `{ charts: [{ action, data: { uuid, slug, … } }] }` — read UUID from `charts[0].data.uuid` for tiles.
|
|
123
|
+
- Multi-viz boards: raise the new-chart budget; prefer **≤2 concurrent** preview→confirm→apply chains (hosted tunnels often 502 under heavier parallelism).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Content-developer — content move
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer/content-move`
|
|
4
|
+
|
|
5
|
+
Move charts/dashboards into **existing** spaces. Never create, rename, or update spaces (Terraform / out-of-band).
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Discover with `list_spaces` / `get_space` / `search_content`. Confirm the **target space already exists** (`targetSpaceUuid`).
|
|
10
|
+
2. Resolve each item to a **UUID** (not only a name). Prefer `search_content` short tokens or space inventory.
|
|
11
|
+
3. Preview with `preview_content_move`:
|
|
12
|
+
- Required: `itemUuids`, `targetSpaceUuid` (null = project root if supported), `contentTypes` (same length/order as `itemUuids`).
|
|
13
|
+
- Optional: `chartSources` (must match lengths and match apply exactly).
|
|
14
|
+
4. `confirm_preview` with `resourceKind: 'content-move'` and the preview's exact `resourceKey` → use the **new** validated `previewToken`.
|
|
15
|
+
5. Apply with `move_content` using the same payload hash fields.
|
|
16
|
+
6. Report moved item UUIDs and target space. Re-`get_space` if you need confirmation.
|
|
17
|
+
|
|
18
|
+
## Pitfalls
|
|
19
|
+
|
|
20
|
+
- Wrong `contentTypes` length/order vs `itemUuids` fails closed.
|
|
21
|
+
- Do not invent space UUIDs — copy from `list_spaces` / `get_space`.
|
|
22
|
+
- Moving does not replace promote; cross-project promote stays on content-governance.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Content-developer core
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer/core`
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Author **semantic** charts and dashboards inside one resolved project. **Clarify objective → Design Spec → user approval →** create the dashboard shell first, then create charts scoped with `dashboardSlug` (official Lightdash as-code: dashboard-owned charts do not appear as independent space charts). Every write is gated: `preview_*` → `confirm_preview` → apply.
|
|
8
|
+
|
|
9
|
+
This persona does **not** execute queries, compile explores, create spaces, or promote. Clone viz configs via `get_chart_as_code` / `duplicate_chart`. For unknown fieldIds use semantic-layer. For promote use content-governance.
|
|
10
|
+
|
|
11
|
+
## Hard bans
|
|
12
|
+
|
|
13
|
+
- Do not execute arbitrary metric queries, raw SQL, warehouse runs, or saved-chart execution (no `run_chart` here).
|
|
14
|
+
- Do not author or upsert SQL charts.
|
|
15
|
+
- Do not hard-delete, rollback, or promote content. Promote dashboards via **content-governance**.
|
|
16
|
+
- Do not perform organization administration or list org-wide projects.
|
|
17
|
+
- Do not create or update spaces — spaces are Terraform / out-of-band. Use existing spaces only.
|
|
18
|
+
- Do not create **space-only** charts for dashboard work (omit `dashboardSlug`). New charts must set `dashboardSlug` to the dashboard already created.
|
|
19
|
+
- Do not call `preview_*` or write tools for a **new** dashboard or a **material** dashboard redesign until a Design Spec (with settled **Objective**) was presented and the user approved or amended it in-thread.
|
|
20
|
+
- Do not start writes from a viz-type / “all chart types” checklist alone — Objective and insight questions come first (an explicit user all-types ask may be the Objective after a one-line restatement).
|
|
21
|
+
- Do not call `confirm_preview` without **`projectUuid`** when there is no HTTP pin — `PROJECT_SCOPE_REQUIRED` even if the matching `preview_*` already had a project.
|
|
22
|
+
- Do not attach dashboard filters whose `target.tableName` is absent from a tile’s explore without explicitly excluding that tile (or remapping) via `tileTargets`.
|
|
23
|
+
- Do not treat chart create as done without a dashboard shell and tiles that reference those charts.
|
|
24
|
+
- Do not invent `fieldId`s. Copy from `get_chart_as_code` / `get_chart` (`includeQueryDefinition`) or semantic-layer.
|
|
25
|
+
- Do not invent skinny `chartConfig` (e.g. `{ series: [{ type: 'bar' }] }` only) — clone a working as-code body and keep series/layout/encode structure.
|
|
26
|
+
- Do not call a write tool without a validated, unexpired HMAC `previewToken` from the matching `preview_*` then `confirm_preview`.
|
|
27
|
+
- Do not reuse a **draft** token after confirm (confirm returns a **new** validated token) or after payload/baseline drift (`PREVIEW_STALE`).
|
|
28
|
+
- Do not unlock with a different resource's preview — `resourceKind` / `resourceKey` must match the preview exactly.
|
|
29
|
+
- Do not treat `validate_chart` / `validate_dashboard` as unlock — saved-UUID health checks only (not UI-render proof).
|
|
30
|
+
- Do not reveal secrets, warehouse credentials, or hidden SQL.
|
|
31
|
+
|
|
32
|
+
## Default budgets (override when the user expands scope)
|
|
33
|
+
|
|
34
|
+
| Resource | Default |
|
|
35
|
+
| --------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
36
|
+
| `search_content` pages | `pageSize≤25`, stop after **2** pages |
|
|
37
|
+
| Spaces deep-dived (`get_space`) | **≤3** |
|
|
38
|
+
| Seed charts inspected / cloned | **≤12** |
|
|
39
|
+
| New charts created per dashboard | **≤8** (raise only when the user explicitly expands scope, e.g. all chart types) |
|
|
40
|
+
| Concurrent preview→confirm→apply chains | **≤2** (hosted tunnels often 502 under heavier parallelism) |
|
|
41
|
+
| Tile mutations after shell | Prefer one `update_dashboard` with full tiles; else **≤8** `add_dashboard_tile` |
|
|
42
|
+
| Preview→confirm→apply retries after `PREVIEW_STALE` | **≤2** per resource |
|
|
43
|
+
|
|
44
|
+
Record when a budget stopped you. User-requested “one of every chart type” overrides the new-chart cap.
|
|
45
|
+
|
|
46
|
+
## Allowed tools (`lightdash_*`)
|
|
47
|
+
|
|
48
|
+
| Tool | Use for |
|
|
49
|
+
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
50
|
+
| `get_project` | Resolve project; read `developerCapabilities` (mutate yes; **execute charts/tiles = false**) |
|
|
51
|
+
| `search_content` | Find charts/dashboards; prefer short tokens, not marketing phrases |
|
|
52
|
+
| `list_spaces` / `get_space` | Existing spaces; pick `spaceUuid` / `spaceSlug` |
|
|
53
|
+
| `get_dashboard` / `get_chart` | Metadata. `get_chart` arg is **`chartUuidOrSlug`** (not `chartUuid`). Tiles often omit `x/y/w/h` |
|
|
54
|
+
| `get_chart_as_code` | **Clone** upsert-shaped `chartConfig` + `metricQuery` before create/update |
|
|
55
|
+
| `preview_chart_changes` / `preview_dashboard_changes` / `preview_content_move` | Mint draft `previewToken` + `resourceKey` |
|
|
56
|
+
| `confirm_preview` | Unlock; returns **new** validated token — always pass **`projectUuid`** without HTTP pin |
|
|
57
|
+
| `create_chart` / `update_chart` / `duplicate_chart` | Semantic as-code writes (after confirm); set `dashboardSlug` |
|
|
58
|
+
| `create_dashboard` / `update_dashboard` / `duplicate_dashboard` | Dashboard shell then tile updates |
|
|
59
|
+
| `add_dashboard_tile` / `move_dashboard_tile` / `remove_dashboard_tile` / `resize_dashboard_tile` | Tile ops; each needs preview of the **full next tiles array** |
|
|
60
|
+
| `move_content` | Relocate into existing spaces |
|
|
61
|
+
| `validate_chart` / `validate_dashboard` | Optional post-apply health (`chartUuid` / dashboard UUID) |
|
|
62
|
+
| `compare_chart_versions` / `compare_dashboard_versions` | Drift / refactor |
|
|
63
|
+
|
|
64
|
+
## Phase 0 — Resolve project
|
|
65
|
+
|
|
66
|
+
1. Always pass **`projectUuid`** (or HTTP `X-Lightdash-Project` pin). Else `PROJECT_SCOPE_REQUIRED` — stop.
|
|
67
|
+
2. Call `get_project`. Record UUID, name, pin, and `developerCapabilities`.
|
|
68
|
+
3. Expect execution capabilities **false** — you cannot verify query results here.
|
|
69
|
+
4. Never switch projects or invent an org project list.
|
|
70
|
+
5. Shared discovery tools (`get_dashboard`, `get_chart`, …) may report `context.persona: content-reader` in the envelope even on this persona — ignore that label; write tools still use content-developer.
|
|
71
|
+
|
|
72
|
+
## Preview → confirm → apply (every write)
|
|
73
|
+
|
|
74
|
+
1. `preview_*` → record `previewToken`, `previewId`, `contentHash`, `resourceKey`, `expiresAt`, diff.
|
|
75
|
+
2. `confirm_preview` with that draft token + exact `resourceKind` / `resourceKey` **and `projectUuid` (required when there is no HTTP pin)** → use the **returned** validated `previewToken`. Omitting `projectUuid` on confirm yields `PROJECT_SCOPE_REQUIRED` even if preview succeeded with a project arg.
|
|
76
|
+
3. Apply write with the validated token, **`projectUuid`**, and the **same** proposed payload (`dashboard:{}` / `chart:{}` nested shapes).
|
|
77
|
+
4. Drift / expiry → re-preview → confirm → apply (≤2 retries).
|
|
78
|
+
5. Optionally `validate_*` on saved UUIDs. Report UUIDs/slugs — never claim success without a successful apply response. UI render is not guaranteed by MCP success alone.
|
|
79
|
+
|
|
80
|
+
**Diff noise vs real omissions:** On dashboard **update** previews, `diff.removed` often lists server-owned metadata omitted from the proposal (`access`, `views`, `updatedAt`, `uuid`, `slug`, `organizationUuid`, …). Ignore those. If **`tiles`**, **`tabs`**, or **`filters`** appear in `diff.removed`, you omitted them from `changes` — do **not** apply. Re-preview with the full intentional `tiles`/`tabs`/`filters` (copy layout from preview `current` when only editing name/description). Never ship a description-only body that drops the board.
|
|
81
|
+
|
|
82
|
+
### ResourceKey cheat sheet
|
|
83
|
+
|
|
84
|
+
| Operation | Typical `resourceKind` | Typical `resourceKey` |
|
|
85
|
+
| ------------------- | ---------------------- | ------------------------------------------------------------------------ |
|
|
86
|
+
| Create chart | `chart` | target **`slug`** — only if `preview_chart_changes` got top-level `slug` |
|
|
87
|
+
| Update chart | `chart` | chart **UUID** (slug is alias) |
|
|
88
|
+
| Duplicate chart | `chart` | **source** UUID |
|
|
89
|
+
| Create dashboard | `dashboard` | literal `new` |
|
|
90
|
+
| Update / tile ops | `dashboard` | dashboard UUID (slug is alias) |
|
|
91
|
+
| Duplicate dashboard | `dashboard` | **source** UUID |
|
|
92
|
+
| Content move | `content-move` | preview's `resourceKey` |
|
|
93
|
+
|
|
94
|
+
**Create-chart gotcha:** omit top-level `slug` on `preview_chart_changes` → preview returns `resourceKey: "new"`, but `create_chart` applies with `resourceKey = args.slug` → binding mismatch. Always pass top-level `slug` (same as `changes.slug`) on create previews.
|
|
95
|
+
|
|
96
|
+
### Apply arg pitfalls
|
|
97
|
+
|
|
98
|
+
- `preview_*` uses flat `changes`; `create_dashboard` / `update_dashboard` wrap the **same** body as `dashboard: { … }`; `create_chart` / `update_chart` wrap as `chart: { … }` plus top-level `slug`.
|
|
99
|
+
- `create_chart` requires top-level **`slug`** **and** `chart.slug` (same value).
|
|
100
|
+
- Charts use **`spaceSlug`** (+ `skipSpaceCreate: true`) and **`dashboardSlug`** for dashboard-owned charts.
|
|
101
|
+
- Dashboards use **`spaceUuid`** (not `spaceSlug`).
|
|
102
|
+
- `dashboardSlug` owns the chart to the dashboard but does **not** add tiles — still `update_dashboard` with a full tile array.
|
|
103
|
+
- Tile shape: `{ type: 'saved_chart', x, y, w, h, properties: { savedChartUuid, title? } }` — use the UUID from `create_chart` / `duplicate_chart` (36-column grid; half-width ≈ `w: 18`). Optional `chartSlug` is metadata only; do not omit `savedChartUuid`.
|
|
104
|
+
- `create_chart` response: extract UUID from `charts[0].data.uuid` (not a bare chart object).
|
|
105
|
+
- Viz shapes: `lightdash://playbooks/content-developer/chart-types`.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Content-developer — dashboard design
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer/dashboard-design`
|
|
4
|
+
|
|
5
|
+
Composition and quality for usable boards. **Apply writes** (preview → confirm → nested `dashboard:{}` / chart slug) via `lightdash://playbooks/content-developer/dashboards`. Viz shapes via `lightdash://playbooks/content-developer/chart-types`.
|
|
6
|
+
|
|
7
|
+
Official product order: [Creating dashboards](https://docs.lightdash.com/get-started/exploring-data/dashboards) — shell → charts → markdown (optional) → save → filters (optional) → tabs (only if needed).
|
|
8
|
+
|
|
9
|
+
The **Phase Design** gate below is agent planning (chat). After the user approves, mutate in that official product order via MCP tools.
|
|
10
|
+
|
|
11
|
+
## Phase Design (before any write)
|
|
12
|
+
|
|
13
|
+
If the user goal lacks audience, decisions, or insight questions, ask **2–4 clarifying questions** first — then discover and emit the Spec.
|
|
14
|
+
|
|
15
|
+
Read-only discovery is allowed (`get_project`, `list_spaces`, `get_space`, `search_content`, `get_dashboard`, `get_chart` / `get_chart_as_code` for seed picking).
|
|
16
|
+
Do **not** call `preview_*`, `confirm_preview`, or any create/update/duplicate/tile/move tool until the user approves or amends this Design Spec.
|
|
17
|
+
|
|
18
|
+
Emit one Design Spec:
|
|
19
|
+
|
|
20
|
+
1. **Objective** (required before Space / Tiles) — settle what to understand:
|
|
21
|
+
- **Audience** (who)
|
|
22
|
+
- **Decisions** the board supports (why)
|
|
23
|
+
- **Insight questions** — 3–7 numbered (`Q1`…`Qn`) (what to understand)
|
|
24
|
+
- **Primary metrics / dimensions** (how; real fieldIds only after seed discovery, else `TBD pending seed`)
|
|
25
|
+
- **Non-goals** (what this board is _not_)
|
|
26
|
+
2. **Space** — existing `spaceUuid` / `spaceSlug` (never create a space)
|
|
27
|
+
3. **Tiles** — ordered list: reuse chart UUID **or** new chart (name, viz type from chart-types map, seed chart, **`tableName` (explore)**, proposed slug). **Each tile cites an insight id** (e.g. `Q2`). Do **not** propose “all chart types” unless the user explicitly asked.
|
|
28
|
+
4. **Layout sketch** — 36-col grid rows (KPI → trends → breakdowns → table); markdown yes/no
|
|
29
|
+
5. **Filters** — 0–3 shared dimensions; prefer empty `values: []`; `required: true` only if user asked. For each filter: list which tiles it **applies** to vs **excludes**. Prefer **one explore** for the whole filtered board. If a tile’s `tableName` ≠ filter `target.tableName` (and no known equivalent field), mark **exclude**.
|
|
30
|
+
6. **Tabs** — default none (only themes / audiences / 30+ tiles per Lightdash docs)
|
|
31
|
+
7. **Budget** — chart count vs core cap (default ≤8 unless user expands)
|
|
32
|
+
|
|
33
|
+
Then stop and ask: proceed / amend?
|
|
34
|
+
|
|
35
|
+
Approval phrases: proceed, approved, go ahead, looks good, or an explicit amended plan.
|
|
36
|
+
|
|
37
|
+
**Explicit multi-viz / all-types asks:** When the user already named the full viz checklist + analysis goal + `projectUuid`, a one-line Objective restatement + tile→insight map **is** the Spec. Treat that ask as approval after you restate once (do not re-ask clarifying questions that restate their checklist). Still skip **map** when no lat/lon and say so.
|
|
38
|
+
|
|
39
|
+
### Improve / professionalize Spec delta
|
|
40
|
+
|
|
41
|
+
Use this instead of inventing a full new-board Spec when the user asks to **professionalize**, **clean up**, or **redesign** an existing dashboard — or when the board looks like a viz showcase (`[loop*]`, “all chart types”, many redundant status/revenue charts).
|
|
42
|
+
|
|
43
|
+
1. Clarify Objective if still vague (2–4 questions).
|
|
44
|
+
2. Emit a **Spec delta**, then stop for proceed / amend:
|
|
45
|
+
- **Objective** (+ 3–7 insight ids `Q1`…`Qn`)
|
|
46
|
+
- **Keep / drop / rename** table — each **keep** cites an insight id; **drop** lists charts leaving the board; **rename** strips demo prefixes
|
|
47
|
+
- **Layout sketch** (36-col; KPI → trends → breakdowns → table)
|
|
48
|
+
- **Filters** — usually keep existing empty-value filters; do not invent `required: true`. Re-check explore↔filter: exclude (or remount) tiles whose `tableName` cannot use each filter’s `target`
|
|
49
|
+
3. **Cull rule:** one primary viz per insight. Drop duplicates (e.g. area if line answers the same Q; pie/funnel/treemap if bar already covers status mix) unless the user explicitly asked for multi-viz.
|
|
50
|
+
4. Markdown overview should **restate the approved Objective** ([docs](https://docs.lightdash.com/get-started/exploring-data/dashboards#add-markdown-or-other-content)).
|
|
51
|
+
5. After apply: list chart UUIDs still dashboard-owned (`dashboardSlug`) but **not** tiled. Soft-delete those leftovers via **content-governance** — not this persona ([dashboard-owned charts stay off search/spaces](https://docs.lightdash.com/get-started/exploring-data/dashboards#create-a-new-chart)).
|
|
52
|
+
|
|
53
|
+
## Layout
|
|
54
|
+
|
|
55
|
+
- One board, one **Objective**. Prefer **KPI / overview** → **trends** → **breakdowns** → **table**.
|
|
56
|
+
- Grid width max **36**. Half-width ≈ `w: 18`. Full-width table/markdown ≈ `w: 36`.
|
|
57
|
+
- `get_dashboard` tile summaries often **omit `x/y/w/h`** — always compose the full layout intentionally; do not assume round-trip of positions.
|
|
58
|
+
- Prefer dashboard-owned charts (`dashboardSlug`) for one-off tiles ([docs](https://docs.lightdash.com/get-started/exploring-data/dashboards#create-a-new-chart)).
|
|
59
|
+
- Reuse existing charts as tiles when they already fit.
|
|
60
|
+
- Suggested skeleton after markdown (`y:0`, `h:3`, `w:36`): KPIs at `y:3`, then rows of two half-width charts (`h:8–9`), table last full-width.
|
|
61
|
+
|
|
62
|
+
## Markdown (optional)
|
|
63
|
+
|
|
64
|
+
Use for purpose, definitions, or caveats — not decorative HTML. Prefer an overview tile that **restates the approved Objective** (audience, decisions, insight questions) so viewers understand the board ([docs](https://docs.lightdash.com/get-started/exploring-data/dashboards#add-markdown-or-other-content)).
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
type: markdown
|
|
68
|
+
x: 0
|
|
69
|
+
y: 0
|
|
70
|
+
w: 36
|
|
71
|
+
h: 3
|
|
72
|
+
properties:
|
|
73
|
+
title: Overview
|
|
74
|
+
content: |
|
|
75
|
+
Short markdown restating the Objective. Prefer plain text over HTML/CSS.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Skip fancy HTML/iframe unless the user asks. Loom / heading tiles: only if requested.
|
|
79
|
+
|
|
80
|
+
## Filters (optional)
|
|
81
|
+
|
|
82
|
+
0–3 shared **dimensions**. Prefer **one explore** for all tiles that share dashboard filters. Filters guide: [Using filters](https://docs.lightdash.com/guides/limiting-data-using-filters). Official as-code targeting: [dashboard-reference `tileTargets`](https://github.com/lightdash/lightdash/blob/main/skills/developing-in-lightdash/resources/dashboard-reference.md).
|
|
83
|
+
|
|
84
|
+
- Prefer **empty-value** saved filters so viewers choose ([saved filters](https://docs.lightdash.com/guides/limiting-data-using-filters#adding-saved-filters-to-your-dashboard)).
|
|
85
|
+
- Prefer **clone** `filters` from `get_dashboard` on a working board over inventing rules.
|
|
86
|
+
- Do **not** set `required: true` unless the user asks (locks load until a value is set; cannot combine with a default).
|
|
87
|
+
- Auto-apply needs matching `fieldId` + `tableName` on the tile’s explore. Omitting `tileTargets` is fine when **every** tile shares that table.
|
|
88
|
+
- Multi-explore: **exclude** foreign tiles (do not leave ambiguous). Advanced: remap equivalent fields via `tileTargets` — only when the user needs the filter on both explores.
|
|
89
|
+
- Shape: `filters: { dimensions: [], metrics: [], tableCalculations: [] }` (OpenAPI `DashboardFilters`).
|
|
90
|
+
|
|
91
|
+
**Same-explore boards** — empty-value example (omit `tileTargets`):
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
filters:
|
|
95
|
+
dimensions:
|
|
96
|
+
- id: filter-orders-status
|
|
97
|
+
label: Order status
|
|
98
|
+
operator: equals
|
|
99
|
+
values: []
|
|
100
|
+
disabled: false
|
|
101
|
+
required: false
|
|
102
|
+
target:
|
|
103
|
+
fieldId: orders_status
|
|
104
|
+
tableName: orders
|
|
105
|
+
- id: filter-orders-month
|
|
106
|
+
label: Order month
|
|
107
|
+
operator: equals
|
|
108
|
+
values: []
|
|
109
|
+
disabled: false
|
|
110
|
+
required: false
|
|
111
|
+
target:
|
|
112
|
+
fieldId: orders_order_date_month
|
|
113
|
+
tableName: orders
|
|
114
|
+
metrics: []
|
|
115
|
+
tableCalculations: []
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Exclude a foreign explore tile** (MCP / native API — keys are **tile UUIDs**; as-code YAML uses tile slugs instead):
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
# After tiles exist: get_dashboard → copy each tile's uuid for exclusions
|
|
122
|
+
filters:
|
|
123
|
+
dimensions:
|
|
124
|
+
- id: filter-orders-status
|
|
125
|
+
label: Order status
|
|
126
|
+
operator: equals
|
|
127
|
+
values: []
|
|
128
|
+
disabled: false
|
|
129
|
+
required: false
|
|
130
|
+
target:
|
|
131
|
+
fieldId: orders_status
|
|
132
|
+
tableName: orders
|
|
133
|
+
tileTargets:
|
|
134
|
+
'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee': false # customers-explore LTV tile uuid
|
|
135
|
+
metrics: []
|
|
136
|
+
tableCalculations: []
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Apply order:** compose tiles first → if excluding, `get_dashboard` for tile UUIDs → then `preview_dashboard_changes` → `confirm_preview` → `update_dashboard({ dashboard: { filters, tiles?, name?, … } })` (second update is fine when UUIDs were not known on first tile write).
|
|
140
|
+
|
|
141
|
+
## Tabs
|
|
142
|
+
|
|
143
|
+
Default: **no tabs**. Use only for themes / audiences / 30+ tiles ([docs tip](https://docs.lightdash.com/get-started/exploring-data/dashboards#add-tabs)).
|
|
144
|
+
|
|
145
|
+
## Done criteria
|
|
146
|
+
|
|
147
|
+
- Objective was settled (and Design Spec approved) before writes.
|
|
148
|
+
- Every tile maps to an insight question from the Spec.
|
|
149
|
+
- Charts are tiled (ownership alone is not enough).
|
|
150
|
+
- Filters honor explore↔filter plan (single-explore auto-apply, or `tileTargets` exclude/remap for foreign tiles).
|
|
151
|
+
- After a cull / professionalize: report untiled dashboard-owned leftovers; hand soft-delete to content-governance.
|
|
152
|
+
- Markdown / filters only if intentional — summarize them in the report.
|
|
153
|
+
- This persona cannot `run_chart`; note UI render was not verified here.
|