@lightdash-tools/mcp 0.8.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.
Files changed (339) hide show
  1. package/README.md +112 -236
  2. package/dist/audit/server-profile.d.ts +13 -0
  3. package/dist/audit/server-profile.js +28 -0
  4. package/dist/audit/server-profile.test.js +21 -0
  5. package/dist/auth/oauth-broker/pending-store.d.ts +6 -7
  6. package/dist/auth/oauth-broker/pending-store.js +3 -4
  7. package/dist/auth/oauth-broker/pending-store.test.d.ts +2 -3
  8. package/dist/auth/oauth-broker/pending-store.test.js +2 -39
  9. package/dist/auth/oauth-broker/routes.d.ts +1 -1
  10. package/dist/auth/oauth-broker/routes.js +3 -3
  11. package/dist/auth/oauth-broker/routes.test.js +1 -1
  12. package/dist/auth/request-state-key.d.ts +19 -0
  13. package/dist/auth/request-state-key.js +49 -0
  14. package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +1 -3
  15. package/dist/auth/resource-server/lightdash-oauth-middleware.js +1 -20
  16. package/dist/auth/resource-server/lightdash-oauth-middleware.test.js +14 -14
  17. package/dist/auth/resource-server/oauth-protected-resource.d.ts +6 -6
  18. package/dist/auth/resource-server/oauth-protected-resource.js +8 -8
  19. package/dist/auth/resource-server/token-scopes.d.ts +1 -1
  20. package/dist/auth/resource-server/token-scopes.js +1 -1
  21. package/dist/auth/resource-server/www-authenticate.test.js +11 -13
  22. package/dist/bin.js +54 -51
  23. package/dist/config/env.d.ts +8 -16
  24. package/dist/config/env.js +9 -17
  25. package/dist/config/load-mcp-config.d.ts +0 -4
  26. package/dist/config/load-mcp-config.js +9 -38
  27. package/dist/config/load-mcp-config.test.js +8 -2
  28. package/dist/config/normalize-url.d.ts +1 -1
  29. package/dist/config/normalize-url.js +1 -1
  30. package/dist/config/normalize-url.test.js +16 -13
  31. package/dist/config/obsolete-env.d.ts +5 -0
  32. package/dist/config/obsolete-env.js +48 -0
  33. package/dist/config/obsolete-env.test.js +22 -0
  34. package/dist/config/runtime.d.ts +3 -3
  35. package/dist/config/runtime.js +19 -23
  36. package/dist/config/runtime.test.js +23 -9
  37. package/dist/config/test-mcp-http-config.js +1 -1
  38. package/dist/destructive/content-promote.js +7 -1
  39. package/dist/destructive/promote-contract.test.js +106 -47
  40. package/dist/destructive/register-destructive-tool.js +6 -24
  41. package/dist/destructive/request-state.d.ts +2 -6
  42. package/dist/destructive/request-state.js +3 -38
  43. package/dist/destructive/types.d.ts +2 -1
  44. package/dist/governance/available-projects.d.ts +37 -0
  45. package/dist/governance/available-projects.js +132 -0
  46. package/dist/governance/available-projects.test.d.ts +4 -0
  47. package/dist/governance/available-projects.test.js +107 -0
  48. package/dist/governance/mcp-client-session.d.ts +3 -2
  49. package/dist/governance/mcp-client-session.js +3 -2
  50. package/dist/governance/mcp-post-factory-context.d.ts +15 -0
  51. package/dist/governance/mcp-post-factory-context.js +22 -0
  52. package/dist/governance/mcp-post-factory-context.test.js +34 -0
  53. package/dist/governance/project-scope.d.ts +8 -22
  54. package/dist/governance/project-scope.js +36 -44
  55. package/dist/governance/project-scope.test.d.ts +1 -1
  56. package/dist/governance/project-scope.test.js +21 -44
  57. package/dist/governance/promote-allowlist.d.ts +18 -0
  58. package/dist/governance/promote-allowlist.js +66 -0
  59. package/dist/governance/promote-allowlist.test.d.ts +4 -0
  60. package/dist/governance/promote-allowlist.test.js +87 -0
  61. package/dist/http.integration.test.js +116 -265
  62. package/dist/http.test.js +0 -12
  63. package/dist/index.d.ts +5 -1
  64. package/dist/index.integration.test.js +0 -4
  65. package/dist/index.js +31 -16
  66. package/dist/policy/content-developer.d.ts +3 -3
  67. package/dist/policy/content-developer.js +3 -3
  68. package/dist/policy/content-developer.test.js +10 -4
  69. package/dist/policy/content-reader.d.ts +15 -6
  70. package/dist/policy/content-reader.js +39 -10
  71. package/dist/policy/content-reader.test.js +5 -3
  72. package/dist/policy/envelope.d.ts +4 -2
  73. package/dist/policy/envelope.js +2 -2
  74. package/dist/policy/envelope.test.js +28 -0
  75. package/dist/policy/preview-ledger-fault.test.js +101 -426
  76. package/dist/policy/preview-ledger.d.ts +38 -74
  77. package/dist/policy/preview-ledger.js +108 -186
  78. package/dist/policy/preview-ledger.test.js +237 -111
  79. package/dist/policy/result-limits.d.ts +6 -1
  80. package/dist/policy/result-limits.js +28 -29
  81. package/dist/policy/result-limits.test.js +10 -1
  82. package/dist/profiles/ai-agent-ops/v1/index.d.ts +6 -0
  83. package/dist/profiles/ai-agent-ops/v1/index.js +20 -0
  84. package/dist/profiles/ai-agent-ops/v1/prompts.d.ts +5 -0
  85. package/dist/profiles/ai-agent-ops/v1/prompts.js +141 -0
  86. package/dist/profiles/ai-agent-ops/v1/prompts.test.d.ts +4 -0
  87. package/dist/profiles/ai-agent-ops/v1/prompts.test.js +26 -0
  88. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
  89. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
  90. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
  91. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
  92. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
  93. package/dist/profiles/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
  94. package/dist/profiles/ai-agent-ops/v1/resources/playbooks.js +41 -0
  95. package/dist/profiles/content-developer/v1/index.d.ts +8 -0
  96. package/dist/profiles/content-developer/v1/index.js +22 -0
  97. package/dist/{personas → profiles}/content-developer/v1/prompts.d.ts +3 -0
  98. package/dist/profiles/content-developer/v1/prompts.js +157 -0
  99. package/dist/profiles/content-developer/v1/prompts.test.js +286 -0
  100. package/dist/profiles/content-developer/v1/resources/playbooks/chart-types.md +138 -0
  101. package/dist/profiles/content-developer/v1/resources/playbooks/content-move.md +22 -0
  102. package/dist/profiles/content-developer/v1/resources/playbooks/core.md +109 -0
  103. package/dist/profiles/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
  104. package/dist/profiles/content-developer/v1/resources/playbooks/dashboards.md +108 -0
  105. package/dist/profiles/content-developer/v1/resources/playbooks/index.md +15 -0
  106. package/dist/{personas → profiles}/content-developer/v1/resources/playbooks.d.ts +1 -1
  107. package/dist/profiles/content-developer/v1/resources/playbooks.js +65 -0
  108. package/dist/profiles/content-governance/v1/index.d.ts +7 -0
  109. package/dist/profiles/content-governance/v1/index.js +21 -0
  110. package/dist/{personas → profiles}/content-governance/v1/prompts.test.js +2 -2
  111. package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/core.md +3 -3
  112. package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/dashboards.md +1 -1
  113. package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.js +4 -4
  114. package/dist/profiles/content-reader/v1/index.d.ts +6 -0
  115. package/dist/profiles/content-reader/v1/index.js +20 -0
  116. package/dist/profiles/content-reader/v1/prompts.js +162 -0
  117. package/dist/{personas → profiles}/content-reader/v1/prompts.test.js +2 -2
  118. package/dist/profiles/content-reader/v1/resources/playbooks/compare.md +36 -0
  119. package/dist/profiles/content-reader/v1/resources/playbooks/core.md +67 -0
  120. package/dist/profiles/content-reader/v1/resources/playbooks/discover.md +35 -0
  121. package/dist/profiles/content-reader/v1/resources/playbooks/explain-run.md +49 -0
  122. package/dist/profiles/content-reader/v1/resources/playbooks/index.md +14 -0
  123. package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.js +4 -4
  124. package/dist/profiles/data-analyst/v1/index.d.ts +6 -0
  125. package/dist/profiles/data-analyst/v1/index.js +20 -0
  126. package/dist/profiles/data-analyst/v1/prompts.d.ts +5 -0
  127. package/dist/profiles/data-analyst/v1/prompts.js +41 -0
  128. package/dist/profiles/data-analyst/v1/prompts.test.d.ts +4 -0
  129. package/dist/profiles/data-analyst/v1/prompts.test.js +26 -0
  130. package/dist/profiles/data-analyst/v1/resources/playbooks/core.md +41 -0
  131. package/dist/profiles/data-analyst/v1/resources/playbooks/explore.md +26 -0
  132. package/dist/profiles/data-analyst/v1/resources/playbooks/index.md +8 -0
  133. package/dist/profiles/data-analyst/v1/resources/playbooks.d.ts +10 -0
  134. package/dist/profiles/data-analyst/v1/resources/playbooks.js +33 -0
  135. package/dist/profiles/index.d.ts +24 -0
  136. package/dist/profiles/index.js +73 -0
  137. package/dist/profiles/index.test.js +121 -0
  138. package/dist/{personas → profiles}/lib/playbook-resources.d.ts +12 -10
  139. package/dist/{personas → profiles}/lib/playbook-resources.js +28 -24
  140. package/dist/profiles/organization-audit/v1/index.d.ts +6 -0
  141. package/dist/profiles/organization-audit/v1/index.js +20 -0
  142. package/dist/profiles/organization-audit/v1/prompts.js +124 -0
  143. package/dist/{personas → profiles}/organization-audit/v1/prompts.test.js +2 -2
  144. package/dist/profiles/organization-audit/v1/resources/playbooks/access.md +21 -0
  145. package/dist/profiles/organization-audit/v1/resources/playbooks/content.md +19 -0
  146. package/dist/profiles/organization-audit/v1/resources/playbooks/core.md +69 -0
  147. package/dist/profiles/organization-audit/v1/resources/playbooks/deliveries.md +14 -0
  148. package/dist/profiles/organization-audit/v1/resources/playbooks/index.md +14 -0
  149. package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.js +3 -3
  150. package/dist/profiles/profile.membership.test.js +36 -0
  151. package/dist/profiles/semantic-layer/v1/index.d.ts +6 -0
  152. package/dist/profiles/semantic-layer/v1/index.js +19 -0
  153. package/dist/profiles/semantic-layer/v1/prompts.js +96 -0
  154. package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.js +2 -2
  155. package/dist/profiles/semantic-layer/v1/resources/playbooks/compose-compile.md +60 -0
  156. package/dist/profiles/semantic-layer/v1/resources/playbooks/core.md +71 -0
  157. package/dist/profiles/semantic-layer/v1/resources/playbooks/explore.md +79 -0
  158. package/dist/profiles/semantic-layer/v1/resources/playbooks/index.md +13 -0
  159. package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.js +4 -4
  160. package/dist/{personas → profiles}/types.d.ts +6 -7
  161. package/dist/{personas → profiles}/types.js +1 -1
  162. package/dist/protocol-contract.test.js +48 -3
  163. package/dist/server/capabilities.d.ts +6 -6
  164. package/dist/server/capabilities.js +11 -8
  165. package/dist/server/capabilities.test.js +8 -7
  166. package/dist/server/server.js +17 -13
  167. package/dist/server/upstream-errors.d.ts +17 -0
  168. package/dist/server/upstream-errors.js +60 -0
  169. package/dist/server/upstream-errors.test.js +50 -0
  170. package/dist/stdio.process.test.js +65 -9
  171. package/dist/tools/ai-agents/agents.d.ts +7 -0
  172. package/dist/tools/ai-agents/agents.js +32 -0
  173. package/dist/tools/ai-agents/agents.test.d.ts +1 -0
  174. package/dist/tools/ai-agents/agents.test.js +176 -0
  175. package/dist/tools/ai-agents/discovery.d.ts +9 -0
  176. package/dist/tools/ai-agents/discovery.js +73 -0
  177. package/dist/tools/ai-agents/evaluations.d.ts +14 -0
  178. package/dist/tools/ai-agents/evaluations.js +177 -0
  179. package/dist/tools/ai-agents/helpers.d.ts +63 -0
  180. package/dist/tools/ai-agents/helpers.js +321 -0
  181. package/dist/tools/ai-agents/threads.d.ts +7 -0
  182. package/dist/tools/ai-agents/threads.js +40 -0
  183. package/dist/tools/composition/explain-content.js +3 -1
  184. package/dist/tools/index.d.ts +1 -1
  185. package/dist/tools/index.js +1 -1
  186. package/dist/tools/index.test.js +16 -10
  187. package/dist/tools/lib/schema-fields.d.ts +2 -0
  188. package/dist/tools/lib/schema-fields.js +4 -1
  189. package/dist/tools/lib/stable-stringify.d.ts +1 -1
  190. package/dist/tools/lib/stable-stringify.js +1 -1
  191. package/dist/tools/organization/invariants.test.d.ts +1 -1
  192. package/dist/tools/organization/invariants.test.js +5 -5
  193. package/dist/tools/organization/inventory.js +2 -1
  194. package/dist/tools/project/content.js +5 -1
  195. package/dist/tools/project/developer-content-preview.d.ts +3 -2
  196. package/dist/tools/project/developer-content-preview.js +41 -36
  197. package/dist/tools/project/developer-content-shared.d.ts +9 -3
  198. package/dist/tools/project/developer-content-shared.js +8 -4
  199. package/dist/tools/project/developer-content.d.ts +7 -8
  200. package/dist/tools/project/developer-content.js +72 -67
  201. package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
  202. package/dist/tools/project/developer-get-chart-as-code.js +39 -0
  203. package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
  204. package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
  205. package/dist/tools/project/developer-helpers.d.ts +1 -1
  206. package/dist/tools/project/developer-helpers.js +1 -1
  207. package/dist/tools/project/get-dashboard-promote-diff.js +12 -2
  208. package/dist/tools/project/invariants.test.d.ts +1 -1
  209. package/dist/tools/project/invariants.test.js +12 -10
  210. package/dist/tools/project/parameters.js +8 -3
  211. package/dist/tools/project/projects.d.ts +1 -4
  212. package/dist/tools/project/projects.js +37 -15
  213. package/dist/tools/project/projects.test.js +70 -8
  214. package/dist/tools/project/reader-content.js +6 -3
  215. package/dist/tools/project/reader-execution.js +4 -2
  216. package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
  217. package/dist/tools/project/reader-export-chart-image.js +78 -0
  218. package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
  219. package/dist/tools/project/reader-export-chart-image.test.js +149 -0
  220. package/dist/tools/project/spaces.js +12 -4
  221. package/dist/tools/project/spaces.test.d.ts +1 -0
  222. package/dist/tools/project/spaces.test.js +47 -0
  223. package/dist/tools/query/bounded-saved-query.d.ts +4 -3
  224. package/dist/tools/query/bounded-saved-query.js +4 -6
  225. package/dist/tools/query/lifecycle.d.ts +1 -1
  226. package/dist/tools/query/lifecycle.js +25 -31
  227. package/dist/tools/query/query-ledger.d.ts +17 -9
  228. package/dist/tools/query/query-ledger.js +21 -15
  229. package/dist/tools/query/query-ledger.test.js +13 -11
  230. package/dist/tools/query/reader-tool-helpers.d.ts +4 -2
  231. package/dist/tools/query/reader-tool-helpers.js +11 -8
  232. package/dist/tools/query/reader-tool-helpers.test.js +8 -4
  233. package/dist/tools/query/run-metric-query.d.ts +6 -0
  234. package/dist/tools/query/run-metric-query.js +94 -0
  235. package/dist/tools/query/run-metric-query.test.d.ts +4 -0
  236. package/dist/tools/query/run-metric-query.test.js +116 -0
  237. package/dist/tools/registry.d.ts +71 -8
  238. package/dist/tools/registry.js +36 -6
  239. package/dist/tools/semantic/explores.js +43 -17
  240. package/dist/tools/semantic/metrics.js +22 -8
  241. package/dist/tools/semantic/query.js +25 -17
  242. package/dist/tools/shared.d.ts +28 -9
  243. package/dist/tools/shared.js +62 -29
  244. package/dist/tools/shared.test.js +100 -4
  245. package/dist/transports/streamable-http.js +75 -223
  246. package/dist/transports/streamable-http.test.js +19 -12
  247. package/package.json +5 -6
  248. package/dist/destructive/confirmation-claim.d.ts +0 -21
  249. package/dist/destructive/confirmation-claim.js +0 -87
  250. package/dist/destructive/confirmation-claim.test.js +0 -50
  251. package/dist/personas/content-developer/v1/index.d.ts +0 -10
  252. package/dist/personas/content-developer/v1/index.js +0 -51
  253. package/dist/personas/content-developer/v1/prompts.js +0 -138
  254. package/dist/personas/content-developer/v1/prompts.test.js +0 -75
  255. package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +0 -15
  256. package/dist/personas/content-developer/v1/resources/playbooks/core.md +0 -63
  257. package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +0 -55
  258. package/dist/personas/content-developer/v1/resources/playbooks/index.md +0 -13
  259. package/dist/personas/content-developer/v1/resources/playbooks.js +0 -44
  260. package/dist/personas/content-governance/v1/index.d.ts +0 -9
  261. package/dist/personas/content-governance/v1/index.js +0 -29
  262. package/dist/personas/content-reader/v1/index.d.ts +0 -8
  263. package/dist/personas/content-reader/v1/index.js +0 -37
  264. package/dist/personas/content-reader/v1/prompts.js +0 -128
  265. package/dist/personas/content-reader/v1/resources/playbooks/compare.md +0 -21
  266. package/dist/personas/content-reader/v1/resources/playbooks/core.md +0 -40
  267. package/dist/personas/content-reader/v1/resources/playbooks/discover.md +0 -13
  268. package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +0 -19
  269. package/dist/personas/content-reader/v1/resources/playbooks/index.md +0 -14
  270. package/dist/personas/index.d.ts +0 -22
  271. package/dist/personas/index.js +0 -73
  272. package/dist/personas/index.test.js +0 -109
  273. package/dist/personas/organization-audit/v1/index.d.ts +0 -8
  274. package/dist/personas/organization-audit/v1/index.js +0 -42
  275. package/dist/personas/organization-audit/v1/prompts.js +0 -92
  276. package/dist/personas/organization-audit/v1/resources/playbooks/access.md +0 -13
  277. package/dist/personas/organization-audit/v1/resources/playbooks/content.md +0 -9
  278. package/dist/personas/organization-audit/v1/resources/playbooks/core.md +0 -36
  279. package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +0 -9
  280. package/dist/personas/organization-audit/v1/resources/playbooks/index.md +0 -14
  281. package/dist/personas/persona.parity.test.js +0 -26
  282. package/dist/personas/semantic-layer/v1/index.d.ts +0 -8
  283. package/dist/personas/semantic-layer/v1/index.js +0 -32
  284. package/dist/personas/semantic-layer/v1/prompts.js +0 -85
  285. package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +0 -55
  286. package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +0 -39
  287. package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +0 -76
  288. package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +0 -13
  289. package/dist/store/config.d.ts +0 -11
  290. package/dist/store/config.js +0 -50
  291. package/dist/store/config.test.js +0 -56
  292. package/dist/store/create-oauth-broker-store.d.ts +0 -6
  293. package/dist/store/create-oauth-broker-store.js +0 -16
  294. package/dist/store/create-preview-store.d.ts +0 -10
  295. package/dist/store/create-preview-store.js +0 -30
  296. package/dist/store/create-session-store.d.ts +0 -19
  297. package/dist/store/create-session-store.js +0 -24
  298. package/dist/store/in-memory-preview-store.d.ts +0 -17
  299. package/dist/store/in-memory-preview-store.js +0 -72
  300. package/dist/store/redis-client.d.ts +0 -11
  301. package/dist/store/redis-client.js +0 -48
  302. package/dist/store/redis-oauth-broker-store.d.ts +0 -42
  303. package/dist/store/redis-oauth-broker-store.js +0 -167
  304. package/dist/store/redis-oauth-broker-store.test.js +0 -80
  305. package/dist/store/redis-preview-store.d.ts +0 -23
  306. package/dist/store/redis-preview-store.js +0 -94
  307. package/dist/store/redis-preview-store.test.js +0 -39
  308. package/dist/store/redis-session-index.d.ts +0 -33
  309. package/dist/store/redis-session-index.js +0 -49
  310. package/dist/store/types.d.ts +0 -13
  311. package/dist/store/types.js +0 -8
  312. package/dist/transports/http-request-utils.d.ts +0 -2
  313. package/dist/transports/http-request-utils.js +0 -13
  314. package/dist/transports/session-store.d.ts +0 -72
  315. package/dist/transports/session-store.js +0 -143
  316. package/dist/transports/session-store.test.js +0 -111
  317. /package/dist/{destructive/confirmation-claim.test.d.ts → audit/server-profile.test.d.ts} +0 -0
  318. /package/dist/{personas/index.test.d.ts → config/obsolete-env.test.d.ts} +0 -0
  319. /package/dist/{personas/persona.parity.test.d.ts → governance/mcp-post-factory-context.test.d.ts} +0 -0
  320. /package/dist/{store/config.test.d.ts → policy/envelope.test.d.ts} +0 -0
  321. /package/dist/{personas → profiles}/content-developer/v1/prompts.test.d.ts +0 -0
  322. /package/dist/{personas → profiles}/content-governance/v1/prompts.d.ts +0 -0
  323. /package/dist/{personas → profiles}/content-governance/v1/prompts.js +0 -0
  324. /package/dist/{personas → profiles}/content-governance/v1/prompts.test.d.ts +0 -0
  325. /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/charts.md +0 -0
  326. /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/index.md +0 -0
  327. /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.d.ts +0 -0
  328. /package/dist/{personas → profiles}/content-reader/v1/prompts.d.ts +0 -0
  329. /package/dist/{personas → profiles}/content-reader/v1/prompts.test.d.ts +0 -0
  330. /package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.d.ts +0 -0
  331. /package/dist/{store/redis-oauth-broker-store.test.d.ts → profiles/index.test.d.ts} +0 -0
  332. /package/dist/{personas → profiles}/organization-audit/v1/prompts.d.ts +0 -0
  333. /package/dist/{personas → profiles}/organization-audit/v1/prompts.test.d.ts +0 -0
  334. /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.d.ts +0 -0
  335. /package/dist/{store/redis-preview-store.test.d.ts → profiles/profile.membership.test.d.ts} +0 -0
  336. /package/dist/{personas → profiles}/semantic-layer/v1/prompts.d.ts +0 -0
  337. /package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.d.ts +0 -0
  338. /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.d.ts +0 -0
  339. /package/dist/{transports/session-store.test.d.ts → server/upstream-errors.test.d.ts} +0 -0
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ /**
3
+ * Content-developer prompt/playbook invariants.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const common_1 = require("@lightdash-tools/common");
40
+ const vitest_1 = require("vitest");
41
+ const playbooks_js_1 = require("./resources/playbooks.js");
42
+ (0, vitest_1.describe)('content-developer prompts/playbook', () => {
43
+ (0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
44
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
45
+ for (const id of (0, common_1.listMcpToolNamesByProfile)('content-developer')) {
46
+ (0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
47
+ }
48
+ (0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
49
+ (0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
50
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('terraform');
51
+ });
52
+ (0, vitest_1.it)('forbids space create/update and orphan chart publish', () => {
53
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
54
+ (0, vitest_1.expect)(md).toContain('terraform');
55
+ (0, vitest_1.expect)(md).toContain('dashboardslug');
56
+ (0, vitest_1.expect)(md).toContain('get_chart_as_code');
57
+ (0, vitest_1.expect)(md).toMatch(/dashboard shell first|create the dashboard shell first/);
58
+ (0, vitest_1.expect)(md).toContain('encode');
59
+ (0, vitest_1.expect)(md).toMatch(/xref/);
60
+ (0, vitest_1.expect)(md).toContain('chart-types');
61
+ (0, vitest_1.expect)(md).not.toMatch(/`create_space`/);
62
+ (0, vitest_1.expect)(md).not.toMatch(/`update_space`/);
63
+ (0, vitest_1.expect)((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
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('dashboardslug');
67
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('skinny');
68
+ });
69
+ (0, vitest_1.it)('documents create-chart top-level slug, nested dashboard apply, and chart-type map', () => {
70
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
71
+ (0, vitest_1.expect)(md).toContain('top-level');
72
+ (0, vitest_1.expect)(md).toMatch(/dashboard:\s*\{/);
73
+ (0, vitest_1.expect)(md).toMatch(/does \*\*not\*\* add tiles|does not place the chart|ownership alone does not/);
74
+ (0, vitest_1.expect)(md).toContain('pie');
75
+ (0, vitest_1.expect)(md).toContain('sankey');
76
+ (0, vitest_1.expect)(md).toContain('gauge');
77
+ (0, vitest_1.expect)(md).toContain('map');
78
+ (0, vitest_1.expect)(md).toContain('charts[0].data.uuid');
79
+ (0, vitest_1.expect)(md).toMatch(/≤2 concurrent|<=2 concurrent/);
80
+ });
81
+ (0, vitest_1.it)('documents dashboard-design topic with markdown and filters', () => {
82
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
83
+ (0, vitest_1.expect)(md).toContain('dashboard-design');
84
+ (0, vitest_1.expect)(md).toContain('markdown');
85
+ (0, vitest_1.expect)(md).toContain('empty-value');
86
+ (0, vitest_1.expect)(md).toContain('filters');
87
+ (0, vitest_1.expect)(md).toMatch(/required:\s*true|required:true/);
88
+ (0, vitest_1.expect)(md).toContain('phase design');
89
+ (0, vitest_1.expect)(md).toContain('before any write');
90
+ (0, vitest_1.expect)(md).toContain('design spec');
91
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('design spec');
92
+ });
93
+ (0, vitest_1.it)('requires objective-first Design Spec and clarify-before-spec language', () => {
94
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
95
+ (0, vitest_1.expect)(md).toContain('objective');
96
+ (0, vitest_1.expect)(md).toMatch(/insight question/);
97
+ (0, vitest_1.expect)(md).toMatch(/clarif/);
98
+ (0, vitest_1.expect)(md).toMatch(/cites an insight|cite an insight|citing insights/);
99
+ (0, vitest_1.expect)(md).toMatch(/only when the user \*\*explicitly\*\* asks|only when the user explicitly/);
100
+ (0, vitest_1.expect)(md).toMatch(/reference map|not a build order/);
101
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('objective');
102
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toMatch(/viz-type|all-chart-types|all chart types/);
103
+ });
104
+ (0, vitest_1.it)('documents explore↔filter Spec with tileTargets exclude', () => {
105
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
106
+ (0, vitest_1.expect)(md).toContain('tiletargets');
107
+ (0, vitest_1.expect)(md).toMatch(/exclude/);
108
+ (0, vitest_1.expect)(md).toMatch(/one explore|same-explore/);
109
+ (0, vitest_1.expect)(md).toMatch(/tile uuid|tile uuids/);
110
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('tiletargets');
111
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toMatch(/target\.tablename|tablename/);
112
+ });
113
+ (0, vitest_1.it)('requires projectUuid on confirm_preview and multi-viz batch SOP', () => {
114
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
115
+ (0, vitest_1.expect)(md).toMatch(/confirm_preview.*projectuuid|projectuuid.*confirm_preview/);
116
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('confirm_preview');
117
+ (0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('projectuuid');
118
+ (0, vitest_1.expect)(md).toMatch(/batch sop|shell → create all charts|one.*update_dashboard/);
119
+ (0, vitest_1.expect)(md).toMatch(/diff\.removed|diff noise/);
120
+ (0, vitest_1.expect)(md).toMatch(/tiles.*diff\.removed|diff\.removed.*tiles|omit.*tiles|do \*\*not\*\* apply/);
121
+ (0, vitest_1.expect)(md).toContain('chartuuidorslug');
122
+ (0, vitest_1.expect)(md).toMatch(/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/);
145
+ });
146
+ (0, vitest_1.it)('documents improve/professionalize Spec delta, cull, and leftover handoff', () => {
147
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
148
+ (0, vitest_1.expect)(md).toMatch(/professionalize|improve \/ professionalize/);
149
+ (0, vitest_1.expect)(md).toMatch(/keep \/ drop \/ rename|keep\/drop\/rename/);
150
+ (0, vitest_1.expect)(md).toMatch(/cull/);
151
+ (0, vitest_1.expect)(md).toMatch(/untiled|leftover/);
152
+ (0, vitest_1.expect)(md).toContain('content-governance');
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
+ });
187
+ (0, vitest_1.it)('does not register standalone build_chart or design_dashboard prompt', async () => {
188
+ const { registerContentDeveloperPrompts } = await Promise.resolve().then(() => __importStar(require('./prompts.js')));
189
+ const names = [];
190
+ const promptArgs = [];
191
+ let publishText = '';
192
+ let authorText = '';
193
+ let refactorText = '';
194
+ const server = {
195
+ registerPrompt: (name, _meta, handler) => {
196
+ names.push(name);
197
+ if (name === 'create_dashboard' ||
198
+ name === 'improve_dashboard' ||
199
+ name === 'refactor_dashboard') {
200
+ promptArgs.push({
201
+ name,
202
+ messages: handler({
203
+ goal: 'x',
204
+ improvementGoal: 'y',
205
+ dashboardUuidOrSlug: 'dash-1',
206
+ }).messages,
207
+ });
208
+ }
209
+ if (name === 'publish_content') {
210
+ const messages = handler({ contentReferences: 'dash-1' }).messages;
211
+ publishText = messages
212
+ .filter((m) => m.content.type === 'text')
213
+ .map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
214
+ .join('\n')
215
+ .toLowerCase();
216
+ }
217
+ if (name === 'author_chart') {
218
+ const messages = handler({
219
+ goal: 'kpi',
220
+ dashboardSlug: 'my-dash',
221
+ }).messages;
222
+ authorText = messages
223
+ .filter((m) => m.content.type === 'text')
224
+ .map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
225
+ .join('\n')
226
+ .toLowerCase();
227
+ }
228
+ if (name === 'refactor_dashboard') {
229
+ const messages = handler({
230
+ dashboardUuidOrSlug: 'dash-1',
231
+ }).messages;
232
+ refactorText = messages
233
+ .filter((m) => m.content.type === 'text')
234
+ .map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
235
+ .join('\n')
236
+ .toLowerCase();
237
+ }
238
+ },
239
+ };
240
+ registerContentDeveloperPrompts(server);
241
+ (0, vitest_1.expect)(names).not.toContain('build_chart');
242
+ (0, vitest_1.expect)(names).not.toContain('design_dashboard');
243
+ (0, vitest_1.expect)(names).toContain('author_chart');
244
+ (0, vitest_1.expect)(names).toContain('move_content');
245
+ (0, vitest_1.expect)(names).toContain('create_dashboard');
246
+ (0, vitest_1.expect)(names).toContain('improve_dashboard');
247
+ (0, vitest_1.expect)(names).toContain('refactor_dashboard');
248
+ (0, vitest_1.expect)(names).toContain('publish_content');
249
+ for (const { name, messages } of promptArgs) {
250
+ const typed = messages;
251
+ const text = typed
252
+ .filter((m) => m.content.type === 'text')
253
+ .map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
254
+ .join('\n')
255
+ .toLowerCase();
256
+ (0, vitest_1.expect)(text).toContain('design spec');
257
+ (0, vitest_1.expect)(text).toMatch(/stop until the user proceeds|proceeds \/ approves/);
258
+ const uris = typed
259
+ .filter((m) => m.content.type === 'resource')
260
+ .map((m) => { var _a; return (_a = m.content.resource) === null || _a === void 0 ? void 0 : _a.uri; });
261
+ (0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/core');
262
+ (0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/dashboards');
263
+ (0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/dashboard-design');
264
+ if (name === 'create_dashboard' || name === 'improve_dashboard') {
265
+ (0, vitest_1.expect)(text).toContain('objective');
266
+ (0, vitest_1.expect)(text).toMatch(/clarif/);
267
+ (0, vitest_1.expect)(text).toMatch(/only if the user explicitly asked/);
268
+ (0, vitest_1.expect)(text).toMatch(/tablename|filter apply\/exclude|apply\/exclude/);
269
+ (0, vitest_1.expect)(uris).toContain('lightdash://playbooks/content-developer/chart-types');
270
+ }
271
+ if (name === 'improve_dashboard') {
272
+ (0, vitest_1.expect)(text).toMatch(/keep \/ drop \/ rename|professionalize/);
273
+ (0, vitest_1.expect)(text).toMatch(/untiled|leftover/);
274
+ (0, vitest_1.expect)(text).toContain('content-governance');
275
+ }
276
+ }
277
+ (0, vitest_1.expect)(publishText).toContain('objective');
278
+ (0, vitest_1.expect)(publishText).toMatch(/insight/);
279
+ (0, vitest_1.expect)(publishText).toMatch(/tiletargets|exclude\/remap|exclude\/remap/);
280
+ (0, vitest_1.expect)(publishText).toMatch(/untiled|leftover/);
281
+ (0, vitest_1.expect)(publishText).toContain('content-governance');
282
+ (0, vitest_1.expect)(authorText).toContain('board insight');
283
+ (0, vitest_1.expect)(refactorText).toMatch(/approved spec|user request allows/);
284
+ (0, vitest_1.expect)(refactorText).not.toMatch(/unless explicitly requested/);
285
+ });
286
+ });
@@ -0,0 +1,138 @@
1
+ # Content-developer — chart types
2
+
3
+ URI: `lightdash://playbooks/content-developer/chart-types`
4
+
5
+ Pick a viz type to **answer an insight question** from the Design Spec Objective. The table below is a **reference map**, not a build order — do not walk every row unless the user explicitly asked for multi-viz / all chart types. Prefer **clone** (`get_chart_as_code` / `duplicate_chart`) over inventing viz configs. Docs: [overview](https://docs.lightdash.com/references/chart-types/overview).
6
+
7
+ When the user **does** ask for all types: follow dashboards **Multi-viz batch SOP** (shell → ≤2 concurrent chart creates → one tile update), 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.
22
+
23
+ ## UI intent → as-code `chartConfig.type`
24
+
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 |
38
+
39
+ Bar/line/area/scatter are **series** types under one `cartesian` chart — not separate top-level `chartConfig.type` values.
40
+
41
+ ## Required cartesian shape
42
+
43
+ Every series needs `type` **and** `encode.xRef` / `yRef`. Never ship `{ series: [{ type: "bar" }] }` alone (UI can TypeError).
44
+
45
+ ```yaml
46
+ chartConfig:
47
+ type: cartesian
48
+ config:
49
+ layout:
50
+ xField: orders_status
51
+ yField:
52
+ - orders_num_unique_order_ids
53
+ eChartsConfig:
54
+ series:
55
+ - type: bar
56
+ encode:
57
+ xRef:
58
+ field: orders_status
59
+ yRef:
60
+ field: orders_num_unique_order_ids
61
+ yAxisIndex: 0
62
+ ```
63
+
64
+ Mixed charts: one series per metric (e.g. bar + line) with matching encodes; optional dual axis via `yAxisIndex: 0|1`.
65
+
66
+ Horizontal bar: same as bar plus `layout.flipAxes: true`.
67
+
68
+ ## Non-cartesian shapes (clone when possible)
69
+
70
+ ```yaml
71
+ # pie
72
+ chartConfig:
73
+ type: pie
74
+ config:
75
+ groupFieldIds: [orders_status]
76
+ metricId: orders_num_unique_order_ids
77
+ isDonut: false
78
+ showLegend: true
79
+ showPercentage: true
80
+ showValue: true
81
+
82
+ # funnel (row stages = dimension values)
83
+ chartConfig:
84
+ type: funnel
85
+ config:
86
+ fieldId: orders_num_unique_order_ids
87
+ dataInput: row
88
+
89
+ # treemap
90
+ chartConfig:
91
+ type: treemap
92
+ config:
93
+ groupFieldIds: [orders_status]
94
+ sizeMetricId: orders_num_unique_order_ids
95
+
96
+ # sankey (two dims in metricQuery.dimensions; keep customDimensions if cloned)
97
+ chartConfig:
98
+ type: sankey
99
+ config:
100
+ sourceFieldId: use_coupon
101
+ targetFieldId: orders_status
102
+ metricFieldId: orders_num_unique_order_ids
103
+
104
+ # big_number
105
+ chartConfig:
106
+ type: big_number
107
+ config:
108
+ selectedField: orders_num_unique_order_ids
109
+ showBigNumberLabel: true
110
+ showComparison: false
111
+ comparisonFormat: raw
112
+
113
+ # gauge
114
+ chartConfig:
115
+ type: gauge
116
+ config:
117
+ selectedField: orders_num_unique_order_ids
118
+ min: 0
119
+ max: 200
120
+ showAxisLabels: true
121
+ showPercentage: false
122
+
123
+ # table
124
+ chartConfig:
125
+ type: table
126
+ config: {}
127
+ ```
128
+
129
+ ## Hard rules
130
+
131
+ - Clone `chartConfig` from a rendering seed on the same `tableName`; change series `type` / top-level type only when needed.
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.
134
+ - When cloning charts that use SQL/bin custom dims (e.g. coupon flags), copy `metricQuery.customDimensions` verbatim.
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.
136
+ - For dashboard work set `dashboardSlug` **and** tile via `update_dashboard` (ownership alone does not place tiles).
137
+ - `create_chart` success body is `{ charts: [{ action, data: { uuid, slug, … } }] }` — read UUID from `charts[0].data.uuid` for tiles.
138
+ - Multi-viz boards: raise the new-chart budget; prefer **≤2 concurrent** preview→confirm→apply chains (hosted tunnels often 502 under heavier parallelism).
@@ -0,0 +1,22 @@
1
+ # Content-developer — content move
2
+
3
+ URI: `lightdash://playbooks/content-developer/content-move`
4
+
5
+ Move charts/dashboards into **existing** spaces. Never create, rename, or update spaces (Terraform / out-of-band).
6
+
7
+ ## Steps
8
+
9
+ 1. Discover with `list_spaces` / `get_space` / `search_content`. Confirm the **target space already exists** (`targetSpaceUuid`).
10
+ 2. Resolve each item to a **UUID** (not only a name). Prefer `search_content` short tokens or space inventory.
11
+ 3. Preview with `preview_content_move`:
12
+ - Required: `itemUuids`, `targetSpaceUuid` (null = project root if supported), `contentTypes` (same length/order as `itemUuids`).
13
+ - Optional: `chartSources` (must match lengths and match apply exactly).
14
+ 4. `confirm_preview` with `resourceKind: 'content-move'` and the preview's exact `resourceKey` → use the **new** validated `previewToken`.
15
+ 5. Apply with `move_content` using the same payload hash fields.
16
+ 6. Report moved item UUIDs and target space. Re-`get_space` if you need confirmation.
17
+
18
+ ## Pitfalls
19
+
20
+ - Wrong `contentTypes` length/order vs `itemUuids` fails closed.
21
+ - Do not invent space UUIDs — copy from `list_spaces` / `get_space`.
22
+ - Moving does not replace promote; cross-project promote stays on content-governance.
@@ -0,0 +1,109 @@
1
+ # Content-developer core
2
+
3
+ URI: `lightdash://playbooks/content-developer/core`
4
+
5
+ ## Purpose
6
+
7
+ Author **semantic** charts and dashboards inside one resolved project. **Clarify objective → Design Spec → user approval →** create the dashboard shell first, then create charts scoped with `dashboardSlug` (official Lightdash as-code: dashboard-owned charts do not appear as independent space charts). Every write is gated: `preview_*` → `confirm_preview` → apply.
8
+
9
+ this 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
+
11
+ ## Hard bans
12
+
13
+ - Do not execute arbitrary metric queries, raw SQL, warehouse runs, or saved-chart execution (no `run_chart` here).
14
+ - Do not author or upsert SQL charts.
15
+ - Do not hard-delete, rollback, or promote content. Promote dashboards via **content-governance**.
16
+ - Do not perform organization administration or list org-wide projects.
17
+ - Do not create or update spaces — spaces are Terraform / out-of-band. Use existing spaces only.
18
+ - Do not create **space-only** charts for dashboard work (omit `dashboardSlug`). New charts must set `dashboardSlug` to the dashboard already created.
19
+ - Do not call `preview_*` or write tools for a **new** dashboard or a **material** dashboard redesign until a Design Spec (with settled **Objective**) was presented and the user approved or amended it in-thread.
20
+ - Do not start writes from a viz-type / “all chart types” checklist alone — Objective and insight questions come first (an explicit user all-types ask may be the Objective after a one-line restatement).
21
+ - Do not call `confirm_preview` without **`projectUuid`** when there is no HTTP pin — `PROJECT_SCOPE_REQUIRED` even if the matching `preview_*` already had a project.
22
+ - Do not attach dashboard filters whose `target.tableName` is absent from a tile’s explore without explicitly excluding that tile (or remapping) via `tileTargets`.
23
+ - Do not treat chart create as done without a dashboard shell and tiles that reference those charts.
24
+ - Do not invent `fieldId`s. Copy from `get_chart_as_code` / `get_chart` (`includeQueryDefinition`) or semantic-layer.
25
+ - Do not invent skinny `chartConfig` (e.g. `{ series: [{ type: 'bar' }] }` only) — clone a working as-code body and keep series/layout/encode structure.
26
+ - Do not call a write tool without a validated, unexpired HMAC `previewToken` from the matching `preview_*` then `confirm_preview`.
27
+ - Do not 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_*`.
28
+ - Do not reuse a **draft** token after confirm (confirm returns a **new** validated token) or after payload/baseline drift (`PREVIEW_STALE`).
29
+ - Do not unlock with a different resource's preview — `resourceKind` / `resourceKey` must match the preview exactly.
30
+ - Do not treat `validate_chart` / `validate_dashboard` as unlock — saved-UUID health checks only (not UI-render proof).
31
+ - Do not reveal secrets, warehouse credentials, or hidden SQL.
32
+
33
+ ## Default budgets (override when the user expands scope)
34
+
35
+ | Resource | Default |
36
+ | --------------------------------------------------- | -------------------------------------------------------------------------------- |
37
+ | `search_content` pages | `pageSize≤25`, stop after **2** pages |
38
+ | Spaces deep-dived (`get_space`) | **≤3** |
39
+ | Seed charts inspected / cloned | **≤12** |
40
+ | New charts created per dashboard | **≤8** (raise only when the user explicitly expands scope, e.g. all chart types) |
41
+ | Concurrent preview→confirm→apply chains | **≤2** (hosted tunnels often 502 under heavier parallelism) |
42
+ | Tile mutations after shell | Prefer one `update_dashboard` with full tiles; else **≤8** `add_dashboard_tile` |
43
+ | Preview→confirm→apply retries after `PREVIEW_STALE` | **≤2** per resource |
44
+
45
+ Record when a budget stopped you. User-requested “one of every chart type” overrides the new-chart cap.
46
+
47
+ ## Allowed tools (`lightdash_*`)
48
+
49
+ | Tool | Use for |
50
+ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
51
+ | `get_project` | Resolve project; read `developerCapabilities` (mutate yes; **execute charts/tiles = false**) |
52
+ | `search_content` | Find charts/dashboards; prefer short tokens, not marketing phrases |
53
+ | `list_spaces` / `get_space` | Existing spaces; pick `spaceUuid` / `spaceSlug` |
54
+ | `get_dashboard` / `get_chart` | Metadata. `get_chart` arg is **`chartUuidOrSlug`** (not `chartUuid`). Tiles often omit `x/y/w/h` |
55
+ | `get_chart_as_code` | **Clone** upsert-shaped `chartConfig` + `metricQuery` before create/update |
56
+ | `preview_chart_changes` / `preview_dashboard_changes` / `preview_content_move` | Mint draft `previewToken` + `resourceKey` |
57
+ | `confirm_preview` | Unlock; returns **new** validated token — always pass **`projectUuid`** without HTTP pin |
58
+ | `create_chart` / `update_chart` / `duplicate_chart` | Semantic as-code writes (after confirm); set `dashboardSlug` |
59
+ | `create_dashboard` / `update_dashboard` / `duplicate_dashboard` | Dashboard shell then tile updates |
60
+ | `add_dashboard_tile` / `move_dashboard_tile` / `remove_dashboard_tile` / `resize_dashboard_tile` | Tile ops; each needs preview of the **full next tiles array** |
61
+ | `move_content` | Relocate into existing spaces |
62
+ | `validate_chart` / `validate_dashboard` | Optional post-apply health (`chartUuid` / dashboard UUID) |
63
+ | `compare_chart_versions` / `compare_dashboard_versions` | Drift / refactor |
64
+
65
+ ## Phase 0 — Resolve project
66
+
67
+ 1. Always pass **`projectUuid`** (or HTTP `X-Lightdash-Project` pin). Else `PROJECT_SCOPE_REQUIRED` — stop.
68
+ 2. Call `get_project`. Record UUID, name, pin, and `developerCapabilities`.
69
+ 3. Expect execution capabilities **false** — you cannot verify query results here.
70
+ 4. Never switch projects or invent an org project list.
71
+ 5. Shared discovery tools (`get_dashboard`, `get_chart`, …) report `context.profile: content-developer` on this server — same serving profile as write tools.
72
+
73
+ ## Preview → confirm → apply (every write)
74
+
75
+ 1. `preview_*` → record `previewToken`, `previewId`, `contentHash`, `resourceKey`, `expiresAt`, diff. Treat the proposed `changes` / nested `chart` / `dashboard` object as **immutable** until apply succeeds.
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.
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.
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.
83
+
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.
85
+
86
+ ### ResourceKey cheat sheet
87
+
88
+ | Operation | Typical `resourceKind` | Typical `resourceKey` |
89
+ | ------------------- | ---------------------- | ------------------------------------------------------------------------ |
90
+ | Create chart | `chart` | target **`slug`** — only if `preview_chart_changes` got top-level `slug` |
91
+ | Update chart | `chart` | chart **UUID** (slug is alias) |
92
+ | Duplicate chart | `chart` | **source** UUID |
93
+ | Create dashboard | `dashboard` | literal `new` |
94
+ | Update / tile ops | `dashboard` | dashboard UUID (slug is alias) |
95
+ | Duplicate dashboard | `dashboard` | **source** UUID |
96
+ | Content move | `content-move` | preview's `resourceKey` |
97
+
98
+ **Create-chart gotcha:** omit top-level `slug` on `preview_chart_changes` → preview returns `resourceKey: "new"`, but `create_chart` applies with `resourceKey = args.slug` → binding mismatch. Always pass top-level `slug` (same as `changes.slug`) on create previews.
99
+
100
+ ### Apply arg pitfalls
101
+
102
+ - `preview_*` uses flat `changes`; `create_dashboard` / `update_dashboard` wrap the **same** body as `dashboard: { … }`; `create_chart` / `update_chart` wrap as `chart: { … }` plus top-level `slug`.
103
+ - `create_chart` requires top-level **`slug`** **and** `chart.slug` (same value).
104
+ - Charts use **`spaceSlug`** (+ `skipSpaceCreate: true`) and **`dashboardSlug`** for dashboard-owned charts.
105
+ - Dashboards use **`spaceUuid`** (not `spaceSlug`).
106
+ - `dashboardSlug` owns the chart to the dashboard but does **not** add tiles — still `update_dashboard` with a full tile array.
107
+ - Tile shape: `{ type: 'saved_chart', x, y, w, h, properties: { savedChartUuid, title? } }` — use the UUID from `create_chart` / `duplicate_chart` (36-column grid; half-width ≈ `w: 18`). Optional `chartSlug` is metadata only; do not omit `savedChartUuid`.
108
+ - `create_chart` response: extract UUID from `charts[0].data.uuid` (not a bare chart object).
109
+ - Viz shapes: `lightdash://playbooks/content-developer/chart-types`.