basalt-ui 2.8.0 → 2.9.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 (179) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +209 -189
  3. package/MIGRATING.md +98 -28
  4. package/README.md +7 -8
  5. package/agent/rules/basalt-controls.md +1 -1
  6. package/agent/rules/basalt-state.md +1 -1
  7. package/agent/skills/basalt-design/SKILL.md +1 -1
  8. package/agent/templates/AGENTS-block.md.tpl +2 -2
  9. package/configs/oxlint-plugin.js +25 -68
  10. package/configs/oxlint-plugin.test.ts +19 -27
  11. package/dist/charts/BandStrip.d.ts +1 -1
  12. package/dist/charts/BandStrip.d.ts.map +1 -1
  13. package/dist/charts/BandStrip.js +1 -10
  14. package/dist/charts/MirroredBars.d.ts.map +1 -1
  15. package/dist/charts/MirroredBars.js +2 -9
  16. package/dist/charts/band-fold.d.ts +15 -0
  17. package/dist/charts/band-fold.d.ts.map +1 -0
  18. package/dist/charts/band-fold.js +19 -0
  19. package/dist/charts/index.d.ts +1 -0
  20. package/dist/charts/index.d.ts.map +1 -1
  21. package/dist/charts/index.js +3 -1
  22. package/dist/cli/audit-allows.d.ts.map +1 -1
  23. package/dist/cli/audit-allows.js +1 -1
  24. package/dist/cli/check-theme.d.ts.map +1 -1
  25. package/dist/cli/check-theme.js +4 -1
  26. package/dist/cli/config.d.ts +4 -4
  27. package/dist/cli/doctor-upgrade.d.ts +5 -4
  28. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  29. package/dist/cli/doctor-upgrade.js +23 -99
  30. package/dist/cli/doctor.d.ts +2 -1
  31. package/dist/cli/doctor.d.ts.map +1 -1
  32. package/dist/cli/doctor.js +23 -25
  33. package/dist/cli/help.d.ts.map +1 -1
  34. package/dist/cli/help.js +2 -3
  35. package/dist/cli/index.d.ts +15 -6
  36. package/dist/cli/index.d.ts.map +1 -1
  37. package/dist/cli/index.js +16 -27
  38. package/dist/cli/init.d.ts.map +1 -1
  39. package/dist/cli/init.js +9 -6
  40. package/dist/cli/install-root.d.ts +10 -0
  41. package/dist/cli/install-root.d.ts.map +1 -0
  42. package/dist/cli/install-root.js +32 -0
  43. package/dist/cli/router-wiring.d.ts +37 -0
  44. package/dist/cli/router-wiring.d.ts.map +1 -0
  45. package/dist/cli/router-wiring.js +116 -0
  46. package/dist/cli/source-text.d.ts +12 -0
  47. package/dist/cli/source-text.d.ts.map +1 -0
  48. package/dist/cli/source-text.js +46 -0
  49. package/dist/cli/sync.d.ts +0 -2
  50. package/dist/cli/sync.d.ts.map +1 -1
  51. package/dist/cli/sync.js +23 -21
  52. package/dist/cli/tokens-css.d.ts.map +1 -1
  53. package/dist/cli/tokens-css.js +1 -6
  54. package/dist/common/errors.d.ts +1 -6
  55. package/dist/common/errors.d.ts.map +1 -1
  56. package/dist/common/errors.js +0 -7
  57. package/dist/common/index.d.ts +1 -1
  58. package/dist/common/index.d.ts.map +1 -1
  59. package/dist/common/index.js +1 -9
  60. package/dist/common/props.d.ts +2 -2
  61. package/dist/common/vx-family.d.ts +1 -1
  62. package/dist/content/code-block.d.ts.map +1 -1
  63. package/dist/content/code-block.js +36 -27
  64. package/dist/content/code-block.module.css +19 -1
  65. package/dist/content/mermaid-sanitize.d.ts +15 -0
  66. package/dist/content/mermaid-sanitize.d.ts.map +1 -0
  67. package/dist/content/mermaid-sanitize.js +28 -0
  68. package/dist/content/mermaid.d.ts +6 -0
  69. package/dist/content/mermaid.d.ts.map +1 -1
  70. package/dist/content/mermaid.js +3 -1
  71. package/dist/content/toc-click-pin.d.ts +45 -0
  72. package/dist/content/toc-click-pin.d.ts.map +1 -0
  73. package/dist/content/toc-click-pin.js +111 -0
  74. package/dist/content/toc-spy.d.ts +25 -0
  75. package/dist/content/toc-spy.d.ts.map +1 -0
  76. package/dist/content/toc-spy.js +43 -0
  77. package/dist/content/toc.d.ts +1 -4
  78. package/dist/content/toc.d.ts.map +1 -1
  79. package/dist/content/toc.js +38 -49
  80. package/dist/controls/number-filter.d.ts.map +1 -1
  81. package/dist/controls/number-filter.js +1 -1
  82. package/dist/dashboard/index.d.ts +1 -1
  83. package/dist/dashboard/index.d.ts.map +1 -1
  84. package/dist/dashboard/index.js +1 -3
  85. package/dist/dashboard/section.d.ts +10 -2
  86. package/dist/dashboard/section.d.ts.map +1 -1
  87. package/dist/dashboard/section.js +20 -3
  88. package/dist/dashboard/stat-card.d.ts +2 -8
  89. package/dist/dashboard/stat-card.d.ts.map +1 -1
  90. package/dist/dashboard/stat-card.js +1 -1
  91. package/dist/guard/index.d.ts +13 -9
  92. package/dist/guard/index.d.ts.map +1 -1
  93. package/dist/guard/index.js +74 -37
  94. package/dist/guard/types.d.ts +8 -7
  95. package/dist/guard/types.d.ts.map +1 -1
  96. package/dist/guard/vx-names.d.ts +1 -1
  97. package/dist/guard/vx-names.d.ts.map +1 -1
  98. package/dist/guard/vx-names.js +1 -33
  99. package/dist/index.d.ts +2 -2
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/provider/index.d.ts.map +1 -1
  102. package/dist/provider/index.js +3 -2
  103. package/dist/router-tanstack/search-store.d.ts +1 -11
  104. package/dist/router-tanstack/search-store.d.ts.map +1 -1
  105. package/dist/router-tanstack/search-store.js +1 -2
  106. package/dist/shell/index.d.ts +1 -0
  107. package/dist/shell/index.d.ts.map +1 -1
  108. package/dist/shell/index.js +3 -0
  109. package/dist/shell/nav-types.d.ts +1 -1
  110. package/dist/shell/page-bar.d.ts +6 -0
  111. package/dist/shell/page-bar.d.ts.map +1 -1
  112. package/dist/shell/page-bar.js +12 -2
  113. package/dist/state/fields.d.ts +1 -1
  114. package/dist/state/fields.d.ts.map +1 -1
  115. package/dist/state/fields.js +3 -1
  116. package/dist/surfaces.d.ts +1 -1
  117. package/dist/surfaces.d.ts.map +1 -1
  118. package/dist/surfaces.js +5 -11
  119. package/dist/table/data-table.d.ts +2 -2
  120. package/dist/tokens/core.d.ts +0 -10
  121. package/dist/tokens/core.d.ts.map +1 -1
  122. package/dist/tokens/core.js +6 -44
  123. package/dist/vite-boot.d.ts +25 -0
  124. package/dist/vite-boot.d.ts.map +1 -0
  125. package/dist/vite-boot.js +36 -0
  126. package/dist/vite.d.ts +24 -3
  127. package/dist/vite.d.ts.map +1 -1
  128. package/dist/vite.js +7 -16
  129. package/llms.txt +26 -9
  130. package/package.json +8 -5
  131. package/src/charts/BandStrip.tsx +4 -16
  132. package/src/charts/MirroredBars.tsx +2 -11
  133. package/src/charts/band-fold.ts +26 -0
  134. package/src/charts/index.ts +1 -0
  135. package/src/cli/audit-allows.ts +1 -3
  136. package/src/cli/check-theme.ts +7 -1
  137. package/src/cli/config.ts +4 -4
  138. package/src/cli/doctor-upgrade.ts +29 -145
  139. package/src/cli/doctor.ts +25 -31
  140. package/src/cli/help.ts +1 -4
  141. package/src/cli/index.ts +27 -43
  142. package/src/cli/init.ts +9 -6
  143. package/src/cli/install-root.ts +40 -0
  144. package/src/cli/router-wiring.ts +185 -0
  145. package/src/cli/source-text.ts +62 -0
  146. package/src/cli/sync.ts +26 -22
  147. package/src/cli/tokens-css.ts +0 -5
  148. package/src/common/errors.ts +1 -18
  149. package/src/common/index.ts +1 -8
  150. package/src/common/props.ts +2 -2
  151. package/src/common/vx-family.ts +1 -1
  152. package/src/content/code-block.module.css +19 -1
  153. package/src/content/code-block.tsx +7 -2
  154. package/src/content/mermaid-sanitize.ts +49 -0
  155. package/src/content/mermaid.tsx +3 -2
  156. package/src/content/toc-click-pin.ts +156 -0
  157. package/src/content/toc-spy.ts +61 -0
  158. package/src/content/toc.tsx +47 -95
  159. package/src/controls/form-layout.tsx +1 -1
  160. package/src/controls/number-filter.tsx +6 -1
  161. package/src/dashboard/index.ts +1 -6
  162. package/src/dashboard/section.tsx +39 -8
  163. package/src/dashboard/stat-card.tsx +4 -11
  164. package/src/guard/index.ts +114 -89
  165. package/src/guard/types.ts +8 -7
  166. package/src/guard/vx-names.ts +1 -33
  167. package/src/index.ts +1 -2
  168. package/src/provider/index.tsx +6 -3
  169. package/src/router-tanstack/search-store.ts +2 -14
  170. package/src/shell/index.tsx +2 -0
  171. package/src/shell/nav-types.ts +1 -1
  172. package/src/shell/page-bar.tsx +21 -2
  173. package/src/state/fields.ts +7 -2
  174. package/src/surfaces.ts +5 -11
  175. package/src/table/data-table.tsx +2 -2
  176. package/src/tokens/core.ts +6 -67
  177. package/src/vite-boot.ts +109 -0
  178. package/src/vite.ts +32 -61
  179. package/dist/tokens.css +0 -331
