@astryxdesign/cli 0.7.2-canary.621784f → 0.7.2-canary.64e1dde

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 (186) hide show
  1. package/README.md +12 -12
  2. package/api/discover/_adapter.d.mts +119 -12
  3. package/api/discover/_adapter.mjs +449 -10
  4. package/api/discover/_adapter.test.mjs +599 -17
  5. package/api/discover/_catalog-view.d.mts +16 -5
  6. package/api/discover/_catalog-view.mjs +32 -8
  7. package/api/discover/discover.d.mts +11 -0
  8. package/api/discover/discover.doc.mjs +7 -6
  9. package/api/discover/discover.mjs +107 -19
  10. package/api/discover/discover.type.d.mts +18 -7
  11. package/api/discover/discover.type.mjs +15 -7
  12. package/api/discover/list/list.d.mts +4 -3
  13. package/api/discover/list/list.mjs +17 -10
  14. package/api/doctor/doctor.mjs +27 -3
  15. package/api/doctor/doctor.test.mjs +43 -0
  16. package/api/doctor/theme-checks.test.mjs +136 -0
  17. package/api/gap-report/gap-report.d.mts +3 -0
  18. package/api/gap-report/gap-report.doc.mjs +11 -3
  19. package/api/gap-report/gap-report.mjs +152 -48
  20. package/api/gap-report/gap-report.test.mjs +233 -0
  21. package/api/gap-report/gap-report.type.d.mts +41 -0
  22. package/api/gap-report/gap-report.type.mjs +18 -0
  23. package/api/integration/_adapter.d.mts +10 -0
  24. package/api/integration/_adapter.mjs +13 -0
  25. package/api/integration/authoring-checks.mjs +14 -3
  26. package/api/integration/authoring-checks.test.mjs +326 -0
  27. package/api/integration/authoring-checks.type.d.mts +50 -0
  28. package/api/integration/authoring-checks.type.mjs +21 -1
  29. package/api/integration/integrationComponentConflicts.doc.mjs +9 -3
  30. package/api/integration/integrationDocConflicts.doc.mjs +17 -5
  31. package/api/integration/pack-check.mjs +292 -7
  32. package/api/integration/pack-check.test.mjs +341 -0
  33. package/api/integration/validateIntegration.doc.mjs +3 -1
  34. package/api/search/search.d.mts +72 -12
  35. package/api/search/search.domain-priority.test.mjs +108 -18
  36. package/api/search/search.mjs +501 -37
  37. package/api/search/search.test.mjs +139 -0
  38. package/api/theme/build/build.family.test.mjs +54 -6
  39. package/api/theme/build/build.mjs +110 -13
  40. package/api/theme/themeBuild.doc.mjs +4 -4
  41. package/api/upgrade/_adapter.d.mts +40 -2
  42. package/api/upgrade/_adapter.mjs +117 -4
  43. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  44. package/api/upgrade/run/run.mjs +30 -1
  45. package/api/upgrade/status/status.d.mts +21 -5
  46. package/api/upgrade/status/status.mjs +45 -8
  47. package/api/upgrade/upgrade.doc.mjs +5 -3
  48. package/api/upgrade/upgrade.type.d.mts +23 -0
  49. package/api/upgrade/upgrade.type.mjs +16 -1
  50. package/assets/codemods/runner.mjs +7 -1
  51. package/assets/discover/official-packages.json +367 -0
  52. package/assets/docs/author-a-theme.doc.mjs +2 -2
  53. package/assets/docs/styling-overview.doc.mjs +1 -1
  54. package/assets/docs/theme.doc.mjs +1 -1
  55. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  56. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  57. package/assets/docs/tree/add-a-topic.doc.mjs +11 -8
  58. package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
  59. package/assets/docs/tree/block-template.doc.mjs +6 -18
  60. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  61. package/assets/docs/tree/check-the-props.doc.mjs +2 -2
  62. package/assets/docs/tree/check-your-docs.doc.mjs +16 -7
  63. package/assets/docs/tree/checks.doc.mjs +7 -7
  64. package/assets/docs/tree/codemods.doc.mjs +4 -4
  65. package/assets/docs/tree/component-family.doc.mjs +3 -5
  66. package/assets/docs/tree/component-imports.doc.mjs +2 -2
  67. package/assets/docs/tree/components.doc.mjs +1 -1
  68. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -16
  69. package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
  70. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  71. package/assets/docs/tree/docs.doc.mjs +3 -3
  72. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  73. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  74. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  75. package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
  76. package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
  77. package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
  78. package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
  79. package/assets/docs/tree/integrations.doc.mjs +8 -0
  80. package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
  81. package/assets/docs/tree/layout.doc.mjs +6 -6
  82. package/assets/docs/tree/links.doc.mjs +5 -4
  83. package/assets/docs/tree/migration-setup.doc.mjs +3 -2
  84. package/assets/docs/tree/migration-verification.doc.mjs +0 -1
  85. package/assets/docs/tree/migration.doc.mjs +0 -1
  86. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  87. package/assets/docs/tree/page-template.doc.mjs +3 -7
  88. package/assets/docs/tree/publishing.doc.mjs +2 -2
  89. package/assets/docs/tree/quick-start.doc.mjs +37 -21
  90. package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
  91. package/assets/docs/tree/replace-a-core-template.doc.mjs +5 -7
  92. package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
  93. package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
  94. package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
  95. package/assets/docs/tree/single-component.doc.mjs +12 -4
  96. package/assets/docs/tree/start-a-template.doc.mjs +3 -3
  97. package/assets/docs/tree/subcomponent.doc.mjs +6 -6
  98. package/assets/docs/tree/template-assets.doc.mjs +2 -2
  99. package/assets/docs/tree/template-doc-overview.doc.mjs +5 -16
  100. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  101. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  102. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  103. package/assets/docs/tree/template-styles.doc.mjs +2 -2
  104. package/assets/docs/tree/templates.doc.mjs +1 -1
  105. package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
  106. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  107. package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
  108. package/assets/docs/tree/troubleshooting.doc.mjs +8 -8
  109. package/assets/docs/tree/upgrading.doc.mjs +4 -4
  110. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
  111. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  112. package/assets/docs/tree/versioning.doc.mjs +6 -6
  113. package/assets/docs/tree/write-the-template-file.doc.mjs +2 -2
  114. package/authoring/codemod/codemod.doc.mjs +7 -3
  115. package/authoring/config/config.doc.mjs +9 -6
  116. package/authoring/config/type.ts +4 -2
  117. package/authoring/discover/discover.doc.mjs +1 -1
  118. package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
  119. package/authoring/doctypes/command/command.doc.mjs +14 -12
  120. package/authoring/doctypes/component/component.doc.mjs +29 -26
  121. package/authoring/doctypes/component/type.ts +7 -5
  122. package/authoring/doctypes/enum/enum.doc.mjs +7 -4
  123. package/authoring/doctypes/function/function.doc.mjs +9 -8
  124. package/authoring/doctypes/hook/hook.doc.mjs +5 -4
  125. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
  126. package/authoring/doctypes/reference/reference.doc.mjs +11 -10
  127. package/authoring/doctypes/schema/schema.doc.mjs +9 -9
  128. package/authoring/doctypes/template/template.doc.mjs +2 -2
  129. package/authoring/doctypes/theme/theme.doc.mjs +2 -2
  130. package/authoring/gap-report/gap-report.doc.mjs +2 -2
  131. package/authoring/identity/identity.doc.mjs +3 -3
  132. package/authoring/integration/integration.doc.mjs +4 -3
  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/discover.broken-integration.test.mjs +4 -1
  136. package/clients/cli/commands/discover.doc.mjs +1 -1
  137. package/clients/cli/commands/discover.mjs +144 -93
  138. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  139. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  140. package/clients/cli/commands/doctor-integration-components.doc.mjs +3 -1
  141. package/clients/cli/commands/doctor-integration-docs.doc.mjs +17 -5
  142. package/clients/cli/commands/doctor-integration-validate.doc.mjs +3 -1
  143. package/clients/cli/commands/doctor.mjs +34 -3
  144. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  145. package/clients/cli/commands/gap-report.mjs +24 -2
  146. package/clients/cli/commands/gap-report.test.mjs +79 -0
  147. package/clients/cli/commands/integration-check.test.mjs +65 -0
  148. package/clients/cli/commands/integration.mjs +2 -3
  149. package/clients/cli/commands/json-contract.test.mjs +5 -1
  150. package/clients/cli/commands/setup-nudge.test.mjs +79 -1
  151. package/clients/cli/commands/swizzle.mjs +5 -3
  152. package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
  153. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  154. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  155. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  156. package/clients/cli/index.mjs +29 -5
  157. package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
  158. package/foundation/agent-docs/agent-doc-state.mjs +38 -0
  159. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  160. package/foundation/agent-docs/agent-docs.mjs +8 -6
  161. package/foundation/discovery/authoring-self-docs.mjs +1 -1
  162. package/foundation/discovery/copied-passages.d.mts +208 -0
  163. package/foundation/discovery/copied-passages.mjs +720 -0
  164. package/foundation/discovery/copied-passages.test.mjs +124 -0
  165. package/foundation/discovery/doc-types.d.mts +1 -1
  166. package/foundation/discovery/doc-types.mjs +3 -3
  167. package/foundation/discovery/doc-types.test.mjs +48 -0
  168. package/foundation/discovery/docs-discovery.d.mts +7 -0
  169. package/foundation/discovery/docs-discovery.mjs +26 -2
  170. package/foundation/discovery/project-typescript.d.mts +11 -2
  171. package/foundation/discovery/project-typescript.mjs +32 -4
  172. package/foundation/discovery/prop-drift.d.mts +1 -1
  173. package/foundation/discovery/prop-drift.mjs +2 -2
  174. package/foundation/discovery/prop-drift.test.mjs +55 -2
  175. package/foundation/discovery/type-text.mjs +1 -1
  176. package/foundation/discovery/type-text.test.mjs +1 -1
  177. package/foundation/doc-compiler/doc-loads.test.mjs +10 -2
  178. package/foundation/env/package-manager.d.mts +32 -0
  179. package/foundation/env/package-manager.mjs +47 -0
  180. package/foundation/env/package-manager.test.mjs +194 -7
  181. package/foundation/fs/module-loader.d.mts +2 -1
  182. package/foundation/fs/module-loader.mjs +60 -4
  183. package/foundation/fs/module-loader.test.mjs +194 -0
  184. package/foundation/response/response-types.doc.mjs +7 -6
  185. package/package.json +11 -11
  186. package/scripts/postinstall.mjs +3 -3
