@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.
Files changed (201) hide show
  1. package/README.md +19 -17
  2. package/api/component/_adapter.d.mts +6 -12
  3. package/api/component/_adapter.mjs +20 -10
  4. package/api/component/component.mjs +60 -12
  5. package/api/component/list/list.mjs +3 -2
  6. package/api/docs/_adapter.d.mts +209 -28
  7. package/api/docs/_adapter.mjs +667 -35
  8. package/api/docs/detail/detail.mjs +11 -3
  9. package/api/docs/detail/section/section.mjs +24 -13
  10. package/api/docs/detail/section/section.test.mjs +15 -6
  11. package/api/docs/docs.d.mts +5 -3
  12. package/api/docs/docs.doc.mjs +35 -15
  13. package/api/docs/docs.mjs +44 -8
  14. package/api/docs/docs.test.mjs +158 -4
  15. package/api/docs/docs.type.d.mts +165 -2
  16. package/api/docs/docs.type.mjs +101 -3
  17. package/api/docs/index/index.mjs +11 -3
  18. package/api/docs/index/index.test.mjs +1 -1
  19. package/api/docs/integration-tree.test.mjs +547 -0
  20. package/api/docs/integrationDocs.test.mjs +14 -14
  21. package/api/docs/list/list.mjs +25 -5
  22. package/api/docs/node/node.d.mts +43 -0
  23. package/api/docs/node/node.mjs +192 -0
  24. package/api/doctor/doctor.d.mts +30 -2
  25. package/api/doctor/doctor.mjs +147 -8
  26. package/api/doctor/doctor.test.mjs +95 -7
  27. package/api/index.d.mts +1 -1
  28. package/api/index.mjs +1 -0
  29. package/api/init/init.doc.mjs +1 -1
  30. package/api/integration/add-contribution.d.mts +2 -1
  31. package/api/integration/add-contribution.mjs +107 -5
  32. package/api/integration/add-contribution.test.mjs +137 -0
  33. package/api/integration/authoring-checks.mjs +125 -28
  34. package/api/integration/authoring-checks.test.mjs +171 -3
  35. package/api/integration/authoring-checks.type.mjs +6 -1
  36. package/api/integration/integration-authoring.type.d.mts +2 -0
  37. package/api/integration/integration-authoring.type.mjs +2 -0
  38. package/api/integration/integrationAdd.doc.mjs +6 -0
  39. package/api/integration/integrationAddDoc.doc.mjs +7 -1
  40. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  41. package/api/integration/integrationPackCheck.doc.mjs +1 -1
  42. package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
  43. package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
  44. package/api/integration/pack-check.mjs +34 -0
  45. package/api/integration/pack-check.test.mjs +121 -0
  46. package/api/integration/pack-check.type.d.mts +26 -2
  47. package/api/integration/pack-check.type.mjs +14 -1
  48. package/api/integration/template-conflict-compatibility.test.mjs +73 -0
  49. package/api/integration/validate-integration.test.mjs +3 -3
  50. package/api/integration/validateIntegration.doc.mjs +1 -1
  51. package/api/json/index.ts +2 -0
  52. package/api/layout/_adapter.mjs +20 -5
  53. package/api/search/search.d.mts +26 -1
  54. package/api/search/search.doc.mjs +4 -3
  55. package/api/search/search.mjs +308 -29
  56. package/api/search/search.test.mjs +91 -2
  57. package/api/search/search.type.d.mts +13 -1
  58. package/api/search/search.type.mjs +4 -1
  59. package/api/template/list/list.mjs +1 -0
  60. package/api/template/template-integration.test.mjs +1022 -3
  61. package/api/template/template.doc.mjs +27 -7
  62. package/api/template/template.mjs +45 -8
  63. package/api/template/template.type.d.mts +6 -8
  64. package/api/template/template.type.mjs +3 -2
  65. package/api/theme/template/template.test.mjs +5 -0
  66. package/api/theme/themeTemplate.doc.mjs +1 -1
  67. package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
  68. package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +4 -0
  69. package/assets/codemods/transforms/next/index.mjs +8 -0
  70. package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
  71. package/assets/docs/getting-started.doc.mjs +2 -2
  72. package/assets/docs/principles.doc.mjs +6 -6
  73. package/assets/docs/styling-libraries.doc.mjs +2 -2
  74. package/assets/docs/styling.doc.mjs +4 -4
  75. package/assets/docs/theme.doc.mjs +3 -3
  76. package/assets/docs/tokens.doc.mjs +1 -1
  77. package/assets/docs/tree/api.doc.mjs +30 -0
  78. package/assets/docs/tree/cli.doc.mjs +23 -0
  79. package/assets/docs/tree/commands.doc.mjs +25 -0
  80. package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
  81. package/assets/docs/tree/integrations.test.mjs +62 -0
  82. package/assets/docs/tree/writing-docs.doc.mjs +286 -0
  83. package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
  84. package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
  85. package/authoring/debug/parse.d.mts +3 -3
  86. package/authoring/doctypes/_schema.d.mts +71 -141
  87. package/authoring/doctypes/_schema.mjs +29 -2
  88. package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
  89. package/authoring/doctypes/base/type.ts +6 -5
  90. package/authoring/doctypes/command/command.doc.mjs +1 -1
  91. package/authoring/doctypes/command/type.ts +2 -2
  92. package/authoring/doctypes/enum/enum.doc.mjs +1 -1
  93. package/authoring/doctypes/enum/type.ts +1 -1
  94. package/authoring/doctypes/function/function.doc.mjs +3 -2
  95. package/authoring/doctypes/function/type.ts +3 -2
  96. package/authoring/doctypes/load-contract.test.mjs +1 -1
  97. package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
  98. package/authoring/doctypes/namespace/parse.test.mjs +23 -25
  99. package/authoring/doctypes/namespace/type.ts +5 -2
  100. package/authoring/doctypes/parse.mjs +3 -2
  101. package/authoring/doctypes/reference/reference.doc.mjs +6 -4
  102. package/authoring/doctypes/reference/type.ts +10 -8
  103. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  104. package/authoring/doctypes/schema/type.ts +1 -1
  105. package/authoring/doctypes/template/parse.d.mts +2 -0
  106. package/authoring/doctypes/template/parse.mjs +4 -0
  107. package/authoring/doctypes/template/parse.test.mjs +18 -0
  108. package/authoring/doctypes/template/template.doc.mjs +6 -0
  109. package/authoring/doctypes/template/type.ts +8 -0
  110. package/authoring/identity/identity.doc.mjs +2 -2
  111. package/authoring/index.d.ts +1 -0
  112. package/authoring/integration/type.ts +1 -1
  113. package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
  114. package/clients/cli/commands/build-theme.mjs +11 -45
  115. package/clients/cli/commands/build.mjs +5 -2
  116. package/clients/cli/commands/component/index.mjs +1 -1
  117. package/clients/cli/commands/component-ownership.test.mjs +3 -3
  118. package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
  119. package/clients/cli/commands/discover.mjs +1 -1
  120. package/clients/cli/commands/docs.doc.mjs +20 -8
  121. package/clients/cli/commands/docs.mjs +182 -68
  122. package/clients/cli/commands/docs.test.mjs +120 -16
  123. package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
  124. package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
  125. package/clients/cli/commands/doctor-integration.test.mjs +75 -1
  126. package/clients/cli/commands/doctor.mjs +53 -16
  127. package/clients/cli/commands/integration-add.doc.mjs +10 -0
  128. package/clients/cli/commands/integration.mjs +1 -0
  129. package/clients/cli/commands/search.mjs +11 -2
  130. package/clients/cli/commands/setup-nudge.test.mjs +6 -0
  131. package/clients/cli/commands/template.doc.mjs +23 -6
  132. package/clients/cli/commands/template.mjs +4 -91
  133. package/clients/cli/commands/text-json-parity.test.mjs +719 -0
  134. package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
  135. package/clients/cli/commands/upgrade.mjs +26 -7
  136. package/clients/cli/formatters/index.mjs +2 -0
  137. package/clients/cli/formatters/index.test.mjs +6 -0
  138. package/clients/cli/index.mjs +8 -0
  139. package/clients/cli/lib/manifest.mjs +9 -2
  140. package/foundation/agent-docs/agent-docs.mjs +1 -0
  141. package/foundation/agent-docs/agent-docs.test.mjs +10 -1
  142. package/foundation/config/project.d.mts +12 -11
  143. package/foundation/config/project.mjs +73 -59
  144. package/foundation/config/project.test.mjs +141 -5
  145. package/foundation/discovery/authoring-self-docs.test.mjs +20 -9
  146. package/foundation/discovery/cli-self-docs.d.mts +40 -34
  147. package/foundation/discovery/cli-self-docs.mjs +91 -115
  148. package/foundation/discovery/cli-self-docs.test.mjs +104 -166
  149. package/foundation/discovery/component-discovery.d.mts +38 -0
  150. package/foundation/discovery/component-discovery.mjs +48 -0
  151. package/foundation/discovery/docs-discovery.d.mts +105 -8
  152. package/foundation/discovery/docs-discovery.mjs +183 -18
  153. package/foundation/discovery/docs-discovery.test.mjs +63 -27
  154. package/foundation/discovery/docs-output-budget.d.mts +2 -2
  155. package/foundation/discovery/docs-output-budget.mjs +1 -1
  156. package/foundation/discovery/docs-section-key.d.mts +28 -10
  157. package/foundation/discovery/docs-section-key.mjs +134 -33
  158. package/foundation/discovery/docs-section-key.test.mjs +41 -19
  159. package/foundation/discovery/template-adapter.d.mts +92 -6
  160. package/foundation/discovery/template-adapter.mjs +453 -17
  161. package/foundation/discovery/template-adapter.test.mjs +42 -0
  162. package/foundation/discovery/template-conflict-release.d.mts +13 -0
  163. package/foundation/discovery/template-conflict-release.mjs +40 -0
  164. package/foundation/discovery/template-conflict-release.test.mjs +40 -0
  165. package/foundation/doc-compiler/bundle.mjs +61 -1
  166. package/foundation/doc-compiler/bundle.test.mjs +21 -10
  167. package/foundation/doc-compiler/compile.d.mts +113 -132
  168. package/foundation/doc-compiler/compile.mjs +57 -10
  169. package/foundation/doc-compiler/diagnostics.mjs +28 -0
  170. package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
  171. package/foundation/doc-compiler/inputs.d.mts +2 -2
  172. package/foundation/doc-compiler/inputs.mjs +6 -1
  173. package/foundation/doc-compiler/ir.mjs +7 -0
  174. package/foundation/doc-compiler/lenses.d.mts +3 -2
  175. package/foundation/doc-compiler/lenses.mjs +2 -1
  176. package/foundation/doc-compiler/links.d.mts +135 -0
  177. package/foundation/doc-compiler/links.mjs +253 -0
  178. package/foundation/doc-compiler/links.test.mjs +139 -0
  179. package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
  180. package/foundation/doc-compiler/read.d.mts +3 -2
  181. package/foundation/doc-compiler/read.mjs +6 -1
  182. package/foundation/doc-compiler/tree.d.mts +288 -0
  183. package/foundation/doc-compiler/tree.mjs +876 -0
  184. package/foundation/doc-compiler/tree.test.mjs +598 -0
  185. package/foundation/integrations/autolink.test.mjs +1 -1
  186. package/foundation/integrations/cli-requirement.d.mts +45 -0
  187. package/foundation/integrations/cli-requirement.mjs +154 -0
  188. package/foundation/integrations/cli-requirement.test.mjs +109 -0
  189. package/foundation/integrations/contribution-inventory.d.mts +2 -1
  190. package/foundation/integrations/contribution-inventory.mjs +10 -4
  191. package/foundation/integrations/contribution-inventory.test.mjs +19 -0
  192. package/foundation/integrations/integration-warnings.d.mts +9 -2
  193. package/foundation/integrations/integration-warnings.mjs +51 -26
  194. package/foundation/integrations/integration-warnings.test.mjs +74 -1
  195. package/foundation/integrations/validate-contributions.mjs +25 -27
  196. package/foundation/response/response-types.doc.d.mts +5 -1
  197. package/foundation/response/response-types.doc.mjs +18 -9
  198. package/foundation/xle/expand.mjs +1 -1
  199. package/foundation/xle/xle.test.mjs +13 -0
  200. package/package.json +9 -9
  201. package/assets/docs/cli.doc.mjs +0 -15
