@astryxdesign/cli 0.7.17 → 0.7.18-canary.g57306fd
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 +1 -1
- package/api/discover/_adapter.d.mts +7 -5
- package/api/discover/_adapter.mjs +12 -11
- package/api/docs/_adapter.d.mts +19 -2
- package/api/docs/_adapter.mjs +66 -5
- package/api/doctor/_adapter.d.mts +11 -62
- package/api/doctor/_adapter.mjs +242 -472
- package/api/doctor/doctor.d.mts +1 -1
- package/api/doctor/doctor.mjs +3 -3
- package/api/doctor/theme-checks.mjs +37 -45
- package/api/error.d.mts +21 -0
- package/api/error.mjs +89 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/icon/_adapter.d.mts +8 -0
- package/api/icon/_adapter.mjs +17 -0
- package/api/icon/_authoring.mjs +6 -6
- package/api/icon/_default-look.mjs +16 -16
- package/api/icon/add/add.mjs +3 -3
- package/api/icon/exportIconIndex.doc.mjs +2 -2
- package/api/icon/icon.doc.mjs +2 -2
- package/api/icon/icon.type.d.mts +4 -0
- package/api/icon/icon.type.mjs +2 -1
- package/api/icon/search/icon-index.mjs +16 -3
- package/api/icon/search/search.d.mts +15 -5
- package/api/icon/search/search.mjs +74 -16
- package/api/icon/use/use.mjs +4 -4
- package/api/render/_adapter.mjs +233 -40
- package/api/render/render.type.d.mts +1 -1
- package/api/render/render.type.mjs +1 -1
- package/api/search/ORDERING.md +2 -2
- package/api/search/_adapter.mjs +4 -0
- package/api/search/_candidate-score.mjs +32 -8
- package/api/search/_cards.json +1 -1
- package/api/search/_compound.d.mts +0 -1
- package/api/search/_compound.mjs +93 -2
- package/api/search/_icons.d.mts +4 -2
- package/api/search/_icons.mjs +4 -2
- package/api/search/_lexical.mjs +177 -17
- package/api/search/_order.d.mts +3 -1
- package/api/search/_order.mjs +16 -5
- package/api/search/_result.d.mts +9 -0
- package/api/search/_result.mjs +10 -0
- package/api/search/_score.mjs +21 -3
- package/api/swizzle/_moduleGraph.d.mts +8 -0
- package/api/swizzle/_moduleGraph.mjs +61 -3
- package/api/template/copy/copy.mjs +5 -3
- package/api/theme/_adapter.mjs +48 -12
- package/api/theme/build/build.d.mts +4 -0
- package/api/theme/build/build.mjs +69 -18
- package/api/theme/build/style-keys.mjs +4 -5
- package/api/theme/build/theme-object.mjs +5 -0
- package/api/theme/palette/generate/color.d.mts +47 -0
- package/api/theme/palette/generate/color.mjs +58 -1
- package/api/theme/palette/generate/derive-look.d.mts +293 -0
- package/api/theme/palette/generate/derive-look.mjs +1362 -0
- package/api/theme/palette/generate/editor-look.d.mts +62 -0
- package/api/theme/palette/generate/editor-look.mjs +550 -0
- package/api/theme/palette/generate/mapping.d.mts +94 -9
- package/api/theme/palette/generate/mapping.mjs +94 -22
- package/api/theme-edit/_adapter.mjs +13 -2
- package/api/theme-edit/_catalog.d.mts +13 -13
- package/api/theme-edit/_catalog.mjs +66 -28
- package/api/theme-edit/_check.d.mts +82 -6
- package/api/theme-edit/_check.mjs +1270 -238
- package/api/theme-edit/_color.d.mts +74 -0
- package/api/theme-edit/_color.mjs +168 -3
- package/api/theme-edit/_compiler.d.mts +3 -5
- package/api/theme-edit/_compiler.mjs +122 -23
- package/api/theme-edit/_context.d.mts +55 -12
- package/api/theme-edit/_context.mjs +114 -60
- package/api/theme-edit/_css.d.mts +11 -0
- package/api/theme-edit/_css.mjs +40 -0
- package/api/theme-edit/_edit.d.mts +15 -2
- package/api/theme-edit/_edit.mjs +1469 -133
- package/api/theme-edit/_how-commands.d.mts +116 -0
- package/api/theme-edit/_how-commands.mjs +227 -115
- package/api/theme-edit/_how-question.d.mts +74 -29
- package/api/theme-edit/_how-question.mjs +8514 -1256
- package/api/theme-edit/_how-sides.d.mts +22 -0
- package/api/theme-edit/_how-sides.mjs +173 -0
- package/api/theme-edit/_how-steps.d.mts +42 -0
- package/api/theme-edit/_how-steps.mjs +208 -0
- package/api/theme-edit/_how-values.d.mts +29 -0
- package/api/theme-edit/_how-values.mjs +111 -0
- package/api/theme-edit/_how-words.d.mts +15 -0
- package/api/theme-edit/_how-words.mjs +239 -0
- package/api/theme-edit/_how.d.mts +1 -1
- package/api/theme-edit/_how.mjs +422 -37
- package/api/theme-edit/_missed.d.mts +2 -1
- package/api/theme-edit/_missed.mjs +125 -13
- package/api/theme-edit/_normal.d.mts +5 -3
- package/api/theme-edit/_normal.mjs +54 -14
- package/api/theme-edit/_palette.d.mts +204 -4
- package/api/theme-edit/_palette.mjs +901 -25
- package/api/theme-edit/_part-pieces.d.mts +54 -0
- package/api/theme-edit/_part-pieces.mjs +179 -0
- package/api/theme-edit/_part-words.mjs +33 -5
- package/api/theme-edit/_parts.d.mts +133 -0
- package/api/theme-edit/_parts.mjs +599 -10
- package/api/theme-edit/_picture-traits.d.mts +259 -0
- package/api/theme-edit/_picture-traits.mjs +1030 -0
- package/api/theme-edit/_preview.d.mts +95 -4
- package/api/theme-edit/_preview.mjs +284 -31
- package/api/theme-edit/_project.d.mts +14 -4
- package/api/theme-edit/_project.mjs +95 -26
- package/api/theme-edit/_resolved.d.mts +46 -0
- package/api/theme-edit/_resolved.mjs +800 -0
- package/api/theme-edit/_set-line.d.mts +29 -0
- package/api/theme-edit/_set-line.mjs +100 -0
- package/api/theme-edit/_settings.d.mts +625 -28
- package/api/theme-edit/_settings.mjs +4867 -888
- package/api/theme-edit/_tables.d.mts +25 -1
- package/api/theme-edit/_tables.mjs +115 -11
- package/api/theme-edit/_text-looks.d.mts +78 -0
- package/api/theme-edit/_text-looks.mjs +376 -0
- package/api/theme-edit/_vet.d.mts +3 -26
- package/api/theme-edit/_vet.mjs +5 -89
- package/api/theme-edit/how/how.d.mts +1 -1
- package/api/theme-edit/how/how.mjs +1 -1
- package/api/theme-edit/show/show.d.mts +4 -3
- package/api/theme-edit/show/show.mjs +3 -2
- package/api/theme-edit/theme-edit.type.d.mts +117 -1
- package/api/theme-edit/theme-edit.type.mjs +46 -3
- package/api/theme-edit/themeEditHow.doc.mjs +3 -3
- package/api/theme-edit/themeEditNew.doc.mjs +4 -0
- package/api/theme-edit/themeEditSet.doc.mjs +6 -2
- package/api/theme-edit/themeEditShow.doc.mjs +22 -3
- package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/author-a-theme.doc.mjs +7 -4
- package/assets/docs/theme.doc.dense.mjs +10 -0
- package/assets/docs/theme.doc.mjs +10 -0
- package/assets/docs/theme.doc.zh.mjs +10 -0
- package/assets/docs/tree/export-pages.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +89 -17
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/definitions/article.doc.mjs +9 -0
- package/assets/icons/template-icons.json +5 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ide/page.tsx +5 -10
- package/assets/templates/pages/payment-form/page.tsx +16 -60
- package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/doctypes/_schema.d.mts +13 -13
- package/authoring/gap-report/parse.d.mts +1 -1
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/ensure-core-built.mjs +17 -10
- package/clients/cli/commands/experimental/icon.mjs +7 -7
- package/clients/cli/commands/experimental/theme.mjs +175 -13
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +15 -5
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/hook.mjs +7 -0
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/index.mjs +6 -2
- package/clients/cli/lib/hook-format.mjs +41 -1
- package/clients/cli/lib/json-shim.mjs +34 -14
- package/clients/cli/lib/other-cli-words.mjs +7 -0
- package/clients/cli/lib/unknown-command.mjs +345 -46
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +11 -2
- package/foundation/agent-docs/agent-docs.mjs +51 -8
- package/foundation/config/project.d.mts +11 -1
- package/foundation/config/project.mjs +11 -2
- package/foundation/discovery/component-replacement.d.mts +5 -8
- package/foundation/discovery/component-replacement.mjs +12 -14
- package/foundation/discovery/core-augmentation-points.d.mts +35 -0
- package/foundation/discovery/core-augmentation-points.mjs +410 -9
- package/foundation/discovery/core-elements.d.mts +6 -0
- package/foundation/discovery/core-elements.mjs +10 -2
- package/foundation/discovery/core-prop-types.d.mts +5 -0
- package/foundation/discovery/core-prop-types.mjs +10 -3
- package/foundation/discovery/core-props.d.mts +8 -0
- package/foundation/discovery/core-props.mjs +29 -13
- package/foundation/discovery/icon-ranking.d.mts +5 -2
- package/foundation/discovery/icon-ranking.mjs +101 -18
- package/foundation/discovery/icon-set-checks.mjs +1 -1
- package/foundation/discovery/icon-set-writer.mjs +1 -1
- package/foundation/discovery/official-list.d.mts +17 -0
- package/foundation/discovery/official-list.mjs +77 -0
- package/foundation/discovery/unknown-core-props.d.mts +130 -0
- package/foundation/discovery/unknown-core-props.mjs +601 -0
- package/foundation/discovery/written-prop-values.d.mts +35 -0
- package/foundation/discovery/written-prop-values.mjs +258 -0
- package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
- package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
- package/foundation/fs/package-name.d.mts +10 -0
- package/foundation/fs/package-name.mjs +37 -0
- package/foundation/fs/project-source-files.d.mts +27 -0
- package/foundation/fs/project-source-files.mjs +115 -0
- package/foundation/fs/project-sources.d.mts +25 -0
- package/foundation/fs/project-sources.mjs +83 -0
- package/foundation/fs/read-record.d.mts +18 -0
- package/foundation/fs/read-record.mjs +36 -2
- package/foundation/integrations/integration-warnings.d.mts +39 -7
- package/foundation/integrations/integration-warnings.mjs +141 -19
- package/foundation/integrations/missing-dependency.d.mts +11 -0
- package/foundation/integrations/missing-dependency.mjs +20 -5
- package/foundation/release/folder-lock.d.mts +5 -2
- package/foundation/release/folder-lock.mjs +9 -3
- package/foundation/release/notices.mjs +2 -8
- package/foundation/render/cut-short.d.mts +8 -2
- package/foundation/render/cut-short.mjs +50 -5
- package/foundation/render/drawn-contrast.d.mts +40 -0
- package/foundation/render/drawn-contrast.mjs +355 -0
- package/foundation/render/file-header.mjs +4 -0
- package/foundation/render/layers.d.mts +2 -1
- package/foundation/render/layers.mjs +22 -1
- package/foundation/render/package-resolve-hooks.d.mts +38 -9
- package/foundation/render/package-resolve-hooks.mjs +124 -32
- package/foundation/render/page-worker.mjs +95 -23
- package/foundation/render/part-boxes.d.mts +27 -0
- package/foundation/render/part-boxes.mjs +45 -0
- package/foundation/render/picture-chrome.mjs +36 -4
- package/foundation/render/picture-playwright.mjs +26 -2
- package/foundation/render/picture-window.d.mts +29 -2
- package/foundation/render/picture-window.mjs +99 -1
- package/foundation/render/render-page.d.mts +39 -6
- package/foundation/render/render-page.mjs +26 -10
- package/foundation/render/ts-paths.mjs +2 -1
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/error-codes.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +9 -5
- package/foundation/text/written-string.d.mts +4 -1
- package/foundation/text/written-string.mjs +4 -1
- package/package.json +8 -7
|
@@ -92,6 +92,14 @@ export function detectStylingSystem(targetDir: string): "stylex" | "tailwind" |
|
|
|
92
92
|
* @returns {boolean}
|
|
93
93
|
*/
|
|
94
94
|
export function projectHasBuiltCheck(dir: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the project at `dir` can run `astryx experimental export`, read from
|
|
97
|
+
* the CLI it installs, as {@link projectHasBuiltCheck} reads `doctor --built`.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} dir
|
|
100
|
+
* @returns {boolean}
|
|
101
|
+
*/
|
|
102
|
+
export function projectHasExport(dir: string): boolean;
|
|
95
103
|
/**
|
|
96
104
|
* Generate the agent cheat sheet from live CLI metadata.
|
|
97
105
|
*
|
|
@@ -120,10 +128,10 @@ export function projectHasBuiltCheck(dir: string): boolean;
|
|
|
120
128
|
* one; where it is off, the block has no icon line.
|
|
121
129
|
*
|
|
122
130
|
* @param {string | null} version the Core version
|
|
123
|
-
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}>, skills?: ReadonlyArray<{package: string, name: string, description: string}>, builtCheck?: boolean, iconFeatures?: boolean}} [options]
|
|
131
|
+
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}>, skills?: ReadonlyArray<{package: string, name: string, description: string}>, builtCheck?: boolean, iconFeatures?: boolean, exportCheck?: boolean}} [options]
|
|
124
132
|
* @returns {string}
|
|
125
133
|
*/
|
|
126
|
-
export function generateCompressedIndex(version: string | null, { coreDir, invocation, stylingSystem, topics, agentDocs, skills, builtCheck, iconFeatures, }?: {
|
|
134
|
+
export function generateCompressedIndex(version: string | null, { coreDir, invocation, stylingSystem, topics, agentDocs, skills, builtCheck, iconFeatures, exportCheck, }?: {
|
|
127
135
|
coreDir?: string | null;
|
|
128
136
|
invocation?: string;
|
|
129
137
|
stylingSystem?: "stylex" | "tailwind" | "css";
|
|
@@ -141,6 +149,7 @@ export function generateCompressedIndex(version: string | null, { coreDir, invoc
|
|
|
141
149
|
}>;
|
|
142
150
|
builtCheck?: boolean;
|
|
143
151
|
iconFeatures?: boolean;
|
|
152
|
+
exportCheck?: boolean;
|
|
144
153
|
}): string;
|
|
145
154
|
/**
|
|
146
155
|
* The block's line for one integration skill: who ships it, when to use it,
|
|
@@ -105,6 +105,14 @@ const MAX_PROJECT_AGENT_DOC_LINES = 32;
|
|
|
105
105
|
export const REMOVE_LINE =
|
|
106
106
|
'To remove this block, run `astryx init --remove-agents`, which removes it from the agent files at the project root and in the folder you run it in; from any other file it leaves, delete everything from ASTRYX:START to ASTRYX:END.';
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* How to share a page as one file, for a share ask only. Agents asked to share
|
|
110
|
+
* a page otherwise hand-build their own single HTML file, whose controls do
|
|
111
|
+
* not work.
|
|
112
|
+
*/
|
|
113
|
+
const SHARE_LINE =
|
|
114
|
+
'When asked to share a page as one file, run `astryx experimental export <page.tsx>`: the file opens anywhere and its controls work; `--reverse` gets the source back.';
|
|
115
|
+
|
|
108
116
|
const MANAGED_MARKER_TEXT = /(?:ASTRYX|XDS):(START|END)/u;
|
|
109
117
|
|
|
110
118
|
/** @param {unknown} value @returns {string} */
|
|
@@ -555,16 +563,17 @@ export function detectStylingSystem(targetDir) {
|
|
|
555
563
|
const BUILT_CHECK_SINCE = '0.7.4';
|
|
556
564
|
|
|
557
565
|
/**
|
|
558
|
-
* Whether
|
|
559
|
-
*
|
|
560
|
-
* option.
|
|
566
|
+
* Whether `version` is release `since` or later. A prerelease of `since`
|
|
567
|
+
* itself is below it: its canaries predate the feature.
|
|
561
568
|
* @param {string | null | undefined} version
|
|
569
|
+
* @param {string} since
|
|
570
|
+
* @returns {boolean}
|
|
562
571
|
*/
|
|
563
|
-
function
|
|
572
|
+
function isReleaseSince(version, since) {
|
|
564
573
|
if (typeof version !== 'string' || !isValidSemver(version)) return false;
|
|
565
574
|
const [release, prerelease] = version.split('-', 2);
|
|
566
|
-
if (prerelease !== undefined && release ===
|
|
567
|
-
return semverGte(release,
|
|
575
|
+
if (prerelease !== undefined && release === since) return false;
|
|
576
|
+
return semverGte(release, since);
|
|
568
577
|
}
|
|
569
578
|
|
|
570
579
|
/**
|
|
@@ -578,13 +587,39 @@ function hasBuiltCheck(version) {
|
|
|
578
587
|
* @returns {boolean}
|
|
579
588
|
*/
|
|
580
589
|
export function projectHasBuiltCheck(dir) {
|
|
590
|
+
return installedCliHas(dir, BUILT_CHECK_SINCE);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/** The first release whose CLI has `experimental export`. */
|
|
594
|
+
const EXPORT_SINCE = '0.7.17';
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Whether the project at `dir` can run `astryx experimental export`, read from
|
|
598
|
+
* the CLI it installs, as {@link projectHasBuiltCheck} reads `doctor --built`.
|
|
599
|
+
*
|
|
600
|
+
* @param {string} dir
|
|
601
|
+
* @returns {boolean}
|
|
602
|
+
*/
|
|
603
|
+
export function projectHasExport(dir) {
|
|
604
|
+
return installedCliHas(dir, EXPORT_SINCE);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Whether the CLI the project at `dir` installs is release `since` or later.
|
|
609
|
+
* A canary of `since` itself is not: it may predate the feature.
|
|
610
|
+
*
|
|
611
|
+
* @param {string} dir
|
|
612
|
+
* @param {string} since
|
|
613
|
+
* @returns {boolean}
|
|
614
|
+
*/
|
|
615
|
+
function installedCliHas(dir, since) {
|
|
581
616
|
const installed = findInstalledPackage(dir, '@astryxdesign/cli');
|
|
582
617
|
if (!installed) return false;
|
|
583
618
|
try {
|
|
584
619
|
const {version} = JSON.parse(
|
|
585
620
|
fs.readFileSync(path.join(installed, 'package.json'), 'utf8'),
|
|
586
621
|
);
|
|
587
|
-
return
|
|
622
|
+
return isReleaseSince(version, since);
|
|
588
623
|
} catch {
|
|
589
624
|
return false;
|
|
590
625
|
}
|
|
@@ -625,7 +660,7 @@ export const ICON_FINDER_LINE =
|
|
|
625
660
|
* one; where it is off, the block has no icon line.
|
|
626
661
|
*
|
|
627
662
|
* @param {string | null} version the Core version
|
|
628
|
-
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}>, skills?: ReadonlyArray<{package: string, name: string, description: string}>, builtCheck?: boolean, iconFeatures?: boolean}} [options]
|
|
663
|
+
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}>, skills?: ReadonlyArray<{package: string, name: string, description: string}>, builtCheck?: boolean, iconFeatures?: boolean, exportCheck?: boolean}} [options]
|
|
629
664
|
* @returns {string}
|
|
630
665
|
*/
|
|
631
666
|
export function generateCompressedIndex(
|
|
@@ -639,6 +674,7 @@ export function generateCompressedIndex(
|
|
|
639
674
|
skills = [],
|
|
640
675
|
builtCheck = false,
|
|
641
676
|
iconFeatures = false,
|
|
677
|
+
exportCheck = false,
|
|
642
678
|
} = {},
|
|
643
679
|
) {
|
|
644
680
|
const run = invocation;
|
|
@@ -696,6 +732,9 @@ export function generateCompressedIndex(
|
|
|
696
732
|
if (builtCheck) {
|
|
697
733
|
lines.push("Before you deliver a build, run `astryx doctor --built <dir>`; don't deliver it if it fails.");
|
|
698
734
|
}
|
|
735
|
+
// Only for a project whose installed CLI has the command, as for the
|
|
736
|
+
// doctor line above.
|
|
737
|
+
if (exportCheck) lines.push(SHARE_LINE);
|
|
699
738
|
lines.push('');
|
|
700
739
|
|
|
701
740
|
// Rules — the top error-preventers.
|
|
@@ -870,6 +909,7 @@ export async function renderAgentDocsBlock(
|
|
|
870
909
|
description,
|
|
871
910
|
})),
|
|
872
911
|
builtCheck: projectHasBuiltCheck(targetDir),
|
|
912
|
+
exportCheck: projectHasExport(targetDir),
|
|
873
913
|
invocation: getCliInvocation(targetDir),
|
|
874
914
|
stylingSystem: detectStylingSystem(targetDir),
|
|
875
915
|
topics,
|
|
@@ -970,6 +1010,7 @@ export function injectAgentsMd(targetDir, version) {
|
|
|
970
1010
|
const compressedIndex = generateCompressedIndex(version, {
|
|
971
1011
|
coreDir: findCoreDir(targetDir),
|
|
972
1012
|
builtCheck: projectHasBuiltCheck(targetDir),
|
|
1013
|
+
exportCheck: projectHasExport(targetDir),
|
|
973
1014
|
stylingSystem: detectStylingSystem(targetDir),
|
|
974
1015
|
});
|
|
975
1016
|
injectXdsBlock(agentsPath, compressedIndex, {
|
|
@@ -991,6 +1032,7 @@ export function injectClaudeMd(targetDir, version) {
|
|
|
991
1032
|
const compressedIndex = generateCompressedIndex(version, {
|
|
992
1033
|
coreDir: findCoreDir(targetDir),
|
|
993
1034
|
builtCheck: projectHasBuiltCheck(targetDir),
|
|
1035
|
+
exportCheck: projectHasExport(targetDir),
|
|
994
1036
|
stylingSystem: detectStylingSystem(targetDir),
|
|
995
1037
|
});
|
|
996
1038
|
return injectXdsBlock(claudePath, compressedIndex);
|
|
@@ -1778,6 +1820,7 @@ export function installAgentDocs(
|
|
|
1778
1820
|
generateCompressedIndex(version, {
|
|
1779
1821
|
coreDir,
|
|
1780
1822
|
builtCheck: projectHasBuiltCheck(targetDir),
|
|
1823
|
+
exportCheck: projectHasExport(targetDir),
|
|
1781
1824
|
zh,
|
|
1782
1825
|
lang,
|
|
1783
1826
|
invocation,
|
|
@@ -33,7 +33,11 @@ export function providerLedgerOf(project: Project): import("../integrations/prov
|
|
|
33
33
|
* An integration issue tagged with the owner package. The base
|
|
34
34
|
* {@link import('../integrations/issue').AstryxIntegrationIssue} fields plus the
|
|
35
35
|
* `package` that produced it, which Project tracks for routing/dedup.
|
|
36
|
-
*
|
|
36
|
+
* `needsCore` marks one that compares a component with Core's components,
|
|
37
|
+
* which needs a Core to be judged. `needsCatalog` marks one found by
|
|
38
|
+
* resolving replacements against Core and the other packages the folder
|
|
39
|
+
* loads, which `doctor integration validate` does not do.
|
|
40
|
+
* @typedef {import('../integrations/issue').AstryxIntegrationIssue & {package: string, needsCore?: boolean, needsCatalog?: boolean}} ProjectIntegrationIssue
|
|
37
41
|
*/
|
|
38
42
|
/** Default issue tracker used when neither config nor integration routes one. */
|
|
39
43
|
export const DEFAULT_ISSUES_URL: "https://github.com/meta/astryx/issues/new";
|
|
@@ -292,9 +296,15 @@ export class Project {
|
|
|
292
296
|
* An integration issue tagged with the owner package. The base
|
|
293
297
|
* {@link import ('../integrations/issue').AstryxIntegrationIssue} fields plus the
|
|
294
298
|
* `package` that produced it, which Project tracks for routing/dedup.
|
|
299
|
+
* `needsCore` marks one that compares a component with Core's components,
|
|
300
|
+
* which needs a Core to be judged. `needsCatalog` marks one found by
|
|
301
|
+
* resolving replacements against Core and the other packages the folder
|
|
302
|
+
* loads, which `doctor integration validate` does not do.
|
|
295
303
|
*/
|
|
296
304
|
export type ProjectIntegrationIssue = import("../integrations/issue").AstryxIntegrationIssue & {
|
|
297
305
|
package: string;
|
|
306
|
+
needsCore?: boolean;
|
|
307
|
+
needsCatalog?: boolean;
|
|
298
308
|
};
|
|
299
309
|
import { DocsCatalog } from '../discovery/docs-discovery.mjs';
|
|
300
310
|
export { CONFIG_BASENAMES, findConfigPath } from "./config-path.mjs";
|
|
@@ -363,7 +363,11 @@ function readPackageJson(dir) {
|
|
|
363
363
|
* An integration issue tagged with the owner package. The base
|
|
364
364
|
* {@link import('../integrations/issue').AstryxIntegrationIssue} fields plus the
|
|
365
365
|
* `package` that produced it, which Project tracks for routing/dedup.
|
|
366
|
-
*
|
|
366
|
+
* `needsCore` marks one that compares a component with Core's components,
|
|
367
|
+
* which needs a Core to be judged. `needsCatalog` marks one found by
|
|
368
|
+
* resolving replacements against Core and the other packages the folder
|
|
369
|
+
* loads, which `doctor integration validate` does not do.
|
|
370
|
+
* @typedef {import('../integrations/issue').AstryxIntegrationIssue & {package: string, needsCore?: boolean, needsCatalog?: boolean}} ProjectIntegrationIssue
|
|
367
371
|
*/
|
|
368
372
|
|
|
369
373
|
/** Default issue tracker used when neither config nor integration routes one. */
|
|
@@ -798,7 +802,7 @@ export class Project {
|
|
|
798
802
|
/**
|
|
799
803
|
* Record a single integration issue, deduped by (package, code, message).
|
|
800
804
|
* @param {string} pkg
|
|
801
|
-
* @param {import('../integrations/issue').AstryxIntegrationIssue} issue
|
|
805
|
+
* @param {import('../integrations/issue').AstryxIntegrationIssue & {needsCore?: boolean, needsCatalog?: boolean}} issue
|
|
802
806
|
*/
|
|
803
807
|
#pushIssue(pkg, issue) {
|
|
804
808
|
const code = issue?.code ?? 'unknown';
|
|
@@ -812,6 +816,8 @@ export class Project {
|
|
|
812
816
|
code,
|
|
813
817
|
severity: issue?.severity ?? 'error',
|
|
814
818
|
message,
|
|
819
|
+
...(issue?.needsCore ? {needsCore: true} : {}),
|
|
820
|
+
...(issue?.needsCatalog ? {needsCatalog: true} : {}),
|
|
815
821
|
});
|
|
816
822
|
}
|
|
817
823
|
|
|
@@ -964,6 +970,8 @@ export class Project {
|
|
|
964
970
|
code: finding.code,
|
|
965
971
|
severity: finding.severity,
|
|
966
972
|
message: finding.message,
|
|
973
|
+
...(finding.needsCore ? {needsCore: true} : {}),
|
|
974
|
+
needsCatalog: true,
|
|
967
975
|
});
|
|
968
976
|
}
|
|
969
977
|
return replacements;
|
|
@@ -1039,6 +1047,7 @@ export class Project {
|
|
|
1039
1047
|
code: error.code,
|
|
1040
1048
|
severity: error.severity,
|
|
1041
1049
|
message: error.message,
|
|
1050
|
+
needsCatalog: true,
|
|
1042
1051
|
});
|
|
1043
1052
|
}
|
|
1044
1053
|
return effectiveTemplateDiscovery(resolved.templates);
|
|
@@ -24,14 +24,6 @@ export function componentReplacementsEnabled(pkg: any): boolean;
|
|
|
24
24
|
* @returns {Promise<ComponentReplacements>}
|
|
25
25
|
*/
|
|
26
26
|
export function resolveComponentReplacements(coreDir: string | null, loadedIntegrations: readonly LoadedIntegration[]): Promise<ComponentReplacements>;
|
|
27
|
-
/**
|
|
28
|
-
* The findings that compare a component with Core's components: a
|
|
29
|
-
* replacement target Core does not have, two replacements of one Core
|
|
30
|
-
* component, and a component named like a Core one. Without a Core they
|
|
31
|
-
* cannot be judged.
|
|
32
|
-
* @type {ReadonlySet<string>}
|
|
33
|
-
*/
|
|
34
|
-
export const CORE_COMPARISON_CODES: ReadonlySet<string>;
|
|
35
27
|
export type LoadedIntegration = import("../integrations/integrations.mjs").LoadedIntegration;
|
|
36
28
|
/**
|
|
37
29
|
* One Doctor finding about a component replacement.
|
|
@@ -55,6 +47,11 @@ export type ComponentReplacementFinding = {
|
|
|
55
47
|
* through `doctor integration components` and the pack check alone.
|
|
56
48
|
*/
|
|
57
49
|
optedIn: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* the finding compares the component with
|
|
52
|
+
* Core's components, so it cannot be judged without a Core
|
|
53
|
+
*/
|
|
54
|
+
needsCore?: boolean | undefined;
|
|
58
55
|
};
|
|
59
56
|
/**
|
|
60
57
|
* The integration component that answers to a Core component's name.
|
|
@@ -51,6 +51,8 @@ import {persistedGather} from '../fs/gather-cache.mjs';
|
|
|
51
51
|
* declares the CLI floor. Project issues and the everyday-command nudge
|
|
52
52
|
* carry only these; a package without the floor is reported to its author
|
|
53
53
|
* through `doctor integration components` and the pack check alone.
|
|
54
|
+
* @property {boolean} [needsCore] the finding compares the component with
|
|
55
|
+
* Core's components, so it cannot be judged without a Core
|
|
54
56
|
*/
|
|
55
57
|
|
|
56
58
|
/**
|
|
@@ -106,19 +108,6 @@ function packageJsonOf(integration) {
|
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
/**
|
|
110
|
-
* The findings that compare a component with Core's components: a
|
|
111
|
-
* replacement target Core does not have, two replacements of one Core
|
|
112
|
-
* component, and a component named like a Core one. Without a Core they
|
|
113
|
-
* cannot be judged.
|
|
114
|
-
* @type {ReadonlySet<string>}
|
|
115
|
-
*/
|
|
116
|
-
export const CORE_COMPARISON_CODES = new Set([
|
|
117
|
-
'missing_component_replacement_target',
|
|
118
|
-
'ambiguous_component_replacement',
|
|
119
|
-
'shadowed_component_name',
|
|
120
|
-
]);
|
|
121
|
-
|
|
122
111
|
/**
|
|
123
112
|
* Whether a package's declared CLI range turns its component replacements on.
|
|
124
113
|
* @param {any} pkg package.json
|
|
@@ -385,8 +374,10 @@ async function replacementsNow(coreDir, loadedIntegrations) {
|
|
|
385
374
|
* @param {Declaration} declaration
|
|
386
375
|
* @param {ComponentReplacementFinding['code']} code
|
|
387
376
|
* @param {string} message
|
|
377
|
+
* @param {boolean} [needsCore] it compares the component with Core's
|
|
378
|
+
* components, as every finding here does but a malformed `replaces`
|
|
388
379
|
*/
|
|
389
|
-
const report = (declaration, code, message) => {
|
|
380
|
+
const report = (declaration, code, message, needsCore = true) => {
|
|
390
381
|
findings.push({
|
|
391
382
|
package: declaration.package,
|
|
392
383
|
component: declaration.name,
|
|
@@ -394,6 +385,7 @@ async function replacementsNow(coreDir, loadedIntegrations) {
|
|
|
394
385
|
severity: declaration.optedIn ? 'error' : 'warning',
|
|
395
386
|
message,
|
|
396
387
|
optedIn: declaration.optedIn,
|
|
388
|
+
...(needsCore ? {needsCore: true} : {}),
|
|
397
389
|
});
|
|
398
390
|
};
|
|
399
391
|
|
|
@@ -425,9 +417,13 @@ async function replacementsNow(coreDir, loadedIntegrations) {
|
|
|
425
417
|
declaration,
|
|
426
418
|
'invalid_component_replacement',
|
|
427
419
|
`Component "${name}" sets \`replaces\` to ${JSON.stringify(replaces) ?? String(replaces)}. Set it to the exact name of one Core component, such as "SideNav".`,
|
|
420
|
+
false,
|
|
428
421
|
);
|
|
429
422
|
continue;
|
|
430
423
|
}
|
|
424
|
+
// With no Core there is nothing to compare the target with: only the
|
|
425
|
+
// opt-in and value findings above are computed.
|
|
426
|
+
if (!coreDir) continue;
|
|
431
427
|
if (!coreSet.has(replaces)) {
|
|
432
428
|
const differentCase = coreByKey.get(keyOf(replaces));
|
|
433
429
|
report(
|
|
@@ -543,6 +539,7 @@ async function replacementsNow(coreDir, loadedIntegrations) {
|
|
|
543
539
|
severity: 'warning',
|
|
544
540
|
message: `Core component "${target}" is replaced by ${packages}. ${reason}`,
|
|
545
541
|
optedIn: true,
|
|
542
|
+
needsCore: true,
|
|
546
543
|
});
|
|
547
544
|
}
|
|
548
545
|
const active = {
|
|
@@ -570,6 +567,7 @@ async function replacementsNow(coreDir, loadedIntegrations) {
|
|
|
570
567
|
severity: 'warning',
|
|
571
568
|
message: `Component "${native.name}" from ${native.package} is shadowed by "${winner.name}" from ${winner.package}, which replaces Core "${target}". Select it with --package ${native.package}.`,
|
|
572
569
|
optedIn: true,
|
|
570
|
+
needsCore: true,
|
|
573
571
|
});
|
|
574
572
|
}
|
|
575
573
|
}
|
|
@@ -58,6 +58,34 @@ export function resolveAugmentationTarget(coreRoot: string | null, component: st
|
|
|
58
58
|
* @returns {Promise<Set<string> | null>}
|
|
59
59
|
*/
|
|
60
60
|
export function propWideningInterfaces(coreRoot: string | null, pascalName: string, prop: string): Promise<Set<string> | null>;
|
|
61
|
+
/**
|
|
62
|
+
* @typedef {'string' | 'number' | 'boolean' | 'object' | 'array' | 'Date' | 'function'} ValueKind
|
|
63
|
+
* @typedef {{kinds: Set<ValueKind>, fields?: string[] | null, numbers: Set<number>, anyNumber: boolean}} PropKinds
|
|
64
|
+
*/
|
|
65
|
+
/**
|
|
66
|
+
* The kinds of value the declared type of `<pascalName prop>` takes, read
|
|
67
|
+
* from Core's source by the same reader as {@link propWideningInterfaces}: a
|
|
68
|
+
* string (a literal, a template, `keyof` a map), a number, a boolean, an
|
|
69
|
+
* object (with the field names of the first object shape it names), an
|
|
70
|
+
* array, a `Date` or a function. `null` and `undefined` add no kind. Null
|
|
71
|
+
* when any part of the type leads where this reader does not follow (a React
|
|
72
|
+
* type, a generic parameter, an enum): such a prop's kinds are not certain.
|
|
73
|
+
* @param {string | null} coreRoot the Core package root
|
|
74
|
+
* @param {string} pascalName
|
|
75
|
+
* @param {string} prop
|
|
76
|
+
* @returns {PropKinds | null}
|
|
77
|
+
*/
|
|
78
|
+
export function propValueKinds(coreRoot: string | null, pascalName: string, prop: string): PropKinds | null;
|
|
79
|
+
/**
|
|
80
|
+
* The first written kind a prop's declared kinds do not take, or null when
|
|
81
|
+
* the prop takes every one. An array, a `Date` or a function passes where
|
|
82
|
+
* the type takes an object, since an object shape this reader names may
|
|
83
|
+
* still accept one.
|
|
84
|
+
* @param {ValueKind[]} written
|
|
85
|
+
* @param {PropKinds} declared
|
|
86
|
+
* @returns {ValueKind | null}
|
|
87
|
+
*/
|
|
88
|
+
export function unacceptedKind(written: ValueKind[], declared: PropKinds): ValueKind | null;
|
|
61
89
|
/**
|
|
62
90
|
* The keys a project adds to Core's interfaces by module augmentation
|
|
63
91
|
* (`declare module '@astryxdesign/core/Button' { interface ButtonVariantMap
|
|
@@ -84,6 +112,13 @@ export function projectAugmentations(projectDir: string, file: string): {
|
|
|
84
112
|
complete: boolean;
|
|
85
113
|
files: string[];
|
|
86
114
|
};
|
|
115
|
+
export type ValueKind = "string" | "number" | "boolean" | "object" | "array" | "Date" | "function";
|
|
116
|
+
export type PropKinds = {
|
|
117
|
+
kinds: Set<ValueKind>;
|
|
118
|
+
fields?: string[] | null;
|
|
119
|
+
numbers: Set<number>;
|
|
120
|
+
anyNumber: boolean;
|
|
121
|
+
};
|
|
87
122
|
export type Declaration = {
|
|
88
123
|
node: any;
|
|
89
124
|
file: string;
|