@astryxdesign/cli 0.7.2-canary.ab79547 → 0.7.2-canary.b40ba52

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 (255) hide show
  1. package/README.md +20 -19
  2. package/api/build/help/help.mjs +1 -1
  3. package/api/component/_adapter.d.mts +41 -1
  4. package/api/component/_adapter.mjs +93 -7
  5. package/api/component/component.mjs +22 -5
  6. package/api/component/integration-export-name.test.mjs +644 -0
  7. package/api/discover/_adapter.d.mts +119 -12
  8. package/api/discover/_adapter.mjs +449 -10
  9. package/api/discover/_adapter.test.mjs +599 -17
  10. package/api/discover/_catalog-view.d.mts +16 -5
  11. package/api/discover/_catalog-view.mjs +32 -8
  12. package/api/discover/discover.d.mts +11 -0
  13. package/api/discover/discover.doc.mjs +7 -6
  14. package/api/discover/discover.mjs +107 -19
  15. package/api/discover/discover.type.d.mts +18 -7
  16. package/api/discover/discover.type.mjs +15 -7
  17. package/api/discover/list/list.d.mts +4 -3
  18. package/api/discover/list/list.mjs +17 -10
  19. package/api/docs/_adapter.d.mts +11 -0
  20. package/api/docs/_adapter.mjs +244 -1
  21. package/api/docs/integrationDocs.test.mjs +124 -0
  22. package/api/doctor/doctor.mjs +27 -3
  23. package/api/doctor/doctor.test.mjs +43 -0
  24. package/api/doctor/theme-checks.mjs +1 -1
  25. package/api/doctor/theme-checks.test.mjs +136 -0
  26. package/api/gap-report/gap-report.d.mts +3 -0
  27. package/api/gap-report/gap-report.doc.mjs +11 -3
  28. package/api/gap-report/gap-report.mjs +219 -52
  29. package/api/gap-report/gap-report.test.mjs +233 -0
  30. package/api/gap-report/gap-report.type.d.mts +41 -0
  31. package/api/gap-report/gap-report.type.mjs +18 -0
  32. package/api/index.d.mts +2 -0
  33. package/api/index.mjs +2 -0
  34. package/api/init/run/run.mjs +2 -2
  35. package/api/integration/_adapter.d.mts +12 -0
  36. package/api/integration/_adapter.mjs +54 -0
  37. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  38. package/api/integration/add-contribution.mjs +8 -4
  39. package/api/integration/add-contribution.test.mjs +4 -2
  40. package/api/integration/authoring-checks.mjs +11 -2
  41. package/api/integration/authoring-checks.test.mjs +39 -0
  42. package/api/integration/authoring-checks.type.d.mts +9 -0
  43. package/api/integration/authoring-checks.type.mjs +14 -1
  44. package/api/integration/check/check.d.mts +96 -0
  45. package/api/integration/check/check.mjs +357 -0
  46. package/api/integration/check/check.test.mjs +489 -0
  47. package/api/integration/integration-check.type.d.mts +118 -0
  48. package/api/integration/integration-check.type.mjs +84 -0
  49. package/api/integration/integrationCheck.doc.d.mts +10 -0
  50. package/api/integration/integrationCheck.doc.mjs +73 -0
  51. package/api/integration/integrationComponentConflicts.doc.mjs +43 -6
  52. package/api/integration/pack-check.mjs +343 -104
  53. package/api/integration/pack-check.test.mjs +700 -0
  54. package/api/integration/validate-integration.mjs +8 -0
  55. package/api/integration/validate-integration.test.mjs +11 -0
  56. package/api/integration/validate-integration.type.d.mts +8 -0
  57. package/api/integration/validate-integration.type.mjs +12 -1
  58. package/api/integration/validateIntegration.doc.mjs +19 -3
  59. package/api/search/search.d.mts +81 -12
  60. package/api/search/search.domain-priority.test.mjs +108 -18
  61. package/api/search/search.integration-check.test.mjs +24 -0
  62. package/api/search/search.mjs +601 -50
  63. package/api/search/search.test.mjs +139 -0
  64. package/api/swizzle/copy/copy.mjs +28 -14
  65. package/api/theme/build/build.family.test.mjs +54 -6
  66. package/api/theme/build/build.mjs +114 -17
  67. package/api/theme/themeBuild.doc.mjs +4 -4
  68. package/api/upgrade/_adapter.d.mts +40 -2
  69. package/api/upgrade/_adapter.mjs +117 -4
  70. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  71. package/api/upgrade/run/run.mjs +30 -1
  72. package/api/upgrade/status/status.d.mts +21 -5
  73. package/api/upgrade/status/status.mjs +45 -8
  74. package/api/upgrade/upgrade.doc.mjs +5 -3
  75. package/api/upgrade/upgrade.type.d.mts +23 -0
  76. package/api/upgrade/upgrade.type.mjs +16 -1
  77. package/assets/codemods/runner.mjs +7 -1
  78. package/assets/discover/official-packages.json +367 -0
  79. package/assets/docs/README.md +10 -0
  80. package/assets/docs/author-a-theme.doc.mjs +1 -1
  81. package/assets/docs/getting-started.doc.mjs +3 -3
  82. package/assets/docs/styling-overview.doc.mjs +1 -1
  83. package/assets/docs/theme.doc.dense.mjs +1 -1
  84. package/assets/docs/theme.doc.mjs +1 -1
  85. package/assets/docs/theme.doc.zh.mjs +1 -1
  86. package/assets/docs/tree/add-a-component.doc.mjs +11 -1
  87. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  88. package/assets/docs/tree/add-a-topic.doc.mjs +10 -7
  89. package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
  90. package/assets/docs/tree/block-template.doc.mjs +8 -20
  91. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  92. package/assets/docs/tree/check-the-props.doc.mjs +196 -0
  93. package/assets/docs/tree/check-your-docs.doc.mjs +51 -5
  94. package/assets/docs/tree/checks.doc.mjs +24 -16
  95. package/assets/docs/tree/codemods.doc.mjs +4 -4
  96. package/assets/docs/tree/component-family.doc.mjs +8 -6
  97. package/assets/docs/tree/component-imports.doc.mjs +10 -2
  98. package/assets/docs/tree/components.doc.mjs +1 -1
  99. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -16
  100. package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
  101. package/assets/docs/tree/describe-the-component.doc.mjs +2 -2
  102. package/assets/docs/tree/docs.doc.mjs +3 -3
  103. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  104. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  105. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  106. package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
  107. package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
  108. package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
  109. package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
  110. package/assets/docs/tree/integrations.doc.mjs +8 -0
  111. package/assets/docs/tree/links.doc.mjs +6 -5
  112. package/assets/docs/tree/migration-setup.doc.mjs +1 -0
  113. package/assets/docs/tree/migration-verification.doc.mjs +0 -1
  114. package/assets/docs/tree/migration.doc.mjs +0 -1
  115. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  116. package/assets/docs/tree/page-template.doc.mjs +4 -8
  117. package/assets/docs/tree/publishing.doc.mjs +1 -1
  118. package/assets/docs/tree/quick-start.doc.mjs +37 -21
  119. package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
  120. package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
  121. package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
  122. package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
  123. package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
  124. package/assets/docs/tree/single-component.doc.mjs +15 -6
  125. package/assets/docs/tree/start-a-template.doc.mjs +3 -3
  126. package/assets/docs/tree/subcomponent.doc.mjs +6 -6
  127. package/assets/docs/tree/template-assets.doc.mjs +2 -2
  128. package/assets/docs/tree/template-doc-overview.doc.mjs +4 -15
  129. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  130. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  131. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  132. package/assets/docs/tree/template-styles.doc.mjs +2 -2
  133. package/assets/docs/tree/templates.doc.mjs +1 -1
  134. package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
  135. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  136. package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
  137. package/assets/docs/tree/troubleshooting.doc.mjs +13 -5
  138. package/assets/docs/tree/type-scale.doc.mjs +3 -3
  139. package/assets/docs/tree/upgrading.doc.mjs +3 -3
  140. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
  141. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  142. package/assets/docs/tree/versioning.doc.mjs +7 -6
  143. package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
  144. package/assets/docs/use-a-theme.doc.mjs +2 -2
  145. package/assets/theme.template.ts +1 -1
  146. package/authoring/codemod/codemod.doc.mjs +7 -3
  147. package/authoring/config/config.doc.mjs +9 -6
  148. package/authoring/config/type.ts +4 -2
  149. package/authoring/discover/discover.doc.mjs +1 -1
  150. package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
  151. package/authoring/doctypes/command/command.doc.mjs +14 -12
  152. package/authoring/doctypes/component/component.doc.mjs +29 -26
  153. package/authoring/doctypes/component/type.ts +13 -8
  154. package/authoring/doctypes/enum/enum.doc.mjs +7 -4
  155. package/authoring/doctypes/function/function.doc.mjs +9 -8
  156. package/authoring/doctypes/hook/hook.doc.mjs +5 -4
  157. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
  158. package/authoring/doctypes/reference/reference.doc.mjs +11 -10
  159. package/authoring/doctypes/schema/schema.doc.mjs +9 -9
  160. package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
  161. package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
  162. package/authoring/doctypes/template/parse.d.mts +6 -2
  163. package/authoring/doctypes/template/parse.mjs +3 -1
  164. package/authoring/doctypes/template/template.doc.mjs +3 -3
  165. package/authoring/doctypes/template/type.ts +22 -0
  166. package/authoring/doctypes/theme/theme.doc.mjs +2 -2
  167. package/authoring/gap-report/gap-report.doc.mjs +2 -2
  168. package/authoring/identity/identity.doc.mjs +3 -3
  169. package/authoring/index.d.ts +1 -0
  170. package/authoring/integration/integration.doc.mjs +12 -4
  171. package/authoring/integration/parse.test.mjs +10 -0
  172. package/authoring/integration/schema.d.mts +2 -0
  173. package/authoring/integration/schema.mjs +1 -0
  174. package/authoring/integration/type.ts +4 -0
  175. package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
  176. package/clients/cli/commands/build-theme.mjs +1 -1
  177. package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
  178. package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
  179. package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
  180. package/clients/cli/commands/discover.doc.mjs +1 -1
  181. package/clients/cli/commands/discover.mjs +144 -93
  182. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  183. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  184. package/clients/cli/commands/doctor-integration-components.doc.mjs +17 -4
  185. package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
  186. package/clients/cli/commands/doctor-integration.test.mjs +837 -0
  187. package/clients/cli/commands/doctor.mjs +190 -0
  188. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  189. package/clients/cli/commands/gap-report.mjs +24 -2
  190. package/clients/cli/commands/gap-report.test.mjs +79 -0
  191. package/clients/cli/commands/integration-check.doc.mjs +85 -0
  192. package/clients/cli/commands/integration-check.test.mjs +284 -0
  193. package/clients/cli/commands/integration.doc.mjs +6 -2
  194. package/clients/cli/commands/integration.mjs +106 -1
  195. package/clients/cli/commands/json-contract.test.mjs +5 -1
  196. package/clients/cli/commands/setup-nudge.test.mjs +79 -1
  197. package/clients/cli/commands/swizzle.mjs +5 -3
  198. package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
  199. package/clients/cli/commands/text-json-parity.test.mjs +5 -0
  200. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  201. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  202. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  203. package/clients/cli/index.mjs +30 -5
  204. package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
  205. package/foundation/agent-docs/agent-doc-state.mjs +38 -0
  206. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  207. package/foundation/agent-docs/agent-docs.mjs +8 -6
  208. package/foundation/config/project.mjs +82 -0
  209. package/foundation/discovery/authoring-self-docs.mjs +2 -1
  210. package/foundation/discovery/component-discovery.d.mts +178 -10
  211. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  212. package/foundation/discovery/component-discovery.mjs +659 -62
  213. package/foundation/discovery/component-replacement.mjs +18 -0
  214. package/foundation/discovery/component-replacement.test.mjs +40 -0
  215. package/foundation/discovery/doc-types.d.mts +157 -0
  216. package/foundation/discovery/doc-types.mjs +1224 -0
  217. package/foundation/discovery/doc-types.test.mjs +700 -0
  218. package/foundation/discovery/docs-discovery.d.mts +81 -0
  219. package/foundation/discovery/docs-discovery.mjs +57 -0
  220. package/foundation/discovery/integration-doc-files.d.mts +22 -0
  221. package/foundation/discovery/integration-doc-files.mjs +231 -0
  222. package/foundation/discovery/integration-doc-files.test.mjs +246 -0
  223. package/foundation/discovery/module-exports.d.mts +27 -0
  224. package/foundation/discovery/module-exports.mjs +356 -31
  225. package/foundation/discovery/module-exports.test.mjs +172 -0
  226. package/foundation/discovery/package-tsconfig.d.mts +14 -0
  227. package/foundation/discovery/package-tsconfig.mjs +228 -0
  228. package/foundation/discovery/package-tsconfig.test.mjs +210 -0
  229. package/foundation/discovery/project-typescript.d.mts +32 -0
  230. package/foundation/discovery/project-typescript.mjs +89 -0
  231. package/foundation/discovery/prop-drift.d.mts +278 -0
  232. package/foundation/discovery/prop-drift.mjs +2263 -0
  233. package/foundation/discovery/prop-drift.test.mjs +2272 -0
  234. package/foundation/discovery/type-match.d.mts +53 -0
  235. package/foundation/discovery/type-match.mjs +660 -0
  236. package/foundation/discovery/type-match.test.mjs +169 -0
  237. package/foundation/discovery/type-text.d.mts +68 -0
  238. package/foundation/discovery/type-text.mjs +658 -0
  239. package/foundation/discovery/type-text.test.mjs +196 -0
  240. package/foundation/discovery/unresolved-references.d.mts +62 -0
  241. package/foundation/discovery/unresolved-references.mjs +790 -0
  242. package/foundation/discovery/unresolved-references.test.mjs +567 -0
  243. package/foundation/doc-compiler/doc-loads.test.mjs +10 -0
  244. package/foundation/doc-compiler/links.d.mts +9 -5
  245. package/foundation/doc-compiler/links.mjs +4 -2
  246. package/foundation/env/package-manager.d.mts +32 -0
  247. package/foundation/env/package-manager.mjs +47 -0
  248. package/foundation/env/package-manager.test.mjs +194 -7
  249. package/foundation/fs/module-loader.d.mts +2 -1
  250. package/foundation/fs/module-loader.mjs +60 -4
  251. package/foundation/fs/module-loader.test.mjs +194 -0
  252. package/foundation/integrations/contribution-inventory.mjs +6 -1
  253. package/foundation/response/response-types.doc.mjs +13 -7
  254. package/package.json +9 -9
  255. package/scripts/postinstall.mjs +3 -3
