@astryxdesign/cli 0.7.3-canary.f94e962 → 0.7.3

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 (205) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/README.md +68 -68
  3. package/api/build/_adapter.mjs +37 -25
  4. package/api/build/blocks/blocks.d.mts +68 -18
  5. package/api/build/blocks/blocks.mjs +475 -116
  6. package/api/build/blocks/blocks.test.mjs +191 -61
  7. package/api/build/blocks/blocks.weights.json +1 -1
  8. package/api/build/build.type.mjs +1 -1
  9. package/api/build/kit/answer.d.mts +9 -5
  10. package/api/build/kit/answer.mjs +123 -13
  11. package/api/build/kit/answer.test.mjs +73 -3
  12. package/api/build/kit/signals.d.mts +19 -0
  13. package/api/build/kit/signals.mjs +18 -7
  14. package/api/build/kit/weights.d.mts +8 -22
  15. package/api/build/kit/weights.mjs +87 -8
  16. package/api/build/kit/weights.test.mjs +96 -0
  17. package/api/build/tree.mjs +2 -1
  18. package/api/build/tree.test.mjs +37 -29
  19. package/api/component/_adapter.mjs +39 -5
  20. package/api/component/component-replacement.test.mjs +1 -0
  21. package/api/component/component.mjs +1 -1
  22. package/api/component/doc-links.test.mjs +2 -2
  23. package/api/discover/_adapter.d.mts +1 -2
  24. package/api/discover/_adapter.mjs +6 -8
  25. package/api/discover/discover.mjs +0 -1
  26. package/api/docs/_adapter.d.mts +2 -2
  27. package/api/docs/_adapter.mjs +65 -18
  28. package/api/docs/docs-homes.test.mjs +127 -0
  29. package/api/docs/docs.doc.mjs +3 -3
  30. package/api/docs/docs.test.mjs +28 -18
  31. package/api/docs/integration-tree.test.mjs +20 -20
  32. package/api/docs/integrationDocs.test.mjs +1 -1
  33. package/api/docs/namespace-section.test.mjs +6 -6
  34. package/api/docs/reference-blocks.test.mjs +2 -2
  35. package/api/doctor/_adapter.d.mts +33 -13
  36. package/api/doctor/_adapter.mjs +55 -25
  37. package/api/doctor/doctor.d.mts +23 -5
  38. package/api/doctor/doctor.mjs +97 -28
  39. package/api/doctor/doctor.test.mjs +67 -9
  40. package/api/hook/hook.mjs +1 -1
  41. package/api/integration/validate-integration-fixes.test.mjs +6 -5
  42. package/api/integration/validate-integration-gaps.test.mjs +12 -1
  43. package/api/integration/validate-integration.d.mts +4 -0
  44. package/api/integration/validate-integration.mjs +48 -7
  45. package/api/integration/validate-integration.type.d.mts +36 -5
  46. package/api/integration/validate-integration.type.mjs +27 -6
  47. package/api/integration/validateIntegration.doc.mjs +1 -1
  48. package/api/search/_adapter.d.mts +16 -0
  49. package/api/search/_adapter.mjs +39 -0
  50. package/api/search/_adapter.test.mjs +173 -0
  51. package/api/search/_candidate-score.mjs +1 -1
  52. package/api/search/_entries.d.mts +11 -0
  53. package/api/search/_entries.mjs +35 -17
  54. package/api/search/_entries.test.mjs +48 -0
  55. package/api/search/_gather-docs.mjs +3 -3
  56. package/api/search/_gather-templates.d.mts +0 -1
  57. package/api/search/_gather-templates.mjs +25 -0
  58. package/api/search/search.doc.mjs +1 -1
  59. package/api/search/search.integration-block.test.mjs +100 -0
  60. package/api/search/search.mjs +6 -2
  61. package/api/search/search.test.mjs +14 -14
  62. package/api/template/template.mjs +5 -1
  63. package/assets/docs/author-a-theme.doc.mjs +2 -2
  64. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  65. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  66. package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
  67. package/assets/docs/tree/agent-guidance.doc.mjs +1 -1
  68. package/assets/docs/tree/{integrations.doc.mjs → authoring.doc.mjs} +15 -6
  69. package/assets/docs/tree/block-template.doc.mjs +1 -1
  70. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  71. package/assets/docs/tree/building-blocks.doc.mjs +2 -2
  72. package/assets/docs/tree/check-the-props.doc.mjs +1 -1
  73. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  74. package/assets/docs/tree/checks.doc.mjs +2 -2
  75. package/assets/docs/tree/ci-and-containers.doc.mjs +13 -0
  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 +1 -1
  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/authoring/doctypes/schema/schema.doc.mjs +1 -1
  131. package/authoring/integration/integration.doc.mjs +1 -1
  132. package/authoring/integration/type.ts +1 -1
  133. package/clients/cli/command-result-coverage.test.mjs +6 -5
  134. package/clients/cli/commands/build-theme.color-scheme.test.mjs +1 -1
  135. package/clients/cli/commands/{component/index.mjs → component.mjs} +37 -37
  136. package/clients/cli/commands/component.test.mjs +6 -6
  137. package/clients/cli/commands/docs.doc.mjs +2 -2
  138. package/clients/cli/commands/docs.mjs +1 -1
  139. package/clients/cli/commands/docs.test.mjs +14 -14
  140. package/clients/cli/commands/doctor-integration.test.mjs +49 -1
  141. package/clients/cli/commands/doctor.doc.mjs +1 -1
  142. package/clients/cli/commands/doctor.mjs +10 -0
  143. package/clients/cli/commands/{hook/index.mjs → hook.mjs} +22 -22
  144. package/clients/cli/commands/import-hint-correctness.test.mjs +1 -1
  145. package/clients/cli/commands/integration.doc.mjs +1 -1
  146. package/clients/cli/commands/manifest.doc.mjs +1 -1
  147. package/clients/cli/commands/manifest.mjs +67 -0
  148. package/clients/cli/commands/outside-project.test.mjs +99 -0
  149. package/clients/cli/commands/postinstall.doc.mjs +23 -0
  150. package/clients/cli/commands/postinstall.mjs +31 -0
  151. package/clients/cli/commands/setup-nudge.test.mjs +17 -0
  152. package/clients/cli/commands/{build-theme.mjs → theme.mjs} +1 -1
  153. package/clients/cli/index.mjs +35 -93
  154. package/clients/cli/lib/component-format.mjs +1 -1
  155. package/clients/cli/lib/define-command.mjs +12 -7
  156. package/clients/cli/lib/exit-codes.test.mjs +5 -0
  157. package/clients/cli/lib/manifest.test.mjs +12 -0
  158. package/clients/cli/lib/welcome-box.mjs +50 -0
  159. package/foundation/agent-docs/agent-doc-state.d.mts +12 -0
  160. package/foundation/agent-docs/agent-doc-state.mjs +24 -2
  161. package/foundation/agent-docs/agent-docs.mjs +7 -6
  162. package/foundation/agent-docs/agent-docs.test.mjs +5 -4
  163. package/foundation/agent-docs/computer-agent-text.d.mts +39 -2
  164. package/foundation/agent-docs/computer-agent-text.mjs +135 -8
  165. package/foundation/agent-docs/computer-agent-text.test.mjs +99 -2
  166. package/foundation/discovery/authoring-self-docs.d.mts +7 -0
  167. package/foundation/discovery/authoring-self-docs.mjs +16 -4
  168. package/foundation/discovery/authoring-self-docs.test.mjs +15 -3
  169. package/foundation/discovery/authoring-surface.d.mts +1 -1
  170. package/foundation/discovery/authoring-surface.mjs +2 -2
  171. package/foundation/discovery/authoring-surface.test.mjs +1 -1
  172. package/foundation/discovery/cli-self-docs.d.mts +2 -1
  173. package/foundation/discovery/cli-self-docs.mjs +4 -3
  174. package/foundation/discovery/cli-self-docs.test.mjs +2 -2
  175. package/foundation/discovery/runner-commands.mjs +1 -0
  176. package/foundation/discovery/stray-pointers.test.mjs +1 -1
  177. package/foundation/doc-compiler/doc-loads.test.mjs +21 -9
  178. package/foundation/doc-compiler/split-topic-keywords.test.mjs +3 -2
  179. package/foundation/doc-compiler/tree.d.mts +32 -6
  180. package/foundation/doc-compiler/tree.mjs +77 -43
  181. package/foundation/doc-compiler/tree.test.mjs +7 -7
  182. package/foundation/fs/read-record.d.mts +18 -0
  183. package/foundation/fs/read-record.mjs +131 -0
  184. package/foundation/fs/read-record.test.mjs +77 -0
  185. package/foundation/integrations/cli-peer-version.d.mts +36 -0
  186. package/foundation/integrations/cli-peer-version.mjs +132 -0
  187. package/foundation/integrations/cli-peer-version.test.mjs +354 -0
  188. package/foundation/integrations/exports-subpaths.d.mts +57 -0
  189. package/foundation/integrations/exports-subpaths.mjs +113 -0
  190. package/foundation/integrations/public-imports.d.mts +118 -0
  191. package/foundation/integrations/public-imports.mjs +1769 -0
  192. package/foundation/integrations/public-imports.test.mjs +1793 -0
  193. package/foundation/release/cache.test.mjs +24 -21
  194. package/foundation/release/global-state.d.mts +8 -4
  195. package/foundation/release/global-state.mjs +4 -2
  196. package/foundation/release/notices.d.mts +62 -8
  197. package/foundation/release/notices.mjs +136 -25
  198. package/foundation/release/notices.test.mjs +21 -0
  199. package/foundation/response/response-types.doc.mjs +1 -1
  200. package/foundation/text/string-utils.d.mts +2 -1
  201. package/foundation/text/string-utils.mjs +16 -5
  202. package/foundation/text/suggest-order.d.mts +72 -0
  203. package/foundation/text/suggest-order.mjs +363 -0
  204. package/foundation/text/suggest-order.test.mjs +259 -0
  205. package/package.json +9 -9
