@astryxdesign/cli 0.7.2-canary.01eab6a → 0.7.2-canary.0da784d

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 (179) hide show
  1. package/README.md +9 -8
  2. package/api/build/help/help.mjs +1 -1
  3. package/api/docs/_adapter.d.mts +11 -0
  4. package/api/docs/_adapter.mjs +244 -1
  5. package/api/docs/integrationDocs.test.mjs +124 -0
  6. package/api/doctor/doctor.mjs +27 -3
  7. package/api/doctor/doctor.test.mjs +43 -0
  8. package/api/doctor/theme-checks.mjs +1 -1
  9. package/api/index.d.mts +2 -0
  10. package/api/index.mjs +2 -0
  11. package/api/init/run/run.mjs +2 -2
  12. package/api/integration/add-contribution.mjs +1 -1
  13. package/api/integration/add-contribution.test.mjs +4 -2
  14. package/api/integration/check/check.d.mts +96 -0
  15. package/api/integration/check/check.mjs +357 -0
  16. package/api/integration/check/check.test.mjs +489 -0
  17. package/api/integration/integration-check.type.d.mts +118 -0
  18. package/api/integration/integration-check.type.mjs +84 -0
  19. package/api/integration/integrationCheck.doc.d.mts +10 -0
  20. package/api/integration/integrationCheck.doc.mjs +73 -0
  21. package/api/integration/integrationComponentConflicts.doc.mjs +27 -6
  22. package/api/integration/validate-integration.mjs +8 -0
  23. package/api/integration/validate-integration.test.mjs +11 -0
  24. package/api/integration/validate-integration.type.d.mts +8 -0
  25. package/api/integration/validate-integration.type.mjs +12 -1
  26. package/api/integration/validateIntegration.doc.mjs +19 -3
  27. package/api/search/search.d.mts +72 -12
  28. package/api/search/search.domain-priority.test.mjs +108 -18
  29. package/api/search/search.integration-check.test.mjs +24 -0
  30. package/api/search/search.mjs +501 -37
  31. package/api/search/search.test.mjs +139 -0
  32. package/api/theme/build/build.family.test.mjs +54 -6
  33. package/api/theme/build/build.mjs +114 -17
  34. package/api/theme/themeBuild.doc.mjs +4 -4
  35. package/assets/docs/README.md +10 -0
  36. package/assets/docs/author-a-theme.doc.mjs +1 -1
  37. package/assets/docs/getting-started.doc.mjs +3 -3
  38. package/assets/docs/styling-overview.doc.mjs +1 -1
  39. package/assets/docs/theme.doc.dense.mjs +1 -1
  40. package/assets/docs/theme.doc.mjs +1 -1
  41. package/assets/docs/theme.doc.zh.mjs +1 -1
  42. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  43. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  44. package/assets/docs/tree/add-a-topic.doc.mjs +10 -7
  45. package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
  46. package/assets/docs/tree/block-template.doc.mjs +8 -20
  47. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  48. package/assets/docs/tree/check-the-props.doc.mjs +52 -1
  49. package/assets/docs/tree/check-your-docs.doc.mjs +51 -5
  50. package/assets/docs/tree/checks.doc.mjs +21 -13
  51. package/assets/docs/tree/codemods.doc.mjs +4 -4
  52. package/assets/docs/tree/component-family.doc.mjs +3 -5
  53. package/assets/docs/tree/component-imports.doc.mjs +2 -2
  54. package/assets/docs/tree/components.doc.mjs +1 -1
  55. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +7 -18
  56. package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
  57. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  58. package/assets/docs/tree/docs.doc.mjs +3 -3
  59. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  60. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  61. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  62. package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
  63. package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
  64. package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
  65. package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
  66. package/assets/docs/tree/integrations.doc.mjs +8 -0
  67. package/assets/docs/tree/links.doc.mjs +6 -5
  68. package/assets/docs/tree/migration-setup.doc.mjs +1 -0
  69. package/assets/docs/tree/migration-verification.doc.mjs +0 -1
  70. package/assets/docs/tree/migration.doc.mjs +0 -1
  71. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  72. package/assets/docs/tree/page-template.doc.mjs +4 -8
  73. package/assets/docs/tree/publishing.doc.mjs +1 -1
  74. package/assets/docs/tree/quick-start.doc.mjs +37 -21
  75. package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
  76. package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
  77. package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
  78. package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
  79. package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
  80. package/assets/docs/tree/single-component.doc.mjs +12 -4
  81. package/assets/docs/tree/start-a-template.doc.mjs +3 -3
  82. package/assets/docs/tree/subcomponent.doc.mjs +6 -6
  83. package/assets/docs/tree/template-assets.doc.mjs +2 -2
  84. package/assets/docs/tree/template-doc-overview.doc.mjs +4 -15
  85. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  86. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  87. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  88. package/assets/docs/tree/template-styles.doc.mjs +2 -2
  89. package/assets/docs/tree/templates.doc.mjs +1 -1
  90. package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
  91. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  92. package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
  93. package/assets/docs/tree/troubleshooting.doc.mjs +4 -4
  94. package/assets/docs/tree/type-scale.doc.mjs +3 -3
  95. package/assets/docs/tree/upgrading.doc.mjs +3 -3
  96. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
  97. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  98. package/assets/docs/tree/versioning.doc.mjs +6 -6
  99. package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
  100. package/assets/docs/use-a-theme.doc.mjs +2 -2
  101. package/assets/theme.template.ts +1 -1
  102. package/authoring/codemod/codemod.doc.mjs +7 -3
  103. package/authoring/config/config.doc.mjs +9 -6
  104. package/authoring/config/type.ts +4 -2
  105. package/authoring/discover/discover.doc.mjs +1 -1
  106. package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
  107. package/authoring/doctypes/command/command.doc.mjs +14 -12
  108. package/authoring/doctypes/component/component.doc.mjs +28 -25
  109. package/authoring/doctypes/component/type.ts +7 -5
  110. package/authoring/doctypes/enum/enum.doc.mjs +7 -4
  111. package/authoring/doctypes/function/function.doc.mjs +9 -8
  112. package/authoring/doctypes/hook/hook.doc.mjs +5 -4
  113. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
  114. package/authoring/doctypes/reference/reference.doc.mjs +11 -10
  115. package/authoring/doctypes/schema/schema.doc.mjs +9 -9
  116. package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
  117. package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
  118. package/authoring/doctypes/template/parse.d.mts +6 -2
  119. package/authoring/doctypes/template/parse.mjs +3 -1
  120. package/authoring/doctypes/template/template.doc.mjs +3 -3
  121. package/authoring/doctypes/template/type.ts +22 -0
  122. package/authoring/doctypes/theme/theme.doc.mjs +2 -2
  123. package/authoring/gap-report/gap-report.doc.mjs +2 -2
  124. package/authoring/identity/identity.doc.mjs +3 -3
  125. package/authoring/index.d.ts +1 -0
  126. package/authoring/integration/integration.doc.mjs +12 -4
  127. package/authoring/integration/parse.test.mjs +10 -0
  128. package/authoring/integration/schema.d.mts +2 -0
  129. package/authoring/integration/schema.mjs +1 -0
  130. package/authoring/integration/type.ts +4 -0
  131. package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
  132. package/clients/cli/commands/build-theme.mjs +1 -1
  133. package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
  134. package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
  135. package/clients/cli/commands/doctor-integration-components.doc.mjs +11 -4
  136. package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
  137. package/clients/cli/commands/doctor-integration.test.mjs +512 -2
  138. package/clients/cli/commands/doctor.mjs +116 -0
  139. package/clients/cli/commands/integration-check.doc.mjs +85 -0
  140. package/clients/cli/commands/integration-check.test.mjs +267 -0
  141. package/clients/cli/commands/integration.doc.mjs +6 -2
  142. package/clients/cli/commands/integration.mjs +107 -1
  143. package/clients/cli/commands/setup-nudge.test.mjs +79 -1
  144. package/clients/cli/commands/swizzle.mjs +5 -3
  145. package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
  146. package/clients/cli/commands/text-json-parity.test.mjs +5 -0
  147. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  148. package/clients/cli/index.mjs +30 -5
  149. package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
  150. package/foundation/agent-docs/agent-doc-state.mjs +38 -0
  151. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  152. package/foundation/agent-docs/agent-docs.mjs +8 -6
  153. package/foundation/config/project.mjs +82 -0
  154. package/foundation/discovery/authoring-self-docs.mjs +2 -1
  155. package/foundation/discovery/doc-types.d.mts +157 -0
  156. package/foundation/discovery/doc-types.mjs +1224 -0
  157. package/foundation/discovery/doc-types.test.mjs +700 -0
  158. package/foundation/discovery/docs-discovery.d.mts +81 -0
  159. package/foundation/discovery/docs-discovery.mjs +57 -0
  160. package/foundation/discovery/integration-doc-files.d.mts +22 -0
  161. package/foundation/discovery/integration-doc-files.mjs +231 -0
  162. package/foundation/discovery/integration-doc-files.test.mjs +246 -0
  163. package/foundation/discovery/project-typescript.d.mts +11 -2
  164. package/foundation/discovery/project-typescript.mjs +32 -4
  165. package/foundation/discovery/prop-drift.d.mts +62 -4
  166. package/foundation/discovery/prop-drift.mjs +561 -63
  167. package/foundation/discovery/prop-drift.test.mjs +1086 -11
  168. package/foundation/discovery/type-match.d.mts +53 -0
  169. package/foundation/discovery/type-match.mjs +660 -0
  170. package/foundation/discovery/type-match.test.mjs +169 -0
  171. package/foundation/discovery/type-text.d.mts +68 -0
  172. package/foundation/discovery/type-text.mjs +658 -0
  173. package/foundation/discovery/type-text.test.mjs +196 -0
  174. package/foundation/doc-compiler/doc-loads.test.mjs +8 -2
  175. package/foundation/doc-compiler/links.d.mts +9 -5
  176. package/foundation/doc-compiler/links.mjs +4 -2
  177. package/foundation/response/response-types.doc.mjs +7 -2
  178. package/package.json +9 -9
  179. package/scripts/postinstall.mjs +3 -3