@@ -98,6 +98,85 @@ function issueBlocks(issues) {
98
98
  ];
99
99
  }
100
100
 
101
+ /**
102
+ * The docs checked against the authoring types: a visible line when it was
103
+ * skipped, the findings (all warnings), the files it could not check, or an
104
+ * [ok] (never after a failed check).
105
+ * @param {import('../../../api/integration/validate-integration.type.mjs').DocTypesReport | undefined} report
106
+ * @param {boolean} failed
107
+ */
108
+ function docTypesBlocks(report, failed) {
109
+ if (!report) return [];
110
+ if (
111
+ report.status === 'checked' &&
112
+ report.docs === 0 &&
113
+ report.findings.length === 0 &&
114
+ report.unchecked.length === 0
115
+ ) {
116
+ return [
117
+ text('[info] No doc files to type-check.'),
118
+ ...(report.fixtures
119
+ ? [text(`[info] ${report.fixtures} test fixture doc(s) not checked.`)]
120
+ : []),
121
+ ];
122
+ }
123
+ if (report.status === 'skipped') {
124
+ return [text(`[skip] Docs not type-checked: ${report.reason}`)];
125
+ }
126
+ const blocks = [
127
+ section(
128
+ `Checking ${report.docs} doc(s) against the authoring types${report.typescript ? ` (TypeScript ${report.typescript})` : ''}`,
129
+ ),
130
+ ];
131
+ if (report.findings.length > 0) {
132
+ const files = new Set(report.findings.map(f => f.doc)).size;
133
+ blocks.push(
134
+ records(report.findings, {
135
+ fields: [
136
+ 'severity',
137
+ 'doc',
138
+ 'line',
139
+ 'export',
140
+ 'type',
141
+ 'field',
142
+ 'problem',
143
+ 'message',
144
+ 'fix',
145
+ ],
146
+ format: {severity: statusToken},
147
+ }),
148
+ text(
149
+ `${report.findings.length} doc field(s) in ${files} file(s) do not match the authoring types. ` +
150
+ 'These are warnings; `astryx docs authoring` lists every field.',
151
+ ),
152
+ );
153
+ }
154
+ if (report.unchecked.length > 0) {
155
+ blocks.push(
156
+ text(`[info] Not type-checked: ${report.unchecked.length} doc file(s):`),
157
+ records(report.unchecked, {fields: ['doc', 'reason']}),
158
+ );
159
+ }
160
+ if (report.fixtures) {
161
+ blocks.push(
162
+ text(`[info] ${report.fixtures} test fixture doc(s) not checked.`),
163
+ );
164
+ }
165
+ if (report.findings.length === 0 && report.docs > 0) {
166
+ // After a failed check an [ok] reads as a pass, but the result still shows.
167
+ blocks.push(
168
+ text(
169
+ failed
170
+ ? `[info] No doc field differs from its authoring type (${report.docs} checked).`
171
+ : report.unchecked.length > 0
172
+ ? `[ok] Every doc that was checked matches its authoring type (${report.docs} checked).`
173
+ : `[ok] Every doc matches its authoring type (${report.docs} checked).`,
174
+ ),
175
+ );
176
+ }
177
+ return blocks;
178
+ }
179
+
101
180
  /**
102
181
  * @param {import('../../../api/integration/validate-integration.type.mjs').ValidateIntegrationResponse['data']} data
103
182
  */
