basalt-ui 1.0.0 → 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.
Files changed (40) hide show
  1. package/AGENTS.md +12 -12
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +31 -44
  4. package/agent/rules/basalt-charts.md +1 -1
  5. package/agent/rules/basalt-mantine.md +3 -3
  6. package/agent/rules/basalt-router.md +1 -1
  7. package/agent/rules/basalt-state.md +2 -2
  8. package/agent/rules/basalt-tokens.md +3 -3
  9. package/agent/skills/basalt-app/SKILL.md +137 -0
  10. package/agent/skills/basalt-charts/SKILL.md +179 -0
  11. package/agent/skills/basalt-design/SKILL.md +249 -0
  12. package/agent/templates/CLAUDE-block.md.tpl +8 -5
  13. package/agent/templates/__root.tpl +1 -1
  14. package/agent/templates/query-client.ts.tpl +1 -1
  15. package/configs/check.yml +8 -8
  16. package/configs/lefthook.yml +9 -5
  17. package/configs/oxlint-plugin.js +119 -7
  18. package/configs/oxlint-plugin.test.ts +73 -3
  19. package/configs/oxlint.json +2 -71
  20. package/dist/cli/index.d.ts +71 -28
  21. package/dist/cli/index.d.ts.map +1 -1
  22. package/dist/cli/index.js +134 -121
  23. package/dist/surfaces.d.ts +41 -17
  24. package/dist/surfaces.d.ts.map +1 -1
  25. package/dist/surfaces.js +37 -38
  26. package/dist/tokens/index.d.ts +1 -0
  27. package/dist/tokens/index.d.ts.map +1 -1
  28. package/dist/tokens/index.js +3 -0
  29. package/llms.txt +2 -2
  30. package/package.json +2 -2
  31. package/src/cli/check-theme.test.ts +12 -2
  32. package/src/cli/help.test.ts +93 -0
  33. package/src/cli/index.ts +332 -184
  34. package/src/cli/placement-engine.test.ts +194 -0
  35. package/src/cli/tarball-parity.test.ts +44 -0
  36. package/src/cli/template-format.test.ts +64 -0
  37. package/src/cli/template-ledger.test.ts +219 -0
  38. package/src/surfaces.ts +78 -43
  39. package/src/tokens/index.ts +6 -0
  40. /package/bin/{basalt.mjs → basalt-ui.mjs} +0 -0
package/src/surfaces.ts CHANGED
@@ -29,7 +29,8 @@ export type RuleName =
29
29
  | 'agent'
30
30
  | 'content'
31
31
 
