@astryxdesign/cli 0.7.11-canary.ed0adf3 → 0.7.12-canary.0085c0f

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 (180) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/api/build/blocks/blocks.d.mts +41 -0
  3. package/api/build/blocks/blocks.mjs +118 -68
  4. package/api/build/kit/rank.mjs +21 -4
  5. package/api/build/kit/words.d.mts +1 -0
  6. package/api/build/kit/words.mjs +1 -1
  7. package/api/component/__fixtures__/resolutions/modules.txt +5 -5
  8. package/api/docs/_adapter.d.mts +22 -0
  9. package/api/docs/_adapter.mjs +81 -3
  10. package/api/docs/docs.doc.mjs +5 -5
  11. package/api/docs/docs.type.d.mts +21 -0
  12. package/api/docs/docs.type.mjs +11 -0
  13. package/api/docs/list/list.d.mts +5 -1
  14. package/api/docs/list/list.mjs +72 -6
  15. package/api/docs/node/node.mjs +2 -40
  16. package/api/doctor/doctor.d.mts +4 -4
  17. package/api/doctor/doctor.mjs +248 -78
  18. package/api/icon/_adapter.d.mts +3 -2
  19. package/api/icon/_adapter.mjs +8 -2
  20. package/api/icon/_authoring.d.mts +1 -0
  21. package/api/icon/_authoring.mjs +594 -67
  22. package/api/icon/_default-look.d.mts +155 -0
  23. package/api/icon/_default-look.mjs +474 -0
  24. package/api/icon/_records.d.mts +1 -1
  25. package/api/icon/_records.mjs +1 -0
  26. package/api/icon/add/add.mjs +269 -43
  27. package/api/icon/icon.type.d.mts +46 -2
  28. package/api/icon/icon.type.mjs +12 -2
  29. package/api/icon/iconAdd.doc.mjs +2 -2
  30. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  31. package/api/icon/iconNewSet.doc.mjs +4 -4
  32. package/api/icon/map/map.mjs +11 -4
  33. package/api/icon/search/search.mjs +10 -9
  34. package/api/index.d.mts +1 -0
  35. package/api/index.mjs +1 -0
  36. package/api/integration/add-helpers.d.mts +15 -1
  37. package/api/integration/add-helpers.mjs +5 -2
  38. package/api/integration/authoring-checks.d.mts +0 -2
  39. package/api/integration/authoring-checks.mjs +1 -6
  40. package/api/logger.mjs +2 -1
  41. package/api/render/_adapter.mjs +9 -0
  42. package/api/render/render.doc.mjs +3 -3
  43. package/api/render/render.type.d.mts +1 -1
  44. package/api/render/render.type.mjs +1 -1
  45. package/api/search/ORDERING.md +3 -0
  46. package/api/search/_adapter.d.mts +32 -3
  47. package/api/search/_adapter.mjs +50 -22
  48. package/api/search/_fit-order.d.mts +47 -0
  49. package/api/search/_fit-order.mjs +257 -0
  50. package/api/search/_main-searcher.mjs +15 -5
  51. package/api/search/exportSearchIndex.doc.d.mts +10 -0
  52. package/api/search/exportSearchIndex.doc.mjs +58 -0
  53. package/api/search/rankSearchIndex.doc.d.mts +10 -0
  54. package/api/search/rankSearchIndex.doc.mjs +79 -0
  55. package/api/search/search-index.d.mts +44 -0
  56. package/api/search/search-index.mjs +270 -0
  57. package/api/search/search.type.d.mts +28 -0
  58. package/api/search/search.type.mjs +17 -0
  59. package/api/swizzle/_adapter.d.mts +1 -0
  60. package/api/swizzle/_adapter.mjs +4 -1
  61. package/api/swizzle/_moduleGraph.d.mts +178 -0
  62. package/api/swizzle/_moduleGraph.mjs +903 -0
  63. package/api/swizzle/copy/copy.d.mts +2 -43
  64. package/api/swizzle/copy/copy.mjs +287 -315
  65. package/api/swizzle/swizzle.d.mts +0 -2
  66. package/api/swizzle/swizzle.doc.mjs +13 -4
  67. package/api/swizzle/swizzle.mjs +3 -7
  68. package/api/swizzle/swizzle.type.d.mts +7 -1
  69. package/api/swizzle/swizzle.type.mjs +4 -2
  70. package/api/template/skeleton/skeleton.mjs +1 -1
  71. package/api/template/template.mjs +1 -0
  72. package/assets/codemods/transforms/v0.1.0/drop-xds-prefix-imports.mjs +1 -1
  73. package/assets/codemods/transforms/v0.1.0/index.mjs +1 -1
  74. package/assets/discover/official-packages.json +40 -0
  75. package/assets/docs/browser-support.doc.mjs +2 -2
  76. package/assets/docs/styling-overview.doc.mjs +6 -2
  77. package/assets/docs/tree/icon-sets.doc.mjs +13 -7
  78. package/assets/docs/tree/render-pages.doc.mjs +3 -3
  79. package/assets/docs/tree/tailwind.doc.mjs +41 -1
  80. package/assets/docs/tree/type-scale.doc.mjs +19 -2
  81. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.doc.mjs +14 -0
  82. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.tsx +146 -0
  83. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.doc.mjs +14 -0
  84. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.tsx +173 -0
  85. package/assets/templates/blocks/components/Hooks/useInputStatusIconHookUsage.tsx +1 -0
  86. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.doc.mjs +14 -0
  87. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.tsx +56 -0
  88. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.doc.mjs +2 -2
  89. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +66 -10
  90. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.doc.mjs +14 -0
  91. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.tsx +39 -0
  92. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.doc.mjs +14 -0
  93. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.tsx +83 -0
  94. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.doc.mjs +14 -0
  95. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.tsx +41 -0
  96. package/assets/templates/blocks/components/Table/TableLeadingMarkSelection.doc.mjs +15 -0
  97. package/assets/templates/blocks/components/Table/TableLeadingMarkSelection.tsx +134 -0
  98. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  99. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  100. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.doc.mjs +14 -0
  101. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.tsx +97 -0
  102. package/assets/templates/pages/course-detail/page.tsx +699 -0
  103. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  104. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  105. package/assets/templates/pages/table-filter/page.tsx +15 -23
  106. package/assets/templates/pages/table-grouped/page.tsx +190 -262
  107. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  108. package/assets/templates/pages/table-inbox/page.tsx +3 -6
  109. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  110. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  111. package/assets/templates/themes/butter/butterTheme.ts +2 -2
  112. package/assets/templates/themes/gothic/gothicTheme.ts +16 -0
  113. package/assets/templates/themes/matcha/matchaTheme.ts +1 -1
  114. package/assets/templates/themes/neutral/neutralTheme.ts +6 -0
  115. package/assets/templates/themes/stone/stoneTheme.ts +1 -1
  116. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
  117. package/assets/templates/themes/y2k/y2kTheme.ts +2 -2
  118. package/authoring/doctypes/_schema.d.mts +1 -1
  119. package/authoring/doctypes/template/type.ts +1 -0
  120. package/clients/cli/commands/build.mjs +34 -5
  121. package/clients/cli/commands/docs.doc.mjs +5 -1
  122. package/clients/cli/commands/docs.mjs +30 -2
  123. package/clients/cli/commands/experimental/icon.mjs +56 -14
  124. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  125. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  126. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  127. package/clients/cli/commands/experimental-render.doc.mjs +1 -1
  128. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  129. package/clients/cli/commands/swizzle.mjs +33 -9
  130. package/clients/cli/commands/template.mjs +204 -181
  131. package/clients/cli/index.mjs +36 -7
  132. package/clients/cli/lib/resolve-theme.mjs +16 -7
  133. package/foundation/discovery/component-discovery.mjs +1 -1
  134. package/foundation/discovery/component-loader.d.mts +1 -1
  135. package/foundation/discovery/doc-types.mjs +9 -2
  136. package/foundation/discovery/hook-discovery.mjs +31 -8
  137. package/foundation/discovery/icon-ranking.d.mts +27 -3
  138. package/foundation/discovery/icon-ranking.mjs +125 -8
  139. package/foundation/discovery/icon-set-checks.mjs +44 -35
  140. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  141. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  142. package/foundation/discovery/icon-set-writer.d.mts +258 -20
  143. package/foundation/discovery/icon-set-writer.mjs +785 -87
  144. package/foundation/discovery/module-exports.d.mts +62 -3
  145. package/foundation/discovery/module-exports.mjs +384 -58
  146. package/foundation/discovery/template-adapter.mjs +2 -2
  147. package/foundation/doc-compiler/import.d.mts +5 -1
  148. package/foundation/doc-compiler/import.mjs +40 -6
  149. package/foundation/env/package-manager.d.mts +12 -4
  150. package/foundation/env/package-manager.mjs +15 -6
  151. package/foundation/env/semver.mjs +41 -9
  152. package/foundation/fs/import-url.d.mts +20 -0
  153. package/foundation/fs/import-url.mjs +22 -0
  154. package/foundation/fs/module-loader.d.mts +24 -3
  155. package/foundation/fs/module-loader.mjs +69 -47
  156. package/foundation/fs/paths.d.mts +2 -1
  157. package/foundation/fs/paths.mjs +3 -4
  158. package/foundation/release/notices.d.mts +16 -0
  159. package/foundation/release/notices.mjs +27 -6
  160. package/foundation/render/charts.d.mts +59 -0
  161. package/foundation/render/charts.mjs +216 -0
  162. package/foundation/render/embedded-imports.d.mts +7 -7
  163. package/foundation/render/embedded-imports.mjs +63 -54
  164. package/foundation/render/page-host.d.mts +4 -0
  165. package/foundation/render/page-host.mjs +45 -0
  166. package/foundation/render/page-worker.mjs +350 -57
  167. package/foundation/render/render-page.d.mts +11 -6
  168. package/foundation/render/render-page.mjs +164 -54
  169. package/foundation/render/ts-paths.d.mts +63 -0
  170. package/foundation/render/ts-paths.mjs +138 -0
  171. package/foundation/response/error-codes.doc.mjs +3 -3
  172. package/foundation/response/error-codes.mjs +3 -2
  173. package/foundation/text/levenshtein.d.mts +6 -1
  174. package/foundation/text/levenshtein.mjs +25 -9
  175. package/foundation/text/shell-arg.d.mts +14 -0
  176. package/foundation/text/shell-arg.mjs +17 -0
  177. package/foundation/text/suggest-order.d.mts +8 -1
  178. package/foundation/text/suggest-order.mjs +72 -6
  179. package/foundation/xle/registry-core.mjs +1 -1
  180. package/package.json +7 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @xds/cli
