@graphit/cli 0.1.49 → 0.1.51

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.
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "metadata": {
9
9
  "description": "Graphit CLI plugin for AI coding assistants",
10
- "version": "0.1.49"
10
+ "version": "0.1.51"
11
11
  },
12
12
  "plugins": [
13
13
  {
@@ -16,9 +16,9 @@
16
16
  "source": {
17
17
  "source": "npm",
18
18
  "package": "@graphit/cli",
19
- "version": "0.1.49"
19
+ "version": "0.1.51"
20
20
  },
21
- "version": "0.1.49",
21
+ "version": "0.1.51",
22
22
  "category": "data-visualization",
23
23
  "tags": [
24
24
  "bi",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphit",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "description": "Build custom HTML dashboards from real data using the Graphit CLI. KB-aware queries, entity wrapping, cached data sources.",
5
5
  "author": {
6
6
  "name": "Graphit",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphit",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "description": "Build custom HTML dashboards from real data using the Graphit CLI. KB-aware queries, entity wrapping, cached data sources.",
5
5
  "author": {
6
6
  "name": "Graphit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphit/cli",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "description": "Graphit CLI - Build custom dashboards from any AI coding assistant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,5 @@
1
1
  ---
2
- skill_version: "0.1.49"
2
+ skill_version: "0.1.51"
3
3
  name: graphit
4
4
  description: >
5
5
  Build HTML dashboards with Graphit. KB-aware queries, entity wrapping, cached data sources.
@@ -415,7 +415,7 @@ The iframe also provides optional convenience helpers if you want quick standard
415
415
  | Helper | Usage |
416
416
  |---|---|
417
417
  | `graphit.chart(el, {type, data, x, y, ...})` | Bar, line, area, donut, scatter, stacked-bar, heatmap, funnel, gauge, sparkline |
418
- | `graphit.table(el, {data, columns?, maxRows?})` | Styled HTML table. `columns` is a `string[]` of data keys (NOT objects), defaults to `Object.keys(data[0])` |
418
+ | `graphit.table(el, {data, columns?, maxRows?, columnFormats?})` | Styled HTML table. `columns` is a `string[]` of data keys (NOT objects), defaults to `Object.keys(data[0])`. `columnFormats` maps column name -> `"currency"`/`"percent"`/`"number"` for per-column number formatting (same formats and no-scaling percent rule as chart `valueFormat`); unlisted columns render raw |
419
419
  | `graphit.kpi(el, {value, label?, format?})` | KPI card with optional delta |
420
420
  | `graphit.presentation(el)` | Full-screen slide deck. Returns builder: `.slide({bg, layout, html})` then `.start()`. See `presentations.md` |
421
421
  | `graphit.filter(id, {label, field?, default?})` | Headless filter registration (renders nothing). Returns handle: `{get, set, subscribe}`. See `filters.md` |
@@ -432,6 +432,8 @@ These are shortcuts, not requirements. Use them when a standard chart is all you
432
432
 
433
433
  `graphit.kpi` config: `value`, `label`, `format` (`"currency"` | `"percent"` | `"number"`), `compareValue`, `compareLabel`.
434
434
 
435
+ **Percent does NOT scale.** `"percent"` only appends a `%` sign - it does not multiply by 100. A 0-1 ratio (retention, conversion, share, churn) renders as `0.42%`, not `42%`. Multiply ratios by 100 in SQL so the value is already 0-100, e.g. `SUM(retained) * 100.0 / NULLIF(SUM(cohort), 0) AS retention_pct` charted with `valueFormat: "percent"` -> "42%". Charts use `valueFormat`; `kpi`/`gauge`/`filter` use `format`.
436
+
435
437
  ### Canonical pattern - entity with live data
436
438
 
437
439
  ```html
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "package": "@graphit/cli",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "source": "cli/package.json"
5
5
  }
@@ -47,6 +47,9 @@ Config: `value`, `min` (default 0), `max` (default 100), `format`, `label`, `col
47
47
  Inline SVG polyline for KPI cards or table cells. No axes, no grid - just trend shape. Single data point renders as a dot.
48
48
  Config: `y`, `width` (default 120), `height` (default 32), `label`, `showValue` (default true), `valueFormat`.
49
49
 
50
+ ## Value formatting
51
+ `valueFormat` (charts), `format` (`kpi`/`gauge`), and `columnFormats` (`graphit.table`, mapping column name -> format) all take `"currency"`, `"percent"`, or `"number"`. **`"percent"` only appends `%` - it does NOT multiply by 100.** A 0-1 ratio renders as `0.42%`, not `42%`; multiply ratios/rates by 100 in SQL (`* 100.0 ... AS x_pct`) so the value is already 0-100. Table columns without a `columnFormats` entry render raw.
52
+
50
53
  ## Color tokens
51
54
 
52
55
  | Token | Usage |
@@ -39,6 +39,8 @@ All KB assets use UPPER_SNAKE_CASE. The names are auto-sanitized:
39
39
  | `COUNT_*` | `COUNT_ACTIVE_USERS` | Count metrics |
40
40
  | `*_RATE` | `CONVERSION_RATE`, `CHURN_RATE` | Ratios/percentages |
41
41
 
42
+ > `*_RATE`/ratio columns are usually 0-1 fractions. To chart them as a percent, multiply by 100 in SQL (`* 100.0`) - `"percent"` format appends `%` without scaling.
43
+
42
44
  ## When to Suggest KB Asset Creation
43
45
 
44
46
  | Signal | Propose |
@@ -133,7 +133,7 @@ Canvas `graphit.resolve()` queries that follow these shapes serve from a semanti
133
133
  **Shapes that skip the cache** (fall back to normal execution, still correct):
134
134
  - `COUNT(DISTINCT x)`, window functions, HAVING, QUALIFY
135
135
  - OR / NOT in WHERE
136
- - Ratio metrics (`SUM(a)/NULLIF(SUM(b),0)`) - compute client-side or use two resolves
136
+ - Ratio metrics (`SUM(a)/NULLIF(SUM(b),0)`) - compute client-side or use two resolves. To display as a percent, multiply by 100 (`* 100.0 ... AS x_pct`): the `"percent"` format only appends `%`, it does not scale (a 0-1 ratio would show as `0.42%`, not `42%`).
137
137
  - `CURRENT_DATE`-relative predicates
138
138
  - Top-N with aggregate only in ORDER BY (`SELECT dim FROM t GROUP BY dim ORDER BY SUM(metric) DESC LIMIT N` - no decomposable aggregate in SELECT)
139
139
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- skill_version: "0.1.49"
2
+ skill_version: "0.1.51"
3
3
  alwaysApply: false
4
4
  description: "Build Graphit HTML dashboards with KB-aware queries, entity wrapping, and cached data sources"
5
5
  globs: []
@@ -305,7 +305,7 @@ Add the overlay inside EVERY element you pass as `target:` - and ONLY those elem
305
305
  | Helper | Usage |
306
306
  |---|---|
307
307
  | `graphit.chart(el, {type, data, x, y, ...})` | Bar, horizontal-bar, line, area, donut, scatter, stacked-bar, heatmap, funnel, gauge, sparkline |
308
- | `graphit.table(el, {data, columns?, maxRows?})` | Styled HTML table. `columns` is a `string[]` of data keys (NOT objects) |
308
+ | `graphit.table(el, {data, columns?, maxRows?, columnFormats?})` | Styled HTML table. `columns` is a `string[]` of data keys (NOT objects). `columnFormats` maps column name -> `"currency"`/`"percent"`/`"number"` (same formats and no-scaling percent rule as chart `valueFormat`); unlisted columns render raw |
309
309
  | `graphit.kpi(el, {value, label?, format?})` | KPI card with optional delta (`compareValue`, `compareLabel`) |
310
310
  | `graphit.presentation(el)` | Full-screen slide deck. Returns builder: `.slide({bg, layout, html})` then `.start()`. See graphit-presentations rule. |
311
311
  | `graphit.filter(id, {label, field?, default?})` | Headless filter (zero DOM). Returns `{get, set, subscribe}` handle. See graphit-filters rule. |
@@ -318,6 +318,8 @@ Add the overlay inside EVERY element you pass as `target:` - and ONLY those elem
318
318
 
319
319
  `graphit.chart` types: `"bar"`, `"horizontal-bar"` (alias `"hbar"`), `"line"`, `"area"`, `"donut"` (alias `"pie"`), `"scatter"` (alias `"bubble"`), `"stacked-bar"` (alias `"stacked"`), `"heatmap"`, `"funnel"`, `"gauge"`, `"sparkline"`. Config: `x`, `y`, `series`, `title`, `height` (140-900px), `valueFormat` (`"currency"` | `"percent"` | `"number"`), `colors`. Dual axis (bar/line/area): `y2`, `y2Format`, `y2Label`; `y2` and `series` are mutually exclusive. Scatter adds: `size`, `label`. Gauge: `min`, `max`, `format`. Sparkline: `width`, `showValue`.
320
320
 
321
+ **Percent does NOT scale.** `"percent"` only appends `%` - it does not multiply by 100. A 0-1 ratio (retention, conversion, share, churn) renders as `0.42%`, not `42%`. Multiply ratios by 100 in SQL (`SUM(retained) * 100.0 / NULLIF(SUM(cohort), 0) AS retention_pct`) then use `valueFormat: "percent"`. Charts use `valueFormat`; `kpi`/`gauge`/`filter` use `format`.
322
+
321
323
  ### Canonical pattern - entity with live data
322
324
 
323
325
  ```html
@@ -44,6 +44,9 @@ Config: `value`, `min` (default 0), `max` (default 100), `format`, `label`, `col
44
44
  Inline SVG polyline for KPI cards or table cells. No axes, no grid - just trend shape. Single data point renders as a dot.
45
45
  Config: `y`, `width` (default 120), `height` (default 32), `label`, `showValue` (default true), `valueFormat`.
46
46
 
47
+ ## Value formatting
48
+ `valueFormat` (charts), `format` (`kpi`/`gauge`), and `columnFormats` (`graphit.table`, mapping column name -> format) all take `"currency"`, `"percent"`, or `"number"`. **`"percent"` only appends `%` - it does NOT multiply by 100.** A 0-1 ratio renders as `0.42%`, not `42%`; multiply ratios/rates by 100 in SQL (`* 100.0 ... AS x_pct`) so the value is already 0-100. Table columns without a `columnFormats` entry render raw.
49
+
47
50
  ## Saved templates
48
51
 
49
52
  Templates are reusable chart components saved to the org's KB. At dashboard load, the SDK fetches the org's template bundle and registers them alongside built-in types.
@@ -46,6 +46,8 @@ All KB assets are UPPER_SNAKE_CASE (auto-sanitized on write):
46
46
  | `COUNT_*` | `COUNT_ACTIVE_USERS` | Count metrics |
47
47
  | `*_RATE` | `CONVERSION_RATE`, `CHURN_RATE` | Ratios / percentages |
48
48
 
49
+ > `*_RATE`/ratio columns are usually 0-1 fractions. To chart them as a percent, multiply by 100 in SQL (`* 100.0`) - `"percent"` format appends `%` without scaling.
50
+
49
51
  ## Formula Syntax
50
52
 
51
53
  Metrics reference `TABLE.COLUMN` with UPPERCASE naming:
@@ -127,7 +127,7 @@ Canvas `graphit.resolve()` queries that follow these shapes serve from a semanti
127
127
  **Shapes that skip the cache** (fall back to normal execution, still correct):
128
128
  - `COUNT(DISTINCT x)`, window functions, HAVING, QUALIFY
129
129
  - OR / NOT in WHERE
130
- - Ratio metrics (`SUM(a)/NULLIF(SUM(b),0)`) - compute client-side or use two resolves
130
+ - Ratio metrics (`SUM(a)/NULLIF(SUM(b),0)`) - compute client-side or use two resolves. To display as a percent, multiply by 100 (`* 100.0 ... AS x_pct`): the `"percent"` format only appends `%`, it does not scale (a 0-1 ratio would show as `0.42%`, not `42%`).
131
131
  - `CURRENT_DATE`-relative predicates
132
132
  - Top-N with aggregate only in ORDER BY (`SELECT dim FROM t GROUP BY dim ORDER BY SUM(metric) DESC LIMIT N` - no decomposable aggregate in SELECT)
133
133