@@ -2,7 +2,9 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * Resolve the project's own `typescript`, trying each directory in order.
5
+ * Resolve the project's own `typescript`, trying each directory in order;
6
+ * where it has no JavaScript compiler API (TypeScript 7), the TypeScript 6
7
+ * API package installed beside it.
6
8
  * @param {Array<string | null | undefined>} dirs
7
9
  * @returns {{ts: any, version: string} | {ts: null, version: string} | null}
8
10
  * `ts: null` when a TypeScript is installed but has no `createProgram`
@@ -16,8 +18,15 @@ export function resolveProjectTypeScript(dirs: Array<string | null | undefined>)
16
18
  } | null;
17
19
  /**
18
20
  * Why a check that needs the compiler did not run, when the TypeScript
19
- * installed has no JavaScript compiler API.
21
+ * installed has no JavaScript compiler API, and what to do.
20
22
  * @param {string} version
21
23
  * @param {string} outcome what was not done, such as `docs were not checked`
22
24
  */
23
25
  export function unusableTypeScriptReason(version: string, outcome: string): string;
26
+ /**
27
+ * What to do when the project's TypeScript is missing or cannot be used:
28
+ * beside TypeScript 7, the TypeScript 6 API package it ships for tools;
29
+ * otherwise a version every check here reads, 5.0 (the oldest that checks a
30
+ * JavaScript doc) through 6.
31
+ */
32
+ export const TYPESCRIPT_FIX: "On TypeScript 7, add its TypeScript 6 API package (`npm install -D @typescript/typescript6`); otherwise install TypeScript 5.0 through 6 (`npm install -D typescript@6`). Then run this check again.";
@@ -15,7 +15,16 @@ import * as path from 'node:path';
15
15
  import {createRequire} from 'node:module';
