@astryxdesign/cli 0.7.3-canary.b74cf21 → 0.7.3-canary.ca48bb7

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 (213) hide show
  1. package/README.md +68 -68
  2. package/api/build/blocks/blocks.d.mts +6 -4
  3. package/api/build/blocks/blocks.mjs +103 -20
  4. package/api/build/blocks/blocks.test.mjs +126 -13
  5. package/api/build/blocks/blocks.weights.json +1 -1
  6. package/api/build/kit/answer.d.mts +5 -4
  7. package/api/build/kit/answer.mjs +114 -12
  8. package/api/build/kit/answer.test.mjs +73 -3
  9. package/api/build/kit/signals.d.mts +8 -0
  10. package/api/build/kit/signals.mjs +10 -0
  11. package/api/build/tree.test.mjs +19 -11
  12. package/api/component/component-replacement.test.mjs +1 -0
  13. package/api/component/component.mjs +17 -3
  14. package/api/component/component.test.mjs +15 -0
  15. package/api/component/doc-links.test.mjs +2 -2
  16. package/api/docs/_adapter.d.mts +2 -2
  17. package/api/docs/_adapter.mjs +61 -18
  18. package/api/docs/docs-homes.test.mjs +127 -0
  19. package/api/docs/docs.doc.mjs +3 -3
  20. package/api/docs/docs.test.mjs +28 -18
  21. package/api/docs/integration-tree.test.mjs +20 -20
  22. package/api/docs/integrationDocs.test.mjs +1 -1
  23. package/api/docs/namespace-section.test.mjs +6 -6
  24. package/api/docs/reference-blocks.test.mjs +2 -2
  25. package/api/doctor/doctor.mjs +16 -12
  26. package/api/doctor/doctor.test.mjs +37 -12
  27. package/api/hook/hook.mjs +1 -1
  28. package/api/integration/_adapter.d.mts +8 -0
  29. package/api/integration/_adapter.mjs +21 -1
  30. package/api/integration/authoring-checks.test.mjs +220 -0
  31. package/api/integration/pack-check.mjs +110 -4
  32. package/api/integration/pack-check.test.mjs +69 -0
  33. package/api/integration/validate-integration-fixes.test.mjs +6 -5
  34. package/api/integration/validate-integration-gaps.test.mjs +304 -1
  35. package/api/integration/validate-integration.d.mts +6 -1
  36. package/api/integration/validate-integration.mjs +82 -13
  37. package/api/integration/validate-integration.type.d.mts +37 -4
  38. package/api/integration/validate-integration.type.mjs +28 -5
  39. package/api/integration/validateIntegration.doc.mjs +1 -1
  40. package/api/search/_adapter.d.mts +16 -0
  41. package/api/search/_adapter.mjs +39 -0
  42. package/api/search/_adapter.test.mjs +173 -0
  43. package/api/search/_candidate-score.mjs +1 -1
  44. package/api/search/_entries.d.mts +11 -0
  45. package/api/search/_entries.mjs +77 -3
  46. package/api/search/_entries.test.mjs +48 -0
  47. package/api/search/_gather-docs.mjs +3 -3
  48. package/api/search/search.doc.mjs +1 -1
  49. package/api/search/search.mjs +6 -2
  50. package/api/search/search.test.mjs +14 -14
  51. package/api/upgrade/_adapter.d.mts +57 -3
  52. package/api/upgrade/_adapter.mjs +149 -27
  53. package/api/upgrade/registry/registry.d.mts +10 -4
  54. package/api/upgrade/registry/registry.mjs +33 -16
  55. package/api/upgrade/registry/registry.test.mjs +85 -0
  56. package/api/upgrade/run/run.d.mts +4 -2
  57. package/api/upgrade/run/run.mjs +13 -2
  58. package/api/upgrade/run/run.test.mjs +417 -3
  59. package/api/upgrade/upgrade.doc.mjs +10 -5
  60. package/api/upgrade/upgrade.mjs +13 -2
  61. package/api/upgrade/upgrade.type.d.mts +5 -3
  62. package/api/upgrade/upgrade.type.mjs +8 -6
  63. package/assets/docs/author-a-theme.doc.mjs +2 -2
  64. package/assets/docs/is-my-code-good.doc.mjs +287 -0
  65. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  66. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  67. package/assets/docs/tree/add-a-topic.doc.mjs +2 -2
  68. package/assets/docs/tree/agent-guidance.doc.mjs +1 -1
  69. package/assets/docs/tree/{integrations.doc.mjs → authoring.doc.mjs} +15 -6
  70. package/assets/docs/tree/block-template.doc.mjs +1 -1
  71. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  72. package/assets/docs/tree/building-blocks.doc.mjs +2 -2
  73. package/assets/docs/tree/check-the-props.doc.mjs +1 -1
  74. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  75. package/assets/docs/tree/checks.doc.mjs +3 -3
  76. package/assets/docs/tree/cli-command.doc.mjs +1 -1
  77. package/assets/docs/tree/cli.doc.mjs +1 -1
  78. package/assets/docs/tree/codemods.doc.mjs +1 -1
  79. package/assets/docs/tree/component-family.doc.mjs +1 -1
  80. package/assets/docs/tree/component-imports.doc.mjs +1 -1
  81. package/assets/docs/tree/components.doc.mjs +1 -1
  82. package/assets/docs/tree/configuration.doc.mjs +1 -1
  83. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  84. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  85. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  86. package/assets/docs/tree/docs.doc.mjs +1 -1
  87. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  88. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  89. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  90. package/assets/docs/tree/extend-or-replace.doc.mjs +1 -1
  91. package/assets/docs/{authoring.doc.mjs → tree/field-reference.doc.mjs} +4 -3
  92. package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
  93. package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
  94. package/assets/docs/tree/global-integrations.doc.mjs +2 -2
  95. package/assets/docs/tree/grade-template-with-agent.doc.mjs +4 -4
  96. package/assets/docs/tree/help.doc.mjs +2 -2
  97. package/assets/docs/tree/links.doc.mjs +1 -1
  98. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  99. package/assets/docs/tree/page-template.doc.mjs +1 -1
  100. package/assets/docs/tree/publishing.doc.mjs +1 -1
  101. package/assets/docs/tree/quick-start.doc.mjs +1 -1
  102. package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
  103. package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
  104. package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
  105. package/assets/docs/tree/see-it-in-an-app.doc.mjs +1 -1
  106. package/assets/docs/tree/ship.doc.mjs +2 -2
  107. package/assets/docs/tree/short-and-findable.doc.mjs +1 -1
  108. package/assets/docs/tree/single-component.doc.mjs +1 -1
  109. package/assets/docs/tree/start-a-template.doc.mjs +1 -1
  110. package/assets/docs/tree/subcomponent.doc.mjs +1 -1
  111. package/assets/docs/tree/template-assets.doc.mjs +1 -1
  112. package/assets/docs/tree/template-doc-overview.doc.mjs +2 -2
  113. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  114. package/assets/docs/tree/template-grading-rubric.doc.mjs +17 -38
  115. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  116. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  117. package/assets/docs/tree/template-styles.doc.mjs +1 -1
  118. package/assets/docs/tree/templates.doc.mjs +1 -1
  119. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  120. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  121. package/assets/docs/tree/themes.doc.mjs +1 -1
  122. package/assets/docs/tree/troubleshooting.doc.mjs +1 -1
  123. package/assets/docs/tree/upgrading.doc.mjs +1 -1
  124. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
  125. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  126. package/assets/docs/tree/versioning.doc.mjs +5 -1
  127. package/assets/docs/tree/write-good-templates.doc.mjs +1 -1
  128. package/assets/docs/tree/write-the-template-file.doc.mjs +1 -1
  129. package/assets/docs/use-integrations.doc.mjs +120 -0
  130. package/assets/templates/themes/butter/butterTheme.ts +4 -2
  131. package/assets/templates/themes/stone/stoneTheme.ts +4 -2
  132. package/assets/templates/themes/y2k/y2kTheme.ts +4 -2
  133. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  134. package/authoring/integration/integration.doc.mjs +1 -1
  135. package/authoring/integration/type.ts +1 -1
  136. package/clients/cli/command-result-coverage.test.mjs +6 -5
  137. package/clients/cli/commands/build-theme.color-scheme.test.mjs +1 -1
  138. package/clients/cli/commands/{component/index.mjs → component.mjs} +37 -37
  139. package/clients/cli/commands/component.test.mjs +6 -6
  140. package/clients/cli/commands/docs.doc.mjs +2 -2
  141. package/clients/cli/commands/docs.mjs +1 -1
  142. package/clients/cli/commands/docs.test.mjs +14 -14
  143. package/clients/cli/commands/doctor-integration.test.mjs +49 -1
  144. package/clients/cli/commands/doctor.mjs +10 -0
  145. package/clients/cli/commands/{hook/index.mjs → hook.mjs} +22 -22
  146. package/clients/cli/commands/import-hint-correctness.test.mjs +1 -1
  147. package/clients/cli/commands/integration-check.test.mjs +48 -0
  148. package/clients/cli/commands/integration.doc.mjs +1 -1
  149. package/clients/cli/commands/manifest.doc.mjs +1 -1
  150. package/clients/cli/commands/manifest.mjs +67 -0
  151. package/clients/cli/commands/postinstall.doc.mjs +23 -0
  152. package/clients/cli/commands/postinstall.mjs +31 -0
  153. package/clients/cli/commands/{build-theme.mjs → theme.mjs} +1 -1
  154. package/clients/cli/commands/upgrade.doc.mjs +4 -2
  155. package/clients/cli/commands/upgrade.mjs +9 -2
  156. package/clients/cli/commands/upgrade.subfolder-path.test.mjs +97 -0
  157. package/clients/cli/index.mjs +10 -85
  158. package/clients/cli/lib/component-format.mjs +1 -1
  159. package/clients/cli/lib/define-command.mjs +12 -7
  160. package/clients/cli/lib/exit-codes.test.mjs +5 -0
  161. package/clients/cli/lib/manifest.test.mjs +12 -0
  162. package/clients/cli/lib/welcome-box.mjs +50 -0
  163. package/foundation/agent-docs/agent-docs.mjs +2 -1
  164. package/foundation/agent-docs/agent-docs.test.mjs +5 -4
  165. package/foundation/config/project.mjs +5 -20
  166. package/foundation/config/project.test.mjs +56 -0
  167. package/foundation/discovery/authoring-self-docs.d.mts +7 -0
  168. package/foundation/discovery/authoring-self-docs.mjs +16 -4
  169. package/foundation/discovery/authoring-self-docs.test.mjs +15 -3
  170. package/foundation/discovery/authoring-surface.d.mts +1 -1
  171. package/foundation/discovery/authoring-surface.mjs +2 -2
  172. package/foundation/discovery/authoring-surface.test.mjs +1 -1
  173. package/foundation/discovery/cli-self-docs.d.mts +2 -1
  174. package/foundation/discovery/cli-self-docs.mjs +4 -3
  175. package/foundation/discovery/cli-self-docs.test.mjs +2 -2
  176. package/foundation/discovery/runner-allowlist.d.mts +2 -4
  177. package/foundation/discovery/runner-allowlist.mjs +2 -4
  178. package/foundation/discovery/runner-commands.d.mts +77 -0
  179. package/foundation/discovery/runner-commands.mjs +294 -0
  180. package/foundation/discovery/runner-commands.test.mjs +128 -0
  181. package/foundation/discovery/stray-pointers.test.mjs +1 -1
  182. package/foundation/discovery/template-adapter.mjs +18 -1
  183. package/foundation/discovery/template-needs.mjs +1 -44
  184. package/foundation/discovery/theme-discovery.mjs +147 -3
  185. package/foundation/doc-compiler/doc-loads.test.mjs +25 -9
  186. package/foundation/doc-compiler/read.mjs +59 -1
  187. package/foundation/doc-compiler/read.test.mjs +11 -2
  188. package/foundation/doc-compiler/split-topic-keywords.test.mjs +3 -2
  189. package/foundation/doc-compiler/tree.d.mts +32 -6
  190. package/foundation/doc-compiler/tree.mjs +77 -43
  191. package/foundation/doc-compiler/tree.test.mjs +7 -7
  192. package/foundation/fs/paths.d.mts +70 -8
  193. package/foundation/fs/paths.mjs +526 -35
  194. package/foundation/fs/paths.test.mjs +430 -54
  195. package/foundation/fs/read-record.d.mts +18 -0
  196. package/foundation/fs/read-record.mjs +131 -0
  197. package/foundation/fs/read-record.test.mjs +77 -0
  198. package/foundation/integrations/autolink.d.mts +2 -1
  199. package/foundation/integrations/autolink.mjs +4 -13
  200. package/foundation/integrations/cli-peer-version.d.mts +36 -0
  201. package/foundation/integrations/cli-peer-version.mjs +132 -0
  202. package/foundation/integrations/cli-peer-version.test.mjs +354 -0
  203. package/foundation/integrations/exports-subpaths.d.mts +57 -0
  204. package/foundation/integrations/exports-subpaths.mjs +113 -0
  205. package/foundation/integrations/integrations.d.mts +20 -1
  206. package/foundation/integrations/integrations.mjs +59 -2
  207. package/foundation/integrations/public-imports.d.mts +118 -0
  208. package/foundation/integrations/public-imports.mjs +1769 -0
  209. package/foundation/integrations/public-imports.test.mjs +1793 -0
  210. package/foundation/integrations/validate-contributions.d.mts +19 -0
  211. package/foundation/integrations/validate-contributions.mjs +172 -3
  212. package/foundation/response/response-types.doc.mjs +1 -1
  213. package/package.json +9 -9
