@astryxdesign/cli 0.1.2 → 0.1.3
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/CHANGELOG.md +64 -1
- package/README.md +49 -55
- package/docs/layout.doc.dense.mjs +90 -0
- package/docs/layout.doc.mjs +160 -0
- package/docs/principles.doc.dense.mjs +2 -2
- package/docs/principles.doc.mjs +4 -0
- package/docs/principles.doc.zh.mjs +2 -2
- package/docs/theme.doc.mjs +2 -2
- package/package.json +13 -1
- package/src/api/blog.mjs +192 -0
- package/src/api/blog.test.mjs +144 -0
- package/src/api/component.mjs +253 -12
- package/src/api/discover.mjs +14 -7
- package/src/api/doctor.mjs +10 -25
- package/src/api/index.mjs +1 -0
- package/src/api/layout.mjs +11 -10
- package/src/api/layout.test.mjs +4 -1
- package/src/api/template-integration.test.mjs +225 -0
- package/src/api/template.mjs +242 -84
- package/src/api/validate-integration.mjs +370 -0
- package/src/api/validate-integration.test.mjs +222 -0
- package/src/codemod.mjs +93 -0
- package/src/codemod.test.mjs +134 -0
- package/src/codemods/__tests__/registry.test.mjs +1 -0
- package/src/codemods/__tests__/runner.test.mjs +103 -0
- package/src/codemods/integration-discovery.mjs +168 -0
- package/src/codemods/integration-discovery.test.mjs +234 -0
- package/src/codemods/integration-runner.mjs +109 -0
- package/src/codemods/registry.mjs +1 -0
- package/src/codemods/run-codemod.mjs +207 -0
- package/src/codemods/runner.mjs +73 -96
- package/src/codemods/transforms/v0.0.15/index.mjs +0 -13
- package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +67 -0
- package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +61 -0
- package/src/codemods/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +104 -0
- package/src/codemods/transforms/{v0.0.15 → v0.1.0}/drop-xds-prefix-imports.mjs +15 -4
- package/src/codemods/transforms/v0.1.0/index.mjs +43 -6
- package/src/codemods/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +77 -0
- package/src/codemods/transforms/v0.1.0/migrate-xds-declare-module.mjs +78 -0
- package/src/codemods/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +360 -0
- package/src/codemods/transforms/v0.1.3/index.mjs +19 -0
- package/src/codemods/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +260 -0
- package/src/commands/agent-docs.mjs +4 -1
- package/src/commands/blog.mjs +60 -0
- package/src/commands/build-theme.import-path.test.mjs +2 -12
- package/src/commands/build-theme.mjs +117 -0
- package/src/commands/build-theme.prose.test.mjs +5 -15
- package/src/commands/build-theme.watch.test.mjs +149 -0
- package/src/commands/component/index.mjs +44 -10
- package/src/commands/component-ownership.test.mjs +227 -0
- package/src/commands/discover.mjs +5 -16
- package/src/commands/doctor.test.mjs +3 -3
- package/src/commands/ensure-core-built.mjs +120 -0
- package/src/commands/json-contract.test.mjs +0 -32
- package/src/commands/swizzle.mjs +224 -235
- package/src/commands/swizzle.path-safety.test.mjs +3 -3
- package/src/commands/swizzle.routing.test.mjs +279 -0
- package/src/commands/template.mjs +33 -37
- package/src/commands/upgrade.config-ordering.test.mjs +273 -0
- package/src/commands/upgrade.integration-policy.test.mjs +204 -0
- package/src/commands/upgrade.mjs +349 -170
- package/src/commands/validate-integration.mjs +110 -0
- package/src/commands/validate-integration.test.mjs +124 -0
- package/src/config.mjs +7 -20
- package/src/config.test.mjs +89 -13
- package/src/index.mjs +8 -3
- package/src/integration.mjs +19 -0
- package/src/lib/component-discovery.mjs +177 -0
- package/src/lib/config-cache.mjs +91 -0
- package/src/lib/config-cache.test.mjs +83 -0
- package/src/lib/config-schema.mjs +41 -55
- package/src/lib/error-codes.mjs +15 -12
- package/src/lib/integration-warnings.mjs +62 -0
- package/src/lib/integration-warnings.test.mjs +102 -0
- package/src/lib/integrations.mjs +92 -115
- package/src/lib/integrations.test.mjs +88 -107
- package/src/lib/manifest.mjs +5 -2
- package/src/lib/module-loader.mjs +80 -0
- package/src/lib/module-loader.test.mjs +106 -0
- package/src/lib/project.mjs +502 -0
- package/src/lib/project.test.mjs +308 -0
- package/src/lib/site.mjs +20 -0
- package/src/template.mjs +73 -0
- package/src/template.test.mjs +127 -0
- package/src/types/api.d.ts +2 -6
- package/src/types/base.d.ts +3 -9
- package/src/types/codemod.d.ts +81 -0
- package/src/types/component.d.ts +27 -2
- package/src/types/config.d.ts +56 -85
- package/src/types/error-codes.d.ts +5 -3
- package/src/types/index.d.ts +0 -1
- package/src/types/integration.d.ts +29 -0
- package/src/types/swizzle.d.ts +9 -2
- package/src/types/template-api.d.ts +54 -0
- package/src/types/template.d.ts +10 -7
- package/src/types/upgrade.d.ts +29 -0
- package/src/types/validate-integration.d.ts +24 -0
- package/src/utils/github.mjs +0 -237
- package/src/utils/interactive.mjs +2 -2
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.doc.mjs +14 -0
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +28 -0
- package/templates/blocks/components/Blockquote/BlockquoteTestimonials.doc.mjs +14 -0
- package/templates/blocks/components/Blockquote/BlockquoteTestimonials.tsx +34 -0
- package/templates/blocks/components/Blockquote/BlockquoteWithCite.doc.mjs +14 -0
- package/templates/blocks/components/Blockquote/BlockquoteWithCite.tsx +21 -0
- package/templates/blocks/components/BreadcrumbItem/BreadcrumbItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/BreadcrumbItem/BreadcrumbItemBasic.tsx +15 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupBasic.doc.mjs +14 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupBasic.tsx +16 -0
- package/templates/blocks/components/ChatDictationButton/ChatDictationButtonBasic.doc.mjs +19 -0
- package/templates/blocks/components/ChatDictationButton/ChatDictationButtonBasic.tsx +34 -0
- package/templates/blocks/components/CheckboxListItem/CheckboxListItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/CheckboxListItem/CheckboxListItemBasic.tsx +30 -0
- package/templates/blocks/components/CollapsibleGroup/CollapsibleGroupAccordion.doc.mjs +14 -0
- package/templates/blocks/components/CollapsibleGroup/CollapsibleGroupAccordion.tsx +31 -0
- package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyBasic.doc.mjs +14 -0
- package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyBasic.tsx +26 -0
- package/templates/blocks/components/CommandPaletteFooter/CommandPaletteFooterBasic.doc.mjs +14 -0
- package/templates/blocks/components/CommandPaletteFooter/CommandPaletteFooterBasic.tsx +32 -0
- package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.doc.mjs +18 -0
- package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.tsx +32 -0
- package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemBasic.tsx +27 -0
- package/templates/blocks/components/ContextMenu/ContextMenuBasic.doc.mjs +14 -0
- package/templates/blocks/components/ContextMenu/ContextMenuBasic.tsx +32 -0
- package/templates/blocks/components/DateRangeInput/DateRangeInputWithPresets.doc.mjs +14 -0
- package/templates/blocks/components/DateRangeInput/DateRangeInputWithPresets.tsx +46 -0
- package/templates/blocks/components/DateRangeInput/DateRangeInputWithValidation.doc.mjs +14 -0
- package/templates/blocks/components/DateRangeInput/DateRangeInputWithValidation.tsx +52 -0
- package/templates/blocks/components/DateTimeInput/DateTimeInputWithValidation.doc.mjs +14 -0
- package/templates/blocks/components/DateTimeInput/DateTimeInputWithValidation.tsx +43 -0
- package/templates/blocks/components/DialogHeader/DialogHeaderBasic.doc.mjs +14 -0
- package/templates/blocks/components/DialogHeader/DialogHeaderBasic.tsx +30 -0
- package/templates/blocks/components/DropdownMenu/DropdownMenuShowcase.tsx +0 -6
- package/templates/blocks/components/DropdownMenuItem/DropdownMenuItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/DropdownMenuItem/DropdownMenuItemBasic.tsx +27 -0
- package/templates/blocks/components/DropdownMenuItem/DropdownMenuItemShowcase.tsx +1 -5
- package/templates/blocks/components/FieldLabel/FieldLabelBasic.doc.mjs +14 -0
- package/templates/blocks/components/FieldLabel/FieldLabelBasic.tsx +20 -0
- package/templates/blocks/components/FieldStatus/FieldStatusBasic.doc.mjs +14 -0
- package/templates/blocks/components/FieldStatus/FieldStatusBasic.tsx +23 -0
- package/templates/blocks/components/FileInput/FileInputBasic.doc.mjs +14 -0
- package/templates/blocks/components/FileInput/FileInputBasic.tsx +22 -0
- package/templates/blocks/components/GridSpan/GridSpanColumns.doc.mjs +14 -0
- package/templates/blocks/components/GridSpan/GridSpanColumns.tsx +38 -0
- package/templates/blocks/components/HStack/HStackBasic.doc.mjs +14 -0
- package/templates/blocks/components/HStack/HStackBasic.tsx +16 -0
- package/templates/blocks/components/Hooks/useKeyboardHintHookUsage.doc.mjs +14 -0
- package/templates/blocks/components/Hooks/useKeyboardHintHookUsage.tsx +57 -0
- package/templates/blocks/components/HoverCard/HoverCardInteractiveContent.doc.mjs +1 -1
- package/templates/blocks/components/HoverCard/HoverCardInteractiveContent.tsx +9 -4
- package/templates/blocks/components/InputGroup/InputGroupBasic.doc.mjs +14 -0
- package/templates/blocks/components/InputGroup/InputGroupBasic.tsx +27 -0
- package/templates/blocks/components/LayoutContent/LayoutContentBasic.doc.mjs +23 -0
- package/templates/blocks/components/LayoutContent/LayoutContentBasic.tsx +40 -0
- package/templates/blocks/components/LayoutFooter/LayoutFooterActions.doc.mjs +22 -0
- package/templates/blocks/components/LayoutFooter/LayoutFooterActions.tsx +41 -0
- package/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.doc.mjs +23 -0
- package/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.tsx +40 -0
- package/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.doc.mjs +22 -0
- package/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.tsx +37 -0
- package/templates/blocks/components/Lightbox/LightboxGallery.doc.mjs +14 -0
- package/templates/blocks/components/Lightbox/LightboxGallery.tsx +53 -0
- package/templates/blocks/components/Lightbox/LightboxShowcase.tsx +4 -3
- package/templates/blocks/components/Lightbox/LightboxVideo.doc.mjs +14 -0
- package/templates/blocks/components/Lightbox/LightboxVideo.tsx +27 -0
- package/templates/blocks/components/Lightbox/LightboxZoom.doc.mjs +14 -0
- package/templates/blocks/components/Lightbox/LightboxZoom.tsx +33 -0
- package/templates/blocks/components/LinkProvider/LinkProviderCustomLink.doc.mjs +1 -1
- package/templates/blocks/components/MetadataListItem/MetadataListItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/MetadataListItem/MetadataListItemBasic.tsx +19 -0
- package/templates/blocks/components/MobileNavToggle/MobileNavToggleBasic.doc.mjs +23 -0
- package/templates/blocks/components/MobileNavToggle/MobileNavToggleBasic.tsx +42 -0
- package/templates/blocks/components/MoreMenu/MoreMenuShowcase.tsx +0 -6
- package/templates/blocks/components/NavIcon/NavIconBasic.doc.mjs +14 -0
- package/templates/blocks/components/NavIcon/NavIconBasic.tsx +16 -0
- package/templates/blocks/components/RadioListItem/RadioListItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/RadioListItem/RadioListItemBasic.tsx +30 -0
- package/templates/blocks/components/Resizable/ResizableSidebar.doc.mjs +25 -0
- package/templates/blocks/components/Resizable/ResizableSidebar.tsx +67 -0
- package/templates/blocks/components/SegmentedControlItem/SegmentedControlItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/SegmentedControlItem/SegmentedControlItemBasic.tsx +21 -0
- package/templates/blocks/components/SelectorOption/SelectorOptionBasic.doc.mjs +14 -0
- package/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +39 -0
- package/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonBasic.doc.mjs +14 -0
- package/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonBasic.tsx +55 -0
- package/templates/blocks/components/SideNavHeading/SideNavHeadingBasic.doc.mjs +14 -0
- package/templates/blocks/components/SideNavHeading/SideNavHeadingBasic.tsx +38 -0
- package/templates/blocks/components/SideNavItem/SideNavItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/SideNavItem/SideNavItemBasic.tsx +49 -0
- package/templates/blocks/components/SideNavSection/SideNavSectionBasic.doc.mjs +14 -0
- package/templates/blocks/components/SideNavSection/SideNavSectionBasic.tsx +71 -0
- package/templates/blocks/components/StackItem/StackItemFill.doc.mjs +14 -0
- package/templates/blocks/components/StackItem/StackItemFill.tsx +28 -0
- package/templates/blocks/components/Tab/TabWithSelectedIcon.doc.mjs +13 -0
- package/templates/blocks/components/Tab/TabWithSelectedIcon.tsx +39 -0
- package/templates/blocks/components/TabMenu/TabMenuBasic.doc.mjs +14 -0
- package/templates/blocks/components/TabMenu/TabMenuBasic.tsx +23 -0
- package/templates/blocks/components/Table/StickyColumnsHookUsage.doc.mjs +1 -1
- package/templates/blocks/components/ToggleButtonGroup/ToggleButtonGroupVertical.doc.mjs +14 -0
- package/templates/blocks/components/ToggleButtonGroup/ToggleButtonGroupVertical.tsx +47 -0
- package/templates/blocks/components/TopNavHeading/TopNavHeadingBasic.doc.mjs +14 -0
- package/templates/blocks/components/TopNavHeading/TopNavHeadingBasic.tsx +22 -0
- package/templates/blocks/components/TopNavItem/TopNavItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/TopNavItem/TopNavItemBasic.tsx +21 -0
- package/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.doc.mjs +20 -0
- package/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.tsx +46 -0
- package/templates/blocks/components/TopNavMegaMenuFeaturedCard/TopNavMegaMenuFeaturedCardBasic.doc.mjs +14 -0
- package/templates/blocks/components/TopNavMegaMenuFeaturedCard/TopNavMegaMenuFeaturedCardBasic.tsx +16 -0
- package/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.tsx +26 -0
- package/templates/blocks/components/TopNavMenu/TopNavMenuBasic.doc.mjs +14 -0
- package/templates/blocks/components/TopNavMenu/TopNavMenuBasic.tsx +43 -0
- package/templates/blocks/components/TypeaheadItem/TypeaheadItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/TypeaheadItem/TypeaheadItemBasic.tsx +43 -0
- package/templates/blocks/components/VStack/VStackBasic.doc.mjs +14 -0
- package/templates/blocks/components/VStack/VStackBasic.tsx +20 -0
- package/templates/pages/kanban-board/page.tsx +729 -0
- package/templates/pages/kanban-board/template.doc.mjs +12 -0
- package/templates/pages/shell-nav/page.tsx +321 -0
- package/templates/pages/shell-nav/template.doc.mjs +12 -0
- package/templates/pages/shell-side-nav/page.tsx +241 -0
- package/templates/pages/shell-side-nav/template.doc.mjs +12 -0
- package/templates/pages/shell-top-nav/page.tsx +224 -0
- package/templates/pages/shell-top-nav/template.doc.mjs +12 -0
- package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-config-surfaces.test.mjs +0 -116
- package/src/codemods/transforms/v0.1.0/migrate-xds-config-surfaces.mjs +0 -230
- package/src/commands/gap-report.mjs +0 -464
- package/src/commands/gap-report.test.mjs +0 -168
- package/src/commands/swizzle-gap-safety.test.mjs +0 -273
- package/src/lib/config.mjs +0 -113
- package/src/lib/config.test.mjs +0 -91
- package/src/types/gap-report.d.ts +0 -29
- package/templates/blocks/components/TreeListBranches/TreeListBranchesShowcase.doc.mjs +0 -14
- package/templates/blocks/components/TreeListBranches/TreeListBranchesShowcase.tsx +0 -64
- package/templates/blocks/components/TreeListItem/TreeListItemShowcase.doc.mjs +0 -14
- package/templates/blocks/components/TreeListItem/TreeListItemShowcase.tsx +0 -60
- /package/src/codemods/transforms/{v0.0.15 → v0.1.0}/__tests__/drop-xds-prefix-imports.test.mjs +0 -0
package/src/types/component.d.ts
CHANGED
|
@@ -28,7 +28,18 @@ import type {ComponentDoc, PropDoc} from '../../../core/src/docs-types';
|
|
|
28
28
|
/** xds --json component [--list] [--category X] [--detail brief] */
|
|
29
29
|
export interface ComponentListResponse {
|
|
30
30
|
type: 'component.list';
|
|
31
|
-
data: Record<string,
|
|
31
|
+
data: Record<string, ComponentListEntry[]>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A single entry in a `component.list` group. Pre-1.0 the list moved from bare
|
|
36
|
+
* strings to package-qualified objects so consumers can disambiguate ownership
|
|
37
|
+
* (core vs. an integration package).
|
|
38
|
+
*/
|
|
39
|
+
export interface ComponentListEntry {
|
|
40
|
+
name: string;
|
|
41
|
+
/** Owner package, e.g. '@astryxdesign/core' or '@acme/astryx-meta'. */
|
|
42
|
+
package: string;
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
/** xds --json component --list --detail compact */
|
|
@@ -52,7 +63,21 @@ export interface ComponentFullResponse {
|
|
|
52
63
|
/** xds --json component <name> */
|
|
53
64
|
export interface ComponentDetailResponse {
|
|
54
65
|
type: 'component.detail';
|
|
55
|
-
data: ComponentDoc;
|
|
66
|
+
data: ComponentDoc & ComponentOwnership;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Ownership metadata attached to every `component.detail` payload. Exposes the
|
|
71
|
+
* owner package, the import specifier, and whether a swizzleable source file is
|
|
72
|
+
* available — the inputs the integration-component swizzle (a later PR) needs.
|
|
73
|
+
*/
|
|
74
|
+
export interface ComponentOwnership {
|
|
75
|
+
/** Owner package, e.g. '@astryxdesign/core' or an integration package name. */
|
|
76
|
+
package: string;
|
|
77
|
+
/** Import specifier for the component (e.g. '@astryxdesign/core/Button'). */
|
|
78
|
+
import: string;
|
|
79
|
+
/** Whether a component source file exists for `--source` / swizzle. */
|
|
80
|
+
sourceAvailable: boolean;
|
|
56
81
|
}
|
|
57
82
|
|
|
58
83
|
/** xds --json component <name> --props */
|
package/src/types/config.d.ts
CHANGED
|
@@ -1,99 +1,70 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A command to run as part of a post-codemod hook. Returned by a hook's
|
|
5
|
+
* `buildCommand` and executed via `execFile` after codemods write files.
|
|
6
|
+
*/
|
|
7
|
+
export interface PostCodemodCommand {
|
|
8
|
+
command: string;
|
|
9
|
+
args?: string[];
|
|
10
|
+
options?: {
|
|
11
|
+
cwd?: string;
|
|
12
|
+
env?: NodeJS.ProcessEnv;
|
|
13
|
+
timeout?: number;
|
|
14
14
|
};
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface AstryxIntegrationCodemod {
|
|
19
|
-
name: string;
|
|
20
|
-
from?: string;
|
|
21
|
-
to?: string;
|
|
22
|
-
title?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
pr?: string;
|
|
25
|
-
optional?: boolean;
|
|
26
|
-
fileExtensions?: string[];
|
|
27
|
-
transform:
|
|
28
|
-
| string
|
|
29
|
-
| ((file: unknown, api: unknown) => string | undefined | null);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface AstryxPostCodemodContext {
|
|
33
|
-
packageDir: string;
|
|
34
|
-
codemodDir: string;
|
|
35
|
-
changedFiles: string[];
|
|
36
|
-
absoluteChangedFiles: string[];
|
|
37
|
-
packageChangedFiles: string[];
|
|
38
|
-
apply: boolean;
|
|
39
|
-
run: (
|
|
40
|
-
command: string,
|
|
41
|
-
args?: string[],
|
|
42
|
-
options?: {
|
|
43
|
-
cwd?: string;
|
|
44
|
-
timeoutMs?: number;
|
|
45
|
-
env?: Record<string, string>;
|
|
46
|
-
},
|
|
47
|
-
) => Promise<void>;
|
|
48
15
|
}
|
|
49
16
|
|
|
50
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A post-codemod hook. `buildCommand` receives the package directory and the
|
|
19
|
+
* list of files changed by codemods, and returns the command to run (or a
|
|
20
|
+
* nullish value to skip).
|
|
21
|
+
*/
|
|
22
|
+
export type PostCodemodHook = {
|
|
51
23
|
name?: string;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
cwd?: string;
|
|
58
|
-
timeoutMs?: number;
|
|
59
|
-
env?: Record<string, string>;
|
|
60
|
-
}
|
|
24
|
+
buildCommand: (ctx: {
|
|
25
|
+
packageDir: string;
|
|
26
|
+
files: string[];
|
|
27
|
+
}) =>
|
|
28
|
+
| PostCodemodCommand
|
|
61
29
|
| null
|
|
62
30
|
| undefined
|
|
63
|
-
| Promise<
|
|
64
|
-
|
|
65
|
-
command: string;
|
|
66
|
-
args?: string[];
|
|
67
|
-
cwd?: string;
|
|
68
|
-
timeoutMs?: number;
|
|
69
|
-
env?: Record<string, string>;
|
|
70
|
-
}
|
|
71
|
-
| null
|
|
72
|
-
| undefined
|
|
73
|
-
>;
|
|
74
|
-
}
|
|
31
|
+
| Promise<PostCodemodCommand | null | undefined>;
|
|
32
|
+
};
|
|
75
33
|
|
|
76
|
-
/**
|
|
77
|
-
export interface
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
34
|
+
/** A component XLE layout expressions can reference by name via `{hint}`. */
|
|
35
|
+
export interface XleComponent {
|
|
36
|
+
/** Import specifier the component is imported from, e.g. '@/components/KpiCard'. */
|
|
37
|
+
from: string;
|
|
38
|
+
/** Optional human description shown in tooling. */
|
|
81
39
|
description?: string;
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
40
|
+
/** Import as the module's default export instead of a named export. Defaults to false. */
|
|
41
|
+
default?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** User config exported from astryx.config.{ts,mjs,js}. */
|
|
45
|
+
export interface AstryxConfig {
|
|
46
|
+
/** Integration package names to load. */
|
|
47
|
+
integrations?: string[];
|
|
48
|
+
/** Where to file issues/feedback for this project. */
|
|
49
|
+
issuesUrl?: string;
|
|
50
|
+
/** Lifecycle hooks. */
|
|
51
|
+
hooks?: {
|
|
52
|
+
postCodemod?: PostCodemodHook[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* EXPERIMENTAL — shape may change and is not part of the stable config
|
|
56
|
+
* contract. Provisional home for features still being proven out.
|
|
57
|
+
*/
|
|
58
|
+
experimental?: {
|
|
59
|
+
/** Experimental XLE (layout expression) configuration. */
|
|
60
|
+
xle?: {
|
|
61
|
+
/**
|
|
62
|
+
* Register app-local components so XLE layout expressions can
|
|
63
|
+
* reference them by name via {hint}. Keyed by component name.
|
|
64
|
+
*/
|
|
65
|
+
components?: Record<string, XleComponent>;
|
|
66
|
+
};
|
|
90
67
|
};
|
|
91
|
-
codemods?: AstryxIntegrationCodemod[];
|
|
92
|
-
postCodemod?: AstryxPostCodemodHook[];
|
|
93
|
-
[key: string]: unknown;
|
|
94
68
|
}
|
|
95
69
|
|
|
96
70
|
export declare function createConfig<T extends AstryxConfig>(config: T): T;
|
|
97
|
-
export declare function createIntegration<T extends AstryxIntegration>(
|
|
98
|
-
integration: T,
|
|
99
|
-
): T;
|
|
@@ -25,6 +25,9 @@ export type ErrorCode =
|
|
|
25
25
|
| 'ERR_UNKNOWN_SECTION'
|
|
26
26
|
| 'ERR_UNKNOWN_CATEGORY'
|
|
27
27
|
| 'ERR_UNKNOWN_TEMPLATE'
|
|
28
|
+
| 'ERR_AMBIGUOUS_TEMPLATE'
|
|
29
|
+
| 'ERR_AMBIGUOUS_COMPONENT'
|
|
30
|
+
| 'ERR_UNKNOWN_THEME'
|
|
28
31
|
| 'ERR_UNKNOWN_PACKAGE'
|
|
29
32
|
| 'ERR_UNKNOWN_AGENT'
|
|
30
33
|
| 'ERR_UNKNOWN_FEATURE'
|
|
@@ -41,13 +44,12 @@ export type ErrorCode =
|
|
|
41
44
|
| 'ERR_WRITE_FAILED'
|
|
42
45
|
| 'ERR_THEME_INVALID'
|
|
43
46
|
| 'ERR_THEME_LOAD'
|
|
44
|
-
| 'ERR_TEMPLATE_CONFIG'
|
|
45
|
-
| 'ERR_TEMPLATE_GET'
|
|
46
47
|
| 'ERR_VERSION_DETECT'
|
|
47
48
|
| 'ERR_INVALID_VERSION'
|
|
48
49
|
| 'ERR_DEP_MISSING'
|
|
49
50
|
| 'ERR_GH_CLI'
|
|
50
|
-
| '
|
|
51
|
+
| 'ERR_LAYOUT_PARSE'
|
|
52
|
+
| 'ERR_LAYOUT_INVALID';
|
|
51
53
|
|
|
52
54
|
/** The frozen runtime map of all error codes (keys === values). */
|
|
53
55
|
export declare const ERROR_CODES: Readonly<Record<ErrorCode, ErrorCode>>;
|
package/src/types/index.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Integration manifest exported from a conventional root manifest file
|
|
5
|
+
* (astryx.integration.{ts,mjs,js}) sibling to the integration package's
|
|
6
|
+
* package.json. Identity (name/version) comes from the package's
|
|
7
|
+
* package.json, not from the manifest.
|
|
8
|
+
*/
|
|
9
|
+
export interface AstryxIntegration {
|
|
10
|
+
/** Relative path to the components/docs root (resolved to absolute). */
|
|
11
|
+
components?: string;
|
|
12
|
+
/** Relative path to the templates root (resolved to absolute). */
|
|
13
|
+
templates?: string;
|
|
14
|
+
/** Relative path to the codemods root (resolved to absolute). */
|
|
15
|
+
codemods?: string;
|
|
16
|
+
/** Where to file issues/feedback for this integration. */
|
|
17
|
+
issuesUrl?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** An issue surfaced by an integration. */
|
|
21
|
+
export interface AstryxIntegrationIssue {
|
|
22
|
+
code: string;
|
|
23
|
+
severity: 'warning' | 'error';
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare function createIntegration<T extends AstryxIntegration>(
|
|
28
|
+
integration: T,
|
|
29
|
+
): T;
|
package/src/types/swizzle.d.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* ------------------------------------------------------------------
|
|
8
8
|
* xds --json swizzle [--list] -> swizzle.list
|
|
9
9
|
* xds --json swizzle <component> -> swizzle.copy
|
|
10
|
-
* xds --json swizzle <component> --gap "x" -> swizzle.copy (with gapReport)
|
|
11
10
|
* (not found) -> CLIError
|
|
12
11
|
*/
|
|
13
12
|
|
|
@@ -17,6 +16,14 @@ export interface SwizzleListResponse {
|
|
|
17
16
|
data: string[];
|
|
18
17
|
}
|
|
19
18
|
|
|
19
|
+
/** Maintainer feedback note emitted after a successful swizzle. */
|
|
20
|
+
export interface SwizzleFeedback {
|
|
21
|
+
/** Where to report the gap that led to swizzling. */
|
|
22
|
+
issuesUrl: string;
|
|
23
|
+
/** Ready-to-run `gh issue create` command, when `gh` is available. */
|
|
24
|
+
ghCommand?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
/** xds --json swizzle <component> */
|
|
21
28
|
export interface SwizzleCopyResponse {
|
|
22
29
|
type: 'swizzle.copy';
|
|
@@ -25,6 +32,6 @@ export interface SwizzleCopyResponse {
|
|
|
25
32
|
outputDir: string;
|
|
26
33
|
filesCopied: number;
|
|
27
34
|
files: string[];
|
|
28
|
-
|
|
35
|
+
feedback?: SwizzleFeedback;
|
|
29
36
|
};
|
|
30
37
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Authoring surface for Astryx static templates, exported from
|
|
5
|
+
* `@astryxdesign/cli/template`.
|
|
6
|
+
*
|
|
7
|
+
* A template doc lives in a `<id>.doc.{ts,mjs,js}` file with a required
|
|
8
|
+
* same-stem sibling source file (`<id>.tsx`). The doc's `type` (page or
|
|
9
|
+
* block) — injected by the create* helpers — decides how the template is
|
|
10
|
+
* scaffolded; there is no `/pages` vs `/blocks` directory requirement.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Optional preview metadata for a template (used by docs surfaces). */
|
|
14
|
+
export interface AstryxTemplatePreview {
|
|
15
|
+
/** Path or URL to a preview image. */
|
|
16
|
+
image?: string;
|
|
17
|
+
/** CSS aspect-ratio hint for the preview, e.g. "16 / 9". */
|
|
18
|
+
aspectRatio?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Fields common to page and block template docs (without the `type` tag). */
|
|
22
|
+
export interface AstryxTemplateInput {
|
|
23
|
+
/** Human-readable template name. Required. */
|
|
24
|
+
name: string;
|
|
25
|
+
/** One-line description of what the template provides. Required. */
|
|
26
|
+
description: string;
|
|
27
|
+
/** Optional grouping/category label. */
|
|
28
|
+
category?: string;
|
|
29
|
+
/** Component display names the template composes. */
|
|
30
|
+
componentsUsed?: string[];
|
|
31
|
+
/** Optional preview metadata. */
|
|
32
|
+
preview?: AstryxTemplatePreview;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Input accepted by {@link createPageTemplate} (no `type` field). */
|
|
36
|
+
export type AstryxPageTemplateInput = AstryxTemplateInput;
|
|
37
|
+
/** Input accepted by {@link createBlockTemplate} (no `type` field). */
|
|
38
|
+
export type AstryxBlockTemplateInput = AstryxTemplateInput;
|
|
39
|
+
|
|
40
|
+
/** A validated page template doc. */
|
|
41
|
+
export type AstryxPageTemplate = AstryxTemplateInput & {type: 'page'};
|
|
42
|
+
/** A validated block template doc. */
|
|
43
|
+
export type AstryxBlockTemplate = AstryxTemplateInput & {type: 'block'};
|
|
44
|
+
|
|
45
|
+
/** A validated template doc (page or block). */
|
|
46
|
+
export type AstryxTemplate = AstryxPageTemplate | AstryxBlockTemplate;
|
|
47
|
+
|
|
48
|
+
export declare function createPageTemplate<T extends AstryxPageTemplateInput>(
|
|
49
|
+
def: T,
|
|
50
|
+
): T & {type: 'page'};
|
|
51
|
+
|
|
52
|
+
export declare function createBlockTemplate<T extends AstryxBlockTemplateInput>(
|
|
53
|
+
def: T,
|
|
54
|
+
): T & {type: 'block'};
|
package/src/types/template.d.ts
CHANGED
|
@@ -21,12 +21,21 @@ export interface TemplateListResponse {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface TemplateListEntry {
|
|
24
|
+
/** Stable template id (relative path under the templates root, minus the .doc.* suffix). */
|
|
25
|
+
id: string;
|
|
24
26
|
name: string;
|
|
27
|
+
/** @deprecated Alias of `name`, retained for back-compat. */
|
|
25
28
|
displayName: string;
|
|
26
29
|
description: string;
|
|
30
|
+
type: 'page' | 'block';
|
|
31
|
+
/** Owning package; core (built-in) templates report '@astryxdesign/core'. */
|
|
32
|
+
package: string;
|
|
33
|
+
/** Optional grouping/category label. */
|
|
34
|
+
category?: string;
|
|
35
|
+
/** Component display names the template composes. */
|
|
36
|
+
componentsUsed?: string[];
|
|
27
37
|
isReady: boolean;
|
|
28
38
|
scaffold?: boolean;
|
|
29
|
-
type: 'page' | 'block';
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
/** xds --json template <name> */
|
|
@@ -62,9 +71,3 @@ export interface TemplateCopyResponse {
|
|
|
62
71
|
filesCopied: number;
|
|
63
72
|
};
|
|
64
73
|
}
|
|
65
|
-
|
|
66
|
-
/** xds --json template get --id <id> */
|
|
67
|
-
export interface TemplateGetResponse {
|
|
68
|
-
type: 'template.get';
|
|
69
|
-
data: {id: string; source: string};
|
|
70
|
-
}
|
package/src/types/upgrade.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* ------------------------------------------------------------------
|
|
8
8
|
* xds --json upgrade --list -> upgrade.list
|
|
9
9
|
* xds --json upgrade [--apply] -> upgrade.run
|
|
10
|
+
* xds --json upgrade (status short-circuit) -> upgrade.status
|
|
10
11
|
* (version detection failure) -> CLIError
|
|
11
12
|
*/
|
|
12
13
|
|
|
@@ -33,3 +34,31 @@ export interface UpgradeRunResponse {
|
|
|
33
34
|
agentDocsRefreshed: boolean;
|
|
34
35
|
};
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* xds --json upgrade — short-circuit status results.
|
|
40
|
+
*
|
|
41
|
+
* - `up_to_date`: `--from` is >= installed target and `--force` was not passed.
|
|
42
|
+
* - `no_codemods`: no codemods (core or integration) apply to the range.
|
|
43
|
+
* - `config_fixable`: DRY-RUN ONLY. The consumer's astryx.config currently
|
|
44
|
+
* fails strict validation, but a pending core CONFIG codemod (in the selected
|
|
45
|
+
* range) would repair it. The dry run previews the fix without writing and
|
|
46
|
+
* reports the exact command to apply it; integrations are skipped for the
|
|
47
|
+
* preview (they will be processed on the `--apply` run).
|
|
48
|
+
*/
|
|
49
|
+
export interface UpgradeStatusResponse {
|
|
50
|
+
type: 'upgrade.status';
|
|
51
|
+
data:
|
|
52
|
+
| {status: 'up_to_date'; from: string; to: string}
|
|
53
|
+
| {status: 'no_codemods'; from: string; to: string}
|
|
54
|
+
| {
|
|
55
|
+
status: 'config_fixable';
|
|
56
|
+
from: string;
|
|
57
|
+
to: string;
|
|
58
|
+
configError: string;
|
|
59
|
+
configCodemods: string[];
|
|
60
|
+
suggestedCommand: string;
|
|
61
|
+
message: string;
|
|
62
|
+
note: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* validate-integration command JSON responses.
|
|
5
|
+
*
|
|
6
|
+
* Invocation -> type discriminator
|
|
7
|
+
* ------------------------------------------------------------
|
|
8
|
+
* astryx --json validate-integration -> integration.validate
|
|
9
|
+
* astryx --json validate-integration <pkg> -> integration.validate
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type {AstryxIntegrationIssue} from './integration';
|
|
13
|
+
|
|
14
|
+
/** astryx --json validate-integration [package] */
|
|
15
|
+
export interface ValidateIntegrationResponse {
|
|
16
|
+
type: 'integration.validate';
|
|
17
|
+
data: {
|
|
18
|
+
/** Integration package name, or null when no manifest was located. */
|
|
19
|
+
name: string | null;
|
|
20
|
+
/** Integration package version, or null when unavailable. */
|
|
21
|
+
version: string | null;
|
|
22
|
+
issues: AstryxIntegrationIssue[];
|
|
23
|
+
};
|
|
24
|
+
}
|