@astryxdesign/cli 0.6.3-canary.98a2e4e → 0.6.3-canary.9e4c545

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 (88) hide show
  1. package/api/docs/_adapter.d.mts +30 -27
  2. package/api/docs/_adapter.mjs +154 -124
  3. package/api/docs/compiled-topics.test.mjs +78 -0
  4. package/api/docs/detail/detail.d.mts +0 -15
  5. package/api/docs/detail/detail.mjs +14 -78
  6. package/api/docs/detail/section/section.mjs +22 -18
  7. package/api/docs/detail/section/section.test.mjs +4 -3
  8. package/api/docs/index/index.mjs +6 -5
  9. package/api/doctor/doctor.mjs +3 -7
  10. package/api/search/search.mjs +5 -5
  11. package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
  12. package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
  13. package/authoring/_shared/contract.ts +22 -0
  14. package/authoring/codemod/codemod.doc.mjs +6 -1
  15. package/authoring/codemod/parse.d.mts +8 -8
  16. package/authoring/codemod/parse.mjs +8 -6
  17. package/authoring/config/parse.d.mts +13 -13
  18. package/authoring/config/parse.mjs +8 -8
  19. package/authoring/config/type.ts +3 -3
  20. package/authoring/debug/parse.d.mts +4 -4
  21. package/authoring/debug/parse.mjs +3 -3
  22. package/authoring/doctypes/_schema.d.mts +121 -11
  23. package/authoring/doctypes/_schema.mjs +144 -13
  24. package/authoring/doctypes/base/graph-fields.doc.mjs +11 -4
  25. package/authoring/doctypes/base/type.ts +8 -4
  26. package/authoring/doctypes/command/command.doc.mjs +3 -2
  27. package/authoring/doctypes/command/parse.d.mts +2 -2
  28. package/authoring/doctypes/command/parse.mjs +1 -1
  29. package/authoring/doctypes/command/type.ts +2 -2
  30. package/authoring/doctypes/component/component.doc.mjs +5 -2
  31. package/authoring/doctypes/component/parse.d.mts +2 -2
  32. package/authoring/doctypes/component/parse.mjs +1 -1
  33. package/authoring/doctypes/component/type.ts +1 -1
  34. package/authoring/doctypes/enum/parse.d.mts +2 -2
  35. package/authoring/doctypes/enum/parse.mjs +1 -1
  36. package/authoring/doctypes/enum/type.ts +1 -1
  37. package/authoring/doctypes/function/function.doc.mjs +4 -0
  38. package/authoring/doctypes/function/parse.d.mts +2 -2
  39. package/authoring/doctypes/function/parse.mjs +1 -1
  40. package/authoring/doctypes/function/type.ts +1 -1
  41. package/authoring/doctypes/hook/hook.doc.mjs +4 -0
  42. package/authoring/doctypes/hook/parse.d.mts +2 -2
  43. package/authoring/doctypes/hook/parse.mjs +1 -1
  44. package/authoring/doctypes/hook/type.ts +1 -1
  45. package/authoring/doctypes/legacy.d.mts +6 -6
  46. package/authoring/doctypes/legacy.mjs +3 -3
  47. package/authoring/doctypes/load-contract.test.mjs +207 -0
  48. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -3
  49. package/authoring/doctypes/namespace/parse.d.mts +2 -2
  50. package/authoring/doctypes/namespace/parse.mjs +1 -1
  51. package/authoring/doctypes/namespace/type.ts +2 -2
  52. package/authoring/doctypes/parse.d.mts +18 -18
  53. package/authoring/doctypes/parse.mjs +9 -9
  54. package/authoring/doctypes/reference/parse.d.mts +2 -2
  55. package/authoring/doctypes/reference/parse.mjs +1 -1
  56. package/authoring/doctypes/reference/reference.doc.mjs +6 -2
  57. package/authoring/doctypes/reference/type.ts +1 -1
  58. package/authoring/doctypes/schema/parse.d.mts +2 -2
  59. package/authoring/doctypes/schema/parse.mjs +1 -1
  60. package/authoring/doctypes/schema/type.ts +2 -2
  61. package/authoring/doctypes/template/parse.d.mts +92 -1
  62. package/authoring/doctypes/template/parse.mjs +33 -1
  63. package/authoring/doctypes/template/template.doc.mjs +4 -0
  64. package/authoring/doctypes/template/type.ts +4 -1
  65. package/authoring/doctypes/types.ts +10 -10
  66. package/authoring/gap-report/parse.d.mts +9 -9
  67. package/authoring/gap-report/parse.mjs +6 -6
  68. package/authoring/gap-report/type.ts +1 -1
  69. package/authoring/identity/identity.doc.mjs +3 -2
  70. package/authoring/identity/type.ts +10 -10
  71. package/authoring/index.d.ts +19 -19
  72. package/authoring/integration/parse.d.mts +2 -2
  73. package/authoring/integration/parse.mjs +1 -1
  74. package/authoring/integration/schema.d.mts +4 -4
  75. package/authoring/integration/schema.mjs +3 -3
  76. package/authoring/integration/type.ts +1 -1
  77. package/foundation/discovery/authoring-self-docs.test.mjs +71 -12
  78. package/foundation/discovery/docs-discovery.d.mts +4 -0
  79. package/foundation/discovery/docs-discovery.mjs +16 -2
  80. package/foundation/discovery/docs-discovery.test.mjs +47 -11
  81. package/foundation/doc-compiler/compile.d.mts +162 -0
  82. package/foundation/doc-compiler/compile.mjs +262 -0
  83. package/foundation/doc-compiler/doc-compiler.test.mjs +687 -0
  84. package/foundation/doc-compiler/ir.d.mts +9 -0
  85. package/foundation/doc-compiler/ir.mjs +287 -0
  86. package/foundation/doc-compiler/lenses.d.mts +33 -0
  87. package/foundation/doc-compiler/lenses.mjs +127 -0
  88. package/package.json +9 -9