2
2
 
3
+ # 0.7.11
4
+
5
+ #### New Features
6
+
7
+ - `astryx build` ranks Core blocks of component families its picker was not fitted with somewhat better: the block picker's doc-side word weights are refitted from paraphrases of each block's own source. (#10355)
8
+
9
+ #### Fixes
10
+
11
+ - `astryx build` names its two alternative page templates in the same order it chooses the start from, so the three templates it shows for a whole page are its best three. The start, the number of alternatives, the blocks and the JSON shape are unchanged. (#10357)
12
+ - `astryx build --type doc` and `--type theme` now point to `astryx search <query> --type doc` or `--type theme`: a build kit has no docs or themes, so build says so once on stderr and names the search that finds them. Stdout, JSON output and exit codes are unchanged. (#10401)
13
+ - `astryx doctor` no longer warns that no theme is wired in an app that imports its themes itself. Without a generated theme module or a package.json `astryx.theme`, the `themes` check now passes when the source of the app imports a theme's built module or stylesheet (the imports `theme add` writes) or passes a theme to `Theme`, followed through module-scope variables, `defineTheme({extends})`, re-exports and installed packages to its package, and names the file. Only a theme whose package is installed, or a local theme, counts. A theme passed to `Theme` that doctor cannot trace (a prop, a function result, a variable declared inside a component) is reported as not confirmed (info), not as missing. (#10353)
14
+ - The CLI's semver range check reads `^0` as any 0.x.y and `^0.0` as any 0.0.y, and reads a hyphen range (`1.0.0 - 2.0.0`) as inclusive bounds, with a partial upper bound (`1.0.0 - 2`) covering its whole series as npm does. Before, `^0` and `^0.0` were locked to a single patch version and a hyphen range could never match, so `astryx doctor` and the peer-version checks reported a false mismatch for projects that declare those ranges. (#10184)
15
+ - The reminder to run `astryx init` in a project that has not run it no longer prints before every command. It now prints after a command that succeeds, at most once a day per project, recorded in the per-user state as the daily hints are. It does not print with `--json`, after a command that fails, or when `CI` is set. `astryx doctor` still reports the missing setup in its agent-docs check every time. No JSON shape or exit code changes. (#10343)
16
+ - In a folder inside an Astryx project whose own `package.json` declares no Astryx package, such as a tool folder that installs its own `@astryxdesign/core`, the setup reminder's `init` command now names the project's release, as run from the project's folder: the project's own CLI when it installs one, otherwise the package runner pinned to the project's Core, such as `npx @astryxdesign/cli@0.7.3 init`. It used to pin the release of the CLI that answered the run, whatever the project records. No JSON shape or exit code changes. (#10343)
17
+ - `astryx experimental render`: a page outside a project now renders. Outside a project (no Core or CLI the folder reads, and no package.json that declares one), the page takes the `@astryxdesign/*` packages its folder lacks, and the integrations a host approves, from the copy the CLI itself runs with, instead of failing with ERR_RENDER_MISSING_DEPENDENCY. React and StyleX come from that copy too, so the page loads one copy of each, even in a React app that installs its own. When that copy's Core cannot be downloaded, a page that needs it fails with ERR_VERSIONS_UNAVAILABLE, as other commands that read Core do. Inside a project, the page uses only the project's own packages. (#10362)
18
+ - A link to a topic that an integration replaces under the same name opens the replacement. In an app whose integration replaced `theme` or `getting-started`, `doctor` reported Core's links to them as naming no doc. (#10342)
19
+ - `swizzle` no longer copies a component's browser test harnesses (`*.spec.ts`, `*.spec.tsx`, such as Item's `ItemMarkerColumns.a11y.chromium.spec.ts`) when the installed Core source holds them: `@astryxdesign/core` 0.7.5 and earlier, or Core's repository source. They import Playwright and an unpublished test package, so a project that swizzled such a component failed to type-check or build. Core 0.7.6 and later ship no harnesses, so swizzling from them is unchanged. (#10230)
20
+ - `astryx theme build` no longer depends on the order it loads the core component docs. A parent doc that lists a sub-component by name only, such as `Avatar.doc.mjs` listing `AvatarStatusDot`, erased the values the sub-component's own doc declares when it loaded after that doc; when `Avatar.doc.mjs` loaded last, `avatar-status-dot` `variant:success` counted as a custom value. The build now merges every doc's entry for a component. (#10288)
21
+ - `astryx integration verify` no longer reports `theme_module_stale` for a theme whose built module differs only in the command its comment says built it, such as a theme built with `yarn astryx` and verified where `pnpm exec astryx` runs. Any other difference still fails. (#10344)
22
+
23
+ #### Performance
24
+
25
+ - A compact or full hook list, and the suggestions for an unknown hook name, list each of Core's folders once. Before, they listed a folder again for each hook they looked up. (#10324)
26
+ - A search, build or component read lists each folder once. A process that runs several reads, such as a docs site's search or an agent harness, reuses a folder's listing once the folder has stayed unchanged for two seconds. A later read lists the folder again after an entry is added, removed or renamed. (#10274)
27
+ - Within one operation, component discovery reads each component doc once, and the component matcher looks for each component's doc once, not once for each name they resolve. Resolving 30 names that only the matcher finds, such as names in another case, makes 14,794 file-system calls instead of 305,108. Results are unchanged. (#10277)
28
+
29
+ #### Documentation
30
+
31
+ - The Authoring guides (Quick Start, Field reference, Building Blocks, Ship, Help, and Make your integration work globally) now carry the keyword "authoring", so `astryx search authoring` lists them right after the Authoring overview instead of after API function pages. (#10354)
32
+ - `astryx build --help` lists every value `--type` accepts (component, hook, doc, template, theme), matching the invalid-type error and what build actually runs, and says that `doc` and `theme` give an empty kit, since the kit has no doc or theme group. A test keeps the help text, the choices, the API doc and the error message on build and search naming the same set, and checks what each value returns. (#10361)
33
+ - Getting Started has an Upgrade section: upgrade every Astryx package your app lists in one command, to the same release, then run `astryx upgrade`. If your package manager holds new releases back, exempt the whole `@astryxdesign/*` scope, not only some of its packages. (#10241)
34
+ - The custom theme guide names the files of a local theme, including the same-stem descriptor `theme add` reads. (#10347)
35
+ - The CLI's bundled colour token docs say the status icon colours (`--color-icon-<status>`) paint status marks on the page or a card, such as a StatusDot. (#10204)
36
+ - New block, "Table — Selection in the Leading Mark": row selection with no checkbox column. Each row shows its avatar, and the checkbox takes the avatar's slot while a mouse is over it, on keyboard focus, and on every row once anything is selected. On touch screens the checkbox always shows. It uses the existing `useTableSelectionState` and renders the checkboxes in the name column, so no new Table API is involved. (#10395)
37
+
38
+ #### Other Changes
39
+
40
+ - Internal: the export reader can report type-only exports and map a module's whole public surface in one pass. No change to any command's output. (#10365)
41
+
42
+ #### Contributors
43
+
44
+ Thanks to everyone who contributed to this release:
45
+
46
+ - @cixzhang
47
+ - @josephfarina
48
+ - @thecodebasedot
49
+ - @utsavo-afk
50
+ - @vjeux
51
+
52
+ ---
53
+
3
54
  # 0.7.10
4
55
 
5
56
  #### New Features
@@ -22,6 +22,47 @@ export function wordsOf(text: string): string[];
22
22
  * @returns {string[]}
23
23
  */
24
24
  export function termsOf(text: string): string[];
25
+ /**
26
+ * A text's docs side for `matchOf`: its word vector and that vector through
27
+ * the doc matrix. Search scores its entries' own docs with it.
28
+ * @param {string} text
29
+ * @param {BlockPickerWeights} weights
30
+ * @returns {{vector: Map<number, number>, projected: Float64Array}}
31
+ */
32
+ export function docSideOf(text: string, weights: BlockPickerWeights): {
33
+ vector: Map<number, number>;
34
+ projected: Float64Array;
35
+ };
36
+ /**
37
+ * A request's side for `matchOf`: its word vector and that vector through the
38
+ * request matrix.
39
+ * @param {string} request
40
+ * @param {BlockPickerWeights} weights
41
+ * @returns {{vector: Map<number, number>, projected: Float64Array}}
42
+ */
43
+ export function requestSideOf(request: string, weights: BlockPickerWeights): {
44
+ vector: Map<number, number>;
45
+ projected: Float64Array;
46
+ };
47
+ /**
48
+ * The picker's match of a request to a docs text: their projections' dot
49
+ * product plus the lexical weight times their plain overlap (the cosine of
50
+ * their word vectors). Build's ranking also reads the overlap alone.
51
+ * @param {{vector: Map<number, number>, projected: Float64Array}} request
52
+ * @param {{vector: Map<number, number>, projected: Float64Array}} doc
53
+ * @param {BlockPickerWeights} weights
54
+ * @returns {{match: number, overlap: number}}
55
+ */
56
+ export function matchOf(request: {
57
+ vector: Map<number, number>;
58
+ projected: Float64Array;
59
+ }, doc: {
60
+ vector: Map<number, number>;
61
+ projected: Float64Array;
62
+ }, weights: BlockPickerWeights): {
63
+ match: number;
64
+ overlap: number;
65
+ };
25
66
  /**
26
67
  * The blocks build names for a request, ranked by the picker.
27
68
  * @param {string} request
@@ -163,34 +163,10 @@ export function termsOf(text) {
163
163
  return out;
164
164
  }
165
165
 
166
- /**
167
- * The weights, decoded once per weights object.
168
- * @type {WeakMap<BlockPickerWeights, {index: Map<string, number>, idf: Float64Array, request: Int8Array, doc: Int8Array}>}
169
- */
170
- const decoded = new WeakMap();
171
-
172
- /** @param {BlockPickerWeights} weights */
173
- function decode(weights) {
174
- let d = decoded.get(weights);
175
- if (!d) {
176
- // Each byte is a signed weight stored offset by 128.
177
- const bytes = (/** @type {string} */ s) =>
178
- Int8Array.from(Buffer.from(s, 'base64'), b => b - 128);
179
- d = {
180
- index: new Map(weights.vocab.map((w, i) => [w, i])),
181
- idf: Float64Array.from(weights.idf, x => x / 1024),
182
- request: bytes(weights.request),
183
- doc: bytes(weights.doc),
184
- };
185
- decoded.set(weights, d);
186
- }
187
- return d;
188
- }
189
-
190
166
  /**
191
167
  * A text's sparse unit vector over the vocabulary: (1 + ln count) x idf.
192
168
  * @param {string[]} terms
193
- * @param {ReturnType<typeof decode>} d
169
+ * @param {{index: Map<string, number>, idf: Float64Array}} d
194
170
  * @returns {Map<number, number>}
195
171
  */
196
172
  function vectorOf(terms, d) {
@@ -214,20 +190,116 @@ function vectorOf(terms, d) {
214
190
  }
215
191
 
216
192
  /**
217
- * A sparse vector through a signed byte matrix.
218
- * @param {Map<number, number>} v
219
- * @param {Int8Array} m
193
+ * The vocabulary index and idf, read once per weights object, and each matrix
194
+ * row decoded when a side first uses it.
195
+ * @type {WeakMap<BlockPickerWeights, {index: Map<string, number>, idf: Float64Array, rows: Map<string, Int8Array>}>}
196
+ */
197
+ const vocabularies = new WeakMap();
198
+
199
+ /** @param {BlockPickerWeights} weights */
200
+ function vocabularyOf(weights) {
201
+ let v = vocabularies.get(weights);
202
+ if (!v) {
203
+ v = {
204
+ index: new Map(weights.vocab.map((w, i) => [w, i])),
205
+ idf: Float64Array.from(weights.idf, x => x / 1024),
206
+ rows: new Map(),
207
+ };
208
+ vocabularies.set(weights, v);
209
+ }
210
+ return v;
211
+ }
212
+
213
+ /**
214
+ * One row of a byte matrix, decoded from the base64 text alone: four
215
+ * characters hold three bytes, so the row's bytes sit inside the characters
216
+ * from its first byte's group to its last byte's group.
217
+ * @param {BlockPickerWeights} weights
218
+ * @param {'request' | 'doc'} matrix
219
+ * @param {number} i
220
+ * @returns {Int8Array}
221
+ */
222
+ function rowOf(weights, matrix, i) {
223
+ const {rows} = vocabularyOf(weights);
224
+ const key = `${matrix}:${i}`;
225
+ let row = rows.get(key);
226
+ if (!row) {
227
+ const {dims} = weights;
228
+ const first = Math.floor((i * dims) / 3);
229
+ const last = Math.ceil(((i + 1) * dims) / 3);
230
+ const bytes = Buffer.from(
231
+ weights[matrix].slice(first * 4, last * 4),
232
+ 'base64',
233
+ ).subarray(i * dims - first * 3, i * dims - first * 3 + dims);
234
+ // Each byte is a signed weight stored offset by 128.
235
+ row = Int8Array.from(bytes, b => b - 128);
236
+ rows.set(key, row);
237
+ }
238
+ return row;
239
+ }
240
+
241
+ /**
242
+ * A text's side for `matchOf` through one matrix: its word vector, and that
243
+ * vector times the matrix rows its words use, scaled.
244
+ * @param {string} text
245
+ * @param {BlockPickerWeights} weights
246
+ * @param {'request' | 'doc'} matrix
220
247
  * @param {number} scale
221
- * @param {number} dims
248
+ * @returns {{vector: Map<number, number>, projected: Float64Array}}
222
249
  */
223
- function project(v, m, scale, dims) {
224
- const out = new Float64Array(dims);
225
- for (const [i, x] of v) {
226
- const row = i * dims;
227
- for (let k = 0; k < dims; k++) out[k] += x * m[row + k];
250
+ function sideOf(text, weights, matrix, scale) {
251
+ const vector = vectorOf(termsOf(text), vocabularyOf(weights));
252
+ const {dims} = weights;
253
+ const projected = new Float64Array(dims);
254
+ for (const [i, x] of vector) {
255
+ const row = rowOf(weights, matrix, i);
256
+ for (let k = 0; k < dims; k++) projected[k] += x * row[k];
228
257
  }
229
- for (let k = 0; k < dims; k++) out[k] *= scale;
230
- return out;
258
+ for (let k = 0; k < dims; k++) projected[k] *= scale;
259
+ return {vector, projected};
260
+ }
261
+
262
+ /**
263
+ * A text's docs side for `matchOf`: its word vector and that vector through
264
+ * the doc matrix. Search scores its entries' own docs with it.
265
+ * @param {string} text
266
+ * @param {BlockPickerWeights} weights
267
+ * @returns {{vector: Map<number, number>, projected: Float64Array}}
268
+ */
269
+ export function docSideOf(text, weights) {
270
+ return sideOf(text, weights, 'doc', weights.docScale);
271
+ }
272
+
273
+ /**
274
+ * A request's side for `matchOf`: its word vector and that vector through the
275
+ * request matrix.
276
+ * @param {string} request
277
+ * @param {BlockPickerWeights} weights
278
+ * @returns {{vector: Map<number, number>, projected: Float64Array}}
279
+ */
280
+ export function requestSideOf(request, weights) {
281
+ return sideOf(request, weights, 'request', weights.requestScale);
282
+ }
283
+
284
+ /**
285
+ * The picker's match of a request to a docs text: their projections' dot
286
+ * product plus the lexical weight times their plain overlap (the cosine of
287
+ * their word vectors). Build's ranking also reads the overlap alone.
288
+ * @param {{vector: Map<number, number>, projected: Float64Array}} request
289
+ * @param {{vector: Map<number, number>, projected: Float64Array}} doc
290
+ * @param {BlockPickerWeights} weights
291
+ * @returns {{match: number, overlap: number}}
292
+ */
293
+ export function matchOf(request, doc, weights) {
294
+ let s = 0;
295
+ for (let k = 0; k < weights.dims; k++)
296
+ s += request.projected[k] * doc.projected[k];
297
+ let overlap = 0;
298
+ for (const [i, x] of request.vector) {
299
+ const y = doc.vector.get(i);
300
+ if (y !== undefined) overlap += x * y;
301
+ }
302
+ return {match: s + weights.lexical * overlap, overlap};
231
303
  }
232
304
 
233
305
  /**
@@ -261,7 +333,6 @@ function readCatalog(catalog, components, weights) {
261
333
  ]);
262
334
  const cached = catalogs.get(weights);
263
335
  if (cached && cached.key === key) return cached;
264
- const d = decode(weights);
265
336
  const names = components.map(c => c.name).sort((a, b) => b.length - a.length);
266
337
  const keywords = new Map(components.map(c => [c.name, c.keywords ?? []]));
267
338
  /** @type {Map<string, {component: string, vector: Map<number, number>, projected: Float64Array}>} */
@@ -276,12 +347,7 @@ function readCatalog(catalog, components, weights) {
276
347
  wordsOf(component).join(' '),
277
348
  (keywords.get(component) ?? []).join(' '),
278
349
  ].join(' ');
279
- const vector = vectorOf(termsOf(text), d);
280
- blocks.set(b.name, {
281
- component,
282
- vector,
283
- projected: project(vector, d.doc, weights.docScale, weights.dims),
284
- });
350
+ blocks.set(b.name, {component, ...docSideOf(text, weights)});
285
351
  }
286
352
  // A component is named by its own words, or by a keyword at most three
287
353
  // components share (weighted by how few share it).
@@ -378,26 +444,12 @@ export function pickBlocks(request, signals, weights) {
378
444
  /** @type {Map<string, SearchResultEntry>} */
379
445
  const entries = new Map();
380
446
  if (own.length === 0) return {names: [], entries};
381
- const d = decode(weights);
382
447
  const cat = readCatalog(signals.catalog, signals.components, weights);
383
- const q = vectorOf(termsOf(request), d);
384
- const eq = project(q, d.request, weights.requestScale, weights.dims);
385
- const dot = (/** @type {Map<number, number>} */ v) => {
386
- let s = 0;
387
- for (const [i, x] of q) {
388
- const y = v.get(i);
389
- if (y !== undefined) s += x * y;
390
- }
391
- return s;
392
- };
448
+ const side = requestSideOf(request, weights);
393
449
  /** @type {Map<string, {match: number, overlap: number}>} */
394
450
  const scored = new Map();
395
- for (const [name, b] of cat.blocks) {
396
- let s = 0;
397
- for (let k = 0; k < weights.dims; k++) s += eq[k] * b.projected[k];
398
- const overlap = dot(b.vector);
399
- scored.set(name, {match: s + weights.lexical * overlap, overlap});
400
- }
451
+ for (const [name, b] of cat.blocks)
452
+ scored.set(name, matchOf(side, b, weights));
401
453
  const get = (/** @type {string} */ b) =>
402
454
  scored.get(b) ?? {match: -Infinity, overlap: 0};
403
455
  const ranked = [...scored.keys()].sort((a, b) => get(b).match - get(a).match);
@@ -480,7 +532,7 @@ export function pickBlocks(request, signals, weights) {
480
532
  name,
481
533
  package: block.package ?? '',
482
534
  score: Math.max(1, Math.round(100 * Math.exp(x.score - max))),
483
- reason: reasonFor(request, cat.blocks.get(name), d, weights),
535
+ reason: reasonFor(request, side, cat.blocks.get(name), weights),
484
536
  description: block.description ?? '',
485
537
  displayName: block.displayName,
486
538
  kind: 'block',
@@ -493,11 +545,11 @@ export function pickBlocks(request, signals, weights) {
493
545
  /**
494
546
  * Why a block fits: the request words that tie it to its docs most.
495
547
  * @param {string} request
548
+ * @param {{vector: Map<number, number>, projected: Float64Array}} side the request's side
496
549
  * @param {{vector: Map<number, number>, projected: Float64Array} | undefined} block
497
- * @param {ReturnType<typeof decode>} d
498
550
  * @param {BlockPickerWeights} weights
499
551
  */
500
- function reasonFor(request, block, d, weights) {
552
+ function reasonFor(request, side, block, weights) {
501
553
  if (!block) return 'fits by meaning';
502
554
  const raw =
503
555
  String(request)
@@ -507,16 +559,14 @@ function reasonFor(request, block, d, weights) {
507
559
  const wordOf = new Map();
508
560
  for (const w of raw)
509
561
  if (!STOP.has(w) && !wordOf.has(stemOf(w))) wordOf.set(stemOf(w), w);
510
- const q = vectorOf(termsOf(request), d);
511
562
  /** @type {[string, number][]} */
512
563
  const parts = [];
513
- for (const [i, x] of q) {
564
+ for (const [i, x] of side.vector) {
514
565
  const term = weights.vocab[i];
515
566
  if (term.includes('_')) continue;
567
+ const row = rowOf(weights, 'request', i);
516
568
  let s = 0;
517
- const row = i * weights.dims;
518
- for (let k = 0; k < weights.dims; k++)
519
- s += d.request[row + k] * block.projected[k];
569
+ for (let k = 0; k < weights.dims; k++) s += row[k] * block.projected[k];
520
570
  s =
521
571
  x * s * weights.requestScale +
522
572
  weights.lexical * x * (block.vector.get(i) ?? 0);
@@ -41,7 +41,9 @@
41
41
  * `settings`) is that family's default. A variant displaces it only with two
42
42
  * matched terms of its own ("a small comparison note" does not make a
43
43
  * dashboard the comparison dashboard), and a base too weak to start on its
44
- * own displaces no variant ("a funnel for a dashboard" is the funnel).
44
+ * own displaces no variant ("a funnel for a dashboard" is the funnel) —
45
+ * unless the idea names its family in the head, which is start evidence on
46
+ * its own ("saml login" stays the login page).
45
47
  */
46
48
 
47
49
  import {
@@ -219,7 +221,8 @@ export function rankPages(query, pages) {
219
221
  }
220
222
  }
221
223
  const familyNamed = namedFamilies.has(family);
222
- if (headFamilies.has(family)) score += HEAD_FAMILY;
224
+ const headNamed = headFamilies.has(family);
225
+ if (headNamed) score += HEAD_FAMILY;
223
226
  else if (familyNamed) score += BODY_FAMILY;
224
227
  const base = normalized(page.name) === normalized(family);
225
228
  if (familyNamed && base) score += FAMILY_BASE;
@@ -228,6 +231,7 @@ export function rankPages(query, pages) {
228
231
  score,
229
232
  hits,
230
233
  familyNamed,
234
+ headNamed,
231
235
  containerMatched,
232
236
  family,
233
237
  base,
@@ -246,7 +250,14 @@ export function rankPages(query, pages) {
246
250
  /**
247
251
  * Put a named family's base template ahead of the variant that outranks it,
248
252
  * unless the variant matched START_TERMS terms the base did not, or the base
249
- * scores too little to start on its own.
253
+ * cannot start on its own: too little score, or too few matched terms. The
254
+ * head names the exception: a family word in the idea's head is start
255
+ * evidence on its own — the same evidence pickStart accepts in place of a
256
+ * second term — so a head-named one-term base can still take the lead ("saml
257
+ * login" is the login page, not the SSO flow). A base whose family the idea
258
+ * names only elsewhere still needs a second term: score alone drifts upward
259
+ * as the catalog grows (idf rises with page count) and would eventually let a
260
+ * one-term base displace its variant, while hits do not drift.
250
261
  * @param {RankedPage[]} ranked
251
262
  * @returns {RankedPage[]}
252
263
  */
@@ -254,7 +265,13 @@ function baseFirst(ranked) {
254
265
  const top = ranked[0];
255
266
  if (!top || top.base || !top.familyNamed) return ranked;
256
267
  const base = ranked.find(r => r.base && r.family === top.family);
257
- if (!base || base.score < START_SCORE) return ranked;
268
+ if (
269
+ !base ||
270
+ base.score < START_SCORE ||
271
+ (base.hits < START_TERMS && !base.headNamed)
272
+ ) {
273
+ return ranked;
274
+ }
258
275
  const own = [...top.matched].filter(t => !base.matched.has(t)).length;
259
276
  return own >= START_TERMS
260
277
  ? ranked
@@ -64,6 +64,7 @@ export type RankedPage = {
64
64
  score: number;
65
65
  hits: number;
66
66
  familyNamed: boolean;
67
+ headNamed: boolean;
67
68
  containerMatched: boolean;
68
69
  family: string;
69
70
  base: boolean;
@@ -163,7 +163,7 @@ export const SYNONYMS_OF = (() => {
163
163
  /**
164
164
  * @typedef {import('../_adapter.mjs').PageTemplate} PageTemplate
165
165
  * @typedef {import('../_adapter.mjs').ComponentWords} ComponentWords
166
- * @typedef {{name: string, score: number, hits: number, familyNamed: boolean, containerMatched: boolean, family: string, base: boolean, matched: Set<string>}} RankedPage
166
+ * @typedef {{name: string, score: number, hits: number, familyNamed: boolean, headNamed: boolean, containerMatched: boolean, family: string, base: boolean, matched: Set<string>}} RankedPage
167
167
  * @typedef {'page' | 'part' | 'edit'} IdeaKind
168
168
  */
169
169
 
@@ -247,9 +247,9 @@ useAutoMediaMode useAutoMediaMode hooks/useAnimatedLayout.doc.mjs hooks/useAutoM
247
247
  useBackdropPress useBackdropPress Layer/Layer.doc.mjs Layer/useBackdropPress.ts
248
248
  useBaseTablePlugins useBaseTablePlugins Table/Table.doc.mjs Table/useBaseTablePlugins.ts
249
249
  useBusyAnnouncement useBusyAnnouncement hooks/useAnimatedLayout.doc.mjs hooks/useBusyAnnouncement.ts
250
- useCalendarConstraints useCalendarConstraints Calendar/Calendar.doc.mjs Calendar/hooks/useCalendarConstraints.ts
250
+ useCalendarConstraints useCalendarConstraints Calendar/useCalendarConstraints.doc.mjs Calendar/hooks/useCalendarConstraints.ts
251
251
  useCalendarDays useCalendarDays Calendar/useCalendarDays.doc.mjs Calendar/hooks/useCalendarDays.ts
252
- useCalendarNavigation useCalendarNavigation Calendar/Calendar.doc.mjs Calendar/hooks/useCalendarNavigation.ts
252
+ useCalendarNavigation useCalendarNavigation Calendar/useCalendarNavigation.doc.mjs Calendar/hooks/useCalendarNavigation.ts
253
253
  useChatComposerTokens useChatComposerTokens Chat/Chat.doc.mjs Chat/useChatComposerTokens.ts
254
254
  useChatDictation useChatDictation Chat/Chat.doc.mjs Chat/useChatDictation.ts
255
255
  useChatNewMessages useChatNewMessages Chat/Chat.doc.mjs Chat/useChatNewMessages.ts
@@ -271,7 +271,7 @@ useIsomorphicLayoutEffect useIsomorphicLayoutEffect hooks/useAnimatedLayout.doc.
271
271
  useLayerDismissal useLayerDismissal Layer/Layer.doc.mjs Layer/useLayerDismissal.ts
272
272
  useLightbox useLightbox Lightbox/useLightbox.doc.mjs Lightbox/useLightbox.tsx
273
273
  useLinkComponent useLinkComponent Link/useLinkComponent.doc.mjs Link/useLinkComponent.ts
274
- useLinkify useLinkify Link/Link.doc.mjs Link/useLinkify.tsx
274
+ useLinkify useLinkify Link/useLinkify.doc.mjs Link/useLinkify.tsx
275
275
  useListFormatter useListFormatter i18n/InternationalizationProvider.doc.mjs i18n/useListFormatter.ts
276
276
  useMenuDrillIn useMenuDrillIn DropdownMenu/DropdownMenu.doc.mjs DropdownMenu/useMenuDrillIn.tsx
277
277
  useMenuHover useMenuHover hooks/useAnimatedLayout.doc.mjs hooks/useMenuHover.ts
@@ -282,7 +282,7 @@ useOverlay useOverlay Overlay/useOverlay.doc.mjs Overlay/useOverlay.tsx
282
282
  useOwnScrollGesture useOwnScrollGesture DateInput/DateInput.doc.mjs DateInput/useOwnScrollGesture.ts
283
283
  usePager usePager hooks/useAnimatedLayout.doc.mjs hooks/usePager.ts
284
284
  usePointerDragScroll usePointerDragScroll DateInput/DateInput.doc.mjs DateInput/usePointerDragScroll.ts
285
- usePowerSearchConfig usePowerSearchConfig PowerSearch/PowerSearch.doc.mjs PowerSearch/usePowerSearchConfig.ts
285
+ usePowerSearchConfig usePowerSearchConfig PowerSearch/usePowerSearchConfig.doc.mjs PowerSearch/usePowerSearchConfig.ts
286
286
  usePowerSearchSource usePowerSearchSource PowerSearch/PowerSearch.doc.mjs PowerSearch/usePowerSearchSource.ts
287
287
  useRenamedProp useRenamedProp hooks/useAnimatedLayout.doc.mjs hooks/useRenamedProp.ts
288
288
  useResolvedRequired useResolvedRequired hooks/useAnimatedLayout.doc.mjs hooks/useResolvedRequired.ts
@@ -298,7 +298,7 @@ useSpeechRecognition useSpeechRecognition Chat/Chat.doc.mjs Chat/useSpeechRecogn
298
298
  useSwipeAction useSwipeAction Item/Item.doc.mjs Item/useSwipeAction.ts
299
299
  useSwitchTouch useSwitchTouch Switch/Switch.doc.mjs Switch/useSwitchTouch.ts
300
300
  useTableCellStyles useTableCellStyles Table/Table.doc.mjs Table/useTableCellStyles.ts
301
- useTableColumnSettingsState useTableColumnSettingsState Table/Table.doc.mjs Table/plugins/columnSettings/useTableColumnSettingsState.tsx
301
+ useTableColumnSettingsState useTableColumnSettingsState Table/plugins/columnSettings/useTableColumnSettingsState.doc.mjs Table/plugins/columnSettings/useTableColumnSettingsState.tsx
302
302
  useTableSortableState useTableSortableState Table/plugins/sortable/useTableSortableState.doc.mjs Table/plugins/sortable/useTableSortableState.tsx
303
303
  useToastGesture useToastGesture Toast/Toast.doc.mjs Toast/useToastGesture.ts
304
304
  useTouchTrigger useTouchTrigger Layer/Layer.doc.mjs Layer/useTouchTrigger.ts
@@ -319,6 +319,28 @@ export function nameOwner(tree: DocsTree, catalog: DocsCatalog, name: string): {
319
319
  kind: "node";
320
320
  node: TreeNode;
321
321
  } | null;
322
+ /**
323
+ * `stability: 'experimental'` for a node whose doc is marked experimental, or
324
+ * that sits under an experimental namespace (spec:AST-017 FR27), the way help
325
+ * marks an experimental command; nothing for a stable one, so stable entries
326
+ * read as they always have.
327
+ * @param {DocsTree} tree
328
+ * @param {TreeNode} node
329
+ * @returns {{stability?: 'experimental'}}
330
+ */
331
+ export function stabilityOf(tree: DocsTree, node: TreeNode): {
332
+ stability?: "experimental";
333
+ };
334
+ /**
335
+ * The fields every child carries: what it is, and the route that opens it.
336
+ * Shared, so a child reads the same whether a namespace read or the topic
337
+ * list names it — including the package, which is the integration's for a
338
+ * guide an integration replaced, not the package whose route it took.
339
+ * @param {DocsTree} tree
340
+ * @param {TreeNode} child
341
+ * @returns {import('./docs.type.mjs').DocsNodeChild}
342
+ */
343
+ export function childIdentity(tree: DocsTree, child: TreeNode): import("./docs.type.mjs").DocsNodeChild;
322
344
  /**
323
345
  * Whether a topic answers to its own name: what the topic list and search
324
346
  * offer must open that topic.
@@ -1765,9 +1765,87 @@ export function nameOwner(tree, catalog, name) {
1765
1765
  return entry == null ? null : {kind: 'topic', entry};
1766
1766
  }
1767
1767
  const entry = catalog.resolve(name);
1768
- if (entry == null) return null;
1769
- const owner = routeOwner(tree, entry);
1770
- return owner == null ? {kind: 'topic', entry} : {kind: 'node', node: owner};
1768
+ if (entry != null) {
1769
+ const owner = routeOwner(tree, entry);
1770
+ return owner == null ? {kind: 'topic', entry} : {kind: 'node', node: owner};
1771
+ }
1772
+ return childOwner(tree, name);
1773
+ }
1774
+
1775
+ /**
1776
+ * The child a reader names without its namespace, or with a route that leaves
1777
+ * out the prefix the child's own name repeats (spec:AST-046 FR5). A namespace
1778
+ * whose children repeat its name makes its own routes stutter: `tokens` holds
1779
+ * `tokens-color`, so the route is `tokens/tokens-color`, while the namespace
1780
+ * listing shows the bare `tokens-color`. Both spellings name one child, so
1781
+ * that child answers. Two or more children answering is ambiguous, and the
1782
+ * read falls through to the suggestion list, unchanged. An experimental doc
1783
+ * never answers to a bare name: its project reaches it only by a marked route
1784
+ * (spec:AST-017 FR27).
1785
+ * @param {DocsTree} tree
1786
+ * @param {string} name
1787
+ * @returns {{kind: 'node', node: TreeNode} | null}
1788
+ */
1789
+ function childOwner(tree, name) {
1790
+ const wanted = name.toLowerCase();
1791
+ const slash = wanted.lastIndexOf('/');
1792
+ const parent = slash > 0 ? wanted.slice(0, slash) : null;
1793
+ const unstuttered =
1794
+ parent == null
1795
+ ? null
1796
+ : `${parent}/${parent.slice(parent.lastIndexOf('/') + 1)}-${wanted.slice(slash + 1)}`;
1797
+ const matches = [...tree.nodes.values()].filter(
1798
+ node =>
1799
+ node.ref?.flatTopic == null &&
1800
+ node.route.includes('/') &&
1801
+ // An experimental doc is reachable only by a route its project marked
1802
+ // as experimental (spec:AST-017 FR27): a bare name never opens one.
1803
+ !isExperimentalTreeNode(tree, node) &&
1804
+ (node.name?.toLowerCase() === wanted ||
1805
+ (unstuttered != null && node.route.toLowerCase() === unstuttered)),
1806
+ );
1807
+ return matches.length === 1 ? {kind: 'node', node: matches[0]} : null;
1808
+ }
1809
+
1810
+ /**
1811
+ * `stability: 'experimental'` for a node whose doc is marked experimental, or
1812
+ * that sits under an experimental namespace (spec:AST-017 FR27), the way help
1813
+ * marks an experimental command; nothing for a stable one, so stable entries
1814
+ * read as they always have.
1815
+ * @param {DocsTree} tree
1816
+ * @param {TreeNode} node
1817
+ * @returns {{stability?: 'experimental'}}
1818
+ */
1819
+ export function stabilityOf(tree, node) {
1820
+ return isExperimentalTreeNode(tree, node) ? {stability: 'experimental'} : {};
1821
+ }
1822
+
1823
+ /**
1824
+ * The fields every child carries: what it is, and the route that opens it.
1825
+ * Shared, so a child reads the same whether a namespace read or the topic
1826
+ * list names it — including the package, which is the integration's for a
1827
+ * guide an integration replaced, not the package whose route it took.
1828
+ * @param {DocsTree} tree
1829
+ * @param {TreeNode} child
1830
+ * @returns {import('./docs.type.mjs').DocsNodeChild}
1831
+ */
1832
+ export function childIdentity(tree, child) {
1833
+ return {
1834
+ route: child.route,
1835
+ name: child.route.slice(child.route.lastIndexOf('/') + 1),
1836
+ package: child.guideOverlay?.replacement?.package ?? child.provider,
1837
+ // A guide an integration's doc took the place of names whose it was.
1838
+ ...(child.guideOverlay?.replacement
1839
+ ? {
1840
+ replaces: child.route,
1841
+ replacedPackage: child.guideOverlay.replacedPackage ?? child.provider,
1842
+ }
1843
+ : {}),
1844
+ kind: child.kind,
1845
+ title: child.title,
1846
+ summary: child.summary,
1847
+ ...stabilityOf(tree, child),
1848
+ };
1771
1849
  }
1772
1850
 
1773
1851
  /**
@@ -54,7 +54,7 @@ export const doc = {
54
54
  name: 'topic',
55
55
  type: 'string',
56
56
  description:
57
- "Doc topic to load (e.g. 'principles'), or a docs-tree route (e.g. 'cli/api/functions/search'). Omit to list all topics.",
57
+ "Doc topic to load (e.g. 'principles'), a docs-tree route (e.g. 'cli/api/functions/search'), or the name of one node of the docs tree: its own name (e.g. 'tokens-color'), or its route without the prefix its name repeats (e.g. 'tokens/color'), where exactly one node answers to it. Omit to list all topics.",
58
58
  },
59
59
  {
60
60
  name: 'section',
@@ -88,13 +88,13 @@ export const doc = {
88
88
  name: 'options.depth',
89
89
  type: "number | 'all'",
90
90
  description:
91
- "How many levels below a docs-tree namespace to read: 0 for the namespace alone, 1 for its children (the default), 'all' for every level. Where a read stops, a child with docs below it carries childCount. A doc with nothing below it reads the same at any depth.",
91
+ "How many levels below a docs-tree namespace to read: 0 for the namespace alone, 1 for its children (the default), 'all' for every level. Where a read stops, a child with docs below it carries childCount. A doc with nothing below it reads the same at any depth. On the topic list, where each namespace otherwise lists alone, it names the docs below each one, as deep as asked; without it the list is unchanged.",
92
92
  },
93
93
  {
94
94
  name: 'options.detail',
95
95
  type: "'brief' | 'compact' | 'full'",
96
96
  description:
97
- "How much of each doc below the named one a depth read returns: brief (the default) is its identity; compact and full add its text (a guide's sections, a namespace's or typed doc's content). Given alone, it reads one level down.",
97
+ "How much of each doc below the named one a depth read returns: brief (the default) is its identity; compact and full add its text (a guide's sections, a namespace's or typed doc's content). Given alone, it reads one level down. The topic list names each doc below a namespace by its identity whatever the detail.",
98
98
  },
99
99
  {
100
100
  name: 'options.cwd',
@@ -107,7 +107,7 @@ export const doc = {
107
107
  {
108
108
  type: 'docs.list',
109
109
  description:
110
- "Every reference-doc topic in read order, as DocsListEntry[] ({topic, description, package, replaces?, replacedPackage?}), each readable with docs(topic). meta.namespaces lists the docs tree's top-level namespaces ({topic, description, package}), and meta.notLoaded each package whose docs did not load ({package, message}).",
110
+ "Every reference-doc topic in read order, as DocsListEntry[] ({topic, description, package, replaces?, replacedPackage?}), each readable with docs(topic). meta.namespaces lists the docs tree's top-level namespaces ({topic, description, package}); with depth, each also carries children, the docs below it as a namespace read names them ({topic, description, route, name, package, kind, title, summary, replaces?, replacedPackage?, stability?}), nested the same way to the depth asked for, and childCount where the depth stops on a doc with docs below it. meta.notLoaded names each package whose docs did not load ({package, message}).",
111
111
  },
112
112
  {
113
113
  type: 'docs.detail',
@@ -141,7 +141,7 @@ export const doc = {
141
141
  },
142
142
  {
143
143
  code: 'ERR_UNKNOWN_TOPIC',
144
- when: 'the topic is not a string, or matches no topic and no docs-tree route',
144
+ when: 'the topic is not a string, or matches no topic, no docs-tree route, and no one node of the docs tree by its own name or by its route without the prefix its name repeats; a name more than one node answers to opens none of them, and the suggestions list them',
145
145
  },
146
146
  {
147
147
  code: 'ERR_UNKNOWN_SECTION',