@astryxdesign/cli 0.6.3-canary.1f30d4e → 0.6.3-canary.1ffe66d

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 (181) 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 +20 -3
  10. package/api/docs/docs.d.mts +5 -3
  11. package/api/docs/docs.doc.mjs +35 -15
  12. package/api/docs/docs.mjs +44 -8
  13. package/api/docs/docs.test.mjs +158 -4
  14. package/api/docs/docs.type.d.mts +165 -2
  15. package/api/docs/docs.type.mjs +101 -3
  16. package/api/docs/index/index.mjs +11 -3
  17. package/api/docs/index/index.test.mjs +1 -1
  18. package/api/docs/integration-tree.test.mjs +547 -0
  19. package/api/docs/integrationDocs.test.mjs +14 -14
  20. package/api/docs/list/list.mjs +25 -5
  21. package/api/docs/node/node.d.mts +43 -0
  22. package/api/docs/node/node.mjs +192 -0
  23. package/api/doctor/doctor.d.mts +30 -2
  24. package/api/doctor/doctor.mjs +146 -7
  25. package/api/doctor/doctor.test.mjs +89 -1
  26. package/api/index.d.mts +1 -1
  27. package/api/index.mjs +1 -0
  28. package/api/init/init.doc.mjs +1 -1
  29. package/api/integration/add-contribution.d.mts +2 -1
  30. package/api/integration/add-contribution.mjs +107 -5
  31. package/api/integration/add-contribution.test.mjs +137 -0
  32. package/api/integration/authoring-checks.mjs +125 -28
  33. package/api/integration/authoring-checks.test.mjs +171 -3
  34. package/api/integration/authoring-checks.type.mjs +6 -1
  35. package/api/integration/integration-authoring.type.d.mts +2 -0
  36. package/api/integration/integration-authoring.type.mjs +2 -0
  37. package/api/integration/integrationAdd.doc.mjs +6 -0
  38. package/api/integration/integrationAddDoc.doc.mjs +7 -1
  39. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  40. package/api/integration/integrationPackCheck.doc.mjs +1 -1
  41. package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
  42. package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
  43. package/api/integration/pack-check.mjs +34 -0
  44. package/api/integration/pack-check.test.mjs +121 -0
  45. package/api/integration/pack-check.type.d.mts +26 -2
  46. package/api/integration/pack-check.type.mjs +14 -1
  47. package/api/integration/template-conflict-compatibility.test.mjs +73 -0
  48. package/api/integration/validate-integration.test.mjs +3 -3
  49. package/api/integration/validateIntegration.doc.mjs +1 -1
  50. package/api/json/index.ts +2 -0
  51. package/api/layout/_adapter.mjs +20 -5
  52. package/api/search/search.d.mts +26 -1
  53. package/api/search/search.doc.mjs +4 -3
  54. package/api/search/search.mjs +308 -29
  55. package/api/search/search.test.mjs +91 -2
  56. package/api/search/search.type.d.mts +13 -1
  57. package/api/search/search.type.mjs +4 -1
  58. package/api/template/list/list.mjs +1 -0
  59. package/api/template/template-integration.test.mjs +1022 -3
  60. package/api/template/template.doc.mjs +27 -7
  61. package/api/template/template.mjs +45 -8
  62. package/api/template/template.type.d.mts +6 -8
  63. package/api/template/template.type.mjs +3 -2
  64. package/api/theme/template/template.test.mjs +5 -0
  65. package/api/theme/themeTemplate.doc.mjs +1 -1
  66. package/assets/docs/getting-started.doc.mjs +2 -2
  67. package/assets/docs/principles.doc.mjs +6 -6
  68. package/assets/docs/styling-libraries.doc.mjs +2 -2
  69. package/assets/docs/styling.doc.mjs +4 -4
  70. package/assets/docs/theme.doc.mjs +3 -3
  71. package/assets/docs/tokens.doc.mjs +1 -1
  72. package/assets/docs/tree/api.doc.mjs +30 -0
  73. package/assets/docs/tree/cli.doc.mjs +23 -0
  74. package/assets/docs/tree/commands.doc.mjs +25 -0
  75. package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
  76. package/assets/docs/tree/integrations.test.mjs +62 -0
  77. package/assets/docs/tree/writing-docs.doc.mjs +286 -0
  78. package/authoring/debug/parse.d.mts +3 -3
  79. package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
  80. package/authoring/doctypes/base/type.ts +6 -5
  81. package/authoring/doctypes/command/command.doc.mjs +1 -1
  82. package/authoring/doctypes/command/type.ts +2 -2
  83. package/authoring/doctypes/enum/enum.doc.mjs +1 -1
  84. package/authoring/doctypes/enum/type.ts +1 -1
  85. package/authoring/doctypes/function/function.doc.mjs +3 -2
  86. package/authoring/doctypes/function/type.ts +3 -2
  87. package/authoring/doctypes/namespace/namespace.doc.mjs +5 -9
  88. package/authoring/doctypes/reference/reference.doc.mjs +3 -3
  89. package/authoring/doctypes/reference/type.ts +3 -0
  90. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  91. package/authoring/doctypes/schema/type.ts +1 -1
  92. package/authoring/doctypes/template/parse.d.mts +2 -0
  93. package/authoring/doctypes/template/parse.mjs +4 -0
  94. package/authoring/doctypes/template/parse.test.mjs +18 -0
  95. package/authoring/doctypes/template/template.doc.mjs +6 -0
  96. package/authoring/doctypes/template/type.ts +8 -0
  97. package/authoring/identity/identity.doc.mjs +2 -2
  98. package/authoring/integration/type.ts +1 -1
  99. package/clients/cli/commands/build-theme.mjs +1 -1
  100. package/clients/cli/commands/build.mjs +5 -2
  101. package/clients/cli/commands/component/index.mjs +1 -1
  102. package/clients/cli/commands/component-ownership.test.mjs +3 -3
  103. package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
  104. package/clients/cli/commands/discover.mjs +1 -1
  105. package/clients/cli/commands/docs.doc.mjs +20 -8
  106. package/clients/cli/commands/docs.mjs +175 -18
  107. package/clients/cli/commands/docs.test.mjs +114 -7
  108. package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
  109. package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
  110. package/clients/cli/commands/doctor-integration.test.mjs +75 -1
  111. package/clients/cli/commands/doctor.mjs +53 -16
  112. package/clients/cli/commands/integration-add.doc.mjs +10 -0
  113. package/clients/cli/commands/integration.mjs +1 -0
  114. package/clients/cli/commands/search.mjs +11 -2
  115. package/clients/cli/commands/setup-nudge.test.mjs +6 -0
  116. package/clients/cli/commands/template.doc.mjs +23 -6
  117. package/clients/cli/commands/template.mjs +4 -91
  118. package/clients/cli/commands/text-json-parity.test.mjs +2 -1
  119. package/clients/cli/index.mjs +8 -0
  120. package/clients/cli/lib/manifest.mjs +9 -2
  121. package/foundation/agent-docs/agent-docs.mjs +1 -0
  122. package/foundation/agent-docs/agent-docs.test.mjs +10 -1
  123. package/foundation/config/project.d.mts +12 -11
  124. package/foundation/config/project.mjs +73 -59
  125. package/foundation/config/project.test.mjs +141 -5
  126. package/foundation/discovery/authoring-self-docs.test.mjs +17 -7
  127. package/foundation/discovery/cli-self-docs.d.mts +40 -34
  128. package/foundation/discovery/cli-self-docs.mjs +91 -115
  129. package/foundation/discovery/cli-self-docs.test.mjs +104 -166
  130. package/foundation/discovery/component-discovery.d.mts +38 -0
  131. package/foundation/discovery/component-discovery.mjs +48 -0
  132. package/foundation/discovery/docs-discovery.d.mts +105 -8
  133. package/foundation/discovery/docs-discovery.mjs +177 -13
  134. package/foundation/discovery/docs-discovery.test.mjs +56 -17
  135. package/foundation/discovery/docs-output-budget.d.mts +2 -2
  136. package/foundation/discovery/docs-output-budget.mjs +1 -1
  137. package/foundation/discovery/docs-section-key.d.mts +9 -2
  138. package/foundation/discovery/docs-section-key.mjs +15 -1
  139. package/foundation/discovery/template-adapter.d.mts +92 -6
  140. package/foundation/discovery/template-adapter.mjs +453 -17
  141. package/foundation/discovery/template-adapter.test.mjs +42 -0
  142. package/foundation/discovery/template-conflict-release.d.mts +13 -0
  143. package/foundation/discovery/template-conflict-release.mjs +40 -0
  144. package/foundation/discovery/template-conflict-release.test.mjs +40 -0
  145. package/foundation/doc-compiler/bundle.mjs +61 -1
  146. package/foundation/doc-compiler/bundle.test.mjs +21 -10
  147. package/foundation/doc-compiler/compile.d.mts +113 -132
  148. package/foundation/doc-compiler/compile.mjs +52 -6
  149. package/foundation/doc-compiler/diagnostics.mjs +28 -0
  150. package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
  151. package/foundation/doc-compiler/inputs.d.mts +2 -2
  152. package/foundation/doc-compiler/inputs.mjs +6 -1
  153. package/foundation/doc-compiler/ir.mjs +7 -0
  154. package/foundation/doc-compiler/lenses.d.mts +3 -2
  155. package/foundation/doc-compiler/lenses.mjs +2 -1
  156. package/foundation/doc-compiler/links.d.mts +135 -0
  157. package/foundation/doc-compiler/links.mjs +253 -0
  158. package/foundation/doc-compiler/links.test.mjs +139 -0
  159. package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
  160. package/foundation/doc-compiler/read.d.mts +3 -2
  161. package/foundation/doc-compiler/read.mjs +6 -1
  162. package/foundation/doc-compiler/tree.d.mts +288 -0
  163. package/foundation/doc-compiler/tree.mjs +876 -0
  164. package/foundation/doc-compiler/tree.test.mjs +598 -0
  165. package/foundation/integrations/autolink.test.mjs +1 -1
  166. package/foundation/integrations/cli-requirement.d.mts +45 -0
  167. package/foundation/integrations/cli-requirement.mjs +154 -0
  168. package/foundation/integrations/cli-requirement.test.mjs +109 -0
  169. package/foundation/integrations/contribution-inventory.d.mts +2 -1
  170. package/foundation/integrations/contribution-inventory.mjs +10 -4
  171. package/foundation/integrations/contribution-inventory.test.mjs +19 -0
  172. package/foundation/integrations/integration-warnings.d.mts +9 -2
  173. package/foundation/integrations/integration-warnings.mjs +51 -26
  174. package/foundation/integrations/integration-warnings.test.mjs +74 -1
  175. package/foundation/integrations/validate-contributions.mjs +25 -27
  176. package/foundation/response/response-types.doc.d.mts +5 -1
  177. package/foundation/response/response-types.doc.mjs +18 -9
  178. package/foundation/xle/expand.mjs +1 -1
  179. package/foundation/xle/xle.test.mjs +13 -0
  180. package/package.json +9 -9
  181. package/assets/docs/cli.doc.mjs +0 -15
