@astryxdesign/cli 0.6.0 → 0.6.1

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 (219) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/README.md +76 -67
  3. package/api/build/build.test.mjs +37 -0
  4. package/api/build/build.type.mjs +1 -1
  5. package/api/build/kit/kit.mjs +31 -1
  6. package/api/component/_adapter.mjs +14 -28
  7. package/api/component/integration-import-agreement.test.mjs +318 -0
  8. package/api/doctor/doctor.d.mts +32 -3
  9. package/api/doctor/doctor.doc.mjs +2 -1
  10. package/api/doctor/doctor.mjs +97 -4
  11. package/api/doctor/doctor.test.mjs +90 -1
  12. package/api/gap-report/gap-report-worker.d.mts +4 -0
  13. package/api/gap-report/gap-report-worker.mjs +73 -0
  14. package/api/gap-report/gap-report.d.mts +81 -0
  15. package/api/gap-report/gap-report.doc.d.mts +9 -0
  16. package/api/gap-report/gap-report.doc.mjs +127 -0
  17. package/api/gap-report/gap-report.mjs +707 -0
  18. package/api/gap-report/gap-report.test.mjs +1210 -0
  19. package/api/gap-report/gap-report.type.d.mts +88 -0
  20. package/api/gap-report/gap-report.type.mjs +69 -0
  21. package/api/index.d.mts +8 -1
  22. package/api/index.mjs +24 -1
  23. package/api/integration/add-contribution.d.mts +44 -0
  24. package/api/integration/add-contribution.mjs +1160 -0
  25. package/api/integration/add-contribution.test.mjs +733 -0
  26. package/api/integration/add-helpers.d.mts +80 -0
  27. package/api/integration/add-helpers.mjs +333 -0
  28. package/api/integration/add-helpers.test.mjs +161 -0
  29. package/api/integration/add-theme.d.mts +10 -0
  30. package/api/integration/add-theme.mjs +332 -0
  31. package/api/integration/add-theme.test.mjs +194 -0
  32. package/api/integration/integration-authoring.type.d.mts +55 -0
  33. package/api/integration/integration-authoring.type.mjs +76 -0
  34. package/api/integration/integration-block-exports.test.mjs +4 -0
  35. package/api/integration/integrationAdd.doc.d.mts +5 -0
  36. package/api/integration/integrationAdd.doc.mjs +100 -0
  37. package/api/integration/integrationAddAgentDoc.doc.d.mts +5 -0
  38. package/api/integration/integrationAddAgentDoc.doc.mjs +49 -0
  39. package/api/integration/integrationAddCodemod.doc.d.mts +5 -0
  40. package/api/integration/integrationAddCodemod.doc.mjs +55 -0
  41. package/api/integration/integrationAddComponent.doc.d.mts +5 -0
  42. package/api/integration/integrationAddComponent.doc.mjs +49 -0
  43. package/api/integration/integrationAddDoc.doc.d.mts +5 -0
  44. package/api/integration/integrationAddDoc.doc.mjs +59 -0
  45. package/api/integration/integrationAddTemplate.doc.d.mts +5 -0
  46. package/api/integration/integrationAddTemplate.doc.mjs +55 -0
  47. package/api/integration/integrationAddTheme.doc.d.mts +5 -0
  48. package/api/integration/integrationAddTheme.doc.mjs +85 -0
  49. package/api/integration/integrationPackCheck.doc.d.mts +5 -0
  50. package/api/integration/integrationPackCheck.doc.mjs +35 -0
  51. package/api/integration/pack-check.d.mts +27 -0
  52. package/api/integration/pack-check.mjs +795 -0
  53. package/api/integration/pack-check.test.mjs +569 -0
  54. package/api/integration/pack-check.type.d.mts +45 -0
  55. package/api/integration/pack-check.type.mjs +56 -0
  56. package/api/integration/public-api.test.mjs +21 -0
  57. package/api/integration/validate-integration.mjs +221 -11
  58. package/api/integration/validate-integration.test.mjs +189 -5
  59. package/api/integration/validateIntegration.doc.mjs +2 -2
  60. package/api/json/index.ts +1 -0
  61. package/api/search/search.mjs +19 -1
  62. package/api/theme/_adapter.d.mts +26 -28
  63. package/api/theme/_adapter.mjs +101 -38
  64. package/api/theme/add/add.d.mts +2 -1
  65. package/api/theme/add/add.mjs +56 -20
  66. package/api/theme/add/add.test.mjs +1 -0
  67. package/api/theme/build/build.d.mts +25 -0
  68. package/api/theme/build/build.mjs +101 -70
  69. package/api/theme/build/build.test.mjs +77 -44
  70. package/api/theme/integration-themes.test.mjs +183 -0
  71. package/api/theme/list/list.d.mts +10 -2
  72. package/api/theme/list/list.mjs +31 -10
  73. package/api/theme/list/list.test.mjs +102 -23
  74. package/api/theme/listThemes.doc.d.mts +1 -5
  75. package/api/theme/listThemes.doc.mjs +6 -13
  76. package/api/theme/targets/targets.test.mjs +22 -8
  77. package/api/theme/theme.d.mts +1 -1
  78. package/api/theme/theme.mjs +1 -1
  79. package/api/theme/theme.type.d.mts +9 -0
  80. package/api/theme/theme.type.mjs +3 -1
  81. package/api/theme/themeAdd.doc.d.mts +1 -4
  82. package/api/theme/themeAdd.doc.mjs +31 -31
  83. package/api/theme/themeBuild.doc.mjs +1 -1
  84. package/api/theme/themeList.doc.d.mts +1 -4
  85. package/api/theme/themeList.doc.mjs +7 -15
  86. package/api/theme/themeListAvailable.doc.d.mts +8 -0
  87. package/api/theme/themeListAvailable.doc.mjs +57 -0
  88. package/api/theme/themeTargets.doc.mjs +21 -7
  89. package/api/upgrade/_adapter.d.mts +2 -0
  90. package/api/upgrade/_adapter.mjs +1 -0
  91. package/api/upgrade/registry/registry.d.mts +40 -0
  92. package/api/upgrade/registry/registry.mjs +1154 -0
  93. package/api/upgrade/registry/registry.test.mjs +826 -0
  94. package/api/upgrade/run/run.mjs +49 -8
  95. package/api/upgrade/status/status.d.mts +6 -4
  96. package/api/upgrade/status/status.mjs +26 -8
  97. package/api/upgrade/upgrade.d.mts +2 -2
  98. package/api/upgrade/upgrade.doc.mjs +33 -9
  99. package/api/upgrade/upgrade.mjs +34 -7
  100. package/api/upgrade/upgrade.test.mjs +198 -8
  101. package/api/upgrade/upgrade.type.d.mts +90 -1
  102. package/api/upgrade/upgrade.type.mjs +51 -2
  103. package/assets/docs/cli-integrations.doc.mjs +152 -28
  104. package/assets/docs/getting-started.doc.mjs +1 -1
  105. package/assets/docs/{shadcn-compatibility.doc.mjs → shadcn-compatibility.doc.draft.mjs} +23 -13
  106. package/assets/docs/styling.doc.mjs +3 -3
  107. package/assets/docs/theme.doc.dense.mjs +2 -2
  108. package/assets/docs/theme.doc.mjs +23 -13
  109. package/assets/docs/theme.doc.zh.mjs +1 -1
  110. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +2 -1
  111. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +38 -12
  112. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadShowcase.doc.mjs +15 -0
  113. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadShowcase.tsx +87 -0
  114. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +23 -0
  115. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.tsx +75 -0
  116. package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +5 -19
  117. package/assets/templates/blocks/components/Center/CenterHorizontal.doc.mjs +3 -2
  118. package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +4 -5
  119. package/assets/templates/blocks/components/Toast/ToastAction.tsx +2 -1
  120. package/assets/templates/blocks/components/Toast/ToastDeduplication.tsx +2 -1
  121. package/assets/templates/blocks/components/Toast/ToastDismiss.tsx +2 -1
  122. package/assets/templates/blocks/components/Toast/ToastShowcase.tsx +2 -1
  123. package/assets/templates/blocks/components/Toast/ToastStacking.tsx +2 -1
  124. package/assets/templates/blocks/components/Toast/ToastTypes.tsx +2 -1
  125. package/assets/templates/pages/dashboard/template.doc.mjs +2 -2
  126. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +3 -2
  127. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +3 -2
  128. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +3 -3
  129. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -2
  130. package/assets/templates/pages/dashboard-progress/template.doc.mjs +2 -2
  131. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -2
  132. package/assets/templates/themes/butter/butterTheme.ts +3 -3
  133. package/assets/templates/themes/neutral/neutralTheme.ts +2 -2
  134. package/assets/templates/themes/stone/stoneTheme.ts +3 -3
  135. package/assets/theme.template.ts +4 -7
  136. package/authoring/config/config.doc.mjs +9 -1
  137. package/authoring/config/parse.d.mts +2 -0
  138. package/authoring/config/parse.mjs +28 -3
  139. package/authoring/config/parse.test.mjs +25 -3
  140. package/authoring/config/type.ts +3 -0
  141. package/authoring/doctypes/_schema.d.mts +3 -0
  142. package/authoring/doctypes/_schema.mjs +6 -1
  143. package/authoring/doctypes/base/type.ts +6 -6
  144. package/authoring/doctypes/component/component.doc.mjs +6 -0
  145. package/authoring/doctypes/component/type.ts +2 -0
  146. package/authoring/gap-report/parse.d.mts +63 -0
  147. package/authoring/gap-report/parse.mjs +121 -0
  148. package/authoring/gap-report/parse.test.mjs +172 -0
  149. package/authoring/gap-report/type.ts +107 -0
  150. package/authoring/index.d.mts +1 -0
  151. package/authoring/index.d.ts +12 -0
  152. package/authoring/index.mjs +4 -0
  153. package/authoring/integration/integration.doc.mjs +14 -2
  154. package/authoring/integration/parse.test.mjs +9 -4
  155. package/authoring/integration/schema.d.mts +2 -0
  156. package/authoring/integration/schema.mjs +1 -0
  157. package/authoring/integration/type.ts +23 -6
  158. package/authoring/shadcn/receipt.d.mts +219 -0
  159. package/authoring/shadcn/receipt.mjs +248 -0
  160. package/authoring/shadcn/receipt.test.mjs +187 -0
  161. package/authoring/shadcn/source-variants.d.mts +28 -0
  162. package/authoring/shadcn/source-variants.mjs +176 -0
  163. package/authoring/shadcn/source-variants.test.mjs +120 -0
  164. package/clients/cli/commands/build-theme.mjs +54 -19
  165. package/clients/cli/commands/build-theme.variants.test.mjs +15 -12
  166. package/clients/cli/commands/component/index.mjs +1 -1
  167. package/clients/cli/commands/docs.test.mjs +1 -0
  168. package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
  169. package/clients/cli/commands/gap-report.doc.mjs +73 -0
  170. package/clients/cli/commands/gap-report.mjs +114 -0
  171. package/clients/cli/commands/gap-report.test.mjs +198 -0
  172. package/clients/cli/commands/import-hint-correctness.test.mjs +88 -0
  173. package/clients/cli/commands/integration-add.doc.mjs +88 -0
  174. package/clients/cli/commands/integration-authoring.test.mjs +177 -0
  175. package/clients/cli/commands/integration-pack.doc.mjs +34 -0
  176. package/clients/cli/commands/integration-real-world.test.mjs +618 -0
  177. package/clients/cli/commands/integration.doc.mjs +28 -0
  178. package/clients/cli/commands/integration.mjs +153 -0
  179. package/clients/cli/commands/theme-add.doc.mjs +11 -6
  180. package/clients/cli/commands/theme-list.doc.mjs +21 -5
  181. package/clients/cli/commands/theme-targets.behavior.test.mjs +19 -2
  182. package/clients/cli/commands/theme.doc.mjs +2 -2
  183. package/clients/cli/commands/upgrade.doc.mjs +17 -4
  184. package/clients/cli/commands/upgrade.mjs +12 -1
  185. package/clients/cli/commands/upgrade.test.mjs +41 -0
  186. package/clients/cli/index.mjs +5 -0
  187. package/clients/cli/lib/component-format.mjs +42 -26
  188. package/clients/cli/lib/component-format.test.mjs +34 -3
  189. package/clients/cli/lib/manifest.mjs +12 -0
  190. package/foundation/config/project-themes.test.mjs +127 -0
  191. package/foundation/config/project.d.mts +23 -4
  192. package/foundation/config/project.mjs +96 -9
  193. package/foundation/config/project.test.mjs +132 -6
  194. package/foundation/discovery/component-discovery.d.mts +36 -0
  195. package/foundation/discovery/component-discovery.mjs +96 -0
  196. package/foundation/discovery/theme-discovery.d.mts +39 -0
  197. package/foundation/discovery/theme-discovery.mjs +650 -0
  198. package/foundation/discovery/theme-discovery.test.mjs +375 -0
  199. package/foundation/discovery/theming-targets.d.mts +16 -0
  200. package/foundation/discovery/theming-targets.mjs +39 -3
  201. package/foundation/discovery/theming-targets.test.mjs +139 -0
  202. package/foundation/integrations/autolink.d.mts +96 -0
  203. package/foundation/integrations/autolink.mjs +265 -0
  204. package/foundation/integrations/autolink.test.mjs +430 -0
  205. package/foundation/integrations/contribution-inventory.d.mts +152 -0
  206. package/foundation/integrations/contribution-inventory.mjs +497 -0
  207. package/foundation/integrations/contribution-inventory.test.mjs +361 -0
  208. package/foundation/integrations/integrations.d.mts +73 -9
  209. package/foundation/integrations/integrations.mjs +158 -8
  210. package/foundation/integrations/integrations.test.mjs +152 -29
  211. package/foundation/integrations/manifest-writer.d.mts +56 -0
  212. package/foundation/integrations/manifest-writer.mjs +328 -0
  213. package/foundation/integrations/manifest-writer.test.mjs +229 -0
  214. package/foundation/integrations/validate-contributions.mjs +81 -6
  215. package/foundation/response/error-codes.d.mts +4 -1
  216. package/foundation/response/error-codes.doc.mjs +16 -1
  217. package/foundation/response/error-codes.mjs +10 -1
  218. package/foundation/response/response-types.doc.mjs +23 -2
  219. package/package.json +8 -1