@@ -0,0 +1,30 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs cli/api`: the programmatic API of `@astryxdesign/cli/api`.
5
+ *
6
+ * Adopts each function, schema, and enum doc whose `namespace` is `cli/api`,
7
+ * one generated level per kind: `cli/api/functions`, `cli/api/schemas`, and
8
+ * `cli/api/enums`.
9
+ */
10
+
11
+ /** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
12
+ export const docs = {
13
+ type: 'namespace',
14
+ name: 'api',
15
+ title: 'API',
16
+ summary:
17
+ 'The programmatic API: functions, the JSON output envelope, error codes, and response types.',
18
+ keywords: ['api', 'functions', 'schemas', 'enums', 'json'],
19
+ placement: {parent: 'namespace:cli', slot: 'reference', order: 20},
20
+ slots: {
21
+ kinds: {title: 'Reference', accepts: {kinds: ['namespace']}},
22
+ },
23
+ adopts: [
24
+ {
25
+ source: {group: 'cli/api', kinds: ['function', 'schema', 'enum']},
26
+ into: 'kinds',
27
+ groupBy: 'kind',
28
+ },
29
+ ],
30
+ };
@@ -0,0 +1,23 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs cli`: the top of the CLI's docs tree (spec:AST-046).
5
+ *
6
+ * A namespace declares a level and its slots. It never lists its children:
7
+ * a guide places itself here with `placement`, and the `commands` and `api`
8
+ * namespaces adopt the CLI's typed docs by the `namespace` group each declares.
9
+ */
10
+
11
+ /** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
12
+ export const docs = {
13
+ type: 'namespace',
14
+ name: 'cli',
15
+ title: 'Astryx CLI',
16
+ summary:
17
+ 'Commands, programmatic APIs, integration authoring, and output contracts.',
18
+ keywords: ['cli', 'commands', 'api', 'reference'],
19
+ slots: {
20
+ guides: {title: 'Guides', accepts: {kinds: ['generic', 'namespace']}},
21
+ reference: {title: 'Reference', accepts: {kinds: ['namespace']}},
22
+ },
23
+ };
@@ -0,0 +1,25 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs cli/commands`: every command the CLI ships.
5
+ *
6
+ * Adopts each command doc whose `namespace` is `cli/commands`, so a new
7
+ * command appears here with no edit to this file.
8
+ */
9
+
10
+ /** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
11
+ export const docs = {
12
+ type: 'namespace',
13
+ name: 'commands',
14
+ title: 'Commands',
15
+ summary:
16
+ 'Every command and subcommand: usage, options, examples, and exit codes.',
17
+ keywords: ['commands', 'usage', 'options', 'flags'],
18
+ placement: {parent: 'namespace:cli', slot: 'reference', order: 10},
19
+ slots: {
20
+ commands: {title: 'Commands', accepts: {kinds: ['command']}},
21
+ },
22
+ adopts: [
23
+ {source: {group: 'cli/commands', kinds: ['command']}, into: 'commands'},
24
+ ],
25
+ };
@@ -1,13 +1,20 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
- /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
3
+ /**
4
+ * @file `astryx docs cli/integrations`: the guide to building an integration
5
+ * package. It lives in the docs tree under the `cli` namespace (spec:AST-046),
6
+ * so its only route is `cli/integrations`.
7
+ */
4
8
 
