@astryxdesign/cli 0.6.3-canary.f22695a → 0.6.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 (197) hide show
  1. package/README.md +1 -2
  2. package/api/build/build.type.d.mts +2 -2
  3. package/api/build/build.type.mjs +2 -2
  4. package/api/component/component.type.d.mts +6 -6
  5. package/api/component/component.type.mjs +19 -19
  6. package/api/discover/discover.type.d.mts +4 -4
  7. package/api/discover/discover.type.mjs +10 -10
  8. package/api/docs/_adapter.d.mts +24 -37
  9. package/api/docs/_adapter.mjs +83 -169
  10. package/api/docs/detail/detail.mjs +63 -14
  11. package/api/docs/detail/section/section.d.mts +1 -1
  12. package/api/docs/detail/section/section.mjs +20 -44
  13. package/api/docs/detail/section/section.test.mjs +0 -41
  14. package/api/docs/docs.d.mts +2 -7
  15. package/api/docs/docs.doc.mjs +10 -27
  16. package/api/docs/docs.mjs +9 -16
  17. package/api/docs/docs.test.mjs +0 -6
  18. package/api/docs/docs.type.d.mts +3 -40
  19. package/api/docs/docs.type.mjs +8 -36
  20. package/api/docs/integrationDocs.test.mjs +0 -106
  21. package/api/doctor/doctor.d.mts +0 -48
  22. package/api/doctor/doctor.mjs +0 -232
  23. package/api/doctor/doctor.test.mjs +0 -196
  24. package/api/hook/hook.type.d.mts +3 -3
  25. package/api/hook/hook.type.mjs +11 -11
  26. package/api/hook/list/list.d.mts +1 -1
  27. package/api/integration/add-contribution.mjs +3 -5
  28. package/api/integration/add-contribution.test.mjs +4 -4
  29. package/api/integration/integration-authoring.type.d.mts +1 -1
  30. package/api/integration/pack-check.mjs +7 -49
  31. package/api/integration/pack-check.test.mjs +0 -249
  32. package/api/search/search.d.mts +1 -1
  33. package/api/search/search.mjs +5 -5
  34. package/api/search/search.type.d.mts +2 -2
  35. package/api/search/search.type.mjs +1 -1
  36. package/api/swizzle/swizzle.type.d.mts +2 -2
  37. package/api/swizzle/swizzle.type.mjs +2 -2
  38. package/api/template/template.d.mts +1 -1
  39. package/api/template/template.type.d.mts +6 -6
  40. package/api/template/template.type.mjs +12 -12
  41. package/api/theme/build/build.mjs +6 -20
  42. package/api/theme/build/build.test.mjs +0 -127
  43. package/api/theme/palette/generate/generate.mjs +1 -1
  44. package/api/theme/palette/generate/generator.d.mts +13 -10
  45. package/api/theme/palette/generate/generator.mjs +3 -7
  46. package/api/theme/theme.type.d.mts +11 -170
  47. package/api/theme/theme.type.mjs +27 -94
  48. package/api/upgrade/_adapter.mjs +5 -71
  49. package/api/upgrade/upgrade.doc.mjs +3 -4
  50. package/api/upgrade/upgrade.type.d.mts +5 -5
  51. package/api/upgrade/upgrade.type.mjs +11 -11
  52. package/assets/codemods/integration-discovery.mjs +2 -40
  53. package/assets/codemods/integration-discovery.test.mjs +0 -58
  54. package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +5 -27
  55. package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +5 -20
  56. package/assets/docs/README.md +0 -9
  57. package/assets/docs/cli-integrations.doc.mjs +15 -86
  58. package/assets/docs/styling-libraries.doc.mjs +1 -1
  59. package/assets/docs/working-with-ai.doc.mjs +1 -1
  60. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +3 -19
  61. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +65 -383
  62. package/authoring/_shared/contract.ts +0 -22
  63. package/authoring/codemod/codemod.doc.mjs +1 -6
  64. package/authoring/codemod/parse.d.mts +8 -8
  65. package/authoring/codemod/parse.mjs +6 -8
  66. package/authoring/config/parse.d.mts +13 -13
  67. package/authoring/config/parse.mjs +8 -8
  68. package/authoring/config/type.ts +3 -3
  69. package/authoring/debug/parse.d.mts +5 -5
  70. package/authoring/debug/parse.mjs +3 -3
  71. package/authoring/doctypes/_schema.d.mts +23 -788
  72. package/authoring/doctypes/_schema.mjs +39 -492
  73. package/authoring/doctypes/base/type.ts +0 -40
  74. package/authoring/doctypes/command/command.doc.mjs +2 -3
  75. package/authoring/doctypes/command/parse.d.mts +2 -2
  76. package/authoring/doctypes/command/parse.mjs +1 -1
  77. package/authoring/doctypes/command/type.ts +2 -3
  78. package/authoring/doctypes/component/component.doc.mjs +3 -6
  79. package/authoring/doctypes/component/parse.d.mts +2 -2
  80. package/authoring/doctypes/component/parse.mjs +1 -1
  81. package/authoring/doctypes/component/type.ts +3 -4
  82. package/authoring/doctypes/enum/parse.d.mts +2 -2
  83. package/authoring/doctypes/enum/parse.mjs +1 -1
  84. package/authoring/doctypes/enum/type.ts +1 -3
  85. package/authoring/doctypes/function/function.doc.mjs +0 -4
  86. package/authoring/doctypes/function/parse.d.mts +2 -2
  87. package/authoring/doctypes/function/parse.mjs +1 -1
  88. package/authoring/doctypes/function/type.ts +2 -6
  89. package/authoring/doctypes/hook/hook.doc.mjs +0 -4
  90. package/authoring/doctypes/hook/parse.d.mts +2 -2
  91. package/authoring/doctypes/hook/parse.mjs +1 -1
  92. package/authoring/doctypes/hook/type.ts +2 -3
  93. package/authoring/doctypes/legacy.d.mts +6 -8
  94. package/authoring/doctypes/legacy.mjs +4 -5
  95. package/authoring/doctypes/parse.d.mts +18 -20
  96. package/authoring/doctypes/parse.mjs +10 -16
  97. package/authoring/doctypes/parse.test.mjs +3 -77
  98. package/authoring/doctypes/reference/parse.d.mts +2 -2
  99. package/authoring/doctypes/reference/parse.mjs +5 -8
  100. package/authoring/doctypes/reference/reference.doc.mjs +4 -17
  101. package/authoring/doctypes/reference/type.ts +5 -51
  102. package/authoring/doctypes/schema/parse.d.mts +2 -2
  103. package/authoring/doctypes/schema/parse.mjs +1 -1
  104. package/authoring/doctypes/schema/type.ts +2 -3
  105. package/authoring/doctypes/template/parse.d.mts +1 -92
  106. package/authoring/doctypes/template/parse.mjs +2 -36
  107. package/authoring/doctypes/template/parse.test.mjs +2 -8
  108. package/authoring/doctypes/template/template.doc.mjs +0 -4
  109. package/authoring/doctypes/template/type.ts +2 -5
  110. package/authoring/doctypes/types.ts +9 -10
  111. package/authoring/gap-report/parse.d.mts +10 -10
  112. package/authoring/gap-report/parse.mjs +6 -6
  113. package/authoring/gap-report/type.ts +1 -1
  114. package/authoring/index.d.mts +0 -1
  115. package/authoring/index.d.ts +17 -49
  116. package/authoring/index.mjs +0 -1
  117. package/authoring/integration/integration.doc.mjs +6 -13
  118. package/authoring/integration/parse.d.mts +2 -2
  119. package/authoring/integration/parse.mjs +1 -1
  120. package/authoring/integration/parse.test.mjs +1 -10
  121. package/authoring/integration/schema.d.mts +4 -6
  122. package/authoring/integration/schema.mjs +3 -9
  123. package/authoring/integration/type.ts +6 -23
  124. package/authoring/shadcn/receipt.d.mts +6 -6
  125. package/clients/cli/commands/docs.doc.mjs +3 -13
  126. package/clients/cli/commands/docs.mjs +21 -121
  127. package/clients/cli/commands/docs.test.mjs +0 -88
  128. package/clients/cli/commands/integration-authoring.test.mjs +9 -13
  129. package/clients/cli/commands/theme-palette-generate.doc.mjs +4 -8
  130. package/clients/cli/commands/upgrade.doc.mjs +2 -2
  131. package/clients/cli/formatters/index.mjs +1 -162
  132. package/clients/cli/formatters/index.test.mjs +0 -91
  133. package/clients/cli/lib/manifest.mjs +2 -7
  134. package/foundation/config/project.mjs +6 -21
  135. package/foundation/discovery/component-discovery.d.mts +1 -1
  136. package/foundation/discovery/component-discovery.mjs +1 -2
  137. package/foundation/discovery/docs-discovery.d.mts +4 -11
  138. package/foundation/discovery/docs-discovery.mjs +88 -208
  139. package/foundation/discovery/docs-discovery.test.mjs +13 -279
  140. package/foundation/discovery/template-adapter.mjs +1 -2
  141. package/foundation/integrations/autolink.mjs +5 -12
  142. package/foundation/integrations/integration-warnings.mjs +0 -6
  143. package/foundation/integrations/integrations.d.mts +2 -46
  144. package/foundation/integrations/integrations.mjs +8 -167
  145. package/foundation/integrations/integrations.test.mjs +1 -384
  146. package/foundation/integrations/validate-contributions.d.mts +0 -2
  147. package/foundation/integrations/validate-contributions.mjs +0 -10
  148. package/foundation/response/json-contract.test.mjs +17 -46
  149. package/foundation/response/response-types.doc.mjs +1 -6
  150. package/package.json +11 -9
  151. package/api/docs/compiled-topics.test.mjs +0 -78
  152. package/api/docs/index/index.d.mts +0 -18
  153. package/api/docs/index/index.mjs +0 -32
  154. package/api/docs/index/index.test.mjs +0 -62
  155. package/api/upgrade/project-context.test.mjs +0 -272
  156. package/assets/docs/authoring.doc.mjs +0 -14
  157. package/assets/templates/blocks/components/Timer/TimerFormats.doc.mjs +0 -14
  158. package/assets/templates/blocks/components/Timer/TimerFormats.tsx +0 -34
  159. package/assets/templates/blocks/components/Timer/TimerInline.doc.mjs +0 -14
  160. package/assets/templates/blocks/components/Timer/TimerInline.tsx +0 -14
  161. package/assets/templates/blocks/components/Timer/TimerShowcase.doc.mjs +0 -13
  162. package/assets/templates/blocks/components/Timer/TimerShowcase.tsx +0 -47
  163. package/assets/templates/blocks/components/Timer/TimerTypography.doc.mjs +0 -14
  164. package/assets/templates/blocks/components/Timer/TimerTypography.tsx +0 -31
  165. package/authoring/doctypes/base/graph-fields.doc.d.mts +0 -9
  166. package/authoring/doctypes/base/graph-fields.doc.mjs +0 -62
  167. package/authoring/doctypes/load-contract.test.mjs +0 -207
  168. package/authoring/doctypes/namespace/namespace.doc.d.mts +0 -9
  169. package/authoring/doctypes/namespace/namespace.doc.mjs +0 -132
  170. package/authoring/doctypes/namespace/parse.d.mts +0 -12
  171. package/authoring/doctypes/namespace/parse.mjs +0 -25
  172. package/authoring/doctypes/namespace/parse.test.mjs +0 -165
  173. package/authoring/doctypes/namespace/type.ts +0 -71
  174. package/authoring/identity/identity.doc.d.mts +0 -9
  175. package/authoring/identity/identity.doc.mjs +0 -61
  176. package/authoring/identity/type.ts +0 -132
  177. package/foundation/discovery/authoring-self-docs.d.mts +0 -69
  178. package/foundation/discovery/authoring-self-docs.mjs +0 -214
  179. package/foundation/discovery/authoring-self-docs.test.mjs +0 -154
  180. package/foundation/discovery/docs-output-budget.d.mts +0 -28
  181. package/foundation/discovery/docs-output-budget.mjs +0 -50
  182. package/foundation/discovery/docs-section-key.d.mts +0 -98
  183. package/foundation/discovery/docs-section-key.mjs +0 -221
  184. package/foundation/discovery/docs-section-key.test.mjs +0 -224
  185. package/foundation/doc-compiler/compile.d.mts +0 -162
  186. package/foundation/doc-compiler/compile.mjs +0 -262
  187. package/foundation/doc-compiler/doc-compiler.test.mjs +0 -687
  188. package/foundation/doc-compiler/ir.d.mts +0 -9
  189. package/foundation/doc-compiler/ir.mjs +0 -287
  190. package/foundation/doc-compiler/lenses.d.mts +0 -33
  191. package/foundation/doc-compiler/lenses.mjs +0 -127
  192. package/foundation/identity/provider-identity.d.mts +0 -90
  193. package/foundation/identity/provider-identity.mjs +0 -320
  194. package/foundation/identity/provider-identity.test.mjs +0 -254
  195. package/foundation/identity/providers.d.mts +0 -7
  196. package/foundation/identity/providers.mjs +0 -16
  197. package/foundation/integrations/provider-conflicts.test.mjs +0 -125
