@astryxdesign/cli 0.6.3-canary.ea2f048 → 0.6.3-canary.ebaebc4
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.
- package/README.md +2 -1
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +2 -2
- package/api/component/component.type.d.mts +6 -6
- package/api/component/component.type.mjs +19 -19
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +37 -24
- package/api/docs/_adapter.mjs +169 -83
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.mjs +14 -63
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +44 -20
- package/api/docs/detail/section/section.test.mjs +41 -0
- package/api/docs/docs.d.mts +7 -2
- package/api/docs/docs.doc.mjs +27 -10
- package/api/docs/docs.mjs +16 -9
- package/api/docs/docs.test.mjs +6 -0
- package/api/docs/docs.type.d.mts +40 -3
- package/api/docs/docs.type.mjs +36 -8
- package/api/docs/index/index.d.mts +18 -0
- package/api/docs/index/index.mjs +32 -0
- package/api/docs/index/index.test.mjs +62 -0
- package/api/docs/integrationDocs.test.mjs +106 -0
- package/api/doctor/doctor.d.mts +48 -0
- package/api/doctor/doctor.mjs +232 -0
- package/api/doctor/doctor.test.mjs +196 -0
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +1 -1
- package/api/integration/add-contribution.mjs +5 -3
- package/api/integration/add-contribution.test.mjs +4 -4
- package/api/integration/integration-authoring.type.d.mts +1 -1
- package/api/integration/pack-check.mjs +49 -7
- package/api/integration/pack-check.test.mjs +249 -0
- package/api/search/search.d.mts +1 -1
- package/api/search/search.mjs +5 -5
- package/api/search/search.type.d.mts +2 -2
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/template.d.mts +1 -1
- package/api/template/template.type.d.mts +6 -6
- package/api/template/template.type.mjs +12 -12
- package/api/theme/build/build.mjs +20 -6
- package/api/theme/build/build.test.mjs +127 -0
- package/api/theme/palette/generate/generate.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +10 -13
- package/api/theme/palette/generate/generator.mjs +7 -3
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/upgrade/_adapter.mjs +71 -5
- package/api/upgrade/project-context.test.mjs +272 -0
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/api/upgrade/upgrade.type.d.mts +5 -5
- package/api/upgrade/upgrade.type.mjs +11 -11
- package/assets/codemods/integration-discovery.mjs +40 -2
- package/assets/codemods/integration-discovery.test.mjs +58 -0
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
- package/assets/docs/README.md +9 -0
- package/assets/docs/authoring.doc.mjs +14 -0
- package/assets/docs/cli-integrations.doc.mjs +86 -15
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/authoring/_shared/contract.ts +22 -0
- package/authoring/codemod/codemod.doc.mjs +6 -1
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +8 -6
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +3 -3
- package/authoring/debug/parse.d.mts +5 -5
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +788 -23
- package/authoring/doctypes/_schema.mjs +492 -39
- package/authoring/doctypes/base/graph-fields.doc.d.mts +9 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +62 -0
- package/authoring/doctypes/base/type.ts +40 -0
- package/authoring/doctypes/command/command.doc.mjs +3 -2
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +3 -2
- package/authoring/doctypes/component/component.doc.mjs +6 -3
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +4 -3
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +3 -1
- package/authoring/doctypes/function/function.doc.mjs +4 -0
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +6 -2
- package/authoring/doctypes/hook/hook.doc.mjs +4 -0
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +3 -2
- package/authoring/doctypes/legacy.d.mts +8 -6
- package/authoring/doctypes/legacy.mjs +5 -4
- package/authoring/doctypes/load-contract.test.mjs +207 -0
- package/authoring/doctypes/namespace/namespace.doc.d.mts +9 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +132 -0
- package/authoring/doctypes/namespace/parse.d.mts +12 -0
- package/authoring/doctypes/namespace/parse.mjs +25 -0
- package/authoring/doctypes/namespace/parse.test.mjs +165 -0
- package/authoring/doctypes/namespace/type.ts +71 -0
- package/authoring/doctypes/parse.d.mts +20 -18
- package/authoring/doctypes/parse.mjs +16 -10
- package/authoring/doctypes/parse.test.mjs +77 -3
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +8 -5
- package/authoring/doctypes/reference/reference.doc.mjs +17 -4
- package/authoring/doctypes/reference/type.ts +51 -5
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +3 -2
- package/authoring/doctypes/template/parse.d.mts +92 -1
- package/authoring/doctypes/template/parse.mjs +36 -2
- package/authoring/doctypes/template/parse.test.mjs +8 -2
- package/authoring/doctypes/template/template.doc.mjs +4 -0
- package/authoring/doctypes/template/type.ts +5 -2
- package/authoring/doctypes/types.ts +10 -9
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.d.mts +9 -0
- package/authoring/identity/identity.doc.mjs +61 -0
- package/authoring/identity/type.ts +132 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +49 -17
- package/authoring/index.mjs +1 -0
- package/authoring/integration/integration.doc.mjs +13 -6
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +10 -1
- package/authoring/integration/schema.d.mts +6 -4
- package/authoring/integration/schema.mjs +9 -3
- package/authoring/integration/type.ts +23 -6
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/commands/docs.doc.mjs +13 -3
- package/clients/cli/commands/docs.mjs +121 -21
- package/clients/cli/commands/docs.test.mjs +88 -0
- package/clients/cli/commands/integration-authoring.test.mjs +13 -9
- package/clients/cli/commands/theme-palette-generate.doc.mjs +8 -4
- package/clients/cli/commands/upgrade.doc.mjs +2 -2
- package/clients/cli/formatters/index.mjs +162 -1
- package/clients/cli/formatters/index.test.mjs +91 -0
- package/clients/cli/lib/manifest.mjs +7 -2
- package/foundation/config/project.mjs +21 -6
- package/foundation/discovery/authoring-self-docs.d.mts +69 -0
- package/foundation/discovery/authoring-self-docs.mjs +214 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +154 -0
- package/foundation/discovery/component-discovery.d.mts +1 -1
- package/foundation/discovery/component-discovery.mjs +2 -1
- package/foundation/discovery/docs-discovery.d.mts +11 -4
- package/foundation/discovery/docs-discovery.mjs +208 -88
- package/foundation/discovery/docs-discovery.test.mjs +279 -13
- package/foundation/discovery/docs-output-budget.d.mts +28 -0
- package/foundation/discovery/docs-output-budget.mjs +50 -0
- package/foundation/discovery/docs-section-key.d.mts +98 -0
- package/foundation/discovery/docs-section-key.mjs +221 -0
- package/foundation/discovery/docs-section-key.test.mjs +224 -0
- package/foundation/discovery/template-adapter.mjs +2 -1
- package/foundation/discovery/theming-targets.test.mjs +4 -0
- package/foundation/doc-compiler/compile.d.mts +162 -0
- package/foundation/doc-compiler/compile.mjs +262 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +687 -0
- package/foundation/doc-compiler/ir.d.mts +9 -0
- package/foundation/doc-compiler/ir.mjs +287 -0
- package/foundation/doc-compiler/lenses.d.mts +33 -0
- package/foundation/doc-compiler/lenses.mjs +127 -0
- package/foundation/identity/provider-identity.d.mts +90 -0
- package/foundation/identity/provider-identity.mjs +320 -0
- package/foundation/identity/provider-identity.test.mjs +254 -0
- package/foundation/identity/providers.d.mts +7 -0
- package/foundation/identity/providers.mjs +16 -0
- package/foundation/integrations/autolink.mjs +12 -5
- package/foundation/integrations/integration-warnings.mjs +6 -0
- package/foundation/integrations/integrations.d.mts +46 -2
- package/foundation/integrations/integrations.mjs +167 -8
- package/foundation/integrations/integrations.test.mjs +384 -1
- package/foundation/integrations/provider-conflicts.test.mjs +125 -0
- package/foundation/integrations/validate-contributions.d.mts +2 -0
- package/foundation/integrations/validate-contributions.mjs +10 -0
- package/foundation/response/json-contract.test.mjs +46 -17
- package/foundation/response/response-types.doc.mjs +6 -1
- package/package.json +9 -11
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
6
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
5
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
6
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
7
7
|
* >} _GapReportReceiptDriftLock
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -25,23 +25,23 @@ export function parseGapReportHandler(input: unknown, label?: string): GapReport
|
|
|
25
25
|
* @returns {GapReportHandlerReceipt | null}
|
|
26
26
|
*/
|
|
27
27
|
export function parseGapReportReceipt(input: unknown): GapReportHandlerReceipt | null;
|
|
28
|
-
export type _GapReportReceiptDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>>;
|
|
29
|
-
export type GapReportHandler = import("./type").GapReportHandler;
|
|
30
|
-
export type GapReportHandlerReceipt = import("./type").GapReportHandlerReceipt;
|
|
28
|
+
export type _GapReportReceiptDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>>;
|
|
29
|
+
export type GapReportHandler = import("./type.js").GapReportHandler;
|
|
30
|
+
export type GapReportHandlerReceipt = import("./type.js").GapReportHandlerReceipt;
|
|
31
31
|
/**
|
|
32
32
|
* Compile-time drift-lock: the sealed schema must infer EXACTLY the public
|
|
33
33
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
34
34
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
35
35
|
*/
|
|
36
|
-
export type _GapReportHandlerDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>>;
|
|
36
|
+
export type _GapReportHandlerDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>>;
|
|
37
37
|
import { z } from 'zod';
|
|
38
38
|
/**
|
|
39
39
|
* Compile-time drift-lock: the sealed schema must infer EXACTLY the public
|
|
40
40
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
41
41
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
42
42
|
*
|
|
43
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
44
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
43
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
44
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
45
45
|
* >} _GapReportHandlerDriftLock
|
|
46
46
|
*/
|
|
47
47
|
declare const receiptSchema: z.ZodObject<{
|
|
@@ -55,9 +55,9 @@ declare const receiptSchema: z.ZodObject<{
|
|
|
55
55
|
}, z.core.$strict>;
|
|
56
56
|
declare const handlerSchema: z.ZodObject<{
|
|
57
57
|
audience: z.ZodEnum<{
|
|
58
|
-
internal: "internal";
|
|
59
58
|
public: "public";
|
|
59
|
+
internal: "internal";
|
|
60
60
|
}>;
|
|
61
|
-
handle: z.ZodType<(report: import("./type").GapReport, context: import("./type").GapReportHandlerContext) => import("./type").GapReportHandlerReceipt | Promise<import("./type").GapReportHandlerReceipt>, any, z.core.$ZodTypeInternals<(report: import("./type").GapReport, context: import("./type").GapReportHandlerContext) => import("./type").GapReportHandlerReceipt | Promise<import("./type").GapReportHandlerReceipt>, any>>;
|
|
61
|
+
handle: z.ZodType<(report: import("./type.js").GapReport, context: import("./type.js").GapReportHandlerContext) => import("./type.js").GapReportHandlerReceipt | Promise<import("./type.js").GapReportHandlerReceipt>, any, z.core.$ZodTypeInternals<(report: import("./type.js").GapReport, context: import("./type.js").GapReportHandlerContext) => import("./type.js").GapReportHandlerReceipt | Promise<import("./type.js").GapReportHandlerReceipt>, any>>;
|
|
62
62
|
}, z.core.$strict>;
|
|
63
63
|
export {};
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
import {z} from 'zod';
|
|
14
14
|
import {formatZodError} from '../_shared/errors.mjs';
|
|
15
15
|
|
|
16
|
-
/** @typedef {import('./type').GapReportHandler} GapReportHandler */
|
|
17
|
-
/** @typedef {import('./type').GapReportHandlerReceipt} GapReportHandlerReceipt */
|
|
16
|
+
/** @typedef {import('./type.js').GapReportHandler} GapReportHandler */
|
|
17
|
+
/** @typedef {import('./type.js').GapReportHandlerReceipt} GapReportHandlerReceipt */
|
|
18
18
|
|
|
19
19
|
// Typed z.custom so z.infer reproduces the real function type, matching the
|
|
20
20
|
// pattern used by the debug handler and post-codemod hook parsers.
|
|
@@ -36,8 +36,8 @@ const handlerSchema = z
|
|
|
36
36
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
37
37
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
38
38
|
*
|
|
39
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
40
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
39
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
40
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
41
41
|
* >} _GapReportHandlerDriftLock
|
|
42
42
|
*/
|
|
43
43
|
|
|
@@ -50,8 +50,8 @@ const receiptSchema = z
|
|
|
50
50
|
.strict();
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
54
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
53
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
54
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
55
55
|
* >} _GapReportReceiptDriftLock
|
|
56
56
|
*/
|
|
57
57
|
|
|
@@ -0,0 +1,9 @@
|
|
|
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 provider, artifact, and immutable instance identity.
|
|
6
|
+
* @position packages/cli/authoring/identity — identity documentation
|
|
7
|
+
*/
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
|
|
9
|
+
export const doc: import("@astryxdesign/cli/authoring").SchemaDoc;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file SchemaDoc for provider, artifact, and immutable instance identity.
|
|
5
|
+
* @position packages/cli/authoring/identity — identity documentation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
|
|
9
|
+
export const doc = {
|
|
10
|
+
type: 'schema',
|
|
11
|
+
name: 'provider-identity',
|
|
12
|
+
displayName: 'Provider and artifact identity',
|
|
13
|
+
namespace: 'authoring',
|
|
14
|
+
description:
|
|
15
|
+
'Separates stable provider/artifact identity from package instances and runtime lifecycle state. providerId is in use today: an integration manifest may declare it, and Doctor and every command report two packages that claim one. The artifact, doc, instance, and compiler-input identities are defined for the docs graph, which is not built yet, and no command reads them.',
|
|
16
|
+
appliesTo:
|
|
17
|
+
'Integration manifests and provider conflicts today; the docs graph once it ships',
|
|
18
|
+
fields: [
|
|
19
|
+
{
|
|
20
|
+
name: 'ProviderId',
|
|
21
|
+
type: 'string',
|
|
22
|
+
description:
|
|
23
|
+
'Canonical logical provider ID. It defaults to the lowercase npm package name; Core uses the same model without publishing an integration manifest.',
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'ArtifactId',
|
|
28
|
+
type: 'string',
|
|
29
|
+
description:
|
|
30
|
+
'Versioned serialization of provider ID, contribution kind, and stable artifact name. Every segment uses RFC 3986 escaping.',
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'DocId',
|
|
35
|
+
type: 'ArtifactId',
|
|
36
|
+
description:
|
|
37
|
+
'Artifact ID restricted to one authored doc kind. Navigation changes do not change it.',
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'ProviderInstance',
|
|
42
|
+
type: '{ id; providerId; packageName; packageVersion; sourceDigest }',
|
|
43
|
+
description:
|
|
44
|
+
'One immutable package version and source/content digest. Installed, configured, loaded, selected, and healthy state is a separate runtime overlay.',
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'AuthoredDocEntry',
|
|
49
|
+
type: '{ id; provider; kind; stableName; source; authored }',
|
|
50
|
+
description:
|
|
51
|
+
'Normalized compiler input. Discovery supplies stableName independently from the authored display name, source paths remain package-relative, and provider provenance plus the authored snapshot are immutable.',
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
notes: [
|
|
56
|
+
{
|
|
57
|
+
type: 'prose',
|
|
58
|
+
text: 'Provider package renames require an explicit mapping: a ProviderInstance may retain its stable providerId while packageName changes. Silent identity changes are not inferred.',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Stable provider, artifact, and authored-doc entry contracts.
|
|
5
|
+
*
|
|
6
|
+
* Logical IDs exclude installed/configured/loaded/healthy state. A concrete
|
|
7
|
+
* provider instance adds package version and a content digest, while an
|
|
8
|
+
* artifact ID stays stable across those instances.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {AuthoredDocKind} from '../doctypes/base/type.js';
|
|
12
|
+
import type {CommandDoc} from '../doctypes/command/type.js';
|
|
13
|
+
import type {ComponentDoc} from '../doctypes/component/type.js';
|
|
14
|
+
import type {EnumDoc} from '../doctypes/enum/type.js';
|
|
15
|
+
import type {FunctionDoc} from '../doctypes/function/type.js';
|
|
16
|
+
import type {HookDoc} from '../doctypes/hook/type.js';
|
|
17
|
+
import type {NamespaceDoc} from '../doctypes/namespace/type.js';
|
|
18
|
+
import type {ReferenceDoc} from '../doctypes/reference/type.js';
|
|
19
|
+
import type {SchemaDoc} from '../doctypes/schema/type.js';
|
|
20
|
+
import type {TemplateDoc} from '../doctypes/template/type.js';
|
|
21
|
+
|
|
22
|
+
declare const providerIdBrand: unique symbol;
|
|
23
|
+
declare const artifactIdBrand: unique symbol;
|
|
24
|
+
declare const docIdBrand: unique symbol;
|
|
25
|
+
declare const providerInstanceIdBrand: unique symbol;
|
|
26
|
+
declare const contentDigestBrand: unique symbol;
|
|
27
|
+
|
|
28
|
+
/** Canonical provider identity. It defaults to the normalized npm package name. */
|
|
29
|
+
export type ProviderId = string & {readonly [providerIdBrand]: true};
|
|
30
|
+
|
|
31
|
+
/** Stable provider + contribution kind + artifact-name identity. */
|
|
32
|
+
export type ArtifactId = string & {readonly [artifactIdBrand]: true};
|
|
33
|
+
|
|
34
|
+
/** ArtifactId narrowed to an authored documentation kind. */
|
|
35
|
+
export type DocId = ArtifactId & {readonly [docIdBrand]: true};
|
|
36
|
+
|
|
37
|
+
/** Immutable provider version + source/content digest identity. */
|
|
38
|
+
export type ProviderInstanceId = string & {
|
|
39
|
+
readonly [providerInstanceIdBrand]: true;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** Lowercase `sha256:<64 hex characters>` digest. */
|
|
43
|
+
export type ContentDigest = string & {readonly [contentDigestBrand]: true};
|
|
44
|
+
|
|
45
|
+
/** Every stable artifact kind owned by a provider. */
|
|
46
|
+
export type ContributionKind =
|
|
47
|
+
AuthoredDocKind | 'theme' | 'codemod' | 'agent-doc';
|
|
48
|
+
|
|
49
|
+
/** Stable logical identity for one provider-owned artifact. */
|
|
50
|
+
export interface ArtifactIdentity {
|
|
51
|
+
readonly id: ArtifactId;
|
|
52
|
+
readonly providerId: ProviderId;
|
|
53
|
+
readonly kind: ContributionKind;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** One immutable package instance. Runtime lifecycle state does not belong here. */
|
|
58
|
+
export interface ProviderInstance {
|
|
59
|
+
readonly id: ProviderInstanceId;
|
|
60
|
+
readonly providerId: ProviderId;
|
|
61
|
+
readonly packageName: string;
|
|
62
|
+
readonly packageVersion: string;
|
|
63
|
+
readonly sourceDigest: ContentDigest;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Every authored value accepted by the documentation compiler boundary. */
|
|
67
|
+
export type AuthoredDoc =
|
|
68
|
+
| ComponentDoc
|
|
69
|
+
| HookDoc
|
|
70
|
+
| FunctionDoc
|
|
71
|
+
| ReferenceDoc
|
|
72
|
+
| TemplateDoc
|
|
73
|
+
| SchemaDoc
|
|
74
|
+
| CommandDoc
|
|
75
|
+
| EnumDoc
|
|
76
|
+
| NamespaceDoc;
|
|
77
|
+
|
|
78
|
+
/** Provenance attached by discovery before compilation. */
|
|
79
|
+
export interface AuthoredDocSource {
|
|
80
|
+
/** Provider-local logical discovery group. */
|
|
81
|
+
readonly group: string;
|
|
82
|
+
/** Package-relative source path; excluded from compiled renderer data. */
|
|
83
|
+
readonly path: string;
|
|
84
|
+
/** Digest of the authored source bytes. */
|
|
85
|
+
readonly digest: ContentDigest;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Authored kind that corresponds to one public document type. */
|
|
89
|
+
export type AuthoredDocKindOf<TDoc extends AuthoredDoc> =
|
|
90
|
+
TDoc extends ComponentDoc
|
|
91
|
+
? 'component'
|
|
92
|
+
: TDoc extends HookDoc | FunctionDoc
|
|
93
|
+
? 'function'
|
|
94
|
+
: TDoc extends ReferenceDoc
|
|
95
|
+
? 'generic'
|
|
96
|
+
: TDoc extends TemplateDoc
|
|
97
|
+
? TDoc['type']
|
|
98
|
+
: TDoc extends SchemaDoc
|
|
99
|
+
? 'schema'
|
|
100
|
+
: TDoc extends CommandDoc
|
|
101
|
+
? 'command'
|
|
102
|
+
: TDoc extends EnumDoc
|
|
103
|
+
? 'enum'
|
|
104
|
+
: TDoc extends NamespaceDoc
|
|
105
|
+
? 'namespace'
|
|
106
|
+
: never;
|
|
107
|
+
|
|
108
|
+
type DeepReadonly<Value> = Value extends (...args: never[]) => unknown
|
|
109
|
+
? Value
|
|
110
|
+
: Value extends readonly (infer Item)[]
|
|
111
|
+
? readonly DeepReadonly<Item>[]
|
|
112
|
+
: Value extends object
|
|
113
|
+
? {readonly [Key in keyof Value]: DeepReadonly<Value[Key]>}
|
|
114
|
+
: Value;
|
|
115
|
+
|
|
116
|
+
/** Immutable authored-data snapshot stored in a compiler entry. */
|
|
117
|
+
export type AuthoredDocSnapshot<TDoc extends AuthoredDoc = AuthoredDoc> =
|
|
118
|
+
DeepReadonly<TDoc>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* One normalized compiler input. Stable identity is provider + authored kind +
|
|
122
|
+
* stable name; provider version and source bytes remain explicit provenance.
|
|
123
|
+
*/
|
|
124
|
+
export interface AuthoredDocEntry<TDoc extends AuthoredDoc = AuthoredDoc> {
|
|
125
|
+
readonly id: DocId;
|
|
126
|
+
readonly provider: ProviderInstance;
|
|
127
|
+
readonly kind: AuthoredDocKindOf<TDoc>;
|
|
128
|
+
/** Stable provider-local key used in the DocId; it need not equal a display name. */
|
|
129
|
+
readonly stableName: string;
|
|
130
|
+
readonly source: AuthoredDocSource;
|
|
131
|
+
readonly authored: AuthoredDocSnapshot<TDoc>;
|
|
132
|
+
}
|
package/authoring/index.d.mts
CHANGED
|
@@ -14,5 +14,6 @@ export { parseTemplate } from "./doctypes/template/parse.mjs";
|
|
|
14
14
|
export { parseSchema } from "./doctypes/schema/parse.mjs";
|
|
15
15
|
export { parseCommand } from "./doctypes/command/parse.mjs";
|
|
16
16
|
export { parseEnum } from "./doctypes/enum/parse.mjs";
|
|
17
|
+
export { parseNamespace } from "./doctypes/namespace/parse.mjs";
|
|
17
18
|
export { parseLegacyDoc } from "./doctypes/legacy.mjs";
|
|
18
19
|
export { parseGapReportHandler, parseGapReportReceipt } from "./gap-report/parse.mjs";
|
package/authoring/index.d.ts
CHANGED
|
@@ -23,17 +23,18 @@
|
|
|
23
23
|
// ═══════════════════════════════════════════════════════════════════════
|
|
24
24
|
// AUTHOR THESE — each is the default export of one authored file.
|
|
25
25
|
// ═══════════════════════════════════════════════════════════════════════
|
|
26
|
-
export type {ComponentDoc} from './doctypes/types'; // Button.doc.{ts,mjs}
|
|
27
|
-
export type {HookDoc} from './doctypes/types'; // useToast.doc.{ts,mjs}
|
|
28
|
-
export type {FunctionDoc} from './doctypes/types'; // search.doc.mjs (hook | api)
|
|
29
|
-
export type {ReferenceDoc} from './doctypes/types'; // theming.doc.{ts,mjs}
|
|
30
|
-
export type {TemplateDoc} from './doctypes/types'; // Foo.template.{ts,mjs}
|
|
31
|
-
export type {SchemaDoc} from './doctypes/types'; // config.doc.mjs (object shape)
|
|
32
|
-
export type {CommandDoc} from './doctypes/types'; // search.doc.mjs (CLI command)
|
|
33
|
-
export type {EnumDoc} from './doctypes/types'; // error-codes.doc.mjs (vocabulary)
|
|
34
|
-
export type {
|
|
35
|
-
export type {
|
|
36
|
-
export type {
|
|
26
|
+
export type {ComponentDoc} from './doctypes/types.js'; // Button.doc.{ts,mjs}
|
|
27
|
+
export type {HookDoc} from './doctypes/types.js'; // useToast.doc.{ts,mjs}
|
|
28
|
+
export type {FunctionDoc} from './doctypes/types.js'; // search.doc.mjs (hook | api)
|
|
29
|
+
export type {ReferenceDoc} from './doctypes/types.js'; // theming.doc.{ts,mjs}
|
|
30
|
+
export type {TemplateDoc} from './doctypes/types.js'; // Foo.template.{ts,mjs}
|
|
31
|
+
export type {SchemaDoc} from './doctypes/types.js'; // config.doc.mjs (object shape)
|
|
32
|
+
export type {CommandDoc} from './doctypes/types.js'; // search.doc.mjs (CLI command)
|
|
33
|
+
export type {EnumDoc} from './doctypes/types.js'; // error-codes.doc.mjs (vocabulary)
|
|
34
|
+
export type {NamespaceDoc} from './doctypes/types.js'; // cli.doc.mjs (hierarchy)
|
|
35
|
+
export type {AstryxConfig} from './config/type.js'; // astryx.config.{ts,mjs}
|
|
36
|
+
export type {DebugEvent} from './debug/type.js'; // one recorded CLI run
|
|
37
|
+
export type {AstryxIntegration} from './integration/type.js'; // astryx.integration.{ts,mjs}
|
|
37
38
|
export type {
|
|
38
39
|
GapReportHandler,
|
|
39
40
|
GapReportHandlerContext,
|
|
@@ -41,8 +42,8 @@ export type {
|
|
|
41
42
|
GapReportCategory,
|
|
42
43
|
GapReportTarget,
|
|
43
44
|
GapReportHandlerReceipt,
|
|
44
|
-
} from './gap-report/type'; // gap-report handler contract
|
|
45
|
-
export type {AstryxCodemod, AstryxConfigCodemod} from './codemod/type'; // codemods/*
|
|
45
|
+
} from './gap-report/type.js'; // gap-report handler contract
|
|
46
|
+
export type {AstryxCodemod, AstryxConfigCodemod} from './codemod/type.js'; // codemods/*
|
|
46
47
|
|
|
47
48
|
// ═══════════════════════════════════════════════════════════════════════
|
|
48
49
|
// PARSERS — the CLI's load boundary (types come from each parser's JSDoc).
|
|
@@ -56,6 +57,7 @@ export {parseTemplate} from './doctypes/template/parse.mjs';
|
|
|
56
57
|
export {parseSchema} from './doctypes/schema/parse.mjs';
|
|
57
58
|
export {parseCommand} from './doctypes/command/parse.mjs';
|
|
58
59
|
export {parseEnum} from './doctypes/enum/parse.mjs';
|
|
60
|
+
export {parseNamespace} from './doctypes/namespace/parse.mjs';
|
|
59
61
|
export {parseLegacyDoc} from './doctypes/legacy.mjs';
|
|
60
62
|
export {parseConfig} from './config/parse.mjs';
|
|
61
63
|
export {parseIntegration} from './integration/parse.mjs';
|
|
@@ -72,6 +74,26 @@ export {parseDebugEvent} from './debug/parse.mjs';
|
|
|
72
74
|
// need them to author. Names carry the doc kind they belong to.
|
|
73
75
|
// ═══════════════════════════════════════════════════════════════════════
|
|
74
76
|
export type {
|
|
77
|
+
ProviderId,
|
|
78
|
+
ArtifactId,
|
|
79
|
+
DocId,
|
|
80
|
+
ProviderInstanceId,
|
|
81
|
+
ContentDigest,
|
|
82
|
+
ContributionKind,
|
|
83
|
+
ArtifactIdentity,
|
|
84
|
+
ProviderInstance,
|
|
85
|
+
AuthoredDoc,
|
|
86
|
+
AuthoredDocKindOf,
|
|
87
|
+
AuthoredDocSnapshot,
|
|
88
|
+
AuthoredDocSource,
|
|
89
|
+
AuthoredDocEntry,
|
|
90
|
+
} from './identity/type.js';
|
|
91
|
+
export type {
|
|
92
|
+
// shared graph
|
|
93
|
+
AuthoredDocKind,
|
|
94
|
+
DocAudience,
|
|
95
|
+
DocPlacement,
|
|
96
|
+
AuthoredDocGraphFields,
|
|
75
97
|
// component
|
|
76
98
|
SingleComponentDoc,
|
|
77
99
|
MultiComponentDoc,
|
|
@@ -109,6 +131,16 @@ export type {
|
|
|
109
131
|
ReferenceContentBlock,
|
|
110
132
|
ReferenceTokenPreviewType,
|
|
111
133
|
ReferenceTranslationDoc,
|
|
134
|
+
WorkflowStep,
|
|
135
|
+
WorkflowDocBlock,
|
|
136
|
+
CollectionDocBlock,
|
|
137
|
+
ReferenceDocBlock,
|
|
138
|
+
// namespace
|
|
139
|
+
NamespaceProviderScope,
|
|
140
|
+
NamespaceSlotAcceptance,
|
|
141
|
+
NamespaceSlot,
|
|
142
|
+
NamespaceAdoptionSource,
|
|
143
|
+
NamespaceAdoptionRule,
|
|
112
144
|
// template
|
|
113
145
|
TemplateCategory,
|
|
114
146
|
// schema
|
|
@@ -119,8 +151,8 @@ export type {
|
|
|
119
151
|
CommandExampleDoc,
|
|
120
152
|
// enum
|
|
121
153
|
EnumMemberDoc,
|
|
122
|
-
} from './doctypes/types';
|
|
123
|
-
export type {PostCodemodHook, DebugConfig} from './config/type';
|
|
154
|
+
} from './doctypes/types.js';
|
|
155
|
+
export type {PostCodemodHook, DebugConfig} from './config/type.js';
|
|
124
156
|
export type {
|
|
125
157
|
// debug
|
|
126
158
|
DebugSchemaVersion,
|
|
@@ -133,11 +165,11 @@ export type {
|
|
|
133
165
|
DebugEventEnv,
|
|
134
166
|
DebugEventProject,
|
|
135
167
|
DebugEventHandler,
|
|
136
|
-
} from './debug/type';
|
|
168
|
+
} from './debug/type.js';
|
|
137
169
|
export type {
|
|
138
170
|
AstryxCodemodDef,
|
|
139
171
|
AstryxConfigCodemodDef,
|
|
140
172
|
AstryxCodemodFile,
|
|
141
173
|
AstryxCodemodApi,
|
|
142
174
|
AstryxCodemodTransform,
|
|
143
|
-
} from './codemod/type';
|
|
175
|
+
} from './codemod/type.js';
|
package/authoring/index.mjs
CHANGED
|
@@ -31,4 +31,5 @@ export {parseTemplate} from './doctypes/template/parse.mjs';
|
|
|
31
31
|
export {parseSchema} from './doctypes/schema/parse.mjs';
|
|
32
32
|
export {parseCommand} from './doctypes/command/parse.mjs';
|
|
33
33
|
export {parseEnum} from './doctypes/enum/parse.mjs';
|
|
34
|
+
export {parseNamespace} from './doctypes/namespace/parse.mjs';
|
|
34
35
|
export {parseLegacyDoc} from './doctypes/legacy.mjs';
|
|
@@ -14,11 +14,18 @@ export const doc = {
|
|
|
14
14
|
namespace: 'cli',
|
|
15
15
|
description:
|
|
16
16
|
'The astryx.integration.* manifest that sits beside an integration ' +
|
|
17
|
-
"package's package.json.
|
|
18
|
-
'templates, codemods, doc topics,
|
|
19
|
-
'
|
|
17
|
+
"package's package.json. It can preserve a stable provider identity across a package rename, " +
|
|
18
|
+
"and points the CLI at the package's components, templates, codemods, doc topics, " +
|
|
19
|
+
'source themes, managed agent guidance, and issue tracker. Every field is optional.',
|
|
20
20
|
appliesTo: 'astryx.integration.{ts,mjs,js}',
|
|
21
21
|
fields: [
|
|
22
|
+
{
|
|
23
|
+
name: 'providerId',
|
|
24
|
+
type: 'string',
|
|
25
|
+
description:
|
|
26
|
+
'Stable logical provider ID. Omit to use package.json#name; set it to the prior package name only when an explicit rename must preserve artifact IDs. If two packages claim the same ID, the package being authored is used, otherwise the first-loaded one, and the CLI warns about the other.',
|
|
27
|
+
example: "'@acme/widgets'",
|
|
28
|
+
},
|
|
22
29
|
{
|
|
23
30
|
name: 'components',
|
|
24
31
|
type: 'string',
|
|
@@ -87,9 +94,9 @@ export const doc = {
|
|
|
87
94
|
{
|
|
88
95
|
type: 'prose',
|
|
89
96
|
text:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
'
|
|
97
|
+
'Provider identity defaults to package.json#name. During an explicit ' +
|
|
98
|
+
'package rename, set `providerId` to the prior canonical package name so ' +
|
|
99
|
+
'existing artifact IDs remain stable. Package version always comes from package.json.',
|
|
93
100
|
},
|
|
94
101
|
{
|
|
95
102
|
type: 'prose',
|
|
@@ -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('./type').AstryxIntegration} AstryxIntegration */
|
|
4
|
+
/** @typedef {import('./type.js').AstryxIntegration} AstryxIntegration */
|
|
5
5
|
/**
|
|
6
6
|
* Validate an unknown value as an Astryx integration manifest, or throw.
|
|
7
7
|
*
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
* @returns {AstryxIntegration}
|
|
15
15
|
*/
|
|
16
16
|
export function parseIntegration(input: unknown, label?: string): AstryxIntegration;
|
|
17
|
-
export type AstryxIntegration = import("./type").AstryxIntegration;
|
|
17
|
+
export type AstryxIntegration = import("./type.js").AstryxIntegration;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import {formatZodError} from '../_shared/errors.mjs';
|
|
15
15
|
import {integrationSchema} from './schema.mjs';
|
|
16
16
|
|
|
17
|
-
/** @typedef {import('./type').AstryxIntegration} AstryxIntegration */
|
|
17
|
+
/** @typedef {import('./type.js').AstryxIntegration} AstryxIntegration */
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Validate an unknown value as an Astryx integration manifest, or throw.
|
|
@@ -28,6 +28,9 @@ describe('parseIntegration (load boundary)', () => {
|
|
|
28
28
|
components: './src',
|
|
29
29
|
});
|
|
30
30
|
expect(parseIntegration({docs: './docs'})).toEqual({docs: './docs'});
|
|
31
|
+
expect(parseIntegration({providerId: '@acme/legacy-widgets'})).toEqual({
|
|
32
|
+
providerId: '@acme/legacy-widgets',
|
|
33
|
+
});
|
|
31
34
|
expect(parseIntegration({themes: './themes'})).toEqual({
|
|
32
35
|
themes: './themes',
|
|
33
36
|
});
|
|
@@ -66,7 +69,9 @@ describe('parseIntegration (load boundary)', () => {
|
|
|
66
69
|
? 'https://example.com/issues'
|
|
67
70
|
: key === 'agentDocs'
|
|
68
71
|
? {}
|
|
69
|
-
: '
|
|
72
|
+
: key === 'providerId'
|
|
73
|
+
? '@acme/widgets'
|
|
74
|
+
: './x',
|
|
70
75
|
]),
|
|
71
76
|
);
|
|
72
77
|
expect(unknownIntegrationKeys(everyKnownKey)).toEqual([]);
|
|
@@ -82,6 +87,10 @@ describe('parseIntegration (load boundary)', () => {
|
|
|
82
87
|
expect(reason({issuesUrl: 'nope'})).toContain('issuesUrl');
|
|
83
88
|
});
|
|
84
89
|
|
|
90
|
+
it('rejects a noncanonical providerId', () => {
|
|
91
|
+
expect(reason({providerId: 'Acme Widgets'})).toContain('providerId');
|
|
92
|
+
});
|
|
93
|
+
|
|
85
94
|
it('accepts an optional append array as manifest data', () => {
|
|
86
95
|
expect(
|
|
87
96
|
parseIntegration({
|
|
@@ -32,6 +32,7 @@ export const agentDocsSchema: z.ZodObject<{
|
|
|
32
32
|
append: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
export const integrationBaseSchema: z.ZodObject<{
|
|
35
|
+
providerId: z.ZodOptional<z.ZodString>;
|
|
35
36
|
components: z.ZodOptional<z.ZodString>;
|
|
36
37
|
templates: z.ZodOptional<z.ZodString>;
|
|
37
38
|
codemods: z.ZodOptional<z.ZodString>;
|
|
@@ -40,6 +41,7 @@ export const integrationBaseSchema: z.ZodObject<{
|
|
|
40
41
|
issuesUrl: z.ZodOptional<z.ZodString>;
|
|
41
42
|
}, z.core.$strip>;
|
|
42
43
|
export const integrationSchema: z.ZodObject<{
|
|
44
|
+
providerId: z.ZodOptional<z.ZodString>;
|
|
43
45
|
components: z.ZodOptional<z.ZodString>;
|
|
44
46
|
templates: z.ZodOptional<z.ZodString>;
|
|
45
47
|
codemods: z.ZodOptional<z.ZodString>;
|
|
@@ -53,8 +55,8 @@ export const integrationSchema: z.ZodObject<{
|
|
|
53
55
|
/**
|
|
54
56
|
* Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
|
|
55
57
|
*
|
|
56
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
57
|
-
* import('../_shared/contract').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
58
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
59
|
+
* import('../_shared/contract.js').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
58
60
|
* >} _IntegrationDriftLock
|
|
59
61
|
*/
|
|
60
62
|
/**
|
|
@@ -67,9 +69,9 @@ export const integrationSchema: z.ZodObject<{
|
|
|
67
69
|
* @type {string[]}
|
|
68
70
|
*/
|
|
69
71
|
export const KNOWN_INTEGRATION_KEYS: string[];
|
|
70
|
-
export type AstryxIntegration = import("./type").AstryxIntegration;
|
|
72
|
+
export type AstryxIntegration = import("./type.js").AstryxIntegration;
|
|
71
73
|
/**
|
|
72
74
|
* Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
|
|
73
75
|
*/
|
|
74
|
-
export type _IntegrationDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof integrationSchema>, AstryxIntegration>>;
|
|
76
|
+
export type _IntegrationDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof integrationSchema>, AstryxIntegration>>;
|
|
75
77
|
import { z } from 'zod';
|
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
import {z} from 'zod';
|
|
17
17
|
import {formatZodError} from '../_shared/errors.mjs';
|
|
18
18
|
|
|
19
|
-
/** @typedef {import('./type').AstryxIntegration} AstryxIntegration */
|
|
19
|
+
/** @typedef {import('./type.js').AstryxIntegration} AstryxIntegration */
|
|
20
20
|
|
|
21
21
|
const MAX_AGENT_DOC_LINES = 8;
|
|
22
22
|
const MAX_AGENT_DOC_LINE_CODE_POINTS = 240;
|
|
23
23
|
const MANAGED_MARKER_TEXT = /(?:ASTRYX|XDS):(START|END)/u;
|
|
24
|
+
const PROVIDER_ID_RE =
|
|
25
|
+
/^(?:@[a-z0-9][a-z0-9._~!*'()-]*\/)?[a-z0-9][a-z0-9._~!*'()-]*$/u;
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* @param {string} value
|
|
@@ -66,6 +68,10 @@ export const agentDocsSchema = z.object({
|
|
|
66
68
|
});
|
|
67
69
|
|
|
68
70
|
export const integrationBaseSchema = z.object({
|
|
71
|
+
providerId: z
|
|
72
|
+
.string()
|
|
73
|
+
.regex(PROVIDER_ID_RE, 'providerId must be a canonical npm package name')
|
|
74
|
+
.optional(),
|
|
69
75
|
components: z.string().optional(),
|
|
70
76
|
templates: z.string().optional(),
|
|
71
77
|
codemods: z.string().optional(),
|
|
@@ -115,8 +121,8 @@ export function parseAgentDocsField(input, label) {
|
|
|
115
121
|
/**
|
|
116
122
|
* Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
|
|
117
123
|
*
|
|
118
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
119
|
-
* import('../_shared/contract').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
124
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
125
|
+
* import('../_shared/contract.js').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
120
126
|
* >} _IntegrationDriftLock
|
|
121
127
|
*/
|
|
122
128
|
|