@astryxdesign/cli 0.7.17-canary.gf4fa366 → 0.7.17-canary.gf63cf9f

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 (115) hide show
  1. package/README.md +3 -3
  2. package/api/component/component.d.mts +1 -1
  3. package/api/component/component.mjs +4 -4
  4. package/api/doctor/doctor.d.mts +17 -0
  5. package/api/doctor/doctor.mjs +47 -1
  6. package/api/doctor/theme-checks.d.mts +1 -1
  7. package/api/doctor/theme-checks.mjs +91 -2
  8. package/api/icon/icon.doc.mjs +1 -1
  9. package/api/render/_adapter.mjs +4 -13
  10. package/api/render/render.doc.mjs +2 -2
  11. package/api/render/render.type.d.mts +2 -1
  12. package/api/render/render.type.mjs +2 -1
  13. package/api/search/_adapter.d.mts +17 -0
  14. package/api/search/_adapter.mjs +51 -3
  15. package/api/search/_icons.d.mts +46 -0
  16. package/api/search/_icons.mjs +72 -0
  17. package/api/search/search.d.mts +3 -1
  18. package/api/search/search.mjs +65 -25
  19. package/api/search/search.type.d.mts +53 -0
  20. package/api/search/search.type.mjs +30 -0
  21. package/api/theme/build/build.d.mts +3 -1
  22. package/api/theme/build/build.mjs +115 -4
  23. package/api/theme/build/null-values.d.mts +14 -0
  24. package/api/theme/build/null-values.mjs +77 -14
  25. package/api/theme/build/setting-effects.d.mts +199 -0
  26. package/api/theme/build/setting-effects.mjs +957 -0
  27. package/api/theme/theme.type.d.mts +15 -0
  28. package/api/theme/theme.type.mjs +7 -2
  29. package/api/theme/themeBuild.doc.mjs +2 -2
  30. package/api/theme/themeTargets.doc.mjs +1 -1
  31. package/api/theme-edit/_css.d.mts +3 -16
  32. package/api/theme-edit/_css.mjs +8 -42
  33. package/api/theme-edit/_how-question.mjs +108 -1
  34. package/api/theme-edit/_part-words.mjs +8 -0
  35. package/api/theme-edit/_parts.d.mts +4 -0
  36. package/api/theme-edit/_parts.mjs +35 -2
  37. package/api/theme-edit/_project.d.mts +4 -0
  38. package/api/theme-edit/_project.mjs +8 -1
  39. package/assets/component-list.generated.json +1 -1
  40. package/assets/docs/author-a-theme.doc.mjs +2 -2
  41. package/assets/docs/getting-started.doc.mjs +1 -1
  42. package/assets/docs/tree/icon-sets.doc.mjs +6 -2
  43. package/assets/docs/working-with-ai.doc.mjs +3 -3
  44. package/assets/docs-routes.generated.json +1 -1
  45. package/assets/docs.generated.json +2 -2
  46. package/assets/search-catalog.generated.json +2 -2
  47. package/assets/self-audit.generated.json +1 -1
  48. package/assets/templates/components.generated.json +1 -1
  49. package/assets/templates/pages/course-detail/page.tsx +2 -2
  50. package/assets/templates/pages/dashboard/page.tsx +4 -4
  51. package/assets/templates/pages/dashboard-alert-rail/page.tsx +2 -2
  52. package/assets/templates/pages/dashboard-comparison/page.tsx +2 -2
  53. package/assets/templates/pages/dashboard-composition/page.tsx +6 -3
  54. package/assets/templates/pages/form-wizard-inline/page.tsx +6 -4
  55. package/assets/templates/pages/library/page.tsx +1 -1
  56. package/assets/templates/pages/product-detail/page.tsx +1 -1
  57. package/assets/templates/pages/product-gallery/page.tsx +1 -1
  58. package/assets/templates/pages/settings/page.tsx +3 -3
  59. package/assets/templates/pages/side-gallery/page.tsx +4 -1
  60. package/assets/theme.template.ts +7 -7
  61. package/authoring/config/config.doc.mjs +1 -1
  62. package/authoring/doctypes/_schema.d.mts +4 -0
  63. package/authoring/doctypes/_schema.mjs +13 -0
  64. package/authoring/doctypes/base/type.ts +13 -0
  65. package/authoring/doctypes/command/command.doc.mjs +6 -0
  66. package/authoring/doctypes/command/type.ts +7 -0
  67. package/authoring/doctypes/component/component.doc.mjs +1 -1
  68. package/clients/cli/build-id.generated.json +1 -1
  69. package/clients/cli/commands/component.doc.mjs +3 -1
  70. package/clients/cli/commands/component.mjs +7 -3
  71. package/clients/cli/commands/experimental/render.mjs +38 -2
  72. package/clients/cli/commands/mcp.doc.mjs +5 -1
  73. package/clients/cli/commands/search.mjs +27 -0
  74. package/clients/cli/commands/template.doc.mjs +12 -3
  75. package/clients/cli/commands/theme-targets.doc.mjs +1 -1
  76. package/clients/cli/index.mjs +13 -21
  77. package/clients/cli/lib/component-format.mjs +112 -68
  78. package/clients/cli/lib/define-command.mjs +10 -0
  79. package/clients/cli/manifest.generated.json +1 -1
  80. package/foundation/agent-docs/agent-doc-state.mjs +1 -1
  81. package/foundation/agent-docs/agent-docs.d.mts +12 -2
  82. package/foundation/agent-docs/agent-docs.mjs +16 -1
  83. package/foundation/discovery/cli-self-docs.mjs +16 -2
  84. package/foundation/discovery/command-pointers.d.mts +21 -4
  85. package/foundation/discovery/command-pointers.mjs +25 -4
  86. package/foundation/discovery/icon-ranking.d.mts +16 -2
  87. package/foundation/discovery/icon-ranking.mjs +36 -6
  88. package/foundation/discovery/icon-set-discovery.d.mts +20 -0
  89. package/foundation/discovery/icon-set-discovery.mjs +42 -16
  90. package/foundation/discovery/template-needs.mjs +3 -3
  91. package/foundation/env/user-dirs.d.mts +14 -0
  92. package/foundation/env/user-dirs.mjs +34 -1
  93. package/foundation/fs/cache-eviction.d.mts +7 -5
  94. package/foundation/fs/cache-eviction.mjs +20 -13
  95. package/foundation/fs/gather-cache.d.mts +4 -3
  96. package/foundation/fs/gather-cache.mjs +35 -30
  97. package/foundation/fs/jiti-cache.d.mts +47 -26
  98. package/foundation/fs/jiti-cache.mjs +222 -130
  99. package/foundation/integrations/computer-integrations.mjs +5 -6
  100. package/foundation/integrations/icon-features.d.mts +1 -1
  101. package/foundation/integrations/icon-features.mjs +1 -1
  102. package/foundation/integrations/may-have-integrations.mjs +7 -6
  103. package/foundation/render/embedded-files.d.mts +24 -1
  104. package/foundation/render/embedded-files.mjs +40 -3
  105. package/foundation/render/file-header.d.mts +5 -0
  106. package/foundation/render/file-header.mjs +9 -1
  107. package/foundation/render/page-worker.mjs +33 -5
  108. package/foundation/render/render-page.d.mts +7 -2
  109. package/foundation/render/render-page.mjs +65 -11
  110. package/foundation/response/response-types.doc.mjs +2 -2
  111. package/foundation/runtime/css-tree.d.mts +16 -0
  112. package/foundation/runtime/css-tree.mjs +44 -2
  113. package/foundation/runtime/package-root.d.mts +17 -0
  114. package/foundation/runtime/package-root.mjs +28 -0
  115. package/package.json +6 -6
