@astryxdesign/cli 0.6.5 → 0.6.6

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 (217) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +16 -15
  3. package/api/build/_adapter.d.mts +50 -2
  4. package/api/build/_adapter.mjs +98 -10
  5. package/api/build/build.doc.mjs +2 -2
  6. package/api/build/build.test.mjs +111 -2
  7. package/api/build/kit/kit.mjs +98 -22
  8. package/api/build/kit/rank.d.mts +32 -8
  9. package/api/build/kit/rank.mjs +291 -97
  10. package/api/build/kit/rank.test.mjs +231 -48
  11. package/api/build/kit/weights.d.mts +82 -0
  12. package/api/build/kit/weights.json +1 -0
  13. package/api/build/kit/weights.mjs +305 -0
  14. package/api/build/kit/weights.test.mjs +190 -0
  15. package/api/docs/docs.d.mts +6 -0
  16. package/api/docs/docs.depth.test.mjs +132 -0
  17. package/api/docs/docs.doc.mjs +31 -2
  18. package/api/docs/docs.mjs +44 -1
  19. package/api/docs/docs.test.mjs +279 -0
  20. package/api/docs/docs.type.d.mts +38 -1
  21. package/api/docs/docs.type.mjs +18 -1
  22. package/api/docs/integration-tree.test.mjs +572 -0
  23. package/api/docs/integrationDocs.test.mjs +336 -0
  24. package/api/docs/node/node.d.mts +28 -3
  25. package/api/docs/node/node.mjs +146 -23
  26. package/api/error.d.mts +22 -0
  27. package/api/error.mjs +42 -0
  28. package/api/gap-report/gap-report.d.mts +3 -1
  29. package/api/gap-report/gap-report.mjs +12 -2
  30. package/api/gap-report/gap-report.test.mjs +106 -0
  31. package/api/hook/list/list.d.mts +1 -1
  32. package/api/integration/add-contribution.d.mts +2 -1
  33. package/api/integration/add-contribution.mjs +7 -3
  34. package/api/integration/add-contribution.test.mjs +3 -3
  35. package/api/integration/add-theme.mjs +338 -26
  36. package/api/integration/add-theme.test.mjs +314 -1
  37. package/api/integration/authoring-checks.mjs +10 -7
  38. package/api/integration/authoring-checks.type.d.mts +8 -0
  39. package/api/integration/authoring-checks.type.mjs +7 -3
  40. package/api/integration/integration-authoring.type.d.mts +4 -1
  41. package/api/integration/integration-authoring.type.mjs +6 -1
  42. package/api/integration/integrationAdd.doc.mjs +6 -0
  43. package/api/integration/integrationAddTheme.doc.mjs +10 -0
  44. package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
  45. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  46. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
  47. package/api/integration/pack-check.mjs +12 -3
  48. package/api/integration/pack-check.test.mjs +52 -3
  49. package/api/integration/validate-integration.d.mts +4 -2
  50. package/api/integration/validate-integration.mjs +7 -2
  51. package/api/integration/validate-integration.test.mjs +55 -0
  52. package/api/integration/validate-integration.type.d.mts +5 -0
  53. package/api/integration/validate-integration.type.mjs +5 -1
  54. package/api/integration/validateIntegration.doc.mjs +1 -1
  55. package/api/layout/expand/expand.mjs +12 -7
  56. package/api/layout/expand/expand.receipt.test.mjs +74 -0
  57. package/api/layout/layout.type.d.mts +1 -0
  58. package/api/layout/layout.type.mjs +1 -0
  59. package/api/layout/layoutExpand.doc.mjs +1 -1
  60. package/api/search/search.d.mts +36 -5
  61. package/api/search/search.doc.mjs +4 -4
  62. package/api/search/search.mjs +194 -54
  63. package/api/search/search.test.mjs +825 -0
  64. package/api/search/search.type.d.mts +5 -5
  65. package/api/search/search.type.mjs +5 -5
  66. package/api/swizzle/copy/copy.mjs +66 -3
  67. package/api/swizzle/swizzle.doc.mjs +4 -0
  68. package/api/template/copy/copy.mjs +14 -8
  69. package/api/template/copy/copy.receipt.test.mjs +77 -0
  70. package/api/template/show/show.mjs +15 -4
  71. package/api/template/show/show.test.mjs +76 -0
  72. package/api/template/template-integration.test.mjs +14 -0
  73. package/api/template/template.d.mts +1 -1
  74. package/api/template/template.doc.mjs +6 -2
  75. package/api/template/template.mjs +1 -0
  76. package/api/template/template.type.d.mts +2 -0
  77. package/api/template/template.type.mjs +2 -0
  78. package/api/theme/build/build.d.mts +24 -0
  79. package/api/theme/build/build.icon-lineage.test.mjs +117 -0
  80. package/api/theme/build/build.icon-preservation.test.mjs +639 -0
  81. package/api/theme/build/build.mjs +381 -77
  82. package/api/theme/build/build.project-core.test.mjs +165 -0
  83. package/api/theme/build/build.test.mjs +190 -1
  84. package/api/theme/build/icon-imports.d.mts +47 -0
  85. package/api/theme/build/icon-imports.mjs +691 -0
  86. package/api/theme/themeBuild.doc.d.mts +4 -1
  87. package/api/theme/themeBuild.doc.mjs +14 -3
  88. package/api/upgrade/run/run.mjs +20 -3
  89. package/api/upgrade/run/run.test.mjs +45 -1
  90. package/api/upgrade/upgrade.doc.mjs +1 -1
  91. package/api/upgrade/upgrade.type.d.mts +1 -0
  92. package/api/upgrade/upgrade.type.mjs +1 -0
  93. package/assets/docs/icons.doc.mjs +1 -0
  94. package/assets/docs/theme.doc.mjs +3 -2
  95. package/assets/docs/tokens.doc.mjs +3 -3
  96. package/assets/docs/tree/add-a-theme.doc.mjs +4 -0
  97. package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
  98. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  99. package/assets/docs/tree/checks.doc.mjs +1 -1
  100. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  101. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  102. package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
  103. package/assets/docs/tree/template-doc-overview.doc.mjs +13 -1
  104. package/assets/docs/tree/troubleshooting.doc.mjs +9 -5
  105. package/assets/docs/tree/versioning.doc.mjs +7 -6
  106. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
  107. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
  108. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
  109. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
  110. package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
  111. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
  112. package/assets/templates/pages/blank/template.doc.mjs +3 -1
  113. package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
  114. package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
  115. package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
  116. package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
  117. package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
  118. package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
  119. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
  120. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
  121. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
  122. package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
  123. package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
  124. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
  125. package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
  126. package/assets/templates/pages/documentation/template.doc.mjs +10 -1
  127. package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
  128. package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
  129. package/assets/templates/pages/editor/template.doc.mjs +9 -1
  130. package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
  131. package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
  132. package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
  133. package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
  134. package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
  135. package/assets/templates/pages/ide/template.doc.mjs +9 -1
  136. package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
  137. package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
  138. package/assets/templates/pages/library/template.doc.mjs +15 -1
  139. package/assets/templates/pages/login/template.doc.mjs +10 -1
  140. package/assets/templates/pages/login-card/template.doc.mjs +11 -1
  141. package/assets/templates/pages/login-split/template.doc.mjs +10 -1
  142. package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
  143. package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
  144. package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
  145. package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
  146. package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
  147. package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
  148. package/assets/templates/pages/settings/template.doc.mjs +3 -1
  149. package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
  150. package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
  151. package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
  152. package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
  153. package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
  154. package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
  155. package/assets/templates/pages/table/template.doc.mjs +11 -1
  156. package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
  157. package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
  158. package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
  159. package/assets/templates/pages/table-page/template.doc.mjs +20 -1
  160. package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
  161. package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
  162. package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
  163. package/assets/templates/themes/butter/icons.tsx +2 -0
  164. package/assets/templates/themes/chocolate/icons.tsx +2 -0
  165. package/assets/templates/themes/gothic/icons.tsx +2 -0
  166. package/assets/templates/themes/matcha/icons.tsx +2 -0
  167. package/assets/templates/themes/neutral/icons.tsx +2 -0
  168. package/assets/templates/themes/stone/icons.tsx +2 -0
  169. package/assets/templates/themes/y2k/icons.tsx +2 -0
  170. package/authoring/doctypes/template/parse.d.mts +2 -0
  171. package/authoring/doctypes/template/parse.mjs +1 -0
  172. package/authoring/doctypes/template/parse.test.mjs +21 -0
  173. package/authoring/doctypes/template/template.doc.mjs +6 -0
  174. package/authoring/doctypes/template/type.ts +10 -0
  175. package/clients/cli/commands/build-theme.mjs +8 -2
  176. package/clients/cli/commands/discover.mjs +29 -1
  177. package/clients/cli/commands/discover.no-source.test.mjs +75 -0
  178. package/clients/cli/commands/docs.depth.test.mjs +219 -0
  179. package/clients/cli/commands/docs.doc.mjs +15 -2
  180. package/clients/cli/commands/docs.mjs +222 -5
  181. package/clients/cli/commands/docs.test.mjs +383 -0
  182. package/clients/cli/commands/doctor.mjs +4 -4
  183. package/clients/cli/commands/gap-report.mjs +12 -0
  184. package/clients/cli/commands/gap-report.test.mjs +63 -0
  185. package/clients/cli/commands/integration-add.doc.mjs +10 -0
  186. package/clients/cli/commands/integration-authoring.test.mjs +12 -2
  187. package/clients/cli/commands/integration.mjs +3 -1
  188. package/clients/cli/commands/layout-expand.doc.mjs +3 -1
  189. package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
  190. package/clients/cli/commands/layout.mjs +16 -0
  191. package/clients/cli/commands/search.doc.mjs +5 -4
  192. package/clients/cli/commands/search.mjs +30 -6
  193. package/clients/cli/commands/search.test.mjs +60 -16
  194. package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
  195. package/clients/cli/commands/template.mjs +19 -5
  196. package/clients/cli/commands/template.show-media.test.mjs +62 -0
  197. package/clients/cli/commands/theme-list.behavior.test.mjs +41 -0
  198. package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
  199. package/clients/cli/commands/write-failure.test.mjs +175 -0
  200. package/clients/cli/lib/manifest.mjs +44 -165
  201. package/clients/cli/lib/manifest.test.mjs +98 -7
  202. package/foundation/agent-docs/agent-docs.mjs +2 -1
  203. package/foundation/agent-docs/agent-docs.test.mjs +1168 -0
  204. package/foundation/discovery/template-adapter.d.mts +14 -0
  205. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
  206. package/foundation/discovery/template-adapter.mjs +21 -1
  207. package/foundation/discovery/theme-discovery.d.mts +6 -0
  208. package/foundation/discovery/theme-discovery.mjs +9 -0
  209. package/foundation/doc-compiler/doc-loads.test.mjs +3 -3
  210. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  211. package/foundation/doc-compiler/tree.test.mjs +649 -0
  212. package/foundation/integrations/cli-requirement.d.mts +57 -13
  213. package/foundation/integrations/cli-requirement.mjs +84 -22
  214. package/foundation/integrations/cli-requirement.test.mjs +135 -8
  215. package/foundation/response/response-types.doc.d.mts +5 -5
  216. package/foundation/response/response-types.doc.mjs +13 -13
  217. package/package.json +1 -1
