@astryxdesign/cli 0.7.4-canary.c9c991e → 0.7.4-canary.ccdb1b8
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 +63 -63
- package/api/docs/_adapter.d.mts +80 -0
- package/api/docs/_adapter.mjs +248 -5
- package/api/docs/detail/detail.mjs +8 -0
- package/api/docs/docs.doc.mjs +1 -1
- package/api/docs/docs.type.d.mts +28 -2
- package/api/docs/docs.type.mjs +13 -3
- package/api/docs/guide-route-targets.test.mjs +998 -0
- package/api/docs/index/index.mjs +9 -0
- package/api/docs/list/list.mjs +7 -1
- package/api/docs/node/node.mjs +9 -1
- package/api/docs/reference-blocks.test.mjs +1 -1
- package/api/doctor/built-checks.mjs +43 -13
- package/api/doctor/built-checks.test.mjs +29 -0
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/integration/_adapter.d.mts +8 -0
- package/api/integration/_adapter.mjs +25 -0
- package/api/integration/authoring-checks.mjs +29 -2
- package/api/integration/pack-check.mjs +32 -1
- package/api/integration/pack-check.test.mjs +33 -0
- package/api/integration/validate-integration.mjs +66 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_candidate-score.d.mts +3 -2
- package/api/search/_candidate-score.mjs +66 -3
- package/api/search/_gather-docs.mjs +12 -2
- package/api/search/_priority.mjs +2 -1
- package/api/search/_score.d.mts +2 -1
- package/api/search/_score.mjs +2 -2
- package/api/search/search.family-members.test.mjs +124 -0
- package/assets/discover/official-packages.json +16 -0
- package/assets/docs/browser-support.doc.mjs +1 -1
- package/assets/docs/theme.doc.mjs +2 -2
- package/assets/docs/tree/component-lookups.doc.mjs +2 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +36 -4
- package/assets/docs/tree/migration.doc.mjs +2 -1
- package/assets/docs/tree/styling-libraries.doc.mjs +2 -1
- package/assets/docs/tree/styling.doc.mjs +1 -1
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +54 -0
- package/assets/templates/themes/butter/butterPalettes.generated.receipt.json +1499 -0
- package/assets/templates/themes/butter/butterPalettes.generated.ts +550 -0
- package/assets/templates/themes/butter/butterTheme.ts +274 -234
- package/assets/templates/themes/butter/palette.config.json +484 -0
- package/assets/templates/themes/y2k/palette.config.json +166 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +54 -0
- package/assets/templates/themes/y2k/y2kPalettes.generated.receipt.json +872 -0
- package/assets/templates/themes/y2k/y2kPalettes.generated.ts +550 -0
- package/assets/templates/themes/y2k/y2kPalettes.ts +257 -0
- package/assets/templates/themes/y2k/y2kTheme.ts +164 -391
- package/authoring/doctypes/_schema.d.mts +4 -0
- package/authoring/doctypes/_schema.mjs +4 -0
- package/authoring/doctypes/reference/type.ts +14 -2
- package/clients/cli/commands/docs.mjs +27 -2
- package/clients/cli/commands/docs.test.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +14 -2
- package/foundation/agent-docs/agent-docs.mjs +54 -2
- package/foundation/agent-docs/agent-docs.test.mjs +61 -0
- package/foundation/discovery/docs-discovery.d.mts +93 -2
- package/foundation/discovery/docs-discovery.mjs +236 -8
- package/foundation/doc-compiler/compile.mjs +8 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +3 -0
- package/foundation/doc-compiler/tree.d.mts +5 -0
- package/foundation/doc-compiler/tree.mjs +3 -0
- package/foundation/integrations/cli-requirement.d.mts +14 -0
- package/foundation/integrations/cli-requirement.mjs +23 -0
- package/foundation/integrations/cli-requirement.test.mjs +1 -0
- package/foundation/response/response-types.doc.mjs +5 -5
- package/package.json +9 -9
package/api/docs/_adapter.d.mts
CHANGED
|
@@ -155,6 +155,39 @@ export function packageDocsProblems(integration: {
|
|
|
155
155
|
severity: "error" | "warning";
|
|
156
156
|
message: string;
|
|
157
157
|
}>>;
|
|
158
|
+
/**
|
|
159
|
+
* What one doc that replaces or extends another does, as a package's own
|
|
160
|
+
* check sees it.
|
|
161
|
+
* @typedef {object} DocTarget
|
|
162
|
+
* @property {string} topic the doc's own name
|
|
163
|
+
* @property {'replaces' | 'extends'} relationship
|
|
164
|
+
* @property {string} target the topic name or route it names
|
|
165
|
+
* @property {'topic' | 'guide' | 'namespace' | null} kind what the target
|
|
166
|
+
* is: a flat topic, a guide the docs tree places, a namespace (which neither
|
|
167
|
+
* takes), or null when it names nothing
|
|
168
|
+
* @property {string | null} guide for a guide, the route it is placed at now,
|
|
169
|
+
* which an old route resolves to
|
|
170
|
+
* @property {string[]} guidesBelow for a namespace, the routes of the guides
|
|
171
|
+
* placed below it, any of which the doc could name instead
|
|
172
|
+
* @property {string | null} owner the package whose topic or guide it is
|
|
173
|
+
* @property {Array<{section: string, field: 'before' | 'after', key: string}>} unplaced
|
|
174
|
+
* each section whose `before` or `after` names no section of the target, so
|
|
175
|
+
* it is added at the end instead
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* Each doc in one integration's docs that replaces or extends a topic, or a
|
|
179
|
+
* guide the docs tree places by its route, read against the CLI's docs and the
|
|
180
|
+
* package's own: what it names and whether that exists, and each section an
|
|
181
|
+
* extension places with `before` or `after` that finds no section there.
|
|
182
|
+
* @param {any} integration
|
|
183
|
+
* @param {{records: import('../../foundation/discovery/docs-discovery.mjs').DocsTopicRecord[], namespaces: import('../../foundation/doc-compiler/tree.mjs').TreeNamespaceInput[], guides: import('../../foundation/doc-compiler/tree.mjs').TreeDocInput[]}} discovered
|
|
184
|
+
* @returns {Promise<DocTarget[]>}
|
|
185
|
+
*/
|
|
186
|
+
export function packageDocTargets(integration: any, discovered: {
|
|
187
|
+
records: import("../../foundation/discovery/docs-discovery.mjs").DocsTopicRecord[];
|
|
188
|
+
namespaces: import("../../foundation/doc-compiler/tree.mjs").TreeNamespaceInput[];
|
|
189
|
+
guides: import("../../foundation/doc-compiler/tree.mjs").TreeDocInput[];
|
|
190
|
+
}): Promise<DocTarget[]>;
|
|
158
191
|
/**
|
|
159
192
|
* How a token reference finds its target: the topic it names in `catalog`,
|
|
160
193
|
* lowered for the same language.
|
|
@@ -190,6 +223,9 @@ export function compileTopic(catalog: DocsCatalog, entry: import("../../foundati
|
|
|
190
223
|
/**
|
|
191
224
|
* A guide the docs tree places, as a topic entry the topic readers open by its
|
|
192
225
|
* route. It is never a flat topic: `astryx docs <route>` is its only name.
|
|
226
|
+
* What integrations do to it by its route applies: a replacement is read in
|
|
227
|
+
* its place and names its own package, and each extension's sections merge
|
|
228
|
+
* onto it, each naming the package that wrote it (INV28).
|
|
193
229
|
* @param {import('../../foundation/doc-compiler/tree.mjs').TreeNode} node
|
|
194
230
|
* @returns {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry}
|
|
195
231
|
*/
|
|
@@ -363,6 +399,50 @@ export type FoundDoc = {
|
|
|
363
399
|
tree: boolean;
|
|
364
400
|
} | null;
|
|
365
401
|
};
|
|
402
|
+
/**
|
|
403
|
+
* What one doc that replaces or extends another does, as a package's own
|
|
404
|
+
* check sees it.
|
|
405
|
+
*/
|
|
406
|
+
export type DocTarget = {
|
|
407
|
+
/**
|
|
408
|
+
* the doc's own name
|
|
409
|
+
*/
|
|
410
|
+
topic: string;
|
|
411
|
+
relationship: "replaces" | "extends";
|
|
412
|
+
/**
|
|
413
|
+
* the topic name or route it names
|
|
414
|
+
*/
|
|
415
|
+
target: string;
|
|
416
|
+
/**
|
|
417
|
+
* what the target
|
|
418
|
+
* is: a flat topic, a guide the docs tree places, a namespace (which neither
|
|
419
|
+
* takes), or null when it names nothing
|
|
420
|
+
*/
|
|
421
|
+
kind: "topic" | "guide" | "namespace" | null;
|
|
422
|
+
/**
|
|
423
|
+
* for a guide, the route it is placed at now,
|
|
424
|
+
* which an old route resolves to
|
|
425
|
+
*/
|
|
426
|
+
guide: string | null;
|
|
427
|
+
/**
|
|
428
|
+
* for a namespace, the routes of the guides
|
|
429
|
+
* placed below it, any of which the doc could name instead
|
|
430
|
+
*/
|
|
431
|
+
guidesBelow: string[];
|
|
432
|
+
/**
|
|
433
|
+
* the package whose topic or guide it is
|
|
434
|
+
*/
|
|
435
|
+
owner: string | null;
|
|
436
|
+
/**
|
|
437
|
+
* each section whose `before` or `after` names no section of the target, so
|
|
438
|
+
* it is added at the end instead
|
|
439
|
+
*/
|
|
440
|
+
unplaced: Array<{
|
|
441
|
+
section: string;
|
|
442
|
+
field: "before" | "after";
|
|
443
|
+
key: string;
|
|
444
|
+
}>;
|
|
445
|
+
};
|
|
366
446
|
export type DocsTree = import("../../foundation/doc-compiler/tree.mjs").DocsTree;
|
|
367
447
|
export type TreeNode = import("../../foundation/doc-compiler/tree.mjs").TreeNode;
|
|
368
448
|
export type LinkProblem = import("../../foundation/doc-compiler/links.mjs").LinkProblem;
|
package/api/docs/_adapter.mjs
CHANGED
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
|
|
20
20
|
import * as path from 'node:path';
|
|
21
21
|
import {Project} from '../../foundation/config/project.mjs';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
DocsCatalog,
|
|
24
|
+
isGuideRoute,
|
|
25
|
+
mergeTopicReport,
|
|
26
|
+
} from '../../foundation/discovery/docs-discovery.mjs';
|
|
23
27
|
import {checkDocTypes} from '../../foundation/discovery/doc-types.mjs';
|
|
24
28
|
import {integrationDocFiles} from '../../foundation/discovery/integration-doc-files.mjs';
|
|
25
29
|
import {
|
|
@@ -437,14 +441,61 @@ async function buildProjectTree(catalog, fresh) {
|
|
|
437
441
|
docs: [...cli.docs, ...added.flatMap(each => each.guides)],
|
|
438
442
|
topics: await flatTopicInputs(catalog),
|
|
439
443
|
});
|
|
444
|
+
// A guide the tree places that an integration replaces or extends by its
|
|
445
|
+
// route, or by the route it had before it moved: reads apply what it does,
|
|
446
|
+
// and a replacement lists under its own title and summary.
|
|
447
|
+
// Each doc applies in configured order to the guide its route names, so a
|
|
448
|
+
// doc naming a guide's old route and one naming its new route stack as if
|
|
449
|
+
// both named the same one.
|
|
450
|
+
for (const record of catalog.guideTargeters) {
|
|
451
|
+
const node = placedGuideAt(
|
|
452
|
+
result,
|
|
453
|
+
/** @type {string} */ (record.replaces ?? record.extendsTopic),
|
|
454
|
+
);
|
|
455
|
+
if (!node) continue;
|
|
456
|
+
/** @type {import('../../foundation/discovery/docs-discovery.mjs').GuideOverlay} */
|
|
457
|
+
const overlay = node.guideOverlay ?? {replacement: null, extensions: []};
|
|
458
|
+
if (record.replaces != null) {
|
|
459
|
+
node.guideOverlay = {
|
|
460
|
+
replacement: record,
|
|
461
|
+
// Extensions were authored against the content that just went away.
|
|
462
|
+
extensions: [],
|
|
463
|
+
...(overlay.replacement
|
|
464
|
+
? {replacedPackage: overlay.replacement.package}
|
|
465
|
+
: {}),
|
|
466
|
+
};
|
|
467
|
+
} else {
|
|
468
|
+
node.guideOverlay = {
|
|
469
|
+
...overlay,
|
|
470
|
+
extensions: [
|
|
471
|
+
...overlay.extensions,
|
|
472
|
+
{
|
|
473
|
+
package: record.package,
|
|
474
|
+
path: record.path,
|
|
475
|
+
...(record.providerId ? {providerId: record.providerId} : {}),
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
for (const node of result.nodes.values()) {
|
|
482
|
+
const replacement = node.guideOverlay?.replacement;
|
|
483
|
+
if (replacement) {
|
|
484
|
+
node.title = replacement.title ?? node.title;
|
|
485
|
+
node.summary = replacement.description ?? node.summary;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
440
488
|
// A summary is a doc's text too: each link in it reads as the command that
|
|
441
489
|
// opens its doc, wherever the tree's summaries print (spec:AST-047 FR9).
|
|
442
490
|
for (const node of result.nodes.values()) {
|
|
443
491
|
if (typeof node.summary === 'string' && node.summary.includes('{@link')) {
|
|
492
|
+
const replacement = node.guideOverlay?.replacement;
|
|
444
493
|
node.summary = await linkSummary(
|
|
445
494
|
catalog,
|
|
446
495
|
result,
|
|
447
|
-
|
|
496
|
+
replacement
|
|
497
|
+
? (replacement.providerId ?? replacement.package)
|
|
498
|
+
: node.providerId,
|
|
448
499
|
node.summary,
|
|
449
500
|
);
|
|
450
501
|
}
|
|
@@ -1103,7 +1154,16 @@ export async function docsLinkProblems(
|
|
|
1103
1154
|
}
|
|
1104
1155
|
}
|
|
1105
1156
|
for (const node of tree.nodes.values()) {
|
|
1106
|
-
|
|
1157
|
+
// A package owns a guide it placed, and a guide it replaces or extends by
|
|
1158
|
+
// its route.
|
|
1159
|
+
if (
|
|
1160
|
+
owner != null &&
|
|
1161
|
+
node.provider !== owner &&
|
|
1162
|
+
node.guideOverlay?.replacement?.package !== owner &&
|
|
1163
|
+
!node.guideOverlay?.extensions.some(each => each.package === owner)
|
|
1164
|
+
) {
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1107
1167
|
if (node.kind === 'generic' && node.ref?.topicFile) {
|
|
1108
1168
|
try {
|
|
1109
1169
|
note(node.route, await topicLinkProblems(catalog, guideEntry(node)));
|
|
@@ -1234,6 +1294,168 @@ export async function packageDocsProblems(integration, discovered) {
|
|
|
1234
1294
|
return problems;
|
|
1235
1295
|
}
|
|
1236
1296
|
|
|
1297
|
+
/**
|
|
1298
|
+
* The guide the docs tree places at a route, compared without case, or at the
|
|
1299
|
+
* route it moved to; null when the route holds no placed guide.
|
|
1300
|
+
* @param {DocsTree} tree
|
|
1301
|
+
* @param {string} route
|
|
1302
|
+
* @returns {TreeNode | null}
|
|
1303
|
+
*/
|
|
1304
|
+
function placedGuideAt(tree, route) {
|
|
1305
|
+
const node =
|
|
1306
|
+
tree.get(route) ?? tree.getFolded(route) ?? movedRoute(route, tree);
|
|
1307
|
+
return node?.kind === 'generic' && node.ref?.topicFile ? node : null;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* The routes of every guide the tree places below a namespace, nearest first,
|
|
1312
|
+
* in reading order.
|
|
1313
|
+
* @param {DocsTree} tree
|
|
1314
|
+
* @param {TreeNode} namespace
|
|
1315
|
+
* @returns {string[]}
|
|
1316
|
+
*/
|
|
1317
|
+
function placedGuidesBelow(tree, namespace) {
|
|
1318
|
+
/** @type {string[]} */
|
|
1319
|
+
const routes = [];
|
|
1320
|
+
/** @type {TreeNode[]} */
|
|
1321
|
+
let level = [namespace];
|
|
1322
|
+
while (level.length > 0) {
|
|
1323
|
+
/** @type {TreeNode[]} */
|
|
1324
|
+
const next = [];
|
|
1325
|
+
for (const parent of level) {
|
|
1326
|
+
for (const slot of parent.slots) {
|
|
1327
|
+
for (const route of slot.children) {
|
|
1328
|
+
const child = tree.get(route);
|
|
1329
|
+
if (!child || child.parent !== parent.route) continue;
|
|
1330
|
+
if (child.kind === 'generic' && child.ref?.topicFile) {
|
|
1331
|
+
routes.push(child.route);
|
|
1332
|
+
}
|
|
1333
|
+
if (child.slots.length > 0) next.push(child);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
level = next;
|
|
1338
|
+
}
|
|
1339
|
+
return routes;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* What one doc that replaces or extends another does, as a package's own
|
|
1344
|
+
* check sees it.
|
|
1345
|
+
* @typedef {object} DocTarget
|
|
1346
|
+
* @property {string} topic the doc's own name
|
|
1347
|
+
* @property {'replaces' | 'extends'} relationship
|
|
1348
|
+
* @property {string} target the topic name or route it names
|
|
1349
|
+
* @property {'topic' | 'guide' | 'namespace' | null} kind what the target
|
|
1350
|
+
* is: a flat topic, a guide the docs tree places, a namespace (which neither
|
|
1351
|
+
* takes), or null when it names nothing
|
|
1352
|
+
* @property {string | null} guide for a guide, the route it is placed at now,
|
|
1353
|
+
* which an old route resolves to
|
|
1354
|
+
* @property {string[]} guidesBelow for a namespace, the routes of the guides
|
|
1355
|
+
* placed below it, any of which the doc could name instead
|
|
1356
|
+
* @property {string | null} owner the package whose topic or guide it is
|
|
1357
|
+
* @property {Array<{section: string, field: 'before' | 'after', key: string}>} unplaced
|
|
1358
|
+
* each section whose `before` or `after` names no section of the target, so
|
|
1359
|
+
* it is added at the end instead
|
|
1360
|
+
*/
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* Each doc in one integration's docs that replaces or extends a topic, or a
|
|
1364
|
+
* guide the docs tree places by its route, read against the CLI's docs and the
|
|
1365
|
+
* package's own: what it names and whether that exists, and each section an
|
|
1366
|
+
* extension places with `before` or `after` that finds no section there.
|
|
1367
|
+
* @param {any} integration
|
|
1368
|
+
* @param {{records: import('../../foundation/discovery/docs-discovery.mjs').DocsTopicRecord[], namespaces: import('../../foundation/doc-compiler/tree.mjs').TreeNamespaceInput[], guides: import('../../foundation/doc-compiler/tree.mjs').TreeDocInput[]}} discovered
|
|
1369
|
+
* @returns {Promise<DocTarget[]>}
|
|
1370
|
+
*/
|
|
1371
|
+
export async function packageDocTargets(integration, discovered) {
|
|
1372
|
+
const catalog = packageCatalog(integration, discovered);
|
|
1373
|
+
const tree = await projectTree(catalog);
|
|
1374
|
+
/** @type {DocTarget[]} */
|
|
1375
|
+
const targets = [];
|
|
1376
|
+
for (const record of discovered.records) {
|
|
1377
|
+
const relationship = record.replaces != null ? 'replaces' : 'extends';
|
|
1378
|
+
const target =
|
|
1379
|
+
relationship === 'replaces' ? record.replaces : record.extendsTopic;
|
|
1380
|
+
if (target == null) continue;
|
|
1381
|
+
/** @type {DocTarget['kind']} */
|
|
1382
|
+
let kind = null;
|
|
1383
|
+
/** @type {string | null} */
|
|
1384
|
+
let owner = null;
|
|
1385
|
+
/** @type {string | null} */
|
|
1386
|
+
let basePath = null;
|
|
1387
|
+
/** @type {ReadonlyArray<{path: string}>} every extension of the target, in configured order */
|
|
1388
|
+
let extensions = [];
|
|
1389
|
+
/** @type {string[]} */
|
|
1390
|
+
let guidesBelow = [];
|
|
1391
|
+
/** @type {string | null} */
|
|
1392
|
+
let guide = null;
|
|
1393
|
+
if (isGuideRoute(target)) {
|
|
1394
|
+
const node = placedGuideAt(tree, target);
|
|
1395
|
+
if (node) {
|
|
1396
|
+
kind = 'guide';
|
|
1397
|
+
guide = node.route;
|
|
1398
|
+
owner = node.provider;
|
|
1399
|
+
basePath = node.guideOverlay?.replacement?.path ?? node.ref.topicFile;
|
|
1400
|
+
extensions = node.guideOverlay?.extensions ?? [];
|
|
1401
|
+
}
|
|
1402
|
+
} else {
|
|
1403
|
+
// A replacement already holds the topic's place in the catalog, and
|
|
1404
|
+
// names the package it took it from.
|
|
1405
|
+
const entry = catalog.resolve(target);
|
|
1406
|
+
if (entry?.path === record.path) {
|
|
1407
|
+
kind = 'topic';
|
|
1408
|
+
owner = entry.replacedPackage ?? null;
|
|
1409
|
+
} else if (entry) {
|
|
1410
|
+
kind = 'topic';
|
|
1411
|
+
owner = entry.package;
|
|
1412
|
+
basePath = entry.path;
|
|
1413
|
+
extensions = entry.extensions;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
if (kind == null) {
|
|
1417
|
+
// A namespace holds no sections to take over or merge onto; the guides
|
|
1418
|
+
// below it do.
|
|
1419
|
+
const node =
|
|
1420
|
+
tree.get(target) ?? tree.getFolded(target) ?? movedRoute(target, tree);
|
|
1421
|
+
if (node?.kind === 'namespace') {
|
|
1422
|
+
kind = 'namespace';
|
|
1423
|
+
owner = node.provider;
|
|
1424
|
+
guidesBelow = placedGuidesBelow(tree, node);
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
/** @type {DocTarget['unplaced']} */
|
|
1428
|
+
let unplaced = [];
|
|
1429
|
+
if (relationship === 'extends' && basePath != null) {
|
|
1430
|
+
// Merge every extension in configured order, as a read does, so a key
|
|
1431
|
+
// an earlier extension adds counts as a section of the target.
|
|
1432
|
+
let doc = (await loadTopicFile(basePath, null)).doc;
|
|
1433
|
+
for (const extension of extensions) {
|
|
1434
|
+
if (doc == null) break;
|
|
1435
|
+
const file = (await loadTopicFile(extension.path, null)).doc;
|
|
1436
|
+
if (file == null) continue;
|
|
1437
|
+
const merged = mergeTopicReport(doc, file);
|
|
1438
|
+
if (extension.path === record.path) {
|
|
1439
|
+
unplaced = merged.unplaced;
|
|
1440
|
+
break;
|
|
1441
|
+
}
|
|
1442
|
+
doc = merged.doc;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
targets.push({
|
|
1446
|
+
topic: record.name,
|
|
1447
|
+
relationship,
|
|
1448
|
+
target,
|
|
1449
|
+
kind,
|
|
1450
|
+
owner,
|
|
1451
|
+
guide,
|
|
1452
|
+
guidesBelow,
|
|
1453
|
+
unplaced,
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
return targets;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1237
1459
|
/**
|
|
1238
1460
|
* How a token reference finds its target: the topic it names in `catalog`,
|
|
1239
1461
|
* lowered for the same language.
|
|
@@ -1335,20 +1557,41 @@ export async function compileTopic(catalog, entry, lang = null) {
|
|
|
1335
1557
|
/**
|
|
1336
1558
|
* A guide the docs tree places, as a topic entry the topic readers open by its
|
|
1337
1559
|
* route. It is never a flat topic: `astryx docs <route>` is its only name.
|
|
1560
|
+
* What integrations do to it by its route applies: a replacement is read in
|
|
1561
|
+
* its place and names its own package, and each extension's sections merge
|
|
1562
|
+
* onto it, each naming the package that wrote it (INV28).
|
|
1338
1563
|
* @param {import('../../foundation/doc-compiler/tree.mjs').TreeNode} node
|
|
1339
1564
|
* @returns {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry}
|
|
1340
1565
|
*/
|
|
1341
1566
|
export function guideEntry(node) {
|
|
1342
|
-
|
|
1567
|
+
const base = {
|
|
1343
1568
|
name: node.route,
|
|
1344
1569
|
route: node.route,
|
|
1345
1570
|
package: node.provider,
|
|
1346
1571
|
providerId: node.providerId,
|
|
1347
1572
|
path: node.ref.topicFile,
|
|
1348
1573
|
extensions: [],
|
|
1349
|
-
tree: true,
|
|
1574
|
+
tree: /** @type {const} */ (true),
|
|
1350
1575
|
parent: node.parent ?? undefined,
|
|
1351
1576
|
};
|
|
1577
|
+
const overlay = node.guideOverlay;
|
|
1578
|
+
if (!overlay) return base;
|
|
1579
|
+
const replacement = overlay.replacement;
|
|
1580
|
+
return {
|
|
1581
|
+
...base,
|
|
1582
|
+
...(replacement
|
|
1583
|
+
? {
|
|
1584
|
+
package: replacement.package,
|
|
1585
|
+
providerId: replacement.providerId ?? replacement.package,
|
|
1586
|
+
path: replacement.path,
|
|
1587
|
+
replaces: node.route,
|
|
1588
|
+
// The package whose guide it took over: an earlier replacement's,
|
|
1589
|
+
// when the guide was already replaced.
|
|
1590
|
+
replacedPackage: overlay.replacedPackage ?? node.provider,
|
|
1591
|
+
}
|
|
1592
|
+
: {}),
|
|
1593
|
+
extensions: [...overlay.extensions],
|
|
1594
|
+
};
|
|
1352
1595
|
}
|
|
1353
1596
|
|
|
1354
1597
|
/** @type {WeakMap<DocsTree, ReturnType<typeof cliDocIndex>>} */
|
|
@@ -52,6 +52,14 @@ export async function detail(topic, options = {}) {
|
|
|
52
52
|
),
|
|
53
53
|
// A guide the docs tree places is read by its route, not its doc name.
|
|
54
54
|
...(entry.tree ? {name: entry.name} : {}),
|
|
55
|
+
// Whose topic or guide it took the place of, beside `replaces` (INV28).
|
|
56
|
+
// What it took the place of, as the list, the index and the listing
|
|
57
|
+
// name it: a guide's route, even when the doc named a route the guide
|
|
58
|
+
// moved from, and a topic replaced twice by the earlier replacement.
|
|
59
|
+
...(entry.replaces != null ? {replaces: entry.replaces} : {}),
|
|
60
|
+
...(entry.replaces != null && entry.replacedPackage != null
|
|
61
|
+
? {replacedPackage: entry.replacedPackage}
|
|
62
|
+
: {}),
|
|
55
63
|
links: await topicLinks(catalog, entry),
|
|
56
64
|
},
|
|
57
65
|
};
|
package/api/docs/docs.doc.mjs
CHANGED
|
@@ -107,7 +107,7 @@ export const doc = {
|
|
|
107
107
|
{
|
|
108
108
|
type: 'docs.list',
|
|
109
109
|
description:
|
|
110
|
-
"Every reference-doc topic in read order, as DocsListEntry[] ({topic, description, package, replaces?}), each readable with docs(topic). meta.namespaces lists the docs tree's top-level namespaces ({topic, description, package}), and meta.notLoaded each package whose docs did not load ({package, message}).",
|
|
110
|
+
"Every reference-doc topic in read order, as DocsListEntry[] ({topic, description, package, replaces?, replacedPackage?}), each readable with docs(topic). meta.namespaces lists the docs tree's top-level namespaces ({topic, description, package}), and meta.notLoaded each package whose docs did not load ({package, message}).",
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
type: 'docs.detail',
|
package/api/docs/docs.type.d.mts
CHANGED
|
@@ -36,6 +36,11 @@ export type DocsListEntry = {
|
|
|
36
36
|
* was contributed as a replacement
|
|
37
37
|
*/
|
|
38
38
|
replaces?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* the package whose topic it took the
|
|
41
|
+
* place of, with `replaces`
|
|
42
|
+
*/
|
|
43
|
+
replacedPackage?: string | undefined;
|
|
39
44
|
};
|
|
40
45
|
/**
|
|
41
46
|
* A top-level namespace of the docs tree, as `astryx docs --json` lists it in
|
|
@@ -74,11 +79,13 @@ export type DocsDetailResponse = {
|
|
|
74
79
|
package: string;
|
|
75
80
|
/**
|
|
76
81
|
* the whole doc, each section naming the package that wrote it, and the
|
|
77
|
-
* moves from it
|
|
82
|
+
* moves from it; `replacedPackage` names the package whose topic or guide
|
|
83
|
+
* it took the place of, with `replaces`
|
|
78
84
|
*/
|
|
79
85
|
data: Omit<DocsReadDoc, "sections"> & {
|
|
80
86
|
sections: DocsDetailSection[];
|
|
81
87
|
links: DocsLinks;
|
|
88
|
+
replacedPackage?: string;
|
|
82
89
|
};
|
|
83
90
|
};
|
|
84
91
|
/**
|
|
@@ -86,7 +93,7 @@ export type DocsDetailResponse = {
|
|
|
86
93
|
* and each `reference` block the author wrote, so its content holds only the
|
|
87
94
|
* stable ReferenceContentBlock kinds.
|
|
88
95
|
*/
|
|
89
|
-
export type DocsReadSection = Omit<import("@astryxdesign/cli/authoring").ReferenceSection, "content"> & {
|
|
96
|
+
export type DocsReadSection = Omit<import("@astryxdesign/cli/authoring").ReferenceSection, "content" | "before" | "after"> & {
|
|
90
97
|
content: import("@astryxdesign/cli/authoring").ReferenceContentBlock[];
|
|
91
98
|
};
|
|
92
99
|
/**
|
|
@@ -152,6 +159,15 @@ export type DocsIndex = {
|
|
|
152
159
|
name: string;
|
|
153
160
|
title: string;
|
|
154
161
|
description: string;
|
|
162
|
+
/**
|
|
163
|
+
* the topic or guide this one took the place of
|
|
164
|
+
*/
|
|
165
|
+
replaces?: string | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* the package whose topic or guide it
|
|
168
|
+
* took the place of
|
|
169
|
+
*/
|
|
170
|
+
replacedPackage?: string | undefined;
|
|
155
171
|
sections: DocsIndexSection[];
|
|
156
172
|
/**
|
|
157
173
|
* the moves from the index
|
|
@@ -288,6 +304,16 @@ export type DocsNodeChild = {
|
|
|
288
304
|
* the package that owns the child
|
|
289
305
|
*/
|
|
290
306
|
package: string;
|
|
307
|
+
/**
|
|
308
|
+
* the guide's own route, when an integration's
|
|
309
|
+
* doc took its place
|
|
310
|
+
*/
|
|
311
|
+
replaces?: string | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* the package whose guide it took the
|
|
314
|
+
* place of, with `replaces`
|
|
315
|
+
*/
|
|
316
|
+
replacedPackage?: string | undefined;
|
|
291
317
|
kind: string;
|
|
292
318
|
title: string;
|
|
293
319
|
summary: string;
|
package/api/docs/docs.type.mjs
CHANGED
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
* '@astryxdesign/cli' for a built-in one, else the contributing integration
|
|
35
35
|
* @property {string} [replaces] the topic this one took the place of, when it
|
|
36
36
|
* was contributed as a replacement
|
|
37
|
+
* @property {string} [replacedPackage] the package whose topic it took the
|
|
38
|
+
* place of, with `replaces`
|
|
37
39
|
*/
|
|
38
40
|
|
|
39
41
|
/**
|
|
@@ -58,16 +60,17 @@
|
|
|
58
60
|
* @typedef {object} DocsDetailResponse
|
|
59
61
|
* @property {'docs.detail'} type
|
|
60
62
|
* @property {string} package the npm package that owns the topic
|
|
61
|
-
* @property {Omit<DocsReadDoc, 'sections'> & {sections: DocsDetailSection[], links: DocsLinks}} data
|
|
63
|
+
* @property {Omit<DocsReadDoc, 'sections'> & {sections: DocsDetailSection[], links: DocsLinks, replacedPackage?: string}} data
|
|
62
64
|
* the whole doc, each section naming the package that wrote it, and the
|
|
63
|
-
* moves from it
|
|
65
|
+
* moves from it; `replacedPackage` names the package whose topic or guide
|
|
66
|
+
* it took the place of, with `replaces`
|
|
64
67
|
*/
|
|
65
68
|
|
|
66
69
|
/**
|
|
67
70
|
* A topic section as a read returns it. A read inlines each token reference
|
|
68
71
|
* and each `reference` block the author wrote, so its content holds only the
|
|
69
72
|
* stable ReferenceContentBlock kinds.
|
|
70
|
-
* @typedef {Omit<import('@astryxdesign/cli/authoring').ReferenceSection, 'content'>
|
|
73
|
+
* @typedef {Omit<import('@astryxdesign/cli/authoring').ReferenceSection, 'content' | 'before' | 'after'>
|
|
71
74
|
* & {content: import('@astryxdesign/cli/authoring').ReferenceContentBlock[]}} DocsReadSection
|
|
72
75
|
*/
|
|
73
76
|
|
|
@@ -119,6 +122,9 @@
|
|
|
119
122
|
* @property {string} name the topic
|
|
120
123
|
* @property {string} title
|
|
121
124
|
* @property {string} description
|
|
125
|
+
* @property {string} [replaces] the topic or guide this one took the place of
|
|
126
|
+
* @property {string} [replacedPackage] the package whose topic or guide it
|
|
127
|
+
* took the place of
|
|
122
128
|
* @property {DocsIndexSection[]} sections
|
|
123
129
|
* @property {DocsLinks} links the moves from the index
|
|
124
130
|
*/
|
|
@@ -200,6 +206,10 @@
|
|
|
200
206
|
* @property {string} route pass it to `astryx docs` to go one level down
|
|
201
207
|
* @property {string} name the last segment of its route
|
|
202
208
|
* @property {string} package the package that owns the child
|
|
209
|
+
* @property {string} [replaces] the guide's own route, when an integration's
|
|
210
|
+
* doc took its place
|
|
211
|
+
* @property {string} [replacedPackage] the package whose guide it took the
|
|
212
|
+
* place of, with `replaces`
|
|
203
213
|
* @property {string} kind
|
|
204
214
|
* @property {string} title
|
|
205
215
|
* @property {string} summary
|