@astryxdesign/cli 0.6.3-canary.7ada42e → 0.6.3-canary.7ec7be0

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 (221) hide show
  1. package/README.md +21 -19
  2. package/api/build/_adapter.d.mts +50 -0
  3. package/api/build/_adapter.mjs +60 -0
  4. package/api/build/build.doc.mjs +13 -7
  5. package/api/build/build.test.mjs +184 -6
  6. package/api/build/build.type.d.mts +57 -2
  7. package/api/build/build.type.mjs +30 -7
  8. package/api/build/help/help.d.mts +4 -0
  9. package/api/build/help/help.mjs +24 -11
  10. package/api/build/kit/kit.d.mts +4 -1
  11. package/api/build/kit/kit.mjs +165 -49
  12. package/api/build/kit/rank.d.mts +44 -0
  13. package/api/build/kit/rank.mjs +432 -0
  14. package/api/build/kit/rank.test.mjs +196 -0
  15. package/api/component/_adapter.d.mts +6 -12
  16. package/api/component/_adapter.mjs +20 -10
  17. package/api/component/component.mjs +60 -12
  18. package/api/component/list/list.mjs +3 -2
  19. package/api/docs/_adapter.d.mts +251 -28
  20. package/api/docs/_adapter.mjs +918 -35
  21. package/api/docs/detail/detail.mjs +11 -3
  22. package/api/docs/detail/section/section.mjs +24 -13
  23. package/api/docs/detail/section/section.test.mjs +15 -6
  24. package/api/docs/docs.d.mts +5 -3
  25. package/api/docs/docs.doc.mjs +38 -17
  26. package/api/docs/docs.mjs +44 -8
  27. package/api/docs/docs.test.mjs +158 -4
  28. package/api/docs/docs.type.d.mts +181 -2
  29. package/api/docs/docs.type.mjs +117 -3
  30. package/api/docs/index/index.mjs +11 -3
  31. package/api/docs/index/index.test.mjs +1 -1
  32. package/api/docs/integration-tree.test.mjs +555 -0
  33. package/api/docs/integrationDocs.test.mjs +14 -14
  34. package/api/docs/list/list.mjs +25 -5
  35. package/api/docs/node/node.d.mts +43 -0
  36. package/api/docs/node/node.mjs +192 -0
  37. package/api/docs/reference-blocks.test.mjs +406 -0
  38. package/api/doctor/doctor.d.mts +30 -2
  39. package/api/doctor/doctor.mjs +151 -8
  40. package/api/doctor/doctor.test.mjs +95 -7
  41. package/api/index.d.mts +1 -1
  42. package/api/index.mjs +1 -0
  43. package/api/init/init.doc.mjs +1 -1
  44. package/api/integration/add-contribution.d.mts +2 -1
  45. package/api/integration/add-contribution.mjs +107 -5
  46. package/api/integration/add-contribution.test.mjs +137 -0
  47. package/api/integration/authoring-checks.mjs +138 -28
  48. package/api/integration/authoring-checks.test.mjs +171 -3
  49. package/api/integration/authoring-checks.type.mjs +6 -1
  50. package/api/integration/integration-authoring.type.d.mts +2 -0
  51. package/api/integration/integration-authoring.type.mjs +2 -0
  52. package/api/integration/integrationAdd.doc.mjs +6 -0
  53. package/api/integration/integrationAddDoc.doc.mjs +7 -1
  54. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  55. package/api/integration/integrationPackCheck.doc.mjs +1 -1
  56. package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
  57. package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
  58. package/api/integration/pack-check.mjs +34 -0
  59. package/api/integration/pack-check.test.mjs +121 -0
  60. package/api/integration/pack-check.type.d.mts +26 -2
  61. package/api/integration/pack-check.type.mjs +14 -1
  62. package/api/integration/template-conflict-compatibility.test.mjs +73 -0
  63. package/api/integration/validate-integration.test.mjs +3 -3
  64. package/api/integration/validateIntegration.doc.mjs +1 -1
  65. package/api/json/index.ts +2 -0
  66. package/api/layout/_adapter.mjs +20 -5
  67. package/api/search/search.d.mts +59 -1
  68. package/api/search/search.doc.mjs +4 -3
  69. package/api/search/search.mjs +442 -71
  70. package/api/search/search.test.mjs +91 -2
  71. package/api/search/search.type.d.mts +13 -1
  72. package/api/search/search.type.mjs +4 -1
  73. package/api/template/list/list.mjs +1 -0
  74. package/api/template/table-floating-bulk-actions.test.mjs +66 -0
  75. package/api/template/template-integration.test.mjs +1072 -3
  76. package/api/template/template.doc.mjs +27 -7
  77. package/api/template/template.mjs +45 -8
  78. package/api/template/template.type.d.mts +6 -8
  79. package/api/template/template.type.mjs +3 -2
  80. package/api/theme/template/template.test.mjs +5 -0
  81. package/api/theme/themeTemplate.doc.mjs +1 -1
  82. package/assets/docs/getting-started.doc.mjs +2 -2
  83. package/assets/docs/layout.doc.dense.mjs +2 -2
  84. package/assets/docs/layout.doc.mjs +1 -1
  85. package/assets/docs/principles.doc.mjs +6 -6
  86. package/assets/docs/styling-libraries.doc.mjs +3 -3
  87. package/assets/docs/styling.doc.mjs +4 -4
  88. package/assets/docs/theme.doc.mjs +4 -4
  89. package/assets/docs/tokens.doc.mjs +1 -1
  90. package/assets/docs/tree/api.doc.mjs +30 -0
  91. package/assets/docs/tree/cli.doc.mjs +23 -0
  92. package/assets/docs/tree/commands.doc.mjs +25 -0
  93. package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
  94. package/assets/docs/tree/integrations.test.mjs +62 -0
  95. package/assets/docs/tree/writing-docs.doc.mjs +286 -0
  96. package/assets/docs/working-with-ai.doc.mjs +3 -3
  97. package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
  98. package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
  99. package/assets/templates/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
  100. package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
  101. package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
  102. package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
  103. package/authoring/debug/parse.d.mts +3 -3
  104. package/authoring/doctypes/_schema.d.mts +119 -117
  105. package/authoring/doctypes/_schema.mjs +54 -3
  106. package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
  107. package/authoring/doctypes/base/type.ts +6 -5
  108. package/authoring/doctypes/command/command.doc.mjs +1 -1
  109. package/authoring/doctypes/command/type.ts +2 -2
  110. package/authoring/doctypes/enum/enum.doc.mjs +1 -1
  111. package/authoring/doctypes/enum/type.ts +1 -1
  112. package/authoring/doctypes/function/function.doc.mjs +3 -2
  113. package/authoring/doctypes/function/type.ts +3 -2
  114. package/authoring/doctypes/load-contract.test.mjs +26 -1
  115. package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
  116. package/authoring/doctypes/namespace/parse.test.mjs +23 -25
  117. package/authoring/doctypes/namespace/type.ts +5 -2
  118. package/authoring/doctypes/parse.mjs +3 -2
  119. package/authoring/doctypes/reference/reference.doc.mjs +34 -5
  120. package/authoring/doctypes/reference/type.ts +28 -11
  121. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  122. package/authoring/doctypes/schema/type.ts +1 -1
  123. package/authoring/doctypes/template/parse.d.mts +2 -0
  124. package/authoring/doctypes/template/parse.mjs +4 -0
  125. package/authoring/doctypes/template/parse.test.mjs +18 -0
  126. package/authoring/doctypes/template/template.doc.mjs +6 -0
  127. package/authoring/doctypes/template/type.ts +8 -0
  128. package/authoring/identity/identity.doc.mjs +2 -2
  129. package/authoring/index.d.ts +1 -0
  130. package/authoring/integration/type.ts +1 -1
  131. package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
  132. package/clients/cli/commands/build-theme.mjs +1 -1
  133. package/clients/cli/commands/build.doc.mjs +11 -6
  134. package/clients/cli/commands/build.mjs +105 -67
  135. package/clients/cli/commands/build.text-fields.test.mjs +41 -0
  136. package/clients/cli/commands/component/index.mjs +1 -1
  137. package/clients/cli/commands/component-ownership.test.mjs +3 -3
  138. package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
  139. package/clients/cli/commands/discover.mjs +1 -1
  140. package/clients/cli/commands/docs.doc.mjs +20 -8
  141. package/clients/cli/commands/docs.mjs +183 -69
  142. package/clients/cli/commands/docs.test.mjs +120 -16
  143. package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
  144. package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
  145. package/clients/cli/commands/doctor-integration.test.mjs +75 -1
  146. package/clients/cli/commands/doctor.mjs +53 -16
  147. package/clients/cli/commands/integration-add.doc.mjs +10 -0
  148. package/clients/cli/commands/integration.mjs +1 -0
  149. package/clients/cli/commands/search.mjs +11 -2
  150. package/clients/cli/commands/setup-nudge.test.mjs +6 -0
  151. package/clients/cli/commands/template.doc.mjs +23 -6
  152. package/clients/cli/commands/template.mjs +4 -91
  153. package/clients/cli/index.mjs +8 -0
  154. package/clients/cli/lib/manifest.mjs +9 -2
  155. package/foundation/agent-docs/agent-docs.d.mts +3 -2
  156. package/foundation/agent-docs/agent-docs.mjs +13 -9
  157. package/foundation/agent-docs/agent-docs.test.mjs +19 -1
  158. package/foundation/config/project.d.mts +12 -11
  159. package/foundation/config/project.mjs +73 -59
  160. package/foundation/config/project.test.mjs +141 -5
  161. package/foundation/discovery/authoring-self-docs.d.mts +12 -0
  162. package/foundation/discovery/authoring-self-docs.mjs +20 -8
  163. package/foundation/discovery/authoring-self-docs.test.mjs +25 -9
  164. package/foundation/discovery/cli-self-docs.d.mts +40 -34
  165. package/foundation/discovery/cli-self-docs.mjs +91 -115
  166. package/foundation/discovery/cli-self-docs.test.mjs +104 -166
  167. package/foundation/discovery/component-discovery.d.mts +38 -0
  168. package/foundation/discovery/component-discovery.mjs +48 -0
  169. package/foundation/discovery/docs-discovery.d.mts +109 -9
  170. package/foundation/discovery/docs-discovery.mjs +223 -24
  171. package/foundation/discovery/docs-discovery.test.mjs +103 -27
  172. package/foundation/discovery/docs-output-budget.d.mts +2 -2
  173. package/foundation/discovery/docs-output-budget.mjs +1 -1
  174. package/foundation/discovery/docs-section-key.d.mts +28 -10
  175. package/foundation/discovery/docs-section-key.mjs +134 -33
  176. package/foundation/discovery/docs-section-key.test.mjs +41 -19
  177. package/foundation/discovery/template-adapter.d.mts +92 -6
  178. package/foundation/discovery/template-adapter.mjs +453 -17
  179. package/foundation/discovery/template-adapter.test.mjs +42 -0
  180. package/foundation/discovery/template-conflict-release.d.mts +13 -0
  181. package/foundation/discovery/template-conflict-release.mjs +40 -0
  182. package/foundation/discovery/template-conflict-release.test.mjs +40 -0
  183. package/foundation/doc-compiler/bundle.mjs +61 -1
  184. package/foundation/doc-compiler/bundle.test.mjs +21 -10
  185. package/foundation/doc-compiler/compile.d.mts +113 -132
  186. package/foundation/doc-compiler/compile.mjs +57 -10
  187. package/foundation/doc-compiler/diagnostics.mjs +28 -0
  188. package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
  189. package/foundation/doc-compiler/inputs.d.mts +2 -2
  190. package/foundation/doc-compiler/inputs.mjs +6 -1
  191. package/foundation/doc-compiler/ir.mjs +7 -0
  192. package/foundation/doc-compiler/lenses.d.mts +8 -5
  193. package/foundation/doc-compiler/lenses.mjs +50 -4
  194. package/foundation/doc-compiler/links.d.mts +162 -0
  195. package/foundation/doc-compiler/links.mjs +294 -0
  196. package/foundation/doc-compiler/links.test.mjs +192 -0
  197. package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
  198. package/foundation/doc-compiler/read.d.mts +3 -2
  199. package/foundation/doc-compiler/read.mjs +6 -1
  200. package/foundation/doc-compiler/tree.d.mts +288 -0
  201. package/foundation/doc-compiler/tree.mjs +876 -0
  202. package/foundation/doc-compiler/tree.test.mjs +598 -0
  203. package/foundation/integrations/autolink.test.mjs +1 -1
  204. package/foundation/integrations/cli-requirement.d.mts +45 -0
  205. package/foundation/integrations/cli-requirement.mjs +154 -0
  206. package/foundation/integrations/cli-requirement.test.mjs +84 -0
  207. package/foundation/integrations/contribution-inventory.d.mts +2 -1
  208. package/foundation/integrations/contribution-inventory.mjs +10 -4
  209. package/foundation/integrations/contribution-inventory.test.mjs +19 -0
  210. package/foundation/integrations/integration-warnings.d.mts +9 -2
  211. package/foundation/integrations/integration-warnings.mjs +51 -26
  212. package/foundation/integrations/integration-warnings.test.mjs +74 -1
  213. package/foundation/integrations/validate-contributions.mjs +25 -27
  214. package/foundation/response/response-types.doc.d.mts +5 -1
  215. package/foundation/response/response-types.doc.mjs +19 -10
  216. package/foundation/text/string-utils.d.mts +8 -0
  217. package/foundation/text/string-utils.mjs +18 -0
  218. package/foundation/xle/expand.mjs +1 -1
  219. package/foundation/xle/xle.test.mjs +13 -0
  220. package/package.json +9 -9
  221. package/assets/docs/cli.doc.mjs +0 -15
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'NamespaceDoc',
13
13
  namespace: 'authoring',
