@astryxdesign/cli 0.7.15 → 0.7.16-canary.g22213fd

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 (222) hide show
  1. package/README.md +6 -4
  2. package/api/build/_adapter.d.mts +10 -0
  3. package/api/build/_adapter.mjs +24 -0
  4. package/api/build/blocks/blocks.d.mts +1 -0
  5. package/api/build/blocks/blocks.mjs +18 -1
  6. package/api/build/kit/shell.weights.json +1 -0
  7. package/api/build/kit/shellcall.d.mts +26 -0
  8. package/api/build/kit/shellcall.mjs +87 -0
  9. package/api/build/kit/start.mjs +67 -4
  10. package/api/build/kit/weights.d.mts +15 -0
  11. package/api/build/kit/weights.mjs +27 -0
  12. package/api/component/__fixtures__/resolutions/modules.txt +1 -1
  13. package/api/component/_adapter.d.mts +1 -1
  14. package/api/component/_adapter.mjs +28 -1
  15. package/api/doctor/_adapter.d.mts +38 -2
  16. package/api/doctor/_adapter.mjs +76 -1
  17. package/api/doctor/built-checks.mjs +1 -1
  18. package/api/doctor/doctor.d.mts +26 -0
  19. package/api/doctor/doctor.doc.mjs +1 -1
  20. package/api/doctor/doctor.mjs +156 -11
  21. package/api/doctor/theme-checks.mjs +163 -18
  22. package/api/icon/_adapter.d.mts +7 -3
  23. package/api/icon/_adapter.mjs +12 -3
  24. package/api/icon/icon.type.d.mts +15 -0
  25. package/api/icon/icon.type.mjs +10 -3
  26. package/api/icon/iconUse.doc.mjs +19 -5
  27. package/api/icon/list/list.mjs +7 -1
  28. package/api/icon/use/use.d.mts +8 -5
  29. package/api/icon/use/use.mjs +95 -13
  30. package/api/init/run/run.mjs +1 -0
  31. package/api/integration/add-contribution.mjs +3 -3
  32. package/api/integration/pack-check.mjs +14 -8
  33. package/api/integration/validate-integration.mjs +1 -1
  34. package/api/search/_adapter.mjs +15 -16
  35. package/api/search/_entries.d.mts +2 -1
  36. package/api/search/_entries.mjs +28 -1
  37. package/api/swizzle/_moduleGraph.mjs +1 -1
  38. package/api/template/template.type.d.mts +6 -2
  39. package/api/template/template.type.mjs +2 -1
  40. package/api/theme/_adapter.d.mts +5 -2
  41. package/api/theme/_adapter.mjs +59 -14
  42. package/api/theme/_fork.mjs +1 -1
  43. package/api/theme/build/build.d.mts +120 -32
  44. package/api/theme/build/build.mjs +471 -111
  45. package/api/theme/eject/eject.mjs +22 -1
  46. package/api/theme/generateTonalPalette.doc.mjs +2 -2
  47. package/api/theme/palette/generate/generator.mjs +141 -2
  48. package/api/theme/template/template.d.mts +19 -0
  49. package/api/theme/template/template.mjs +102 -25
  50. package/api/theme/theme.type.d.mts +44 -1
  51. package/api/theme/theme.type.mjs +23 -1
  52. package/api/theme/themeBuild.doc.mjs +4 -4
  53. package/api/theme/themeEject.doc.mjs +1 -1
  54. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  55. package/api/theme/themeTemplate.doc.mjs +9 -3
  56. package/api/theme-edit/_adapter.d.mts +33 -2
  57. package/api/theme-edit/_adapter.mjs +276 -41
  58. package/api/theme-edit/_check.d.mts +93 -4
  59. package/api/theme-edit/_check.mjs +1712 -223
  60. package/api/theme-edit/_color.d.mts +2 -8
  61. package/api/theme-edit/_color.mjs +292 -219
  62. package/api/theme-edit/_compiler.d.mts +1 -0
  63. package/api/theme-edit/_compiler.mjs +20 -1
  64. package/api/theme-edit/_context.d.mts +31 -1
  65. package/api/theme-edit/_context.mjs +445 -41
  66. package/api/theme-edit/_css.d.mts +60 -1
  67. package/api/theme-edit/_css.mjs +404 -28
  68. package/api/theme-edit/_edit.d.mts +25 -0
  69. package/api/theme-edit/_edit.mjs +1620 -154
  70. package/api/theme-edit/_how-commands.d.mts +11 -26
  71. package/api/theme-edit/_how-commands.mjs +30 -2
  72. package/api/theme-edit/_how-question.d.mts +15 -0
  73. package/api/theme-edit/_how-question.mjs +1469 -194
  74. package/api/theme-edit/_how.mjs +144 -30
  75. package/api/theme-edit/_marks.d.mts +13 -0
  76. package/api/theme-edit/_marks.mjs +15 -0
  77. package/api/theme-edit/_overview.mjs +2 -0
  78. package/api/theme-edit/_palette.d.mts +38 -0
  79. package/api/theme-edit/_palette.mjs +306 -73
  80. package/api/theme-edit/_parts.d.mts +33 -0
  81. package/api/theme-edit/_parts.mjs +138 -9
  82. package/api/theme-edit/_png.d.mts +18 -0
  83. package/api/theme-edit/_png.mjs +95 -14
  84. package/api/theme-edit/_preview-app.d.mts +55 -1
  85. package/api/theme-edit/_preview-app.mjs +1552 -101
  86. package/api/theme-edit/_preview.d.mts +71 -3
  87. package/api/theme-edit/_preview.mjs +565 -35
  88. package/api/theme-edit/_project.d.mts +15 -0
  89. package/api/theme-edit/_project.mjs +68 -13
  90. package/api/theme-edit/_settings.d.mts +299 -5
  91. package/api/theme-edit/_settings.mjs +2806 -158
  92. package/api/theme-edit/_tables.d.mts +24 -0
  93. package/api/theme-edit/_tables.mjs +212 -150
  94. package/api/theme-edit/_vet.d.mts +42 -0
  95. package/api/theme-edit/_vet.mjs +144 -0
  96. package/api/theme-edit/theme-edit.type.d.mts +31 -2
  97. package/api/theme-edit/theme-edit.type.mjs +10 -2
  98. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  99. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  100. package/api/theme-edit/themeEditShow.doc.mjs +11 -3
  101. package/api/upgrade/registry/registry.mjs +6 -1
  102. package/assets/codemods/parse.mjs +2 -2
  103. package/assets/docs/author-a-theme.doc.mjs +1 -1
  104. package/assets/docs/theme.doc.dense.mjs +1 -1
  105. package/assets/docs/theme.doc.mjs +1 -1
  106. package/assets/docs/theme.doc.zh.mjs +4 -3
  107. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  108. package/assets/docs/tree/icon-sets.doc.mjs +63 -8
  109. package/assets/docs/tree/single-component.doc.mjs +11 -2
  110. package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
  111. package/assets/docs.generated.json +2 -2
  112. package/assets/preview-app/next.config.mjs +7 -1
  113. package/assets/preview-app/package.json +1 -0
  114. package/assets/preview-app/src/app/globals.css +1 -0
  115. package/assets/self-audit.generated.json +1 -1
  116. package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs +21 -0
  117. package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx +62 -0
  118. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
  119. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
  120. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
  121. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
  122. package/assets/templates/components.generated.json +1 -1
  123. package/assets/templates/pages/ai-chat/page.tsx +20 -2
  124. package/assets/templates/pages/dashboard/page.tsx +1 -1
  125. package/assets/templates/themes/neutral/neutralPalettes.generated.receipt.json +2 -0
  126. package/authoring/config/config.doc.mjs +8 -0
  127. package/authoring/config/parse.d.mts +1 -0
  128. package/authoring/config/parse.mjs +12 -0
  129. package/authoring/config/type.ts +8 -0
  130. package/authoring/doctypes/_schema.d.mts +52 -5
  131. package/authoring/doctypes/_schema.mjs +62 -7
  132. package/authoring/doctypes/base/type.ts +10 -0
  133. package/authoring/doctypes/component/component.doc.mjs +1 -1
  134. package/authoring/doctypes/function/function.doc.mjs +6 -0
  135. package/authoring/doctypes/function/type.ts +3 -0
  136. package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +3 -3
  137. package/authoring/doctypes/legacy.mjs +5 -1
  138. package/authoring/index.d.ts +1 -0
  139. package/authoring/shadcn/source-variants.d.mts +1 -1
  140. package/authoring/shadcn/source-variants.mjs +32 -10
  141. package/clients/cli/build-id.generated.json +1 -1
  142. package/clients/cli/commands/doctor.doc.mjs +2 -2
  143. package/clients/cli/commands/experimental/icon.mjs +61 -6
  144. package/clients/cli/commands/experimental/theme.mjs +244 -45
  145. package/clients/cli/commands/experimental-icon-use.doc.mjs +12 -5
  146. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  147. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
  148. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
  149. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +3 -3
  150. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  151. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  152. package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -1
  153. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  154. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  155. package/clients/cli/commands/experimental-theme-template.doc.mjs +2 -2
  156. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  157. package/clients/cli/commands/theme-eject.doc.mjs +1 -1
  158. package/clients/cli/commands/theme-template.doc.mjs +3 -1
  159. package/clients/cli/commands/theme.doc.mjs +7 -2
  160. package/clients/cli/commands/theme.mjs +222 -55
  161. package/clients/cli/commands.generated.json +1 -1
  162. package/clients/cli/formatters/index.mjs +7 -4
  163. package/clients/cli/index.mjs +25 -5
  164. package/clients/cli/lib/cli-error.mjs +9 -3
  165. package/clients/cli/lib/component-format.mjs +27 -9
  166. package/clients/cli/lib/json-shim.mjs +72 -2
  167. package/clients/cli/manifest.generated.json +1 -1
  168. package/clients/cli/run.mjs +49 -0
  169. package/foundation/agent-docs/agent-docs-target.d.mts +2 -6
  170. package/foundation/agent-docs/agent-docs-target.mjs +9 -17
  171. package/foundation/agent-docs/agent-docs.mjs +4 -3
  172. package/foundation/config/config-writer.d.mts +23 -0
  173. package/foundation/config/config-writer.mjs +152 -58
  174. package/foundation/config/project.mjs +103 -16
  175. package/foundation/discovery/component-discovery.mjs +11 -22
  176. package/foundation/discovery/icon-set-checks.mjs +164 -48
  177. package/foundation/discovery/icon-set-discovery.d.mts +38 -5
  178. package/foundation/discovery/icon-set-discovery.mjs +50 -6
  179. package/foundation/discovery/icon-set-theme-maps.d.mts +59 -0
  180. package/foundation/discovery/icon-set-theme-maps.mjs +95 -0
  181. package/foundation/discovery/icon-set-writer.d.mts +2 -3
  182. package/foundation/discovery/icon-set-writer.mjs +58 -17
  183. package/foundation/discovery/module-exports.mjs +1 -15
  184. package/foundation/discovery/template-adapter.mjs +44 -19
  185. package/foundation/discovery/template-icons.d.mts +27 -10
  186. package/foundation/discovery/template-icons.mjs +142 -26
  187. package/foundation/discovery/template-source-tree.mjs +3 -16
  188. package/foundation/discovery/theme-discovery.d.mts +30 -1
  189. package/foundation/discovery/theme-discovery.mjs +109 -50
  190. package/foundation/fs/exact-codec.d.mts +35 -0
  191. package/foundation/fs/exact-codec.mjs +148 -0
  192. package/foundation/fs/gather-cache.d.mts +15 -5
  193. package/foundation/fs/gather-cache.mjs +129 -31
  194. package/foundation/fs/paths.d.mts +39 -0
  195. package/foundation/fs/paths.mjs +44 -11
  196. package/foundation/fs/read-record.mjs +11 -1
  197. package/foundation/integrations/autolink.d.mts +4 -2
  198. package/foundation/integrations/autolink.mjs +4 -2
  199. package/foundation/integrations/cli-requirement.d.mts +16 -5
  200. package/foundation/integrations/cli-requirement.mjs +27 -6
  201. package/foundation/integrations/contribution-fixes.mjs +1 -16
  202. package/foundation/integrations/may-have-integrations.mjs +7 -3
  203. package/foundation/integrations/missing-dependency.d.mts +9 -0
  204. package/foundation/integrations/missing-dependency.mjs +100 -0
  205. package/foundation/integrations/public-imports.mjs +1 -1
  206. package/foundation/render/embedded-imports.mjs +1 -1
  207. package/foundation/render/host-exit.d.mts +8 -0
  208. package/foundation/render/host-exit.mjs +11 -0
  209. package/foundation/render/page-host.mjs +56 -10
  210. package/foundation/render/page-worker.mjs +14 -0
  211. package/foundation/render/render-page.mjs +37 -2
  212. package/foundation/response/error-codes.d.mts +2 -1
  213. package/foundation/response/error-codes.d.ts +1 -0
  214. package/foundation/response/error-codes.doc.mjs +5 -0
  215. package/foundation/response/error-codes.mjs +3 -0
  216. package/foundation/response/json.d.mts +15 -0
  217. package/foundation/response/json.mjs +52 -1
  218. package/foundation/response/response-types.doc.mjs +1 -1
  219. package/foundation/runtime/lazy-dependencies.d.mts +14 -0
  220. package/foundation/runtime/lazy-dependencies.mjs +82 -0
  221. package/foundation/xle/browser.d.mts +2 -2
  222. package/package.json +7 -6
