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.
@@ -60,13 +60,6 @@ type BaseSurface = {
60
60
  readonly layer: Layer;
61
61
  readonly forbiddenImports: readonly ForbiddenImport[];
62
62
  readonly ruleOverrides?: readonly RuleOverride[];
63
- /**
64
- * REPLACE-not-inherit-and-add. When true, this surface's forbiddenImports are the COMPLETE ban
65
- * set for its glob — the generator MUST NOT inherit-and-add the parent (src/**) bans. Charts sets
66
- * this so the @visx/* ban from src/** does NOT leak into the charts override (which would re-ban
67
- * visx). The projection emits the full list.
68
- */
69
- readonly replaceBans?: true;
70
63
  /**
71
64
  * Human-readable description of this surface — single source for llms.txt and info output.
72
65
  * Optional on tooling surfaces (they have no llms.txt row).
@@ -150,8 +143,7 @@ export declare const SURFACES: {
150
143
  readonly shipped: readonly ["**/charts/**"];
151
144
  readonly repo: readonly ["packages/basalt-ui/src/charts/**"];
152
145
  };
153
- readonly replaceBans: true;
154
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
146
+ readonly forbiddenImports: readonly [];
155
147
  readonly ruleOverrides: readonly [{
156
148
  readonly rule: "no-underscore-dangle";
157
149
  readonly level: "off";
@@ -169,7 +161,7 @@ export declare const SURFACES: {
169
161
  readonly shipped: readonly ["**/tokens/**"];
170
162
  readonly repo: readonly ["packages/basalt-ui/src/tokens/**"];
171
163
  };
172
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
164
+ readonly forbiddenImports: readonly [];
173
165
  };
174
166
  readonly './theme-lab': {
175
167
  readonly kind: "tooling";
@@ -191,7 +183,7 @@ export declare const SURFACES: {
191
183
  readonly shipped: readonly [];
192
184
  readonly repo: readonly ["packages/basalt-ui/src/guard/**"];
193
185
  };
194
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
186
+ readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport];
195
187
  };
196
188
  readonly './query': {
197
189
  readonly kind: "doctrine";
@@ -205,7 +197,7 @@ export declare const SURFACES: {
205
197
  readonly shipped: readonly [];
206
198
  readonly repo: readonly ["packages/basalt-ui/src/query/**"];
207
199
  };
208
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
200
+ readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport];
209
201
  };
210
202
  readonly './router-tanstack': {
211
203
  readonly kind: "doctrine";
@@ -219,7 +211,7 @@ export declare const SURFACES: {
219
211
  readonly shipped: readonly [];
220
212
  readonly repo: readonly ["packages/basalt-ui/src/router-tanstack/**"];
221
213
  };
222
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
214
+ readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport];
223
215
  };
224
216
  readonly './forms': {
225
217
  readonly kind: "doctrine";
@@ -293,7 +285,7 @@ export declare const SURFACES: {
293
285
  readonly shipped: readonly [];
294
286
  readonly repo: readonly ["packages/basalt-ui/src/agent/**"];
295
287
  };
296
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
288
+ readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport];
297
289
  };
298
290
  readonly './content': {
299
291
  readonly kind: "doctrine";
@@ -317,7 +309,7 @@ export declare const SURFACES: {
317
309
  readonly shipped: readonly [];
318
310
  readonly repo: readonly ["packages/basalt-ui/src/state.ts"];
319
311
  };
320
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
312
+ readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport];
321
313
  };
322
314
  readonly './connectivity': {
323
315
  readonly kind: "doctrine";
@@ -362,7 +354,7 @@ export declare const SURFACES: {
362
354
  readonly level: "off";
363
355
  readonly target: "repo";
364
356
  }];
365
- readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport, ForbiddenImport, ForbiddenImport];
357
+ readonly forbiddenImports: readonly [ForbiddenImport, ForbiddenImport];
366
358
  };
367
359
  };
368
360
  /**
@@ -382,5 +374,27 @@ export declare const RULE_NAMES: readonly RuleName[];
382
374
  * SKILL_NAMES.includes('basalt-design') // true
383
375
  */
384
376
  export declare const SKILL_NAMES: readonly SkillName[];
377
+ /**
378
+ * Headless SURFACES keys whose Mantine-free guarantee is enforced by the `basalt/import-boundary`
379
+ * oxlint plugin rule (`configs/oxlint-plugin.js`) instead of a `forbiddenImports` no-restricted-
380
+ * imports ban — the rule fires on `charts`/`tokens` path segments only, so ONLY these two surfaces
381
+ * qualify (every other headless surface still carries its Mantine ban in `forbiddenImports`).
382
+ *
383
+ * Membership alone does NOT satisfy the coverage check — `checkCoverage()`'s assertion 7 (and its
384
+ * test mirror) also require `hasImportBoundaryRuleRegistered` to hold, so a future removal of the
385
+ * plugin rule's registration still fails loudly instead of silently passing.
386
+ */
387
+ export declare const MANTINE_FREE_VIA_IMPORT_BOUNDARY: ReadonlySet<string>;
388
+ /**
389
+ * True when a parsed oxlint config's `rules` object registers `basalt/import-boundary` as `'error'`
390
+ * — the live signal (not just a hardcoded assumption) that `MANTINE_FREE_VIA_IMPORT_BOUNDARY`
391
+ * surfaces are actually enforced. Pure — callers read + JSON.parse the config file themselves
392
+ * (surfaces.ts stays dependency-free, no fs access here).
393
+ *
394
+ * @example
395
+ * hasImportBoundaryRuleRegistered({ 'basalt/import-boundary': 'error' }) // true
396
+ * hasImportBoundaryRuleRegistered({}) // false
397
+ */
398
+ export declare function hasImportBoundaryRuleRegistered(rules: Record<string, unknown> | undefined): boolean;
385
399
  export {};
386
400
  //# sourceMappingURL=surfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["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AAM,MAAM,WAAW,GAAG,YAAY,GAAG,WAAW,CAAA;AA6BpD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuR2B,CAAA;AAIhD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,qBAMiB,CAAA;AAIxC;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,sBAMiB,CAAA;AAIzC;;;;;;;;;GASG;AACH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,CAG/D,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACzC,OAAO,CAET"}
package/dist/surfaces.js CHANGED
@@ -39,13 +39,10 @@ const SURFACES = {
39
39
  shipped: ["**/charts/**"],
40
40
  repo: ["packages/basalt-ui/src/charts/**"]
41
41
  },
42
- replaceBans: true,
43
- // @visx/* MUST NOT inherit from src/** (the re-allow). Full list emitted.
44
- forbiddenImports: [
45
- ...MANTINE_BANS,
46
- v("@visx/tooltip", "Use ChartTooltip + TooltipHeader/Row/Body from {ctx}.")
47
- // LOAD-BEARING ABSENCE: no @visx/* group ban here — charts uniquely permits @visx/*.
48
- ],
42
+ // The @visx/*-only-in-charts and Mantine-free boundaries are enforced by the
43
+ // `basalt/import-boundary` oxlint plugin rule (configs/oxlint-plugin.js), not
44
+ // no-restricted-imports — see that file's header comment for why.
45
+ forbiddenImports: [],
49
46
  ruleOverrides: [{ rule: "no-underscore-dangle", level: "off", target: "repo" }]
50
47
  },
