semiotic 3.5.4 → 3.7.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 (164) hide show
  1. package/CLAUDE.md +196 -175
  2. package/README.md +52 -15
  3. package/ai/cli.js +41 -0
  4. package/ai/componentMetadata.cjs +11 -2
  5. package/ai/dist/mcp-server.js +454 -4
  6. package/ai/examples.md +98 -0
  7. package/ai/schema.json +614 -9
  8. package/ai/system-prompt.md +5 -2
  9. package/dist/components/AccessibleNavTree.d.ts +25 -0
  10. package/dist/components/Annotation.d.ts +40 -14
  11. package/dist/components/ChartContainer.d.ts +32 -2
  12. package/dist/components/ai/annotationProvenance.d.ts +349 -0
  13. package/dist/components/ai/audienceProfile.d.ts +147 -0
  14. package/dist/components/ai/audiences.d.ts +31 -0
  15. package/dist/components/ai/chartCapabilities.d.ts +55 -0
  16. package/dist/components/ai/chartCapabilityTypes.d.ts +254 -0
  17. package/dist/components/ai/chartRoles.d.ts +27 -0
  18. package/dist/components/ai/conversationArc.d.ts +379 -0
  19. package/dist/components/ai/dataScaleProfile.d.ts +320 -0
  20. package/dist/components/ai/describeChart.d.ts +114 -0
  21. package/dist/components/ai/diffProfile.d.ts +51 -0
  22. package/dist/components/ai/inferIntent.d.ts +24 -0
  23. package/dist/components/ai/intents.d.ts +34 -0
  24. package/dist/components/ai/navigationTree.d.ts +45 -0
  25. package/dist/components/ai/profileData.d.ts +16 -0
  26. package/dist/components/ai/qualityFixtures.d.ts +2 -0
  27. package/dist/components/ai/qualityScorecard.d.ts +82 -0
  28. package/dist/components/ai/readerGrounding.d.ts +70 -0
  29. package/dist/components/ai/repairChartConfig.d.ts +73 -0
  30. package/dist/components/ai/streamingTypes.d.ts +64 -0
  31. package/dist/components/ai/suggestCharts.d.ts +109 -0
  32. package/dist/components/ai/suggestDashboard.d.ts +92 -0
  33. package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
  34. package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
  35. package/dist/components/ai/useChartSuggestions.d.ts +22 -0
  36. package/dist/components/ai/useConversationArc.d.ts +89 -0
  37. package/dist/components/ai/useNavigationSync.d.ts +61 -0
  38. package/dist/components/ai/variantDiscovery.d.ts +168 -0
  39. package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
  40. package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
  41. package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
  42. package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
  43. package/dist/components/charts/index.d.ts +1 -1
  44. package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
  45. package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
  46. package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
  47. package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
  48. package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
  49. package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
  50. package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
  51. package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
  52. package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
  53. package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
  54. package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
  55. package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
  56. package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
  57. package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
  58. package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
  59. package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
  60. package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
  61. package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
  62. package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
  63. package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
  64. package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
  65. package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
  66. package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
  67. package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
  68. package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
  69. package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
  70. package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
  71. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +3 -0
  72. package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
  73. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +3 -0
  74. package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
  75. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +3 -0
  76. package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
  77. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +3 -0
  78. package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
  79. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +3 -0
  80. package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
  81. package/dist/components/charts/shared/annotationHierarchy.d.ts +42 -0
  82. package/dist/components/charts/shared/annotationResolvers.d.ts +3 -2
  83. package/dist/components/charts/shared/annotationRules.d.ts +16 -0
  84. package/dist/components/charts/shared/annotationTypes.d.ts +14 -0
  85. package/dist/components/charts/shared/auditAccessibility.d.ts +90 -0
  86. package/dist/components/charts/shared/chartSpecs.d.ts +2 -37
  87. package/dist/components/charts/shared/diagnoseConfig.d.ts +4 -6
  88. package/dist/components/charts/shared/selectionUtils.d.ts +5 -2
  89. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -0
  90. package/dist/components/charts/shared/types.d.ts +5 -1
  91. package/dist/components/charts/value/BigNumber.capability.d.ts +13 -0
  92. package/dist/components/charts/value/BigNumber.d.ts +14 -0
  93. package/dist/components/charts/value/formatting.d.ts +40 -0
  94. package/dist/components/charts/value/thresholdSparkline.d.ts +40 -0
  95. package/dist/components/charts/value/types.d.ts +292 -0
  96. package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
  97. package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
  98. package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
  99. package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
  100. package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
  101. package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
  102. package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
  103. package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
  104. package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
  105. package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
  106. package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
  107. package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
  108. package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
  109. package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
  110. package/dist/components/data/DataSummarizer.d.ts +45 -0
  111. package/dist/components/realtime/lifecycleBands.d.ts +44 -0
  112. package/dist/components/realtime/types.d.ts +23 -8
  113. package/dist/components/recipes/annotationDensity.d.ts +69 -0
  114. package/dist/components/recipes/annotationLayout.d.ts +93 -0
  115. package/dist/components/semiotic-ai.d.ts +58 -0
  116. package/dist/components/semiotic-realtime.d.ts +2 -0
  117. package/dist/components/semiotic-recipes.d.ts +4 -0
  118. package/dist/components/semiotic-utils.d.ts +8 -0
  119. package/dist/components/semiotic-value.d.ts +55 -0
  120. package/dist/components/semiotic-xy.d.ts +1 -1
  121. package/dist/components/semiotic.d.ts +8 -1
  122. package/dist/components/server/staticAnnotations.d.ts +2 -0
  123. package/dist/components/store/useChartFocus.d.ts +43 -0
  124. package/dist/components/store/useChartInterrogation.d.ts +141 -0
  125. package/dist/components/stream/AccessibleDataTable.d.ts +10 -1
  126. package/dist/components/stream/NetworkSVGOverlay.d.ts +11 -5
  127. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -0
  128. package/dist/components/stream/SVGOverlay.d.ts +2 -0
  129. package/dist/components/stream/geoTypes.d.ts +3 -0
  130. package/dist/components/stream/networkTypes.d.ts +2 -0
  131. package/dist/components/stream/ordinalTypes.d.ts +2 -0
  132. package/dist/components/stream/types.d.ts +2 -0
  133. package/dist/geo.min.js +1 -1
  134. package/dist/geo.module.min.js +1 -1
  135. package/dist/network.min.js +1 -1
  136. package/dist/network.module.min.js +1 -1
  137. package/dist/ordinal.min.js +1 -1
  138. package/dist/ordinal.module.min.js +1 -1
  139. package/dist/realtime.min.js +1 -1
  140. package/dist/realtime.module.min.js +1 -1
  141. package/dist/semiotic-ai.d.ts +58 -0
  142. package/dist/semiotic-ai.min.js +1 -1
  143. package/dist/semiotic-ai.module.min.js +1 -1
  144. package/dist/semiotic-realtime.d.ts +2 -0
  145. package/dist/semiotic-recipes.d.ts +4 -0
  146. package/dist/semiotic-recipes.min.js +1 -1
  147. package/dist/semiotic-recipes.module.min.js +1 -1
  148. package/dist/semiotic-themes.min.js +1 -1
  149. package/dist/semiotic-themes.module.min.js +1 -1
  150. package/dist/semiotic-utils.d.ts +8 -0
  151. package/dist/semiotic-utils.min.js +1 -1
  152. package/dist/semiotic-utils.module.min.js +1 -1
  153. package/dist/semiotic-value.d.ts +55 -0
  154. package/dist/semiotic-value.min.js +2 -0
  155. package/dist/semiotic-value.module.min.js +2 -0
  156. package/dist/semiotic-xy.d.ts +1 -1
  157. package/dist/semiotic.d.ts +8 -1
  158. package/dist/semiotic.min.js +1 -1
  159. package/dist/semiotic.module.min.js +1 -1
  160. package/dist/server.min.js +1 -1
  161. package/dist/server.module.min.js +1 -1
  162. package/dist/xy.min.js +1 -1
  163. package/dist/xy.module.min.js +1 -1
  164. package/package.json +28 -5