@@ -9,12 +9,22 @@
9
9
  * @returns {string | null}
10
10
  */
11
11
  export function lowestAdmitted(range: unknown): string | null;
12
+ /**
13
+ * Why a package that uses a feature an older CLI cannot read would lose it,
14
+ * or null when its declared CLI range admits only CLIs that read it.
15
+ * @param {any} pkg package.json
16
+ * @param {string} feature what the package does, e.g. "ships a namespace doc"
17
+ * @param {string} loss what an older CLI does with it
18
+ * @param {string} floor the first stable CLI release that reads it
19
+ * @returns {string | null}
20
+ */
21
+ export function cliRangeProblem(pkg: any, feature: string, loss: string, floor: string): string | null;
12
22
  /**
13
23
  * Why a package that ships a namespace doc or a placed guide would lose its
14
24
  * docs on an older CLI, or null when its declared CLI range admits only CLIs
15
25
  * that read the docs tree. Published 0.6.3 hides every topic of a package
16
26
  * with a namespace doc; builds of main before the docs tree also do so for a
17
- * placed guide.
27
+ * placed guide. Published 0.6.4 reads both.
18
28
  * @param {any} pkg package.json
19
29
  * @returns {string | null}
20
30
  */
@@ -31,7 +41,7 @@ export function replacesCliProblem(pkg: any): string | null;
31
41
  * Why a package with a doc section that sets `id` would lose its doc topics on
