@astryxdesign/cli 0.7.2-canary.01eab6a → 0.7.2-canary.020e1fe
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 +9 -8
- package/api/build/help/help.mjs +1 -1
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +244 -1
- package/api/docs/integrationDocs.test.mjs +124 -0
- package/api/doctor/doctor.mjs +27 -3
- package/api/doctor/doctor.test.mjs +43 -0
- package/api/doctor/theme-checks.mjs +1 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/init/run/run.mjs +2 -2
- package/api/integration/add-contribution.mjs +1 -1
- package/api/integration/add-contribution.test.mjs +4 -2
- package/api/integration/check/check.d.mts +96 -0
- package/api/integration/check/check.mjs +357 -0
- package/api/integration/check/check.test.mjs +489 -0
- package/api/integration/integration-check.type.d.mts +118 -0
- package/api/integration/integration-check.type.mjs +84 -0
- package/api/integration/integrationCheck.doc.d.mts +10 -0
- package/api/integration/integrationCheck.doc.mjs +73 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +27 -6
- package/api/integration/validate-integration.mjs +8 -0
- package/api/integration/validate-integration.test.mjs +11 -0
- package/api/integration/validate-integration.type.d.mts +8 -0
- package/api/integration/validate-integration.type.mjs +12 -1
- package/api/integration/validateIntegration.doc.mjs +19 -3
- package/api/search/search.d.mts +72 -12
- package/api/search/search.domain-priority.test.mjs +108 -18
- package/api/search/search.integration-check.test.mjs +24 -0
- package/api/search/search.mjs +501 -37
- package/api/search/search.test.mjs +139 -0
- package/api/theme/build/build.family.test.mjs +54 -6
- package/api/theme/build/build.mjs +114 -17
- package/api/theme/themeBuild.doc.mjs +4 -4
- package/assets/docs/README.md +10 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +3 -3
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.zh.mjs +1 -1
- package/assets/docs/tree/add-a-component.doc.mjs +1 -1
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +10 -7
- package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
- package/assets/docs/tree/block-template.doc.mjs +8 -20
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/check-the-props.doc.mjs +52 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +51 -5
- package/assets/docs/tree/checks.doc.mjs +21 -13
- package/assets/docs/tree/codemods.doc.mjs +4 -4
- package/assets/docs/tree/component-family.doc.mjs +3 -5
- package/assets/docs/tree/component-imports.doc.mjs +2 -2
- package/assets/docs/tree/components.doc.mjs +1 -1
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +7 -18
- package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
- package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
- package/assets/docs/tree/docs.doc.mjs +3 -3
- package/assets/docs/tree/document-the-template.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
- package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
- package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
- package/assets/docs/tree/integrations.doc.mjs +8 -0
- package/assets/docs/tree/links.doc.mjs +6 -5
- package/assets/docs/tree/migration-setup.doc.mjs +1 -0
- package/assets/docs/tree/migration-verification.doc.mjs +0 -1
- package/assets/docs/tree/migration.doc.mjs +0 -1
- package/assets/docs/tree/package-and-test.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +4 -8
- package/assets/docs/tree/publishing.doc.mjs +1 -1
- package/assets/docs/tree/quick-start.doc.mjs +37 -21
- package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
- package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
- package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
- package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
- package/assets/docs/tree/single-component.doc.mjs +12 -4
- package/assets/docs/tree/start-a-template.doc.mjs +3 -3
- package/assets/docs/tree/subcomponent.doc.mjs +6 -6
- package/assets/docs/tree/template-assets.doc.mjs +2 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +4 -15
- package/assets/docs/tree/template-fonts.doc.mjs +1 -1
- package/assets/docs/tree/template-icons.doc.mjs +1 -1
- package/assets/docs/tree/template-images-media.doc.mjs +1 -1
- package/assets/docs/tree/template-styles.doc.mjs +2 -2
- package/assets/docs/tree/templates.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
- package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
- package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
- package/assets/docs/tree/troubleshooting.doc.mjs +4 -4
- package/assets/docs/tree/type-scale.doc.mjs +3 -3
- package/assets/docs/tree/upgrading.doc.mjs +3 -3
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
- package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +6 -6
- package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
- package/assets/docs/use-a-theme.doc.mjs +2 -2
- package/assets/theme.template.ts +1 -1
- package/authoring/codemod/codemod.doc.mjs +7 -3
- package/authoring/config/config.doc.mjs +9 -6
- package/authoring/config/type.ts +4 -2
- package/authoring/discover/discover.doc.mjs +1 -1
- package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
- package/authoring/doctypes/command/command.doc.mjs +14 -12
- package/authoring/doctypes/component/component.doc.mjs +28 -25
- package/authoring/doctypes/component/type.ts +7 -5
- package/authoring/doctypes/enum/enum.doc.mjs +7 -4
- package/authoring/doctypes/function/function.doc.mjs +9 -8
- package/authoring/doctypes/hook/hook.doc.mjs +5 -4
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
- package/authoring/doctypes/reference/reference.doc.mjs +11 -10
- package/authoring/doctypes/schema/schema.doc.mjs +9 -9
- package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
- package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
- package/authoring/doctypes/template/parse.d.mts +6 -2
- package/authoring/doctypes/template/parse.mjs +3 -1
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/authoring/doctypes/template/type.ts +22 -0
- package/authoring/doctypes/theme/theme.doc.mjs +2 -2
- package/authoring/gap-report/gap-report.doc.mjs +2 -2
- package/authoring/identity/identity.doc.mjs +3 -3
- package/authoring/index.d.ts +1 -0
- package/authoring/integration/integration.doc.mjs +12 -4
- package/authoring/integration/parse.test.mjs +10 -0
- package/authoring/integration/schema.d.mts +2 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +4 -0
- package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
- package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +11 -4
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
- package/clients/cli/commands/doctor-integration.test.mjs +512 -2
- package/clients/cli/commands/doctor.mjs +116 -0
- package/clients/cli/commands/integration-check.doc.mjs +85 -0
- package/clients/cli/commands/integration-check.test.mjs +267 -0
- package/clients/cli/commands/integration.doc.mjs +6 -2
- package/clients/cli/commands/integration.mjs +107 -1
- package/clients/cli/commands/setup-nudge.test.mjs +79 -1
- package/clients/cli/commands/swizzle.mjs +5 -3
- package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
- package/clients/cli/commands/text-json-parity.test.mjs +5 -0
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/index.mjs +30 -5
- package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
- package/foundation/agent-docs/agent-doc-state.mjs +38 -0
- package/foundation/agent-docs/agent-docs.d.mts +2 -1
- package/foundation/agent-docs/agent-docs.mjs +8 -6
- package/foundation/config/project.mjs +82 -0
- package/foundation/discovery/authoring-self-docs.mjs +2 -1
- package/foundation/discovery/doc-types.d.mts +157 -0
- package/foundation/discovery/doc-types.mjs +1224 -0
- package/foundation/discovery/doc-types.test.mjs +700 -0
- package/foundation/discovery/docs-discovery.d.mts +81 -0
- package/foundation/discovery/docs-discovery.mjs +57 -0
- package/foundation/discovery/integration-doc-files.d.mts +22 -0
- package/foundation/discovery/integration-doc-files.mjs +231 -0
- package/foundation/discovery/integration-doc-files.test.mjs +246 -0
- package/foundation/discovery/project-typescript.d.mts +11 -2
- package/foundation/discovery/project-typescript.mjs +32 -4
- package/foundation/discovery/prop-drift.d.mts +62 -4
- package/foundation/discovery/prop-drift.mjs +561 -63
- package/foundation/discovery/prop-drift.test.mjs +1086 -11
- package/foundation/discovery/type-match.d.mts +53 -0
- package/foundation/discovery/type-match.mjs +660 -0
- package/foundation/discovery/type-match.test.mjs +169 -0
- package/foundation/discovery/type-text.d.mts +68 -0
- package/foundation/discovery/type-text.mjs +658 -0
- package/foundation/discovery/type-text.test.mjs +196 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +8 -2
- package/foundation/doc-compiler/links.d.mts +9 -5
- package/foundation/doc-compiler/links.mjs +4 -2
- package/foundation/response/response-types.doc.mjs +7 -2
- package/package.json +9 -9
- package/scripts/postinstall.mjs +3 -3
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @file The type-text normalization the prop type judgment compares by. */
|
|
4
|
+
|
|
5
|
+
import {createRequire} from 'node:module';
|
|
6
|
+
import {describe, expect, it} from 'vitest';
|
|
7
|
+
import {
|
|
8
|
+
normalizeTypeText as normalize,
|
|
9
|
+
typeTextTooOld,
|
|
10
|
+
UNPARSED,
|
|
11
|
+
} from './type-text.mjs';
|
|
12
|
+
|
|
13
|
+
const ts = createRequire(import.meta.url)('typescript');
|
|
14
|
+
/** @type {(text: string, options?: {optional?: boolean}) => readonly string[]} */
|
|
15
|
+
const normalizeTypeText = (text, options = {}) =>
|
|
16
|
+
normalize(text, {...options, ts});
|
|
17
|
+
|
|
18
|
+
describe('normalizeTypeText', () => {
|
|
19
|
+
it.each([
|
|
20
|
+
["'b' | 'a'", '"a" | "b"'],
|
|
21
|
+
['React.ReactNode', 'ReactNode'],
|
|
22
|
+
['Array<string>', 'string[]'],
|
|
23
|
+
['ReadonlyArray<"a" | "b">', "('a' | 'b')[]"],
|
|
24
|
+
['readonly string[]', 'string[]'],
|
|
25
|
+
['Readonly<Status>', 'Status'],
|
|
26
|
+
['true | false', 'boolean'],
|
|
27
|
+
["'sm' | string", 'string'],
|
|
28
|
+
['(e: MouseEvent) => void', '(event: MouseEvent) => void'],
|
|
29
|
+
['{b: number; a?: string}', '{ a?: string, b: number }'],
|
|
30
|
+
['{ /** doc */ a: string; }', '{a: string}'],
|
|
31
|
+
['{get /*c*/ a(): string}', '{get a(): string}'],
|
|
32
|
+
['{get a(): string; b: number}', '{b: number, get a(): string}'],
|
|
33
|
+
['{set a(v: string), b: number}', '{set a(v: string); b: number}'],
|
|
34
|
+
['{a: string, b: number}', '{a: string; b: number}'],
|
|
35
|
+
['"a"|"b"', "'a' | 'b'"],
|
|
36
|
+
['string | never', 'string'],
|
|
37
|
+
['Array<() => void>', '(() => void)[]'],
|
|
38
|
+
[
|
|
39
|
+
'Array<(value: string) => string | undefined>',
|
|
40
|
+
'((v: string) => string | undefined)[]',
|
|
41
|
+
],
|
|
42
|
+
['readonly ("a" | "b")[]', "ReadonlyArray<'a' | 'b'>"],
|
|
43
|
+
['readonly [string, number]', '[string, number]'],
|
|
44
|
+
['(() => void) | null', 'null | (() => void)'],
|
|
45
|
+
['() => (string | null)', '() => null | string'],
|
|
46
|
+
['(this: Window) => void', '(this: Window) => void'],
|
|
47
|
+
['(a: X, b: X) => a is T', '(c: X, d: X) => c is T'],
|
|
48
|
+
['Readonly<A & B>[]', '(A & B)[]'],
|
|
49
|
+
['Readonly<{a: string; b: number}>', '{b: number; a: string}'],
|
|
50
|
+
['Readonly<Record<string, string>>', 'Record<string, string>'],
|
|
51
|
+
["(v: unknown) => v is 'x'", "(value: unknown) => value is 'x'"],
|
|
52
|
+
['(a: A, b?: B) => void', '(x: A, y?: B) => void'],
|
|
53
|
+
['[a: string, b?: number]', '[string, number?]'],
|
|
54
|
+
["{'a': string}", '{a: string}'],
|
|
55
|
+
['1e3 | 1000', '1000'],
|
|
56
|
+
['T extends string ? (() => B) : C', 'T extends string ? () => B : C'],
|
|
57
|
+
['(A | B) | C', 'C | B | A'],
|
|
58
|
+
])('reads %s as %s', (a, b) => {
|
|
59
|
+
expect(normalizeTypeText(a)).toEqual(normalizeTypeText(b));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('returns a result no caller can change for the next', () => {
|
|
63
|
+
const first = normalizeTypeText("'b' | 'a'");
|
|
64
|
+
expect(() => /** @type {string[]} */ (first).push('c')).toThrow();
|
|
65
|
+
expect(normalizeTypeText("'b' | 'a'")).toEqual(["'a'", "'b'"]);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('drops undefined only on an optional prop', () => {
|
|
69
|
+
expect(normalizeTypeText('string | undefined', {optional: true})).toEqual([
|
|
70
|
+
'string',
|
|
71
|
+
]);
|
|
72
|
+
expect(normalizeTypeText('string | undefined')).toEqual([
|
|
73
|
+
'string',
|
|
74
|
+
'undefined',
|
|
75
|
+
]);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it.each([
|
|
79
|
+
["'a' | 'b'", "'a'"],
|
|
80
|
+
['(a: string) => void', '(a: number) => void'],
|
|
81
|
+
// An array of callbacks, and a callback that returns an array.
|
|
82
|
+
['(() => void)[]', '() => void[]'],
|
|
83
|
+
[
|
|
84
|
+
'((value: string) => string | undefined)[]',
|
|
85
|
+
'(value: string) => string | undefined[]',
|
|
86
|
+
],
|
|
87
|
+
['Array<() => void>', '() => void[]'],
|
|
88
|
+
// An array of an intersection, and an intersection with an array.
|
|
89
|
+
['(A & B)[]', 'A & B[]'],
|
|
90
|
+
['Array<A & B>', 'A & B[]'],
|
|
91
|
+
['(keyof T)[]', 'keyof T[]'],
|
|
92
|
+
['keyof (A & B)', 'keyof A & B'],
|
|
93
|
+
// `never` that is a whole type, not a union member.
|
|
94
|
+
['(x: never) => void', '() => void'],
|
|
95
|
+
['[never]', '[]'],
|
|
96
|
+
['Array<never>', '[]'],
|
|
97
|
+
// String literals as written.
|
|
98
|
+
["{a: 'x;y'}", "{a: 'x,y'}"],
|
|
99
|
+
["'readonly x'", "'x'"],
|
|
100
|
+
["'React.Node'", "'Node'"],
|
|
101
|
+
// A union around a function, and one in its return.
|
|
102
|
+
['(() => ReactNode) | null', '() => ReactNode | null'],
|
|
103
|
+
['(() => string) | undefined', '() => string | undefined'],
|
|
104
|
+
['Array<(() => ReactNode) | null>', 'Array<() => ReactNode | null>'],
|
|
105
|
+
['{f: (() => ReactNode) | null}', '{f: () => ReactNode | null}'],
|
|
106
|
+
// `this` is no ordinary parameter.
|
|
107
|
+
['(this: Window, e: Event) => void', '(w: Window, e: Event) => void'],
|
|
108
|
+
// A conditional's false branch takes the rest of a union.
|
|
109
|
+
['T extends string ? A : B | C', '(T extends string ? A : B) | C'],
|
|
110
|
+
// An array of `Readonly<A & B>` is no intersection with an array.
|
|
111
|
+
['Readonly<A & B>[]', 'A & B[]'],
|
|
112
|
+
// `keyof` keeps its operand apart from the name after it.
|
|
113
|
+
['Array<keyof (B)>', 'keyof (Array<B>)'],
|
|
114
|
+
// A type predicate names a parameter by its place.
|
|
115
|
+
['(a: X, b: X) => a is T', '(b: X, a: X) => a is T'],
|
|
116
|
+
[
|
|
117
|
+
"(a: unknown, b: unknown) => a is 'x'",
|
|
118
|
+
"(b: unknown, a: unknown) => a is 'x'",
|
|
119
|
+
],
|
|
120
|
+
// A function in a conditional's true branch returns only its own type.
|
|
121
|
+
[
|
|
122
|
+
'T extends string ? () => B : C | A',
|
|
123
|
+
'T extends string ? () => A | B : C',
|
|
124
|
+
],
|
|
125
|
+
// `Readonly<…>` keeps its argument grouped.
|
|
126
|
+
['Readonly<A | B> & C', 'A | (B & C)'],
|
|
127
|
+
['keyof Readonly<A & B>', '(keyof A) & B'],
|
|
128
|
+
// Overloads keep their order; an intersection's members keep theirs.
|
|
129
|
+
['{(a: string): A; (a: number): B}', '{(a: number): B; (a: string): A}'],
|
|
130
|
+
// Text that does not parse is kept as written.
|
|
131
|
+
['string?', 'string'],
|
|
132
|
+
// Text spelled as the printer prints a type, but that does not parse.
|
|
133
|
+
['((Item[]) => void)[]', '((items: Item[]) => void)[]'],
|
|
134
|
+
// A computed property name, and an index signature.
|
|
135
|
+
['{[K]: number}', '{[k: K]: number}'],
|
|
136
|
+
// A method named `'new'`, and a construct signature.
|
|
137
|
+
["{'new'(): X}", '{new(): X}'],
|
|
138
|
+
// A comment between two words separates them, as a space does.
|
|
139
|
+
['{get/*c*/a(): string}', '{geta(): string}'],
|
|
140
|
+
// Import attributes change which file a module resolves to.
|
|
141
|
+
[
|
|
142
|
+
"import('dual', {with: {'resolution-mode': 'import'}}).T",
|
|
143
|
+
"import('dual', {with: {'resolution-mode': 'require'}}).T",
|
|
144
|
+
],
|
|
145
|
+
])('keeps %s and %s different', (a, b) => {
|
|
146
|
+
expect(normalizeTypeText(a)).not.toEqual(normalizeTypeText(b));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('marks text that does not parse, and names a TypeScript too old to read types with', () => {
|
|
150
|
+
expect(normalizeTypeText('((Item[]) => void)[]')).toEqual([
|
|
151
|
+
`${UNPARSED}((Item[])=>void)[]`,
|
|
152
|
+
]);
|
|
153
|
+
// Forms only the checker rejects.
|
|
154
|
+
for (const text of [
|
|
155
|
+
'Foo<>',
|
|
156
|
+
'Array.<string>',
|
|
157
|
+
'{a: Map<>}',
|
|
158
|
+
'typeof Foo<>',
|
|
159
|
+
'?string',
|
|
160
|
+
'string?',
|
|
161
|
+
'*',
|
|
162
|
+
'function(string): void',
|
|
163
|
+
'{[K in keyof P]: P[K]; extra: string}',
|
|
164
|
+
'{public a: string}',
|
|
165
|
+
'(public a: string) => void',
|
|
166
|
+
'(a: string = "x") => void',
|
|
167
|
+
'<in T>(x: T) => void',
|
|
168
|
+
'{[k?: string]: number}',
|
|
169
|
+
'{[a: string, b: string]: number}',
|
|
170
|
+
"{a: string = 'x'}",
|
|
171
|
+
'Foo<A,>',
|
|
172
|
+
]) {
|
|
173
|
+
expect(normalizeTypeText(text)[0].startsWith(UNPARSED)).toBe(true);
|
|
174
|
+
}
|
|
175
|
+
expect(normalizeTypeText('Array /* v1.2 */ <string>')).toEqual([
|
|
176
|
+
'string[]',
|
|
177
|
+
]);
|
|
178
|
+
expect(typeTextTooOld({version: '4.7.4'})).toBe(
|
|
179
|
+
'TypeScript 4.7.4 is older than 4.8, the oldest the type comparison reads; install TypeScript 5.0 through 6 (`npm install -D typescript@6`), or on TypeScript 7 add `@typescript/typescript6`, to judge them',
|
|
180
|
+
);
|
|
181
|
+
for (const version of ['4.8.4', '5.0.4', '6.0.3', ts.version]) {
|
|
182
|
+
expect(typeTextTooOld({version})).toBeNull();
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('keeps a union around a function apart from one in its return, joined as the members are', () => {
|
|
187
|
+
for (const [a, b] of [
|
|
188
|
+
['(() => ReactNode) | null', '() => ReactNode | null'],
|
|
189
|
+
['(T extends string ? A : B) | C', 'T extends string ? A : B | C'],
|
|
190
|
+
]) {
|
|
191
|
+
expect(normalizeTypeText(a).join('|')).not.toBe(
|
|
192
|
+
normalizeTypeText(b).join('|'),
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
@@ -195,8 +195,10 @@ const RUNNERS = {
|
|
|
195
195
|
runs: SELF_DOCS,
|
|
196
196
|
sites: [
|
|
197
197
|
'import ../../../api/integration/integrationAdd.doc.mjs',
|
|
198
|
+
'import ../../../api/integration/integrationCheck.doc.mjs',
|
|
198
199
|
'import ../../../api/integration/integrationPackCheck.doc.mjs',
|
|
199
200
|
'import ./integration-add.doc.mjs',
|
|
201
|
+
'import ./integration-check.doc.mjs',
|
|
200
202
|
'import ./integration-pack.doc.mjs',
|
|
201
203
|
'import ./integration-verify.doc.mjs',
|
|
202
204
|
'import ./integration.doc.mjs',
|
|
@@ -255,8 +257,12 @@ const RUNNERS = {
|
|
|
255
257
|
sites: ['importDocModule'],
|
|
256
258
|
},
|
|
257
259
|
'foundation/discovery/project-typescript.mjs': {
|
|
258
|
-
runs: "the project's own typescript, for the author checks that read source and docs with it, and its package.json for the version of one they cannot use",
|
|
259
|
-
sites: [
|
|
260
|
+
runs: "the project's own typescript, for the author checks that read source and docs with it, and its package.json for the version of one they cannot use; beside TypeScript 7, which has no compiler API, the TypeScript 6 API package @typescript/typescript6",
|
|
261
|
+
sites: [
|
|
262
|
+
'require(<computed>)',
|
|
263
|
+
'require(typescript)',
|
|
264
|
+
'require(typescript/package.json)',
|
|
265
|
+
],
|
|
260
266
|
},
|
|
261
267
|
'foundation/discovery/template-adapter.mjs': {
|
|
262
268
|
runs: '@babel/parser, to find the fixture references and page-local bindings in template source; and a template doc that does not validate, to read the replacement it declares',
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
* @typedef {object} DocLink
|
|
14
14
|
* @property {string} target the target as written: `[<provider>:]<kind>:<name>`
|
|
15
15
|
* @property {string} id the doc's identity (a DocId)
|
|
16
|
-
* @property {string} route what `astryx docs <route>` opens
|
|
16
|
+
* @property {string | null} route what `astryx docs <route>` opens; null for a
|
|
17
|
+
* component, page, or block doc, which no docs route opens
|
|
17
18
|
* @property {string} title
|
|
18
19
|
* @property {string} summary
|
|
19
|
-
* @property {string} command the command that opens it
|
|
20
|
+
* @property {string} command the command that opens it: `astryx docs <route>`,
|
|
21
|
+
* or `astryx component` or `astryx template` for a component, page, or block
|
|
20
22
|
*/
|
|
21
23
|
/**
|
|
22
24
|
* Finds the doc a target names, or says why none matches.
|
|
@@ -118,13 +120,15 @@ export type DocLink = {
|
|
|
118
120
|
*/
|
|
119
121
|
id: string;
|
|
120
122
|
/**
|
|
121
|
-
* what `astryx docs <route>` opens
|
|
123
|
+
* what `astryx docs <route>` opens; null for a
|
|
124
|
+
* component, page, or block doc, which no docs route opens
|
|
122
125
|
*/
|
|
123
|
-
route: string;
|
|
126
|
+
route: string | null;
|
|
124
127
|
title: string;
|
|
125
128
|
summary: string;
|
|
126
129
|
/**
|
|
127
|
-
* the command that opens it
|
|
130
|
+
* the command that opens it: `astryx docs <route>`,
|
|
131
|
+
* or `astryx component` or `astryx template` for a component, page, or block
|
|
128
132
|
*/
|
|
129
133
|
command: string;
|
|
130
134
|
};
|
|
@@ -47,10 +47,12 @@ const CODE_SPAN = /(`[^`]*`)/;
|
|
|
47
47
|
* @typedef {object} DocLink
|
|
48
48
|
* @property {string} target the target as written: `[<provider>:]<kind>:<name>`
|
|
49
49
|
* @property {string} id the doc's identity (a DocId)
|
|
50
|
-
* @property {string} route what `astryx docs <route>` opens
|
|
50
|
+
* @property {string | null} route what `astryx docs <route>` opens; null for a
|
|
51
|
+
* component, page, or block doc, which no docs route opens
|
|
51
52
|
* @property {string} title
|
|
52
53
|
* @property {string} summary
|
|
53
|
-
* @property {string} command the command that opens it
|
|
54
|
+
* @property {string} command the command that opens it: `astryx docs <route>`,
|
|
55
|
+
* or `astryx component` or `astryx template` for a component, page, or block
|
|
54
56
|
*/
|
|
55
57
|
|
|
56
58
|
/**
|
|
@@ -332,7 +332,7 @@ export const doc = {
|
|
|
332
332
|
{
|
|
333
333
|
value: 'integration.validate',
|
|
334
334
|
description:
|
|
335
|
-
'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}.',
|
|
335
|
+
'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}. When the manifest loads, docTypes checks each doc against its published authoring type: status (checked | skipped), reason, typescript, docs, findings (all warnings, each naming the field and a fix), unchecked, and fixtures (test fixture docs not checked).',
|
|
336
336
|
},
|
|
337
337
|
{
|
|
338
338
|
value: 'integration.template-conflicts',
|
|
@@ -342,12 +342,17 @@ export const doc = {
|
|
|
342
342
|
{
|
|
343
343
|
value: 'integration.component-conflicts',
|
|
344
344
|
description:
|
|
345
|
-
'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. When the manifest loads and declares a components root, propDrift compares documented props with the TypeScript props: status (checked | skipped), reason, typescript, components, findings (all warnings), unchecked, and propsNotChecked.',
|
|
345
|
+
'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. When the manifest loads and declares a components root, propDrift compares documented props with the TypeScript props: status (checked | skipped), reason, typescript, components, typesCompared, typesSkipped, findings (all warnings), unchecked, typesNotCompared, and propsNotChecked.',
|
|
346
346
|
},
|
|
347
347
|
{
|
|
348
348
|
value: 'integration.doc-conflicts',
|
|
349
349
|
description:
|
|
350
350
|
'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
|
|
351
351
|
},
|
|
352
|
+
{
|
|
353
|
+
value: 'integration.check',
|
|
354
|
+
description:
|
|
355
|
+
'Every source check of an integration package in one result: validated (false when no integration manifest was found, so nothing was checked), the package name and version, strict, and checks, one entry per check (validate, components, templates, docs), each with check, errors, warnings, skipped, failed, and response, the envelope that check returns on its own. The totals are errors, warnings, and skipped; unchecked counts what the checks could not compare. With --strict, failures lists each warning and each piece of skipped work again as an error, in the issue format the checks use; it is empty without --strict. failed decides the exit code.',
|
|
356
|
+
},
|
|
352
357
|
],
|
|
353
358
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.2-canary.
|
|
3
|
+
"version": "0.7.2-canary.020e1fe",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"zod": "^4.4.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@astryxdesign/charts": "0.7.2-canary.
|
|
105
|
-
"@astryxdesign/core": "0.7.2-canary.
|
|
106
|
-
"@astryxdesign/lab": "0.7.2-canary.
|
|
107
|
-
"@astryxdesign/theme-neutral": "0.7.2-canary.
|
|
104
|
+
"@astryxdesign/charts": "0.7.2-canary.020e1fe",
|
|
105
|
+
"@astryxdesign/core": "0.7.2-canary.020e1fe",
|
|
106
|
+
"@astryxdesign/lab": "0.7.2-canary.020e1fe",
|
|
107
|
+
"@astryxdesign/theme-neutral": "0.7.2-canary.020e1fe"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@astryxdesign/charts": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "0.7.2-canary.
|
|
125
|
-
"@astryxdesign/core": "0.7.2-canary.
|
|
126
|
-
"@astryxdesign/lab": "0.7.2-canary.
|
|
127
|
-
"@astryxdesign/theme-neutral": "0.7.2-canary.
|
|
124
|
+
"@astryxdesign/charts": "0.7.2-canary.020e1fe",
|
|
125
|
+
"@astryxdesign/core": "0.7.2-canary.020e1fe",
|
|
126
|
+
"@astryxdesign/lab": "0.7.2-canary.020e1fe",
|
|
127
|
+
"@astryxdesign/theme-neutral": "0.7.2-canary.020e1fe",
|
|
128
128
|
"@heroicons/react": "^2.2.0",
|
|
129
129
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
130
|
"@types/babel__core": "^7.20.5",
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* installed as a project dependency and the project hasn't run init yet, print a
|
|
8
8
|
* one-line next-step so agents/humans discover it.
|
|
9
9
|
*
|
|
10
|
-
* Reuses the ONE setup check (
|
|
10
|
+
* Reuses the ONE setup check (isAstryxPromptInReach) from the dependency-free leaf
|
|
11
11
|
* ../foundation/agent-docs/agent-doc-state.mjs — node builtins only, so it is
|
|
12
12
|
* genuinely safe to load at install time (importing agent-docs.mjs would drag in
|
|
13
13
|
* the full CLI module graph). Non-interactive, never fails the install, and
|
|
@@ -41,10 +41,10 @@ async function projectIsSetUp(root) {
|
|
|
41
41
|
// Dep-free leaf (node builtins only) — safe to load mid-install. NOT
|
|
42
42
|
// agent-docs.mjs, whose static graph (component discovery, package-manager
|
|
43
43
|
// detection, …) isn't guaranteed importable yet during this postinstall.
|
|
44
|
-
const {
|
|
44
|
+
const {isAstryxPromptInReach} = await import(
|
|
45
45
|
'../foundation/agent-docs/agent-doc-state.mjs'
|
|
46
46
|
);
|
|
47
|
-
return
|
|
47
|
+
return isAstryxPromptInReach(root);
|
|
48
48
|
} catch {
|
|
49
49
|
return false; // best-effort — if the check can't load, fall through and nudge
|
|
50
50
|
}
|