@lightdash-tools/mcp 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -170
- package/dist/audit/server-persona.d.ts +10 -0
- package/dist/audit/server-persona.js +19 -0
- package/dist/auth/oauth-broker/pending-store.d.ts +69 -19
- package/dist/auth/oauth-broker/pending-store.js +52 -26
- package/dist/auth/oauth-broker/pending-store.test.d.ts +5 -0
- package/dist/auth/oauth-broker/pending-store.test.js +109 -0
- package/dist/auth/oauth-broker/routes.d.ts +6 -2
- package/dist/auth/oauth-broker/routes.js +25 -20
- package/dist/auth/oauth-broker/routes.test.js +33 -28
- package/dist/auth/request-state-key.d.ts +19 -0
- package/dist/auth/request-state-key.js +49 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +0 -2
- package/dist/auth/resource-server/lightdash-oauth-middleware.js +0 -19
- package/dist/auth/resource-server/www-authenticate.test.js +12 -8
- package/dist/bin.js +30 -2
- package/dist/config/env.d.ts +5 -8
- package/dist/config/env.js +6 -9
- package/dist/config/load-mcp-config.d.ts +0 -4
- package/dist/config/load-mcp-config.js +8 -5
- package/dist/config/load-mcp-config.test.js +7 -0
- package/dist/config/normalize-url.test.js +16 -7
- package/dist/config/runtime.d.ts +3 -3
- package/dist/config/runtime.js +19 -23
- package/dist/config/runtime.test.js +23 -9
- package/dist/config/test-mcp-http-config.js +1 -1
- package/dist/destructive/capability.d.ts +13 -0
- package/dist/destructive/capability.js +37 -0
- package/dist/destructive/capability.test.js +46 -0
- package/dist/destructive/confirmation.d.ts +58 -0
- package/dist/destructive/confirmation.js +99 -0
- package/dist/destructive/confirmation.test.d.ts +1 -0
- package/dist/destructive/confirmation.test.js +75 -0
- package/dist/destructive/content-promote.d.ts +8 -0
- package/dist/destructive/content-promote.js +150 -0
- package/dist/destructive/content-soft-delete.d.ts +7 -0
- package/dist/destructive/content-soft-delete.js +106 -0
- package/dist/destructive/destructive-contract.test.d.ts +1 -0
- package/dist/destructive/destructive-contract.test.js +269 -0
- package/dist/destructive/precondition.d.ts +14 -0
- package/dist/destructive/precondition.js +31 -0
- package/dist/destructive/precondition.test.d.ts +1 -0
- package/dist/destructive/precondition.test.js +72 -0
- package/dist/destructive/promote-contract.test.d.ts +1 -0
- package/dist/destructive/promote-contract.test.js +398 -0
- package/dist/destructive/register-destructive-tool.d.ts +54 -0
- package/dist/destructive/register-destructive-tool.js +283 -0
- package/dist/destructive/request-state.d.ts +12 -0
- package/dist/destructive/request-state.js +41 -0
- package/dist/destructive/types.d.ts +65 -0
- package/dist/destructive/types.js +10 -0
- package/dist/governance/available-projects.d.ts +37 -0
- package/dist/governance/available-projects.js +132 -0
- package/dist/governance/available-projects.test.d.ts +4 -0
- package/dist/governance/available-projects.test.js +107 -0
- package/dist/governance/client-capabilities-cache.d.ts +44 -0
- package/dist/governance/client-capabilities-cache.js +142 -0
- package/dist/governance/client-capabilities-cache.test.d.ts +1 -0
- package/dist/governance/client-capabilities-cache.test.js +148 -0
- package/dist/governance/mcp-client-session.d.ts +10 -0
- package/dist/governance/mcp-client-session.js +31 -0
- package/dist/governance/mcp-client-session.test.d.ts +1 -0
- package/dist/governance/mcp-client-session.test.js +31 -0
- package/dist/governance/project-scope.d.ts +24 -0
- package/dist/governance/project-scope.js +71 -0
- package/dist/governance/project-scope.test.d.ts +4 -0
- package/dist/governance/project-scope.test.js +80 -0
- package/dist/governance/promote-allowlist.d.ts +18 -0
- package/dist/governance/promote-allowlist.js +66 -0
- package/dist/governance/promote-allowlist.test.d.ts +4 -0
- package/dist/governance/promote-allowlist.test.js +87 -0
- package/dist/http.integration.test.js +151 -262
- package/dist/http.test.js +0 -12
- package/dist/index.integration.test.js +0 -4
- package/dist/index.js +3 -1
- package/dist/personas/ai-agent-ops/v1/index.d.ts +8 -0
- package/dist/personas/ai-agent-ops/v1/index.js +41 -0
- package/dist/personas/ai-agent-ops/v1/prompts.d.ts +5 -0
- package/dist/personas/ai-agent-ops/v1/prompts.js +141 -0
- package/dist/personas/ai-agent-ops/v1/prompts.test.d.ts +4 -0
- package/dist/personas/ai-agent-ops/v1/prompts.test.js +26 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/ai-agent-ops/v1/resources/playbooks.js +41 -0
- package/dist/personas/content-developer/v1/index.d.ts +10 -0
- package/dist/personas/content-developer/v1/index.js +52 -0
- package/dist/personas/content-developer/v1/prompts.d.ts +8 -0
- package/dist/personas/content-developer/v1/prompts.js +157 -0
- package/dist/personas/content-developer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-developer/v1/prompts.test.js +231 -0
- package/dist/personas/content-developer/v1/resources/playbooks/chart-types.md +123 -0
- package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +22 -0
- package/dist/personas/content-developer/v1/resources/playbooks/core.md +105 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +103 -0
- package/dist/personas/content-developer/v1/resources/playbooks/index.md +15 -0
- package/dist/personas/content-developer/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-developer/v1/resources/playbooks.js +63 -0
- package/dist/personas/content-governance/v1/index.d.ts +9 -0
- package/dist/personas/content-governance/v1/index.js +29 -0
- package/dist/personas/content-governance/v1/prompts.d.ts +5 -0
- package/dist/personas/content-governance/v1/prompts.js +87 -0
- package/dist/personas/content-governance/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-governance/v1/prompts.test.js +75 -0
- package/dist/personas/content-governance/v1/resources/playbooks/charts.md +29 -0
- package/dist/personas/content-governance/v1/resources/playbooks/core.md +52 -0
- package/dist/personas/content-governance/v1/resources/playbooks/dashboards.md +48 -0
- package/dist/personas/content-governance/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/content-governance/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-governance/v1/resources/playbooks.js +41 -0
- package/dist/personas/content-reader/v1/index.d.ts +8 -0
- package/dist/personas/content-reader/v1/index.js +38 -0
- package/dist/personas/content-reader/v1/prompts.d.ts +5 -0
- package/dist/personas/content-reader/v1/prompts.js +162 -0
- package/dist/personas/content-reader/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-reader/v1/prompts.test.js +25 -0
- package/dist/personas/content-reader/v1/resources/playbooks/compare.md +36 -0
- package/dist/personas/content-reader/v1/resources/playbooks/core.md +67 -0
- package/dist/personas/content-reader/v1/resources/playbooks/discover.md +35 -0
- package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +49 -0
- package/dist/personas/content-reader/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/content-reader/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-reader/v1/resources/playbooks.js +49 -0
- package/dist/personas/index.d.ts +4 -0
- package/dist/personas/index.js +31 -10
- package/dist/personas/index.test.js +92 -26
- package/dist/personas/lib/playbook-resources.d.ts +80 -0
- package/dist/personas/lib/playbook-resources.js +169 -0
- package/dist/personas/organization-audit/v1/index.js +2 -2
- package/dist/personas/organization-audit/v1/prompts.js +79 -66
- package/dist/personas/organization-audit/v1/prompts.test.js +4 -4
- package/dist/personas/organization-audit/v1/resources/playbooks/access.md +21 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/content.md +19 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/core.md +69 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +14 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.js +41 -0
- package/dist/personas/persona.parity.test.d.ts +1 -0
- package/dist/personas/persona.parity.test.js +30 -0
- package/dist/personas/semantic-layer/v1/index.js +2 -2
- package/dist/personas/semantic-layer/v1/prompts.js +56 -67
- package/dist/personas/semantic-layer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/semantic-layer/v1/prompts.test.js +19 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +60 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +71 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +79 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.d.ts +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.js +39 -0
- package/dist/personas/types.d.ts +1 -1
- package/dist/policy/content-developer.d.ts +35 -0
- package/dist/policy/content-developer.js +91 -0
- package/dist/policy/content-developer.test.d.ts +4 -0
- package/dist/policy/content-developer.test.js +54 -0
- package/dist/policy/content-reader.d.ts +28 -0
- package/dist/policy/content-reader.js +67 -0
- package/dist/policy/content-reader.test.d.ts +4 -0
- package/dist/policy/content-reader.test.js +23 -0
- package/dist/policy/envelope.d.ts +31 -0
- package/dist/policy/envelope.js +24 -0
- package/dist/policy/preview-ledger-fault.test.d.ts +1 -0
- package/dist/policy/preview-ledger-fault.test.js +202 -0
- package/dist/policy/preview-ledger.d.ts +82 -0
- package/dist/policy/preview-ledger.js +165 -0
- package/dist/policy/preview-ledger.test.d.ts +1 -0
- package/dist/policy/preview-ledger.test.js +393 -0
- package/dist/policy/result-limits.d.ts +32 -0
- package/dist/policy/result-limits.js +106 -0
- package/dist/policy/result-limits.test.d.ts +4 -0
- package/dist/policy/result-limits.test.js +37 -0
- package/dist/server/capabilities.js +3 -1
- package/dist/server/capabilities.test.js +5 -1
- package/dist/server/server.js +16 -1
- package/dist/server/upstream-errors.d.ts +17 -0
- package/dist/server/upstream-errors.js +60 -0
- package/dist/server/upstream-errors.test.d.ts +1 -0
- package/dist/server/upstream-errors.test.js +50 -0
- package/dist/stdio.process.test.js +150 -0
- package/dist/tools/ai-agents/agents.d.ts +7 -0
- package/dist/tools/ai-agents/agents.js +32 -0
- package/dist/tools/ai-agents/agents.test.d.ts +1 -0
- package/dist/tools/ai-agents/agents.test.js +176 -0
- package/dist/tools/ai-agents/discovery.d.ts +9 -0
- package/dist/tools/ai-agents/discovery.js +73 -0
- package/dist/tools/ai-agents/evaluations.d.ts +14 -0
- package/dist/tools/ai-agents/evaluations.js +177 -0
- package/dist/tools/ai-agents/helpers.d.ts +64 -0
- package/dist/tools/ai-agents/helpers.js +323 -0
- package/dist/tools/ai-agents/threads.d.ts +7 -0
- package/dist/tools/ai-agents/threads.js +40 -0
- package/dist/tools/composition/explain-content.d.ts +6 -0
- package/dist/tools/composition/explain-content.js +108 -0
- package/dist/tools/lib/api-errors.d.ts +2 -0
- package/dist/tools/lib/api-errors.js +5 -0
- package/dist/tools/lib/stable-stringify.d.ts +9 -0
- package/dist/tools/lib/stable-stringify.js +35 -0
- package/dist/tools/organization/inventory.js +2 -1
- package/dist/tools/project/content.js +5 -1
- package/dist/tools/project/delete-chart.d.ts +4 -0
- package/dist/tools/project/delete-chart.js +8 -0
- package/dist/tools/project/delete-dashboard.d.ts +4 -0
- package/dist/tools/project/delete-dashboard.js +8 -0
- package/dist/tools/project/developer-content-preview.d.ts +13 -0
- package/dist/tools/project/developer-content-preview.js +291 -0
- package/dist/tools/project/developer-content-shared.d.ts +24 -0
- package/dist/tools/project/developer-content-shared.js +50 -0
- package/dist/tools/project/developer-content-shared.test.d.ts +1 -0
- package/dist/tools/project/developer-content-shared.test.js +25 -0
- package/dist/tools/project/developer-content.d.ts +38 -0
- package/dist/tools/project/developer-content.js +589 -0
- package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
- package/dist/tools/project/developer-get-chart-as-code.js +39 -0
- package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
- package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
- package/dist/tools/project/developer-helpers.d.ts +180 -0
- package/dist/tools/project/developer-helpers.js +484 -0
- package/dist/tools/project/developer-helpers.test.d.ts +1 -0
- package/dist/tools/project/developer-helpers.test.js +509 -0
- package/dist/tools/project/get-dashboard-promote-diff.d.ts +6 -0
- package/dist/tools/project/get-dashboard-promote-diff.js +52 -0
- package/dist/tools/project/invariants.test.d.ts +4 -0
- package/dist/tools/project/invariants.test.js +44 -0
- package/dist/tools/project/parameters.d.ts +7 -0
- package/dist/tools/project/parameters.js +74 -0
- package/dist/tools/project/projects.d.ts +4 -1
- package/dist/tools/project/projects.js +68 -6
- package/dist/tools/project/projects.test.js +77 -1
- package/dist/tools/project/promote-dashboard.d.ts +4 -0
- package/dist/tools/project/promote-dashboard.js +8 -0
- package/dist/tools/project/reader-content.d.ts +9 -0
- package/dist/tools/project/reader-content.js +208 -0
- package/dist/tools/project/reader-execution.d.ts +7 -0
- package/dist/tools/project/reader-execution.js +214 -0
- package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
- package/dist/tools/project/reader-export-chart-image.js +78 -0
- package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
- package/dist/tools/project/reader-export-chart-image.test.js +149 -0
- package/dist/tools/project/schemas/chart-upsert.d.ts +33 -0
- package/dist/tools/project/schemas/chart-upsert.js +66 -0
- package/dist/tools/project/schemas/dashboard-tile.d.ts +29 -0
- package/dist/tools/project/schemas/dashboard-tile.js +57 -0
- package/dist/tools/project/schemas/dashboard.d.ts +70 -0
- package/dist/tools/project/schemas/dashboard.js +101 -0
- package/dist/tools/project/schemas/duplicate.d.ts +30 -0
- package/dist/tools/project/schemas/duplicate.js +86 -0
- package/dist/tools/project/schemas/index.d.ts +7 -0
- package/dist/tools/project/schemas/index.js +26 -0
- package/dist/tools/project/schemas/parse-helpers.d.ts +14 -0
- package/dist/tools/project/schemas/parse-helpers.js +34 -0
- package/dist/tools/project/schemas/payload-schemas.test.d.ts +1 -0
- package/dist/tools/project/schemas/payload-schemas.test.js +204 -0
- package/dist/tools/project/spaces.d.ts +7 -0
- package/dist/tools/project/spaces.js +101 -0
- package/dist/tools/query/bounded-saved-query.d.ts +37 -0
- package/dist/tools/query/bounded-saved-query.js +80 -0
- package/dist/tools/query/bounded-saved-query.test.d.ts +4 -0
- package/dist/tools/query/bounded-saved-query.test.js +82 -0
- package/dist/tools/query/chart-source.d.ts +10 -0
- package/dist/tools/query/chart-source.js +36 -0
- package/dist/tools/query/chart-source.test.d.ts +1 -0
- package/dist/tools/query/chart-source.test.js +62 -0
- package/dist/tools/query/filter-overrides.d.ts +34 -0
- package/dist/tools/query/filter-overrides.js +75 -0
- package/dist/tools/query/filter-overrides.test.d.ts +1 -0
- package/dist/tools/query/filter-overrides.test.js +21 -0
- package/dist/tools/query/lifecycle.d.ts +7 -0
- package/dist/tools/query/lifecycle.js +104 -0
- package/dist/tools/query/query-ledger.d.ts +41 -0
- package/dist/tools/query/query-ledger.js +92 -0
- package/dist/tools/query/query-ledger.test.d.ts +1 -0
- package/dist/tools/query/query-ledger.test.js +75 -0
- package/dist/tools/query/reader-tool-helpers.d.ts +12 -0
- package/dist/tools/query/reader-tool-helpers.js +57 -0
- package/dist/tools/query/reader-tool-helpers.test.d.ts +1 -0
- package/dist/tools/query/reader-tool-helpers.test.js +53 -0
- package/dist/tools/query/result-normalizer.d.ts +27 -0
- package/dist/tools/query/result-normalizer.js +133 -0
- package/dist/tools/query/result-normalizer.test.d.ts +1 -0
- package/dist/tools/query/result-normalizer.test.js +41 -0
- package/dist/tools/query/wait-for-async.d.ts +10 -0
- package/dist/tools/query/wait-for-async.js +46 -0
- package/dist/tools/query/wait-for-async.test.d.ts +1 -0
- package/dist/tools/query/wait-for-async.test.js +45 -0
- package/dist/tools/registry.d.ts +187 -3
- package/dist/tools/registry.js +89 -7
- package/dist/tools/shared.d.ts +52 -10
- package/dist/tools/shared.js +127 -41
- package/dist/tools/shared.test.js +103 -3
- package/dist/transports/streamable-http.js +47 -198
- package/dist/transports/streamable-http.test.js +21 -9
- package/package.json +5 -5
- package/dist/personas/organization-audit/v1/resources/playbook.d.ts +0 -11
- package/dist/personas/organization-audit/v1/resources/playbook.js +0 -40
- package/dist/personas/organization-audit/v1/resources/playbook.md +0 -52
- package/dist/personas/semantic-layer/v1/resources/playbook.d.ts +0 -12
- package/dist/personas/semantic-layer/v1/resources/playbook.js +0 -42
- package/dist/personas/semantic-layer/v1/resources/playbook.md +0 -153
- package/dist/transports/http-request-utils.d.ts +0 -2
- package/dist/transports/http-request-utils.js +0 -13
- package/dist/transports/session-store.d.ts +0 -40
- package/dist/transports/session-store.js +0 -88
- package/dist/transports/session-store.test.js +0 -111
- /package/dist/{transports/session-store.test.d.ts → destructive/capability.test.d.ts} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Content-developer — dashboards (and dashboard-owned charts)
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer/dashboards`
|
|
4
|
+
|
|
5
|
+
**Order matters:** clarify **Objective** if needed, emit a **Design Spec** and get user approval first, then create the **dashboard shell**, then create charts with `dashboardSlug` set to that dashboard, then attach tiles (+ filters with explore↔filter / `tileTargets` via dashboard-design). Official Lightdash as-code: `dashboardSlug` scopes a chart to a dashboard (it will not appear as an independent space chart). Promote via **content-governance**.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
get_project → list_spaces → discover seeds (read-only)
|
|
9
|
+
→ clarify Objective if goal is vague
|
|
10
|
+
→ Design Spec (Objective + tiles with tableName citing insights + filter apply/exclude) → user approve ← STOP: no writes yet
|
|
11
|
+
→ create_dashboard (empty / markdown shell) ← record dashboard slug
|
|
12
|
+
→ reuse tiles OR get_chart_as_code → create_chart (dashboardSlug set)
|
|
13
|
+
→ update_dashboard (full tile array)
|
|
14
|
+
→ optional: get_dashboard for tile UUIDs → update_dashboard (filters + tileTargets excludes)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Discover
|
|
18
|
+
|
|
19
|
+
1. `list_spaces` → existing `spaceUuid` (dashboards) / `spaceSlug` (chart as-code).
|
|
20
|
+
2. `search_content` with **short** tokens (`orders`, space slug). Multi-word brand phrases often return empty — use `get_space`. Short tokens can also return noisy org-wide hits — prefer `get_space` inventory for seeds.
|
|
21
|
+
3. Prefer **reuse** of existing charts as tiles when they already fit.
|
|
22
|
+
4. For new charts: find a **working seed** on the same `tableName`; never invent fieldIds.
|
|
23
|
+
5. Dashboard-owned charts (`dashboardSlug` set) **do not** appear as independent space charts in `get_space` / typical search — keep the UUIDs you create, or re-open the dashboard.
|
|
24
|
+
|
|
25
|
+
## Create dashboard shell (step 1 — after Design Spec approval)
|
|
26
|
+
|
|
27
|
+
Only after Phase Design approval (see `lightdash://playbooks/content-developer/dashboard-design`). Then:
|
|
28
|
+
|
|
29
|
+
1. Resolve target **existing** `spaceUuid`.
|
|
30
|
+
2. `preview_dashboard_changes` without `dashboardUuidOrSlug`, `changes: { name, description?, spaceUuid, tabs: [], tiles: [] }` → `resourceKey` is literal **`new`**.
|
|
31
|
+
3. `confirm_preview` (`resourceKind: 'dashboard'`, `resourceKey: 'new'`, **`projectUuid`**).
|
|
32
|
+
4. `create_dashboard` with **`dashboard: { … }`** — same fields as `changes` (nested object; not flat tool args). Empty or markdown-only `tiles`. **Pass `projectUuid`.**
|
|
33
|
+
5. Record returned **`slug`** and **`uuid`** — required as `dashboardSlug` for new charts.
|
|
34
|
+
|
|
35
|
+
## New chart for that dashboard (step 2)
|
|
36
|
+
|
|
37
|
+
Semantic as-code only. Prefer clone, not invent.
|
|
38
|
+
|
|
39
|
+
### Seed SOP
|
|
40
|
+
|
|
41
|
+
1. Prefer **reuse** of an existing chart as a tile when it already fits.
|
|
42
|
+
2. Else `search_content` / `get_space` → pick a **rendering** seed on the same `tableName` (same explore).
|
|
43
|
+
3. `get_chart_as_code` (or `duplicate_chart`) → **keep `chartConfig` structure** (layout + series encode); edit only `name`, `slug`, and `metricQuery` fields that exist on the explore; set `dashboardSlug` = dashboard slug from step 1.
|
|
44
|
+
4. Viz type / encode details: `lightdash://playbooks/content-developer/chart-types`.
|
|
45
|
+
|
|
46
|
+
Then:
|
|
47
|
+
|
|
48
|
+
1. Set `spaceSlug`, `skipSpaceCreate: true`, `version`, `tableName`, `dashboardSlug`.
|
|
49
|
+
2. Every dimension in `metricQuery.dimensions` must appear in viz config (cartesian layout / pie groups / sankey source-target / …) — unused dimensions change SQL GROUP BY and can yield “Results may be incorrect”.
|
|
50
|
+
3. `preview_chart_changes` with top-level **`slug`** + `changes` body → `confirm_preview` (`resourceKey` = that slug, **`projectUuid`**) → `create_chart` / `update_chart` (`slug` + `chart: { … }` matching `changes`, **`projectUuid`**).
|
|
51
|
+
4. Capture `charts[0].data.uuid` immediately for tiling.
|
|
52
|
+
|
|
53
|
+
If fieldIds are unknown → stop; use semantic-layer. Do **not** hand-author minimal cartesian configs (series without `encode.xRef`/`yRef`).
|
|
54
|
+
|
|
55
|
+
`dashboardSlug` alone does **not** place the chart on the board — step 3 (tiles) is mandatory.
|
|
56
|
+
|
|
57
|
+
### Multi-viz / “all chart types” boards
|
|
58
|
+
|
|
59
|
+
Only when the user **explicitly** asks for every chart type (or a large multi-viz board)—not the default:
|
|
60
|
+
|
|
61
|
+
1. Raise the new-chart budget (default ≤8 is too low).
|
|
62
|
+
2. Cover: bar, horizontal bar, line, area, mixed, scatter, pie, funnel, treemap, sankey, table, big_number, gauge; **skip map** if no lat/lon and say so.
|
|
63
|
+
3. 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.
|
|
64
|
+
4. **Batch SOP:** create shell → create all charts (`dashboardSlug` set; **≤2** concurrent preview→confirm→apply chains) → capture each `charts[0].data.uuid` → **one** `update_dashboard` with full tiles + optional empty-value filters. Do not interleave tiling with chart creates.
|
|
65
|
+
5. Cap concurrent writes at **≤2** on hosted tunnels — parallel bursts often return HTTP 502.
|
|
66
|
+
|
|
67
|
+
### Duplicate chart
|
|
68
|
+
|
|
69
|
+
1. Preview with `chartUuidOrSlug` = source and `changes` = `{ sourceChartUuidOrSlug, newSlug, newName? }`.
|
|
70
|
+
2. Confirm `resourceKind: 'chart'`, `resourceKey` = **source** UUID (**always pass `projectUuid`**).
|
|
71
|
+
3. `duplicate_chart`, then `update_chart` if needed to set `dashboardSlug` and any metricQuery edits (clone body via `get_chart_as_code` first).
|
|
72
|
+
4. Tile the result onto the dashboard.
|
|
73
|
+
|
|
74
|
+
## Attach tiles (step 3)
|
|
75
|
+
|
|
76
|
+
1. Compose the **full** tile array (markdown + `saved_chart` with `x/y/w/h`; grid width max **36**).
|
|
77
|
+
2. Require `properties.savedChartUuid` from the chart create/duplicate result (OpenAPI `CreateDashboardChartTile`). Optional `chartSlug` is metadata only — do not tile with slug alone.
|
|
78
|
+
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
|
+
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
|
+
|
|
82
|
+
Layout, optional markdown, optional filters → `lightdash://playbooks/content-developer/dashboard-design`.
|
|
83
|
+
|
|
84
|
+
## Improve / refactor / duplicate dashboard
|
|
85
|
+
|
|
86
|
+
1. `get_dashboard` for structure (layout may be incomplete — rebuild intentionally).
|
|
87
|
+
2. For **material** layout / tile / filter changes (including professionalize / clean up / redesign): emit a Design Spec **delta** per `lightdash://playbooks/content-developer/dashboard-design` (**Improve / professionalize Spec delta** — keep / drop / rename + cull) and await user approval before any `preview_*` / write. Trivial one-shot renames the user already specified may skip the stop.
|
|
88
|
+
3. **Naming when professionalizing:** update tile `properties.title` **and** chart `name` via `update_chart` (strip demo prefixes like `[loop3]`); keep slug unless the user asks to rename.
|
|
89
|
+
4. `compare_dashboard_versions` when reconciling drift.
|
|
90
|
+
5. New charts mid-improve still follow shell-exists → `dashboardSlug` → tiles.
|
|
91
|
+
6. Duplicate dashboard: preview `{ newName? }` → confirm source UUID → `duplicate_dashboard`; relocate with content-move if needed.
|
|
92
|
+
|
|
93
|
+
## Done criteria
|
|
94
|
+
|
|
95
|
+
- Objective clarified when needed; Design Spec approved (or amended) before writes for new boards / material redesigns.
|
|
96
|
+
- Dashboard shell existed **before** new charts were created.
|
|
97
|
+
- Every new chart has `dashboardSlug` set to that dashboard (not space-only orphans).
|
|
98
|
+
- Every new/updated chart is referenced by a dashboard tile that maps to an insight question.
|
|
99
|
+
- 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 persona).
|
|
101
|
+
- Report dashboard UUID/slug, tiles, and chart UUIDs/slugs; note execution was unavailable on this persona.
|
|
102
|
+
- Do not promote from here — content-governance when ready.
|
|
103
|
+
- Layout / optional markdown / optional filters quality → `lightdash://playbooks/content-developer/dashboard-design`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Content-developer playbooks
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer`
|
|
4
|
+
|
|
5
|
+
Workflow-scoped playbooks (always load **core** plus one topic with a prompt):
|
|
6
|
+
|
|
7
|
+
| Topic | URI |
|
|
8
|
+
| ------------------------------------------------------------ | ---------------------------------------------------------- |
|
|
9
|
+
| Core (gates & bans) | `lightdash://playbooks/content-developer/core` |
|
|
10
|
+
| Dashboards & dashboard-owned charts | `lightdash://playbooks/content-developer/dashboards` |
|
|
11
|
+
| Dashboard design (Design Spec + layout / markdown / filters) | `lightdash://playbooks/content-developer/dashboard-design` |
|
|
12
|
+
| Chart types (cartesian + pie/funnel/…) | `lightdash://playbooks/content-developer/chart-types` |
|
|
13
|
+
| Content move | `lightdash://playbooks/content-developer/content-move` |
|
|
14
|
+
|
|
15
|
+
**Authoring order:** clarify Objective → Design Spec → approve → dashboard shell → charts with `dashboardSlug` → tiles (+ optional filters; prefer one explore or `tileTargets` exclude by tile UUID). Always pass **`projectUuid`** on `confirm_preview` and apply when there is no HTTP pin. Clone via `get_chart_as_code`; never invent fieldIds or skinny `chartConfig` (cartesian series need `encode.xRef`/`yRef`). Multi-viz / all chart types only when the user explicitly asks (batch: shell → charts ≤2 parallel → one tile update). Cap concurrent writes at ≤2 on hosted tunnels. Spaces are Terraform / out-of-band (`list_spaces` / `get_space` only).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-developer multi-playbook resources (core + topics + index).
|
|
3
|
+
*/
|
|
4
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
5
|
+
export type ContentDeveloperPlaybookTopic = 'chart-types' | 'content-move' | 'dashboard-design' | 'dashboards';
|
|
6
|
+
export declare const CONTENT_DEVELOPER_HARD_BANS: string;
|
|
7
|
+
export declare const getAllPlaybookMarkdown: () => string;
|
|
8
|
+
export declare const CONTENT_DEVELOPER_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
|
|
9
|
+
export declare const CONTENT_DEVELOPER_TOPIC_PLAYBOOKS: Readonly<Record<ContentDeveloperPlaybookTopic, import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
|
|
10
|
+
export declare function registerContentDeveloperPlaybook(server: McpServer): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-developer multi-playbook resources (core + topics + index).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS = exports.CONTENT_DEVELOPER_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_DEVELOPER_HARD_BANS = void 0;
|
|
7
|
+
exports.registerContentDeveloperPlaybook = registerContentDeveloperPlaybook;
|
|
8
|
+
const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
|
|
9
|
+
const playbooks = (0, playbook_resources_js_1.definePersonaPlaybooks)({
|
|
10
|
+
personaId: 'content-developer',
|
|
11
|
+
moduleDir: __dirname,
|
|
12
|
+
hardBans: `Do not execute arbitrary metric queries, raw SQL, warehouse runs, or saved-chart execution.
|
|
13
|
+
Do not author or upsert SQL charts.
|
|
14
|
+
Do not hard-delete, rollback, or promote content (use content-governance for promote).
|
|
15
|
+
Do not perform organization administration or list org-wide projects.
|
|
16
|
+
Do not create or update spaces — spaces are Terraform / out-of-band; use existing spaces only.
|
|
17
|
+
Do not create space-only charts for dashboard work — set dashboardSlug to the dashboard shell already created.
|
|
18
|
+
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.
|
|
19
|
+
Do not start writes from a viz-type or all-chart-types checklist alone — settle Objective and insight questions first (an explicit user all-types ask may be the Objective after a one-line restatement).
|
|
20
|
+
Do not call confirm_preview without projectUuid when there is no HTTP X-Lightdash-Project pin (PROJECT_SCOPE_REQUIRED).
|
|
21
|
+
Do not attach dashboard filters whose target.tableName is absent from a tile explore without excluding that tile (or remapping) via tileTargets.
|
|
22
|
+
Do not treat chart create as done without a dashboard shell and tiles.
|
|
23
|
+
Do not invent fieldIds — clone via get_chart_as_code / get_chart or use semantic-layer.
|
|
24
|
+
Do not invent skinny chartConfig — clone a working as-code body and keep series/layout/encode.
|
|
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 treat validate_chart / validate_dashboard as a preview unlock — they are saved-UUID health checks only (validate_chart needs chartUuid).
|
|
27
|
+
Do not reuse a draft previewToken after confirm; re-run preview if the resource drifts (PREVIEW_STALE).
|
|
28
|
+
Do not reveal secrets, warehouse credentials, or hidden SQL.`,
|
|
29
|
+
coreDescription: 'Hard bans, tools, project scope, preview gate, and apply pitfalls',
|
|
30
|
+
topics: [
|
|
31
|
+
{
|
|
32
|
+
id: 'dashboards',
|
|
33
|
+
title: 'Content-developer dashboards playbook',
|
|
34
|
+
description: 'Dashboard shell first, then dashboardSlug-scoped charts as tiles',
|
|
35
|
+
file: 'dashboards.md',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'dashboard-design',
|
|
39
|
+
title: 'Content-developer dashboard-design playbook',
|
|
40
|
+
description: 'Objective-first Design Spec, explore↔filter / tileTargets, layout, markdown, filters, tabs',
|
|
41
|
+
file: 'dashboard-design.md',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'chart-types',
|
|
45
|
+
title: 'Content-developer chart-types playbook',
|
|
46
|
+
description: 'Insight-first viz pick; cartesian encode checklist; UI intent → as-code map',
|
|
47
|
+
file: 'chart-types.md',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'content-move',
|
|
51
|
+
title: 'Content-developer content-move playbook',
|
|
52
|
+
description: 'Move content into existing spaces (no space CRUD)',
|
|
53
|
+
file: 'content-move.md',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
exports.CONTENT_DEVELOPER_HARD_BANS = playbooks.HARD_BANS;
|
|
58
|
+
exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
|
|
59
|
+
exports.CONTENT_DEVELOPER_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
|
|
60
|
+
exports.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
|
|
61
|
+
function registerContentDeveloperPlaybook(server) {
|
|
62
|
+
playbooks.registerPlaybooks(server);
|
|
63
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-governance persona: 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 { PersonaDefinition } from '../../types.js';
|
|
6
|
+
export declare const CONTENT_GOVERNANCE_PERSONA_PATH: "/content-governance/v1/mcp";
|
|
7
|
+
/** Explicit allowlist — must stay a deliberate subset of the shared registry. */
|
|
8
|
+
export declare const CONTENT_GOVERNANCE_TOOL_IDS: readonly ["delete_chart", "delete_dashboard", "get_dashboard_promote_diff", "promote_dashboard"];
|
|
9
|
+
export declare const contentGovernancePersona: PersonaDefinition;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-governance persona: 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.contentGovernancePersona = exports.CONTENT_GOVERNANCE_TOOL_IDS = exports.CONTENT_GOVERNANCE_PERSONA_PATH = void 0;
|
|
8
|
+
const prompts_js_1 = require("./prompts.js");
|
|
9
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
10
|
+
exports.CONTENT_GOVERNANCE_PERSONA_PATH = '/content-governance/v1/mcp';
|
|
11
|
+
/** Explicit allowlist — must stay a deliberate subset of the shared registry. */
|
|
12
|
+
exports.CONTENT_GOVERNANCE_TOOL_IDS = [
|
|
13
|
+
'delete_chart',
|
|
14
|
+
'delete_dashboard',
|
|
15
|
+
'get_dashboard_promote_diff',
|
|
16
|
+
'promote_dashboard',
|
|
17
|
+
];
|
|
18
|
+
exports.contentGovernancePersona = {
|
|
19
|
+
id: 'content-governance',
|
|
20
|
+
path: exports.CONTENT_GOVERNANCE_PERSONA_PATH,
|
|
21
|
+
serverName: 'lightdash-mcp-gov',
|
|
22
|
+
toolIds: exports.CONTENT_GOVERNANCE_TOOL_IDS,
|
|
23
|
+
registerPrompts: (server) => {
|
|
24
|
+
(0, prompts_js_1.registerContentGovernancePrompts)(server);
|
|
25
|
+
},
|
|
26
|
+
registerResources: (server) => {
|
|
27
|
+
(0, playbooks_js_1.registerContentGovernancePlaybook)(server);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP prompts for content-governance soft-delete and dashboard promote workflows.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerContentGovernancePrompts = registerContentGovernancePrompts;
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-deprecated -- matches content-reader prompt registration pattern */
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const playbook_resources_js_1 = require("../../lib/playbook-resources.js");
|
|
10
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
11
|
+
const userMessages = (0, playbook_resources_js_1.createPromptPlaybookEmbedder)({
|
|
12
|
+
core: playbooks_js_1.CONTENT_GOVERNANCE_CORE_PLAYBOOK,
|
|
13
|
+
topics: playbooks_js_1.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS,
|
|
14
|
+
});
|
|
15
|
+
const TOPIC_CHARTS = 'charts';
|
|
16
|
+
const TOPIC_DASHBOARDS = 'dashboards';
|
|
17
|
+
const REASON_NONE = '(none provided)';
|
|
18
|
+
const DELETE_ELICITATION_RULES = `Hard rule: form elicitation only. Call the matching lightdash_delete_* tool;
|
|
19
|
+
the human must accept a form with decision=confirm_delete and confirmationText equal to the exact
|
|
20
|
+
resource name. Never invent confirmation flags or treat chat approval as sufficient.
|
|
21
|
+
If the client lacks form elicitation, expect ELICITATION_REQUIRED and stop.
|
|
22
|
+
If the resource drifts after binding, expect RESOURCE_CHANGED and re-invoke the tool.`;
|
|
23
|
+
const PROMOTE_ELICITATION_RULES = `Hard rule: form elicitation only. Optionally call lightdash_get_dashboard_promote_diff
|
|
24
|
+
first, then lightdash_promote_dashboard. The human must accept a form with decision=confirm_promote
|
|
25
|
+
and confirmationText equal to the exact dashboard name. Never invent confirmation flags.
|
|
26
|
+
If the client lacks form elicitation, expect ELICITATION_REQUIRED and stop.
|
|
27
|
+
If the dashboard or promoteDiff drifts after binding, expect RESOURCE_CHANGED and re-invoke.`;
|
|
28
|
+
function registerContentGovernancePrompts(server) {
|
|
29
|
+
server.registerPrompt('delete_chart', {
|
|
30
|
+
title: 'Soft-delete chart',
|
|
31
|
+
description: 'Soft-delete a saved chart after form elicitation (restorable from trash; no permanent purge)',
|
|
32
|
+
argsSchema: {
|
|
33
|
+
chartUuidOrSlug: zod_1.z.string(),
|
|
34
|
+
reason: zod_1.z.string().optional(),
|
|
35
|
+
},
|
|
36
|
+
}, ({ chartUuidOrSlug, reason }) => userMessages(`Soft-delete the Lightdash chart ${chartUuidOrSlug}.
|
|
37
|
+
|
|
38
|
+
${playbooks_js_1.CONTENT_GOVERNANCE_HARD_BANS}
|
|
39
|
+
|
|
40
|
+
${DELETE_ELICITATION_RULES}
|
|
41
|
+
|
|
42
|
+
Reason / context: ${reason !== null && reason !== void 0 ? reason : REASON_NONE}.
|
|
43
|
+
Resolve project scope (X-Lightdash-Project pin or projectUuid), then call
|
|
44
|
+
lightdash_delete_chart with chartUuidOrSlug.
|
|
45
|
+
Complete human form fields: decision (confirm_delete | do_not_delete) and confirmationText
|
|
46
|
+
(exact chart name). Report the deletion receipt or that nothing was deleted if declined/cancelled.
|
|
47
|
+
Do not permanently purge.`, TOPIC_CHARTS));
|
|
48
|
+
server.registerPrompt('delete_dashboard', {
|
|
49
|
+
title: 'Soft-delete dashboard',
|
|
50
|
+
description: 'Soft-delete a dashboard after form elicitation (restorable from trash; no permanent purge)',
|
|
51
|
+
argsSchema: {
|
|
52
|
+
dashboardUuidOrSlug: zod_1.z.string(),
|
|
53
|
+
reason: zod_1.z.string().optional(),
|
|
54
|
+
},
|
|
55
|
+
}, ({ dashboardUuidOrSlug, reason }) => userMessages(`Soft-delete the Lightdash dashboard ${dashboardUuidOrSlug}.
|
|
56
|
+
|
|
57
|
+
${playbooks_js_1.CONTENT_GOVERNANCE_HARD_BANS}
|
|
58
|
+
|
|
59
|
+
${DELETE_ELICITATION_RULES}
|
|
60
|
+
|
|
61
|
+
Reason / context: ${reason !== null && reason !== void 0 ? reason : REASON_NONE}.
|
|
62
|
+
Resolve project scope (X-Lightdash-Project pin or projectUuid), then call
|
|
63
|
+
lightdash_delete_dashboard with dashboardUuidOrSlug.
|
|
64
|
+
Complete human form fields: decision (confirm_delete | do_not_delete) and confirmationText
|
|
65
|
+
(exact dashboard name). Report the deletion receipt or that nothing was deleted if declined/cancelled.
|
|
66
|
+
Do not permanently purge, delete spaces, or bulk-delete.`, TOPIC_DASHBOARDS));
|
|
67
|
+
server.registerPrompt('promote_dashboard', {
|
|
68
|
+
title: 'Promote dashboard',
|
|
69
|
+
description: 'Promote a dashboard to its configured upstream project after form elicitation (dashboard-first release)',
|
|
70
|
+
argsSchema: {
|
|
71
|
+
dashboardUuidOrSlug: zod_1.z.string(),
|
|
72
|
+
reason: zod_1.z.string().optional(),
|
|
73
|
+
},
|
|
74
|
+
}, ({ dashboardUuidOrSlug, reason }) => userMessages(`Promote the Lightdash dashboard ${dashboardUuidOrSlug} to its configured upstream project.
|
|
75
|
+
|
|
76
|
+
${playbooks_js_1.CONTENT_GOVERNANCE_HARD_BANS}
|
|
77
|
+
|
|
78
|
+
${PROMOTE_ELICITATION_RULES}
|
|
79
|
+
|
|
80
|
+
Reason / context: ${reason !== null && reason !== void 0 ? reason : REASON_NONE}.
|
|
81
|
+
Resolve project scope, optionally call lightdash_get_dashboard_promote_diff, then
|
|
82
|
+
lightdash_promote_dashboard with dashboardUuidOrSlug.
|
|
83
|
+
Complete human form fields: decision (confirm_promote | do_not_promote) and confirmationText
|
|
84
|
+
(exact dashboard name). Report the promotion receipt or that nothing was promoted if declined/cancelled.
|
|
85
|
+
Do not promote charts or SQL charts via MCP.`, TOPIC_DASHBOARDS));
|
|
86
|
+
}
|
|
87
|
+
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-governance prompt/playbook invariants.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const vitest_1 = require("vitest");
|
|
40
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
41
|
+
const index_js_1 = require("./index.js");
|
|
42
|
+
(0, vitest_1.describe)('content-governance prompts/playbook', () => {
|
|
43
|
+
(0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
|
|
44
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
45
|
+
for (const id of index_js_1.CONTENT_GOVERNANCE_TOOL_IDS) {
|
|
46
|
+
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
47
|
+
}
|
|
48
|
+
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
49
|
+
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
50
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_GOVERNANCE_HARD_BANS.toLowerCase()).toContain('permanently purge');
|
|
51
|
+
});
|
|
52
|
+
(0, vitest_1.it)('documents elicitation SOP, soft-delete, and promote bans', () => {
|
|
53
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
54
|
+
(0, vitest_1.expect)(md).toContain('elicitation_required');
|
|
55
|
+
(0, vitest_1.expect)(md).toContain('resource_changed');
|
|
56
|
+
(0, vitest_1.expect)(md).toContain('confirm_delete');
|
|
57
|
+
(0, vitest_1.expect)(md).toContain('confirm_promote');
|
|
58
|
+
(0, vitest_1.expect)(md).toContain('confirmationtext');
|
|
59
|
+
(0, vitest_1.expect)(md).toContain('soft-delete');
|
|
60
|
+
(0, vitest_1.expect)(md).toContain('promote_dashboard');
|
|
61
|
+
(0, vitest_1.expect)(md).toContain('permanently purge');
|
|
62
|
+
(0, vitest_1.expect)(md).not.toMatch(/`permanent_delete/);
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.it)('registers delete and promote prompts', async () => {
|
|
65
|
+
const { registerContentGovernancePrompts } = await Promise.resolve().then(() => __importStar(require('./prompts.js')));
|
|
66
|
+
const names = [];
|
|
67
|
+
const server = {
|
|
68
|
+
registerPrompt: (name) => {
|
|
69
|
+
names.push(name);
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
registerContentGovernancePrompts(server);
|
|
73
|
+
(0, vitest_1.expect)(names.sort()).toEqual(['delete_chart', 'delete_dashboard', 'promote_dashboard']);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Content-governance — charts
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-governance/charts`
|
|
4
|
+
|
|
5
|
+
Soft-delete a single saved chart after human form elicitation. Soft-delete hides the chart from normal lists and is restorable from trash until permanently purged (purge is not available on MCP).
|
|
6
|
+
|
|
7
|
+
## Soft-delete workflow
|
|
8
|
+
|
|
9
|
+
1. Resolve project scope (`X-Lightdash-Project` pin or `projectUuid`).
|
|
10
|
+
2. Call `lightdash_delete_chart` with `chartUuidOrSlug` (UUID or slug).
|
|
11
|
+
3. If the response is blocked with `ELICITATION_REQUIRED`, stop — the client cannot approve deletes via MCP.
|
|
12
|
+
4. When the tool returns an elicitation form, the human must complete:
|
|
13
|
+
- `decision`: `confirm_delete` to proceed, or `do_not_delete` to abort
|
|
14
|
+
- `confirmationText`: exact chart **name** from the form message (not the UUID alone unless that is the displayed name)
|
|
15
|
+
5. On accept, the server re-fetches the chart and checks the precondition digest. If the chart changed (name, space, updatedAt, etc.), expect `RESOURCE_CHANGED` — call `lightdash_delete_chart` again for a fresh elicitation; do not invent confirmation.
|
|
16
|
+
6. On success, report the soft-delete receipt (identity, project, that it is restorable). Do not claim permanent purge.
|
|
17
|
+
|
|
18
|
+
## Confirmation form fields
|
|
19
|
+
|
|
20
|
+
| Field | Required values |
|
|
21
|
+
| ------------------ | ---------------------------------------------------- |
|
|
22
|
+
| `decision` | `confirm_delete` or `do_not_delete` |
|
|
23
|
+
| `confirmationText` | Exact resource name shown in the elicitation message |
|
|
24
|
+
|
|
25
|
+
## Error codes
|
|
26
|
+
|
|
27
|
+
- `ELICITATION_REQUIRED` — client lacks form elicitation; fail closed (no weaker confirmation path).
|
|
28
|
+
- `RESOURCE_CHANGED` — target drifted after approval was bound; re-invoke the tool.
|
|
29
|
+
- Declined / cancelled elicitation — leave the chart in place; report that nothing was deleted.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Content-governance core
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-governance/core`
|
|
4
|
+
|
|
5
|
+
## Hard bans
|
|
6
|
+
|
|
7
|
+
- Do not permanently purge soft-deleted content (client-only / never on MCP).
|
|
8
|
+
- Do not delete spaces, bulk-delete, or call org-level deletes.
|
|
9
|
+
- Do not soft-delete or promote without **form elicitation** — never invent `confirmed: true` or treat chat "please confirm" as approval.
|
|
10
|
+
- Do not bypass the elicitation gate when the client lacks form elicitation (`ELICITATION_REQUIRED`).
|
|
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 persona.
|
|
13
|
+
- Do not reveal secrets, warehouse credentials, or hidden SQL.
|
|
14
|
+
|
|
15
|
+
## Tools
|
|
16
|
+
|
|
17
|
+
Use only these `lightdash_*` tools:
|
|
18
|
+
|
|
19
|
+
- `delete_chart`
|
|
20
|
+
- `delete_dashboard`
|
|
21
|
+
- `get_dashboard_promote_diff`
|
|
22
|
+
- `promote_dashboard`
|
|
23
|
+
|
|
24
|
+
One mutating tool call → one resource → one elicitation → one API call. No bulk delete or bulk promote in v1.
|
|
25
|
+
|
|
26
|
+
## Phase 0 — Resolve project
|
|
27
|
+
|
|
28
|
+
1. Require a resolved project: HTTP `X-Lightdash-Project` pin or explicit `projectUuid` on the tool.
|
|
29
|
+
2. Stop when project scope is unresolved (`PROJECT_SCOPE_REQUIRED`).
|
|
30
|
+
3. Never enumerate organization projects from this persona (no `list_projects`).
|
|
31
|
+
|
|
32
|
+
## Soft-delete elicitation SOP
|
|
33
|
+
|
|
34
|
+
1. Call `lightdash_delete_chart` or `lightdash_delete_dashboard` with the target UUID/slug (and `projectUuid` when not pinned).
|
|
35
|
+
2. The tool fails closed with `ELICITATION_REQUIRED` if the client cannot do form elicitation.
|
|
36
|
+
3. Otherwise the tool returns `inputRequired` with a confirmation form. Humans must set:
|
|
37
|
+
- `decision`: `confirm_delete` (or `do_not_delete` to keep the resource)
|
|
38
|
+
- `confirmationText`: the **exact** resource name shown in the elicitation message
|
|
39
|
+
4. After accept, the server revalidates the target. Drift → `RESOURCE_CHANGED`; re-run the tool (do not reuse stale approval).
|
|
40
|
+
5. Report the deletion receipt (or declined/cancelled/blocked). Soft-delete is restorable from trash until permanently purged outside MCP.
|
|
41
|
+
|
|
42
|
+
## Dashboard promote elicitation SOP
|
|
43
|
+
|
|
44
|
+
1. Optionally call `lightdash_get_dashboard_promote_diff` to inspect `create` / `update` / `no changes` counts before release.
|
|
45
|
+
2. Call `lightdash_promote_dashboard` with `dashboardUuidOrSlug` (and `projectUuid` when not pinned / for slug disambiguation).
|
|
46
|
+
3. Same elicitation capability gate as soft-delete.
|
|
47
|
+
4. Humans must set:
|
|
48
|
+
- `decision`: `confirm_promote` (or `do_not_promote` to abort)
|
|
49
|
+
- `confirmationText`: the **exact** dashboard name shown in the elicitation message
|
|
50
|
+
5. The form message summarizes promoteDiff impact and warns that nested charts/spaces/data apps may be created or overwritten upstream.
|
|
51
|
+
6. After accept, the server re-fetches dashboard + promoteDiff. Drift → `RESOURCE_CHANGED`; re-run the tool.
|
|
52
|
+
7. Report the promotion receipt (or declined/cancelled/blocked). Upstream must already be configured in Lightdash Data Ops.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Content-governance — dashboards
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-governance/dashboards`
|
|
4
|
+
|
|
5
|
+
Soft-delete a single dashboard after human form elicitation, or promote a dashboard to its configured upstream project after form elicitation. Soft-delete hides the dashboard from normal lists and is restorable from trash until permanently purged (purge is not available on MCP). Promote copies the dashboard and its nested charts (and may create spaces / data-app tiles) into the upstream project — see [How to promote content](https://docs.lightdash.com/guides/how-to-promote-content).
|
|
6
|
+
|
|
7
|
+
## Soft-delete workflow
|
|
8
|
+
|
|
9
|
+
1. Resolve project scope (`X-Lightdash-Project` pin or `projectUuid`).
|
|
10
|
+
2. Call `lightdash_delete_dashboard` with `dashboardUuidOrSlug` (UUID or slug).
|
|
11
|
+
3. If the response is blocked with `ELICITATION_REQUIRED`, stop — the client cannot approve deletes via MCP.
|
|
12
|
+
4. When the tool returns an elicitation form, the human must complete:
|
|
13
|
+
- `decision`: `confirm_delete` to proceed, or `do_not_delete` to abort
|
|
14
|
+
- `confirmationText`: exact dashboard **name** from the form message (not the UUID alone unless that is the displayed name)
|
|
15
|
+
5. On accept, the server re-fetches the dashboard and checks the precondition digest. If the dashboard changed, expect `RESOURCE_CHANGED` — call `lightdash_delete_dashboard` again for a fresh elicitation; do not invent confirmation.
|
|
16
|
+
6. On success, report the soft-delete receipt (identity, project, that it is restorable). Do not claim permanent purge or space deletion.
|
|
17
|
+
|
|
18
|
+
## Promote workflow
|
|
19
|
+
|
|
20
|
+
1. Resolve project scope.
|
|
21
|
+
2. Optionally call `lightdash_get_dashboard_promote_diff` to inspect `PromotionChanges` (charts/dashboards/spaces/sqlCharts/dataApps actions).
|
|
22
|
+
3. Call `lightdash_promote_dashboard` with `dashboardUuidOrSlug`.
|
|
23
|
+
4. If blocked with `ELICITATION_REQUIRED`, stop — no weaker confirmation path.
|
|
24
|
+
5. Human form fields:
|
|
25
|
+
- `decision`: `confirm_promote` or `do_not_promote`
|
|
26
|
+
- `confirmationText`: exact dashboard name from the elicitation message
|
|
27
|
+
6. On accept, server re-fetches dashboard + promoteDiff. Drift → `RESOURCE_CHANGED` — re-invoke for a fresh elicitation.
|
|
28
|
+
7. On success, report the promotion receipt. Do not claim chart-only or SQL-chart promote (not available on MCP). Upstream project is configured in Data Ops, not chosen via tool args. If `LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS` is set, the upstream target must be on that list (including for `get_dashboard_promote_diff`); otherwise expect `PROJECT_NOT_AVAILABLE`.
|
|
29
|
+
|
|
30
|
+
## Soft-delete confirmation form fields
|
|
31
|
+
|
|
32
|
+
| Field | Required values |
|
|
33
|
+
| ------------------ | ---------------------------------------------------- |
|
|
34
|
+
| `decision` | `confirm_delete` or `do_not_delete` |
|
|
35
|
+
| `confirmationText` | Exact resource name shown in the elicitation message |
|
|
36
|
+
|
|
37
|
+
## Promote confirmation form fields
|
|
38
|
+
|
|
39
|
+
| Field | Required values |
|
|
40
|
+
| ------------------ | ----------------------------------------------------- |
|
|
41
|
+
| `decision` | `confirm_promote` or `do_not_promote` |
|
|
42
|
+
| `confirmationText` | Exact dashboard name shown in the elicitation message |
|
|
43
|
+
|
|
44
|
+
## Error codes
|
|
45
|
+
|
|
46
|
+
- `ELICITATION_REQUIRED` — client lacks form elicitation; fail closed (no weaker confirmation path).
|
|
47
|
+
- `RESOURCE_CHANGED` — target or promoteDiff drifted after approval was bound; re-invoke the tool.
|
|
48
|
+
- Declined / cancelled elicitation — leave the dashboard / upstream unchanged; report that nothing was mutated.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Content-governance playbooks
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-governance`
|
|
4
|
+
|
|
5
|
+
Workflow-scoped playbooks (always load **core** plus one topic with a prompt):
|
|
6
|
+
|
|
7
|
+
| Topic | URI |
|
|
8
|
+
| ------------------- | ----------------------------------------------------- |
|
|
9
|
+
| Core (gates & bans) | `lightdash://playbooks/content-governance/core` |
|
|
10
|
+
| Charts | `lightdash://playbooks/content-governance/charts` |
|
|
11
|
+
| Dashboards | `lightdash://playbooks/content-governance/dashboards` |
|
|
12
|
+
|
|
13
|
+
Soft-delete project-scoped charts and dashboards only, after human form elicitation.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-governance multi-playbook resources (core + topics + index).
|
|
3
|
+
*/
|
|
4
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
5
|
+
export type ContentGovernancePlaybookTopic = 'charts' | 'dashboards';
|
|
6
|
+
export declare const CONTENT_GOVERNANCE_HARD_BANS: string;
|
|
7
|
+
export declare const getAllPlaybookMarkdown: () => string;
|
|
8
|
+
export declare const CONTENT_GOVERNANCE_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
|
|
9
|
+
export declare const CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS: Readonly<Record<ContentGovernancePlaybookTopic, import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
|
|
10
|
+
export declare function registerContentGovernancePlaybook(server: McpServer): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-governance multi-playbook resources (core + topics + index).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS = exports.CONTENT_GOVERNANCE_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.CONTENT_GOVERNANCE_HARD_BANS = void 0;
|
|
7
|
+
exports.registerContentGovernancePlaybook = registerContentGovernancePlaybook;
|
|
8
|
+
const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
|
|
9
|
+
const playbooks = (0, playbook_resources_js_1.definePersonaPlaybooks)({
|
|
10
|
+
personaId: 'content-governance',
|
|
11
|
+
moduleDir: __dirname,
|
|
12
|
+
hardBans: `Do not permanently purge soft-deleted content.
|
|
13
|
+
Do not delete spaces or perform bulk delete.
|
|
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 personas or bypass the elicitation gate.
|
|
16
|
+
Do not promote charts or SQL charts via MCP (dashboard-first only).
|
|
17
|
+
Do not restore, author, or execute warehouse queries from this persona.
|
|
18
|
+
Do not reveal secrets, warehouse credentials, or hidden SQL.`,
|
|
19
|
+
coreDescription: 'Hard bans, elicitation SOP, tools, and project scope',
|
|
20
|
+
topics: [
|
|
21
|
+
{
|
|
22
|
+
id: 'charts',
|
|
23
|
+
title: 'Content-governance charts playbook',
|
|
24
|
+
description: 'Soft-delete a saved chart with form elicitation',
|
|
25
|
+
file: 'charts.md',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'dashboards',
|
|
29
|
+
title: 'Content-governance dashboards playbook',
|
|
30
|
+
description: 'Soft-delete or promote a dashboard with form elicitation',
|
|
31
|
+
file: 'dashboards.md',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
exports.CONTENT_GOVERNANCE_HARD_BANS = playbooks.HARD_BANS;
|
|
36
|
+
exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
|
|
37
|
+
exports.CONTENT_GOVERNANCE_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
|
|
38
|
+
exports.CONTENT_GOVERNANCE_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
|
|
39
|
+
function registerContentGovernancePlaybook(server) {
|
|
40
|
+
playbooks.registerPlaybooks(server);
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-reader persona: saved-content discovery + bounded execution.
|
|
3
|
+
*/
|
|
4
|
+
import type { PersonaDefinition } from '../../types.js';
|
|
5
|
+
export declare const CONTENT_READER_PERSONA_PATH: "/content-reader/v1/mcp";
|
|
6
|
+
/** Explicit allowlist — must stay a deliberate subset of the shared registry. */
|
|
7
|
+
export declare const CONTENT_READER_TOOL_IDS: readonly ["get_project", "search_content", "list_spaces", "get_space", "get_dashboard", "get_chart", "list_project_parameters", "get_project_parameters", "explain_content", "run_chart", "export_chart_image", "run_dashboard_tile", "get_query_result", "cancel_query"];
|
|
8
|
+
export declare const contentReaderPersona: PersonaDefinition;
|