32
42
  * an older CLI, or null when its declared CLI range admits only CLIs that read
33
43
  * the field. Published 0.6.3 rejects a section `id` and hides every doc topic
34
- * the package ships.
44
+ * the package ships; published 0.6.4 reads it.
35
45
  * @param {any} pkg package.json
36
46
  * @returns {string | null}
37
47
  */
@@ -40,26 +50,60 @@ export function sectionIdsCliProblem(pkg: any): string | null;
40
50
  * Why a package that ships a theme would lose its themes and doc topics on an
41
51
  * older CLI, or null when its declared CLI range admits only CLIs that read
42
52
  * typed theme descriptors. Published 0.6.3 rejects a themes root with no
43
- * `manifest.json` catalog, which `integration add theme` no longer writes.
53
+ * `manifest.json` catalog, which `integration add theme` no longer writes;
54
+ * published 0.6.4 reads the descriptors.
44
55
  * @param {any} pkg package.json
45
56
  * @returns {string | null}
46
57
  */
47
58
  export function themesCliProblem(pkg: any): string | null;
48
59
  /**
49
- * The package.json with a CLI peer that reads namespace docs: optional, unless
50
- * the package already says otherwise.
60
+ * Why a package with a template that sets `keywords` would lose that template
61
+ * and its doc topics on an older CLI, or null when its declared CLI range
62
+ * admits only CLIs that read the field. Published 0.6.3 rejects the field,
63
+ * drops that template, and hides the package's doc topics.
64
+ * @param {any} pkg package.json
65
+ * @returns {string | null}
66
+ */
67
+ export function keywordsCliProblem(pkg: any): string | null;
68
+ /**
69
+ * The package.json with a CLI peer of `>=floor`: optional, unless the package
70
+ * already says otherwise. Call it only when the package's range admits a CLI
71
+ * before `floor`, so a stricter range is never lowered.
72
+ * @param {any} pkg package.json
73
+ * @param {string} floor the first stable CLI release the package needs
74
+ * @returns {any}
75
+ */
76
+ export function withCliPeer(pkg: any, floor: string): any;
77
+ /**
78
+ * The package.json with a CLI peer that reads namespace docs.
51
79
  * @param {any} pkg package.json
52
80
  * @returns {any}
53
81
  */
