@outsidedata/dolex 8.0.0 → 8.0.1

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 CHANGED
@@ -7,35 +7,20 @@
7
7
  ╚═════╝ ╚═════╝ ╚══════╝ ╚══════╝ ╚═╝ ╚═╝
8
8
  ```
9
9
 
10
- **Your AI data analyst.** Point Claude at a folder of CSV files and get expert-level analysis — no code, no setup, no data leaves your machine.
10
+ # Dolex turns your AI assistant into a data analyst you can trust on your own data.
11
11
 
12
- ---
12
+ A B2B data-analysis product that gives your AI assistant a rigorous analyst's discipline, working on your own files and handing back artifacts you keep.
13
13
 
14
- ## The Problem
14
+ Dolex connects to your data, audits it, runs the analysis, and returns real results you own. It runs locally on your CSV files and loads a folder of them as one joinable database. It profiles every column, classifies what each one is, and builds a prioritized analysis plan with ready-to-run queries. Every answer traces back to an inspectable query, and the findings come back as artifacts you keep. Dolex ships as a published npm package with two front ends over one core: an MCP server any AI assistant can call, and a command-line tool your terminals, scripts, and pipelines run directly.
15
15
 
16
- You've got a folder of CSV exports on your desktop. `sales-2024-Q1.csv`, `sales-2024-Q2.csv`, `customers.csv`, `products.csv`. Loose files from different periods, different systems. Right now, turning those into actual insight means one of two things:
16
+ ## What you get
17
17
 
18
- 1. **The Python REPL loop** — Claude writes a script, runs it, gets an error, fixes it, runs it again, gets a different error, and eventually produces a matplotlib chart with default styling that you'd be embarrassed to put in a deck.
19
-
20
- 2. **"Here's a bar chart"** — every AI assistant reaches for the same three chart types because they optimize for the most likely token, not the most informative visualization.
21
-
22
- Dolex replaces both. No Python. No REPL. No `import pandas`. No `plt.show()`. No debugging dependency conflicts. Just tell Claude: *"load everything in ~/data/ and show me quarterly trends."*
23
-
24
- ## What It Actually Is
25
-
26
- Dolex is an MCP server that gives Claude a complete data analysis toolkit. It runs locally inside Claude — you don't need to know how that works, just install it and Claude gains new abilities:
27
-
28
- **Load a whole folder of CSV files at once** — point it at a directory and Dolex loads every CSV it finds, profiles each one automatically (column types, distributions, stats, sample values), and makes them all queryable. Loose quarterly exports, separate files per region, whatever you have — Dolex handles it.
29
-
30
- **A built-in query engine** — aggregations (sum, avg, median, stddev, percentiles), time bucketing (group by month/quarter/year), window functions (lag, lead, rank, running totals, percent of total), automatic joins across files, and filters. Handles 500k+ rows. No code generation, no sandboxes — Dolex crunches the numbers directly.
31
-
32
- **43 handcrafted visualization patterns** — not chart.js defaults. Bump charts for rankings, beeswarms for distributions, Sankey diagrams for flows, ridgeline plots for comparing distributions, connected dot plots for two-metric comparisons, calendar heatmaps for temporal patterns, and 37 more. Each pattern has selection rules that encode real data visualization expertise.
33
-
34
- **Pattern intelligence** — Dolex doesn't just render charts. It analyzes the shape of your data and your intent, scores all 43 patterns, and recommends the one that actually communicates the insight — not the obvious one.
35
-
36
- **Auto-analysis planning** — give it a dataset and it generates a structured analysis plan: which columns matter, what relationships to explore, what charts to build, with ready-to-execute queries for each step.
37
-
38
- **100% local, 100% offline** — your data never leaves your machine. Charts render as self-contained HTML. 33 TopoJSON map files ship with the package. Zero CDN calls, zero external dependencies.
18
+ - **Analysis on your own data.** Dolex runs locally on your CSV files, and a folder of them becomes one database your assistant can join across.
19
+ - **Data you can stand behind.** A built-in audit surfaces type traps, sentinel values, leaked and duplicate columns, and outliers before they reach a conclusion.
20
+ - **Rigor on every result.** Full column profiling and statistics back the analysis, and each finding traces to a query you can inspect.
21
+ - **A real analysis plan.** Dolex classifies your columns and produces a prioritized analysis plan with ready-to-run queries; derived columns persist across sessions.
22
+ - **Artifacts you keep.** Findings render across 43 chart types as self-contained HTML or PNG, with React components, a design system, and the queries behind every result.
23
+ - **One analyst on call everywhere.** The same core serves your chat assistant and your pipelines, with concurrent work running in its own lane.
39
24
 
40
25
  ## Install
41
26
 
@@ -82,11 +67,11 @@ dolex mcp
82
67
 
83
68
  ## Command Line
84
69
 
85
- You don't need an AI assistant to use Dolex. The same pattern intelligence, SQL
86
- engine, and 43 chart types are a CLI away — point it at a CSV and get a chart.
70
+ The same analysis engine, query layer, and 43 chart types are a CLI away — point
71
+ it at a CSV and get a chart, an analysis plan, or a data-quality audit.
87
72
 
88
73
  ```bash
