@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
@@ -16,14 +16,28 @@ describe('themeTargets (api/theme/targets)', () => {
16
16
  expect(result.data.filter).toBeNull();
17
17
  expect(result.data.targets.length).toBeGreaterThan(100);
18
18
  expect(result.data.componentCount).toBeGreaterThan(50);
19
- for (const t of result.data.targets) {
20
- expect(Object.keys(t).sort()).toEqual([
21
- 'className',
22
- 'component',
23
- 'key',
24
- 'props',
25
- 'states',
26
- ]);
19
+ const allowedKeys = new Set([
20
+ 'className',
21
+ 'component',
22
+ 'deprecatedFor',
23
+ 'key',
24
+ 'props',
25
+ 'states',
26
+ ]);
27
+ for (const target of result.data.targets) {
28
+ expect(target).toMatchObject({
29
+ className: expect.any(String),
30
+ component: expect.any(String),
31
+ key: expect.any(String),
32
+ props: expect.any(Array),
33
+ states: expect.any(Array),
34
+ });
35
+ expect(Object.keys(target).filter(key => !allowedKeys.has(key))).toEqual(
36
+ [],
37
+ );
38
+ if (target.deprecatedFor !== undefined) {
39
+ expect(target.deprecatedFor).toEqual(expect.any(String));
40
+ }
27
41
  }
28
42
  }, 60_000);
29
43
 
@@ -5,7 +5,7 @@ export { themeAdd } from "./add/add.mjs";
5
5
  export { themeTemplate } from "./template/template.mjs";
6
6
  export { themeTargets } from "./targets/targets.mjs";
7
7
  export { themePaletteGenerate } from "./palette/generate/generate.mjs";
8
- export { themeList } from "./list/list.mjs";
9
8
  export { listThemes } from "./_adapter.mjs";
10
9
  export { themeBuild, importSpecifier } from "./build/build.mjs";
11
10
  export { COMPACT_11_STOPS, DEFAULT_21_STOPS, PALETTE_RECIPE, generatePaletteSet, generateTonalPalette, parseStopList, validateStops } from "./palette/generate/generator.mjs";
11
+ export { themeList, themeListAvailable } from "./list/list.mjs";
@@ -23,5 +23,5 @@ export {
23
23
  parseStopList,
24
24
  validateStops,
25
25
  } from './palette/generate/generator.mjs';
26
- export {themeList} from './list/list.mjs';
26
+ export {themeList, themeListAvailable} from './list/list.mjs';
27
27
  export {listThemes} from './_adapter.mjs';
@@ -65,6 +65,10 @@ export type ThemeListEntry = {
65
65
  displayName: string;
66
66
  description: string;
67
67
  maintained: boolean;
68
+ /**
69
+ * owner package for project-aware listings
70
+ */
71
+ package?: string | undefined;
68
72
  };
69
73
  /**
70
74
  * xds --json theme list
@@ -82,6 +86,7 @@ export type ThemeAddResponse = {
82
86
  slug: string;
83
87
  displayName: string;
84
88
  maintained: boolean;
89
+ package: string;
85
90
  outputDir: string;
86
91
  entry: string;
87
92
  exportName: string;
@@ -112,6 +117,10 @@ export type ThemeTargetEntry = {
112
117
  component: string;
113
118
  props: string[];
114
119
  states: string[];
120
+ /**
121
+ * - exact canonical replacement for a deprecated target
122
+ */
123
+ deprecatedFor?: string | undefined;
115
124
  };
116
125
  /**
117
126
  * xds --json theme targets [filter]
@@ -55,6 +55,7 @@
55
55
  * @property {string} displayName
56
56
  * @property {string} description
57
57
  * @property {boolean} maintained
58
+ * @property {string} [package] owner package for project-aware listings
58
59
  */
59
60
 
60
61
  /**
@@ -68,7 +69,7 @@
68
69
  * xds --json theme add <slug>
69
70
  * @typedef {object} ThemeAddResponse
70
71
  * @property {'theme.add'} type
71
- * @property {{slug: string, displayName: string, maintained: boolean, outputDir: string, entry: string, exportName: string, files: string[]}} data
72
+ * @property {{slug: string, displayName: string, maintained: boolean, package: string, outputDir: string, entry: string, exportName: string, files: string[]}} data
72
73
  */
73
74
 
74
75
  /**
@@ -90,6 +91,7 @@
90
91
  * @property {string} component
91
92
  * @property {string[]} props
92
93
  * @property {string[]} states
94
+ * @property {string} [deprecatedFor] - exact canonical replacement for a deprecated target
93
95
  */
94
96
 