54
82
  export function withDocsTreeCli(pkg: any): any;
55
83
  export const CLI_PACKAGE: "@astryxdesign/cli";
56
84
  /**
57
- * The first CLI release that reads an integration's docs tree (namespace docs
58
- * and placed guides), its templates' `replaces`, and its typed theme
59
- * descriptors. A release before it can hide every doc topic a package with a
60
- * namespace doc or a placed guide ships, with no warning; it rejects
61
- * `replaces`, drops that template, and hides the package's doc topics; and it
62
- * rejects a themes root without the `manifest.json` catalog the CLI no longer
63
- * writes, withholding the package's themes and doc topics.
85
+ * The first stable CLI release that reads an integration's docs tree:
86
+ * namespace docs and placed guides. Published 0.6.3 rejects a namespace doc
87
+ * and hides every doc topic the package ships, with no warning; published
88
+ * 0.6.4 lists the namespace and reads its guides.
89
+ */
90
+ export const NAMESPACE_DOCS_CLI: "0.6.4";
91
+ /**
92
+ * The first CLI release that reads a template's `replaces` and `keywords`. A
93
+ * release before it rejects either field, drops that template, and hides the
94
+ * package's doc topics.
95
+ */
96
+ export const REPLACES_CLI: "0.7.0";
97
+ /**
98
+ * The first stable CLI release that reads typed theme descriptors, the theme
99
+ * folder `integration add theme` writes. Published 0.6.3 rejects a themes root
100
+ * with no `manifest.json` catalog and withholds the package's themes and doc
101
+ * topics; published 0.6.4 lists the themes.
102
+ */
103
+ export const THEMES_CLI: "0.6.4";
104
+ /**
105
+ * The first stable CLI release that reads a doc section's `id`. Published
106
+ * 0.6.3 rejects the field and hides every doc topic the package ships;
107
+ * published 0.6.4 reads the section by its id.
64
108
  */
65
- export const DOCS_TREE_CLI: "0.7.0";
109
+ export const SECTION_IDS_CLI: "0.6.4";
@@ -1,11 +1,13 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file The CLI an integration's namespace docs need (spec:AST-046 FR11).
4
+ * @file The CLI release an integration's newer contributions need
5
+ * (spec:AST-046 FR11).
5
6
  *
6
7
  * @input A package.json object.
7
8
  * @output Whether its `peerDependencies` range for `@astryxdesign/cli` admits
8
- * only CLIs that read namespace docs, and the package.json that declares it.
9
+ * only CLIs that read what the package ships, and the package.json that
10
+ * declares that range.
9
11
  * @position foundation/integrations; read by `integration add doc --parent`
10
12
  * and `integration add theme`, which declare the peer, and
11
13
  * `integration verify`, which requires it.
@@ -16,15 +18,34 @@ import {semverCompare} from '../env/semver.mjs';
16
18
  export const CLI_PACKAGE = '@astryxdesign/cli';
17
19
 
18
20
  /**
19
- * The first CLI release that reads an integration's docs tree (namespace docs
20
- * and placed guides), its templates' `replaces`, and its typed theme
21
- * descriptors. A release before it can hide every doc topic a package with a
22
- * namespace doc or a placed guide ships, with no warning; it rejects
23
- * `replaces`, drops that template, and hides the package's doc topics; and it
24
- * rejects a themes root without the `manifest.json` catalog the CLI no longer
25
- * writes, withholding the package's themes and doc topics.
21
+ * The first stable CLI release that reads an integration's docs tree:
22
+ * namespace docs and placed guides. Published 0.6.3 rejects a namespace doc
23
+ * and hides every doc topic the package ships, with no warning; published
24
+ * 0.6.4 lists the namespace and reads its guides.
26
25
  */
27
- export const DOCS_TREE_CLI = '0.7.0';
26
+ export const NAMESPACE_DOCS_CLI = '0.6.4';
27
+
28
+ /**
29
+ * The first CLI release that reads a template's `replaces` and `keywords`. A
30
+ * release before it rejects either field, drops that template, and hides the
31
+ * package's doc topics.
32
+ */
33
+ export const REPLACES_CLI = '0.7.0';
34
+
35
+ /**
36
+ * The first stable CLI release that reads typed theme descriptors, the theme
37
+ * folder `integration add theme` writes. Published 0.6.3 rejects a themes root
38
+ * with no `manifest.json` catalog and withholds the package's themes and doc
39
+ * topics; published 0.6.4 lists the themes.
40
+ */
41
+ export const THEMES_CLI = '0.6.4';
42
+
43
+ /**
44
+ * The first stable CLI release that reads a doc section's `id`. Published
45
+ * 0.6.3 rejects the field and hides every doc topic the package ships;
46
+ * published 0.6.4 reads the section by its id.
47
+ */
48
+ export const SECTION_IDS_CLI = '0.6.4';
28
49
 
