@astryxdesign/cli 0.7.2-canary.9da2d0b → 0.7.2-canary.a3f5dbf

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.
Files changed (95) hide show
  1. package/README.md +7 -7
  2. package/api/component/_adapter.d.mts +41 -1
  3. package/api/component/_adapter.mjs +93 -7
  4. package/api/component/component.mjs +22 -5
  5. package/api/component/component.test.mjs +80 -0
  6. package/api/component/integration-export-name.test.mjs +644 -0
  7. package/api/component/list/list.mjs +42 -4
  8. package/api/docs/_adapter.mjs +207 -1
  9. package/api/docs/integrationDocs.test.mjs +124 -0
  10. package/api/gap-report/gap-report.mjs +67 -4
  11. package/api/integration/_adapter.d.mts +12 -0
  12. package/api/integration/_adapter.mjs +54 -0
  13. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  14. package/api/integration/add-contribution.mjs +7 -3
  15. package/api/integration/authoring-checks.mjs +11 -2
  16. package/api/integration/authoring-checks.test.mjs +39 -0
  17. package/api/integration/authoring-checks.type.d.mts +9 -0
  18. package/api/integration/authoring-checks.type.mjs +14 -1
  19. package/api/integration/integrationComponentConflicts.doc.mjs +21 -5
  20. package/api/integration/pack-check.mjs +61 -107
  21. package/api/integration/pack-check.test.mjs +359 -0
  22. package/api/integration/validate-integration.test.mjs +11 -0
  23. package/api/search/search.d.mts +9 -0
  24. package/api/search/search.mjs +108 -16
  25. package/api/search/search.test.mjs +36 -0
  26. package/api/swizzle/copy/copy.mjs +28 -14
  27. package/api/theme/build/build.family.test.mjs +16 -0
  28. package/api/theme/build/build.mjs +77 -18
  29. package/api/theme/themeBuild.doc.mjs +3 -3
  30. package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
  31. package/assets/codemods/transforms/next/index.mjs +11 -1
  32. package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
  33. package/assets/docs/tree/add-a-component.doc.mjs +10 -0
  34. package/assets/docs/tree/check-the-props.doc.mjs +145 -0
  35. package/assets/docs/tree/checks.doc.mjs +4 -4
  36. package/assets/docs/tree/component-family.doc.mjs +5 -1
  37. package/assets/docs/tree/component-imports.doc.mjs +8 -0
  38. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  39. package/assets/docs/tree/links.doc.mjs +2 -2
  40. package/assets/docs/tree/single-component.doc.mjs +3 -2
  41. package/assets/docs/tree/troubleshooting.doc.mjs +9 -1
  42. package/assets/docs/tree/versioning.doc.mjs +1 -0
  43. package/assets/docs/working-with-ai.doc.mjs +43 -4
  44. package/authoring/doctypes/component/component.doc.mjs +2 -2
  45. package/authoring/doctypes/component/type.ts +6 -3
  46. package/authoring/integration/integration.doc.mjs +8 -1
  47. package/authoring/integration/parse.test.mjs +10 -0
  48. package/authoring/integration/schema.d.mts +2 -0
  49. package/authoring/integration/schema.mjs +1 -0
  50. package/authoring/integration/type.ts +4 -0
  51. package/clients/cli/commands/build-theme.path-safety.test.mjs +84 -0
  52. package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
  53. package/clients/cli/commands/doctor-integration-components.doc.mjs +9 -3
  54. package/clients/cli/commands/doctor-integration.test.mjs +392 -0
  55. package/clients/cli/commands/doctor.mjs +74 -0
  56. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  57. package/foundation/config/project.mjs +82 -0
  58. package/foundation/discovery/component-discovery.d.mts +190 -10
  59. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  60. package/foundation/discovery/component-discovery.mjs +864 -56
  61. package/foundation/discovery/component-discovery.test.mjs +96 -0
  62. package/foundation/discovery/component-replacement.mjs +18 -0
  63. package/foundation/discovery/component-replacement.test.mjs +40 -0
  64. package/foundation/discovery/docs-discovery.d.mts +81 -0
  65. package/foundation/discovery/docs-discovery.mjs +57 -0
  66. package/foundation/discovery/module-exports.d.mts +27 -0
  67. package/foundation/discovery/module-exports.mjs +356 -31
  68. package/foundation/discovery/module-exports.test.mjs +172 -0
  69. package/foundation/discovery/package-tsconfig.d.mts +14 -0
  70. package/foundation/discovery/package-tsconfig.mjs +228 -0
  71. package/foundation/discovery/package-tsconfig.test.mjs +210 -0
  72. package/foundation/discovery/project-typescript.d.mts +23 -0
  73. package/foundation/discovery/project-typescript.mjs +61 -0
  74. package/foundation/discovery/prop-drift.d.mts +220 -0
  75. package/foundation/discovery/prop-drift.mjs +1765 -0
  76. package/foundation/discovery/prop-drift.test.mjs +1197 -0
  77. package/foundation/discovery/type-match.d.mts +53 -0
  78. package/foundation/discovery/type-match.mjs +660 -0
  79. package/foundation/discovery/type-match.test.mjs +169 -0
  80. package/foundation/discovery/type-text.d.mts +68 -0
  81. package/foundation/discovery/type-text.mjs +658 -0
  82. package/foundation/discovery/type-text.test.mjs +196 -0
  83. package/foundation/discovery/unresolved-references.d.mts +62 -0
  84. package/foundation/discovery/unresolved-references.mjs +790 -0
  85. package/foundation/discovery/unresolved-references.test.mjs +567 -0
  86. package/foundation/doc-compiler/doc-loads.test.mjs +8 -0
  87. package/foundation/doc-compiler/inputs.mjs +23 -0
  88. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  89. package/foundation/doc-compiler/links.d.mts +9 -5
  90. package/foundation/doc-compiler/links.mjs +4 -2
  91. package/foundation/integrations/contribution-inventory.mjs +6 -1
  92. package/foundation/response/response-types.doc.mjs +1 -1
  93. package/foundation/xle/registry.mjs +4 -0
  94. package/foundation/xle/registry.test.mjs +28 -0
  95. package/package.json +9 -9