9
+ /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
5
10
  export const docs = {
6
- name: 'cli-integrations',
11
+ type: 'generic',
12
+ name: 'integrations',
13
+ placement: {parent: 'namespace:cli', slot: 'guides', order: 10},
7
14
  title: 'CLI Integrations',
8
15
  category: 'guide',
9
16
  description:
10
- 'Author an npm package that contributes components, templates, themes, docs, and upgrade codemods to Astryx.',
17
+ 'Build an Astryx integration: an npm package that contributes components, templates, themes, docs, and upgrade codemods.',
11
18
 
12
19
  sections: [
13
20
  {
@@ -20,11 +27,11 @@ export const docs = {
20
27
  },
21
28
  {
22
29
  type: 'prose',
23
- text: 'The authoring CLI owns the integration file. The first `astryx integration add` creates `astryx.integration.mjs`; each later add declares its root only after writing a valid contribution behind it. Identity (name and version) still comes from package.json. For the consumer side, run `astryx docs getting-started`.',
30
+ text: 'The authoring CLI owns the integration file. The first `astryx integration add` creates `astryx.integration.mjs`; each later add declares its root only after writing a valid contribution behind it. Identity (name and version) still comes from package.json. For the consumer side, run {@link generic:getting-started}.',
24
31
  },
25
32
  {
26
33
  type: 'prose',
27
- text: 'Every file an integration author writes is documented field by field in `npx astryx docs authoring`: the manifest, astryx.config, codemods, identity, and each doc type. `npx astryx docs authoring --index` lists them, and `npx astryx docs authoring <key>` reads one.',
34
+ text: 'Every file an integration author writes is documented field by field in {@link generic:authoring}: the manifest, astryx.config, codemods, identity, and each doc type. `npx astryx docs authoring --index` lists them, and `npx astryx docs authoring <key>` reads one.',
28
35
  },
29
36
  {
30
37
  type: 'prose',
@@ -175,16 +182,37 @@ export const docs = {
175
182
  },
176
183
  {
177
184
  type: 'prose',
178
- text: 'A template id is its source-relative path with the metadata suffix removed; the display `name` is not its identity and may repeat. If an integration id matches a Core id, unqualified lookup fails closed instead of choosing one. Run `astryx doctor integration templates <package>` before publishing: it recommends renaming, but an intentional overlap is allowed when callers always pass `--package <package>`.',
185
+ text: "A template id is its exact source-relative path with the metadata suffix removed; the display `name` is not its identity and may repeat. Run `astryx --json template --list --package @astryxdesign/core` and copy the Core entry's `id` exactly. To replace one, generate the source/metadata pair with `integration add template`, then set `replaces` in that template's own metadata to the exact Core id. The declaration lives on the template, as `replaces` does on a doc topic; the manifest only points at the templates root.",
186
+ },
187
+ {
188
+ type: 'code',
189
+ lang: 'bash',
190
+ label: 'Create the integration template',
191
+ code: 'astryx integration add template acme-app-shell --type page',
192
+ },
193
+ {
194
+ type: 'code',
195
+ lang: 'typescript',
196
+ label: 'Declare the replacement',
197
+ code: "// templates/acme-app-shell.doc.mjs\n/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */\nexport default {\n type: 'page',\n name: 'acme-app-shell',\n displayName: 'Acme App Shell',\n description: 'An app shell with Acme navigation.',\n replaces: 'shell-side-nav',\n};",
179
198
  },
180
199
  {
181
200
  type: 'code',
182
201
  lang: 'typescript',
183
- code: "// AcmeLandingPage.doc.mjs\n/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */\nexport default {\n type: 'page',\n name: 'acme-landing-page',\n displayName: 'Acme Landing Page',\n description: 'A complete product landing page.',\n};",
202
+ label: 'Use product navigation in the replacement source',
203
+ code: "// templates/acme-app-shell.tsx\nimport {AppShell} from '@astryxdesign/core/AppShell';\nimport {Card} from '@astryxdesign/core/Card';\nimport {AcmeSideNav, AcmeTopNav} from '@acme/navigation';\n\nexport default function AcmeAppShell() {\n return (\n <AppShell\n sideNav={<AcmeSideNav />}\n topNav={<AcmeTopNav />}>\n <Card>Product content</Card>\n </AppShell>\n );\n}",
204
+ },
205
+ {
206
+ type: 'prose',
207
+ text: 'With that declaration, `astryx template shell-side-nav` selects `acme-app-shell`; template listing, search, build suggestions, and block-layout lookup use the same effective identity. `astryx template shell-side-nav --package @astryxdesign/core` still selects the original, and `astryx template acme-app-shell --package @acme/navigation` explicitly selects the integration template. In the `template.list` JSON response, a winning replacement entry carries `replaces` naming the Core id it supersedes, and the Core entry is omitted from the default listing. A page can replace only a Core page, and a block can replace only a Core block. Missing Core targets, type mismatches, a declaration on a template that cannot be used, and more than one replacement from one package fail closed: Core stays the default and `astryx doctor integration templates <package>` reports the error. If multiple explicitly configured packages each replace the target, the package configured later wins with a warning. An explicitly configured replacement always wins over an autolinked one. If only autolinked packages conflict, the package listed later in package.json dependencies wins with a warning; add the intended package to `astryx.config` to make the choice explicit. Without `replaces`, valid template selection keeps the existing package-aware ambiguity behavior; contribution failure isolation still follows the rules below.',
208
+ },
209
+ {
210
+ type: 'prose',
211
+ text: "`replaces` is part of the strict template metadata object, so a CLI older than 0.7.0 rejects it: on those CLIs the package's templates and doc topics are withheld with one warning, while its components still load. Declare `@astryxdesign/cli >=0.7.0` when a package uses `replaces`.",
184
212
  },
185
213
  {
186
214
  type: 'prose',
187
- text: 'The CLI needs both files at consume time. `integration add` includes the templates root when package.json already has a files allowlist. It never creates an exports map, because doing that can make previously-open deep imports private; when a map already exists, it adds the generated source subpath without replacing author-owned entries. Use consumer-safe extensionless subpaths in the exports map (e.g. `"./templates/AcmeDashboard"` instead of `"./templates/AcmeDashboard.tsx"`), so consumers import without knowing the file extension. `integration pack --check` proves the source and metadata survive the tarball and verifies every component through the public import its metadata advertises.',
215
+ text: 'The CLI needs both files at consume time. `integration add` includes the templates root when package.json already has a files allowlist. It never creates an exports map, because doing that can make previously-open deep imports private; when a map already exists, it adds the generated source subpath without replacing author-owned entries. Use consumer-safe extensionless subpaths in the exports map (e.g. `"./templates/AcmeDashboard"` instead of `"./templates/AcmeDashboard.tsx"`), so consumers import without knowing the file extension. `integration pack --check` proves the source and metadata, including `replaces`, survive the tarball and verifies every component through the public import its metadata advertises.',
188
216
  },
189
217
  ],
190
218
  },
@@ -426,7 +454,7 @@ export const docs = {
426
454
  },
427
455
  {
428
456
  type: 'prose',
429
- text: 'Discovery is resilient. A broken or misconfigured integration is skipped with a single non-blocking warning on stderr instead of crashing the CLI, and it never corrupts a `--json` stdout envelope. Everyday commands keep working with the remaining valid contributions.',
457
+ text: "Discovery is resilient. A manifest that fails to load is skipped because none of its roots are trustworthy. An error in one contribution kind is reported without hiding the integration's other valid kinds. Invalid template and component files are omitted without hiding valid siblings; other kinds keep their existing all-or-nothing behavior. Everyday commands keep working with the remaining valid contributions, warnings go to stderr, and `--json` stdout stays clean.",
430
458
  },
431
459
  {
432
460
  type: 'prose',
@@ -0,0 +1,62 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, expect, it} from 'vitest';
4
+ import {docs as integrationGuide} from './integrations.doc.mjs';
5
+ import {doc as integrationSchema} from '../../../authoring/integration/integration.doc.mjs';
6
+ import {doc as templateSchema} from '../../../authoring/doctypes/template/template.doc.mjs';
7
+
8
+ function guideText() {
9
+ return integrationGuide.sections
10
+ .flatMap(section => section.content)
11
+ .flatMap(block => {
12
+ if (block.type === 'prose') return [block.text];
13
+ if (block.type === 'code') return [block.label ?? '', block.code];
14
+ if (block.type === 'list') return block.items;
15
+ return [];
16
+ })
17
+ .join('\n');
18
+ }
19
+
20
+ describe('integration template replacement docs', () => {
21
+ it('documents the complete author and consumer contract', () => {
22
+ const text = guideText();
23
+
24
+ for (const required of [
25
+ "replaces: 'shell-side-nav'",
26
+ 'acme-app-shell',
27
+ 'astryx --json template --list --package @astryxdesign/core',
28
+ 'astryx template shell-side-nav --package @astryxdesign/core',
29
+ 'astryx template acme-app-shell --package @acme/navigation',
30
+ 'templates/acme-app-shell.doc.mjs',
31
+ 'AcmeSideNav',
32
+ 'AcmeTopNav',
33
+ '<Card>Product content</Card>',
34
+ 'fail closed',
35
+ 'configured later wins',
36
+ 'wins over an autolinked one',
37
+ 'listed later in package.json dependencies',
38
+ 'valid siblings',
39
+ 'Without `replaces`',
40
+ '@astryxdesign/cli >=0.7.0',
41
+ 'templates and doc topics are withheld',
42
+ '`template.list` JSON response',
43
+ ]) {
44
+ expect(text, required).toContain(required);
45
+ }
46
+ });
47
+
48
+ it('declares a replacement on the template, never in the manifest', () => {
49
+ expect(guideText()).not.toContain('templateReplacements');
50
+ expect(
51
+ integrationSchema.fields.some(field => /replac/i.test(field.name)),
52
+ ).toBe(false);
53
+
54
+ const field = templateSchema.fields.find(
55
+ candidate => candidate.name === 'replaces',
56
+ );
57
+ expect(field).toMatchObject({type: 'string'});
58
+ expect(field.description).toContain('Integration templates only');
59
+ expect(field.description).toContain('--package @astryxdesign/core');
60
+ expect(field.description).toContain('0.7.0');
61
+ });
62
+ });
@@ -0,0 +1,286 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs cli/writing-docs`: the guide to writing docs that readers,
5
+ * people and agents alike, find by search or by moving one level at a time.
6
+ * It lives in the docs tree under the `cli` namespace, so its only route is
7
+ * `cli/writing-docs`.
8
+ */
9
+
10
+ /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
11
+ export const docs = {
12
+ type: 'generic',
13
+ name: 'writing-docs',
14
+ placement: {parent: 'namespace:cli', slot: 'guides', order: 20},
15
+ title: 'Writing docs',
16
+ category: 'guide',
17
+ description:
18
+ 'Write docs that people and agents find by search or by reading one level at a time.',
19
+
20
+ sections: [
21
+ {
22
+ title: 'How the docs work',
23
+ category: 'guide',
24
+ content: [
25
+ {
26
+ type: 'prose',
27
+ text: 'Every doc is one node in one docs graph, with a stable identity and one home in a tree.',
28
+ },
29
+ {
30
+ type: 'list',
31
+ style: 'unordered',
32
+ items: [
33
+ "Identity: the doc's provider, its kind, and its name. Moving a doc never changes it.",
34
+ 'Route: the names of the doc and its parents, such as `cli/api/functions/search`; `astryx docs <route>` reads it.',
35
+ 'Moves: every read ends with Up, Previous, Next, and Related, each as a command you can run.',
36
+ 'Search: a hit is the smallest part that answers, one section or one tree page. It gives the command that reads it and the command that opens the level above.',
37
+ ],
38
+ },
39
+ {
40
+ type: 'prose',
41
+ text: "You never write moves or lists of children. The CLI derives them from each doc's home and its typed links.",
42
+ },
43
+ ],
44
+ },
45
+ {
46
+ title: 'Add a doc',
47
+ category: 'guide',
48
+ content: [
49
+ {
50
+ type: 'prose',
51
+ text: 'To add a doc, write one `.doc.mjs` file named after the doc, and stamp the type that matches what it describes.',
52
+ },
53
+ {
54
+ type: 'table',
55
+ headers: ['You document', 'Doc type', '`type`'],
56
+ rows: [
57
+ ['A topic or a guide', 'ReferenceDoc', "'generic'"],
58
+ ['A CLI command', 'CommandDoc', "'command'"],
59
+ ['A CLI API function', 'FunctionDoc', "'function'"],
60
+ ['An object shape', 'SchemaDoc', "'schema'"],
61
+ ['A fixed list of values', 'EnumDoc', "'enum'"],
62
+ ['A component', 'ComponentDoc', "'component'"],
63
+ ['A level of the tree', 'NamespaceDoc', "'namespace'"],
64
+ ],
65
+ },
66
+ {
67
+ type: 'prose',
68
+ text: 'A topic or guide holds `sections`. Each section has a `title` and `content` blocks, and covers one idea. The `description` is one sentence that says what the doc covers.',
69
+ },
70
+ {
71
+ type: 'code',
72
+ lang: 'javascript',
73
+ label: 'docs/deploying.doc.mjs',
74
+ code: "export default {\n type: 'generic',\n name: 'deploying',\n title: 'Deploying',\n description: 'Ship an app built with Acme widgets.',\n sections: [\n {\n title: 'Build before you ship',\n content: [\n {type: 'prose', text: 'Build the app, then check it with {@link @astryxdesign/cli:command:doctor}.'},\n {type: 'code', lang: 'bash', code: 'npm run build'},\n {type: 'list', style: 'unordered', items: ['Check the output folder.']},\n {type: 'table', headers: ['Env', 'Value'], rows: [['NODE_ENV', 'production']]},\n ],\n },\n ],\n};",
75
+ },
76
+ {
77
+ type: 'list',
78
+ style: 'unordered',
79
+ items: [
80
+ 'A name is a command argument, so use only letters, digits, `_`, and `-`. Use lowercase kebab-case, such as `writing-docs`, so the name and its route segment match.',
81
+ 'Keep the name stable. Links name a doc by its identity, and the name is part of it.',
82
+ 'A name that collides with an existing topic is an error unless the doc declares `replaces` or `extends`.',
83
+ 'Name the cases a doc does not cover, and link to where they are covered. A reader cannot tell a case you left out from a case that does not exist.',
84
+ ],
85
+ },
86
+ {
87
+ type: 'prose',
88
+ text: 'Every field of every doc type is in {@link generic:authoring}.',
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ title: 'Place a doc',
94
+ category: 'guide',
95
+ content: [
96
+ {
97
+ type: 'prose',
98
+ text: 'Each doc gets one home in one of three ways: a namespace adopts it, it places itself, or it stays a flat topic. Folders never decide a home.',
99
+ },
100
+ {
101
+ type: 'prose',
102
+ text: "Adopted: a CLI typed doc declares `namespace`, either `'cli/commands'` or `'cli/api'`. That namespace adopts it by kind, so its route is `cli/commands/<name>` or `cli/api/functions/<name>`.",
103
+ },
104
+ {
105
+ type: 'code',
106
+ lang: 'javascript',
107
+ code: "{type: 'function', name: 'search', namespace: 'cli/api' /* ... */} // cli/api/functions/search",
108
+ },
109
+ {
110
+ type: 'prose',
111
+ text: "Placed: a guide declares `placement`. The `parent` names a namespace of your own package, the `slot` is one that namespace declares for the doc's kind, and `order` sorts the siblings in the slot. A placement that fails withdraws the doc with an error.",
112
+ },
113
+ {
114
+ type: 'code',
115
+ lang: 'javascript',
116
+ code: "placement: {parent: 'namespace:cli', slot: 'guides', order: 20}, // cli/writing-docs",
117
+ },
118
+ {
119
+ type: 'prose',
120
+ text: 'Flat: a doc with neither is a flat topic, read with `astryx docs <name>`.',
121
+ },
122
+ {
123
+ type: 'code',
124
+ lang: 'javascript',
125
+ code: "{type: 'generic', name: 'tokens', title: 'All Tokens' /* ... */} // astryx docs tokens",
126
+ },
127
+ ],
128
+ },
129
+ {
130
+ title: 'Link docs',
131
+ category: 'guide',
132
+ content: [
133
+ {
134
+ type: 'prose',
135
+ text: 'Link a doc with `{@link <target>}` or a typed field, never by writing its `astryx docs` route in prose: a route you write goes stale when the doc moves. Other commands, such as `astryx doctor`, you write as they are.',
136
+ },
137
+ {
138
+ type: 'prose',
139
+ text: "Typed fields: a FunctionDoc's `command` names the CLI command that runs it, and its `related` names functions. A CommandDoc's `fn` names the function it runs, and its `related` names commands.",
140
+ },
141
+ {
142
+ type: 'code',
143
+ lang: 'javascript',
144
+ code: "{type: 'function', name: 'search', command: 'search', related: ['docs']}\n{type: 'command', name: 'search', fn: 'search', related: ['docs']}",
145
+ },
146
+ {
147
+ type: 'prose',
148
+ text: "Inside a section's text, write `{@link <target>}`, where the target is `[<provider>:]<kind>:<name>`; leave out the provider for a doc of your own provider. The CLI prints the command that opens the doc. It works in prose, list items, and table cells; link syntax inside code ticks is shown as written, and an older CLI prints the link as plain text. A namespace doc can also carry `reference` and `workflow` blocks in its `blocks`, though the CLI does not print them yet; a topic's sections cannot hold them.",
149
+ },
150
+ {
151
+ type: 'code',
152
+ lang: 'javascript',
153
+ code: "{type: 'prose', text: 'Check it with {@link command:doctor}.'}\n{type: 'list', style: 'unordered', items: ['Search with {@link @astryxdesign/cli:function:search}.']}\n\n// In a namespace doc's blocks only:\n{type: 'workflow', steps: [\n {title: 'Write the doc', references: ['generic:authoring']},\n {title: 'Check it', references: ['command:doctor']},\n]}",
154
+ },
155
+ {
156
+ type: 'prose',
157
+ text: "The route in the printed command is derived when the doc is read, so a link follows its doc when the doc moves. A target that names no doc prints as written, and so does a typed-field name that matches more than one doc; `astryx doctor` warns on both.",
158
+ },
159
+ ],
160
+ },
161
+ {
162
+ title: 'Keep reads short',
163
+ category: 'guide',
164
+ content: [
165
+ {
166
+ type: 'prose',
167
+ text: 'Keep every read short so a reader gets one answer per command: one idea per section, a summary first, and a hard size limit.',
168
+ },
169
+ {
170
+ type: 'list',
171
+ style: 'unordered',
172
+ items: [
173
+ 'Give each section one idea. If it needs a second topic, split it into two sections.',
174
+ "A section's summary, shown in the section list and in search, is its first prose block or first list item, cut at 240 characters. Lead with what the section answers.",
175
+ 'In text, a topic with more than one section reads as its section list. The reader opens one section, or prints everything with `--full`. With `--json`, a topic returns the whole doc and `--index` its section list.',
176
+ 'Every read should fit in 32 KB; `astryx doctor` warns on one that does not. Aim for sections under about 30 lines.',
177
+ ],
178
+ },
179
+ {
180
+ type: 'code',
181
+ lang: 'bash',
182
+ code: 'astryx docs cli/writing-docs\nastryx docs cli/writing-docs keep-reads-short\nastryx docs cli/writing-docs --full',
183
+ },
184
+ ],
185
+ },
186
+ {
187
+ title: 'Make docs findable',
188
+ category: 'guide',
189
+ content: [
190
+ {
191
+ type: 'prose',
192
+ text: 'Search finds a doc only by the words it indexes, so put the words a reader types where search looks.',
193
+ },
194
+ {
195
+ type: 'prose',
196
+ text: "Search matches titles, section titles, headings, each section's summary, and identifiers written in code ticks, such as `ERR_UNKNOWN_SECTION` or `token-ref`. It also matches a doc's own name and the `keywords` of a namespace or typed doc.",
197
+ },
198
+ {
199
+ type: 'list',
200
+ style: 'do',
201
+ items: [
202
+ 'Title a section with the task or question, such as "Place a doc".',
203
+ 'Start each section with a sentence that names its subject and answers it.',
204
+ 'Write exact identifiers in code ticks: field names, block types, and error codes.',
205
+ 'Add `keywords` only for words that are not already in the title or summary.',
206
+ ],
207
+ },
208
+ {
209
+ type: 'list',
210
+ style: 'dont',
211
+ items: [
212
+ 'Open a section with background. Its first block is its summary.',
213
+ 'Use vague titles such as "Overview" or "Details" when a specific one fits.',
214
+ ],
215
+ },
216
+ {
217
+ type: 'prose',
218
+ text: 'Test it the way a new reader arrives: search for the question, not the title, and check that the first hit answers it.',
219
+ },
220
+ {
221
+ type: 'code',
222
+ lang: 'bash',
223
+ code: 'astryx search placement --type doc',
224
+ },
225
+ ],
226
+ },
227
+ {
228
+ title: 'Docs from an integration',
229
+ category: 'guide',
230
+ content: [
231
+ {
232
+ type: 'prose',
233
+ text: 'An integration joins the same graph with a namespace doc in its docs directory and guides placed in it. The namespace shows in `astryx docs` beside `cli`, with the same moves, search, and links. You can place a doc only in a namespace of your own package.',
234
+ },
235
+ {
236
+ type: 'prose',
237
+ text: 'Let the CLI write the files: inside the package, `astryx integration add doc deploying --parent acme` writes the guide with its placement, declares the docs root, and writes the `acme` namespace doc the first time. Run `astryx docs` in the package to see it.',
238
+ },
239
+ {
240
+ type: 'prose',
241
+ text: "A CLI release that does not read the docs tree can hide every doc topic your package ships when the package contains a namespace doc or a placed guide: none appear in `astryx docs`, in text or JSON, and `astryx doctor` may not say why. So `--parent` also declares the CLI release your docs need as an optional `@astryxdesign/cli` peer in package.json, which makes npm warn when an older CLI is installed, and `astryx integration pack --check` fails a package that ships either one without it.",
242
+ },
243
+ {
244
+ type: 'code',
245
+ lang: 'javascript',
246
+ code: "// docs/acme.doc.mjs\n/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */\nexport default {\n type: 'namespace', name: 'acme', title: 'Acme widgets',\n summary: 'Guides for building apps with Acme widgets.',\n slots: {guides: {title: 'Guides', accepts: {kinds: ['generic']}}},\n};\n\n// docs/deploying.doc.mjs (route: acme/deploying)\n/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */\nexport default {\n type: 'generic', name: 'deploying', title: 'Deploying',\n description: 'Ship an app built with Acme widgets.',\n placement: {parent: 'namespace:acme', slot: 'guides', order: 10},\n sections: [{title: 'Check before you ship', content: [\n {type: 'prose', text: 'Run {@link @astryxdesign/cli:command:doctor} before every deploy.'},\n ]}],\n};",
247
+ },
248
+ {
249
+ type: 'prose',
250
+ text: "The link names the `@astryxdesign/cli` provider because its target lives in another package. A link without a provider resolves against yours: your manifest's `providerId`, or else your package name. That holds in a topic that `extends` another package's topic too: your sections link your docs, and a link to the other package's docs names its provider.",
251
+ },
252
+ {
253
+ type: 'prose',
254
+ text: 'Everything else an integration ships is in {@link generic:integrations}.',
255
+ },
256
+ ],
257
+ },
258
+ {
259
+ title: 'Check your docs',
260
+ category: 'guide',
261
+ content: [
262
+ {
263
+ type: 'prose',
264
+ text: 'Run the doctor commands to check every home, link, and read in your docs.',
265
+ },
266
+ {
267
+ type: 'list',
268
+ style: 'unordered',
269
+ items: [
270
+ '`astryx doctor`, in a project, checks the whole graph: the tree, the links, and the size of each read.',
271
+ '`astryx doctor integration docs`, inside an integration package, runs the same checks on that package\'s docs before it ships.',
272
+ '`astryx integration pack --check` fails a package that ships a namespace doc or a placed guide without a CLI peer that reads them.',
273
+ ],
274
+ },
275
+ {
276
+ type: 'prose',
277
+ text: 'No check can tell whether a doc is still true. Describe what the CLI does now, and change the doc in the same change that changes the behavior.',
278
+ },
279
+ {
280
+ type: 'prose',
281
+ text: 'A problem in the tree or a link is a warning: it names what to fix, but the exit code stays 0, so read the report (or its `--json`) before you ship.',
282
+ },
283
+ ],
284
+ },
285
+ ],
286
+ };
@@ -41,7 +41,7 @@ export default function DateInputDateRange() {
41
41
  max={max}
42
42
  description={description}
43
43
  placeholder="Select a booking date"
44
- nativePicker="never"
44
+ presentation="adaptive-bottom-sheet"
45
45
  value={value}
46
46
  onChange={setValue}
47
47
  />
@@ -17,6 +17,7 @@ export default function TimeInputConstrained() {
17
17
  max={'22:00' as never}
18
18
  description="Evening seating: 5 PM – 10 PM"
19
19
  placeholder="Select reservation time"
20
+ presentation="adaptive-bottom-sheet"
20
21
  value={evening as never}
21
22
  onChange={setEvening as never}
22
23
  hasClear
@@ -52,8 +52,8 @@ declare const eventSchema: z.ZodObject<{
52
52
  }>>;
53
53
  globalOptions: z.ZodRecord<z.ZodString, z.ZodUnknown>;
54
54
  outcome: z.ZodEnum<{
55
- ok: "ok";
56
55
  error: "error";
56
+ ok: "ok";
57
57
  "parse-error": "parse-error";
58
58
  fatal: "fatal";
59
59
  rejected: "rejected";
@@ -79,8 +79,8 @@ declare const eventSchema: z.ZodObject<{
79
79
  component: "component";
80
80
  command: "command";
81
81
  hook: "hook";
82
- doc: "doc";
83
82
  template: "template";
83
+ doc: "doc";
84
84
  integration: "integration";
85
85
  migration: "migration";
86
86
  mixed: "mixed";
@@ -106,10 +106,10 @@ declare const eventSchema: z.ZodObject<{
106
106
  agentSessionIdHash: z.ZodDefault<z.ZodNullable<z.ZodString>>;
107
107
  agentSessionIdSource: z.ZodDefault<z.ZodNullable<z.ZodString>>;
108
108
  invocationSource: z.ZodDefault<z.ZodEnum<{
109
+ unknown: "unknown";
109
110
  human: "human";
110
111
  ai: "ai";
111
112
  automation: "automation";
112
- unknown: "unknown";
113
113
  }>>;
114
114
  oneOff: z.ZodBoolean;
115
115
  packageManager: z.ZodNullable<z.ZodString>;