@astryxdesign/cli 0.3.0-canary.c857354 → 0.3.0-canary.fbc60c5

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 (79) hide show
  1. package/api/component/_adapter.mjs +3 -0
  2. package/api/integration/validate-integration.d.mts +2 -18
  3. package/api/integration/validate-integration.mjs +16 -141
  4. package/api/template/copy/copy.d.mts +2 -2
  5. package/api/template/copy/copy.mjs +2 -2
  6. package/api/template/list/list.d.mts +2 -2
  7. package/api/template/list/list.mjs +2 -2
  8. package/api/template/show/show.d.mts +2 -2
  9. package/api/template/show/show.mjs +2 -2
  10. package/api/template/skeleton/skeleton.d.mts +3 -3
  11. package/api/template/skeleton/skeleton.mjs +3 -3
  12. package/api/template/template.d.mts +7 -7
  13. package/api/template/template.mjs +7 -7
  14. package/authoring/_shared/errors.d.mts +21 -0
  15. package/authoring/codemod/codemod.doc.d.mts +11 -0
  16. package/authoring/codemod/parse.d.mts +48 -2
  17. package/authoring/config/config.doc.d.mts +10 -0
  18. package/authoring/config/parse.d.mts +54 -2
  19. package/authoring/doctypes/_schema.d.mts +248 -0
  20. package/authoring/doctypes/command/command.doc.d.mts +12 -0
  21. package/authoring/doctypes/command/parse.d.mts +11 -2
  22. package/authoring/doctypes/component/component.doc.d.mts +11 -0
  23. package/authoring/doctypes/component/parse.d.mts +11 -2
  24. package/authoring/doctypes/enum/enum.doc.d.mts +11 -0
  25. package/authoring/doctypes/enum/parse.d.mts +11 -2
  26. package/authoring/doctypes/function/function.doc.d.mts +11 -0
  27. package/authoring/doctypes/function/parse.d.mts +11 -2
  28. package/authoring/doctypes/function/parse.mjs +24 -4
  29. package/authoring/doctypes/hook/hook.doc.d.mts +10 -0
  30. package/authoring/doctypes/hook/parse.d.mts +11 -2
  31. package/authoring/doctypes/legacy.d.mts +13 -2
  32. package/authoring/doctypes/parse.d.mts +29 -20
  33. package/authoring/doctypes/reference/parse.d.mts +11 -2
  34. package/authoring/doctypes/reference/reference.doc.d.mts +11 -0
  35. package/authoring/doctypes/schema/parse.d.mts +11 -2
  36. package/authoring/doctypes/schema/schema.doc.d.mts +11 -0
  37. package/authoring/doctypes/template/parse.d.mts +12 -2
  38. package/authoring/doctypes/template/template.doc.d.mts +11 -0
  39. package/authoring/index.d.mts +16 -0
  40. package/authoring/integration/integration.doc.d.mts +10 -0
  41. package/authoring/integration/parse.d.mts +30 -2
  42. package/clients/cli/commands/hook.doc.mjs +1 -1
  43. package/clients/cli/lib/manifest.mjs +1 -1
  44. package/foundation/agent-docs/agent-docs.d.mts +197 -0
  45. package/foundation/config/config-cache.d.mts +53 -0
  46. package/foundation/config/project.d.mts +154 -0
  47. package/foundation/config/project.mjs +3 -3
  48. package/foundation/discovery/component-discovery.d.mts +140 -0
  49. package/foundation/discovery/component-loader.d.mts +50 -0
  50. package/foundation/discovery/hook-discovery.d.mts +28 -0
  51. package/{api/template/_adapter.d.mts → foundation/discovery/template-adapter.d.mts} +1 -1
  52. package/{api/template/_adapter.mjs → foundation/discovery/template-adapter.mjs} +20 -15
  53. package/foundation/env/node-version.d.mts +52 -0
  54. package/foundation/env/package-manager.d.mts +84 -0
  55. package/foundation/env/semver.d.mts +56 -0
  56. package/foundation/fs/module-loader.d.mts +36 -0
  57. package/foundation/fs/path-safety.d.mts +74 -0
  58. package/foundation/fs/paths.d.mts +35 -0
  59. package/foundation/integrations/integration-warnings.d.mts +17 -0
  60. package/foundation/integrations/integration-warnings.mjs +1 -1
  61. package/foundation/integrations/integrations.d.mts +80 -0
  62. package/foundation/integrations/validate-contributions.d.mts +22 -0
  63. package/foundation/integrations/validate-contributions.mjs +162 -0
  64. package/foundation/response/error-codes.d.mts +103 -0
  65. package/foundation/response/error-codes.doc.d.mts +11 -0
  66. package/foundation/response/json.d.mts +75 -0
  67. package/foundation/response/response-types.doc.d.mts +12 -0
  68. package/foundation/response/response.doc.d.mts +11 -0
  69. package/foundation/text/levenshtein.d.mts +21 -0
  70. package/foundation/text/string-utils.d.mts +43 -0
  71. package/foundation/xle/browser.d.mts +89 -0
  72. package/foundation/xle/expand.d.mts +23 -0
  73. package/foundation/xle/parse.d.mts +72 -0
  74. package/foundation/xle/print.d.mts +7 -0
  75. package/foundation/xle/registry-core.d.mts +168 -0
  76. package/foundation/xle/registry.d.mts +19 -0
  77. package/foundation/xle/splice.d.mts +42 -0
  78. package/foundation/xle/validate.d.mts +94 -0
  79. package/package.json +9 -9