@@ -0,0 +1,145 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs cli/integrations/building-blocks/components/describe-the-component/check-the-props`:
5
+ * compare each component doc's props table with the component's TypeScript
6
+ * props, read each finding, and fix the doc or the code.
7
+ */
8
+
9
+ /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
10
+ export const docs = {
11
+ type: 'generic',
12
+ name: 'check-the-props',
13
+ placement: {
14
+ parent: 'namespace:describe-the-component',
15
+ slot: 'guides',
16
+ order: 50,
17
+ },
18
+ title: 'Check the props table',
19
+ category: 'guide',
20
+ keywords: [
21
+ 'props table',
22
+ 'documented props',
23
+ 'prop drift',
24
+ 'props not compared',
25
+ ],
26
+ description:
27
+ "Compare each props table with the component's TypeScript props, then fix the doc or the code.",
28
+ sections: [
29
+ {
30
+ id: 'run-the-props-check',
31
+ title: 'Run the props check',
32
+ content: [
33
+ {
34
+ type: 'prose',
35
+ text: "`doctor integration components` compares every props table in your component docs, hidden docs and every family entry included, with the props the component's TypeScript declares. Run it in your package after you change a component or its doc.",
36
+ },
37
+ {
38
+ type: 'code',
39
+ lang: 'bash',
40
+ code: 'npx astryx doctor integration components',
41
+ },
42
+ {
43
+ type: 'code',
44
+ lang: 'text',
45
+ code: `severity: [warn]
46
+ component: AcmeCarousel
47
+ prop: loop
48
+ kind: not_in_code
49
+ message: "loop" is documented, but AcmeCarousel's props have no "loop".
50
+ doc: components/AcmeCarousel.doc.mjs
51
+ source: components/AcmeCarousel.tsx
52
+ docType: boolean
53
+
54
+ 1 prop(s) differ between the docs and the code in 1 of 1 component(s) compared (TypeScript 6.0.3). These are warnings: update the doc, or the code if the doc is right.`,
55
+ },
56
+ {
57
+ type: 'list',
58
+ style: 'unordered',
59
+ items: [
60
+ "A doc's own `props` describe the export its `name` names. In a family doc, each entry describes its own export. A hook entry documents parameters and returns, so it is not compared.",
61
+ "It reads props with the `typescript` your package installs, and reads your package's `tsconfig.json` the way `tsc -p` does. Without TypeScript it prints `[skip] Props not compared` and the reason.",
62
+ 'Every finding is a warning, so the exit code stays 0. Read them before you publish. With `--json`, they are in `data.propDrift.findings`.',
63
+ ],
64
+ },
65
+ ],
66
+ },
67
+ {
68
+ id: 'fix-each-finding',
69
+ title: 'Fix each finding',
70
+ content: [
71
+ {
72
+ type: 'prose',
73
+ text: "Each finding's `kind` says what differs. Fix the doc, or the code if the doc is right.",
74
+ },
75
+ {
76
+ type: 'table',
77
+ headers: ['Kind', 'Means', 'Fix'],
78
+ rows: [
79
+ [
80
+ '`not_in_code`',
81
+ "The doc lists a prop the component's props do not have",
82
+ 'Remove it from the doc, or add it to the code. A name an index signature takes, such as `data-*`, counts as present',
83
+ ],
84
+ [
85
+ '`not_in_doc`',
86
+ "Your package declares a prop the doc does not list, or builds one with a mapped type, such as `Partial<Record<'sm' | 'md', string>>`",
87
+ 'Document it. Props from React, the DOM, or another package are never asked for, and neither are props whose keys another package defines (`keyof CSSProperties`, behind an alias or not), `className`, `style`, `xstyle`, `data-testid`, `ref`, `key`, or a prop whose JSDoc has `@internal`. A deprecated prop is still a prop: document it until you remove it. A prop a mapped type builds from keys the check cannot trace (a template literal, say) is listed under `[info] Props not checked for a doc entry` instead',
88
+ ],
89
+ [
90
+ '`required_mismatch`',
91
+ '`required` disagrees with the code',
92
+ 'Set `required: true` exactly when every caller must pass the prop. One your `defaultProps` fills counts as optional, as it is to JSX callers, and so does one only some members of a union require, since a caller can leave it out: say in its description which variants need it. An entry that names several props (`value / onChange`) makes the same claim about each: give them separate entries when they differ',
93
+ ],
94
+ ],
95
+ },
96
+ ],
97
+ },
98
+ {
99
+ id: 'when-a-component-is-not-compared',
100
+ title: 'When a component is not compared',
101
+ content: [
102
+ {
103
+ type: 'prose',
104
+ text: "When the check cannot read a component's props exactly, it lists the component under `[info] Props not compared`, with the reason, instead of reporting findings that might be wrong.",
105
+ },
106
+ {
107
+ type: 'code',
108
+ lang: 'text',
109
+ code: `[info] Props not compared for 1 documented component(s):
110
+
111
+ component: AcmeCarousel
112
+ doc: components/AcmeCarousel.doc.mjs
113
+ reason: AcmeCarousel depends on \`@acme/motion\` (imported in AcmeCarousel.tsx), which the compiler could not resolve, usually a dependency that is not installed. Install the package's dependencies and run this check again`,
114
+ },
115
+ {
116
+ type: 'table',
117
+ headers: ['Reason', 'Fix'],
118
+ rows: [
119
+ [
120
+ 'It depends on a package or file the compiler could not resolve',
121
+ "Install the package's dependencies, then run the check again",
122
+ ],
123
+ [
124
+ "It depends on a type the compiler can't work out",
125
+ 'Make the types compile with `npx tsc --noEmit`, then run the check again',
126
+ ],
127
+ [
128
+ "The package's TypeScript config has an error",
129
+ 'Fix `tsconfig.json` until `npx tsc -p .` reads it',
130
+ ],
131
+ ['Its props are typed `any`', 'Give the component a props type'],
132
+ [
133
+ 'Some prop names come from a type parameter',
134
+ 'Nothing to fix: a component that renders an element the caller picks takes props known only where it is used',
135
+ ],
136
+ [
137
+ "The file has no export named by the doc's `name`",
138
+ 'Change `name` or the export so they agree',
139
+ ],
140
+ ],
141
+ },
142
+ ],
143
+ },
144
+ ],
145
+ };
@@ -36,9 +36,9 @@ export const docs = {
36
36
  ],
