@lightdash-tools/mcp 0.14.0 → 0.17.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 +43 -14
- package/dist/auth/oauth-broker/as-metadata.d.ts +6 -2
- package/dist/auth/oauth-broker/as-metadata.js +8 -4
- package/dist/auth/oauth-broker/invoke-origins.d.ts +16 -0
- package/dist/auth/oauth-broker/invoke-origins.js +112 -0
- package/dist/auth/oauth-broker/invoke-origins.test.d.ts +1 -0
- package/dist/auth/oauth-broker/invoke-origins.test.js +82 -0
- package/dist/auth/oauth-broker/lightdash-token.d.ts +6 -5
- package/dist/auth/oauth-broker/lightdash-token.js +6 -10
- package/dist/auth/oauth-broker/mcp-access-token.d.ts +31 -0
- package/dist/auth/oauth-broker/mcp-access-token.js +109 -0
- package/dist/auth/oauth-broker/mcp-access-token.test.d.ts +1 -0
- package/dist/auth/oauth-broker/mcp-access-token.test.js +61 -0
- package/dist/auth/oauth-broker/pending-store.d.ts +9 -3
- package/dist/auth/oauth-broker/pending-store.js +5 -3
- package/dist/auth/oauth-broker/pending-store.test.js +28 -44
- package/dist/auth/oauth-broker/routes.d.ts +2 -1
- package/dist/auth/oauth-broker/routes.js +124 -48
- package/dist/auth/oauth-broker/routes.test.js +191 -16
- package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +3 -1
- package/dist/auth/resource-server/lightdash-oauth-middleware.js +65 -41
- package/dist/auth/resource-server/lightdash-oauth-middleware.test.js +95 -59
- package/dist/auth/resource-server/oauth-protected-resource.d.ts +2 -2
- package/dist/auth/resource-server/oauth-protected-resource.js +8 -11
- package/dist/auth/resource-server/www-authenticate.test.js +3 -3
- package/dist/bin.js +33 -7
- package/dist/config/env.d.ts +10 -0
- package/dist/config/env.js +11 -1
- package/dist/config/load-mcp-config.d.ts +14 -1
- package/dist/config/load-mcp-config.js +35 -8
- package/dist/config/load-mcp-config.test.js +49 -0
- package/dist/config/prompt-context-policy.d.ts +18 -0
- package/dist/config/prompt-context-policy.js +40 -0
- package/dist/config/prompt-context-policy.test.d.ts +4 -0
- package/dist/config/prompt-context-policy.test.js +35 -0
- package/dist/config/test-mcp-http-config.js +1 -1
- package/dist/governance/mcp-post-factory-context.d.ts +2 -0
- package/dist/http.d.ts +7 -1
- package/dist/http.integration.helpers.d.ts +50 -0
- package/dist/http.integration.helpers.js +190 -0
- package/dist/http.integration.test.js +81 -187
- package/dist/http.invoke-origin.integration.test.d.ts +1 -0
- package/dist/http.invoke-origin.integration.test.js +108 -0
- package/dist/http.js +10 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -3
- package/dist/policy/content-developer.d.ts +5 -0
- package/dist/policy/content-developer.js +25 -1
- package/dist/policy/content-developer.test.js +29 -0
- package/dist/profiles/ai-agent-ops/v1/invariants.d.ts +27 -0
- package/dist/profiles/ai-agent-ops/v1/invariants.js +39 -0
- package/dist/profiles/ai-agent-ops/v1/prompts.d.ts +3 -2
- package/dist/profiles/ai-agent-ops/v1/prompts.js +67 -41
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks.d.ts +2 -1
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks.js +10 -3
- package/dist/profiles/content-developer/v1/invariants.d.ts +69 -0
- package/dist/profiles/content-developer/v1/invariants.js +95 -0
- package/dist/profiles/content-developer/v1/prompt-specs.d.ts +32 -0
- package/dist/profiles/content-developer/v1/prompt-specs.js +56 -0
- package/dist/profiles/content-developer/v1/prompts.d.ts +4 -3
- package/dist/profiles/content-developer/v1/prompts.js +65 -71
- package/dist/profiles/content-developer/v1/prompts.test.js +61 -7
- package/dist/profiles/content-developer/v1/resources/playbooks/core.md +1 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/index.md +11 -8
- package/dist/profiles/content-developer/v1/resources/playbooks/recovery/dashboard-diff.md +15 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/recovery/preview-required.md +14 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/recovery/preview-stale.md +21 -0
- package/dist/profiles/content-developer/v1/resources/playbooks.d.ts +3 -2
- package/dist/profiles/content-developer/v1/resources/playbooks.js +35 -22
- package/dist/profiles/content-governance/v1/invariants.d.ts +27 -0
- package/dist/profiles/content-governance/v1/invariants.js +39 -0
- package/dist/profiles/content-governance/v1/prompts.d.ts +4 -2
- package/dist/profiles/content-governance/v1/prompts.js +31 -19
- package/dist/profiles/content-governance/v1/resources/playbooks.d.ts +2 -1
- package/dist/profiles/content-governance/v1/resources/playbooks.js +8 -9
- package/dist/profiles/content-reader/v1/invariants.d.ts +33 -0
- package/dist/profiles/content-reader/v1/invariants.js +47 -0
- package/dist/profiles/content-reader/v1/prompt-specs.d.ts +18 -0
- package/dist/profiles/content-reader/v1/prompt-specs.js +33 -0
- package/dist/profiles/content-reader/v1/prompts.d.ts +3 -2
- package/dist/profiles/content-reader/v1/prompts.js +69 -76
- package/dist/profiles/content-reader/v1/resources/playbooks.d.ts +2 -1
- package/dist/profiles/content-reader/v1/resources/playbooks.js +10 -11
- package/dist/profiles/data-analyst/v1/invariants.d.ts +21 -0
- package/dist/profiles/data-analyst/v1/invariants.js +31 -0
- package/dist/profiles/data-analyst/v1/prompts.d.ts +3 -2
- package/dist/profiles/data-analyst/v1/prompts.js +17 -9
- package/dist/profiles/data-analyst/v1/resources/playbooks.d.ts +2 -1
- package/dist/profiles/data-analyst/v1/resources/playbooks.js +6 -7
- package/dist/profiles/lib/playbook-resources.d.ts +16 -34
- package/dist/profiles/lib/playbook-resources.js +55 -76
- package/dist/profiles/lib/prompt-context.d.ts +71 -0
- package/dist/profiles/lib/prompt-context.js +205 -0
- package/dist/profiles/lib/prompt-context.test.d.ts +4 -0
- package/dist/profiles/lib/prompt-context.test.js +154 -0
- package/dist/profiles/lib/prompt-invariants.d.ts +20 -0
- package/dist/profiles/lib/prompt-invariants.js +54 -0
- package/dist/profiles/organization-audit/v1/invariants.d.ts +24 -0
- package/dist/profiles/organization-audit/v1/invariants.js +35 -0
- package/dist/profiles/organization-audit/v1/prompts.d.ts +3 -2
- package/dist/profiles/organization-audit/v1/prompts.js +44 -28
- package/dist/profiles/organization-audit/v1/resources/playbooks.d.ts +2 -1
- package/dist/profiles/organization-audit/v1/resources/playbooks.js +10 -3
- package/dist/profiles/semantic-layer/v1/invariants.d.ts +27 -0
- package/dist/profiles/semantic-layer/v1/invariants.js +39 -0
- package/dist/profiles/semantic-layer/v1/prompts.d.ts +3 -2
- package/dist/profiles/semantic-layer/v1/prompts.js +37 -26
- package/dist/profiles/semantic-layer/v1/resources/playbooks.d.ts +2 -4
- package/dist/profiles/semantic-layer/v1/resources/playbooks.js +8 -7
- package/dist/profiles/test-support/prompt-context-budget.test.d.ts +5 -0
- package/dist/profiles/test-support/prompt-context-budget.test.js +72 -0
- package/dist/profiles/types.d.ts +6 -1
- package/dist/server/capabilities.d.ts +3 -0
- package/dist/server/capabilities.js +4 -2
- package/dist/tools/lib/schema-fields.d.ts +4 -0
- package/dist/tools/lib/schema-fields.js +8 -1
- package/dist/tools/project/developer-content-preview.js +1 -1
- package/dist/tools/project/developer-content.js +2 -2
- package/dist/tools/query/reader-tool-helpers.d.ts +2 -2
- package/dist/tools/query/reader-tool-helpers.js +2 -2
- package/dist/tools/query/reader-tool-helpers.test.js +1 -0
- package/dist/tools/shared.d.ts +6 -1
- package/dist/tools/shared.js +12 -2
- package/dist/transports/streamable-http.js +13 -4
- package/dist/transports/streamable-http.test.js +8 -3
- package/package.json +3 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Content-developer structured prompt invariants (SSOT for capsules + HARD_BANS projection).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CONTENT_DEVELOPER_DEFAULT_INVARIANT_IDS = exports.CONTENT_DEVELOPER_HARD_BANS = exports.CONTENT_DEVELOPER_INVARIANTS = void 0;
|
|
7
|
+
const prompt_invariants_js_1 = require("../../lib/prompt-invariants.js");
|
|
8
|
+
exports.CONTENT_DEVELOPER_INVARIANTS = [
|
|
9
|
+
{
|
|
10
|
+
id: 'no-arbitrary-sql',
|
|
11
|
+
short: 'Do not execute arbitrary metric queries, raw SQL, warehouse runs, or saved-chart execution.',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'no-sql-charts',
|
|
15
|
+
short: 'Do not author or upsert SQL charts.',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 'no-hard-delete-promote',
|
|
19
|
+
short: 'Do not hard-delete, rollback, or promote content (use content-governance for promote).',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'no-org-admin',
|
|
23
|
+
short: 'Do not perform organization administration or list org-wide projects.',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'no-space-crud',
|
|
27
|
+
short: 'Do not create or update spaces — spaces are Terraform / out-of-band; use existing spaces only.',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'no-space-only-charts',
|
|
31
|
+
short: 'Do not create space-only charts for dashboard work — set dashboardSlug to the dashboard shell already created.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'design-approval',
|
|
35
|
+
short: '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.',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'objective-first',
|
|
39
|
+
short: '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).',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'project-scope',
|
|
43
|
+
short: 'Do not call confirm_preview without projectUuid when there is no HTTP X-Lightdash-Project pin (PROJECT_SCOPE_REQUIRED).',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'tile-targets-filters',
|
|
47
|
+
short: 'Do not attach dashboard filters whose target.tableName is absent from a tile explore without excluding that tile (or remapping) via tileTargets.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'dashboard-shell-first',
|
|
51
|
+
short: 'Do not treat chart create as done without a dashboard shell and tiles.',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'no-invent-field-ids',
|
|
55
|
+
short: 'Do not invent fieldIds — clone via get_chart_as_code / get_chart or use semantic-layer.',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'no-skinny-chart-config',
|
|
59
|
+
short: 'Do not invent skinny chartConfig — clone a working as-code body and keep series/layout/encode.',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'no-verify-unless-asked',
|
|
63
|
+
short: 'Do not set chart verified or dashboard preserveVerification unless the user explicitly asks (verify permission required).',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'preview-confirm-apply',
|
|
67
|
+
short: '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).',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'immutable-preview-payload',
|
|
71
|
+
short: 'Do not mutate the proposed payload after preview_* (description/name/SQL/metrics/tiles) — apply must reuse the identical proposed body or PREVIEW_STALE (content hash mismatch); any edit requires a new preview_*.',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'preview-kind-key-match',
|
|
75
|
+
short: "Do not unlock with a different resource's preview — resourceKind / resourceKey must match the preview exactly.",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 'validate-not-unlock',
|
|
79
|
+
short: 'Do not treat validate_chart / validate_dashboard as a preview unlock — they are saved-UUID health checks only (validate_chart needs chartUuid).',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'no-reuse-draft-token',
|
|
83
|
+
short: 'Do not reuse a draft previewToken after confirm; re-run preview if the resource drifts (PREVIEW_STALE).',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'no-sdd-mcp-click-loops',
|
|
87
|
+
short: 'Do not use subagent-driven-development or multi-task writing-plans solely to click MCP preview/confirm/apply for lab boards (e.g. experiments) — after Design Spec approval, run Batch SOP inline in the same session.',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'no-secrets',
|
|
91
|
+
short: 'Do not reveal secrets, warehouse credentials, or saved SQL chart bodies.',
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
exports.CONTENT_DEVELOPER_HARD_BANS = (0, prompt_invariants_js_1.formatHardBansProjection)(exports.CONTENT_DEVELOPER_INVARIANTS);
|
|
95
|
+
exports.CONTENT_DEVELOPER_DEFAULT_INVARIANT_IDS = (0, prompt_invariants_js_1.allInvariantIds)(exports.CONTENT_DEVELOPER_INVARIANTS);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure PromptContextSpec builders for content-developer prompts.
|
|
3
|
+
* Shared by registerContentDeveloperPrompts and budget gates.
|
|
4
|
+
*/
|
|
5
|
+
import type { ContentDeveloperPlaybookTopic } from './resources/playbooks.js';
|
|
6
|
+
import type { PromptContextSpec } from '../../lib/prompt-context.js';
|
|
7
|
+
/** Topics for create/improve dashboard prompts (shell + design + viz). */
|
|
8
|
+
export declare const DASHBOARD_CHART_TOPIC_IDS: readonly ["dashboards", "dashboard-design", "chart-types"];
|
|
9
|
+
/** Topics for refactor (shell + design). */
|
|
10
|
+
export declare const DASHBOARD_TOPIC_IDS: readonly ["dashboards", "dashboard-design"];
|
|
11
|
+
/** Topics for publish (shell + viz). */
|
|
12
|
+
export declare const DASHBOARD_PUBLISH_TOPIC_IDS: readonly ["dashboards", "chart-types"];
|
|
13
|
+
/** Manifest `when` comes from TOPIC_META.useWhen (optional `when` on entries). */
|
|
14
|
+
export declare const WRITE_RECOVERY_TOPICS: readonly [{
|
|
15
|
+
readonly topic: "recovery/preview-stale";
|
|
16
|
+
}, {
|
|
17
|
+
readonly topic: "recovery/preview-required";
|
|
18
|
+
}, {
|
|
19
|
+
readonly topic: "recovery/dashboard-diff";
|
|
20
|
+
}];
|
|
21
|
+
/** Thin stop gate — Phase Design / Objective detail lives in dashboard-design playbook. */
|
|
22
|
+
export declare const DESIGN_SPEC_STOP = "Emit a Design Spec (dashboard-design Phase Design: Objective + tiles with tableName citing insights + filter apply/exclude plan), then **stop until the user proceeds / approves / amends** before any preview_* or write. If the user already gave an explicit all-chart-types (or multi-viz) checklist + goal + projectUuid, a one-line Objective restatement is enough \u2014 treat that as approval after restating once. Always pass projectUuid on confirm_preview and apply when there is no HTTP pin.";
|
|
23
|
+
export type CreateDashboardPromptArgs = {
|
|
24
|
+
goal: string;
|
|
25
|
+
projectUuid?: string;
|
|
26
|
+
spaceUuid?: string;
|
|
27
|
+
chartReferences?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Production PromptContextSpec for `create_dashboard` (task + topics + recovery).
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildCreateDashboardPromptSpec(args: CreateDashboardPromptArgs): PromptContextSpec<ContentDeveloperPlaybookTopic>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pure PromptContextSpec builders for content-developer prompts.
|
|
4
|
+
* Shared by registerContentDeveloperPrompts and budget gates.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DESIGN_SPEC_STOP = exports.WRITE_RECOVERY_TOPICS = exports.DASHBOARD_PUBLISH_TOPIC_IDS = exports.DASHBOARD_TOPIC_IDS = exports.DASHBOARD_CHART_TOPIC_IDS = void 0;
|
|
8
|
+
exports.buildCreateDashboardPromptSpec = buildCreateDashboardPromptSpec;
|
|
9
|
+
const schema_fields_js_1 = require("../../../tools/lib/schema-fields.js");
|
|
10
|
+
const invariants_js_1 = require("./invariants.js");
|
|
11
|
+
const TOPIC_DASHBOARDS = 'dashboards';
|
|
12
|
+
const TOPIC_DASHBOARD_DESIGN = 'dashboard-design';
|
|
13
|
+
const TOPIC_CHART_TYPES = 'chart-types';
|
|
14
|
+
/** Topics for create/improve dashboard prompts (shell + design + viz). */
|
|
15
|
+
exports.DASHBOARD_CHART_TOPIC_IDS = [
|
|
16
|
+
TOPIC_DASHBOARDS,
|
|
17
|
+
TOPIC_DASHBOARD_DESIGN,
|
|
18
|
+
TOPIC_CHART_TYPES,
|
|
19
|
+
];
|
|
20
|
+
/** Topics for refactor (shell + design). */
|
|
21
|
+
exports.DASHBOARD_TOPIC_IDS = [TOPIC_DASHBOARDS, TOPIC_DASHBOARD_DESIGN];
|
|
22
|
+
/** Topics for publish (shell + viz). */
|
|
23
|
+
exports.DASHBOARD_PUBLISH_TOPIC_IDS = [TOPIC_DASHBOARDS, TOPIC_CHART_TYPES];
|
|
24
|
+
/** Manifest `when` comes from TOPIC_META.useWhen (optional `when` on entries). */
|
|
25
|
+
exports.WRITE_RECOVERY_TOPICS = [
|
|
26
|
+
{ topic: 'recovery/preview-stale' },
|
|
27
|
+
{ topic: 'recovery/preview-required' },
|
|
28
|
+
{ topic: 'recovery/dashboard-diff' },
|
|
29
|
+
];
|
|
30
|
+
/** Thin stop gate — Phase Design / Objective detail lives in dashboard-design playbook. */
|
|
31
|
+
exports.DESIGN_SPEC_STOP = 'Emit a Design Spec (dashboard-design Phase Design: Objective + tiles with tableName citing insights + filter apply/exclude plan), then **stop until the user proceeds / approves / amends** before any preview_* or write. If the user already gave an explicit all-chart-types (or multi-viz) checklist + goal + projectUuid, a one-line Objective restatement is enough — treat that as approval after restating once. Always pass projectUuid on confirm_preview and apply when there is no HTTP pin.';
|
|
32
|
+
/**
|
|
33
|
+
* Production PromptContextSpec for `create_dashboard` (task + topics + recovery).
|
|
34
|
+
*/
|
|
35
|
+
function buildCreateDashboardPromptSpec(args) {
|
|
36
|
+
const { goal, projectUuid, spaceUuid, chartReferences } = args;
|
|
37
|
+
return {
|
|
38
|
+
task: `Create a new dashboard for this goal:
|
|
39
|
+
|
|
40
|
+
${goal}
|
|
41
|
+
|
|
42
|
+
${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
|
|
43
|
+
|
|
44
|
+
Target existing space: ${spaceUuid !== null && spaceUuid !== void 0 ? spaceUuid : '(resolve with lightdash_list_spaces / lightdash_get_space — never create a space)'}.
|
|
45
|
+
Chart hints: ${chartReferences !== null && chartReferences !== void 0 ? chartReferences : '(none provided — discover seeds via get_space / short search_content, then get_chart_as_code)'}.
|
|
46
|
+
|
|
47
|
+
1. If the goal is vague on audience / decisions / what to understand: ask **2–4 clarifying questions** before a Spec (do not invent a viz-type checklist).
|
|
48
|
+
2. Read-only discovery only (project/space/seeds).
|
|
49
|
+
3. ${exports.DESIGN_SPEC_STOP} Multi-viz / all chart types only if the user explicitly asked (see dashboards + chart-types playbooks). For explicit all-types work, keep primary insights decision-oriented and place redundant required forms in a labeled validation appendix; never weaken semantic field requirements.
|
|
50
|
+
4. After approval: follow playbooks (preview→confirm→apply; reuse the **exact** preview payload on apply — do not tidy description/name between confirm and create).
|
|
51
|
+
5. Report dashboard UUID/slug, tiles, filters, chart UUIDs — reject space-only orphans or untiled dashboard-owned charts.`,
|
|
52
|
+
invariantIds: invariants_js_1.CONTENT_DEVELOPER_DEFAULT_INVARIANT_IDS,
|
|
53
|
+
requiredTopics: exports.DASHBOARD_CHART_TOPIC_IDS,
|
|
54
|
+
recoveryTopics: exports.WRITE_RECOVERY_TOPICS,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP prompts for content-developer workflows.
|
|
2
|
+
* MCP prompts for content-developer workflows (progressive-disclosure context).
|
|
3
3
|
*
|
|
4
|
-
* Procedure detail lives in playbooks (
|
|
4
|
+
* Procedure detail lives in playbooks (manifest / selective embed via policy).
|
|
5
5
|
* Prompt bodies stay goal/input-specific — do not restate entire SOPs here.
|
|
6
6
|
*/
|
|
7
|
+
import type { RegisterPromptsOptions } from '../../types.js';
|
|
7
8
|
import type { McpServer } from '@modelcontextprotocol/server';
|
|
8
|
-
export declare function registerContentDeveloperPrompts(server: McpServer): void;
|
|
9
|
+
export declare function registerContentDeveloperPrompts(server: McpServer, options?: RegisterPromptsOptions): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* MCP prompts for content-developer workflows.
|
|
3
|
+
* MCP prompts for content-developer workflows (progressive-disclosure context).
|
|
4
4
|
*
|
|
5
|
-
* Procedure detail lives in playbooks (
|
|
5
|
+
* Procedure detail lives in playbooks (manifest / selective embed via policy).
|
|
6
6
|
* Prompt bodies stay goal/input-specific — do not restate entire SOPs here.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -10,149 +10,143 @@ exports.registerContentDeveloperPrompts = registerContentDeveloperPrompts;
|
|
|
10
10
|
/* eslint-disable @typescript-eslint/no-deprecated -- matches content-reader prompt registration pattern */
|
|
11
11
|
const zod_1 = require("zod");
|
|
12
12
|
const schema_fields_js_1 = require("../../../tools/lib/schema-fields.js");
|
|
13
|
-
const
|
|
13
|
+
const prompt_context_js_1 = require("../../lib/prompt-context.js");
|
|
14
|
+
const invariants_js_1 = require("./invariants.js");
|
|
15
|
+
const prompt_specs_js_1 = require("./prompt-specs.js");
|
|
14
16
|
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
15
|
-
const
|
|
17
|
+
const TOPIC_CHART_TYPES = 'chart-types';
|
|
18
|
+
const TOPIC_TABLE_CALCULATIONS = 'table-calculations';
|
|
19
|
+
const TOPIC_CONTENT_MOVE = 'content-move';
|
|
20
|
+
const bindPromptContext = (0, prompt_context_js_1.bindProfilePromptContext)({
|
|
21
|
+
invariants: invariants_js_1.CONTENT_DEVELOPER_INVARIANTS,
|
|
16
22
|
core: playbooks_js_1.CONTENT_DEVELOPER_CORE_PLAYBOOK,
|
|
17
23
|
topics: playbooks_js_1.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS,
|
|
24
|
+
topicMeta: playbooks_js_1.CONTENT_DEVELOPER_TOPIC_META,
|
|
18
25
|
});
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const TOPIC_DASHBOARD_DESIGN = 'dashboard-design';
|
|
23
|
-
const TOPIC_CHART_TYPES = 'chart-types';
|
|
24
|
-
const TOPIC_TABLE_CALCULATIONS = 'table-calculations';
|
|
25
|
-
const DASHBOARD_CHART_TOPIC_IDS = [
|
|
26
|
-
TOPIC_DASHBOARDS,
|
|
27
|
-
TOPIC_DASHBOARD_DESIGN,
|
|
28
|
-
TOPIC_CHART_TYPES,
|
|
29
|
-
];
|
|
30
|
-
const DASHBOARD_TOPIC_IDS = [TOPIC_DASHBOARDS, TOPIC_DASHBOARD_DESIGN];
|
|
31
|
-
const DASHBOARD_PUBLISH_TOPIC_IDS = [TOPIC_DASHBOARDS, TOPIC_CHART_TYPES];
|
|
32
|
-
/** Thin stop gate — Phase Design / Objective detail lives in dashboard-design playbook. */
|
|
33
|
-
const DESIGN_SPEC_STOP = 'Emit a Design Spec (dashboard-design Phase Design: Objective + tiles with tableName citing insights + filter apply/exclude plan), then **stop until the user proceeds / approves / amends** before any preview_* or write. If the user already gave an explicit all-chart-types (or multi-viz) checklist + goal + projectUuid, a one-line Objective restatement is enough — treat that as approval after restating once. Always pass projectUuid on confirm_preview and apply when there is no HTTP pin.';
|
|
34
|
-
function registerContentDeveloperPrompts(server) {
|
|
26
|
+
function registerContentDeveloperPrompts(server, options) {
|
|
27
|
+
const promptContext = bindPromptContext(options === null || options === void 0 ? void 0 : options.promptContextPolicy);
|
|
28
|
+
const invariantIds = invariants_js_1.CONTENT_DEVELOPER_DEFAULT_INVARIANT_IDS;
|
|
35
29
|
server.registerPrompt('create_dashboard', {
|
|
36
30
|
title: 'Create dashboard',
|
|
37
31
|
description: 'Clarify Objective → Design Spec (await approval) → shell → dashboardSlug charts → tiles / filters',
|
|
38
32
|
argsSchema: {
|
|
39
33
|
goal: zod_1.z.string(),
|
|
40
|
-
projectUuid:
|
|
34
|
+
projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
|
|
41
35
|
spaceUuid: zod_1.z.string().optional(),
|
|
42
36
|
chartReferences: zod_1.z.string().optional(),
|
|
43
37
|
},
|
|
44
|
-
}, ({ goal, projectUuid, spaceUuid, chartReferences }) =>
|
|
45
|
-
|
|
46
|
-
${goal}
|
|
47
|
-
|
|
48
|
-
Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
|
|
49
|
-
|
|
50
|
-
${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
|
|
51
|
-
|
|
52
|
-
Target existing space: ${spaceUuid !== null && spaceUuid !== void 0 ? spaceUuid : '(resolve with lightdash_list_spaces / lightdash_get_space — never create a space)'}.
|
|
53
|
-
Chart hints: ${chartReferences !== null && chartReferences !== void 0 ? chartReferences : '(none provided — discover seeds via get_space / short search_content, then get_chart_as_code)'}.
|
|
54
|
-
|
|
55
|
-
1. If the goal is vague on audience / decisions / what to understand: ask **2–4 clarifying questions** before a Spec (do not invent a viz-type checklist).
|
|
56
|
-
2. Read-only discovery only (project/space/seeds).
|
|
57
|
-
3. ${DESIGN_SPEC_STOP} Multi-viz / all chart types only if the user explicitly asked (see dashboards + chart-types playbooks). For explicit all-types work, keep primary insights decision-oriented and place redundant required forms in a labeled validation appendix; never weaken semantic field requirements.
|
|
58
|
-
4. After approval: follow embedded playbooks (preview→confirm→apply; reuse the **exact** preview payload on apply — do not tidy description/name between confirm and create).
|
|
59
|
-
5. Report dashboard UUID/slug, tiles, filters, chart UUIDs — reject space-only orphans or untiled dashboard-owned charts.`, DASHBOARD_CHART_TOPIC_IDS));
|
|
38
|
+
}, ({ goal, projectUuid, spaceUuid, chartReferences }) => promptContext((0, prompt_specs_js_1.buildCreateDashboardPromptSpec)({ goal, projectUuid, spaceUuid, chartReferences })));
|
|
60
39
|
server.registerPrompt('improve_dashboard', {
|
|
61
40
|
title: 'Improve dashboard',
|
|
62
41
|
description: 'Clarify Objective if needed → Design Spec delta (await approval) → layout / filters / tiles',
|
|
63
42
|
argsSchema: {
|
|
64
43
|
dashboardUuidOrSlug: zod_1.z.string(),
|
|
65
44
|
improvementGoal: zod_1.z.string(),
|
|
66
|
-
projectUuid:
|
|
45
|
+
projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
|
|
67
46
|
},
|
|
68
|
-
}, ({ dashboardUuidOrSlug, improvementGoal, projectUuid }) =>
|
|
47
|
+
}, ({ dashboardUuidOrSlug, improvementGoal, projectUuid }) => promptContext({
|
|
48
|
+
task: `Improve dashboard ${dashboardUuidOrSlug} for this goal:
|
|
69
49
|
|
|
70
50
|
${improvementGoal}
|
|
71
51
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
|
|
52
|
+
${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
|
|
75
53
|
|
|
76
54
|
1. Inspect with lightdash_get_dashboard first (tile x/y/w/h may be missing — rebuild layout intentionally).
|
|
77
55
|
2. If the improvement goal is vague on decisions / insights: ask **2–4 clarifying questions** before a Spec delta.
|
|
78
|
-
3. For material layout/tile/filter changes (including professionalize): ${DESIGN_SPEC_STOP} Use the **Improve / professionalize Spec delta** (keep / drop / rename + cull) in dashboard-design. Trivial one-shot renames the user already specified may skip the stop. Multi-viz / all chart types only if the user explicitly asked.
|
|
79
|
-
4. After approval: follow
|
|
80
|
-
Report what changed (tiles, filters, chart UUIDs), any untiled dashboard-owned leftovers (content-governance for soft-delete), and validation warnings.`,
|
|
56
|
+
3. For material layout/tile/filter changes (including professionalize): ${prompt_specs_js_1.DESIGN_SPEC_STOP} Use the **Improve / professionalize Spec delta** (keep / drop / rename + cull) in dashboard-design. Trivial one-shot renames the user already specified may skip the stop. Multi-viz / all chart types only if the user explicitly asked.
|
|
57
|
+
4. After approval: follow playbooks (reuse the **exact** preview payload on apply). New charts: get_chart_as_code + dashboardSlug, then tile. Rename tile titles and chart names when stripping demo prefixes.
|
|
58
|
+
Report what changed (tiles, filters, chart UUIDs), any untiled dashboard-owned leftovers (content-governance for soft-delete), and validation warnings.`,
|
|
59
|
+
invariantIds,
|
|
60
|
+
requiredTopics: prompt_specs_js_1.DASHBOARD_CHART_TOPIC_IDS,
|
|
61
|
+
recoveryTopics: prompt_specs_js_1.WRITE_RECOVERY_TOPICS,
|
|
62
|
+
}));
|
|
81
63
|
server.registerPrompt('refactor_dashboard', {
|
|
82
64
|
title: 'Refactor dashboard',
|
|
83
65
|
description: 'Compare versions; Design Spec delta for material changes (await approval), then reconcile',
|
|
84
66
|
argsSchema: {
|
|
85
67
|
dashboardUuidOrSlug: zod_1.z.string(),
|
|
86
68
|
concern: zod_1.z.string().optional(),
|
|
87
|
-
projectUuid:
|
|
69
|
+
projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
|
|
88
70
|
},
|
|
89
|
-
}, ({ dashboardUuidOrSlug, concern, projectUuid }) =>
|
|
90
|
-
|
|
91
|
-
Project UUID: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : PROJECT_UUID_HINT}.
|
|
71
|
+
}, ({ dashboardUuidOrSlug, concern, projectUuid }) => promptContext({
|
|
72
|
+
task: `Refactor dashboard ${dashboardUuidOrSlug}.
|
|
92
73
|
|
|
93
|
-
${
|
|
74
|
+
${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
|
|
94
75
|
|
|
95
76
|
Concern: ${concern !== null && concern !== void 0 ? concern : '(general cleanup)'}.
|
|
96
77
|
1. Use lightdash_compare_dashboard_versions before proposing changes.
|
|
97
|
-
2. For material layout/tile/filter changes: ${DESIGN_SPEC_STOP} Trivial one-shot renames may skip the stop.
|
|
98
|
-
3. After approval: follow
|
|
78
|
+
2. For material layout/tile/filter changes: ${prompt_specs_js_1.DESIGN_SPEC_STOP} Trivial one-shot renames may skip the stop.
|
|
79
|
+
3. After approval: follow dashboards + dashboard-design. Do not remove tiles unless the approved Spec or user request allows it.`,
|
|
80
|
+
invariantIds,
|
|
81
|
+
requiredTopics: prompt_specs_js_1.DASHBOARD_TOPIC_IDS,
|
|
82
|
+
recoveryTopics: prompt_specs_js_1.WRITE_RECOVERY_TOPICS,
|
|
83
|
+
}));
|
|
99
84
|
server.registerPrompt('author_chart', {
|
|
100
85
|
title: 'Author chart',
|
|
101
86
|
description: 'Clone a working seed chart (cartesian encode intact); optional dashboardSlug scoping',
|
|
102
87
|
argsSchema: {
|
|
103
88
|
goal: zod_1.z.string(),
|
|
104
|
-
projectUuid:
|
|
89
|
+
projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
|
|
105
90
|
seedChartUuidOrSlug: zod_1.z.string().optional(),
|
|
106
91
|
dashboardSlug: zod_1.z.string().optional(),
|
|
107
92
|
},
|
|
108
|
-
}, ({ goal, projectUuid, seedChartUuidOrSlug, dashboardSlug }) =>
|
|
93
|
+
}, ({ goal, projectUuid, seedChartUuidOrSlug, dashboardSlug }) => promptContext({
|
|
94
|
+
task: `Author a semantic chart for this goal:
|
|
109
95
|
|
|
110
96
|
${goal}
|
|
111
97
|
|
|
112
|
-
|
|
98
|
+
${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
|
|
113
99
|
Seed chart: ${seedChartUuidOrSlug !== null && seedChartUuidOrSlug !== void 0 ? seedChartUuidOrSlug : '(find a rendering seed on the same tableName via search_content / get_space)'}.
|
|
114
100
|
Dashboard slug: ${dashboardSlug !== null && dashboardSlug !== void 0 ? dashboardSlug : '(omit only for intentional space-owned charts; for dashboard work set dashboardSlug to an existing dashboard shell)'}.
|
|
115
101
|
|
|
116
|
-
${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
|
|
117
|
-
|
|
118
102
|
Follow core + chart-types + table-calculations (clone via get_chart_as_code; preview with top-level slug; keep customDimensions when needed; tile if dashboardSlug set).
|
|
119
103
|
When dashboardSlug is set, the chart must serve a **board insight** from the approved Design Spec — do not invent a viz type for its own sake.
|
|
120
|
-
Report UUID/slug from charts[0].data; note this profile cannot run_chart / prove UI render.`,
|
|
104
|
+
Report UUID/slug from charts[0].data; note this profile cannot run_chart / prove UI render.`,
|
|
105
|
+
invariantIds,
|
|
106
|
+
requiredTopics: [TOPIC_CHART_TYPES, TOPIC_TABLE_CALCULATIONS],
|
|
107
|
+
recoveryTopics: prompt_specs_js_1.WRITE_RECOVERY_TOPICS,
|
|
108
|
+
}));
|
|
121
109
|
server.registerPrompt('move_content', {
|
|
122
110
|
title: 'Move content',
|
|
123
111
|
description: 'Move charts/dashboards into an existing space (no space create/update)',
|
|
124
112
|
argsSchema: {
|
|
125
113
|
goal: zod_1.z.string(),
|
|
126
|
-
projectUuid:
|
|
114
|
+
projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
|
|
127
115
|
spaceReferences: zod_1.z.string().optional(),
|
|
128
116
|
},
|
|
129
|
-
}, ({ goal, projectUuid, spaceReferences }) =>
|
|
117
|
+
}, ({ goal, projectUuid, spaceReferences }) => promptContext({
|
|
118
|
+
task: `Move content between existing spaces for this goal:
|
|
130
119
|
|
|
131
120
|
${goal}
|
|
132
121
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
|
|
122
|
+
${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
|
|
136
123
|
|
|
137
124
|
Space hints: ${spaceReferences !== null && spaceReferences !== void 0 ? spaceReferences : '(discover with lightdash_list_spaces)'}.
|
|
138
125
|
Follow core + content-move playbooks. Target spaces must already exist.
|
|
139
|
-
Report moved items and target space.`,
|
|
126
|
+
Report moved items and target space.`,
|
|
127
|
+
invariantIds,
|
|
128
|
+
requiredTopics: [TOPIC_CONTENT_MOVE],
|
|
129
|
+
recoveryTopics: prompt_specs_js_1.WRITE_RECOVERY_TOPICS,
|
|
130
|
+
}));
|
|
140
131
|
server.registerPrompt('publish_content', {
|
|
141
132
|
title: 'Publish content',
|
|
142
133
|
description: 'Validate dashboard-scoped authored content before treating it as done',
|
|
143
134
|
argsSchema: {
|
|
144
135
|
contentReferences: zod_1.z.string(),
|
|
145
|
-
projectUuid:
|
|
136
|
+
projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
|
|
146
137
|
},
|
|
147
|
-
}, ({ contentReferences, projectUuid }) =>
|
|
138
|
+
}, ({ contentReferences, projectUuid }) => promptContext({
|
|
139
|
+
task: `Finalize this authored Lightdash content before considering it done:
|
|
148
140
|
|
|
149
141
|
${contentReferences}
|
|
150
142
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
${playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS}
|
|
143
|
+
${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
|
|
154
144
|
|
|
155
|
-
Done checklist: markdown/description states the **Objective**; tiles map to approved insight questions; every saved filter matches each tile explore or has explicit tileTargets exclude/remap; dashboardSlug on new charts + tiles present; cartesian encode intact; no invented fieldIds. Report untiled dashboard-owned leftovers (soft-delete via content-governance). Follow
|
|
156
|
-
Optionally validate_* (schema/health only). Promote is content-governance, not this profile.`,
|
|
145
|
+
Done checklist: markdown/description states the **Objective**; tiles map to approved insight questions; every saved filter matches each tile explore or has explicit tileTargets exclude/remap; dashboardSlug on new charts + tiles present; cartesian encode intact; no invented fieldIds. Report untiled dashboard-owned leftovers (soft-delete via content-governance). Follow playbooks for encode/map/filter detail. UI runtime not verified on this profile.
|
|
146
|
+
Optionally validate_* (schema/health only). Promote is content-governance, not this profile.`,
|
|
147
|
+
invariantIds,
|
|
148
|
+
requiredTopics: prompt_specs_js_1.DASHBOARD_PUBLISH_TOPIC_IDS,
|
|
149
|
+
recoveryTopics: prompt_specs_js_1.WRITE_RECOVERY_TOPICS,
|
|
150
|
+
}));
|
|
157
151
|
}
|
|
158
152
|
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
@@ -38,7 +38,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
const vitest_1 = require("vitest");
|
|
40
40
|
const index_js_1 = require("../../index.js");
|
|
41
|
+
const playbook_resources_js_1 = require("../../lib/playbook-resources.js");
|
|
41
42
|
const playbook_invariants_js_1 = require("../../test-support/playbook-invariants.js");
|
|
43
|
+
const invariants_js_1 = require("./invariants.js");
|
|
42
44
|
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
43
45
|
(0, vitest_1.describe)('content-developer prompts/playbook', () => {
|
|
44
46
|
(0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
|
|
@@ -47,6 +49,20 @@ const playbooks_js_1 = require("./resources/playbooks.js");
|
|
|
47
49
|
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
48
50
|
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('terraform');
|
|
49
51
|
});
|
|
52
|
+
(0, vitest_1.it)('keeps structured invariants and core.md Hard bans in sync (count + key phrases)', () => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const core = playbooks_js_1.CONTENT_DEVELOPER_CORE_PLAYBOOK.getMarkdown();
|
|
55
|
+
const hardBansSection = (_b = (_a = core.split('## Hard bans')[1]) === null || _a === void 0 ? void 0 : _a.split('\n## ')[0]) !== null && _b !== void 0 ? _b : '';
|
|
56
|
+
const coreBullets = hardBansSection
|
|
57
|
+
.split('\n')
|
|
58
|
+
.map((line) => line.trim())
|
|
59
|
+
.filter((line) => line.startsWith('- Do not'));
|
|
60
|
+
(0, vitest_1.expect)(coreBullets).toHaveLength(invariants_js_1.CONTENT_DEVELOPER_INVARIANTS.length);
|
|
61
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('resourcekind');
|
|
62
|
+
(0, vitest_1.expect)(playbooks_js_1.CONTENT_DEVELOPER_HARD_BANS.toLowerCase()).toContain('subagent-driven-development');
|
|
63
|
+
(0, vitest_1.expect)(hardBansSection.toLowerCase()).toContain('subagent-driven-development');
|
|
64
|
+
(0, vitest_1.expect)(hardBansSection.toLowerCase()).toContain('resourcekind');
|
|
65
|
+
});
|
|
50
66
|
(0, vitest_1.it)('forbids space create/update and orphan chart publish', () => {
|
|
51
67
|
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
52
68
|
(0, vitest_1.expect)(md).toContain('terraform');
|
|
@@ -192,6 +208,7 @@ const playbooks_js_1 = require("./resources/playbooks.js");
|
|
|
192
208
|
let authorText = '';
|
|
193
209
|
let authorUris = [];
|
|
194
210
|
let refactorText = '';
|
|
211
|
+
let createCompactText = '';
|
|
195
212
|
const server = {
|
|
196
213
|
registerPrompt: (name, _meta, handler) => {
|
|
197
214
|
names.push(name);
|
|
@@ -241,7 +258,42 @@ const playbooks_js_1 = require("./resources/playbooks.js");
|
|
|
241
258
|
}
|
|
242
259
|
},
|
|
243
260
|
};
|
|
244
|
-
|
|
261
|
+
// embedded keeps legacy resource URI assertions; compact is the package default.
|
|
262
|
+
registerContentDeveloperPrompts(server, { promptContextPolicy: 'embedded' });
|
|
263
|
+
const compactServer = {
|
|
264
|
+
registerPrompt: (name, _meta, handler) => {
|
|
265
|
+
if (name !== 'create_dashboard')
|
|
266
|
+
return;
|
|
267
|
+
const messages = handler({ goal: 'x' }).messages;
|
|
268
|
+
createCompactText = messages
|
|
269
|
+
.filter((m) => m.content.type === 'text')
|
|
270
|
+
.map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
|
|
271
|
+
.join('\n')
|
|
272
|
+
.toLowerCase();
|
|
273
|
+
(0, vitest_1.expect)(messages.every((m) => m.content.type === 'text')).toBe(true);
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
registerContentDeveloperPrompts(compactServer, { promptContextPolicy: 'compact' });
|
|
277
|
+
(0, vitest_1.expect)(createCompactText).toContain('critical invariants:');
|
|
278
|
+
(0, vitest_1.expect)(createCompactText).toContain('previewtoken');
|
|
279
|
+
(0, vitest_1.expect)(createCompactText).toContain((0, playbook_resources_js_1.playbookTopicUri)('content-developer', 'recovery/preview-stale'));
|
|
280
|
+
(0, vitest_1.expect)(createCompactText).not.toContain('## hard bans');
|
|
281
|
+
let moveCompactText = '';
|
|
282
|
+
const moveCompactServer = {
|
|
283
|
+
registerPrompt: (name, _meta, handler) => {
|
|
284
|
+
if (name !== 'move_content')
|
|
285
|
+
return;
|
|
286
|
+
const messages = handler({ goal: 'x' }).messages;
|
|
287
|
+
moveCompactText = messages
|
|
288
|
+
.filter((m) => m.content.type === 'text')
|
|
289
|
+
.map((m) => { var _a; return (_a = m.content.text) !== null && _a !== void 0 ? _a : ''; })
|
|
290
|
+
.join('\n')
|
|
291
|
+
.toLowerCase();
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
registerContentDeveloperPrompts(moveCompactServer, { promptContextPolicy: 'compact' });
|
|
295
|
+
(0, vitest_1.expect)(moveCompactText).toContain((0, playbook_resources_js_1.playbookTopicUri)('content-developer', 'recovery/preview-stale'));
|
|
296
|
+
(0, vitest_1.expect)(moveCompactText).toContain((0, playbook_resources_js_1.playbookTopicUri)('content-developer', 'recovery/preview-required'));
|
|
245
297
|
(0, vitest_1.expect)(names).not.toContain('build_chart');
|
|
246
298
|
(0, vitest_1.expect)(names).not.toContain('design_dashboard');
|
|
247
299
|
(0, vitest_1.expect)(names).toContain('author_chart');
|
|
@@ -259,18 +311,20 @@ const playbooks_js_1 = require("./resources/playbooks.js");
|
|
|
259
311
|
.toLowerCase();
|
|
260
312
|
(0, vitest_1.expect)(text).toContain('design spec');
|
|
261
313
|
(0, vitest_1.expect)(text).toMatch(/stop until the user proceeds|proceeds \/ approves/);
|
|
314
|
+
(0, vitest_1.expect)(text).toContain('critical invariants:');
|
|
315
|
+
(0, vitest_1.expect)(text).toContain('previewtoken');
|
|
262
316
|
const uris = typed
|
|
263
317
|
.filter((m) => m.content.type === 'resource')
|
|
264
318
|
.map((m) => { var _a; return (_a = m.content.resource) === null || _a === void 0 ? void 0 : _a.uri; });
|
|
265
|
-
(0, vitest_1.expect)(uris).toContain(
|
|
266
|
-
(0, vitest_1.expect)(uris).toContain(
|
|
267
|
-
(0, vitest_1.expect)(uris).toContain('
|
|
319
|
+
(0, vitest_1.expect)(uris).toContain(playbooks_js_1.CONTENT_DEVELOPER_CORE_PLAYBOOK.uri);
|
|
320
|
+
(0, vitest_1.expect)(uris).toContain(playbooks_js_1.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS.dashboards.uri);
|
|
321
|
+
(0, vitest_1.expect)(uris).toContain(playbooks_js_1.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS['dashboard-design'].uri);
|
|
268
322
|
if (name === 'create_dashboard' || name === 'improve_dashboard') {
|
|
269
323
|
(0, vitest_1.expect)(text).toContain('objective');
|
|
270
324
|
(0, vitest_1.expect)(text).toMatch(/clarif/);
|
|
271
325
|
(0, vitest_1.expect)(text).toMatch(/only if the user explicitly asked/);
|
|
272
326
|
(0, vitest_1.expect)(text).toMatch(/tablename|filter apply\/exclude|apply\/exclude/);
|
|
273
|
-
(0, vitest_1.expect)(uris).toContain('
|
|
327
|
+
(0, vitest_1.expect)(uris).toContain(playbooks_js_1.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS['chart-types'].uri);
|
|
274
328
|
}
|
|
275
329
|
if (name === 'improve_dashboard') {
|
|
276
330
|
(0, vitest_1.expect)(text).toMatch(/keep \/ drop \/ rename|professionalize/);
|
|
@@ -285,8 +339,8 @@ const playbooks_js_1 = require("./resources/playbooks.js");
|
|
|
285
339
|
(0, vitest_1.expect)(publishText).toContain('content-governance');
|
|
286
340
|
(0, vitest_1.expect)(authorText).toContain('board insight');
|
|
287
341
|
(0, vitest_1.expect)(authorText).toContain('table-calculations');
|
|
288
|
-
(0, vitest_1.expect)(authorUris).toContain('
|
|
289
|
-
(0, vitest_1.expect)(authorUris).toContain('
|
|
342
|
+
(0, vitest_1.expect)(authorUris).toContain(playbooks_js_1.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS['chart-types'].uri);
|
|
343
|
+
(0, vitest_1.expect)(authorUris).toContain(playbooks_js_1.CONTENT_DEVELOPER_TOPIC_PLAYBOOKS['table-calculations'].uri);
|
|
290
344
|
(0, vitest_1.expect)(refactorText).toMatch(/approved spec|user request allows/);
|
|
291
345
|
(0, vitest_1.expect)(refactorText).not.toMatch(/unless explicitly requested/);
|
|
292
346
|
});
|
|
@@ -29,6 +29,7 @@ this profile does **not** execute queries, compile explores, create spaces, or p
|
|
|
29
29
|
- Do not reuse a **draft** token after confirm (confirm returns a **new** validated token) or after payload/baseline drift (`PREVIEW_STALE`).
|
|
30
30
|
- Do not unlock with a different resource's preview — `resourceKind` / `resourceKey` must match the preview exactly.
|
|
31
31
|
- Do not treat `validate_chart` / `validate_dashboard` as unlock — saved-UUID health checks only (not UI-render proof).
|
|
32
|
+
- Do not use subagent-driven-development or multi-task writing-plans solely to click MCP preview/confirm/apply for lab boards (e.g. experiments) — after Design Spec approval, run Batch SOP inline in the same session.
|
|
32
33
|
- Do not reveal secrets, warehouse credentials, or saved SQL **chart** bodies.
|
|
33
34
|
|
|
34
35
|
## Default budgets (override when the user expands scope)
|
|
@@ -4,13 +4,16 @@ URI: `lightdash://playbooks/content-developer`
|
|
|
4
4
|
|
|
5
5
|
Workflow-scoped playbooks (always load **core** plus one topic with a prompt):
|
|
6
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
|
-
| Table calculations (template / formula / sql) | `lightdash://playbooks/content-developer/table-calculations`
|
|
14
|
-
| Content move | `lightdash://playbooks/content-developer/content-move`
|
|
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
|
+
| Table calculations (template / formula / sql) | `lightdash://playbooks/content-developer/table-calculations` |
|
|
14
|
+
| Content move | `lightdash://playbooks/content-developer/content-move` |
|
|
15
|
+
| Recovery: PREVIEW_STALE | `lightdash://playbooks/content-developer/recovery/preview-stale` |
|
|
16
|
+
| Recovery: PREVIEW_REQUIRED | `lightdash://playbooks/content-developer/recovery/preview-required` |
|
|
17
|
+
| Recovery: dashboard preview diff | `lightdash://playbooks/content-developer/recovery/dashboard-diff` |
|
|
15
18
|
|
|
16
19
|
**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,15 @@
|
|
|
1
|
+
# Recovery: dashboard preview diff noise
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer/recovery/dashboard-diff`
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
Interpreting `diff.removed` / `diff.added` on dashboard **update** previews before apply.
|
|
8
|
+
|
|
9
|
+
## Noise (safe to ignore)
|
|
10
|
+
|
|
11
|
+
Server-owned metadata often listed as removed when omitted from the proposal: `access`, `views`, `updatedAt`, `uuid`, `slug`, `organizationUuid`, and similar.
|
|
12
|
+
|
|
13
|
+
## Real omissions (do not apply)
|
|
14
|
+
|
|
15
|
+
If **`tiles`**, **`tabs`**, or **`filters`** appear in `diff.removed`, you omitted them from `changes`. 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.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Recovery: PREVIEW_REQUIRED
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/content-developer/recovery/preview-required`
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
Tool error `PREVIEW_REQUIRED` — missing, invalid, or expired preview token (“invalid or expired”). There is no separate `PREVIEW_EXPIRED` code (~10 min TTL).
|
|
8
|
+
|
|
9
|
+
## Recover
|
|
10
|
+
|
|
11
|
+
1. Run the matching `preview_*` again for this write (new draft token).
|
|
12
|
+
2. `confirm_preview` with that draft + exact `resourceKind` / `resourceKey` + `projectUuid` when there is no HTTP pin.
|
|
13
|
+
3. Apply with the **new** validated token from confirm — never reuse a draft token after confirm.
|
|
14
|
+
4. If confirm returned `PREVIEW_NOT_VALIDATED` / `PREVIEW_NOT_OWNED`, fix kind/key/ownership and re-preview; do not treat `validate_*` as an unlock.
|