89
- # Chart a CSV — the pattern is auto-selected and explained
74
+ # Chart a CSV — the pattern matches the shape of the data
90
75
  dolex visualize sales.csv -i "compare revenue by region"
91
76
 
92
77
  # Query first, then chart; force a type and palette; render a PNG
@@ -132,9 +117,9 @@ Full reference: [`docs/CLI.md`](https://github.com/outsidedata/dolex/blob/master
132
117
 
133
118
  ## The Query Engine
134
119
 
135
- Point Claude at a folder of CSV files and start asking questions. No schema definition, no imports, no setup. Dolex loads every file, profiles your data automatically — column types, distributions, cardinality, sample values — and gives Claude everything it needs to answer your questions.
120
+ Point your assistant at a folder of CSV files and start asking questions. Dolex loads every file and profiles your data — column types, distributions, cardinality, sample values — giving your assistant everything it needs to answer.
136
121
 
137
- Claude never writes code or raw SQL. Instead it works with Dolex's built-in query language:
122
+ The built-in query language covers the analysis your assistant runs:
138
123
 
139
124
  **Aggregations**: `sum`, `avg`, `min`, `max`, `count`, `count_distinct`, `median`, `stddev`, `p25`, `p75`, `percentile`
140
125
 
@@ -5,7 +5,7 @@ import * as o from '../output.js';
5
5
  export function printMainHelp(version) {
6
6
  const v = version ? o.c.dim(`v${version}`) : '';
7
7
  o.out(`${o.c.bold('dolex')} ${v} — data visualization from the command line
8
- ${o.c.dim('43 chart types · SQL engine · auto-analysis · local pattern intelligence')}
8
+ ${o.c.dim('a data analyst you can trust on your own data — profile, audit, analyze, and chart 43 ways')}
9
9
 
10
10
  ${o.c.bold('USAGE')}
11
11
  dolex <command> [arguments] [options]
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * Data comes from a CSV path / registered source (optionally sliced with
5
5
  * `--sql`), an inline JSON array (`--data file.json`), or stdin (`-` /
6
- * `--stdin`). The pattern is auto-selected unless `--pattern` forces one.
6
+ * `--stdin`). The chart is matched to the shape of the data; `--pattern` forces a specific one.
7
7
  */
8
8
  export declare function visualizeCommand(argv: string[]): Promise<number>;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Data comes from a CSV path / registered source (optionally sliced with
5
5
  * `--sql`), an inline JSON array (`--data file.json`), or stdin (`-` /
6
- * `--stdin`). The pattern is auto-selected unless `--pattern` forces one.
6
+ * `--stdin`). The chart is matched to the shape of the data; `--pattern` forces a specific one.
7
7
  */
8
8
  import { parseArgs, str, bool, num, list } from '../args.js';
9
9
  import * as o from '../output.js';
@@ -4,7 +4,8 @@
4
4
  *
5
5
  * Dispatches subcommands. Command modules are dynamically imported so that
6
6
  * commands which never touch a CSV avoid loading the SQLite/papaparse optional
7
- * deps, and so `dolex mcp` is the only path that loads (and starts) the MCP
8
- * server — whose `main()` runs on import.
7
+ * deps, and so the MCP server (whose `main()` runs on import) is loaded only
8
+ * when actually serving — via the `dolex mcp` subcommand, or by a bare `dolex`
9
+ * launched over piped stdio (how MCP clients spawn it).
9
10
  */
10
11
  export {};
@@ -4,13 +4,33 @@
4
4
  *
5
5
  * Dispatches subcommands. Command modules are dynamically imported so that
6
6
  * commands which never touch a CSV avoid loading the SQLite/papaparse optional
7
- * deps, and so `dolex mcp` is the only path that loads (and starts) the MCP
8
- * server — whose `main()` runs on import.
7
+ * deps, and so the MCP server (whose `main()` runs on import) is loaded only
8
+ * when actually serving — via the `dolex mcp` subcommand, or by a bare `dolex`
9
+ * launched over piped stdio (how MCP clients spawn it).
9
10
  */
10
11
  import { readFileSync, existsSync } from 'fs';
11
12
  import { dirname, join } from 'path';
12
13
  import { fileURLToPath } from 'url';
13
14
  import * as o from './output.js';
15
+ /**
16
+ * Start the MCP stdio server. Importing the module runs its `main()`, which
17
+ * takes over the process and never returns. The MCP SDK is an optional
18
+ * dependency: if it isn't installed, surface an actionable install message
19
+ * instead of crashing with a cryptic module-not-found error.
20
+ */
21
+ async function startMcpServer() {
22
+ try {
23
+ await import('../mcp/index.js');
24
+ }
25
+ catch (e) {
26
+ const { isModuleNotFound, missingDependencyMessage } = await import('../utils/optional-deps.js');
27
+ if (isModuleNotFound(e) && /modelcontextprotocol/i.test(String(e))) {
28
+ o.fail(missingDependencyMessage('mcp'));
29
+ process.exit(1);
30
+ }
31
+ throw e;
32
+ }
33
+ }
14
34
  function readVersion() {
15
35
  let dir = dirname(fileURLToPath(import.meta.url));
16
36
  for (let i = 0; i < 6; i++) {
@@ -66,27 +86,26 @@ async function main() {
66
86
  process.exit(await (await import('./commands/sources.js')).sourcesCommand(rest));
67
87
  case 'mcp':
68
88
  case 'serve':
69
- // Starts the stdio server on import; do not exit — it owns the process.
70
- // The MCP SDK is an optional dependency: if it isn't installed, tell the
71
- // user exactly what to install instead of crashing with a cryptic error.
72
- try {
73
- await import('../mcp/index.js');
74
- }
75
- catch (e) {
76
- const { isModuleNotFound, missingDependencyMessage } = await import('../utils/optional-deps.js');
77
- if (isModuleNotFound(e) && /modelcontextprotocol/i.test(String(e))) {
78
- o.fail(missingDependencyMessage('mcp'));
79
- process.exit(1);
80
- }
81
- throw e;
82
- }
89
+ await startMcpServer();
83
90
  return;
84
91
  case 'version':
85
92
  case '--version':
86
93
  case '-v':
87
94
  o.out(readVersion() ?? 'unknown');
88
95
  process.exit(0);
89
- case undefined:
96
+ case undefined: {
97
+ // No subcommand. MCP clients spawn the bin with piped stdio (no TTY) and
98
+ // expect the stdio server on the other end, so a bare `dolex` must serve —
99
+ // that keeps every existing `command: "dolex"` config working. A human at
100
+ // an interactive terminal (a TTY) gets help instead.
101
+ if (!process.stdin.isTTY) {
102
+ await startMcpServer();
103
+ return;
104
+ }
105
+ const { printMainHelp } = await import('./commands/help.js');
106
+ printMainHelp(readVersion());
107
+ process.exit(0);
108
+ }
90
109
  case 'help':
91
110
  case '--help':
92
111
  case '-h': {
@@ -76,7 +76,7 @@ const server = new McpServer({
76
76
  ...(serverIcons && { icons: serverIcons }),
77
77
  }, {
78
78
  instructions: [
79
- 'Dolex — CSV data analysis with 43 chart types.',
79
+ "You are a data analyst working on the user's own CSV files: rigorous column profiling, data-quality auditing, a prioritized analysis plan, and findings rendered across 43 chart types as artifacts they keep.",
80
80
  '',
81
81
  'WORKFLOW:',
82
82
  '• Got a CSV file? → load_csv(name, path) — returns smart summary (column names, types, ranges, categorical values)',
@@ -96,26 +96,26 @@ const server = new McpServer({
96
96
  '• describe_data: Full column stats, top values, sample rows. Call only when you need deep exploration.',
97
97
  '• analyze_data: Auto-generate analysis plan with ready SQL queries. Execute each step with visualize; present results one at a time.',
98
98
  '• query_data: Run SQL query, get rows. Returns resultId for visualize().',
99
- '• visualize: Chart data. Pass inline data array, resultId from query_data, or sourceId + sql for server-side query. Auto-selects best pattern. Set title/subtitle here to avoid a refine round-trip.',
99
+ '• visualize: Chart data. Pass inline data array, resultId from query_data, or sourceId + sql for server-side query. Matches a chart to the shape of the data. Set title/subtitle here to avoid a refine round-trip.',
100
100
  '• refine_visualization: Tweak a chart — sort, limit, filter, palette, highlight, flip, title, format. Each call returns a new specId.',
101
101
  '• list_patterns: Browse available chart types. Only needed when the user asks what charts are available or you need a pattern ID.',
102
102
  '',
103
103
  'Utility tools: list_data, remove_data, server_status (inspect cached data), clear_cache, export_html (get chart HTML by specId), screenshot (render to PNG).',
104
104
  '',
105
105
  'COLOR: Set palette (categorical/blue/warm/blueRed/etc.) and/or highlight specific values. Use colorField to control which column drives color.',
106
- 'PATTERNS: 43 types auto-selected by data shape + intent. When user names a specific chart type, pass pattern="<id>" to force it. Use list_patterns to browse.',
106
+ 'PATTERNS: 43 chart types matched to the shape of the data and the question being asked. When user names a specific chart type, pass pattern="<id>" to force it. Use list_patterns to browse.',
107
107
  '',
108
108
  'ERRORS: If a SQL query fails, check the error message for available columns/tables and retry. If specId is expired, re-run visualize.',
109
109
  '',
110
110
  'DON\'T use Dolex for: simple arithmetic, explanations of chart types, non-data questions, or file format conversions (CSV export, PowerPoint, etc.).',
111
- 'DO use Dolex when the user asks "what chart should I use" — run visualize and let the pattern selector recommend.',
111
+ 'DO use Dolex when the user asks "what chart should I use" — run visualize to match a chart to the shape of the data.',
112
112
  ].join('\n'),
113
113
  });
114
114
  // ─── REGISTER TOOLS ─────────────────────────────────────────────────────────
115
115
  // Inline data visualization tool
116
116
  registerAppTool(server, 'visualize', {
117
117
  title: 'Visualize Data',
118
- description: 'Chart data from inline arrays, cached query results, or loaded CSVs.\n\nData source (provide one):\n• data: inline rows\n• resultId: reuse query_data result\n• sourceId + sql: query a loaded CSV server-side (saves tokens)\n\nReturns specId (for refine calls), pattern recommendation, and alternatives.\nPresent any notes to the user.',
118
+ description: 'Produces the analysis as a finished chart. Takes inline data, a cached result, or a registered source, and produces a chart matched to the shape of the data — self-contained HTML the user keeps, with the analysis behind it inspectable. Set title and subtitle here.\n\nData source (provide one):\n• data: inline rows\n• resultId: reuse query_data result\n• sourceId + sql: query a loaded CSV server-side (saves tokens)\n\nReturns specId (for refine calls), the matched chart, and alternatives.\nPresent any notes to the user.',
119
119
  inputSchema: visualizeInputSchema.shape,
120
120
  _meta: {
121
121
  ui: {
@@ -9,9 +9,9 @@ import type { SourceManager } from '../../connectors/manager.js';
9
9
  export declare const clearCacheInputSchema: z.ZodObject<{
10
10
  scope: z.ZodDefault<z.ZodEnum<["all", "specs", "results"]>>;
11
11
  }, "strip", z.ZodTypeAny, {
12
- scope: "specs" | "all" | "results";
12
+ scope: "all" | "specs" | "results";
13
13
  }, {
14
- scope?: "specs" | "all" | "results" | undefined;
14
+ scope?: "all" | "specs" | "results" | undefined;
15
15
  }>;
16
16
  interface PrivacyDeps {
17
17
  sourceManager: SourceManager;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * MCP Tool: visualize
3
3
  * Takes data (inline, cached, or from a loaded CSV via SQL) + intent
4
- * and returns visualization recommendations from the handcrafted pattern library.
4
+ * and produces a chart matched to the shape of the data.
5
5
  *
6
6
  * Returns compact text content (specId + metadata, no data) while
7
7
  * structuredContent still gets the full pre-rendered chart HTML.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * MCP Tool: visualize
3
3
  * Takes data (inline, cached, or from a loaded CSV via SQL) + intent
4
- * and returns visualization recommendations from the handcrafted pattern library.
4
+ * and produces a chart matched to the shape of the data.
5
5
  *
6
6
  * Returns compact text content (specId + metadata, no data) while
7
7
  * structuredContent still gets the full pre-rendered chart HTML.
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Pattern Selection Intelligence.
2
+ * Pattern Selection.
3
3
  *
4
- * This is the core of the product. Analyzes data shape + user intent,
5
- * scores every registered pattern, and returns ranked recommendations
6
- * with reasoning.
4
+ * Analyzes data shape + user intent, scores every registered pattern,
5
+ * and returns ranked recommendations with reasoning.
7
6
  *
8
- * An LLM will always pick bar/line/pie. We pick bump charts, beeswarms,
9
- * slope charts, waffles — because the selection rules encode design
10
- * expertise that probabilistic token generation cannot.
7
+ * Selection rules encode dataviz design expertise, matching the
8
+ * visualization — bar, line, bump chart, beeswarm, slope chart, waffle,
9
+ * and the rest of the library — to the shape of the data and the question
10
+ * being asked.
11
11
  */
12
12
  import type { DataColumn, PatternMatchContext, VisualizationRecommendation, PatternCategory } from '../types.js';
13
13
  export interface SelectionResult {
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Pattern Selection Intelligence.
2
+ * Pattern Selection.
3
3
  *
4
- * This is the core of the product. Analyzes data shape + user intent,
5
- * scores every registered pattern, and returns ranked recommendations
6
- * with reasoning.
4
+ * Analyzes data shape + user intent, scores every registered pattern,
5
+ * and returns ranked recommendations with reasoning.
7
6
  *
8
- * An LLM will always pick bar/line/pie. We pick bump charts, beeswarms,
9
- * slope charts, waffles — because the selection rules encode design
10
- * expertise that probabilistic token generation cannot.
7
+ * Selection rules encode dataviz design expertise, matching the
8
+ * visualization — bar, line, bump chart, beeswarm, slope chart, waffle,
9
+ * and the rest of the library — to the shape of the data and the question
10
+ * being asked.
11
11
  */
12
12
  import { registry } from './registry.js';
13
13
  import { buildMatchContext, parseIntent } from './utils.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outsidedata/dolex",
3
- "version": "8.0.0",
4
- "description": "AI data analyst — 43 handcrafted visualization patterns, SQL query engine with custom aggregates, and auto-analysis planning via MCP",
3
+ "version": "8.0.1",
4
+ "description": "Turn your AI assistant into a data analyst you can trust on your own CSV files — column profiling, data-quality auditing, a prioritized analysis plan, and findings rendered across 43 chart types.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "scripts": {
68
68
  "build:bundles": "tsx scripts/build-render-bundles.ts",
69
- "build": "npm run build:bundles && tsc",
69
+ "build": "npm run build:bundles && tsc && chmod +x dist/src/cli/index.js",
70
70
  "dev": "tsx watch src/mcp/index.ts",
71
71
  "start": "node dist/src/cli/index.js mcp",
72
72
  "cli": "node dist/src/cli/index.js",