37
37
  [
38
38
  '`npx astryx doctor integration components`',
39
- 'No component name clashes with a Core component, and each `replaces` names one Core component',
39
+ "No component name clashes with a Core component, each `replaces` names one Core component, and each component doc's props match the component's TypeScript props",
40
40
  'Core is not installed (`core_not_found`). In a package that declares the CLI range that turns replacement on, a `replaces` target is missing (`missing_component_replacement_target`) or invalid (`invalid_component_replacement`), or two components replace one Core component (`ambiguous_component_replacement`)',
41
- 'A name clashes with Core, or a component sets `replaces` in a package without that range (`inactive_component_replacement`, plus any missing, invalid, or duplicate `replaces` reported as a warning)',
41
+ 'A name clashes with Core, a component sets `replaces` in a package without that range (`inactive_component_replacement`, plus any missing, invalid, or duplicate `replaces` reported as a warning), or a documented prop differs from the code: it is missing there (`not_in_code`), the doc omits a prop the package declares (`not_in_doc`), or its `required` disagrees (`required_mismatch`). It reads props with your installed `typescript`; without it, it prints `[skip] Props not compared`',
42
42
  ],
43
43
  [
44
44
  '`npx astryx doctor integration templates`',
@@ -62,7 +62,7 @@ export const docs = {
62
62
  },
63
63
  {
64
64
  type: 'prose',
65
- text: 'Pass a package name, such as `npx astryx doctor integration validate @acme/astryx-widgets`, to check an installed copy from an app instead.',
65
+ text: 'Pass a package name, such as `npx astryx doctor integration validate @acme/astryx-widgets`, to check an installed copy from an app instead. To fix a props finding, see {@link generic:check-the-props}.',
66
66
  },
67
67
  ],
68
68
  },
@@ -105,7 +105,7 @@ export const docs = {
105
105
  'It runs `npm pack` the way `npm publish` would, including your `prepack` script.',
106
106
  'It checks that every contribution file is in the `.tgz` file. A root missing from `files` fails with `Add "templates" to "files" in package.json.`',
107
107
  'It lists the components, templates, themes, docs, and codemods the temporary app sees, and compares them with your source.',
108
- "It resolves each component's `import`, and each template's public import, the way Node does, and checks that the module exports the component, or a default export for a template.",
108
+ "It resolves each component's `import`, and each template's public import, the way Node does, and checks that the module exports the component under the name its doc documents, or a default export for a template. A type-only export does not count.",
109
109
  'For each theme, it rebuilds the source, compares the built module and production CSS with the authored outputs, and proves the module, CSS, and optional font CSS exports resolve from the packed package.',
110
110
  'It fails a package that needs an `@astryxdesign/cli` peer and lacks it: `>=0.6.6` for a template that sets `keywords`, and `>=0.6.4` for a template that sets `replaces`, a docs section, a placed guide, a doc section with an `id`, or a theme.',
111
111
  ],
@@ -95,7 +95,11 @@ export default {
95
95
  },
