@astryxdesign/cli 0.7.2-canary.020e1fe → 0.7.2-canary.081ccea
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.
- package/README.md +62 -62
- package/api/component/_adapter.d.mts +31 -0
- package/api/component/_adapter.mjs +116 -0
- package/api/component/component.mjs +60 -10
- package/api/component/doc-links.test.mjs +386 -0
- package/api/discover/_adapter.d.mts +119 -12
- package/api/discover/_adapter.mjs +449 -10
- package/api/discover/_adapter.test.mjs +599 -17
- package/api/discover/_catalog-view.d.mts +16 -5
- package/api/discover/_catalog-view.mjs +32 -8
- package/api/discover/detail/doc/doc.mjs +9 -1
- package/api/discover/discover.d.mts +11 -0
- package/api/discover/discover.doc.mjs +7 -6
- package/api/discover/discover.mjs +107 -19
- package/api/discover/discover.type.d.mts +18 -7
- package/api/discover/discover.type.mjs +15 -7
- package/api/discover/list/list.d.mts +4 -3
- package/api/discover/list/list.mjs +17 -10
- package/api/docs/_adapter.d.mts +63 -0
- package/api/docs/_adapter.mjs +309 -16
- package/api/docs/integration-tree.test.mjs +22 -0
- package/api/docs/list/list.mjs +12 -2
- package/api/doctor/theme-checks.test.mjs +136 -0
- package/api/gap-report/gap-report.d.mts +3 -0
- package/api/gap-report/gap-report.doc.mjs +11 -3
- package/api/gap-report/gap-report.mjs +152 -48
- package/api/gap-report/gap-report.test.mjs +233 -0
- package/api/gap-report/gap-report.type.d.mts +41 -0
- package/api/gap-report/gap-report.type.mjs +18 -0
- package/api/integration/_adapter.d.mts +33 -0
- package/api/integration/_adapter.mjs +58 -0
- package/api/integration/authoring-checks.mjs +98 -3
- package/api/integration/authoring-checks.test.mjs +769 -0
- package/api/integration/authoring-checks.type.d.mts +134 -0
- package/api/integration/authoring-checks.type.mjs +60 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +3 -1
- package/api/integration/integrationDocConflicts.doc.mjs +22 -5
- package/api/integration/pack-check.mjs +296 -7
- package/api/integration/pack-check.test.mjs +367 -0
- package/api/integration/validate-integration-fixes.test.mjs +67 -0
- package/api/integration/validate-integration.mjs +28 -3
- package/api/integration/validate-integration.test.mjs +77 -8
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/search.mjs +2 -1
- package/api/upgrade/_adapter.d.mts +40 -2
- package/api/upgrade/_adapter.mjs +117 -4
- package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
- package/api/upgrade/run/run.mjs +30 -1
- package/api/upgrade/status/status.d.mts +21 -5
- package/api/upgrade/status/status.mjs +45 -8
- package/api/upgrade/upgrade.doc.mjs +5 -3
- package/api/upgrade/upgrade.type.d.mts +23 -0
- package/api/upgrade/upgrade.type.mjs +16 -1
- package/assets/codemods/runner.mjs +7 -1
- package/assets/discover/official-packages.json +367 -0
- package/assets/docs/author-a-theme.doc.mjs +2 -2
- package/assets/docs/browser-support.doc.mjs +1 -1
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +3 -3
- package/assets/docs/tree/check-the-props.doc.mjs +7 -2
- package/assets/docs/tree/check-your-docs.doc.mjs +15 -3
- package/assets/docs/tree/checks.doc.mjs +5 -5
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -5
- package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
- package/assets/docs/tree/layout.doc.mjs +6 -6
- package/assets/docs/tree/migration-setup.doc.mjs +2 -2
- package/assets/docs/tree/publishing.doc.mjs +3 -3
- package/assets/docs/tree/quick-start.doc.mjs +2 -2
- package/assets/docs/tree/sections-and-placement.doc.mjs +2 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +5 -5
- package/assets/docs/tree/upgrading.doc.mjs +1 -1
- package/authoring/discover/discover.doc.mjs +1 -1
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -0
- package/authoring/doctypes/hook/type.ts +4 -0
- package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/discover.mjs +144 -93
- package/clients/cli/commands/discover.no-source.test.mjs +447 -33
- package/clients/cli/commands/discover.sources.test.mjs +20 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +3 -2
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +19 -5
- package/clients/cli/commands/doctor-integration.test.mjs +48 -1
- package/clients/cli/commands/doctor.mjs +91 -5
- package/clients/cli/commands/gap-report.doc.mjs +14 -2
- package/clients/cli/commands/gap-report.mjs +24 -2
- package/clients/cli/commands/gap-report.test.mjs +79 -0
- package/clients/cli/commands/integration-authoring.test.mjs +46 -0
- package/clients/cli/commands/integration-check.test.mjs +144 -0
- package/clients/cli/commands/integration.mjs +12 -7
- package/clients/cli/commands/json-contract.test.mjs +5 -1
- package/clients/cli/commands/upgrade.doc.mjs +14 -0
- package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
- package/foundation/discovery/copied-passages.d.mts +216 -0
- package/foundation/discovery/copied-passages.mjs +720 -0
- package/foundation/discovery/copied-passages.test.mjs +124 -0
- package/foundation/discovery/doc-consistency.d.mts +34 -0
- package/foundation/discovery/doc-consistency.mjs +513 -0
- package/foundation/discovery/doc-consistency.test.mjs +347 -0
- package/foundation/discovery/doc-fluff.d.mts +112 -0
- package/foundation/discovery/doc-fluff.mjs +328 -0
- package/foundation/discovery/doc-fluff.test.mjs +142 -0
- package/foundation/discovery/doc-types.mjs +12 -5
- package/foundation/discovery/doc-types.test.mjs +46 -2
- package/foundation/discovery/docs-discovery.d.mts +7 -0
- package/foundation/discovery/docs-discovery.mjs +26 -2
- package/foundation/discovery/prop-drift.d.mts +25 -6
- package/foundation/discovery/prop-drift.mjs +171 -6
- package/foundation/discovery/prop-drift.test.mjs +65 -0
- package/foundation/discovery/stray-pointers.d.mts +52 -0
- package/foundation/discovery/stray-pointers.mjs +293 -0
- package/foundation/discovery/stray-pointers.test.mjs +86 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +16 -0
- package/foundation/doc-compiler/links.d.mts +32 -0
- package/foundation/doc-compiler/links.mjs +163 -26
- package/foundation/doc-compiler/links.test.mjs +97 -4
- package/foundation/doc-compiler/tree.mjs +30 -1
- package/foundation/doc-compiler/tree.test.mjs +7 -0
- package/foundation/env/package-manager.d.mts +32 -0
- package/foundation/env/package-manager.mjs +47 -0
- package/foundation/env/package-manager.test.mjs +194 -7
- package/foundation/fs/module-loader.d.mts +2 -1
- package/foundation/fs/module-loader.mjs +60 -4
- package/foundation/fs/module-loader.test.mjs +194 -0
- package/foundation/integrations/contribution-inventory.d.mts +11 -0
- package/foundation/integrations/contribution-inventory.mjs +50 -2
- package/foundation/integrations/issue.ts +6 -0
- package/foundation/integrations/validate-contributions.mjs +30 -1
- package/foundation/response/response-types.doc.mjs +10 -9
- package/package.json +11 -11
|
@@ -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,36 @@
|
|
|
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
|
+
/**
|
|
23
|
+
* Padding phrases and low-density topics in a package's prose
|
|
24
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, and Core's
|
|
25
|
+
* guides for the density median a finding names.
|
|
26
|
+
*
|
|
27
|
+
* @param {Parameters<typeof findFluff>[0]} discovered the package's docs, as
|
|
28
|
+
* discoverIntegrationDocs returns them
|
|
29
|
+
*/
|
|
30
|
+
export function integrationFluff(discovered: Parameters<typeof findFluff>[0]): Promise<import("./authoring-checks.type.mjs").DocFluff[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Code spans in a package's prose that write `astryx docs <name>` for a doc
|
|
33
|
+
* that exists, where `{@link generic:<name>}` would be checked
|
|
34
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, its own
|
|
35
|
+
* component docs, and the names of Core's docs.
|
|
36
|
+
*
|
|
37
|
+
* @param {Parameters<typeof findStrayPointers>[0]} discovered the package's
|
|
38
|
+
* docs, as discoverIntegrationDocs returns them
|
|
39
|
+
* @param {any} [integration] the loaded integration, whose component docs are
|
|
40
|
+
* read too
|
|
41
|
+
*/
|
|
42
|
+
export function integrationStrayPointers(discovered: Parameters<typeof findStrayPointers>[0], integration?: any): Promise<import("./authoring-checks.type.mjs").StrayPointer[]>;
|
|
43
|
+
import { findCopiedPassages } from '../../foundation/discovery/copied-passages.mjs';
|
|
44
|
+
import { findFluff } from '../../foundation/discovery/doc-fluff.mjs';
|
|
45
|
+
import { findStrayPointers } from '../../foundation/discovery/stray-pointers.mjs';
|
|
@@ -15,6 +15,9 @@ 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';
|
|
19
|
+
import {findFluff} from '../../foundation/discovery/doc-fluff.mjs';
|
|
20
|
+
import {findStrayPointers} from '../../foundation/discovery/stray-pointers.mjs';
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Each component doc's props compared with the component's TypeScript props,
|
|
@@ -52,3 +55,58 @@ export async function integrationPropDrift(integration, cwd) {
|
|
|
52
55
|
resolveFrom: [cwd, packageDir],
|
|
53
56
|
});
|
|
54
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The passages two of a package's topics, or one of them and a Core topic,
|
|
61
|
+
* repeat word for word (architecture:cli-surface DEC-8). Reads the package's
|
|
62
|
+
* topics and Core's guides.
|
|
63
|
+
*
|
|
64
|
+
* @param {Parameters<typeof findCopiedPassages>[0]} discovered the package's
|
|
65
|
+
* docs, as discoverIntegrationDocs returns them
|
|
66
|
+
*/
|
|
67
|
+
export function integrationCopiedPassages(discovered) {
|
|
68
|
+
return findCopiedPassages(discovered);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Padding phrases and low-density topics in a package's prose
|
|
73
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, and Core's
|
|
74
|
+
* guides for the density median a finding names.
|
|
75
|
+
*
|
|
76
|
+
* @param {Parameters<typeof findFluff>[0]} discovered the package's docs, as
|
|
77
|
+
* discoverIntegrationDocs returns them
|
|
78
|
+
*/
|
|
79
|
+
export function integrationFluff(discovered) {
|
|
80
|
+
return findFluff(discovered);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Code spans in a package's prose that write `astryx docs <name>` for a doc
|
|
85
|
+
* that exists, where `{@link generic:<name>}` would be checked
|
|
86
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, its own
|
|
87
|
+
* component docs, and the names of Core's docs.
|
|
88
|
+
*
|
|
89
|
+
* @param {Parameters<typeof findStrayPointers>[0]} discovered the package's
|
|
90
|
+
* docs, as discoverIntegrationDocs returns them
|
|
91
|
+
* @param {any} [integration] the loaded integration, whose component docs are
|
|
92
|
+
* read too
|
|
93
|
+
*/
|
|
94
|
+
export async function integrationStrayPointers(discovered, integration) {
|
|
95
|
+
/** @type {{name: string, file: string}[]} */
|
|
96
|
+
const components = [];
|
|
97
|
+
if (integration?.components) {
|
|
98
|
+
const seen = new Set();
|
|
99
|
+
try {
|
|
100
|
+
const {components: records} =
|
|
101
|
+
await discoverValidIntegrationComponents(integration);
|
|
102
|
+
for (const record of records) {
|
|
103
|
+
if (!record.docPath || seen.has(record.docPath)) continue;
|
|
104
|
+
seen.add(record.docPath);
|
|
105
|
+
components.push({name: record.name, file: record.docPath});
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
// `validate` reports component docs that do not load.
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return findStrayPointers({...discovered, components});
|
|
112
|
+
}
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
* @position Public integration-authoring API over private discovery adapters.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
import path from 'node:path';
|
|
21
22
|
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
22
23
|
import {
|
|
24
|
+
packageComponentLinkProblems,
|
|
23
25
|
packageDocsProblems,
|
|
24
26
|
packageReferenceProblems,
|
|
25
27
|
} from '../docs/_adapter.mjs';
|
|
@@ -29,7 +31,12 @@ import {
|
|
|
29
31
|
discoverOwnedComponents,
|
|
30
32
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
31
33
|
import {loadComponentReplacements} from '../component/_adapter.mjs';
|
|
32
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
integrationCopiedPassages,
|
|
36
|
+
integrationFluff,
|
|
37
|
+
integrationPropDrift,
|
|
38
|
+
integrationStrayPointers,
|
|
39
|
+
} from './_adapter.mjs';
|
|
33
40
|
import {
|
|
34
41
|
discoverBuiltinTopics,
|
|
35
42
|
discoverIntegrationDocs,
|
|
@@ -251,6 +258,19 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
251
258
|
// the project's own compiler; without one the report says it was skipped.
|
|
252
259
|
const propDrift = await integrationPropDrift(resolved.integration, cwd);
|
|
253
260
|
|
|
261
|
+
// A link in a component doc's text reads as the command that opens its doc,
|
|
262
|
+
// as one in a topic does; one that names no doc prints as written, so it is
|
|
263
|
+
// a warning (spec:AST-047 FR9). The package's own topics are linkable.
|
|
264
|
+
const ownDocs = resolved.integration.docs
|
|
265
|
+
? await discoverIntegrationDocs(resolved.integration)
|
|
266
|
+
: null;
|
|
267
|
+
for (const {severity, message} of await packageComponentLinkProblems(
|
|
268
|
+
resolved.integration,
|
|
269
|
+
ownDocs,
|
|
270
|
+
)) {
|
|
271
|
+
issues.push({code: 'invalid_doc_graph', severity, message});
|
|
272
|
+
}
|
|
273
|
+
|
|
254
274
|
const coreDir = findCoreDir(cwd);
|
|
255
275
|
if (!coreDir) {
|
|
256
276
|
issues.push({
|
|
@@ -323,10 +343,47 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
323
343
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
324
344
|
const issues = [...resolved.issues];
|
|
325
345
|
|
|
346
|
+
/** @type {import('./authoring-checks.type.mjs').CopiedPassage[]} */
|
|
347
|
+
const copiedPassages = [];
|
|
348
|
+
/** @type {import('./authoring-checks.type.mjs').DocFluff[]} */
|
|
349
|
+
const fluff = [];
|
|
350
|
+
/** @type {import('./authoring-checks.type.mjs').StrayPointer[]} */
|
|
351
|
+
const strayPointers = [];
|
|
352
|
+
// Like the other findings' `doc`, a fluff or stray-pointer `file` is
|
|
353
|
+
// relative to the package root.
|
|
354
|
+
const packageDir = /** @type {any} */ (resolved.integration)?.__packageDir;
|
|
355
|
+
const fromPackage = (/** @type {string} */ file) =>
|
|
356
|
+
typeof packageDir === 'string'
|
|
357
|
+
? path.relative(packageDir, file).split(path.sep).join('/')
|
|
358
|
+
: file;
|
|
326
359
|
if (!resolved.integration?.docs || name == null) {
|
|
360
|
+
// A package that ships components and no topics still has component docs
|
|
361
|
+
// a written pointer can sit in.
|
|
362
|
+
if (name != null && resolved.integration?.components) {
|
|
363
|
+
strayPointers.push(
|
|
364
|
+
...(
|
|
365
|
+
await integrationStrayPointers(
|
|
366
|
+
{records: [], guides: []},
|
|
367
|
+
resolved.integration,
|
|
368
|
+
)
|
|
369
|
+
).map(each => ({...each, file: fromPackage(each.file)})),
|
|
370
|
+
);
|
|
371
|
+
for (const {message} of strayPointers) {
|
|
372
|
+
issues.push({code: 'stray_doc_pointer', severity: 'warning', message});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
327
375
|
return {
|
|
328
376
|
type: 'integration.doc-conflicts',
|
|
329
|
-
data: {
|
|
377
|
+
data: {
|
|
378
|
+
validated,
|
|
379
|
+
name,
|
|
380
|
+
version,
|
|
381
|
+
findings: [],
|
|
382
|
+
copiedPassages,
|
|
383
|
+
fluff,
|
|
384
|
+
strayPointers,
|
|
385
|
+
issues,
|
|
386
|
+
},
|
|
330
387
|
};
|
|
331
388
|
}
|
|
332
389
|
|
|
@@ -416,10 +473,48 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
416
473
|
)) {
|
|
417
474
|
issues.push({code: 'invalid_doc_reference', severity: 'error', message});
|
|
418
475
|
}
|
|
476
|
+
|
|
477
|
+
// One fact has one owner: a passage two topics repeat goes stale in one
|
|
478
|
+
// of them. Each is listed and is a warning (architecture:cli-surface
|
|
479
|
+
// DEC-8), so `integration check --strict` fails until it is fixed;
|
|
480
|
+
// `doctor integration docs` keeps its exit code, as it fails on errors.
|
|
481
|
+
copiedPassages.push(...(await integrationCopiedPassages(discovered)));
|
|
482
|
+
for (const {message} of copiedPassages) {
|
|
483
|
+
issues.push({code: 'copied_passage', severity: 'warning', message});
|
|
484
|
+
}
|
|
485
|
+
// Docs should be dense: padding phrases and mostly-glue topics, listed
|
|
486
|
+
// and warned about the same way (DEC-8).
|
|
487
|
+
fluff.push(
|
|
488
|
+
...(await integrationFluff(discovered)).map(each => ({
|
|
489
|
+
...each,
|
|
490
|
+
file: fromPackage(each.file),
|
|
491
|
+
})),
|
|
492
|
+
);
|
|
493
|
+
for (const {message} of fluff) {
|
|
494
|
+
issues.push({code: 'doc_fluff', severity: 'warning', message});
|
|
495
|
+
}
|
|
496
|
+
// A pointer to a doc is a link, so doctor checks it (DEC-8).
|
|
497
|
+
strayPointers.push(
|
|
498
|
+
...(await integrationStrayPointers(discovered, resolved.integration)).map(
|
|
499
|
+
each => ({...each, file: fromPackage(each.file)}),
|
|
500
|
+
),
|
|
501
|
+
);
|
|
502
|
+
for (const {message} of strayPointers) {
|
|
503
|
+
issues.push({code: 'stray_doc_pointer', severity: 'warning', message});
|
|
504
|
+
}
|
|
419
505
|
}
|
|
420
506
|
|
|
421
507
|
return {
|
|
422
508
|
type: 'integration.doc-conflicts',
|
|
423
|
-
data: {
|
|
509
|
+
data: {
|
|
510
|
+
validated,
|
|
511
|
+
name,
|
|
512
|
+
version,
|
|
513
|
+
findings,
|
|
514
|
+
copiedPassages,
|
|
515
|
+
fluff,
|
|
516
|
+
strayPointers,
|
|
517
|
+
issues,
|
|
518
|
+
},
|
|
424
519
|
};
|
|
425
520
|
}
|