@@ -13,7 +13,7 @@
13
13
  * did that. Optional contributions such as `agentDocs` carry their own error
14
14
  * marker so a bad contribution is reported without withdrawing valid roots.
15
15
  * What is re-checked is the on-disk contributions (roots +
16
- * codemods/templates/components), because those regress independently of the
16
+ * codemods/templates/components/docs/themes), because those regress independently of the
17
17
  * manifest: a deleted directory, a template that lost its source file.
18
18
  *
19
19
  * @input a loaded-integration-shaped object (absolute contribution roots + identity)
@@ -22,10 +22,14 @@
22
22
  */
23
23
 
24
24
  import * as fs from 'node:fs';
25
+ import * as path from 'node:path';
26
+ import {isValidSemver} from '../env/semver.mjs';
27
+ import {findSourceOnlyCandidates} from './contribution-inventory.mjs';
25
28
  import {discoverIntegrationCodemods} from '../../assets/codemods/integration-discovery.mjs';
26
29
  import {discoverIntegrationTemplatesForOne} from '../discovery/template-adapter.mjs';
27
30
  import * as componentDiscovery from '../discovery/component-discovery.mjs';
28
31
  import {discoverIntegrationDocs} from '../discovery/docs-discovery.mjs';
32
+ import {discoverIntegrationThemes} from '../discovery/theme-discovery.mjs';
29
33
 