package/README.md CHANGED
@@ -35,7 +35,7 @@ generate correct code without examples.
35
35
  Semiotic ships with everything an AI coding assistant needs to generate
36
36
  correct visualizations without trial and error:
37
37
 
38
- - **`semiotic/ai`** — a single import with 41 HOC charts (XY, ordinal, network, realtime), optimized for LLM code generation. Geo charts are in `semiotic/geo` to keep d3-geo out of non-geo bundles.
38
+ - **`semiotic/ai`** — a single import with the 47-chart capability catalog (XY, ordinal, network, realtime, geo, value), optimized for LLM code generation. Prefer family subpaths such as `semiotic/xy`, `semiotic/geo`, and `semiotic/value` when bundle size matters.
39
39
  - **`ai/schema.json`** — machine-readable prop schemas for every component
40
40
  - **`npx semiotic-mcp`** — an MCP server for tool-based chart rendering in any MCP client
41
41
  - **`npx semiotic-ai --doctor`** — validate component + props JSON from the command line with typo suggestions and anti-pattern detection
@@ -71,6 +71,13 @@ with d3-geo projections, zoom/pan, tile basemaps, and drag-rotate globe spinning
71
71
  LOESS smoothing, forecast with confidence envelopes, and anomaly detection.
72
72
  Marginal distribution graphics on scatterplot axes with a single prop.