14
14
  description:
15
- "Declares named navigation slots and renderer-neutral layout blocks for already-discovered docs. It never scans folders or copies child documents. Not loaded yet: only the docs graph reads namespace docs, and it is not built, so keep them out of an integration's docs directory for now.",
15
+ "Declares one level of the docs tree: named slots, and adoption rules for already-discovered docs. It never scans folders, lists its children, or copies child documents: a child names its parent with `placement`, or a namespace adopts a discovery group. `astryx docs <route>` lists each slot's children one level down. The CLI keeps its namespace docs in its docs tree directory; an integration ships its own in its docs directory, and they appear in `astryx docs` beside the CLI's.",
16
16
  appliesTo: '<namespace>.doc.mjs',
17
17
  fields: [
18
18
  {
@@ -44,13 +44,13 @@ export const doc = {
44
44
  name: 'placement',
45
45
  type: 'DocPlacement',
46
46
  description:
47
- 'Optional canonical parent request: {parent, slot?, order?}. Invalid explicit placement will fail compilation instead of falling back.',
47
+ 'Optional canonical parent: {parent, slot?, order?}. `parent` names a namespace of the same package as `namespace:<name>`. An invalid placement withdraws the namespace with a diagnostic; it never falls back.',
48
48
  },
49
49
  {
50
50
  name: 'aliases',
51
51
  type: 'string[]',
52
52
  description:
53
- 'Prior names or routes the docs graph will keep resolving to this doc.',
53
+ 'Prior names or routes the docs tree will keep resolving to this doc. Not read yet.',
54
54
  },
55
55
  {
56
56
  name: 'audience',
@@ -78,9 +78,9 @@ export const doc = {
78
78
  },
79
79
  {
80
80
  name: 'blocks',
81
- type: 'ReferenceContentBlock[]',
81
+ type: '(ReferenceContentBlock | GraphContentBlock)[]',
82
82
  description:
83
- 'Ordered layout content. V1 adds only workflow, collection, and reference to the existing prose, heading, code, table, list, and token-ref blocks.',
83
+ 'Ordered layout content for the namespace page. Graph-only workflow, collection, and reference blocks are available here without widening the stable ReferenceContentBlock union used by existing topic renderers. Not rendered yet: `astryx docs <route>` lists every slot and its children in order.',
84
84
  },
85
85
  ],
86
86
  examples: [
@@ -103,17 +103,13 @@ export const docs = {
103
103
  source: {group: 'cli-commands', kinds: ['command']},
104
104
  into: 'reference',
105
105
  }],
106
- blocks: [
107
- {type: 'collection', source: {slot: 'guides'}, presentation: 'cards'},
108
- {type: 'collection', source: {slot: 'reference'}, presentation: 'compact'},
109
- ],
110
106
  };`,
111
107
  },
112
108
  ],
113
109
  notes: [
114
110
  {
115
111
  type: 'prose',
116
- text: "Namespace docs are not loaded yet. Only the docs graph reads them, and it is not built. A namespace doc in an integration's docs directory fails to load as a topic, and with it every topic that package contributes, until the file is removed.",
112
+ text: "The docs tree reads namespace docs from the CLI and from every configured integration. An integration's namespace doc is a top-level level of the tree, and its guides name it with `placement`; a doc can be placed only in a namespace of its own package. When two packages claim one route, the CLI's own docs win, then integrations in configured order, and `astryx doctor` names the loser.",
117
113
  },
118
114
  {
119
115
  type: 'prose',
@@ -134,32 +134,30 @@ describe('NamespaceDoc', () => {
134
134
  });
135
135
  });
136
136
 
137
- describe('semantic blocks in existing docs', () => {
138
- it('accepts workflow, collection, and reference in a ReferenceDoc section', () => {
139
- const parsed = parseReference({
140
- type: 'generic',
141
- name: 'publishing',
142
- title: 'Publishing',
143
- description: 'Publish an integration.',
144
- sections: [
145
- {
146
- id: 'start',
147
- title: 'Start',
148
- content: namespaceDoc.blocks,
149
- },
150
- ],
151
- });
152
- expect(parsed.sections[0].id).toBe('start');
153
- expect(parsed.sections[0].content.map(block => block.type)).toEqual([
154
- 'workflow',
155
- 'collection',
156
- 'reference',
157
- ]);
137
+ describe('semantic graph blocks', () => {
138
+ it('keeps graph-only blocks out of the stable ReferenceDoc section union', () => {
139
+ expect(() =>
140
+ parseReference({
141
+ type: 'generic',
142
+ name: 'publishing',
143
+ title: 'Publishing',
144
+ description: 'Publish an integration.',
145
+ sections: [
146
+ {
147
+ id: 'start',
148
+ title: 'Start',
149
+ content: namespaceDoc.blocks,
150
+ },
151
+ ],
152
+ }),
153
+ ).toThrow(/Invalid discriminator value/u);
158
154
  });
159
155
 
160
- it('rejects an unknown stamped doc kind instead of treating it as legacy', () => {
161
- expect(() => parseDoc({type: 'choice', name: 'x', props: []})).toThrow(
162
- /unsupported type "choice"/u,
163
- );
156
+ it('keeps shape-sniffing an unknown stamp for 0.6.x compatibility', () => {
157
+ expect(parseDoc({type: 'choice', name: 'x', props: []})).toMatchObject({
158
+ type: 'choice',
159
+ name: 'x',
160
+ props: [],
161
+ });
164
162
  });
165
163
  });
@@ -7,7 +7,10 @@
7
7
  */
8
8
 
9
9
  import type {AuthoredDocGraphFields, AuthoredDocKind} from '../base/type.js';
10
- import type {ReferenceContentBlock} from '../reference/type.js';
10
+ import type {
11
+ GraphContentBlock,
12
+ ReferenceContentBlock,
13
+ } from '../reference/type.js';
11
14
 
12
15
  /** Which providers may contribute appearances to a namespace slot. */
13
16
  export type NamespaceProviderScope = 'same' | 'configured';
@@ -67,5 +70,5 @@ export interface NamespaceDoc extends AuthoredDocGraphFields {
67
70
  /** Optional source-adoption rules for otherwise-unplaced docs. */
68
71
  adopts?: NamespaceAdoptionRule[];
69
72
  /** Ordered renderer-neutral content and collection blocks. */
70
- blocks?: ReferenceContentBlock[];
73
+ blocks?: (ReferenceContentBlock | GraphContentBlock)[];
71
74
  }
@@ -67,8 +67,9 @@ export function parseDoc(input, label = 'doc') {
67
67
  case 'theme':
68
68
  return parseTheme(input, label);
69
69
  case undefined:
70
- return parseLegacyDoc(input, label);
71
70
  default:
72
- throw new Error(`${label} has unsupported type ${JSON.stringify(type)}.`);
71
+ // 0.6.x shape-sniffed unknown stamps. Keep accepting them through the
72
+ // patch compatibility window; canonical writers emit a known stamp.
73
+ return parseLegacyDoc(input, label);
73
74
  }
74
75
  }
@@ -93,9 +93,9 @@ export const doc = {
93
93
  },
94
94
  {
95
95
  name: 'sections[].content',
96
- type: 'ReferenceContentBlock[]',
96
+ type: '(ReferenceContentBlock | ReferenceDocBlock)[]',
97
97
  description:
98
- 'Ordered content blocks: prose, heading, code, table, list, and token-ref. workflow, collection, and reference are declared for the docs graph and parse, but a topic that uses one fails to load until the docs graph ships.',
98
+ "Ordered content blocks: prose, heading, code, table, list, token-ref, and reference. A `reference` block (`{type: 'reference', target, projection?, presentation?}`) includes another doc from its canonical source instead of a copy: a schema, command, function, or enum doc as `astryx docs` prints it, then the command that opens it. `projection.fields` keeps only those fields of a schema; `presentation` is `full` (the default), `compact` (no code blocks), or `summary` (only the doc's title, summary, and command). Any other doc shows as a summary. Graph-only workflow and collection blocks are available through GraphContentBlock on NamespaceDoc, without widening the stable ReferenceContentBlock union. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.",
99
99
  required: true,
100
100
  },
101
101
  {
@@ -144,7 +144,27 @@ export const docs = {
144
144
  },
145
145
  {
146
146
  type: 'prose',
147
- text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, a discriminated union. workflow, collection, and reference are declared for the docs graph: they parse, but topic loading rejects them until the docs graph ships. choice, callout, and checklist remain invalid. The same union is reused by the `notes` field on SchemaDoc and CommandDoc.',
147
+ text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref, plus the reference block (ReferenceDocBlock). A read inlines a reference block the way it inlines a token-ref, so `astryx docs`, in text and in `--json`, returns only the stable block kinds. Docs-graph-only workflow and collection blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.',
148
+ },
149
+ {
150
+ type: 'prose',
151
+ text: "A reference block includes content, where a link only points at it: `astryx doctor integration docs` fails when its target names no doc, when `projection.fields` names a field the schema does not have, or when the doc cannot take the projection or presentation it sets, and a read marks the missing content. A target without a provider names a doc of the package that wrote it, so an integration names the CLI's docs with the CLI's provider, as in `@astryxdesign/cli:schema:integration`.",
152
+ },
153
+ {
154
+ type: 'code',
155
+ lang: 'js',
156
+ label: 'A section that includes two fields of the integration manifest',
157
+ code: `{
158
+ title: 'Point the manifest at your folders',
159
+ content: [
160
+ {type: 'prose', text: 'Add these fields to astryx.integration.mjs.'},
161
+ {
162
+ type: 'reference',
163
+ target: '@astryxdesign/cli:schema:integration',
164
+ projection: {fields: ['components', 'docs']},
165
+ },
166
+ ],
167
+ }`,
148
168
  },
149
169
  {
150
170
  type: 'code',
@@ -156,10 +176,19 @@ export const docs = {
156
176
  | { type: 'code'; lang: string; code: string; label?: string }
157
177
  | { type: 'table'; headers: string[]; rows: string[][] }
158
178
  | { type: 'list'; style: 'ordered' | 'unordered' | 'do' | 'dont'; items: string[] }
159
- | { type: 'token-ref'; topic: string; section: string }
179
+ | { type: 'token-ref'; topic: string; section: string };
180
+
181
+ type ReferenceDocBlock = {
182
+ type: 'reference';
183
+ target: string;
184
+ projection?: { fields?: string[]; sections?: string[] };
185
+ presentation?: 'summary' | 'compact' | 'full';
186
+ };
187
+
188
+ type GraphContentBlock =
160
189
  | { type: 'workflow'; title?: string; steps: WorkflowStep[] }
161
190
  | { type: 'collection'; source: {slot: string}; presentation?: 'list' | 'cards' | 'compact'; whenEmpty?: 'show' | 'omit' }
162
- | { type: 'reference'; target: string; projection?: {fields?: string[]; sections?: string[]} };`,
191
+ | ReferenceDocBlock;`,
163
192
  },
164
193
  {
165
194
  type: 'prose',
@@ -30,19 +30,37 @@ export interface CollectionDocBlock {
30
30
  whenEmpty?: 'show' | 'omit';
31
31
  }
32
32
 
33
- /** A bounded projection of one canonical doc. */
33
+ /**
34
+ * A bounded projection of one canonical doc. In a namespace doc's `blocks` it
35
+ * is layout the docs tree renders later. In a topic section, a read includes
36
+ * the doc it names in place of the block: a schema, command, function, or
37
+ * enum doc as `astryx docs` prints it (`projection.fields` keeps only those
38
+ * fields of a schema), then the command that opens that doc. Any other doc
39
+ * shows its title and summary.
40
+ */
34
41
  export interface ReferenceDocBlock {
35
42
  type: 'reference';
43
+ /** The doc it names, by identity: `[<provider>:]<kind>:<name>`. */
36
44
  target: string;
37
45
  projection?: {
38
46
  fields?: string[];
39
47
  sections?: string[];
40
48
  };
49
+ /** `summary`: only the doc's title, summary, and the command that opens it.
50
+ * `compact`: the included doc without its code blocks. `full`, the default:
51
+ * the included doc. */
41
52
  presentation?: 'summary' | 'compact' | 'full';
42
53
  }
43
54
 
55
+ /** Graph-only content blocks, for a namespace doc's `blocks`. These are
56
+ * additive and do not widen the stable {@link ReferenceContentBlock} union
57
+ * consumed by existing exhaustive renderers. A topic section accepts the
58
+ * `reference` block too, and a read inlines it as stable blocks. */
59
+ export type GraphContentBlock =
60
+ WorkflowDocBlock | CollectionDocBlock | ReferenceDocBlock;
61
+
44
62
  /**
45
- * A content block within a reference doc section or namespace.
63
+ * A content block within a reference doc section.
46
64
  * Ordered arrays of these blocks form renderer-neutral documentation content.
47
65
  * A new semantic kind must ship with every renderer or fail visibly at a legacy
48
66
  * reader boundary until that renderer is available.
@@ -55,12 +73,12 @@ export interface ReferenceDocBlock {
55
73
  * { type: 'table', headers: ['Token', 'Value'], rows: [['--spacing-4', '16px']] }
56
74
  * { type: 'list', style: 'do', items: ['Use semantic tokens'] }
57
75
  * { type: 'token-ref', topic: 'tokens', section: 'Color Tokens' }
58
- * { type: 'workflow', steps: [{title: 'Validate', references: ['command:doctor']}] }
59
- * { type: 'collection', source: {slot: 'guides'}, presentation: 'cards' }
60
- * { type: 'reference', target: 'schema:integration', projection: {fields: ['docs']} }
76
+ * { type: 'prose', text: 'Check it with {@link command:doctor}.' }
61
77
  * ```
62
78
  */
63
79
  export type ReferenceContentBlock =
80
+ /** Text. `{@link [<provider>:]<kind>:<name>}` inside it links another doc
81
+ * by identity; `astryx docs` prints the command that opens that doc. */
64
82
  | {type: 'prose'; text: string}
65
83
  | {type: 'heading'; level: 3 | 4 | 5 | 6; text: string}
66
84
  | {type: 'code'; lang: string; code: string; label?: string}
@@ -80,10 +98,7 @@ export type ReferenceContentBlock =
80
98
  topic: string;
81
99
  /** Section title to pull from that topic. e.g. `'Color Tokens'` */
82
100
  section: string;
83
- }
84
- | WorkflowDocBlock
85
- | CollectionDocBlock
86
- | ReferenceDocBlock;
101
+ };
87
102
 
