@lightdash-tools/mcp 0.9.0 → 0.11.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 +27 -22
- package/dist/audit/server-profile.d.ts +13 -0
- package/dist/audit/server-profile.js +28 -0
- package/dist/audit/server-profile.test.js +21 -0
- package/dist/auth/oauth-broker/pending-store.test.d.ts +1 -1
- package/dist/auth/oauth-broker/pending-store.test.js +1 -1
- package/dist/auth/request-state-key.d.ts +2 -2
- package/dist/auth/request-state-key.js +2 -2
- package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +1 -1
- package/dist/auth/resource-server/lightdash-oauth-middleware.js +1 -1
- package/dist/auth/resource-server/lightdash-oauth-middleware.test.js +14 -14
- package/dist/auth/resource-server/oauth-protected-resource.d.ts +6 -6
- package/dist/auth/resource-server/oauth-protected-resource.js +8 -8
- package/dist/auth/resource-server/token-scopes.d.ts +1 -1
- package/dist/auth/resource-server/token-scopes.js +1 -1
- package/dist/auth/resource-server/www-authenticate.test.js +11 -11
- package/dist/bin.js +54 -58
- package/dist/config/env.d.ts +3 -1
- package/dist/config/env.js +4 -2
- package/dist/config/load-mcp-config.js +8 -36
- package/dist/config/load-mcp-config.test.js +8 -2
- package/dist/config/normalize-url.d.ts +1 -1
- package/dist/config/normalize-url.js +1 -1
- package/dist/config/normalize-url.test.js +16 -16
- package/dist/config/obsolete-env.d.ts +5 -0
- package/dist/config/obsolete-env.js +48 -0
- package/dist/config/obsolete-env.test.js +22 -0
- package/dist/config/runtime.js +1 -1
- package/dist/governance/available-projects.d.ts +1 -1
- package/dist/governance/available-projects.js +1 -1
- package/dist/governance/mcp-post-factory-context.d.ts +15 -0
- package/dist/governance/mcp-post-factory-context.js +22 -0
- package/dist/governance/mcp-post-factory-context.test.js +34 -0
- package/dist/http.integration.test.js +11 -15
- package/dist/index.d.ts +5 -1
- package/dist/index.js +29 -16
- package/dist/policy/content-reader.d.ts +10 -5
- package/dist/policy/content-reader.js +23 -9
- package/dist/policy/content-reader.test.js +4 -3
- package/dist/policy/envelope.d.ts +4 -2
- package/dist/policy/envelope.js +2 -2
- package/dist/policy/envelope.test.d.ts +1 -0
- package/dist/policy/envelope.test.js +28 -0
- package/dist/profiles/ai-agent-ops/v1/index.d.ts +6 -0
- package/dist/profiles/ai-agent-ops/v1/index.js +20 -0
- package/dist/{personas → profiles}/ai-agent-ops/v1/prompts.js +2 -2
- package/dist/{personas → profiles}/ai-agent-ops/v1/prompts.test.js +2 -2
- package/dist/{personas → profiles}/ai-agent-ops/v1/resources/playbooks/core.md +1 -1
- package/dist/{personas → profiles}/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +1 -1
- package/dist/{personas → profiles}/ai-agent-ops/v1/resources/playbooks/release-gate.md +1 -1
- package/dist/{personas → profiles}/ai-agent-ops/v1/resources/playbooks.js +4 -4
- package/dist/profiles/content-developer/v1/index.d.ts +8 -0
- package/dist/profiles/content-developer/v1/index.js +22 -0
- package/dist/{personas → profiles}/content-developer/v1/prompts.js +6 -6
- package/dist/{personas → profiles}/content-developer/v1/prompts.test.js +61 -6
- package/dist/{personas → profiles}/content-developer/v1/resources/playbooks/chart-types.md +31 -16
- package/dist/{personas → profiles}/content-developer/v1/resources/playbooks/core.md +9 -5
- package/dist/{personas → profiles}/content-developer/v1/resources/playbooks/dashboard-design.md +3 -3
- package/dist/{personas → profiles}/content-developer/v1/resources/playbooks/dashboards.md +12 -7
- package/dist/{personas → profiles}/content-developer/v1/resources/playbooks.js +4 -2
- package/dist/profiles/content-governance/v1/index.d.ts +7 -0
- package/dist/profiles/content-governance/v1/index.js +21 -0
- package/dist/{personas → profiles}/content-governance/v1/prompts.test.js +2 -2
- package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/core.md +2 -2
- package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.js +4 -4
- package/dist/profiles/content-reader/v1/index.d.ts +6 -0
- package/dist/profiles/content-reader/v1/index.js +20 -0
- package/dist/{personas → profiles}/content-reader/v1/prompts.test.js +2 -2
- package/dist/{personas → profiles}/content-reader/v1/resources/playbooks/core.md +1 -1
- package/dist/{personas → profiles}/content-reader/v1/resources/playbooks/discover.md +1 -1
- package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.js +2 -2
- package/dist/profiles/data-analyst/v1/index.d.ts +6 -0
- package/dist/profiles/data-analyst/v1/index.js +20 -0
- package/dist/profiles/data-analyst/v1/prompts.d.ts +5 -0
- package/dist/profiles/data-analyst/v1/prompts.js +41 -0
- package/dist/profiles/data-analyst/v1/prompts.test.d.ts +4 -0
- package/dist/profiles/data-analyst/v1/prompts.test.js +26 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks/core.md +41 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks/explore.md +26 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks/index.md +8 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks.d.ts +10 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks.js +33 -0
- package/dist/profiles/index.d.ts +24 -0
- package/dist/profiles/index.js +73 -0
- package/dist/profiles/index.test.d.ts +1 -0
- package/dist/profiles/index.test.js +121 -0
- package/dist/{personas → profiles}/lib/playbook-resources.d.ts +8 -7
- package/dist/{personas → profiles}/lib/playbook-resources.js +15 -15
- package/dist/profiles/organization-audit/v1/index.d.ts +6 -0
- package/dist/profiles/organization-audit/v1/index.js +20 -0
- package/dist/{personas → profiles}/organization-audit/v1/prompts.test.js +2 -2
- package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.js +2 -2
- package/dist/profiles/profile.membership.test.d.ts +1 -0
- package/dist/profiles/profile.membership.test.js +36 -0
- package/dist/profiles/semantic-layer/v1/index.d.ts +6 -0
- package/dist/profiles/semantic-layer/v1/index.js +19 -0
- package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.js +2 -2
- package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.js +2 -2
- package/dist/profiles/types.d.ts +18 -0
- package/dist/{personas → profiles}/types.js +1 -1
- package/dist/protocol-contract.test.js +48 -3
- package/dist/server/capabilities.d.ts +6 -6
- package/dist/server/capabilities.js +11 -10
- package/dist/server/capabilities.test.js +8 -9
- package/dist/server/server.js +7 -7
- package/dist/stdio.process.test.js +61 -7
- package/dist/tools/ai-agents/agents.d.ts +1 -1
- package/dist/tools/ai-agents/agents.js +1 -1
- package/dist/tools/ai-agents/evaluations.d.ts +1 -1
- package/dist/tools/ai-agents/evaluations.js +1 -1
- package/dist/tools/ai-agents/helpers.d.ts +2 -3
- package/dist/tools/ai-agents/helpers.js +2 -4
- package/dist/tools/ai-agents/threads.d.ts +1 -1
- package/dist/tools/ai-agents/threads.js +1 -1
- package/dist/tools/composition/explain-content.js +3 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.test.js +16 -10
- package/dist/tools/lib/schema-fields.d.ts +2 -0
- package/dist/tools/lib/schema-fields.js +4 -1
- package/dist/tools/lib/stable-stringify.d.ts +1 -1
- package/dist/tools/lib/stable-stringify.js +1 -1
- package/dist/tools/organization/invariants.test.d.ts +1 -1
- package/dist/tools/organization/invariants.test.js +5 -5
- package/dist/tools/project/developer-content-preview.d.ts +1 -1
- package/dist/tools/project/developer-content-preview.js +1 -1
- package/dist/tools/project/developer-content-shared.d.ts +1 -1
- package/dist/tools/project/developer-content-shared.js +1 -1
- package/dist/tools/project/developer-get-chart-as-code.test.js +1 -1
- package/dist/tools/project/invariants.test.d.ts +1 -1
- package/dist/tools/project/invariants.test.js +8 -8
- package/dist/tools/project/parameters.js +8 -3
- package/dist/tools/project/projects.d.ts +1 -4
- package/dist/tools/project/projects.js +32 -12
- package/dist/tools/project/projects.test.js +30 -7
- package/dist/tools/project/reader-content.js +6 -3
- package/dist/tools/project/reader-execution.js +4 -2
- package/dist/tools/project/reader-export-chart-image.js +1 -1
- package/dist/tools/project/reader-export-chart-image.test.js +2 -2
- package/dist/tools/project/spaces.js +12 -4
- package/dist/tools/project/spaces.test.d.ts +1 -0
- package/dist/tools/project/spaces.test.js +47 -0
- package/dist/tools/query/bounded-saved-query.d.ts +4 -3
- package/dist/tools/query/bounded-saved-query.js +3 -5
- package/dist/tools/query/lifecycle.js +10 -8
- package/dist/tools/query/query-ledger.d.ts +2 -1
- package/dist/tools/query/reader-tool-helpers.d.ts +4 -2
- package/dist/tools/query/reader-tool-helpers.js +7 -2
- package/dist/tools/query/run-metric-query.d.ts +6 -0
- package/dist/tools/query/run-metric-query.js +94 -0
- package/dist/tools/query/run-metric-query.test.d.ts +4 -0
- package/dist/tools/query/run-metric-query.test.js +116 -0
- package/dist/tools/registry.d.ts +8 -8
- package/dist/tools/registry.js +10 -6
- package/dist/tools/semantic/explores.js +43 -17
- package/dist/tools/semantic/metrics.js +22 -8
- package/dist/tools/semantic/query.js +25 -17
- package/dist/tools/shared.d.ts +1 -1
- package/dist/tools/shared.js +5 -5
- package/dist/tools/shared.test.js +4 -4
- package/dist/transports/streamable-http.js +46 -36
- package/dist/transports/streamable-http.test.js +9 -9
- package/package.json +5 -5
- package/dist/audit/server-persona.d.ts +0 -10
- package/dist/audit/server-persona.js +0 -19
- package/dist/governance/client-capabilities-cache.d.ts +0 -44
- package/dist/governance/client-capabilities-cache.js +0 -142
- package/dist/governance/client-capabilities-cache.test.js +0 -148
- package/dist/personas/ai-agent-ops/v1/index.d.ts +0 -8
- package/dist/personas/ai-agent-ops/v1/index.js +0 -41
- package/dist/personas/content-developer/v1/index.d.ts +0 -10
- package/dist/personas/content-developer/v1/index.js +0 -52
- package/dist/personas/content-governance/v1/index.d.ts +0 -9
- package/dist/personas/content-governance/v1/index.js +0 -29
- package/dist/personas/content-reader/v1/index.d.ts +0 -8
- package/dist/personas/content-reader/v1/index.js +0 -38
- package/dist/personas/index.d.ts +0 -23
- package/dist/personas/index.js +0 -78
- package/dist/personas/index.test.js +0 -124
- package/dist/personas/organization-audit/v1/index.d.ts +0 -8
- package/dist/personas/organization-audit/v1/index.js +0 -42
- package/dist/personas/persona.parity.test.js +0 -30
- package/dist/personas/semantic-layer/v1/index.d.ts +0 -8
- package/dist/personas/semantic-layer/v1/index.js +0 -32
- package/dist/personas/types.d.ts +0 -19
- /package/dist/{governance/client-capabilities-cache.test.d.ts → audit/server-profile.test.d.ts} +0 -0
- /package/dist/{personas/index.test.d.ts → config/obsolete-env.test.d.ts} +0 -0
- /package/dist/{personas/persona.parity.test.d.ts → governance/mcp-post-factory-context.test.d.ts} +0 -0
- /package/dist/{personas → profiles}/ai-agent-ops/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/ai-agent-ops/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/ai-agent-ops/v1/resources/playbooks/evaluation.md +0 -0
- /package/dist/{personas → profiles}/ai-agent-ops/v1/resources/playbooks/index.md +0 -0
- /package/dist/{personas → profiles}/ai-agent-ops/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{personas → profiles}/content-developer/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/content-developer/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/content-developer/v1/resources/playbooks/content-move.md +0 -0
- /package/dist/{personas → profiles}/content-developer/v1/resources/playbooks/index.md +0 -0
- /package/dist/{personas → profiles}/content-developer/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/prompts.js +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/charts.md +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/dashboards.md +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/index.md +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/prompts.js +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/resources/playbooks/compare.md +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/resources/playbooks/explain-run.md +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/resources/playbooks/index.md +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/prompts.js +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks/access.md +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks/content.md +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks/core.md +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks/deliveries.md +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks/index.md +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/prompts.js +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks/compose-compile.md +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks/core.md +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks/explore.md +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks/index.md +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.d.ts +0 -0
|
@@ -36,13 +36,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const common_1 = require("@lightdash-tools/common");
|
|
39
40
|
const vitest_1 = require("vitest");
|
|
40
41
|
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
41
|
-
const index_js_1 = require("./index.js");
|
|
42
42
|
(0, vitest_1.describe)('content-developer prompts/playbook', () => {
|
|
43
43
|
(0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
|
|
44
44
|
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
45
|
-
for (const id of
|
|
45
|
+
for (const id of (0, common_1.listMcpToolNamesByProfile)('content-developer')) {
|
|
46
46
|
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
47
47
|
}
|
|
48
48
|
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
@@ -60,9 +60,9 @@ const index_js_1 = require("./index.js");
|
|
|
60
60
|
(0, vitest_1.expect)(md).toContain('chart-types');
|
|
61
61
|
(0, vitest_1.expect)(md).not.toMatch(/`create_space`/);
|
|
62
62
|
(0, vitest_1.expect)(md).not.toMatch(/`update_space`/);
|
|
63
|
-
(0, vitest_1.expect)(
|
|
64
|
-
(0, vitest_1.expect)(
|
|
65
|
-
(0, vitest_1.expect)(
|
|
63
|
+
(0, vitest_1.expect)((0, common_1.listMcpToolNamesByProfile)('content-developer')).not.toContain('create_space');
|
|
64
|
+
(0, vitest_1.expect)((0, common_1.listMcpToolNamesByProfile)('content-developer')).not.toContain('update_space');
|
|
65
|
+
(0, vitest_1.expect)((0, common_1.listMcpToolNamesByProfile)('content-developer')).toContain('get_chart_as_code');
|
|
66
66
|
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('dashboardslug');
|
|
67
67
|
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('skinny');
|
|
68
68
|
});
|
|
@@ -119,7 +119,29 @@ const index_js_1 = require("./index.js");
|
|
|
119
119
|
(0, vitest_1.expect)(md).toMatch(/diff\.removed|diff noise/);
|
|
120
120
|
(0, vitest_1.expect)(md).toMatch(/tiles.*diff\.removed|diff\.removed.*tiles|omit.*tiles|do \*\*not\*\* apply/);
|
|
121
121
|
(0, vitest_1.expect)(md).toContain('chartuuidorslug');
|
|
122
|
-
(0, vitest_1.expect)(md).toMatch(/
|
|
122
|
+
(0, vitest_1.expect)(md).toMatch(/profile: \s*content-developer|serving profile/);
|
|
123
|
+
});
|
|
124
|
+
(0, vitest_1.it)('documents lab/inline Batch SOP and bans SDD-only MCP click loops', () => {
|
|
125
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
126
|
+
const bans = playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase();
|
|
127
|
+
(0, vitest_1.expect)(md).toMatch(/lab \/ inline|lab\/inline|inline build/);
|
|
128
|
+
(0, vitest_1.expect)(md).toMatch(/batch sop in the same session|same session/);
|
|
129
|
+
(0, vitest_1.expect)(md).toMatch(/subagent-driven-development|writing-plans/);
|
|
130
|
+
(0, vitest_1.expect)(bans).toMatch(/subagent-driven-development|writing-plans/);
|
|
131
|
+
(0, vitest_1.expect)(bans).toMatch(/lab boards|experiments/);
|
|
132
|
+
});
|
|
133
|
+
(0, vitest_1.it)('locks identical proposed payload, preview failure taxonomy, and mid-build UUID inventory', () => {
|
|
134
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
135
|
+
const bans = playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase();
|
|
136
|
+
(0, vitest_1.expect)(md).toMatch(/identical proposed|same proposed payload|immutable.*proposed|do not (mutate|edit|change).*proposed/);
|
|
137
|
+
(0, vitest_1.expect)(bans).toMatch(/proposed payload|identical proposed|mutate.*proposed|edit.*after preview/);
|
|
138
|
+
(0, vitest_1.expect)(md).toMatch(/content hash/);
|
|
139
|
+
(0, vitest_1.expect)(md).toMatch(/preview_stale/);
|
|
140
|
+
(0, vitest_1.expect)(md).toMatch(/preview_required/);
|
|
141
|
+
(0, vitest_1.expect)(md).toMatch(/invalid or expired/);
|
|
142
|
+
(0, vitest_1.expect)(md).toMatch(/running inventory|uuid inventory|after each.*create_chart|inventory.*charts\[0\]\.data\.uuid/);
|
|
143
|
+
(0, vitest_1.expect)(md).toMatch(/batch sop|one.*update_dashboard/);
|
|
144
|
+
(0, vitest_1.expect)(md).toMatch(/avoid n single-tile|do not interleave tiling/);
|
|
123
145
|
});
|
|
124
146
|
(0, vitest_1.it)('documents improve/professionalize Spec delta, cull, and leftover handoff', () => {
|
|
125
147
|
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
@@ -129,6 +151,39 @@ const index_js_1 = require("./index.js");
|
|
|
129
151
|
(0, vitest_1.expect)(md).toMatch(/untiled|leftover/);
|
|
130
152
|
(0, vitest_1.expect)(md).toContain('content-governance');
|
|
131
153
|
});
|
|
154
|
+
(0, vitest_1.it)('keeps all-types dashboards decision-oriented and enforces chart semantics', () => {
|
|
155
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
156
|
+
(0, vitest_1.expect)(md).toMatch(/decision-oriented|decision section/);
|
|
157
|
+
(0, vitest_1.expect)(md).toMatch(/validation appendix|visualization-validation/);
|
|
158
|
+
(0, vitest_1.expect)(md).toMatch(/scatter.*two numeric|two numeric.*scatter/);
|
|
159
|
+
(0, vitest_1.expect)(md).toMatch(/funnel.*discrete stages|discrete stages.*funnel/);
|
|
160
|
+
(0, vitest_1.expect)(md).toMatch(/sankey.*source.*target.*flow/);
|
|
161
|
+
(0, vitest_1.expect)(md).toMatch(/pie.*meaningful whole|meaningful whole.*pie/);
|
|
162
|
+
(0, vitest_1.expect)(md).toMatch(/area.*total.*parts|total.*parts.*area/);
|
|
163
|
+
(0, vitest_1.expect)(md).toMatch(/gauge.*target|target.*gauge/);
|
|
164
|
+
});
|
|
165
|
+
(0, vitest_1.it)('documents every supported native map input without permitting fabricated geography', () => {
|
|
166
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
167
|
+
(0, vitest_1.expect)(md).toMatch(/iso 3166-1|iso3/);
|
|
168
|
+
(0, vitest_1.expect)(md).toMatch(/us state|state code/);
|
|
169
|
+
(0, vitest_1.expect)(md).toMatch(/latitude.*longitude|longitude.*latitude/);
|
|
170
|
+
(0, vitest_1.expect)(md).toMatch(/do not fabricate|never fabricate/);
|
|
171
|
+
});
|
|
172
|
+
(0, vitest_1.it)('documents that a legitimate scatter grain dimension is not a validate_chart defect', () => {
|
|
173
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
174
|
+
(0, vitest_1.expect)(md).toMatch(/grain dimension/);
|
|
175
|
+
(0, vitest_1.expect)(md).toMatch(/two metric axes/);
|
|
176
|
+
(0, vitest_1.expect)(md).toMatch(/validate_chart/);
|
|
177
|
+
(0, vitest_1.expect)(md).toMatch(/flag(?:s|ged)? .*unused/);
|
|
178
|
+
(0, vitest_1.expect)(md).toMatch(/do not drop the dimension|never drop the dimension/);
|
|
179
|
+
});
|
|
180
|
+
(0, vitest_1.it)('documents a canonical proxy-naming template for validation-only funnel\\/sankey charts', () => {
|
|
181
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
182
|
+
(0, vitest_1.expect)(md).toContain('<metric>');
|
|
183
|
+
(0, vitest_1.expect)(md).toContain('<type>');
|
|
184
|
+
(0, vitest_1.expect)(md).toMatch(/<funnel\/flow>/);
|
|
185
|
+
(0, vitest_1.expect)(md).toMatch(/visualization validation, not a real/);
|
|
186
|
+
});
|
|
132
187
|
(0, vitest_1.it)('does not register standalone build_chart or design_dashboard prompt', async () => {
|
|
133
188
|
const { registerContentDeveloperPrompts } = await Promise.resolve().then(() => __importStar(require('./prompts.js')));
|
|
134
189
|
const names = [];
|
|
@@ -4,23 +4,37 @@ URI: `lightdash://playbooks/content-developer/chart-types`
|
|
|
4
4
|
|
|
5
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
6
|
|
|
7
|
-
When the user **does** ask for all types: follow dashboards **Multi-viz batch SOP** (shell → ≤2 concurrent chart creates → one tile update)
|
|
7
|
+
When the user **does** ask for all types: follow dashboards **Multi-viz batch SOP** (shell → ≤2 concurrent chart creates → one tile update), split the board into a decision-oriented section plus a visualization-validation appendix (see `dashboards` / `dashboard-design`), and check every candidate type against the **semantic fit gate** below before adding it.
|
|
8
|
+
|
|
9
|
+
## Semantic fit gate
|
|
10
|
+
|
|
11
|
+
Schema acceptance is not suitability — check every type against its semantics before adding it, including in a validation appendix:
|
|
12
|
+
|
|
13
|
+
- Scatter: two numeric variables at one shared grain; a categorical x-axis is not a correlation plot.
|
|
14
|
+
- Funnel: ordered, discrete stages with a numeric count; categories such as coupon yes/no are not a funnel.
|
|
15
|
+
- Sankey: a real source → target flow plus a weight metric; unrelated dimensions do not become a flow merely because the schema accepts them.
|
|
16
|
+
- Pie: categories must form a meaningful whole; otherwise use a bar.
|
|
17
|
+
- Area: use when the total and its component parts over time both matter; a single series normally belongs in a line chart.
|
|
18
|
+
- Gauge: require a defensible bound or target; do not invent `max` from aesthetics. When no natural bound exists, use an explicitly labeled illustrative benchmark rather than inventing one silently.
|
|
19
|
+
- Map: require latitude+longitude, ISO 3166-1 alpha-3 country codes, US state codes, or an existing compatible custom-GeoJSON join field. Never fabricate geography to satisfy an all-types checklist — report the type as unsupported instead.
|
|
20
|
+
|
|
21
|
+
When an explicit all-types override still creates a funnel/Sankey (or similar) chart that fails this gate, label it as a validation-only proxy instead of skipping it — canonical template for `name`/`description`: `"<Metric> (<Type>) — Visualization Validation, Not a Real <Funnel/Flow>"` plus one sentence stating what the chart actually shows and that it is not a real funnel/flow.
|
|
8
22
|
|
|
9
23
|
## UI intent → as-code `chartConfig.type`
|
|
10
24
|
|
|
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
|
|
23
|
-
| Custom / data-app viz | out of scope unless a rendering seed exists
|
|
25
|
+
| User / UI intent | As-code |
|
|
26
|
+
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
27
|
+
| Bar / line / area / scatter / mixed | `cartesian` — series `type` is `bar` \| `line` \| `area` \| `scatter`; mixed = multiple series types |
|
|
28
|
+
| Horizontal bar | `cartesian` + `layout.flipAxes: true` + series `type: bar` |
|
|
29
|
+
| Pie / donut | `pie` (`groupFieldIds`, `metricId`; `isDonut` optional) |
|
|
30
|
+
| Funnel | `funnel` (`fieldId` metric; usually `dataInput: row` + one stage dimension) |
|
|
31
|
+
| Treemap | `treemap` (`groupFieldIds`, `sizeMetricId`) |
|
|
32
|
+
| Sankey | `sankey` (`sourceFieldId`, `targetFieldId`, `metricFieldId`; needs **two** dimensions) |
|
|
33
|
+
| Table | `table` (`config: {}` is fine; keep `tableConfig.columnOrder`) |
|
|
34
|
+
| Big value / KPI | `big_number` (`selectedField`; empty `dimensions`) |
|
|
35
|
+
| Gauge | `gauge` (`selectedField`, numeric `min`/`max` or `maxFieldId`) |
|
|
36
|
+
| Map | `map` — requires latitude/longitude, ISO 3166-1 alpha-3 or US state codes, or a custom-GeoJSON join; **skip** and report if the explore has none |
|
|
37
|
+
| Custom / data-app viz | out of scope unless a rendering seed exists |
|
|
24
38
|
|
|
25
39
|
Bar/line/area/scatter are **series** types under one `cartesian` chart — not separate top-level `chartConfig.type` values.
|
|
26
40
|
|
|
@@ -115,9 +129,10 @@ chartConfig:
|
|
|
115
129
|
## Hard rules
|
|
116
130
|
|
|
117
131
|
- 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.
|
|
132
|
+
- FieldIds only from seed / `get_chart` / semantic-layer — never invent. this profile has **no** explore/field list tools.
|
|
133
|
+
- Field IDs shown in the YAML examples below (e.g. `orders_status`) are **illustrative**, not guaranteed to exist on any given explore — verify against a seed via `get_chart_as_code` (or `get_chart`) before use.
|
|
119
134
|
- 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”).
|
|
135
|
+
- Every `metricQuery.dimensions` entry must appear in viz layout / group / sankey source-target / pivot — unused dimensions corrupt GROUP BY (“Results may be incorrect”). **Exception:** a scatter with two metric axes legitimately keeps its grain dimension (e.g. customer id) in `metricQuery.dimensions` to produce one row per entity — `validate_chart` will still flag it as "unused" because the validator only recognizes x/y-axis or group-by references, not grain-only dimensions. That warning is expected on a correct two-metric scatter; do not drop the dimension to silence it.
|
|
121
136
|
- For dashboard work set `dashboardSlug` **and** tile via `update_dashboard` (ownership alone does not place tiles).
|
|
122
137
|
- `create_chart` success body is `{ charts: [{ action, data: { uuid, slug, … } }] }` — read UUID from `charts[0].data.uuid` for tiles.
|
|
123
138
|
- Multi-viz boards: raise the new-chart budget; prefer **≤2 concurrent** preview→confirm→apply chains (hosted tunnels often 502 under heavier parallelism).
|
|
@@ -6,7 +6,7 @@ URI: `lightdash://playbooks/content-developer/core`
|
|
|
6
6
|
|
|
7
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
8
|
|
|
9
|
-
|
|
9
|
+
this profile 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
10
|
|
|
11
11
|
## Hard bans
|
|
12
12
|
|
|
@@ -24,6 +24,7 @@ This persona does **not** execute queries, compile explores, create spaces, or p
|
|
|
24
24
|
- Do not invent `fieldId`s. Copy from `get_chart_as_code` / `get_chart` (`includeQueryDefinition`) or semantic-layer.
|
|
25
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
26
|
- Do not call a write tool without a validated, unexpired HMAC `previewToken` from the matching `preview_*` then `confirm_preview`.
|
|
27
|
+
- Do not mutate the proposed payload after `preview_*` (no edits to `description`, `name`, SQL, metrics, tiles, or other fields between preview and apply) — apply must reuse the **identical proposed** body or you get `PREVIEW_STALE` (content hash mismatch). Any intentional edit requires a new `preview_*`.
|
|
27
28
|
- Do not reuse a **draft** token after confirm (confirm returns a **new** validated token) or after payload/baseline drift (`PREVIEW_STALE`).
|
|
28
29
|
- Do not unlock with a different resource's preview — `resourceKind` / `resourceKey` must match the preview exactly.
|
|
29
30
|
- Do not treat `validate_chart` / `validate_dashboard` as unlock — saved-UUID health checks only (not UI-render proof).
|
|
@@ -67,14 +68,17 @@ Record when a budget stopped you. User-requested “one of every chart type” o
|
|
|
67
68
|
2. Call `get_project`. Record UUID, name, pin, and `developerCapabilities`.
|
|
68
69
|
3. Expect execution capabilities **false** — you cannot verify query results here.
|
|
69
70
|
4. Never switch projects or invent an org project list.
|
|
70
|
-
5. Shared discovery tools (`get_dashboard`, `get_chart`, …)
|
|
71
|
+
5. Shared discovery tools (`get_dashboard`, `get_chart`, …) report `context.profile: content-developer` on this server — same serving profile as write tools.
|
|
71
72
|
|
|
72
73
|
## Preview → confirm → apply (every write)
|
|
73
74
|
|
|
74
|
-
1. `preview_*` → record `previewToken`, `previewId`, `contentHash`, `resourceKey`, `expiresAt`, diff.
|
|
75
|
+
1. `preview_*` → record `previewToken`, `previewId`, `contentHash`, `resourceKey`, `expiresAt`, diff. Treat the proposed `changes` / nested `chart` / `dashboard` object as **immutable** until apply succeeds.
|
|
75
76
|
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 **
|
|
77
|
-
4.
|
|
77
|
+
3. Apply write with the validated token, **`projectUuid`**, and the **identical proposed payload** (`dashboard:{}` / `chart:{}` nested shapes). Do **not** tidy `description`/`name`/SQL/tiles between confirm and apply — that causes `PREVIEW_STALE` (`content hash does not match the applied payload`). Keep one proposed object and reuse it; any edit → new `preview_*`.
|
|
78
|
+
4. Failure taxonomy (re-preview → confirm → apply, ≤2 retries per resource):
|
|
79
|
+
- Apply body ≠ preview → **`PREVIEW_STALE`** (`content hash` mismatch).
|
|
80
|
+
- Resource `updatedAt` / create race → **`PREVIEW_STALE`** (baseline changed).
|
|
81
|
+
- Token expired (~10 min TTL) or invalid → **`PREVIEW_REQUIRED`** (“invalid or expired”) — not a separate `PREVIEW_EXPIRED` code.
|
|
78
82
|
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
83
|
|
|
80
84
|
**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.
|
package/dist/{personas → profiles}/content-developer/v1/resources/playbooks/dashboard-design.md
RENAMED
|
@@ -34,7 +34,7 @@ Then stop and ask: proceed / amend?
|
|
|
34
34
|
|
|
35
35
|
Approval phrases: proceed, approved, go ahead, looks good, or an explicit amended plan.
|
|
36
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**
|
|
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). Split the board into a **decision-oriented** section — one best visualization per insight — plus a clearly titled **visualization-validation appendix** for required-but-redundant chart forms; the appendix relaxes the cull rule only, never field validity or semantic-fit (see chart-types **semantic fit gate**). Still skip **map** — and report it unsupported — unless the explore has latitude+longitude, ISO 3166-1 alpha-3 / US state codes, or a compatible custom-GeoJSON join field; never fabricate geography (or any field) to complete the checklist.
|
|
38
38
|
|
|
39
39
|
### Improve / professionalize Spec delta
|
|
40
40
|
|
|
@@ -48,7 +48,7 @@ Use this instead of inventing a full new-board Spec when the user asks to **prof
|
|
|
48
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
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
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
|
|
51
|
+
5. After apply: list chart UUIDs still dashboard-owned (`dashboardSlug`) but **not** tiled. Soft-delete those leftovers via **content-governance** — not this profile ([dashboard-owned charts stay off search/spaces](https://docs.lightdash.com/get-started/exploring-data/dashboards#create-a-new-chart)).
|
|
52
52
|
|
|
53
53
|
## Layout
|
|
54
54
|
|
|
@@ -150,4 +150,4 @@ Default: **no tabs**. Use only for themes / audiences / 30+ tiles ([docs tip](ht
|
|
|
150
150
|
- Filters honor explore↔filter plan (single-explore auto-apply, or `tileTargets` exclude/remap for foreign tiles).
|
|
151
151
|
- After a cull / professionalize: report untiled dashboard-owned leftovers; hand soft-delete to content-governance.
|
|
152
152
|
- Markdown / filters only if intentional — summarize them in the report.
|
|
153
|
-
-
|
|
153
|
+
- this profile cannot `run_chart`; note UI render was not verified here.
|
|
@@ -59,10 +59,11 @@ If fieldIds are unknown → stop; use semantic-layer. Do **not** hand-author min
|
|
|
59
59
|
Only when the user **explicitly** asks for every chart type (or a large multi-viz board)—not the default:
|
|
60
60
|
|
|
61
61
|
1. Raise the new-chart budget (default ≤8 is too low).
|
|
62
|
-
2.
|
|
63
|
-
3.
|
|
64
|
-
4.
|
|
65
|
-
5.
|
|
62
|
+
2. Split the board into a **decision-oriented** primary section — one best visualization per insight — plus a clearly titled **visualization-validation appendix** for required-but-redundant chart forms. The checklist relaxes the normal cull rule only in the appendix; it never relaxes field validity or semantic-fit requirements (`chart-types` **semantic fit gate**). Report an unsupported type instead of manufacturing meaningless data.
|
|
63
|
+
3. Cover: bar, horizontal bar, line, area, mixed, scatter, pie, funnel, treemap, sankey, table, big_number, gauge — each checked against the semantic fit gate; **skip map** and report it unsupported unless the explore has latitude+longitude, ISO 3166-1 alpha-3 / US state codes, or a compatible custom-GeoJSON join field. Never fabricate geography (or any other field) to force a type onto the checklist.
|
|
64
|
+
4. One-line Objective is enough when the user already listed the viz checklist + analysis goal; still map each tile to an insight id (or label demo tiles clearly). Treat that explicit ask as Design Spec approval after you restate the checklist once.
|
|
65
|
+
5. **Batch SOP:** create shell → create all charts (`dashboardSlug` set; **≤2** concurrent preview→confirm→apply chains) → after **each** successful `create_chart`, append `slug` + `charts[0].data.uuid` to a **running inventory** in the reply (mid-build progress without tiling) → **one** `update_dashboard` with full tiles + optional empty-value filters. Do not interleave tiling with chart creates. Preview failure codes (hash vs expiry) → `lightdash://playbooks/content-developer/core`. Optional `validate_chart` only on risky charts (scatter grain, SQL custom dims) — not unlock.
|
|
66
|
+
6. Cap concurrent writes at **≤2** on hosted tunnels — parallel bursts often return HTTP 502.
|
|
66
67
|
|
|
67
68
|
### Duplicate chart
|
|
68
69
|
|
|
@@ -77,10 +78,14 @@ Only when the user **explicitly** asks for every chart type (or a large multi-vi
|
|
|
77
78
|
2. Require `properties.savedChartUuid` from the chart create/duplicate result (OpenAPI `CreateDashboardChartTile`). Optional `chartSlug` is metadata only — do not tile with slug alone.
|
|
78
79
|
3. `preview_dashboard_changes` → `confirm_preview` (`resourceKey` = dashboard **UUID**, plus **`projectUuid`**) → `update_dashboard` with nested `dashboard: { name?, tiles, tabs, filters? }` matching preview `changes`.
|
|
79
80
|
|
|
80
|
-
Avoid N single-tile round-trips when you already know the layout. If preview `diff.removed` includes **`tiles`/`tabs`/`filters`**, re-preview with those arrays included — do not treat that as harmless noise (see core).
|
|
81
|
+
Avoid N single-tile round-trips when you already know the layout. Mid-build progress = running UUID inventory (+ optional validate), not an `update_dashboard` after every chart — unless the user explicitly asks to see tiles appear early (then still send full `tiles`/`tabs`/`filters`, never description-only). If preview `diff.removed` includes **`tiles`/`tabs`/`filters`**, re-preview with those arrays included — do not treat that as harmless noise (see core).
|
|
81
82
|
|
|
82
83
|
Layout, optional markdown, optional filters → `lightdash://playbooks/content-developer/dashboard-design`.
|
|
83
84
|
|
|
85
|
+
## Lab / inline build
|
|
86
|
+
|
|
87
|
+
For lab spaces (e.g. `experiments`) and other non-production content boards: after Design Spec approval, run the **Batch SOP in the same session** (shell → charts → one `update_dashboard`). Do **not** use subagent-driven-development or multi-task writing-plans solely to click MCP `preview_*` / `confirm_preview` / apply for those boards — that ceremony adds latency without changing the required write loop. Still require Spec stop, `projectUuid`, identical proposed payload, and ≤2 concurrent chains.
|
|
88
|
+
|
|
84
89
|
## Improve / refactor / duplicate dashboard
|
|
85
90
|
|
|
86
91
|
1. `get_dashboard` for structure (layout may be incomplete — rebuild intentionally).
|
|
@@ -97,7 +102,7 @@ Layout, optional markdown, optional filters → `lightdash://playbooks/content-d
|
|
|
97
102
|
- Every new chart has `dashboardSlug` set to that dashboard (not space-only orphans).
|
|
98
103
|
- Every new/updated chart is referenced by a dashboard tile that maps to an insight question.
|
|
99
104
|
- Filter↔explore plan from Spec honored (single-explore auto-apply, or foreign tiles excluded / remapped via `tileTargets`).
|
|
100
|
-
- After cull / professionalize: report untiled dashboard-owned chart UUIDs; soft-delete via **content-governance** (not this
|
|
101
|
-
- Report dashboard UUID/slug, tiles, and chart UUIDs/slugs; note execution was unavailable on this
|
|
105
|
+
- After cull / professionalize: report untiled dashboard-owned chart UUIDs; soft-delete via **content-governance** (not this profile).
|
|
106
|
+
- Report dashboard UUID/slug, tiles, and chart UUIDs/slugs; note execution was unavailable on this profile.
|
|
102
107
|
- Do not promote from here — content-governance when ready.
|
|
103
108
|
- Layout / optional markdown / optional filters quality → `lightdash://playbooks/content-developer/dashboard-design`.
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS = exports.CONTENT_DEVELOPER_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_DEVELOPER_HARD_BANS = void 0;
|
|
7
7
|
exports.registerContentDeveloperPlaybook = registerContentDeveloperPlaybook;
|
|
8
8
|
const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
|
|
9
|
-
const playbooks = (0, playbook_resources_js_1.
|
|
10
|
-
|
|
9
|
+
const playbooks = (0, playbook_resources_js_1.defineProfilePlaybooks)({
|
|
10
|
+
profileId: 'content-developer',
|
|
11
11
|
moduleDir: __dirname,
|
|
12
12
|
hardBans: `Do not execute arbitrary metric queries, raw SQL, warehouse runs, or saved-chart execution.
|
|
13
13
|
Do not author or upsert SQL charts.
|
|
@@ -23,8 +23,10 @@ Do not treat chart create as done without a dashboard shell and tiles.
|
|
|
23
23
|
Do not invent fieldIds — clone via get_chart_as_code / get_chart or use semantic-layer.
|
|
24
24
|
Do not invent skinny chartConfig — clone a working as-code body and keep series/layout/encode.
|
|
25
25
|
Do not apply a write tool without a confirmed, unexpired HMAC previewToken from the matching preview_* tool (confirm_preview unlocks every write; use the new validated token).
|
|
26
|
+
Do not mutate the proposed payload after preview_* (description/name/SQL/metrics/tiles) — apply must reuse the identical proposed body or PREVIEW_STALE (content hash mismatch); any edit requires a new preview_*.
|
|
26
27
|
Do not treat validate_chart / validate_dashboard as a preview unlock — they are saved-UUID health checks only (validate_chart needs chartUuid).
|
|
27
28
|
Do not reuse a draft previewToken after confirm; re-run preview if the resource drifts (PREVIEW_STALE).
|
|
29
|
+
Do not use subagent-driven-development or multi-task writing-plans solely to click MCP preview/confirm/apply for lab boards (e.g. experiments) — after Design Spec approval, run Batch SOP inline in the same session.
|
|
28
30
|
Do not reveal secrets, warehouse credentials, or hidden SQL.`,
|
|
29
31
|
coreDescription: 'Hard bans, tools, project scope, preview gate, and apply pitfalls',
|
|
30
32
|
topics: [
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-governance profile: elicitation-gated soft-delete and dashboard promote
|
|
3
|
+
* (ADR-0015 / ADR-0017). Permanent purge and chart/SQL promote stay off MCP.
|
|
4
|
+
*/
|
|
5
|
+
import type { ProfileDefinition } from '../../types.js';
|
|
6
|
+
export declare const CONTENT_GOVERNANCE_PROFILE_PATH: "/content-governance/v1/mcp";
|
|
7
|
+
export declare const contentGovernanceProfile: ProfileDefinition;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-governance profile: elicitation-gated soft-delete and dashboard promote
|
|
4
|
+
* (ADR-0015 / ADR-0017). Permanent purge and chart/SQL promote stay off MCP.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.contentGovernanceProfile = exports.CONTENT_GOVERNANCE_PROFILE_PATH = void 0;
|
|
8
|
+
const prompts_js_1 = require("./prompts.js");
|
|
9
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
10
|
+
exports.CONTENT_GOVERNANCE_PROFILE_PATH = '/content-governance/v1/mcp';
|
|
11
|
+
exports.contentGovernanceProfile = {
|
|
12
|
+
id: 'content-governance',
|
|
13
|
+
path: exports.CONTENT_GOVERNANCE_PROFILE_PATH,
|
|
14
|
+
serverName: 'lightdash-mcp-gov',
|
|
15
|
+
registerPrompts: (server) => {
|
|
16
|
+
(0, prompts_js_1.registerContentGovernancePrompts)(server);
|
|
17
|
+
},
|
|
18
|
+
registerResources: (server) => {
|
|
19
|
+
(0, playbooks_js_1.registerContentGovernancePlaybook)(server);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -36,13 +36,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const common_1 = require("@lightdash-tools/common");
|
|
39
40
|
const vitest_1 = require("vitest");
|
|
40
41
|
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
41
|
-
const index_js_1 = require("./index.js");
|
|
42
42
|
(0, vitest_1.describe)('content-governance prompts/playbook', () => {
|
|
43
43
|
(0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
|
|
44
44
|
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
45
|
-
for (const id of
|
|
45
|
+
for (const id of (0, common_1.listMcpToolNamesByProfile)('content-governance')) {
|
|
46
46
|
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
47
47
|
}
|
|
48
48
|
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
@@ -9,7 +9,7 @@ URI: `lightdash://playbooks/content-governance/core`
|
|
|
9
9
|
- Do not soft-delete or promote without **form elicitation** — never invent `confirmed: true` or treat chat "please confirm" as approval.
|
|
10
10
|
- Do not bypass the elicitation gate when the client lacks form elicitation (`ELICITATION_REQUIRED`).
|
|
11
11
|
- Do not promote charts or SQL charts via MCP (dashboard-first only). Upstream is the project's Data Ops setting — do not invent a target project UUID.
|
|
12
|
-
- Do not restore, author, compile queries, or execute warehouse SQL from this
|
|
12
|
+
- Do not restore, author, compile queries, or execute warehouse SQL from this profile.
|
|
13
13
|
- Do not reveal secrets, warehouse credentials, or hidden SQL.
|
|
14
14
|
|
|
15
15
|
## Tools
|
|
@@ -27,7 +27,7 @@ One mutating tool call → one resource → one elicitation → one API call. No
|
|
|
27
27
|
|
|
28
28
|
1. Require a resolved project: HTTP `X-Lightdash-Project` pin or explicit `projectUuid` on the tool.
|
|
29
29
|
2. Stop when project scope is unresolved (`PROJECT_SCOPE_REQUIRED`).
|
|
30
|
-
3. Never enumerate organization projects from this
|
|
30
|
+
3. Never enumerate organization projects from this profile (no `list_projects`).
|
|
31
31
|
|
|
32
32
|
## Soft-delete elicitation SOP
|
|
33
33
|
|
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS = exports.CONTENT_GOVERNANCE_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_GOVERNANCE_HARD_BANS = void 0;
|
|
7
7
|
exports.registerContentGovernancePlaybook = registerContentGovernancePlaybook;
|
|
8
8
|
const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
|
|
9
|
-
const playbooks = (0, playbook_resources_js_1.
|
|
10
|
-
|
|
9
|
+
const playbooks = (0, playbook_resources_js_1.defineProfilePlaybooks)({
|
|
10
|
+
profileId: 'content-governance',
|
|
11
11
|
moduleDir: __dirname,
|
|
12
12
|
hardBans: `Do not permanently purge soft-deleted content.
|
|
13
13
|
Do not delete spaces or perform bulk delete.
|
|
14
14
|
Do not soft-delete or promote without form elicitation (never invent confirmed: true or chat-only approval).
|
|
15
|
-
Do not expose deletes/promote on other
|
|
15
|
+
Do not expose deletes/promote on other profiles or bypass the elicitation gate.
|
|
16
16
|
Do not promote charts or SQL charts via MCP (dashboard-first only).
|
|
17
|
-
Do not restore, author, or execute warehouse queries from this
|
|
17
|
+
Do not restore, author, or execute warehouse queries from this profile.
|
|
18
18
|
Do not reveal secrets, warehouse credentials, or hidden SQL.`,
|
|
19
19
|
coreDescription: 'Hard bans, elicitation SOP, tools, and project scope',
|
|
20
20
|
topics: [
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-reader profile: saved-content discovery + bounded execution.
|
|
3
|
+
*/
|
|
4
|
+
import type { ProfileDefinition } from '../../types.js';
|
|
5
|
+
export declare const CONTENT_READER_PROFILE_PATH: "/content-reader/v1/mcp";
|
|
6
|
+
export declare const contentReaderProfile: ProfileDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-reader profile: saved-content discovery + bounded execution.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.contentReaderProfile = exports.CONTENT_READER_PROFILE_PATH = void 0;
|
|
7
|
+
const prompts_js_1 = require("./prompts.js");
|
|
8
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
9
|
+
exports.CONTENT_READER_PROFILE_PATH = '/content-reader/v1/mcp';
|
|
10
|
+
exports.contentReaderProfile = {
|
|
11
|
+
id: 'content-reader',
|
|
12
|
+
path: exports.CONTENT_READER_PROFILE_PATH,
|
|
13
|
+
serverName: 'lightdash-mcp-content',
|
|
14
|
+
registerPrompts: (server) => {
|
|
15
|
+
(0, prompts_js_1.registerContentReaderPrompts)(server);
|
|
16
|
+
},
|
|
17
|
+
registerResources: (server) => {
|
|
18
|
+
(0, playbooks_js_1.registerContentReaderPlaybook)(server);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Content-reader prompt/playbook invariants.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const common_1 = require("@lightdash-tools/common");
|
|
6
7
|
const vitest_1 = require("vitest");
|
|
7
8
|
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
8
|
-
const index_js_1 = require("./index.js");
|
|
9
9
|
(0, vitest_1.describe)('content-reader prompts/playbook', () => {
|
|
10
10
|
(0, vitest_1.it)('playbook references only registered tool short ids', () => {
|
|
11
11
|
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
12
|
-
for (const id of
|
|
12
|
+
for (const id of (0, common_1.listMcpToolNamesByProfile)('content-reader')) {
|
|
13
13
|
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
14
14
|
}
|
|
15
15
|
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
@@ -57,7 +57,7 @@ Record budget / pagination / truncation stops in the answer.
|
|
|
57
57
|
|
|
58
58
|
1. Always pass **`projectUuid`** (or rely on HTTP `X-Lightdash-Project` pin). Without either → `PROJECT_SCOPE_REQUIRED`; stop.
|
|
59
59
|
2. Call `get_project`. Record UUID, name, `context.projectPinned`, and `readerCapabilities` (`canExecuteSavedCharts`, `canExecuteSqlCharts`, `canExecuteDashboardTiles`).
|
|
60
|
-
3. There is **no** org-wide project list on this
|
|
60
|
+
3. There is **no** org-wide project list on this profile — never invent one.
|
|
61
61
|
|
|
62
62
|
## Answer shape
|
|
63
63
|
|
|
@@ -11,7 +11,7 @@ Map the user request to: find / explain / retrieve values / summarize dashboard
|
|
|
11
11
|
1. Prefer **short, high-signal tokens** that appear in titles (product names, Japanese KPI words). Multi-word English phrases often return **zero** hits even when related content exists.
|
|
12
12
|
2. If the first query is empty, try: alternate language tokens, a single keyword, `spaceUuids` / `parentSpaceUuid`, or browse with `sortBy=views` + `sortDirection=desc` (optional empty/`query` omitted) and then refine.
|
|
13
13
|
3. Always set `pageSize` (≤25). Prefer `contentTypes` when the user asked for charts vs dashboards.
|
|
14
|
-
4. Read `source` on chart hits: `dbt_explore` (or similar semantic) vs `sql`. Treat `sql` as **not executable** on this
|
|
14
|
+
4. Read `source` on chart hits: `dbt_explore` (or similar semantic) vs `sql`. Treat `sql` as **not executable** on this profile.
|
|
15
15
|
5. Ranking heuristics when relevance ties:
|
|
16
16
|
- Higher `views` / pinned (`pinnedList` non-null)
|
|
17
17
|
- Richer description / clearer name match
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CONTENT_READER_TOPIC_PLAYBOOKS = exports.CONTENT_READER_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_READER_HARD_BANS = void 0;
|
|
7
7
|
exports.registerContentReaderPlaybook = registerContentReaderPlaybook;
|
|
8
8
|
const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
|
|
9
|
-
const playbooks = (0, playbook_resources_js_1.
|
|
10
|
-
|
|
9
|
+
const playbooks = (0, playbook_resources_js_1.defineProfilePlaybooks)({
|
|
10
|
+
profileId: 'content-reader',
|
|
11
11
|
moduleDir: __dirname,
|
|
12
12
|
hardBans: `Do not mutate Lightdash resources.
|
|
13
13
|
Do not execute arbitrary metric queries, raw SQL, or underlying-data queries.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data-analyst profile: explore discovery + ad-hoc metric-query execution (ADR-0020).
|
|
3
|
+
*/
|
|
4
|
+
import type { ProfileDefinition } from '../../types.js';
|
|
5
|
+
export declare const DATA_ANALYST_PROFILE_PATH: "/data-analyst/v1/mcp";
|
|
6
|
+
export declare const dataAnalystProfile: ProfileDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Data-analyst profile: explore discovery + ad-hoc metric-query execution (ADR-0020).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.dataAnalystProfile = exports.DATA_ANALYST_PROFILE_PATH = void 0;
|
|
7
|
+
const prompts_js_1 = require("./prompts.js");
|
|
8
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
9
|
+
exports.DATA_ANALYST_PROFILE_PATH = '/data-analyst/v1/mcp';
|
|
10
|
+
exports.dataAnalystProfile = {
|
|
11
|
+
id: 'data-analyst',
|
|
12
|
+
path: exports.DATA_ANALYST_PROFILE_PATH,
|
|
13
|
+
serverName: 'lightdash-mcp-analyst',
|
|
14
|
+
registerPrompts: (server) => {
|
|
15
|
+
(0, prompts_js_1.registerDataAnalystPrompts)(server);
|
|
16
|
+
},
|
|
17
|
+
registerResources: (server) => {
|
|
18
|
+
(0, playbooks_js_1.registerDataAnalystPlaybook)(server);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP prompts for data-analyst workflows.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerDataAnalystPrompts = registerDataAnalystPrompts;
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-deprecated -- matches other profile prompt registration pattern */
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const schema_fields_js_1 = require("../../../tools/lib/schema-fields.js");
|
|
10
|
+
const playbook_resources_js_1 = require("../../lib/playbook-resources.js");
|
|
11
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
12
|
+
const userMessages = (0, playbook_resources_js_1.createPromptPlaybookEmbedder)({
|
|
13
|
+
core: playbooks_js_1.DATA_ANALYST_CORE_PLAYBOOK,
|
|
14
|
+
topics: playbooks_js_1.DATA_ANALYST_TOPIC_PLAYBOOKS,
|
|
15
|
+
});
|
|
16
|
+
function registerDataAnalystPrompts(server) {
|
|
17
|
+
server.registerPrompt('explore_data', {
|
|
18
|
+
title: 'Explore data',
|
|
19
|
+
description: 'Explore a Lightdash project with unsaved metric queries (dimensions, metrics, filters) — do not save charts',
|
|
20
|
+
argsSchema: {
|
|
21
|
+
projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
|
|
22
|
+
question: zod_1.z.string(),
|
|
23
|
+
exploreHint: zod_1.z.string().optional(),
|
|
24
|
+
},
|
|
25
|
+
}, ({ projectUuid, question, exploreHint }) => userMessages(`Answer this data question by exploring the semantic layer and running unsaved metric queries:
|
|
26
|
+
|
|
27
|
+
${question}
|
|
28
|
+
|
|
29
|
+
${playbooks_js_1.DATA_ANALYST_HARD_BANS}
|
|
30
|
+
|
|
31
|
+
Project: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : '(use HTTP pin or ask for projectUuid — PROJECT_SCOPE_REQUIRED otherwise)'}.
|
|
32
|
+
Explore hint: ${exploreHint !== null && exploreHint !== void 0 ? exploreHint : '(discover with list_explores search+limit)'}.
|
|
33
|
+
|
|
34
|
+
Procedure:
|
|
35
|
+
1. get_project; record analystCapabilities.
|
|
36
|
+
2. list_explores (search+limit≤15) → get_explore → lock exploreName.
|
|
37
|
+
3. Copy fieldIds from list_dimensions / list_metrics (or get_explore base-table metrics). Never invent fieldIds.
|
|
38
|
+
4. Optional compile_query; then run_metric_query with small limit. Poll get_query_result if needed.
|
|
39
|
+
5. Iterate filters/fields. Do not save charts unless the user asks.`, 'explore'));
|
|
40
|
+
}
|
|
41
|
+
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Data-analyst prompt/playbook invariants.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const common_1 = require("@lightdash-tools/common");
|
|
7
|
+
const vitest_1 = require("vitest");
|
|
8
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
9
|
+
(0, vitest_1.describe)('data-analyst prompts/playbook', () => {
|
|
10
|
+
(0, vitest_1.it)('playbook references registered tools and hard bans', () => {
|
|
11
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
12
|
+
for (const id of (0, common_1.listMcpToolNamesByProfile)('data-analyst')) {
|
|
13
|
+
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
14
|
+
}
|
|
15
|
+
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
16
|
+
(0, vitest_1.expect)(playbooks_js_1.DATA_ANALYST_HARD_BANS.toLowerCase()).toContain('raw sql');
|
|
17
|
+
(0, vitest_1.expect)(playbooks_js_1.DATA_ANALYST_HARD_BANS.toLowerCase()).toContain('mutate');
|
|
18
|
+
(0, vitest_1.expect)(md.toLowerCase()).toContain('tablecalculations');
|
|
19
|
+
});
|
|
20
|
+
(0, vitest_1.it)('explore playbook requires fieldIds and forbids saving charts by default', () => {
|
|
21
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
22
|
+
(0, vitest_1.expect)(md).toContain('run_metric_query');
|
|
23
|
+
(0, vitest_1.expect)(md).toContain('fieldid');
|
|
24
|
+
(0, vitest_1.expect)(md).toContain('without saving');
|
|
25
|
+
});
|
|
26
|
+
});
|