@@ -119,6 +198,7 @@ function printIntegrationValidation(data) {
119
198
  `Summary: ${errors} error${errors === 1 ? '' : 's'}, ` +
120
199
  `${warnings} warning${warnings === 1 ? '' : 's'}`,
121
200
  ),
201
+ ...docTypesBlocks(data.docTypes, errors > 0),
122
202
  );
123
203
  }
124
204
 
@@ -173,6 +253,98 @@ function printTemplateConflicts(data) {
173
253
  emit(...output);
174
254
  }
175
255
 
256
+ /**
257
+ * The documented-props comparison, with every field its JSON carries: a
258
+ * visible line when it was skipped, the findings (all warnings), the
259
+ * components it could not read, and how many were compared with which
260
+ * TypeScript, as an [ok] when nothing differs (never after a failed check).
261
+ * Then how many documented prop types were judged and which were not.
262
+ * @param {import('../../../api/integration/authoring-checks.type.mjs').PropDriftReport | undefined} report
263
+ * @param {boolean} failed
264
+ */
265
+ function propDriftBlocks(report, failed) {
266
+ if (!report) return [];
267
+ if (report.status === 'skipped') {
268
+ return [text(`[skip] Props not compared: ${report.reason}`)];
269
+ }
270
+ const blocks = [];
271
+ if (report.findings.length > 0) {
272
+ // Two docs of one name are two components.
273
+ const components = new Set(
274
+ report.findings.map(f => `${f.doc}\0${f.component}`),
275
+ ).size;
276
+ blocks.push(
277
+ records(report.findings, {
278
+ fields: [
279
+ 'severity',
280
+ 'component',
281
+ 'prop',
282
+ 'kind',
283
+ 'message',
284
+ 'doc',
285
+ 'source',
286
+ 'docType',
287
+ 'codeType',
288
+ 'docRequired',
289
+ 'codeRequired',
290
+ ],
291
+ format: {severity: statusToken},
292
+ }),
293
+ text(
294
+ `${report.findings.length} prop(s) differ between the docs and the code in ${components} of ${report.components} component(s) compared (TypeScript ${report.typescript}). ` +
295
+ 'These are warnings: update the doc, or the code if the doc is right.',
296
+ ),
297
+ );
298
+ }
299
+ if (report.unchecked.length > 0) {
300
+ blocks.push(
301
+ text(
302
+ `[info] Props not compared for ${report.unchecked.length} documented component(s):`,
303
+ ),
304
+ records(report.unchecked, {fields: ['component', 'doc', 'reason']}),
305
+ );
306
+ }
307
+ const notChecked = report.propsNotChecked ?? [];
308
+ if (notChecked.length > 0) {
309
+ blocks.push(
310
+ text(
311
+ `[info] Props not checked for a doc entry in ${notChecked.length} component(s):`,
312
+ ),
313
+ records(notChecked, {fields: ['component', 'doc', 'reason', 'props']}),
314
+ );
315
+ }
316
+ if (report.findings.length === 0) {
317
+ const apart =
318
+ notChecked.length > 0 ? ', apart from the props not checked' : '';
319
+ blocks.push(
320
+ text(
321
+ !failed && report.components > 0
322
+ ? `[ok] Documented prop names and required flags match the code in ${report.components} component(s)${apart} (TypeScript ${report.typescript}).`
323
+ : `[info] Props compared in ${report.components} component(s) (TypeScript ${report.typescript}).`,
324
+ ),
325
+ );
326
+ }
327
+ if (report.typesSkipped) {
328
+ blocks.push(text(`[skip] Prop types not judged: ${report.typesSkipped}.`));
329
+ return blocks;
330
+ }
331
+ const notCompared = report.typesNotCompared.flatMap(entry => entry.props);
332
+ blocks.push(
333
+ text(
334
+ `[info] Documented prop types judged: ${report.typesCompared}; not compared: ${notCompared.length}. ` +
335
+ 'A type is judged when the doc writes it the same as the source (exactly, if it contains `readonly`), or when both are primitives, literals, arrays and unions of those, or names for them.',
336
+ ),
337
+ );
338
+ if (notCompared.length > 0) {
339
+ blocks.push(
340
+ records(report.typesNotCompared, {
341
+ fields: ['component', 'doc', 'reason', 'props'],
342
+ }),
343
+ );
344
+ }
345
+ return blocks;
346
+ }
347
+
176
348
  /**
177
349
  * @param {import('../../../api/integration/authoring-checks.type.mjs').IntegrationComponentConflictResponse['data']} data
178
350
  */
