@astryxdesign/cli 0.7.2-canary.7462c41 → 0.7.2-canary.7ae39ea
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 +6 -6
- package/api/doctor/doctor.mjs +27 -3
- package/api/doctor/doctor.test.mjs +43 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +9 -3
- package/api/integration/validateIntegration.doc.mjs +3 -1
- package/api/search/search.d.mts +59 -6
- package/api/search/search.domain-priority.test.mjs +15 -0
- package/api/search/search.mjs +468 -28
- package/api/search/search.test.mjs +139 -0
- package/assets/docs/styling-overview.doc.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 +6 -18
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/check-the-props.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +10 -5
- package/assets/docs/tree/checks.doc.mjs +3 -3
- 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 +4 -0
- package/assets/docs/tree/links.doc.mjs +5 -4
- 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 +3 -7
- package/assets/docs/tree/publishing.doc.mjs +1 -1
- package/assets/docs/tree/quick-start.doc.mjs +7 -19
- package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
- package/assets/docs/tree/replace-a-core-template.doc.mjs +5 -7
- 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/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 +2 -2
- 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/template.doc.mjs +2 -2
- 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/integration/integration.doc.mjs +4 -3
- package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +3 -1
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +3 -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/index.mjs +29 -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/discovery/authoring-self-docs.mjs +1 -1
- package/foundation/discovery/doc-types.d.mts +1 -1
- package/foundation/discovery/doc-types.mjs +3 -3
- package/foundation/discovery/doc-types.test.mjs +48 -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 +1 -1
- package/foundation/discovery/prop-drift.mjs +2 -2
- package/foundation/discovery/prop-drift.test.mjs +55 -2
- package/foundation/discovery/type-text.mjs +1 -1
- package/foundation/discovery/type-text.test.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +6 -2
- package/package.json +9 -9
- package/scripts/postinstall.mjs +3 -3
|
@@ -47,6 +47,7 @@ import {loadComponentDoc} from './component-loader.mjs';
|
|
|
47
47
|
import {readPackageTsconfig} from './package-tsconfig.mjs';
|
|
48
48
|
import {
|
|
49
49
|
resolveProjectTypeScript,
|
|
50
|
+
TYPESCRIPT_FIX,
|
|
50
51
|
unusableTypeScriptReason,
|
|
51
52
|
} from './project-typescript.mjs';
|
|
52
53
|
import {judgeType} from './type-match.mjs';
|
|
@@ -158,8 +159,7 @@ const outside = (name, code) =>
|
|
|
158
159
|
const HOOK_NAME = /^use[A-Z0-9]/;
|
|
159
160
|
|
|
160
161
|
/** The line both surfaces print when the compiler is missing. */
|
|
161
|
-
export const TYPESCRIPT_MISSING_REASON =
|
|
162
|
-
'TypeScript is not installed in this project, so documented props were not compared with the code. Install typescript and run this check again.';
|
|
162
|
+
export const TYPESCRIPT_MISSING_REASON = `TypeScript is not installed in this project, so documented props were not compared with the code. ${TYPESCRIPT_FIX}`;
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
* @template T
|
|
@@ -58,6 +58,37 @@ function withTypeScript() {
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* TypeScript 7 (no JavaScript compiler API) with the TypeScript 6 API package
|
|
63
|
+
* beside it, which re-exports a real TypeScript.
|
|
64
|
+
*/
|
|
65
|
+
function withTypeScript7AndItsTypeScript6Api() {
|
|
66
|
+
const ts7 = path.join(pkg, 'node_modules', 'typescript');
|
|
67
|
+
fs.mkdirSync(ts7, {recursive: true});
|
|
68
|
+
fs.writeFileSync(
|
|
69
|
+
path.join(ts7, 'package.json'),
|
|
70
|
+
JSON.stringify({
|
|
71
|
+
name: 'typescript',
|
|
72
|
+
version: '7.0.2',
|
|
73
|
+
exports: {'./package.json': './package.json'},
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
const ts6 = path.join(pkg, 'node_modules', '@typescript', 'typescript6');
|
|
77
|
+
fs.mkdirSync(ts6, {recursive: true});
|
|
78
|
+
fs.writeFileSync(
|
|
79
|
+
path.join(ts6, 'package.json'),
|
|
80
|
+
JSON.stringify({
|
|
81
|
+
name: '@typescript/typescript6',
|
|
82
|
+
version: '6.0.2',
|
|
83
|
+
main: 'index.js',
|
|
84
|
+
}),
|
|
85
|
+
);
|
|
86
|
+
fs.writeFileSync(
|
|
87
|
+
path.join(ts6, 'index.js'),
|
|
88
|
+
`module.exports = require(${JSON.stringify(TYPESCRIPT_DIR)});\n`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
61
92
|
/**
|
|
62
93
|
* Write `components/<name>.tsx` and its doc; returns its prop table, which
|
|
63
94
|
* also carries the component record (name, docPath, sourcePath).
|
|
@@ -176,7 +207,8 @@ describe('comparePropTables', () => {
|
|
|
176
207
|
expect(await compare([component('Badge', source, doc)])).toMatchObject({
|
|
177
208
|
findings: [],
|
|
178
209
|
typesCompared: 0,
|
|
179
|
-
typesSkipped:
|
|
210
|
+
typesSkipped:
|
|
211
|
+
'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
212
|
});
|
|
181
213
|
});
|
|
182
214
|
|
|
@@ -2179,6 +2211,23 @@ export const Hoc = withName((props: {label?: string}) => null);`;
|
|
|
2179
2211
|
]);
|
|
2180
2212
|
});
|
|
2181
2213
|
|
|
2214
|
+
it("compares with TypeScript 7's TypeScript 6 API package when the project has one", async () => {
|
|
2215
|
+
const badge = component(
|
|
2216
|
+
'Badge',
|
|
2217
|
+
'export function Badge(props: {label: string}) { return null; }\n',
|
|
2218
|
+
{props: [prop('label', 'number')]},
|
|
2219
|
+
);
|
|
2220
|
+
withTypeScript7AndItsTypeScript6Api();
|
|
2221
|
+
|
|
2222
|
+
const report = await compare([badge]);
|
|
2223
|
+
|
|
2224
|
+
expect(report.status).toBe('checked');
|
|
2225
|
+
// The comparison ran: the documented `number` is judged against `string`.
|
|
2226
|
+
expect(
|
|
2227
|
+
report.findings.map(f => `${f.component}.${f.prop} ${f.kind}`),
|
|
2228
|
+
).toContain('Badge.label type_mismatch');
|
|
2229
|
+
});
|
|
2230
|
+
|
|
2182
2231
|
it('skips with a reason, and compares nothing, without a TypeScript it can use', async () => {
|
|
2183
2232
|
const badge = component(
|
|
2184
2233
|
'Badge',
|
|
@@ -2196,6 +2245,7 @@ export const Hoc = withName((props: {label?: string}) => null);`;
|
|
|
2196
2245
|
});
|
|
2197
2246
|
|
|
2198
2247
|
expect(await compare([badge])).toEqual(skipped(TYPESCRIPT_MISSING_REASON));
|
|
2248
|
+
expect(TYPESCRIPT_MISSING_REASON).toContain('npm install -D typescript@6');
|
|
2199
2249
|
// TypeScript 7 has no JavaScript compiler API to load.
|
|
2200
2250
|
const dir = path.join(pkg, 'node_modules', 'typescript');
|
|
2201
2251
|
fs.mkdirSync(dir, {recursive: true});
|
|
@@ -2207,7 +2257,10 @@ export const Hoc = withName((props: {label?: string}) => null);`;
|
|
|
2207
2257
|
exports: {'./package.json': './package.json'},
|
|
2208
2258
|
}),
|
|
2209
2259
|
);
|
|
2210
|
-
|
|
2260
|
+
const report = await compare([badge]);
|
|
2261
|
+
expect(report.reason).toContain('TypeScript 7.0.0');
|
|
2262
|
+
expect(report.reason).toContain('npm install -D @typescript/typescript6');
|
|
2263
|
+
expect(report).toEqual(
|
|
2211
2264
|
skipped(
|
|
2212
2265
|
unusableTypeScriptReason(
|
|
2213
2266
|
'7.0.0',
|
|
@@ -46,7 +46,7 @@ export function typeTextTooOld(ts) {
|
|
|
46
46
|
const [major, minor] = String(ts.version).split('.').map(Number);
|
|
47
47
|
return major > 4 || (major === 4 && minor >= 8)
|
|
48
48
|
? null
|
|
49
|
-
: `TypeScript ${ts.version} is older than 4.8, the oldest the type comparison reads`;
|
|
49
|
+
: `TypeScript ${ts.version} 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`;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/** How tightly a printed type binds: a slot needs at least its level. */
|
|
@@ -176,7 +176,7 @@ describe('normalizeTypeText', () => {
|
|
|
176
176
|
'string[]',
|
|
177
177
|
]);
|
|
178
178
|
expect(typeTextTooOld({version: '4.7.4'})).toBe(
|
|
179
|
-
'TypeScript 4.7.4 is older than 4.8, the oldest the type comparison reads',
|
|
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
180
|
);
|
|
181
181
|
for (const version of ['4.8.4', '5.0.4', '6.0.3', ts.version]) {
|
|
182
182
|
expect(typeTextTooOld({version})).toBeNull();
|
|
@@ -257,8 +257,12 @@ const RUNNERS = {
|
|
|
257
257
|
sites: ['importDocModule'],
|
|
258
258
|
},
|
|
259
259
|
'foundation/discovery/project-typescript.mjs': {
|
|
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",
|
|
261
|
-
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
|
+
],
|
|
262
266
|
},
|
|
263
267
|
'foundation/discovery/template-adapter.mjs': {
|
|
264
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',
|
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.7ae39ea",
|
|
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.7ae39ea",
|
|
105
|
+
"@astryxdesign/core": "0.7.2-canary.7ae39ea",
|
|
106
|
+
"@astryxdesign/lab": "0.7.2-canary.7ae39ea",
|
|
107
|
+
"@astryxdesign/theme-neutral": "0.7.2-canary.7ae39ea"
|
|
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.7ae39ea",
|
|
125
|
+
"@astryxdesign/core": "0.7.2-canary.7ae39ea",
|
|
126
|
+
"@astryxdesign/lab": "0.7.2-canary.7ae39ea",
|
|
127
|
+
"@astryxdesign/theme-neutral": "0.7.2-canary.7ae39ea",
|
|
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
|
}
|