@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
@@ -88,6 +88,7 @@ export function allErrorCodes(): string[];
88
88
  * | 'ERR_WRITE_FAILED'
89
89
  * | 'ERR_THEME_INVALID'
90
90
  * | 'ERR_THEME_LOAD'
91
+ * | 'ERR_THEME_STALE'
91
92
  * | 'ERR_PALETTE_GENERATION'
92
93
  * | 'ERR_VERSION_DETECT'
93
94
  * | 'ERR_INVALID_VERSION'
@@ -133,4 +134,4 @@ export const ERROR_CODES: Readonly<Record<ErrorCode, ErrorCode>>;
133
134
  /**
134
135
  * Stable error-code string union. Append-only.
135
136
  */
136
- export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_CODEMOD_PROTECTED" | "ERR_CODEMOD_PROTECTION_SOURCE" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED" | "ERR_VERSIONS_UNAVAILABLE" | "ERR_PROJECT_REQUIRED" | "ERR_RENDER_COMPILE" | "ERR_RENDER_NO_DEFAULT_EXPORT" | "ERR_RENDER_MISSING_DEPENDENCY" | "ERR_RENDER_BROWSER_API" | "ERR_RENDER_ASSET_TOO_LARGE" | "ERR_RENDER_TIMEOUT" | "ERR_RENDER_FAILED" | "ERR_RENDER_NOT_ASTRYX" | "ERR_RENDER_SOURCE_DAMAGED" | "ERR_THEME_BAD_VALUE" | "ERR_THEME_NO_MODE" | "ERR_THEME_UNKNOWN_PART" | "ERR_THEME_UNKNOWN_VARIANT" | "ERR_THEME_UNKNOWN_STATE" | "ERR_THEME_PRIVATE_TOKEN" | "ERR_THEME_UNKNOWN_TOKEN" | "ERR_THEME_NO_EFFECT" | "ERR_THEME_NOT_CHECKED" | "ERR_THEME_BUSY" | "ERR_THEME_UNKNOWN_THING" | "ERR_THEME_NOT_SET" | "ERR_THEME_NOTHING_TO_UNDO");
137
+ export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_CODEMOD_PROTECTED" | "ERR_CODEMOD_PROTECTION_SOURCE" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_THEME_STALE" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED" | "ERR_VERSIONS_UNAVAILABLE" | "ERR_PROJECT_REQUIRED" | "ERR_RENDER_COMPILE" | "ERR_RENDER_NO_DEFAULT_EXPORT" | "ERR_RENDER_MISSING_DEPENDENCY" | "ERR_RENDER_BROWSER_API" | "ERR_RENDER_ASSET_TOO_LARGE" | "ERR_RENDER_TIMEOUT" | "ERR_RENDER_FAILED" | "ERR_RENDER_NOT_ASTRYX" | "ERR_RENDER_SOURCE_DAMAGED" | "ERR_THEME_BAD_VALUE" | "ERR_THEME_NO_MODE" | "ERR_THEME_UNKNOWN_PART" | "ERR_THEME_UNKNOWN_VARIANT" | "ERR_THEME_UNKNOWN_STATE" | "ERR_THEME_PRIVATE_TOKEN" | "ERR_THEME_UNKNOWN_TOKEN" | "ERR_THEME_NO_EFFECT" | "ERR_THEME_NOT_CHECKED" | "ERR_THEME_BUSY" | "ERR_THEME_UNKNOWN_THING" | "ERR_THEME_NOT_SET" | "ERR_THEME_NOTHING_TO_UNDO");
@@ -47,6 +47,7 @@ export type ErrorCode =
47
47
  | 'ERR_WRITE_FAILED'
48
48
  | 'ERR_THEME_INVALID'
49
49
  | 'ERR_THEME_LOAD'
50
+ | 'ERR_THEME_STALE'
50
51
  | 'ERR_VERSION_DETECT'
51
52
  | 'ERR_INVALID_VERSION'
52
53
  | 'ERR_DEP_MISSING'
@@ -219,6 +219,11 @@ export const doc = {
219
219
  description:
220
220
  'A theme file could not be loaded / parsed into a defineTheme result.',
221
221
  },