@@ -205,6 +377,7 @@ function printComponentConflicts(data) {
205
377
  ),
206
378
  );
207
379
  }
380
+ output.push(...propDriftBlocks(data.propDrift, failed));
208
381
  emit(...output);
209
382
  }
210
383
 
@@ -242,6 +415,23 @@ function printDocConflicts(data) {
242
415
  emit(...output);
243
416
  }
244
417
 
418
+ /**
419
+ * Print one `doctor integration` check's result as its own subcommand prints
420
+ * it. `astryx integration check` prints each check it runs through this.
421
+ * @param {import('../../../api/integration/integration-check.type.mjs').IntegrationCheckResponse} response
422
+ */
423
+ export function printIntegrationCheckResponse(response) {
424
+ if (response.type === 'integration.validate') {
425
+ printIntegrationValidation(response.data);
426
+ } else if (response.type === 'integration.component-conflicts') {
427
+ printComponentConflicts(response.data);
428
+ } else if (response.type === 'integration.template-conflicts') {
429
+ printTemplateConflicts(response.data);
430
+ } else {
431
+ printDocConflicts(response.data);
432
+ }
433
+ }
434
+
245
435
  /** @param {import('commander').Command} program */
246
436
  async function runProjectDoctor(program) {
247
437
  const report = await runChecks();
@@ -16,6 +16,8 @@ export const doc = {
16
16
  'Reports a missing component, variant, layout, styling, accessibility, API, or documentation capability to the package that owns it: the --package you name, else the integration whose component replaces it, else the one package that provides the component, else Core. ' +
17
17
  'Every configured handler receives the report: the project config handler first, then each integration handler in config order. Public handlers run only with --confirm-public; internal handlers always run. A failing handler does not stop the others. ' +
18
18
  "With no handler it files a GitHub issue for the owning package, only with --confirm-public (without it nothing is sent), or returns the package's issues URL when that is not on GitHub. " +
19
+ "With --to <package>, the report goes only to that integration's issues URL instead, under the same --confirm-public rule. " +
20
+ 'When loaded integrations name their own issues URLs, the output lists every destination: an agent asks the person where to file and passes their choice with --to; it never picks a package itself, and without a choice the default is used. ' +
19
21
  'The report records whether an agent or a person ran it.',
20
22
  fn: 'gapReport',
21
23
  args: [
@@ -55,13 +57,19 @@ export const doc = {
55
57
  flag: '--confirm-public',
56
58
  param: 'options.confirmPublic',
57
59
  description:
58
- 'Allow public delivery: public handlers run, and with no handler it files a GitHub issue with your gh login',
60
+ 'Allow public delivery: public handlers run, and a GitHub issues URL gets an issue filed with your gh login',
61
+ },
62
+ {
63
+ flag: '--to <package>',
64
+ param: 'options.to',
65
+ description:
66
+ "Send the report only to this loaded integration's issues URL, as the person chose; the destinations the output lists are the choices",
59
67
  },
60
68
  {
61
69
  flag: '--list-categories',
62
70
  param: 'options.listCategories',
63
71
  description:
64
- 'List valid report categories without filing; the component and the other gap-report options are refused with ERR_INVALID_ARGUMENT',
72
+ 'List valid report categories, and the destinations when there is more than one, without filing; the component and the other gap-report options are refused with ERR_INVALID_ARGUMENT',
65
73
  },
66
74
  ],
67
75
  examples: [
@@ -70,6 +78,10 @@ export const doc = {
70
78
  label: 'Prepare a report (nothing public happens without --confirm-public)',
71
79
  cli: "astryx gap-report Button --category missing_variant --reason 'Need a compact size'",
72
80
  },
81
+ {
82
+ label: 'File where the person chose',
83
+ cli: "astryx gap-report Button --category missing_variant --reason 'Need a compact size' --to @acme/widgets",
84
+ },
73
85
  ],
74
86
  exitCodes: [
75
87
  {
@@ -7,7 +7,7 @@
7
7
  import {gapReport as gapReportApi} from '../../../api/gap-report/gap-report.mjs';
8
8
  import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
9
9
  import {jsonOut} from '../../../foundation/response/json.mjs';
10
- import {emit, record, records, section} from '../formatters/index.mjs';
10
+ import {emit, record, records, section, text} from '../formatters/index.mjs';
11
11
  import {cliError} from '../lib/cli-error.mjs';
12
12
  import {defineCommand} from '../lib/define-command.mjs';
13
13
  import {doc as gapReportCommand} from './gap-report.doc.mjs';
@@ -19,7 +19,7 @@ export function registerGapReport(program) {
19
19
  fn: gapReportFn,
20
20
  action: async (
21
21
  /** @type {string|undefined} */ component,
22
- /** @type {{category?: string, reason?: string, additionalContext?: string, package?: string, confirmPublic?: boolean, listCategories?: boolean}} */ options,
22
+ /** @type {{category?: string, reason?: string, additionalContext?: string, package?: string, confirmPublic?: boolean, listCategories?: boolean, to?: string}} */ options,
23
23
  ) => {
24
24
  /** @type {Awaited<ReturnType<typeof gapReportApi>>} */
25
25
  let result;
@@ -35,6 +35,7 @@ export function registerGapReport(program) {
35
35
  package: options.package,
36
36
  confirmPublic: options.confirmPublic,
37
37
  listCategories: options.listCategories,
38
+ to: options.to,
38
39
  });
39
40
  } catch (error) {
40
41
  const err =
@@ -78,6 +79,9 @@ export function registerGapReport(program) {
78
79
  section('Gap report categories'),
79
80
  records(result.data, {fields: ['value', 'label']}),
80
81
  );
82
+ if (result.meta) {
83
+ emit(...destinationBlocks(result.meta.destinations, result.meta.ask));
84
+ }
81
85
  return answered;
82
86
  }
83
87
 
@@ -119,8 +123,26 @@ export function registerGapReport(program) {
119
123
  );
120
124
  }
121
125
 
126
+ if (result.data.destinations && result.data.ask) {
127
+ emit(...destinationBlocks(result.data.destinations, result.data.ask));
128
+ }
129
+
122
130
  if (isFailure) process.exitCode = 1;
123
131
  return answered;
124
132
  },
125
133
  });