51
48
  "./tokens": {
@@ -59,11 +56,8 @@ const SURFACES = {
59
56
  shipped: ["**/tokens/**"],
60
57
  repo: ["packages/basalt-ui/src/tokens/**"]
61
58
  },
62
- forbiddenImports: [
63
- ...MANTINE_BANS,
64
- vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
65
- ]
66
- // shipped tokens override is MISSING today → this projection EMITS it (closes D2)
59
+ // Mantine-free + @visx/* boundaries enforced by `basalt/import-boundary` (see ./charts above).
60
+ forbiddenImports: []
67
61
  },
68
62
  "./theme-lab": {
69
63
  kind: "tooling",
@@ -85,10 +79,8 @@ const SURFACES = {
85
79
  shipped: [],
86
80
  repo: ["packages/basalt-ui/src/guard/**"]
87
81
  },
88
- forbiddenImports: [
89
- ...MANTINE_BANS,
90
- vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
91
- ]
82
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
83
+ forbiddenImports: [...MANTINE_BANS]
92
84
  },
93
85
  // 6th JS subpath
94
86
  "./query": {
@@ -103,10 +95,8 @@ const SURFACES = {
103
95
  shipped: [],
104
96
  repo: ["packages/basalt-ui/src/query/**"]
105
97
  },
106
- forbiddenImports: [
107
- ...MANTINE_BANS,
108
- vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
109
- ]
98
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
99
+ forbiddenImports: [...MANTINE_BANS]
110
100
  },
