basalt-ui 2.14.0 → 2.16.0

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 (134) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/MIGRATING.md +81 -13
  3. package/agent/agents/basalt-design-reviewer.md +83 -0
  4. package/agent/rules/basalt-batteries.md +1 -2
  5. package/agent/rules/basalt-charts.md +1 -1
  6. package/agent/rules/basalt-controls.md +3 -3
  7. package/agent/rules/basalt-mantine.md +2 -3
  8. package/agent/rules/basalt-state.md +1 -2
  9. package/agent/rules/basalt-tokens.md +1 -3
  10. package/agent/skills/basalt-design/SKILL.md +26 -8
  11. package/agent/templates/AGENTS-block.md.tpl +7 -0
  12. package/configs/card-inset.test.ts +57 -0
  13. package/configs/oxlint-basalt.json +1 -1
  14. package/configs/oxlint-plugin.js +81 -20
  15. package/configs/oxlint-plugin.test.ts +85 -6
  16. package/dist/agent/chat/thread-message.js +1 -1
  17. package/dist/agent/chat/thread-outcome-card.js +1 -1
  18. package/dist/charts/ChartCard.js +1 -1
  19. package/dist/charts/chart-card.module.css +2 -2
  20. package/dist/charts/legend.d.ts +4 -4
  21. package/dist/cli/board-freshness.d.ts +25 -0
  22. package/dist/cli/board-freshness.d.ts.map +1 -0
  23. package/dist/cli/board-freshness.js +88 -0
  24. package/dist/cli/doctor.d.ts +2 -1
  25. package/dist/cli/doctor.d.ts.map +1 -1
  26. package/dist/cli/doctor.js +3 -1
  27. package/dist/cli/help.d.ts.map +1 -1
  28. package/dist/cli/help.js +9 -3
  29. package/dist/cli/index.d.ts +15 -1
  30. package/dist/cli/index.d.ts.map +1 -1
  31. package/dist/cli/index.js +57 -7
  32. package/dist/cli/init.d.ts.map +1 -1
  33. package/dist/cli/init.js +6 -1
  34. package/dist/cli/shot/board.d.ts +5 -0
  35. package/dist/cli/shot/board.d.ts.map +1 -0
  36. package/dist/cli/shot/board.js +96 -0
  37. package/dist/cli/shot/capture.d.ts +59 -0
  38. package/dist/cli/shot/capture.d.ts.map +1 -0
  39. package/dist/cli/shot/capture.js +473 -0
  40. package/dist/cli/shot/index.d.ts +45 -0
  41. package/dist/cli/shot/index.d.ts.map +1 -0
  42. package/dist/cli/shot/index.js +289 -0
  43. package/dist/cli/shot/measure.d.ts +47 -0
  44. package/dist/cli/shot/measure.d.ts.map +1 -0
  45. package/dist/cli/shot/measure.js +191 -0
  46. package/dist/cli/shot/playwright.d.ts +101 -0
  47. package/dist/cli/shot/playwright.d.ts.map +1 -0
  48. package/dist/cli/shot/playwright.js +60 -0
  49. package/dist/cli/shot/serve.d.ts +6 -0
  50. package/dist/cli/shot/serve.d.ts.map +1 -0
  51. package/dist/cli/shot/serve.js +33 -0
  52. package/dist/cli/shot/types.d.ts +98 -0
  53. package/dist/cli/shot/types.d.ts.map +1 -0
  54. package/dist/cli/shot/types.js +17 -0
  55. package/dist/cli/sync.d.ts.map +1 -1
  56. package/dist/cli/sync.js +2 -1
  57. package/dist/dashboard/settings-section.d.ts.map +1 -1
  58. package/dist/dashboard/settings-section.js +5 -2
  59. package/dist/dashboard/stat-card.js +12 -12
  60. package/dist/dashboard/stat-card.module.css +4 -4
  61. package/dist/dashboard/widget-header.module.css +3 -3
  62. package/dist/guard/guard-hook.d.ts.map +1 -1
  63. package/dist/guard/index.d.ts +4 -2
  64. package/dist/guard/index.d.ts.map +1 -1
  65. package/dist/guard/index.js +18 -4
  66. package/dist/guard/vx-names.d.ts.map +1 -1
  67. package/dist/guard/vx-names.js +1 -0
  68. package/dist/shell/app-mobile-nav.module.css +2 -2
  69. package/dist/shell/app-sidebar-account.js +1 -1
  70. package/dist/shell/app-sidebar.js +2 -2
  71. package/dist/shell/app-sidebar.module.css +8 -8
  72. package/dist/shell/index.js +5 -1
  73. package/dist/shell/page-bar.js +1 -1
  74. package/dist/surfaces.d.ts +2 -0
  75. package/dist/surfaces.d.ts.map +1 -1
  76. package/dist/surfaces.js +2 -0
  77. package/dist/table/data-table.d.ts.map +1 -1
  78. package/dist/table/data-table.js +3 -0
  79. package/dist/theme/index.d.ts.map +1 -1
  80. package/dist/theme/index.js +31 -21
  81. package/dist/tokens/core.d.ts +10 -4
  82. package/dist/tokens/core.d.ts.map +1 -1
  83. package/dist/tokens/core.js +16 -10
  84. package/dist/tokens/ctl-vars.d.ts +15 -0
  85. package/dist/tokens/ctl-vars.d.ts.map +1 -0
  86. package/dist/tokens/ctl-vars.js +22 -0
  87. package/dist/tokens/palette.d.ts +37 -29
  88. package/dist/tokens/palette.d.ts.map +1 -1
  89. package/dist/tokens/palette.js +32 -21
  90. package/dist/tokens/space-scale.d.ts +14 -0
  91. package/dist/tokens/space-scale.d.ts.map +1 -0
  92. package/dist/tokens/space-scale.js +10 -0
  93. package/llms.txt +2 -2
  94. package/package.json +1 -1
  95. package/src/agent/chat/thread-message.tsx +1 -1
  96. package/src/agent/chat/thread-outcome-card.tsx +2 -2
  97. package/src/charts/ChartCard.tsx +1 -1
  98. package/src/charts/chart-card.module.css +2 -2
  99. package/src/charts/legend.tsx +4 -4
  100. package/src/cli/board-freshness.ts +132 -0
  101. package/src/cli/doctor.ts +10 -1
  102. package/src/cli/help.ts +14 -2
  103. package/src/cli/index.ts +80 -10
  104. package/src/cli/init.ts +8 -1
  105. package/src/cli/shot/board.ts +154 -0
  106. package/src/cli/shot/capture.ts +650 -0
  107. package/src/cli/shot/index.ts +362 -0
  108. package/src/cli/shot/measure.ts +252 -0
  109. package/src/cli/shot/playwright.ts +152 -0
  110. package/src/cli/shot/serve.ts +35 -0
  111. package/src/cli/shot/types.ts +92 -0
  112. package/src/cli/sync.ts +2 -1
  113. package/src/dashboard/settings-section.tsx +5 -2
  114. package/src/dashboard/stat-card.module.css +4 -4
  115. package/src/dashboard/stat-card.tsx +13 -13
  116. package/src/dashboard/widget-header.module.css +3 -3
  117. package/src/guard/guard-hook.ts +3 -1
  118. package/src/guard/index.ts +27 -13
  119. package/src/guard/vx-names.ts +1 -0
  120. package/src/shell/app-mobile-nav.module.css +2 -2
  121. package/src/shell/app-sidebar-account.tsx +1 -1
  122. package/src/shell/app-sidebar.module.css +8 -8
  123. package/src/shell/app-sidebar.tsx +2 -2
  124. package/src/shell/index.tsx +10 -4
  125. package/src/shell/page-bar.tsx +1 -1
  126. package/src/surfaces.ts +5 -0
  127. package/src/table/data-table.tsx +10 -4
  128. package/src/theme/__snapshots__/plain-theme.test.ts.snap +57 -45
  129. package/src/theme/ctl-theme.tsx +1 -1
  130. package/src/theme/index.ts +43 -23
  131. package/src/tokens/core.ts +16 -8
  132. package/src/tokens/ctl-vars.ts +32 -0
  133. package/src/tokens/palette.ts +40 -29
  134. package/src/tokens/space-scale.ts +13 -0