@@ -0,0 +1,127 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Every Core doc has a named home in the docs tree (spec:AST-046 FR12).
5
+ *
6
+ * A reader sees a doc's home in its path (`Guides › Getting started`) and in
7
+ * its Up move. A flat Core topic sits in Guides or Foundations by the
8
+ * category it declares, so a new topic with no category, or one the levels
9
+ * do not know, fails here instead of landing in a catch-all. The integration
10
+ * guides and their field reference live under `authoring`, and the routes
11
+ * they left name where they went.
12
+ */
13
+
14
+ import {describe, expect, it} from 'vitest';
15
+ import {docs} from './docs.mjs';
16
+ import {TOPIC_LEVELS} from '../../foundation/doc-compiler/tree.mjs';
17
+
18
+ const CLI = '@astryxdesign/cli';
19
+ const SLOW = 60_000;
20
+
21
+ describe('every Core doc has a named home', () => {
22
+ it(
23
+ 'puts each flat Core topic in Guides or Foundations by its category',
24
+ async () => {
25
+ const list = await docs();
26
+ const core = list.data.filter(topic => topic.package === CLI);
27
+ expect(core.length).toBeGreaterThan(10);
28
+ /** @type {string[]} */
29
+ const unfiled = [];
30
+ for (const topic of core) {
31
+ const read = await docs(topic.topic);
32
+ const {category} = read.data;
33
+ if (category !== 'guide' && category !== 'foundations') {
34
+ unfiled.push(`${topic.topic} (category ${String(category)})`);
35
+ continue;
36
+ }
37
+ const level =
38
+ category === 'foundations'
39
+ ? TOPIC_LEVELS.foundations
40
+ : TOPIC_LEVELS.guides;
41
+ expect(read.data.links.up, topic.topic).toBe(
42
+ `astryx docs ${level.route}`,
43
+ );
44
+ }
45
+ expect(unfiled, 'Core topics with no home: give each a category').toEqual(
46
+ [],
47
+ );
48
+ },
49
+ SLOW,
50
+ );
51
+
52
+ it(
53
+ 'lists each level under a plain name, and no catch-all',
54
+ async () => {
55
+ const list = await docs();
56
+ const roots = (list.meta.namespaces ?? []).map(entry => entry.topic);
57
+ expect(roots).toEqual(expect.arrayContaining(['guides', 'foundations']));
58
+ expect(roots).not.toContain('unorganized');
59
+ const guides = await docs('guides');
60
+ expect(guides.data).toMatchObject({route: 'guides', title: 'Guides'});
61
+ expect(guides.data.slots[0].children.map(child => child.route)).toEqual(
62
+ expect.arrayContaining(['getting-started', 'principles', 'theme']),
63
+ );
64
+ const foundations = await docs('foundations');
65
+ expect(foundations.data.title).toBe('Foundations');
66
+ expect(
67
+ foundations.data.slots[0].children.map(child => child.route),
68
+ ).toEqual(expect.arrayContaining(['color', 'icons', 'spacing']));
69
+ await expect(docs('unorganized')).rejects.toMatchObject({
70
+ code: 'ERR_UNKNOWN_TOPIC',
71
+ });
72
+ },
73
+ SLOW,
74
+ );
75
+
76
+ it(
77
+ 'keeps everything for integration authors under authoring, and names where an old route went',
78
+ async () => {
79
+ const authoring = await docs('authoring');
80
+ expect(authoring.data).toMatchObject({
81
+ route: 'authoring',
82
+ kind: 'namespace',
83
+ breadcrumb: [],
84
+ links: {up: 'astryx docs'},
85
+ });
86
+ const children = authoring.data.slots.flatMap(slot =>
87
+ slot.children.map(child => child.route),
88
+ );
89
+ expect(children).toEqual(
90
+ expect.arrayContaining([
91
+ 'authoring/quick-start',
92
+ 'authoring/building-blocks',
93
+ 'authoring/ship',
94
+ 'authoring/help',
95
+ 'authoring/field-reference',
96
+ ]),
97
+ );
98
+ // Every field reference section still opens from the namespace by its
99
+ // key, as `astryx docs authoring <name>` did on the topic (FR13).
100
+ const reference = await docs('authoring/field-reference', undefined, {
101
+ index: true,
102
+ });
103
+ const keys = reference.data.sections.map(section => section.id);
104
+ expect(keys.length).toBeGreaterThan(15);
105
+ for (const key of keys) {
106
+ const section = await docs('authoring', key);
107
+ expect(section.type, key).toBe('docs.detail.section');
108
+ expect(section.data.id, key).toBe(key);
109
+ }
110
+ for (const [old, now] of [
111
+ ['cli/integrations', 'authoring'],
112
+ ['cli/integrations/quick-start', 'authoring/quick-start'],
113
+ ['cli/integrations/ship/publishing', 'authoring/ship/publishing'],
114
+ ]) {
115
+ const error = await docs(old).catch(e => e);
116
+ expect(error).toMatchObject({
117
+ code: 'ERR_UNKNOWN_TOPIC',
118
+ message: expect.stringContaining(`It moved to "${now}"`),
119
+ });
120
+ // The new route comes first, ahead of the suggestions any unknown
121
+ // route gets (FR6).
122
+ expect(error.suggestions[0]).toMatchObject({name: now});
123
+ }
124
+ },
125
+ SLOW,
126
+ );
127
+ });
@@ -28,7 +28,7 @@ export const doc = {
28
28
  '`cli/api` returns its children one level down (`depth` reads as many ' +
29
29
  'levels as asked, and `detail` how much of each doc below), a typed doc such as ' +
30
30
  "`cli/api/functions/search` returns its content, and a guide the tree " +
31
- 'places (`cli/integrations/quick-start`) reads like any topic. ' +
31
+ 'places (`authoring/quick-start`) reads like any topic. ' +
32
32
  'Every read but the list carries `links`, the commands that move from it: ' +
33
33
  '`up` to the level it sits in, `previous` and `next` to its neighbors, and, ' +
34
34
  'for a typed doc, `related` to the docs it names (its command or function, ' +
@@ -162,12 +162,12 @@ export const doc = {
162
162
  },
163
163
  {
164
164
  label: 'A namespace and everything below it, in full',
165
- code: "await docs('cli/integrations', undefined, {depth: 'all', detail: 'full'});",
165
+ code: "await docs('authoring', undefined, {depth: 'all', detail: 'full'});",
166
166
  },
167
167
  {label: 'One API function', code: "await docs('cli/api/functions/search');"},
168
168
  {
169
169
  label: 'A whole guide from the docs tree',
170
- code: "await docs('cli/integrations/quick-start');",
170
+ code: "await docs('authoring/quick-start');",
171
171
  },
172
172
  {label: 'One section by key', code: "await docs('spacing', 'scale');"},
173
173
  ],