73
73
 
74
+ **First-class annotations.** Annotations are data-bound objects, not post-hoc
75
+ artwork. Labels, callouts, thresholds, enclosures, statistical overlays, and
76
+ React widgets move with the chart and render through browser, SSR, and export
77
+ paths. Opt into placement, hierarchy, density, progressive disclosure,
78
+ audience-aware amount, provenance, and editorial lifecycle when the chart
79
+ needs to communicate more than its encoding alone.
80
+
74
81
  ### Start simple, go deep
75
82
 
76
83
  | Layer | For | Example |
@@ -278,6 +285,27 @@ configToJSX(config)
278
285
  Supports bar, line, area, point, rect, arc, tick marks with encoding translation
279
286
  for color, size, aggregation, and binning.
280
287
 
288
+ ### Conversation Arc Telemetry
289
+
290
+ Capture and replay the path an AI-assisted chart session took:
291
+
292
+ ```ts
293
+ import {
294
+ createLocalStorageConversationArcSink,
295
+ enableConversationArc,
296
+ getConversationArcStore,
297
+ loadConversationArc,
298
+ registerConversationArcSink,
299
+ } from "semiotic/ai"
300
+
301
+ const sink = createLocalStorageConversationArcSink({ key: "my-app:arc" })
302
+ registerConversationArcSink(sink)
303
+ enableConversationArc({ sessionId: "session-abc" })
304
+
305
+ getConversationArcStore().record({ type: "chart-rendered", component: "LineChart" })
306
+ loadConversationArc(sink.load(), { enabled: false })
307
+ ```
308
+
281
309
  ## Bundle Sizes
282
310
 
283
311
  Semiotic ships 12 entry points. **Don't import from `"semiotic"` unless you need everything** — use the sub-path that matches your chart type:
@@ -287,18 +315,19 @@ Semiotic ships 12 entry points. **Don't import from `"semiotic"` unless you need
287
315
 
288
316
  | Entry Point | gzip | What's inside |
289
317
  |---|---|---|
290
- | `semiotic/xy` | **85 KB** | LineChart, AreaChart, Scatterplot, Heatmap, + 8 more XY charts |
291
- | `semiotic/ordinal` | **69 KB** | BarChart, PieChart, BoxPlot, Histogram, + 11 more categorical charts |
292
- | `semiotic/network` | **63 KB** | ForceDirectedGraph, SankeyDiagram, ProcessSankey, Treemap, + 4 more |
293
- | `semiotic/geo` | **52 KB** | ChoroplethMap, FlowMap, DistanceCartogram, ProportionalSymbolMap |
294
- | `semiotic/realtime` | **90 KB** | RealtimeLineChart, RealtimeHistogram, + 3 streaming charts |
295
- | `semiotic/server` | **122 KB** | renderChart, renderDashboard, renderToImage, renderToAnimatedGif |
296
- | `semiotic/utils` | **22 KB** | ThemeProvider, validators, serialization — no chart components |
297
- | `semiotic/recipes` | **5 KB** | Pure layout functions (waffle, marimekko, flextree, dagre, …) |
318
+ | `semiotic/xy` | **90 KB** | LineChart, AreaChart, Scatterplot, Heatmap, + 8 more XY charts |
319
+ | `semiotic/ordinal` | **74 KB** | BarChart, PieChart, BoxPlot, Histogram, + 11 more categorical charts |
320
+ | `semiotic/network` | **68 KB** | ForceDirectedGraph, SankeyDiagram, ProcessSankey, Treemap, + 4 more |
321
+ | `semiotic/geo` | **55 KB** | ChoroplethMap, FlowMap, DistanceCartogram, ProportionalSymbolMap |
322
+ | `semiotic/realtime` | **95 KB** | RealtimeLineChart, RealtimeHistogram, + 4 streaming charts |
323
+ | `semiotic/server` | **127 KB** | renderChart, renderDashboard, renderToImage, renderToAnimatedGif |
324
+ | `semiotic/utils` | **37 KB** | ThemeProvider, validators, serialization — no chart components |
325
+ | `semiotic/recipes` | **9 KB** | Pure layout functions (waffle, marimekko, flextree, dagre, …) |
298
326
  | `semiotic/themes` | **4 KB** | Theme presets only (tufte, carbon, etc.) |