@@ -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').FunctionDoc} FunctionDoc */
4
+ /** @typedef {import('../types.js').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").FunctionDoc;
13
+ export type FunctionDoc = import("../types.js").FunctionDoc;
@@ -14,7 +14,7 @@
14
14
 
15
15
  import {parseHook} from '../hook/parse.mjs';
16
16
 
17
- /** @typedef {import('../types').FunctionDoc} FunctionDoc */
17
+ /** @typedef {import('../types.js').FunctionDoc} FunctionDoc */
18
18
 
19
19
  /**
20
20
  * Validate an unknown value as a stamped function doc, or throw.
@@ -14,7 +14,7 @@ import type {
14
14
  AuthoredDocGraphFields,
15
15
  HookParamDoc,
16
16
  UsageDoc,
17
- } from '../base/type';
17
+ } from '../base/type.js';
18
18
 
19
19
  /**
20
20
  * A documented return. Hooks list named return fields (`name` set); CLI/API
@@ -200,6 +200,10 @@ 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
+ },
203
207
  {
204
208
  type: 'prose',
205
209
  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').HookDoc} HookDoc */
4
+ /** @typedef {import('../types.js').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").HookDoc;
13
+ export type HookDoc = import("../types.js").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').HookDoc} HookDoc */
11
+ /** @typedef {import('../types.js').HookDoc} HookDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped function/hook doc, or throw.
@@ -12,7 +12,7 @@ import type {
12
12
  HookReturnDoc,
13
13
  RegistryDocIdentity,
14
14
  UsageDoc,
15
- } from '../base/type';
15
+ } from '../base/type.js';
16
16
 
17
17
  /**
18
18
  * Documentation for a standalone hook's .doc.mjs file.
@@ -1,9 +1,9 @@
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').ComponentDoc} ComponentDoc */
5
- /** @typedef {import('./types').HookDoc} HookDoc */
6
- /** @typedef {import('./types').ReferenceDoc} ReferenceDoc */
4
+ /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
5
+ /** @typedef {import('./types.js').HookDoc} HookDoc */
6
+ /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
7
7
  /**
8
8
  * Validate an unknown value as a legacy (unstamped) doc, or throw.
9
9
  *
@@ -12,6 +12,6 @@
12
12
  * @returns {ComponentDoc | HookDoc | ReferenceDoc}
13
13
  */
14
14
  export function parseLegacyDoc(input: unknown, label?: string): ComponentDoc | HookDoc | ReferenceDoc;
15
- export type ComponentDoc = import("./types").ComponentDoc;
16
- export type HookDoc = import("./types").HookDoc;
17
- export type ReferenceDoc = import("./types").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;
@@ -10,9 +10,9 @@
10
10
  import {LegacyDocSchema} from './_schema.mjs';