222
+ {
223
+ value: 'ERR_THEME_STALE',
224
+ description:
225
+ '`theme build --check` found stale or missing outputs: exit 1, in the check result (`code`), not an error.',
226
+ },
222
227
  {
223
228
  value: 'ERR_PALETTE_GENERATION',
224
229
  description:
@@ -77,6 +77,7 @@
77
77
  * | 'ERR_WRITE_FAILED'
78
78
  * | 'ERR_THEME_INVALID'
79
79
  * | 'ERR_THEME_LOAD'
80
+ * | 'ERR_THEME_STALE'
80
81
  * | 'ERR_PALETTE_GENERATION'
81
82
  * | 'ERR_VERSION_DETECT'
82
83
  * | 'ERR_INVALID_VERSION'
@@ -219,6 +220,8 @@ export const ERROR_CODES = Object.freeze({
219
220
  ERR_THEME_INVALID: 'ERR_THEME_INVALID',
220
221
  /** A theme file could not be loaded / parsed into a defineTheme result. */
221
222
  ERR_THEME_LOAD: 'ERR_THEME_LOAD',
223
+ /** `--check` found built outputs stale or missing (a result, exit 1). */
224
+ ERR_THEME_STALE: 'ERR_THEME_STALE',
222
225
 
223
226
  // ── Palette generation ──────────────────────────────────────────
224
227
  /** A palette generation request or its constraints were invalid. */
@@ -84,4 +84,19 @@ export function toErrorEnvelope(err: unknown, suggestions?: import("./base").Sug
84
84
  * done before it failed (see toErrorEnvelope).
85
85
  */
86
86
  export function jsonError(message: string, suggestions?: import("./base").Suggestion[], code?: string, receipt?: Record<string, unknown>): void;
87
+ /**
88
+ * Whether the output on `fd` is captured in process: the console method or
89
+ * the stream's write replaced since this module loaded (a test).
90
+ * @param {number} fd
91
+ */
92
+ export function outputCaptured(fd: number): boolean;
93
+ /**
94
+ * Write `text` to a file descriptor whole, synchronously, waiting while a
95
+ * full pipe drains (a non-blocking pipe answers EAGAIN until its reader
96
+ * reads). Used for a command's last output before it exits, so nothing is
97
+ * lost however slowly the output is read.
98
+ * @param {number} fd 1 (stdout) or 2 (stderr)
99
+ * @param {string} text
100
+ */
101
+ export function writeAllSync(fd: number, text: string): void;
87
102
  export const API_VERSION: 1;
@@ -31,6 +31,7 @@
31
31
  import {ERROR_CODES, isErrorCode} from './error-codes.mjs';
32
32
  import {recordEnvelope, setOutcome} from '../debug/index.mjs';
33
33
  import {answeredBy} from '../release/run-context.mjs';
34
+ import * as fs from 'node:fs';
34
35
 
35
36
  export const API_VERSION = 1;
36
37
 
@@ -171,6 +172,56 @@ export function jsonError(message, suggestions, code, receipt) {
171
172
  const err = toErrorEnvelope(message, suggestions, code, receipt);
172
173
  // No-op when cliError already classified this failure — first outcome wins.
173
174
  setOutcome('error', {exitCode: 1, error: new Error(message), code: err.code});
174
- console.log(JSON.stringify(err, null, 2));
175
+ // Written whole before the exit: a process that exits with output still
176
+ // queued for a pipe (a slow reader, bash `$(…)`) loses all but the first
177
+ // 64 KiB, and a --json caller gets invalid JSON.
178
+ writeAllSync(1, `${JSON.stringify(err, null, 2)}\n`);
175
179
  process.exit(1);
176
180
  }
181
+
182
+ const CONSOLE_LOG = console.log;
183
+ const CONSOLE_ERROR = console.error;
184
+
185
+ /**
186
+ * Whether the output on `fd` is captured in process: the console method or
187
+ * the stream's write replaced since this module loaded (a test).
188
+ * @param {number} fd
189
+ */
190
+ export function outputCaptured(fd) {
191
+ const stream = fd === 2 ? process.stderr : process.stdout;
192
+ return (
193
+ Object.hasOwn(stream, 'write') ||
194
+ (fd === 2 ? console.error !== CONSOLE_ERROR : console.log !== CONSOLE_LOG)
195
+ );
196
+ }
197
+
198
+ /**
199
+ * Write `text` to a file descriptor whole, synchronously, waiting while a
200
+ * full pipe drains (a non-blocking pipe answers EAGAIN until its reader
201
+ * reads). Used for a command's last output before it exits, so nothing is
202
+ * lost however slowly the output is read.
203
+ * @param {number} fd 1 (stdout) or 2 (stderr)
204
+ * @param {string} text
205
+ */
206
+ export function writeAllSync(fd, text) {
207
+ // Output captured in process (a test replaced the console or the
208
+ // stream's write) keeps going through what captures it.
209
+ if (outputCaptured(fd)) {
210
+ (fd === 2 ? console.error : console.log)(text.replace(/\n$/, ''));
211
+ return;
212
+ }
213
+ const buf = Buffer.from(text, 'utf8');
214
+ const pause = new Int32Array(new SharedArrayBuffer(4));
215
+ let off = 0;
216
+ while (off < buf.length) {
217
+ try {
218
+ off += fs.writeSync(fd, buf, off, buf.length - off);
219
+ } catch (e) {
220
+ const code = /** @type {any} */ (e)?.code;
221
+ // A full pipe: wait a moment for its reader, then write the rest.
222
+ if (code === 'EAGAIN') Atomics.wait(pause, 0, 0, 5);
223
+ // The reader is gone (EPIPE) or the fd is closed: nothing to keep.
224
+ else return;
225
+ }
226
+ }
227
+ }
@@ -386,7 +386,7 @@ export const doc = {
386
386
  {
387
387
  value: 'theme.build.check',
388
388
  description:
389
- 'The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing | outdated}), and the full list of checked paths. Writes nothing.',
389
+ '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.',
390
390
  },
391
391
  {
392
392
  value: 'theme.build.batch',
@@ -0,0 +1,14 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ export function babelParser(): typeof import("@babel/parser");
5
+ /** @type {typeof import('@babel/parser').parse} */
6
+ export const babelParse: typeof import("@babel/parser").parse;
7
+ export function babelCore(): typeof import("@babel/core");
8
+ export function jscodeshift(): any;
9
+ export function selectorParser(): typeof import("postcss-selector-parser");
10
+ /**
11
+ * Every package loaded on first use, here and in the ShadCN source variants,
12
+ * for the test that each resolves to one file either way.
13
+ */
14
+ export const LAZY_PACKAGES: string[];
@@ -0,0 +1,82 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The CLI's heavy parsing and transform dependencies, each loaded on
5
+ * first use rather than when a module that may use it is imported.
6
+ * @input Nothing; each getter requires its package once and keeps it.
7
+ * @output `babelParser` (and `babelParse`, its `parse`), `babelCore`,
8
+ * `jscodeshift` and `selectorParser`: the same module objects a static
9
+ * import gives, since each package resolves to the same file for `require`
10
+ * as for `import` (test/lazy-dependencies.test.mjs checks it).
11
+ * @position The first-use loader for these packages on the API's import
12
+ * path (authoring/ may not import foundation, so the ShadCN source variants
13
+ * keep their own). Everything that imports the CLI's API reaches the
14
+ * modules that parse or rewrite sources, and most runs never parse one, so
15
+ * loading Babel and jscodeshift with them cost every importer about 350
16
+ * modules. Each package is still resolved when this module loads, which
17
+ * reads no module, so every module that imports this loader needs all four
18
+ * packages installed: a broken install without one fails when such a
19
+ * module loads, never as a parse that quietly finds nothing. The `Project`
20
+ * seam and the agent docs reach this loader through component discovery,
21
+ * so on such an install every command except `help`, `--version`, `blog`
22
+ * and `manifest` stops at load; a run with no options names the missing
23
+ * package (an option the failed command does not declare is rejected as
24
+ * unknown first).
25
+ */
26
+
27
+ import {createRequire} from 'node:module';
28
+
29
+ const require = createRequire(import.meta.url);
30
+
31
+ // Resolved, not loaded: a missing package fails here, at import.
32
+ for (const pkg of [
33
+ '@babel/parser',
34
+ '@babel/core',
35
+ 'jscodeshift',
36
+ 'postcss-selector-parser',
37
+ ]) {
38
+ require.resolve(pkg);
39
+ }
40
+
41
+ /** @type {typeof import('@babel/parser') | undefined} */
42
+ let parser;
43
+ /** @type {typeof import('@babel/core') | undefined} */
44
+ let core;
45
+ /** @type {any} */
46
+ let codeshift;
47
+ /** @type {typeof import('postcss-selector-parser') | undefined} */
48
+ let selectors;
49
+
50
+ /** @returns {typeof import('@babel/parser')} */
51
+ export const babelParser = () => (parser ??= require('@babel/parser'));
52
+
53
+ /** @type {typeof import('@babel/parser').parse} */
54
+ export const babelParse = (input, options) =>
55
+ babelParser().parse(input, options);
56
+
57
+ /** @returns {typeof import('@babel/core')} */
58
+ export const babelCore = () => (core ??= require('@babel/core'));
59
+
60
+ /**
61
+ * Untyped here: jscodeshift ships no types, and this module is reached by
62
+ * type checks that do not load the CLI's ambient declaration for it.
63
+ * @returns {any}
64
+ */
65
+ export const jscodeshift = () => (codeshift ??= require('jscodeshift'));
66
+
67
+ /** @returns {typeof import('postcss-selector-parser')} */
68
+ export const selectorParser = () =>
69
+ (selectors ??= require('postcss-selector-parser'));
70
+
71
+ /**
72
+ * Every package loaded on first use, here and in the ShadCN source variants,
73
+ * for the test that each resolves to one file either way.
74
+ */
75
+ export const LAZY_PACKAGES = [
76
+ '@babel/parser',
77
+ '@babel/core',
78
+ 'jscodeshift',
79
+ 'postcss-selector-parser',
80
+ 'recast',
81
+ '@babel/plugin-transform-typescript',
82
+ ];
@@ -15,7 +15,7 @@
15
15
  */
16
16
  export function checkExpression(expression: string, registry: import("./xle-ast").Registry | import("./browser").SerializedRegistry | object, opts?: {
17
17
  blocks?: import("./browser").XLEBlock[] | undefined;
18
- form?: "compact" | "outline" | "auto" | undefined;
18
+ form?: "compact" | "auto" | "outline" | undefined;
19
19
  loose?: boolean | undefined;
20
20
  }): import("./browser").CheckResult;
21
21
  /**
@@ -34,7 +34,7 @@ export function checkExpression(expression: string, registry: import("./xle-ast"
34
34
  */
35
35
  export function expandExpression(expression: string, registry: import("./xle-ast").Registry | import("./browser").SerializedRegistry | object, opts?: {
36
36
  blocks?: import("./browser").XLEBlock[] | undefined;
37
- form?: "compact" | "outline" | "auto" | undefined;
37
+ form?: "compact" | "auto" | "outline" | undefined;
38
38
  loose?: boolean | undefined;
39
39
  name?: string | undefined;
40
40
  blockModules?: Map<string, import("./xle-ast").BlockModule> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.15",
3
+ "version": "0.7.16-canary.g22213fd",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -111,6 +111,7 @@
111
111
  "@babel/parser": "7.29.8",
112
112
  "@babel/plugin-transform-typescript": "7.29.7",
113
113
  "@babel/types": "7.29.8",
114
+ "@csstools/css-syntax-patches-for-csstree": "1.1.6",
114
115
  "@stylexjs/babel-plugin": "^0.19.1",
115
116
  "ast-types": "0.16.3",
116
117
  "commander": "^12.1.0",
@@ -126,7 +127,7 @@
126
127
  "zod": "^4.6.7"
127
128
  },
128
129
  "peerDependencies": {
129
- "@astryxdesign/core": "*"
130
+ "@astryxdesign/core": "0.7.16-canary.g22213fd"
130
131
  },
131
132
  "peerDependenciesMeta": {
132
133
  "@astryxdesign/core": {
@@ -134,10 +135,10 @@
134
135
  }
135
136
  },
136
137
  "devDependencies": {
137
- "@astryxdesign/charts": "*",
138
- "@astryxdesign/core": "*",
139
- "@astryxdesign/lab": "*",
140
- "@astryxdesign/theme-neutral": "*",
138
+ "@astryxdesign/charts": "0.7.16-canary.g22213fd",
139
+ "@astryxdesign/core": "0.7.16-canary.g22213fd",
140
+ "@astryxdesign/lab": "0.7.16-canary.g22213fd",
141
+ "@astryxdesign/theme-neutral": "0.7.16-canary.g22213fd",
141
142
  "@heroicons/react": "^2.2.0",
142
143
  "@stylexjs/stylex": "^0.19.1",
143
144
  "@types/babel__core": "^7.20.5",