basalt-ui 1.0.1 → 1.0.2

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 CHANGED
@@ -41,7 +41,7 @@ theme. Never write `#rrggbb`, `rgb(…)`, or `hsl(…)` in component or style co
41
41
  **Motion discipline**: import animation from `motion/react`, never the raw `framer-motion`
42
42
  package (enforced by oxlint `no-restricted-imports`). Route transition timing through the shared
43
43
  `MOTION_DURATION` / `MOTION_SPRING` / `MOTION_EASE_STANDARD` tokens — never a hardcoded
44
- duration/spring/ease literal in a `transition={{...}}` prop (enforced by `basalt check-theme`).
44
+ duration/spring/ease literal in a `transition={{...}}` prop (enforced by `basalt-ui check-theme`).
45
45
 
46
46
  ## Key commands
47
47
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.0.2](https://github.com/jkrumm/basalt-ui/compare/v1.0.1...v1.0.2) (2026-07-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * make the import boundary unclobberable and stop false drift on sync ([98aba84](https://github.com/jkrumm/basalt-ui/commit/98aba8497eb359cbc86e3bee289d21d3e2dbd099))
7
+
1
8
  ## [1.0.1](https://github.com/jkrumm/basalt-ui/compare/v1.0.0...v1.0.1) (2026-07-17)
2
9
 
3
10
 
@@ -36,7 +36,7 @@ downstream apps too:
36
36
  shapes and optional highlight state.
37
37
  3. **ChartTooltip** + `TooltipHeader` + `TooltipRow` + `TooltipBody` — never `@visx/tooltip` directly.
38
38
  4. **AxisLeftNumeric** / **AxisRightNumeric** + **AxisBottomDate** — never raw `<AxisLeft>`/`<AxisBottom>`/`<AxisRight>`
39
- (they miss theme tokens + smart ticks). Enforced by `basalt check-theme` (`raw-visx-axis` guard
39
+ (they miss theme tokens + smart ticks). Enforced by `basalt-ui check-theme` (`raw-visx-axis` guard
40
40
  fails the build on a raw axis in a `/charts/` file; escape via `theme-allow`), not just convention.
41
41
  5. **HoverOverlay** for mouse capture, **HoverContext** for cross-chart crosshair sync,
42
42
  **useChartTooltip** for tip state, **useHoverSync** for the shared cursor. Wrap a group of
@@ -143,7 +143,7 @@ section divider, not card depth) are both fine.
143
143
  consumer code must compose Mantine layout/surface primitives — `Box`, `Flex`, `Grid`,
144
144
  `SimpleGrid`, `Stack`, `Group`, `Paper`, `Card` — instead of raw `<div>`/`<span>` with inline
145
145
  `style`. Raw HTML with inline layout/surface styling defeats the token system.
146
- - **Mechanical enforcement.** `basalt check-theme` adds five surface guard kinds (each a config knob,
146
+ - **Mechanical enforcement.** `basalt-ui check-theme` adds five surface guard kinds (each a config knob,
147
147
  default ON; `theme-allow` line-comment escape): `off-system-surface-var` (raw ramp-step vars),
148
148
  `card-with-border` (`withBorder` on a `Card`/`Paper`), `raw-html-layout` (raw `<div>`/`<span>` with
149
149
  inline layout/surface styling), `inline-spacing` (inline spacing literals), `inline-display`
@@ -188,7 +188,7 @@ shape doctrine lives here; the spacing/radius/type **tokens** are in basalt-toke
188
188
  separate `border` property). Cards must never diverge: same radius, same shadow. Never
189
189
  inline-override `border`/`borderRadius`/`boxShadow`/`backgroundColor` on a surface — use the
190
190
  radius token (`radius="md"` / `var(--vx-radius-card)`) + `VX.shadowCard` + `VX.surface.*`.
191
- Mechanically enforced by `basalt check-theme`'s `raw-surface` guard. Outer spacing comes from the
191
+ Mechanically enforced by `basalt-ui check-theme`'s `raw-surface` guard. Outer spacing comes from the
192
192
  parent `Stack`/`SimpleGrid` gap, not an intrinsic card margin.
193
193
  - **Depth = `shadow-card`, not a plain hairline** (see `docs/DESIGN-SPEC.md` in the basalt-ui repo,
194
194
  doctrine inversion #1 — this supersedes the old "never a drop shadow" rule). Elevation tiers: 0 flat (no shadow — body,
@@ -318,7 +318,7 @@ precedent as `@visx/*`: an internal implementation detail, not a peer the consum
318
318
  - **Never a hardcoded duration/spring/ease literal in a `transition={{...}}` prop.** Import
319
319
  `MOTION_DURATION` / `MOTION_SPRING` / `MOTION_EASE_STANDARD` from `basalt-ui` instead — the
320
320
  motion analog of routing color through `VX.*`. `MOTION_DURATION` is capped at 0.3s (300ms),
321
- matching the interaction-feedback ceiling above. Mechanically enforced by `basalt check-theme`'s
321
+ matching the interaction-feedback ceiling above. Mechanically enforced by `basalt-ui check-theme`'s
322
322
  `raw-motion-value` guard (default ON; `theme-allow` line-comment escape).
323
323
  - **Always branch on `useReducedMotion`** (`@mantine/hooks`) — render a real unanimated code path
324
324
  (no `motion.*` wrapper at all), not just `transition={{ duration: 0 }}`. See `ThemeToggle`'s
@@ -108,7 +108,7 @@ Install `@tanstack/react-router` as a peer, then import from `basalt-ui/router-t
108
108
  tree (`src/routeTree.gen.ts`) has been generated. In CI and after adding routes, run
109
109
  `tsr generate` (or `bun run typecheck`, which triggers it) before relying on breadcrumb or nav data.
110
110
  - The loader's `context.queryClient` requires `createRootRouteWithContext<{ queryClient: QueryClient }>()`.
111
- Run `basalt init` to scaffold a `query-client.ts` + `__root.tsx` seed that wires the TanStack
111
+ Run `basalt-ui init` to scaffold a `query-client.ts` + `__root.tsx` seed that wires the TanStack
112
112
  Router + Query context correctly — the generated `__root.tsx` uses
113
113
  `createRootRouteWithContext<{ queryClient }>()` and passes the client through `RouterProvider`.
114
114
 
@@ -9,7 +9,7 @@ paths:
9
9
  # Basalt State
10
10
 
11
11
  How to place state in a basalt-ui app. The **theme-scheme rule** below is
12
- guard-enforced (`basalt check-theme` bans `localStorage.getItem('theme')`); the rest is **advisory**.
12
+ guard-enforced (`basalt-ui check-theme` bans `localStorage.getItem('theme')`); the rest is **advisory**.
13
13
 
14
14
  ## State placement
15
15
 
@@ -21,7 +21,7 @@ Pick the right home for each kind of state — don't dump everything into one st
21
21
  might link to.
22
22
  - **Theme / color scheme** → `useMantineColorScheme()` from Mantine — **never** a client store, and
23
23
  **never** `localStorage.getItem('theme')`. The scheme persists to Mantine's own key and resolves the
24
- `--vx-*` tokens via CSS; reading it any other way breaks scheme reactivity and trips `basalt check-theme`.
24
+ `--vx-*` tokens via CSS; reading it any other way breaks scheme reactivity and trips `basalt-ui check-theme`.
25
25
  - **UI preferences that must survive navigation but aren't URL-worthy** (sidebar collapsed, panel
26
26
  layout, draft filters) → `createPersistedState` from `basalt-ui/state` — the framework's own
27
27
  versioned localStorage primitive (see below). `BasaltShell` already persists its own collapse state
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  source: basalt-ui
3
- description: Color, spacing, radius, and type discipline — route every value through the basalt-ui token system. Enforced by `basalt check-theme`.
3
+ description: Color, spacing, radius, and type discipline — route every value through the basalt-ui token system. Enforced by `basalt-ui check-theme`.
4
4
  paths:
5
5
  - 'src/**'
6
6
  - 'apps/**/src/**'
@@ -21,8 +21,8 @@ surface (60/30/10, pushed toward 90/10); the accent only points — primary CTA,
21
21
  status pops — never floods. (Blueprint/Basalt zinc-charcoal are the historical hue-tuning
22
22
  ancestors; `docs/DESIGN-SPEC.md` in the basalt-ui repo supersedes both — see its "Doctrine
23
23
  inversions" section.) This
24
- rule is the operational checklist; it is enforced mechanically by **`basalt check-theme`**
25
- (wire it into `lint`: `oxlint . && basalt check-theme`). A violation fails the build. Escape hatch: a
24
+ rule is the operational checklist; it is enforced mechanically by **`basalt-ui check-theme`**
25
+ (wire it into `lint`: `oxlint . && basalt-ui check-theme`). A violation fails the build. Escape hatch: a
26
26
  `theme-allow` line comment (diff-visible, deliberate).
27
27
 
28
28
  `check-theme` reads its config from your `package.json` `"basalt"` key
@@ -2,7 +2,7 @@
2
2
  * TanStack Router root route — wires QueryClient into the router context so
3
3
  * loader functions and components can call `Route.useRouteContext()`.
4
4
  *
5
- * Scaffold written by `basalt init`. This file is yours — `basalt sync` will not overwrite it.
5
+ * Scaffold written by `basalt-ui init`. This file is yours — `basalt-ui sync` will not overwrite it.
6
6
  */
7
7
  import { Outlet, createRootRouteWithContext } from '@tanstack/react-router'
8
8
  import type { QueryClient } from '@tanstack/react-query'
@@ -2,7 +2,7 @@
2
2
  * Basalt query client — configure once, share via router context.
3
3
  * Extend staleTime / gcTime defaults and add per-query error handling here.
4
4
  *
5
- * Scaffold written by `basalt init`. This file is yours — `basalt sync` will not overwrite it.
5
+ * Scaffold written by `basalt-ui init`. This file is yours — `basalt-ui sync` will not overwrite it.
6
6
  */
7
7
  import { createBasaltQueryClient } from 'basalt-ui/query'
8
8
 
@@ -1,15 +1,17 @@
1
1
  // oxlint-disable import/no-default-export -- oxlint's JS plugin loader requires a default export
2
2
  /**
3
3
  * basalt — the shipped oxlint JS plugin (alpha `jsPlugins`, ESLint-v9-compatible `create(context)`
4
- * API). Three design-guard AST rules steering consumers onto the token/idiom system that
5
- * `src/guard` (the regex-based `check-theme` CLI) cannot see from a raw-text scan alone.
4
+ * API). Design-guard AST rules steering consumers onto the token/idiom system that `src/guard`
5
+ * (the regex-based `check-theme` CLI) cannot see from a raw-text scan alone, plus the
6
+ * `import-boundary` rule enforcing basalt's architecture boundaries (see below).
6
7
  *
7
8
  * Ships inside `configs/` so the shipped preset (`configs/oxlint.json`) can reference it as
8
9
  * `./oxlint-plugin.js` — a consumer `extends`-ing that preset inherits `jsPlugins` too, and the
9
10
  * path resolves relative to the preset file, not the consumer's own config.
10
11
  *
11
- * Every rule supports the same `theme-allow` escape as `src/guard`: skip a reported node if a line
12
- * comment containing `theme-allow` sits on the node's own line or the line immediately above it.
12
+ * The four design-guard rules below support the same `theme-allow` escape as `src/guard`: skip a
13
+ * reported node if a line comment containing `theme-allow` sits on the node's own line or the line
14
+ * immediately above it. `import-boundary` deliberately does NOT — see its own comment for why.
13
15
  *
14
16
  * ── About the shipped `configs/oxlint.json` preset ────────────────────────────────────────────
15
17
  * Consumers extend it from their own `.oxlintrc.json` via the node_modules-relative path:
@@ -17,9 +19,14 @@
17
19
  * specifiers, so the relative `./node_modules` path is required. NOTE: oxlint `extends` is
18
20
  * per-glob last-writer-wins for `no-restricted-imports` — a base ban does NOT merge into an
19
21
  * override glob, so any ban that must also hold inside an override is duplicated into that
20
- * override. `configs/oxlint.json` is generated from `SURFACES` by `scripts/gen-oxlint.ts`
21
- * (`--check` is the CI drift gate) — its top-level keys are limited to what oxlint's own parser
22
- * accepts (see `ALLOWED_TOP_LEVEL_KEYS` in that script); do not add ad hoc keys to that file.
22
+ * override, AND a consumer's own `no-restricted-imports` override on an overlapping glob silently
23
+ * REPLACES basalt's ban rather than merging with it. That is exactly why the `@visx/*`-only-in-
24
+ * charts and Mantine-free charts/tokens boundaries live in the `import-boundary` rule below instead
25
+ * of `no-restricted-imports`: a jsPlugin rule has its own rule id, so a consumer can only turn it
26
+ * off explicitly, by name — never silently. `configs/oxlint.json` is generated from `SURFACES` by
27
+ * `scripts/gen-oxlint.ts` (`--check` is the CI drift gate) — its top-level keys are limited to what
28
+ * oxlint's own parser accepts (see `ALLOWED_TOP_LEVEL_KEYS` in that script); do not add ad hoc keys
29
+ * to that file.
23
30
  */
24
31
 
25
32
  // ── Shared helpers ──────────────────────────────────────────────────────────────────────────────
@@ -256,6 +263,110 @@ const rawScrollContainer = {
256
263
  },
257
264
  }
258
265
 
266
+ // ── Rule 5 — import-boundary ────────────────────────────────────────────────────────────────────
267
+
268
+ // Message bodies mirror the wording that used to live in the shipped `no-restricted-imports`
269
+ // overrides (configs/oxlint.json) verbatim, so the DX doesn't regress.
270
+ const IMPORT_BOUNDARY_MESSAGES = {
271
+ visxOutsideCharts:
272
+ 'Direct @visx/* imports are only allowed inside the charts boundary (**/charts/**). ' +
273
+ '(basalt/import-boundary)',
274
+ visxTooltip:
275
+ 'Use ChartTooltip + TooltipHeader/Row/Body from basalt-ui charts primitives. ' +
276
+ '(basalt/import-boundary)',
277
+ mantineInCharts:
278
+ 'charts must be Mantine-free — no Mantine imports allowed. (basalt/import-boundary)',
279
+ mantineInTokens:
280
+ 'tokens must be Mantine-free — no Mantine imports allowed. (basalt/import-boundary)',
281
+ }
282
+
283
+ /** True when any path segment of `filename` equals `segment` (POSIX or Windows separators). */
284
+ function hasPathSegment(filename, segment) {
285
+ return filename.split(/[\\/]/).includes(segment)
286
+ }
287
+
288
+ /** Import specifier for an ImportDeclaration or a dynamic `import()` call; undefined otherwise. */
289
+ function importSource(node) {
290
+ if (node.type === 'ImportDeclaration') return node.source?.value
291
+ if (node.type === 'ImportExpression' && node.source?.type === 'Literal') {
292
+ return node.source.value
293
+ }
294
+ return undefined
295
+ }
296
+
297
+ /**
298
+ * Import specifier for a source-bearing export (`export { x } from '…'` / `export * from '…'`);
299
+ * undefined for a plain local `export { x }` (no `source`) or any other node shape.
300
+ */
301
+ function exportSource(node) {
302
+ if (node.type === 'ExportNamedDeclaration' || node.type === 'ExportAllDeclaration') {
303
+ return node.source?.value
304
+ }
305
+ return undefined
306
+ }
307
+
308
+ const importBoundary = {
309
+ meta: {
310
+ type: 'suggestion',
311
+ docs: {
312
+ description:
313
+ 'Enforce the @visx/*-only-in-charts and Mantine-free charts/tokens import boundaries.',
314
+ },
315
+ schema: [],
316
+ },
317
+ create(context) {
318
+ const filename = getFilename(context)
319
+ const inCharts = hasPathSegment(filename, 'charts')
320
+ const inTokens = hasPathSegment(filename, 'tokens')
321
+
322
+ // Deliberately NO `hasThemeAllow` escape here (unlike the four design-guard rules above).
323
+ // `theme-allow` exists so the theme/palette source can opt out of DESIGN guidance (raw font
324
+ // sizes, raw colors) — it is not a license to punch through an ARCHITECTURE boundary. The whole
325
+ // point of moving this check into a plugin rule instead of `no-restricted-imports` was that it
326
+ // can only be turned off explicitly, by rule id (see the file-header comment); a stray
327
+ // `theme-allow` comment (which also matches the line above the flagged node) must not silently
328
+ // bypass it. Do not "restore consistency" by adding it back.
329
+ function reportFor(node, source) {
330
+ if (typeof source !== 'string') return
331
+
332
+ if (source === '@visx/tooltip') {
333
+ context.report({ node, message: IMPORT_BOUNDARY_MESSAGES.visxTooltip })
334
+ return
335
+ }
336
+ if (source.startsWith('@visx/')) {
337
+ if (!inCharts) context.report({ node, message: IMPORT_BOUNDARY_MESSAGES.visxOutsideCharts })
338
+ return
339
+ }
340
+ if (
341
+ source === '@mantine/core' ||
342
+ source === '@mantine/hooks' ||
343
+ source.startsWith('@mantine/')
344
+ ) {
345
+ if (inCharts) {
346
+ context.report({ node, message: IMPORT_BOUNDARY_MESSAGES.mantineInCharts })
347
+ } else if (inTokens) {
348
+ context.report({ node, message: IMPORT_BOUNDARY_MESSAGES.mantineInTokens })
349
+ }
350
+ }
351
+ }
352
+
353
+ return {
354
+ ImportDeclaration(node) {
355
+ reportFor(node, importSource(node))
356
+ },
357
+ ImportExpression(node) {
358
+ reportFor(node, importSource(node))
359
+ },
360
+ ExportNamedDeclaration(node) {
361
+ reportFor(node, exportSource(node))
362
+ },
363
+ ExportAllDeclaration(node) {
364
+ reportFor(node, exportSource(node))
365
+ },
366
+ }
367
+ },
368
+ }
369
+
259
370
  // ── Plugin export ───────────────────────────────────────────────────────────────────────────────
260
371
 
261
372
  export default {
@@ -265,5 +376,6 @@ export default {
265
376
  'card-inset': cardInset,
266
377
  'chart-in-raw-surface': chartInRawSurface,
267
378
  'raw-scroll-container': rawScrollContainer,
379
+ 'import-boundary': importBoundary,
268
380
  },
269
381
  }
@@ -8,9 +8,9 @@
8
8
  * and returns the parsed set of `basalt/<rule>` diagnostics it printed.
9
9
  */
10
10
  import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
11
- import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
11
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
12
12
  import { tmpdir } from 'node:os'
13
- import { resolve } from 'node:path'
13
+ import { dirname, resolve } from 'node:path'
14
14
 
15
15
  const PLUGIN_PATH = resolve(import.meta.dirname, 'oxlint-plugin.js')
16
16
  const OXLINT_BIN = resolve(import.meta.dirname, '..', '..', '..', 'node_modules', '.bin', 'oxlint')
@@ -28,6 +28,7 @@ beforeEach(() => {
28
28
  'basalt/no-raw-font-size': 'error',
29
29
  'basalt/card-inset': 'error',
30
30
  'basalt/chart-in-raw-surface': 'error',
31
+ 'basalt/import-boundary': 'error',
31
32
  },
32
33
  }),
