@astryxdesign/cli 0.6.3-canary.7ada42e → 0.6.3-canary.7ec7be0
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 +21 -19
- package/api/build/_adapter.d.mts +50 -0
- package/api/build/_adapter.mjs +60 -0
- package/api/build/build.doc.mjs +13 -7
- package/api/build/build.test.mjs +184 -6
- package/api/build/build.type.d.mts +57 -2
- package/api/build/build.type.mjs +30 -7
- package/api/build/help/help.d.mts +4 -0
- package/api/build/help/help.mjs +24 -11
- package/api/build/kit/kit.d.mts +4 -1
- package/api/build/kit/kit.mjs +165 -49
- package/api/build/kit/rank.d.mts +44 -0
- package/api/build/kit/rank.mjs +432 -0
- package/api/build/kit/rank.test.mjs +196 -0
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.mjs +60 -12
- package/api/component/list/list.mjs +3 -2
- package/api/docs/_adapter.d.mts +251 -28
- package/api/docs/_adapter.mjs +918 -35
- package/api/docs/detail/detail.mjs +11 -3
- package/api/docs/detail/section/section.mjs +24 -13
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/docs/docs.d.mts +5 -3
- package/api/docs/docs.doc.mjs +38 -17
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +181 -2
- package/api/docs/docs.type.mjs +117 -3
- package/api/docs/index/index.mjs +11 -3
- package/api/docs/index/index.test.mjs +1 -1
- package/api/docs/integration-tree.test.mjs +555 -0
- package/api/docs/integrationDocs.test.mjs +14 -14
- package/api/docs/list/list.mjs +25 -5
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/docs/reference-blocks.test.mjs +406 -0
- package/api/doctor/doctor.d.mts +30 -2
- package/api/doctor/doctor.mjs +151 -8
- package/api/doctor/doctor.test.mjs +95 -7
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +1 -1
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +107 -5
- package/api/integration/add-contribution.test.mjs +137 -0
- package/api/integration/authoring-checks.mjs +138 -28
- package/api/integration/authoring-checks.test.mjs +171 -3
- package/api/integration/authoring-checks.type.mjs +6 -1
- package/api/integration/integration-authoring.type.d.mts +2 -0
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddDoc.doc.mjs +7 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationPackCheck.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
- package/api/integration/pack-check.mjs +34 -0
- package/api/integration/pack-check.test.mjs +121 -0
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/template-conflict-compatibility.test.mjs +73 -0
- package/api/integration/validate-integration.test.mjs +3 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/index.ts +2 -0
- package/api/layout/_adapter.mjs +20 -5
- package/api/search/search.d.mts +59 -1
- package/api/search/search.doc.mjs +4 -3
- package/api/search/search.mjs +442 -71
- package/api/search/search.test.mjs +91 -2
- package/api/search/search.type.d.mts +13 -1
- package/api/search/search.type.mjs +4 -1
- package/api/template/list/list.mjs +1 -0
- package/api/template/table-floating-bulk-actions.test.mjs +66 -0
- package/api/template/template-integration.test.mjs +1072 -3
- package/api/template/template.doc.mjs +27 -7
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +6 -8
- package/api/template/template.type.mjs +3 -2
- package/api/theme/template/template.test.mjs +5 -0
- package/api/theme/themeTemplate.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/layout.doc.dense.mjs +2 -2
- package/assets/docs/layout.doc.mjs +1 -1
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +3 -3
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +4 -4
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/working-with-ai.doc.mjs +3 -3
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +119 -117
- package/authoring/doctypes/_schema.mjs +54 -3
- package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/load-contract.test.mjs +26 -1
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.mjs +3 -2
- package/authoring/doctypes/reference/reference.doc.mjs +34 -5
- package/authoring/doctypes/reference/type.ts +28 -11
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -1
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +4 -0
- package/authoring/doctypes/template/parse.test.mjs +18 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +8 -0
- package/authoring/identity/identity.doc.mjs +2 -2
- package/authoring/index.d.ts +1 -0
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build.doc.mjs +11 -6
- package/clients/cli/commands/build.mjs +105 -67
- package/clients/cli/commands/build.text-fields.test.mjs +41 -0
- package/clients/cli/commands/component/index.mjs +1 -1
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
- package/clients/cli/commands/discover.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +20 -8
- package/clients/cli/commands/docs.mjs +183 -69
- package/clients/cli/commands/docs.test.mjs +120 -16
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
- package/clients/cli/commands/doctor-integration.test.mjs +75 -1
- package/clients/cli/commands/doctor.mjs +53 -16
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/search.mjs +11 -2
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/template.doc.mjs +23 -6
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/index.mjs +8 -0
- package/clients/cli/lib/manifest.mjs +9 -2
- package/foundation/agent-docs/agent-docs.d.mts +3 -2
- package/foundation/agent-docs/agent-docs.mjs +13 -9
- package/foundation/agent-docs/agent-docs.test.mjs +19 -1
- package/foundation/config/project.d.mts +12 -11
- package/foundation/config/project.mjs +73 -59
- package/foundation/config/project.test.mjs +141 -5
- package/foundation/discovery/authoring-self-docs.d.mts +12 -0
- package/foundation/discovery/authoring-self-docs.mjs +20 -8
- package/foundation/discovery/authoring-self-docs.test.mjs +25 -9
- package/foundation/discovery/cli-self-docs.d.mts +40 -34
- package/foundation/discovery/cli-self-docs.mjs +91 -115
- package/foundation/discovery/cli-self-docs.test.mjs +104 -166
- package/foundation/discovery/component-discovery.d.mts +38 -0
- package/foundation/discovery/component-discovery.mjs +48 -0
- package/foundation/discovery/docs-discovery.d.mts +109 -9
- package/foundation/discovery/docs-discovery.mjs +223 -24
- package/foundation/discovery/docs-discovery.test.mjs +103 -27
- package/foundation/discovery/docs-output-budget.d.mts +2 -2
- package/foundation/discovery/docs-output-budget.mjs +1 -1
- package/foundation/discovery/docs-section-key.d.mts +28 -10
- package/foundation/discovery/docs-section-key.mjs +134 -33
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/discovery/template-adapter.d.mts +92 -6
- package/foundation/discovery/template-adapter.mjs +453 -17
- package/foundation/discovery/template-adapter.test.mjs +42 -0
- package/foundation/discovery/template-conflict-release.d.mts +13 -0
- package/foundation/discovery/template-conflict-release.mjs +40 -0
- package/foundation/discovery/template-conflict-release.test.mjs +40 -0
- package/foundation/doc-compiler/bundle.mjs +61 -1
- package/foundation/doc-compiler/bundle.test.mjs +21 -10
- package/foundation/doc-compiler/compile.d.mts +113 -132
- package/foundation/doc-compiler/compile.mjs +57 -10
- package/foundation/doc-compiler/diagnostics.mjs +28 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
- package/foundation/doc-compiler/inputs.d.mts +2 -2
- package/foundation/doc-compiler/inputs.mjs +6 -1
- package/foundation/doc-compiler/ir.mjs +7 -0
- package/foundation/doc-compiler/lenses.d.mts +8 -5
- package/foundation/doc-compiler/lenses.mjs +50 -4
- package/foundation/doc-compiler/links.d.mts +162 -0
- package/foundation/doc-compiler/links.mjs +294 -0
- package/foundation/doc-compiler/links.test.mjs +192 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
- package/foundation/doc-compiler/read.d.mts +3 -2
- package/foundation/doc-compiler/read.mjs +6 -1
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +84 -0
- package/foundation/integrations/contribution-inventory.d.mts +2 -1
- package/foundation/integrations/contribution-inventory.mjs +10 -4
- package/foundation/integrations/contribution-inventory.test.mjs +19 -0
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +51 -26
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/validate-contributions.mjs +25 -27
- package/foundation/response/response-types.doc.d.mts +5 -1
- package/foundation/response/response-types.doc.mjs +19 -10
- package/foundation/text/string-utils.d.mts +8 -0
- package/foundation/text/string-utils.mjs +18 -0
- package/foundation/xle/expand.mjs +1 -1
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +9 -9
- package/assets/docs/cli.doc.mjs +0 -15
|
@@ -34,6 +34,11 @@ import {
|
|
|
34
34
|
} from '../../foundation/integrations/integrations.mjs';
|
|
35
35
|
import {isValidSemver} from '../../foundation/env/semver.mjs';
|
|
36
36
|
import {assertContributionVisible} from '../../foundation/integrations/contribution-inventory.mjs';
|
|
37
|
+
import {
|
|
38
|
+
docsTreeCliProblem,
|
|
39
|
+
withDocsTreeCli,
|
|
40
|
+
} from '../../foundation/integrations/cli-requirement.mjs';
|
|
41
|
+
import {discoverIntegrationDocs} from '../../foundation/discovery/docs-discovery.mjs';
|
|
37
42
|
import {findIntegrationComponentDoc} from '../../foundation/discovery/component-discovery.mjs';
|
|
38
43
|
import {parseAgentDocsField} from '../../authoring/integration/schema.mjs';
|
|
39
44
|
import {integrationAddTheme} from './add-theme.mjs';
|
|
@@ -83,6 +88,17 @@ function resolvePackage(cwd) {
|
|
|
83
88
|
}
|
|
84
89
|
const owner = typeof pkg.name === 'string' ? pkg.name : '(local integration)';
|
|
85
90
|
const existingManifest = findLocalIntegrationManifestOrNull(packageDir);
|
|
91
|
+
// The nearest package.json above the cwd may belong to another package (an
|
|
92
|
+
// app that contains the folder). Only a package that is already an
|
|
93
|
+
// integration is found from a subfolder; the first add runs in the package.
|
|
94
|
+
const here = path.resolve(cwd ?? process.cwd());
|
|
95
|
+
if (existingManifest == null && path.resolve(packageDir) !== here) {
|
|
96
|
+
throw new AstryxError(
|
|
97
|
+
`${here} has no package.json. The nearest is ${packageFile} (${owner}), which is not an Astryx integration yet. Run this in your integration package's own directory, next to its package.json.`,
|
|
98
|
+
undefined,
|
|
99
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
86
102
|
const manifestFile =
|
|
87
103
|
existingManifest ?? path.join(packageDir, 'astryx.integration.mjs');
|
|
88
104
|
return {
|
|
@@ -353,7 +369,7 @@ async function addComponent(name, options) {
|
|
|
353
369
|
|
|
354
370
|
/**
|
|
355
371
|
* @param {string} name topic name (must match [\w-]+)
|
|
356
|
-
* @param {{cwd?: string, dryRun?: boolean, replaces?: string, extends?: string}} options
|
|
372
|
+
* @param {{cwd?: string, dryRun?: boolean, replaces?: string, extends?: string, parent?: string}} options
|
|
357
373
|
* @returns {Promise<import('./integration-authoring.type.mjs').IntegrationAddResponse>}
|
|
358
374
|
*/
|
|
359
375
|
async function addDoc(name, options) {
|
|
@@ -372,6 +388,20 @@ async function addDoc(name, options) {
|
|
|
372
388
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
373
389
|
);
|
|
374
390
|
}
|
|
391
|
+
if (options.parent != null && (options.replaces != null || options.extends != null)) {
|
|
392
|
+
throw new AstryxError(
|
|
393
|
+
'A guide placed in a namespace has its own route: it cannot also replace or extend a topic.',
|
|
394
|
+
undefined,
|
|
395
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
if (options.parent != null && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(options.parent)) {
|
|
399
|
+
throw new AstryxError(
|
|
400
|
+
'--parent must name a namespace in lowercase letters and digits joined by single hyphens, such as "acme".',
|
|
401
|
+
undefined,
|
|
402
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
403
|
+
);
|
|
404
|
+
}
|
|
375
405
|
for (const [option, value] of [
|
|
376
406
|
['--replaces', options.replaces],
|
|
377
407
|
['--extends', options.extends],
|
|
@@ -432,20 +462,92 @@ async function addDoc(name, options) {
|
|
|
432
462
|
}
|
|
433
463
|
|
|
434
464
|
const title = kebabToTitle(name);
|
|
465
|
+
// --parent names a namespace of this package by its name, wherever its file
|
|
466
|
+
// is. An existing one is used as it is: its `guides` slot, or else its only
|
|
467
|
+
// slot that takes a guide. Otherwise the namespace doc is written, unless a
|
|
468
|
+
// file of that name is already something else (spec:AST-046 FR11).
|
|
469
|
+
const namespaceFile =
|
|
470
|
+
options.parent == null
|
|
471
|
+
? null
|
|
472
|
+
: assertWithin(`${options.parent}.doc.mjs`, root, {
|
|
473
|
+
label: 'namespace doc file',
|
|
474
|
+
});
|
|
475
|
+
let parentSlot = 'guides';
|
|
476
|
+
let writeNamespace = false;
|
|
477
|
+
if (options.parent != null && namespaceFile != null) {
|
|
478
|
+
const {namespaces} = await discoverIntegrationDocs({
|
|
479
|
+
name: owner,
|
|
480
|
+
docs: root,
|
|
481
|
+
});
|
|
482
|
+
const existing = namespaces.find(ns => ns.doc.name === options.parent);
|
|
483
|
+
if (existing != null) {
|
|
484
|
+
const takesGuides = Object.entries(existing.doc.slots ?? {})
|
|
485
|
+
.filter(([, slot]) => slot?.accepts?.kinds?.includes('generic'))
|
|
486
|
+
.map(([slotName]) => slotName);
|
|
487
|
+
const slot = takesGuides.includes('guides')
|
|
488
|
+
? 'guides'
|
|
489
|
+
: takesGuides.length === 1
|
|
490
|
+
? takesGuides[0]
|
|
491
|
+
: null;
|
|
492
|
+
if (slot == null) {
|
|
493
|
+
throw new AstryxError(
|
|
494
|
+
takesGuides.length === 0
|
|
495
|
+
? `Namespace "${options.parent}" (${existing.source}) has no slot that takes a guide. Add one, such as guides: {title: 'Guides', accepts: {kinds: ['generic']}}.`
|
|
496
|
+
: `Namespace "${options.parent}" (${existing.source}) has more than one slot that takes a guide (${takesGuides.join(', ')}). Write the guide yourself, and name its slot in its placement.`,
|
|
497
|
+
undefined,
|
|
498
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
parentSlot = slot;
|
|
502
|
+
} else if (fs.existsSync(namespaceFile)) {
|
|
503
|
+
throw new AstryxError(
|
|
504
|
+
`${projectPath(path.relative(packageDir, namespaceFile))} exists but does not load as the namespace "${options.parent}". Fix or rename that file, or pass another --parent.`,
|
|
505
|
+
undefined,
|
|
506
|
+
ERROR_CODES.ERR_FILE_EXISTS,
|
|
507
|
+
);
|
|
508
|
+
} else {
|
|
509
|
+
writeNamespace = true;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
435
512
|
const relationship = options.replaces
|
|
436
513
|
? `\n replaces: '${options.replaces}',`
|
|
437
514
|
: options.extends
|
|
438
515
|
? `\n extends: '${options.extends}',`
|
|
439
|
-
:
|
|
516
|
+
: options.parent
|
|
517
|
+
? `\n placement: {parent: 'namespace:${options.parent}', slot: '${parentSlot}'},`
|
|
518
|
+
: '';
|
|
519
|
+
const namespaceTitle =
|
|
520
|
+
options.parent == null ? '' : kebabToTitle(options.parent);
|
|
521
|
+
const namespaceContents = `/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */\nexport default {\n type: 'namespace',\n name: '${options.parent}',\n title: '${namespaceTitle}',\n summary: 'Guides for ${namespaceTitle}.',\n slots: {\n guides: {title: 'Guides', accepts: {kinds: ['generic']}},\n },\n};\n`;
|
|
440
522
|
const docContents = `/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */\nexport default {\n type: 'generic',\n name: '${name}',\n title: '${title}',\n description: '${title} documentation.',${relationship}\n sections: [\n {\n title: 'Overview',\n content: [\n { type: 'prose', text: '${title} documentation.' },\n ],\n },\n ],\n};\n`;
|
|
441
523
|
|
|
442
524
|
/** @type {import('./add-helpers.mjs').WritePlan[]} */
|
|
443
525
|
const plans = [{path: docFile, contents: docContents, createOnly: true}];
|
|
444
|
-
|
|
526
|
+
if (namespaceFile != null && writeNamespace) {
|
|
527
|
+
plans.push({path: namespaceFile, contents: namespaceContents, createOnly: true});
|
|
528
|
+
}
|
|
529
|
+
let pkgUpdate = packageJsonUpdate(
|
|
445
530
|
packageFile,
|
|
446
531
|
rootPath,
|
|
447
532
|
path.basename(manifestFile),
|
|
448
533
|
);
|
|
534
|
+
// A namespace doc needs a CLI that reads it: an older one hides every doc
|
|
535
|
+
// topic the package ships. Declare that CLI as a peer, so an older one fails
|
|
536
|
+
// at install instead (spec:AST-046 FR11).
|
|
537
|
+
if (options.parent != null) {
|
|
538
|
+
const expectedOriginal =
|
|
539
|
+
pkgUpdate?.expectedOriginal ?? fs.readFileSync(packageFile);
|
|
540
|
+
const text = pkgUpdate?.contents ?? expectedOriginal.toString('utf-8');
|
|
541
|
+
const current = JSON.parse(text);
|
|
542
|
+
if (docsTreeCliProblem(current) != null) {
|
|
543
|
+
pkgUpdate = {
|
|
544
|
+
contents:
|
|
545
|
+
JSON.stringify(withDocsTreeCli(current), null, 2) +
|
|
546
|
+
(text.endsWith('\n') ? '\n' : ''),
|
|
547
|
+
expectedOriginal,
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
}
|
|
449
551
|
if (pkgUpdate != null) {
|
|
450
552
|
plans.push({
|
|
451
553
|
path: packageFile,
|
|
@@ -1105,7 +1207,7 @@ export function integrationAddAgentDoc(line, options = {}) {
|
|
|
1105
1207
|
|
|
1106
1208
|
const KIND_OPTIONS = {
|
|
1107
1209
|
component: new Set(['cwd', 'dryRun']),
|
|
1108
|
-
doc: new Set(['cwd', 'dryRun', 'replaces', 'extends']),
|
|
1210
|
+
doc: new Set(['cwd', 'dryRun', 'replaces', 'extends', 'parent']),
|
|
1109
1211
|
template: new Set(['cwd', 'dryRun', 'templateType']),
|
|
1110
1212
|
codemod: new Set(['cwd', 'dryRun', 'to']),
|
|
1111
1213
|
'agent-doc': new Set(['cwd', 'dryRun']),
|
|
@@ -1136,7 +1238,7 @@ function validateKindOptions(kind, options) {
|
|
|
1136
1238
|
*
|
|
1137
1239
|
* @param {'component'|'doc'|'template'|'codemod'|'agent-doc'|'theme'} kind
|
|
1138
1240
|
* @param {string} name
|
|
1139
|
-
* @param {{cwd?: string, dryRun?: boolean, templateType?: 'page'|'block', to?: string, replaces?: string, extends?: string}} [options]
|
|
1241
|
+
* @param {{cwd?: string, dryRun?: boolean, templateType?: 'page'|'block', to?: string, replaces?: string, extends?: string, parent?: string}} [options]
|
|
1140
1242
|
* @returns {Promise<import('./integration-authoring.type.mjs').IntegrationAddResponse>}
|
|
1141
1243
|
*/
|
|
1142
1244
|
export async function integrationAdd(kind, name, options = {}) {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
integrationAddTemplate,
|
|
13
13
|
} from './add-contribution.mjs';
|
|
14
14
|
import {validateLocalIntegration} from './validate-integration.mjs';
|
|
15
|
+
import {DOCS_TREE_CLI} from '../../foundation/integrations/cli-requirement.mjs';
|
|
15
16
|
|
|
16
17
|
let tmpDir;
|
|
17
18
|
|
|
@@ -314,6 +315,142 @@ describe('integrationAdd doc', () => {
|
|
|
314
315
|
expect(docErrors).toEqual([]);
|
|
315
316
|
});
|
|
316
317
|
|
|
318
|
+
it('refuses to write from a folder with no package.json into the package above it', async () => {
|
|
319
|
+
setupBare();
|
|
320
|
+
const inside = path.join(tmpDir, 'kit');
|
|
321
|
+
fs.mkdirSync(inside);
|
|
322
|
+
await expect(
|
|
323
|
+
integrationAdd('doc', 'my-guide', {cwd: inside, parent: 'acme'}),
|
|
324
|
+
).rejects.toMatchObject({
|
|
325
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
326
|
+
message: expect.stringContaining('has no package.json'),
|
|
327
|
+
});
|
|
328
|
+
expect(fs.existsSync(path.join(tmpDir, 'docs'))).toBe(false);
|
|
329
|
+
expect(fs.existsSync(path.join(tmpDir, 'astryx.integration.mjs'))).toBe(false);
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
it('finds an integration from a folder inside it', async () => {
|
|
333
|
+
setup();
|
|
334
|
+
const inside = path.join(tmpDir, 'src');
|
|
335
|
+
fs.mkdirSync(inside);
|
|
336
|
+
const result = await integrationAdd('doc', 'my-guide', {cwd: inside});
|
|
337
|
+
expect(result.data.files).toContain('docs/my-guide.doc.mjs');
|
|
338
|
+
expect(fs.existsSync(path.join(tmpDir, 'docs/my-guide.doc.mjs'))).toBe(true);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it('places a guide in a namespace of the package, writing the namespace once', async () => {
|
|
342
|
+
setup();
|
|
343
|
+
const first = await integrationAdd('doc', 'deploying', {
|
|
344
|
+
cwd: tmpDir,
|
|
345
|
+
parent: 'acme',
|
|
346
|
+
});
|
|
347
|
+
expect(first.data.files).toEqual(
|
|
348
|
+
expect.arrayContaining(['docs/deploying.doc.mjs', 'docs/acme.doc.mjs']),
|
|
349
|
+
);
|
|
350
|
+
const guide = fs.readFileSync(path.join(tmpDir, 'docs/deploying.doc.mjs'), 'utf-8');
|
|
351
|
+
expect(guide).toContain("placement: {parent: 'namespace:acme', slot: 'guides'}");
|
|
352
|
+
const namespace = fs.readFileSync(path.join(tmpDir, 'docs/acme.doc.mjs'), 'utf-8');
|
|
353
|
+
expect(namespace).toContain("type: 'namespace'");
|
|
354
|
+
expect(namespace).toContain("guides: {title: 'Guides', accepts: {kinds: ['generic']}}");
|
|
355
|
+
|
|
356
|
+
// The namespace doc needs a CLI that reads it, declared as an optional peer.
|
|
357
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'));
|
|
358
|
+
expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': `>=${DOCS_TREE_CLI}`});
|
|
359
|
+
expect(pkg.peerDependenciesMeta).toEqual({'@astryxdesign/cli': {optional: true}});
|
|
360
|
+
|
|
361
|
+
const second = await integrationAdd('doc', 'upgrading', {
|
|
362
|
+
cwd: tmpDir,
|
|
363
|
+
parent: 'acme',
|
|
364
|
+
});
|
|
365
|
+
expect(second.data.files).not.toContain('docs/acme.doc.mjs');
|
|
366
|
+
|
|
367
|
+
const validation = await validateLocalIntegration(tmpDir);
|
|
368
|
+
expect(validation.issues.filter(i => i.code === 'invalid_doc')).toEqual([]);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('finds the --parent namespace by its name, wherever its file is, and uses its slot', async () => {
|
|
372
|
+
setup({manifest: "export default {docs: './docs'};\n"});
|
|
373
|
+
fs.mkdirSync(path.join(tmpDir, 'docs', 'ns'), {recursive: true});
|
|
374
|
+
fs.writeFileSync(
|
|
375
|
+
path.join(tmpDir, 'docs', 'ns', 'acme.doc.mjs'),
|
|
376
|
+
"export default {type: 'namespace', name: 'acme', title: 'Acme', summary: 'Acme.', slots: {items: {title: 'Items', accepts: {kinds: ['generic']}}}};\n",
|
|
377
|
+
);
|
|
378
|
+
const result = await integrationAdd('doc', 'deploying', {cwd: tmpDir, parent: 'acme'});
|
|
379
|
+
expect(result.data.files).not.toContain('docs/acme.doc.mjs');
|
|
380
|
+
expect(fs.existsSync(path.join(tmpDir, 'docs', 'acme.doc.mjs'))).toBe(false);
|
|
381
|
+
expect(fs.readFileSync(path.join(tmpDir, 'docs', 'deploying.doc.mjs'), 'utf-8')).toContain(
|
|
382
|
+
"placement: {parent: 'namespace:acme', slot: 'items'}",
|
|
383
|
+
);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it('refuses --parent when its file is not that namespace, or the namespace has no slot for a guide', async () => {
|
|
387
|
+
setup({manifest: "export default {docs: './docs'};\n"});
|
|
388
|
+
fs.mkdirSync(path.join(tmpDir, 'docs'), {recursive: true});
|
|
389
|
+
const nsFile = path.join(tmpDir, 'docs', 'acme.doc.mjs');
|
|
390
|
+
fs.writeFileSync(
|
|
391
|
+
nsFile,
|
|
392
|
+
"export default {type: 'generic', name: 'acme', title: 'Acme', description: 'A topic.', sections: [{title: 'Only', content: [{type: 'prose', text: 'x'}]}]};\n",
|
|
393
|
+
);
|
|
394
|
+
await expect(
|
|
395
|
+
integrationAdd('doc', 'deploying', {cwd: tmpDir, parent: 'acme'}),
|
|
396
|
+
).rejects.toMatchObject({code: 'ERR_FILE_EXISTS'});
|
|
397
|
+
// A fresh file: the module loader keeps the first import of a path.
|
|
398
|
+
fs.writeFileSync(
|
|
399
|
+
path.join(tmpDir, 'docs', 'beta.doc.mjs'),
|
|
400
|
+
"export default {type: 'namespace', name: 'beta', title: 'Beta', summary: 'Beta.', slots: {items: {title: 'Items', accepts: {kinds: ['function']}}}};\n",
|
|
401
|
+
);
|
|
402
|
+
await expect(
|
|
403
|
+
integrationAdd('doc', 'deploying', {cwd: tmpDir, parent: 'beta'}),
|
|
404
|
+
).rejects.toMatchObject({
|
|
405
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
406
|
+
message: expect.stringContaining('no slot that takes a guide'),
|
|
407
|
+
});
|
|
408
|
+
fs.writeFileSync(
|
|
409
|
+
path.join(tmpDir, 'docs', 'gamma.doc.mjs'),
|
|
410
|
+
"export default {type: 'namespace', name: 'gamma', title: 'Gamma', summary: 'Gamma.', slots: {guides: {title: 'Guides', accepts: {kinds: ['function']}}, more: {title: 'More', accepts: {kinds: ['generic']}}, extra: {title: 'Extra', accepts: {kinds: ['generic']}}}};\n",
|
|
411
|
+
);
|
|
412
|
+
await expect(
|
|
413
|
+
integrationAdd('doc', 'deploying', {cwd: tmpDir, parent: 'gamma'}),
|
|
414
|
+
).rejects.toMatchObject({
|
|
415
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
416
|
+
message: expect.stringContaining('more than one slot that takes a guide (more, extra)'),
|
|
417
|
+
});
|
|
418
|
+
expect(fs.existsSync(path.join(tmpDir, 'docs', 'deploying.doc.mjs'))).toBe(false);
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('raises a CLI peer that admits a CLI too old for namespace docs, and keeps one that does not', async () => {
|
|
422
|
+
setup();
|
|
423
|
+
const file = path.join(tmpDir, 'package.json');
|
|
424
|
+
const write = (/** @type {string} */ range) => {
|
|
425
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
426
|
+
pkg.peerDependencies = {'@astryxdesign/cli': range};
|
|
427
|
+
fs.writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
428
|
+
};
|
|
429
|
+
write('^0.6.0');
|
|
430
|
+
await integrationAdd('doc', 'deploying', {cwd: tmpDir, parent: 'acme'});
|
|
431
|
+
expect(JSON.parse(fs.readFileSync(file, 'utf-8')).peerDependencies).toEqual({
|
|
432
|
+
'@astryxdesign/cli': `>=${DOCS_TREE_CLI}`,
|
|
433
|
+
});
|
|
434
|
+
write('^9.1.0');
|
|
435
|
+
await integrationAdd('doc', 'upgrading', {cwd: tmpDir, parent: 'acme'});
|
|
436
|
+
expect(JSON.parse(fs.readFileSync(file, 'utf-8')).peerDependencies).toEqual({
|
|
437
|
+
'@astryxdesign/cli': '^9.1.0',
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('refuses --parent with a relationship, or a namespace name that is not a route segment', async () => {
|
|
442
|
+
setup();
|
|
443
|
+
await expect(
|
|
444
|
+
integrationAdd('doc', 'x', {cwd: tmpDir, parent: 'acme', replaces: 'getting-started'}),
|
|
445
|
+
).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
|
|
446
|
+
await expect(
|
|
447
|
+
integrationAdd('doc', 'x', {cwd: tmpDir, parent: 'Acme Kit'}),
|
|
448
|
+
).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
|
|
449
|
+
await expect(
|
|
450
|
+
integrationAdd('template', 'x', {cwd: tmpDir, parent: 'acme'}),
|
|
451
|
+
).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
|
|
452
|
+
});
|
|
453
|
+
|
|
317
454
|
it('includes replaces in the generated doc', async () => {
|
|
318
455
|
setup();
|
|
319
456
|
const result = await integrationAdd('doc', 'my-tokens', {
|
|
@@ -3,13 +3,22 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Integration authoring diagnostics against the built-in Core catalog.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Templates may intentionally replace Core identities; undeclared same-id
|
|
7
|
+
* overlaps stay fail-closed and require package selection. The CLI package
|
|
8
|
+
* version gates replacement-specific fields so 0.6.x keeps its released shape.
|
|
9
|
+
* Docs have explicit `replaces` / `extends` relationships with parallel
|
|
10
|
+
* validation semantics.
|
|
11
|
+
*
|
|
12
|
+
* @input Integration packages, built-in catalogs, and the CLI release boundary.
|
|
13
|
+
* @output Typed template, component, and documentation authoring diagnostics.
|
|
14
|
+
* @position Public integration-authoring API over private discovery adapters.
|
|
10
15
|
*/
|
|
11
16
|
|
|
12
17
|
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
18
|
+
import {
|
|
19
|
+
packageDocsProblems,
|
|
20
|
+
packageReferenceProblems,
|
|
21
|
+
} from '../docs/_adapter.mjs';
|
|
13
22
|
import {findCoreDir} from '../../foundation/fs/paths.mjs';
|
|
14
23
|
import {
|
|
15
24
|
discoverIntegrationComponents,
|
|
@@ -20,9 +29,11 @@ import {
|
|
|
20
29
|
discoverIntegrationDocs,
|
|
21
30
|
} from '../../foundation/discovery/docs-discovery.mjs';
|
|
22
31
|
import {
|
|
32
|
+
applyTemplateReplacements,
|
|
23
33
|
discoverCoreTemplates,
|
|
24
34
|
discoverIntegrationTemplatesForOne,
|
|
25
35
|
} from '../../foundation/discovery/template-adapter.mjs';
|
|
36
|
+
import {expandedTemplateConflictSchemaActive} from '../../foundation/discovery/template-conflict-release.mjs';
|
|
26
37
|
import {
|
|
27
38
|
validateInstalledIntegration,
|
|
28
39
|
validateLocalIntegration,
|
|
@@ -48,16 +59,27 @@ async function resolveIntegration(pkg, cwd) {
|
|
|
48
59
|
/**
|
|
49
60
|
* Add discovery errors once to an issue list.
|
|
50
61
|
* @param {Array<{code: string, severity: 'warning' | 'error', message: string}>} issues
|
|
51
|
-
* @param {Array<{message: string} | Error>} errors
|
|
62
|
+
* @param {Array<{message: string, code?: string, severity?: 'warning' | 'error'} | Error>} errors
|
|
52
63
|
* @param {string} code
|
|
53
64
|
*/
|
|
54
65
|
function addErrors(issues, errors, code) {
|
|
55
66
|
for (const error of errors) {
|
|
56
67
|
const message = error.message;
|
|
57
|
-
|
|
68
|
+
const issueCode =
|
|
69
|
+
'code' in error && typeof error.code === 'string' ? error.code : code;
|
|
70
|
+
const severity =
|
|
71
|
+
'severity' in error &&
|
|
72
|
+
(error.severity === 'warning' || error.severity === 'error')
|
|
73
|
+
? error.severity
|
|
74
|
+
: 'error';
|
|
75
|
+
if (
|
|
76
|
+
issues.some(
|
|
77
|
+
issue => issue.code === issueCode && issue.message === message,
|
|
78
|
+
)
|
|
79
|
+
) {
|
|
58
80
|
continue;
|
|
59
81
|
}
|
|
60
|
-
issues.push({code, severity
|
|
82
|
+
issues.push({code: issueCode, severity, message});
|
|
61
83
|
}
|
|
62
84
|
}
|
|
63
85
|
|
|
@@ -74,7 +96,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
74
96
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
75
97
|
const issues = [...resolved.issues];
|
|
76
98
|
|
|
77
|
-
if (!resolved.integration
|
|
99
|
+
if (!resolved.integration || name == null) {
|
|
78
100
|
return {
|
|
79
101
|
type: 'integration.template-conflicts',
|
|
80
102
|
data: {name, version, conflicts: [], issues},
|
|
@@ -87,6 +109,32 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
87
109
|
]);
|
|
88
110
|
addErrors(issues, errors, 'invalid_template');
|
|
89
111
|
|
|
112
|
+
const expandedConflictSchema = expandedTemplateConflictSchemaActive();
|
|
113
|
+
const replacementResolution = applyTemplateReplacements(
|
|
114
|
+
[...coreTemplates, ...templates],
|
|
115
|
+
errors.filter(error => error.replacementTarget != null),
|
|
116
|
+
);
|
|
117
|
+
for (const error of replacementResolution.errors) {
|
|
118
|
+
if (
|
|
119
|
+
!issues.some(
|
|
120
|
+
issue => issue.code === error.code && issue.message === error.message,
|
|
121
|
+
)
|
|
122
|
+
) {
|
|
123
|
+
issues.push({
|
|
124
|
+
code: error.code,
|
|
125
|
+
severity: error.severity,
|
|
126
|
+
message: error.message,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const activeReplacementIds = new Set(
|
|
131
|
+
replacementResolution.templates
|
|
132
|
+
.filter(
|
|
133
|
+
template => template.package === name && template.replaces != null,
|
|
134
|
+
)
|
|
135
|
+
.map(template => template.dirName),
|
|
136
|
+
);
|
|
137
|
+
|
|
90
138
|
/** @type {Map<string, Array<{type: 'page' | 'block', name: string}>>} */
|
|
91
139
|
const coreById = new Map();
|
|
92
140
|
for (const template of coreTemplates) {
|
|
@@ -101,30 +149,69 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
101
149
|
}
|
|
102
150
|
|
|
103
151
|
const run = getCliInvocation(cwd);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
152
|
+
/** @type {import('./authoring-checks.type.mjs').IntegrationTemplateConflict[]} */
|
|
153
|
+
const conflicts = [];
|
|
154
|
+
for (const template of templates) {
|
|
155
|
+
const sameIdCore = coreById.get(template.dirName);
|
|
156
|
+
const replacementIsActive = activeReplacementIds.has(template.dirName);
|
|
157
|
+
|
|
158
|
+
if (
|
|
159
|
+
expandedConflictSchema &&
|
|
160
|
+
replacementIsActive &&
|
|
161
|
+
template.replaces != null
|
|
162
|
+
) {
|
|
163
|
+
// This branch is unreachable before the package reaches 0.7.0. Keep the
|
|
164
|
+
// published 0.6.x conflict typedef narrow until the activation change.
|
|
165
|
+
conflicts.push(
|
|
166
|
+
/** @type {any} */ ({
|
|
114
167
|
id: template.dirName,
|
|
115
|
-
severity:
|
|
168
|
+
severity: 'info',
|
|
169
|
+
relationship: 'replaces',
|
|
170
|
+
replaces: template.replaces,
|
|
116
171
|
integrationPackage: name,
|
|
117
172
|
integrationType: template.type,
|
|
118
173
|
integrationName: template.name,
|
|
119
|
-
coreMatches,
|
|
174
|
+
coreMatches: coreById.get(template.replaces) ?? [],
|
|
120
175
|
message:
|
|
121
|
-
`
|
|
122
|
-
|
|
123
|
-
command
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
176
|
+
`Intentional replacement: "${template.dirName}" replaces the Core template ` +
|
|
177
|
+
`"${template.replaces}" for unqualified lookup.`,
|
|
178
|
+
command: `${run} template ${shellArg(template.replaces)} --package ${shellArg('@astryxdesign/core')}`,
|
|
179
|
+
}),
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (
|
|
184
|
+
sameIdCore &&
|
|
185
|
+
!(replacementIsActive && template.replaces === template.dirName)
|
|
186
|
+
) {
|
|
187
|
+
const coreKinds = sameIdCore
|
|
188
|
+
.map(match => `${match.type} "${match.name}"`)
|
|
189
|
+
.join(', ');
|
|
190
|
+
const compatibleKind = sameIdCore.some(
|
|
191
|
+
match => match.type === template.type,
|
|
192
|
+
);
|
|
193
|
+
conflicts.push({
|
|
194
|
+
id: template.dirName,
|
|
195
|
+
severity: 'warning',
|
|
196
|
+
...(expandedConflictSchema ? {relationship: 'accidental'} : {}),
|
|
197
|
+
integrationPackage: name,
|
|
198
|
+
integrationType: template.type,
|
|
199
|
+
integrationName: template.name,
|
|
200
|
+
coreMatches: sameIdCore,
|
|
201
|
+
message: expandedConflictSchema
|
|
202
|
+
? compatibleKind
|
|
203
|
+
? `Template id "${template.dirName}" conflicts with Core (${coreKinds}). Consider renaming it, or set replaces: ${JSON.stringify(template.dirName)} in its metadata to replace the Core template.`
|
|
204
|
+
: `Template id "${template.dirName}" conflicts with Core (${coreKinds}), but a ${template.type} template cannot replace a different template kind. Rename the integration template.`
|
|
205
|
+
: `Template id "${template.dirName}" conflicts with Core (${coreKinds}). Consider renaming the integration template. If you keep it, always select it with --package.`,
|
|
206
|
+
command: `${run} template ${shellArg(template.dirName)} --package ${shellArg(name)}`,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
conflicts.sort((a, b) =>
|
|
211
|
+
`${a.id}:${'relationship' in a ? a.relationship : ''}`.localeCompare(
|
|
212
|
+
`${b.id}:${'relationship' in b ? b.relationship : ''}`,
|
|
213
|
+
),
|
|
214
|
+
);
|
|
128
215
|
|
|
129
216
|
return {
|
|
130
217
|
type: 'integration.template-conflicts',
|
|
@@ -211,10 +298,11 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
211
298
|
};
|
|
212
299
|
}
|
|
213
300
|
|
|
214
|
-
const [
|
|
301
|
+
const [discovered, builtinTopics] = await Promise.all([
|
|
215
302
|
discoverIntegrationDocs(resolved.integration),
|
|
216
303
|
Promise.resolve(discoverBuiltinTopics()),
|
|
217
304
|
]);
|
|
305
|
+
const {records, errors} = discovered;
|
|
218
306
|
addErrors(issues, errors, 'invalid_doc');
|
|
219
307
|
const coreTopicsByKey = new Map(
|
|
220
308
|
Object.keys(builtinTopics).map(topic => [topic.toLowerCase(), topic]),
|
|
@@ -276,6 +364,28 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
276
364
|
),
|
|
277
365
|
);
|
|
278
366
|
|
|
367
|
+
// The same graph checks `astryx doctor` runs in a project: the namespaces
|
|
368
|
+
// and placed guides this package adds to the docs tree, and every link in
|
|
369
|
+
// its docs (spec:AST-046, spec:AST-047).
|
|
370
|
+
if (errors.length === 0) {
|
|
371
|
+
for (const message of await packageDocsProblems(
|
|
372
|
+
/** @type {{name: string}} */ (resolved.integration),
|
|
373
|
+
discovered,
|
|
374
|
+
)) {
|
|
375
|
+
issues.push({code: 'invalid_doc_graph', severity: 'warning', message});
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// A reference block includes content rather than linking to it, so one
|
|
379
|
+
// that cannot include what it names loses that content for every reader:
|
|
380
|
+
// an error, where a link that names no doc still prints as written.
|
|
381
|
+
for (const message of await packageReferenceProblems(
|
|
382
|
+
/** @type {{name: string}} */ (resolved.integration),
|
|
383
|
+
discovered,
|
|
384
|
+
)) {
|
|
385
|
+
issues.push({code: 'invalid_doc_reference', severity: 'error', message});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
279
389
|
return {
|
|
280
390
|
type: 'integration.doc-conflicts',
|
|
281
391
|
data: {name, version, findings, issues},
|