11
11
  import {formatZodError} from '../_shared/errors.mjs';
12
12
 
13
- /** @typedef {import('./types').ComponentDoc} ComponentDoc */
14
- /** @typedef {import('./types').HookDoc} HookDoc */
15
- /** @typedef {import('./types').ReferenceDoc} ReferenceDoc */
13
+ /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
14
+ /** @typedef {import('./types.js').HookDoc} HookDoc */
15
+ /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
16
16
 
17
17
  /**
18
18
  * Validate an unknown value as a legacy (unstamped) doc, or throw.
@@ -0,0 +1,207 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Every authored doc kind has a compile-time lock between its load check
5
+ * and its published type: the `_*DriftLock` typedefs in `_schema.mjs` and
6
+ * `template/parse.mjs`, which the strict typecheck evaluates. A lock names each
7
+ * place the loader is deliberately looser than the type. These tests pin that
8
+ * looser behavior and the published unknown-field policy, so tightening a load
9
+ * check is a reviewed change rather than a silent one.
10
+ */
11
+
12
+ import * as fs from 'node:fs';
13
+ import * as path from 'node:path';
14
+ import {fileURLToPath, pathToFileURL} from 'node:url';
15
+ import {describe, expect, it} from 'vitest';
16
+ import {parseDoc} from './parse.mjs';
17
+ import {AuthoredDocKindSchema} from './_schema.mjs';
18
+ import {doc as graphFieldsDoc} from './base/graph-fields.doc.mjs';
19
+ import {problemsInTopic} from '../../foundation/discovery/docs-discovery.mjs';
20
+
21
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
22
+ const KINDS = AuthoredDocKindSchema.options;
23
+
24
+ /** The lock that pins each kind's load check to its published type. */
25
+ const LOCKS = {
26
+ component: '_ComponentDocDriftLock',
27
+ function: '_FunctionDocDriftLock',
28
+ generic: '_ReferenceDocDriftLock',
29
+ page: '_PageTemplateDocDriftLock',
30
+ block: '_BlockTemplateDocDriftLock',
31
+ schema: '_SchemaDocDriftLock',
32
+ command: '_CommandDocDriftLock',
33
+ enum: '_EnumDocDriftLock',
34
+ namespace: '_NamespaceDocDriftLock',
35
+ };
36
+
37
+ /** One valid example doc per kind, from the typed examples. */
38
+ const EXAMPLES = Object.fromEntries(
39
+ await Promise.all(
40
+ KINDS.map(async kind => {
41
+ const file = {generic: 'reference', function: 'function'}[kind] ?? kind;
42
+ const url = pathToFileURL(
43
+ path.join(HERE, '../../test/authoring-types', `${file}.doc.mjs`),
44
+ );
45
+ return [kind, (await import(url.href)).docs];
46
+ }),
47
+ ),
48
+ );
49
+
50
+ describe('load check vs published type', () => {
51
+ it('locks every doc kind', () => {
52
+ const source = ['_schema.mjs', 'template/parse.mjs']
53
+ .map(file => fs.readFileSync(path.join(HERE, file), 'utf8'))
54
+ .join('\n');
55
+ expect(Object.keys(LOCKS).sort()).toEqual([...KINDS].sort());
56
+ const locks = [
57
+ ...Object.values(LOCKS),
58
+ '_AuthoredDocKindDriftLock',
59
+ '_HookDocIsFunctionDocLock',
60
+ ];
61
+ for (const lock of locks) {
62
+ expect(source, `${lock} is missing`).toMatch(
63
+ new RegExp(`\\}\\s*${lock}\\b`),
64
+ );
65
+ }
66
+ });
67
+
68
+ it('dispatches every doc kind and refuses any other', () => {
69
+ for (const kind of KINDS) {
70
+ expect(() => parseDoc(EXAMPLES[kind], `${kind}.doc.mjs`)).not.toThrow();
71
+ }
72
+ expect(() => parseDoc({type: 'widget', name: 'x'}, 'x.doc.mjs')).toThrow(
73
+ /unsupported type "widget"/,
74
+ );
75
+ });
76
+ });
77
+
78
+ describe('where loading is deliberately looser than the type', () => {
79
+ it('a stamped component needs no displayName; usage, theming and examples are unchecked', () => {
80
+ expect(() =>
81
+ parseDoc(
82
+ {
83
+ type: 'component',
84
+ name: 'Badge',
85
+ category: 'badges',
86
+ props: [],
87
+ usage: 'free text',
88
+ theming: 5,
89
+ examples: [{title: 'Basic'}],
90
+ },
91
+ 'Badge.doc.mjs',
92
+ ),
93
+ ).not.toThrow();
94
+ });
95
+
96
+ it('each entry of a stamped group doc needs a name, and nothing more', () => {
97
+ const group = (/** @type {unknown[]} */ components) => ({
98
+ type: 'component',
99
+ name: 'Tabs',
100
+ components,
101
+ });
102
+ expect(() =>
103
+ parseDoc(
104
+ group([{name: 'Tab'}, {name: 'TabPanel', description: 'x'}]),
105
+ 'Tabs.doc.mjs',
106
+ ),
107
+ ).not.toThrow();
108
+ for (const bad of [null, 5, 'Tab', {}, {name: ''}, {displayName: 'Tab'}]) {
109
+ expect(() => parseDoc(group([bad]), 'Tabs.doc.mjs')).toThrow(
110
+ /components\.0/,
111
+ );
112
+ }
113
+ });
114
+
115
+ it('a stamped function needs no displayName; usage is unchecked', () => {
116
+ expect(() =>
117
+ parseDoc(
118
+ {type: 'function', name: 'useX', params: [], returns: [], usage: 5},
119
+ 'useX.doc.mjs',
120
+ ),
121
+ ).not.toThrow();
122
+ });
123
+
124
+ it('a stamped generic doc loads without title, description or sections, but is no topic', () => {
125
+ const doc = parseDoc({type: 'generic', name: 'notes'}, 'notes.doc.mjs');
126
+ expect(doc.title).toBe('notes');
127
+ expect(problemsInTopic(doc)).toEqual([
128
+ 'description: expected a non-empty string',
129
+ 'sections: expected at least one section',
130
+ ]);
131
+ });
132
+
133
+ it('a template needs no displayName or aspectRatio and may use its own category', () => {
134
+ expect(() =>
135
+ parseDoc(
136
+ {type: 'block', name: 'widget-demo', category: 'components/Widget'},
137
+ 'widget-demo.doc.mjs',
138
+ ),
139
+ ).not.toThrow();
140
+ expect(() =>
141
+ parseDoc(
142
+ {type: 'page', name: 'widget-page', category: 'Widgets'},
143
+ 'widget-page.doc.mjs',
144
+ ),
145
+ ).not.toThrow();
146
+ });
147
+
148
+ it('schema, command and enum docs load only as their type allows', () => {
149
+ const {fields, ...schemaDoc} = EXAMPLES.schema;
150
+ const {summary, ...commandDoc} = EXAMPLES.command;
151
+ const {members, ...enumDoc} = EXAMPLES.enum;
152
+ expect(() => parseDoc(schemaDoc, 's.doc.mjs')).toThrow(/fields/);
153
+ expect(() => parseDoc(commandDoc, 'c.doc.mjs')).toThrow(/summary/);
154
+ expect(() => parseDoc(enumDoc, 'e.doc.mjs')).toThrow(/members/);
155
+ });
156
+ });
157
+
158
+ describe('unknown fields', () => {
159
+ const keeps = KINDS.filter(kind => {
160
+ try {
161
+ parseDoc({...EXAMPLES[kind], notAField: true}, `${kind}.doc.mjs`);
162
+ return true;
163
+ } catch {
164
+ return false;
165
+ }
166
+ });
167
+
168
+ it('match the published policy', () => {
169
+ const policy = graphFieldsDoc.notes
170
+ .map(note => ('text' in note ? note.text : ''))
171
+ .find(text => text.startsWith('Unknown fields'));
172
+ expect(policy, 'graph-fields.doc.mjs states the policy').toBeDefined();
173
+ const [kept, refused] = /** @type {string} */ (policy).split(
174
+ ' docs accept',
175
+ );
176
+ const named = (/** @type {string} */ text) =>
177
+ [...text.matchAll(/`([a-z]+)`/g)].map(match => match[1]).sort();
178
+ expect(named(kept)).toEqual([...keeps].sort());
179
+ expect(named(refused).filter(kind => KINDS.includes(kind))).toEqual(
180
+ KINDS.filter(kind => !keeps.includes(kind)).sort(),
181
+ );
182
+ });
183
+
184
+ it('are refused inside sections and content blocks', () => {
185
+ const [section] = EXAMPLES.generic.sections;
186
+ expect(() =>
187
+ parseDoc(
188
+ {...EXAMPLES.generic, sections: [{...section, notAField: true}]},
189
+ 'r.doc.mjs',
190
+ ),
191
+ ).toThrow();
192
+ expect(() =>
193
+ parseDoc(
194
+ {
195
+ ...EXAMPLES.generic,
196
+ sections: [
197
+ {
198
+ ...section,
199
+ content: [{type: 'prose', text: 'x', notAField: true}],
200
+ },
201
+ ],
202
+ },
203
+ 'r.doc.mjs',
204
+ ),
205
+ ).toThrow();
206
+ });
207
+ });
@@ -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.',
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.",
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 fails compilation instead of falling back.',
47
+ 'Optional canonical parent request: {parent, slot?, order?}. Invalid explicit placement will fail compilation instead of falling back.',
48
48
  },