@@ -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
+ };
@@ -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>;
@@ -12,25 +12,27 @@ export const doc = {
12
12
  displayName: 'Authored doc graph fields',
13
13
  namespace: 'authoring',
14
14
  description:
15
- 'Placement, compatibility aliases, and audience: fields every authored doc kind declares for the docs graph. The docs graph is not built yet, so nothing reads them: a reference topic that sets one fails to load, and other doc kinds accept them and ignore them.',
15
+ "Placement, compatibility aliases, and audience: fields every authored doc kind declares for the docs tree. The docs tree reads `placement` for every guide, the CLI's and each integration's; aliases and audience are not built yet. A reference topic outside the docs tree that sets one fails to load, and other doc kinds accept them and ignore them.",
16
16
  appliesTo: 'Every supported .doc.mjs object',
17
17
  fields: [
18
18
  {
19
19
  name: 'placement',
20
20
  type: 'DocPlacement',
21
21
  description:
22
- 'Requests one canonical parent in the docs graph. Not read yet: a topic that sets it fails to load.',
22
+ "Names the doc's one parent in the docs tree: a namespace of the same package, one of its slots, and an order. Read for every guide, the CLI's and each integration's: a guide with `placement` gets a route in the tree instead of a flat topic name, and cannot also `replaces` or `extends` a topic. In the CLI's own topic directory a topic that sets it fails to load: the CLI keeps its guides in its docs tree directory. Commands, API functions, schemas, and enums do not set it: the tree adopts each by its `namespace`.",
23
23
  fields: [
24
24
  {
25
25
  name: 'placement.parent',
26
26
  type: 'string',
27
- description: 'Stable reference to the requested parent namespace.',
27
+ description:
28
+ 'The parent namespace: `namespace:<name>` in the same package.',
28
29
  required: true,
29
30
  },
30
31
  {
31
32
  name: 'placement.slot',
32
33
  type: 'string',
33
- description: 'Named slot owned by the parent namespace.',
34
+ description:
35
+ "A slot the parent namespace declares; it must accept this doc's kind. Optional when the parent has one slot.",
34
36
  },
35
37
  {
36
38
  name: 'placement.order',
@@ -43,7 +45,7 @@ export const doc = {
43
45
  name: 'aliases',
44
46
  type: 'string[]',
45
47
  description:
46
- 'Prior names or routes the docs graph will keep resolving to this doc, without creating another identity. Not read yet: a topic that sets it fails to load.',
48
+ 'Prior names or routes the docs tree will keep resolving to this doc, without creating another identity. Not read yet: a topic that sets it fails to load.',
47
49
  },
48
50
  {
49
51
  name: 'audience',
@@ -31,14 +31,15 @@ export interface DocPlacement {
31
31
  }
32
32
 
33
33
  /**
34
- * Graph metadata shared by every authored doc kind. Reserved for the docs
35
- * graph, which is not built yet: nothing reads these fields, and a reference
36
- * topic that sets one fails to load.
34
+ * Tree metadata shared by every authored doc kind. The docs tree reads
35
+ * `placement` for every guide, the CLI's and each integration's
36
+ * (spec:AST-046); nothing reads `aliases` or `audience` yet. A reference topic
37
+ * outside the docs tree that sets one fails to load.
37
38
  */
38
39
  export interface AuthoredDocGraphFields {
39
- /** Requested canonical parent in the docs graph. Not read yet. */
40
+ /** The doc's one parent in the docs tree: a namespace of its own package. */
40
41
  placement?: DocPlacement;
41
- /** Prior routes or names the docs graph will keep resolving. Not read yet. */
42
+ /** Prior routes or names the docs tree will keep resolving. Not read yet. */
42
43
  aliases?: string[];
43
44
  /** Docs bundle audience; omit for public docs. Not read yet. */
44
45
  audience?: DocAudience;
@@ -54,7 +54,7 @@ export const doc = {
54
54
  name: 'namespace',
55
55
  type: 'string',
56
56
  description:
57
- "The `astryx docs` topic that reads this doc. The CLI's commands use 'cli/commands' (the section `commands-<name>` of the `cli` topic). Every command doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads.",
57
+ "Optional in the type, but every doc the CLI ships declares it. The group that reads this doc. The CLI's commands use 'cli/commands', which the docs tree adopts: each is the leaf `cli/commands/<name>`. Every command doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
58
58
  },
59
59
  {
60
60
  name: 'aliases',
@@ -65,7 +65,7 @@ export interface CommandDoc extends AuthoredDocGraphFields {
65
65
  summary: string;
66
66
  /** Longer help body / when-to-use. */
67
67
  description?: string;
68
- /** The `astryx docs` topic that reads this doc. The CLI's commands use 'cli/commands' (the section `commands-<name>` of the `cli` topic). Every command doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads. */
68
+ /** The group that reads this doc. The CLI's commands use 'cli/commands', which the docs tree adopts: each is the leaf `cli/commands/<name>`. Every command doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
69
69
  namespace?: string;
70
70
  /** Alternate slugs that also resolve to this doc. */
71
71
  aliases?: string[];
@@ -81,7 +81,7 @@ export interface CommandDoc extends AuthoredDocGraphFields {
81
81
  examples?: CommandExampleDoc[];
82
82
  /** Documented exit codes. */
83
83
  exitCodes?: {code: number; when: string}[];
84
- /** Related command names. */
84
+ /** Related command names; the CLI links each to its doc. */
85
85
  related?: string[];
86
86
  /** Freeform prose/notes. */
87
87
  notes?: ReferenceContentBlock[];
@@ -49,7 +49,7 @@ export const doc = {
49
49
  name: 'namespace',
50
50
  type: 'string',
51
51
  description:
52
- "The `astryx docs` topic that reads this doc. The CLI's enums use 'cli/api' (the section `api-<name>` of the `cli` topic). Every enum doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads.",
52
+ "Optional in the type, but every doc the CLI ships declares it. The group that reads this doc. The CLI's enums use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/enums/<name>`. Every enum doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
53
53
  },
54
54
  {
55
55
  name: 'aliases',
@@ -32,7 +32,7 @@ export interface EnumDoc extends AuthoredDocGraphFields {
32
32
  displayName: string;
33
33
  /** One-line summary shown in listings. */
34
34
  description: string;
35
- /** The `astryx docs` topic that reads this doc. The CLI's enums use 'cli/api' (the section `api-<name>` of the `cli` topic). Every enum doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads. */
35
+ /** The group that reads this doc. The CLI's enums use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/enums/<name>`. Every enum doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
36
36
  namespace?: string;
37
37
  /** Alternate slugs that also resolve to this doc. */
38
38
  aliases?: string[];
@@ -57,7 +57,7 @@ export const doc = {
57
57
  name: 'namespace',
58
58
  type: 'string',
59
59
  description:
60
- "The `astryx docs` topic that reads this doc. The CLI's API functions use 'cli/api' (the section `api-<name>` of the `cli` topic). Every function doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads.",
60
+ "Optional in the type, but every doc the CLI ships declares it. The group that reads this doc. The CLI's API functions use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/functions/<name>`. Every function doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
61
61
  },
62
62
  {
63
63
  name: 'aliases',
@@ -201,7 +201,8 @@ export const doc = {
201
201
  {
202
202
  name: 'related',
203
203
  type: 'string[]',
204
- description: 'Related function/command names.',
204
+ description:
205
+ 'Related function names; the CLI links each to its doc. Name the CLI command with `command`, not here.',
205
206
  },
206
207
  {
207
208
  name: 'relatedComponents',
@@ -62,7 +62,7 @@ export interface FunctionDoc extends AuthoredDocGraphFields {
62
62
  summary?: string;
63
63
  /** Longer description. */
64
64
  description?: string;
65
- /** The `astryx docs` topic that reads this doc. The CLI's API functions use 'cli/api' (the section `api-<name>` of the `cli` topic). Every function doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads. */
65
+ /** The group that reads this doc. The CLI's API functions use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/functions/<name>`. Every function doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
66
66
  namespace?: string;
67
67
  /** Alternate slugs that also resolve to this doc. */
68
68
  aliases?: string[];
@@ -84,7 +84,8 @@ export interface FunctionDoc extends AuthoredDocGraphFields {
84
84
  usage?: UsageDoc;
85
85
  /** The CLI command that wraps this function, e.g. 'search'. */
86
86
  command?: string;
87
- /** Related function/command names. */
87
+ /** Related function names; the CLI links each to its doc. Name the CLI
88
+ * command with `command`, not here. */
88
89
  related?: string[];
89
90
  /** Component names this is commonly used with (hooks). */
90
91
  relatedComponents?: string[];
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'NamespaceDoc',
13
13
  namespace: 'authoring',
14
14
  description:
15
- "Declares named navigation slots and renderer-neutral layout blocks for already-discovered docs. It never scans folders or copies child documents. Not loaded yet: only the docs graph reads namespace docs, and it is not built, so keep them out of an integration's docs directory for now.",
15
+ "Declares one level of the docs tree: named slots, and adoption rules for already-discovered docs. It never scans folders, lists its children, or copies child documents: a child names its parent with `placement`, or a namespace adopts a discovery group. `astryx docs <route>` lists each slot's children one level down. The CLI keeps its namespace docs in its docs tree directory; an integration ships its own in its docs directory, and they appear in `astryx docs` beside the CLI's.",
16
16
  appliesTo: '<namespace>.doc.mjs',
17
17
  fields: [
18
18
  {
@@ -44,13 +44,13 @@ export const doc = {
44
44
  name: 'placement',
45
45
  type: 'DocPlacement',
46
46
  description:
47
- 'Optional canonical parent request: {parent, slot?, order?}. Invalid explicit placement will fail compilation instead of falling back.',
47
+ 'Optional canonical parent: {parent, slot?, order?}. `parent` names a namespace of the same package as `namespace:<name>`. An invalid placement withdraws the namespace with a diagnostic; it never falls back.',
48
48
  },
49
49
  {
50
50
  name: 'aliases',
51
51
  type: 'string[]',
52
52
  description:
53
- 'Prior names or routes the docs graph will keep resolving to this doc.',
53
+ 'Prior names or routes the docs tree will keep resolving to this doc. Not read yet.',
54
54
  },
55
55
  {
56
56
  name: 'audience',
@@ -80,7 +80,7 @@ export const doc = {
80
80
  name: 'blocks',
81
81
  type: '(ReferenceContentBlock | GraphContentBlock)[]',
82
82
  description:
83
- 'Ordered layout content. Graph-only workflow, collection, and reference blocks are available here without widening the stable ReferenceContentBlock union used by existing topic renderers.',
83
+ 'Ordered layout content for the namespace page. Graph-only workflow, collection, and reference blocks are available here without widening the stable ReferenceContentBlock union used by existing topic renderers. Not rendered yet: `astryx docs <route>` lists every slot and its children in order.',
84
84
  },
85
85
  ],
86
86
  examples: [
@@ -103,17 +103,13 @@ export const docs = {
103
103
  source: {group: 'cli-commands', kinds: ['command']},
104
104
  into: 'reference',
105
105
  }],
106
- blocks: [
107
- {type: 'collection', source: {slot: 'guides'}, presentation: 'cards'},
108
- {type: 'collection', source: {slot: 'reference'}, presentation: 'compact'},
109
- ],
110
106
  };`,
111
107
  },
112
108
  ],
113
109
  notes: [
114
110
  {
115
111
  type: 'prose',
116
- text: "Namespace docs are not loaded yet. Only the docs graph reads them, and it is not built. A namespace doc in an integration's docs directory fails to load as a topic, and with it every topic that package contributes, until the file is removed.",
112
+ text: "The docs tree reads namespace docs from the CLI and from every configured integration. An integration's namespace doc is a top-level level of the tree, and its guides name it with `placement`; a doc can be placed only in a namespace of its own package. When two packages claim one route, the CLI's own docs win, then integrations in configured order, and `astryx doctor` names the loser.",
117
113
  },
118
114
  {
119
115
  type: 'prose',
@@ -95,7 +95,7 @@ export const doc = {
95
95
  name: 'sections[].content',
96
96
  type: 'ReferenceContentBlock[]',
97
97
  description:
98
- 'Ordered content blocks: prose, heading, code, table, list, and token-ref. Graph-only workflow, collection, and reference blocks are available through GraphContentBlock on NamespaceDoc, without widening this stable union.',
98
+ 'Ordered content blocks: prose, heading, code, table, list, and token-ref. Graph-only workflow, collection, and reference blocks are available through GraphContentBlock on NamespaceDoc, without widening this stable union. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.',
99
99
  required: true,
100
100
  },
101
101
  {
@@ -144,7 +144,7 @@ export const docs = {
144
144
  },
145
145
  {
146
146
  type: 'prose',
147
- text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref. Docs-graph-only workflow, collection, and reference blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc.',
147
+ text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref. Docs-graph-only workflow, collection, and reference blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.',
148
148
  },
149
149
  {
150
150
  type: 'code',
@@ -161,7 +161,7 @@ export const docs = {
161
161
  type GraphContentBlock =
162
162
  | { type: 'workflow'; title?: string; steps: WorkflowStep[] }
163
163
  | { type: 'collection'; source: {slot: string}; presentation?: 'list' | 'cards' | 'compact'; whenEmpty?: 'show' | 'omit' }
164
- | { type: 'reference'; target: string; projection?: {fields?: string[]; sections?: string[]} };`,
164
+ | { type: 'reference'; target: string; presentation?: 'summary' | 'compact' };`,
165
165
  },
166
166
  {
167
167
  type: 'prose',
@@ -60,9 +60,12 @@ export type GraphContentBlock =
60
60
  * { type: 'table', headers: ['Token', 'Value'], rows: [['--spacing-4', '16px']] }
61
61
  * { type: 'list', style: 'do', items: ['Use semantic tokens'] }
62
62
  * { type: 'token-ref', topic: 'tokens', section: 'Color Tokens' }
63
+ * { type: 'prose', text: 'Check it with {@link command:doctor}.' }
63
64
  * ```
64
65
  */
65
66
  export type ReferenceContentBlock =
67
+ /** Text. `{@link [<provider>:]<kind>:<name>}` inside it links another doc
68
+ * by identity; `astryx docs` prints the command that opens that doc. */
66
69
  | {type: 'prose'; text: string}
67
70
  | {type: 'heading'; level: 3 | 4 | 5 | 6; text: string}
68
71
  | {type: 'code'; lang: string; code: string; label?: string}
@@ -49,7 +49,7 @@ export const doc = {
49
49
  name: 'namespace',
50
50
  type: 'string',
51
51
  description:
52
- "The `astryx docs` topic that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the section `api-<name>` of the `cli` topic). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads.",
52
+ "The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
53
53
  },
54
54
  {
55
55
  name: 'aliases',
@@ -47,7 +47,7 @@ export interface SchemaDoc extends AuthoredDocGraphFields {
47
47
  displayName: string;
48
48
  /** One-line summary shown in listings. */
49
49
  description: string;
50
- /** The `astryx docs` topic that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the section `api-<name>` of the `cli` topic). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads. */
50
+ /** The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
51
51
  namespace?: string;
52
52
  /** Alternate slugs that also resolve to this doc (back-compat). */
53
53
  aliases?: string[];
@@ -56,6 +56,7 @@ declare const pageTemplateSchema: z.ZodObject<{
56
56
  slug: z.ZodOptional<z.ZodString>;
57
57
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
58
58
  }, z.core.$strict>>;
59
+ replaces: z.ZodOptional<z.ZodString>;
59
60
  placement: z.ZodOptional<z.ZodObject<{
60
61
  parent: z.ZodString;
61
62
  slot: z.ZodOptional<z.ZodString>;
@@ -91,6 +92,7 @@ declare const blockTemplateSchema: z.ZodObject<{
91
92
  slug: z.ZodOptional<z.ZodString>;
92
93
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
94
  }, z.core.$strict>>;
95
+ replaces: z.ZodOptional<z.ZodString>;
94
96
  placement: z.ZodOptional<z.ZodObject<{
95
97
  parent: z.ZodString;
96
98
  slot: z.ZodOptional<z.ZodString>;
@@ -51,6 +51,10 @@ const baseTemplateFields = {
51
51
  scaffold: z.boolean().optional(),
52
52
  isHiddenFromOverview: z.boolean().optional(),
53
53
  registry: registryIdentitySchema.optional(),
54
+ replaces: z
55
+ .string()
56
+ .min(1, 'replaces must name a Core template id')
57
+ .optional(),
54
58
  };
55
59
 
56
60
  const pageTemplateSchema = z