@lightdash/cli 3.34.0 → 3.35.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.
@@ -185,6 +185,11 @@ order, `sortBy` describes result ordering, `totalColumnCount` exposes truncation
185
185
  A short ask ("add AI analysis") gets the whole set. They sit on
186
186
  `useInsights()` / `useInsights(result)` and render nothing when the host has
187
187
  no analysis. Full contract in `/app/references/ai-analysis.md`.
188
+ - `analysis-instructions`: author guidance for the analysis model — language
189
+ and format rules plus a line or two of domain vocabulary. Pass it as the
190
+ `instructions` prop on `InsightsSummary` (or `useInsights({ instructions })`
191
+ in a custom block). One string per app, max 2000 characters. See "Author
192
+ instructions" in `/app/references/ai-analysis.md`.
188
193
  - `ai-prompt`: `useAiPrompt()` returns `{ available, ask, loading, text, error }`;
189
194
  `ask({ prompt, sources: [{ result, label }], focus?: { row } })` sends an
190
195
  author-written question over loaded `useLightdash` results and resolves to
@@ -49,7 +49,17 @@ const view = useInsights();
49
49
  // view.analyse() ask Lightdash to (re)run the analysis
50
50
  ```
51
51
 
52
- Render `<InsightsSummary />` near the top of the page. It handles every status (idle, analysing, ready, error, stale) and renders nothing when unavailable. Props: `title`, `idleText`, `className`. Write your own block only when the user asks for a layout the component cannot give, and then keep every status branch.
52
+ Render `<InsightsSummary />` near the top of the page. It handles every status (idle, analysing, ready, error, stale) and renders nothing when unavailable. Props: `title`, `idleText`, `instructions`, `className`. Write your own block only when the user asks for a layout the component cannot give, and then keep every status branch.
53
+
54
+ ### Author instructions for the analysis
55
+
56
+ When the user wants the summary written a certain way — a language or locale ("British English", "amounts in EUR"), a tone, or a line or two of domain vocabulary the model would otherwise misread ("stage labels are covenant stages") — pass it as `instructions`:
57
+
58
+ ```tsx
59
+ <InsightsSummary instructions="Write in British English. Amounts are EUR. 'Stage' labels are covenant stages, not sales stages." />
60
+ ```
61
+
62
+ Or equivalently `useInsights({ instructions })` in a custom block. One string per app (the last value set wins), applied to every analysis of the app, max 2000 characters — keep it to a few short sentences. It guides wording and interpretation only; it cannot grant data access or change which rows are analysed. Do not restate what the data already shows, and do not set it unless the user asked for specific guidance.
53
63
 
54
64
  Rules for the block:
55
65
 
@@ -718,7 +718,7 @@ For any external HTTP API call, read `/app/references/external-apis.md` and use
718
718
 
719
719
  ### AI analysis — executive summary and anomalies
720
720
 
721
- When the user asks for AI analysis, an executive summary, "what changed and why", anomaly callouts, or any AI-generated insight about the data on the page, read `/app/references/ai-analysis.md` and build its **Default build** with the shipped components in `src/components/insights/` (`InsightsSummary`, `InsightMarker` / `insightCellProps`, `InvestigateMenuItem`, `InvestigationCard`): summary block at the top, markers on every query-bound chart, Investigate in every point menu, the investigation card under the chart. A short ask gets the whole set; only a narrower ask ("just a summary") gets a subset. Never rewrite those components. Lightdash runs the analysis over the queries the app already loaded and pushes the result in; the app renders it and never sends rows or keys. The components render nothing when the host has no analysis to offer. For an author-written question over loaded results (a takeaway under a chart, "explain this row"), use `useAiPrompt` from the same reference.
721
+ When the user asks for AI analysis, an executive summary, "what changed and why", anomaly callouts, or any AI-generated insight about the data on the page, read `/app/references/ai-analysis.md` and build its **Default build** with the shipped components in `src/components/insights/` (`InsightsSummary`, `InsightMarker` / `insightCellProps`, `InvestigateMenuItem`, `InvestigationCard`): summary block at the top, markers on every query-bound chart, Investigate in every point menu, the investigation card under the chart. A short ask gets the whole set; only a narrower ask ("just a summary") gets a subset. Never rewrite those components. Lightdash runs the analysis over the queries the app already loaded and pushes the result in; the app renders it and never sends rows or keys. The components render nothing when the host has no analysis to offer. For an author-written question over loaded results (a takeaway under a chart, "explain this row"), use `useAiPrompt` from the same reference. When the user wants the summaries written a certain way (language, currency, domain vocabulary), pass it via the `instructions` prop on `InsightsSummary` — see "Author instructions" in the same reference.
722
722
 
723
723
  ## Visual Design
724
724
 
@@ -12,15 +12,21 @@ type Props = {
12
12
  title?: ReactNode;
13
13
  /** Shown before the first run. */
14
14
  idleText?: string;
15
+ /** Guidance for the analysis model: language/format rules and a line or
16
+ * two of domain vocabulary. One string per app. */
17
+ instructions?: string;
15
18
  className?: string;
16
19
  };
17
20
 
18
21
  export function InsightsSummary({
19
22
  title = 'Executive summary',
20
23
  idleText = 'Click Analyse for an AI-generated read of everything on this page.',
24
+ instructions,
21
25
  className,
22
26
  }: Props) {
23
- const view = useInsights();
27
+ // Always pass the options object so clearing the prop clears the
28
+ // guidance instead of leaving the previous value in force.
29
+ const view = useInsights({ instructions });
24
30
  if (view.status === 'unavailable') return null;
25
31
  const busy = view.status === 'analysing';
26
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "3.34.0",
3
+ "version": "3.35.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -22,8 +22,8 @@
22
22
  "@actions/core": "1.11.1",
23
23
  "@aws-sdk/credential-providers": "3.995.0",
24
24
  "@casl/ability": "6.8.0",
25
- "@lightdash/common": "3.34.0",
26
- "@lightdash/warehouses": "3.34.0",
25
+ "@lightdash/common": "3.35.0",
26
+ "@lightdash/warehouses": "3.35.0",
27
27
  "@sidvind/better-ajv-errors": "7.0.0",
28
28
  "@types/columnify": "1.5.1",
29
29
  "ajv": "8.18.0",