96
96
  {
97
97
  type: 'prose',
98
- text: 'The public module named by `import` must export every component or hook named by a full entry.',
98
+ text: "The public module named by `import` must export every component or hook named by a full entry. Apps then list, search and open each component in the family by its own name. A full entry the module does not export is not listed, and `integration verify` does not report it: check the family with `astryx component --list`. When `import` names output your pack lifecycle builds (such as `dist`), the members are listed once that output exists, and `integration verify` compares them as they are listed after the pack builds it.",
99
+ },
100
+ {
101
+ type: 'prose',
102
+ text: "A member's source is the `.tsx` file in the family doc's folder, or below it, that declares it: the one the family's own file or the module `import` names reaches, else the one in that folder that declares the name, as when `import` names built output. A member that only a bundle or a file outside that folder declares is still listed, with no source for `--source` or `swizzle`. A member is not listed when a doc's file or a Core name your package replaces already has its name. A member that shares a name with Core opens with `--package`.",
99
103
  },
100
104
  ],
101
105
  },
@@ -35,6 +35,14 @@ export const docs = {
35
35
  type: 'prose',
36
36
  text: 'Add writes the entry only when package.json already has an `exports` map, so start every package with `"exports": {}`.',
37
37
  },
38
+ {
39
+ type: 'prose',
40
+ text: 'A file does not have to be named after its component. When `Slides.tsx` exports `AcmeCarousel` and nothing named `Slides`, keep the doc beside it as `Slides.doc.mjs` and set its `name` to `AcmeCarousel`: apps list, search and open the component by that name, and `integration verify` checks that its import exports `AcmeCarousel`. A file that exports its own name keeps that name. A package that names its files in kebab case works the same way: `acme-gallery.doc.mjs` beside `acme-gallery.tsx` sets `name: \'AcmeGallery\'`.',
41
+ },
42
+ {
43
+ type: 'prose',
44
+ text: "The file name still opens the doc. A name that Core or another doc's file already has stays theirs, and so does a Core name your package replaces: with `Badge.doc.mjs` naming `AcmeBadge`, `astryx component Badge` opens Core's `Badge`, and `--package` with your package name reaches yours.",
45
+ },
38
46
  ],
39
47
  },
40
48
  {
@@ -37,7 +37,7 @@ export const docs = {
37
37
  items: [
38
38
  'Change the source and its `.doc.mjs` together.',
39
39
  'Update the doc whenever the public name, import, behavior, props, defaults, examples, or accessibility requirements change.',
40
- '`integration verify` checks the doc shape and packed import, but it cannot prove the prose still matches the component.',
40
+ '`integration verify` checks the doc shape and packed import, and `doctor integration components` compares each props table with the component\'s TypeScript props ({@link generic:check-the-props}). Neither can prove the prose still matches the component.',
41
41
  ],
42
42
  },
43
43
  {
@@ -36,8 +36,8 @@ export const docs = {
36
36
  type: 'list',
37
37
  style: 'unordered',
38
38
  items: [
39
- 'The kind is `generic` for a topic or guide, `namespace` for a docs section, and `command` or `function` for a CLI command or API function.',
40
- 'A link to a component or a template does not resolve. Write its name in backticks instead, such as `AcmeCarousel`.',
39
+ 'The kind is `generic` for a topic or guide, `namespace` for a docs section, `command` or `function` for a CLI command or API function, `component` for a component, and `page` or `block` for a template.',
40
+ 'Name a component by its export name and a template by its id. Its link reads as the command that opens it, such as `astryx component AcmeCarousel --package @acme/widgets`.',
41
41
  'Inside backticks or a code block, link syntax prints as written.',
42
42
  ],
43
43
  },
@@ -56,7 +56,7 @@ export default {
56
56
  style: 'unordered',
57
57
  items: [
58
58
  'Keep `props` on the top-level doc. Private implementation helpers do not need entries.',
59
- 'Keep the doc beside the source and change both in the same pull request.',
59
+ 'Name the doc after the source file beside it, such as `AcmeCarousel.doc.mjs` beside `AcmeCarousel.tsx`, and change both in the same pull request.',
60
60
  'If the module later exposes several related public exports, adapt this doc with {@link generic:component-family}.',
61
61
  ],
62
62
  },
@@ -122,6 +122,7 @@ export default {
122
122
  'Set `required: true` only when every caller must pass the prop.',
123
123
  'Write `default` exactly as the value should appear in documentation.',
124
124
  'Skip styling escape hatches such as `xstyle`, `className`, and `style`.',
125
+ '`npx astryx doctor integration components` lists a documented prop the code lacks, a public prop the doc misses, and a wrong `required`. See {@link generic:check-the-props}.',
125
126
  ],
126
127
  },
127
128
  ],
@@ -157,7 +158,7 @@ export default {
157
158
  {
158
159
  type: 'code',
159
160
  lang: 'bash',
160
- code: 'npx astryx component AcmeCarousel\nnpx astryx integration verify',
161
+ code: 'npx astryx component AcmeCarousel\nnpx astryx doctor integration components\nnpx astryx integration verify',
161
162
  },
162
163
  ],
163
164
  },
