basalt-ui 1.0.0 → 1.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/AGENTS.md +11 -11
- package/CHANGELOG.md +12 -0
- package/README.md +31 -44
- package/agent/skills/basalt-app/SKILL.md +137 -0
- package/agent/skills/basalt-charts/SKILL.md +179 -0
- package/agent/skills/basalt-design/SKILL.md +249 -0
- package/agent/templates/CLAUDE-block.md.tpl +8 -5
- package/configs/check.yml +8 -8
- package/configs/lefthook.yml +9 -5
- package/dist/cli/index.d.ts +46 -27
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +98 -116
- package/dist/surfaces.d.ts +11 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +6 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +3 -0
- package/llms.txt +2 -2
- package/package.json +2 -2
- package/src/cli/check-theme.test.ts +12 -2
- package/src/cli/help.test.ts +93 -0
- package/src/cli/index.ts +207 -169
- package/src/cli/placement-engine.test.ts +194 -0
- package/src/cli/tarball-parity.test.ts +44 -0
- package/src/cli/template-format.test.ts +64 -0
- package/src/surfaces.ts +20 -1
- package/src/tokens/index.ts +6 -0
- /package/bin/{basalt.mjs → basalt-ui.mjs} +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: basalt-design
|
|
3
|
+
description: Design and restyle data visualizations and analytics UIs in a basalt-ui app (Mantine v9 + visx). The dataviz successor — restraint doctrine plus the live theme-lab tuning loop and the centralized, lint-enforced --vx-* token system. Use when building or restyling charts/dashboards, choosing a palette, tuning dark/light, or when charts look childish / inconsistent / over-colored.
|
|
4
|
+
when_to_use: User is building or restyling charts, dashboards, or metric UIs in a basalt-ui consumer; picking or tuning a palette; deciding on dark/light shades; or complaining that charts look "AI default", inconsistent across tabs, or over-saturated. Also the entry point for any "make this look professional" dataviz request in a Mantine + visx app.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
`/basalt-design` is the design authority for a basalt-ui app. It is the **method**; the project's
|
|
8
|
+
doctrine is the **law**. Professional dataviz is restraint, not decoration — this skill encodes
|
|
9
|
+
that restraint and the concrete, lint-enforced way basalt-ui makes it impossible to bypass.
|
|
10
|
+
|
|
11
|
+
## Read the law first (strict precedence)
|
|
12
|
+
|
|
13
|
+
Before applying any generic guidance, load the doctrine in this exact order and obey the highest
|
|
14
|
+
one that exists. Lower layers fill gaps; they never override a higher layer.
|
|
15
|
+
|
|
16
|
+
1. **Consumer `DESIGN.md`** (repo root) — the thin, app-specific instantiation. Identity
|
|
17
|
+
confirmation, the series dictionary, app deviations. **This wins on every conflict.** It is the
|
|
18
|
+
Google-spec convention (YAML token front matter + Markdown prose, sibling to `CLAUDE.md`).
|
|
19
|
+
2. **Shipped `basalt-*` rules** (`.claude/rules/basalt-{tokens,charts,mantine,state}.md`) — the
|
|
20
|
+
universal law AND its enforcement: the Basalt modern-zinc palette + saturated sky accent,
|
|
21
|
+
one-hue-per-metric, neutral structure, gradient defaults, the three-tier token contract, the
|
|
22
|
+
shadow-card elevation/density doctrine.
|
|
23
|
+
3. **This skill** — only the loop and the judgment, where the above are silent.
|
|
24
|
+
|
|
25
|
+
If a consumer `DESIGN.md` does not exist yet, the app has not been scaffolded — run `/basalt-app`
|
|
26
|
+
(it wraps `basalt-ui init`, which writes the thin `DESIGN.md` and the `basalt-*` rules). Do not invent
|
|
27
|
+
a palette ad hoc.
|
|
28
|
+
|
|
29
|
+
## Restraint doctrine (decide before touching code)
|
|
30
|
+
|
|
31
|
+
This is the same restraint `frontend-design` calls for, applied to data: intentionality over
|
|
32
|
+
intensity. The `basalt-ui init` CLAUDE block sets a restraint override for exactly this reason — in a
|
|
33
|
+
dashboard the bold move is calm.
|
|
34
|
+
|
|
35
|
+
- **One muted hue family, reused everywhere.** The Basalt modern-zinc identity (below), never raw
|
|
36
|
+
Material / AntD / Tailwind primaries (they read childish and clash). A small harmonious subset
|
|
37
|
+
across every page so tabs feel like one app.
|
|
38
|
+
- **Single hue per metric.** Each metric owns ONE color, stable across all views (HRV always
|
|
39
|
+
violet, bench always amber). Series colors are app-side and distinct from the UI accent — don't
|
|
40
|
+
reuse the sky accent as a metric hue. Multiple colors only for genuinely categorical data
|
|
41
|
+
(sleep stages, source breakdown). A line chart almost never needs more than one hue plus neutrals.
|
|
42
|
+
- **Neutral structure, colored signal.** Lines/axes/grids in muted neutrals; color is the data and
|
|
43
|
+
status (good/warn/bad). A single neutral line with a soft tinted area reads more premium than a
|
|
44
|
+
rainbow.
|
|
45
|
+
- **Gradients on areas, not everything.** A soft single-hue vertical gradient under a line is the
|
|
46
|
+
canonical "modern" move (`AreaGradient`). Keep stacked-area bands opaque — transparency leaks
|
|
47
|
+
lower bands.
|
|
48
|
+
- **Quiet chrome.** Hairline grids (~6–8% neutral), thin crosshairs, restrained tooltips with a
|
|
49
|
+
card surface and one accent swatch per row. Generous whitespace.
|
|
50
|
+
- **Motion restraint (same doctrine, applied to animation).** Subtle and purposeful, never
|
|
51
|
+
decorative — a state change earns a transition, idle chrome does not. Reach for the shared
|
|
52
|
+
`MOTION_DURATION` / `MOTION_SPRING` tokens (`basalt-ui`'s `src/motion`) instead of inventing
|
|
53
|
+
per-component durations/easings, so animated chrome feels like one identity the same way the
|
|
54
|
+
`--vx-*` palette does for color. Never a looping/pulsing idle animation. Always respect
|
|
55
|
+
`useReducedMotion` (`@mantine/hooks`) — an animated component needs a real unanimated code path,
|
|
56
|
+
not just `duration: 0`.
|
|
57
|
+
|
|
58
|
+
## Color identity & accent restraint (the #1 lever)
|
|
59
|
+
|
|
60
|
+
The Basalt identity is **modern zinc + a saturated sky accent** — cool-neutral zinc surfaces
|
|
61
|
+
(Tailwind zinc family) on both schemes, a slightly darker page with panels lifting off it via depth
|
|
62
|
+
(a whisper shadow + 1px ring, `shadow-card` — never a bare border), and one saturated sky-blue
|
|
63
|
+
accent. Restraint is now about _placement_, not _saturation_ — the accent is louder than the old
|
|
64
|
+
muted-slate identity, so the discipline below (where it appears / where it never appears) carries
|
|
65
|
+
more of the weight.
|
|
66
|
+
|
|
67
|
+
**Neutrals carry the surface — cool zinc on both schemes**, never warm-neutral/off-white, never
|
|
68
|
+
steel-blue, never pure black/white:
|
|
69
|
+
|
|
70
|
+
- **Dark:** bg `color-mix(in srgb, #27272a 70%, #18181b)` (#232326), panel `#27272a`, panel-hover
|
|
71
|
+
`color-mix(in srgb, #3f3f46 50%, #27272a)` (#333338), hairline (card ring)
|
|
72
|
+
`color-mix(in srgb, #52525c 50%, #3f3f46)` (#494951), line (strong border) `#3f3f46`. Ink
|
|
73
|
+
`#e5e5e5`, muted `#d4d4d4`, faint `#a1a1a1`.
|
|
74
|
+
- **Light:** bg `color-mix(in srgb, #f4f4f5 50%, #e4e4e7)` (#ececee), panel `#f4f4f5`, panel-hover
|
|
75
|
+
`#fafafa`, hairline `#e5e5e5`, line (strong border) `color-mix(in srgb, #e4e4e7 50%, #d4d4d8)`
|
|
76
|
+
(#dcdce0). Ink `#262626`, muted `#525252`, faint `#737373`.
|
|
77
|
+
|
|
78
|
+
The surface token set is `bg` (page) · `panel` (cards, controls) · `panel-hover` · `line` (strong
|
|
79
|
+
border) · `hairline` (card ring, lives inside `shadow-card`, never rendered as a bare `border`) ·
|
|
80
|
+
`divider` (layout separators).
|
|
81
|
+
|
|
82
|
+
**One accent, saturated sky-blue — split by ROLE.** As **ink** (links, active-nav icon, chart lines,
|
|
83
|
+
focus ring) it is read against the page, so it inverts: `#0077bd` light / `#8ec5ff` dark. As a
|
|
84
|
+
**filled surface** it carries a label, so it is squeezed between that label (≥4.5:1) and the page
|
|
85
|
+
behind it (≥3:1) — which leaves one luminance band, the same on both pages: `#0077bd` with a WHITE
|
|
86
|
+
label, in BOTH schemes. Fill with `--vx-accentFill` / `--vx-fill-{family}`, never with `--vx-accent`
|
|
87
|
+
(a light fill cannot carry white text). Every Mantine family's fill sits in that same band, so a
|
|
88
|
+
filled surface always reads white. With `accent-hover` (derived from the fill) and `on-accent`
|
|
89
|
+
companions (NOT the old ~50%-saturation muted slate).
|
|
90
|
+
|
|
91
|
+
The accent appears on: the primary data series, active-nav **icons** and active **child** labels,
|
|
92
|
+
links, primary buttons, focus rings, and the leader bar in meters. It stays off: general chrome,
|
|
93
|
+
borders, large fills, every icon, secondary buttons. "Ink earns its color" — neutral does the
|
|
94
|
+
structure, the accent only points.
|
|
95
|
+
|
|
96
|
+
- **Active nav = panel bg + `shadow-card` + accent-colored icon + weight-600 ink text**, never a
|
|
97
|
+
full accent fill. The theme bakes this into `NavLink` for every render path — don't re-color it.
|
|
98
|
+
- **Buttons:** exactly one filled-accent primary CTA per view; every other action is
|
|
99
|
+
`variant="default"` (neutral). Avoid colored `variant="light"` for routine actions.
|
|
100
|
+
- **Status:** positive deltas `color="green"` (forest), never `teal`/turquoise/saturated emerald.
|
|
101
|
+
- **Dark done right:** cool zinc, neutral/faint-cool, never steel-blue, never pure black; the
|
|
102
|
+
dark-scheme accent (`#8ec5ff`) is lighter/less saturated than its light counterpart so it doesn't
|
|
103
|
+
glow/bleed.
|
|
104
|
+
- **Light done right:** cool zinc page + panel lift (never warm/off-white); depth comes from
|
|
105
|
+
`shadow-card`, not a bare hairline border.
|
|
106
|
+
|
|
107
|
+
### Density & surface consistency
|
|
108
|
+
|
|
109
|
+
- **Dense by default** (Linear/Notion): compact nav rows, `sm` (12px) gaps and card padding, a
|
|
110
|
+
48px shell header. Separate by surface + `shadow-card`, not by large air — default to the
|
|
111
|
+
tighter step.
|
|
112
|
+
- **All cards render identically:** Mantine `Card`/`Paper` **and** the Mantine-free `ChartCard`
|
|
113
|
+
resolve to **one radius token** (`--vx-radius-card` = 7px) and **`shadow-card`** — a whisper
|
|
114
|
+
shadow with the 1px ring baked into the shadow itself, **no `border` property**. Never
|
|
115
|
+
inline-override a surface's `border`/`borderRadius`/`boxShadow`/`backgroundColor` — use the
|
|
116
|
+
radius token + `VX.surface.*` / the shadow-card token. Mechanically enforced by
|
|
117
|
+
`basalt-ui check-theme`'s `raw-surface` guard.
|
|
118
|
+
- **Strict surfaces & primitives.** The theme runs a strict surface system: Mantine components read
|
|
119
|
+
raw ramp steps directly, so `cssVariablesResolver` **collapses the ramp steps onto the
|
|
120
|
+
`--vx-surface-*` tokens** — one `shadow-card` treatment, one card bg, one radius across every
|
|
121
|
+
component (AppShell, Table, Input, Divider, Tabs, Popover, Accordion, cards). Consumer code must
|
|
122
|
+
**use Mantine layout primitives** (`Box`/`Flex`/`Grid`/`SimpleGrid`/`Stack`/`Group`/`Paper`/`Card`),
|
|
123
|
+
not raw `<div>`/`<span>` with inline `style`. `check-theme` adds four guard kinds to enforce this
|
|
124
|
+
(default ON, `theme-allow` escape): `off-system-surface-var` (raw ramp-step vars),
|
|
125
|
+
`raw-html-layout`, `inline-spacing`, `inline-display`. Only the Mantine-free `src/charts/**` may
|
|
126
|
+
use raw `<div>` (still with `VX.*` tokens).
|
|
127
|
+
|
|
128
|
+
**Anti-slop checklist:** no pure `#000`/`#fff`; one accent locked page-wide; neutral does the
|
|
129
|
+
structure, accent only points; don't flood blue; hierarchy via scale/weight/contrast/space, not
|
|
130
|
+
color; depth = `shadow-card` (whisper shadow + ring), never a bare hairline border on cards.
|
|
131
|
+
|
|
132
|
+
## The three-tier token system (centralize + enforce)
|
|
133
|
+
|
|
134
|
+
Aesthetics only survive if they cannot be bypassed. basalt-ui ships this as the `./tokens` and
|
|
135
|
+
`./charts` surfaces:
|
|
136
|
+
|
|
137
|
+
1. **Palette data** — the Basalt modern-zinc ramps + the saturated sky accent family, plus
|
|
138
|
+
every semantic/status/neutral/surface entry as a per-theme `{ light, dark }` pair. Pure data: no
|
|
139
|
+
React, no `@mantine/*`, no browser API.
|
|
140
|
+
2. **CSS variables** — `buildPaletteCss(opts)` emits the pairs as `--vx-*` custom properties under
|
|
141
|
+
the light/dark color-scheme selector. Theme resolution is **pure CSS** — no JS branching, works
|
|
142
|
+
in non-component files.
|
|
143
|
+
3. **Token refs** — `VX.*` are just `var(--vx-*)` strings (colors) plus non-color sizing constants.
|
|
144
|
+
Opacity via `alpha(token, a)` (= `color-mix`), **never** `rgba()` — the hue must keep resolving
|
|
145
|
+
per scheme.
|
|
146
|
+
|
|
147
|
+
Hard rules (the guard enforces these, not just prose):
|
|
148
|
+
|
|
149
|
+
- **Never a raw hex / `rgb()` / `hsl()` in chart or app source.** Route every color through
|
|
150
|
+
`VX.*` / the palette. `basalt-ui check-theme` fails the build on a literal; a `theme-allow` comment
|
|
151
|
+
is the only deliberate exception.
|
|
152
|
+
- **Never `localStorage.getItem('theme')`.** The scheme resolves via Mantine's color scheme + the
|
|
153
|
+
`--vx-*` vars. The guard bans this read.
|
|
154
|
+
- New colors go into the palette as `{ light, dark }` pairs — never inline, never two
|
|
155
|
+
`fooLight`/`fooDark` keys.
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
import { VX, alpha } from 'basalt-ui/tokens'
|
|
159
|
+
import { SERIES } from '../lib/series' // consumer-owned — see /basalt-charts
|
|
160
|
+
|
|
161
|
+
const stroke = SERIES.hrv // app-side series ref (consumer-defined — see /basalt-charts)
|
|
162
|
+
const fill = alpha(SERIES.hrv, 0.12) // theme-aware soft area, NOT rgba()
|
|
163
|
+
const grid = VX.grid // framework neutral
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Drive the theme-lab loop (tune by eye, then bake)
|
|
167
|
+
|
|
168
|
+
Static HTML POCs do not translate 1:1 to visx/Mantine. Tune in the **real app** with the shipped
|
|
169
|
+
theme lab (`basalt-ui/theme-lab`), then bake the values into the palette. The lab writes overrides
|
|
170
|
+
as inline `--vx-*` styles on `<html>`, which beat the stylesheet's per-scheme rules — so everything
|
|
171
|
+
restyles **instantly with no React re-render**.
|
|
172
|
+
|
|
173
|
+
Wire it (DEV-only) inside a dev dock popover:
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { ThemeLabControls, applyOverrides, loadOverrides } from 'basalt-ui/theme-lab'
|
|
177
|
+
|
|
178
|
+
// At boot — re-apply a persisted tuning session (the control body does NOT do the initial apply):
|
|
179
|
+
applyOverrides(loadOverrides())
|
|
180
|
+
|
|
181
|
+
// In the dev dock — pass the consumer's own series groups so they're tunable too:
|
|
182
|
+
<ThemeLabControls
|
|
183
|
+
groups={[
|
|
184
|
+
...COLOR_GROUPS, // framework: Semantic / Status / Neutral / Surface
|
|
185
|
+
{ title: 'Health', items: [{ var: '--vx-hrv', label: 'HRV' }, /* ... */] },
|
|
186
|
+
]}
|
|
187
|
+
onCopy={(json) => notifications.show({ message: 'Overrides copied' })}
|
|
188
|
+
copyIcon={<IconCopy size={16} />} // framework ships no icon/notification dep
|
|
189
|
+
resetIcon={<IconRefresh size={16} />}
|
|
190
|
+
/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The loop:
|
|
194
|
+
|
|
195
|
+
1. Open the lab, adjust `--vx-*` colors and the area-gradient strength (`--vx-area-top` /
|
|
196
|
+
`--vx-area-bottom`) by eye, in both schemes.
|
|
197
|
+
2. Toggle the Mantine color scheme and re-check: saturated mid-tones **glow/bleed on dark** — step
|
|
198
|
+
one shade lighter and slightly desaturated; on light go one shade deeper for contrast. Same hue,
|
|
199
|
+
different shade — **never the same hex in both**.
|
|
200
|
+
3. **Copy JSON** → hand the values back into the palette data as `{ light, dark }` pairs.
|
|
201
|
+
4. Remove the override (or "Reset to palette defaults") and confirm the baked palette matches.
|
|
202
|
+
|
|
203
|
+
The lab is a tuning sandbox, not a prod theme editor: inline overrides apply to whatever scheme is
|
|
204
|
+
on screen and win over both light and dark rules. It is the closing step of design, not a shipped
|
|
205
|
+
feature.
|
|
206
|
+
|
|
207
|
+
## Primitives + kind discipline (don't loosen, extend)
|
|
208
|
+
|
|
209
|
+
Every chart composes the shipped primitives — never hand-rolled equivalents:
|
|
210
|
+
|
|
211
|
+
- **`ChartCard`** wrapper (title + info-tooltip + extra slot, consistent margin).
|
|
212
|
+
- **`ChartLegend`** (`line | bar | split | splitLine` shapes) — never hand-rolled legend markup.
|
|
213
|
+
- **`ChartTooltip`** + `TooltipHeader` / `TooltipRow` / `TooltipBody` — never import `@visx/tooltip`
|
|
214
|
+
directly (oxlint bans it in chart files).
|
|
215
|
+
- **`AxisBottomDate`** / **`AxisLeftNumeric`** / **`AxisRightNumeric`** — never raw
|
|
216
|
+
`<AxisLeft>`/`<AxisBottom>` (they miss theme tokens + smart ticks). Now lint-enforced:
|
|
217
|
+
`basalt-ui check-theme`'s `raw-visx-axis` guard fails the build on a raw axis inside a `/charts/`
|
|
218
|
+
file (escape via `theme-allow`).
|
|
219
|
+
- **`HoverOverlay`** + `HoverContext` + `useChartTooltip` for hover/crosshair. Wrap a group of
|
|
220
|
+
date-aligned charts in **`ChartHoverSync`** to cast a ghost crosshair across all siblings on hover
|
|
221
|
+
(without it, `useHoverSync` runs per-chart only and warns in dev).
|
|
222
|
+
- **`AreaGradient`** / `areaFillUrl` for the soft single-hue fill.
|
|
223
|
+
|
|
224
|
+
Shipped kinds beyond `ZonedLine` / `Bars` / `StackedArea` / `Donut`: **`MultiLine`** (N series on a
|
|
225
|
+
shared y-axis, legend-hover dimming, dashed MA companions, per-point markers, zones/refLines, fixed
|
|
226
|
+
or auto domain — also z-score/σ via a symmetric domain + zero refLine), **`DualPanel`** (line pane
|
|
227
|
+
|
|
228
|
+
- signed-histogram pane on one x-scale and cursor, optional fill-between), **`Heatmap`**
|
|
229
|
+
(category×category intensity grid with per-cell tooltip + optional gradient legend strip).
|
|
230
|
+
|
|
231
|
+
> If the new chart does not fit the primitives, **add a kind — don't loosen the primitives.**
|
|
232
|
+
> Recurring shape → extract a kind via the Rule of Three. Genuinely unique → stay bespoke,
|
|
233
|
+
> composing primitives directly. New color → a `{ light, dark }` pair in the palette, wired through
|
|
234
|
+
> `--vx-*`, exposed as a `VX.*` ref — never an inline hex. The mechanics of all three live in
|
|
235
|
+
> **`/basalt-charts`** — defer to it for the "how".
|
|
236
|
+
|
|
237
|
+
The Mantine-free boundary holds here too: `./charts` and `./tokens` import zero `@mantine/*`, and
|
|
238
|
+
`@visx/*` is only allowed under chart files. Both are oxlint-enforced in the shipped consumer
|
|
239
|
+
preset.
|
|
240
|
+
|
|
241
|
+
## Checklist before declaring a chart "done"
|
|
242
|
+
|
|
243
|
+
- Every color comes from a token (`VX.*` / palette) — `basalt-ui check-theme` green, zero raw hex.
|
|
244
|
+
- One hue per metric; categorical multi-color only where the data is genuinely categorical.
|
|
245
|
+
- Neutral line/axis/grid; soft `AreaGradient` on plain metric lines, opaque stacked-area bands.
|
|
246
|
+
- Tooltip = `ChartCard` / `ChartTooltip` primitives, one swatch per row — no hand-rolled markup.
|
|
247
|
+
- Looks right in BOTH schemes (toggled and checked: glow on dark, contrast on light).
|
|
248
|
+
- New colors landed as `{ light, dark }` pairs in the palette, not inline.
|
|
249
|
+
- Nothing reads `localStorage.getItem('theme')`.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<!-- basalt:begin {{BASALT_VERSION}} -->
|
|
2
|
+
|
|
2
3
|
## basalt-ui (managed — do not hand-edit)
|
|
3
4
|
|
|
4
|
-
Scaffolded by `bunx basalt init` and refreshed by `bunx basalt sync` (run it after a basalt-ui
|
|
5
|
-
upgrade; `basalt sync --check` gates drift in CI). This block is framework-owned — edit `DESIGN.md`
|
|
5
|
+
Scaffolded by `bunx basalt-ui init` and refreshed by `bunx basalt-ui sync` (run it after a basalt-ui
|
|
6
|
+
upgrade; `basalt-ui sync --check` gates drift in CI). This block is framework-owned — edit `DESIGN.md`
|
|
6
7
|
or the `basalt-*` rules instead; manual changes here are overwritten on the next sync.
|
|
7
8
|
|
|
8
9
|
**Stack:** React 19 + Mantine v9, themed by `basalt-ui` (`BasaltProvider` + `createBasaltTheme`).
|
|
@@ -11,17 +12,18 @@ never a raw hex/`rgb()`/`hsl()`. Charts are visx via `basalt-ui/charts` (compose
|
|
|
11
12
|
`ChartCard`, `ChartLegend`, the `ChartTooltip` family, `AxisLeftNumeric`/`AxisBottomDate`); add a
|
|
12
13
|
kind on the third repeat, don't loosen the primitives. `basalt-ui/charts` and `basalt-ui/tokens`
|
|
13
14
|
are Mantine-free — never import `@mantine/*` under `**/charts/**`, never import `@visx/*` outside
|
|
14
|
-
charts. Toolchain is oxlint + oxfmt (no ESLint/Biome/Prettier) and `basalt check-theme` guards the
|
|
15
|
+
charts. Toolchain is oxlint + oxfmt (no ESLint/Biome/Prettier) and `basalt-ui check-theme` guards the
|
|
15
16
|
palette. Runtime is Bun.
|
|
16
17
|
|
|
17
18
|
**Before guessing an import, check the installed package's machine docs**:
|
|
18
19
|
`node_modules/basalt-ui/llms.txt` (per-subpath import map), `node_modules/basalt-ui/AGENTS.md`, or
|
|
19
|
-
run `bunx basalt info --json`.
|
|
20
|
+
run `bunx basalt-ui info --json`.
|
|
20
21
|
|
|
21
22
|
**DESIGN.md is law.** `./DESIGN.md` (imported below) records this app's palette identity and series
|
|
22
23
|
dictionary. Precedence: **DESIGN.md > `basalt-*` rules > skills.** When building or restyling any
|
|
23
24
|
UI, that law wins over habit, over library defaults, and over a skill's instinct. The design/charts
|
|
24
|
-
workflows are
|
|
25
|
+
workflows are the managed skills in `.claude/skills/` (`/basalt-design`, `/basalt-charts`) — they
|
|
26
|
+
defer to DESIGN.md.
|
|
25
27
|
|
|
26
28
|
@./DESIGN.md
|
|
27
29
|
|
|
@@ -32,4 +34,5 @@ three-font system (Nunito Sans body, Hubot Sans condensed headings, JetBrains Mo
|
|
|
32
34
|
numeral/micro-label), depth via `shadow-card` (a whisper shadow + 1px ring, never a decorative drop
|
|
33
35
|
shadow), neutral zinc-by-default with the single saturated accent spent only when earned (trend /
|
|
34
36
|
signal / categorical separation). Restraint **is** the identity.
|
|
37
|
+
|
|
35
38
|
<!-- basalt:end -->
|
package/configs/check.yml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# basalt-ui consumer CI
|
|
2
|
-
#
|
|
3
|
-
# lint + theme guard ->
|
|
4
|
-
# `basalt check-theme` is the palette guard shipped by basalt-ui (fails on raw
|
|
1
|
+
# basalt-ui consumer CI seed — placed at .github/workflows/check.yml by `basalt-ui init`,
|
|
2
|
+
# then owned by the consumer (sync never touches it again). Mirrors the basalt-ui gate
|
|
3
|
+
# order: frozen install -> lint + theme guard -> doctrine drift gate -> format check.
|
|
4
|
+
# `basalt-ui check-theme` is the palette guard shipped by basalt-ui (fails on raw
|
|
5
5
|
# color literals / off-identity accents that bypass the --vx-* token system).
|
|
6
|
-
# `basalt sync --check` fails when the basalt-managed files (rules,
|
|
7
|
-
#
|
|
6
|
+
# `basalt-ui sync --check` fails when the basalt-managed files (rules, skills, the
|
|
7
|
+
# CLAUDE block) have drifted from the installed basalt-ui version.
|
|
8
8
|
name: check
|
|
9
9
|
on:
|
|
10
10
|
pull_request:
|
|
@@ -21,8 +21,8 @@ jobs:
|
|
|
21
21
|
bun-version: latest
|
|
22
22
|
- run: bun install --frozen-lockfile
|
|
23
23
|
- run: bunx oxlint .
|
|
24
|
-
- run: bunx basalt check-theme
|
|
25
|
-
- run: bunx basalt sync --check
|
|
24
|
+
- run: bunx basalt-ui check-theme
|
|
25
|
+
- run: bunx basalt-ui sync --check
|
|
26
26
|
- run: bunx oxfmt 'src/**' '!**/dist/**' --check
|
|
27
27
|
# Enable once your app defines these package.json scripts:
|
|
28
28
|
# - run: bun run typecheck
|
package/configs/lefthook.yml
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
# basalt-ui consumer lefthook
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
1
|
+
# basalt-ui consumer lefthook preset — an `extends` target, not a copy.
|
|
2
|
+
# `basalt-ui init` seeds a lefthook.yml that references this file:
|
|
3
|
+
# extends:
|
|
4
|
+
# - node_modules/basalt-ui/configs/lefthook.yml
|
|
5
|
+
# lefthook merges these commands with the consumer's own, so this preset auto-updates
|
|
6
|
+
# with the package. Runs oxlint + oxfmt on staged files and the theme guard on the whole
|
|
7
|
+
# tree, pre-commit. Assumes oxlint/oxfmt are installed and your .oxlintrc.json extends
|
|
8
|
+
# ./node_modules/basalt-ui/configs/oxlint.json.
|
|
5
9
|
pre-commit:
|
|
6
10
|
parallel: true
|
|
7
11
|
commands:
|
|
@@ -18,4 +22,4 @@ pre-commit:
|
|
|
18
22
|
# ran are indistinguishable from the kinds that found nothing.
|
|
19
23
|
check-theme:
|
|
20
24
|
glob: '*.{ts,tsx}'
|
|
21
|
-
run: bunx basalt check-theme
|
|
25
|
+
run: bunx basalt-ui check-theme
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RULE_NAMES } from '../surfaces.js';
|
|
1
|
+
import { RULE_NAMES, SKILL_NAMES } from '../surfaces.js';
|
|
2
2
|
/** Shape of the optional `"basalt"` key in a consumer's package.json. */
|
|
3
3
|
export type BasaltConfig = {
|
|
4
|
-
/** Source roots to scan. Default:
|
|
4
|
+
/** Source roots to scan. Default: `['src']`. Set explicitly for a monorepo layout. */
|
|
5
5
|
roots?: string[];
|
|
6
6
|
/** Files exempt from the scan (they ARE the palette source). Default: argo's exempt set. */
|
|
7
7
|
exempt?: string[];
|
|
@@ -96,13 +96,8 @@ export type BasaltConfig = {
|
|
|
96
96
|
* `sub-16-input-font` check.
|
|
97
97
|
*/
|
|
98
98
|
sub16InputFont?: boolean;
|
|
99
|
-
/** Path of the consumer's guard-exempt series file, for DESIGN.md `{{SERIES_MODULE_PATH}}`. Default: `src/
|
|
99
|
+
/** Path of the consumer's guard-exempt series file, for DESIGN.md `{{SERIES_MODULE_PATH}}`. Default: `src/lib/series.ts`. */
|
|
100
100
|
seriesModulePath?: string;
|
|
101
|
-
/** Claude Code marketplace coordinates for the settings stanza `{{MARKETPLACE_OWNER}}/{{MARKETPLACE_REPO}}`. Default: `jkrumm/basalt-ui`. */
|
|
102
|
-
marketplace?: {
|
|
103
|
-
owner?: string;
|
|
104
|
-
repo?: string;
|
|
105
|
-
};
|
|
106
101
|
};
|
|
107
102
|
/**
|
|
108
103
|
* Theme guard — thin FS walker over the headless `../guard` core. Reads BasaltConfig, builds a
|
|
@@ -111,21 +106,36 @@ export type BasaltConfig = {
|
|
|
111
106
|
*/
|
|
112
107
|
export declare function checkTheme(cwd?: string): number;
|
|
113
108
|
/**
|
|
114
|
-
* How a
|
|
109
|
+
* How a file the framework writes into a consumer repo is owned. Two modes, one question:
|
|
110
|
+
* **does Claude read this file?**
|
|
115
111
|
*
|
|
116
|
-
* - `
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
112
|
+
* - `managed` : basalt owns it. sync refreshes it to the shipped version; a local edit is skipped
|
|
113
|
+
* and reported (`--force` overwrites); `--check` exits 1 on drift. Applies to exactly
|
|
114
|
+
* what Claude reads (.claude/rules/*, .claude/skills/*, the CLAUDE.md block) —
|
|
115
|
+
* Claude Code cannot load rules or skills from node_modules, and that platform limit
|
|
116
|
+
* is the only reason anything is copied at all. The sync diff is the review gate.
|
|
117
|
+
* - `seed` : written once if absent, then owned entirely by the consumer. sync never overwrites
|
|
118
|
+
* it and never reports drift (a starting point, not a managed mirror). Everything a
|
|
119
|
+
* machine reads is a seed, and a good seed's content is a REFERENCE (`extends` into
|
|
120
|
+
* node_modules/basalt-ui/configs/*), not a copy, so the toolchain auto-updates with
|
|
121
|
+
* the package while the consumer still owns the file.
|
|
122
|
+
*
|
|
123
|
+
* A managed file with `markers: true` is spliced as a `<!-- basalt:begin -->…<!-- basalt:end -->`
|
|
124
|
+
* region inside a host file the consumer otherwise owns (CLAUDE.md) — not a third mode, just
|
|
125
|
+
* managed ownership scoped to a region.
|
|
121
126
|
*/
|
|
122
|
-
type
|
|
127
|
+
type Mode = 'managed' | 'seed';
|
|
123
128
|
/** A single file the framework writes into a consumer repo. */
|
|
124
129
|
type ManagedFile = {
|
|
125
130
|
/** Path of the produced file, relative to the consumer repo root. Stable manifest key. */
|
|
126
131
|
dest: string;
|
|
127
|
-
/**
|
|
128
|
-
|
|
132
|
+
/** Ownership mode. */
|
|
133
|
+
mode: Mode;
|
|
134
|
+
/**
|
|
135
|
+
* `managed` only: the file is a marker-delimited region spliced into a consumer-owned host file
|
|
136
|
+
* rather than a whole file. `render()` returns the region INCLUDING its begin/end markers.
|
|
137
|
+
*/
|
|
138
|
+
markers?: true;
|
|
129
139
|
/** Path of the shipped source asset, relative to the package root. */
|
|
130
140
|
source: string;
|
|
131
141
|
/**
|
|
@@ -150,8 +160,6 @@ type TemplateVars = {
|
|
|
150
160
|
BASALT_VERSION: string;
|
|
151
161
|
ACCENT_HUE: string;
|
|
152
162
|
SERIES_MODULE_PATH: string;
|
|
153
|
-
MARKETPLACE_OWNER: string;
|
|
154
|
-
MARKETPLACE_REPO: string;
|
|
155
163
|
};
|
|
156
164
|
declare const MANIFEST_PATH = ".basalt/manifest.json";
|
|
157
165
|
/**
|
|
@@ -171,6 +179,8 @@ type PeerFlags = {
|
|
|
171
179
|
declare function managedFiles(peers: PeerFlags): ManagedFile[];
|
|
172
180
|
type Manifest = {
|
|
173
181
|
version: 1;
|
|
182
|
+
/** The basalt-ui version that last wrote this manifest — `doctor`'s one reconciliation axis. */
|
|
183
|
+
basaltVersion?: string;
|
|
174
184
|
/** dest path → sha256 of the managed unit (file bytes, block body, or stanza) at last write. */
|
|
175
185
|
files: Record<string, string>;
|
|
176
186
|
};
|
|
@@ -195,7 +205,7 @@ export declare function sync(opts?: SyncOptions, cwd?: string): number;
|
|
|
195
205
|
* Eight assertions:
|
|
196
206
|
* 1. Every doctrine spec's guardKinds ⊆ keyof GUARD_RULES.
|
|
197
207
|
* 2. Every doctrine rule (deduped) maps to agent/rules/basalt-{rule}.md on disk.
|
|
198
|
-
* 3.
|
|
208
|
+
* 3. Every doctrine skill (deduped) maps to agent/skills/{skill}/SKILL.md on disk.
|
|
199
209
|
* 4. Every non-#, non-'.' JS-subpath SURFACES key has a package.json exports entry.
|
|
200
210
|
* 5. Every real package.json exports key has a SURFACES entry.
|
|
201
211
|
* 6. Every surface with non-empty forbiddenImports has a globs field.
|
|
@@ -206,7 +216,7 @@ export declare function sync(opts?: SyncOptions, cwd?: string): number;
|
|
|
206
216
|
* Synthetic #-keys participate in assertions 1 and 2 but feed assertion 3 only
|
|
207
217
|
* via the deduped skill union (no independent per-#-surface skill row).
|
|
208
218
|
*/
|
|
209
|
-
export declare function checkCoverage(
|
|
219
|
+
export declare function checkCoverage(): number;
|
|
210
220
|
type DoctorResult = {
|
|
211
221
|
/** Number of hard failures (exit non-zero). */
|
|
212
222
|
hardFailures: number;
|
|
@@ -216,15 +226,20 @@ type DoctorResult = {
|
|
|
216
226
|
/**
|
|
217
227
|
* Check a consumer repo's basalt integration and print a pass/warn report.
|
|
218
228
|
*
|
|
229
|
+
* With the plugin retired there is exactly ONE version axis — the npm package — so doctor verifies
|
|
230
|
+
* one thing: the basalt-ui resolved in the consumer's node_modules against the version recorded in
|
|
231
|
+
* .basalt/manifest.json at the last init/sync. File-level drift is `sync --check`'s job, not
|
|
232
|
+
* doctor's.
|
|
233
|
+
*
|
|
219
234
|
* Hard failures (exit non-zero):
|
|
220
235
|
* 1. .basalt/manifest.json exists (init was run).
|
|
221
236
|
*
|
|
222
237
|
* Warnings (non-fatal):
|
|
223
|
-
* 2.
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
238
|
+
* 2. The installed node_modules/basalt-ui version matches the manifest's basaltVersion
|
|
239
|
+
* (a mismatch means the package was upgraded but `sync` never ran — the placed doctrine is
|
|
240
|
+
* stale).
|
|
241
|
+
* 3. The running CLI's own version matches the installed basalt-ui (catches a stale
|
|
242
|
+
* `bunx basalt-ui` npm fetch; best-effort, skipped if node_modules is absent).
|
|
228
243
|
*
|
|
229
244
|
* Returns the exit code: 0 = all good, 1 = one or more hard failures.
|
|
230
245
|
*/
|
|
@@ -265,9 +280,13 @@ export declare function guardHook(cwd?: string): Promise<number>;
|
|
|
265
280
|
* entry is the ONLY caller that translates this to process.exit, so init/sync/checkTheme stay free
|
|
266
281
|
* of process side effects and are safe to import and call from tests.
|
|
267
282
|
*
|
|
283
|
+
* `--help` / `-h` (on ANY subcommand) and the bare `help` command short-circuit BEFORE dispatch —
|
|
284
|
+
* checked first, so a mutating command (`sync`, `init`) never runs just because the caller only
|
|
285
|
+
* asked to read about it.
|
|
286
|
+
*
|
|
268
287
|
* The `guard-hook` subcommand is async (reads stdin); all others are synchronous.
|
|
269
288
|
*/
|
|
270
289
|
export declare function run(argv: string[], cwd?: string): number | Promise<number>;
|
|
271
|
-
export { managedFiles, MANIFEST_PATH, RULE_NAMES };
|
|
290
|
+
export { managedFiles, MANIFEST_PATH, RULE_NAMES, SKILL_NAMES };
|
|
272
291
|
export type { ManagedFile, Manifest, SyncOptions, DoctorResult };
|
|
273
292
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAY,MAAM,aAAa,CAAA;AAG/D,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG;IACzB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,uGAAuG;IACvG,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,6FAA6F;IAC7F,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OA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