@@ -7,6 +7,7 @@ import * as path from 'node:path';
7
7
  import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
8
8
  import {Project} from '../../foundation/config/project.mjs';
9
9
  import {
10
+ ASK_DESTINATION_MESSAGE,
10
11
  GAP_REPORT_CATEGORIES,
11
12
  PUBLIC_CONFIRMATION_MESSAGE,
12
13
  collectGapReportHandlers,
@@ -1022,6 +1023,238 @@ console.log('https://github.com/acme/widgets/issues/42');
1022
1023
  });
1023
1024
  });
1024
1025
 
1026
+ describe('gapReport destinations and --to', () => {
1027
+ /** A shared internal handler that records each call in a marker file. */
1028
+ function addSharedHandler() {
1029
+ const marker = path.join(projectDir, 'shared-called');
1030
+ addIntegration({
1031
+ name: '@test/shared',
1032
+ audience: 'internal',
1033
+ handleBody: `(await import('node:fs')).writeFileSync(${JSON.stringify(marker)}, 'x'); return {status: 'filed', message: 'shared'};`,
1034
+ });
1035
+ return marker;
1036
+ }
1037
+
1038
+ function addWidgets(issuesUrl = 'https://github.com/acme/widgets/issues') {
1039
+ addIntegration({name: '@test/widgets', handler: false, issuesUrl});
1040
+ }
1041
+
1042
+ it('keeps the default route and lists the destinations with the ask line', async () => {
1043
+ const marker = addSharedHandler();
1044
+ addWidgets();
1045
+ configure(['@test/shared', '@test/widgets']);
1046
+ const argsFile = stubGh();
1047
+
1048
+ const result = await gapReport('General', {
1049
+ ...reportOptions,
1050
+ confirmPublic: true,
1051
+ cwd: projectDir,
1052
+ });
1053
+
1054
+ expect(result.data.deliveries).toEqual([
1055
+ expect.objectContaining({handler: '@test/shared', status: 'filed'}),
1056
+ ]);
1057
+ expect(fs.existsSync(marker)).toBe(true);
1058
+ expect(fs.existsSync(argsFile)).toBe(false);
1059
+ expect(result.data.destinations).toEqual([
1060
+ {to: null, default: true, issuesUrl: null},
1061
+ {
1062
+ to: '@test/widgets',
1063
+ default: false,
1064
+ issuesUrl: 'https://github.com/acme/widgets/issues',
1065
+ },
1066
+ ]);
1067
+ expect(result.data.ask).toBe(ASK_DESTINATION_MESSAGE);
1068
+ expect(ASK_DESTINATION_MESSAGE).toMatch(/ask the person/i);
1069
+ });
1070
+
1071
+ it('lists no destinations when no integration names an issuesUrl', async () => {
1072
+ addSharedHandler();
1073
+ configure(['@test/shared']);
1074
+
1075
+ const result = await gapReport('General', {
1076
+ ...reportOptions,
1077
+ cwd: projectDir,
1078
+ });
1079
+
1080
+ expect(result.data).not.toHaveProperty('destinations');
1081
+ expect(result.data).not.toHaveProperty('ask');
1082
+ });
1083
+
1084
+ it('files with the chosen integration GitHub issuesUrl only with consent, and runs no handler', async () => {
1085
+ const marker = addSharedHandler();
1086
+ addWidgets();
1087
+ configure(['@test/shared', '@test/widgets']);
1088
+ const argsFile = stubGh();
1089
+
1090
+ const pending = await gapReport('General', {
1091
+ ...reportOptions,
1092
+ to: '@test/widgets',
1093
+ cwd: projectDir,
1094
+ });
1095
+ expect(pending.data.deliveries).toEqual([
1096
+ {
1097
+ handlerType: 'fallback',
1098
+ handler: 'github',
1099
+ audience: 'public',
1100
+ status: 'consent_required',
1101
+ url: null,
1102
+ message: PUBLIC_CONFIRMATION_MESSAGE,
1103
+ },
1104
+ ]);
1105
+ expect(pending.data.issuesUrl).toBe(
1106
+ 'https://github.com/acme/widgets/issues',
1107
+ );
1108
+ expect(pending.data).not.toHaveProperty('destinations');
1109
+ expect(fs.existsSync(argsFile)).toBe(false);
1110
+
1111
+ const filed = await gapReport('General', {
1112
+ ...reportOptions,
1113
+ to: '@test/widgets',
1114
+ confirmPublic: true,
1115
+ cwd: projectDir,
1116
+ });
1117
+ expect(filed.data.deliveries).toHaveLength(1);
1118
+ expect(filed.data.deliveries[0]).toMatchObject({
1119
+ handlerType: 'fallback',
1120
+ handler: 'github',
1121
+ status: 'filed',
1122
+ });
1123
+ const args = JSON.parse(fs.readFileSync(argsFile, 'utf8'));
1124
+ expect(args.slice(0, 4)).toEqual([
1125
+ 'issue',
1126
+ 'create',
1127
+ '--repo',
1128
+ 'acme/widgets',
1129
+ ]);
1130
+ expect(fs.existsSync(marker)).toBe(false);
1131
+ });
1132
+
1133
+ it('routes a chosen non-GitHub issuesUrl as routed_only', async () => {
1134
+ addSharedHandler();
1135
+ addWidgets('https://tracker.example/widgets');
1136
+ configure(['@test/shared', '@test/widgets']);
1137
+
1138
+ const result = await gapReport('General', {
1139
+ ...reportOptions,
1140
+ to: '@test/widgets',
1141
+ cwd: projectDir,
1142
+ });
1143
+
1144
+ expect(result.data.deliveries).toEqual([
1145
+ expect.objectContaining({
1146
+ handlerType: 'fallback',
1147
+ handler: 'issuesUrl',
1148
+ status: 'routed_only',
1149
+ url: 'https://tracker.example/widgets',
1150
+ }),
1151
+ ]);
1152
+ expect(result.data.status).toBe('routed_only');
1153
+ });
1154
+
1155
+ it.each([
1156
+ ['a package that is not loaded', '@test/nope'],
1157
+ ['a loaded integration without an issuesUrl', '@test/shared'],
1158
+ ])(
1159
+ 'refuses --to naming %s, lists the choices, and sends nothing',
1160
+ async (_label, to) => {
1161
+ const marker = addSharedHandler();
1162
+ addWidgets();
1163
+ configure(['@test/shared', '@test/widgets']);
1164
+
1165
+ await expect(
1166
+ gapReport('General', {...reportOptions, to, cwd: projectDir}),
1167
+ ).rejects.toMatchObject({
1168
+ code: 'ERR_UNKNOWN_PACKAGE',
1169
+ suggestions: [
1170
+ {
1171
+ name: '@test/widgets',
1172
+ reason: 'https://github.com/acme/widgets/issues',
1173
+ },
1174
+ ],
1175
+ });
1176
+ expect(fs.existsSync(marker)).toBe(false);
1177
+ },
1178
+ );
1179
+
1180
+ it.each([
1181
+ ['an empty value', ''],
1182
+ ['a blank value', ' '],
1183
+ ['an over-long value', `@test/${'a'.repeat(300)}`],
1184
+ ])('refuses %s for --to with the destination list', async (_label, to) => {
1185
+ const marker = addSharedHandler();
1186
+ addWidgets();
1187
+ configure(['@test/shared', '@test/widgets']);
1188
+
1189
+ await expect(
1190
+ gapReport('General', {...reportOptions, to, cwd: projectDir}),
1191
+ ).rejects.toMatchObject({
1192
+ code: 'ERR_UNKNOWN_PACKAGE',
1193
+ suggestions: [{name: '@test/widgets'}],
1194
+ });
1195
+ expect(fs.existsSync(marker)).toBe(false);
1196
+ });
1197
+
1198
+ it('treats to: null as absent', async () => {
1199
+ const marker = addSharedHandler();
1200
+ addWidgets();
1201
+ configure(['@test/shared', '@test/widgets']);
1202
+
1203
+ const result = await gapReport('General', {
1204
+ ...reportOptions,
1205
+ to: /** @type {any} */ (null),
1206
+ cwd: projectDir,
1207
+ });
1208
+
1209
+ expect(result.data.deliveries).toHaveLength(1);
1210
+ expect(fs.existsSync(marker)).toBe(true);
1211
+ expect(result.data.destinations).toHaveLength(2);
1212
+ });
1213
+
1214
+ it('lists the destinations with the categories', async () => {
1215
+ addSharedHandler();
1216
+ addWidgets();
1217
+ configure(['@test/shared', '@test/widgets']);
1218
+
1219
+ const listed = await gapReport(undefined, {
1220
+ listCategories: true,
1221
+ cwd: projectDir,
1222
+ });
1223
+
1224
+ expect(listed.data).toEqual(GAP_REPORT_CATEGORIES);
1225
+ expect(listed.meta).toEqual({
1226
+ destinations: [
1227
+ {to: null, default: true, issuesUrl: null},
1228
+ {
1229
+ to: '@test/widgets',
1230
+ default: false,
1231
+ issuesUrl: 'https://github.com/acme/widgets/issues',
1232
+ },
1233
+ ],
1234
+ ask: ASK_DESTINATION_MESSAGE,
1235
+ });
1236
+ });
1237
+
1238
+ it('adds no meta to the categories when there is only the default', async () => {
1239
+ configure([]);
1240
+ const listed = await gapReport(undefined, {
1241
+ listCategories: true,
1242
+ cwd: projectDir,
1243
+ });
1244
+ expect(listed).not.toHaveProperty('meta');
1245
+ });
1246
+
1247
+ it('refuses --to with --list-categories', async () => {
1248
+ await expect(
1249
+ gapReport(undefined, {
1250
+ listCategories: true,
1251
+ to: '@test/widgets',
1252
+ cwd: projectDir,
1253
+ }),
1254
+ ).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
1255
+ });
1256
+ });
1257
+
1025
1258
  describe('gapReport target selection', () => {
1026
1259
  it('routes to the unique component owner', async () => {
1027
1260
  addIntegration({
@@ -35,10 +35,42 @@ export type GapReportOptions = {
35
35
  * Return the category vocabulary without routing or writing.
36
36
  */
37
37
  listCategories?: boolean | undefined;
38
+ /**
39
+ * A destination the person chose: a loaded integration
40
+ * whose manifest names an issues URL. The report goes only there.
41
+ */
42
+ to?: string | undefined;
43
+ };
44
+ /**
45
+ * Where a report can go. The default entry (`to: null`) is the configured
46
+ * handlers, or with none the owning package's issues URL.
47
+ */
48
+ export type GapReportDestination = {
49
+ /**
50
+ * The value to pass as `to`; null for the default.
51
+ */
52
+ to: string | null;
53
+ /**
54
+ * Whether this is the default destination.
55
+ */
56
+ default: boolean;
57
+ /**
58
+ * The integration's issues URL; null for the
59
+ * default.
60
+ */
61
+ issuesUrl: string | null;
38
62
  };
39
63
  export type GapReportCategoriesResponse = {
40
64
  type: "gap-report.categories";
41
65
  data: GapReportCategoryEntry[];
66
+ /**
67
+ * Present when a destination besides the default exists: every destination,
68
+ * and the line telling an agent to ask the person.
69
+ */
70
+ meta?: {
71
+ destinations: GapReportDestination[];
72
+ ask: string;
73
+ } | undefined;
42
74
  };
43
75
  export type GapReportAggregateStatus = "filed" | "partial" | "failed" | "routed_only" | "consent_required" | "skipped";
44
76
  export type GapReportDeliveryStatus = "filed" | "routed_only" | "skipped" | "failed" | "consent_required";
@@ -81,6 +113,15 @@ export type GapReportReceipt = {
81
113
  * Count of handlers that routed only.
82
114
  */
83
115
  routedOnlyCount: number;
116
+ /**
117
+ * For a run without `to`,
118
+ * when a destination besides the default exists: every destination.
119
+ */
120
+ destinations?: GapReportDestination[] | undefined;
121
+ /**
122
+ * With `destinations`: ask the person where to file.
123
+ */
124
+ ask?: string | undefined;
84
125
  };
85
126
  export type GapReportReceiptResponse = {
86
127
  type: "gap-report.file";
@@ -23,12 +23,27 @@
23
23
  * @property {string} [package] Explicit owner package for ambiguous routes.
24
24
  * @property {boolean} [confirmPublic] Explicit consent for public handlers or GitHub issue creation.
25
25
  * @property {boolean} [listCategories] Return the category vocabulary without routing or writing.
26
+ * @property {string} [to] A destination the person chose: a loaded integration
27
+ * whose manifest names an issues URL. The report goes only there.
28
+ */
29
+
30
+ /**
31
+ * Where a report can go. The default entry (`to: null`) is the configured
32
+ * handlers, or with none the owning package's issues URL.
33
+ * @typedef {object} GapReportDestination
34
+ * @property {string|null} to The value to pass as `to`; null for the default.
35
+ * @property {boolean} default Whether this is the default destination.
36
+ * @property {string|null} issuesUrl The integration's issues URL; null for the
37
+ * default.
26
38
  */
27
39
 
28
40
  /**
29
41
  * @typedef {object} GapReportCategoriesResponse
30
42
  * @property {'gap-report.categories'} type
31
43
  * @property {GapReportCategoryEntry[]} data
44
+ * @property {{destinations: GapReportDestination[], ask: string}} [meta]
45
+ * Present when a destination besides the default exists: every destination,
46
+ * and the line telling an agent to ask the person.
32
47
  */
33
48
 
34
49
  /**
@@ -58,6 +73,9 @@
58
73
  * @property {GapReportDelivery[]} deliveries Ordered handler outcomes.
59
74
  * @property {number} filedCount Count of handlers that filed the report.
60
75
  * @property {number} routedOnlyCount Count of handlers that routed only.
76
+ * @property {GapReportDestination[]} [destinations] For a run without `to`,
77
+ * when a destination besides the default exists: every destination.
78
+ * @property {string} [ask] With `destinations`: ask the person where to file.
61
79
  */
62
80
 
63
81
  /**
@@ -10,3 +10,13 @@
10
10
  * @returns {Promise<import('../../foundation/discovery/prop-drift.mjs').PropDriftReport>}
11
11
  */
12
12
  export function integrationPropDrift(integration: any, cwd: string): Promise<import("../../foundation/discovery/prop-drift.mjs").PropDriftReport>;
13
+ /**
14
+ * The passages two of a package's topics, or one of them and a Core topic,
15
+ * repeat word for word (architecture:cli-surface DEC-8). Reads the package's
16
+ * topics and Core's guides.
17
+ *
18
+ * @param {Parameters<typeof findCopiedPassages>[0]} discovered the package's
19
+ * docs, as discoverIntegrationDocs returns them
20
+ */
21
+ export function integrationCopiedPassages(discovered: Parameters<typeof findCopiedPassages>[0]): Promise<import("./authoring-checks.type.mjs").CopiedPassage[]>;
22
+ import { findCopiedPassages } from '../../foundation/discovery/copied-passages.mjs';
@@ -15,6 +15,7 @@ import {
15
15
  integrationSourceForDoc,
16
16
  } from '../../foundation/discovery/component-discovery.mjs';
17
17
  import {comparePropDocs} from '../../foundation/discovery/prop-drift.mjs';
18
+ import {findCopiedPassages} from '../../foundation/discovery/copied-passages.mjs';
18
19
 
19
20
  /**
20
21
  * Each component doc's props compared with the component's TypeScript props,
@@ -52,3 +53,15 @@ export async function integrationPropDrift(integration, cwd) {
52
53
  resolveFrom: [cwd, packageDir],
53
54
  });
54
55
  }
56
+
57
+ /**
58
+ * The passages two of a package's topics, or one of them and a Core topic,
59
+ * repeat word for word (architecture:cli-surface DEC-8). Reads the package's
60
+ * topics and Core's guides.
61
+ *
62
+ * @param {Parameters<typeof findCopiedPassages>[0]} discovered the package's
63
+ * docs, as discoverIntegrationDocs returns them
64
+ */
65
+ export function integrationCopiedPassages(discovered) {
66
+ return findCopiedPassages(discovered);
67
+ }
@@ -29,7 +29,7 @@ import {
29
29
  discoverOwnedComponents,
30
30
  } from '../../foundation/discovery/component-discovery.mjs';
31
31
  import {loadComponentReplacements} from '../component/_adapter.mjs';
32
- import {integrationPropDrift} from './_adapter.mjs';
32
+ import {integrationCopiedPassages, integrationPropDrift} from './_adapter.mjs';
33
33
  import {
34
34
  discoverBuiltinTopics,
35
35
  discoverIntegrationDocs,
@@ -323,10 +323,12 @@ export async function integrationDocConflicts(pkg, options = {}) {
323
323
  const version = resolved.found ? (resolved.version ?? null) : null;
324
324
  const issues = [...resolved.issues];
325
325
 
326
+ /** @type {import('./authoring-checks.type.mjs').CopiedPassage[]} */
327
+ const copiedPassages = [];
326
328
  if (!resolved.integration?.docs || name == null) {
327
329
  return {
328
330
  type: 'integration.doc-conflicts',
329
- data: {validated, name, version, findings: [], issues},
331
+ data: {validated, name, version, findings: [], copiedPassages, issues},
330
332
  };
331
333
  }
332
334
 
@@ -416,10 +418,19 @@ export async function integrationDocConflicts(pkg, options = {}) {
416
418
  )) {
417
419
  issues.push({code: 'invalid_doc_reference', severity: 'error', message});
418
420
  }
421
+
422
+ // One fact has one owner: a passage two topics repeat goes stale in one
423
+ // of them. Each is listed and is a warning (architecture:cli-surface
424
+ // DEC-8), so `integration check --strict` fails until it is fixed;
425
+ // `doctor integration docs` keeps its exit code, as it fails on errors.
426
+ copiedPassages.push(...(await integrationCopiedPassages(discovered)));
427
+ for (const {message} of copiedPassages) {
428
+ issues.push({code: 'copied_passage', severity: 'warning', message});
429
+ }
419
430
  }
420
431
 
421
432
  return {
422
433
  type: 'integration.doc-conflicts',
423
- data: {validated, name, version, findings, issues},
434
+ data: {validated, name, version, findings, copiedPassages, issues},
424
435
  };
425
436
  }