299
327
  | `semiotic/data` | **3 KB** | bin, rollup, groupBy, pivot, fromVegaLite |
300
- | `semiotic/ai` | **189 KB** | All 41 HOCs + validation optimized for LLM code generation |
301
- | `semiotic` | **188 KB** | Everything below (full bundle) |
328
+ | `semiotic/value` | **6 KB** | BigNumber focal-value KPI / scorecard (SingleValueFrame POC) |
329
+ | `semiotic/ai` | **246 KB** | All 47 schema-backed charts + validation — optimized for LLM code generation |
330
+ | `semiotic` | **203 KB** | Everything below (full bundle) |
302
331
 
303
332
  <!-- semiotic-bundle-sizes:end -->
304
333
 
@@ -389,8 +418,14 @@ No API keys or authentication required. The server runs locally via stdio. HTTP
389
418
  | Tool | Description |
390
419
  |------|-------------|
391
420
  | **`renderChart`** | Render a Semiotic chart to static SVG. Supports the components returned by `getSchema` that are marked `[renderable]`. Pass `{ component: "LineChart", props: { data: [...], xAccessor: "x", yAccessor: "y" } }`. Returns SVG string or validation errors with fix suggestions. |
392
- | **`getSchema`** | Return the prop schema for a specific component. Pass `{ component: "LineChart" }` to get its props, or omit `component` to list all 45 chart schemas. Components marked `[renderable]` are available through `renderChart`; realtime charts require a browser/live environment. |
393
- | **`suggestChart`** | Recommend chart types for a data sample. Pass `{ data: [{...}, ...] }` with 1–5 sample objects. Optionally include `intent` (`"comparison"`, `"trend"`, `"distribution"`, `"relationship"`, `"composition"`, `"geographic"`, `"network"`, `"hierarchy"`). Returns ranked suggestions with example props. |
421
+ | **`getSchema`** | Return the prop schema for a specific component. Pass `{ component: "LineChart" }` to get its props, or omit `component` to list all 47 chart schemas. Components marked `[renderable]` are available through `renderChart`; realtime charts require a browser/live environment. |
422
+ | **`suggestChart`** | Legacy sample-row recommender. Pass `{ data: [{...}, ...] }` with 1–5 sample objects plus optional broad intent/capability filters. |
423
+ | **`suggestCharts`** | Capability-based recommender for bounded row data. Returns ranked chart suggestions with scores, reasons, caveats, import paths, and ready-to-use props. |
424
+ | **`suggestStreamCharts`** | Recommend realtime charts from a stream schema, throughput, and retention hints. |
425
+ | **`suggestDashboard`** | Build a multi-panel dashboard suggestion that covers distinct analytical intents. |
426
+ | **`suggestStretchCharts`** | Recommend audience-literacy stretch picks from an `AudienceProfile`. |
427
+ | **`repairChartConfig`** | Check whether a requested chart fits a dataset and return ranked alternatives when it does not. |
428
+ | **`interrogateChart`** | Return a statistical summary and chart-aware context for answering natural-language questions with optional annotations. |
394
429
  | **`diagnoseConfig`** | Check a chart configuration for common problems — empty data, bad dimensions, missing accessors, wrong data shape, and more. Returns a human-readable diagnostic report with actionable fixes. |
395
430
  | **`reportIssue`** | Generate a pre-filled GitHub issue URL for bug reports or feature requests. Pass `{ title: "...", body: "...", labels: ["bug"] }`. Returns a URL the user can open to submit. |