88
103
  /**
89
104
  * A reference documentation file (.doc.mjs).
@@ -146,8 +161,10 @@ export interface ReferenceSection {
146
161
  /** Navigation category ('guide' | 'foundations'). Mirrors the parent doc's
147
162
  * category so sections can be grouped independently in the docsite nav. */
148
163
  category?: string;
149
- /** Ordered content blocks. Mix prose, code, tables, and lists freely. */
150
- content: ReferenceContentBlock[];
164
+ /** Ordered content blocks. Mix prose, code, tables, and lists freely. A
165
+ * `reference` block includes another doc from its canonical source, so a
166
+ * guide never copies a schema's fields or a command's options. */
167
+ content: (ReferenceContentBlock | ReferenceDocBlock)[];
151
168
  /** Preview type for token tables in this section. When set, the docsite
152
169
  * renders a visual preview column using the token's computed CSS value
153
170
  * from the current theme. Omit for non-token sections. */
@@ -49,7 +49,7 @@ export const doc = {
49
49
  name: 'namespace',
50
50
  type: 'string',
51
51
  description:
52
- "The `astryx docs` topic that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the section `api-<name>` of the `cli` topic). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads.",
52
+ "The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
53
53
  },
54
54
  {
55
55
  name: 'aliases',
@@ -47,7 +47,7 @@ export interface SchemaDoc extends AuthoredDocGraphFields {
47
47
  displayName: string;
48
48
  /** One-line summary shown in listings. */
49
49
  description: string;
50
- /** The `astryx docs` topic that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the section `api-<name>` of the `cli` topic). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that no topic reads. */
50
+ /** The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
51
51
  namespace?: string;
52
52
  /** Alternate slugs that also resolve to this doc (back-compat). */
53
53
  aliases?: string[];
@@ -56,6 +56,7 @@ declare const pageTemplateSchema: z.ZodObject<{
56
56
  slug: z.ZodOptional<z.ZodString>;
57
57
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
58
58
  }, z.core.$strict>>;
59
+ replaces: z.ZodOptional<z.ZodString>;
59
60
  placement: z.ZodOptional<z.ZodObject<{
60
61
  parent: z.ZodString;
61
62
  slot: z.ZodOptional<z.ZodString>;
@@ -91,6 +92,7 @@ declare const blockTemplateSchema: z.ZodObject<{
91
92
  slug: z.ZodOptional<z.ZodString>;
92
93
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
94
  }, z.core.$strict>>;
95
+ replaces: z.ZodOptional<z.ZodString>;
94
96
  placement: z.ZodOptional<z.ZodObject<{
95
97
  parent: z.ZodString;
96
98
  slot: z.ZodOptional<z.ZodString>;
@@ -51,6 +51,10 @@ const baseTemplateFields = {
51
51
  scaffold: z.boolean().optional(),
52
52
  isHiddenFromOverview: z.boolean().optional(),
53
53
  registry: registryIdentitySchema.optional(),
54
+ replaces: z
55
+ .string()
56
+ .min(1, 'replaces must name a Core template id')
57
+ .optional(),
54
58
  };
55
59
 
56
60
  const pageTemplateSchema = z
@@ -22,6 +22,24 @@ function reason(value, label = 'template') {
22
22
  }
23
23
 
24
24
  describe('parseTemplate (load boundary)', () => {
25
+ it('accepts replaces on page and block templates', () => {
26
+ for (const type of ['page', 'block']) {
27
+ const parsed = parseTemplate({
28
+ type,
29
+ name: 'Acme shell',
30
+ description: 'Replaces a Core template.',
31
+ replaces: 'shell-side-nav',
32
+ });
33
+ expect(parsed.replaces).toBe('shell-side-nav');
34
+ }
35
+ });
36
+
37
+ it('rejects an empty replaces', () => {
38
+ expect(reason({type: 'page', name: 'Acme shell', replaces: ''})).toMatch(
39
+ /replaces must name a Core template id/,
40
+ );
41
+ });
42
+
25
43
  it('accepts a stamped page template', () => {
26
44
  const parsed = parseTemplate({
27
45
  type: 'page',
@@ -52,6 +52,12 @@ export const doc = {
52
52
  type: 'string',
53
53
  description: 'One-sentence description of what the template provides.',
54
54
  },
55
+ {
56
+ name: 'replaces',
57
+ type: 'string',
58
+ description:
59
+ "Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.7.0 or later: earlier CLIs reject the field and withhold the package's templates and doc topics.",
60
+ },
55
61
  {
56
62
  name: 'isReady',
57
63
  type: 'boolean',
@@ -28,6 +28,14 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
28
28
 
29
29
  /** Optional stable slug override and prior aliases for registry output. */
30
30
  registry?: RegistryDocIdentity;
31
+
32
+ /** Integration templates only: the exact id of the Core template this one
33
+ * replaces for unqualified lookup (find it with
34
+ * `astryx --json template --list --package @astryxdesign/core`). The Core
35
+ * original stays selectable with `--package @astryxdesign/core`. Needs
36
+ * `@astryxdesign/cli` 0.7.0 or later: earlier CLIs reject the field and
37
+ * withhold the package's templates and doc topics. */
38
+ replaces?: string;
31
39
  /** Whether this template is ready for use. Templates with
32
40
  * isReady: false show as "(WIP)" in the gallery and CLI. */
33
41
  isReady?: boolean;
@@ -12,9 +12,9 @@ export const doc = {
12
12
  displayName: 'Provider and artifact identity',
13
13
  namespace: 'authoring',
14
14
  description:
15
- 'Separates stable provider/artifact identity from package instances and runtime lifecycle state. providerId is in use today: an integration manifest may declare it, and Doctor and every command report two packages that claim one. The artifact, doc, instance, and compiler-input identities are defined for the docs graph, which is not built yet, and no command reads them.',
15
+ 'Separates stable provider/artifact identity from package instances and runtime lifecycle state. Provider identity names integration manifests and settles provider conflicts. Docs-tree nodes are identified by doc identity; the tree covers the CLI\'s own docs. Artifact, instance, and compiler-input identities are defined for every provider-owned artifact; no command reads them.',
16
16
  appliesTo:
17
- 'Integration manifests and provider conflicts today; the docs graph once it ships',
17
+ 'Integration manifests, provider conflicts, and docs-tree node ids.',
18
18
  fields: [
19
19
  {
20
20
  name: 'ProviderId',
@@ -131,6 +131,7 @@ export type {
131
131
  // reference
132
132
  ReferenceSection,
133
133
  ReferenceContentBlock,
134
+ GraphContentBlock,
134
135
  ReferenceTokenPreviewType,
135
136
  ReferenceTranslationDoc,
136
137
  WorkflowStep,
@@ -11,7 +11,7 @@
11
11
  * The manifest module may also carry `debug` and `gapReport` NAMED exports.
12
12
  * They are not fields here on purpose: a CLI released before a given manifest
13
13
  * field existed could reject it and lose every contribution, while an unknown
14
- * named export is simply not read. See the `cli-integrations` doc topic.
14
+ * named export is simply not read. See `astryx docs cli/integrations`.
15
15
  */
16
16
  export interface AstryxIntegration {
17
17
  /** Stable logical provider ID. Omit to use package.json#name. Set this only
@@ -3,7 +3,8 @@
3
3
  /**
4
4
  * @file Ensures `astryx theme build` preserves AST-012 adaptation semantics.
5
5
  * Runtime and static output share core's compiler; this suite guards the CLI
6
- * loading, diagnostics, serialization, and extension boundaries around it.
6
+ * loading, diagnostics, serialization, and extension boundaries around it,
7
+ * including root component overrides underneath adapted typography scales.
7
8
  */
8
9
 
9
10
  import {afterEach, beforeAll, beforeEach, describe, expect, it} from 'vitest';
@@ -94,6 +95,104 @@ describe('theme build adaptations', () => {
94
95
  );
95
96
  });
96
97
 
98
+ it.each([
99
+ ['defined', writeTheme],
100
+ ['plain', writePlainTheme],
101
+ ])(
102
+ 'preserves component pins in %s themes and built extensions',
103
+ async (_kind, write) => {
104
+ const {defineTheme, generateAdaptationCSS, generateThemeCSS} =
105
+ await import('@astryxdesign/core/theme');
106
+ const project = path.join(tmpDir, 'project');
107
+ const themesDir = path.join(project, 'themes');
108
+ const displayFamily =
109
+ 'Sarina, "Brush Script MT", "Snell Roundhand", cursive';
110
+ const input = {
111
+ name: 'adaptive-display',
112
+ typography: {
113
+ scale: {base: 16, ratio: 1.25},
114
+ body: {family: 'Outfit', fallbacks: 'sans-serif'},
115
+ },
116
+ components: {
117
+ text: Object.fromEntries(
118
+ ['display-1', 'display-2', 'display-3'].map(type => [
119
+ `type:${type}`,
120
+ {fontFamily: displayFamily},
121
+ ]),
122
+ ),
123
+ button: {base: {borderRadius: '12px'}},
124
+ },
125
+ adaptations: {
126
+ rules: [
127
+ {
128
+ when: {width: {below: 'md'}, pointer: 'coarse'},
129
+ value: {typography: {scale: {base: 14, ratio: 1.2}}},
130
+ },
131
+ {
132
+ when: {contrast: 'more'},
133
+ value: {
134
+ typography: {scale: {base: 15}},
135
+ components: {
136
+ text: {'type:display-1': {fontFamily: 'monospace'}},
137
+ },
138
+ },
139
+ },
140
+ ],
141
+ },
142
+ };
143
+ const themeFile = write(themesDir, input.name, JSON.stringify(input));
144
+ const result = await build(project, themeFile);
145
+ expect(result.code, result.stderr).toBe(0);
146
+ const css = fs.readFileSync(
147
+ path.join(themesDir, 'adaptive-display.css'),
148
+ 'utf8',
149
+ );
150
+ const compact = value => value.replace(/\s+/g, ' ').trim();
151
+ const source = defineTheme(input);
152
+ const runtime = generateThemeCSS(source);
153
+ // The CLI wraps root, adaptation, and surface CSS in separate @layer
154
+ // blocks; their contents and order must still match runtime output.
155
+ const adaptationCSS = generateAdaptationCSS(source).component;
156
+ const [rootCSS, surfaceCSS] = runtime.component.split(adaptationCSS);
157
+ const blocks = [rootCSS, adaptationCSS, surfaceCSS].map(compact);
158
+ let previousIndex = -1;
159
+ for (const block of blocks) {
160
+ expect(compact(css)).toContain(block);
161
+ const index = compact(css).indexOf(block);
162
+ expect(index).toBeGreaterThan(previousIndex);
163
+ previousIndex = index;
164
+ }
165
+ expect(compact(css)).toContain(compact(runtime.prose));
166
+ const scaleBlock = css.slice(
167
+ css.indexOf('@media (width < 768px) and (pointer: coarse)'),
168
+ css.indexOf('@media (prefers-contrast: more)'),
169
+ );
170
+ expect(scaleBlock).toContain('--font-size-base: 0.875rem');
171
+ expect(scaleBlock).not.toContain('.astryx-text');
172
+ expect(scaleBlock).not.toContain('.astryx-heading');
173
+ expect(scaleBlock).not.toContain('.astryx-button');
174
+ expect(css).toContain(`font-family: ${displayFamily};`);
175
+ expect(css).toContain('font-family: monospace;');
176
+
177
+ const {adaptiveDisplayTheme: builtTheme} = await import(
178
+ pathToFileURL(path.join(themesDir, 'adaptive-display.js')).href
179
+ );
180
+ expect(builtTheme.__adaptationRules).toBeUndefined();
181
+ expect(generateThemeCSS(builtTheme)).toEqual(runtime);
182
+ const childInput = {
183
+ name: 'display-child',
184
+ components: {text: {'type:display-2': {fontFamily: 'serif'}}},
185
+ };
186
+ const fromSource = defineTheme({...childInput, extends: source});
187
+ const fromBuilt = defineTheme({...childInput, extends: builtTheme});
188
+ expect(generateThemeCSS(fromBuilt)).toEqual(generateThemeCSS(fromSource));
189
+ expect(fromBuilt.__adaptationRules[0].components).toBeUndefined();
190
+ expect(fromBuilt.components.text['type:display-2'].fontFamily).toBe(
191
+ 'serif',
192
+ );
193
+ },
194
+ );
195
+
97
196
  it('resolves a plain object whose only input-only field is adaptations', async () => {
98
197
  const project = path.join(tmpDir, 'project');
99
198
  const themesDir = path.join(project, 'themes');
@@ -196,7 +196,7 @@ async function warnOnThemeIntegrationIssues(json) {
196
196
  try {
197
197
  const project = await Project.load(process.cwd());
198
198
  await project.themes();
199
- await warnOnIntegrationIssues(project.loadedIntegrations, {json});
199
+ await warnOnIntegrationIssues(project, {json});
200
200
  } catch {
201
201
  // Never let the nudge break the command.
202
202
  }
@@ -14,11 +14,12 @@ export const doc = {
14
14
  displayName: 'astryx build',
15
15
  namespace: 'cli/commands',
16
16
  summary:
17
- 'Build a page: composition kit for an idea, or the workflow playbook (no args)',
17
+ 'Build a page: the template to start from, or the workflow playbook (no query)',
18
18
  description:
19
- 'The assemble-a-page entry point. With no query it returns the how-to-build-a-page ' +
20
- 'playbook; with a query it groups the unified search hits into a composition kit: ' +
21
- 'the closest templates, drop-in blocks, and idea-specific components and hooks.',
19
+ 'The build-a-page entry point. With no query it returns the how-to-build-a-page ' +
20
+ 'playbook; with a query it names the page template to start from (always one: the ' +
21
+ 'closest page template, or the app shell when none matches), the next two templates, and the ' +
22
+ 'drop-in blocks and idea-specific components and hooks around it.',
22
23
  fn: 'build',
23
24
  args: [{name: 'query', param: 'query', required: false}],
24
25
  options: [
@@ -35,12 +36,16 @@ export const doc = {
35
36
  },
36
37
  {
37
38
  flag: '--verbose',
38
- description: 'Verbose output (include import paths and match reason)',
39
+ description:
40
+ 'Verbose output (every block and component, full descriptions, import paths and match reason)',
39
41
  },
40
42
  ],
41
43
  examples: [
42
44
  {label: 'Get the playbook', cli: 'astryx build'},
43
- {label: 'Compose a page', cli: 'astryx build "analytics dashboard" --json'},
45
+ {
46
+ label: 'Find the template to start from',
47
+ cli: 'astryx build "analytics dashboard" --json',
48
+ },
44
49
  ],
45
50
  exitCodes: [
46
51
  {code: 0, when: 'success (including zero matches)'},