49
49
  {
50
50
  name: 'aliases',
51
51
  type: 'string[]',
52
52
  description:
53
- 'Prior names or routes that must keep resolving to this doc.',
53
+ 'Prior names or routes the docs graph will keep resolving to this doc.',
54
54
  },
55
55
  {
56
56
  name: 'audience',
@@ -111,6 +111,10 @@ export const docs = {
111
111
  },
112
112
  ],
113
113
  notes: [
114
+ {
115
+ 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.",
117
+ },
114
118
  {
115
119
  type: 'prose',
116
120
  text: 'Child docs request one canonical home with placement. Collections store and render stable references to those docs; they never create a second identity or parent.',
@@ -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').NamespaceDoc} NamespaceDoc */
4
+ /** @typedef {import('../types.js').NamespaceDoc} NamespaceDoc */
5
5
  /**
6
6
  * Validate an unknown value as a NamespaceDoc, or throw a readable error.
7
7
  * @param {unknown} input
@@ -9,4 +9,4 @@
9
9
  * @returns {NamespaceDoc}
10
10
  */
11
11
  export function parseNamespace(input: unknown, label?: string): NamespaceDoc;
12
- export type NamespaceDoc = import("../types").NamespaceDoc;
12
+ export type NamespaceDoc = import("../types.js").NamespaceDoc;
@@ -8,7 +8,7 @@
8
8
  import {NamespaceDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types').NamespaceDoc} NamespaceDoc */
11
+ /** @typedef {import('../types.js').NamespaceDoc} NamespaceDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a NamespaceDoc, or throw a readable error.
@@ -6,8 +6,8 @@
6
6
  * or copies child documents.
7
7
  */
8
8
 
9
- import type {AuthoredDocGraphFields, AuthoredDocKind} from '../base/type';
10
- import type {ReferenceContentBlock} from '../reference/type';
9
+ import type {AuthoredDocGraphFields, AuthoredDocKind} from '../base/type.js';
10
+ import type {ReferenceContentBlock} from '../reference/type.js';
11
11
 
12
12
  /** Which providers may contribute appearances to a namespace slot. */
13
13
  export type NamespaceProviderScope = 'same' | 'configured';
@@ -1,15 +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').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 */
12
- /** @typedef {import('./types').NamespaceDoc} NamespaceDoc */
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 */
13
13
  /**
14
14
  * Validate an unknown loaded doc value into its typed shape, or throw.
15
15
  * Dispatches on the stamped `type`; unstamped docs fall back to
@@ -21,12 +21,12 @@
21
21
  * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc}
22
22
  */
23
23
  export function parseDoc(input: unknown, label?: string): ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc;
24
- export type ComponentDoc = import("./types").ComponentDoc;
25
- export type HookDoc = import("./types").HookDoc;
26
- export type FunctionDoc = import("./types").FunctionDoc;
27
- export type ReferenceDoc = import("./types").ReferenceDoc;
28
- export type TemplateDoc = import("./types").TemplateDoc;
29
- export type SchemaDoc = import("./types").SchemaDoc;
30
- export type CommandDoc = import("./types").CommandDoc;
31
- export type EnumDoc = import("./types").EnumDoc;
32
- export type NamespaceDoc = import("./types").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;
@@ -18,15 +18,15 @@ import {parseEnum} from './enum/parse.mjs';
18
18
  import {parseNamespace} from './namespace/parse.mjs';
19
19
  import {parseLegacyDoc} from './legacy.mjs';
20
20
 
21
- /** @typedef {import('./types').ComponentDoc} ComponentDoc */
22
- /** @typedef {import('./types').HookDoc} HookDoc */
23
- /** @typedef {import('./types').FunctionDoc} FunctionDoc */
24
- /** @typedef {import('./types').ReferenceDoc} ReferenceDoc */
25
- /** @typedef {import('./types').TemplateDoc} TemplateDoc */
26
- /** @typedef {import('./types').SchemaDoc} SchemaDoc */
27
- /** @typedef {import('./types').CommandDoc} CommandDoc */
28
- /** @typedef {import('./types').EnumDoc} EnumDoc */
29
- /** @typedef {import('./types').NamespaceDoc} NamespaceDoc */
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 */
30
30
 
31
31
  /**
32
32
  * Validate an unknown loaded doc value into its typed shape, or throw.
@@ -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').ReferenceDoc} ReferenceDoc */
4
+ /** @typedef {import('../types.js').ReferenceDoc} ReferenceDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped reference/topic doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {ReferenceDoc}
11
11
  */
12
12
  export function parseReference(input: unknown, label?: string): ReferenceDoc;
13
- export type ReferenceDoc = import("../types").ReferenceDoc;
13
+ export type ReferenceDoc = import("../types.js").ReferenceDoc;
@@ -9,7 +9,7 @@
9
9
  import {GenericDocKindSchema} from '../_schema.mjs';
10
10
  import {formatZodError} from '../../_shared/errors.mjs';
11
11
 
12
- /** @typedef {import('../types').ReferenceDoc} ReferenceDoc */
12
+ /** @typedef {import('../types.js').ReferenceDoc} ReferenceDoc */
13
13
 
14
14
  /**
15
15
  * Validate an unknown value as a stamped reference/topic doc, or throw.
@@ -95,7 +95,7 @@ export const doc = {
95
95
  name: 'sections[].content',
96
96
  type: 'ReferenceContentBlock[]',
97
97
  description:
98
- 'Ordered content blocks. Existing prose, heading, code, table, list, and token-ref blocks remain; V1 adds workflow, collection, and reference.',
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.',
99
99
  required: true,
100
100
  },
101
101
  {
@@ -140,7 +140,11 @@ export const docs = {
140
140
  notes: [
141
141
  {
142
142
  type: 'prose',
143
- text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, a discriminated union. V1 adds only workflow, collection, and reference; choice, callout, and checklist remain invalid. The same union is reused by the `notes` field on SchemaDoc and CommandDoc.',
143
+ text: 'A stamped generic doc without `title`, `description` or `sections` still loads, as older codemod output does; its title falls back to `displayName` or `name`. Without a description and sections it is not a usable topic, and `astryx doctor` reports it.',
144
+ },
145
+ {
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.',
144
148
  },
145
149
  {
146
150
  type: 'code',
@@ -4,7 +4,7 @@
4
4
  * @file Reference/topic doc types.
5
5
  */
6
6
 
7
- import type {AuthoredDocGraphFields} from '../base/type';
7
+ import type {AuthoredDocGraphFields} from '../base/type.js';
8
8
 
9
9
  /** One step in a renderer-neutral workflow. */
10
10
  export interface WorkflowStep {
@@ -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').SchemaDoc} SchemaDoc */
4
+ /** @typedef {import('../types.js').SchemaDoc} SchemaDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped schema doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {SchemaDoc}
11
11
  */
12
12
  export function parseSchema(input: unknown, label?: string): SchemaDoc;
13
- export type SchemaDoc = import("../types").SchemaDoc;
13
+ export type SchemaDoc = import("../types.js").SchemaDoc;
@@ -8,7 +8,7 @@
8
8
  import {SchemaDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types').SchemaDoc} SchemaDoc */
11
+ /** @typedef {import('../types.js').SchemaDoc} SchemaDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped schema doc, or throw.
@@ -6,8 +6,8 @@
6
6
  * response envelope). Colocated as a `.doc.mjs` next to the schema it describes.
7
7
  */
8
8
 
9
- import type {AuthoredDocGraphFields} from '../base/type';
10
- import type {ReferenceContentBlock} from '../reference/type';
9
+ import type {AuthoredDocGraphFields} from '../base/type.js';
10
+ import type {ReferenceContentBlock} from '../reference/type.js';
11
11
 
12
12
  /**
13
13
  * One documented field of a schema. Object fields nest via `fields`, so a whole