33
34
  )
@@ -39,7 +40,9 @@ afterEach(() => {
39
40
 
40
41
  /** Writes `source` as the sole fixture file and runs oxlint against the temp fixture repo. */
41
42
  function run(source: string, filename = 'fixture.tsx'): { code: number; rules: Set<string> } {
42
- writeFileSync(resolve(dir, filename), source)
43
+ const filePath = resolve(dir, filename)
44
+ mkdirSync(dirname(filePath), { recursive: true })
45
+ writeFileSync(filePath, source)
43
46
  const result = Bun.spawnSync([OXLINT_BIN, '-c', '.oxlintrc.json', filename], { cwd: dir })
44
47
  const output = `${result.stdout}${result.stderr}`
45
48
  const rules = new Set(
@@ -105,3 +108,70 @@ describe('basalt/chart-in-raw-surface', () => {
105
108
  expect(rules).not.toContain('chart-in-raw-surface')
106
109
  })
107
110
  })
111
+
112
+ // ── import-boundary ────────────────────────────────────────────────────────────
113
+
114
+ describe('basalt/import-boundary', () => {
115
+ it('flags a @visx/* import outside charts', () => {
116
+ const { code, rules } = run(`import { scaleLinear } from '@visx/scale'\n`, 'lib.ts')
117
+ expect(code).toBe(1)
118
+ expect(rules).toContain('import-boundary')
119
+ })
120
+
121
+ it('does NOT flag a @visx/* import inside charts', () => {
122
+ const { code, rules } = run(`import { scaleLinear } from '@visx/scale'\n`, 'charts/lib.ts')
123
+ expect(code).toBe(0)
124
+ expect(rules).not.toContain('import-boundary')
125
+ })
126
+
127
+ it('flags a @mantine/* import inside charts (Mantine-free)', () => {
128
+ const { code, rules } = run(`import { Button } from '@mantine/core'\n`, 'charts/lib.tsx')
129
+ expect(code).toBe(1)
130
+ expect(rules).toContain('import-boundary')
131
+ })
132
+
133
+ it('does NOT flag a @mantine/* import outside charts/tokens', () => {
134
+ const { code, rules } = run(`import { Button } from '@mantine/core'\n`, 'lib.tsx')
135
+ expect(code).toBe(0)
136
+ expect(rules).not.toContain('import-boundary')
137
+ })
138
+
139
+ it('flags @visx/tooltip even inside charts', () => {
140
+ const { code, rules } = run(`import { Tooltip } from '@visx/tooltip'\n`, 'charts/lib.tsx')
141
+ expect(code).toBe(1)
142
+ expect(rules).toContain('import-boundary')
143
+ })
144
+
145
+ it('flags a @mantine/* import inside tokens (Mantine-free)', () => {
146
+ const { code, rules } = run(`import { Button } from '@mantine/core'\n`, 'tokens/lib.ts')
147
+ expect(code).toBe(1)
148
+ expect(rules).toContain('import-boundary')
149
+ })
150
+
151
+ it('still flags a @visx/* import outside charts carrying a theme-allow comment (no escape hatch)', () => {
152
+ const { code, rules } = run(
153
+ `// theme-allow: legacy\nimport { scaleLinear } from '@visx/scale'\n`,
154
+ 'lib.ts',
155
+ )
156
+ expect(code).toBe(1)
157
+ expect(rules).toContain('import-boundary')
158
+ })
159
+
160
+ it('flags a source-bearing named re-export of @visx/* outside charts', () => {
161
+ const { code, rules } = run(`export { scaleLinear } from '@visx/scale'\n`, 'lib.ts')
162
+ expect(code).toBe(1)
163
+ expect(rules).toContain('import-boundary')
164
+ })
165
+
166
+ it('flags a wildcard re-export of @visx/* outside charts', () => {
167
+ const { code, rules } = run(`export * from '@visx/scale'\n`, 'lib.ts')
168
+ expect(code).toBe(1)
169
+ expect(rules).toContain('import-boundary')
170
+ })
171
+
172
+ it('does NOT flag a plain local named export (no source)', () => {
173
+ const { code, rules } = run(`const x = 1\nexport { x }\n`, 'lib.ts')
174
+ expect(code).toBe(0)
175
+ expect(rules).not.toContain('import-boundary')
176
+ })
177
+ })
@@ -19,7 +19,8 @@
19
19
  "basalt/no-raw-font-size": "error",
20
20
  "basalt/card-inset": "error",
21
21
  "basalt/chart-in-raw-surface": "error",
22
- "basalt/raw-scroll-container": "off"
22
+ "basalt/raw-scroll-container": "off",
23
+ "basalt/import-boundary": "error"
23
24
  },
24
25
  "overrides": [
25
26
  {
@@ -33,80 +34,10 @@
33
34
  "name": "antd",
34
35
  "message": "Use Mantine — antd is not part of the basalt-ui stack."
35
36
  },
36
- {
37
- "name": "@visx/tooltip",
38
- "message": "Use ChartTooltip + TooltipHeader/Row/Body from basalt-ui charts primitives."
39
- },
40
37
  {
41
38
  "name": "framer-motion",
42
39
  "message": "Import from 'motion/react', not the raw framer-motion package."
43
40
  }
44
- ],
45
- "patterns": [
46
- {
47
- "group": ["@visx/*"],
48
- "message": "Direct @visx/* imports are only allowed inside the charts boundary (**/charts/**)."
49
- }
50
- ]
51
- }
52
- ]
53
- }
54
- },
55
- {
56
- "files": ["**/charts/**"],
57
- "rules": {
58
- "no-restricted-imports": [
59
- "error",
60
- {
61
- "paths": [
62
- {
63
- "name": "@mantine/core",
64
- "message": "charts must be Mantine-free — no Mantine imports allowed."
65
- },
66
- {
67
- "name": "@mantine/hooks",
68
- "message": "charts must be Mantine-free — no Mantine imports allowed."
69
- },
70
- {
71
- "name": "@visx/tooltip",
72
- "message": "Use ChartTooltip + TooltipHeader/Row/Body from basalt-ui charts primitives."
73
- }
74
- ],
75
- "patterns": [
76
- {
77
- "group": ["@mantine/*"],
78
- "message": "charts must be Mantine-free — no Mantine imports allowed."
79
- }
80
- ]
81
- }
82
- ]
83
- }
84
- },
85
- {
86
- "files": ["**/tokens/**"],
87
- "rules": {
88
- "no-restricted-imports": [
89
- "error",
90
- {
91
- "paths": [
92
- {
93
- "name": "@mantine/core",
94
- "message": "tokens must be Mantine-free — no Mantine imports allowed."
95
- },
96
- {
97
- "name": "@mantine/hooks",
98
- "message": "tokens must be Mantine-free — no Mantine imports allowed."
99
- }
100
- ],
101
- "patterns": [
102
- {
103
- "group": ["@mantine/*"],
104
- "message": "tokens must be Mantine-free — no Mantine imports allowed."
105
- },
106
- {
107
- "group": ["@visx/*"],
108
- "message": "Direct @visx/* imports are only allowed inside the charts boundary (**/charts/**)."
109
- }
110
41
  ]
111
42
  }
112
43
  ]
@@ -184,6 +184,28 @@ type Manifest = {
184
184
  /** dest path → sha256 of the managed unit (file bytes, block body, or stanza) at last write. */
185
185
  files: Record<string, string>;
186
186
  };
187
+ /**
188
+ * Normalize a managed unit's rendered bytes for the ledger comparison below — makes a delta that is
189
+ * PURELY formatting or a version bump invisible to drift detection, while a real prose/content edit
190
+ * stays fully visible:
191
+ *
192
+ * - Blank out the per-release `BASALT_VERSION` token in a marker's begin line
193
+ * (`<!-- basalt:begin 1.0.1 -->` → `<!-- basalt:begin -->`). It changes on every release and is
194
+ * the only per-release variable that lands INSIDE the hashed region (the rest of
195
+ * `CLAUDE-block.md.tpl` has no other `{{…}}` placeholders today), so stripping it is what lets
196
+ * one normalized rendering stand in for every version of a given template body instead of
197
+ * needing one ledger entry per release. If a future marker template interpolates another
198
+ * per-release var inside its region, extend this normalization the same way.
199
+ * - Trim trailing whitespace per line and collapse every run of blank lines to none. This is the
200
+ * fix for the actual argo repro: lefthook's oxfmt reformats a spliced block (or a whole managed
201
+ * file) AFTER `writeUnit` has already exited and the manifest hash was recorded, so the manifest
202
+ * can never account for the reformat up front — normalizing it away here is the only place that
203
+ * can.
204
+ *
205
+ * Deliberately whitespace-only — word content is untouched, so a genuine hand-edit inside the block
206
+ * still changes the normalized text and still classifies `drifted`.
207
+ */
208
+ declare function normalizeForLedger(text: string): string;
187
209
  /** Scaffold all managed files into the consumer repo, then write the manifest. Idempotent. Returns 0. */
188
210
  export declare function init(cwd?: string, scaffoldFlags?: ScaffoldFlags): number;
189
211
  type SyncOptions = {
@@ -209,7 +231,9 @@ export declare function sync(opts?: SyncOptions, cwd?: string): number;
209
231
  * 4. Every non-#, non-'.' JS-subpath SURFACES key has a package.json exports entry.
210
232
  * 5. Every real package.json exports key has a SURFACES entry.
211
233
  * 6. Every surface with non-empty forbiddenImports has a globs field.
212
- * 7. Every headless surface carries all 3 Mantine bans (Mantine-free boundary).
234
+ * 7. Every headless surface is Mantine-free — via all 3 `forbiddenImports` bans, OR (for
235
+ * `MANTINE_FREE_VIA_IMPORT_BOUNDARY` members) the `basalt/import-boundary` plugin rule actually
236
+ * registered as `'error'` in the shipped config.
213
237
  * 8. Every doctrine optionalPeers entry exists in peerDependencies AND peerDependenciesMeta.
214
238
  *
215
239
  * Tooling surfaces are exempt from assertions 1–3 by the discriminant.
@@ -287,6 +311,6 @@ export declare function guardHook(cwd?: string): Promise<number>;
287
311
  * The `guard-hook` subcommand is async (reads stdin); all others are synchronous.
288
312
  */
289
313
  export declare function run(argv: string[], cwd?: string): number | Promise<number>;
290
- export { managedFiles, MANIFEST_PATH, RULE_NAMES, SKILL_NAMES };
314
+ export { managedFiles, MANIFEST_PATH, normalizeForLedger, RULE_NAMES, SKILL_NAMES };
291
315
  export type { ManagedFile, Manifest, SyncOptions, DoctorResult };
292
316
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,aAAa,CAAC,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,MAAM,CAAA;IACpB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAyF1D;AAMD,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB,CAAA;AAED,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,WAAW,EAAE,CAAA;CACxB,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CA8F5C;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoF5E;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCzF;AAKD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AACnF,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,CAAA"}
package/dist/cli/index.js CHANGED
@@ -12,7 +12,13 @@ import { dirname, isAbsolute, relative, resolve } from "node:path";
12
12
  import { fileURLToPath } from "node:url";
13
13
  import { checkSource, DEFAULT_GUARD_CONFIG, GUARD_RULES } from "../guard/index.js";
14
14
  import { evaluateGuardHook } from "../guard/guard-hook.js";
15
- import { RULE_NAMES, SKILL_NAMES, SURFACES } from "../surfaces.js";
15
+ import {
16
+ hasImportBoundaryRuleRegistered,
17
+ MANTINE_FREE_VIA_IMPORT_BOUNDARY,
18
+ RULE_NAMES,
19
+ SKILL_NAMES,
20
+ SURFACES
21
+ } from "../surfaces.js";
16
22
  const DEFAULT_ROOTS = ["src"];
17
23
  const DEFAULT_SERIES_MODULE_PATH = "src/lib/series.ts";
18
24
  function defaultExempt(cfg) {
@@ -359,21 +365,28 @@ function unitState(file, cwd, ctx) {
359
365
  }
360
366
  return { current: onDisk, desired };
361
367
  }
368
+ function normalizeForLedger(text) {
369
+ return text.replace(/(<!-- basalt:begin)\s+\S+(\s*-->)/, "$1$2").split("\n").map((line) => line.replace(/[ \t]+$/, "")).join("\n").replace(/\n{2,}/g, "\n").trim();
370
+ }
362
371
  function writeUnit(file, cwd, desired) {
363
372
  const destAbs = resolve(cwd, file.dest);
364
373
  if (file.markers) {
365
374
  const host = readIfExists(destAbs) ?? "";
366
375
  writeFileEnsuringDir(destAbs, applyBlock(host, desired));
367
- return sha256(desired);
376
+ } else {
377
+ writeFileEnsuringDir(destAbs, desired);
368
378
  }
369
- writeFileEnsuringDir(destAbs, desired);
370
- return sha256(desired);
379
+ return sha256(normalizeForLedger(desired));
371
380
  }
372
381
  function classify(state, manifestHash) {
373
382
  if (state.current === null) return "missing";
374
383
  if (state.desired !== null && state.current === state.desired) return "current";
375
384
  const currentHash = sha256(state.current);
376
385
  if (currentHash === manifestHash) return "unchanged";
386
+ if (sha256(normalizeForLedger(state.current)) === manifestHash) return "unchanged";
387
+ if (state.desired !== null && normalizeForLedger(state.current) === normalizeForLedger(state.desired)) {
388
+ return "unchanged";
389
+ }
377
390
  return "drifted";
378
391
  }
379
392
  function diffSummary(file, state) {
@@ -404,7 +417,7 @@ function init(cwd = process.cwd(), scaffoldFlags = {}) {
404
417
  }
405
418
  const destExists = existsSync(resolve(cwd, file.dest));
406
419
  if (!file.markers && destExists) {
407
- manifest.files[file.dest] = sha256(state.desired);
420
+ manifest.files[file.dest] = sha256(normalizeForLedger(state.desired));
408
421
  skipped++;
409
422
  continue;
410
423
  }
@@ -475,7 +488,7 @@ function sync(opts = {}, cwd = process.cwd()) {
475
488
  }
476
489
  const kind = classify(state, manifest.files[file.dest]);
477
490
  if (kind === "current") {
478
- manifest.files[file.dest] = sha256(state.desired);
491
+ manifest.files[file.dest] = sha256(normalizeForLedger(state.desired));
479
492
  continue;
480
493
  }
481
494
  if (kind === "drifted" && !opts.force) {
@@ -585,8 +598,25 @@ function checkCoverage() {
585
598
  }
586
599
  }
587
600
  const REQUIRED_MANTINE_BANS = ["@mantine/core", "@mantine/hooks", "@mantine/*"];
601
+ let shippedRules;
602
+ try {
603
+ const shippedConfig = JSON.parse(
604
+ readFileSync(resolve(pkgRoot, "configs/oxlint.json"), "utf8")
605
+ );
606
+ shippedRules = shippedConfig.rules;
607
+ } catch {
608
+ failures.push(`Cannot read configs/oxlint.json at ${pkgRoot} to verify basalt/import-boundary`);
609
+ }
610
+ const importBoundaryRegistered = hasImportBoundaryRuleRegistered(shippedRules);
588
611
  for (const [key, spec] of allSpecs) {
589
612
  if (spec.layer !== "headless") continue;
613
+ if (MANTINE_FREE_VIA_IMPORT_BOUNDARY.has(key)) {
614
+ if (importBoundaryRegistered) continue;
615
+ failures.push(
616
+ `SURFACES['${key}'] relies on the basalt/import-boundary plugin rule for Mantine-free coverage, but that rule is not registered as 'error' in configs/oxlint.json`
617
+ );
618
+ continue;
619
+ }
590
620
  for (const required of REQUIRED_MANTINE_BANS) {
591
621
  const hasBan = spec.forbiddenImports.some((fi) => fi.spec === required);
592
622
  if (!hasBan) {
@@ -884,6 +914,7 @@ export {
884
914
  info,
885
915
  init,
886
916
  managedFiles,
917
+ normalizeForLedger,
887
918
  run,
888
919
  sync
889
920
  };