@@ -1,6 +1,23 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * A doctor check that reads only files, kept between runs through the kept
6
+ * gather (foundation/fs/gather-cache.mjs): a later `doctor` with every file,
7
+ * folder, module and environment variable it read unchanged reads the check
8
+ * back. Only the docs checks go through here; a check that depends on the
9
+ * time, the network or anything else the stamps do not see never does.
10
+ * @template T
11
+ * @param {{name: string, cwd: string, coreDir: string | null}} where - The
12
+ * check, the project folder, and the Core folder the project loads.
13
+ * @param {() => Promise<T>} check
14
+ * @returns {Promise<T>}
15
+ */
16
+ export function keptFileCheck<T>({ name, cwd, coreDir }: {
17
+ name: string;
18
+ cwd: string;
19
+ coreDir: string | null;
20
+ }, check: () => Promise<T>): Promise<T>;
4
21
  /**
5
22
  * Package written to the generated app record for one discovered theme.
6
23
  * @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
@@ -71,6 +88,24 @@ export function doctorElementPropOrigins(file: string, element: Parameters<typeo
71
88
  * @returns {Set<string>}
72
89
  */
73
90
  export function doctorStylesheetImports(css: string): Set<string>;
91
+ /**
92
+ * The `@astryxdesign/core` range a package's peerDependencies declare, and
93
+ * whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
94
+ * doctor check uses to compare a package with the installed Core:
95
+ * `theme-core-peers` for added theme packages, `integration-core-range` for
96
+ * every other loaded integration.
97
+ * @param {{peerDependencies?: Record<string, unknown>} | null | undefined} pkg
98
+ * @param {string | null | undefined} coreVersion
99
+ * Any declared string is judged by `satisfiesRange`, so an empty range
100
+ * accepts every Core; only a missing range is `null`.
101
+ * @returns {{range: string | null, accepts: boolean}}
102
+ */
103
+ export function corePeerRange(pkg: {
104
+ peerDependencies?: Record<string, unknown>;
105
+ } | null | undefined, coreVersion: string | null | undefined): {
106
+ range: string | null;
107
+ accepts: boolean;
108
+ };
74
109
  /** @param {string} projectDir */