30
34
  /**
31
35
  * @typedef {import('./issue').AstryxIntegrationIssue} Issue
@@ -77,12 +81,18 @@ function checkUnknownKeys(integration, issues) {
77
81
  /**
78
82
  * Verify each declared contribution root exists on disk. A declared-but-missing
79
83
  * root is a `missing_root` error.
80
- * @param {{components?: string, templates?: string, codemods?: string, docs?: string}} resolved
84
+ * @param {{components?: string, templates?: string, codemods?: string, docs?: string, themes?: string}} resolved
81
85
  * absolute resolved roots (undefined when not declared)
82
86
  * @param {Issue[]} issues
83
87
  */
84
88
  function checkRoots(resolved, issues) {
85
- const kinds = /** @type {const} */ (['components', 'templates', 'codemods', 'docs']);
89
+ const kinds = /** @type {const} */ ([
90
+ 'components',
91
+ 'templates',
92
+ 'codemods',
93
+ 'docs',
94
+ 'themes',
95
+ ]);
86
96
  for (const kind of kinds) {
87
97
  const root = resolved[kind];
88
98
  if (root == null) continue;
@@ -106,10 +116,42 @@ function checkRoots(resolved, issues) {
106
116
  */
107
117
  async function checkCodemods(integration, issues) {
108
118
  if (!integration.codemods || !fs.existsSync(integration.codemods)) return;
119
+ for (const entry of fs.readdirSync(integration.codemods, {
120
+ withFileTypes: true,
121
+ })) {
122
+ if (
123
+ entry.isFile() &&
124
+ /\.(?:ts|mjs|js)$/u.test(entry.name) &&
125
+ !/\.(?:test|spec|fixture)\.(?:ts|mjs|js)$/u.test(entry.name)
126
+ ) {
127
+ issues.push(
128
+ issueWarning(
129
+ 'codemod_outside_version',
130
+ `Codemod file "${path.join(integration.codemods, entry.name)}" is outside a version folder, so upgrade will never load it.`,
131
+ ),
132
+ );
133
+ }
134
+ if (
135
+ entry.isDirectory() &&
136
+ !['node_modules', '.git', '__tests__', '__fixtures__'].includes(
137
+ entry.name,
138
+ ) &&
139
+ !isValidSemver(entry.name)
140
+ ) {
141
+ issues.push(
142
+ issueError(
143
+ 'invalid_codemod_version',
144
+ `Codemod folder "${entry.name}" is not an exact semver version such as 1.2.0.`,
145
+ ),
146
+ );
147
+ }
148
+ }
109
149
  try {
110
150
  await discoverIntegrationCodemods([integration]);
111
151
  } catch (err) {
112
- issues.push(issueError('invalid_codemod', /** @type {any} */ (err).message));
152
+ issues.push(
153
+ issueError('invalid_codemod', /** @type {any} */ (err).message),
154
+ );
113
155
  }
114
156
  }
115
157
 
@@ -127,7 +169,9 @@ async function checkTemplates(integration, issues) {
127
169
  issues.push(issueError('invalid_template', e.message));
128
170
  }
129
171
  } catch (err) {
130
- issues.push(issueError('invalid_template', /** @type {any} */ (err).message));
172
+ issues.push(
173
+ issueError('invalid_template', /** @type {any} */ (err).message),
174
+ );
131
175
  }
132
176
  }
133
177
 
@@ -159,8 +203,21 @@ async function checkComponents(integration, issues) {
159
203
  );
160
204
  }