16
16
 
17
17
  /**
18
- * Resolve the project's own `typescript`, trying each directory in order.
18
+ * The package TypeScript publishes beside TypeScript 7 for tools that need a
19
+ * JavaScript compiler API: TypeScript 6's. Kept in a constant so the type
20
+ * check does not treat the load as a static import of an uninstalled package.
21
+ */
22
+ const TYPESCRIPT_6_API = '@typescript/typescript6';
23
+
24
+ /**
25
+ * Resolve the project's own `typescript`, trying each directory in order;
26
+ * where it has no JavaScript compiler API (TypeScript 7), the TypeScript 6
27
+ * API package installed beside it.
19
28
  * @param {Array<string | null | undefined>} dirs
20
29
  * @returns {{ts: any, version: string} | {ts: null, version: string} | null}
21
30
  * `ts: null` when a TypeScript is installed but has no `createProgram`
@@ -43,19 +52,38 @@ export function resolveProjectTypeScript(dirs) {
43
52
  unusable ??= installed();
44
53
  } catch {
45
54
  // Not installed from here, or installed without an entry this CLI can
46
- // load; try the next directory.
55
+ // load.
47
56
  unusable ??= installed();
48
57
  }
58
+ // TypeScript 7 has no JavaScript compiler API; the package TypeScript
59
+ // ships beside it for tools that need one carries TypeScript 6's.
60
+ try {
61
+ const ts = require(TYPESCRIPT_6_API);
62
+ if (ts && typeof ts.createProgram === 'function') {
63
+ return {ts, version: String(ts.version)};
64
+ }
65
+ } catch {
66
+ // Not installed from here; try the next directory.
67
+ }
49
68
  }
50
69
  return unusable ? {ts: null, version: unusable} : null;
51
70
  }
52
71
 
72
+ /**
73
+ * What to do when the project's TypeScript is missing or cannot be used:
74
+ * beside TypeScript 7, the TypeScript 6 API package it ships for tools;
75
+ * otherwise a version every check here reads, 5.0 (the oldest that checks a
76
+ * JavaScript doc) through 6.
77
+ */
78
+ export const TYPESCRIPT_FIX =
79
+ 'On TypeScript 7, add its TypeScript 6 API package (`npm install -D @typescript/typescript6`); otherwise install TypeScript 5.0 through 6 (`npm install -D typescript@6`). Then run this check again.';
80
+
53
81
  /**
54
82
  * Why a check that needs the compiler did not run, when the TypeScript
55
- * installed has no JavaScript compiler API.
83
+ * installed has no JavaScript compiler API, and what to do.
56
84
  * @param {string} version
57
85
  * @param {string} outcome what was not done, such as `docs were not checked`
58
86
  */