@@ -67,7 +67,7 @@ export const docs = {
67
67
  rows: [
68
68
  [
69
69
  '`component_export_missing`: `Component "AcmeCarousel" advertises import "@acme/astryx-widgets/components/AcmeCarousel", but that packed module does not export "AcmeCarousel".`',
70
- "package.json has no `exports` map, or the module does not export the name. Keep `export function AcmeCarousel`, and add the entry: `npm pkg set 'exports[./components/AcmeCarousel]=./components/AcmeCarousel.tsx'`.",
70
+ "package.json has no `exports` map, or the module does not export the name. Keep `export function AcmeCarousel`, and add the entry: `npm pkg set 'exports[./components/AcmeCarousel]=./components/AcmeCarousel.tsx'`. When the quoted name is a file name, such as `acme-carousel`, set the doc's `name` to the component the file exports. A type-only export does not count.",
71
71
  ],
72
72
  [
73
73
  '`template_export_missing`: `Template "acme-dashboard" public import "@acme/astryx-widgets/templates/acme-dashboard" does not have a default export.`',
@@ -125,6 +125,14 @@ export const docs = {
125
125
  type: 'table',
126
126
  headers: ['Symptom', 'Fix'],
127
127
  rows: [
128
+ [
129
+ '`Error: No component named "AcmeCarousel"` for a component your package documents.',
130
+ "Its doc still names its file. Set `name` to the export, such as `name: 'AcmeCarousel'` in `acme-carousel.doc.mjs`. A family member is listed only when the module its family doc imports exports it ({@link generic:component-family}).",
131
+ ],
132
+ [
133
+ '`npx astryx component Dialog` opens Core\'s `Dialog`, not yours.',
134
+ "A name that Core, a legacy docs package, or another package's file already has stays theirs. Run `npx astryx component Dialog --package @acme/astryx-widgets`, or give your component a name of its own.",
135
+ ],
128
136
  [
129
137
  '`Error: Template "dashboard" is ambiguous — narrow it with --type and/or --package.`',
130
138
  "Your template id matches a Core id. Rename it, such as `acme-dashboard`, or set `replaces: 'dashboard'` to take its place. `npx astryx doctor integration templates` warns about this before you publish.",
@@ -140,6 +140,7 @@ export const docs = {
140
140
  'Published 0.6.3 and earlier reject a template that sets `replaces` or `keywords`, drop that template, and hide every doc topic your package ships. Published 0.6.4 and 0.6.5 still drop a template that sets `keywords`.',
141
141
  'A stable CLI before 0.6.4 cannot read a docs section, a section `id`, or a theme folder that `integration add theme` writes. It can then hide every doc topic your package ships.',
142
142
  'Stable 0.6.3 still loads your components, but 0.6.0 cannot read the component docs that `integration add component` writes: `component AcmeCarousel` fails there.',
143
+ 'An app on an older CLI lists a component whose doc names another export of its file under the file name, and lists no family members, so `component AcmeCarousel` fails there.',
143
144
  ],
144
145
  },
145
146
  {
@@ -44,7 +44,7 @@ export const docs = {
44
44
  },
45
45
  {
46
46
  type: 'prose',
47
- text: 'By default this creates `AGENTS.md` (the tool-agnostic standard most agents read). To target a specific tool\'s file instead:',
47
+ text: "By default this creates `AGENTS.md` (the tool-agnostic standard most agents read). To target a specific tool's file instead:",
48
48
  },
49
49
  {
50
50
  type: 'code',
@@ -182,21 +182,60 @@ astryx docs principles --dense`,
182
182
  },
183
183
  {
184
184
  type: 'prose',
185
- text: 'Add the server to your MCP config file. This works with any MCP-compatible tool: Claude Desktop (claude_desktop_config.json), Cursor (.cursor/mcp.json), Windsurf (.windsurf/mcp.json), Cline, and others.',
185
+ text: 'Add the server to your MCP config file. The entry is a remote HTTP server, and the exact shape differs per client, so use the snippet for the tool you run. An entry with an unrecognized transport is skipped with a warning rather than an error, which reads as a server that connects but exposes no tools.',
186
186
  },
187
187
  {
188
188
  type: 'code',
189
189
  lang: 'json',
190
- label: 'MCP config (same for all tools)',
190
+ label: 'Claude Code (.mcp.json)',
191
191
  code: `{
192
192
  "mcpServers": {
193
193
  "astryx": {
194
- "type": "url",
194
+ "type": "http",
195
195
  "url": "https://astryx.atmeta.com/mcp"
196
196
  }
197
197
  }
198
198
  }`,
199
199
  },
200
+ {
201
+ type: 'prose',
202
+ text: 'Claude Code can also write that entry from the terminal:',
203
+ },
204
+ {
205
+ type: 'code',
206
+ lang: 'bash',
207
+ code: `claude mcp add --transport http astryx https://astryx.atmeta.com/mcp`,
208
+ },
209
+ {
210
+ type: 'code',
211
+ lang: 'json',
212
+ label: 'Cline (cline_mcp_settings.json) - type is streamableHttp',
213
+ code: `{
214
+ "mcpServers": {
215
+ "astryx": {
216
+ "type": "streamableHttp",
217
+ "url": "https://astryx.atmeta.com/mcp"
218
+ }
219
+ }
220
+ }`,
221
+ },
222
+ {
223
+ type: 'code',
224
+ lang: 'json',
225
+ label:
226
+ 'Cursor (.cursor/mcp.json) - remote servers take no type field',
227
+ code: `{
228
+ "mcpServers": {
229
+ "astryx": {
230
+ "url": "https://astryx.atmeta.com/mcp"
231
+ }
232
+ }
233
+ }`,
234
+ },
235
+ {
236
+ type: 'prose',
237
+ text: 'Claude Desktop is the exception: claude_desktop_config.json holds local stdio servers, so a remote server is added through Settings, then Connectors, then Add custom connector, pasting the URL above.',
238
+ },
200
239
  {
201
240
  type: 'prose',
202
241
  text: 'Once connected, your AI tool can search for components by natural language (e.g. "dropdown menu", "success message") and retrieve full documentation without any manual CLI invocation. The server uses the same keyword index from component docs, so search quality improves automatically as component documentation is updated.',
@@ -30,7 +30,7 @@ export const doc = {
30
30
  name: 'name',
31
31
  type: 'string',
32
32
  description:
33
- "Stable machine identity and directory name without the Astryx prefix, PascalCase. e.g. 'Button', 'TextInput', 'AppShell'. Change `displayName`, not `name`, to edit the visible label; registry URLs derive from this identity by default.",
33
+ "Stable machine identity and directory name without the Astryx prefix, PascalCase. e.g. 'Button', 'TextInput', 'AppShell'. For an integration component it is the export apps import: the doc sits beside the file that exports it, and when that file exports nothing under its own name, `name` may name the export it does have. Change `displayName`, not `name`, to edit the visible label; registry URLs derive from this identity by default.",
34
34
  required: true,
35
35
  },
36
36
  {
@@ -187,7 +187,7 @@ export const doc = {
187
187
  name: 'components',
188
188
  type: '(ComponentEntry | ComponentRef)[]',
189
189
  description:
190
- 'MultiComponentDoc variant (required there): one entry per public component/hook exported from the directory. Each entry is a full ComponentEntry (inline: name, displayName, description, props | params+returns) or a name-only ComponentRef pointing at a sibling {Name}.doc.mjs.',
190
+ 'MultiComponentDoc variant (required there): one entry per public component/hook exported from the directory. Each entry is a full ComponentEntry (inline: name, displayName, description, props | params+returns) or a name-only ComponentRef pointing at a sibling {Name}.doc.mjs. In an integration, each full entry the module named by `import` exports is a component under its own name.',
191
191
  },
192
192
  {
193
193
  name: 'subComponentOf',
@@ -33,9 +33,12 @@ export interface ComponentBaseDoc extends AuthoredDocGraphFields {
33
33
  type?: 'component';
34
34
  /**
35
35
  * Stable machine identity and directory name without the Astryx prefix,
36
- * PascalCase (for example `Button`, `Table`, or `AppShell`). Do not change
37
- * this to edit the visible label; use `displayName` for that. Registry URLs
38
- * derive from this value by default.
36
+ * PascalCase (for example `Button`, `Table`, or `AppShell`). For an
37
+ * integration component it is the export apps import: the doc sits beside
38
+ * the file that exports it, and when that file exports nothing under its own
39
+ * name, `name` may name the export it does have. Do not change this to edit
40
+ * the visible label; use `displayName` for that. Registry URLs derive from
41
+ * this value by default.
39
42
  */
40
43
  name: string;
41
44
  /** Human-readable display name with spaces between words, used by the
@@ -74,6 +74,13 @@ export const doc = {
74
74
  description: 'Where to file issues/feedback for this integration.',
75
75
  example: "'https://github.com/acme/widgets/issues'",
76
76
  },
77
+ {
78
+ name: 'docsiteUrl',
79
+ type: 'string',
80
+ description:
81
+ "Link to this integration's docs site, such as its home page. Catalogs that list the package may show it.",
82
+ example: "'https://widgets.acme.dev'",
83
+ },
77
84
  ],
78
85
  examples: [
79
86
  {
@@ -118,7 +125,7 @@ export const doc = {
118
125
  text:
119
126
  'Validate the manifest with `astryx doctor integration validate`. At the ' +
120
127
  'load boundary, a known field of the wrong type is an error, issuesUrl ' +
121
- 'must be a valid URL, and unknown fields become warnings so an older CLI ' +
128
+ 'and docsiteUrl must be valid URLs, and unknown fields become warnings so an older CLI ' +
122
129
  'can still load the fields it understands. Before publishing, also run ' +
123
130
  '`templates`, `components`, and `docs` under the same `doctor integration` ' +
124
131
  'group. Those leaves compare authored identities with Core and explain ' +
@@ -87,6 +87,16 @@ describe('parseIntegration (load boundary)', () => {
87
87
  expect(reason({issuesUrl: 'nope'})).toContain('issuesUrl');
88
88
  });
89
89
 
90
+ it('accepts a docsiteUrl as a known key', () => {
91
+ const manifest = {docsiteUrl: 'https://widgets.example.com'};
92
+ expect(parseIntegration(manifest)).toEqual(manifest);
93
+ expect(unknownIntegrationKeys(manifest)).toEqual([]);
94
+ });
95
+
96
+ it('rejects a non-URL docsiteUrl', () => {
97
+ expect(reason({docsiteUrl: 'nope'})).toContain('docsiteUrl');
98
+ });
99
+
90
100
  it('rejects a noncanonical providerId', () => {
91
101
  expect(reason({providerId: 'Acme Widgets'})).toContain('providerId');
92
102
  });
@@ -39,6 +39,7 @@ export const integrationBaseSchema: z.ZodObject<{
39
39
  docs: z.ZodOptional<z.ZodString>;
40
40
  themes: z.ZodOptional<z.ZodString>;
41
41
  issuesUrl: z.ZodOptional<z.ZodString>;
42
+ docsiteUrl: z.ZodOptional<z.ZodString>;
42
43
  }, z.core.$strip>;
43
44
  export const integrationSchema: z.ZodObject<{
44
45
  providerId: z.ZodOptional<z.ZodString>;
@@ -48,6 +49,7 @@ export const integrationSchema: z.ZodObject<{
48
49
  docs: z.ZodOptional<z.ZodString>;
49
50
  themes: z.ZodOptional<z.ZodString>;
50
51
  issuesUrl: z.ZodOptional<z.ZodString>;
52
+ docsiteUrl: z.ZodOptional<z.ZodString>;
51
53
  agentDocs: z.ZodOptional<z.ZodObject<{
52
54
  append: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
53
55
  }, z.core.$strip>>;
@@ -78,6 +78,7 @@ export const integrationBaseSchema = z.object({
78
78
  docs: z.string().optional(),
79
79
  themes: z.string().optional(),
80
80
  issuesUrl: z.string().url().optional(),
81
+ docsiteUrl: z.string().url().optional(),
81
82
  });
82
83
 
83
84
  // Unknown top-level keys are stripped rather than rejected. `.strict()` made a key from a
@@ -44,6 +44,10 @@ export interface AstryxIntegration {
44
44
  };
45
45
  /** Where to file issues/feedback for this integration. */
46
46
  issuesUrl?: string;
47
+ /** Link to this integration's docs site, such as its home page. The CLI
48
+ * accepts it as a known field; catalogs that list the package may show
49
+ * it. */
50
+ docsiteUrl?: string;
47
51
  }
48
52
 
49
53
  /**
@@ -9,6 +9,9 @@
9
9
  * - Multi-file write is atomic: if one file fails, none are left behind.
10
10
  * - An `--out` escape, or an output directory that cannot be created, fails
11
11
  * with a registered error code.
12
+ * - Every output stays inside the working directory: an absolute `--out`
13
+ * path or a theme file outside it fails before anything is written, while
14
+ * absolute paths inside it build, also through a symlinked spelling.
12
15
  *
13
16
  * Runs the CLI in-process (shared runCli harness) against a tiny synthetic theme file.
14
17
  */
@@ -129,6 +132,68 @@ describe('theme build output-path failures carry registered codes', () => {
129
132
  expect(fs.existsSync(path.join(tmpDir, 'escaped.css'))).toBe(false);
130
133
  });
131
134
 
135
+ it('reports an absolute --out path outside the project as ERR_PATH_TRAVERSAL, with --check too', async () => {
136
+ const project = path.join(tmpDir, 'project');
137
+ const outside = path.join(tmpDir, 'outside');
138
+ fs.mkdirSync(outside, {recursive: true});
139
+ const themeFile = writeTheme(path.join(project, 'themes'), 'ocean');
140
+ const out = path.join(outside, 'ocean.css');
141
+
142
+ for (const extra of [[], ['--check']]) {
143
+ const {result, envelope} = await buildJson(
144
+ [path.relative(project, themeFile), '--out', out, ...extra],
145
+ project,
146
+ );
147
+
148
+ expect(result.code).toBe(1);
149
+ expect(envelope.code).toBe(ERROR_CODES.ERR_PATH_TRAVERSAL);
150
+ }
151
+ expect(fs.readdirSync(outside)).toEqual([]);
152
+ });
153
+
154
+ it('reports a theme file outside the project as ERR_PATH_TRAVERSAL, because its outputs go beside it', async () => {
155
+ const project = path.join(tmpDir, 'project');
156
+ fs.mkdirSync(project, {recursive: true});
157
+ const shared = path.join(tmpDir, 'shared');
158
+ const themeFile = writeTheme(shared, 'ocean');
159
+
160
+ for (const file of [themeFile, path.relative(project, themeFile)]) {
161
+ const {result, envelope} = await buildJson([file], project);
162
+
163
+ expect(result.code).toBe(1);
164
+ expect(envelope.code).toBe(ERROR_CODES.ERR_PATH_TRAVERSAL);
165
+ }
166
+ expect(fs.readdirSync(shared)).toEqual(['theme.mjs']);
167
+ });
168
+
169
+ it('builds absolute paths inside the project, also when they reach it through a symlink', async () => {
170
+ const project = path.join(tmpDir, 'project');
171
+ const themeFile = writeTheme(path.join(project, 'themes'), 'ocean');
172
+ const alias = path.join(tmpDir, 'alias');
173
+ fs.symlinkSync(project, alias, 'dir');
174
+
175
+ for (const [args, written] of [
176
+ [
177
+ [themeFile, '--out', path.join(project, 'dist', 'direct.css')],
178
+ path.join(project, 'dist', 'direct.css'),
179
+ ],
180
+ [
181
+ [themeFile, '--out', path.join(alias, 'dist', 'aliased.css')],
182
+ path.join(project, 'dist', 'aliased.css'),
183
+ ],
184
+ [
185
+ [path.join(alias, 'themes', 'theme.mjs')],
186
+ path.join(project, 'themes', 'ocean.css'),
187
+ ],
188
+ ]) {
189
+ const {result, envelope} = await buildJson(args, project);
190
+
191
+ expect(result.code).toBe(0);
192
+ expect(envelope.type).toBe('theme.build');
193
+ expect(fs.existsSync(written)).toBe(true);
194
+ }
195
+ });
196
+
132
197
  it('reports an --out path that escapes through a symlink as ERR_PATH_TRAVERSAL', async () => {
133
198
  const project = path.join(tmpDir, 'project');
134
199
  const outside = path.join(tmpDir, 'outside');
@@ -177,4 +242,23 @@ describe('theme build output-path failures carry registered codes', () => {
177
242
  code: ERROR_CODES.ERR_PATH_TRAVERSAL,
178
243
  });
179
244
  });
245
+
246
+ it('themeBuild() rejects an output outside cwd: an absolute out path, or the default beside a theme file outside cwd', async () => {
247
+ const project = path.join(tmpDir, 'project');
248
+ const inside = writeTheme(path.join(project, 'themes'), 'ocean');
249
+ const shared = path.join(tmpDir, 'shared');
250
+ const outsideTheme = writeTheme(shared, 'ocean');
251
+ const outDir = path.join(tmpDir, 'out');
252
+
253
+ for (const [file, options] of [
254
+ [path.relative(project, inside), {out: path.join(outDir, 'ocean.css')}],
255
+ [outsideTheme, {}],
256
+ ]) {
257
+ await expect(
258
+ themeBuild(file, options, {cwd: project}),
259
+ ).rejects.toMatchObject({code: ERROR_CODES.ERR_PATH_TRAVERSAL});
260
+ }
261
+ expect(fs.existsSync(outDir)).toBe(false);
262
+ expect(fs.readdirSync(shared)).toEqual(['theme.mjs']);
263
+ });
180
264
  });
@@ -126,7 +126,10 @@ describe('theme build emits a live TextInput selector (#4109)', () => {
126
126
  `};\n`,
127
127
  );
128
128
 
129
- const result = await runCli(['theme', 'build', themeFile, '-o', outFile]);
129
+ const result = await runCli(
130
+ ['theme', 'build', themeFile, '-o', outFile],
131
+ tmpDir,
132
+ );
130
133
  const css = fs.readFileSync(outFile, 'utf8');
131
134
 
132
135
  expect(result.status).toBe(0);
@@ -148,7 +151,7 @@ describe('theme build emits a live TextInput selector (#4109)', () => {
148
151
  `};\n`,
149
152
  );
150
153
 
151
- await runCli(['theme', 'build', themeFile, '-o', outFile]);
154
+ await runCli(['theme', 'build', themeFile, '-o', outFile], tmpDir);
152
155
  const css = fs.readFileSync(outFile, 'utf8');
153
156
 
154
157
  expect(css).toContain('.astryx-text-input');
@@ -8,7 +8,8 @@ export const doc = {
8
8
  name: 'doctor integration components',
9
9
  displayName: 'astryx doctor integration components',
10
10
  namespace: 'cli/commands',
11
- summary: 'Check integration component names and replacements against Core',
11
+ summary:
12
+ 'Check integration component names, replacements, and documented props',
12
13
  description:
13
14
  'Compares one local or installed integration with Core component names. A ' +
14
15
  'conflict is allowed and exits successfully, but the report recommends ' +
@@ -17,7 +18,12 @@ export const doc = {
17
18
  'range that turns replacement on, a missing Core target, an invalid value, a ' +
18
19
  'component named after a different Core component, or two replacements for one ' +
19
20
  'Core component is an error. In a package without that range they are warnings, ' +
20
- 'with a warning for each such component, naming the range to declare.',
21
+ 'with a warning for each such component, naming the range to declare. ' +
22
+ "Then it compares each component doc's props with the component's TypeScript " +
23
+ "props, using the project's own `typescript`, and warns about a documented prop " +
24
+ 'the code lacks, a prop the package declares that the doc omits, and a wrong ' +
25
+ '`required`. Without TypeScript it prints one ' +
26
+ 'line saying the comparison was skipped.',
21
27
  fn: 'integrationComponentConflicts',
22
28
  args: [
23
29
  {
@@ -38,7 +44,7 @@ export const doc = {
38
44
  exitCodes: [
39
45
  {
40
46
  code: 0,
41
- when: 'the check completed; component name conflicts, and replaces findings for a package without the CLI range, are warnings',
47
+ when: 'the check completed; component name conflicts, replaces findings for a package without the CLI range, and props that differ from the code are warnings',
42
48
  },
43
49
  {
44
50
  code: 1,