161
205
  }
206
+ for (const name of findSourceOnlyCandidates(
207
+ integration.components,
208
+ records.map(record => record.name),
209
+ )) {
210
+ issues.push(
211
+ issueWarning(
212
+ 'source_without_component_doc',
213
+ `Component source "${name}.tsx" has no same-stem metadata file ${name}.doc.mjs, so Astryx ignores it.`,
214
+ ),
215
+ );
216
+ }
162
217
  } catch (err) {
163
- issues.push(issueError('invalid_component', /** @type {any} */ (err).message));
218
+ issues.push(
219
+ issueError('invalid_component', /** @type {any} */ (err).message),
220
+ );
164
221
  }
165
222
  }
166
223
 
@@ -189,6 +246,22 @@ async function checkDocs(integration, issues) {
189
246
  }
190
247
  }
191
248
 
249
+ /**
250
+ * Validate the integration's source-theme catalog. The same discovery function
251
+ * powers Project and theme list/add, so validation cannot accept a shape that
252
+ * consumers later fail to use.
253
+ * @param {LoadedIntegration} integration
254
+ * @param {Issue[]} issues
255
+ */
256
+ async function checkThemes(integration, issues) {
257
+ if (!integration.themes || !fs.existsSync(integration.themes)) return;
258
+ try {
259
+ await discoverIntegrationThemes(integration);
260
+ } catch (err) {
261
+ issues.push(issueError('invalid_theme', /** @type {any} */ (err).message));
262
+ }
263
+ }
264
+
192
265
  /**
193
266
  * Run every contribution validator against a loaded-integration-shaped object.
194
267
  * @param {LoadedIntegration} integration
@@ -199,6 +272,7 @@ async function runContributionChecks(integration, issues) {
199
272
  await checkTemplates(integration, issues);
200
273
  await checkComponents(integration, issues);
201
274
  await checkDocs(integration, issues);
275
+ await checkThemes(integration, issues);
202
276
  }
203
277
 
204
278
  /**
@@ -232,6 +306,7 @@ export async function validateLoadedIntegration(loaded) {
232
306
  templates: loaded.templates,
233
307
  codemods: loaded.codemods,
234
308
  docs: loaded.docs,
309
+ themes: loaded.themes,
235
310
  },
236
311
  issues,
237
312
  );
@@ -66,7 +66,10 @@ export function allErrorCodes(): string[];
66
66
  * | 'ERR_UNKNOWN_TEMPLATE'
67
67
  * | 'ERR_AMBIGUOUS_TEMPLATE'
68
68
  * | 'ERR_AMBIGUOUS_COMPONENT'
69
+ * | 'ERR_AMBIGUOUS_THEME'
69
70
  * | 'ERR_UNKNOWN_THEME'
71
+ * | 'ERR_INTEGRATION_ROOT_CONFLICT'
72
+ * | 'ERR_INTEGRATION_EXPORT_CONFLICT'
70
73
  * | 'ERR_UNKNOWN_PACKAGE'
71
74
  * | 'ERR_UNKNOWN_AGENT'
72
75
  * | 'ERR_UNKNOWN_FEATURE'
@@ -104,4 +107,4 @@ export const ERROR_CODES: Readonly<Record<ErrorCode, ErrorCode>>;
104
107
  /**
105
108
  * Stable error-code string union. Append-only.
106
109
  */