32
- /** The 3 plugin skill names (plugins/basalt/skills/basalt-{name}/).
32
+ /** The 3 shipped skill names (agent/skills/basalt-{name}/SKILL.md, placed into a consumer's
33
+ * .claude/skills/ by `basalt-ui init`/`sync` — the same managed path the rules take).
33
34
  *
34
35
  * @example
35
36
  * const s: SkillName = 'basalt-app'
@@ -81,13 +82,6 @@ type BaseSurface = {
81
82
  readonly layer: Layer
82
83
  readonly forbiddenImports: readonly ForbiddenImport[]
83
84
  readonly ruleOverrides?: readonly RuleOverride[]
84
- /**
85
- * REPLACE-not-inherit-and-add. When true, this surface's forbiddenImports are the COMPLETE ban
86
- * set for its glob — the generator MUST NOT inherit-and-add the parent (src/**) bans. Charts sets
87
- * this so the @visx/* ban from src/** does NOT leak into the charts override (which would re-ban
88
- * visx). The projection emits the full list.
89
- */
90
- readonly replaceBans?: true
91
85
  /**
92
86
  * Human-readable description of this surface — single source for llms.txt and info output.
93
87
  * Optional on tooling surfaces (they have no llms.txt row).
@@ -158,6 +152,10 @@ const vg = (spec: string, message: string, extra?: Partial<ForbiddenImport>): Fo
158
152
  ...extra,
159
153
  })
160
154
 
155
+ // Mantine-free ban for headless surfaces the `basalt/import-boundary` plugin rule does NOT cover
156
+ // (it only enforces charts/tokens path segments — see oxlint-plugin.js). `./charts` and `./tokens`
157
+ // no longer use this: their Mantine-free + @visx/* boundaries are enforced by that plugin rule
158
+ // instead, so duplicating the ban here would be redundant no-restricted-imports config.
161
159
  const MANTINE_BANS = [
162
160
  v('@mantine/core', '{ctx} must be Mantine-free — no Mantine imports allowed.'),
163
161
  v('@mantine/hooks', '{ctx} must be Mantine-free — no Mantine imports allowed.'),
@@ -200,12 +198,10 @@ export const SURFACES = {
200
198
  shipped: ['**/charts/**'],
201
199
  repo: ['packages/basalt-ui/src/charts/**'],
202
200
  },
203
- replaceBans: true, // @visx/* MUST NOT inherit from src/** (the re-allow). Full list emitted.
204
- forbiddenImports: [
205
- ...MANTINE_BANS,
206
- v('@visx/tooltip', 'Use ChartTooltip + TooltipHeader/Row/Body from {ctx}.'),
207
- // LOAD-BEARING ABSENCE: no @visx/* group ban here — charts uniquely permits @visx/*.
208
- ],
201
+ // The @visx/*-only-in-charts and Mantine-free boundaries are enforced by the
202
+ // `basalt/import-boundary` oxlint plugin rule (configs/oxlint-plugin.js), not
203
+ // no-restricted-imports — see that file's header comment for why.
204
+ forbiddenImports: [],
209
205
  ruleOverrides: [{ rule: 'no-underscore-dangle', level: 'off', target: 'repo' }],
210
206
  },
211
207
  './tokens': {
@@ -220,10 +216,8 @@ export const SURFACES = {
220
216
  shipped: ['**/tokens/**'],
221
217
  repo: ['packages/basalt-ui/src/tokens/**'],
222
218
  },
223
- forbiddenImports: [
224
- ...MANTINE_BANS,
225
- vg('@visx/*', 'Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).'),
226
- ], // shipped tokens override is MISSING today → this projection EMITS it (closes D2)
219
+ // Mantine-free + @visx/* boundaries enforced by `basalt/import-boundary` (see ./charts above).
220
+ forbiddenImports: [],
227
221
  },
228
222
  './theme-lab': {
229
223
  kind: 'tooling',
@@ -245,10 +239,8 @@ export const SURFACES = {
245
239
  shipped: [],
246
240
  repo: ['packages/basalt-ui/src/guard/**'],
247
241
  },
248
- forbiddenImports: [
249
- ...MANTINE_BANS,
250
- vg('@visx/*', 'Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).'),
251
- ],
242
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
243
+ forbiddenImports: [...MANTINE_BANS],
252
244
  }, // 6th JS subpath
253
245
  './query': {
254
246
  kind: 'doctrine',
@@ -262,10 +254,8 @@ export const SURFACES = {
262
254
  shipped: [],
263
255
  repo: ['packages/basalt-ui/src/query/**'],
264
256
  },
265
- forbiddenImports: [
266
- ...MANTINE_BANS,
267
- vg('@visx/*', 'Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).'),
268
- ],
257
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
258
+ forbiddenImports: [...MANTINE_BANS],
269
259
  },
270
260
  './router-tanstack': {
271
261
  kind: 'doctrine',
@@ -280,10 +270,8 @@ export const SURFACES = {
280
270
  shipped: [],
281
271
  repo: ['packages/basalt-ui/src/router-tanstack/**'],
282
272
  },
283
- forbiddenImports: [
284
- ...MANTINE_BANS,
285
- vg('@visx/*', 'Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).'),
286
- ],
273
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
274
+ forbiddenImports: [...MANTINE_BANS],
287
275
  },
288
276
  './forms': {
289
277
  kind: 'doctrine',
@@ -364,10 +352,8 @@ export const SURFACES = {
364
352
  shipped: [],
365
353
  repo: ['packages/basalt-ui/src/agent/**'],
366
354
  },
367
- forbiddenImports: [
368
- ...MANTINE_BANS,
369
- vg('@visx/*', 'Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).'),
370
- ],
355
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
356
+ forbiddenImports: [...MANTINE_BANS],
371
357
  },
372
358
  './content': {
373
359
  kind: 'doctrine',
@@ -404,10 +390,8 @@ export const SURFACES = {
404
390
  shipped: [],
405
391
  repo: ['packages/basalt-ui/src/state.ts'],
406
392
  },
407
- forbiddenImports: [
408
- ...MANTINE_BANS,
409
- vg('@visx/*', 'Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).'),
410
- ],
393
+ // @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
394
+ forbiddenImports: [...MANTINE_BANS],
411
395
  },
412
396
 
413
397
  './connectivity': {
@@ -455,17 +439,17 @@ export const SURFACES = {
455
439
  guardKinds: [],
456
440
  globs: {
457
441
  // Shipped is a catch-all (not just src/**+app/**) so consumer code under components/, lib/,
458
- // features/, etc. is also covered — the narrower re-allow overrides (./tokens, ./charts,
459
- // ./agent) still win for their globs because oxlint overrides are last-writer-wins and
460
- // EMIT_ORDER places #app first (see projectBanList doc comment in gen-oxlint.ts).
442
+ // features/, etc. is also covered. The @visx/*-only-in-charts and Mantine-free charts/tokens
443
+ // boundaries used to live here too and need last-writer-wins EMIT_ORDER games against the
444
+ // narrower ./tokens/./charts overrides — they're now enforced by `basalt/import-boundary`
445
+ // (a plugin rule, immune to that class of clobbering) instead, so the bans left below (antd,
446
+ // framer-motion) are plain global bans with no narrower override to out-order.
461
447
  shipped: ['**/*.{ts,tsx}'],