59
87
  export function unusableTypeScriptReason(version, outcome) {
60
- return `TypeScript ${version} is installed in this project, but it has no JavaScript compiler API (\`createProgram\`) to read types with, so ${outcome}.`;
88
+ return `TypeScript ${version} is installed in this project, but it has no JavaScript compiler API (\`createProgram\`) to read types with (TypeScript 7 ships none), so ${outcome}. ${TYPESCRIPT_FIX}`;
61
89
  }
@@ -25,7 +25,7 @@ export function comparePropDocs(components: PropDriftComponent[], options: {
25
25
  loadDoc?: (docPath: string) => Promise<any>;
26
26
  }): Promise<PropDriftReport>;
27
27
  /**
28
- * @typedef {'not_in_code' | 'not_in_doc' | 'required_mismatch'} PropDriftKind
28
+ * @typedef {'not_in_code' | 'not_in_doc' | 'required_mismatch' | 'type_mismatch'} PropDriftKind
29
29
  */
30
30
  /**
31
31
  * @typedef {object} PropDriftFinding
@@ -47,6 +47,15 @@ export function comparePropDocs(components: PropDriftComponent[], options: {
47
47
  * @property {string} doc the doc file, relative to the package root
48
48
  * @property {string} reason why its props could not be read
49
49
  */
50
+ /**
51
+ * @typedef {object} PropDriftTypesNotCompared
52
+ * @property {string} component
53
+ * @property {string} doc the doc file, relative to the package root
54
+ * @property {string} reason why: not a form the check judges exactly, a
55
+ * field the prop's variants give different types, a standard prop
56
+ * (`className`, `style`, …), or a prop declared outside the package
57
+ * @property {string[]} props documented props whose types were not compared
58
+ */
50
59
  /**
51
60
  * @typedef {object} PropDriftReport
52
61
  * @property {'checked' | 'skipped'} status `skipped` means nothing was
@@ -54,12 +63,16 @@ export function comparePropDocs(components: PropDriftComponent[], options: {
54
63
  * @property {string} [reason]
55
64
  * @property {string} [typescript] the version of the compiler that read the props
56
65
  * @property {number} components how many documented prop tables were compared
66
+ * @property {number} typesCompared how many documented prop types were judged
67
+ * @property {string} [typesSkipped] why no prop type was judged
57
68
  * @property {PropDriftFinding[]} findings
58
69
  * @property {PropDriftUnchecked[]} unchecked documented components whose props
59
70
  * could not be read from the source
60
71
  * @property {Array<PropDriftUnchecked & {props: string[]}>} [propsNotChecked]
61
72
  * props a mapped type builds from keys the check can't trace, which a doc
62
73
  * leaving out draws no warning for
74
+ * @property {PropDriftTypesNotCompared[]} typesNotCompared every other
75
+ * documented prop type, grouped by why it was not judged
63
76
  */