107
- 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_UNKNOWN_THEME" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "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");
110
+ 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_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");
@@ -113,10 +113,25 @@ export const doc = {
113
113
  description:
114
114
  'A component name is owned by more than one package (narrow with --package).',
115
115
  },
116
+ {
117
+ value: 'ERR_AMBIGUOUS_THEME',
118
+ description:
119
+ 'A theme slug is owned by more than one package (narrow with --package).',
120
+ },
116
121
  {
117
122
  value: 'ERR_UNKNOWN_THEME',
118
123
  description: 'No theme matched the requested slug (theme add).',
119
124
  },
125
+ {
126
+ value: 'ERR_INTEGRATION_ROOT_CONFLICT',
127
+ description:
128
+ 'An integration manifest already declares a different path for the requested contribution root.',
129
+ },
130
+ {
131
+ value: 'ERR_INTEGRATION_EXPORT_CONFLICT',
132
+ description:
133
+ 'A package export already maps a generated contribution subpath to a different target.',
134
+ },
120
135
  {
121
136
  value: 'ERR_UNKNOWN_PACKAGE',
122
137
  description: 'No package matched the requested name (discover).',
@@ -189,7 +204,7 @@ export const doc = {
189
204
  {
190
205
  value: 'ERR_THEME_INVALID',
191
206
  description:
192
- 'A theme definition was missing a required property (e.g. `name`).',
207
+ 'A theme definition or contributed theme catalog is invalid.',
193
208
  },
194
209
  {
195
210
  value: 'ERR_THEME_LOAD',
@@ -55,7 +55,10 @@
55
55
  * | 'ERR_UNKNOWN_TEMPLATE'
56
56
  * | 'ERR_AMBIGUOUS_TEMPLATE'
57
57
  * | 'ERR_AMBIGUOUS_COMPONENT'
58
+ * | 'ERR_AMBIGUOUS_THEME'
58
59
  * | 'ERR_UNKNOWN_THEME'
60
+ * | 'ERR_INTEGRATION_ROOT_CONFLICT'
61
+ * | 'ERR_INTEGRATION_EXPORT_CONFLICT'
59
62
  * | 'ERR_UNKNOWN_PACKAGE'
60
63
  * | 'ERR_UNKNOWN_AGENT'
61
64
  * | 'ERR_UNKNOWN_FEATURE'
@@ -140,8 +143,14 @@ export const ERROR_CODES = Object.freeze({
140
143
  ERR_AMBIGUOUS_TEMPLATE: 'ERR_AMBIGUOUS_TEMPLATE',
141
144
  /** A component name is owned by more than one package (narrow with --package). */
142
145
  ERR_AMBIGUOUS_COMPONENT: 'ERR_AMBIGUOUS_COMPONENT',
146
+ /** A theme slug is owned by more than one package (narrow with --package). */
147
+ ERR_AMBIGUOUS_THEME: 'ERR_AMBIGUOUS_THEME',
143
148
  /** No theme matched the requested slug (theme add). */
144
149
  ERR_UNKNOWN_THEME: 'ERR_UNKNOWN_THEME',
150
+ /** An integration root already points somewhere other than the requested path. */
151
+ ERR_INTEGRATION_ROOT_CONFLICT: 'ERR_INTEGRATION_ROOT_CONFLICT',
152
+ /** A package export already maps a generated contribution subpath elsewhere. */
153
+ ERR_INTEGRATION_EXPORT_CONFLICT: 'ERR_INTEGRATION_EXPORT_CONFLICT',
145
154
  /** No package matched the requested name (discover). */
146
155
  ERR_UNKNOWN_PACKAGE: 'ERR_UNKNOWN_PACKAGE',
147
156
  /** An unrecognized `--agent` value was passed to agent-docs/init. */
@@ -176,7 +185,7 @@ export const ERROR_CODES = Object.freeze({
176
185
  ERR_WRITE_FAILED: 'ERR_WRITE_FAILED',
177
186
 
178
187
  // ── Theme build ──────────────────────────────────────────────────
179
- /** A theme definition was missing a required property (e.g. `name`). */
188
+ /** A theme definition or contributed theme catalog is invalid. */
180
189
  ERR_THEME_INVALID: 'ERR_THEME_INVALID',
181
190
  /** A theme file could not be loaded / parsed into a defineTheme result. */
182
191
  ERR_THEME_LOAD: 'ERR_THEME_LOAD',
@@ -138,6 +138,17 @@ export const doc = {
138
138
  'An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and an optional maintainer note.',
139
139
  },
140
140
 
141
+ // gap reports
142
+ {
143
+ value: 'gap-report.categories',
144
+ description: 'The fixed gap category values and human-readable labels.',
145
+ },
146
+ {
147
+ value: 'gap-report.file',
148
+ description:
149
+ 'An aggregate receipt with overall status, the selected package and issues URL, ordered per-handler deliveries, and filedCount/routedOnlyCount totals.',
150
+ },
151
+
141
152
  // template
142
153
  {
143
154
  value: 'template.list',
@@ -197,12 +208,12 @@ export const doc = {
197
208
  {
198
209
  value: 'theme.list',
199
210
  description:
200
- 'Every bundled theme as a ThemeListEntry[]: each with slug, displayName, description, and a maintained flag.',
211
+ 'Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package.',
201
212
  },
202
213
  {
203
214
  value: 'theme.add',
204
215
  description:
205
- 'A scaffold receipt: resolved slug, displayName, maintained flag, outputDir (relative to cwd), the theme entry file, its exportName, and the files written.',
216
+ 'A scaffold receipt: resolved slug, displayName, maintained flag, owner package, outputDir (relative to cwd), the theme entry file, its exportName, and the files written.',
206
217
  },
207
218
  {
208
219
  value: 'theme.template',
@@ -252,6 +263,16 @@ export const doc = {
252
263
  },
253
264
 
254
265
  // integration authoring
266
+ {
267
+ value: 'integration.add',
268
+ description:
269
+ 'A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun.',
270
+ },
271
+ {
272
+ value: 'integration.pack-check',
273
+ description:
274
+ 'The packed-package check: package identity, tarball facts, local and packed contribution inventories, and issues.',
275
+ },
255
276
  {
256
277
  value: 'integration.validate',
257
278
  description:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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",
@@ -85,11 +85,18 @@
85
85
  "CHANGELOG.md"
86
86
  ],
87
87
  "dependencies": {
88
+ "@babel/core": "7.29.7",
89
+ "@babel/parser": "7.29.8",
90
+ "@babel/plugin-transform-typescript": "7.29.7",
91
+ "@babel/types": "7.29.8",
92
+ "ast-types": "0.16.3",
88
93
  "commander": "^12.1.0",
89
94
  "jiti": "^2.7.0",
90
95
  "jscodeshift": "^17.3.0",
96
+ "node-diff3": "3.2.1",
91
97
  "postcss": "^8.5.23",
92
98
  "postcss-selector-parser": "^7.1.5",
99
+ "recast": "0.23.21",
93
100
  "zod": "^4.4.3"
94
101
  },
95
102
  "peerDependencies": {