95
97
  /**
@@ -2,10 +2,7 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * @file FunctionDoc for `themeAdd()` / `astryx theme add`. Colocated with the
6
- * API function it documents; the response-shape source of truth stays in
7
- * `theme.type.mjs`.
8
- * @position packages/cli/api/theme — function documentation
5
+ * @file FunctionDoc for `themeAdd()` / `astryx theme add`.
9
6
  */
10
7
  /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
11
8
  export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
@@ -1,10 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file FunctionDoc for `themeAdd()` / `astryx theme add`. Colocated with the
5
- * API function it documents; the response-shape source of truth stays in
6
- * `theme.type.mjs`.
7
- * @position packages/cli/api/theme — function documentation
4
+ * @file FunctionDoc for `themeAdd()` / `astryx theme add`.
8
5
  */
9
6
 
10
7
  /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
@@ -13,80 +10,83 @@ export const doc = {
13
10
  kind: 'api',
14
11
  name: 'themeAdd',
15
12
  displayName: 'themeAdd()',
16
- summary: 'Scaffold a bundled theme into a project as editable source.',
13
+ summary: 'Copy an available theme into a project as editable source.',
17
14
  description:
18
- "Copies a bundled theme's source (from the CLI's templates/themes/<slug>) into the " +
19
- "consumer's project so they own it, no theme package needed. Writes are staged to temp " +
20
- 'files then renamed, rolling back partials on failure so a failed write never leaves a ' +
21
- 'half-written theme. Returns a theme.add receipt describing where the files landed and how ' +
22
- 'to import them.',
15
+ 'Resolves a theme from the CLI bundle or an installed integration and copies every catalog-listed source file into the consumer project. Writes are staged and existing files require explicit overwrite. Duplicate slugs fail closed until the caller selects an owner package.',
23
16
  importPath: '@astryxdesign/cli/api',
24
17
  signature:
25
- 'themeAdd(slug: string, options?: {targetPath?: string, overwrite?: boolean, cwd?: string}): Promise<ThemeAddResponse>',
26
- keywords: ['theme', 'add', 'scaffold', 'copy', 'eject', 'starter'],
18
+ 'themeAdd(slug: string, options?: {targetPath?: string, overwrite?: boolean, cwd?: string, package?: string}): Promise<ThemeAddResponse>',
19
+ keywords: ['theme', 'add', 'integration', 'scaffold', 'copy', 'eject'],
27
20
  params: [
28
21
  {
29
22
  name: 'slug',
30
23
  type: 'string',
31
24
  description:
32
- 'Slug of the bundled theme to scaffold (matched case-insensitively).',
25
+ 'Slug of the available theme to copy (matched case-insensitively).',
33
26
  required: true,
34
27
  },
35
28
  {
36
29
  name: 'options.targetPath',
37
30
  type: 'string',
38
31
  description:
39
- 'Destination directory for the copied files. Must resolve within cwd.',
32
+ 'Destination directory for copied files. Must resolve within cwd.',
40
33
  default: "'src/themes/<slug>'",
41
34
  },
42
35
  {
43
36
  name: 'options.overwrite',
44
37
  type: 'boolean',
45
- description:
46
- 'Replace existing files instead of refusing when a destination file already exists.',
38
+ description: 'Replace existing files instead of refusing.',
47
39
  default: 'false',
48
40
  },
49
41
  {
50
42
  name: 'options.cwd',
51
43
  type: 'string',
52
- description: 'Directory the target path resolves against.',
44
+ description:
45
+ 'Project directory used for integration discovery and target paths.',
46
+ },
47
+ {
48
+ name: 'options.package',
49
+ type: 'string',
50
+ description: 'Exact owner package used to disambiguate a shared slug.',
53
51
  },
54
52
  ],
55
53
  returns: [
56
54
  {
57
55
  type: 'theme.add',
58
56
  description:
59
- 'Scaffold receipt: the resolved slug, displayName, whether the theme is maintained, the outputDir the copy landed in (relative to cwd), the theme entry file, its exportName, and the list of files written.',
57
+ 'Copy receipt with slug, displayName, maintained flag, owner package, outputDir, entry, exportName, and files.',
60
58
  },
61
59
  {
62
60
  type: 'theme.list',
63
61
  description:
64
- 'The `theme add` command also lists: a bare `astryx theme add` (no slug) or `--list` routes to themeList() and returns every bundled theme (slug, displayName, description, maintained).',
62
+ 'The CLI list affordance routes a bare `astryx theme add` or `--list` to themeListAvailable() and returns every available theme with its owner.',
65
63
  },
66
64
  ],
67
65
  throws: [
68
- {code: 'ERR_UNKNOWN_THEME', when: 'no bundled theme matches the slug'},
69
- {code: 'ERR_PATH_TRAVERSAL', when: 'the target path escapes cwd'},
70
66
  {
71
- code: 'ERR_NO_SOURCE',
72
- when: 'a bundled file for the theme is missing from this CLI build',
67
+ code: 'ERR_UNKNOWN_THEME',
68
+ when: 'no available theme matches the slug and package',
73
69
  },
70
+ {code: 'ERR_AMBIGUOUS_THEME', when: 'more than one package owns the slug'},
74
71
  {
75
- code: 'ERR_FILE_EXISTS',
76
- when: 'a destination file already exists and overwrite is not set',
72
+ code: 'ERR_THEME_INVALID',
73
+ when: 'the selected installed package has a blocking integration or theme-catalog error',
77
74
  },
75
+ {code: 'ERR_PATH_TRAVERSAL', when: 'the target path escapes cwd'},
76
+ {code: 'ERR_NO_SOURCE', when: 'a catalog-listed source file is missing'},
78
77
  {
79
- code: 'ERR_WRITE_FAILED',
80
- when: 'writing the files fails (staged temp files are rolled back)',
78
+ code: 'ERR_FILE_EXISTS',
79
+ when: 'a destination exists and overwrite is not set',
81
80
  },
81
+ {code: 'ERR_WRITE_FAILED', when: 'writing files fails'},
82
82
  ],
83
83
  examples: [
84
- {label: 'Scaffold a theme', code: "const r = await themeAdd('ocean');"},
84
+ {label: 'Copy a bundled theme', code: "await themeAdd('ocean');"},
85
85
  {
86
- label: 'Custom target + overwrite',
87
- code: "await themeAdd('ocean', {targetPath: 'src/theme', overwrite: true});",
86
+ label: 'Copy an integration theme',
87
+ code: "await themeAdd('ocean', {package: '@acme/themes'});",
88
88
  },
89
89
  ],
90
90
  command: 'theme add',
91
- related: ['themeList', 'listThemes', 'themeBuild'],
91
+ related: ['themeList', 'listThemes'],
92
92
  };