@@ -588,9 +588,15 @@ const rawSizeLiteral = {
588
588
 
589
589
  const CARD_TAGS = new Set(['Card', 'Paper'])
590
590
 
591
+ // The idiom is the PAIR py="sm" px="md" (12/16), or leaving both to the theme. Never a uniform
592
+ // `p`/`padding` (whatever its value or form), never one half of the pair alone, never a number, an
593
+ // expression or any other step. The pair is the level-0 inset (`cardInsetY`/`cardInsetX` =
594
+ // `SPACE_SCALE.sm`/`.md`); `tokens/space-scale.test.ts` pins that.
595
+ export const CARD_INSET_PY = 'sm'
596
+ export const CARD_INSET_PX = 'md'
591
597
  const CARD_INSET_MESSAGE =
592
- 'Card/Paper is off the card idiom — use the spacing xs/sm inset (py="xs" px="sm") and the ' +
593
- "theme's card radius, not an explicit p/padding or radius. (basalt/card-inset)"
598
+ 'Card/Paper is off the card idiom — use the spacing sm/md inset together (py="sm" px="md") and ' +
599
+ "the theme's card radius, not an explicit p/padding, a lone py/px, or a radius. (basalt/card-inset)"
594
600
 
595
601
  function isStringLiteral(node) {
596
602
  return node !== null && node.type === 'Literal' && typeof node.value === 'string'
@@ -600,7 +606,7 @@ function attrValue(attr) {
600
606
  return unwrapExpressionContainer(attr.value)
601
607
  }
602
608
 
603
- // Ships: error
609
+ // Ships: warn (grace → 2.17.0)
604
610
  const cardInset = {
605
611
  meta: {
606
612
  type: 'suggestion',
@@ -612,23 +618,35 @@ const cardInset = {
612
618
  create(context) {
613
619
  return {
614
620
  JSXOpeningElement(node) {
615
- const tagName = node.name?.name
616
- if (!CARD_TAGS.has(tagName)) return
621
+ if (!CARD_TAGS.has(node.name?.name)) return
617
622
 
623
+ /** @type {Map<string, any>} */
624
+ const attrs = new Map()
618
625
  for (const attr of node.attributes) {
619
- if (attr.type !== 'JSXAttribute') continue
620
- const attrName = attr.name?.name
626
+ if (attr.type === 'JSXAttribute' && typeof attr.name?.name === 'string') {
627
+ attrs.set(attr.name.name, attr)
628
+ }
629
+ }
630
+ const isExactly = (attr, expected) => {
631
+ if (!attr) return false
621
632
  const value = attrValue(attr)
622
-
623
- const isOffPadding =
624
- (attrName === 'p' || attrName === 'padding') &&
625
- ((isStringLiteral(value) && value.value !== 'xs' && value.value !== 'sm') ||
626
- isNumericLiteral(value))
627
- const isOffPy = attrName === 'py' && isStringLiteral(value) && value.value !== 'xs'
628
- const isOffPx = attrName === 'px' && isStringLiteral(value) && value.value !== 'sm'
629
- const isRadius = attrName === 'radius'
630
-
631
- if (!isOffPadding && !isOffPy && !isOffPx && !isRadius) continue
633
+ return isStringLiteral(value) && value.value === expected
634
+ }
635
+ const py = attrs.get('py')
636
+ const px = attrs.get('px')
637
+ const offenders = []
638
+ // A uniform inset is never the idiom, in any form (string, number, expression).
639
+ for (const name of ['p', 'padding', 'radius']) {
640
+ if (attrs.has(name)) offenders.push(attrs.get(name))
641
+ }
642
+ // The pair stands or falls together: each half must be exactly its step, and neither
643
+ // may appear without the other.
644
+ const pyOk = isExactly(py, CARD_INSET_PY)
645
+ const pxOk = isExactly(px, CARD_INSET_PX)
646
+ if (py && !(pyOk && pxOk)) offenders.push(py)
647
+ if (px && !(pyOk && pxOk)) offenders.push(px)
648
+
649
+ for (const attr of offenders) {
632
650
  if (hasThemeAllow(context, attr, 'card-inset')) continue
633
651
  context.report({ node: attr, message: CARD_INSET_MESSAGE })
634
652
  }
@@ -2133,6 +2151,12 @@ function spreadSlotOwnerBinding(property) {
2133
2151
  return jsxRootName(owner.name)
2134
2152
  }
2135
2153
 
2154
+ /** The slot's prop name, spelled as {@link slotOwnerBinding} reads it (`tabs=` or `{ 'tabs': … }`). */
2155
+ function slotAttrName(attr) {
2156
+ if (attr === undefined) return undefined
2157
+ return attr.type === 'Property' ? (attr.key?.name ?? attr.key?.value) : attr.name?.name
2158
+ }
2159
+
2136
2160
  /** The home slot attribute that ENCLOSES `node`, or undefined. Stops at the attribute, never the element. */
2137
2161
  function enclosingSlotAttribute(node) {
2138
2162
  let current = node.parent
@@ -2324,6 +2348,7 @@ function createSlotContext(context) {
2324
2348
  const attr = enclosingSlotAttribute(node)
2325
2349
  return {
2326
2350
  directOwner: attr === undefined ? undefined : slotOwnerBinding(attr),
2351
+ slotName: slotAttrName(attr),
2327
2352
  declaratorName: enclosingDeclaratorName(node),
2328
2353
  subtreeHosts: ancestorTagBindings(node, BASALT_HOST_TAGS),
2329
2354
  }
@@ -2341,6 +2366,10 @@ function createSlotContext(context) {
2341
2366
  }
2342
2367
  return false
2343
2368
  },
2369
+ /** The basalt EXPORTS of the subtree homes (`FilterSet`, `PageAside`, …) a captured node sits in. */
2370
+ hostExports(captured) {
2371
+ return captured.subtreeHosts.filter((b) => homes.has(b)).map((b) => homes.get(b))
2372
+ },
2344
2373
  /** Does `name` resolve to a basalt home component in this file? */
2345
2374
  isHome(name) {
2346
2375
  return name !== undefined && homes.has(name)
@@ -3070,6 +3099,24 @@ const BOUND_CONTROL_OUTSIDE_HOME_MESSAGE =
3070
3099
  `declared non-homes and never report. ${SHELL_LESS_HOME_HINT} ` +
3071
3100
  '(basalt/bound-control-outside-home)'
3072
3101
 
3102
+ const VIEW_TABS_REFUSED_HOME_MESSAGE =
3103
+ '`ViewTabs` is not in its home. It switches a page or a section from a `tabs` slot ' +
3104
+ "(`PageBar.tabs`, `Section.tabs`), or one card's view from a `ChartCard` / `WidgetHeader` " +
3105
+ '`actions` slot; it is refused outside any slot, in every other `PageBar` slot (`actions`, ' +
3106
+ '`filters`, `filtersEnd`, `sync`), in `Section.actions` and in a `FilterSet` ' +
3107
+ '(agent/rules/basalt-controls.md). (basalt/bound-control-outside-home)'
3108
+
3109
+ /** A `ViewTabs` written directly in a refused slot — see {@link VIEW_TABS_REFUSED_HOME_MESSAGE}. */
3110
+ function viewTabsInRefusedSlot(slots, captured) {
3111
+ if (slots.hostExports(captured).includes('FilterSet')) return true
3112
+ if (captured.directOwner === undefined) return false
3113
+ const owners = slots.ownerExports(captured)
3114
+ return (
3115
+ (owners.includes('PageBar') && captured.slotName !== 'tabs') ||
3116
+ (owners.includes('Section') && captured.slotName === 'actions')
3117
+ )
3118
+ }
3119
+
3073
3120
  /**
3074
3121
  * A BOUND basalt control that is in no home at all — ledger G5 (`docs/ASIDE-SPEC.md` §2), the half
3075
3122
  * of law C1 that had no guard: `control-outside-home` matches raw Mantine tags only, so a
@@ -3142,9 +3189,17 @@ const boundControlOutsideHome = {
3142
3189
  for (const { node, root, captured, hosted } of candidates) {
3143
3190
  const exported = controls.get(root)
3144
3191
  if (exported === undefined || !BOUND_TAGS.has(exported)) continue
3145
- if (hosted || slots.resolve(captured) || slots.inSubtreeHome(captured)) continue
3192
+ if (hosted) continue
3193
+ const refused = exported === 'ViewTabs' && viewTabsInRefusedSlot(slots, captured)
3194
+ if (!refused && (slots.resolve(captured) || slots.inSubtreeHome(captured))) continue
3146
3195
  if (hasThemeAllow(context, node, 'bound-control-outside-home')) continue
3147
- context.report({ node, message: BOUND_CONTROL_OUTSIDE_HOME_MESSAGE })
3196
+ context.report({
3197
+ node,
3198
+ message:
3199
+ exported === 'ViewTabs'
3200
+ ? VIEW_TABS_REFUSED_HOME_MESSAGE
3201
+ : BOUND_CONTROL_OUTSIDE_HOME_MESSAGE,
3202
+ })
3148
3203
  }
3149
3204
  },
3150
3205
  }
@@ -4166,7 +4221,13 @@ const routeViewTransition = {
4166
4221
  *
4167
4222
  * @type {Record<string, GraceEntry>}
4168
4223
  */
4169
- export const PLUGIN_RULE_GRACE = {}
4224
+ export const PLUGIN_RULE_GRACE = {
4225
+ 'card-inset': {
4226
+ since: '2.16.0',
4227
+ promote: '2.17.0',
4228
+ why: 'Tightened in 2.16.0: only py="sm" px="md" together (or neither) passes; uniform p/padding, a lone half, numbers and expressions are findings.',
4229
+ },
4230
+ }
4170
4231
 
4171
4232
  // ── Plugin export ───────────────────────────────────────────────────────────────────────────────
4172
4233
 
@@ -225,17 +225,44 @@ describe('basalt/raw-size-literal', () => {
225
225
  // ── card-inset ───────────────────────────────────────────────────────────────
226
226
 
227
227
  describe('basalt/card-inset', () => {
228
- it('flags an off-idiom padding value on Card', () => {
229
- const { code, rules } = run(`export const C = () => <Card p="md" />\n`)
230
- expect(code).toBe(1)
228
+ it.each([
229
+ ['uniform p="lg"', '<Card p="lg" />'],
230
+ ['uniform p="md"', '<Card p="md" />'],
231
+ ['uniform p="sm"', '<Card p="sm" />'],
232
+ ['uniform padding="sm"', '<Card padding="sm" />'],
233
+ ['uniform padding={12}', '<Card padding={12} />'],
234
+ ['uniform p={0}', '<Card p={0} />'],
235
+ ['a non-literal p', '<Card p={gap} />'],
236
+ ['py="md"', '<Paper py="md" px="md" />'],
237
+ ['px="xs"', '<Paper py="sm" px="xs" />'],
238
+ ['the old xs/sm pair', '<Paper py="xs" px="sm" />'],
239
+ ['numeric py/px {8} {12}', '<Paper py={8} px={12} />'],
240
+ ['numeric py/px {13} {4}', '<Paper py={13} px={4} />'],
241
+ ['a non-literal py', '<Paper py={y} px="md" />'],
242
+ ['a non-literal px', '<Paper py="sm" px={x} />'],
243
+ ['a lone py="sm"', '<Paper py="sm" />'],
244
+ ['a lone px="md"', '<Paper px="md" />'],
245
+ ['an explicit radius', '<Card radius="md" />'],
246
+ ])('flags %s', (_name, jsx) => {
247
+ const { rules } = run(`export const C = () => ${jsx}\n`)
231
248
  expect(rules).toContain('card-inset')
232
249
  })
233
250
 
234
- it('does NOT flag the xs/sm inset idiom on Paper', () => {
235
- const { code, rules } = run(`export const C = () => <Paper py="xs" px="sm" />\n`)
236
- expect(code).toBe(0)
251
+ it.each([
252
+ ['the sm/md pair', '<Paper py="sm" px="md" />'],
253
+ ['the pair in either order', '<Card px="md" py="sm" />'],
254
+ ['no padding at all', '<Card />'],
255
+ ])('does NOT flag %s', (_name, jsx) => {
256
+ const { rules } = run(`export const C = () => ${jsx}\n`)
237
257
  expect(rules).not.toContain('card-inset')
238
258
  })
259
+
260
+ it('ships warn through its grace minor, so a flagged card does not fail the run', () => {
261
+ const { code, rules } = run(`export const C = () => <Card p="lg" />\n`)
262
+ // The fixture config sets the rule to error; the SHIPPED level is pinned by the ledger tests.
263
+ expect(rules).toContain('card-inset')
264
+ expect(code).toBe(1)
265
+ })
239
266
  })
240
267
 
241
268
  // ── chart-in-raw-surface ──────────────────────────────────────────────────────
@@ -1430,6 +1457,9 @@ describe('assertGraceLedger', () => {
1430
1457
  const pluginGrace = PLUGIN_RULE_GRACE as Record<string, GraceEntry>
1431
1458
  const guardGrace = GRACE_PERIOD_KINDS as Record<string, GraceEntry>
1432
1459
 
1460
+ /** A guard message that NAMES a plugin rule in its remedy without being that rule's twin. */
1461
+ const REFERRALS = new Set(['card-with-border:card-inset'])
1462
+
1433
1463
  function twinLanes(): Array<[kind: string, rule: string]> {
1434
1464
  const pairs = new Map<string, string>()
1435
1465
  for (const [kind, aliases] of Object.entries(WAIVER_ID_ALIASES)) {
@@ -1438,6 +1468,7 @@ function twinLanes(): Array<[kind: string, rule: string]> {
1438
1468
  }
1439
1469
  for (const [kind, rule] of Object.entries(GUARD_RULES)) {
1440
1470
  for (const m of rule.message.matchAll(/basalt\/([a-z-]+)/g)) {
1471
+ if (REFERRALS.has(`${kind}:${m[1]}`)) continue
1441
1472
  if (m[1] !== undefined && m[1] in basaltPlugin.rules) pairs.set(kind, m[1])
1442
1473
  }
1443
1474
  }
@@ -2107,6 +2138,54 @@ describe('basalt/control-outside-home', () => {
2107
2138
  expect(rules).not.toContain('control-outside-home')
2108
2139
  })
2109
2140
 
2141
+ describe('ViewTabs homes', () => {
2142
+ const IMPORTS = `import { PageBar, Section, ChartCard } from 'basalt-ui'\nimport { FilterSet, ViewTabs } from 'basalt-ui/controls'\n`
2143
+ const refused = (jsx: string): void => {
2144
+ const { rules, output } = run(`${IMPORTS}export const C = () => ${jsx}\n`)
2145
+ expect(rules).toContain('bound-control-outside-home')
2146
+ expect(output).toContain('agent/rules/basalt-controls.md')
2147
+ }
2148
+ const allowed = (jsx: string): void => {
2149
+ const { code, rules } = run(`${IMPORTS}export const C = () => ${jsx}\n`)
2150
+ expect(code).toBe(0)
2151
+ expect(rules).not.toContain('bound-control-outside-home')
2152
+ }
2153
+
2154
+ it('allows PageBar.tabs, Section.tabs and a ChartCard actions slot', () => {
2155
+ allowed('<PageBar tabs={<ViewTabs field={f} />} />')
2156
+ allowed('<Section title="x" tabs={<ViewTabs field={f} />} />')
2157
+ allowed('<ChartCard title="x" actions={<ViewTabs field={f} />} />')
2158
+ })
2159
+
2160
+ it('refuses PageBar actions / filters / filtersEnd / sync', () => {
2161
+ for (const slot of ['actions', 'filters', 'filtersEnd', 'sync']) {
2162
+ refused(`<PageBar ${slot}={<ViewTabs field={f} />} />`)
2163
+ }
2164
+ })
2165
+
2166
+ it('reads a quoted-key slot spread the way the home resolver does', () => {
2167
+ refused("<PageBar {...{ 'actions': <ViewTabs field={f} /> }} />")
2168
+ allowed("<PageBar {...{ 'tabs': <ViewTabs field={f} /> }} />")
2169
+ })
2170
+
2171
+ // Structural lint: only a ViewTabs written inside the slot is seen. Pinned so a change is deliberate.
2172
+ it('does not see a hoisted binding handed to a refused slot', () => {
2173
+ allowed('(() => { const t = <ViewTabs field={f} />; return <PageBar actions={t} /> })()')
2174
+ })
2175
+
2176
+ it('uses the ViewTabs wording for one outside any slot', () => {
2177
+ const { output } = run(
2178
+ `${IMPORTS}export const C = () => <Section title="x"><ViewTabs field={f} /></Section>\n`,
2179
+ )
2180
+ expect(output).toContain('`ViewTabs` is not in its home')
2181
+ })
2182
+
2183
+ it('refuses Section.actions and a FilterSet', () => {
2184
+ refused('<Section title="x" actions={<ViewTabs field={f} />} />')
2185
+ refused('<FilterSet><ViewTabs field={f} /></FilterSet>')
2186
+ })
2187
+ })
2188
+
2110
2189
  it('does NOT flag one inside a FilterSet subtree', () => {
2111
2190
  const { rules } = run(
2112
2191
  `import { FilterSet } from 'basalt-ui/controls'\n${MANTINE_IMPORT}` +
@@ -140,7 +140,7 @@ function MessageAffordanceRow({
140
140
  return /* @__PURE__ */ jsxs(
141
141
  Group,
142
142
  {
143
- gap: 8,
143
+ gap: "xs",
144
144
  "data-testid": `message-affordances-${message.id}`,
145
145
  style: { opacity: visible ? 1 : 0, transition: "opacity 120ms ease" },
146
146
  children: [
@@ -96,7 +96,7 @@ function ThreadOutcomeCard({
96
96
  className: cx(className),
97
97
  style: {
98
98
  display: "block",
99
- padding: "var(--mantine-spacing-xs) var(--mantine-spacing-sm)",
99
+ padding: "var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)",
100
100
  borderRadius: VX.radiusCard,
101
101
  boxShadow: VX.shadowCard,
102
102
  backgroundColor: background,
@@ -53,7 +53,7 @@ const bodyClipStyle = {
53
53
  minHeight: 0,
54
54
  display: "flex",
55
55
  flexDirection: "column",
56
- padding: "2px var(--vx-space-card-inset-x, 0.8125rem) var(--vx-space-card-inset-y, 0.6875rem)"
56
+ padding: "2px var(--vx-space-card-inset-x, 1rem) var(--vx-space-card-inset-y, 0.75rem)"
57
57
  };
58
58
  const definedOnly = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
59
59
  const HEADER_TRIGGERS = ["title", "info", "value", "icon", "count"];
@@ -7,12 +7,12 @@
7
7
  */
8
8
 
9
9
  .header {
10
- padding: 4px var(--vx-space-card-inset-x, 0.8125rem) 4px;
10
+ padding: 4px var(--vx-space-card-inset-x, 1rem) 4px;
11
11
  }
12
12
 
13
13
  @container (min-width: 480px) {
14
14
  .header {
15
- padding-top: var(--vx-space-card-inset-y, 0.6875rem);
15
+ padding-top: var(--vx-space-card-inset-y, 0.75rem);
16
16
  }
17
17
  }
18
18
 
@@ -25,10 +25,10 @@ export type SignedSeries<T> = ChartSeries<T> & {
25
25
  colorNegative?: string | undefined;
26
26
  };
27
27
  /**
28
- * A line series' key: a stroke with its dash, compact below 480px and wide from 480px. Both are at
29
- * least 14px with two or more clear dashes: a shorter key reads as two dots. A
30
- * dashed swatch has BUTT caps: a round cap grows each dash by half the stroke width per end and
31
- * would close the gap.
28
+ * A line series' key: a stroke with its dash, compact below 480px of CHART width (a container
29
+ * query, not the viewport) and wide from 480px. Both are at least 14px with two or more clear
30
+ * dashes: a shorter key reads as two dots. A dashed swatch has BUTT caps: a round cap grows each
31
+ * dash by half the stroke width per end and would close the gap.
32
32
  */
33
33
  export declare const LINE_SWATCH: {
34
34
  readonly compact: {
@@ -0,0 +1,25 @@
1
+ export declare const BOARD_NOTICE = "UI changed since the last board \u2014 run basalt-ui shot <routes> and the basalt-design-reviewer (/basalt-design)";
2
+ export declare const PLAYWRIGHT_INSTALL = "bun add -d playwright && bunx playwright install chromium";
3
+ /**
4
+ * The notice line when a UI file is newer than the last board, no valid board exists, or the walk
5
+ * hit its cap (unknown is reported, never "fresh"); else null. The signal is mtime-based, so a
6
+ * checkout or rebase can fire it on unchanged UI — a documented trade-off for a stat-only check.
7
+ */
8
+ export declare function staleBoardNotice(cwd: string, roots: string[], walkCap?: number): string | null;
9
+ /** Loads `<id>/package.json` from the consumer; throws when unresolvable. Injectable for tests. */
10
+ export type PackageLoader = (id: string) => {
11
+ version?: string;
12
+ };
13
+ /** The consumer's Playwright version (`playwright`, then `playwright-core`), or null when absent. */
14
+ export declare function playwrightVersion(cwd: string, load?: PackageLoader): string | null;
15
+ /** Test seams for {@link designLoopLines}. */
16
+ export type DesignLoopProbes = {
17
+ notice?: (cwd: string, roots: string[]) => string | null;
18
+ playwright?: (cwd: string) => string | null;
19
+ };
20
+ /**
21
+ * Doctor's design-loop section: advisory info lines only. They never count as a warning, so they
22
+ * cannot change doctor's verdict or its "All checks passed" line.
23
+ */
24
+ export declare function designLoopLines(cwd: string, roots: string[], probes?: DesignLoopProbes): string[];
25
+ //# sourceMappingURL=board-freshness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-freshness.d.ts","sourceRoot":"","sources":["../../src/cli/board-freshness.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,uHACwF,CAAA;AACjH,eAAO,MAAM,kBAAkB,8DAA8D,CAAA;AAwD7F;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,GAAE,MAAiB,GACzB,MAAM,GAAG,IAAI,CAMf;AAED,mGAAmG;AACnG,MAAM,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhE,qGAAqG;AACrG,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,aAA2D,GAChE,MAAM,GAAG,IAAI,CASf;AAED,8CAA8C;AAC9C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,MAAM,GAAG,IAAI,CAAA;IACxD,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;CAC5C,CAAA;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,GAAE,gBAAqB,GAC5B,MAAM,EAAE,CAWV"}
@@ -0,0 +1,88 @@
1
+ import { readFileSync, readdirSync, statSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { join, resolve } from "node:path";
4
+ const LAST_SHOT = join(".basalt", "shots", "last.json");
5
+ const SKIPPED_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", ".git", ".basalt"]);
6
+ const UI_FILE = /\.(tsx|css)$/;
7
+ const WALK_CAP = 5e3;
8
+ const BOARD_NOTICE = "UI changed since the last board \u2014 run basalt-ui shot <routes> and the basalt-design-reviewer (/basalt-design)";
9
+ const PLAYWRIGHT_INSTALL = "bun add -d playwright && bunx playwright install chromium";
10
+ function mtimeOf(path) {
11
+ try {
12
+ return statSync(path, { throwIfNoEntry: false })?.mtimeMs ?? null;
13
+ } catch {
14
+ return null;
15
+ }
16
+ }
17
+ function walkUi(cwd, roots, cap) {
18
+ const walk = { newest: null, truncated: false };
19
+ const stack = roots.map((root) => resolve(cwd, root));
20
+ let visited = 0;
21
+ for (let dir = stack.pop(); dir !== void 0; dir = stack.pop()) {
22
+ if (++visited > cap) return { ...walk, truncated: true };
23
+ let entries;
24
+ try {
25
+ entries = readdirSync(dir, { withFileTypes: true });
26
+ } catch (error) {
27
+ if (error.code !== "ENOENT") walk.truncated = true;
28
+ continue;
29
+ }
30
+ for (const entry of entries) {
31
+ const path = join(dir, entry.name);
32
+ if (entry.isDirectory()) {
33
+ if (!SKIPPED_DIRS.has(entry.name)) stack.push(path);
34
+ continue;
35
+ }
36
+ if (!UI_FILE.test(entry.name)) continue;
37
+ if (++visited > cap) return { ...walk, truncated: true };
38
+ const mtime = mtimeOf(path);
39
+ if (mtime !== null && (walk.newest === null || mtime > walk.newest)) walk.newest = mtime;
40
+ }
41
+ }
42
+ return walk;
43
+ }
44
+ function lastBoardAt(cwd) {
45
+ try {
46
+ const last = JSON.parse(readFileSync(resolve(cwd, LAST_SHOT), "utf8"));
47
+ if (typeof last !== "object" || last === null) return null;
48
+ const at = last.at;
49
+ if (typeof at !== "string") return null;
50
+ const ms = Date.parse(at);
51
+ return Number.isNaN(ms) ? null : ms;
52
+ } catch {
53
+ return null;
54
+ }
55
+ }
56
+ function staleBoardNotice(cwd, roots, walkCap = WALK_CAP) {
57
+ const { newest, truncated } = walkUi(cwd, roots, walkCap);
58
+ if (truncated) return BOARD_NOTICE;
59
+ if (newest === null) return null;
60
+ const at = lastBoardAt(cwd);
61
+ return at === null || newest > at ? BOARD_NOTICE : null;
62
+ }
63
+ function playwrightVersion(cwd, load = createRequire(resolve(cwd, "package.json"))) {
64
+ for (const name of ["playwright", "playwright-core"]) {
65
+ try {
66
+ return load(`${name}/package.json`).version ?? "unknown";
67
+ } catch {
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ function designLoopLines(cwd, roots, probes = {}) {
73
+ const lines = [];
74
+ const notice = (probes.notice ?? staleBoardNotice)(cwd, roots);
75
+ if (notice !== null) lines.push(` \u2192 ${notice}`);
76
+ const playwright = (probes.playwright ?? playwrightVersion)(cwd);
77
+ lines.push(
78
+ playwright === null ? ` \u2192 playwright is not installed (optional, needed by basalt-ui shot): ${PLAYWRIGHT_INSTALL}` : ` \u2713 playwright resolves (${playwright === "unknown" ? "version unknown" : playwright}; optional: basalt-ui shot)`
79
+ );
80
+ return lines;
81
+ }
82
+ export {
83
+ BOARD_NOTICE,
84
+ PLAYWRIGHT_INSTALL,
85
+ designLoopLines,
86
+ playwrightVersion,
87
+ staleBoardNotice
88
+ };
@@ -1,3 +1,4 @@
1
+ import type { DesignLoopProbes } from './board-freshness.js';
1
2
  export type DoctorResult = {
2
3
  /** Number of hard failures (exit non-zero). */
3
4
  hardFailures: number;
@@ -33,5 +34,5 @@ export type DoctorResult = {
33
34
  *
34
35
  * Returns the exit code: 0 = all good, 1 = one or more hard failures or skipped checks.
35
36
  */
36
- export declare function doctor(invocationCwd?: string, flags?: string[]): number;
37
+ export declare function doctor(invocationCwd?: string, flags?: string[], designLoop?: DesignLoopProbes): number;
37
38
  //# sourceMappingURL=doctor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AA8DA,MAAM,MAAM,YAAY,GAAG;IACzB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA2BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CAAC,aAAa,GAAE,MAAsB,EAAE,KAAK,GAAE,MAAM,EAAO,GAAG,MAAM,CA+T1F"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AA4BzD,MAAM,MAAM,YAAY,GAAG;IACzB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA2BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CACpB,aAAa,GAAE,MAAsB,EACrC,KAAK,GAAE,MAAM,EAAO,EACpB,UAAU,GAAE,gBAAqB,GAChC,MAAM,CAkUR"}
@@ -27,6 +27,7 @@ import {
27
27
  scannableFiles,
28
28
  shippedAssetPath
29
29
  } from "./index.js";
30
+ import { designLoopLines } from "./board-freshness.js";
30
31
  import { parseJsonc } from "./source-text.js";
31
32
  import { resolveRoots } from "./config.js";
32
33
  import {
@@ -65,7 +66,7 @@ function aiMajorsAt(dir) {
65
66
  }
66
67
  return out;
67
68
  }
68
- function doctor(invocationCwd = process.cwd(), flags = []) {
69
+ function doctor(invocationCwd = process.cwd(), flags = [], designLoop = {}) {
69
70
  if (conflictingProfileFlags("doctor", flags)) return 1;
70
71
  const project = resolveProjectDir(invocationCwd);
71
72
  const aboveRoot = project.relocatedFrom === null ? installRootAbove(project.dir) : null;
@@ -294,6 +295,7 @@ basalt-ui doctor \u2014 ${cwd}
294
295
  if (shell.fail !== null) fail(shell.fail);
295
296
  for (const line of shell.warnings) warn(line);
296
297
  }
298
+ if (profile !== "tokens-only") lines.push(...designLoopLines(cwd, resolveRoots(cfg), designLoop));
297
299
  lines.push("");
298
300
  if (result.hardFailures === 0 && result.warnings === 0 && result.skipped === 0) {
299
301
  lines.push("All checks passed.");
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,CA+B1F,CAAA;AAED;yCACyC;AACzC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAWhF;AAED,0GAA0G;AAC1G,eAAO,MAAM,KAAK,QAkC0E,CAAA"}
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,CAqC1F,CAAA;AAED;yCACyC;AACzC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAWhF;AAED,0GAA0G;AAC1G,eAAO,MAAM,KAAK,QAwC0E,CAAA"}
package/dist/cli/help.js CHANGED
@@ -29,13 +29,19 @@ const COMMAND_OPTIONS = {
29
29
  "media-fallback": { type: "boolean" },
30
30
  only: { type: "string" }
31
31
  },
32
- "fonts:css": { out: { type: "string" }, check: { type: "boolean" } }
32
+ "fonts:css": { out: { type: "string" }, check: { type: "boolean" } },
33
+ shot: {
34
+ base: { type: "string" },
35
+ dist: { type: "string" },
36
+ out: { type: "string" },
37
+ states: { type: "string" }
38
+ }
33
39
  };
34
40
  function unknownFlag(cmd, flags) {
35
41
  const options = COMMAND_OPTIONS[cmd];
36
42
  if (options === void 0) return null;
37
43
  try {
38
- parseArgs({ args: [...flags], options, strict: true, allowPositionals: false });
44
+ parseArgs({ args: [...flags], options, strict: true, allowPositionals: cmd === "shot" });
39
45
  return null;
40
46
  } catch (err) {
41
47
  const message = err instanceof Error ? err.message : String(err);
@@ -43,7 +49,7 @@ function unknownFlag(cmd, flags) {
43
49
  return match?.[1] ?? flags.find((f) => f.startsWith("-")) ?? flags[0] ?? null;
44
50
  }
45
51
  }
46
- const USAGE = "Usage: basalt-ui <--version | init [--no-merge-lint] |\n sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n check-theme [--audit-allows] |\n doctor [--tokens-only|--framework] | guard-hook | tokens:css | fonts:css | help>\n\ncheck-theme [--tokens-only|--framework] [--audit-allows]\n --audit-allows reports instead of scanning: every `theme-allow` annotation and every\n `basalt.exemptRules` entry, with what each one still suppresses \u2014 proved by re-running the\n guard with that one waiver neutralized, not by reading its text. Exits 1 on a waiver that\n suppresses nothing (dead), which is what makes it usable as a CI gate.\n\ntokens:css [--out <path>] [--check] [--selector-attribute <attr> | --selector-class <class>]\n [--light-class <class>] [--dark-value <v>] [--light-value <v>]\n [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n Emit the --vx-* stylesheet (stdout unless --out). Defaults emit the stock identity; commit the output as your tokens file.\n --selector-class emits `:root.dark` instead of an attribute selector (the Tailwind convention).\n --check writes nothing and exits 1 when --out differs from what would be emitted (a CI gate).\n\nfonts:css [--out <path>] [--check]\n Emit the shipped --basalt-font-* stacks as plain CSS \u2014 the typeface half of the token layer,\n otherwise reachable only by importing styles.css.\n\ndoctor [--tokens-only|--framework]\n Checks THIS project only: the manifest exists, the oxlint preset is wired, the pre-commit\n hook runs check-theme (via `lefthook dump`), and the ai package major is consistent within\n this package.json. Profile is DECLARED, same as check-theme \u2014 never inferred.\n\nsync [--force] [--check] [--verbose] [--tokens-only|--framework]\n Refreshes an EXISTING install; it never creates one (that is init). A tokens-only consumer\n has no scaffold to reconcile, so sync reports n/a and exits 0 there \u2014 as doctor does.\n --check prints the permanent placement skips as a COUNT; --verbose spells them out again.\n\ncheck-theme / doctor / sync all resolve their project the same way: BASALT_CWD, else the\ninvocation cwd \u2014 nothing inferred, nothing ascended or descended into.\n--tokens-only and --framework are alternatives; passing both is an error.\n\nEvery subcommand accepts --help / -h to print this message and exit without running.\n--version / -v prints the resolved package version and exits 0 \u2014 the one command that proves\nWHICH basalt-ui ran, which a `bunx` cache can otherwise make a lie. An unknown command or an\nunrecognized flag exits 1 and names what it did not understand; neither is ever ignored.";
52
+ const USAGE = "Usage: basalt-ui <--version | init [--no-merge-lint] |\n sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n check-theme [--audit-allows] |\n doctor [--tokens-only|--framework] | guard-hook | tokens:css | fonts:css |\n shot <route\u2026> | help>\n\ncheck-theme [--tokens-only|--framework] [--audit-allows]\n --audit-allows reports instead of scanning: every `theme-allow` annotation and every\n `basalt.exemptRules` entry, with what each one still suppresses \u2014 proved by re-running the\n guard with that one waiver neutralized, not by reading its text. Exits 1 on a waiver that\n suppresses nothing (dead), which is what makes it usable as a CI gate.\n\ntokens:css [--out <path>] [--check] [--selector-attribute <attr> | --selector-class <class>]\n [--light-class <class>] [--dark-value <v>] [--light-value <v>]\n [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n Emit the --vx-* stylesheet (stdout unless --out). Defaults emit the stock identity; commit the output as your tokens file.\n --selector-class emits `:root.dark` instead of an attribute selector (the Tailwind convention).\n --check writes nothing and exits 1 when --out differs from what would be emitted (a CI gate).\n\nfonts:css [--out <path>] [--check]\n Emit the shipped --basalt-font-* stacks as plain CSS \u2014 the typeface half of the token layer,\n otherwise reachable only by importing styles.css.\n\nshot <route\u2026> (--base <url> | --dist <dir>) [--out <dir>] [--states <list>]\n Render routes in Chromium (Playwright from YOUR project: bun add -d playwright) and write\n board.html, metrics.json and png/* \u2014 every data-shot anchor \xD7 light/dark \xD7 desktop/mobile \xD7\n rest, hover, focus, tooltip, empty, loading, error. --dist serves a built SPA dir itself.\n Default --out .basalt/shots (emptied each run); .basalt/shots/last.json names the last out dir.\n\ndoctor [--tokens-only|--framework]\n Checks THIS project only: the manifest exists, the oxlint preset is wired, the pre-commit\n hook runs check-theme (via `lefthook dump`), and the ai package major is consistent within\n this package.json. Profile is DECLARED, same as check-theme \u2014 never inferred.\n\nsync [--force] [--check] [--verbose] [--tokens-only|--framework]\n Refreshes an EXISTING install; it never creates one (that is init). A tokens-only consumer\n has no scaffold to reconcile, so sync reports n/a and exits 0 there \u2014 as doctor does.\n --check prints the permanent placement skips as a COUNT; --verbose spells them out again.\n\ncheck-theme / doctor / sync all resolve their project the same way: BASALT_CWD, else the\ninvocation cwd \u2014 nothing inferred, nothing ascended or descended into.\n--tokens-only and --framework are alternatives; passing both is an error.\n\nEvery subcommand accepts --help / -h to print this message and exit without running.\n--version / -v prints the resolved package version and exits 0 \u2014 the one command that proves\nWHICH basalt-ui ran, which a `bunx` cache can otherwise make a lie. An unknown command or an\nunrecognized flag exits 1 and names what it did not understand; neither is ever ignored.";
47
53
  export {
48
54
  COMMAND_OPTIONS,
49
55
  USAGE,
@@ -132,6 +132,8 @@ type TemplateVars = {
132
132
  SERIES_MODULE_PATH: string;
133
133
  /** The consumer's configured roots as space-separated quoted oxfmt globs, e.g. `'apps/web/src/**'`. */
134
134
  ROOTS_GLOBS: string;
135
+ /** The roots a rule's `paths:` renders from: `basalt.roots` (init/sync write the inferred ones first), else {@link LEGACY_RULE_ROOTS}. */
136
+ RULE_ROOTS: string[];
135
137
  /** Path to the shipped oxlint preset from the consumer dir — RESOLVED, never assumed at the root. */
136
138
  OXLINT_PRESET_PATH: string;
137
139
  /** Path to the shipped lefthook preset from the consumer dir — same resolution. */
@@ -167,6 +169,13 @@ export declare function basaltBinCommand(install: BasaltInstall, cwd: string): s
167
169
  * lint/theme/format steps. Without one, the built-in steps run. Rendered at `{{GATE_STEPS}}`.
168
170
  */
169
171
  export declare function ciGateSteps(cwd: string): string;
172
+ /**
173
+ * A rule's front-matter `paths:` block rendered from `roots`: one `'<root>/**'` item per root,
174
+ * normalised (no `./`, no trailing slash) and single-quoted for YAML. Only the leading `---…---`
175
+ * block is touched. Front matter without `paths:` is returned unchanged; a `paths:` that is not the
176
+ * expected list shape, or a root that would match everywhere (`''`, `/`, absolute), throws.
177
+ */
178
+ export declare function renderRulePaths(text: string, roots: readonly string[]): string;
170
179
  /** True when both paths resolve to one file (a symlinked pair). A missing path is simply "no". */
171
180
  export declare function sameFile(a: string, b: string): boolean;
172
181
  /** True when the host text carries a managed block (begin marker present). */
@@ -342,7 +351,12 @@ export declare function writeUnit(file: ManagedFile, cwd: string, desired: strin
342
351
  export declare function classify(state: UnitState, manifestHash: string | undefined): Classification;
343
352
  export declare function diffSummary(file: ManagedFile, state: UnitState): string;
344
353
  /** Build the render context for a run from the package root + consumer cwd/config. */
345
- export declare function renderContext(cwd: string): RenderContext;
354
+ export declare function renderContext(cwd: string, ruleRoots?: readonly string[]): RenderContext;
355
+ /**
356
+ * The rule roots a run renders with: what `reconcileRoots` wrote, or — on `--check`, which writes
357
+ * nothing — what a real sync would have written, so check and write never disagree.
358
+ */
359
+ export declare function ruleRootsFor(state: RootsState): readonly string[] | undefined;
346
360
  /**
347
361
  * Read → mutate → write the consumer's package.json, preserving its own indentation and trailing
348
362
  * newline. `mutate` returns false to abort the write (nothing to change). Returns whether a write