@astryxdesign/cli 0.7.3 → 0.7.4-canary.1a552f2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -63
- package/api/component/_adapter.mjs +4 -3
- package/api/component/component.mjs +13 -6
- package/api/component/doc-links.test.mjs +33 -0
- package/api/discover/_adapter.mjs +22 -10
- package/api/discover/_catalog-view.d.mts +2 -0
- package/api/discover/_catalog-view.mjs +1 -0
- package/api/discover/_catalog-view.test.mjs +1 -0
- package/api/discover/detail/detail.mjs +1 -0
- package/api/discover/detail/detail.test.mjs +3 -0
- package/api/discover/detail/doc/doc.mjs +5 -1
- package/api/discover/detail/doc/doc.test.mjs +1 -0
- package/api/discover/detail/item/item.mjs +2 -0
- package/api/discover/detail/item/item.test.mjs +2 -0
- package/api/discover/discover.doc.mjs +4 -4
- package/api/discover/discover.type.d.mts +20 -0
- package/api/discover/discover.type.mjs +5 -0
- package/api/discover/list/list.test.mjs +2 -0
- package/api/discover/search/search.d.mts +3 -2
- package/api/discover/search/search.mjs +26 -7
- package/api/discover/search/search.test.mjs +67 -0
- package/api/docs/_adapter.d.mts +80 -0
- package/api/docs/_adapter.mjs +261 -11
- package/api/docs/detail/detail.mjs +8 -0
- package/api/docs/docOverlays.test.mjs +2 -1
- package/api/docs/docs.d.mts +16 -6
- package/api/docs/docs.doc.mjs +1 -1
- package/api/docs/docs.mjs +55 -6
- package/api/docs/docs.type.d.mts +28 -2
- package/api/docs/docs.type.mjs +13 -3
- package/api/docs/guide-route-targets.test.mjs +1002 -0
- package/api/docs/index/index.mjs +9 -0
- package/api/docs/integration-tree.test.mjs +22 -0
- package/api/docs/integrationDocs.test.mjs +85 -0
- package/api/docs/list/list.mjs +7 -1
- package/api/docs/node/node.mjs +9 -1
- package/api/docs/reference-blocks.test.mjs +1 -1
- package/api/doctor/_adapter.d.mts +40 -0
- package/api/doctor/_adapter.mjs +171 -1
- package/api/doctor/built-checks.d.mts +85 -0
- package/api/doctor/built-checks.mjs +837 -0
- package/api/doctor/built-checks.test.mjs +531 -0
- package/api/doctor/doctor.d.mts +6 -5
- package/api/doctor/doctor.doc.mjs +11 -1
- package/api/doctor/doctor.mjs +18 -3
- package/api/doctor/doctor.type.d.mts +6 -0
- package/api/doctor/doctor.type.mjs +3 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/integration/_adapter.d.mts +11 -2
- package/api/integration/_adapter.mjs +30 -4
- package/api/integration/authoring-checks.mjs +29 -2
- package/api/integration/authoring-checks.test.mjs +131 -1
- package/api/integration/check/check.d.mts +4 -1
- package/api/integration/check/check.mjs +34 -4
- package/api/integration/check/check.test.mjs +49 -0
- package/api/integration/integration-check.type.d.mts +8 -0
- package/api/integration/integration-check.type.mjs +4 -1
- package/api/integration/integrationCheck.doc.mjs +8 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +71 -2
- package/api/integration/pack-check.test.mjs +77 -0
- package/api/integration/validate-integration-case-disk.test.mjs +2 -0
- package/api/integration/validate-integration-gaps.test.mjs +7 -4
- package/api/integration/validate-integration.mjs +96 -14
- package/api/integration/validate-integration.type.d.mts +10 -4
- package/api/integration/validate-integration.type.mjs +10 -5
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_candidate-score.d.mts +3 -2
- package/api/search/_candidate-score.mjs +66 -3
- package/api/search/_gather-docs.mjs +12 -2
- package/api/search/_priority.mjs +2 -1
- package/api/search/_score.d.mts +2 -1
- package/api/search/_score.mjs +2 -2
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.family-members.test.mjs +124 -0
- package/api/search/search.mjs +28 -0
- package/api/theme/palette/generate/generate.d.mts +8 -0
- package/api/theme/palette/generate/generate.mjs +38 -11
- package/api/theme/palette/generate/generate.test.mjs +83 -4
- package/api/theme/palette/generate/generator.d.mts +6 -0
- package/api/theme/palette/generate/generator.mjs +6 -0
- package/api/theme/theme.type.d.mts +12 -1
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme/themeTargets.doc.mjs +1 -1
- package/assets/discover/official-packages.json +16 -0
- package/assets/docs/author-a-theme.doc.mjs +15 -15
- package/assets/docs/browser-support.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +16 -16
- package/assets/docs/is-my-code-good.doc.mjs +6 -6
- package/assets/docs/styling-overview.doc.mjs +5 -5
- package/assets/docs/theme.doc.mjs +5 -5
- package/assets/docs/tree/add-a-component.doc.mjs +1 -1
- package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/add-a-topic.doc.mjs +6 -6
- package/assets/docs/tree/agent-guidance.doc.mjs +5 -5
- package/assets/docs/tree/authoring.doc.mjs +2 -2
- package/assets/docs/tree/block-template.doc.mjs +1 -1
- package/assets/docs/tree/check-the-props.doc.mjs +3 -3
- package/assets/docs/tree/check-your-docs.doc.mjs +6 -6
- package/assets/docs/tree/checks.doc.mjs +11 -11
- package/assets/docs/tree/ci-and-containers.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +6 -6
- package/assets/docs/tree/codemods.doc.mjs +7 -7
- package/assets/docs/tree/component-family.doc.mjs +1 -1
- package/assets/docs/tree/component-imports.doc.mjs +2 -2
- package/assets/docs/tree/component-lookups.doc.mjs +6 -5
- package/assets/docs/tree/computer-agent-guide.doc.mjs +7 -7
- package/assets/docs/tree/computer-integrations.doc.mjs +5 -5
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +3 -3
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
- package/assets/docs/tree/doc-syntax.doc.mjs +219 -0
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +39 -7
- package/assets/docs/tree/font-setup.doc.mjs +1 -1
- package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
- package/assets/docs/tree/global-integrations.doc.mjs +11 -11
- package/assets/docs/tree/global.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +1 -1
- package/assets/docs/tree/install-once.doc.mjs +4 -4
- package/assets/docs/tree/layout.doc.mjs +1 -1
- package/assets/docs/tree/links.doc.mjs +2 -2
- package/assets/docs/tree/migration-setup.doc.mjs +15 -15
- package/assets/docs/tree/migration.doc.mjs +2 -1
- package/assets/docs/tree/other-libraries.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +2 -2
- package/assets/docs/tree/problems.doc.mjs +8 -8
- package/assets/docs/tree/project-global-or-both.doc.mjs +2 -2
- package/assets/docs/tree/publishing.doc.mjs +7 -7
- package/assets/docs/tree/quick-start.doc.mjs +9 -9
- package/assets/docs/tree/reference.doc.mjs +2 -2
- package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
- package/assets/docs/tree/replace-a-core-template.doc.mjs +4 -4
- package/assets/docs/tree/scaffold.doc.mjs +1 -1
- package/assets/docs/tree/sections-and-placement.doc.mjs +3 -3
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +3 -3
- package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
- package/assets/docs/tree/single-component.doc.mjs +4 -4
- package/assets/docs/tree/start-a-template.doc.mjs +5 -5
- package/assets/docs/tree/styling-advanced.doc.mjs +1 -1
- package/assets/docs/tree/styling-libraries.doc.mjs +2 -1
- package/assets/docs/tree/styling.doc.mjs +1 -1
- package/assets/docs/tree/tailwind.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +5 -5
- package/assets/docs/tree/test-template-in-app.doc.mjs +6 -6
- package/assets/docs/tree/tokens-and-setup.doc.mjs +1 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +24 -20
- package/assets/docs/tree/uninstall.doc.mjs +2 -2
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/upgrading.doc.mjs +3 -3
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/verify-packed-template.doc.mjs +3 -3
- package/assets/docs/tree/versioning.doc.mjs +4 -4
- package/assets/docs/tree/who-answers.doc.mjs +4 -4
- package/assets/docs/tree/write-the-template-file.doc.mjs +4 -4
- package/assets/docs/use-a-theme.doc.mjs +10 -10
- package/assets/docs/use-integrations.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +15 -15
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +1 -1
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +1 -1
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +54 -0
- package/assets/templates/themes/butter/butterPalettes.generated.receipt.json +1499 -0
- package/assets/templates/themes/butter/butterPalettes.generated.ts +550 -0
- package/assets/templates/themes/butter/butterTheme.ts +274 -234
- package/assets/templates/themes/butter/palette.config.json +484 -0
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +41 -0
- package/assets/templates/themes/gothic/gothicPalettes.generated.receipt.json +979 -0
- package/assets/templates/themes/gothic/gothicPalettes.generated.ts +271 -0
- package/assets/templates/themes/gothic/gothicTheme.ts +130 -160
- package/assets/templates/themes/gothic/palette.config.json +371 -0
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +51 -0
- package/assets/templates/themes/matcha/matchaPalettes.generated.receipt.json +1502 -0
- package/assets/templates/themes/matcha/matchaPalettes.generated.ts +501 -0
- package/assets/templates/themes/matcha/matchaPalettes.ts +21 -0
- package/assets/templates/themes/matcha/matchaTheme.ts +164 -103
- package/assets/templates/themes/matcha/palette.config.json +448 -0
- package/assets/templates/themes/stone/palette.config.json +262 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +51 -0
- package/assets/templates/themes/stone/stonePalettes.generated.receipt.json +840 -0
- package/assets/templates/themes/stone/stonePalettes.generated.ts +501 -0
- package/assets/templates/themes/stone/stoneTheme.ts +190 -207
- package/assets/templates/themes/y2k/palette.config.json +166 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +54 -0
- package/assets/templates/themes/y2k/y2kPalettes.generated.receipt.json +872 -0
- package/assets/templates/themes/y2k/y2kPalettes.generated.ts +550 -0
- package/assets/templates/themes/y2k/y2kPalettes.ts +257 -0
- package/assets/templates/themes/y2k/y2kTheme.ts +164 -391
- package/authoring/codemod/codemod.doc.mjs +1 -1
- package/authoring/config/config.doc.mjs +4 -4
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/discover/discover.doc.mjs +1 -1
- package/authoring/doctypes/_schema.d.mts +4 -0
- package/authoring/doctypes/_schema.mjs +4 -0
- package/authoring/doctypes/reference/type.ts +14 -2
- package/authoring/gap-report/gap-report.doc.mjs +1 -1
- package/authoring/integration/integration.doc.mjs +6 -6
- package/clients/cli/commands/discover.mjs +1 -1
- package/clients/cli/commands/discover.sources.test.mjs +6 -0
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +27 -2
- package/clients/cli/commands/docs.test.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor.doc.mjs +13 -1
- package/clients/cli/commands/doctor.mjs +25 -9
- package/clients/cli/commands/integration-check.doc.mjs +11 -0
- package/clients/cli/commands/integration-check.test.mjs +36 -3
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-verify.doc.mjs +1 -1
- package/clients/cli/commands/integration.mjs +15 -3
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.doc.mjs +2 -2
- package/clients/cli/lib/define-command.mjs +5 -3
- package/foundation/agent-docs/agent-docs.d.mts +14 -2
- package/foundation/agent-docs/agent-docs.mjs +65 -4
- package/foundation/agent-docs/agent-docs.test.mjs +107 -0
- package/foundation/discovery/docs-discovery.d.mts +93 -2
- package/foundation/discovery/docs-discovery.mjs +237 -8
- package/foundation/discovery/runner-allowlist.d.mts +2 -0
- package/foundation/discovery/runner-allowlist.mjs +4 -0
- package/foundation/discovery/runner-commands.d.mts +29 -13
- package/foundation/discovery/runner-commands.mjs +253 -17
- package/foundation/discovery/stray-pointers.mjs +11 -5
- package/foundation/discovery/stray-pointers.test.mjs +6 -0
- package/foundation/doc-compiler/compile.mjs +8 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +3 -0
- package/foundation/doc-compiler/doc-syntax.d.mts +194 -0
- package/foundation/doc-compiler/doc-syntax.mjs +739 -0
- package/foundation/doc-compiler/doc-syntax.test.mjs +383 -0
- package/foundation/doc-compiler/links.d.mts +13 -16
- package/foundation/doc-compiler/links.mjs +40 -7
- package/foundation/doc-compiler/tree.d.mts +5 -0
- package/foundation/doc-compiler/tree.mjs +9 -0
- package/foundation/env/package-manager.d.mts +18 -0
- package/foundation/env/package-manager.mjs +40 -0
- package/foundation/integrations/cli-requirement.d.mts +29 -0
- package/foundation/integrations/cli-requirement.mjs +47 -0
- package/foundation/integrations/cli-requirement.test.mjs +23 -2
- package/foundation/response/error-codes.test.mjs +9 -0
- package/foundation/response/response-types.doc.mjs +11 -11
- package/foundation/response/response-types.doc.test.mjs +29 -0
- package/package.json +9 -9
|
@@ -101,6 +101,17 @@ export function resolveAgentPaths(targetDir: string, agent: string): {
|
|
|
101
101
|
* @returns {'stylex' | 'tailwind' | 'css'}
|
|
102
102
|
*/
|
|
103
103
|
export function detectStylingSystem(targetDir: string): "stylex" | "tailwind" | "css";
|
|
104
|
+
/**
|
|
105
|
+
* Whether the project at `dir` can run `astryx doctor --built`: the CLI it
|
|
106
|
+
* installs, which answers it whatever the running copy is, has the option.
|
|
107
|
+
* Read from the installed CLI (the folder's own, or its workspace's), never
|
|
108
|
+
* from declared ranges or the running copy, so a block written before
|
|
109
|
+
* install, or by a newer copy, never names an option the project's CLI
|
|
110
|
+
* rejects; the next `init` or `upgrade --apply` after install adds it.
|
|
111
|
+
* @param {string} dir
|
|
112
|
+
* @returns {boolean}
|
|
113
|
+
*/
|
|
114
|
+
export function projectHasBuiltCheck(dir: string): boolean;
|
|
104
115
|
/**
|
|
105
116
|
* Generate the agent cheat sheet from live CLI metadata.
|
|
106
117
|
*
|
|
@@ -125,10 +136,10 @@ export function detectStylingSystem(targetDir: string): "stylex" | "tailwind" |
|
|
|
125
136
|
* `getting-started` is the one it should reach for first.
|
|
126
137
|
*
|
|
127
138
|
* @param {string | null} version the Core version
|
|
128
|
-
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}
|
|
139
|
+
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}>, builtCheck?: boolean}} [options]
|
|
129
140
|
* @returns {string}
|
|
130
141
|
*/
|
|
131
|
-
export function generateCompressedIndex(version: string | null, { coreDir, invocation, stylingSystem, topics, agentDocs, }?: {
|
|
142
|
+
export function generateCompressedIndex(version: string | null, { coreDir, invocation, stylingSystem, topics, agentDocs, builtCheck, }?: {
|
|
132
143
|
coreDir?: string | null;
|
|
133
144
|
invocation?: string;
|
|
134
145
|
stylingSystem?: "stylex" | "tailwind" | "css";
|
|
@@ -139,6 +150,7 @@ export function generateCompressedIndex(version: string | null, { coreDir, invoc
|
|
|
139
150
|
package: string;
|
|
140
151
|
append: readonly string[];
|
|
141
152
|
}>;
|
|
153
|
+
builtCheck?: boolean;
|
|
142
154
|
}): string;
|
|
143
155
|
/**
|
|
144
156
|
* Resolve the complete expected block for one installed project.
|
|
@@ -33,10 +33,15 @@ import {spawnSync} from 'node:child_process';
|
|
|
33
33
|
import * as fs from 'node:fs';
|
|
34
34
|
import * as os from 'node:os';
|
|
35
35
|
import * as path from 'node:path';
|
|
36
|
-
import {findCoreDir, CLI_ROOT} from '../fs/paths.mjs';
|
|
36
|
+
import {findCoreDir, findInstalledPackage, CLI_ROOT} from '../fs/paths.mjs';
|
|
37
37
|
import {assertWithin, PathSafetyError} from '../fs/path-safety.mjs';
|
|
38
38
|
import {createFileProtectionResolver} from '../fs/file-protection.mjs';
|
|
39
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
docPackageManager,
|
|
41
|
+
getCliInvocation,
|
|
42
|
+
} from '../env/package-manager.mjs';
|
|
43
|
+
import {renderCommandTokens} from '../doc-compiler/doc-syntax.mjs';
|
|
44
|
+
import {isValidSemver, semverGte} from '../env/semver.mjs';
|
|
40
45
|
import {discoverComponents} from '../discovery/component-discovery.mjs';
|
|
41
46
|
import {Project} from '../config/project.mjs';
|
|
42
47
|
import {cliRootNamespaceNames} from '../doc-compiler/tree.mjs';
|
|
@@ -683,6 +688,45 @@ export function detectStylingSystem(targetDir) {
|
|
|
683
688
|
}
|
|
684
689
|
}
|
|
685
690
|
|
|
691
|
+
/** The first release whose `doctor` takes `--built`. */
|
|
692
|
+
const BUILT_CHECK_SINCE = '0.7.4';
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Whether a project on this Core release can run `astryx doctor --built`. A
|
|
696
|
+
* prerelease of the first release is below it: its canaries predate the
|
|
697
|
+
* option.
|
|
698
|
+
* @param {string | null | undefined} version
|
|
699
|
+
*/
|
|
700
|
+
function hasBuiltCheck(version) {
|
|
701
|
+
if (typeof version !== 'string' || !isValidSemver(version)) return false;
|
|
702
|
+
const [release, prerelease] = version.split('-', 2);
|
|
703
|
+
if (prerelease !== undefined && release === BUILT_CHECK_SINCE) return false;
|
|
704
|
+
return semverGte(release, BUILT_CHECK_SINCE);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Whether the project at `dir` can run `astryx doctor --built`: the CLI it
|
|
709
|
+
* installs, which answers it whatever the running copy is, has the option.
|
|
710
|
+
* Read from the installed CLI (the folder's own, or its workspace's), never
|
|
711
|
+
* from declared ranges or the running copy, so a block written before
|
|
712
|
+
* install, or by a newer copy, never names an option the project's CLI
|
|
713
|
+
* rejects; the next `init` or `upgrade --apply` after install adds it.
|
|
714
|
+
* @param {string} dir
|
|
715
|
+
* @returns {boolean}
|
|
716
|
+
*/
|
|
717
|
+
export function projectHasBuiltCheck(dir) {
|
|
718
|
+
const installed = findInstalledPackage(dir, '@astryxdesign/cli');
|
|
719
|
+
if (!installed) return false;
|
|
720
|
+
try {
|
|
721
|
+
const {version} = JSON.parse(
|
|
722
|
+
fs.readFileSync(path.join(installed, 'package.json'), 'utf8'),
|
|
723
|
+
);
|
|
724
|
+
return hasBuiltCheck(version);
|
|
725
|
+
} catch {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
686
730
|
/**
|
|
687
731
|
* Generate the agent cheat sheet from live CLI metadata.
|
|
688
732
|
*
|
|
@@ -707,7 +751,7 @@ export function detectStylingSystem(targetDir) {
|
|
|
707
751
|
* `getting-started` is the one it should reach for first.
|
|
708
752
|
*
|
|
709
753
|
* @param {string | null} version the Core version
|
|
710
|
-
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}
|
|
754
|
+
* @param {{coreDir?: string|null, invocation?: string, stylingSystem?: 'stylex'|'tailwind'|'css', zh?: boolean, lang?: string, topics?: string[], agentDocs?: Array<{package: string, append: readonly string[]}>, builtCheck?: boolean}} [options]
|
|
711
755
|
* @returns {string}
|
|
712
756
|
*/
|
|
713
757
|
export function generateCompressedIndex(
|
|
@@ -718,6 +762,7 @@ export function generateCompressedIndex(
|
|
|
718
762
|
stylingSystem = 'css',
|
|
719
763
|
topics,
|
|
720
764
|
agentDocs = [],
|
|
765
|
+
builtCheck = false,
|
|
721
766
|
} = {},
|
|
722
767
|
) {
|
|
723
768
|
const run = invocation;
|
|
@@ -767,6 +812,13 @@ export function generateCompressedIndex(
|
|
|
767
812
|
// intentionally omitted from the command reference below.
|
|
768
813
|
lines.push(WORKFLOW_TITLE, ...WORKFLOW_STEPS);
|
|
769
814
|
lines.push('Changing an existing page? Keep it: skip step 2 and add blocks/components inside its sections.');
|
|
815
|
+
// Only for a project whose recorded releases have `doctor --built`
|
|
816
|
+
// (projectHasBuiltCheck): a newer copy may write this block in a project
|
|
817
|
+
// whose install then brings an older CLI, which rejects the option. The computer-level
|
|
818
|
+
// skill names only entry points every release keeps (AST-081 FR8).
|
|
819
|
+
if (builtCheck) {
|
|
820
|
+
lines.push("Before you deliver a build, run `astryx doctor --built <dir>`; don't deliver it if it fails.");
|
|
821
|
+
}
|
|
770
822
|
lines.push('');
|
|
771
823
|
|
|
772
824
|
// Rules — the top error-preventers.
|
|
@@ -896,8 +948,13 @@ export async function renderAgentDocsBlock(
|
|
|
896
948
|
.map(input => input.doc.name),
|
|
897
949
|
),
|
|
898
950
|
];
|
|
951
|
+
// Doc tokens in an integration's lines render here, for the project's
|
|
952
|
+
// package manager; the block's header names the runner for bare commands.
|
|
953
|
+
const tokenOptions = {stem: 'astryx', pm: docPackageManager(targetDir)};
|
|
899
954
|
const agentDocs = project.loadedIntegrations.flatMap(integration => {
|
|
900
|
-
const append = integration.agentDocs?.append ?? []
|
|
955
|
+
const append = (integration.agentDocs?.append ?? []).map(line =>
|
|
956
|
+
renderCommandTokens(line, tokenOptions),
|
|
957
|
+
);
|
|
901
958
|
if (append.length === 0) return [];
|
|
902
959
|
return [
|
|
903
960
|
{
|
|
@@ -911,6 +968,7 @@ export async function renderAgentDocsBlock(
|
|
|
911
968
|
|
|
912
969
|
return generateCompressedIndex(version, {
|
|
913
970
|
coreDir,
|
|
971
|
+
builtCheck: projectHasBuiltCheck(targetDir),
|
|
914
972
|
invocation: getCliInvocation(targetDir),
|
|
915
973
|
stylingSystem: detectStylingSystem(targetDir),
|
|
916
974
|
topics,
|
|
@@ -999,6 +1057,7 @@ export function injectAgentsMd(targetDir, version) {
|
|
|
999
1057
|
const agentsPath = path.join(targetDir, AGENTS_MD);
|
|
1000
1058
|
const compressedIndex = generateCompressedIndex(version, {
|
|
1001
1059
|
coreDir: findCoreDir(targetDir),
|
|
1060
|
+
builtCheck: projectHasBuiltCheck(targetDir),
|
|
1002
1061
|
stylingSystem: detectStylingSystem(targetDir),
|
|
1003
1062
|
});
|
|
1004
1063
|
injectXdsBlock(agentsPath, compressedIndex, {
|
|
@@ -1019,6 +1078,7 @@ export function injectClaudeMd(targetDir, version) {
|
|
|
1019
1078
|
const claudePath = path.join(targetDir, CLAUDE_MD);
|
|
1020
1079
|
const compressedIndex = generateCompressedIndex(version, {
|
|
1021
1080
|
coreDir: findCoreDir(targetDir),
|
|
1081
|
+
builtCheck: projectHasBuiltCheck(targetDir),
|
|
1022
1082
|
stylingSystem: detectStylingSystem(targetDir),
|
|
1023
1083
|
});
|
|
1024
1084
|
return injectXdsBlock(claudePath, compressedIndex);
|
|
@@ -1743,6 +1803,7 @@ export function installAgentDocs(
|
|
|
1743
1803
|
renderedBlock ??
|
|
1744
1804
|
generateCompressedIndex(version, {
|
|
1745
1805
|
coreDir,
|
|
1806
|
+
builtCheck: projectHasBuiltCheck(targetDir),
|
|
1746
1807
|
zh,
|
|
1747
1808
|
lang,
|
|
1748
1809
|
invocation,
|
|
@@ -4,8 +4,10 @@ import {describe, it, expect, beforeEach, afterEach, vi} from 'vitest';
|
|
|
4
4
|
import * as fs from 'node:fs';
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
import * as os from 'node:os';
|
|
7
|
+
import {renderComputerAgentText} from './computer-agent-text.mjs';
|
|
7
8
|
import {
|
|
8
9
|
generateCompressedIndex,
|
|
10
|
+
projectHasBuiltCheck,
|
|
9
11
|
detectStylingSystem,
|
|
10
12
|
getXdsVersion,
|
|
11
13
|
installAgentDocs,
|
|
@@ -95,6 +97,65 @@ describe('generateCompressedIndex', () => {
|
|
|
95
97
|
expect(result).toContain('<!-- ASTRYX:END -->');
|
|
96
98
|
});
|
|
97
99
|
|
|
100
|
+
it('tells agents to check a build with doctor --built; the computer-level skill does not', () => {
|
|
101
|
+
const line =
|
|
102
|
+
"Before you deliver a build, run `astryx doctor --built <dir>`; don't deliver it if it fails.";
|
|
103
|
+
expect(generateCompressedIndex('0.7.4', {builtCheck: true})).toContain(line);
|
|
104
|
+
expect(generateCompressedIndex('0.7.4')).not.toContain('doctor --built');
|
|
105
|
+
expect(renderComputerAgentText({command: 'astryx'})).not.toContain(
|
|
106
|
+
'doctor --built',
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('projectHasBuiltCheck reads the CLI the project installs', () => {
|
|
111
|
+
/**
|
|
112
|
+
* @param {string | null} cliVersion the installed CLI, or none
|
|
113
|
+
* @param {{workspace?: boolean}} [options] install it at a workspace root
|
|
114
|
+
*/
|
|
115
|
+
const project = (cliVersion, {workspace = false} = {}) => {
|
|
116
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-built-check-'));
|
|
117
|
+
const app = workspace ? path.join(root, 'apps', 'web') : root;
|
|
118
|
+
fs.mkdirSync(app, {recursive: true});
|
|
119
|
+
if (workspace) {
|
|
120
|
+
fs.writeFileSync(
|
|
121
|
+
path.join(root, 'package.json'),
|
|
122
|
+
JSON.stringify({name: 'repo', private: true, workspaces: ['apps/*'], devDependencies: {'@astryxdesign/cli': cliVersion ?? '0.7.3'}}),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
fs.writeFileSync(
|
|
126
|
+
path.join(app, 'package.json'),
|
|
127
|
+
JSON.stringify({name: 'web', dependencies: {'@astryxdesign/core': '0.7.4'}}),
|
|
128
|
+
);
|
|
129
|
+
if (cliVersion) {
|
|
130
|
+
const cliDir = path.join(root, 'node_modules', '@astryxdesign', 'cli');
|
|
131
|
+
fs.mkdirSync(cliDir, {recursive: true});
|
|
132
|
+
fs.writeFileSync(
|
|
133
|
+
path.join(cliDir, 'package.json'),
|
|
134
|
+
JSON.stringify({name: '@astryxdesign/cli', version: cliVersion}),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return {root, app};
|
|
138
|
+
};
|
|
139
|
+
it.each([
|
|
140
|
+
['an installed CLI 0.7.4', '0.7.4', {}, true],
|
|
141
|
+
['an installed CLI 0.8.0', '0.8.0', {}, true],
|
|
142
|
+
['an installed CLI 0.7.3', '0.7.3', {}, false],
|
|
143
|
+
['an installed 0.7.4 canary', '0.7.4-canary.b25f95e', {}, false],
|
|
144
|
+
['no installed CLI (before install, or Core only)', null, {}, false],
|
|
145
|
+
['a workspace root that installs CLI 0.7.3', '0.7.3', {workspace: true}, false],
|
|
146
|
+
['a workspace root that installs CLI 0.7.4', '0.7.4', {workspace: true}, true],
|
|
147
|
+
])('%s', (_label, cliVersion, options, expected) => {
|
|
148
|
+
const {root, app} = project(cliVersion, options);
|
|
149
|
+
try {
|
|
150
|
+
expect(projectHasBuiltCheck(app)).toBe(expected);
|
|
151
|
+
} finally {
|
|
152
|
+
fs.rmSync(root, {recursive: true, force: true});
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
98
159
|
it('includes theme nudge rule', () => {
|
|
99
160
|
const result = generateCompressedIndex('1.0.0');
|
|
100
161
|
expect(result).toMatch(/astryx docs theme/);
|
|
@@ -370,6 +431,52 @@ describe('renderAgentDocsBlock', () => {
|
|
|
370
431
|
fs.rmSync(projectDir, {recursive: true, force: true});
|
|
371
432
|
}
|
|
372
433
|
});
|
|
434
|
+
it('renders doc tokens in an integration line for the project', async () => {
|
|
435
|
+
const projectDir = fs.mkdtempSync(
|
|
436
|
+
path.join(process.cwd(), '.astryx-agent-doc-tokens-'),
|
|
437
|
+
);
|
|
438
|
+
try {
|
|
439
|
+
fs.writeFileSync(
|
|
440
|
+
path.join(projectDir, 'package.json'),
|
|
441
|
+
JSON.stringify({name: 'consumer'}),
|
|
442
|
+
);
|
|
443
|
+
fs.writeFileSync(path.join(projectDir, 'bun.lock'), '{}\n');
|
|
444
|
+
fs.writeFileSync(
|
|
445
|
+
path.join(projectDir, 'astryx.config.mjs'),
|
|
446
|
+
`export default {integrations: ['@acme/kit']};\n`,
|
|
447
|
+
);
|
|
448
|
+
const coreDir = path.join(
|
|
449
|
+
projectDir,
|
|
450
|
+
'node_modules',
|
|
451
|
+
'@astryxdesign',
|
|
452
|
+
'core',
|
|
453
|
+
);
|
|
454
|
+
fs.mkdirSync(coreDir, {recursive: true});
|
|
455
|
+
fs.writeFileSync(
|
|
456
|
+
path.join(coreDir, 'package.json'),
|
|
457
|
+
JSON.stringify({name: '@astryxdesign/core', version: '1.0.0'}),
|
|
458
|
+
);
|
|
459
|
+
const packageDir = path.join(projectDir, 'node_modules', '@acme', 'kit');
|
|
460
|
+
fs.mkdirSync(packageDir, {recursive: true});
|
|
461
|
+
fs.writeFileSync(
|
|
462
|
+
path.join(packageDir, 'package.json'),
|
|
463
|
+
JSON.stringify({name: '@acme/kit'}),
|
|
464
|
+
);
|
|
465
|
+
fs.writeFileSync(
|
|
466
|
+
path.join(packageDir, 'astryx.integration.mjs'),
|
|
467
|
+
`export default {agentDocs: {append: ['Add it with {@pm install @acme/kit}, then run {@command doctor}.']}};\n`,
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
const block = await renderAgentDocsBlock(projectDir);
|
|
471
|
+
expect(block).toContain(
|
|
472
|
+
'- `@acme/kit`: Add it with `bun add @acme/kit`, then run `astryx doctor`.',
|
|
473
|
+
);
|
|
474
|
+
expect(block).not.toContain('{@');
|
|
475
|
+
} finally {
|
|
476
|
+
fs.rmSync(projectDir, {recursive: true, force: true});
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
|
|
373
480
|
it('rejects a package label that could alter managed block structure', async () => {
|
|
374
481
|
const projectDir = fs.mkdtempSync(
|
|
375
482
|
path.join(process.cwd(), '.astryx-agent-doc-label-'),
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Whether a `replaces` or `extends` names a route of the docs tree rather than
|
|
6
|
+
* a flat topic: a topic name never holds a `/`, and a guide the tree places is
|
|
7
|
+
* always read by a route that does.
|
|
8
|
+
* @param {unknown} target
|
|
9
|
+
* @returns {target is string}
|
|
10
|
+
*/
|
|
11
|
+
export function isGuideRoute(target: unknown): target is string;
|
|
12
|
+
/**
|
|
13
|
+
* What the integrations do to one guide the docs tree places, in configured
|
|
14
|
+
* order: a replacement, and the extensions merged onto whatever is there.
|
|
15
|
+
* @typedef {object} GuideOverlay
|
|
16
|
+
* @property {DocsTopicRecord | null} replacement the doc readers get at the
|
|
17
|
+
* route instead of the guide; the last package configured wins
|
|
18
|
+
* @property {Array<{package: string, path: string, providerId?: string}>} extensions
|
|
19
|
+
* extensions authored after the replacement, if any, in configured order
|
|
20
|
+
* @property {string} [replacedPackage] the package of the replacement this one
|
|
21
|
+
* took over from, when the guide was replaced twice
|
|
22
|
+
*/
|
|
4
23
|
/**
|
|
5
24
|
* @typedef {object} DocsTopicRecord A doc file discovered under a docs root.
|
|
6
25
|
* @property {string} name
|
|
@@ -25,6 +44,8 @@
|
|
|
25
44
|
* @property {string} [description]
|
|
26
45
|
* @property {string|null} [category]
|
|
27
46
|
* @property {string} [replaces] the topic this one took the place of
|
|
47
|
+
* @property {string} [replacedPackage] the package whose topic or guide this
|
|
48
|
+
* one took the place of
|
|
28
49
|
* @property {Array<{package: string, path: string, providerId?: string}>} extensions
|
|
29
50
|
* overlays to merge onto the base doc, in the order their integrations were
|
|
30
51
|
* configured; each section an extension adds resolves its links against the
|
|
@@ -108,8 +129,9 @@ export function discoverIntegrationDocs(integration: {
|
|
|
108
129
|
/**
|
|
109
130
|
* Merge an extension onto a base topic: a section with a stable `id` replaces
|
|
110
131
|
* the base section with the same `id`; legacy sections without IDs fall back to
|
|
111
|
-
* title matching. A section with no match is
|
|
112
|
-
*
|
|
132
|
+
* title matching. A section with no match is added: before or after the
|
|
133
|
+
* section whose key its `before` or `after` names, else at the end. The title
|
|
134
|
+
* and description stay the base topic's: an extension adds to a topic, it never
|
|
113
135
|
* renames it. A topic that `replaces` another is the one that renames.
|
|
114
136
|
*
|
|
115
137
|
* Keyed by section TITLE rather than by position, the way the localization
|
|
@@ -122,6 +144,28 @@ export function discoverIntegrationDocs(integration: {
|
|
|
122
144
|
* @returns {any} a new doc; neither input is mutated
|
|
123
145
|
*/
|
|
124
146
|
export function mergeTopic(base: any, overlay: any): any;
|
|
147
|
+
/**
|
|
148
|
+
* {@link mergeTopic}, also naming each `before` or `after` that found no
|
|
149
|
+
* section: that section was added at the end instead.
|
|
150
|
+
*
|
|
151
|
+
* @param {any} base
|
|
152
|
+
* @param {any} overlay
|
|
153
|
+
* @returns {{doc: any, unplaced: Array<{section: string, field: 'before' | 'after', key: string}>}}
|
|
154
|
+
*/
|
|
155
|
+
export function mergeTopicReport(base: any, overlay: any): {
|
|
156
|
+
doc: any;
|
|
157
|
+
unplaced: Array<{
|
|
158
|
+
section: string;
|
|
159
|
+
field: "before" | "after";
|
|
160
|
+
key: string;
|
|
161
|
+
}>;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* A section without the fields that place it; readers never see them.
|
|
165
|
+
* @param {any} section
|
|
166
|
+
* @returns {any}
|
|
167
|
+
*/
|
|
168
|
+
export function withoutPosition(section: any): any;
|
|
125
169
|
export { withSourceTitle };
|
|
126
170
|
/**
|
|
127
171
|
* Owner package recorded for the built-in topics. They ship inside the CLI
|
|
@@ -139,6 +183,11 @@ export const GRAPH_BLOCK_TYPES: Set<string>;
|
|
|
139
183
|
* load; a guide the tree places may set `placement` (spec:AST-046).
|
|
140
184
|
*/
|
|
141
185
|
export const GRAPH_ONLY_FIELDS: string[];
|
|
186
|
+
/**
|
|
187
|
+
* The fields an extension section places itself with: the key of the base
|
|
188
|
+
* section it goes before or after. Read only by a merge, never by a reader.
|
|
189
|
+
*/
|
|
190
|
+
export const SECTION_POSITION_FIELDS: string[];
|
|
142
191
|
/**
|
|
143
192
|
* A component a link can name: its owner's provider id, package, and name,
|
|
144
193
|
* and the doc file that describes it.
|
|
@@ -183,6 +232,19 @@ export class DocsCatalog {
|
|
|
183
232
|
* @returns {DocsCatalog}
|
|
184
233
|
*/
|
|
185
234
|
static fromBuiltins(builtins?: Record<string, string>): DocsCatalog;
|
|
235
|
+
/**
|
|
236
|
+
* What the integrations do to the guide the docs tree places at `route`, or
|
|
237
|
+
* null when they leave it as it is.
|
|
238
|
+
* @param {string} route
|
|
239
|
+
* @returns {GuideOverlay | null}
|
|
240
|
+
*/
|
|
241
|
+
guideOverlay(route: string): GuideOverlay | null;
|
|
242
|
+
/**
|
|
243
|
+
* Every doc that replaces or extends a guide by its route, in configured
|
|
244
|
+
* order, so a check can name a route that holds no guide.
|
|
245
|
+
* @returns {ReadonlyArray<DocsTopicRecord>}
|
|
246
|
+
*/
|
|
247
|
+
get guideTargeters(): ReadonlyArray<DocsTopicRecord>;
|
|
186
248
|
/**
|
|
187
249
|
* Record a doc file a package ships that did not load. Its package's docs
|
|
188
250
|
* are withdrawn; readers name the package so an author knows where to look.
|
|
@@ -259,6 +321,30 @@ export class DocsCatalog {
|
|
|
259
321
|
entries(): DocsTopicEntry[];
|
|
260
322
|
#private;
|
|
261
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* What the integrations do to one guide the docs tree places, in configured
|
|
326
|
+
* order: a replacement, and the extensions merged onto whatever is there.
|
|
327
|
+
*/
|
|
328
|
+
export type GuideOverlay = {
|
|
329
|
+
/**
|
|
330
|
+
* the doc readers get at the
|
|
331
|
+
* route instead of the guide; the last package configured wins
|
|
332
|
+
*/
|
|
333
|
+
replacement: DocsTopicRecord | null;
|
|
334
|
+
/**
|
|
335
|
+
* extensions authored after the replacement, if any, in configured order
|
|
336
|
+
*/
|
|
337
|
+
extensions: Array<{
|
|
338
|
+
package: string;
|
|
339
|
+
path: string;
|
|
340
|
+
providerId?: string;
|
|
341
|
+
}>;
|
|
342
|
+
/**
|
|
343
|
+
* the package of the replacement this one
|
|
344
|
+
* took over from, when the guide was replaced twice
|
|
345
|
+
*/
|
|
346
|
+
replacedPackage?: string | undefined;
|
|
347
|
+
};
|
|
262
348
|
/**
|
|
263
349
|
* A doc file discovered under a docs root.
|
|
264
350
|
*/
|
|
@@ -314,6 +400,11 @@ export type DocsTopicEntry = {
|
|
|
314
400
|
* the topic this one took the place of
|
|
315
401
|
*/
|
|
316
402
|
replaces?: string | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* the package whose topic or guide this
|
|
405
|
+
* one took the place of
|
|
406
|
+
*/
|
|
407
|
+
replacedPackage?: string | undefined;
|
|
317
408
|
/**
|
|
318
409
|
* overlays to merge onto the base doc, in the order their integrations were
|
|
319
410
|
* configured; each section an extension adds resolves its links against the
|