396
431
  | **`applyTheme`** | List named theme presets or return ThemeProvider/CSS/token usage for a preset such as `{ name: "tufte" }`. |
@@ -401,6 +436,7 @@ No API keys or authentication required. The server runs locally via stdio. HTTP
401
436
  |----------|-------------|
402
437
  | **`semiotic://schema`** | Full machine-readable component schema JSON. |
403
438
  | **`semiotic://components`** | Component index showing renderable/browser-only status and MCP categories. |
439
+ | **`semiotic://behavior-contracts`** | Agent-visible semantic rules for color precedence, required prop combinations, push refs, and renderability. |
404
440
  | **`semiotic://system-prompt`** | Compact AI instructions with import rules, chart props, SSR guidance, and pitfalls. |
405
441
  | **`semiotic://examples`** | Copy-paste chart examples by data shape. |
406
442
 
@@ -502,7 +538,7 @@ Semiotic is indexed by AI-coding-agent documentation tools so your assistant (Cl
502
538
 
503
539
  Agent-facing API surface:
504
540
 
505
- - **`CLAUDE.md`**, **`ai/schema.json`**, **`ai/behaviorContracts.cjs`** — bundled in the npm tarball (see `package.json#files`); agents that install Semiotic locally read these directly. `CLAUDE.md` is the quick-start cheat sheet (HOC props, push API, theming, usage notes); `ai/schema.json` is the JSON Schema for every chart's prop surface (45 charts); `ai/behaviorContracts.cjs` carries the agent-visible semantic rules (color precedence, push-mode requirements, ID-accessor contracts).
541
+ - **`CLAUDE.md`**, **`ai/schema.json`**, **`ai/behaviorContracts.cjs`** — bundled in the npm tarball (see `package.json#files`); agents that install Semiotic locally read these directly. `CLAUDE.md` is the quick-start cheat sheet (HOC props, push API, theming, usage notes); `ai/schema.json` is the JSON Schema for every chart's prop surface (47 charts); `ai/behaviorContracts.cjs` carries the agent-visible semantic rules (color precedence, push-mode requirements, ID-accessor contracts).
506
542
  - [**`semiotic.nteract.io/llms.txt`**](https://semiotic.nteract.io/llms.txt) + [**`/llms-full.txt`**](https://semiotic.nteract.io/llms-full.txt) — deployed at the docs site per the [llms.txt standard](https://llmstxt.org). Agents fetch the navigation map (`llms.txt`) or the full inlined docs (`llms-full.txt`) over HTTP; they're not part of the npm package itself.
507
543
 
508
544
  ## Documentation
@@ -512,7 +548,8 @@ Agent-facing API surface:
512
548
  - [Getting Started](https://semiotic.nteract.io/getting-started)
513
549
  - [Charts](https://semiotic.nteract.io/charts) — chart types with live examples
514
550
  - [Frames](https://semiotic.nteract.io/frames) — full Frame API reference
515
- - [Features](https://semiotic.nteract.io/features) — axes, annotations, tooltips, styling, Vega-Lite translator
551
+ - [Features](https://semiotic.nteract.io/features) — axes, tooltips, interaction, responsive behavior, and composition
552
+ - [Annotations](https://semiotic.nteract.io/annotations) — first-class annotation types, design guidance, provenance, and lifecycle
516
553
  - [Cookbook](https://semiotic.nteract.io/cookbook) — advanced patterns and recipes
517
554
  - [Playground](https://semiotic.nteract.io/playground) — interactive prop exploration
518
555
 
package/ai/cli.js CHANGED
@@ -48,6 +48,8 @@ Usage:
48
48
  npx semiotic-ai --compact Print ai/system-prompt.md (compact prompt)
49
49
  npx semiotic-ai --examples Print ai/examples.md (copy-paste examples)
50
50
  npx semiotic-ai --doctor Validate { component, props, usageMode? } JSON from stdin
51
+ npx semiotic-ai --audit-a11y Audit { component, props, inChartContainer?, describe?, navigable? }
52
+ JSON against Chartability (POUR-CAF) accessibility heuristics
51
53
  npx semiotic-ai --help Show this help message
52
54
  `.trim()
53
55
 
@@ -341,6 +343,45 @@ if (flag === "--doctor") {
341
343
  process.exit(0)
342
344
  }
343
345
 
346
+ // --audit-a11y: grade component + props against Chartability heuristics
347
+ if (flag === "--audit-a11y") {
348
+ const input = readJSONInput("Usage: npx semiotic-ai --audit-a11y '{\"component\":\"LineChart\",\"props\":{\"data\":[...],\"xAccessor\":\"x\",\"yAccessor\":\"y\"}}'\n echo '{\"component\":\"BarChart\",\"props\":{...},\"inChartContainer\":true}' | npx semiotic-ai --audit-a11y")
349
+
350
+ try {
351
+ const { component, props, inChartContainer, describe, navigable } = JSON.parse(input)
352
+ if (!component || !props) {
353
+ console.error("Input must be JSON with { component, props } fields.")
354
+ process.exit(1)
355
+ }
356
+
357
+ // Load the audit from dist (same strategy as --doctor). It lives in the
358
+ // semiotic/ai bundle; a clean source checkout without a build can't run it.
359
+ const distPath = path.join(pkgRoot, "dist", "semiotic-ai.min.js")
360
+ let auditAccessibility, formatAccessibilityAudit
361
+ try {
362
+ if (!process.env.SEMIOTIC_AI_SCHEMA_ONLY) {
363
+ const mod = require(distPath)
364
+ auditAccessibility = mod.auditAccessibility
365
+ formatAccessibilityAudit = mod.formatAccessibilityAudit
366
+ }
367
+ } catch (e) {
368
+ // Dist unavailable.
369
+ }
370
+
371
+ if (!auditAccessibility || !formatAccessibilityAudit) {
372
+ console.error("Accessibility audit requires the built library. Run `npm run dist` first, or use the MCP `auditAccessibility` tool.")
373
+ process.exit(2)
374
+ }
375
+
376
+ const result = auditAccessibility(component, props, { inChartContainer: inChartContainer === true, describe: describe === true, navigable: navigable === true })
377
+ console.log(formatAccessibilityAudit(result))
378
+ process.exit(result.ok ? 0 : 1)
379
+ } catch (err) {
380
+ console.error(`Failed to parse input: ${errorMessage(err)}`)
381
+ process.exit(1)
382
+ }
383
+ }
384
+
344
385
  const filePath = flag ? FILES[flag] : FILES.default
345
386
 
346
387
  if (!filePath) {
@@ -1,6 +1,6 @@
1
1
  "use strict"
2
2
 
3
- const CATEGORY_ORDER = ["xy", "ordinal", "network", "geo", "realtime"]
3
+ const CATEGORY_ORDER = ["xy", "ordinal", "network", "geo", "realtime", "value"]
4
4
 
5
5
  const COMPONENTS_BY_CATEGORY = {
6
6
  xy: [
@@ -24,6 +24,9 @@ const COMPONENTS_BY_CATEGORY = {
24
24
  "RealtimeLineChart", "RealtimeHistogram", "TemporalHistogram", "RealtimeSwarmChart",
25
25
  "RealtimeWaterfallChart", "RealtimeHeatmap",
26
26
  ],
27
+ value: [
28
+ "BigNumber",
29
+ ],
27
30
  }
28
31
 
29
32
  const COMPONENT_TO_CATEGORY = new Map()
@@ -59,11 +62,17 @@ function metadataForComponent(entryOrName) {
59
62
  // any other static HOC. Matches the name-prefix exclusion the
60
63
  // check-surface-parity script applies.
61
64
  const isPushOnly = category === "realtime" && name.startsWith("Realtime")
65
+ // Value-family charts (BigNumber, future SingleValueFrame HOCs)
66
+ // render via react-dom/server in a normal React tree, but they do
67
+ // not route through the frame-driven `renderChart` path in
68
+ // serverChartConfigs.ts — so they are not MCP-renderable. Mirrors
69
+ // the `hoc-ssr-only` special feature documented in chartSpecs.ts.
70
+ const isValueCategory = category === "value"
62
71
  return {
63
72
  name,
64
73
  category,
65
74
  importPath: importPathForCategory(category),
66
- renderable: !isPushOnly,
75
+ renderable: !isPushOnly && !isValueCategory,
67
76
  description: typeof entryOrName === "string" ? undefined : entryOrName.description,
68
77
  }
69
78
  }