29
50
  const VERSION_RE = /^v?(\d+|[xX*])(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
30
51
 
@@ -89,17 +110,25 @@ export function lowestAdmitted(range) {
89
110
  * @param {any} pkg package.json
90
111
  * @param {string} feature what the package does, e.g. "ships a namespace doc"
91
112
  * @param {string} loss what an older CLI does with it
113
+ * @param {string} floor the first stable CLI release that reads it
92
114
  * @returns {string | null}
93
115
  */
94
- function cliRangeProblem(pkg, feature, loss) {
116
+ export function cliRangeProblem(pkg, feature, loss, floor) {
117
+ // A floor that is missing or not a version means a caller passed the
118
+ // arguments in another order, as after a merge with a caller written for
119
+ // another signature. Fail loudly rather than compare a range against
120
+ // feature text, or against nothing.
121
+ if (typeof floor !== 'string' || lowerVersion(floor) == null) {
122
+ throw new TypeError(`cliRangeProblem: floor "${floor}" is not a version`);
123
+ }
95
124
  const range = pkg?.peerDependencies?.[CLI_PACKAGE];
96
- const fix = `"${CLI_PACKAGE}": ">=${DOCS_TREE_CLI}" in peerDependencies (optional in peerDependenciesMeta, if the CLI is not required)`;
125
+ const fix = `"${CLI_PACKAGE}": ">=${floor}" in peerDependencies (optional in peerDependenciesMeta, if the CLI is not required)`;
97
126
  if (typeof range !== 'string') {
98
- return `The package ${feature} but declares no ${CLI_PACKAGE} peer. A stable CLI before ${DOCS_TREE_CLI} ${loss}. Declare ${fix}.`;
127
+ return `The package ${feature} but declares no ${CLI_PACKAGE} peer. A stable CLI before ${floor} ${loss}. Declare ${fix}.`;
99
128
  }
100
129
  const lowest = lowestAdmitted(range);
101
- if (lowest == null || semverCompare(lowest, DOCS_TREE_CLI) < 0) {
102
- return `The package ${feature}, but its ${CLI_PACKAGE} peer range "${range}" admits a stable CLI before ${DOCS_TREE_CLI}, which ${loss}. Declare ${fix}.`;
130
+ if (lowest == null || semverCompare(lowest, floor) < 0) {
131
+ return `The package ${feature}, but its ${CLI_PACKAGE} peer range "${range}" admits a stable CLI before ${floor}, which ${loss}. Declare ${fix}.`;
103
132
  }
104
133
  return null;
105
134
  }
@@ -109,7 +138,7 @@ function cliRangeProblem(pkg, feature, loss) {
109
138
  * docs on an older CLI, or null when its declared CLI range admits only CLIs
110
139
  * that read the docs tree. Published 0.6.3 hides every topic of a package
111
140
  * with a namespace doc; builds of main before the docs tree also do so for a
112
- * placed guide.
141
+ * placed guide. Published 0.6.4 reads both.
113
142
  * @param {any} pkg package.json
114
143
  * @returns {string | null}
115
144
  */
@@ -118,6 +147,7 @@ export function docsTreeCliProblem(pkg) {
118
147
  pkg,
119
148
  'ships a namespace doc or a placed guide',
120
149
  'does not read the docs tree, and can hide every doc topic the package ships',
150
+ NAMESPACE_DOCS_CLI,
121
151
  );
122
152
  }
123
153
 
@@ -133,6 +163,7 @@ export function replacesCliProblem(pkg) {
133
163
  pkg,
134
164
  'has a template that sets `replaces`',
135
165
  "rejects the field, drops that template, and hides the package's doc topics",
166
+ REPLACES_CLI,
136
167
  );
137
168
  }
138
169
 
@@ -140,7 +171,7 @@ export function replacesCliProblem(pkg) {
140
171
  * Why a package with a doc section that sets `id` would lose its doc topics on
141
172
  * an older CLI, or null when its declared CLI range admits only CLIs that read
142
173
  * the field. Published 0.6.3 rejects a section `id` and hides every doc topic
143
- * the package ships.
174
+ * the package ships; published 0.6.4 reads it.
144
175
  * @param {any} pkg package.json
145
176
  * @returns {string | null}
146
177
  */
@@ -149,6 +180,7 @@ export function sectionIdsCliProblem(pkg) {
149
180
  pkg,
150
181
  'has a doc section that sets `id`',
151
182
  'rejects the field, and can hide every doc topic the package ships',
183
+ SECTION_IDS_CLI,
152
184
  );
153
185
  }
154
186
 
@@ -156,7 +188,8 @@ export function sectionIdsCliProblem(pkg) {
156
188
  * Why a package that ships a theme would lose its themes and doc topics on an
157
189
  * older CLI, or null when its declared CLI range admits only CLIs that read
158
190
  * typed theme descriptors. Published 0.6.3 rejects a themes root with no
159
- * `manifest.json` catalog, which `integration add theme` no longer writes.
191
+ * `manifest.json` catalog, which `integration add theme` no longer writes;
192
+ * published 0.6.4 reads the descriptors.
160
193
  * @param {any} pkg package.json
161
194
  * @returns {string | null}
162
195
  */
@@ -165,25 +198,54 @@ export function themesCliProblem(pkg) {
165
198
  pkg,
166
199
  'ships a theme',
167
200
  "cannot read typed theme descriptors, and can drop the package's themes and hide its doc topics",
201
+ THEMES_CLI,
202
+ );
203
+ }
204
+
205
+ /**
206
+ * Why a package with a template that sets `keywords` would lose that template
207
+ * and its doc topics on an older CLI, or null when its declared CLI range
208
+ * admits only CLIs that read the field. Published 0.6.3 rejects the field,
209
+ * drops that template, and hides the package's doc topics.
210
+ * @param {any} pkg package.json
211
+ * @returns {string | null}
212
+ */
213
+ export function keywordsCliProblem(pkg) {
214
+ return cliRangeProblem(
215
+ pkg,
216
+ 'has a template that sets `keywords`',
217
+ "rejects the field, drops that template, and hides the package's doc topics",
218
+ REPLACES_CLI,
168
219
  );
169
220
  }
170
221
 
171
222
  /**
172
- * The package.json with a CLI peer that reads namespace docs: optional, unless
173
- * the package already says otherwise.
223
+ * The package.json with a CLI peer of `>=floor`: optional, unless the package
224
+ * already says otherwise. Call it only when the package's range admits a CLI
225
+ * before `floor`, so a stricter range is never lowered.
174
226
  * @param {any} pkg package.json
227
+ * @param {string} floor the first stable CLI release the package needs
175
228
  * @returns {any}
176
229
  */
177
- export function withDocsTreeCli(pkg) {
230
+ export function withCliPeer(pkg, floor) {
178
231
  const meta = pkg.peerDependenciesMeta ?? {};
179
232
  return {
180
233
  ...pkg,
181
234
  peerDependencies: {
182
235
  ...(pkg.peerDependencies ?? {}),
183
- [CLI_PACKAGE]: `>=${DOCS_TREE_CLI}`,
236
+ [CLI_PACKAGE]: `>=${floor}`,
184
237
  },
185
238
  peerDependenciesMeta: meta[CLI_PACKAGE]
186
239
  ? meta
187
240
  : {...meta, [CLI_PACKAGE]: {optional: true}},
188
241
  };
189
242
  }
243
+
244
+ /**
245
+ * The package.json with a CLI peer that reads namespace docs.
246
+ * @param {any} pkg package.json
247
+ * @returns {any}
248
+ */
249
+ export function withDocsTreeCli(pkg) {
250
+ return withCliPeer(pkg, NAMESPACE_DOCS_CLI);
251
+ }
@@ -1,11 +1,22 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
+ import fs from 'node:fs';
3
4
  import {describe, expect, it} from 'vitest';
5
+ import {semverCompare} from '../env/semver.mjs';
6
+ import * as requirement from './cli-requirement.mjs';
4
7
  import {
5
- DOCS_TREE_CLI,
8
+ NAMESPACE_DOCS_CLI,
9
+ REPLACES_CLI,
10
+ SECTION_IDS_CLI,
11
+ cliRangeProblem,
12
+ THEMES_CLI,
6
13
  lowestAdmitted,
7
14
  docsTreeCliProblem,
15
+ keywordsCliProblem,
8
16
  replacesCliProblem,
17
+ sectionIdsCliProblem,
18
+ themesCliProblem,
19
+ withCliPeer,
9
20
  withDocsTreeCli,
10
21
  } from './cli-requirement.mjs';
11
22
 
@@ -35,7 +46,7 @@ describe('docsTreeCliProblem', () => {
35
46
  // Stable releases: a canary built from main before its release reports
36
47
  // the older version and reads every feature.
37
48
  expect(docsTreeCliProblem({name: '@acme/kit'})).toContain(
38
- 'A stable CLI before 0.7.0 does not read the docs tree',
49
+ 'A stable CLI before 0.6.4 does not read the docs tree',
39
50
  );
40
51
  });
41
52
 
@@ -48,16 +59,19 @@ describe('docsTreeCliProblem', () => {
48
59
  },
49
60
  );
50
61
 
51
- it.each(['>=0.7.0', '^0.7.2', '>=0.7.0 <2'])('accepts %s', range => {
52
- expect(
53
- docsTreeCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
54
- ).toBeNull();
55
- });
62
+ it.each(['>=0.6.4', '^0.6.4', '>=0.7.0', '^0.7.2', '>=0.7.0 <2'])(
63
+ 'accepts %s',
64
+ range => {
65
+ expect(
66
+ docsTreeCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
67
+ ).toBeNull();
68
+ },
69
+ );
56
70
 
57
71
  it('declares the peer as optional, and keeps what the package says of it', () => {
58
72
  const declared = withDocsTreeCli({name: '@acme/kit'});
59
73
  expect(declared.peerDependencies).toEqual({
60
- '@astryxdesign/cli': `>=${DOCS_TREE_CLI}`,
74
+ '@astryxdesign/cli': '>=0.6.4',
61
75
  });
62
76
  expect(declared.peerDependenciesMeta).toEqual({
63
77
  '@astryxdesign/cli': {optional: true},
@@ -85,5 +99,118 @@ describe('replacesCliProblem', () => {
85
99
  expect(
86
100
  replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
87
101
  ).toBeNull();
102
+ // Unlike the docs tree, `replaces` still needs 0.7.0.
103
+ expect(
104
+ replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}}),
105
+ ).toContain('admits a stable CLI before 0.7.0');
106
+ });
107
+ });
108
+
109
+ describe('themesCliProblem and sectionIdsCliProblem', () => {
110
+ // Published 0.6.4 reads typed theme descriptors and section ids. Published
111
+ // 0.6.3 rejects both and hides the package's doc topics.
112
+ it.each([
113
+ ['a theme', themesCliProblem, 'ships a theme'],
114
+ ['a section id', sectionIdsCliProblem, 'sets `id`'],
115
+ ])('asks for a CLI from 0.6.4 for %s', (_name, problem, feature) => {
116
+ expect(problem({name: '@acme/kit'})).toContain(feature);
117
+ expect(problem({name: '@acme/kit'})).toContain('A stable CLI before 0.6.4');
118
+ for (const range of ['>=0.6.4', '^0.6.4', '>=0.6.5', '>=0.7.0']) {
119
+ expect(
120
+ problem({peerDependencies: {'@astryxdesign/cli': range}}),
121
+ ).toBeNull();
122
+ }
123
+ for (const range of ['^0.6.0', '>=0.6.3', '*']) {
124
+ expect(
125
+ problem({peerDependencies: {'@astryxdesign/cli': range}}),
126
+ ).toContain('admits a stable CLI before 0.6.4');
127
+ }
128
+ });
129
+
130
+ it('keeps 0.7.0 for replaces and keywords', () => {
131
+ const pkg = {peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}};
132
+ expect(docsTreeCliProblem(pkg)).toBeNull();
133
+ expect(replacesCliProblem(pkg)).toContain(
134
+ 'admits a stable CLI before 0.7.0',
135
+ );
136
+ expect(keywordsCliProblem(pkg)).toContain(
137
+ 'admits a stable CLI before 0.7.0',
138
+ );
139
+ expect(
140
+ keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
141
+ ).toBeNull();
142
+ });
143
+
144
+ it('names a released CLI for a feature that already shipped', () => {
145
+ const {version} = JSON.parse(
146
+ fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'),
147
+ );
148
+ for (const floor of [NAMESPACE_DOCS_CLI, THEMES_CLI, SECTION_IDS_CLI]) {
149
+ expect(semverCompare(floor, version.split('-')[0])).toBeLessThanOrEqual(
150
+ 0,
151
+ );
152
+ }
153
+ });
154
+
155
+ it('declares the floor a theme needs as an optional peer', () => {
156
+ const declared = withCliPeer({name: '@acme/kit'}, THEMES_CLI);
157
+ expect(declared.peerDependencies).toEqual({
158
+ '@astryxdesign/cli': '>=0.6.4',
159
+ });
160
+ expect(declared.peerDependenciesMeta).toEqual({
161
+ '@astryxdesign/cli': {optional: true},
162
+ });
163
+ expect(themesCliProblem(declared)).toBeNull();
164
+ });
165
+ });
166
+
167
+ describe('cliRangeProblem', () => {
168
+ it('fails loudly when a caller names no floor', () => {
169
+ expect(() =>
170
+ // @ts-expect-error: the floor is required
171
+ cliRangeProblem({name: '@acme/kit'}, 'ships x', 'drops x'),
172
+ ).toThrow(TypeError);
173
+ });
174
+
175
+ it('fails loudly when the floor is not a version', () => {
176
+ expect(() =>
177
+ cliRangeProblem({name: '@acme/kit'}, '0.6.4', 'ships x', 'drops x'),
178
+ ).toThrow(TypeError);
179
+ });
180
+ });
181
+
182
+ describe('every feature check names its CLI floor', () => {
183
+ // The first stable CLI release that reads each feature. A new check, or a
184
+ // check whose floor changes, fails here until this table says so on
185
+ // purpose, so a floor never moves as a side effect of another change.
186
+ const FLOORS = {
187
+ docsTreeCliProblem: '0.6.4',
188
+ replacesCliProblem: REPLACES_CLI,
189
+ keywordsCliProblem: REPLACES_CLI,
190
+ sectionIdsCliProblem: '0.6.4',
191
+ themesCliProblem: '0.6.4',
192
+ };
193
+
194
+ it('asks each feature for the CLI release this table names', () => {
195
+ const named = Object.fromEntries(
196
+ Object.entries(requirement)
197
+ .filter(
198
+ ([name, value]) =>
199
+ typeof value === 'function' &&
200
+ /CliProblem$/.test(name) &&
201
+ name !== 'cliRangeProblem',
202
+ )
203
+ .map(([name, check]) => [
204
+ name,
205
+ /A stable CLI before (\d+\.\d+\.\d+)/.exec(
206
+ check({name: '@acme/kit'}) ?? '',
207
+ )?.[1] ?? null,
208
+ ]),
209
+ );
210
+ expect(named).toEqual({
211
+ ...FLOORS,
212
+ replacesCliProblem: '0.7.0',
213
+ keywordsCliProblem: '0.7.0',
214
+ });
88
215
  });
89
216
  });
@@ -3,11 +3,11 @@
3
3
 
4
4
  /**
5
5
  * @file EnumDoc for the `type` discriminant carried on every --json success
6
- * envelope. The vocabulary mirrors the RESPONSE_TYPES map (each command's
7
- * `jsonOut(...)` call sites) plus ROOT_RESPONSE_TYPES (help, version) in
8
- * `clients/cli/lib/manifest.mjs`; a consumer switches on `type` to narrow the
9
- * `data` payload. Descriptions follow the currently published response
10
- * projection, not a future package-version boundary.
6
+ * envelope. The vocabulary equals the manifest's response types (each
7
+ * command's FunctionDoc returns; see `clients/cli/lib/manifest.mjs`) plus
8
+ * ROOT_RESPONSE_TYPES (help, version) there; a consumer switches on `type` to
9
+ * narrow the `data` payload. Descriptions follow the currently published
10
+ * response projection, not a future package-version boundary.
11
11
  *
12
12
  * @input Public response discriminants and their currently released payloads.
13
13
  * @output Generated consumer reference for every typed JSON success response.
@@ -2,11 +2,11 @@
2
2
 
3
3
  /**
4
4
  * @file EnumDoc for the `type` discriminant carried on every --json success
5
- * envelope. The vocabulary mirrors the RESPONSE_TYPES map (each command's
6
- * `jsonOut(...)` call sites) plus ROOT_RESPONSE_TYPES (help, version) in
7
- * `clients/cli/lib/manifest.mjs`; a consumer switches on `type` to narrow the
8
- * `data` payload. Descriptions follow the currently published response
9
- * projection, not a future package-version boundary.
5
+ * envelope. The vocabulary equals the manifest's response types (each
6
+ * command's FunctionDoc returns; see `clients/cli/lib/manifest.mjs`) plus
7
+ * ROOT_RESPONSE_TYPES (help, version) there; a consumer switches on `type` to
8
+ * narrow the `data` payload. Descriptions follow the currently published
9
+ * response projection, not a future package-version boundary.
10
10
  *
11
11
  * @input Public response discriminants and their currently released payloads.
12
12
  * @output Generated consumer reference for every typed JSON success response.
@@ -184,7 +184,7 @@ export const doc = {
184
184
  {
185
185
  value: 'template.show',
186
186
  description:
187
- "The resolved template's raw source plus its description, kind, and the component names it composes.",
187
+ "The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media).",
188
188
  },
189
189
  {
190
190
  value: 'template.skeleton',
@@ -194,7 +194,7 @@ export const doc = {
194
194
  {
195
195
  value: 'template.copy',
196
196
  description:
197
- 'A scaffold receipt: template id, output directory, written file name, and file count.',
197
+ 'A scaffold receipt: template id, output directory, written file name, file count, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media).',
198
198
  },
199
199
 
200
200
  {
@@ -276,7 +276,7 @@ export const doc = {
276
276
  {
277
277
  value: 'upgrade.run',
278
278
  description:
279
- 'The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, and (apply mode) filesChanged, transformsApplied, and per-codemod errors.',
279
+ 'The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors.',
280
280
  },
281
281
 
282
282
  // manifest
@@ -320,29 +320,29 @@ export const doc = {
320
320
  {
321
321
  value: 'integration.validate',
322
322
  description:
323
- 'The validation result: the package name and version (both null when no local manifest is found) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}.',
323
+ 'The validation result: validated (false when no integration manifest was found, so nothing was checked and the empty issues list proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}.',
324
324
  },
325
325
  {
326
326
  value: 'integration.template-conflicts',
327
327
  description:
328
- 'The integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}.',
328
+ 'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}.',
329
329
  },
330
330
  {
331
331
  value: 'integration.component-conflicts',
332
332
  description:
333
- 'The integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command.',
333
+ 'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command.',
334
334
  },
335
335
  {
336
336
  value: 'integration.doc-conflicts',
337
337
  description:
338
- 'The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
338
+ 'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
339
339
  },
340
340
 
341
341
  // layout (XLE/XLO)
342
342
  {
343
343
  value: 'layout.expand',
344
344
  description:
345
- 'The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, and written (the output path, or null when nothing was written).',
345
+ 'The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, written (the output path, or null when nothing was written), and demoMediaReplaced (count of demo media placeholders).',
346
346
  },
347
347
  {
348
348
  value: 'layout.check',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
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",