64
77
  /**
65
78
  * @typedef {object} PropDriftTable
@@ -83,7 +96,7 @@ export function comparePropDocs(components: PropDriftComponent[], options: {
83
96
  */
84
97
  export const PROPS_NOT_DOCUMENTED: readonly string[];
85
98
  /** The line both surfaces print when the compiler is missing. */
86
- export const TYPESCRIPT_MISSING_REASON: "TypeScript is not installed in this project, so documented props were not compared with the code. Install typescript and run this check again.";
99
+ export const TYPESCRIPT_MISSING_REASON: "TypeScript is not installed in this project, so documented props were not compared with the code. On TypeScript 7, add its TypeScript 6 API package (`npm install -D @typescript/typescript6`); otherwise install TypeScript 5.0 through 6 (`npm install -D typescript@6`). Then run this check again.";
87
100
  export type CodeProp = {
88
101
  name: string;
89
102
  /**
@@ -112,13 +125,28 @@ export type CodeProp = {
112
125
  /**
113
126
  * the compiler's renderings, computed on demand
114
127
  */
115
- renderings: () => string[];
128
+ renderings: () => string[][];
116
129
  /**
117
130
  * the prop's type in each member of the props type
118
131
  */
119
132
  types: () => any[];
133
+ /**
134
+ * one member declares it more than once (an
135
+ * intersection), so no one declaration's text is its type
136
+ */
137
+ intersected: boolean;
138
+ /**
139
+ * the type an index signature gives
140
+ * the name in each member that lacks the prop; null when two signatures
141
+ * in one member take it
142
+ */
143
+ indexed: () => any[] | null;
144
+ /**
145
+ * where names in the prop's type resolve
146
+ */
147
+ location: any;
120
148
  };
121
- export type PropDriftKind = "not_in_code" | "not_in_doc" | "required_mismatch";
149
+ export type PropDriftKind = "not_in_code" | "not_in_doc" | "required_mismatch" | "type_mismatch";
122
150
  export type PropDriftFinding = {
123
151
  /**
124
152
  * the documented component (export) name
@@ -158,6 +186,23 @@ export type PropDriftUnchecked = {
158
186
  */
159
187
  reason: string;
160
188
  };
189
+ export type PropDriftTypesNotCompared = {
190
+ component: string;
191
+ /**
192
+ * the doc file, relative to the package root
193
+ */
194
+ doc: string;
195
+ /**
196
+ * why: not a form the check judges exactly, a
197
+ * field the prop's variants give different types, a standard prop
198
+ * (`className`, `style`, …), or a prop declared outside the package
199
+ */
200
+ reason: string;
201
+ /**
202
+ * documented props whose types were not compared
203
+ */
204
+ props: string[];
205
+ };
161
206
  export type PropDriftReport = {
162
207
  /**
163
208
  * `skipped` means nothing was
@@ -173,6 +218,14 @@ export type PropDriftReport = {
173
218
  * how many documented prop tables were compared
174
219
  */
175
220
  components: number;
221
+ /**
222
+ * how many documented prop types were judged
223
+ */
224
+ typesCompared: number;
225
+ /**
226
+ * why no prop type was judged
227
+ */
228
+ typesSkipped?: string | undefined;
176
229
  findings: PropDriftFinding[];
177
230
  /**
178
231
  * documented components whose props
@@ -186,6 +239,11 @@ export type PropDriftReport = {
186
239
  propsNotChecked?: (PropDriftUnchecked & {
187
240
  props: string[];
188
241
  })[] | undefined;
242
+ /**
243
+ * every other
244
+ * documented prop type, grouped by why it was not judged
245
+ */
246
+ typesNotCompared: PropDriftTypesNotCompared[];
189
247
  };
190
248
  export type PropDriftTable = {
191
249
  /**