@@ -4,46 +4,6 @@
4
4
  * @file Shared leaf primitives used across the doc types.
5
5
  */
6
6
 
7
- /** Every authored documentation kind accepted by `parseDoc`. */
8
- export type AuthoredDocKind =
9
- | 'component'
10
- | 'function'
11
- | 'generic'
12
- | 'page'
13
- | 'block'
14
- | 'schema'
15
- | 'command'
16
- | 'enum'
17
- | 'namespace';
18
-
19
- /** Visibility of an authored doc in a compiled audience-specific bundle. */
20
- export type DocAudience = 'public' | 'internal';
21
-
22
- /**
23
- * Optional canonical placement request. The compiler resolves `parent` as a
24
- * stable doc reference. `slot` selects one parent-owned slot, and `order`
25
- * provides deterministic sibling ordering inside that slot.
26
- */
27
- export interface DocPlacement {
28
- parent: string;
29
- slot?: string;
30
- order?: number;
31
- }
32
-
33
- /**
34
- * Graph metadata shared by every authored doc kind. Reserved for the docs
35
- * graph, which is not built yet: nothing reads these fields, and a reference
36
- * topic that sets one fails to load.
37
- */
38
- export interface AuthoredDocGraphFields {
39
- /** Requested canonical parent in the docs graph. Not read yet. */
40
- placement?: DocPlacement;
41
- /** Prior routes or names the docs graph will keep resolving. Not read yet. */
42
- aliases?: string[];
43
- /** Docs bundle audience; omit for public docs. Not read yet. */
44
- audience?: DocAudience;
45
- }
46
-
47
7
  /**
48
8
  * Stable public identity for generated registry resources.
49
9
  *
@@ -135,9 +135,8 @@ export const doc = {
135
135
  },
136
136
  {
137
137
  name: 'options[].default',
138
- type: 'string | boolean | string[]',
139
- description:
140
- 'Default value: a string, a boolean, or a list of strings.',
138
+ type: 'string',
139
+ description: 'Default value as a string.',
141
140
  },
142
141
  {
143
142
  name: 'options[].cliOnly',
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types.js').CommandDoc} CommandDoc */
4
+ /** @typedef {import('../types').CommandDoc} CommandDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped command doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {CommandDoc}
11
11
  */
