@astryxdesign/cli 0.7.2-canary.6d4f178 → 0.7.2-canary.72db6f9
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 +74 -73
- package/api/build/help/help.mjs +1 -1
- 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 +74 -0
- package/api/docs/_adapter.mjs +550 -14
- package/api/docs/integration-tree.test.mjs +22 -0
- package/api/docs/integrationDocs.test.mjs +124 -0
- package/api/docs/list/list.mjs +12 -2
- package/api/doctor/doctor.mjs +27 -3
- package/api/doctor/doctor.test.mjs +43 -0
- package/api/doctor/theme-checks.mjs +1 -1
- 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/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/init/run/run.mjs +2 -2
- package/api/integration/_adapter.d.mts +45 -0
- package/api/integration/_adapter.mjs +112 -0
- package/api/integration/add-contribution.mjs +1 -1
- package/api/integration/add-contribution.test.mjs +4 -2
- package/api/integration/authoring-checks.mjs +108 -4
- package/api/integration/authoring-checks.test.mjs +808 -0
- package/api/integration/authoring-checks.type.d.mts +143 -0
- package/api/integration/authoring-checks.type.mjs +74 -2
- package/api/integration/check/check.d.mts +96 -0
- package/api/integration/check/check.mjs +357 -0
- package/api/integration/check/check.test.mjs +489 -0
- package/api/integration/integration-check.type.d.mts +118 -0
- package/api/integration/integration-check.type.mjs +84 -0
- package/api/integration/integrationCheck.doc.d.mts +10 -0
- package/api/integration/integrationCheck.doc.mjs +73 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +45 -6
- 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 +36 -3
- package/api/integration/validate-integration.test.mjs +88 -8
- package/api/integration/validate-integration.type.d.mts +8 -0
- package/api/integration/validate-integration.type.mjs +12 -1
- package/api/integration/validateIntegration.doc.mjs +19 -3
- package/api/search/search.d.mts +72 -12
- package/api/search/search.domain-priority.test.mjs +108 -18
- package/api/search/search.integration-check.test.mjs +24 -0
- package/api/search/search.mjs +503 -38
- package/api/search/search.test.mjs +139 -0
- package/api/theme/build/build.family.test.mjs +54 -6
- package/api/theme/build/build.mjs +114 -17
- package/api/theme/themeBuild.doc.mjs +4 -4
- 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/README.md +10 -0
- package/assets/docs/author-a-theme.doc.mjs +3 -3
- package/assets/docs/browser-support.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +3 -3
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +2 -2
- package/assets/docs/theme.doc.zh.mjs +1 -1
- package/assets/docs/tree/add-a-component.doc.mjs +1 -1
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +11 -8
- package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
- package/assets/docs/tree/block-template.doc.mjs +8 -20
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/check-the-props.doc.mjs +201 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +65 -7
- package/assets/docs/tree/checks.doc.mjs +25 -17
- package/assets/docs/tree/codemods.doc.mjs +4 -4
- package/assets/docs/tree/component-family.doc.mjs +3 -5
- package/assets/docs/tree/component-imports.doc.mjs +2 -2
- package/assets/docs/tree/components.doc.mjs +1 -1
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +30 -21
- package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
- package/assets/docs/tree/describe-the-component.doc.mjs +2 -2
- package/assets/docs/tree/docs.doc.mjs +3 -3
- package/assets/docs/tree/document-the-template.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +3 -3
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
- package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
- package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
- package/assets/docs/tree/integrations.doc.mjs +8 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
- package/assets/docs/tree/layout.doc.mjs +6 -6
- package/assets/docs/tree/links.doc.mjs +6 -5
- package/assets/docs/tree/migration-setup.doc.mjs +3 -2
- package/assets/docs/tree/migration-verification.doc.mjs +0 -1
- package/assets/docs/tree/migration.doc.mjs +0 -1
- package/assets/docs/tree/package-and-test.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +4 -8
- package/assets/docs/tree/publishing.doc.mjs +4 -4
- package/assets/docs/tree/quick-start.doc.mjs +38 -22
- package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
- package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
- package/assets/docs/tree/sections-and-placement.doc.mjs +6 -8
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
- package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
- package/assets/docs/tree/single-component.doc.mjs +14 -5
- package/assets/docs/tree/start-a-template.doc.mjs +3 -3
- package/assets/docs/tree/subcomponent.doc.mjs +6 -6
- package/assets/docs/tree/template-assets.doc.mjs +2 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +5 -16
- package/assets/docs/tree/template-fonts.doc.mjs +1 -1
- package/assets/docs/tree/template-icons.doc.mjs +1 -1
- package/assets/docs/tree/template-images-media.doc.mjs +1 -1
- package/assets/docs/tree/template-styles.doc.mjs +2 -2
- package/assets/docs/tree/templates.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
- package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
- package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -8
- package/assets/docs/tree/type-scale.doc.mjs +3 -3
- package/assets/docs/tree/upgrading.doc.mjs +4 -4
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
- package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +6 -6
- package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
- package/assets/docs/use-a-theme.doc.mjs +2 -2
- package/assets/theme.template.ts +1 -1
- package/authoring/codemod/codemod.doc.mjs +7 -3
- package/authoring/config/config.doc.mjs +9 -6
- package/authoring/config/type.ts +4 -2
- package/authoring/discover/discover.doc.mjs +1 -1
- package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
- package/authoring/doctypes/command/command.doc.mjs +14 -12
- package/authoring/doctypes/component/component.doc.mjs +29 -26
- package/authoring/doctypes/component/type.ts +15 -5
- package/authoring/doctypes/enum/enum.doc.mjs +7 -4
- package/authoring/doctypes/function/function.doc.mjs +9 -8
- package/authoring/doctypes/hook/hook.doc.mjs +5 -4
- package/authoring/doctypes/hook/type.ts +4 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
- package/authoring/doctypes/reference/reference.doc.mjs +11 -10
- package/authoring/doctypes/schema/schema.doc.mjs +9 -9
- package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
- package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
- package/authoring/doctypes/template/parse.d.mts +6 -2
- package/authoring/doctypes/template/parse.mjs +3 -1
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/authoring/doctypes/template/type.ts +22 -0
- package/authoring/doctypes/theme/theme.doc.mjs +2 -2
- package/authoring/gap-report/gap-report.doc.mjs +2 -2
- package/authoring/identity/identity.doc.mjs +3 -3
- package/authoring/index.d.ts +1 -0
- package/authoring/integration/integration.doc.mjs +12 -4
- package/authoring/integration/parse.test.mjs +10 -0
- package/authoring/integration/schema.d.mts +2 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +4 -0
- package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
- package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
- 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 +18 -4
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +19 -5
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
- package/clients/cli/commands/doctor-integration.test.mjs +884 -0
- package/clients/cli/commands/doctor.mjs +281 -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.doc.mjs +85 -0
- package/clients/cli/commands/integration-check.test.mjs +411 -0
- package/clients/cli/commands/integration.doc.mjs +6 -2
- package/clients/cli/commands/integration.mjs +116 -5
- package/clients/cli/commands/json-contract.test.mjs +5 -1
- package/clients/cli/commands/setup-nudge.test.mjs +79 -1
- package/clients/cli/commands/swizzle.mjs +5 -3
- package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
- package/clients/cli/commands/text-json-parity.test.mjs +5 -0
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/commands/upgrade.doc.mjs +14 -0
- package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
- package/clients/cli/index.mjs +30 -5
- package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
- package/foundation/agent-docs/agent-doc-state.mjs +38 -0
- package/foundation/agent-docs/agent-docs.d.mts +2 -1
- package/foundation/agent-docs/agent-docs.mjs +8 -6
- package/foundation/config/project.mjs +82 -0
- package/foundation/discovery/authoring-self-docs.mjs +2 -1
- package/foundation/discovery/component-discovery.d.mts +18 -0
- package/foundation/discovery/component-discovery.mjs +2 -2
- 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.d.mts +157 -0
- package/foundation/discovery/doc-types.mjs +1231 -0
- package/foundation/discovery/doc-types.test.mjs +744 -0
- package/foundation/discovery/docs-discovery.d.mts +88 -0
- package/foundation/discovery/docs-discovery.mjs +83 -2
- package/foundation/discovery/integration-doc-files.d.mts +22 -0
- package/foundation/discovery/integration-doc-files.mjs +231 -0
- package/foundation/discovery/integration-doc-files.test.mjs +246 -0
- package/foundation/discovery/package-tsconfig.d.mts +14 -0
- package/foundation/discovery/package-tsconfig.mjs +228 -0
- package/foundation/discovery/package-tsconfig.test.mjs +210 -0
- package/foundation/discovery/project-typescript.d.mts +32 -0
- package/foundation/discovery/project-typescript.mjs +89 -0
- package/foundation/discovery/prop-drift.d.mts +297 -0
- package/foundation/discovery/prop-drift.mjs +2428 -0
- package/foundation/discovery/prop-drift.test.mjs +2337 -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/discovery/type-match.d.mts +53 -0
- package/foundation/discovery/type-match.mjs +660 -0
- package/foundation/discovery/type-match.test.mjs +169 -0
- package/foundation/discovery/type-text.d.mts +68 -0
- package/foundation/discovery/type-text.mjs +658 -0
- package/foundation/discovery/type-text.test.mjs +196 -0
- package/foundation/discovery/unresolved-references.d.mts +62 -0
- package/foundation/discovery/unresolved-references.mjs +790 -0
- package/foundation/discovery/unresolved-references.test.mjs +567 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +26 -0
- package/foundation/doc-compiler/links.d.mts +41 -5
- package/foundation/doc-compiler/links.mjs +167 -28
- 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 +15 -9
- package/package.json +11 -11
- package/scripts/postinstall.mjs +3 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Each component doc's props compared with the component's TypeScript props,
|
|
6
|
+
* read with the project's own compiler (spec:AST-039 FR12). Without one, the
|
|
7
|
+
* report says the comparison was skipped.
|
|
8
|
+
* @param {any} integration a loaded integration
|
|
9
|
+
* @param {string} cwd
|
|
10
|
+
* @returns {Promise<import('../../foundation/discovery/prop-drift.mjs').PropDriftReport>}
|
|
11
|
+
*/
|
|
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';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The integration subject's access to the environment (INV21): reading
|
|
5
|
+
* one package's component docs and sources with the project's own TypeScript.
|
|
6
|
+
*
|
|
7
|
+
* @input a loaded integration and the directory the command runs in
|
|
8
|
+
* @output the reports the integration checks attach to their results
|
|
9
|
+
* @position api/integration (internal; not exported from ./api)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
discoverValidIntegrationComponents,
|
|
14
|
+
forEachIntegrationDoc,
|
|
15
|
+
integrationSourceForDoc,
|
|
16
|
+
} from '../../foundation/discovery/component-discovery.mjs';
|
|
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';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Each component doc's props compared with the component's TypeScript props,
|
|
24
|
+
* read with the project's own compiler (spec:AST-039 FR12). Without one, the
|
|
25
|
+
* report says the comparison was skipped.
|
|
26
|
+
* @param {any} integration a loaded integration
|
|
27
|
+
* @param {string} cwd
|
|
28
|
+
* @returns {Promise<import('../../foundation/discovery/prop-drift.mjs').PropDriftReport>}
|
|
29
|
+
*/
|
|
30
|
+
export async function integrationPropDrift(integration, cwd) {
|
|
31
|
+
const packageDir = /** @type {{__packageDir?: string}} */ (integration)
|
|
32
|
+
.__packageDir;
|
|
33
|
+
const {components} = await discoverValidIntegrationComponents(integration);
|
|
34
|
+
// Every doc the package ships has its prop tables compared or listed as not
|
|
35
|
+
// compared. A doc discovery leaves out (a hidden one, a second doc for one
|
|
36
|
+
// name, or one whose source or own file doesn't load) gets a record under
|
|
37
|
+
// its file name.
|
|
38
|
+
const recorded = new Set(components.map(c => c.docPath));
|
|
39
|
+
/** @type {typeof components} */
|
|
40
|
+
const left = [];
|
|
41
|
+
forEachIntegrationDoc(integration?.components, (docPath, stem) => {
|
|
42
|
+
if (recorded.has(docPath)) return;
|
|
43
|
+
recorded.add(docPath);
|
|
44
|
+
left.push({
|
|
45
|
+
name: stem,
|
|
46
|
+
package: integration.name,
|
|
47
|
+
docPath,
|
|
48
|
+
sourcePath: integrationSourceForDoc(docPath),
|
|
49
|
+
issuesUrl: integration.issuesUrl,
|
|
50
|
+
group: null,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return comparePropDocs([...components, ...left], {
|
|
54
|
+
packageDir: packageDir ?? cwd,
|
|
55
|
+
resolveFrom: [cwd, packageDir],
|
|
56
|
+
});
|
|
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
|
+
}
|
|
@@ -695,7 +695,7 @@ async function addTemplate(name, options) {
|
|
|
695
695
|
const sourcePath = projectPath(path.relative(packageDir, sourceFile));
|
|
696
696
|
const extensionlessPath = sourcePath.replace(/\.tsx?$/u, '');
|
|
697
697
|
const blockFields = templateType === 'block' ? '\n aspectRatio: 1,' : '';
|
|
698
|
-
const specContents = `/** @type {import('@astryxdesign/cli/authoring').
|
|
698
|
+
const specContents = `/** @type {import('@astryxdesign/cli/authoring').IntegrationTemplateDoc} */\nexport default {\n type: '${templateType}',\n name: '${name}',\n displayName: '${kebabToTitle(name)}',\n description: '${kebabToTitle(name)} template.',${blockFields}\n};\n`;
|
|
699
699
|
const sourceContents = `export default function ${pascalName}() {\n return <div>${kebabToTitle(name)}</div>;\n}\n`;
|
|
700
700
|
|
|
701
701
|
/** @type {import('./add-helpers.mjs').WritePlan[]} */
|
|
@@ -536,7 +536,9 @@ describe('integrationAdd template', () => {
|
|
|
536
536
|
path.join(tmpDir, 'templates/my-widget.doc.mjs'),
|
|
537
537
|
'utf-8',
|
|
538
538
|
);
|
|
539
|
-
expect(spec).toContain(
|
|
539
|
+
expect(spec).toContain(
|
|
540
|
+
"@astryxdesign/cli/authoring').IntegrationTemplateDoc",
|
|
541
|
+
);
|
|
540
542
|
expect(spec).toContain("type: 'page'");
|
|
541
543
|
expect(spec).toContain("name: 'my-widget'");
|
|
542
544
|
|
|
@@ -830,7 +832,7 @@ describe('typed descriptor conformance', () => {
|
|
|
830
832
|
for (const [relativePath, type] of [
|
|
831
833
|
['components/MyWidget.doc.mjs', 'ComponentDoc'],
|
|
832
834
|
['docs/my-guide.doc.mjs', 'ReferenceDoc'],
|
|
833
|
-
['templates/my-page.doc.mjs', '
|
|
835
|
+
['templates/my-page.doc.mjs', 'IntegrationTemplateDoc'],
|
|
834
836
|
['themes/ocean/oceanTheme.doc.mjs', 'ThemeDoc'],
|
|
835
837
|
]) {
|
|
836
838
|
const source = fs.readFileSync(path.join(tmpDir, relativePath), 'utf-8');
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Integration authoring diagnostics against the built-in Core catalog.
|
|
5
5
|
*
|
|
6
|
+
* The components check also compares each component doc's props with the
|
|
7
|
+
* component's TypeScript props (foundation/discovery/prop-drift.mjs); those
|
|
8
|
+
* findings are warnings under `propDrift`.
|
|
9
|
+
*
|
|
6
10
|
* Templates may intentionally replace Core identities; undeclared same-id
|
|
7
11
|
* overlaps stay fail-closed and require package selection. The CLI package
|
|
8
12
|
* version gates replacement-specific fields so 0.6.x keeps its released shape.
|
|
@@ -14,8 +18,10 @@
|
|
|
14
18
|
* @position Public integration-authoring API over private discovery adapters.
|
|
15
19
|
*/
|
|
16
20
|
|
|
21
|
+
import path from 'node:path';
|
|
17
22
|
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
18
23
|
import {
|
|
24
|
+
packageComponentLinkProblems,
|
|
19
25
|
packageDocsProblems,
|
|
20
26
|
packageReferenceProblems,
|
|
21
27
|
} from '../docs/_adapter.mjs';
|
|
@@ -25,6 +31,12 @@ import {
|
|
|
25
31
|
discoverOwnedComponents,
|
|
26
32
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
27
33
|
import {loadComponentReplacements} from '../component/_adapter.mjs';
|
|
34
|
+
import {
|
|
35
|
+
integrationCopiedPassages,
|
|
36
|
+
integrationFluff,
|
|
37
|
+
integrationPropDrift,
|
|
38
|
+
integrationStrayPointers,
|
|
39
|
+
} from './_adapter.mjs';
|
|
28
40
|
import {
|
|
29
41
|
discoverBuiltinTopics,
|
|
30
42
|
discoverIntegrationDocs,
|
|
@@ -242,6 +254,23 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
242
254
|
};
|
|
243
255
|
}
|
|
244
256
|
|
|
257
|
+
// Each documented prop against the component's TypeScript props, read with
|
|
258
|
+
// the project's own compiler; without one the report says it was skipped.
|
|
259
|
+
const propDrift = await integrationPropDrift(resolved.integration, cwd);
|
|
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
|
+
|
|
245
274
|
const coreDir = findCoreDir(cwd);
|
|
246
275
|
if (!coreDir) {
|
|
247
276
|
issues.push({
|
|
@@ -252,7 +281,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
252
281
|
});
|
|
253
282
|
return {
|
|
254
283
|
type: 'integration.component-conflicts',
|
|
255
|
-
data: {validated, name, version, conflicts: [], issues},
|
|
284
|
+
data: {validated, name, version, conflicts: [], issues, propDrift},
|
|
256
285
|
};
|
|
257
286
|
}
|
|
258
287
|
|
|
@@ -296,7 +325,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
296
325
|
|
|
297
326
|
return {
|
|
298
327
|
type: 'integration.component-conflicts',
|
|
299
|
-
data: {validated, name, version, conflicts, issues},
|
|
328
|
+
data: {validated, name, version, conflicts, issues, propDrift},
|
|
300
329
|
};
|
|
301
330
|
}
|
|
302
331
|
|
|
@@ -314,10 +343,47 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
314
343
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
315
344
|
const issues = [...resolved.issues];
|
|
316
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;
|
|
317
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
|
+
}
|
|
318
375
|
return {
|
|
319
376
|
type: 'integration.doc-conflicts',
|
|
320
|
-
data: {
|
|
377
|
+
data: {
|
|
378
|
+
validated,
|
|
379
|
+
name,
|
|
380
|
+
version,
|
|
381
|
+
findings: [],
|
|
382
|
+
copiedPassages,
|
|
383
|
+
fluff,
|
|
384
|
+
strayPointers,
|
|
385
|
+
issues,
|
|
386
|
+
},
|
|
321
387
|
};
|
|
322
388
|
}
|
|
323
389
|
|
|
@@ -407,10 +473,48 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
407
473
|
)) {
|
|
408
474
|
issues.push({code: 'invalid_doc_reference', severity: 'error', message});
|
|
409
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
|
+
}
|
|
410
505
|
}
|
|
411
506
|
|
|
412
507
|
return {
|
|
413
508
|
type: 'integration.doc-conflicts',
|
|
414
|
-
data: {
|
|
509
|
+
data: {
|
|
510
|
+
validated,
|
|
511
|
+
name,
|
|
512
|
+
version,
|
|
513
|
+
findings,
|
|
514
|
+
copiedPassages,
|
|
515
|
+
fluff,
|
|
516
|
+
strayPointers,
|
|
517
|
+
issues,
|
|
518
|
+
},
|
|
415
519
|
};
|
|
416
520
|
}
|