@@ -1 +1 @@
1
- {"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../src/charts/MirroredBars.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,EAAW,MAAM,SAAS,CAAA;AAEhF,4BAA4B;AAC5B,MAAM,MAAM,eAAe,GAAG;IAC5B;8EAC0E;IAC1E,GAAG,EAAE,MAAM,CAAA;IACX,+FAA+F;IAC/F,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACjC,sGAAsG;IACtG,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,2DAA2D;IAC3D,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAC9B,CAAA;AAED,oGAAoG;AACpG,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,IAAI,CACtC,WAAW,CAAC,CAAC,CAAC,EACd,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChG,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAChE,mBAAmB,C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,GAAG,SAAS,CAAA;IAClD,6FAA6F;IAC7F,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;IAC9C;;;OAGG;IACH,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;KAAE,GAAG,SAAS,CAAA;IAC/E,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAA;CAC7E,CAAA;AAsCD,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EACvD,KAAK,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC7B,YAAY,CA0Kd"}
@@ -10,6 +10,7 @@ import { defaultFormatX, defaultNumberFormat, seriesRow, visibleSeries } from ".
10
10
  import { barMark, emphasis } from "./marks.js";
11
11
  import { PanelRung, chartHeightOf, paneX, paneY, rowsOf } from "./panel.js";