126
134
  }
135
+
136
+ /**
137
+ * The destinations a report can go to, then the line telling an agent to ask
138
+ * the person (architecture:cli-surface INV36).
139
+ * @param {import('../../../api/gap-report/gap-report.type.mjs').GapReportDestination[]} destinations
140
+ * @param {string} ask
141
+ */
142
+ function destinationBlocks(destinations, ask) {
143
+ return [
144
+ section('Destinations'),
145
+ records(destinations, {fields: ['to', 'default', 'issuesUrl']}),
146
+ text(ask),
147
+ ];
148
+ }
@@ -331,3 +331,82 @@ describe('gap-report control docs', () => {
331
331
  ).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
332
332
  });
333
333
  });
334
+
335
+ describe('gap-report destinations in text', () => {
336
+ it('lists the destinations and tells the agent to ask the person', async () => {
337
+ const cwd = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-gap-dest-'));
338
+ try {
339
+ fs.writeFileSync(
340
+ path.join(cwd, 'package.json'),
341
+ JSON.stringify({name: 'fixture-app'}),
342
+ );
343
+ const pkg = path.join(cwd, 'node_modules', '@test', 'widgets');
344
+ fs.mkdirSync(pkg, {recursive: true});
345
+ fs.writeFileSync(
346
+ path.join(pkg, 'package.json'),
347
+ JSON.stringify({name: '@test/widgets', version: '1.0.0'}),
348
+ );
349
+ fs.writeFileSync(
350
+ path.join(pkg, 'astryx.integration.mjs'),
351
+ "export default {issuesUrl: 'https://tracker.example/widgets'};\n",
352
+ );
353
+ fs.writeFileSync(
354
+ path.join(cwd, 'astryx.config.mjs'),
355
+ `export default {
356
+ integrations: ['@test/widgets'],
357
+ gapReport: {audience: 'internal', handle: () => ({status: 'filed', message: 'shared'})},
358
+ };\n`,
359
+ );
360
+
361
+ const listed = await runCli(['gap-report', '--list-categories'], {cwd});
362
+ expect(listed.status).toBe(0);
363
+ expect(listed.stdout).toContain('Destinations');
364
+ expect(listed.stdout).toMatch(/^default:\s+true$/m);
365
+ expect(listed.stdout).toMatch(/^to:\s+@test\/widgets$/m);
366
+ expect(listed.stdout).toMatch(
367
+ /^issuesUrl:\s+https:\/\/tracker\.example\/widgets$/m,
368
+ );
369
+ expect(listed.stdout).toMatch(/ask the person/i);
370
+
371
+ const filed = await runCli(
372
+ [
373
+ 'gap-report',
374
+ 'Button',
375
+ '--category',
376
+ 'docs_gap',
377
+ '--reason',
378
+ 'Need a keyboard example',
379
+ ],
380
+ {cwd},
381
+ );
382
+ expect(filed.status).toBe(0);
383
+ expect(filed.stdout).toContain('Destinations');
384
+ expect(filed.stdout).toMatch(/ask the person/i);
385
+
386
+ const chosen = await runCli(
387
+ [
388
+ 'gap-report',
389
+ 'Button',
390
+ '--category',
391
+ 'docs_gap',
392
+ '--reason',
393
+ 'Need a keyboard example',
394
+ '--to',
395
+ '@test/widgets',
396
+ '--json',
397
+ ],
398
+ {cwd},
399
+ );
400
+ expect(chosen.status).toBe(0);
401
+ expect(JSON.parse(chosen.stdout).data.deliveries).toEqual([
402
+ expect.objectContaining({
403
+ handler: 'issuesUrl',
404
+ status: 'routed_only',
405
+ url: 'https://tracker.example/widgets',
406
+ }),
407
+ ]);
408
+ } finally {
409
+ fs.rmSync(cwd, {recursive: true, force: true});
410
+ }
411
+ });
412
+ });
@@ -0,0 +1,85 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx integration check`.
5
+ */
6
+
7
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
8
+ export const doc = {
9
+ type: 'command',
10
+ name: 'integration check',
11
+ displayName: 'astryx integration check',
12
+ namespace: 'cli/commands',
13
+ summary:
14
+ "The CI check for an integration package's own build: every source check, run in continuous integration or a typecheck script, against the package in the current folder",
15
+ description:
16
+ 'Takes no package argument: it runs the four `doctor integration` checks, ' +
17
+ '`validate`, `components`, `templates`, and `docs`, against the integration ' +
18
+ 'package in the current folder, which is where its own build runs it. It prints ' +
19
+ 'each result as that check ' +
20
+ 'prints it, then a summary with the errors, warnings, and skipped work of each, ' +
21
+ 'and exits 1 when any of the four would exit 1 on its own. With `--strict` it ' +
22
+ 'also exits 1 on any warning and on any check, or comparison within a check, ' +
23
+ 'that did not run, such as a package with no `astryx.integration.*` or a ' +
24
+ 'comparison skipped because the project has no TypeScript, or prop types not ' +
25
+ 'judged because its TypeScript is older than 4.8: it adds no check, ' +
26
+ 'and lists each of those again as an error, after the checks, in their own ' +
27
+ 'issue format. That is the line ' +
28
+ "for the package's own build, so its docs, types, and links stay in sync: run " +
29
+ 'it as a `ci` step, or add ' +
30
+ '`"typecheck": "tsc --noEmit && astryx integration check --strict"` to the ' +
31
+ 'scripts in package.json. Its exit codes and JSON are a contract for the builds ' +
32
+ 'that run it: a new check, or a new failure code, joins only in a minor release ' +
33
+ 'that names it in the release notes. A patch can still ship a Core component, ' +
34
+ 'template, or CLI topic whose name conflicts with one of yours. Run ' +
35
+ '`integration check` on every build; run ' +
36
+ '`integration verify` before you publish, to check that the packed package ' +
37
+ 'works in an app. To check an installed integration by name, run the ' +
38
+ '`doctor integration` subcommands with its package name.',
39
+ fn: 'integrationCheck',
40
+ options: [
41
+ {
42
+ flag: '--strict',
43
+ param: 'options.strict',
44
+ description:
45
+ 'Also exit 1 on any warning and on any check that did not run. A new check or failure code joins only in a minor release, named in the release notes.',
46
+ },
47
+ ],
48
+ examples: [
49
+ {
50
+ label:
51
+ 'In CI, as the typecheck script: add "typecheck": "tsc --noEmit && astryx integration check --strict" to package.json',
52
+ cli: 'integration check --strict',
53
+ },
54
+ {
55
+ label: 'Errors only, while you fix the warnings a package already has',
56
+ cli: 'integration check',
57
+ },
58
+ {
59
+ label: 'Read the result as JSON',
60
+ cli: 'integration check --strict --json',
61
+ },
62
+ {
63
+ label:
64
+ 'Before you publish: check that the packed package works in an app',
65
+ cli: 'integration verify',
66
+ },
67
+ ],
68
+ exitCodes: [
69
+ {
70
+ code: 0,
71
+ when: 'no check fails on its own; with --strict, also no warning, and every check ran',
72
+ },
73
+ {
74
+ code: 1,
75
+ when: 'a check fails on its own (an error); with --strict, also any warning, or a check that did not run',
76
+ },
77
+ ],
78
+ related: [
79
+ 'integration verify',
80
+ 'doctor integration validate',
81
+ 'doctor integration components',
82
+ 'doctor integration templates',
83
+ 'doctor integration docs',
84
+ ],
85
+ };