@@ -0,0 +1,100 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file An integration's own block answers a query that names it, though no
5
+ * learned table lists it: its authored display name is a title search reads,
6
+ * so "rich text editor" finds the rich text package's block first and build
7
+ * offers it, while a variant label that does not name the block (Lab's "Inside
8
+ * a card") captures nothing.
9
+ */
10
+
11
+ import fs from 'node:fs';
12
+ import os from 'node:os';
13
+ import path from 'node:path';
14
+ import {fileURLToPath} from 'node:url';
15
+ import {afterAll, beforeAll, describe, expect, it} from 'vitest';
16
+ import {search} from './search.mjs';
17
+ import {build} from '../build/build.mjs';
18
+
19
+ const SLOW = 60_000;
20
+ const packages = path.resolve(
21
+ path.dirname(fileURLToPath(import.meta.url)),
22
+ '../../..',
23
+ );
24
+
25
+ describe('an integration block found by its display name', () => {
26
+ /** @type {string} */
27
+ let dir;
28
+ beforeAll(() => {
29
+ dir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-integration-block-'));
30
+ fs.writeFileSync(
31
+ path.join(dir, 'package.json'),
32
+ JSON.stringify({
33
+ name: 'consumer',
34
+ dependencies: {
35
+ '@astryxdesign/core': '*',
36
+ '@astryxdesign/richtext': '*',
37
+ '@astryxdesign/lab': '*',
38
+ },
39
+ }),
40
+ );
41
+ const scope = path.join(dir, 'node_modules', '@astryxdesign');
42
+ fs.mkdirSync(scope, {recursive: true});
43
+ for (const name of ['core', 'richtext', 'lab'])
44
+ fs.symlinkSync(path.join(packages, name), path.join(scope, name), 'dir');
45
+ });
46
+ afterAll(() => fs.rmSync(dir, {recursive: true, force: true}));
47
+
48
+ it.each(['rich text editor', 'rich text', 'text editor'])(
49
+ '`%s` ranks the rich text block first among templates',
50
+ async query => {
51
+ const {results} = (await search(query, {cwd: dir, type: 'template'}))
52
+ .data;
53
+ expect(results[0], JSON.stringify(results.slice(0, 3))).toMatchObject({
54
+ name: 'RichTextEditorShowcase',
55
+ });
56
+ },
57
+ SLOW,
58
+ );
59
+
60
+ it(
61
+ 'a whole display name names the block outright',
62
+ async () => {
63
+ const {results} = (
64
+ await search('rich text editor', {cwd: dir, type: 'template'})
65
+ ).data;
66
+ expect(results[0]).toMatchObject({
67
+ name: 'RichTextEditorShowcase',
68
+ reason: 'exact name',
69
+ });
70
+ },
71
+ SLOW,
72
+ );
73
+
74
+ it(
75
+ "a variant label that does not name the block's subject is no title",
76
+ async () => {
77
+ const {results} = (
78
+ await search('table inside a card', {cwd: dir, type: 'template'})
79
+ ).data;
80
+ expect(results[0], JSON.stringify(results.slice(0, 3))).toMatchObject({
81
+ name: 'TableInCard',
82
+ });
83
+ const kit = (await build('a settings form inside a card', {cwd: dir}))
84
+ .data;
85
+ expect(kit.blocks[0]?.name).not.toBe('CommentsInCard');
86
+ },
87
+ SLOW,
88
+ );
89
+
90
+ it(
91
+ 'build offers the rich text block for a request that names it',
92
+ async () => {
93
+ const kit = (
94
+ await build('a comment box with a rich text editor', {cwd: dir})
95
+ ).data;
96
+ expect(kit.blocks.map(b => b.name)).toContain('RichTextEditorShowcase');
97
+ },
98
+ SLOW,
99
+ );
100
+ });
@@ -15,7 +15,11 @@
15
15
  */
16
16
 
17
17
  import {withListingCache} from '../../foundation/fs/listing-cache.mjs';
18
- import {gatherCandidates, loadSearchData} from './_adapter.mjs';
18
+ import {
19
+ gatherCandidates,
20
+ gatherCandidatesReused,
21
+ loadSearchData,
22
+ } from './_adapter.mjs';
19
23
  import {rankLexical} from './_lexical.mjs';
20
24
  import {checkSearchArgs} from './_result.mjs';
21
25
  import {runTree} from '../../foundation/route/route.mjs';
@@ -56,7 +60,7 @@ export async function search(query, options = {}) {
56
60
  await runTree(
57
61
  SEARCH_TREE,
58
62
  {query, options},
59
- {...(await gatherCandidates(options)), data: loadSearchData()},
63
+ {...(await gatherCandidatesReused(options)), data: loadSearchData()},
60
64
  )
61
65
  ),
62
66
  options.cwd ?? process.cwd(),
@@ -117,16 +117,16 @@ describe('search leaf — docs at the grain a reader reads them', () => {
117
117
  .find(result => result.section === 'which-codemods-run');
118
118
  expect(hit).toMatchObject({
119
119
  domain: 'doc',
120
- name: expect.stringMatching(/^cli\/integrations\/(?:.+\/)?codemods$/),
120
+ name: expect.stringMatching(/^authoring\/(?:.+\/)?codemods$/),
121
121
  title: expect.stringMatching(/ › Codemods › Choose when a codemod runs$/),
122
122
  });
123
123
  expect(hit.parent).toBe(`astryx docs ${hit.name} --index`);
124
124
  expect(hit.command).toBe(`astryx docs ${hit.name} which-codemods-run`);
125
125
  const block = await search('token-ref', {cwd});
126
126
  expect(block.data.results[0]).toMatchObject({
127
- name: 'authoring',
127
+ name: 'authoring/field-reference',
128
128
  section: 'reference-doc',
129
- command: 'astryx docs authoring reference-doc',
129
+ command: 'astryx docs authoring/field-reference reference-doc',
130
130
  });
131
131
  const fn = await search('assertResponse', {cwd, type: 'doc'});
132
132
  expect(fn.data.results[0]).toMatchObject({
@@ -148,13 +148,13 @@ describe('search leaf — docs at the grain a reader reads them', () => {
148
148
  // keywords and the title the guides declare. A namespace's own
149
149
  // keywords count, and a plural name is the name.
150
150
  for (const [query, route] of [
151
- ['make an integration', /^cli\/integrations$/],
152
- ['build an integration', /^cli\/integrations$/],
153
- ['create an integration', /^cli\/integrations$/],
154
- ['integration', /^cli\/integrations$/],
155
- ['publish an integration', /^cli\/integrations$/],
151
+ ['make an integration', /^authoring$/],
152
+ ['build an integration', /^authoring$/],
153
+ ['create an integration', /^authoring$/],
154
+ ['integration', /^authoring$/],
155
+ ['publish an integration', /^authoring$/],
156
156
  // The troubleshooting guide, wherever the tree places it.
157
- ['troubleshoot integration', /^cli\/integrations\/(?:.+\/)?troubleshooting$/],
157
+ ['troubleshoot integration', /^authoring\/(?:.+\/)?troubleshooting$/],
158
158
  ]) {
159
159
  const r = await search(query, {cwd, type: 'doc'});
160
160
  const names = r.data.results.slice(0, 3).map(result => result.name);
@@ -167,7 +167,7 @@ describe('search leaf — docs at the grain a reader reads them', () => {
167
167
  it(
168
168
  'gives a top-level namespace hit the topic list as its parent',
169
169
  async () => {
170
- for (const [query, route] of [['unorganized', 'unorganized'], ['Astryx CLI', 'cli']]) {
170
+ for (const [query, route] of [['foundations', 'foundations'], ['Astryx CLI', 'cli']]) {
171
171
  const r = await search(query, {cwd, type: 'doc'});
172
172
  expect(r.data.results).toContainEqual(
173
173
  expect.objectContaining({
@@ -185,7 +185,7 @@ describe('search leaf — docs at the grain a reader reads them', () => {
185
185
  'points a topic hit at its index, never a whole-topic read',
186
186
  async () => {
187
187
  // A guide the tree places, read from the tree rather than named.
188
- const {data: integrations} = await docs('cli/integrations');
188
+ const {data: integrations} = await docs('authoring');
189
189
  const guide = integrations.slots
190
190
  .flatMap(slot => slot.children)
191
191
  .find(child => child.kind === 'generic').route;
@@ -440,9 +440,9 @@ describe('search leaf — a candidate that matches every word outranks a partial
440
440
  const tokens = await search('tokens', {cwd});
441
441
  expect(tokens.data.results[0]).toMatchObject({domain: 'doc', name: 'tokens'});
442
442
  for (const [query, route] of [
443
- ['codemods', /^cli\/integrations\/(?:.+\/)?codemods$/],
444
- ['quick start', /^cli\/integrations\/(?:.+\/)?quick-start$/],
445
- ['test in an app', /^cli\/integrations\/(?:.+\/)?test-in-an-app$/],
443
+ ['codemods', /^authoring\/(?:.+\/)?codemods$/],
444
+ ['quick start', /^authoring\/(?:.+\/)?quick-start$/],
445
+ ['test in an app', /^authoring\/(?:.+\/)?test-in-an-app$/],
446
446
  ]) {
447
447
  const r = await search(query, {cwd, type: 'doc'});
448
448
  // The guide is among the hits that share the top score: two guides
@@ -24,6 +24,7 @@ import {
24
24
  } from '../../foundation/discovery/template-adapter.mjs';
25
25
  import {AstryxError} from '../error.mjs';
26
26
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
27
+ import {orderByAffinity} from '../../foundation/text/suggest-order.mjs';
27
28
  import {templateList} from './list/list.mjs';
28
29
  import {templateShow} from './show/show.mjs';
29
30
  import {templateSkeleton} from './skeleton/skeleton.mjs';
@@ -188,7 +189,10 @@ export async function template(name, options = {}) {
188
189
  if (name && candidates.length === 0) {
189
190
  throw new AstryxError(
190
191
  `Unknown template "${name}"`,
191
- templates.map(t => ({name: t.dirName, reason: `${t.type} template`})),
192
+ orderByAffinity(name, templates, t => [t.dirName, t.name]).map(t => ({
193
+ name: t.dirName,
194
+ reason: `${t.type} template`,
195
+ })),
192
196
  ERROR_CODES.ERR_UNKNOWN_TEMPLATE,
193
197
  );
194
198
  }
@@ -28,7 +28,7 @@ export const docs = {
28
28
  {type: 'code', lang: 'json', label: 'Minimal palette config (palette.config.json)', code: '{"families": [{"id": "ocean", "seed": "#0074e2"}]}'},
29
29
  {type: 'code', lang: 'bash', label: 'Generate and preview', code: '# Print the palette without writing files\nastryx theme palette generate palette.config.json\n\n# Write palette + receipt, and open a visual preview\nastryx theme palette generate palette.config.json \\\n --out src/themes/ocean/tokens/ocean.palette.ts \\\n --preview preview.html'},
30
30
  {type: 'prose', text: "The command writes a `.ts` file exporting 21 shades (stops 0–100) for both light and dark, plus a `.receipt.json` to regenerate later. Point your theme's tokens at the palette, then run defineTheme (see below)."},
31
- {type: 'prose', text: 'For the full palette config fields and CLI flags, run `astryx docs cli/commands/theme-palette-generate`. For the integration-authoring walkthrough of connecting a palette to theme tokens, run `astryx docs cli/integrations/building-blocks/themes/generate-a-palette`.'},
31
+ {type: 'prose', text: 'For the full palette config fields and CLI flags, run `astryx docs cli/commands/theme-palette-generate`. For the integration-authoring walkthrough of connecting a palette to theme tokens, run `astryx docs authoring/building-blocks/themes/generate-a-palette`.'},
32
32
  ],
33
33
  },
34
34
  {
@@ -61,7 +61,7 @@ export const docs = {
61
61
  ['adaptations', 'Width-breakpoint overrides merge by fixed name. Inherited ordered rules keep their relative order; child rules append and re-resolve against the child root axes.'],
62
62
  ]},
63
63
  {type: 'prose', text: "Inheritance is resolved when the theme is defined, so an extended theme is flat: `astryx theme build` emits one self-contained stylesheet holding everything the child inherited, and the base theme's CSS does not need to be loaded next to it. A base that is not a theme (most often an import that missed) throws when `defineTheme` runs, rather than producing a theme that silently inherits nothing."},
64
- {type: 'prose', text: 'For the integration-specific guidance on mapping a palette to tokens when extending, see `astryx docs cli/integrations/building-blocks/themes/define-the-theme`.'},
64
+ {type: 'prose', text: 'For the integration-specific guidance on mapping a palette to tokens when extending, see `astryx docs authoring/building-blocks/themes/define-the-theme`.'},
65
65
  ],
66
66
  },
67
67
  {
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/components/add-a-component`: choose a
4
+ * @file `astryx docs authoring/building-blocks/components/add-a-component`: choose a
5
5
  * component name and generate its first source and doc files.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/themes/add-a-theme`:
4
+ * @file `astryx docs authoring/building-blocks/themes/add-a-theme`:
5
5
  * scaffold a theme in a package — blank, or forked from an existing theme.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/docs/add-a-topic`: add a
4
+ * @file `astryx docs authoring/building-blocks/docs/add-a-topic`: add a
5
5
  * doc topic to an integration package, write its sections, and pick the doc
6
6
  * kind for each thing the package ships.
7
7
  */
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/configuration/agent-guidance`: add short lines of
4
+ * @file `astryx docs authoring/building-blocks/configuration/agent-guidance`: add short lines of
5
5
  * guidance that apps put in front of their AI agents, within the limits.
6
6
  */
7
7
 
@@ -1,27 +1,36 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
- /** @file astryx docs cli/integrations — build an integration package. */
3
+ /**
4
+ * @file `astryx docs authoring`: everything for integration authors. The
5
+ * guides build, ship, and fix an integration package; the field reference
6
+ * covers every file it holds.
7
+ */
4
8
 
5
9
  /** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
6
10
  export const docs = {
7
11
  type: 'namespace',
8
- name: 'integrations',
9
- placement: {parent: 'namespace:cli', slot: 'guides', order: 10},
10
- title: 'Build an integration',
12
+ name: 'authoring',
13
+ title: 'Authoring',
11
14
  summary:
12
- 'Build an npm package that adds components, templates, themes, docs, and codemods to Astryx apps.',
15
+ 'Build an npm package that adds components, templates, themes, docs, and codemods to Astryx apps, and look up every field of every file it holds.',
13
16
  keywords: [
17
+ 'authoring',
14
18
  'integration',
15
19
  'integration package',
16
20
  'make an integration',
17
21
  'publish an integration',
18
22
  'integration authoring',
23
+ 'authoring reference',
19
24
  ],
20
25
  slots: {
21
26
  guides: {
22
27
  title: 'Build an integration',
23
28
  accepts: {kinds: ['generic', 'namespace']},
24
29
  },
30
+ reference: {
31
+ title: 'Reference',
32
+ accepts: {kinds: ['generic']},
33
+ },
25
34
  },
26
35
  blocks: [
27
36
  {
@@ -42,7 +51,7 @@ export const docs = {
42
51
  },
43
52
  {
44
53
  type: 'prose',
45
- text: 'Every field of every file you write for an integration is in {@link generic:authoring}.',
54
+ text: 'Every field of every file you write for an integration is in {@link generic:field-reference}.',
46
55
  },
47
56
  {
48
57
  type: 'prose',
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/templates/document-the-template/block-template`:
4
+ * @file `astryx docs authoring/building-blocks/templates/document-the-template/block-template`:
5
5
  * the block-only fields: component relationships and the preview shape.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/templates/build-the-template`:
4
+ * @file `astryx docs authoring/building-blocks/templates/build-the-template`:
5
5
  * author portable template source and every asset that source needs.
6
6
  */
7
7
 
@@ -1,12 +1,12 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
- /** @file astryx docs cli/integrations/building-blocks — the kinds you can add. */
3
+ /** @file astryx docs authoring/building-blocks — the kinds you can add. */
4
4
 
5
5
  /** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
6
6
  export const docs = {
7
7
  type: 'namespace',
8
8
  name: 'building-blocks',
9
- placement: {parent: 'namespace:integrations', slot: 'guides', order: 20},
9
+ placement: {parent: 'namespace:authoring', slot: 'guides', order: 20},
10
10
  title: 'Building Blocks',
11
11
  summary:
12
12
  'Add components, templates, themes, docs, and codemods, and configure how it behaves.',
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/components/describe-the-component/check-the-props`:
4
+ * @file `astryx docs authoring/building-blocks/components/describe-the-component/check-the-props`:
5
5
  * compare each component doc's props table with the component's TypeScript
6
6
  * props, read each finding, and fix the doc or the code.
7
7
  */
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/docs/check-your-docs`:
4
+ * @file `astryx docs authoring/building-blocks/docs/check-your-docs`:
5
5
  * what each check proves about an integration's docs: the docs check, each
6
6
  * doc's fields, the read size, and the CLI peer.
7
7
  */
@@ -133,7 +133,7 @@ fix: Remove \`summary\`: SingleComponentDoc has no field \`summary\`.`,
133
133
  "The folder decides the type: `ComponentDoc` in your components root, `IntegrationTemplateDoc` in your templates root, `ThemeDoc` in your themes root, and in your docs root the type the doc's `type` names. Keep the `@type` comment above each doc's export too, so your editor shows the same problems as you type.",
134
134
  'Every finding is a warning, so the exit code stays 0. With `--json`, they are in `data.docTypes.findings`.',
135
135
  'It uses the `typescript` your package installs. Where `typescript` is missing or has no JavaScript compiler API, as TypeScript 7 does, it uses `@typescript/typescript6`, the TypeScript 6 API package, if your package installs it. Without either, it prints `[skip] Docs not type-checked` and the reason.',
136
- 'Every field of every doc type is in {@link generic:authoring}.',
136
+ 'Every field of every doc type is in {@link generic:field-reference}.',
137
137
  ],
138
138
  },
139
139
  ],
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/ship/checks`: what each package check
4
+ * @file `astryx docs authoring/ship/checks`: what each package check
5
5
  * proves, what fails and what only warns, and one command to run them all.
6
6
  */
7
7
 
@@ -32,7 +32,7 @@ export const docs = {
32
32
  '`astryx doctor integration validate`',
33
33
  'The manifest loads, each root holds contributions the CLI can read, and each doc matches its authoring type. Notes, which fail nothing, list a malformed `cliCommand` and each command a topic writes with a package runner (`runner_command`)',
34
34
  'A declared root is missing (`missing_root`), a contribution does not load (`invalid_doc`, `invalid_component`, `invalid_theme`), or two templates in the package replace one Core id (`ambiguous_template_replacement`)',
35
- "The manifest has a key this CLI does not know (`unknown_manifest_key`), or a doc field does not match the doc's authoring type: a field the type does not have, a missing required field, or a value outside the field's type. It also warns on what no reader can serve: a prop listed twice (`duplicate_prop`), a `propDescriptions` key that names no documented prop (`unknown_translated_prop`), a section with no content (`empty_section`), two sections of a topic with one key (`duplicate_section_key`), or a `.doc.zh.mjs` or `.doc.dense.mjs` overlay beside no topic file (`orphan_doc_overlay`). It checks docs with your installed `typescript`, or, where that is missing or has no JavaScript compiler API (TypeScript 7), with an installed `@typescript/typescript6`; without either, it prints `[skip] Docs not type-checked`. With no `astryx.integration.mjs` it prints a hint and exits 0",
35
+ "The manifest has a key this CLI does not know (`unknown_manifest_key`), or a doc field does not match the doc's authoring type: a field the type does not have, a missing required field, or a value outside the field's type. It also warns on what no reader can serve: a prop listed twice (`duplicate_prop`), a `propDescriptions` key that names no documented prop (`unknown_translated_prop`), a section with no content (`empty_section`), two sections of a topic with one key (`duplicate_section_key`), or a `.doc.zh.mjs` or `.doc.dense.mjs` overlay beside no topic file (`orphan_doc_overlay`). Since 0.7.3 it also lists, from source and without failing, what the package tells apps to import that they cannot: a component's import (the doc's `import`, or the one the CLI derives) or a template's public import whose subpath package.json `exports` does not declare (`component_import_not_exported`, `template_import_not_exported`) or that names another package (`component_import_other_package`); an example that imports an undeclared subpath (`example_import_not_exported`); a template that imports a path outside the templates root (`template_import_outside_root`) or a path its package or Core does not export (`template_private_import`). It lists the same way a component's import whose module does not export the component (`component_import_missing_name`), an example or a template that imports a name its package does not export (`example_import_missing_name`, `template_import_missing_name`), and a template source with no default export (`template_no_default_export`). Each is a note, printed with its fix, that fails `--strict` from the next minor; an import it cannot judge, such as an `exports` target not built yet or a deep path into a `dist/` not built yet, is listed under `publicImports` as not checked. It checks docs with your installed `typescript`, or, where that is missing or has no JavaScript compiler API (TypeScript 7), with an installed `@typescript/typescript6`; without either, it prints `[skip] Docs not type-checked`. With no `astryx.integration.mjs` it prints a hint and exits 0",
36
36
  ],
37
37
  [
38
38
  '`astryx doctor integration components`',
@@ -24,6 +24,9 @@ export const docs = {
24
24
  'docker',
25
25
  'read-only home',
26
26
  'cache the release cache',
27
+ 'agent machine',
28
+ 'restart',
29
+ 'ephemeral machine',
27
30
  ],
28
31
  description:
29
32
  "What Astryx does in CI and containers: no update checks or notices, the project's version as always, and how to cache versions or work with a read-only home folder.",
@@ -74,6 +77,16 @@ export const docs = {
74
77
  },
75
78
  ],
76
79
  },
80
+ {
81
+ id: 'short-lived',
82
+ title: 'Machines that keep only the home folder',
83
+ content: [
84
+ {
85
+ type: 'prose',
86
+ text: 'Some agent machines keep the home folder across restarts but not system folders. A global install there disappears on restart while the agent guide in the home folder stays, so agents are told to run a global astryx command that is gone; the guide says to run the command that installed the CLI, such as `npm i -g @astryxdesign/cli`, when that command is not found, and `astryx doctor` names the same step. To keep the CLI across restarts, install it into a folder in your home and put its `bin` folder on your PATH, as for a permission error ({@link generic:install-once}), or run that command when the machine starts.',
87
+ },
88
+ ],
89
+ },
77
90
  {
78
91
  id: 'more',
79
92
  title: 'More on global mode',
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/configuration/cli-command`:
4
+ * @file `astryx docs authoring/building-blocks/configuration/cli-command`:
5
5
  * name the command an integration's users run the CLI with, so every command
6
6
  * the CLI prints in their apps starts with it.
7
7
  */
@@ -14,7 +14,7 @@ export const docs = {
14
14
  name: 'cli',
15
15
  title: 'Astryx CLI',
16
16
  summary:
17
- 'Commands, programmatic APIs, integration authoring, and output contracts.',
17
+ 'Commands, programmatic APIs, and output contracts. Building an integration is under {@link namespace:authoring}.',
18
18
  keywords: ['cli', 'commands', 'api', 'reference'],
19
19
  slots: {
20
20
  guides: {title: 'Guides', accepts: {kinds: ['generic', 'namespace']}},
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/codemods`: add codemods to an
4
+ * @file `astryx docs authoring/building-blocks/codemods`: add codemods to an
5
5
  * integration package, and know which of them `astryx upgrade` runs in an app.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/components/describe-the-component/component-family`:
4
+ * @file `astryx docs authoring/building-blocks/components/describe-the-component/component-family`:
5
5
  * author one ComponentDoc for several public exports in a component family.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/components/component-imports`: make an
4
+ * @file `astryx docs authoring/building-blocks/components/component-imports`: make an
5
5
  * integration component's documented import resolve from the packed package.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/components`: guides for adding and
4
+ * @file `astryx docs authoring/building-blocks/components`: guides for adding and
5
5
  * documenting components in an integration package.
6
6
  */
7
7
 
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
- /** @file astryx docs cli/integrations/building-blocks/configuration — set how your integration behaves. */
3
+ /** @file astryx docs authoring/building-blocks/configuration — set how your integration behaves. */
4
4
 
5
5
  /** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
6
6
  export const docs = {
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/configuration/debug-and-gap-reports`: receive a record
4
+ * @file `astryx docs authoring/building-blocks/configuration/debug-and-gap-reports`: receive a record
5
5
  * of each CLI run with `debug`, and handle `astryx gap-report` with
6
6
  * `gapReport`, both named exports of the integration manifest.
7
7
  */
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/themes/define-the-theme`:
4
+ * @file `astryx docs authoring/building-blocks/themes/define-the-theme`:
5
5
  * map the palette to tokens, keep light-dark() to colors, and avoid Core internals.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/components/describe-the-component`:
4
+ * @file `astryx docs authoring/building-blocks/components/describe-the-component`:
5
5
  * choose and maintain the ComponentDoc shape that matches a component's public
6
6
  * source.
7
7
  */
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/docs`: the guides to
4
+ * @file `astryx docs authoring/building-blocks/docs`: the guides to
5
5
  * writing docs for an integration package, which join the same docs tree as
6
6
  * the CLI's own (spec:AST-046, spec:AST-047).
7
7
  */
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/templates/document-the-template`:
4
+ * @file `astryx docs authoring/building-blocks/templates/document-the-template`:
5
5
  * document page and block templates for discovery and correct reuse.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/themes/document-the-theme`:
4
+ * @file `astryx docs authoring/building-blocks/themes/document-the-theme`:
5
5
  * document a theme by extending the core theme topic, not in agent guidance.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/templates/build-the-template/package-and-test/export-template-assets`:
4
+ * @file `astryx docs authoring/building-blocks/templates/build-the-template/package-and-test/export-template-assets`:
5
5
  * expose and include everything a copied template imports, and declare the
6
6
  * packages it needs.
7
7
  */
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/docs/extend-or-replace`:
4
+ * @file `astryx docs authoring/building-blocks/docs/extend-or-replace`:
5
5
  * take over an existing topic with `replaces`, merge sections into one with
6
6
  * `extends`, and check overlaps with Core topics.
7
7
  */
@@ -1,14 +1,15 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs authoring`: every authoring schema, one section each.
4
+ * @file `astryx docs authoring/field-reference`: every authoring schema, one
5
+ * section each. `astryx docs authoring <name>` reads one of them.
5
6
  *
6
7
  * Built from the self-docs colocated under packages/cli/authoring, so it cannot
7
8
  * drift from the schemas it describes. `astryx doctor` names a self-doc this
8
- * topic cannot reach.
9
+ * guide cannot reach.
9
10
  */
10
11
 
11
- import {buildAuthoringTopic} from '../../foundation/discovery/authoring-self-docs.mjs';
12
+ import {buildAuthoringTopic} from '../../../foundation/discovery/authoring-self-docs.mjs';
12
13
 
13
14
  /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
14
15
  export const docs = await buildAuthoringTopic();
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/themes/fonts-and-assets`:
4
+ * @file `astryx docs authoring/building-blocks/themes/fonts-and-assets`:
5
5
  * ship a theme's optional font loader beside its built module and CSS.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file `astryx docs cli/integrations/building-blocks/themes/generate-a-palette`:
4
+ * @file `astryx docs authoring/building-blocks/themes/generate-a-palette`:
5
5
  * turn a few seed colors into a full light and dark color palette.
6
6
  */
7
7