75
110
  export function findDoctorCoreDir(projectDir: string): string | null;
76
111
  /** @param {string} projectDir @param {string} packageName */
@@ -247,7 +282,6 @@ export function readBuiltPath(target: string, { fileLimit }?: {
247
282
  */
248
283
  export function builtIntegrationPackages(target: string, cwd: string): string[];
249
284
  export { placeholderFixes } from "../../foundation/discovery/template-icons.mjs";
250
- export { unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
251
285
  export { installCommandFor as packageInstallCommand } from "../../foundation/discovery/template-needs.mjs";
252
286
  export { resolveRecordedTheme } from "../theme/theme.mjs";
253
287
  export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
@@ -263,6 +297,8 @@ import { lastNoticeSkip } from '../../foundation/release/notices.mjs';
263
297
  import { lastCheckFailure } from '../../foundation/release/global-state.mjs';
264
298
  import { stateLockHolder } from '../../foundation/release/global-state.mjs';
265
299
  import { displayHomePath } from '../../foundation/agent-docs/computer-agent-text.mjs';
300
+ export { iconUseCommand, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
266
301
  export { isLocalThemeOwner, planThemeAppWrite, readThemeState, resolveThemeModule } from "../../foundation/config/theme-state.mjs";
267
- export { missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
302
+ export { GENERATED_MARKER, isPrivateVarRefusal, missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
303
+ export { APP_COPY_MARK, EDITOR_GENERATED_MARK } from "../theme-edit/_marks.mjs";
268
304
  export { AUTHORING_AUDIT, authoringAudit, authoringAuditData } from "./_authoring-audit.mjs";
@@ -41,10 +41,19 @@ import {computerAgentTextSettings} from '../../foundation/env/user-settings.mjs'
41
41
  import * as fs from 'node:fs';
42
42
  import {placeholderUses} from '../../foundation/discovery/template-icons.mjs';
43
43
  export {placeholderFixes} from '../../foundation/discovery/template-icons.mjs';
44
- export {unlistedIconSets} from '../../foundation/discovery/icon-set-discovery.mjs';
44
+ export {
45
+ iconUseCommand,
46
+ unlistedIconSets,
47
+ } from '../../foundation/discovery/icon-set-discovery.mjs';
45
48
  import {elementPropOrigins} from '../../foundation/discovery/module-exports.mjs';
46
49
  import {cssImports} from '../../foundation/render/embedded-imports.mjs';
50
+ import {satisfiesRange} from '../../foundation/env/semver.mjs';
47
51
  import * as path from 'node:path';
52
+ import {
53
+ persistedGather,
54
+ recordedRun,
55
+ } from '../../foundation/fs/gather-cache.mjs';
56
+ import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
48
57
  import {
49
58
  Project,
50
59
  availableComputerIntegrations,
@@ -67,10 +76,13 @@ export {
67
76
  resolveThemeModule,
68
77
  } from '../../foundation/config/theme-state.mjs';
69
78
  export {
79
+ GENERATED_MARKER,
80
+ isPrivateVarRefusal,
70
81
  missingThemePackage,
71
82
  themeBuild,
72
83
  validateThemePrivateInputs,
73
84
  } from '../theme/build/build.mjs';
85
+ export {APP_COPY_MARK, EDITOR_GENERATED_MARK} from '../theme-edit/_marks.mjs';
74
86
  export {installCommandFor as packageInstallCommand} from '../../foundation/discovery/template-needs.mjs';
75
87
  export {resolveRecordedTheme} from '../theme/theme.mjs';
76
88
  export {collectUnloadedFonts} from '../theme/build/font-warning.mjs';
@@ -83,6 +95,44 @@ export {
83
95
  authoringAuditData,
84
96
  } from './_authoring-audit.mjs';
85
97
 
98
+ /** A doctor check record, kept as it is. */
99
+ const CHECK_CODEC = {
100
+ encode: (/** @type {any} */ check) => check,
101
+ decode: (/** @type {any} */ check) => check,
102
+ /** A check record: its id, label, status and message. */
103
+ valid: (/** @type {any} */ check) =>
104
+ check != null &&
105
+ typeof check === 'object' &&
106
+ typeof check.id === 'string' &&
107
+ typeof check.label === 'string' &&
108
+ typeof check.status === 'string' &&
109
+ typeof check.message === 'string',
110
+ };
111
+
112
+ /**
113
+ * A doctor check that reads only files, kept between runs through the kept
114
+ * gather (foundation/fs/gather-cache.mjs): a later `doctor` with every file,
115
+ * folder, module and environment variable it read unchanged reads the check
116
+ * back. Only the docs checks go through here; a check that depends on the
117
+ * time, the network or anything else the stamps do not see never does.
118
+ * @template T
119
+ * @param {{name: string, cwd: string, coreDir: string | null}} where - The
120
+ * check, the project folder, and the Core folder the project loads.
121
+ * @param {() => Promise<T>} check
122
+ * @returns {Promise<T>}
123
+ */
124
+ export function keptFileCheck({name, cwd, coreDir}, check) {
125
+ // Only a recorded run (a plain `doctor` from the bin) reads or keeps one: a
126
+ // hosted run names its commands its own way, so it always checks.
127
+ if (!recordedRun()) return check();
128
+ return persistedGather(
129
+ // With the command name the checks print commands with.
130
+ ['doctor-check', name, cwd, coreDir, getCliInvocation(cwd)],
131
+ check,
132
+ CHECK_CODEC,
133
+ );
134
+ }
135
+
86
136
  /**
87
137
  * Package written to the generated app record for one discovered theme.
88
138
  * @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
@@ -256,6 +306,31 @@ export function doctorStylesheetImports(css) {
256
306
  return new Set(cssImports(css));
257
307
  }
258
308
 
309
+ /**
310
+ * The `@astryxdesign/core` range a package's peerDependencies declare, and
311
+ * whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
312
+ * doctor check uses to compare a package with the installed Core:
313
+ * `theme-core-peers` for added theme packages, `integration-core-range` for
314
+ * every other loaded integration.
315
+ * @param {{peerDependencies?: Record<string, unknown>} | null | undefined} pkg
316
+ * @param {string | null | undefined} coreVersion
317
+ * Any declared string is judged by `satisfiesRange`, so an empty range
318
+ * accepts every Core; only a missing range is `null`.
319
+ * @returns {{range: string | null, accepts: boolean}}
320
+ */
321
+ export function corePeerRange(pkg, coreVersion) {
322
+ const raw = pkg?.peerDependencies?.['@astryxdesign/core'];
323
+ const range = typeof raw === 'string' ? raw.trim() : null;
324
+ return {
325
+ range,
326
+ accepts:
327
+ range !== null &&
328
+ typeof coreVersion === 'string' &&
329
+ coreVersion !== '' &&
330
+ satisfiesRange(coreVersion, range),
331
+ };
332
+ }
333
+
259
334
  /** @param {string} projectDir */
260
335
  export function findDoctorCoreDir(projectDir) {
261
336
  return findProjectCoreDir(projectDir);
@@ -30,7 +30,7 @@ import {
30
30
  resolveBuiltPath,
31
31
  } from './_adapter.mjs';
32
32
  import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
33
- import {parse as parseModule} from '@babel/parser';
33
+ import {babelParse as parseModule} from '../../foundation/runtime/lazy-dependencies.mjs';
34
34
 
35
35
  /** Source files, read for imports and JSX. */
36
36
  const SOURCE_EXT = new Set(['.tsx', '.jsx', '.ts', '.js', '.mjs', '.cjs']);
@@ -86,6 +86,19 @@ export function checkPeerDeps(ctx: DoctorContext): DoctorCheck;
86
86
  * @returns {DoctorCheck}
87
87
  */
88
88
  export function checkIntegrationIssues(ctx: DoctorContext): DoctorCheck;
89
+ /**
90
+ * Every loaded integration's `@astryxdesign/core` peer range admits the
91
+ * installed Core: a package's declared peer ranges define the Core versions it
92
+ * supports (spec:AST-017 FR12). A package made for another Core installs with
93
+ * only a package manager warning, and its components, themes and docs may not
94
+ * work. New, so it warns: a project that passed before keeps passing.
95
+ * Packages of added themes are left to `theme-core-peers` (spec:AST-050 FR11),
96
+ * which applies the same rule. Null when Core is not installed or no other
97
+ * loaded integration declares a Core range.
98
+ * @param {DoctorContext} ctx
99
+ * @returns {DoctorCheck | null}
100
+ */
101
+ export function checkIntegrationCoreRange(ctx: DoctorContext): DoctorCheck | null;
89
102
  /**
90
103
  * The project's icon sets (AST-084 FR17). Fails when `experimental.iconSet`
91
104
  * names a set, main or backup, that is not installed, that is installed but
@@ -387,6 +400,11 @@ export type DoctorContext = {
387
400
  * false means the copy that started the run answered it (spec AST-081 FR2).
388
401
  */
389
402
  ownCli?: boolean | undefined;
403
+ /**
404
+ * - Packages of the project's added
405
+ * themes, which `theme-core-peers` checks against Core
406
+ */
407
+ addedThemePackages?: string[] | undefined;
390
408
  /**
391
409
  * - The Core release the project names
392
410
  * (installed, else locked, else declared), as the daily hint reads it.
@@ -464,6 +482,14 @@ export type DoctorContext = {
464
482
  status: "selected" | "none" | "ambiguous" | "missing" | "withdrawn";
465
483
  reason: string;
466
484
  configured?: string;
485
+ set?: {
486
+ name: string;
487
+ package: string;
488
+ data: {
489
+ variants?: string[];
490
+ };
491
+ };
492
+ variant?: string;
467
493
  backups?: Array<{
468
494
  selector: string;
469
495
  status: "selected" | "ambiguous" | "missing" | "withdrawn";
@@ -20,7 +20,7 @@ export const doc = {
20
20
  '@astryxdesign/core install and version alignment with the CLI, installed ' +
21
21
  'themes and wiring, astryx.config validity, whether every integration ' +
22
22
  'astryx.config names loads (a failed one fails the run), integrations linked from ' +
23
- 'package.json without a config entry, core peer dependencies, ' +
23
+ 'package.json without a config entry, core peer dependencies, whether the @astryxdesign/core peer range of each loaded integration includes the installed Core (`integration-core-range`, a warning; added theme packages are checked by `theme-core-peers` instead), ' +
24
24
  'integration provider identity and contribution issues, agent docs, the ' +
25
25
  'detected package manager, and the health of the docs the CLI reads (authoring ' +
26
26
  'and CLI docs, the docs tree, doc size), and returns a structured ' +
@@ -100,6 +100,7 @@ import {
100
100
  COMPUTER_INSTALL_STEP,
101
101
  } from '../../foundation/agent-docs/computer-agent-text.mjs';
102
102
  import {
103
+ keptFileCheck,
103
104
  alignCommand,
104
105
  addCliCommandFor,
105
106
  computerAgentTextState,
@@ -109,6 +110,7 @@ import {
109
110
  projectHasOwnCli,
110
111
  computerIntegrationsOutside,
111
112
  findIconPlaceholders,
113
+ iconUseCommand,
112
114
  placeholderFixes,
113
115
  unlistedIconSets,
114
116
  computerIntegrationsToAdd,
@@ -117,6 +119,9 @@ import {
117
119
  releaseFacts,
118
120
  builtIntegrationPackages,
119
121
  authoringAudit,
122
+ corePeerRange,
123
+ isLocalThemeOwner,
124
+ readThemeState,
120
125
  } from './_adapter.mjs';
121
126
  import {checkBuilt} from './built-checks.mjs';
122
127
 
@@ -140,6 +145,8 @@ import {checkBuilt} from './built-checks.mjs';
140
145
  * @property {string|null} coreDir - Resolved core package directory, or null.
141
146
  * @property {boolean} [ownCli] - Whether the project installs its own CLI;
142
147
  * false means the copy that started the run answered it (spec AST-081 FR2).
148
+ * @property {string[]} [addedThemePackages] - Packages of the project's added
149
+ * themes, which `theme-core-peers` checks against Core
143
150
  * @property {string|null} [projectCore] - The Core release the project names
144
151
  * (installed, else locked, else declared), as the daily hint reads it.
145
152
  * @property {string|null} configPath - Resolved astryx.config.mjs path, or null.
@@ -162,7 +169,7 @@ import {checkBuilt} from './built-checks.mjs';
162
169
  * Combined project-level integration issues, including cross-package template replacement warnings.
163
170
  * @property {Error|null} [configError] - Error thrown while resolving the config
164
171
  * path (e.g. multiple config files present), surfaced by checkConfig as a FAIL.
165
- * @property {{sets: Array<{name: string, package: string}>, withdrawn: Array<{name: string, package: string, reason: string}>, choice: {status: 'selected'|'none'|'ambiguous'|'missing'|'withdrawn', reason: string, configured?: string, backups?: Array<{selector: string, status: 'selected'|'ambiguous'|'missing'|'withdrawn', reason: string}>, order?: Array<{name: string, package: string}>}}|null} [iconSets]
172
+ * @property {{sets: Array<{name: string, package: string}>, withdrawn: Array<{name: string, package: string, reason: string}>, choice: {status: 'selected'|'none'|'ambiguous'|'missing'|'withdrawn', reason: string, configured?: string, set?: {name: string, package: string, data: {variants?: string[]}}, variant?: string, backups?: Array<{selector: string, status: 'selected'|'ambiguous'|'missing'|'withdrawn', reason: string}>, order?: Array<{name: string, package: string}>}}|null} [iconSets]
166
173
  * The project's icon sets (AST-084 FR17), or null when they could not be read.
167
174
  * Experimental: may change or be removed in a patch release.
168
175
  * @property {Array<{file: string, local: string, meanings: string[] | null, uses: number}>|null} [iconPlaceholders]
@@ -190,6 +197,22 @@ function readPkg(pkgPath) {
190
197
  }
191
198
  }
192
199
 
200
+ /**
201
+ * Packages that own the project's added themes (local themes excluded); empty
202
+ * when the project manages no themes or its theme state cannot be read.
203
+ * @param {string} cwd
204
+ * @returns {string[]}
205
+ */
206
+ function addedThemePackages(cwd) {
207
+ try {
208
+ return Object.values(readThemeState(cwd).themes ?? {}).filter(
209
+ owner => typeof owner === 'string' && !isLocalThemeOwner(owner),
210
+ );
211
+ } catch {
212
+ return [];
213
+ }
214
+ }
215
+
193
216
  /**
194
217
  * Read the version of an installed package from a resolved directory.
195
218
  * @param {string|null} dir
@@ -630,9 +653,11 @@ export function checkImplicitIntegrations(ctx) {
630
653
 
631
654
  /**
632
655
  * The sentence `implicit-integrations` adds for dependencies whose manifest
633
- * could not be loaded, or '' when there are none. Still informational: the
634
- * package is a dependency's own bug, which `doctor integration validate`
635
- * diagnoses, but doctor must not report it as absent.
656
+ * could not be loaded, or '' when there are none. Still informational: a
657
+ * broken install (a package the dependency requires is missing) is also that
658
+ * package's integration issue (INV14), and anything else is the dependency's
659
+ * own bug, which `doctor integration validate` diagnoses; either way doctor
660
+ * must not report it as absent.
636
661
  * @param {Array<{spec: string, error: string}>} failures
637
662
  * @returns {string}
638
663
  */
@@ -1005,6 +1030,69 @@ export function checkIntegrationIssues(ctx) {
1005
1030
  };
1006
1031
  }
1007
1032
 
1033
+ /**
1034
+ * Every loaded integration's `@astryxdesign/core` peer range admits the
1035
+ * installed Core: a package's declared peer ranges define the Core versions it
1036
+ * supports (spec:AST-017 FR12). A package made for another Core installs with
1037
+ * only a package manager warning, and its components, themes and docs may not
1038
+ * work. New, so it warns: a project that passed before keeps passing.
1039
+ * Packages of added themes are left to `theme-core-peers` (spec:AST-050 FR11),
1040
+ * which applies the same rule. Null when Core is not installed or no other
1041
+ * loaded integration declares a Core range.
1042
+ * @param {DoctorContext} ctx
1043
+ * @returns {DoctorCheck | null}
1044
+ */
1045
+ export function checkIntegrationCoreRange(ctx) {
1046
+ const core = pkgVersion(ctx.coreDir);
1047
+ if (!core || ctx.integrations == null) return null;
1048
+ // `theme-core-peers` already judges each added theme package by the same
1049
+ // rule (`corePeerRange`), with a fix that keeps the theme setup working.
1050
+ const reportedByThemeChecks = new Set(ctx.addedThemePackages ?? []);
1051
+ /** @type {Array<{name: string, version: string | null, range: string, accepts: boolean}>} */
1052
+ const declared = [];
1053
+ for (const integration of ctx.integrations) {
1054
+ if (integration.__loadError != null || !integration.__packageDir) continue;
1055
+ const pkg = readPkg(path.join(integration.__packageDir, 'package.json'));
1056
+ const name = typeof pkg?.name === 'string' ? pkg.name : integration.name;
1057
+ if (reportedByThemeChecks.has(name)) continue;
1058
+ const {range, accepts} = corePeerRange(pkg, core);
1059
+ // An integration need not depend on Core; only a declared, non-empty range
1060
+ // is a claim about which Core it supports.
1061
+ if (range == null || range === '') continue;
1062
+ declared.push({
1063
+ name,
1064
+ version: typeof pkg?.version === 'string' ? pkg.version : null,
1065
+ range,
1066
+ accepts,
1067
+ });
1068
+ }
1069
+ if (declared.length === 0) return null;
1070
+ const excluded = declared.filter(d => !d.accepts);
1071
+ const label = 'Integrations support the installed Core';
1072
+ if (excluded.length === 0) {
1073
+ return {
1074
+ id: 'integration-core-range',
1075
+ label,
1076
+ status: 'pass',
1077
+ message: `${declared.length} loaded integration${declared.length === 1 ? ' supports' : 's support'} @astryxdesign/core ${core} (${nameIntegrations(declared)}).`,
1078
+ };
1079
+ }
1080
+ return {
1081
+ id: 'integration-core-range',
1082
+ label,
1083
+ status: 'warn',
1084
+ message: `${excluded
1085
+ .map(
1086
+ d =>
1087
+ `${d.name}${d.version ? `@${d.version}` : ''} supports @astryxdesign/core ${d.range}`,
1088
+ )
1089
+ .join(
1090
+ '; ',
1091
+ )}, but the project has ${core}. ${excluded.length === 1 ? 'Its' : 'Their'} components, themes and docs were made for another Core and may not work.`,
1092
+ fix: `Install a release of ${excluded.length === 1 ? 'that package' : 'each package'} whose @astryxdesign/core range includes ${core}, or move the project to a Core in that range. When no such release exists, ask the package's owner for one.`,
1093
+ };
1094
+ }
1095
+
1008
1096
  /**
1009
1097
  * The project's icon sets (AST-084 FR17). Fails when `experimental.iconSet`
1010
1098
  * names a set, main or backup, that is not installed, that is installed but
@@ -1060,11 +1148,34 @@ export function checkIconSets(ctx) {
1060
1148
  fix: 'Write each name in experimental.iconSet as "<package>/<set>" (`astryx experimental icon --list` names them).',
1061
1149
  };
1062
1150
  }
1151
+ // The look a project picks is one of its main set's variants.
1152
+ const declared = choice.set?.data.variants ?? [];
1153
+ if (choice.set && choice.variant && !declared.includes(choice.variant)) {
1154
+ return {
1155
+ id,
1156
+ label,
1157
+ status: 'fail',
1158
+ message:
1159
+ declared.length === 0
1160
+ ? `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured} declares no variants: it draws one look.`
1161
+ : `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured} declares no such variant. Its variants: ${declared.join(', ')}.`,
1162
+ fix:
1163
+ declared.length === 0
1164
+ ? `Remove experimental.iconVariant: run \`${iconUseCommandOf(choice)}\`.`
1165
+ : `Pick one of its variants: \`${iconUseCommandOf(choice, '<variant>')}\`.`,
1166
+ };
1167
+ }
1063
1168
  const order = choice.order ?? [];
1064
1169
  const unlisted = sets.filter(set => !order.includes(set));
1065
1170
  if (sets.length > 1 && unlisted.length > 0 && order.length > 0) {
1066
1171
  const [main, ...backups] = order;
1067
- const {problem, fix} = unlistedIconSets(sets, main, backups, unlisted);
1172
+ const {problem, fix} = unlistedIconSets(
1173
+ sets,
1174
+ main,
1175
+ backups,
1176
+ unlisted,
1177
+ choice.variant,
1178
+ );
1068
1179
  return {
1069
1180
  id,
1070
1181
  label,
@@ -1086,10 +1197,24 @@ export function checkIconSets(ctx) {
1086
1197
  id,
1087
1198
  label,
1088
1199
  status: 'pass',
1089
- message: `${sets.length} icon set${sets.length === 1 ? '' : 's'} installed. ${choice.reason}`,
1200
+ message: `${sets.length} icon set${sets.length === 1 ? '' : 's'} installed. ${choice.reason}${choice.variant ? ` Each icon draws its "${choice.variant}" look where its set has one.` : ''}`,
1090
1201
  };
1091
1202
  }
1092
1203
 
1204
+ /**
1205
+ * The `experimental icon use` command that writes the project's list again,
1206
+ * as astryx.config names it, with a variant when one is given.
1207
+ * @param {NonNullable<DoctorContext['iconSets']>['choice']} choice
1208
+ * @param {string} [variant]
1209
+ */
1210
+ function iconUseCommandOf(choice, variant) {
1211
+ return iconUseCommand(
1212
+ /** @type {string} */ (choice.configured),
1213
+ (choice.backups ?? []).map(each => each.selector),
1214
+ variant,
1215
+ );
1216
+ }
1217
+
1093
1218
  /**
1094
1219
  * The placeholder component for a missing icon, still in the project's own
1095
1220
  * source (AST-084): each file and the meanings it stands for, with the commands that give each a
@@ -1122,7 +1247,12 @@ export function checkIconPlaceholders(ctx) {
1122
1247
  )
1123
1248
  .join(', ');
1124
1249
  const uses = found.reduce((total, each) => total + each.uses, 0);
1125
- const [mapFix, backupFix] = placeholderFixes(meanings, main);
1250
+ const [mapFix, backupFix] = placeholderFixes(
1251
+ meanings,
1252
+ main,
1253
+ (choice.backups ?? []).map(each => each.selector),
1254
+ choice.variant,
1255
+ );
1126
1256
  return {
1127
1257
  id,
1128
1258
  label,
@@ -2192,7 +2322,7 @@ export function checkGatherCache() {
2192
2322
  id: 'gather-cache',
2193
2323
  label: 'Kept catalog cache',
2194
2324
  status: 'info',
2195
- message: `search, build, component, template, theme and discover keep what they gather (search's catalogs and each integration's check results) 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, and deleting the folder clears it.`,
2325
+ 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, integrations' theme records, and doctor's docs checks) 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, and deleting the folder clears it.`,
2196
2326
  };
2197
2327
  }
2198
2328
 
@@ -2210,6 +2340,7 @@ export const SYNC_CHECKS = [
2210
2340
  checkConfiguredIntegrations,
2211
2341
  checkProviderIdentity,
2212
2342
  checkIntegrationIssues,
2343
+ checkIntegrationCoreRange,
2213
2344
  checkIconSets,
2214
2345
  checkIconPlaceholders,
2215
2346
  checkAgentDocs,
@@ -2400,6 +2531,7 @@ export async function runChecks(options = {}) {
2400
2531
  coreDir,
2401
2532
  ownCli: projectHasOwnCli(cwd),
2402
2533
  projectCore: projectCoreVersion(cwd),
2534
+ addedThemePackages: addedThemePackages(cwd),
2403
2535
  configPath,
2404
2536
  integrations,
2405
2537
  docsCatalog,
@@ -2465,9 +2597,22 @@ export async function runChecks(options = {}) {
2465
2597
  );
2466
2598
  }
2467
2599
  checks.push(await checkAuthoringDocs(ctx));
2468
- checks.push(await checkCliDocs(ctx));
2469
- checks.push(await checkDocsTree(ctx));
2470
- checks.push(await checkDocsProgressiveDisclosure(ctx));
2600
+ // The checks that read only files, each kept while every file it read is
2601
+ // unchanged; the Core the project loads is part of what they read.
2602
+ const where = {cwd, coreDir: coreDir ?? null};
2603
+ checks.push(
2604
+ await keptFileCheck({name: 'cli-docs', ...where}, () => checkCliDocs(ctx)),
2605
+ );
2606
+ checks.push(
2607
+ await keptFileCheck({name: 'docs-tree', ...where}, () =>
2608
+ checkDocsTree(ctx),
2609
+ ),
2610
+ );
2611
+ checks.push(
2612
+ await keptFileCheck({name: 'docs-progressive', ...where}, () =>
2613
+ checkDocsProgressiveDisclosure(ctx),
2614
+ ),
2615
+ );
2471
2616
 
2472
2617
  const summary = {pass: 0, warn: 0, fail: 0, info: 0};
2473
2618
  for (const c of checks) summary[c.status] += 1;