@astryxdesign/cli 0.6.3-canary.e59d786 → 0.6.3-canary.e7723cd
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 +19 -17
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.mjs +60 -12
- package/api/component/list/list.mjs +3 -2
- package/api/docs/_adapter.d.mts +209 -28
- package/api/docs/_adapter.mjs +667 -35
- package/api/docs/detail/detail.mjs +11 -3
- package/api/docs/detail/section/section.mjs +24 -13
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/docs/docs.d.mts +5 -3
- package/api/docs/docs.doc.mjs +35 -15
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +165 -2
- package/api/docs/docs.type.mjs +101 -3
- package/api/docs/index/index.mjs +11 -3
- package/api/docs/index/index.test.mjs +1 -1
- package/api/docs/integration-tree.test.mjs +547 -0
- package/api/docs/integrationDocs.test.mjs +14 -14
- package/api/docs/list/list.mjs +25 -5
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/doctor/doctor.d.mts +30 -2
- package/api/doctor/doctor.mjs +147 -8
- package/api/doctor/doctor.test.mjs +95 -7
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +1 -1
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +107 -5
- package/api/integration/add-contribution.test.mjs +137 -0
- package/api/integration/authoring-checks.mjs +125 -28
- package/api/integration/authoring-checks.test.mjs +171 -3
- package/api/integration/authoring-checks.type.mjs +6 -1
- package/api/integration/integration-authoring.type.d.mts +2 -0
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddDoc.doc.mjs +7 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationPackCheck.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
- package/api/integration/pack-check.mjs +34 -0
- package/api/integration/pack-check.test.mjs +121 -0
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/template-conflict-compatibility.test.mjs +73 -0
- package/api/integration/validate-integration.test.mjs +3 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/index.ts +2 -0
- package/api/layout/_adapter.mjs +20 -5
- package/api/search/search.d.mts +26 -1
- package/api/search/search.doc.mjs +4 -3
- package/api/search/search.mjs +308 -29
- package/api/search/search.test.mjs +91 -2
- package/api/search/search.type.d.mts +13 -1
- package/api/search/search.type.mjs +4 -1
- package/api/template/list/list.mjs +1 -0
- package/api/template/template-integration.test.mjs +1022 -3
- package/api/template/template.doc.mjs +27 -7
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +6 -8
- package/api/template/template.type.mjs +3 -2
- package/api/theme/template/template.test.mjs +5 -0
- package/api/theme/themeTemplate.doc.mjs +1 -1
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +4 -0
- package/assets/codemods/transforms/next/index.mjs +8 -0
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +2 -2
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +3 -3
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +71 -141
- package/authoring/doctypes/_schema.mjs +29 -2
- package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/load-contract.test.mjs +1 -1
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.mjs +3 -2
- package/authoring/doctypes/reference/reference.doc.mjs +6 -4
- package/authoring/doctypes/reference/type.ts +10 -8
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -1
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +4 -0
- package/authoring/doctypes/template/parse.test.mjs +18 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +8 -0
- package/authoring/identity/identity.doc.mjs +2 -2
- package/authoring/index.d.ts +1 -0
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.mjs +11 -45
- package/clients/cli/commands/build.mjs +5 -2
- package/clients/cli/commands/component/index.mjs +1 -1
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
- package/clients/cli/commands/discover.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +20 -8
- package/clients/cli/commands/docs.mjs +182 -68
- package/clients/cli/commands/docs.test.mjs +120 -16
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
- package/clients/cli/commands/doctor-integration.test.mjs +75 -1
- package/clients/cli/commands/doctor.mjs +53 -16
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/search.mjs +11 -2
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/template.doc.mjs +23 -6
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/text-json-parity.test.mjs +719 -0
- package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
- package/clients/cli/commands/upgrade.mjs +26 -7
- package/clients/cli/formatters/index.mjs +2 -0
- package/clients/cli/formatters/index.test.mjs +6 -0
- package/clients/cli/index.mjs +8 -0
- package/clients/cli/lib/manifest.mjs +9 -2
- package/foundation/agent-docs/agent-docs.mjs +1 -0
- package/foundation/agent-docs/agent-docs.test.mjs +10 -1
- package/foundation/config/project.d.mts +12 -11
- package/foundation/config/project.mjs +73 -59
- package/foundation/config/project.test.mjs +141 -5
- package/foundation/discovery/authoring-self-docs.test.mjs +20 -9
- package/foundation/discovery/cli-self-docs.d.mts +40 -34
- package/foundation/discovery/cli-self-docs.mjs +91 -115
- package/foundation/discovery/cli-self-docs.test.mjs +104 -166
- package/foundation/discovery/component-discovery.d.mts +38 -0
- package/foundation/discovery/component-discovery.mjs +48 -0
- package/foundation/discovery/docs-discovery.d.mts +105 -8
- package/foundation/discovery/docs-discovery.mjs +183 -18
- package/foundation/discovery/docs-discovery.test.mjs +63 -27
- package/foundation/discovery/docs-output-budget.d.mts +2 -2
- package/foundation/discovery/docs-output-budget.mjs +1 -1
- package/foundation/discovery/docs-section-key.d.mts +28 -10
- package/foundation/discovery/docs-section-key.mjs +134 -33
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/discovery/template-adapter.d.mts +92 -6
- package/foundation/discovery/template-adapter.mjs +453 -17
- package/foundation/discovery/template-adapter.test.mjs +42 -0
- package/foundation/discovery/template-conflict-release.d.mts +13 -0
- package/foundation/discovery/template-conflict-release.mjs +40 -0
- package/foundation/discovery/template-conflict-release.test.mjs +40 -0
- package/foundation/doc-compiler/bundle.mjs +61 -1
- package/foundation/doc-compiler/bundle.test.mjs +21 -10
- package/foundation/doc-compiler/compile.d.mts +113 -132
- package/foundation/doc-compiler/compile.mjs +57 -10
- package/foundation/doc-compiler/diagnostics.mjs +28 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
- package/foundation/doc-compiler/inputs.d.mts +2 -2
- package/foundation/doc-compiler/inputs.mjs +6 -1
- package/foundation/doc-compiler/ir.mjs +7 -0
- package/foundation/doc-compiler/lenses.d.mts +3 -2
- package/foundation/doc-compiler/lenses.mjs +2 -1
- package/foundation/doc-compiler/links.d.mts +135 -0
- package/foundation/doc-compiler/links.mjs +253 -0
- package/foundation/doc-compiler/links.test.mjs +139 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
- package/foundation/doc-compiler/read.d.mts +3 -2
- package/foundation/doc-compiler/read.mjs +6 -1
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +109 -0
- package/foundation/integrations/contribution-inventory.d.mts +2 -1
- package/foundation/integrations/contribution-inventory.mjs +10 -4
- package/foundation/integrations/contribution-inventory.test.mjs +19 -0
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +51 -26
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/validate-contributions.mjs +25 -27
- package/foundation/response/response-types.doc.d.mts +5 -1
- package/foundation/response/response-types.doc.mjs +18 -9
- package/foundation/xle/expand.mjs +1 -1
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +9 -9
- package/assets/docs/cli.doc.mjs +0 -15
|
@@ -280,6 +280,93 @@ describe('integrationPackCheck', () => {
|
|
|
280
280
|
expect(fileErrors.length).toBeGreaterThan(0);
|
|
281
281
|
});
|
|
282
282
|
|
|
283
|
+
it('fails a package that ships a namespace doc on a CLI range that cannot read it', async () => {
|
|
284
|
+
writePackage({manifest: "export default {docs: './docs'};\n", themes: false});
|
|
285
|
+
fs.mkdirSync(path.join(tmpDir, 'docs'), {recursive: true});
|
|
286
|
+
fs.writeFileSync(
|
|
287
|
+
path.join(tmpDir, 'docs', 'acme.doc.mjs'),
|
|
288
|
+
"export default {type: 'namespace', name: 'acme', title: 'Acme', summary: 'Acme guides.', slots: {guides: {title: 'Guides', accepts: {kinds: ['generic']}}}};\n",
|
|
289
|
+
);
|
|
290
|
+
fs.writeFileSync(
|
|
291
|
+
path.join(tmpDir, 'docs', 'deploying.doc.mjs'),
|
|
292
|
+
"export default {type: 'generic', name: 'deploying', title: 'Deploying', description: 'Ship it.', placement: {parent: 'namespace:acme', slot: 'guides'}, sections: [{title: 'Overview', content: [{type: 'prose', text: 'Ship it.'}]}]};\n",
|
|
293
|
+
);
|
|
294
|
+
const file = path.join(tmpDir, 'package.json');
|
|
295
|
+
const peer = (/** @type {string | undefined} */ range) => {
|
|
296
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
297
|
+
if (range == null) delete pkg.peerDependencies;
|
|
298
|
+
else pkg.peerDependencies = {'@astryxdesign/cli': range};
|
|
299
|
+
fs.writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
300
|
+
};
|
|
301
|
+
const codes = async () =>
|
|
302
|
+
(await integrationPackCheck({cwd: tmpDir})).data.issues.map(
|
|
303
|
+
(/** @type {{code: string}} */ issue) => issue.code,
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
peer(undefined);
|
|
307
|
+
expect(await codes()).toContain('docs_tree_needs_cli');
|
|
308
|
+
peer('^0.6.0 || >=0.7.0');
|
|
309
|
+
expect(await codes()).toContain('docs_tree_needs_cli');
|
|
310
|
+
peer('>=0.7.0');
|
|
311
|
+
expect(await codes()).not.toContain('docs_tree_needs_cli');
|
|
312
|
+
}, 120_000);
|
|
313
|
+
|
|
314
|
+
it('fails a package with only a placed guide on a CLI range that cannot read the docs tree, and passes flat topics', async () => {
|
|
315
|
+
writePackage({manifest: "export default {docs: './docs'};\n", themes: false});
|
|
316
|
+
fs.mkdirSync(path.join(tmpDir, 'docs'), {recursive: true});
|
|
317
|
+
fs.writeFileSync(
|
|
318
|
+
path.join(tmpDir, 'docs', 'notes.doc.mjs'),
|
|
319
|
+
"export default {type: 'generic', name: 'notes', title: 'Notes', description: 'Notes.', sections: [{title: 'Overview', content: [{type: 'prose', text: 'Notes.'}]}]};\n",
|
|
320
|
+
);
|
|
321
|
+
const codes = async () =>
|
|
322
|
+
(await integrationPackCheck({cwd: tmpDir})).data.issues.map(
|
|
323
|
+
(/** @type {{code: string}} */ issue) => issue.code,
|
|
324
|
+
);
|
|
325
|
+
// Flat topics alone need no CLI peer.
|
|
326
|
+
expect(await codes()).not.toContain('docs_tree_needs_cli');
|
|
327
|
+
fs.writeFileSync(
|
|
328
|
+
path.join(tmpDir, 'docs', 'setup.doc.mjs'),
|
|
329
|
+
"export default {type: 'generic', name: 'setup', title: 'Setup', description: 'Set up.', placement: {parent: 'namespace:acme', slot: 'guides'}, sections: [{title: 'Overview', content: [{type: 'prose', text: 'Set up.'}]}]};\n",
|
|
330
|
+
);
|
|
331
|
+
expect(await codes()).toContain('docs_tree_needs_cli');
|
|
332
|
+
const file = path.join(tmpDir, 'package.json');
|
|
333
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
334
|
+
pkg.peerDependencies = {'@astryxdesign/cli': '>=0.7.0'};
|
|
335
|
+
fs.writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
336
|
+
expect(await codes()).not.toContain('docs_tree_needs_cli');
|
|
337
|
+
}, 120_000);
|
|
338
|
+
|
|
339
|
+
it('fails a package with a template that sets replaces on a CLI range that rejects the field', async () => {
|
|
340
|
+
writePackage({manifest: "export default {templates: './templates'};\n", themes: false});
|
|
341
|
+
fs.mkdirSync(path.join(tmpDir, 'templates'), {recursive: true});
|
|
342
|
+
fs.writeFileSync(
|
|
343
|
+
path.join(tmpDir, 'templates', 'acme-shell.doc.mjs'),
|
|
344
|
+
"export default {type: 'page', name: 'acme-shell', description: 'Acme shell.', replaces: 'shell-side-nav'};\n",
|
|
345
|
+
);
|
|
346
|
+
fs.writeFileSync(
|
|
347
|
+
path.join(tmpDir, 'templates', 'acme-shell.tsx'),
|
|
348
|
+
'export default function AcmeShell() { return null; }\n',
|
|
349
|
+
);
|
|
350
|
+
const file = path.join(tmpDir, 'package.json');
|
|
351
|
+
const peer = (/** @type {string | undefined} */ range) => {
|
|
352
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
353
|
+
if (range == null) delete pkg.peerDependencies;
|
|
354
|
+
else pkg.peerDependencies = {'@astryxdesign/cli': range};
|
|
355
|
+
fs.writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
356
|
+
};
|
|
357
|
+
const codes = async () =>
|
|
358
|
+
(await integrationPackCheck({cwd: tmpDir})).data.issues.map(
|
|
359
|
+
(/** @type {{code: string}} */ issue) => issue.code,
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
peer(undefined);
|
|
363
|
+
expect(await codes()).toContain('replaces_needs_cli');
|
|
364
|
+
peer('^0.6.0');
|
|
365
|
+
expect(await codes()).toContain('replaces_needs_cli');
|
|
366
|
+
peer('>=0.7.0');
|
|
367
|
+
expect(await codes()).not.toContain('replaces_needs_cli');
|
|
368
|
+
}, 120_000);
|
|
369
|
+
|
|
283
370
|
it('passes when package.json has no files field', async () => {
|
|
284
371
|
writePackage({files: undefined});
|
|
285
372
|
const result = await integrationPackCheck({cwd: tmpDir});
|
|
@@ -288,6 +375,40 @@ describe('integrationPackCheck', () => {
|
|
|
288
375
|
expect(result.data.packable).toBe(true);
|
|
289
376
|
});
|
|
290
377
|
|
|
378
|
+
it('detects a lifecycle script that changes packed template replacements', async () => {
|
|
379
|
+
const script = [
|
|
380
|
+
"const fs=require('fs')",
|
|
381
|
+
"const p='templates/acme-shell.template.mjs'",
|
|
382
|
+
"const s=fs.readFileSync(p,'utf8')",
|
|
383
|
+
"fs.writeFileSync(p,s.replace('shell-side-nav','shell-top-nav'))",
|
|
384
|
+
].join(';');
|
|
385
|
+
writePackage({
|
|
386
|
+
manifest: "export default {templates: './templates'};\n",
|
|
387
|
+
files: ['astryx.integration.mjs', 'templates'],
|
|
388
|
+
themes: false,
|
|
389
|
+
scripts: {prepack: `node -e "${script}"`},
|
|
390
|
+
});
|
|
391
|
+
fs.mkdirSync(path.join(tmpDir, 'templates'));
|
|
392
|
+
fs.writeFileSync(
|
|
393
|
+
path.join(tmpDir, 'templates', 'acme-shell.template.mjs'),
|
|
394
|
+
"export default {type: 'page', name: 'Acme shell', description: 'Fixture.', replaces: 'shell-side-nav'};\n",
|
|
395
|
+
);
|
|
396
|
+
fs.writeFileSync(
|
|
397
|
+
path.join(tmpDir, 'templates', 'acme-shell.tsx'),
|
|
398
|
+
'export default function AcmeShell() { return null; }\n',
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
const result = await integrationPackCheck({cwd: tmpDir});
|
|
402
|
+
|
|
403
|
+
expect(result.data.packable).toBe(false);
|
|
404
|
+
expect(result.data.issues).toContainEqual(
|
|
405
|
+
expect.objectContaining({
|
|
406
|
+
code: 'identity_mismatch',
|
|
407
|
+
message: expect.stringContaining('acme-shell'),
|
|
408
|
+
}),
|
|
409
|
+
);
|
|
410
|
+
});
|
|
411
|
+
|
|
291
412
|
it('detects a lifecycle script that changes the packed identity', async () => {
|
|
292
413
|
const script = [
|
|
293
414
|
"const fs=require('fs')",
|
|
@@ -9,6 +9,30 @@ export type IntegrationPackCheckResponse = {
|
|
|
9
9
|
data: PackCheckData;
|
|
10
10
|
};
|
|
11
11
|
export type PackCheckResponse = IntegrationPackCheckResponse;
|
|
12
|
+
/**
|
|
13
|
+
* Public contribution inventory returned by pack-check. Kept here rather than
|
|
14
|
+
* importing the runtime inventory module so the type-only `/json` surface does
|
|
15
|
+
* not pull implementation dependencies into downstream type checking.
|
|
16
|
+
*/
|
|
17
|
+
export type PackCheckContributionIdentities = {
|
|
18
|
+
themes: {
|
|
19
|
+
slug: string;
|
|
20
|
+
exportName: string;
|
|
21
|
+
}[];
|
|
22
|
+
components: string[];
|
|
23
|
+
templates: {
|
|
24
|
+
id: string;
|
|
25
|
+
type: string;
|
|
26
|
+
name: string;
|
|
27
|
+
replaces?: string;
|
|
28
|
+
}[];
|
|
29
|
+
codemods: {
|
|
30
|
+
version: string;
|
|
31
|
+
id: string;
|
|
32
|
+
}[];
|
|
33
|
+
docs: string[];
|
|
34
|
+
agentDocsAppend: string[];
|
|
35
|
+
};
|
|
12
36
|
export type PackCheckData = {
|
|
13
37
|
name: string | null;
|
|
14
38
|
version: string | null;
|
|
@@ -19,8 +43,8 @@ export type PackCheckData = {
|
|
|
19
43
|
tarball: PackCheckTarball | null;
|
|
20
44
|
inventory: PackCheckInventory;
|
|
21
45
|
contributions: {
|
|
22
|
-
local:
|
|
23
|
-
packed:
|
|
46
|
+
local: PackCheckContributionIdentities | null;
|
|
47
|
+
packed: PackCheckContributionIdentities | null;
|
|
24
48
|
};
|
|
25
49
|
issues: import("../../foundation/integrations/issue").AstryxIntegrationIssue[];
|
|
26
50
|
};
|
|
@@ -17,6 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
/** @typedef {IntegrationPackCheckResponse} PackCheckResponse */
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Public contribution inventory returned by pack-check. Kept here rather than
|
|
22
|
+
* importing the runtime inventory module so the type-only `/json` surface does
|
|
23
|
+
* not pull implementation dependencies into downstream type checking.
|
|
24
|
+
* @typedef {object} PackCheckContributionIdentities
|
|
25
|
+
* @property {{slug: string, exportName: string}[]} themes
|
|
26
|
+
* @property {string[]} components
|
|
27
|
+
* @property {{id: string, type: string, name: string, replaces?: string}[]} templates
|
|
28
|
+
* @property {{version: string, id: string}[]} codemods
|
|
29
|
+
* @property {string[]} docs
|
|
30
|
+
* @property {string[]} agentDocsAppend
|
|
31
|
+
*/
|
|
32
|
+
|
|
20
33
|
/**
|
|
21
34
|
* @typedef {object} PackCheckData
|
|
22
35
|
* @property {string|null} name
|
|
@@ -24,7 +37,7 @@
|
|
|
24
37
|
* @property {boolean} packable — true when zero error-severity issues
|
|
25
38
|
* @property {PackCheckTarball|null} tarball
|
|
26
39
|
* @property {PackCheckInventory} inventory
|
|
27
|
-
* @property {{local:
|
|
40
|
+
* @property {{local: PackCheckContributionIdentities|null, packed: PackCheckContributionIdentities|null}} contributions
|
|
28
41
|
* @property {import('../../foundation/integrations/issue').AstryxIntegrationIssue[]} issues
|
|
29
42
|
*/
|
|
30
43
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Final-0.6.x compatibility coverage for integration-template conflicts.
|
|
5
|
+
* @input A future replacement declaration plus an ordinary released conflict.
|
|
6
|
+
* @output Proof that 0.6.x omits replacement-specific public fields.
|
|
7
|
+
* @position Regression fixture for the stable conflict response boundary.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {afterEach, beforeEach, describe, expect, it} from 'vitest';
|
|
11
|
+
import * as fs from 'node:fs';
|
|
12
|
+
import * as path from 'node:path';
|
|
13
|
+
import {discoverCoreTemplates} from '../../foundation/discovery/template-adapter.mjs';
|
|
14
|
+
import {integrationTemplateConflicts} from './authoring-checks.mjs';
|
|
15
|
+
|
|
16
|
+
let tmpDir;
|
|
17
|
+
|
|
18
|
+
function writeTemplate(pkgDir, id, type, replaces) {
|
|
19
|
+
const stem = path.join(pkgDir, 'templates', id);
|
|
20
|
+
fs.mkdirSync(path.dirname(stem), {recursive: true});
|
|
21
|
+
fs.writeFileSync(
|
|
22
|
+
`${stem}.doc.mjs`,
|
|
23
|
+
`export default {type: ${JSON.stringify(type)}, name: ${JSON.stringify(id)}, description: 'fixture'${replaces == null ? '' : `, replaces: ${JSON.stringify(replaces)}`}};\n`,
|
|
24
|
+
);
|
|
25
|
+
fs.writeFileSync(
|
|
26
|
+
`${stem}.tsx`,
|
|
27
|
+
`export default function Fixture() { return ${JSON.stringify(id)}; }\n`,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
tmpDir = fs.mkdtempSync(
|
|
33
|
+
path.join(process.cwd(), '.astryx-template-conflict-compat-'),
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('integration-template conflict compatibility on 0.6.x', () => {
|
|
42
|
+
it('preserves the released warning-only conflict shape', async () => {
|
|
43
|
+
const corePages = (await discoverCoreTemplates()).filter(
|
|
44
|
+
candidate => candidate.type === 'page',
|
|
45
|
+
);
|
|
46
|
+
const target = corePages[0];
|
|
47
|
+
const accidental = corePages[1];
|
|
48
|
+
expect(target).toBeDefined();
|
|
49
|
+
expect(accidental).toBeDefined();
|
|
50
|
+
|
|
51
|
+
fs.writeFileSync(
|
|
52
|
+
path.join(tmpDir, 'package.json'),
|
|
53
|
+
JSON.stringify({name: '@acme/widgets', version: '1.0.0'}),
|
|
54
|
+
);
|
|
55
|
+
fs.writeFileSync(
|
|
56
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
57
|
+
`export default {templates: './templates'};\n`,
|
|
58
|
+
);
|
|
59
|
+
writeTemplate(tmpDir, 'acme-future-shell', target.type, target.dirName);
|
|
60
|
+
writeTemplate(tmpDir, accidental.dirName, accidental.type);
|
|
61
|
+
|
|
62
|
+
const report = await integrationTemplateConflicts(undefined, {cwd: tmpDir});
|
|
63
|
+
|
|
64
|
+
expect(report.data.issues).toEqual([]);
|
|
65
|
+
expect(report.data.conflicts).toHaveLength(1);
|
|
66
|
+
expect(report.data.conflicts[0]).toMatchObject({
|
|
67
|
+
id: accidental.dirName,
|
|
68
|
+
severity: 'warning',
|
|
69
|
+
});
|
|
70
|
+
expect(report.data.conflicts[0]).not.toHaveProperty('relationship');
|
|
71
|
+
expect(report.data.conflicts[0]).not.toHaveProperty('replaces');
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -160,7 +160,7 @@ describe('validate-integration API', () => {
|
|
|
160
160
|
fs.mkdirSync(componentsDir);
|
|
161
161
|
fs.writeFileSync(
|
|
162
162
|
path.join(componentsDir, 'Widget.doc.mjs'),
|
|
163
|
-
`export default {name: 'Widget'};\n`,
|
|
163
|
+
`export default {name: 'Widget', props: []};\n`,
|
|
164
164
|
);
|
|
165
165
|
fs.writeFileSync(
|
|
166
166
|
path.join(componentsDir, 'Widget.tsx'),
|
|
@@ -485,7 +485,7 @@ export default {type: 'theme', name: 'ocean', displayName: 'Ocean', description:
|
|
|
485
485
|
fs.mkdirSync(cDir, {recursive: true});
|
|
486
486
|
fs.writeFileSync(
|
|
487
487
|
path.join(cDir, 'Widget.doc.mjs'),
|
|
488
|
-
`export default { name: 'Widget' };\n`,
|
|
488
|
+
`export default { type: 'component', name: 'Widget', props: [] };\n`,
|
|
489
489
|
);
|
|
490
490
|
fs.writeFileSync(
|
|
491
491
|
path.join(cDir, 'Widget.tsx'),
|
|
@@ -507,7 +507,7 @@ export default {type: 'theme', name: 'ocean', displayName: 'Ocean', description:
|
|
|
507
507
|
// Doc with no sibling Widget.tsx.
|
|
508
508
|
fs.writeFileSync(
|
|
509
509
|
path.join(cDir, 'Widget.doc.mjs'),
|
|
510
|
-
`export default { name: 'Widget' };\n`,
|
|
510
|
+
`export default { type: 'component', name: 'Widget', props: [] };\n`,
|
|
511
511
|
);
|
|
512
512
|
|
|
513
513
|
const result = await validateLocalIntegration(pkgDir);
|
package/api/json/index.ts
CHANGED
|
@@ -28,6 +28,8 @@ export type * from '../init/init.type.mjs';
|
|
|
28
28
|
export type * from '../doctor/doctor.type.mjs';
|
|
29
29
|
export type * from '../layout/layout.type.mjs';
|
|
30
30
|
export type * from '../integration/validate-integration.type.mjs';
|
|
31
|
+
export type * from '../integration/authoring-checks.type.mjs';
|
|
32
|
+
export type * from '../integration/pack-check.type.mjs';
|
|
31
33
|
export type * from '../../foundation/response/base';
|
|
32
34
|
export type * from '../../foundation/response/error-codes';
|
|
33
35
|
export type * from '../../clients/cli/lib/manifest';
|
package/api/layout/_adapter.mjs
CHANGED
|
@@ -50,7 +50,18 @@ async function loadBlocks(cwd) {
|
|
|
50
50
|
const blocks = [];
|
|
51
51
|
try {
|
|
52
52
|
const all = await discoverTemplates(cwd);
|
|
53
|
-
|
|
53
|
+
const templates = all.filter(template => template.type === 'block');
|
|
54
|
+
/** @type {Map<string, import('../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate>} */
|
|
55
|
+
const byId = new Map();
|
|
56
|
+
// Exact ids are the fallback. Active replacement aliases override them in a
|
|
57
|
+
// second pass, matching template() regardless of discovery/display order.
|
|
58
|
+
for (const template of templates) byId.set(template.dirName, template);
|
|
59
|
+
for (const template of templates) {
|
|
60
|
+
if (template.replaces != null) byId.set(template.replaces, template);
|
|
61
|
+
}
|
|
62
|
+
for (const [id, template] of byId) {
|
|
63
|
+
blocks.push({...template, dirName: id, kind: 'template'});
|
|
64
|
+
}
|
|
54
65
|
} catch {
|
|
55
66
|
// discovery is best-effort
|
|
56
67
|
}
|
|
@@ -91,7 +102,10 @@ export function formatIssue(issue) {
|
|
|
91
102
|
* @param {string} expression
|
|
92
103
|
* @param {{form?: 'compact'|'outline'|'auto', loose?: boolean, cwd?: string}} [options]
|
|
93
104
|
*/
|
|
94
|
-
export async function analyze(
|
|
105
|
+
export async function analyze(
|
|
106
|
+
expression,
|
|
107
|
+
{form = 'auto', loose = false, cwd = process.cwd()} = {},
|
|
108
|
+
) {
|
|
95
109
|
// Validate inputs in the API (not just the CLI): an empty expression or an
|
|
96
110
|
// unknown --form must error, not silently parse as an empty/compact layout.
|
|
97
111
|
if (typeof expression !== 'string' || expression.trim() === '') {
|
|
@@ -108,9 +122,10 @@ export async function analyze(expression, {form = 'auto', loose = false, cwd = p
|
|
|
108
122
|
ERROR_CODES.ERR_INVALID_OPTION,
|
|
109
123
|
);
|
|
110
124
|
}
|
|
111
|
-
const registry =
|
|
112
|
-
/** @type {
|
|
113
|
-
|
|
125
|
+
const registry =
|
|
126
|
+
/** @type {import('../../foundation/xle/xle-ast').Registry} */ (
|
|
127
|
+
/** @type {unknown} */ (await buildRegistry({cwd}))
|
|
128
|
+
);
|
|
114
129
|
const blocks = await loadBlocks(cwd);
|
|
115
130
|
|
|
116
131
|
/** @type {import('../../foundation/xle/xle-ast').XLEDoc} */
|
package/api/search/search.d.mts
CHANGED
|
@@ -72,7 +72,7 @@ export function scoreCandidate(term: string, { name, keywords, weakKeywords, des
|
|
|
72
72
|
*/
|
|
73
73
|
export function search(query: string, options?: {
|
|
74
74
|
cwd?: string | undefined;
|
|
75
|
-
type?: "component" | "hook" | "
|
|
75
|
+
type?: "component" | "hook" | "template" | "doc" | undefined;
|
|
76
76
|
limit?: number | undefined;
|
|
77
77
|
}): Promise<import("./search.type.mjs").SearchResponse>;
|
|
78
78
|
/** Valid domain filters for `--type`. */
|
|
@@ -91,6 +91,31 @@ export type Candidate = {
|
|
|
91
91
|
guidance?: string[] | undefined;
|
|
92
92
|
_import?: string | undefined;
|
|
93
93
|
_title?: string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* - A doc result's topic or docs-tree route.
|
|
96
|
+
*/
|
|
97
|
+
_topic?: string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* - A doc result's section key, when it is one section.
|
|
100
|
+
*/
|
|
101
|
+
_section?: string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* - The command that reads exactly this doc part.
|
|
104
|
+
*/
|
|
105
|
+
_command?: string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* - The command that opens the level above a doc
|
|
108
|
+
* part: its topic's section list, or the docs-tree namespace it sits in.
|
|
109
|
+
*/
|
|
110
|
+
_parent?: string | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* - The npm package that authored a docs-tree
|
|
113
|
+
* doc part. Flat topics carry none: an extension's sections can come from
|
|
114
|
+
* another package.
|
|
115
|
+
*/
|
|
116
|
+
_package?: string | undefined;
|
|
94
117
|
_displayName?: string | undefined;
|
|
95
118
|
_kind?: "page" | "block" | undefined;
|
|
119
|
+
_resultName?: string | undefined;
|
|
120
|
+
_commandName?: string | undefined;
|
|
96
121
|
};
|
|
@@ -47,14 +47,15 @@ export const doc = {
|
|
|
47
47
|
{
|
|
48
48
|
name: 'options.cwd',
|
|
49
49
|
type: 'string',
|
|
50
|
-
description:
|
|
50
|
+
description:
|
|
51
|
+
"Directory to resolve @astryxdesign/core from. A docs-only search (`type: 'doc'`) does not need it.",
|
|
51
52
|
},
|
|
52
53
|
],
|
|
53
54
|
returns: [
|
|
54
55
|
{
|
|
55
56
|
type: 'search',
|
|
56
57
|
description:
|
|
57
|
-
'The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs, and `displayName` and `kind` for templates.',
|
|
58
|
+
'The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs, and `displayName` and `kind` for templates. A doc result is the smallest part that answers: one section (with `section`, and a command that reads only it), one docs-tree route, or a topic, whose command lists its sections. `parent` is the command that opens the level above it: the section list of its topic, the namespace a tree node sits in, the Unorganized level for a flat topic, or the topic list for a top-level namespace. Every doc result also carries `package`, the npm package that authored it (for a section, the package its file came from).',
|
|
58
59
|
},
|
|
59
60
|
],
|
|
60
61
|
throws: [
|
|
@@ -64,7 +65,7 @@ export const doc = {
|
|
|
64
65
|
},
|
|
65
66
|
{
|
|
66
67
|
code: 'ERR_CORE_NOT_FOUND',
|
|
67
|
-
when: '@astryxdesign/core cannot be found from the cwd',
|
|
68
|
+
when: '@astryxdesign/core cannot be found from the cwd, and the search reads it: every `type` but `doc`',
|
|
68
69
|
},
|
|
69
70
|
],
|
|
70
71
|
examples: [
|