@@ -93,7 +93,7 @@ describe('docs() dispatcher routing', () => {
93
93
 
94
94
  it("lists the docs tree's namespaces in meta, so every data entry reads as a topic", async () => {
95
95
  const res = await docs();
96
- expect(res.meta.namespaces.map(entry => entry.topic)).toEqual(['cli', 'global', 'internationalization', 'layout', 'migration', 'styling', 'styling-libraries', 'tokens', 'typography', 'unorganized']);
96
+ expect(res.meta.namespaces.map(entry => entry.topic)).toEqual(['authoring', 'cli', 'foundations', 'global', 'guides', 'internationalization', 'layout', 'migration', 'styling', 'styling-libraries', 'tokens', 'typography']);
97
97
  for (const entry of res.data) {
98
98
  expect((await docs(entry.topic)).type).toBe('docs.detail');
99
99
  }
@@ -158,8 +158,8 @@ describe('docs() dispatcher routing', () => {
158
158
  }, SLOW);
159
159
 
160
160
  it('a guide the tree places reads like a topic: the whole doc, its index, a section', async () => {
161
- // cli/integrations is a namespace of short guides; each guide reads like a topic.
162
- const integrations = await docs('cli/integrations');
161
+ // authoring is a namespace of short guides; each guide reads like a topic.
162
+ const integrations = await docs('authoring');
163
163
  expect(integrations.type).toBe('docs.node');
164
164
  const guide = placedGuide(integrations.data);
165
165
  expect((await docs(guide)).type).toBe('docs.detail');
@@ -178,7 +178,7 @@ describe('docs() dispatcher routing', () => {
178
178
  expect(leaf.links.up).toBe('astryx docs cli/api/functions');
179
179
  expect(leaf.links.previous).toMatch(/^astryx docs cli\/api\/functions\/[a-z-]+$/);
180
180
  expect(leaf.links.next).toMatch(/^astryx docs cli\/api\/functions\/[a-z-]+$/);
181
- const integrations = (await docs('cli/integrations')).data;
181
+ const integrations = (await docs('authoring')).data;
182
182
  const guide = placedGuide(integrations);
183
183
  const siblings = integrations.slots
184
184
  .find(slot => slot.children.some(child => child.route === guide))
@@ -187,7 +187,7 @@ describe('docs() dispatcher routing', () => {
187
187
  const index = await docs(guide, undefined, {index: true});
188
188
  // A guide moves across its namespace's slot, as any tree node does.
189
189
  expect(index.data.links).toEqual({
190
- up: 'astryx docs cli/integrations',
190
+ up: 'astryx docs authoring',
191
191
  ...(at > 0 ? {previous: `astryx docs ${siblings[at - 1]}`} : {}),
192
192
  ...(at < siblings.length - 1
193
193
  ? {next: `astryx docs ${siblings[at + 1]}`}
@@ -204,16 +204,22 @@ describe('docs() dispatcher routing', () => {
204
204
  expect(end.links.previous).toBe(
205
205
  `astryx docs ${guide} ${index.data.sections.at(-2).id}`,
206
206
  );
207
- // A flat topic's home is the Unorganized level, and it moves across it.
207
+ // A flat topic's home is the level for its category, and it moves across it.
208
208
  const flat = (await docs('principles')).data.links;
209
- expect(flat.up).toBe('astryx docs unorganized');
209
+ expect(flat.up).toBe('astryx docs guides');
210
210
  expect(flat.previous).toMatch(/^astryx docs [a-z-]+$/);
211
211
  expect(flat.next).toMatch(/^astryx docs [a-z-]+$/);
212
- const home = (await docs('unorganized')).data;
213
- expect(home).toMatchObject({id: null, kind: 'namespace', links: {up: 'astryx docs'}});
214
- expect(home.slots[0].children.map(child => child.route)).toEqual(
215
- (await docs()).data.map(entry => entry.topic),
216
- );
212
+ const guides = (await docs('guides')).data;
213
+ expect(guides).toMatchObject({id: null, kind: 'namespace', links: {up: 'astryx docs'}});
214
+ const foundations = (await docs('foundations')).data;
215
+ expect(foundations).toMatchObject({id: null, kind: 'namespace', links: {up: 'astryx docs'}});
216
+ // Between them the two levels hold every flat topic, each in list order.
217
+ const topics = (await docs()).data.map(entry => entry.topic);
218
+ const held = [guides, foundations].map(level => level.slots[0].children.map(child => child.route));
219
+ for (const routes of held) {
220
+ expect(routes).toEqual(topics.filter(topic => routes.includes(topic)));
221
+ }
222
+ expect(held.flat().sort()).toEqual([...topics].sort());
217
223
  }, SLOW);
218
224
 
219
225
  it('names a node by its doc identity; a generated level has id null', async () => {
@@ -240,10 +246,9 @@ describe('docs() dispatcher routing', () => {
240
246
  }, SLOW);
241
247
 
242
248
  it("the guide's old flat name is gone, and its error names the new route", async () => {
243
- await expect(docs('cli-integrations')).rejects.toMatchObject({
244
- code: 'ERR_UNKNOWN_TOPIC',
245
- suggestions: [expect.objectContaining({name: 'cli/integrations'})],
246
- });
249
+ const error = await docs('cli-integrations').catch(e => e);
250
+ expect(error.code).toBe('ERR_UNKNOWN_TOPIC');
251
+ expect(error.suggestions[0]).toMatchObject({name: 'authoring'});
247
252
  expect((await docs()).data.map(entry => entry.topic)).not.toContain(
248
253
  'cli-integrations',
249
254
  );
@@ -253,11 +258,16 @@ describe('docs() dispatcher routing', () => {
253
258
  const err = await docs('cli', 'zzzz-nope').catch(e => e);
254
259
  expect(err).toBeInstanceOf(AstryxError);
255
260
  expect(err.code).toBe('ERR_UNKNOWN_SECTION');
256
- // It names every guide below the namespace, at any depth.
257
261
  const names = err.suggestions.map(s => s.name);
258
262
  expect(names).toContain('cli/component-lookups');
259
- expect(names).toContain('cli/integrations/quick-start');
260
263
  expect(names.every(name => name.startsWith('cli/'))).toBe(true);
264
+ // It names every guide below the namespace, at any depth.
265
+ const deep = await docs('authoring', 'zzzz-nope').catch(e => e);
266
+ expect(deep.code).toBe('ERR_UNKNOWN_SECTION');
267
+ const below = deep.suggestions.map(s => s.name);
268
+ expect(below).toContain('authoring/quick-start');
269
+ expect(below).toContain('authoring/building-blocks/components/add-a-component');
270
+ expect(below.every(name => name.startsWith('authoring/'))).toBe(true);
261
271
  }, SLOW);
262
272
 
263
273
  it('an unknown route suggests the children of the deepest namespace it reaches', async () => {
@@ -246,7 +246,7 @@ describe('integration docs in the docs tree', () => {
246
246
  });
247
247
  scaffold({
248
248
  ...kit(),
249
- 'unorganized.doc.mjs': {...NAMESPACE, name: 'unorganized', title: 'Mine', summary: 'Mine.'},
249
+ 'guides.doc.mjs': {...NAMESPACE, name: 'guides', title: 'Mine', summary: 'Mine.'},
250
250
  'use-a-theme.doc.mjs': {...NAMESPACE, name: 'use-a-theme', title: 'Acme use-a-theme', summary: 'Acme use-a-theme.'},
251
251
  'cli.doc.mjs': flat('cli'),
252
252
  });
@@ -254,26 +254,26 @@ describe('integration docs in the docs tree', () => {
254
254
  expect(listed.meta.namespaces).toEqual(
255
255
  expect.arrayContaining([
256
256
  expect.objectContaining({topic: 'cli', package: '@astryxdesign/cli'}),
257
- expect.objectContaining({topic: 'unorganized', package: '@astryxdesign/cli'}),
257
+ expect.objectContaining({topic: 'guides', package: '@astryxdesign/cli'}),
258
258
  ]),
259
259
  );
260
- expect(listed.meta.namespaces.filter(n => ['use-a-theme', 'unorganized'].includes(n.topic) && n.package === '@acme/kit')).toEqual([]);
260
+ expect(listed.meta.namespaces.filter(n => ['use-a-theme', 'guides'].includes(n.topic) && n.package === '@acme/kit')).toEqual([]);
261
261
  expect(listed.data.map(entry => entry.topic)).not.toContain('cli');
262
262
  // Each name opens the CLI's doc, and a CLI topic keeps its home.
263
263
  expect((await docs('cli', undefined, {cwd: tmpDir})).data).toMatchObject({route: 'cli', package: '@astryxdesign/cli'});
264
- expect((await docs('unorganized', undefined, {cwd: tmpDir})).data).toMatchObject({route: 'unorganized', package: '@astryxdesign/cli'});
264
+ expect((await docs('guides', undefined, {cwd: tmpDir})).data).toMatchObject({route: 'guides', package: '@astryxdesign/cli'});
265
265
  const tokens = await docs('use-a-theme', undefined, {cwd: tmpDir});
266
266
  expect(tokens.type).toBe('docs.detail');
267
- expect(tokens.data.links.up).toBe('astryx docs unorganized');
267
+ expect(tokens.data.links.up).toBe('astryx docs guides');
268
268
  // The project doctor and the package doctor both name the claims.
269
269
  const check = await checkDocsTree({docsCatalog: await loadDocsCatalog(tmpDir)});
270
270
  expect(check.status).toBe('warn');
271
- expect(check.message).toContain('takes the route "unorganized", which the CLI\'s own docs keep');
271
+ expect(check.message).toContain('takes the route "guides", which the CLI\'s own docs keep');
272
272
  expect(check.message).toContain('takes the route "use-a-theme"');
273
273
  expect(check.message).toContain('both have the route "cli"');
274
274
  const result = await integrationDocConflicts('@acme/kit', {cwd: tmpDir});
275
275
  const graph = result.data.issues.filter(issue => issue.code === 'invalid_doc_graph').map(issue => issue.message).join('\n');
276
- expect(graph).toContain('takes the route "unorganized"');
276
+ expect(graph).toContain('takes the route "guides"');
277
277
  expect(graph).toContain('takes the route "use-a-theme"');
278
278
  expect(graph).toContain('route "cli"');
279
279
  }, SLOW);
@@ -294,16 +294,16 @@ describe('integration docs in the docs tree', () => {
294
294
  const nested = path.join(tmpDir, 'node_modules', '@acme', 'kit', 'docs', 'nested');
295
295
  fs.mkdirSync(nested, {recursive: true});
296
296
  fs.writeFileSync(
297
- path.join(nested, 'caps-unorganized.doc.mjs'),
298
- `export const docs = ${JSON.stringify(flat('Unorganized'), null, 2)};\n`,
297
+ path.join(nested, 'caps-guides.doc.mjs'),
298
+ `export const docs = ${JSON.stringify(flat('Guides'), null, 2)};\n`,
299
299
  );
300
300
  fs.writeFileSync(
301
301
  path.join(nested, 'caps-use-a-theme.doc.mjs'),
302
302
  `export const docs = ${JSON.stringify(flat('USE-A-THEME'), null, 2)};\n`,
303
303
  );
304
304
  expect((await docs('cli', undefined, {cwd: tmpDir})).data).toMatchObject({route: 'cli', package: '@astryxdesign/cli'});
305
- expect((await docs('unorganized', undefined, {cwd: tmpDir})).data).toMatchObject({route: 'unorganized', package: '@astryxdesign/cli'});
306
- expect((await docs('theme', undefined, {cwd: tmpDir, index: true})).data.links.up).toBe('astryx docs unorganized');
305
+ expect((await docs('guides', undefined, {cwd: tmpDir})).data).toMatchObject({route: 'guides', package: '@astryxdesign/cli'});
306
+ expect((await docs('theme', undefined, {cwd: tmpDir, index: true})).data.links.up).toBe('astryx docs guides');
307
307
  const listed = await docs(undefined, undefined, {cwd: tmpDir});
308
308
  expect(listed.data.map(entry => entry.topic.toLowerCase())).not.toContain('cli');
309
309
  // Search does not offer a topic whose route another doc owns.
@@ -314,10 +314,10 @@ describe('integration docs in the docs tree', () => {
314
314
  const check = await checkDocsTree({docsCatalog: await loadDocsCatalog(tmpDir)});
315
315
  expect(check.status).toBe('warn');
316
316
  expect(check.message).toContain('route "CLI"');
317
- expect(check.message).toContain('takes the route "Unorganized"');
317
+ expect(check.message).toContain('takes the route "Guides"');
318
318
  // `USE-A-THEME` is the CLI's topic `use-a-theme` in another spelling: the CLI's wins.
319
319
  const tokens = await docs('USE-A-THEME', undefined, {cwd: tmpDir, index: true});
320
- expect(tokens.data).toMatchObject({name: 'use-a-theme', links: {up: 'astryx docs unorganized'}});
320
+ expect(tokens.data).toMatchObject({name: 'use-a-theme', links: {up: 'astryx docs guides'}});
321
321
  expect(tokens.data.title).not.toBe('Acme USE-A-THEME');
322
322
  const result = await integrationDocConflicts('@acme/kit', {cwd: tmpDir});
323
323
  const graph = result.data.issues
@@ -325,7 +325,7 @@ describe('integration docs in the docs tree', () => {
325
325
  .map(issue => issue.message)
326
326
  .join('\n');
327
327
  expect(graph).toContain('route "CLI"');
328
- expect(graph).toContain('takes the route "Unorganized"');
328
+ expect(graph).toContain('takes the route "Guides"');
329
329
  }, SLOW);
330
330
 
331
331
  it("keeps a replaced name for the topic that replaces it, over another integration's namespace", async () => {
@@ -420,9 +420,9 @@ describe('integration docs in the docs tree', () => {
420
420
  scaffold({
421
421
  ...kit(),
422
422
  'a-cli.doc.mjs': flat('cli'),
423
- 'a-unorganized.doc.mjs': flat('Unorganized'),
423
+ 'a-guides.doc.mjs': flat('Guides'),
424
424
  'z-b2.doc.mjs': flat('b2', {replaces: 'cli'}),
425
- 'z-u2.doc.mjs': flat('u2', {replaces: 'Unorganized'}),
425
+ 'z-u2.doc.mjs': flat('u2', {replaces: 'Guides'}),
426
426
  });
427
427
  // Another package carries the chain on: c3 replaces b2, which replaced cli.
428
428
  const three = path.join(tmpDir, 'node_modules', '@acme', 'three');
@@ -440,8 +440,8 @@ describe('integration docs in the docs tree', () => {
440
440
  for (const name of ['cli', 'CLI']) {
441
441
  expect((await docs(name, undefined, {cwd: tmpDir})).data).toMatchObject({route: 'cli', package: '@astryxdesign/cli'});
442
442
  }
443
- for (const name of ['unorganized', 'UNORGANIZED']) {
444
- expect((await docs(name, undefined, {cwd: tmpDir})).data).toMatchObject({route: 'unorganized', package: '@astryxdesign/cli'});
443
+ for (const name of ['guides', 'GUIDES']) {
444
+ expect((await docs(name, undefined, {cwd: tmpDir})).data).toMatchObject({route: 'guides', package: '@astryxdesign/cli'});
445
445
  }
446
446
  // The replacement still answers to its own names.
447
447
  for (const name of ['b2', 'c3']) {
@@ -456,7 +456,7 @@ describe('integration docs in the docs tree', () => {
456
456
  const check = await checkDocsTree({docsCatalog: await loadDocsCatalog(tmpDir)});
457
457
  expect(check.status).toBe('warn');
458
458
  expect(check.message).toContain('The topic "c3" answers to "cli" through replaces');
459
- expect(check.message).toContain('The topic "u2" answers to "unorganized" through replaces');
459
+ expect(check.message).toContain('The topic "u2" answers to "guides" through replaces');
460
460
  const inPackage = await integrationDocConflicts('@acme/kit', {cwd: tmpDir});
461
461
  const graph = inPackage.data.issues
462
462
  .filter(issue => issue.code === 'invalid_doc_graph')
@@ -519,7 +519,7 @@ describe('integration docs in the docs tree', () => {
519
519
  });
520
520
  const {data} = await docs('theme', 'acme-theming-notes', {cwd: tmpDir});
521
521
  // `generic:integrations` is the extension's own guide, never the CLI's
522
- // `cli/integrations`; a provider-qualified link reaches the CLI's topic.
522
+ // `authoring`; a provider-qualified link reaches the CLI's topic.
523
523
  expect(data.content[0].text).toBe(
524
524
  'See `astryx docs acme/integrations`, and `astryx docs tokens` for the tokens.',
525
525
  );
@@ -447,7 +447,7 @@ describe('integration-contributed topics', () => {
447
447
  // places it.
448
448
  expect(top).toContain('troubleshooting');
449
449
  expect(
450
- top.some(name => /^cli\/integrations\/(?:.+\/)?troubleshooting$/.test(name)),
450
+ top.some(name => /^authoring\/(?:.+\/)?troubleshooting$/.test(name)),
451
451
  top.join(', '),
452
452
  ).toBe(true);
453
453
  }, SLOW);
@@ -157,13 +157,13 @@ describe('a section read on a namespace', () => {
157
157
  expect(names).toContain('layout/side-panels');
158
158
  expect(names.every(name => name.startsWith('layout/'))).toBe(true);
159
159
  // At any depth: guides under nested namespaces are named, namespaces are not.
160
- const cli = await docs('cli', 'zzzz-nope').catch(e => e);
161
- expect(cli.code).toBe('ERR_UNKNOWN_SECTION');
162
- expect(cli.suggestions.map(s => s.name)).toContain(
163
- 'cli/integrations/quick-start',
160
+ const authoring = await docs('authoring', 'zzzz-nope').catch(e => e);
161
+ expect(authoring.code).toBe('ERR_UNKNOWN_SECTION');
162
+ expect(authoring.suggestions.map(s => s.name)).toContain(
163
+ 'authoring/building-blocks/components/add-a-component',
164
164
  );
165
- expect(cli.suggestions.map(s => s.name)).not.toContain(
166
- 'cli/integrations',
165
+ expect(authoring.suggestions.map(s => s.name)).not.toContain(
166
+ 'authoring/building-blocks',
167
167
  );
168
168
  },
169
169
  SLOW,
@@ -300,11 +300,11 @@ describe('a reference block that includes what it names', () => {
300
300
  });
301
301
 
302
302
  describe('what a reference block names', () => {
303
- it('resolves a CLI authoring schema by identity, to its section of `astryx docs authoring`', async () => {
303
+ it('resolves a CLI authoring schema by identity, to its section of the field reference', async () => {
304
304
  const resolve = await linkResolver(builtinCatalog(), CLI_PROVIDER_ID);
305
305
  expect(await resolve('schema:integration')).toMatchObject({
306
306
  id: createDocId(CLI_PROVIDER_ID, 'schema', 'integration'),
307
- route: 'authoring',
307
+ route: 'authoring/field-reference',
308
308
  title: 'Astryx Integration',
309
309
  command: 'astryx docs authoring integration',
310
310
  });
@@ -1048,16 +1048,20 @@ function nameTypes(names) {
1048
1048
  }
1049
1049
 
1050
1050
  /**
1051
- * The section keys `astryx docs authoring --index` lists, read the way that
1052
- * command reads them.
1051
+ * The section keys the field reference lists (`astryx docs
1052
+ * authoring/field-reference --index`), read the way that command reads them.
1053
1053
  * @returns {Promise<{keys: Set<string>} | {keys: null, error: string}>}
1054
1054
  */
1055
1055
  async function authoringTopicKeys() {
1056
1056
  try {
1057
+ const {AUTHORING_REFERENCE_ROUTE} =
1058
+ await import('../../foundation/discovery/authoring-self-docs.mjs');
1057
1059
  const catalog = DocsCatalog.fromBuiltins();
1058
- const entry = catalog.resolve('authoring');
1059
- if (!entry) return {keys: null, error: 'it is not a built-in topic'};
1060
- const index = indexView(await lowerTopic(catalog, entry));
1060
+ const node = (await projectTree(catalog)).get(AUTHORING_REFERENCE_ROUTE);
1061
+ if (!node?.ref?.topicFile) {
1062
+ return {keys: null, error: 'the docs tree has no field reference'};
1063
+ }
1064
+ const index = indexView(await lowerTopic(catalog, guideEntry(node)));
1061
1065
  return {keys: new Set(index.sections.map(section => section.id))};
1062
1066
  } catch (err) {
1063
1067
  return {
@@ -1076,7 +1080,7 @@ function surfaceProblems(surface) {
1076
1080
  const problems = [];
1077
1081
  if (surface.types === 0 && surface.untraced.length === 0) {
1078
1082
  problems.push(
1079
- `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring')}\``,
1083
+ `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring/field-reference')}\``,
1080
1084
  );
1081
1085
  }
1082
1086
  for (const {module, names, reason, source, key} of surface.unreadable) {
@@ -1089,7 +1093,7 @@ function surfaceProblems(surface) {
1089
1093
  ? `${source} does not load`
1090
1094
  : `${source} renders section "${key}", which the topic's index does not list`;
1091
1095
  problems.push(
1092
- `${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in \`${formatCliCommand('docs authoring')}\`: ${why}`,
1096
+ `${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in \`${formatCliCommand('docs authoring/field-reference')}\`: ${why}`,
1093
1097
  );
1094
1098
  }
1095
1099
  for (const {name, reason} of surface.untraced) {
@@ -1130,7 +1134,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1130
1134
  const audit = await auditAuthoringSelfDocs({root, sources});
1131
1135
  const problems = [
1132
1136
  ...audit.unreachable.map(
1133
- source => `${source} is not in \`${formatCliCommand('docs authoring')}\``,
1137
+ source => `${source} is not in \`${formatCliCommand('docs authoring/field-reference')}\``,
1134
1138
  ),
1135
1139
  ...audit.failed.map(
1136
1140
  ({source, error}) => `${source} failed to load: ${error}`,
@@ -1146,7 +1150,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1146
1150
  : {keys: options.topicKeys};
1147
1151
  const surface = [
1148
1152
  ...('error' in topic
1149
- ? [`\`${formatCliCommand('docs authoring')}\` could not be read: ${topic.error}`]
1153
+ ? [`\`${formatCliCommand('docs authoring/field-reference')}\` could not be read: ${topic.error}`]
1150
1154
  : []),
1151
1155
  ...surfaceProblems(
1152
1156
  await auditAuthoringSurface({root, sources, topicKeys: topic.keys}),
@@ -1170,7 +1174,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1170
1174
  id,
1171
1175
  label,
1172
1176
  status: 'pass',
1173
- message: `All ${audit.sections} authoring schemas are readable in \`${formatCliCommand('docs authoring')}\`.`,
1177
+ message: `All ${audit.sections} authoring schemas are readable in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
1174
1178
  };
1175
1179
  } catch (err) {
1176
1180
  return {
@@ -1238,7 +1242,7 @@ export async function checkCliDocs(_ctx, options = {}) {
1238
1242
  id,
1239
1243
  label,
1240
1244
  status: 'pass',
1241
- message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring')}\`.`,
1245
+ message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
1242
1246
  };
1243
1247
  } catch (err) {
1244
1248
  return {
@@ -1355,7 +1359,7 @@ export async function checkDocsProgressiveDisclosure(ctx) {
1355
1359
  // A guide the docs tree places is a topic read by its route; it is held
1356
1360
  // to the same budget as every flat topic.
1357
1361
  const guides = [...(await projectTree(catalog)).nodes.values()]
1358
- // A flat topic in the Unorganized level is checked above, as a topic.
1362
+ // A flat topic in a topic level is checked above, as a topic.
1359
1363
  .filter(node => node.kind === 'generic' && !node.ref?.flatTopic)
1360
1364
  .map(guideEntry);
1361
1365
  for (const entry of [...catalog.entries(), ...guides]) {
@@ -652,7 +652,7 @@ describe('checkAuthoringDocs', () => {
652
652
  it('passes when every authoring self-doc is reachable and fits one read', async () => {
653
653
  const c = await checkAuthoringDocs();
654
654
  expect(c).toMatchObject({id: 'authoring-docs', status: 'pass'});
655
- expect(c.message).toContain(formatCliCommand('docs authoring'));
655
+ expect(c.message).toContain(formatCliCommand('docs authoring/field-reference'));
656
656
  }, SLOW);
657
657
  });
658
658
 
@@ -680,7 +680,7 @@ describe('checkCliDocs', () => {
680
680
  id: 'cli-docs',
681
681
  label: 'CLI docs',
682
682
  status: 'pass',
683
- message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring')}\`.`,
683
+ message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
684
684
  });
685
685
  },
686
686
  SLOW,
@@ -790,7 +790,7 @@ describe('checkDocsTree', () => {
790
790
  describe('checkAuthoringDocs against the public authoring surface', () => {
791
791
  const NAMESPACE = 'doctypes/namespace/namespace.doc.mjs';
792
792
  const NAMESPACE_TYPES =
793
- `NamespaceDoc, NamespaceProviderScope, NamespaceSlotAcceptance, NamespaceSlot, NamespaceAdoptionSource, NamespaceAdoptionRule from doctypes/namespace/type.ts have no doc in \`${formatCliCommand('docs authoring')}\``;
793
+ `NamespaceDoc, NamespaceProviderScope, NamespaceSlotAcceptance, NamespaceSlot, NamespaceAdoptionSource, NamespaceAdoptionRule from doctypes/namespace/type.ts have no doc in \`${formatCliCommand('docs authoring/field-reference')}\``;
794
794
  const SURFACE_FIX =
795
795
  'Put a self-doc beside each module whose types @astryxdesign/cli/authoring exports and list it in AUTHORING_SELF_DOCS; export what each listed self-doc documents, or remove that self-doc.';
796
796
 
@@ -820,7 +820,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
820
820
  id: 'authoring-docs',
821
821
  label: 'Authoring docs',
822
822
  status: 'pass',
823
- message: `All ${AUTHORING_SELF_DOCS.length} authoring schemas are readable in \`${formatCliCommand('docs authoring')}\`.`,
823
+ message: `All ${AUTHORING_SELF_DOCS.length} authoring schemas are readable in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
824
824
  });
825
825
  },
826
826
  SLOW,
@@ -849,7 +849,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
849
849
  });
850
850
  expect(c.status).toBe('fail');
851
851
  expect(c.message).toBe(
852
- `2 problems: ${NAMESPACE} is not in \`${formatCliCommand('docs authoring')}\`; ${NAMESPACE_TYPES}: ${NAMESPACE} is not listed in AUTHORING_SELF_DOCS`,
852
+ `2 problems: ${NAMESPACE} is not in \`${formatCliCommand('docs authoring/field-reference')}\`; ${NAMESPACE_TYPES}: ${NAMESPACE} is not listed in AUTHORING_SELF_DOCS`,
853
853
  );
854
854
  },
855
855
  SLOW,
@@ -858,7 +858,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
858
858
  it(
859
859
  "fails when the topic's index no longer exposes the NamespaceDoc section",
860
860
  async () => {
861
- const index = await docs('authoring', undefined, {index: true});
861
+ const index = await docs('authoring/field-reference', undefined, {index: true});
862
862
  const topicKeys = new Set(
863
863
  index.data.sections
864
864
  .map((/** @type {any} */ s) => s.id)
@@ -947,7 +947,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
947
947
  expect(c.fix).toBe(SURFACE_FIX);
948
948
  expect(c.message).toMatch(
949
949
  new RegExp(
950
- `^[A-Za-z, ]+ from ${escape(module)} have no doc in \`${escape(formatCliCommand('docs authoring'))}\`: no self-doc sits beside ${escape(module)}$`,
950
+ `^[A-Za-z, ]+ from ${escape(module)} have no doc in \`${escape(formatCliCommand('docs authoring/field-reference'))}\`: no self-doc sits beside ${escape(module)}$`,
951
951
  ),
952
952
  );
953
953
  for (const name of names) {
@@ -990,7 +990,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
990
990
  expect(await checkAuthoringDocs()).toMatchObject({
991
991
  status: 'fail',
992
992
  message:
993
- `\`${formatCliCommand('docs authoring')}\` could not be read: no built-in docs`,
993
+ `\`${formatCliCommand('docs authoring/field-reference')}\` could not be read: no built-in docs`,
994
994
  fix: SURFACE_FIX,
995
995
  });
996
996
  } finally {
@@ -1011,7 +1011,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
1011
1011
  const c = await checkAuthoringDocs(undefined, {root});
1012
1012
  expect(c.status).toBe('fail');
1013
1013
  expect(c.message).toContain(
1014
- `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring')}\``,
1014
+ `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring/field-reference')}\``,
1015
1015
  );
1016
1016
  },
1017
1017
  SLOW,
@@ -1317,8 +1317,12 @@ describe('a configured integration that cannot load fails the gate', () => {
1317
1317
  'astryx.config.mjs': "export default { integrations: ['@acme/widgets'] };\n",
1318
1318
  };
1319
1319
 
1320
- /** Run doctor on a project under the working directory. */
1321
- async function report(files) {
1320
+ /**
1321
+ * Run doctor on a project under the working directory, in its folder `at`.
1322
+ * @param {Record<string, string>} files
1323
+ * @param {string} [at]
1324
+ */
1325
+ async function report(files, at = '.') {
1322
1326
  const dir = fs.mkdtempSync(path.join(process.cwd(), '.astryx-doctor-gate-'));
1323
1327
  tmpDirs.push(dir);
1324
1328
  for (const [rel, content] of Object.entries(files)) {
@@ -1326,7 +1330,7 @@ describe('a configured integration that cannot load fails the gate', () => {
1326
1330
  fs.mkdirSync(path.dirname(abs), {recursive: true});
1327
1331
  fs.writeFileSync(abs, content);
1328
1332
  }
1329
- const {checks, summary} = (await doctor({cwd: dir})).data;
1333
+ const {checks, summary} = (await doctor({cwd: path.join(dir, at)})).data;
1330
1334
  return {by: Object.fromEntries(checks.map(c => [c.id, c])), summary};
1331
1335
  }
1332
1336
 
@@ -1354,6 +1358,27 @@ describe('a configured integration that cannot load fails the gate', () => {
1354
1358
  SLOW,
1355
1359
  );
1356
1360
 
1361
+ it(
1362
+ 'passes in a workspace member whose configured integration is hoisted to the root',
1363
+ async () => {
1364
+ const {by} = await report(
1365
+ {
1366
+ 'package.json': JSON.stringify({name: 'root', private: true, workspaces: ['apps/*']}),
1367
+ ...CORE_STUB,
1368
+ ...widgets(),
1369
+ 'apps/web/package.json': '{"name":"web"}',
1370
+ 'apps/web/astryx.config.mjs': "export default { integrations: ['@acme/widgets'] };\n",
1371
+ },
1372
+ 'apps/web',
1373
+ );
1374
+ expect(by['configured-integrations'].status).toBe('pass');
1375
+ expect(by['configured-integrations'].message).toBe(
1376
+ '1 integration named in astryx.config loaded: @acme/widgets.',
1377
+ );
1378
+ },
1379
+ SLOW,
1380
+ );
1381
+
1357
1382
  it(
1358
1383
  'counts the package being authored when its own config names it',
1359
1384
  async () => {