@@ -270,6 +270,9 @@ export async function resolveUnscopedDoc(dirName, {coreDir, cwd, name}) {
270
270
  let resolvedName = dirName;
271
271
  // Track the resolving owner so the detail payload can carry ownership info.
272
272
  // Defaults to core; the legacy-external fallback below may reassign it.
273
+ // Annotated because CORE_PACKAGE's generated declaration carries the literal
274
+ // type, which (unlike a fresh literal) does not widen on assignment.
275
+ /** @type {string} */
273
276
  let resolvedOwnerPackage = CORE_PACKAGE;
274
277
  let resolvedSourcePath = readmePath ? findComponentSource(coreDir, dirName) : null;
275
278
 
@@ -1,24 +1,6 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /**
5
- * Validate an already-LOADED integration (as produced by
6
- * `loadIntegrations` in lib/integrations.mjs — absolute contribution roots
7
- * plus identity) and return its issues. This is the reuse seam for everyday
8
- * commands that have already loaded the configured integrations and want the
9
- * SAME validators that `validate-integration` runs, without re-resolving the
10
- * manifest from disk.
11
- *
12
- * The manifest schema is intentionally NOT re-validated here: `loadIntegrations`
13
- * already validated it (and throws otherwise), so by the time a command holds a
14
- * loaded integration the manifest is known-good. We re-run the on-disk
15
- * contribution checks (roots + codemods/templates/components) because those can
16
- * regress independently of the manifest (a deleted directory, a broken template).
17
- *
18
- * @param {import('./validate-integration.type.mjs').LoadedIntegration} loaded loaded-integration-shaped object
19
- * @returns {Promise<Issue[]>}
20
- */
21
- export function validateLoadedIntegration(loaded: import("./validate-integration.type.mjs").LoadedIntegration): Promise<Issue[]>;
22
4
  /**
23
5
  * Validate the LOCAL integration package rooted at `cwd`: nearest package.json
24
6
  * + a single sibling astryx.integration.{ts,mjs,js}. A missing manifest yields
@@ -59,6 +41,7 @@ export function summarizeIssues(issues: Issue[]): {
59
41
  errors: number;
60
42
  warnings: number;
61
43
  };
44
+ export { validateLoadedIntegration };
62
45
  export type Issue = import("../../foundation/integrations/issue").AstryxIntegrationIssue;
63
46
  export type ValidateResult = {
64
47
  /**
@@ -79,3 +62,4 @@ export type ValidateResult = {
79
62
  manifestFile?: string | undefined;
80
63
  issues: Issue[];
81
64
  };
65
+ import { validateLoadedIntegration } from '../../foundation/integrations/validate-contributions.mjs';
@@ -17,6 +17,14 @@
17
17
  * is false only for the no-manifest local case, which is guidance (not an
18
18
  * error) so `validate-integration` can stay exit-0 in a non-integration dir.
19
19
  *
20
+ * The on-disk contribution validators themselves (roots + codemods/templates/
21
+ * components, behind `validateLoadedIntegration`) live in
22
+ * `foundation/integrations/validate-contributions.mjs`, because foundation also
23
+ * runs them: `Project` collects integration issues and `integration-warnings`
24
+ * nudges about them on ordinary commands. This file re-exports
25
+ * `validateLoadedIntegration` so existing importers are unaffected, and keeps
26
+ * the command-level entry points that resolve a manifest from disk.
27
+ *
20
28
  * Validators are intentionally small and independent so more checks can be
21
29
  * appended without reshaping the result. Issue `code`s are stable public
22
30
  * strings.
@@ -30,9 +38,14 @@ import {
30
38
  loadManifestObject,
31
39
  resolvePackageDir,
32
40
  } from '../../foundation/integrations/integrations.mjs';
33
- import {discoverIntegrationCodemods} from '../../assets/codemods/integration-discovery.mjs';
34
- import {discoverIntegrationTemplatesForOne} from '../template/template.mjs';
35
- import * as componentDiscovery from '../../foundation/discovery/component-discovery.mjs';
41
+ // The on-disk contribution validators live in foundation: Project and
42
+ // integration-warnings need them too, and foundation must not depend on api.
43
+ import {
44
+ validateLoadedIntegration,
45
+ issueError as error,
46
+ } from '../../foundation/integrations/validate-contributions.mjs';
47
+
48
+ export {validateLoadedIntegration};
36
49
 
37
50
  /**
38
51
  * @typedef {import('../../foundation/integrations/issue').AstryxIntegrationIssue} Issue
@@ -63,144 +76,6 @@ function findNearestPackageJson(cwd) {
63
76
  }
64
77
  }
65
78
 
66
- /** @param {string} code @param {string} message @returns {Issue} */
67
- function error(code, message) {
68
- return {code, severity: 'error', message};
69
- }
70
-
71
- /**
72
- * Verify each declared contribution root exists on disk. A declared-but-missing
73
- * root is a `missing_root` error.
74
- * @param {{components?: string, templates?: string, codemods?: string}} resolved
75
- * absolute resolved roots (undefined when not declared)
76
- * @param {Issue[]} issues
77
- */
78
- function checkRoots(resolved, issues) {
79
- const kinds = /** @type {const} */ (['components', 'templates', 'codemods']);
80
- for (const kind of kinds) {
81
- const root = resolved[kind];
82
- if (root == null) continue;
83
- if (!fs.existsSync(root)) {
84
- issues.push(
85
- error(
86
- 'missing_root',
87
- `Declared ${kind} root does not exist on disk: ${root}`,
88
- ),
89
- );
90
- }
91
- }
92
- }
93
-
94
- /**
95
- * Validate the integration's codemods via the landed discovery. Discovery is
96
- * strict (throws on bad export / duplicate id); we convert any throw into an
97
- * `invalid_codemod` error.
98
- * @param {import('./validate-integration.type.mjs').LoadedIntegration} integration loaded-integration-shaped object
99
- * @param {Issue[]} issues
100
- */
101
- async function checkCodemods(integration, issues) {
102
- if (!integration.codemods || !fs.existsSync(integration.codemods)) return;
103
- try {
104
- await discoverIntegrationCodemods([integration]);
105
- } catch (err) {
106
- issues.push(error('invalid_codemod', /** @type {any} */ (err).message));
107
- }
108
- }
109
-
110
- /**
111
- * Validate the integration's templates via the landed discovery. Per-template
112
- * problems are reported as `invalid_template` errors.
113
- * @param {import('./validate-integration.type.mjs').LoadedIntegration} integration loaded-integration-shaped object
114
- * @param {Issue[]} issues
115
- */
116
- async function checkTemplates(integration, issues) {
117
- if (!integration.templates || !fs.existsSync(integration.templates)) return;
118
- try {
119
- const {errors} = await discoverIntegrationTemplatesForOne(integration);
120
- for (const e of errors) {
121
- issues.push(error('invalid_template', e.message));
122
- }
123
- } catch (err) {
124
- issues.push(error('invalid_template', /** @type {any} */ (err).message));
125
- }
126
- }
127
-
128
- /**
129
- * Validate the integration's components via the landed ownership discovery.
130
- * Feature-detected: if the component-ownership export isn't present in this
131
- * build (sibling PR not yet merged), component validation is skipped rather
132
- * than hard-failing.
133
- *
134
- * `discoverIntegrationComponents` returns ownership records and does not throw
135
- * on a missing same-stem source — it records `sourcePath: null`. We surface
136
- * each such record as an `invalid_component` error.
137
- * @param {import('./validate-integration.type.mjs').LoadedIntegration} integration loaded-integration-shaped object
138
- * @param {Issue[]} issues
139
- */
140
- async function checkComponents(integration, issues) {
141
- if (!integration.components || !fs.existsSync(integration.components)) return;
142
- const discover = componentDiscovery.discoverIntegrationComponents;
143
- if (typeof discover !== 'function') return; // feature not present yet
144
- try {
145
- const records = (await discover(integration)) ?? [];
146
- for (const record of records) {
147
- if (record?.sourcePath == null) {
148
- issues.push(
149
- error(
150
- 'invalid_component',
151
- `Component "${record?.name}" is missing its same-stem source file ${record?.name}.tsx.`,
152
- ),
153
- );
154
- }
155
- }
156
- } catch (err) {
157
- issues.push(error('invalid_component', /** @type {any} */ (err).message));
158
- }
159
- }
160
-
161
- /**
162
- * Run every contribution validator against a loaded-integration-shaped object.
163
- * @param {import('./validate-integration.type.mjs').LoadedIntegration} integration
164
- * @param {Issue[]} issues
165
- */
166
- async function runContributionChecks(integration, issues) {
167
- await checkCodemods(integration, issues);
168
- await checkTemplates(integration, issues);
169
- await checkComponents(integration, issues);
170
- }
171
-
172
- /**
173
- * Validate an already-LOADED integration (as produced by
174
- * `loadIntegrations` in lib/integrations.mjs — absolute contribution roots
175
- * plus identity) and return its issues. This is the reuse seam for everyday
176
- * commands that have already loaded the configured integrations and want the
177
- * SAME validators that `validate-integration` runs, without re-resolving the
178
- * manifest from disk.
179
- *
180
- * The manifest schema is intentionally NOT re-validated here: `loadIntegrations`
181
- * already validated it (and throws otherwise), so by the time a command holds a
182
- * loaded integration the manifest is known-good. We re-run the on-disk
183
- * contribution checks (roots + codemods/templates/components) because those can
184
- * regress independently of the manifest (a deleted directory, a broken template).
185
- *
186
- * @param {import('./validate-integration.type.mjs').LoadedIntegration} loaded loaded-integration-shaped object
187
- * @returns {Promise<Issue[]>}
188
- */
189
- export async function validateLoadedIntegration(loaded) {
190
- /** @type {Issue[]} */
191
- const issues = [];
192
- if (!loaded || typeof loaded !== 'object') return issues;
193
- checkRoots(
194
- {
195
- components: loaded.components,
196
- templates: loaded.templates,
197
- codemods: loaded.codemods,
198
- },
199
- issues,
200
- );
201
- await runContributionChecks(loaded, issues);
202
- return issues;
203
- }
204
79
 
205
80
  /**
206
81
  * Validate a single integration given its package directory and identity.
@@ -4,11 +4,11 @@
4
4
  /**
5
5
  * Scaffold an already-resolved template to `targetPath` (relative to `cwd`) and
6
6
  * return the `template.copy` receipt.
7
- * @param {import('../_adapter.mjs').DiscoveredTemplate} match
7
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate} match
8
8
  * @param {{targetPath: string, cwd: string, overwrite?: boolean}} ctx
9
9
  * @returns {import('../template.type.mjs').TemplateCopyResponse}
10
10
  */
11
- export function templateCopy(match: import("../_adapter.mjs").DiscoveredTemplate, { targetPath, cwd, overwrite }: {
11
+ export function templateCopy(match: import("../../../foundation/discovery/template-adapter.mjs").DiscoveredTemplate, { targetPath, cwd, overwrite }: {
12
12
  targetPath: string;
13
13
  cwd: string;
14
14
  overwrite?: boolean;
@@ -18,12 +18,12 @@ import {
18
18
  } from '../../../foundation/fs/path-safety.mjs';
19
19
  import {AstryxError} from '../../error.mjs';
20
20
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
21
- import {stripTemplateAssetRefs} from '../_adapter.mjs';
21
+ import {stripTemplateAssetRefs} from '../../../foundation/discovery/template-adapter.mjs';
22
22
 
23
23
  /**
24
24
  * Scaffold an already-resolved template to `targetPath` (relative to `cwd`) and
25
25
  * return the `template.copy` receipt.
26
- * @param {import('../_adapter.mjs').DiscoveredTemplate} match
26
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate} match
27
27
  * @param {{targetPath: string, cwd: string, overwrite?: boolean}} ctx
28
28
  * @returns {import('../template.type.mjs').TemplateCopyResponse}
29
29
  */
@@ -3,11 +3,11 @@
3
3
 
4
4
  /**
5
5
  * Project a discovered template set into the `template.list` envelope.
6
- * @param {import('../_adapter.mjs').DiscoveredTemplate[]} templates
6
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate[]} templates
7
7
  * @param {{type?: 'page' | 'block', package?: string}} [options]
8
8
  * @returns {import('../template.type.mjs').TemplateListResponse}
9
9
  */
10
- export function templateList(templates: import("../_adapter.mjs").DiscoveredTemplate[], options?: {
10
+ export function templateList(templates: import("../../../foundation/discovery/template-adapter.mjs").DiscoveredTemplate[], options?: {
11
11
  type?: "page" | "block";
12
12
  package?: string;
13
13
  }): import("../template.type.mjs").TemplateListResponse;
@@ -9,11 +9,11 @@
9
9
  * no-skeleton default) here.
10
10
  */
11
11
 
12
- import {pkgOf} from '../_adapter.mjs';
12
+ import {pkgOf} from '../../../foundation/discovery/template-adapter.mjs';
13
13
 
14
14
  /**
15
15
  * Project a discovered template set into the `template.list` envelope.
16
- * @param {import('../_adapter.mjs').DiscoveredTemplate[]} templates
16
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate[]} templates
17
17
  * @param {{type?: 'page' | 'block', package?: string}} [options]
18
18
  * @returns {import('../template.type.mjs').TemplateListResponse}
19
19
  */
@@ -3,7 +3,7 @@
3
3
 
4
4
  /**
5
5
  * Build the `template.show` envelope for an already-resolved template.
6
- * @param {import('../_adapter.mjs').DiscoveredTemplate} match
6
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate} match
7
7
  * @returns {import('../template.type.mjs').TemplateShowResponse}
8
8
  */
9
- export function templateShow(match: import("../_adapter.mjs").DiscoveredTemplate): import("../template.type.mjs").TemplateShowResponse;
9
+ export function templateShow(match: import("../../../foundation/discovery/template-adapter.mjs").DiscoveredTemplate): import("../template.type.mjs").TemplateShowResponse;
@@ -11,11 +11,11 @@
11
11
  import * as fs from 'node:fs';
12
12
  import {AstryxError} from '../../error.mjs';
13
13
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
14
- import {extractComponents} from '../_adapter.mjs';
14
+ import {extractComponents} from '../../../foundation/discovery/template-adapter.mjs';
15
15
 
16
16
  /**
17
17
  * Build the `template.show` envelope for an already-resolved template.
18
- * @param {import('../_adapter.mjs').DiscoveredTemplate} match
18
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate} match
19
19
  * @returns {import('../template.type.mjs').TemplateShowResponse}
20
20
  */
21
21
  export function templateShow(match) {
@@ -5,8 +5,8 @@
5
5
  * Build the `template.skeleton` envelope for an already-resolved template.
6
6
  * `match` may be undefined when `--skeleton` is run without a name — the same
7
7
  * "specify a template name" error the dispatcher's resolution would surface.
8
- * @param {import('../_adapter.mjs').DiscoveredTemplate | undefined} match
9
- * @param {import('../_adapter.mjs').DiscoveredTemplate[]} templates
8
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate | undefined} match
9
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate[]} templates
10
10
  * @returns {import('../template.type.mjs').TemplateSkeletonResponse}
11
11
  */
12
- export function templateSkeleton(match: import("../_adapter.mjs").DiscoveredTemplate | undefined, templates: import("../_adapter.mjs").DiscoveredTemplate[]): import("../template.type.mjs").TemplateSkeletonResponse;
12
+ export function templateSkeleton(match: import("../../../foundation/discovery/template-adapter.mjs").DiscoveredTemplate | undefined, templates: import("../../../foundation/discovery/template-adapter.mjs").DiscoveredTemplate[]): import("../template.type.mjs").TemplateSkeletonResponse;
@@ -11,7 +11,7 @@
11
11
  import * as fs from 'node:fs';
12
12
  import {AstryxError} from '../../error.mjs';
13
13
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
14
- import {extractComponents} from '../_adapter.mjs';
14
+ import {extractComponents} from '../../../foundation/discovery/template-adapter.mjs';
15
15
 
16
16
  const STRUCTURAL = new Set([
17
17
  'AppShell',
@@ -223,8 +223,8 @@ function extractSkeleton(source) {
223
223
  * Build the `template.skeleton` envelope for an already-resolved template.
224
224
  * `match` may be undefined when `--skeleton` is run without a name — the same
225
225
  * "specify a template name" error the dispatcher's resolution would surface.
226
- * @param {import('../_adapter.mjs').DiscoveredTemplate | undefined} match
227
- * @param {import('../_adapter.mjs').DiscoveredTemplate[]} templates
226
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate | undefined} match
227
+ * @param {import('../../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate[]} templates
228
228
  * @returns {import('../template.type.mjs').TemplateSkeletonResponse}
229
229
  */
230
230
  export function templateSkeleton(match, templates) {
@@ -2,13 +2,13 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * @typedef {import('./_adapter.mjs').DiscoveredTemplate} DiscoveredTemplate
5
+ * @typedef {import('../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate} DiscoveredTemplate
6
6
  */
7
7
  /**
8
- * @typedef {import('./_adapter.mjs').TemplateDiscoveryError} TemplateDiscoveryError
8
+ * @typedef {import('../../foundation/discovery/template-adapter.mjs').TemplateDiscoveryError} TemplateDiscoveryError
9
9
  */
10
10
  /**
11
- * @typedef {import('./_adapter.mjs').TemplateDocModule} TemplateDocModule
11
+ * @typedef {import('../../foundation/discovery/template-adapter.mjs').TemplateDocModule} TemplateDocModule
12
12
  */
13
13
  /**
14
14
  * @param {string} [name]
@@ -36,7 +36,7 @@ export function template(name?: string, options?: {
36
36
  type: string;
37
37
  data: unknown;
38
38
  }>;
39
- export type DiscoveredTemplate = import("./_adapter.mjs").DiscoveredTemplate;
40
- export type TemplateDiscoveryError = import("./_adapter.mjs").TemplateDiscoveryError;
41
- export type TemplateDocModule = import("./_adapter.mjs").TemplateDocModule;
42
- export { discoverAll, discoverAll as discoverTemplates, discoverAllWithErrors, discoverIntegrationTemplatesForOne, stripTemplateAssetRefs, listTemplates, findRelatedBlocks, findShowcase, extractComponents } from "./_adapter.mjs";
39
+ export type DiscoveredTemplate = import("../../foundation/discovery/template-adapter.mjs").DiscoveredTemplate;
40
+ export type TemplateDiscoveryError = import("../../foundation/discovery/template-adapter.mjs").TemplateDiscoveryError;
41
+ export type TemplateDocModule = import("../../foundation/discovery/template-adapter.mjs").TemplateDocModule;
42
+ export { discoverAll, discoverAll as discoverTemplates, discoverAllWithErrors, discoverIntegrationTemplatesForOne, stripTemplateAssetRefs, listTemplates, findRelatedBlocks, findShowcase, extractComponents } from "../../foundation/discovery/template-adapter.mjs";
@@ -6,16 +6,16 @@
6
6
  * This module is BOTH the template dispatcher and the stable import surface for
7
7
  * the template family. `template()` discovers the available templates, resolves
8
8
  * the requested one, and routes to a leaf (list/show/skeleton/copy). The shared
9
- * discovery/IO + cross-command helpers live in `./_adapter.mjs` and are
9
+ * discovery/IO + cross-command helpers live in `foundation/discovery/template-adapter.mjs` and are
10
10
  * RE-EXPORTED here so external import paths (`api/template/template.mjs`) —
11
11
  * used by component, layout, search, init, discover, validate-integration, and
12
12
  * lib/project — keep resolving unchanged.
13
13
  *
14
14
  * @position api/template — the template dispatcher + barrel; leaves live under
15
- * ./list, ./show, ./skeleton, ./copy and shared discovery under ./_adapter.
15
+ * ./list, ./show, ./skeleton, ./copy and shared discovery in foundation/discovery.
16
16
  */
17
17
 
18
- import {discoverAll, pkgOf} from './_adapter.mjs';
18
+ import {discoverAll, pkgOf} from '../../foundation/discovery/template-adapter.mjs';
19
19
  import {AstryxError} from '../error.mjs';
20
20
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
21
21
  import {templateList} from './list/list.mjs';
@@ -37,16 +37,16 @@ export {
37
37
  findRelatedBlocks,
38
38
  findShowcase,
39
39
  extractComponents,
40
- } from './_adapter.mjs';
40
+ } from '../../foundation/discovery/template-adapter.mjs';
41
41
 
42
42
  /**
43
- * @typedef {import('./_adapter.mjs').DiscoveredTemplate} DiscoveredTemplate
43
+ * @typedef {import('../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate} DiscoveredTemplate
44
44
  */
45
45
  /**
46
- * @typedef {import('./_adapter.mjs').TemplateDiscoveryError} TemplateDiscoveryError
46
+ * @typedef {import('../../foundation/discovery/template-adapter.mjs').TemplateDiscoveryError} TemplateDiscoveryError
47
47
  */
48
48
  /**
49
- * @typedef {import('./_adapter.mjs').TemplateDocModule} TemplateDocModule
49
+ * @typedef {import('../../foundation/discovery/template-adapter.mjs').TemplateDocModule} TemplateDocModule
50
50
  */
51
51
 
52
52
  /**
@@ -0,0 +1,21 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * @file Shared error formatting for authoring parsers.
6
+ *
7
+ * Every authoring parser seals its zod schema and, on failure, throws a single
8
+ * readable line built here — so the message convention (path: message;
9
+ * path: message) stays identical across config, integration, codemod, and doc
10
+ * parsing. Zod is an implementation detail: the `ZodError` never escapes a
11
+ * parser, only the formatted string does.
12
+ */
13
+ /**
14
+ * Format a zod error into a single readable line: `<label> is invalid: <path>:
15
+ * <message>; <path>: <message>`.
16
+ *
17
+ * @param {string} label
18
+ * @param {import('zod').ZodError} error
19
+ * @returns {string}
20
+ */
21
+ export function formatZodError(label: string, error: import("zod").ZodError): string;
@@ -0,0 +1,11 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * @file SchemaDoc for an Astryx codemod module (AstryxCodemod /
6
+ * AstryxConfigCodemod). Colocated with the schema (`type.ts` + `parse.mjs`)
7
+ * it documents.
8
+ * @position packages/cli/authoring/codemod — schema documentation
9
+ */
10
+ /** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
11
+ export const doc: import("@astryxdesign/cli/authoring").SchemaDoc;
@@ -1,4 +1,50 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
2
3
 
3
- import type {AstryxCodemod, AstryxConfigCodemod} from './type';
4
+ /**
5
+ * Compile-time drift-lock: sealed envelope must infer exactly the public
6
+ * stamped-codemod union.
7
+ *
8
+ * @typedef {import('../_shared/contract').Expect<
9
+ * import('../_shared/contract').Equal<
10
+ * z.infer<typeof codemodEnvelopeSchema>,
11
+ * AstryxCodemod | AstryxConfigCodemod
12
+ * >
13
+ * >} _CodemodDriftLock
14
+ */
15
+ /**
16
+ * Validate an unknown value as a stamped codemod default export, or throw.
17
+ *
18
+ * @param {unknown} input
19
+ * @param {string} [label]
20
+ * @returns {AstryxCodemod | AstryxConfigCodemod}
21
+ */
4
22
  export function parseCodemod(input: unknown, label?: string): AstryxCodemod | AstryxConfigCodemod;
23
+ /**
24
+ * Compile-time drift-lock: sealed envelope must infer exactly the public
25
+ * stamped-codemod union.
26
+ */
27
+ export type _CodemodDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof codemodEnvelopeSchema>, AstryxCodemod | AstryxConfigCodemod>>;
28
+ export type AstryxCodemod = import("./type").AstryxCodemod;
29
+ export type AstryxConfigCodemod = import("./type").AstryxConfigCodemod;
30
+ export type AstryxCodemodTransform = import("./type").AstryxCodemodTransform;
31
+ import { z } from 'zod';
32
+ /**
33
+ * The load-boundary contract: a stamped codemod default export, discriminated
34
+ * by `type` (`'code'` may carry `fileExtensions`; `'config'` may not).
35
+ */
36
+ declare const codemodEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
37
+ title: z.ZodString;
38
+ description: z.ZodOptional<z.ZodString>;
39
+ isOptional: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
40
+ fileExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ transform: z.ZodType<import("./type").AstryxCodemodTransform, any, z.core.$ZodTypeInternals<import("./type").AstryxCodemodTransform, any>>;
42
+ type: z.ZodLiteral<"code">;
43
+ }, z.core.$strict>, z.ZodObject<{
44
+ title: z.ZodString;
45
+ description: z.ZodOptional<z.ZodString>;
46
+ isOptional: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
47
+ transform: z.ZodType<import("./type").AstryxCodemodTransform, any, z.core.$ZodTypeInternals<import("./type").AstryxCodemodTransform, any>>;
48
+ type: z.ZodLiteral<"config">;
49
+ }, z.core.$strict>], "type">;
50
+ export {};
@@ -0,0 +1,10 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * @file SchemaDoc for the `astryx.config.*` file (AstryxConfig). Colocated with
6
+ * the schema (`type.ts` + `parse.mjs`) it documents.
7
+ * @position packages/cli/authoring/config — schema documentation
8
+ */
9
+ /** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
10
+ export const doc: import("@astryxdesign/cli/authoring").SchemaDoc;
@@ -1,4 +1,56 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
2
3
 
3
- import type {AstryxConfig} from './type';
4
+ /**
5
+ * Compile-time drift-lock: the sealed schema must infer EXACTLY the public
6
+ * {@link AstryxConfig} type. If they drift, `Equal` becomes `false` and
7
+ * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck.
8
+ *
9
+ * @typedef {import('../_shared/contract').Expect<
10
+ * import('../_shared/contract').MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>
11
+ * >} _ConfigDriftLock
12
+ */
13
+ /**
14
+ * Validate an unknown value as an Astryx config, or throw a readable error.
15
+ *
16
+ * @param {unknown} input
17
+ * @param {string} [label]
18
+ * @returns {AstryxConfig}
19
+ */
4
20
  export function parseConfig(input: unknown, label?: string): AstryxConfig;
21
+ /**
22
+ * Compile-time drift-lock: the sealed schema must infer EXACTLY the public
23
+ * {@link AstryxConfig} type. If they drift, `Equal` becomes `false` and
24
+ * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck.
25
+ */
26
+ export type _ConfigDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>>;
27
+ export type AstryxConfig = import("./type").AstryxConfig;
28
+ export type PostCodemodHook = import("./type").PostCodemodHook;
29
+ export type XleComponent = import("./type").XleComponent;
30
+ import { z } from 'zod';
31
+ declare const configSchema: z.ZodObject<{
32
+ integrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ issuesUrl: z.ZodOptional<z.ZodString>;
34
+ hooks: z.ZodOptional<z.ZodObject<{
35
+ postCodemod: z.ZodOptional<z.ZodArray<z.ZodObject<{
36
+ name: z.ZodOptional<z.ZodString>;
37
+ buildCommand: z.ZodType<(ctx: {
38
+ packageDir: string;
39
+ files: string[];
40
+ }) => import("./type").PostCodemodCommand | null | undefined | Promise<import("./type").PostCodemodCommand | null | undefined>, any, z.core.$ZodTypeInternals<(ctx: {
41
+ packageDir: string;
42
+ files: string[];
43
+ }) => import("./type").PostCodemodCommand | null | undefined | Promise<import("./type").PostCodemodCommand | null | undefined>, any>>;
44
+ }, z.core.$strict>>>;
45
+ }, z.core.$strict>>;
46
+ experimental: z.ZodOptional<z.ZodObject<{
47
+ xle: z.ZodOptional<z.ZodObject<{
48
+ components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
49
+ from: z.ZodString;
50
+ description: z.ZodOptional<z.ZodString>;
51
+ default: z.ZodOptional<z.ZodBoolean>;
52
+ }, z.core.$strict>>>;
53
+ }, z.core.$strict>>;
54
+ }, z.core.$strict>>;
55
+ }, z.core.$strict>;
56
+ export {};