111
101
  "./router-tanstack": {
112
102
  kind: "doctrine",
@@ -120,10 +110,8 @@ const SURFACES = {
120
110
  shipped: [],
121
111
  repo: ["packages/basalt-ui/src/router-tanstack/**"]
122
112
  },
123
- forbiddenImports: [
124
- ...MANTINE_BANS,
125
- vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
126
- ]
113
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
114
+ forbiddenImports: [...MANTINE_BANS]
127
115
  },
128
116
  "./forms": {
129
117
  kind: "doctrine",
@@ -197,10 +185,8 @@ const SURFACES = {
197
185
  shipped: [],
198
186
  repo: ["packages/basalt-ui/src/agent/**"]
199
187
  },
200
- forbiddenImports: [
201
- ...MANTINE_BANS,
202
- vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
203
- ]
188
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
189
+ forbiddenImports: [...MANTINE_BANS]
204
190
  },
205
191
  "./content": {
206
192
  kind: "doctrine",
@@ -235,10 +221,8 @@ const SURFACES = {
235
221
  shipped: [],
236
222
  repo: ["packages/basalt-ui/src/state.ts"]
237
223
  },
238
- forbiddenImports: [
239
- ...MANTINE_BANS,
240
- vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
241
- ]
224
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
225
+ forbiddenImports: [...MANTINE_BANS]
242
226
  },
243
227
  "./connectivity": {
244
228
  kind: "doctrine",
@@ -279,9 +263,11 @@ const SURFACES = {
279
263
  guardKinds: [],
280
264
  globs: {
281
265
  // Shipped is a catch-all (not just src/**+app/**) so consumer code under components/, lib/,
282
- // features/, etc. is also covered — the narrower re-allow overrides (./tokens, ./charts,
283
- // ./agent) still win for their globs because oxlint overrides are last-writer-wins and
284
- // EMIT_ORDER places #app first (see projectBanList doc comment in gen-oxlint.ts).
266
+ // features/, etc. is also covered. The @visx/*-only-in-charts and Mantine-free charts/tokens
267
+ // boundaries used to live here too and need last-writer-wins EMIT_ORDER games against the
268
+ // narrower ./tokens/./charts overrides — they're now enforced by `basalt/import-boundary`
269
+ // (a plugin rule, immune to that class of clobbering) instead, so the bans left below (antd,
270
+ // framer-motion) are plain global bans with no narrower override to out-order.
285
271
  shipped: ["**/*.{ts,tsx}"],
286
272
  repo: ["packages/basalt-ui/src/**", "apps/playground/src/**"]
287
273
  },
@@ -289,8 +275,6 @@ const SURFACES = {
289
275
  // cli/bin/scripts, repo-local only
290
276
  forbiddenImports: [
291
277
  v("antd", "Use Mantine \u2014 antd is not part of the basalt-ui stack.", { shippedOnly: true }),
292
- v("@visx/tooltip", "Use ChartTooltip + TooltipHeader/Row/Body from {ctx}."),
293
- vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx})."),
294
278
  v("framer-motion", "Import from 'motion/react', not the raw framer-motion package.")
295
279
  ]
296
280
  }
