@astryxdesign/cli 0.6.4-canary.f0355e3 → 0.6.4
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 +96 -99
- package/api/build/build.doc.mjs +1 -6
- package/api/build/build.test.mjs +0 -22
- package/api/build/kit/kit.mjs +5 -44
- package/api/component/_adapter.d.mts +0 -25
- package/api/component/_adapter.mjs +5 -59
- package/api/component/component.d.mts +3 -6
- package/api/component/component.doc.mjs +17 -37
- package/api/component/component.mjs +9 -249
- package/api/component/component.type.d.mts +0 -25
- package/api/component/component.type.mjs +0 -44
- package/api/discover/_adapter.d.mts +6 -114
- package/api/discover/_adapter.mjs +17 -372
- package/api/discover/detail/detail.d.mts +6 -18
- package/api/discover/detail/detail.mjs +13 -67
- package/api/discover/detail/detail.test.mjs +0 -85
- package/api/discover/discover.d.mts +9 -3
- package/api/discover/discover.doc.mjs +18 -61
- package/api/discover/discover.mjs +36 -220
- package/api/discover/discover.test.mjs +2 -11
- package/api/discover/discover.type.d.mts +8 -147
- package/api/discover/discover.type.mjs +12 -102
- package/api/discover/list/list.d.mts +6 -20
- package/api/discover/list/list.mjs +12 -45
- package/api/discover/list/list.test.mjs +0 -46
- package/api/discover/search/search.d.mts +16 -18
- package/api/discover/search/search.mjs +56 -102
- package/api/discover/search/search.test.mjs +10 -144
- package/api/docs/_adapter.d.mts +3 -8
- package/api/docs/_adapter.mjs +6 -14
- package/api/docs/docOverlays.test.mjs +1 -27
- package/api/docs/docs.doc.mjs +2 -2
- package/api/docs/docs.test.mjs +243 -0
- package/api/docs/integration-tree.test.mjs +555 -0
- package/api/docs/integrationDocs.test.mjs +314 -0
- package/api/doctor/doctor.d.mts +3 -8
- package/api/doctor/doctor.doc.mjs +8 -17
- package/api/doctor/doctor.mjs +9 -90
- package/api/doctor/doctor.test.mjs +10 -122
- package/api/doctor/doctor.type.d.mts +1 -1
- package/api/doctor/doctor.type.mjs +1 -1
- package/api/gap-report/gap-report.doc.mjs +10 -19
- package/api/hook/hook.doc.mjs +3 -6
- package/api/index.d.mts +2 -1
- package/api/index.mjs +5 -5
- package/api/init/init.doc.mjs +12 -17
- package/api/integration/add-helpers.d.mts +2 -5
- package/api/integration/add-helpers.mjs +9 -36
- package/api/integration/add-theme.mjs +1 -22
- package/api/integration/add-theme.test.mjs +0 -34
- package/api/integration/authoring-checks.mjs +2 -2
- package/api/integration/integrationPackCheck.doc.mjs +3 -3
- package/api/integration/pack-check.mjs +9 -82
- package/api/integration/pack-check.test.mjs +0 -90
- package/api/integration/pack-check.type.mjs +1 -1
- package/api/json/assertResponse.doc.mjs +1 -1
- package/api/json/index.ts +1 -0
- package/api/json/isError.doc.mjs +1 -1
- package/api/layout/_adapter.d.mts +34 -0
- package/api/layout/_adapter.mjs +148 -0
- package/api/layout/check/check.d.mts +16 -0
- package/api/layout/check/check.mjs +40 -0
- package/api/layout/expand/expand.d.mts +22 -0
- package/api/layout/expand/expand.mjs +155 -0
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.d.mts +13 -0
- package/api/layout/grammar/grammar.mjs +87 -0
- package/api/layout/layout.d.mts +6 -0
- package/api/layout/layout.mjs +17 -0
- package/api/layout/layout.test.mjs +297 -0
- package/api/layout/layout.type.d.mts +89 -0
- package/api/layout/layout.type.mjs +103 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +85 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +107 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +57 -0
- package/api/search/search.d.mts +1 -27
- package/api/search/search.doc.mjs +2 -2
- package/api/search/search.mjs +16 -228
- package/api/search/search.test.mjs +512 -0
- package/api/swizzle/swizzle.doc.mjs +5 -7
- package/api/template/copy/copy.mjs +1 -1
- package/api/template/copy/copy.test.mjs +0 -9
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.doc.mjs +1 -2
- package/api/template/template.mjs +1 -1
- package/api/theme/add/add.mjs +25 -17
- package/api/theme/add/add.staging.test.mjs +23 -40
- package/api/theme/build/build.family.test.mjs +12 -7
- package/api/theme/build/build.mjs +18 -8
- package/api/theme/generateTonalPalette.doc.mjs +2 -1
- package/api/theme/listThemes.doc.mjs +1 -1
- package/api/theme/themeAdd.doc.mjs +10 -9
- package/api/theme/themeBuild.doc.mjs +13 -13
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +1 -2
- package/api/theme/themePaletteGenerate.doc.mjs +8 -15
- package/api/theme/themeTargets.doc.mjs +2 -3
- package/api/theme/themeTemplate.doc.mjs +1 -2
- package/api/upgrade/run/run.mjs +4 -6
- package/api/upgrade/upgrade.doc.mjs +22 -24
- package/api/upgrade/upgrade.type.mjs +2 -2
- package/assets/codemods/__tests__/runner.test.mjs +1 -3
- package/assets/codemods/integration-runner.mjs +3 -3
- package/assets/codemods/runner.mjs +4 -5
- package/assets/docs/README.md +2 -4
- package/assets/docs/browser-support.doc.mjs +11 -11
- package/assets/docs/color.doc.mjs +2 -8
- package/assets/docs/elevation.doc.mjs +4 -6
- package/assets/docs/getting-started.doc.mjs +16 -5
- package/assets/docs/icons.doc.mjs +21 -2
- package/assets/docs/illustrations.doc.mjs +15 -7
- package/assets/docs/internationalization.doc.mjs +5 -7
- package/assets/docs/layout.doc.dense.mjs +82 -130
- package/assets/docs/layout.doc.mjs +77 -133
- package/assets/docs/migration.doc.mjs +21 -19
- package/assets/docs/motion.doc.mjs +3 -16
- package/assets/docs/principles.doc.dense.mjs +5 -5
- package/assets/docs/principles.doc.mjs +0 -8
- package/assets/docs/principles.doc.zh.mjs +6 -6
- package/assets/docs/shape.doc.mjs +3 -8
- package/assets/docs/spacing.doc.mjs +2 -7
- package/assets/docs/styling-libraries.doc.mjs +2 -6
- package/assets/docs/styling.doc.mjs +23 -19
- package/assets/docs/theme.doc.dense.mjs +18 -58
- package/assets/docs/theme.doc.mjs +46 -56
- package/assets/docs/theme.doc.zh.mjs +8 -9
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +8 -389
- package/assets/docs/tokens.doc.zh.mjs +2 -2
- package/assets/docs/tree/integrations.doc.mjs +451 -25
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/typography.doc.mjs +4 -24
- package/assets/docs/working-with-ai.doc.mjs +22 -30
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/authoring/config/config.doc.mjs +2 -10
- package/authoring/config/parse.d.mts +0 -2
- package/authoring/config/parse.mjs +0 -19
- package/authoring/config/parse.test.mjs +0 -8
- package/authoring/config/type.ts +2 -13
- package/authoring/doctypes/_schema.d.mts +2 -3
- package/authoring/doctypes/_schema.mjs +0 -6
- package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
- package/authoring/doctypes/base/type.ts +2 -4
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/component.doc.mjs +0 -6
- package/authoring/doctypes/component/type.ts +0 -8
- package/authoring/doctypes/reference/reference.doc.mjs +0 -7
- package/authoring/doctypes/reference/type.ts +0 -5
- package/authoring/doctypes/schema/schema.doc.mjs +2 -2
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +2 -2
- package/authoring/index.d.mts +0 -1
- package/authoring/index.d.ts +0 -10
- package/authoring/index.mjs +0 -1
- package/authoring/integration/integration.doc.mjs +10 -12
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/component/index.mjs +55 -152
- package/clients/cli/commands/component-ownership.test.mjs +0 -89
- package/clients/cli/commands/component.doc.mjs +9 -27
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/discover.doc.mjs +9 -53
- package/clients/cli/commands/discover.mjs +118 -393
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +17 -60
- package/clients/cli/commands/docs.test.mjs +294 -0
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -3
- package/clients/cli/commands/doctor-integration.test.mjs +0 -53
- package/clients/cli/commands/doctor.doc.mjs +1 -3
- package/clients/cli/commands/doctor.mjs +5 -49
- package/clients/cli/commands/gap-report.doc.mjs +9 -10
- package/clients/cli/commands/init.doc.mjs +6 -9
- package/clients/cli/commands/integration-add.doc.mjs +9 -9
- package/clients/cli/commands/integration-authoring.test.mjs +10 -61
- package/clients/cli/commands/integration-pack.doc.mjs +9 -5
- package/clients/cli/commands/integration-real-world.test.mjs +1 -1
- package/clients/cli/commands/integration.doc.mjs +4 -4
- package/clients/cli/commands/integration.mjs +43 -74
- package/clients/cli/commands/layout-check.doc.mjs +65 -0
- package/clients/cli/commands/layout-expand.doc.mjs +83 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
- package/clients/cli/commands/layout.doc.mjs +34 -0
- package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
- package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
- package/clients/cli/commands/layout.mjs +275 -0
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +3 -10
- package/clients/cli/commands/search.mjs +2 -21
- package/clients/cli/commands/search.test.mjs +4 -21
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/text-json-parity.test.mjs +16 -5
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +2 -3
- package/clients/cli/commands/theme-palette.doc.mjs +2 -1
- package/clients/cli/commands/theme-targets.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -62
- package/clients/cli/index.mjs +10 -28
- package/clients/cli/lib/define-command.mjs +4 -28
- package/clients/cli/lib/define-command.test.mjs +0 -54
- package/clients/cli/lib/exit-codes.test.mjs +9 -18
- package/clients/cli/lib/json-shim.mjs +14 -24
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +13 -18
- package/clients/cli/lib/manifest.test.mjs +2 -5
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/agent-docs/agent-docs.test.mjs +1159 -0
- package/foundation/discovery/authoring-self-docs.mjs +0 -1
- package/foundation/discovery/authoring-self-docs.test.mjs +2 -6
- package/foundation/discovery/cli-self-docs.mjs +2 -16
- package/foundation/discovery/cli-self-docs.test.mjs +0 -20
- package/foundation/discovery/docs-discovery.mjs +1 -5
- package/foundation/discovery/docs-discovery.test.mjs +0 -21
- package/foundation/discovery/docs-section-key.d.mts +1 -1
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/template-adapter.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +14 -3
- package/foundation/doc-compiler/tree.d.mts +0 -4
- package/foundation/doc-compiler/tree.mjs +1 -6
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/integrations/cli-requirement.d.mts +6 -26
- package/foundation/integrations/cli-requirement.mjs +11 -46
- package/foundation/integrations/cli-requirement.test.mjs +2 -7
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/integrations/integrations.d.mts +1 -14
- package/foundation/integrations/integrations.mjs +1 -41
- package/foundation/integrations/integrations.test.mjs +0 -31
- package/foundation/response/error-codes.doc.mjs +8 -6
- package/foundation/response/error-codes.test.mjs +5 -30
- package/foundation/response/response-types.doc.d.mts +3 -4
- package/foundation/response/response-types.doc.mjs +27 -40
- package/foundation/response/response-types.doc.test.mjs +0 -23
- package/foundation/response/response.doc.mjs +10 -11
- package/foundation/xle/browser.d.mts +3 -3
- package/foundation/xle/browser.mjs +3 -3
- package/foundation/xle/expand.mjs +2 -2
- package/foundation/xle/parse.mjs +1 -1
- package/foundation/xle/print.mjs +2 -2
- package/foundation/xle/splice.mjs +1 -1
- package/package.json +9 -9
- package/api/discover/_adapter.test.mjs +0 -215
- package/api/discover/_catalog-view.d.mts +0 -115
- package/api/discover/_catalog-view.mjs +0 -203
- package/api/discover/_catalog-view.test.mjs +0 -128
- package/api/discover/detail/item/item.d.mts +0 -26
- package/api/discover/detail/item/item.mjs +0 -78
- package/api/discover/detail/item/item.test.mjs +0 -73
- package/api/integration/pack-check.lifecycle-output.test.mjs +0 -107
- package/api/theme/add/add.rollback.test.mjs +0 -158
- package/api/theme/build/build.rollback.test.mjs +0 -148
- package/api/upgrade/run/files-changed.test.mjs +0 -111
- package/assets/codemods/file-count.test.mjs +0 -163
- package/assets/docs/tree/add-a-component.doc.mjs +0 -75
- package/assets/docs/tree/add-a-theme.doc.mjs +0 -85
- package/assets/docs/tree/add-a-topic.doc.mjs +0 -144
- package/assets/docs/tree/agent-guidance.doc.mjs +0 -138
- package/assets/docs/tree/block-template.doc.mjs +0 -130
- package/assets/docs/tree/build-the-template.doc.mjs +0 -28
- package/assets/docs/tree/building-blocks.doc.mjs +0 -46
- package/assets/docs/tree/check-your-docs.doc.mjs +0 -137
- package/assets/docs/tree/checks.doc.mjs +0 -119
- package/assets/docs/tree/codemods.doc.mjs +0 -147
- package/assets/docs/tree/component-family.doc.mjs +0 -113
- package/assets/docs/tree/component-imports.doc.mjs +0 -69
- package/assets/docs/tree/component-lookups.doc.mjs +0 -149
- package/assets/docs/tree/components.doc.mjs +0 -23
- package/assets/docs/tree/configuration.doc.mjs +0 -23
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +0 -182
- package/assets/docs/tree/define-the-theme.doc.mjs +0 -118
- package/assets/docs/tree/describe-the-component.doc.mjs +0 -57
- package/assets/docs/tree/docs.doc.mjs +0 -21
- package/assets/docs/tree/document-the-template.doc.mjs +0 -28
- package/assets/docs/tree/document-the-theme.doc.mjs +0 -68
- package/assets/docs/tree/export-template-assets.doc.mjs +0 -147
- package/assets/docs/tree/extend-or-replace.doc.mjs +0 -103
- package/assets/docs/tree/fonts-and-assets.doc.mjs +0 -106
- package/assets/docs/tree/generate-a-palette.doc.mjs +0 -66
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +0 -105
- package/assets/docs/tree/help.doc.mjs +0 -16
- package/assets/docs/tree/links.doc.mjs +0 -98
- package/assets/docs/tree/package-and-test.doc.mjs +0 -32
- package/assets/docs/tree/page-template.doc.mjs +0 -71
- package/assets/docs/tree/publishing.doc.mjs +0 -111
- package/assets/docs/tree/quick-start.doc.mjs +0 -272
- package/assets/docs/tree/replace-a-core-component.doc.mjs +0 -104
- package/assets/docs/tree/replace-a-core-template.doc.mjs +0 -172
- package/assets/docs/tree/sections-and-placement.doc.mjs +0 -108
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +0 -59
- package/assets/docs/tree/ship.doc.mjs +0 -16
- package/assets/docs/tree/short-and-findable.doc.mjs +0 -108
- package/assets/docs/tree/single-component.doc.mjs +0 -165
- package/assets/docs/tree/start-a-template.doc.mjs +0 -143
- package/assets/docs/tree/subcomponent.doc.mjs +0 -115
- package/assets/docs/tree/template-assets.doc.mjs +0 -64
- package/assets/docs/tree/template-doc-overview.doc.mjs +0 -109
- package/assets/docs/tree/template-fonts.doc.mjs +0 -102
- package/assets/docs/tree/template-grading-rubric.doc.mjs +0 -452
- package/assets/docs/tree/template-icons.doc.mjs +0 -97
- package/assets/docs/tree/template-images-media.doc.mjs +0 -127
- package/assets/docs/tree/template-styles.doc.mjs +0 -93
- package/assets/docs/tree/templates.doc.mjs +0 -34
- package/assets/docs/tree/test-in-an-app.doc.mjs +0 -115
- package/assets/docs/tree/test-template-in-app.doc.mjs +0 -128
- package/assets/docs/tree/themes.doc.mjs +0 -39
- package/assets/docs/tree/troubleshooting.doc.mjs +0 -149
- package/assets/docs/tree/upgrading.doc.mjs +0 -103
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +0 -51
- package/assets/docs/tree/verify-packed-template.doc.mjs +0 -77
- package/assets/docs/tree/versioning.doc.mjs +0 -161
- package/assets/docs/tree/write-good-templates.doc.mjs +0 -64
- package/assets/docs/tree/write-the-template-file.doc.mjs +0 -154
- package/authoring/discover/discover.doc.d.mts +0 -13
- package/authoring/discover/discover.doc.mjs +0 -138
- package/authoring/discover/parse.d.mts +0 -24
- package/authoring/discover/parse.mjs +0 -128
- package/authoring/discover/parse.test.mjs +0 -124
- package/authoring/discover/type.ts +0 -87
- package/clients/cli/commands/component-batch.test.mjs +0 -341
- package/clients/cli/commands/discover.sources.test.mjs +0 -267
- package/clients/cli/commands/integration-verify.doc.mjs +0 -22
- package/clients/cli/lib/parse-error-format.test.mjs +0 -81
- package/foundation/response/batch.type.d.mts +0 -33
- package/foundation/response/batch.type.mjs +0 -34
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file `astryx discover` with a discover source: the list, a package page, a
|
|
5
|
-
* search, and the refused option pair, driven through the real CLI against a
|
|
6
|
-
* hermetic project whose astryx.config sets `discover`. Saved copies go to a
|
|
7
|
-
* temp cache directory, never the project.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
11
|
-
import * as fs from 'node:fs';
|
|
12
|
-
import * as path from 'node:path';
|
|
13
|
-
import * as os from 'node:os';
|
|
14
|
-
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
15
|
-
|
|
16
|
-
const CONFIG = `
|
|
17
|
-
const packages = [
|
|
18
|
-
{
|
|
19
|
-
package: '@test/kit',
|
|
20
|
-
integration: 'test-kit',
|
|
21
|
-
aliases: [],
|
|
22
|
-
latest: '3.2.0',
|
|
23
|
-
versions: [
|
|
24
|
-
{version: '3.2.0', publishedAt: '2026-09-29T00:00:00.000Z', prerelease: false, status: 'ok'},
|
|
25
|
-
{version: '3.1.4', publishedAt: '2026-09-01T00:00:00.000Z', prerelease: false, status: 'ok'},
|
|
26
|
-
],
|
|
27
|
-
contributions: [{kind: 'component', name: 'Dial'}],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
package: '@test/charts',
|
|
31
|
-
integration: 'test-charts',
|
|
32
|
-
aliases: [],
|
|
33
|
-
latest: '2.0.0',
|
|
34
|
-
versions: [
|
|
35
|
-
{version: '2.1.0-beta.1', publishedAt: '2026-09-25T00:00:00.000Z', prerelease: true, status: 'ok'},
|
|
36
|
-
{version: '2.0.0', publishedAt: '2026-09-20T00:00:00.000Z', prerelease: false, status: 'ok'},
|
|
37
|
-
],
|
|
38
|
-
contributions: [
|
|
39
|
-
{kind: 'component', name: 'Chart'},
|
|
40
|
-
{kind: 'template', name: 'pages/Report'},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
package: '@test/boards',
|
|
45
|
-
integration: 'test-boards',
|
|
46
|
-
aliases: [],
|
|
47
|
-
latest: '1.0.0',
|
|
48
|
-
versions: [
|
|
49
|
-
{version: '1.0.0', publishedAt: '2026-09-10T00:00:00.000Z', prerelease: false, status: 'ok'},
|
|
50
|
-
],
|
|
51
|
-
contributions: [{kind: 'template', name: 'pages/DialBoard'}],
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
integrations: ['@test/kit'],
|
|
57
|
-
async discover({package: name}) {
|
|
58
|
-
return {
|
|
59
|
-
schemaVersion: 1,
|
|
60
|
-
source: {name: 'Test catalog', generatedAt: '2026-09-30T00:00:00.000Z', complete: true},
|
|
61
|
-
packages: packages.filter(p => name == null || p.package === name),
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
let tmpDir;
|
|
68
|
-
let project;
|
|
69
|
-
/** @type {Record<string, string | undefined>} */
|
|
70
|
-
let savedEnv;
|
|
71
|
-
|
|
72
|
-
beforeEach(() => {
|
|
73
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-discover-sources-'));
|
|
74
|
-
project = path.join(tmpDir, 'project');
|
|
75
|
-
const pkgDir = path.join(project, 'node_modules', '@test', 'kit');
|
|
76
|
-
fs.mkdirSync(path.join(pkgDir, 'components'), {recursive: true});
|
|
77
|
-
fs.writeFileSync(
|
|
78
|
-
path.join(project, 'package.json'),
|
|
79
|
-
JSON.stringify({
|
|
80
|
-
name: 'proj',
|
|
81
|
-
version: '1.0.0',
|
|
82
|
-
dependencies: {'@test/kit': '3.1.4'},
|
|
83
|
-
}),
|
|
84
|
-
);
|
|
85
|
-
fs.writeFileSync(path.join(project, 'astryx.config.mjs'), CONFIG);
|
|
86
|
-
fs.writeFileSync(
|
|
87
|
-
path.join(pkgDir, 'package.json'),
|
|
88
|
-
JSON.stringify({name: '@test/kit', version: '3.1.4'}),
|
|
89
|
-
);
|
|
90
|
-
fs.writeFileSync(
|
|
91
|
-
path.join(pkgDir, 'astryx.integration.mjs'),
|
|
92
|
-
`export default {components: './components'};\n`,
|
|
93
|
-
);
|
|
94
|
-
fs.writeFileSync(
|
|
95
|
-
path.join(pkgDir, 'components', 'Dial.doc.mjs'),
|
|
96
|
-
`export const docs = {name: 'Dial', usage: {description: 'A dial.'}};\n`,
|
|
97
|
-
);
|
|
98
|
-
fs.writeFileSync(
|
|
99
|
-
path.join(pkgDir, 'components', 'Dial.tsx'),
|
|
100
|
-
`export function Dial() { return null; }\n`,
|
|
101
|
-
);
|
|
102
|
-
// The saved copy lives in the per-user cache; point it at the temp dir.
|
|
103
|
-
savedEnv = {
|
|
104
|
-
HOME: process.env.HOME,
|
|
105
|
-
XDG_CACHE_HOME: process.env.XDG_CACHE_HOME,
|
|
106
|
-
LOCALAPPDATA: process.env.LOCALAPPDATA,
|
|
107
|
-
};
|
|
108
|
-
process.env.HOME = path.join(tmpDir, 'home');
|
|
109
|
-
process.env.XDG_CACHE_HOME = path.join(tmpDir, 'cache');
|
|
110
|
-
process.env.LOCALAPPDATA = path.join(tmpDir, 'localappdata');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
afterEach(() => {
|
|
114
|
-
for (const [key, value] of Object.entries(savedEnv)) {
|
|
115
|
-
if (value === undefined) delete process.env[key];
|
|
116
|
-
else process.env[key] = value;
|
|
117
|
-
}
|
|
118
|
-
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
/** The per-user cache directory this platform uses under the redirected env. */
|
|
122
|
-
function userCacheDir() {
|
|
123
|
-
if (process.platform === 'win32') {
|
|
124
|
-
return path.join(tmpDir, 'localappdata', 'astryx', 'Cache');
|
|
125
|
-
}
|
|
126
|
-
if (process.platform === 'darwin') {
|
|
127
|
-
return path.join(tmpDir, 'home', 'Library', 'Caches', 'astryx');
|
|
128
|
-
}
|
|
129
|
-
return path.join(tmpDir, 'cache', 'astryx');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
describe('astryx discover with a discover source', () => {
|
|
133
|
-
it('lists what the project has and what it could add, in --json', async () => {
|
|
134
|
-
const {status, stdout} = await runCli(['discover', '--json'], {
|
|
135
|
-
cwd: project,
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
expect(status).toBe(0);
|
|
139
|
-
const {data, meta} = JSON.parse(stdout);
|
|
140
|
-
expect(data).toEqual([
|
|
141
|
-
expect.objectContaining({
|
|
142
|
-
name: '@test/kit',
|
|
143
|
-
components: ['Dial'],
|
|
144
|
-
version: '3.1.4',
|
|
145
|
-
latest: '3.2.0',
|
|
146
|
-
}),
|
|
147
|
-
]);
|
|
148
|
-
expect(meta.available).toEqual([
|
|
149
|
-
{
|
|
150
|
-
name: '@test/charts',
|
|
151
|
-
components: ['Chart'],
|
|
152
|
-
version: '2.0.0',
|
|
153
|
-
templates: ['pages/Report'],
|
|
154
|
-
source: 'Test catalog',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: '@test/boards',
|
|
158
|
-
components: [],
|
|
159
|
-
version: '1.0.0',
|
|
160
|
-
templates: ['pages/DialBoard'],
|
|
161
|
-
source: 'Test catalog',
|
|
162
|
-
},
|
|
163
|
-
]);
|
|
164
|
-
expect(meta.sources).toEqual([
|
|
165
|
-
expect.objectContaining({
|
|
166
|
-
name: 'Test catalog',
|
|
167
|
-
from: 'astryx.config',
|
|
168
|
-
status: 'fresh',
|
|
169
|
-
}),
|
|
170
|
-
]);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('prints both sides as records', async () => {
|
|
174
|
-
const {status, stdout} = await runCli(['discover'], {cwd: project});
|
|
175
|
-
|
|
176
|
-
expect(status).toBe(0);
|
|
177
|
-
expect(stdout).toMatch(/^Installed$/m);
|
|
178
|
-
expect(stdout).toMatch(/^Available$/m);
|
|
179
|
-
expect(stdout).toMatch(/^name:\s+@test\/charts$/m);
|
|
180
|
-
expect(stdout).toMatch(/^latest:\s+3\.2\.0$/m);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('shows a package it does not have with its releases and the command that adds it, and never runs it', async () => {
|
|
184
|
-
const {status, stdout} = await runCli(['discover', '@test/charts'], {
|
|
185
|
-
cwd: project,
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
expect(status).toBe(0);
|
|
189
|
-
expect(stdout).toMatch(/^installed:\s+false$/m);
|
|
190
|
-
expect(stdout).toContain('- 2.0.0 2026-09-20 latest');
|
|
191
|
-
expect(stdout).not.toContain('2.1.0-beta.1 ');
|
|
192
|
-
expect(stdout).toContain('1 prerelease is not listed.');
|
|
193
|
-
// The verb follows the detected package manager.
|
|
194
|
-
expect(stdout).toMatch(
|
|
195
|
-
/^(npm install|pnpm add|yarn add|bun add) @test\/charts$/m,
|
|
196
|
-
);
|
|
197
|
-
expect(
|
|
198
|
-
fs.existsSync(path.join(project, 'node_modules', '@test', 'charts')),
|
|
199
|
-
).toBe(false);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it('says which item is missing from a package only a source lists', async () => {
|
|
203
|
-
const {status, stdout} = await runCli(
|
|
204
|
-
['discover', '@test/charts/Nope', '--json'],
|
|
205
|
-
{cwd: project},
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
expect(status).toBe(1);
|
|
209
|
-
const {code, error} = JSON.parse(stdout);
|
|
210
|
-
expect(code).toBe('ERR_UNKNOWN_COMPONENT');
|
|
211
|
-
expect(error).toBe('"Nope" not found in @test/charts');
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it('searches every kind in every source', async () => {
|
|
215
|
-
const {status, stdout} = await runCli(['discover', 'report', '--json'], {
|
|
216
|
-
cwd: project,
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
expect(status).toBe(0);
|
|
220
|
-
expect(JSON.parse(stdout).data.matches).toEqual([
|
|
221
|
-
{
|
|
222
|
-
package: '@test/charts',
|
|
223
|
-
component: 'pages/Report',
|
|
224
|
-
kind: 'template',
|
|
225
|
-
installed: false,
|
|
226
|
-
},
|
|
227
|
-
]);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it('refuses --installed with --available', async () => {
|
|
231
|
-
const {status, stdout} = await runCli(
|
|
232
|
-
['discover', '--installed', '--available', '--json'],
|
|
233
|
-
{cwd: project},
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
expect(status).toBe(1);
|
|
237
|
-
expect(JSON.parse(stdout).code).toBe('ERR_INVALID_OPTION');
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
it('lists every match for a free-text query, even an exact component name, and opens one by its package path', async () => {
|
|
241
|
-
const exact = await runCli(['discover', 'Dial', '--json'], {cwd: project});
|
|
242
|
-
const {type, data} = JSON.parse(exact.stdout);
|
|
243
|
-
expect(type).toBe('discover.search');
|
|
244
|
-
expect(data.matches.map(m => [m.component, m.installed])).toEqual([
|
|
245
|
-
['Dial', true],
|
|
246
|
-
['pages/DialBoard', false],
|
|
247
|
-
]);
|
|
248
|
-
|
|
249
|
-
const opened = await runCli(['discover', '@test/kit/Dial', '--json'], {
|
|
250
|
-
cwd: project,
|
|
251
|
-
});
|
|
252
|
-
expect(JSON.parse(opened.stdout).type).toBe('discover.detail.doc');
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it('saves the answer in the user cache and writes nothing into the project', async () => {
|
|
256
|
-
const before = fs.readdirSync(project).sort();
|
|
257
|
-
await runCli(['discover', '--json'], {cwd: project});
|
|
258
|
-
|
|
259
|
-
expect(fs.readdirSync(project).sort()).toEqual(before);
|
|
260
|
-
expect(fs.existsSync(path.join(project, 'node_modules', '.cache'))).toBe(
|
|
261
|
-
false,
|
|
262
|
-
);
|
|
263
|
-
expect(fs.readdirSync(path.join(userCacheDir(), 'discover'))).toHaveLength(
|
|
264
|
-
1,
|
|
265
|
-
);
|
|
266
|
-
});
|
|
267
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'command',
|
|
6
|
-
name: 'integration verify',
|
|
7
|
-
displayName: 'astryx integration verify',
|
|
8
|
-
namespace: 'cli/commands',
|
|
9
|
-
summary: 'Check the package the way npm will publish it, before you publish',
|
|
10
|
-
description:
|
|
11
|
-
'Packs the package with npm, unpacks the tarball into a temporary app without installing its dependencies, and checks that the app sees the same components, templates, themes, docs, and codemods as the package, that every public import resolves, and that the package declares a CLI new enough to read it. It publishes nothing and leaves no tarball behind. It runs the package\'s own pack lifecycle scripts, as `npm pack` does.',
|
|
12
|
-
fn: 'integrationPackCheck',
|
|
13
|
-
examples: [
|
|
14
|
-
{label: 'Check before publishing', cli: 'astryx integration verify'},
|
|
15
|
-
{label: 'Machine-readable result', cli: 'astryx integration verify --json'},
|
|
16
|
-
],
|
|
17
|
-
exitCodes: [
|
|
18
|
-
{code: 0, when: 'the packed package exposes the same valid contributions'},
|
|
19
|
-
{code: 1, when: 'the tarball is incomplete or invalid'},
|
|
20
|
-
],
|
|
21
|
-
related: ['integration add', 'doctor integration validate'],
|
|
22
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file A parse failure reads like every other Astryx error in text mode.
|
|
5
|
-
*
|
|
6
|
-
* `astryx theme list --lang zh-Hans` printed Commander's own line —
|
|
7
|
-
* `error: option '--lang <locale>' argument 'zh-Hans' is invalid…` — while
|
|
8
|
-
* every other CLI error prints `Error: …`. `--json` was already correct
|
|
9
|
-
* (ERR_INVALID_LANG), so text and JSON disagreed on everything except the exit
|
|
10
|
-
* code. Commander writes that line before any Astryx code runs, so the shim is
|
|
11
|
-
* the only place that can speak for it.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import {describe, it, expect} from 'vitest';
|
|
15
|
-
import {Command} from 'commander';
|
|
16
|
-
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
17
|
-
import {installJsonShim} from './json-shim.mjs';
|
|
18
|
-
|
|
19
|
-
describe('a parse error prints the Astryx error format', () => {
|
|
20
|
-
it.each([
|
|
21
|
-
['invalid --lang value', ['theme', 'list', '--lang', 'zh-Hans'], 'ERR_INVALID_LANG'],
|
|
22
|
-
['invalid --detail value', ['theme', 'list', '--detail', 'nope'], 'ERR_INVALID_DETAIL'],
|
|
23
|
-
['unknown option', ['component', '--bogus-flag'], 'ERR_INVALID_OPTION'],
|
|
24
|
-
['missing argument', ['theme', 'build'], 'ERR_MISSING_ARGUMENT'],
|
|
25
|
-
])('%s', async (_label, args, code) => {
|
|
26
|
-
const human = await runCli(args);
|
|
27
|
-
|
|
28
|
-
expect(human.status).toBe(1);
|
|
29
|
-
expect(human.stderr).toContain('Error: ');
|
|
30
|
-
// Commander's own lowercase line must not reach the user.
|
|
31
|
-
expect(human.stderr).not.toMatch(/(^|\n)error: /);
|
|
32
|
-
|
|
33
|
-
// --json is unchanged, and the two modes agree on the exit code.
|
|
34
|
-
const json = await runCli(['--json', ...args]);
|
|
35
|
-
expect(json.status).toBe(human.status);
|
|
36
|
-
expect(JSON.parse(json.stdout).code).toBe(code);
|
|
37
|
-
expect(json.stderr).toBe('');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('carries Commander\'s explanation, not just a generic line', async () => {
|
|
41
|
-
const {stderr} = await runCli(['theme', 'list', '--lang', 'zh-Hans']);
|
|
42
|
-
expect(stderr).toContain("'zh-Hans' is invalid");
|
|
43
|
-
expect(stderr).toContain('en, zh, dense');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('leaves --help and --version at exit 0 with nothing on stderr', async () => {
|
|
47
|
-
for (const args of [['--help'], ['theme', '--help']]) {
|
|
48
|
-
const r = await runCli(args);
|
|
49
|
-
expect(r.status).toBe(0);
|
|
50
|
-
expect(r.stderr).toBe('');
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// Commander writes help through the same stderr channel when it shows help
|
|
55
|
-
// BECAUSE the invocation failed, so suppressing that channel wholesale would
|
|
56
|
-
// have taken the help with it. Driven on a throwaway program rather than a
|
|
57
|
-
// real command, so the guard outlives whichever command happens to have a
|
|
58
|
-
// subcommand group today.
|
|
59
|
-
it('still lets help reach stderr when help IS the failure report', () => {
|
|
60
|
-
const program = new Command('probe');
|
|
61
|
-
const group = program.command('group');
|
|
62
|
-
group.command('leaf').action(() => {});
|
|
63
|
-
installJsonShim(program);
|
|
64
|
-
|
|
65
|
-
/** @type {string[]} */
|
|
66
|
-
const written = [];
|
|
67
|
-
const original = process.stderr.write;
|
|
68
|
-
// @ts-expect-error test double for the write signature
|
|
69
|
-
process.stderr.write = str => {
|
|
70
|
-
written.push(String(str));
|
|
71
|
-
return true;
|
|
72
|
-
};
|
|
73
|
-
try {
|
|
74
|
-
group.outputHelp({error: true});
|
|
75
|
-
} finally {
|
|
76
|
-
process.stderr.write = original;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
expect(written.join('')).toMatch(/Usage: probe group/);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* One complete row for an accepted selector.
|
|
6
|
-
*/
|
|
7
|
-
export type BatchRow<TResult, TCandidate> = ({
|
|
8
|
-
selector: string;
|
|
9
|
-
status: "found";
|
|
10
|
-
result: TResult;
|
|
11
|
-
} | {
|
|
12
|
-
selector: string;
|
|
13
|
-
status: "ambiguous";
|
|
14
|
-
code: string;
|
|
15
|
-
error: string;
|
|
16
|
-
candidates: TCandidate[];
|
|
17
|
-
} | {
|
|
18
|
-
selector: string;
|
|
19
|
-
status: "not_found" | "error";
|
|
20
|
-
code: string;
|
|
21
|
-
error: string;
|
|
22
|
-
suggestions?: import("./base").Suggestion[];
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* One ordered batch receipt inside the shared `{type, data}` success envelope.
|
|
26
|
-
*/
|
|
27
|
-
export type BatchResponse<TType extends string, TResult, TCandidate> = {
|
|
28
|
-
type: TType;
|
|
29
|
-
data: {
|
|
30
|
-
count: number;
|
|
31
|
-
results: BatchRow<TResult, TCandidate>[];
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Shared published types for complete multi-selector lookup receipts.
|
|
5
|
-
* Adopting API subjects specialize these types with their single-result and
|
|
6
|
-
* ambiguity-candidate types instead of defining command-specific row shapes.
|
|
7
|
-
*
|
|
8
|
-
* @input One exact selector, its single-result response, and its candidate shape.
|
|
9
|
-
* @output BatchRow and BatchResponse for every AST-053 lookup adopter.
|
|
10
|
-
* @position packages/cli/foundation/response — shared JSON response types
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* One complete row for an accepted selector.
|
|
15
|
-
* @template TResult
|
|
16
|
-
* @template TCandidate
|
|
17
|
-
* @typedef {(
|
|
18
|
-
* | {selector: string; status: 'found'; result: TResult}
|
|
19
|
-
* | {selector: string; status: 'ambiguous'; code: string; error: string; candidates: TCandidate[]}
|
|
20
|
-
* | {selector: string; status: 'not_found' | 'error'; code: string; error: string; suggestions?: import('./base').Suggestion[]}
|
|
21
|
-
* )} BatchRow
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* One ordered batch receipt inside the shared `{type, data}` success envelope.
|
|
26
|
-
* @template {string} TType
|
|
27
|
-
* @template TResult
|
|
28
|
-
* @template TCandidate
|
|
29
|
-
* @typedef {object} BatchResponse
|
|
30
|
-
* @property {TType} type
|
|
31
|
-
* @property {{count: number; results: BatchRow<TResult, TCandidate>[]}} data
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
export {};
|