462
448
  repo: ['packages/basalt-ui/src/**', 'apps/playground/src/**'],
463
449
  },
464
450
  ruleOverrides: [{ rule: 'no-console', level: 'off', target: 'repo' }], // cli/bin/scripts, repo-local only
465
451
  forbiddenImports: [
466
452
  v('antd', 'Use Mantine — antd is not part of the basalt-ui stack.', { shippedOnly: true }),
467
- v('@visx/tooltip', 'Use ChartTooltip + TooltipHeader/Row/Body from {ctx}.'),
468
- vg('@visx/*', 'Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).'),
469
453
  v('framer-motion', "Import from 'motion/react', not the raw framer-motion package."),
470
454
  ],
471
455
  },
@@ -487,3 +471,54 @@ export const RULE_NAMES = [
487
471
  .map((s) => s.rule),
488
472
  ),
489
473
  ] as const satisfies readonly RuleName[]
474
+
475
+ // ── PROJECTION 1b — SKILL_NAMES ───────────────────────────────────────────────────────────────────
476
+
477
+ /**
478
+ * Derived, deduped set of doctrine skill names. Same projection shape as RULE_NAMES — the CLI's
479
+ * managed-file manifest and check-coverage both consume it, so a skill referenced by any doctrine
480
+ * surface is guaranteed a `agent/skills/{name}/SKILL.md` placement path.
481
+ *
482
+ * @example
483
+ * SKILL_NAMES.includes('basalt-design') // true
484
+ */
485
+ export const SKILL_NAMES = [
486
+ ...new Set(
487
+ (Object.values(SURFACES) as readonly SurfaceSpec[])
488
+ .filter((s): s is DoctrineSpec => s.kind === 'doctrine')
489
+ .flatMap((s) => [...s.skill]),
490
+ ),
491
+ ] as const satisfies readonly SkillName[]
492
+
493
+ // ── Mantine-free-via-plugin membership ────────────────────────────────────────────────────────────
494
+
495
+ /**
496
+ * Headless SURFACES keys whose Mantine-free guarantee is enforced by the `basalt/import-boundary`
497
+ * oxlint plugin rule (`configs/oxlint-plugin.js`) instead of a `forbiddenImports` no-restricted-
498
+ * imports ban — the rule fires on `charts`/`tokens` path segments only, so ONLY these two surfaces
499
+ * qualify (every other headless surface still carries its Mantine ban in `forbiddenImports`).
500
+ *
501
+ * Membership alone does NOT satisfy the coverage check — `checkCoverage()`'s assertion 7 (and its
502
+ * test mirror) also require `hasImportBoundaryRuleRegistered` to hold, so a future removal of the
503
+ * plugin rule's registration still fails loudly instead of silently passing.
504
+ */
505
+ export const MANTINE_FREE_VIA_IMPORT_BOUNDARY: ReadonlySet<string> = new Set([
506
+ './charts',
507
+ './tokens',
508
+ ])
509
+
510
+ /**
511
+ * True when a parsed oxlint config's `rules` object registers `basalt/import-boundary` as `'error'`
512
+ * — the live signal (not just a hardcoded assumption) that `MANTINE_FREE_VIA_IMPORT_BOUNDARY`
513
+ * surfaces are actually enforced. Pure — callers read + JSON.parse the config file themselves
514
+ * (surfaces.ts stays dependency-free, no fs access here).
515
+ *
516
+ * @example
517
+ * hasImportBoundaryRuleRegistered({ 'basalt/import-boundary': 'error' }) // true
518
+ * hasImportBoundaryRuleRegistered({}) // false
519
+ */
520
+ export function hasImportBoundaryRuleRegistered(
521
+ rules: Record<string, unknown> | undefined,
522
+ ): boolean {
523
+ return rules?.['basalt/import-boundary'] === 'error'
524
+ }
@@ -11,6 +11,12 @@
11
11
 
12
12
  import { ACCENT, FILL, INK, NEUTRAL, SEMANTIC, SHADOW, STATUS, SURFACE } from './palette'
13
13
 
14
+ // The raw hue families + pair-picker — the building blocks a consumer's series module composes
15
+ // (`hrv: p(BP.blue)`). The doctrine sends every consumer here, so they are public surface, not
16
+ // palette internals; dropping them from this barrel hard-fails the consumer's build (1.0.0 bug,
17
+ // pinned by scripts/export-surface.json).
18
+ export { BP, p } from './palette'
19
+
14
20
  /** A per-theme color pair: a hue keeps its identity but shifts shade across schemes. */
15
21
  export type ColorPair = { light: string; dark: string }
16
22
 
File without changes