@@ -305,8 +289,17 @@ const SKILL_NAMES = [
305
289
  Object.values(SURFACES).filter((s) => s.kind === "doctrine").flatMap((s) => [...s.skill])
306
290
  )
307
291
  ];
292
+ const MANTINE_FREE_VIA_IMPORT_BOUNDARY = /* @__PURE__ */ new Set([
293
+ "./charts",
294
+ "./tokens"
295
+ ]);
296
+ function hasImportBoundaryRuleRegistered(rules) {
297
+ return rules?.["basalt/import-boundary"] === "error";
298
+ }
308
299
  export {
300
+ MANTINE_FREE_VIA_IMPORT_BOUNDARY,
309
301
  RULE_NAMES,
310
302
  SKILL_NAMES,
311
- SURFACES
303
+ SURFACES,
304
+ hasImportBoundaryRuleRegistered
312
305
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basalt-ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets",
5
5
  "keywords": [
6
6
  "charts",
package/src/cli/index.ts CHANGED
@@ -35,7 +35,13 @@ import { fileURLToPath } from 'node:url'
35
35
  import { checkSource, DEFAULT_GUARD_CONFIG, GUARD_RULES } from '../guard'
36
36
  import type { Finding, GuardConfig, GuardKind } from '../guard'
37
37
  import { evaluateGuardHook } from '../guard/guard-hook'
38
- import { RULE_NAMES, SKILL_NAMES, SURFACES } from '../surfaces'
38
+ import {
39
+ hasImportBoundaryRuleRegistered,
40
+ MANTINE_FREE_VIA_IMPORT_BOUNDARY,
41
+ RULE_NAMES,
42
+ SKILL_NAMES,
43
+ SURFACES,
44
+ } from '../surfaces'
39
45
  import type { DoctrineSpec, SurfaceSpec } from '../surfaces'
40
46
 
41
47
  /** Shape of the optional `"basalt"` key in a consumer's package.json. */
@@ -755,32 +761,105 @@ function unitState(file: ManagedFile, cwd: string, ctx: RenderContext): UnitStat
755
761
  return { current: onDisk, desired }
756
762
  }
757
763
 
758
- /** Write a managed unit to disk (whole file, or marker-spliced region). Returns the unit's hash. */
764
+ type Classification = 'unchanged' | 'drifted' | 'missing' | 'current'
765
+
766
+ /**
767
+ * Normalize a managed unit's rendered bytes for the ledger comparison below — makes a delta that is
768
+ * PURELY formatting or a version bump invisible to drift detection, while a real prose/content edit
769
+ * stays fully visible:
770
+ *
771
+ * - Blank out the per-release `BASALT_VERSION` token in a marker's begin line
772
+ * (`<!-- basalt:begin 1.0.1 -->` → `<!-- basalt:begin -->`). It changes on every release and is
773
+ * the only per-release variable that lands INSIDE the hashed region (the rest of
774
+ * `CLAUDE-block.md.tpl` has no other `{{…}}` placeholders today), so stripping it is what lets
775
+ * one normalized rendering stand in for every version of a given template body instead of
776
+ * needing one ledger entry per release. If a future marker template interpolates another
777
+ * per-release var inside its region, extend this normalization the same way.
778
+ * - Trim trailing whitespace per line and collapse every run of blank lines to none. This is the
779
+ * fix for the actual argo repro: lefthook's oxfmt reformats a spliced block (or a whole managed
780
+ * file) AFTER `writeUnit` has already exited and the manifest hash was recorded, so the manifest
781
+ * can never account for the reformat up front — normalizing it away here is the only place that
782
+ * can.
783
+ *
784
+ * Deliberately whitespace-only — word content is untouched, so a genuine hand-edit inside the block
785
+ * still changes the normalized text and still classifies `drifted`.
786
+ */
787
+ function normalizeForLedger(text: string): string {
788
+ return text
789
+ .replace(/(<!-- basalt:begin)\s+\S+(\s*-->)/, '$1$2')
790
+ .split('\n')
791
+ .map((line) => line.replace(/[ \t]+$/, ''))
792
+ .join('\n')
793
+ .replace(/\n{2,}/g, '\n')
794
+ .trim()
795
+ }
796
+
797
+ /**
798
+ * Write a managed unit to disk (whole file, or marker-spliced region). Returns the unit's hash —
799
+ * `sha256(normalizeForLedger(desired))`, NOT the raw bytes.
800
+ *
801
+ * This is the ledger: the manifest already records "what basalt shipped last sync", one entry per
802
+ * dest — a stored NORMALIZED hash makes that same single entry survive both a downstream formatter
803
+ * (the consumer's own lefthook oxfmt reformatting the written file/block after this function has
804
+ * already returned) and a version bump that changed the template's own words since the recorded
805
+ * entry — the argo cross-version case: current is v1.0.0's block, post-oxfmt; desired is v1.0.1's
806
+ * (different words, e.g. the CLI bin rename). Recording the raw hash can never reconcile that;
807
+ * recording the normalized hash lets `classify()` normalize `state.current` the same way and
808
+ * compare directly against it, no separate historical-hash storage required.
809
+ */
759
810
  function writeUnit(file: ManagedFile, cwd: string, desired: string): string {
760
811
  const destAbs = resolve(cwd, file.dest)
761
812
  if (file.markers) {
762
813
  const host = readIfExists(destAbs) ?? ''
763
814
  writeFileEnsuringDir(destAbs, applyBlock(host, desired))
764
- return sha256(desired)
815
+ } else {
816
+ writeFileEnsuringDir(destAbs, desired)
765
817
  }
766
- writeFileEnsuringDir(destAbs, desired)
767
- return sha256(desired)
818
+ return sha256(normalizeForLedger(desired))
768
819
  }
769
820
 
770
- type Classification = 'unchanged' | 'drifted' | 'missing' | 'current'
771
-
772
821
  /**
773
822
  * Classify a managed file against the manifest for a sync run.
774
823
  * - missing : the managed unit is absent on disk → recreate.
775
824
  * - current : on disk == desired → nothing to do.
776
- * - unchanged: on disk == manifest hash (untouched since last sync) but != desired → safe overwrite.
777
- * - drifted : on disk != manifest hash AND != desired (locally edited) → skip unless --force.
825
+ * - unchanged: on disk matches a KNOWN-SHIPPED rendering of this template, checked three ways (any
826
+ * one is sufficient) — but != desired as-is → safe overwrite:
827
+ * 1. `sha256(current) === manifestHash` — legacy raw-hash path. An existing consumer
828
+ * manifest (written before this fix, or by a still-running older CLI) holds the RAW
829
+ * hash of what was written, not the normalized one; keep matching it directly so an
830
+ * upgrade never mass-classifies a pristine tree as drifted.
831
+ * Residual transitional gap: a manifest written by a pre-1.0.2 CLI holds a raw hash
832
+ * of the exact old bytes, so if the on-disk block was ALSO reformatted by a
833
+ * downstream formatter AND the template body changed cross-version in the same
834
+ * upgrade, none of the three paths above match and it classifies `drifted`, needing
835
+ * one `--force`. Once any sync since writes a normalized entry (path 2/3 or a
836
+ * healed write), the gap is closed for good for that file. Deliberately not solved
837
+ * by keeping a historical per-version ledger — that's a real but bounded tradeoff.
838
+ * 2. `sha256(normalizeForLedger(current)) === manifestHash` — the ledger proper.
839
+ * `manifestHash` normally holds `sha256(normalizeForLedger(<bytes written at the
840
+ * last sync>))` (see `writeUnit`); normalizing `current` the same way and comparing
841
+ * survives a downstream formatter reformatting the file AND a version bump that
842
+ * changed the template's own words between the sync that wrote this manifest entry
843
+ * and the version being synced now — the argo cross-version false positive.
844
+ * 3. `normalizeForLedger(current) === normalizeForLedger(desired)` — same-version
845
+ * fallback for when there is no manifest entry to compare against at all (e.g. it
846
+ * was dropped), but the on-disk bytes still match today's rendering modulo
847
+ * formatting noise.
848
+ * - drifted : on disk matches NONE of the above (a real, word-level local edit) → skip unless
849
+ * --force.
778
850
  */
779
851
  function classify(state: UnitState, manifestHash: string | undefined): Classification {
780
852
  if (state.current === null) return 'missing'
781
853
  if (state.desired !== null && state.current === state.desired) return 'current'
782
854
  const currentHash = sha256(state.current)
783
855
  if (currentHash === manifestHash) return 'unchanged'
856
+ if (sha256(normalizeForLedger(state.current)) === manifestHash) return 'unchanged'
857
+ if (
858
+ state.desired !== null &&
859
+ normalizeForLedger(state.current) === normalizeForLedger(state.desired)
860
+ ) {
861
+ return 'unchanged'
862
+ }
784
863
  return 'drifted'
785
864
  }
786
865
 
@@ -821,10 +900,11 @@ export function init(cwd: string = process.cwd(), scaffoldFlags: ScaffoldFlags =
821
900
  // inserts/updates itself inside its host file.
822
901
  const destExists = existsSync(resolve(cwd, file.dest))
823
902
  if (!file.markers && destExists) {
824
- // Already present — keep the consumer's copy untouched. Record the SHIPPED hash so a later
825
- // sync treats a pre-existing-but-different file as locally drifted (skip unless --force),
826
- // never silently clobbering a file the consumer authored before init.
827
- manifest.files[file.dest] = sha256(state.desired)
903
+ // Already present — keep the consumer's copy untouched. Record the SHIPPED hash (normalized,
904
+ // same ledger form `writeUnit` uses) so a later sync treats a pre-existing-but-different file
905
+ // as locally drifted (skip unless --force), never silently clobbering a file the consumer
906
+ // authored before init.
907
+ manifest.files[file.dest] = sha256(normalizeForLedger(state.desired))
828
908
  skipped++
829
909
  continue
830
910
  }
@@ -921,7 +1001,10 @@ export function sync(opts: SyncOptions = {}, cwd: string = process.cwd()): numbe
921
1001
  const kind = classify(state, manifest.files[file.dest])
922
1002
 
923
1003
  if (kind === 'current') {
924
- manifest.files[file.dest] = sha256(state.desired)
1004
+ // On-disk bytes already equal `desired` exactly — record the ledger's normalized form
1005
+ // (not the raw bytes) so this entry keeps behaving like every other `writeUnit`-recorded
1006
+ // hash for a future classify() call.
1007
+ manifest.files[file.dest] = sha256(normalizeForLedger(state.desired))
925
1008
  continue
926
1009
  }
927
1010
 
@@ -986,7 +1069,9 @@ export function sync(opts: SyncOptions = {}, cwd: string = process.cwd()): numbe
986
1069
  * 4. Every non-#, non-'.' JS-subpath SURFACES key has a package.json exports entry.
987
1070
  * 5. Every real package.json exports key has a SURFACES entry.
988
1071
  * 6. Every surface with non-empty forbiddenImports has a globs field.
989
- * 7. Every headless surface carries all 3 Mantine bans (Mantine-free boundary).
1072
+ * 7. Every headless surface is Mantine-free — via all 3 `forbiddenImports` bans, OR (for
1073
+ * `MANTINE_FREE_VIA_IMPORT_BOUNDARY` members) the `basalt/import-boundary` plugin rule actually
1074
+ * registered as `'error'` in the shipped config.
990
1075
  * 8. Every doctrine optionalPeers entry exists in peerDependencies AND peerDependenciesMeta.
991
1076
  *
992
1077
  * Tooling surfaces are exempt from assertions 1–3 by the discriminant.
@@ -1079,11 +1164,34 @@ export function checkCoverage(): number {
1079
1164
  }
1080
1165
  }
1081
1166
 
1082
- // ── Assertion 7: every headless surface carries all 3 Mantine bans ───────────
1083
- // Guarantees the Mantine-free boundary — a future headless surface without bans fails here.
1167
+ // ── Assertion 7: every headless surface is Mantine-free ──────────────────────
1168
+ // Guarantees the Mantine-free boundary — a future headless surface without coverage fails here.
1169
+ // Coverage is either all 3 forbiddenImports bans, OR (for `./charts`/`./tokens`, the surfaces the
1170
+ // `basalt/import-boundary` plugin rule fires on) that rule actually registered as 'error' in the
1171
+ // shipped config — membership in MANTINE_FREE_VIA_IMPORT_BOUNDARY alone does NOT pass this; the
1172
+ // registration must be live, so a future removal of the rule fails loudly instead of silently.
1084
1173
  const REQUIRED_MANTINE_BANS = ['@mantine/core', '@mantine/hooks', '@mantine/*'] as const
1174
+ let shippedRules: Record<string, unknown> | undefined
1175
+ try {
1176
+ const shippedConfig = JSON.parse(
1177
+ readFileSync(resolve(pkgRoot, 'configs/oxlint.json'), 'utf8'),
1178
+ ) as { rules?: Record<string, unknown> }
1179
+ shippedRules = shippedConfig.rules
1180
+ } catch {
1181
+ failures.push(`Cannot read configs/oxlint.json at ${pkgRoot} to verify basalt/import-boundary`)
1182
+ }
1183
+ const importBoundaryRegistered = hasImportBoundaryRuleRegistered(shippedRules)
1184
+
1085
1185
  for (const [key, spec] of allSpecs) {
1086
1186
  if (spec.layer !== 'headless') continue
1187
+ if (MANTINE_FREE_VIA_IMPORT_BOUNDARY.has(key)) {
1188
+ if (importBoundaryRegistered) continue
1189
+ failures.push(
1190
+ `SURFACES['${key}'] relies on the basalt/import-boundary plugin rule for Mantine-free ` +
1191
+ `coverage, but that rule is not registered as 'error' in configs/oxlint.json`,
1192
+ )
1193
+ continue
1194
+ }
1087
1195
  for (const required of REQUIRED_MANTINE_BANS) {
1088
1196
  const hasBan = spec.forbiddenImports.some((fi) => fi.spec === required)
1089
1197
  if (!hasBan) {
@@ -1531,5 +1639,7 @@ export function run(argv: string[], cwd: string = process.cwd()): number | Promi
1531
1639
  }
1532
1640
 
1533
1641
  // Re-export the managed-file manifest for testing / introspection (no default export).
1534
- export { managedFiles, MANIFEST_PATH, RULE_NAMES, SKILL_NAMES }
1642
+ // `normalizeForLedger` is exported so tests can compute a fixture's expected ledger hash without
1643
+ // duplicating the normalization algorithm — it stays call-site-internal to writeUnit/classify.
1644
+ export { managedFiles, MANIFEST_PATH, normalizeForLedger, RULE_NAMES, SKILL_NAMES }
1535
1645
  export type { ManagedFile, Manifest, SyncOptions, DoctorResult }