package/README.md CHANGED
@@ -126,7 +126,7 @@ Every run reads one base: Core, or an installed integration whose manifest decla
126
126
  `--json` works with every command listed in `jsonSupported` (`astryx manifest --json`), which is every command except the bare groups such as `astryx theme`. The other four change only the reads named here; other commands ignore them:
127
127
 
128
128
  - `--json`: Output as typed JSON envelope: `{ apiVersion, type, package?, data, meta? }` (errors: `{ apiVersion, error, code, suggestions? }`)
129
- - `--detail <level>`: Detail level for `component`, `hook`, and docs tree reads (such as `astryx docs cli/commands/build`), increasing in size: `brief` (names only, default for lists) < `compact` (names + 1-line descriptions) < `full` (full docs per entry). Single-item views default to `full`.
129
+ - `--detail <level>`: Detail level for `component`, `hook`, and docs tree reads (such as `astryx docs cli/commands/build`), increasing in size: `brief` (names only, default for lists) < `compact` (names + 1-line descriptions) < `full` (full docs per entry). A component read (`astryx component <Name>`) defaults to `compact`, a short answer that ends with the `--detail full` command; hook and docs reads default to `full`.
130
130
  - `--zh`: Simplified Chinese for component reads and for docs topics that have a translation (English otherwise)
131
131
  - `--dense`: Token-efficient dense text for `astryx component <Name>` and `astryx docs <topic>`
132
132
  - `--lang <locale>`: Language or format for component and docs reads: `en` (default), `zh` (as `--zh`), or `dense` (as `--dense`)
@@ -518,8 +518,8 @@ Every response has a `type` discriminant. The full set is below (generated from
518
518
  | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is the run's active base: @astryxdesign/core in a run on Core. |
519
519
  | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
520
520
  | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
521
- | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). A --family build whose root extends a theme the family does not select adds base {theme, package (the installed package it comes from, or null for a local base: a file of the project or a theme defined in the file of the root), export (the name the root imports it by, or null for a theme defined in the file of the root)}: a requirement of the outputs. |
522
- | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), the full list of checked paths, and, when any is stale or missing, code ERR_THEME_STALE. Writes nothing. |
521
+ | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), notices (advisories about a correct theme, such as a named font it does not load), and settingIssues (the page-rule settings the browser does not show as written, also among the warnings; their fields are in the themeBuild doc). A --family build whose root extends a theme the family does not select adds base {theme, package (the installed package it comes from, or null for a local base: a file of the project or a theme defined in the file of the root), export (the name the root imports it by, or null for a theme defined in the file of the root)}: a requirement of the outputs. |
522
+ | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), the full list of checked paths, when any is stale or missing, code ERR_THEME_STALE, and settingIssues as on the build receipt when any. Writes nothing. |
523
523
  | `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
524
524
  | `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, package (the package that provides it, or the local root), source, added, and default fields, plus owner (the package the app imports the built theme from, such as the bundled theme package @astryxdesign/theme-<slug>, or the local root) and installed (whether that owner is installed). Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |
525
525
  | `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
@@ -12,7 +12,7 @@
12
12
  * @param {boolean} [options.source]
13
13
  * @param {boolean} [options.showcase]
14
14
  * @param {boolean} [options.blocks]
15
- * @param {'full'|'compact'|'brief'} [options.detail] - Defaults to 'full' for a single component, 'brief' for list views (list/category/no name), matching the CLI.
15
+ * @param {'full'|'compact'|'brief'} [options.detail] - The level of a list view's entries; defaults to 'brief' for list views (list/category/no name) and 'full' otherwise. A named component's JSON is the same at every level; only the CLI's text projection (default 'compact' for a component read) depends on it.
16
16
  * @param {string} [options.lang]
17
17
  * @param {boolean} [options.zh]
18
18
  * @param {boolean} [options.dense]
@@ -250,7 +250,7 @@ async function componentBatch(selectors, options, coreDir) {
250
250
  * @param {boolean} [options.source]
251
251
  * @param {boolean} [options.showcase]
252
252
  * @param {boolean} [options.blocks]
253
- * @param {'full'|'compact'|'brief'} [options.detail] - Defaults to 'full' for a single component, 'brief' for list views (list/category/no name), matching the CLI.
253
+ * @param {'full'|'compact'|'brief'} [options.detail] - The level of a list view's entries; defaults to 'brief' for list views (list/category/no name) and 'full' otherwise. A named component's JSON is the same at every level; only the CLI's text projection (default 'compact' for a component read) depends on it.
254
254
  * @param {string} [options.lang]
255
255
  * @param {boolean} [options.zh]
256
256
  * @param {boolean} [options.dense]
@@ -306,9 +306,9 @@ async function componentRead(name, options = {}) {
306
306
  const selectorList = Array.isArray(name) ? name : null;
307
307
  const noName = selectorList == null && !name;
308
308
 
309
- // Default detail level mirrors the CLI (see commands/component.mjs):
310
- // single-component views default to 'full', list-style views (--list,
311
- // --category, or no name) default to 'brief' (scannable name lists).
309
+ // List-style views (--list, --category, or no name) default to 'brief'
310
+ // (scannable name lists). A named read returns the same JSON at every
311
+ // level; the CLI picks its text level (see commands/component.mjs).
312
312
  // An explicit array remains a batch even when it is empty or a caller also
313
313
  // passes a list-only option.
314
314
  const isListView =
@@ -389,6 +389,23 @@ export function checkComputerIntegrationsAvailable({ installed, candidates, inst
389
389
  * @returns {DoctorCheck | null}
390
390
  */
391
391
  export function checkGatherCache(): DoctorCheck | null;
392
+ /**
393
+ * The single folder where earlier CLIs left jiti's own copies of transpiled
394
+ * code, which this CLI never reads, and the command that removes it. Found by
395
+ * one stat, never a listing: that folder can hold so many files that reading
396
+ * it takes minutes.
397
+ * @param {import('../../foundation/env/user-dirs.mjs').UserDirOptions} [options]
398
+ * @returns {DoctorCheck | null}
399
+ */
400
+ export function checkOldTranspileCache(options?: import("../../foundation/env/user-dirs.mjs").UserDirOptions): DoctorCheck | null;
401
+ /**
402
+ * The command that removes a folder and all it holds: PowerShell's on
403
+ * Windows, a POSIX shell's elsewhere, the path quoted as each shell reads it.
404
+ * @param {string} dir
405
+ * @param {string} [platform]
406
+ * @returns {string}
407
+ */
408
+ export function removeFolderCommand(dir: string, platform?: string): string;
392
409
  /**
393
410
  * Run all diagnostic checks and return a structured report.
394
411
  *
@@ -27,6 +27,11 @@
27
27
  import * as fs from 'node:fs';
28
28
  import * as path from 'node:path';
29
29
  import {gatherCacheSummary} from '../../foundation/fs/gather-cache.mjs';
30
+ import {
31
+ oldTranspileCacheDir,
32
+ transpiledCacheDir,
33
+ } from '../../foundation/env/user-dirs.mjs';
34
+ import {SUBFOLDERS} from '../../foundation/fs/jiti-cache.mjs';
30
35
 
31
36
  import {
32
37
  MIN_NODE_VERSION,
@@ -52,6 +57,7 @@ import {
52
57
  formatCliCommand,
53
58
  getCliInvocation,
54
59
  guessCliInvocation,
60
+ quoteCommandArgument,
55
61
  } from '../../foundation/env/package-manager.mjs';
56
62
  import {
57
63
  chooseDeclaredCliCommand,
@@ -2833,10 +2839,49 @@ export function checkGatherCache() {
2833
2839
  id: 'gather-cache',
2834
2840
  label: 'Kept catalog cache',
2835
2841
  status: 'info',
2836
- message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, the component list and whether the installed Core still matches the stored one, Core's and integrations' components with the doc parts the component matcher scores, Core hooks' declared keywords, integrations' theme records, what theme build checks a theme against in Core's component docs, the JavaScript theme build compiles from a theme's local TypeScript or JSX modules, what theme build finds when it checks a theme's pseudo-class keys and token names, the lookup commands' not-found hint's name summaries, npm's list of the files an integration package packs, the CLI's own docs tree, discover's record of the integrations a project loads and what each adds, and what it searches in its sources' saved copies, which search's discover line reads, and doctor's docs checks and theme-wiring scan) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, the installed CLI's own files judged by its build id and folder (an upgrade, a reinstall or a copy in another folder changes them; in-place edits aren't supported), and deleting the folder clears it. A lookup command's not-found path may also create the folder, for its name index, and so may an integration package's \`integration check\` of itself, for npm's list. On Linux, when a debug handler is set, runs also keep the locale and time zone here. The folder holds at most ${summary.limitBytes / (1024 * 1024)} MB, dropping oldest entries first, as does the transpile cache in ${summary.jitiDir}, which keeps every copy written, or read where the file system records reads, in the last day.`,
2842
+ message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, the component list and whether the installed Core still matches the stored one, Core's and integrations' components with the doc parts the component matcher scores, Core hooks' declared keywords, integrations' theme records, what theme build checks a theme against in Core's component docs, the JavaScript theme build compiles from a theme's local TypeScript or JSX modules, what theme build finds when it checks a theme's pseudo-class keys and token names, the lookup commands' not-found hint's name summaries, npm's list of the files an integration package packs, the CLI's own docs tree, discover's record of the integrations a project loads and what each adds, and what it searches in its sources' saved copies, which search's discover line reads, and doctor's docs checks and theme-wiring scan) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, the installed CLI's own files judged by its build id and folder (an upgrade, a reinstall or a copy in another folder changes them; in-place edits aren't supported), and deleting the folder clears it. A lookup command's not-found path may also create the folder, for its name index, and so may an integration package's \`integration check\` of itself, for npm's list. On Linux, when a debug handler is set, runs also keep the locale and time zone here. The folder holds at most ${summary.limitBytes / (1024 * 1024)} MB, dropping oldest entries first; the transpile cache in ${summary.transpiledDir} keeps its copies in ${SUBFOLDERS} subfolders, each holding at most 1/${SUBFOLDERS} of that, and drops the copies made longest ago first.`,
2843
+ };
2844
+ }
2845
+
2846
+ /**
2847
+ * The single folder where earlier CLIs left jiti's own copies of transpiled
2848
+ * code, which this CLI never reads, and the command that removes it. Found by
2849
+ * one stat, never a listing: that folder can hold so many files that reading
2850
+ * it takes minutes.
2851
+ * @param {import('../../foundation/env/user-dirs.mjs').UserDirOptions} [options]
2852
+ * @returns {DoctorCheck | null}
2853
+ */
2854
+ export function checkOldTranspileCache(options) {
2855
+ const dir = oldTranspileCacheDir(options);
2856
+ try {
2857
+ if (!fs.lstatSync(dir).isDirectory()) return null;
2858
+ } catch {
2859
+ return null;
2860
+ }
2861
+ const remove = removeFolderCommand(dir, options?.platform);
2862
+ return {
2863
+ id: 'old-transpile-cache',
2864
+ label: 'Old transpile cache',
2865
+ status: 'info',
2866
+ message: `An earlier Astryx CLI left transpiled copies in ${dir}. This CLI keeps its copies in ${transpiledCacheDir(options)} and never reads the old folder.`,
2867
+ fix: `To remove it, run: ${remove}. An earlier CLI that still runs on this computer makes it again.`,
2837
2868
  };
2838
2869
  }
2839
2870
 
2871
+ /**
2872
+ * The command that removes a folder and all it holds: PowerShell's on
2873
+ * Windows, a POSIX shell's elsewhere, the path quoted as each shell reads it.
2874
+ * @param {string} dir
2875
+ * @param {string} [platform]
2876
+ * @returns {string}
2877
+ */
2878
+ export function removeFolderCommand(dir, platform = process.platform) {
2879
+ const folder = quoteCommandArgument(dir, platform);
2880
+ return platform === 'win32'
2881
+ ? `Remove-Item -Recurse -Force -LiteralPath ${folder}`
2882
+ : `rm -rf ${folder}`;
2883
+ }
2884
+
2840
2885
  /**
2841
2886
  * Ordered list of synchronous check functions. Append here to add a check.
2842
2887
  * (checkConfig is async and is awaited separately by {@link runChecks}.)
@@ -2863,6 +2908,7 @@ export const SYNC_CHECKS = [
2863
2908
  checkCliCommand,
2864
2909
  checkInstallGuidance,
2865
2910
  checkGatherCache,
2911
+ () => checkOldTranspileCache(),
2866
2912
  ];
2867
2913
 
2868
2914
  /**
@@ -106,7 +106,7 @@ export function withProviderWiring(appChecks: DoctorCheck[], wiring: {
106
106
  }>;
107
107
  }): DoctorCheck[];
108
108
  /**
109
- * Run all ten app-theme checks.
109
+ * Run all eleven app-theme checks.
110
110
  * @param {string} cwd
111
111
  * @returns {Promise<DoctorCheck[]>}
112
112
  */
@@ -51,6 +51,7 @@ import {
51
51
  themeShippedImportFindings,
52
52
  validateThemePrivateInputs,
53
53
  } from './_adapter.mjs';
54
+ import {settingIssueLocation} from '../theme/build/setting-effects.mjs';
54
55
  import {
55
56
  getCliInvocation,
56
57
  formatCliCommand,
@@ -67,6 +68,7 @@ const CHECKS = [
67
68
  ['theme-module-import', 'App imports the theme module'],
68
69
  ['theme-stylesheet-imports', 'Built theme stylesheet imports'],
69
70
  ['theme-local-builds', 'Local theme build freshness'],
71
+ ['theme-setting-effects', 'Theme settings that show'],
70
72
  ['theme-private-variables', 'Private theme variables'],
71
73
  ['theme-core-peers', 'Theme Core peer compatibility'],
72
74
  ['theme-default', 'Default added theme'],
@@ -619,7 +621,7 @@ function globalRules(css, slug) {
619
621
 
620
622
  /**
621
623
  * Report source copies made by the released `theme add` before it copied
622
- * descriptors. This is a migration notice, not one of the ten setup checks.
624
+ * descriptors. This is a migration notice, not one of the eleven setup checks.
623
625
  * @param {string} projectDir
624
626
  * @returns {DoctorCheck|null}
625
627
  */
@@ -1268,7 +1270,7 @@ function privateInputFile(theme, owner, projectDir) {
1268
1270
  }
1269
1271
 
1270
1272
  /**
1271
- * Run all ten app-theme checks.
1273
+ * Run all eleven app-theme checks.
1272
1274
  * @param {string} cwd
1273
1275
  * @returns {Promise<DoctorCheck[]>}
1274
1276
  */
@@ -1634,6 +1636,16 @@ export async function checkAppThemes(cwd) {
1634
1636
  }
1635
1637
 
1636
1638
  const localThemes = resolved.filter(theme => theme.source === 'local');
1639
+ /**
1640
+ * What each local theme's build check says does not show as written (the
1641
+ * `settingIssues` of `theme build --check`), and whether the checks ran.
1642
+ * @type {Array<{slug: string, issues: Array<{message: string, fix: string, line: number | null, file?: string}>}>}
1643
+ */
1644
+ const settingIssuesByTheme = [];
1645
+ /** The local themes whose build check returned a receipt. @type {Set<string>} */
1646
+ const settingsChecked = new Set();
1647
+ /** Why a local theme's build check did not run, by its slug. @type {Map<string, string>} */
1648
+ const uncheckedWhy = new Map();
1637
1649
  if (incompleteResolution) {
1638
1650
  checks.push({
1639
1651
  id: 'theme-local-builds',
@@ -1652,6 +1664,8 @@ export async function checkAppThemes(cwd) {
1652
1664
  message:
1653
1665
  "The project's Core isn't installed, so local theme builds were not checked. Install the project's dependencies, then run doctor again.",
1654
1666
  });
1667
+ for (const theme of localThemes)
1668
+ uncheckedWhy.set(theme.slug, "the project's Core isn't installed");
1655
1669
  } else if (localThemes.length === 0) {
1656
1670
  checks.push({
1657
1671
  id: 'theme-local-builds',
@@ -1688,6 +1702,12 @@ export async function checkAppThemes(cwd) {
1688
1702
  {check: true},
1689
1703
  {cwd: state.projectDir, projectCore: true},
1690
1704
  );
1705
+ if (receipt?.type === 'theme.build.check') {
1706
+ settingsChecked.add(theme.slug);
1707
+ const issues = /** @type {any} */ (receipt).data.settingIssues;
1708
+ if (Array.isArray(issues) && issues.length > 0)
1709
+ settingIssuesByTheme.push({slug: theme.slug, issues});
1710
+ }
1691
1711
  if (
1692
1712
  receipt == null ||
1693
1713
  receipt.type !== 'theme.build.check' ||
@@ -1700,9 +1720,20 @@ export async function checkAppThemes(cwd) {
1700
1720
  // variables" check's to report, not a stale output.
1701
1721
  if (isPrivateVarRefusal(error)) {
1702
1722
  refused.push(theme.slug);
1723
+ uncheckedWhy.set(theme.slug, 'it sets a private variable');
1703
1724
  continue;
1704
1725
  }
1705
1726
  const missing = missingThemePackage(error);
1727
+ // What the build said: the first line of its refusal.
1728
+ const said = String(
1729
+ /** @type {any} */ (error)?.message ?? error,
1730
+ ).split('\n')[0];
1731
+ uncheckedWhy.set(
1732
+ theme.slug,
1733
+ missing
1734
+ ? `it imports ${missing}, which the project lacks`
1735
+ : `the build refused it: ${said.replace(/\.$/, '')}`,
1736
+ );
1706
1737
  if (missing) {
1707
1738
  missingPackages.set(missing, [
1708
1739
  ...(missingPackages.get(missing) ?? []),
@@ -1778,6 +1809,64 @@ export async function checkAppThemes(cwd) {
1778
1809
  );
1779
1810
  }
1780
1811
 
1812
+ // Each setting of an added local theme the browser does not show as
1813
+ // written, as its build check reports it: a warning with the theme, the
1814
+ // setting and the fix, never a failure (the theme builds as before). It
1815
+ // passes only when every local theme's build check ran.
1816
+ const settingIssueCount = settingIssuesByTheme.reduce(
1817
+ (n, t) => n + t.issues.length,
1818
+ 0,
1819
+ );
1820
+ // Each local theme whose build check did not run, with why (the cause
1821
+ // the freshness check names).
1822
+ const unchecked = localThemes
1823
+ .map(theme => theme.slug)
1824
+ .filter(slug => !settingsChecked.has(slug))
1825
+ .map(
1826
+ slug =>
1827
+ `${slug} (${uncheckedWhy.get(slug) ?? 'its build check returned no result'})`,
1828
+ );
1829
+ const uncheckedNote =
1830
+ unchecked.length > 0
1831
+ ? `Not checked, because ${unchecked.length === 1 ? 'its build check' : 'their build checks'} did not run: ${unchecked.join('; ')}.`
1832
+ : '';
1833
+ checks.push(
1834
+ settingIssueCount > 0
1835
+ ? {
1836
+ id: 'theme-setting-effects',
1837
+ label: 'Theme settings that show',
1838
+ status: 'warn',
1839
+ message: `${settingIssueCount} ${settingIssueCount === 1 ? 'setting does' : 'settings do'} not show as written: ${settingIssuesByTheme
1840
+ .flatMap(t =>
1841
+ t.issues.map(
1842
+ i => `${t.slug}: ${i.message}${settingIssueLocation(i)}`,
1843
+ ),
1844
+ )
1845
+ .join('; ')}.${uncheckedNote ? ` ${uncheckedNote}` : ''}`,
1846
+ fix: `${settingIssuesByTheme
1847
+ .flatMap(t => t.issues.map(i => `${t.slug}: ${i.fix}`))
1848
+ .join('; ')}.`,
1849
+ }
1850
+ : incompleteResolution || unchecked.length > 0
1851
+ ? {
1852
+ id: 'theme-setting-effects',
1853
+ label: 'Theme settings that show',
1854
+ status: 'info',
1855
+ message: incompleteResolution
1856
+ ? 'Could not check that each local theme setting shows until every local output resolves.'
1857
+ : uncheckedNote,
1858
+ }
1859
+ : {
1860
+ id: 'theme-setting-effects',
1861
+ label: 'Theme settings that show',
1862
+ status: 'pass',
1863
+ message:
1864
+ localThemes.length > 0
1865
+ ? 'Every setting of the added local themes shows as written.'
1866
+ : 'No added local themes to check.',
1867
+ },
1868
+ );
1869
+
1781
1870
  // The inputs load with Core, and doctor reads only the Core the project
1782
1871
  // installed, never the one the answering copy carries.
1783
1872
  const privateCoreMissing =
@@ -16,7 +16,7 @@ export const doc = {
16
16
  summary:
17
17
  'Find an icon by meaning in the installed icon sets, read one icon, or list the sets.',
18
18
  description:
19
- "Reads every installed icon set's data file, never the icon modules. With words it ranks icons by meaning: an icon definition the set's `map` names the icon for, then exact matches on its id or words, then a word that starts with the query, then partial matches, and for a query of several words that none of those answer, the icons that carry some of its words, rarer words counting more within a set. A word written as an export name (`SearchIcon`) also reads as its words, and the reading with the better match answers. Equal scores keep the project's set first, then integration load order; within a set, a whole-id name match before an id-part one and a meaning match by its tag position; then id order. With `<set>/<id>` it reads one icon with every variant's import line. With `list` it lists the installed sets, how many icon definitions each one's `map` covers (built-in and all of Astryx's) and its own definitions, and any set withdrawn and why. Experimental: it may change or be removed in a patch release.",
19
+ "Reads every installed icon set's data file, never the icon modules. With words it ranks icons by meaning: an icon definition the set's `map` names the icon for, then exact matches on its id or words, then a word that starts with the query, then partial matches, and for a query of several words that none of those answer, the icons that carry some of its words, rarer words counting more within a set. A word written as an export name (`SearchIcon`) also reads as its words, and the reading with the better match answers. Equal scores keep the project's set first, then integration load order; within a set, a whole-id name match before an id-part one and a meaning match by its tag position; then id order. With `<set>/<id>` it reads one icon with every variant's import line. With `list` it lists the installed sets, how many icon definitions each one's `map` covers (built-in and all of Astryx's) and its own definitions, and any set withdrawn and why. `search()` and `astryx search` with no `type` answer from the same ranking when a query asks for an icon (one word as typed is `icon` or `icons`, an installed set's name, or an icon export name such as `SearchIcon`, and is not the name of a component or hook): after `results` they return `icons`, `{matchCount, results}`, with at most 3 icons (fewer when `limit` is smaller), each with `domain: 'icon'`, `name` (`<set>/<id>`), `set`, `id`, `package`, `score`, `reason`, `import` and `command`; text mode lists them last, one line each. It never changes search's `results` or `matchCount`, and it is absent when no icon answers. Experimental: it may change or be removed in a patch release.",
20
20
  importPath: '@astryxdesign/cli/api',
21
21
  signature:
22
22
  'icon(query?: string, options?: IconOptions): Promise<IconSearchResponse | IconDetailResponse | IconListResponse>',
@@ -51,7 +51,7 @@ import {climbsOut, findPackageRoot, isInside as liesInside, requireCoreDir} from
51
51
  import {runChoice} from '../../foundation/release/run-context.mjs';
52
52
  import {isAlive, pidSpace} from '../../foundation/release/cache.mjs';
53
53
  import {isServedPackage} from '../../foundation/render/served-packages.mjs';
54
- import {hostedRun, recordResolved, servingRootPackages} from '../../foundation/runtime/package-root.mjs';
54
+ import {hostedPagePackages, recordResolved} from '../../foundation/runtime/package-root.mjs';
55
55
  import {installCommandFor} from '../../foundation/discovery/template-needs.mjs';
56
56
 
57
57
  export {PAGE_EXTENSIONS, embeddedPathProblem};
@@ -466,16 +466,6 @@ function asAstryxError(e, pageDir, cwd = process.cwd()) {
466
466
  return e;
467
467
  }
468
468
 
469
- /**
470
- * The packages besides Astryx, React and StyleX that a page outside a project
471
- * takes from the package set: the integrations the host approves, and the
472
- * other packages its set declares, such as the icon library templates import.
473
- * @returns {string[]}
474
- */
475
- function servedExtras() {
476
- return [...(hostedRun()?.integrations ?? []), ...servingRootPackages()];
477
- }
478
-
479
469
  /**
480
470
  * The package set the CLI runs from, for a page outside a project
481
471
  * (architecture:cli-surface INV30): the Core it carries, found by the rule of
@@ -492,7 +482,7 @@ function servedSet(input) {
492
482
  const dir = path.dirname(input);
493
483
  if (runChoice(dir).inProject) return null;
494
484
  try {
495
- return {dir: requireCoreDir(dir), integrations: servedExtras()};
485
+ return {dir: requireCoreDir(dir), integrations: hostedPagePackages()};
496
486
  } catch (e) {
497
487
  const err = /** @type {any} */ (e);
498
488
  return err?.code === ERROR_CODES.ERR_VERSIONS_UNAVAILABLE ? {unavailable: err} : null;
@@ -523,7 +513,7 @@ export async function renderToFile({cwd, input, output, title, absolute = false}
523
513
  const detail = /** @type {any} */ (e)?.code === 'ERR_RENDER_MISSING_DEPENDENCY' ? /** @type {any} */ (e).detail : null;
524
514
  /** @type {unknown[]} */
525
515
  const missing = Array.isArray(detail?.packages) ? detail.packages : [detail?.package];
526
- const served = servedExtras();
516
+ const served = hostedPagePackages();
527
517
  if (set && 'unavailable' in set && missing.some(name => typeof name === 'string' && isServedPackage(name, served))) {
528
518
  throw new AstryxError(set.unavailable.message, [], ERROR_CODES.ERR_VERSIONS_UNAVAILABLE);
529
519
  }
@@ -588,6 +578,7 @@ export async function renderToFile({cwd, input, output, title, absolute = false}
588
578
  cssBytes: page.cssBytes,
589
579
  images: page.images,
590
580
  warnings: page.warnings,
581
+ ...(page.notCarried ? {notCarried: page.notCarried} : {}),
591
582
  scriptBytes: page.scriptBytes ?? 0,
592
583
  scriptModules: page.scriptModules ?? 0,
593
584
  };
@@ -16,7 +16,7 @@ export const doc = {
16
16
  summary:
17
17
  'Render a page to one self-contained HTML file, or turn a rendered file back into a page.',
18
18
  description:
19
- "Renders the page module's default export on the server with the project's own React and Astryx components (outside a project, with the Astryx, React and StyleX the CLI runs with, and, when a tool runs the CLI through its host entry, the packages the `package.json` beside that CLI lists in `dependencies` or `optionalDependencies`), and writes ONE HTML file that is the page as a live app and needs nothing beside it: the page's own StyleX styles are compiled, Core's stylesheets are cut to the rules the page can use (layer order, custom properties and keyframes kept), local images become data: URIs, the page's source is embedded so it can be given back exactly, and the page's own script follows it inline: the page's modules and the packages they use, bundled for the browser by esbuild (a dependency of the CLI that only this function loads). The file paints its markup first, then the script draws the live page over it, so state, effects and event handlers work: popovers, menus, dialogs, tabs and forms behave as in the app. It loads nothing from the network and the render adds no `eval`, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts, and its colors follow the viewer's light or dark scheme. A page whose script cannot be built for the browser (a module it loads needs Node, say) is refused. A page is refused with ERR_RENDER_COMPILE naming the file, the line, the module and the missing name, as a build refuses it, when it imports a name that one of its own modules, a StyleX variables module (`.stylex`) or an `@astryxdesign/*` package does not export, draws a member (`<Name.Member>`) such an export lacks, or imports any package subpath the package does not export (a named, default or side-effect import). A name another package does not export is refused only when the page's script is built: a page that draws or calls it as it renders fails with ERR_RENDER_FAILED first. Not checked: type imports, a name the page never uses as a value, a default import from a module that exists, a named import from one of the page's own CommonJS modules (a bundler reads those by interop), and a name the page imports through a TypeScript module that only re-exports it with a plain `export {…}` (such a page fails with ERR_RENDER_FAILED if it draws or calls the name as it renders). Warnings name anything that may differ from what the author meant, such as a component that did not render the text it was given. The file opens with a plain note for its next reader, a person or an agent: the CLI version and render format that made it, the page's path, the files it carries, the packages and versions it rendered with, and the exact commands that give the page back and render it again; the embedded source records the same facts and the markup as rendered. With `reverse` (the way back, or unrender), it writes the embedded source back byte for byte, and only the files a render embeds: the page and the local modules, stylesheets, JSON files and images it imports, into a new folder; it also reports the render format, the CLI version and packages that rendered the file, and whether someone changed the markup after the render, naming each run of text that changed and where the old text sits in the restored source (the restored files stay the page as rendered); a file with Astryx markup but no embedded source is rebuilt from its component class names and data attributes (text and layout only); any other file is refused. Experimental: it may change or be removed in a patch release.",
19
+ "Renders the page module's default export on the server with the project's own React and Astryx components (outside a project, with the Astryx, React and StyleX the CLI runs with, and, when a tool runs the CLI through its host entry, the packages the `package.json` beside that CLI lists in `dependencies` or `optionalDependencies`), and writes ONE HTML file that is the page as a live app and needs nothing beside it: the page's own StyleX styles are compiled, Core's stylesheets are cut to the rules the page can use (layer order, custom properties and keyframes kept), local images become data: URIs, the page's source is embedded so it can be given back exactly, and the page's own script follows it inline: the page's modules and the packages they use, bundled for the browser by esbuild (a dependency of the CLI that only this function loads). The file paints its markup first, then the script draws the live page over it, so state, effects and event handlers work: popovers, menus, dialogs, tabs and forms behave as in the app. It loads nothing from the network and the render adds no `eval`, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts, and its colors follow the viewer's light or dark scheme. A page whose script cannot be built for the browser (a module it loads needs Node, say) is refused. A page is refused with ERR_RENDER_COMPILE naming the file, the line, the module and the missing name, as a build refuses it, when it imports a name that one of its own modules, a StyleX variables module (`.stylex`) or an `@astryxdesign/*` package does not export, draws a member (`<Name.Member>`) such an export lacks, or imports any package subpath the package does not export (a named, default or side-effect import). A name another package does not export is refused only when the page's script is built: a page that draws or calls it as it renders fails with ERR_RENDER_FAILED first. Not checked: type imports, a name the page never uses as a value, a default import from a module that exists, a named import from one of the page's own CommonJS modules (a bundler reads those by interop), and a name the page imports through a TypeScript module that only re-exports it with a plain `export {…}` (such a page fails with ERR_RENDER_FAILED if it draws or calls the name as it renders). Warnings name anything that may differ from what the author meant, such as a component that did not render the text it was given. The file opens with a plain note for its next reader, a person or an agent: the CLI version and render format that made it, the page's path, the files it carries, the packages and versions it rendered with, and the exact commands that give the page back and render it again; the embedded source records the same facts and the markup as rendered. Each file the page uses that a render cannot carry is named on the note's 'Not carried' line and in `notCarried` (the JSON result and the text output), and its warning says why; the note then no longer says the page comes back exactly. A file left out because its name reads as a tool's configuration gets the `not-carried` warning, which says what carries it. With `reverse` (the way back, or unrender), it writes the embedded source back byte for byte, and only the files a render embeds: the page and the local modules, stylesheets, JSON files and images it imports, into a new folder; it also reports the render format, the CLI version and packages that rendered the file, and whether someone changed the markup after the render, naming each run of text that changed and where the old text sits in the restored source (the restored files stay the page as rendered); a file with Astryx markup but no embedded source is rebuilt from its component class names and data attributes (text and layout only); any other file is refused. Experimental: it may change or be removed in a patch release.",
20
20
  importPath: '@astryxdesign/cli/api/experimental',
21
21
  signature:
22
22
  'render(file: string, options?: RenderOptions): Promise<RenderPageResponse | RenderReverseResponse>',
@@ -77,7 +77,7 @@ export const doc = {
77
77
  {
78
78
  type: 'render.page',
79
79
  description:
80
- "The page and the HTML file written, its size, the local modules embedded, the stylesheets inlined, the class and image counts, the CSS size, the script's size and how many modules it holds, and any warnings.",
80
+ "The page and the HTML file written, its size, the local modules embedded, the stylesheets inlined, the class and image counts, the CSS size, the script's size and how many modules it holds, the files it could not carry (`notCarried`, when there are any), and any warnings.",
81
81
  },
82
82
  {
83
83
  type: 'render.reverse',
@@ -31,7 +31,7 @@ export type RenderWarning = {
31
31
  /**
32
32
  * - What kind of problem.
33
33
  */
34
- code: "dropped-children" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "screen-query" | "not-embedded" | "node-crash";
34
+ code: "dropped-children" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "screen-query" | "not-embedded" | "not-carried" | "node-crash";
35
35
  /**
36
36
  * - What happened and what to do, in one sentence.
37
37
  */
@@ -74,6 +74,7 @@ export type RenderPageResponse = {
74
74
  cssBytes: number;
75
75
  images: number;
76
76
  warnings: RenderWarning[];
77
+ notCarried?: string[] | undefined;
77
78
  scriptBytes: number;
78
79
  scriptModules: number;
79
80
  };
@@ -22,7 +22,7 @@
22
22
  * author meant.
23
23
  * @experimental May change or be removed in a patch release.
24
24
  * @typedef {object} RenderWarning
25
- * @property {'dropped-children' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'screen-query' | 'not-embedded' | 'node-crash'} code - What kind of problem.
25
+ * @property {'dropped-children' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'screen-query' | 'not-embedded' | 'not-carried' | 'node-crash'} code - What kind of problem.
26
26
  * @property {string} message - What happened and what to do, in one sentence.
27
27
  */
28
28
 
@@ -52,6 +52,7 @@
52
52
  * @property {number} data.cssBytes - Size of the inlined CSS.
53
53
  * @property {number} data.images - Local files inlined as data: URIs.
54
54
  * @property {RenderWarning[]} data.warnings - Empty when nothing looked wrong.
55
+ * @property {string[]} [data.notCarried] - Files the page uses that the file does not carry, so --reverse cannot give them back: a name that reads as a tool's configuration, a file a test or story runner would run, a file outside the carried folder (imported by a relative path or a path alias), an image it cannot carry, or a Sass or Less stylesheet, which a render does not compile. Each also has a warning. Present only when there are some.
55
56
  * @property {number} data.scriptBytes - Size of the page's script, which `bytes` includes.
56
57
  * @property {number} data.scriptModules - How many modules the page's script holds (the page's own, its packages', React's).
57
58
  */