@@ -73,7 +73,7 @@ export const doc = {
73
73
  {
74
74
  type: 'theme.build',
75
75
  description:
76
- 'Build receipt: theme name, token- and component-override counts, output size in KB, the written outputs {css, js, dts, and variantsDts when custom prop values were augmented}, and any validation warnings. Resolves to null instead when the theme produced no CSS (nothing to build).',
76
+ 'Build receipt: theme name, token- and component-override counts, output size in KB, the written outputs {css, js, dts, and variantsDts when custom prop values were augmented}, and validation warnings—including exact canonical replacements for deprecated component target keys. Resolves to null instead when the theme produced no CSS (nothing to build).',
77
77
  },
78
78
  {
79
79
  type: 'theme.build.check',
@@ -2,10 +2,7 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * @file FunctionDoc for `themeList()` / `astryx theme list`. Colocated with the
6
- * API function it documents; the response-shape source of truth stays in
7
- * `theme.type.mjs`.
8
- * @position packages/cli/api/theme — function documentation
5
+ * @file FunctionDoc for the synchronous bundled-theme compatibility API.
9
6
  */
10
7
  /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
11
8
  export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
@@ -1,10 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file FunctionDoc for `themeList()` / `astryx theme list`. Colocated with the
5
- * API function it documents; the response-shape source of truth stays in
6
- * `theme.type.mjs`.
7
- * @position packages/cli/api/theme — function documentation
4
+ * @file FunctionDoc for the synchronous bundled-theme compatibility API.
8
5
  */
9
6
 
10
7
  /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
@@ -13,11 +10,9 @@ export const doc = {
13
10
  kind: 'api',
14
11
  name: 'themeList',
15
12
  displayName: 'themeList()',
16
- summary: 'List the themes bundled with this CLI build.',
13
+ summary: 'List themes bundled with this CLI build.',
17
14
  description:
18
- 'Projects the bundled-theme manifest into the theme.list envelope: the themes that themeAdd ' +
19
- 'can scaffold. A pure projection of the manifest read by listThemes(); no I/O beyond that read, ' +
20
- 'and it returns synchronously.',
15
+ 'Projects the bundled-theme manifest into a synchronous theme.list envelope. This preserves the original programmatic API contract. The CLI command uses themeListAvailable() so installed integrations also appear.',
21
16
  importPath: '@astryxdesign/cli/api',
22
17
  signature: 'themeList(): ThemeListResponse',
23
18
  keywords: ['theme', 'list', 'themes', 'bundled', 'available'],
@@ -26,18 +21,15 @@ export const doc = {
26
21
  {
27
22
  type: 'theme.list',
28
23
  description:
29
- 'Every bundled theme as a ThemeListEntry[]: each entry has slug, displayName, description, and a maintained flag.',
24
+ 'Every bundled theme as ThemeListEntry[]: slug, displayName, description, and maintained flag.',
30
25
  },
31
26
  ],
32
27
  throws: [
33
28
  {
34
29
  code: 'ERR_NO_SOURCE',
35
- when: 'the bundled-theme manifest exists but cannot be read or parsed',
30
+ when: 'the bundled-theme manifest cannot be read or parsed',
36
31
  },
37
32
  ],
38
- examples: [
39
- {label: 'List bundled themes', code: 'const {data} = themeList();'},
40
- ],
41
- command: 'theme list',
42
- related: ['themeAdd', 'listThemes', 'themeBuild'],
33
+ examples: [{label: 'List bundled themes', code: 'const {data} = themeList();'}],
34
+ related: ['themeListAvailable', 'themeAdd', 'listThemes'],
43
35
  };
@@ -0,0 +1,8 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * @file FunctionDoc for the project-aware `astryx theme list` API.
6
+ */
7
+ /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
8
+ export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
@@ -0,0 +1,57 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file FunctionDoc for the project-aware `astryx theme list` API.
5
+ */
6
+
7
+ /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
8
+ export const doc = {
9
+ type: 'function',
10
+ kind: 'api',
11
+ name: 'themeListAvailable',
12
+ displayName: 'themeListAvailable()',
13
+ summary: 'List bundled and installed integration themes.',
14
+ description:
15
+ 'Loads Project for the requested directory, combines the CLI bundle with source themes from installed integrations, and projects each entry with its owner package. An unreadable project configuration degrades to the bundled catalog.',
16
+ importPath: '@astryxdesign/cli/api',
17
+ signature:
18
+ 'themeListAvailable(options?: {cwd?: string, package?: string}): Promise<ThemeListResponse>',
19
+ keywords: ['theme', 'list', 'themes', 'integration', 'available', 'package'],
20
+ params: [
21
+ {
22
+ name: 'options.cwd',
23
+ type: 'string',
24
+ description: 'Project directory whose installed integrations contribute themes.',
25
+ },
26
+ {
27
+ name: 'options.package',
28
+ type: 'string',
29
+ description: 'Optional exact owner-package filter.',
30
+ },
31
+ ],
32
+ returns: [
33
+ {
34
+ type: 'theme.list',
35
+ description:
36
+ 'Every available theme as ThemeListEntry[]: slug, displayName, description, maintained flag, and owner package.',
37
+ },
38
+ ],
39
+ throws: [
40
+ {
41
+ code: 'ERR_NO_SOURCE',
42
+ when: 'the CLI bundled-theme manifest cannot be read or parsed',
43
+ },
44
+ ],
45
+ examples: [
46
+ {
47
+ label: 'List project themes',
48
+ code: 'const {data} = await themeListAvailable();',
49
+ },
50
+ {
51
+ label: 'List one package',
52
+ code: "await themeListAvailable({package: '@acme/themes'});",
53
+ },
54
+ ],
55
+ command: 'theme list',
56
+ related: ['themeList', 'themeAdd'],
57
+ };
@@ -16,15 +16,25 @@ export const doc = {
16
16
  summary: 'List every component theming target a theme can override.',
17
17
  description:
18
18
  'Enumerates the whole themeable surface: each `defineTheme` components key, the stable ' +
19
- 'class it paints, the component that declares it, and the props and states that are legal ' +
20
- 'override keys under it. Same source as the Theming table `astryx component <Name>` prints ' +
19
+ 'class it paints, the component that declares it, the props and states that are legal ' +
20
+ 'override keys under it, and the canonical replacement when a listed target is deprecated. ' +
21
+ 'Same source as the Theming table `astryx component <Name>` prints ' +
21
22
  '(the component docs), so the list cannot drift from the components, and `theme build` ' +
22
23
  'validates overrides against this exact set. A filter naming a component gives that ' +
23
- 'component\'s set; anything else is a substring search over the keys.',
24
+ "component's set; anything else is a substring search over the keys.",
24
25
  importPath: '@astryxdesign/cli/api',
25
26
  signature:
26
27
  'themeTargets(filter?: string, ctx?: {cwd?: string}): Promise<ThemeTargetsResponse>',
27
- keywords: ['theme', 'targets', 'defineTheme', 'components', 'override', 'class', 'states', 'audit'],
28
+ keywords: [
29
+ 'theme',
30
+ 'targets',
31
+ 'defineTheme',
32
+ 'components',
33
+ 'override',
34
+ 'class',
35
+ 'states',
36
+ 'audit',
37
+ ],
28
38
  params: [
29
39
  {
30
40
  name: 'filter',
@@ -35,18 +45,22 @@ export const doc = {
35
45
  {
36
46
  name: 'ctx.cwd',
37
47
  type: 'string',
38
- description: 'Directory the project\'s @astryxdesign/core is resolved from.',
48
+ description:
49
+ "Directory the project's @astryxdesign/core is resolved from.",
39
50
  },
40
51
  ],
41
52
  returns: [
42
53
  {
43
54
  type: 'theme.targets',
44
55
  description:
45
- 'The echoed filter, how many components are represented, and the targets: each {key, className, component, props, states}.',
56
+ 'The echoed filter, how many components are represented, and the targets: each {key, className, component, props, states, deprecatedFor?}.',
46
57
  },
47
58
  ],
48
59
  throws: [
49
- {code: 'ERR_CORE_NOT_FOUND', when: '@astryxdesign/core cannot be resolved from cwd'},
60
+ {
61
+ code: 'ERR_CORE_NOT_FOUND',
62
+ when: '@astryxdesign/core cannot be resolved from cwd',
63
+ },
50
64
  {code: 'ERR_UNKNOWN_COMPONENT', when: 'a filter matches no target'},
51
65
  ],
52
66
  examples: [
@@ -20,6 +20,7 @@
20
20
  * @property {string[]} [integration]
21
21
  * @property {string} [path]
22
22
  * @property {boolean} [installDeps]
23
+ * @property {boolean} [registry]
23
24
  */
24
25
  /**
25
26
  * Detect the installed target version from node_modules.
@@ -217,6 +218,7 @@ export type UpgradeOptions = {
217
218
  integration?: string[] | undefined;
218
219
  path?: string | undefined;
219
220
  installDeps?: boolean | undefined;
221
+ registry?: boolean | undefined;
220
222
  };
221
223
  export type AgentDocsRefreshPlan = {
222
224
  cwd: string;
@@ -63,6 +63,7 @@ const execFileAsync = promisify(execFile);
63
63
  * @property {string[]} [integration]
64
64
  * @property {string} [path]
65
65
  * @property {boolean} [installDeps]
66
+ * @property {boolean} [registry]
66
67
  */
67
68
 
68
69
  /**
@@ -0,0 +1,40 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /** @param {string} root */
5
+ export function discoverRegistryReceipts(root: string): string[];
6
+ /**
7
+ * @param {{apply?: boolean, path?: string}} options
8
+ * @param {{cwd?: string, fetchImpl?: typeof fetch, registryOrigin?: string, expectedVersion?: string, requireExpectedVersion?: boolean}} [ctx]
9
+ */
10
+ export function reconcileRegistryCompositions(options?: {
11
+ apply?: boolean;
12
+ path?: string;
13
+ }, { cwd, fetchImpl, registryOrigin, expectedVersion, requireExpectedVersion, }?: {
14
+ cwd?: string;
15
+ fetchImpl?: typeof fetch;
16
+ registryOrigin?: string;
17
+ expectedVersion?: string;
18
+ requireExpectedVersion?: boolean;
19
+ }): Promise<{
20
+ summary: import("../upgrade.type.mjs").RegistryCompositionSummary;
21
+ writtenFiles: string[];
22
+ }>;
23
+ /** @param {import('../upgrade.type.mjs').RegistryCompositionSummary} summary */
24
+ export function logRegistryCompositionSummary(summary: import("../upgrade.type.mjs").RegistryCompositionSummary): void;
25
+ /**
26
+ * Standalone `astryx upgrade --registry` leaf.
27
+ * @param {{apply?: boolean, path?: string}} options
28
+ * @param {{cwd?: string, fetchImpl?: typeof fetch, registryOrigin?: string, expectedVersion?: string, requireExpectedVersion?: boolean}} [ctx]
29
+ * @returns {Promise<import('../upgrade.type.mjs').UpgradeRegistryResponse>}
30
+ */
31
+ export function registryUpgrade(options?: {
32
+ apply?: boolean;
33
+ path?: string;
34
+ }, ctx?: {
35
+ cwd?: string;
36
+ fetchImpl?: typeof fetch;
37
+ registryOrigin?: string;
38
+ expectedVersion?: string;
39
+ requireExpectedVersion?: boolean;
40
+ }): Promise<import("../upgrade.type.mjs").UpgradeRegistryResponse>;