@lightdash-tools/mcp 0.8.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 +108 -237
- 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 +6 -7
- package/dist/auth/oauth-broker/pending-store.js +3 -4
- package/dist/auth/oauth-broker/pending-store.test.d.ts +2 -3
- package/dist/auth/oauth-broker/pending-store.test.js +2 -39
- package/dist/auth/oauth-broker/routes.d.ts +1 -1
- package/dist/auth/oauth-broker/routes.js +3 -3
- package/dist/auth/oauth-broker/routes.test.js +1 -1
- 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 +0 -2
- package/dist/bin.js +9 -2
- package/dist/config/env.d.ts +5 -15
- package/dist/config/env.js +6 -16
- package/dist/config/load-mcp-config.d.ts +0 -4
- package/dist/config/load-mcp-config.js +8 -9
- package/dist/config/normalize-url.test.js +14 -11
- 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/content-promote.js +7 -1
- package/dist/destructive/promote-contract.test.js +106 -47
- package/dist/destructive/register-destructive-tool.js +6 -24
- package/dist/destructive/request-state.d.ts +2 -6
- package/dist/destructive/request-state.js +3 -38
- package/dist/destructive/types.d.ts +2 -1
- 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.js +148 -0
- package/dist/governance/mcp-client-session.d.ts +3 -2
- package/dist/governance/mcp-client-session.js +3 -2
- package/dist/governance/project-scope.d.ts +8 -22
- package/dist/governance/project-scope.js +36 -44
- package/dist/governance/project-scope.test.d.ts +1 -1
- package/dist/governance/project-scope.test.js +21 -44
- 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 +117 -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 +1 -1
- package/dist/personas/content-developer/v1/index.js +1 -0
- package/dist/personas/content-developer/v1/prompts.d.ts +3 -0
- package/dist/personas/content-developer/v1/prompts.js +80 -61
- package/dist/personas/content-developer/v1/prompts.test.js +159 -3
- package/dist/personas/content-developer/v1/resources/playbooks/chart-types.md +123 -0
- package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +13 -6
- package/dist/personas/content-developer/v1/resources/playbooks/core.md +91 -49
- package/dist/personas/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +82 -34
- package/dist/personas/content-developer/v1/resources/playbooks/index.md +9 -7
- package/dist/personas/content-developer/v1/resources/playbooks.d.ts +1 -1
- package/dist/personas/content-developer/v1/resources/playbooks.js +29 -10
- package/dist/personas/content-governance/v1/resources/playbooks/core.md +1 -1
- package/dist/personas/content-governance/v1/resources/playbooks/dashboards.md +1 -1
- package/dist/personas/content-reader/v1/index.d.ts +1 -1
- package/dist/personas/content-reader/v1/index.js +1 -0
- package/dist/personas/content-reader/v1/prompts.js +64 -30
- package/dist/personas/content-reader/v1/resources/playbooks/compare.md +24 -9
- package/dist/personas/content-reader/v1/resources/playbooks/core.md +56 -29
- package/dist/personas/content-reader/v1/resources/playbooks/discover.md +27 -5
- package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +38 -8
- package/dist/personas/content-reader/v1/resources/playbooks/index.md +8 -8
- package/dist/personas/content-reader/v1/resources/playbooks.js +2 -2
- package/dist/personas/index.d.ts +1 -0
- package/dist/personas/index.js +27 -22
- package/dist/personas/index.test.js +68 -53
- package/dist/personas/lib/playbook-resources.d.ts +4 -3
- package/dist/personas/lib/playbook-resources.js +14 -10
- package/dist/personas/organization-audit/v1/prompts.js +68 -36
- package/dist/personas/organization-audit/v1/resources/playbooks/access.md +12 -4
- package/dist/personas/organization-audit/v1/resources/playbooks/content.md +13 -3
- package/dist/personas/organization-audit/v1/resources/playbooks/core.md +49 -16
- package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +8 -3
- package/dist/personas/organization-audit/v1/resources/playbooks/index.md +8 -8
- package/dist/personas/organization-audit/v1/resources/playbooks.js +1 -1
- package/dist/personas/persona.parity.test.js +14 -10
- package/dist/personas/semantic-layer/v1/prompts.js +50 -39
- package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +36 -31
- package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +53 -21
- package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +42 -39
- package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +6 -6
- package/dist/personas/semantic-layer/v1/resources/playbooks.js +2 -2
- package/dist/personas/types.d.ts +1 -1
- package/dist/policy/content-developer.d.ts +3 -3
- package/dist/policy/content-developer.js +3 -3
- package/dist/policy/content-developer.test.js +10 -4
- package/dist/policy/content-reader.d.ts +5 -1
- package/dist/policy/content-reader.js +18 -3
- package/dist/policy/content-reader.test.js +2 -1
- package/dist/policy/preview-ledger-fault.test.js +101 -426
- package/dist/policy/preview-ledger.d.ts +38 -74
- package/dist/policy/preview-ledger.js +108 -186
- package/dist/policy/preview-ledger.test.js +237 -111
- package/dist/policy/result-limits.d.ts +6 -1
- package/dist/policy/result-limits.js +28 -29
- package/dist/policy/result-limits.test.js +10 -1
- package/dist/server/capabilities.js +2 -0
- package/dist/server/capabilities.test.js +2 -0
- package/dist/server/server.js +12 -8
- package/dist/server/upstream-errors.d.ts +17 -0
- package/dist/server/upstream-errors.js +60 -0
- package/dist/server/upstream-errors.test.js +50 -0
- package/dist/stdio.process.test.js +4 -2
- 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.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/organization/inventory.js +2 -1
- package/dist/tools/project/content.js +5 -1
- package/dist/tools/project/developer-content-preview.d.ts +2 -1
- package/dist/tools/project/developer-content-preview.js +40 -35
- package/dist/tools/project/developer-content-shared.d.ts +8 -2
- package/dist/tools/project/developer-content-shared.js +7 -3
- package/dist/tools/project/developer-content.d.ts +7 -8
- package/dist/tools/project/developer-content.js +72 -67
- 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 +1 -1
- package/dist/tools/project/developer-helpers.js +1 -1
- package/dist/tools/project/get-dashboard-promote-diff.js +12 -2
- package/dist/tools/project/invariants.test.js +5 -3
- package/dist/tools/project/projects.js +6 -4
- package/dist/tools/project/projects.test.js +44 -5
- 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/query/bounded-saved-query.js +1 -1
- package/dist/tools/query/lifecycle.d.ts +1 -1
- package/dist/tools/query/lifecycle.js +17 -25
- package/dist/tools/query/query-ledger.d.ts +15 -8
- package/dist/tools/query/query-ledger.js +21 -15
- package/dist/tools/query/query-ledger.test.js +13 -11
- package/dist/tools/query/reader-tool-helpers.js +4 -6
- package/dist/tools/query/reader-tool-helpers.test.js +8 -4
- package/dist/tools/registry.d.ts +63 -0
- package/dist/tools/registry.js +26 -0
- package/dist/tools/shared.d.ts +27 -8
- package/dist/tools/shared.js +61 -28
- package/dist/tools/shared.test.js +100 -4
- package/dist/transports/streamable-http.js +48 -206
- package/dist/transports/streamable-http.test.js +10 -3
- package/package.json +5 -6
- package/dist/destructive/confirmation-claim.d.ts +0 -21
- package/dist/destructive/confirmation-claim.js +0 -87
- package/dist/destructive/confirmation-claim.test.js +0 -50
- package/dist/store/config.d.ts +0 -11
- package/dist/store/config.js +0 -50
- package/dist/store/config.test.js +0 -56
- package/dist/store/create-oauth-broker-store.d.ts +0 -6
- package/dist/store/create-oauth-broker-store.js +0 -16
- package/dist/store/create-preview-store.d.ts +0 -10
- package/dist/store/create-preview-store.js +0 -30
- package/dist/store/create-session-store.d.ts +0 -19
- package/dist/store/create-session-store.js +0 -24
- package/dist/store/in-memory-preview-store.d.ts +0 -17
- package/dist/store/in-memory-preview-store.js +0 -72
- package/dist/store/redis-client.d.ts +0 -11
- package/dist/store/redis-client.js +0 -48
- package/dist/store/redis-oauth-broker-store.d.ts +0 -42
- package/dist/store/redis-oauth-broker-store.js +0 -167
- package/dist/store/redis-oauth-broker-store.test.js +0 -80
- package/dist/store/redis-preview-store.d.ts +0 -23
- package/dist/store/redis-preview-store.js +0 -94
- package/dist/store/redis-preview-store.test.d.ts +0 -1
- package/dist/store/redis-preview-store.test.js +0 -39
- package/dist/store/redis-session-index.d.ts +0 -33
- package/dist/store/redis-session-index.js +0 -49
- package/dist/store/types.d.ts +0 -13
- package/dist/store/types.js +0 -8
- 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 -72
- package/dist/transports/session-store.js +0 -143
- package/dist/transports/session-store.test.d.ts +0 -1
- package/dist/transports/session-store.test.js +0 -111
- /package/dist/{destructive/confirmation-claim.test.d.ts → governance/client-capabilities-cache.test.d.ts} +0 -0
- /package/dist/{store/config.test.d.ts → server/upstream-errors.test.d.ts} +0 -0
- /package/dist/{store/redis-oauth-broker-store.test.d.ts → tools/ai-agents/agents.test.d.ts} +0 -0
|
@@ -52,24 +52,180 @@ const index_js_1 = require("./index.js");
|
|
|
52
52
|
(0, vitest_1.it)('forbids space create/update and orphan chart publish', () => {
|
|
53
53
|
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
54
54
|
(0, vitest_1.expect)(md).toContain('terraform');
|
|
55
|
-
(0, vitest_1.expect)(md).toContain('
|
|
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');
|
|
56
61
|
(0, vitest_1.expect)(md).not.toMatch(/`create_space`/);
|
|
57
62
|
(0, vitest_1.expect)(md).not.toMatch(/`update_space`/);
|
|
58
63
|
(0, vitest_1.expect)(index_js_1.CONTENT_DEVELOPER_TOOL_IDS).not.toContain('create_space');
|
|
59
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');
|
|
60
68
|
});
|
|
61
|
-
(0, vitest_1.it)('
|
|
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 () => {
|
|
62
133
|
const { registerContentDeveloperPrompts } = await Promise.resolve().then(() => __importStar(require('./prompts.js')));
|
|
63
134
|
const names = [];
|
|
135
|
+
const promptArgs = [];
|
|
136
|
+
let publishText = '';
|
|
137
|
+
let authorText = '';
|
|
138
|
+
let refactorText = '';
|
|
64
139
|
const server = {
|
|
65
|
-
registerPrompt: (name) => {
|
|
140
|
+
registerPrompt: (name, _meta, handler) => {
|
|
66
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
|
+
}
|
|
67
183
|
},
|
|
68
184
|
};
|
|
69
185
|
registerContentDeveloperPrompts(server);
|
|
70
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');
|
|
71
189
|
(0, vitest_1.expect)(names).toContain('move_content');
|
|
72
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');
|
|
73
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/);
|
|
74
230
|
});
|
|
75
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).
|
|
@@ -6,10 +6,17 @@ Move charts/dashboards into **existing** spaces. Never create, rename, or update
|
|
|
6
6
|
|
|
7
7
|
## Steps
|
|
8
8
|
|
|
9
|
-
1. Discover with `list_spaces` / `get_space` / `search_content`. Confirm the **target space already exists
|
|
10
|
-
2.
|
|
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`:
|
|
11
12
|
- Required: `itemUuids`, `targetSpaceUuid` (null = project root if supported), `contentTypes` (same length/order as `itemUuids`).
|
|
12
|
-
- Optional: `chartSources` (must match lengths
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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.
|
|
@@ -2,62 +2,104 @@
|
|
|
2
2
|
|
|
3
3
|
URI: `lightdash://playbooks/content-developer/core`
|
|
4
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
|
+
|
|
5
11
|
## Hard bans
|
|
6
12
|
|
|
7
|
-
- Do not execute arbitrary metric queries, raw SQL, or
|
|
13
|
+
- Do not execute arbitrary metric queries, raw SQL, warehouse runs, or saved-chart execution (no `run_chart` here).
|
|
8
14
|
- Do not author or upsert SQL charts.
|
|
9
|
-
- Do not hard-delete, rollback, or promote content
|
|
10
|
-
- Do not perform organization administration.
|
|
11
|
-
- Do not create or update spaces — spaces are
|
|
12
|
-
- Do not
|
|
13
|
-
- Do not
|
|
14
|
-
- Do not
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
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).
|
|
18
30
|
- Do not reveal secrets, warehouse credentials, or hidden SQL.
|
|
19
31
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- `
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- `
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- `
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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 |
|
|
49
63
|
|
|
50
64
|
## Phase 0 — Resolve project
|
|
51
65
|
|
|
52
|
-
1.
|
|
53
|
-
2. Record
|
|
54
|
-
3.
|
|
55
|
-
4. Never
|
|
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.
|
|
56
95
|
|
|
57
|
-
|
|
96
|
+
### Apply arg pitfalls
|
|
58
97
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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`.
|