12
12
  export function parseCommand(input: unknown, label?: string): CommandDoc;
13
- export type CommandDoc = import("../types.js").CommandDoc;
13
+ export type CommandDoc = import("../types").CommandDoc;
@@ -8,7 +8,7 @@
8
8
  import {CommandDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types.js').CommandDoc} CommandDoc */
11
+ /** @typedef {import('../types').CommandDoc} CommandDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped command doc, or throw.
@@ -9,8 +9,7 @@
9
9
  * `--help`. Colocated at `clients/cli/commands/<name>.doc.mjs`.
10
10
  */
11
11
 
12
- import type {AuthoredDocGraphFields} from '../base/type.js';
13
- import type {ReferenceContentBlock} from '../reference/type.js';
12
+ import type {ReferenceContentBlock} from '../reference/type';
14
13
 
15
14
  /** A positional argument. `param` links it to a FunctionDoc param for its description. */
16
15
  export interface CommandArgDoc {
@@ -54,7 +53,7 @@ export interface CommandExampleDoc {
54
53
  * /\*\* @type {import('@astryxdesign/cli/authoring').CommandDoc} \*\/
55
54
  * export const doc = { type: 'command', name: 'search', fn: 'search', ... };
56
55
  */
57
- export interface CommandDoc extends AuthoredDocGraphFields {
56
+ export interface CommandDoc {
58
57
  /** Doc-kind discriminant. */
59
58
  type?: 'command';
60
59
  /** Command path, e.g. 'search' | 'theme build'. */
@@ -56,7 +56,7 @@ export const doc = {
56
56
  name: 'keywords',
57
57
  type: 'string[]',
58
58
  description:
59
- 'Search keywords for CLI discovery: synonyms and related UI concepts from other design systems (MUI, Chakra, Radix, and others). Lowercase. Used by `astryx component <term>` fuzzy matching.',
59
+ 'Search keywords for CLI discovery: synonyms and related UI concepts from other design systems (MUI, Chakra, Radix, shadcn). Lowercase. Used by `astryx component <term>` fuzzy matching.',
60
60
  },
61
61
  {
62
62
  name: 'hiddenComponents',
@@ -124,7 +124,8 @@ export const doc = {
124
124
  name: 'usage',
125
125
  type: 'UsageDoc',
126
126
  description:
127
- 'Component usage documentation: concise summary, best practices, component-specific accessibility requirements, and optional visual anatomy. Required on a component doc; optional on a sub-component doc (`subComponentOf`), which uses its description instead.',
127
+ 'Component usage documentation: concise summary, best practices, component-specific accessibility requirements, and optional visual anatomy. (Optional on SubComponentDoc, where the sub-component description is used instead.)',
128
+ required: true,
128
129
  fields: [
129
130
  {
130
131
  name: 'usage.description',
@@ -241,10 +242,6 @@ export const docs = {
241
242
  },
242
243
  ],
243
244
  notes: [
244
- {
245
- type: 'prose',
246
- text: "When it loads, a stamped component doc is checked as loosely as an unstamped one, so adding `type: 'component'` to an existing doc never breaks it: `displayName` may be missing, `category` may be any string, and `usage`, `theming`, `playground` and `examples` are not checked. Each entry in a group doc's `components` must have a `name`. Write to the type anyway; it is the contract.",
247
- },
248
245
  {
249
246
  type: 'prose',
250
247
  text: 'ComponentDoc is a discriminated union of three shapes that all extend ComponentBaseDoc. Pick the variant by which key you set: `props` (single), `components` (multi), or `subComponentOf` (sub).',
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types.js').ComponentDoc} ComponentDoc */
4
+ /** @typedef {import('../types').ComponentDoc} ComponentDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped component doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {ComponentDoc}
11
11
  */
12
12
  export function parseComponent(input: unknown, label?: string): ComponentDoc;
13
- export type ComponentDoc = import("../types.js").ComponentDoc;
13
+ export type ComponentDoc = import("../types").ComponentDoc;
@@ -8,7 +8,7 @@
8
8
  import {ComponentDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types.js').ComponentDoc} ComponentDoc */
11
+ /** @typedef {import('../types').ComponentDoc} ComponentDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped component doc, or throw.
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  import type {
8
- AuthoredDocGraphFields,
9
8
  ComponentAccessibilityRequirement,
10
9
  ComponentAnatomyElement,
11
10
  ComponentBestPractice,
@@ -19,13 +18,13 @@ import type {
19
18
  HookReturnDoc,
20
19
  RegistryDocIdentity,
21
20
  UsageDoc,
22
- } from '../base/type.js';
21
+ } from '../base/type';
23
22
 
24
23
  /**
25
24
  * Shared fields between single-component and multi-component docs.
26
25
  * Do not use this interface directly — use `ComponentDoc` (the union type).
27
26
  */
28
- export interface ComponentBaseDoc extends AuthoredDocGraphFields {
27
+ export interface ComponentBaseDoc {
29
28
  /** Doc-kind discriminant for the stamped default-export format
30
29
  * (`export default { type: 'component', ... }`). Optional: legacy
31
30
  * `export const docs = {...}` docs omit it, and `parseDoc` falls back to
@@ -50,7 +49,7 @@ export interface ComponentBaseDoc extends AuthoredDocGraphFields {
50
49
  import?: string;
51
50
  /** Search keywords for CLI discovery. Terms a developer might type when
52
51
  * looking for this component: synonyms, related UI concepts, and common
53
- * names from other design systems (MUI, Chakra, Radix, and others).
52
+ * names from other design systems (MUI, Chakra, Radix, shadcn).
54
53
  * Lowercase only. Used by `astryx component <term>` for fuzzy matching.
55
54
  * e.g. `['accordion', 'expand', 'toggle', 'disclosure']` for Collapsible */
56
55
  keywords?: string[];
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types.js').EnumDoc} EnumDoc */
4
+ /** @typedef {import('../types').EnumDoc} EnumDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped enum doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {EnumDoc}
11
11
  */
12
12
  export function parseEnum(input: unknown, label?: string): EnumDoc;
13
- export type EnumDoc = import("../types.js").EnumDoc;
13
+ export type EnumDoc = import("../types").EnumDoc;
@@ -8,7 +8,7 @@
8
8
  import {EnumDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types.js').EnumDoc} EnumDoc */
11
+ /** @typedef {import('../types').EnumDoc} EnumDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped enum doc, or throw.
@@ -5,8 +5,6 @@
5
5
  * discriminants). Colocated next to the source of truth it documents.
6
6
  */
7
7
 
8
- import type {AuthoredDocGraphFields} from '../base/type.js';
9
-
10
8
  /** One member of an enumerated vocabulary. */
11
9
  export interface EnumMemberDoc {
12
10
  /** The literal value, e.g. 'ERR_UNKNOWN_TOPIC' | 'component.list'. */
@@ -23,7 +21,7 @@ export interface EnumMemberDoc {
23
21
  * /\*\* @type {import('@astryxdesign/cli/authoring').EnumDoc} \*\/
24
22
  * export const doc = { type: 'enum', name: 'error-codes', ... };
25
23
  */
26
- export interface EnumDoc extends AuthoredDocGraphFields {
24
+ export interface EnumDoc {
27
25
  /** Doc-kind discriminant. */
28
26
  type?: 'enum';
29
27
  /** URL-safe identifier, used as the docs slug within its namespace. */
@@ -250,10 +250,6 @@ export const doc = {
250
250
  },
251
251
  ],
252
252
  notes: [
253
- {
254
- type: 'prose',
255
- text: 'When it loads, a stamped function doc may leave out `displayName`, and its `usage` is not checked. Write to the type anyway; it is the contract.',
256
- },
257
253
  {
258
254
  type: 'prose',
259
255
  text: "The `type` discriminant is 'function' for both flavors. Set `kind: 'hook'` or `kind: 'api'` to drive docsite sectioning; it is inferred from `importPath` when omitted.",
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types.js').FunctionDoc} FunctionDoc */
4
+ /** @typedef {import('../types').FunctionDoc} FunctionDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped function doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {FunctionDoc}
11
11
  */
12
12
  export function parseFunction(input: unknown, label?: string): FunctionDoc;
13
- export type FunctionDoc = import("../types.js").FunctionDoc;
13
+ export type FunctionDoc = import("../types").FunctionDoc;
@@ -14,7 +14,7 @@
14
14
 
15
15
  import {parseHook} from '../hook/parse.mjs';
16
16
 
17
- /** @typedef {import('../types.js').FunctionDoc} FunctionDoc */
17
+ /** @typedef {import('../types').FunctionDoc} FunctionDoc */
18
18
 
19
19
  /**
20
20
  * Validate an unknown value as a stamped function doc, or throw.
@@ -10,11 +10,7 @@
10
10
  * here — the function does not know it has a CLI.
11
11
  */
12
12
 
13
- import type {
14
- AuthoredDocGraphFields,
15
- HookParamDoc,
16
- UsageDoc,
17
- } from '../base/type.js';
13
+ import type {HookParamDoc, UsageDoc} from '../base/type';
18
14
 
19
15
  /**
20
16
  * A documented return. Hooks list named return fields (`name` set); CLI/API
@@ -49,7 +45,7 @@ export interface FunctionExampleDoc {
49
45
  * /\*\* @type {import('@astryxdesign/cli/authoring').FunctionDoc} \*\/
50
46
  * export const doc = { type: 'function', kind: 'api', name: 'search', ... };
51
47
  */
52
- export interface FunctionDoc extends AuthoredDocGraphFields {
48
+ export interface FunctionDoc {
53
49
  /** Doc-kind discriminant (shared with hooks). */
54
50
  type?: 'function';
55
51
  /** Export name, e.g. 'search' | 'useMediaQuery'. */
@@ -200,10 +200,6 @@ export const docs = {
200
200
  },
201
201
  ],
202
202
  notes: [
203
- {
204
- type: 'prose',
205
- text: 'When it loads, a hook doc may leave out `displayName`, and its `usage` is not checked. Write to the type anyway; it is the contract.',
206
- },
207
203
  {
208
204
  type: 'prose',
209
205
  text: "A hook's discriminant is `type: 'function'`: HookDoc and FunctionDoc share the generalized function kind. HookDoc is the hook-flavored view: named `returns` fields and a required `usage` block.",
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types.js').HookDoc} HookDoc */
4
+ /** @typedef {import('../types').HookDoc} HookDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped function/hook doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {HookDoc}
11
11
  */
12
12
  export function parseHook(input: unknown, label?: string): HookDoc;
13
- export type HookDoc = import("../types.js").HookDoc;
13
+ export type HookDoc = import("../types").HookDoc;
@@ -8,7 +8,7 @@
8
8
  import {FunctionDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types.js').HookDoc} HookDoc */
11
+ /** @typedef {import('../types').HookDoc} HookDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped function/hook doc, or throw.
@@ -5,14 +5,13 @@
5
5
  */
6
6
 
7
7
  import type {
8
- AuthoredDocGraphFields,
9
8
  ComponentAccessibilityRequirement,
10
9
  ComponentBestPractice,
11
10
  HookParamDoc,
12
11
  HookReturnDoc,
13
12
  RegistryDocIdentity,
14
13
  UsageDoc,
15
- } from '../base/type.js';
14
+ } from '../base/type';
16
15
 
17
16
  /**
18
17
  * Documentation for a standalone hook's .doc.mjs file.
@@ -28,7 +27,7 @@ import type {
28
27
  * /\*\* @type {import('@astryxdesign/cli/authoring').HookDoc} \*\/
29
28
  * export const docs = { ... };
30
29
  */
31
- export interface HookDoc extends AuthoredDocGraphFields {
30
+ export interface HookDoc {
32
31
  /** Doc-kind discriminant for the stamped default-export format
33
32
  * (`export default { type: 'function', ... }`). Optional: legacy
34
33
  * `export const docs = {...}` docs omit it. */
@@ -1,17 +1,15 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
5
- /** @typedef {import('./types.js').HookDoc} HookDoc */
6
- /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
4
+ /** @typedef {import('./types').ComponentDoc} ComponentDoc */
5
+ /** @typedef {import('./types').HookDoc} HookDoc */
7
6
  /**
8
7
  * Validate an unknown value as a legacy (unstamped) doc, or throw.
9
8
  *
10
9
  * @param {unknown} input
11
10
  * @param {string} [label]
12
- * @returns {ComponentDoc | HookDoc | ReferenceDoc}
11
+ * @returns {ComponentDoc | HookDoc}
13
12
  */
14
- export function parseLegacyDoc(input: unknown, label?: string): ComponentDoc | HookDoc | ReferenceDoc;
15
- export type ComponentDoc = import("./types.js").ComponentDoc;
16
- export type HookDoc = import("./types.js").HookDoc;
17
- export type ReferenceDoc = import("./types.js").ReferenceDoc;
13
+ export function parseLegacyDoc(input: unknown, label?: string): ComponentDoc | HookDoc;
14
+ export type ComponentDoc = import("./types").ComponentDoc;
15
+ export type HookDoc = import("./types").HookDoc;
@@ -10,21 +10,20 @@
10
10
  import {LegacyDocSchema} from './_schema.mjs';
11
11
  import {formatZodError} from '../_shared/errors.mjs';
12
12
 
13
- /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
14
- /** @typedef {import('./types.js').HookDoc} HookDoc */
15
- /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
13
+ /** @typedef {import('./types').ComponentDoc} ComponentDoc */
14
+ /** @typedef {import('./types').HookDoc} HookDoc */
16
15
 
17
16
  /**
18
17
  * Validate an unknown value as a legacy (unstamped) doc, or throw.
19
18
  *
20
19
  * @param {unknown} input
21
20
  * @param {string} [label]
22
- * @returns {ComponentDoc | HookDoc | ReferenceDoc}
21
+ * @returns {ComponentDoc | HookDoc}
23
22
  */
24
23
  export function parseLegacyDoc(input, label = 'doc') {
25
24
  const result = LegacyDocSchema.safeParse(input);
26
25
  if (!result.success) {
27
26
  throw new Error(formatZodError(label, result.error));
28
27
  }
29
- return /** @type {ComponentDoc | HookDoc | ReferenceDoc} */ (result.data);
28
+ return /** @type {ComponentDoc | HookDoc} */ (result.data);
30
29
  }
@@ -1,15 +1,14 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
5
- /** @typedef {import('./types.js').HookDoc} HookDoc */
6
- /** @typedef {import('./types.js').FunctionDoc} FunctionDoc */
7
- /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
8
- /** @typedef {import('./types.js').TemplateDoc} TemplateDoc */
9
- /** @typedef {import('./types.js').SchemaDoc} SchemaDoc */
10
- /** @typedef {import('./types.js').CommandDoc} CommandDoc */
11
- /** @typedef {import('./types.js').EnumDoc} EnumDoc */
12
- /** @typedef {import('./types.js').NamespaceDoc} NamespaceDoc */
4
+ /** @typedef {import('./types').ComponentDoc} ComponentDoc */
5
+ /** @typedef {import('./types').HookDoc} HookDoc */
6
+ /** @typedef {import('./types').FunctionDoc} FunctionDoc */
7
+ /** @typedef {import('./types').ReferenceDoc} ReferenceDoc */
8
+ /** @typedef {import('./types').TemplateDoc} TemplateDoc */
9
+ /** @typedef {import('./types').SchemaDoc} SchemaDoc */
10
+ /** @typedef {import('./types').CommandDoc} CommandDoc */
11
+ /** @typedef {import('./types').EnumDoc} EnumDoc */
13
12
  /**
14
13
  * Validate an unknown loaded doc value into its typed shape, or throw.
15
14
  * Dispatches on the stamped `type`; unstamped docs fall back to
@@ -18,15 +17,14 @@
18
17
  *
19
18
  * @param {unknown} input
20
19
  * @param {string} [label]
21
- * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc}
20
+ * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc}
22
21
  */
23
- export function parseDoc(input: unknown, label?: string): ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc;
24
- export type ComponentDoc = import("./types.js").ComponentDoc;
25
- export type HookDoc = import("./types.js").HookDoc;
26
- export type FunctionDoc = import("./types.js").FunctionDoc;
27
- export type ReferenceDoc = import("./types.js").ReferenceDoc;
28
- export type TemplateDoc = import("./types.js").TemplateDoc;
29
- export type SchemaDoc = import("./types.js").SchemaDoc;
30
- export type CommandDoc = import("./types.js").CommandDoc;
31
- export type EnumDoc = import("./types.js").EnumDoc;
32
- export type NamespaceDoc = import("./types.js").NamespaceDoc;
22
+ export function parseDoc(input: unknown, label?: string): ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc;
23
+ export type ComponentDoc = import("./types").ComponentDoc;
24
+ export type HookDoc = import("./types").HookDoc;
25
+ export type FunctionDoc = import("./types").FunctionDoc;
26
+ export type ReferenceDoc = import("./types").ReferenceDoc;
27
+ export type TemplateDoc = import("./types").TemplateDoc;
28
+ export type SchemaDoc = import("./types").SchemaDoc;
29
+ export type CommandDoc = import("./types").CommandDoc;
30
+ export type EnumDoc = import("./types").EnumDoc;
@@ -15,18 +15,16 @@ import {parseTemplate} from './template/parse.mjs';
15
15
  import {parseSchema} from './schema/parse.mjs';
16
16
  import {parseCommand} from './command/parse.mjs';
17
17
  import {parseEnum} from './enum/parse.mjs';
18
- import {parseNamespace} from './namespace/parse.mjs';
19
18
  import {parseLegacyDoc} from './legacy.mjs';
20
19
 
21
- /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
22
- /** @typedef {import('./types.js').HookDoc} HookDoc */
23
- /** @typedef {import('./types.js').FunctionDoc} FunctionDoc */
24
- /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
25
- /** @typedef {import('./types.js').TemplateDoc} TemplateDoc */
26
- /** @typedef {import('./types.js').SchemaDoc} SchemaDoc */
27
- /** @typedef {import('./types.js').CommandDoc} CommandDoc */
28
- /** @typedef {import('./types.js').EnumDoc} EnumDoc */
29
- /** @typedef {import('./types.js').NamespaceDoc} NamespaceDoc */
20
+ /** @typedef {import('./types').ComponentDoc} ComponentDoc */
21
+ /** @typedef {import('./types').HookDoc} HookDoc */
22
+ /** @typedef {import('./types').FunctionDoc} FunctionDoc */
23
+ /** @typedef {import('./types').ReferenceDoc} ReferenceDoc */
24
+ /** @typedef {import('./types').TemplateDoc} TemplateDoc */
25
+ /** @typedef {import('./types').SchemaDoc} SchemaDoc */
26
+ /** @typedef {import('./types').CommandDoc} CommandDoc */
27
+ /** @typedef {import('./types').EnumDoc} EnumDoc */
30
28
 
31
29
  /**
32
30
  * Validate an unknown loaded doc value into its typed shape, or throw.
@@ -36,7 +34,7 @@ import {parseLegacyDoc} from './legacy.mjs';
36
34
  *
37
35
  * @param {unknown} input
38
36
  * @param {string} [label]
39
- * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc}
37
+ * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc}
40
38
  */
41
39
  export function parseDoc(input, label = 'doc') {
42
40
  const type =
@@ -60,11 +58,7 @@ export function parseDoc(input, label = 'doc') {
60
58
  return parseCommand(input, label);
61
59
  case 'enum':
62
60
  return parseEnum(input, label);
63
- case 'namespace':
64
- return parseNamespace(input, label);
65
- case undefined:
66
- return parseLegacyDoc(input, label);
67
61
  default:
68
- throw new Error(`${label} has unsupported type ${JSON.stringify(type)}.`);
62
+ return parseLegacyDoc(input, label);
69
63
  }
70
64
  }
@@ -25,18 +25,8 @@ const goodComponent = {
25
25
  displayName: 'Widget',
26
26
  description: 'A small widget.',
27
27
  props: [
28
- {
29
- name: 'label',
30
- type: 'string',
31
- description: 'Visible label.',
32
- required: true,
33
- },
34
- {
35
- name: 'size',
36
- type: "'sm' | 'md'",
37
- description: 'Control size.',
38
- default: "'md'",
39
- },
28
+ {name: 'label', type: 'string', description: 'Visible label.', required: true},
29
+ {name: 'size', type: "'sm' | 'md'", description: 'Control size.', default: "'md'"},
40
30
  ],
41
31
  };
42
32
 
@@ -45,9 +35,7 @@ const goodFunction = {
45
35
  name: 'useThing',
46
36
  displayName: 'useThing',
47
37
  description: 'A thing hook.',
48
- params: [
49
- {name: 'input', type: 'string', description: 'The input.', required: true},
50
- ],
38
+ params: [{name: 'input', type: 'string', description: 'The input.', required: true}],
51
39
  returns: [{name: 'value', type: 'string', description: 'The result.'}],
52
40
  };
53
41
 
@@ -55,11 +43,7 @@ const goodGeneric = {
55
43
  type: 'generic',
56
44
  name: 'Theming',
57
45
  displayName: 'Theming',
58
- title: 'Theming',
59
46
  description: 'How theming works.',
60
- sections: [
61
- {title: 'Overview', content: [{type: 'prose', text: 'Use a theme.'}]},
62
- ],
63
47
  };
64
48
 
65
49
  /** Run parseDoc and return the thrown message (asserting it throws). */
@@ -117,34 +101,6 @@ describe('per-kind parsers (stamped format)', () => {
117
101
  expect(() => parseReference(goodGeneric)).not.toThrow();
118
102
  });
119
103
 
120
- it('normalizes a migrated minimal generic doc to the public shape', () => {
121
- expect(
122
- parseReference({
123
- type: 'generic',
124
- name: 'Theming',
125
- description: 'How theming works.',
126
- }),
127
- ).toMatchObject({
128
- type: 'generic',
129
- name: 'Theming',
130
- title: 'Theming',
131
- description: 'How theming works.',
132
- sections: [],
133
- });
134
- });
135
-
136
- it('rejects duplicate stable section IDs', () => {
137
- expect(() =>
138
- parseReference({
139
- ...goodGeneric,
140
- sections: [
141
- {id: 'start', title: 'Start', content: []},
142
- {id: 'start', title: 'Renamed start', content: []},
143
- ],
144
- }),
145
- ).toThrow(/sections\.1\.id.*duplicate section id/u);
146
- });
147
-
148
104
  it('keeps nested rich blobs loose (usage/theming/playground passthrough)', () => {
149
105
  expect(() =>
150
106
  parseComponent({
@@ -167,16 +123,6 @@ describe('per-kind parsers (stamped format)', () => {
167
123
  expect(parsed.parent).toBe('WidgetGroup');
168
124
  expect(parsed.relatedDocs).toEqual(['Gauge', 'useThing']);
169
125
  });
170
-
171
- it('validates graph metadata on unstamped legacy docs', () => {
172
- expect(() =>
173
- parseDoc({name: 'Widget', props: [], placement: {parent: ''}}),
174
- ).toThrow(/placement\.parent/u);
175
- expect(() => parseDoc({name: 'Widget', props: [], aliases: [1]})).toThrow();
176
- expect(() =>
177
- parseDoc({name: 'Widget', props: [], audience: 'secret'}),
178
- ).toThrow();
179
- });
180
126
  });
181
127
 
182
128
  describe('parseDoc (load boundary, both formats)', () => {
@@ -229,24 +175,6 @@ describe('parseDoc (load boundary, both formats)', () => {
229
175
  expect(() => parseDoc(hook)).not.toThrow();
230
176
  });
231
177
 
232
- it('accepts and validates the OLD loose reference-topic shape', () => {
233
- const reference = {
234
- name: 'theming',
235
- title: 'Theming',
236
- description: 'How theming works.',
237
- sections: [
238
- {id: 'start', title: 'Start', content: [{type: 'prose', text: 'Go.'}]},
239
- ],
240
- };
241
- expect(parseDoc(reference)).toEqual(reference);
242
- expect(() =>
243
- parseDoc({
244
- ...reference,
245
- sections: [{title: 'Start', content: [{type: 'prose'}]}],
246
- }),
247
- ).toThrow();
248
- });
249
-
250
178
  it('accepts BOTH parent and legacy subComponentOf', () => {
251
179
  const withParent = {name: 'A', parent: 'B', props: []};
252
180
  const withSubComponentOf = {
@@ -361,9 +289,7 @@ describe('loadComponentDoc (end-to-end load boundary)', () => {
361
289
  " type: 'generic',",
362
290
  " name: 'Theming',",
363
291
  " displayName: 'Theming',",
364
- " title: 'Theming',",
365
292
  " description: 'How theming works.',",
366
- " sections: [{title: 'Overview', content: [{type: 'prose', text: 'Use a theme.'}]}],",
367
293
  '};',
368
294
  ].join('\n'),
369
295
  );