@graphit/cli 0.1.3 → 0.1.4
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/package.json
CHANGED
package/skills/graphit/SKILL.md
CHANGED
|
@@ -22,6 +22,17 @@ If the output includes an "Update available" banner, tell the user to update bef
|
|
|
22
22
|
When any `graphit` command fails with an unexpected error (unknown command, unrecognized flag, non-zero exit with unclear message), suggest `npm update -g @graphit/cli` before investigating further. Outdated CLI versions are the most common cause of unexpected errors.
|
|
23
23
|
Do NOT suggest updating for normal operational failures (expired auth, bad SQL syntax, network timeout, entity not found).
|
|
24
24
|
|
|
25
|
+
## After Setup
|
|
26
|
+
|
|
27
|
+
After `graphit setup` completes successfully, offer to add a Graphit section to the project's CLAUDE.md (or AGENTS.md for Codex) so future sessions know Graphit is available without activating the skill. Suggested snippet:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
## Graphit
|
|
31
|
+
Use `/graphit` to build custom HTML dashboards from real data.
|
|
32
|
+
Run `graphit ds list` to see cached data sources before querying.
|
|
33
|
+
Run `graphit kb list` to explore available metrics and dimensions.
|
|
34
|
+
```
|
|
35
|
+
|
|
25
36
|
## HARD CONSTRAINTS (violating these produces a broken dashboard)
|
|
26
37
|
|
|
27
38
|
### 1. ZERO external resources
|
|
@@ -91,10 +102,13 @@ NEVER embed query results as static JS variables. The dashboard iframe provides
|
|
|
91
102
|
|
|
92
103
|
| Command | Description |
|
|
93
104
|
|---------|-------------|
|
|
94
|
-
| `graphit kb list <type>` | List metrics, dimensions, tables, rules, domains, synonyms |
|
|
105
|
+
| `graphit kb list <type>` | List metrics, dimensions, tables, rules, domains, synonyms, templates |
|
|
95
106
|
| `graphit kb get <type> <name>` | Full entity details by name |
|
|
96
107
|
| `graphit kb search <query>` | Search across all KB types |
|
|
97
108
|
| `graphit kb explore metric <name>` | Metric -> tables -> dimensions graph |
|
|
109
|
+
| `graphit kb create template --name X --file template.html --description "..."` | Save a reusable chart template (--file or --render-code) |
|
|
110
|
+
| `graphit kb update template <name> --file template.html --description "..."` | Update a template (--file or --render-code) |
|
|
111
|
+
| `graphit kb delete template <name> --yes` | Delete a template |
|
|
98
112
|
| `graphit ds list` | List cached data sources (use these for fast queries) |
|
|
99
113
|
| `graphit query "<sql>" --ds <id>` | Query cached data source (~100ms) |
|
|
100
114
|
| `graphit query "<sql>" --warehouse --connection <id>` | Query live Snowflake (~10s) |
|
|
@@ -178,7 +192,7 @@ The iframe also provides optional convenience helpers if you want quick standard
|
|
|
178
192
|
|
|
179
193
|
These are shortcuts, not requirements. Use them when a standard chart is all you need. Hand-roll when you want full control over the visualization.
|
|
180
194
|
|
|
181
|
-
`graphit.chart` types: `"bar"`, `"line"`, `"area"`, `"donut"` (alias `"pie"`), `"scatter"` (alias `"bubble"`), `"stacked-bar"` (alias `"stacked"`), `"heatmap"`, `"funnel"`, `"gauge"`, `"sparkline"`. Config: `x` (category field), `y` (value field), `series` (group-by field), `title`, `height` (140-900px), `valueFormat` (`"currency"` | `"percent"` | `"number"`), `colors` (array). Scatter adds: `size` (bubble radius field), `label` (tooltip field). Gauge adds: `min`, `max`, `format`. Sparkline adds: `width`, `showValue`.
|
|
195
|
+
`graphit.chart` types: `"bar"`, `"horizontal-bar"` (alias `"hbar"` - use when category labels are long), `"line"`, `"area"`, `"donut"` (alias `"pie"`), `"scatter"` (alias `"bubble"`), `"stacked-bar"` (alias `"stacked"`), `"heatmap"`, `"funnel"`, `"gauge"`, `"sparkline"`. Config: `x` (category field), `y` (value field), `series` (group-by field), `title`, `height` (140-900px), `valueFormat` (`"currency"` | `"percent"` | `"number"`), `colors` (array). Scatter adds: `size` (bubble radius field), `label` (tooltip field). Gauge adds: `min`, `max`, `format`. Sparkline adds: `width`, `showValue`.
|
|
182
196
|
|
|
183
197
|
`graphit.kpi` config: `value`, `label`, `format` (`"currency"` | `"percent"` | `"number"`), `compareValue`, `compareLabel`.
|
|
184
198
|
|
|
@@ -27,6 +27,9 @@ Config: requires `series` field for stacking groups.
|
|
|
27
27
|
CSS grid. X = columns, Y = rows. Background intensity scales linearly (rgba teal, 0.08-0.98). Text flips white at >55% intensity. Headers auto-generated. Capped at 40x40.
|
|
28
28
|
Config: `x` (column), `y` (row), `value` (intensity, falls back to `y`).
|
|
29
29
|
|
|
30
|
+
### horizontal-bar / hbar
|
|
31
|
+
CSS horizontal bars for long category labels that overlap on vertical bar x-axis. Labels on the left, proportional bars in the middle, formatted values on the right. Each bar colored from the palette. Use instead of `bar` when categories have names longer than ~10 characters.
|
|
32
|
+
|
|
30
33
|
### funnel
|
|
31
34
|
CSS horizontal bars narrowing top-to-bottom. First bar = 100% width, rest proportional. Shows step-over-step conversion rate. Colors cycle through palette.
|
|
32
35
|
|
|
@@ -38,6 +41,14 @@ Config: `value`, `min` (default 0), `max` (default 100), `format`, `label`, `col
|
|
|
38
41
|
Inline SVG polyline for KPI cards or table cells. No axes, no grid - just trend shape. Single data point renders as a dot.
|
|
39
42
|
Config: `y`, `width` (default 120), `height` (default 32), `label`, `showValue` (default true), `valueFormat`.
|
|
40
43
|
|
|
44
|
+
## Saved templates
|
|
45
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
**Usage:** `graphit.TEMPLATE_NAME(el, {data, value: 'revenue', label: 'Revenue'})` or via `graphit.chart(el, {type: 'TEMPLATE_NAME', ...})`.
|
|
49
|
+
|
|
50
|
+
Templates are org-specific - they exist only when users have saved them. The agent's context provider lists available templates each turn. Use `list_templates()` to discover them and `get_template(name)` to read the render code.
|
|
51
|
+
|
|
41
52
|
## Color tokens
|
|
42
53
|
|
|
43
54
|
| Token | Usage |
|