12
12
  import { xScaleFor } from "./scales.js";
13
+ import { foldBands } from "./band-fold.js";
13
14
  import { rowX } from "./types.js";
14
15
  const DEFAULT_UP_FRACTION = 0.35;
15
16
  const DEFAULT_PANE_TICKS = 3;
@@ -17,14 +18,6 @@ const DEFAULT_MIN_BAND_PX = 3;
17
18
  const BAR_OPACITY = 1;
18
19
  const BAND_FILL = 0.8;
19
20
  const clamp01 = (v) => v === void 0 || !Number.isFinite(v) ? 0 : Math.min(Math.max(v, 0), 1);
20
- function fold(data, cap, merge) {
21
- if (cap <= 0) return [];
22
- if (data.length <= cap) return [...data];
23
- const size = Math.ceil(data.length / cap);
24
- const out = [];
25
- for (let i = 0; i < data.length; i += size) out.push(merge(data.slice(i, i + size)));
26
- return out;
27
- }
28
21
  function paneMax(pane, s, data, on) {
29
22
  if (pane.max !== void 0 && pane.max !== "auto") return pane.max || 1;
30
23
  if (!on) return 1;
@@ -55,7 +48,7 @@ function MirroredBars(props) {
55
48
  ({ hidden, highlighted, width }) => {
56
49
  const upSeries = assertPaneKey("up", up.key, bars);
57
50
  const downSeries = assertPaneKey("down", down.key, bars);
58
- const drawn = foldConfig ? fold(
51
+ const drawn = foldConfig ? foldBands(
59
52
  data,
60
53
  Math.floor(width / (foldConfig.minBandPx ?? DEFAULT_MIN_BAND_PX)),
61
54
  foldConfig.merge
@@ -0,0 +1,15 @@
1
+ /** A run of adjacent slots drawn as one band; `items` are the source data it stands for. */
2
+ export type Group<T> = {
3
+ start: number;
4
+ items: T[];
5
+ };
6
+ /** Adjacent data in groups of equal size, the last possibly shorter, at most `cap` groups. */
7
+ export declare function groupsOf<T>(data: readonly T[], cap: number): Group<T>[];
8
+ /**
9
+ * The width-driven fold `BandStrip` and `MirroredBars` run: at most `cap` slots, adjacent data
10
+ * merged in equal runs by the consumer's `merge` (a lone datum passes through unmerged). Exported
11
+ * so a consumer can test its `merge` against the real grouping; `cap` is
12
+ * `floor(width / minBandPx)`.
13
+ */
14
+ export declare function foldBands<T>(data: readonly T[], cap: number, merge: (group: T[]) => T): T[];
15
+ //# sourceMappingURL=band-fold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"band-fold.d.ts","sourceRoot":"","sources":["../../src/charts/band-fold.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAA;AAEpD,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CASvE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAI3F"}
@@ -0,0 +1,19 @@
1
+ function groupsOf(data, cap) {
2
+ const size = Math.max(1, Math.ceil(data.length / Math.max(cap, 1)));
3
+ const out = [];
4
+ data.forEach((d, i) => {
5
+ const last = out.at(-1);
6
+ if (last && last.items.length < size) last.items.push(d);
7
+ else out.push({ start: i, items: [d] });
8
+ });
9
+ return out;
10
+ }
11
+ function foldBands(data, cap, merge) {
12
+ if (cap <= 0) return [];
13
+ if (data.length <= cap) return [...data];
14
+ return groupsOf(data, cap).map((g) => merge(g.items));
15
+ }
16
+ export {
17
+ foldBands,
18
+ groupsOf
19
+ };
@@ -11,6 +11,7 @@ export { Bars, type BarsProps, type BarsBar, type BarsLine } from './Bars.js';
11
11
  export { StackedArea, type StackedAreaProps, type StackedAreaBand } from './StackedArea.js';
12
12
  export { Sparkline, type SparklineProps } from './Sparkline.js';
13
13
  export { BandStrip, type BandStripProps, type BandStripSeries, type BandSpan, type BandFold, } from './BandStrip.js';
14
+ export { foldBands } from './band-fold.js';
14
15
  export { Donut, type DonutProps, type DonutDatum } from './Donut.js';
15
16
  export { Heatmap, type HeatmapProps } from './Heatmap.js';
16
17
  export { DualPanel, type DualPanelProps, type DualPanelLine, type DualPanelBar } from './DualPanel.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAC1E,OAAO,EA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
@@ -6,6 +6,7 @@ import { Sparkline } from "./Sparkline.js";
6
6
  import {
7
7
  BandStrip
8
8
  } from "./BandStrip.js";
9
+ import { foldBands } from "./band-fold.js";
9
10
  import { Donut } from "./Donut.js";
10
11
  import { Heatmap } from "./Heatmap.js";
11
12
  import { DualPanel } from "./DualPanel.js";
@@ -28,5 +29,6 @@ export {
28
29
  Sparkline,
29
30
  StackedArea,
30
31
  chartCursor,
31
- chartCurve
32
+ chartCurve,
33
+ foldBands
32
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"audit-allows.d.ts","sourceRoot":"","sources":["../../src/cli/audit-allows.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAW,WAAW,EAAa,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAA;AA2I7D;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,CAsLR"}
1
+ {"version":3,"file":"audit-allows.d.ts","sourceRoot":"","sources":["../../src/cli/audit-allows.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAW,WAAW,EAAa,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAA;AA2I7D;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,CAoLR"}
@@ -135,7 +135,7 @@ basalt-ui check-theme --audit-allows \u2014 ${cwd}
135
135
  slot: waiverLines.length,
136
136
  rel,
137
137
  line: site.line,
138
- reach: site.bare ? "a bare annotation, waiving every oxlint plugin rule on its line" : `scoped to ${site.oxlintRules.join(", ")}, which oxlint judges`,
138
+ reach: `scoped to ${site.oxlintRules.join(", ")}, which oxlint judges`,
139
139
  site: label,
140
140
  suffix
141
141
  });
@@ -1 +1 @@
1
- {"version":3,"file":"check-theme.d.ts","sourceRoot":"","sources":["../../src/cli/check-theme.ts"],"names":[],"mappings":"AAkFA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,aAAa,GAAE,MAAsB,EACrC,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,MAAM,CA6IR"}
1
+ {"version":3,"file":"check-theme.d.ts","sourceRoot":"","sources":["../../src/cli/check-theme.ts"],"names":[],"mappings":"AAmFA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,aAAa,GAAE,MAAsB,EACrC,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,MAAM,CAkJR"}
@@ -3,6 +3,7 @@ import { dirname, resolve } from "node:path";
3
3
  import {
4
4
  checkSource,
5
5
  guardKindRemedy,
6
+ REMOVED_VX_NAMES,
6
7
  TOKENS_ONLY_DISABLED_KINDS,
7
8
  unmatchedExemptPatterns
8
9
  } from "../guard/index.js";
@@ -112,7 +113,9 @@ function checkTheme(invocationCwd = process.cwd(), flags = []) {
112
113
  for (const [file, vs] of [...byFile].toSorted()) {
113
114
  console.error(file);
114
115
  for (const v of vs.toSorted((a, b) => a.line - b.line)) {
115
- console.error(` ${String(v.line).padStart(4)} ${v.kind.padEnd(22)} ${v.text}`);
116
+ const replacement = v.kind === "unknown-vx-token" ? REMOVED_VX_NAMES[v.token] : void 0;
117
+ const hint = replacement === void 0 ? "" : ` [${v.token} \u2192 ${replacement ?? "deleted, no replacement"}]`;
118
+ console.error(` ${String(v.line).padStart(4)} ${v.kind.padEnd(22)} ${v.text}${hint}`);
116
119
  }
117
120
  console.error("");
118
121
  }
@@ -127,8 +127,8 @@ export type BasaltConfig = {
127
127
  seriesModulePath?: string;
128
128
  /**
129
129
  * Per-rule, per-path exemptions, complementing whole-file `exempt`. A pattern is matched against a
130
- * finding's relative path: a path segment (`'agent'` matches `src/agent/x.tsx`, not
131
- * `src/agenting.ts`), a relative path, a directory prefix, or a glob (`*` stops at `/`, `**` does
130
+ * finding's relative path: a relative path (`'public/site.webmanifest'`), a
131
+ * directory prefix (`'src/agent'` matches `src/agent/x.tsx`, not `src/agenting.ts`), or a glob (`*` stops at `/`, `**` does
132
132
  * not; a slash-free glob also matches the basename). An entry that suppresses nothing is reported
133
133
  * and `check-theme --audit-allows` exits 1 on it. Default: `{}`.
134
134
  *
@@ -136,9 +136,9 @@ export type BasaltConfig = {
136
136
  * `.webmanifest` finding's only escape is this key), which `--audit-allows` prints.
137
137
  *
138
138
  * @example
139
- * { exemptRules: { 'inline-display': ['agent'] } } // inline-display never fires under src/agent/**
139
+ * { exemptRules: { 'inline-display': ['src/agent'] } } // inline-display never fires under src/agent/**
140
140
  * @example
141
- * { exemptRules: { 'raw-hex': { paths: ['site.webmanifest'],
141
+ * { exemptRules: { 'raw-hex': { paths: ['public/site.webmanifest'],
142
142
  * reason: 'a PWA manifest theme_color MUST be a literal hex — JSON cannot reference a CSS var' } } }
143
143
  */
144
144
  exemptRules?: Partial<Record<GuardKind, ExemptRuleEntry>>;
@@ -33,10 +33,11 @@ export declare function seedTsconfigExtends(cwd: string): string | null;
33
33
  export declare function startWiringWarnings(cwd: string): string[];
34
34
  /**
35
35
  * `app-wiring`: the entry module `index.html` loads (default src/main.tsx) mounts `BasaltProvider`
36
- * on a `createBasaltRouter` router (called in the entry or a module it imports), and the router tree is generated: the vite config calls a
37
- * binding imported from `@tanstack/router-plugin` in `plugins`, or a `routeTree.gen.*` already sits
38
- * beside the entry (or in src/). `basaltViteConfig` does not register that plugin, so naming it
39
- * proves nothing.
36
+ * on a `createBasaltRouter` router (called in the entry or a module it imports), and the router tree
37
+ * exists: the vite config calls a binding imported from `@tanstack/router-plugin` (after its
38
+ * `plugins` key), a `routeTree.gen.*` sits beside the entry (or in src/), or the app is code-routed
39
+ * (`isCodeRoutedApp`, the same predicate `init` and `sync` use). `basaltViteConfig` does not
40
+ * register the plugin, so naming it proves nothing.
40
41
  */
41
42
  export declare function appWiringCheck(cwd: string): Check;
42
43
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"doctor-upgrade.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-upgrade.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAS5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAA;AA6B9D,wEAAwE;AACxE,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,KAAG,MACc,CAAA;AA+CvD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAqBpD;AA+CD,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsBhF;AAqFD,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,aAAa,GACrB,KAAK,CAyBP;AAiBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAUnD;AAUD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkC9D;AA0JD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBzD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAmCjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAczD;AAkBD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AAI,CAkC9D;AAkED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CA8BjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAczD;AAkBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAgB1E;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAQ9E,CAAA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsB/F"}
@@ -1,15 +1,17 @@
1
- import { existsSync, writeFileSync } from "node:fs";
1
+ import { writeFileSync } from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import { dirname, relative, resolve } from "node:path";
4
4
  import { BASALT_CONFIG_KEYS, RETIRED_CONFIG_KEYS } from "./config.js";
5
+ import { parseJsonc, routerSeedDest, scannableFiles } from "./index.js";
5
6
  import {
7
+ appEntry,
8
+ hasRouteTree,
9
+ hasRouter,
10
+ isCodeRoutedApp,
6
11
  isStartApp,
7
- parseJsonc,
8
- readIfExists,
9
- readPackageJson,
10
- routerSeedDest,
11
- scannableFiles
12
- } from "./index.js";
12
+ routeTreeDirs
13
+ } from "./router-wiring.js";
14
+ import { readIfExists, readPackageJson, tokenize } from "./source-text.js";
13
15
  const guarded = (id, run) => {
14
16
  try {
15
17
  return run();
@@ -133,23 +135,7 @@ function retiredLintRulesCheck(cwd, install) {
133
135
  };
134
136
  });
135
137
  }
136
- const TOKEN = /("(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`)|\/\/[^\n]*|\/\*[\s\S]*?\*\//g;
137
138
  const SUBPATH_IMPORT = /(?:(?:^|;)[ \t]*(?:(?:import|export)\b[^'"`;]*?\bfrom|import)\s*|(?<![.\w$])(?:import|require)\s*\(\s*)(['"])basalt-ui\/([^'"]+)\1/gm;
138
- function tokenize(src) {
139
- const literals = [];
140
- const code = src.replace(TOKEN, (m, literal, at) => {
141
- if (literal === void 0) return m.replace(/[^\n]/g, " ");
142
- if (!literal.startsWith("`")) {
143
- literals.push([at, at + m.length]);
144
- return m;
145
- }
146
- return m.replace(
147
- /(\$\{[^}]*\})|[^\n`]/g,
148
- (c, interpolation) => interpolation ?? " "
149
- );
150
- });
151
- return { code, inLiteral: (at) => literals.some(([from, to]) => at >= from && at < to) };
152
- }
153
139
  function basaltImports(src) {
154
140
  const { code, inLiteral } = tokenize(src);
155
141
  return [...code.matchAll(SUBPATH_IMPORT)].filter((m) => !inLiteral(m.index)).map((m) => [m[2], code.slice(0, m.index + m[0].length).split("\n").length]);
@@ -259,70 +245,8 @@ function seedTsconfigExtends(cwd) {
259
245
  writeFileSync(target, `${text.slice(0, at)}${key}${text.slice(at)}`);
260
246
  return `added "extends": "${TSCONFIG_PRESET_ID}" to ${name}.`;
261
247
  }
262
- const VITE_CONFIGS = ["ts", "mts", "cts", "js", "mjs", "cjs"].map((e) => `vite.config.${e}`);
263
248
  const SEED_HINT = "node_modules/basalt-ui/agent/templates/main.tpl";
264
- const ROUTER_PLUGIN_FIX = "Fix: `bun add -D @tanstack/router-plugin`, add `tanstackRouter({ target: 'react', autoCodeSplitting: true })` from '@tanstack/router-plugin/vite' to `plugins` in vite.config.ts (before react()), then run vite once to generate src/routeTree.gen.ts.";
265
- function htmlEntry(html) {
266
- for (const [, attrs = ""] of html.replace(/<!--[\s\S]*?-->/g, "").matchAll(/<script\b([^>]*)>/gi)) {
267
- const src = /\bsrc\s*=\s*["']?([^"'\s>]+)/i.exec(attrs)?.[1];
268
- if (/\btype\s*=\s*["']?module\b/i.test(attrs) && src !== void 0 && !/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(src)) {
269
- return src;
270
- }
271
- }
272
- return void 0;
273
- }
274
- function registersRouterPlugin(src) {
275
- const { code, inLiteral } = tokenize(src);
276
- const pluginsAt = [...code.matchAll(/\bplugins\b/g)].find((m) => !inLiteral(m.index))?.index;
277
- if (pluginsAt === void 0) return false;
278
- const imports = code.matchAll(
279
- /(?:^|;)[ \t]*import\s+(?:type\s+)?([^'"`;]*?)\s*from\s*(['"])@tanstack\/router-plugin(?:\/[^'"]*)?\2/gm
280
- );
281
- return [...imports].some((m) => {
282
- if (inLiteral(m.index)) return false;
283
- const names = (m[1] ?? "").replace(/[{}]/g, "").split(",").map((part) => part.trim()).filter((part) => part !== "" && !/^type\s/.test(part)).map((part) => part.split(/\s+as\s+/).pop());
284
- return names.some(
285
- (name) => [
286
- ...code.matchAll(
287
- new RegExp(`(?<![.\\w$])${name.replace(/\$/g, "\\$")}(?:\\.\\w+)?\\s*\\(`, "g")
288
- )
289
- ].some((call) => call.index > pluginsAt && !inLiteral(call.index))
290
- );
291
- });
292
- }
293
- const RELATIVE_IMPORT = /(?:\b(?:import|export)\b[^'";]*?\bfrom|\bimport)\s*['"](\.{1,2}\/[^'"]+)['"]/g;
294
- function resolveRelative(from, spec) {
295
- const base = resolve(dirname(from), spec.replace(/\.[jt]sx?$/, ""));
296
- return [
297
- resolve(dirname(from), spec),
298
- `${base}.ts`,
299
- `${base}.tsx`,
300
- `${base}/index.ts`,
301
- `${base}/index.tsx`
302
- ].find((f) => /\.[jt]sx?$/.test(f) && existsSync(f)) ?? null;
303
- }
304
- function routerCreatedInImports(cwd, entry) {
305
- const seen = /* @__PURE__ */ new Set([resolve(cwd, entry)]);
306
- let frontier = [...seen];
307
- for (let depth = 0; depth < 3 && frontier.length > 0; depth++) {
308
- const next = [];
309
- for (const file of frontier) {
310
- for (const m of (readIfExists(file) ?? "").matchAll(RELATIVE_IMPORT)) {
311
- const dep = resolveRelative(file, m[1] ?? "");
312
- if (dep === null || seen.has(dep)) continue;
313
- seen.add(dep);
314
- const { code, inLiteral } = tokenize(readIfExists(dep) ?? "");
315
- const called = [...code.matchAll(/\bcreateBasaltRouter\b/g)].some(
316
- (c) => !inLiteral(c.index)
317
- );
318
- if (called) return true;
319
- next.push(dep);
320
- }
321
- }
322
- frontier = next;
323
- }
324
- return false;
325
- }
249
+ const ROUTER_PLUGIN_FIX = "Fix: `bun add -D @tanstack/router-plugin`, add `tanstackRouter({ target: 'react', autoCodeSplitting: true })` from '@tanstack/router-plugin/vite' to `plugins` in vite.config.ts (before react()), then run vite once to generate src/routeTree.gen.ts \u2014 or define the tree in code (`createRootRoute` + `createRoute`), drop the routeTree.gen import and pass the tree to createBasaltRouter.";
326
250
  function isSpreadAt(code, i) {
327
251
  const spread = /\{\s*\.\.\./y;
328
252
  spread.lastIndex = i;
@@ -377,29 +301,29 @@ function startWiringWarnings(cwd) {
377
301
  function appWiringCheck(cwd) {
378
302
  return guarded("app-wiring", () => {
379
303
  if (isStartApp(cwd, "")) return startWiring(cwd);
380
- const entry = (htmlEntry(readIfExists(resolve(cwd, "index.html")) ?? "") ?? "src/main.tsx").replace(/^\//, "");
304
+ const entry = appEntry(cwd);
381
305
  const text = readIfExists(resolve(cwd, entry));
382
306
  if (text === null) {
383
307
  return { fail: `app-wiring: ${entry} does not exist. Fix: make it match ${SEED_HINT}.` };
384
308
  }
385
- const { code, inLiteral } = tokenize(text);
386
- const used = (name) => [...code.matchAll(new RegExp(`\\b${name}\\b`, "g"))].some((m) => !inLiteral(m.index));
387
- const missing = ["BasaltProvider", "createBasaltRouter"].filter(
388
- (name) => !used(name) && !(name === "createBasaltRouter" && routerCreatedInImports(cwd, entry))
389
- );
309
+ const tokens = tokenize(text);
310
+ const { code, inLiteral } = tokens;
311
+ const wired = [
312
+ [
313
+ "BasaltProvider",
314
+ [...code.matchAll(/\bBasaltProvider\b/g)].some((m) => !inLiteral(m.index))
315
+ ],
316
+ ["createBasaltRouter", hasRouter(cwd, entry, tokens)]
317
+ ];
318
+ const missing = wired.filter(([, present]) => !present).map(([name]) => name);
390
319
  if (missing.length > 0) {
391
320
  return {
392
321
  fail: `app-wiring: ${entry} does not use ${missing.join(" or ")}. Fix: make it match ${SEED_HINT} (\`init\` seeds it only when the file is absent).`
393
322
  };
394
323
  }
395
- const vite = VITE_CONFIGS.map((f) => readIfExists(resolve(cwd, f))).find((t) => t !== null) ?? "";
396
- const dirs = [.../* @__PURE__ */ new Set([dirname(entry), "src"])];
397
- const generated = dirs.some(
398
- (d) => ["ts", "tsx", "js"].some((e) => existsSync(resolve(cwd, d, `routeTree.gen.${e}`)))
399
- );
400
- if (generated || registersRouterPlugin(vite)) return null;
324
+ if (hasRouteTree(cwd, entry) || isCodeRoutedApp(cwd, "")) return null;
401
325
  return {
402
- fail: `app-wiring: no vite.config calls the TanStack router plugin and ${dirs.join(" or ")}/routeTree.gen.ts does not exist. ${ROUTER_PLUGIN_FIX}`
326
+ fail: `app-wiring: the entry imports a generated route tree but no vite.config calls the TanStack router plugin and ${routeTreeDirs(entry).join(" or ")}/routeTree.gen.ts does not exist. ${ROUTER_PLUGIN_FIX}`
403
327
  };
404
328
  });
405
329
  }
@@ -23,7 +23,8 @@ export type DoctorResult = {
23
23
  * 7. `ai-major-parity`: the `ai` major agrees across this package.json's dependency fields
24
24
  * (exempt via `basalt.aiMajorSkewReason`; a stale reason warns).
25
25
  * 8-14. `tsconfig-base`, `retired-lint-rules`, `dropped-subpaths`, `app-wiring`, `exact-peers`,
26
- * `subpath-peers`, `config-keys` (./doctor-upgrade);
26
+ * `subpath-peers`, `config-keys` (./doctor-upgrade; a tokens-only consumer runs only
27
+ * `dropped-subpaths` of these — it imports CSS subpaths, where `tokens.css` was);
27
28
  * a check that cannot run is SKIPPED and exits non-zero.
28
29
  *
29
30
  * Warning (non-fatal):
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AA4DA,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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,aAAa,GAAE,MAAsB,EAAE,KAAK,GAAE,MAAM,EAAO,GAAG,MAAM,CAoU1F"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AA6DA,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,CA4T1F"}
@@ -3,6 +3,7 @@ import { relative, resolve } from "node:path";
3
3
  import {
4
4
  AGENTS_MD,
5
5
  LEGACY_BLOCK_HOST,
6
+ scanBlock,
6
7
  MANIFEST_PATH,
7
8
  basaltBinCommand,
8
9
  basaltPresetEntry,
@@ -25,7 +26,6 @@ import {
25
26
  ROUTER_SEED_DESTS,
26
27
  sameFile,
27
28
  scannableFiles,
28
- scanBlock,
29
29
  shippedAssetPath
30
30
  } from "./index.js";
31
31
  import { resolveRoots } from "./config.js";
@@ -40,7 +40,8 @@ import {
40
40
  tsconfigBaseCheck,
41
41
  unknownConfigKeysCheck
42
42
  } from "./doctor-upgrade.js";
43
- import { findManifestAbove, parentInstallAdvice } from "./sync.js";
43
+ import { findManifestAbove, installRootAbove } from "./install-root.js";
44
+ import { parentInstallAdvice } from "./sync.js";
44
45
  function isSameFile(a, b) {
45
46
  try {
46
47
  return sameFile(a, b);
@@ -66,12 +67,9 @@ function aiMajorsAt(dir) {
66
67
  function doctor(invocationCwd = process.cwd(), flags = []) {
67
68
  if (conflictingProfileFlags("doctor", flags)) return 1;
68
69
  const project = resolveProjectDir(invocationCwd);
69
- const aboveRoot = project.relocatedFrom === null && !existsSync(resolve(project.dir, MANIFEST_PATH)) ? findManifestAbove(project.dir) : null;
70
- const insideApp = aboveRoot !== null && (() => {
71
- const app2 = resolveAppDir(aboveRoot);
72
- return !("error" in app2) && app2.dir === project.dir;
73
- })();
74
- const cwd = insideApp && aboveRoot !== null ? aboveRoot : project.dir;
70
+ const aboveRoot = project.relocatedFrom === null ? installRootAbove(project.dir) : null;
71
+ const insideApp = aboveRoot !== null;
72
+ const cwd = aboveRoot ?? project.dir;
75
73
  const cfg = readBasaltConfig(cwd);
76
74
  const result = { hardFailures: 0, warnings: 0, skipped: 0 };
77
75
  const lines = [`
@@ -206,10 +204,6 @@ basalt-ui doctor \u2014 ${cwd}
206
204
  const issues = [];
207
205
  if (scan.problem !== null) {
208
206
  issues.push(`has a malformed basalt block (${scan.problem}) \u2014 fix it by hand, then \`sync\``);
209
- } else if (scan.region !== null) {
210
- issues.push(
211
- `still carries a stale basalt block \u2014 delete it by hand; \`sync\` keeps ${AGENTS_MD} current`
212
- );
213
207
  }
214
208
  if (!importsAgentsMd(legacy)) {
215
209
  issues.push(
@@ -255,24 +249,33 @@ basalt-ui doctor \u2014 ${cwd}
255
249
  } else {
256
250
  pass("ai-major-parity: this package.json declares no ai dependency \u2014 nothing to compare");
257
251
  }
252
+ const droppedCheck = [
253
+ "dropped-subpaths: no import of a basalt-ui subpath the install lacks",
254
+ droppedSubpathsCheck(appDir, cfg, install)
255
+ ];
256
+ const runChecks = (checks) => {
257
+ for (const [ok, check] of checks) {
258
+ if (check === null) pass(ok);
259
+ else if ("fail" in check) fail(check.fail);
260
+ else skip(check.skip);
261
+ }
262
+ };
258
263
  if (profile === "tokens-only") {
259
264
  pass(
260
- "tsconfig-base / retired-lint-rules / dropped-subpaths / app-wiring: n/a \u2014 a tokens-only consumer"
265
+ "tsconfig-base / retired-lint-rules / oxlint-floor / app-wiring / exact-peers / subpath-peers / config-keys: n/a \u2014 a tokens-only consumer"
261
266
  );
267
+ runChecks([droppedCheck]);
262
268
  } else {
263
- const upgrade = [
269
+ runChecks([
264
270
  ["tsconfig-base: tsconfig.json extends the shipped preset", tsconfigBaseCheck(appDir)],
265
271
  [
266
272
  "retired-lint-rules: .oxlintrc.json sets no retired basalt/* rule",
267
273
  retiredLintRulesCheck(cwd, install)
268
274
  ],
269
- [
270
- "dropped-subpaths: no import of a basalt-ui subpath the install lacks",
271
- droppedSubpathsCheck(appDir, cfg, install)
272
- ],
275
+ droppedCheck,
273
276
  ["oxlint-floor: the installed oxlint parses the shipped preset", oxlintFloorCheck(cwd)],
274
277
  [
275
- "app-wiring: the entry mounts BasaltProvider and the router tree is generated",
278
+ "app-wiring: the entry mounts BasaltProvider and the router tree exists",
276
279
  appWiringCheck(appDir)
277
280
  ],
278
281
  ["exact-peers: installed exact-pinned peers match basalt-ui", exactPeersCheck(cwd, install)],
@@ -284,12 +287,7 @@ basalt-ui doctor \u2014 ${cwd}
284
287
  "config-keys: the basalt config block sets only keys basalt-ui reads",
285
288
  unknownConfigKeysCheck(cwd)
286
289
  ]
287
- ];
288
- for (const [ok, check] of upgrade) {
289
- if (check === null) pass(ok);
290
- else if ("fail" in check) fail(check.fail);
291
- else skip(check.skip);
292
- }
290
+ ]);
293
291
  for (const line of startWiringWarnings(appDir)) warn(line);
294
292
  }
295
293
  lines.push("");
@@ -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,CAgC1F,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,QAoC0E,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,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"}
package/dist/cli/help.js CHANGED
@@ -27,8 +27,7 @@ const COMMAND_OPTIONS = {
27
27
  "light-value": { type: "string" },
28
28
  "default-scheme": { type: "string" },
29
29
  "media-fallback": { type: "boolean" },
30
- only: { type: "string" },
31
- "no-legacy-aliases": { type: "boolean" }
30
+ only: { type: "string" }
32
31
  },
33
32
  "fonts:css": { out: { type: "string" }, check: { type: "boolean" } }
34
33
  };
@@ -44,7 +43,7 @@ function unknownFlag(cmd, flags) {
44
43
  return match?.[1] ?? flags.find((f) => f.startsWith("-")) ?? flags[0] ?? null;
45
44
  }
46
45
  }
47
- 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 [--no-legacy-aliases]\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 --no-legacy-aliases drops the deprecated camelCase spellings (--vx-accentFill and friends),\n which are emitted by default as aliases of the canonical kebab-case names.\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.";
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.";
48
47
  export {
49
48
  COMMAND_OPTIONS,
50
49
  USAGE,
@@ -5,6 +5,7 @@ import { doctor } from './doctor.js';
5
5
  import { guardHook } from './guard-hook.js';
6
6
  import { init } from './init.js';
7
7
  import { sync } from './sync.js';
8
+ import type { RouterSeedSkip } from './router-wiring.js';
8
9
  import { fontsCss, normalizeColorFunctions, tokensCss } from './tokens-css.js';
9
10
  import type { BasaltConfig } from './config.js';
10
11
  export declare function resolveGuardConfig(cfg: BasaltConfig, profile: DoctorProfile): GuardConfig;
@@ -161,9 +162,6 @@ export declare const AGENTS_MD = "AGENTS.md";
161
162
  /** A `CLAUDE.md` shadows {@link AGENTS_MD} unless it imports it — `doctor` warns on one. */
162
163
  export declare const LEGACY_BLOCK_HOST = "CLAUDE.md";
163
164
  export declare function sha256(text: string): string;
164
- export declare function readIfExists(abs: string): string | null;
165
- /** `<dir>/package.json` parsed as `T`; null when absent or not JSON. */
166
- export declare function readPackageJson<T>(dir: string): T | null;
167
165
  /** Read a shipped source asset from the package root; null if the sibling hasn't authored it yet. */
168
166
  export declare function readSource(pkgRoot: string, source: string): string | null;
169
167
  /** The framework's own published version, read from the package root package.json. */
@@ -213,9 +211,17 @@ export declare const ROUTER_SEED_DESTS: {
213
211
  export declare function routerSeedDest(appRel: string, seed: keyof typeof ROUTER_SEED_DESTS): string;
214
212
  /** The router seeds' dests for an app dir (`main.tsx`, `nav.tsx`, `__root.tsx`). */
215
213
  export declare function routerSeedDests(appRel: string): string[];
216
- /** A TanStack Start app owns its router, so its router seeds give way to an in-tree `<BasaltProvider>`. */
217
- export declare function isStartApp(cwd: string, appRel: string): boolean;
218
214
  export declare const START_APP_NOTE: string;
215
+ /**
216
+ * The router seeds an app does not get, for `init` and `sync`: why (`start` | `code-routed` | null)
217
+ * and which dests. A tokens-only consumer gets none of them either.
218
+ */
219
+ export declare function routerSeedPlan(cwd: string, appRel: string, tokensOnly?: boolean): {
220
+ skip: RouterSeedSkip;
221
+ skipped: Set<string>;
222
+ };
223
+ /** The note `init` prints for a router-seed skip, or null when nothing was skipped. */
224
+ export declare function seedSkipNote(skip: RouterSeedSkip): string | null;
219
225
  /** The app directory a command's app-scoped half targets: `rel` is '' when it is the install root. */
220
226
  export type AppResolution = {
221
227
  dir: string;
@@ -348,7 +354,8 @@ export declare function writeUnit(file: ManagedFile, cwd: string, desired: strin
348
354
  * - missing : absent on disk → recreate.
349
355
  * - current : on disk == desired → nothing to do.
350
356
  * - unchanged: on disk matches a KNOWN-SHIPPED rendering (raw manifest hash, normalized manifest
351
- * hash, or normalized == normalized desired when no entry exists) → safe overwrite.
357
+ * hash, or — with or without a manifest entry — normalized == normalized desired,
358
+ * the format-only difference a formatter pass leaves) → safe overwrite.
352
359
  * - drifted : matches none of them (a real local edit) → skip unless --force.
353
360
  */
354
361
  export declare function classify(state: UnitState, manifestHash: string | undefined): Classification;
@@ -463,6 +470,8 @@ export declare function isStringArray(value: unknown): value is string[];
463
470
  * The `guard-hook` subcommand is async (reads stdin); all others are synchronous.
464
471
  */
465
472
  export declare function run(argv: string[], cwd?: string): number | Promise<number>;
473
+ export { isStartApp } from './router-wiring.js';
474
+ export { readIfExists, readPackageJson } from './source-text.js';
466
475
  export { RULE_NAMES, SKILL_NAMES };
467
476
  export type { ManagedFile };
468
477
  export { checkTheme, doctor, guardHook, init, sync, fontsCss, normalizeColorFunctions, tokensCss };