@ggui-ai/artifact-manifest 0.1.0-rc.1

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Loqu, Inc. (Guuey)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @ggui-ai/artifact-manifest
2
+
3
+ Strict [Zod](https://zod.dev) schemas and parsers for the two ggui marketplace artifact manifests:
4
+
5
+ - **`ggui.gadget.json`** — gadget bundles (reusable client capabilities).
6
+ - **`ggui.blueprint.json`** — cached UI blueprints (TSX + data contract).
7
+
8
+ Plus a discriminated union over both kinds for tooling that handles them generically (signing, registry upload, search-index ingestion).
9
+
10
+ Browser-safe — pure schema + parsers, no Node dependencies.
11
+
12
+ ```bash
13
+ npm install @ggui-ai/artifact-manifest
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import {
20
+ parseGadgetManifest,
21
+ safeParseBlueprintManifest,
22
+ parseArtifactManifest,
23
+ } from "@ggui-ai/artifact-manifest";
24
+
25
+ // Throws on invalid input, returns a typed GadgetManifest.
26
+ const gadget = parseGadgetManifest(json);
27
+
28
+ // Non-throwing — returns Zod's { success, data | error }.
29
+ const result = safeParseBlueprintManifest(json);
30
+
31
+ // Discriminated union — accepts either kind.
32
+ const artifact = parseArtifactManifest(json);
33
+ ```
34
+
35
+ ## Exports
36
+
37
+ | Symbol | What it is |
38
+ | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
39
+ | `gadgetManifestSchema`, `parseGadgetManifest`, `safeParseGadgetManifest`, `assertGadgetManifestValid` | Gadget manifest schema + parsers |
40
+ | `blueprintManifestSchema`, `parseBlueprintManifest`, `safeParseBlueprintManifest`, `assertBlueprintManifestValid` | Blueprint manifest schema + parsers |
41
+ | `artifactManifestSchema`, `parseArtifactManifest`, `safeParseArtifactManifest`, `assertArtifactManifestValid` | Discriminated union over both kinds |
42
+ | `manifestToRegistryEntry` | Translate a manifest into a registry entry |
43
+ | `GADGET_NAME_RE`, `BLUEPRINT_NAME_RE`, `ArtifactScopeSchema`, `ArtifactVersionSchema` | Shared name + version validators |
44
+ | `GGUI_GADGET_JSON_FILENAME`, `GGUI_BLUEPRINT_JSON_FILENAME` | Canonical manifest filenames |
45
+
46
+ `GadgetManifest`, `BlueprintManifest`, and `ArtifactManifest` types are exported alongside their schemas.
47
+
48
+ ## License
49
+
50
+ Apache-2.0.
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Top-level artifact-manifest discriminated union.
3
+ *
4
+ * The marketplace registry hosts two kinds of artifacts:
5
+ *
6
+ * - **gadgets** (`ggui.gadget.json`) — wrapper code bundles
7
+ * (Leaflet, Mapbox, …) published as gadgets.
8
+ * - **blueprints** (`ggui.blueprint.json`) — cached UI blueprints
9
+ * (TSX source + DataContract + variance tags).
10
+ *
11
+ * Both ship under the same `<scope>/<name>@<version>` identifier
12
+ * scheme, the same sigstore/Ed25519 dual-signing model, and the
13
+ * same per-env-isolated registry stack. The DIFFERENCE is the per-
14
+ * kind authoring shape, which this module unifies under one
15
+ * `z.discriminatedUnion("kind", […])` so tooling that doesn't care
16
+ * which kind it has (e.g. signature verification, registry upload,
17
+ * search-index ingestion) can parse once and dispatch later.
18
+ *
19
+ * Re-exports the per-kind schemas as well so callers that DO care
20
+ * about a specific kind can use the narrower parsers without dipping
21
+ * into the union.
22
+ */
23
+ import { z } from 'zod';
24
+ /**
25
+ * Discriminated union over every artifact kind the registry accepts.
26
+ * Narrowing is driven by the `kind` literal (`"gadget"` | `"blueprint"`).
27
+ *
28
+ * Strict-object posture inherited from the per-kind schemas: unknown
29
+ * top-level keys fail parse with a clear path. An unknown `kind`
30
+ * value yields a `discriminator`-issue at `path: ["kind"]`, which is
31
+ * the cleanest possible failure mode for a misspelled manifest.
32
+ */
33
+ export declare const artifactManifestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ connect: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
35
+ tags: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
36
+ author: z.ZodOptional<z.ZodObject<{
37
+ name: z.ZodString;
38
+ email: z.ZodOptional<z.ZodEmail>;
39
+ url: z.ZodOptional<z.ZodURL>;
40
+ }, z.core.$strict>>;
41
+ license: z.ZodOptional<z.ZodString>;
42
+ homepage: z.ZodOptional<z.ZodURL>;
43
+ kind: z.ZodLiteral<"gadget">;
44
+ scope: z.ZodString;
45
+ name: z.ZodString;
46
+ version: z.ZodString;
47
+ exports: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
48
+ description: z.ZodString;
49
+ usage: z.ZodString;
50
+ example: z.ZodType<import("@ggui-ai/protocol").JsonValue, unknown, z.core.$ZodTypeInternals<import("@ggui-ai/protocol").JsonValue, unknown>>;
51
+ gotchas: z.ZodOptional<z.ZodString>;
52
+ hook: z.ZodString;
53
+ }, z.core.$strict>, z.ZodObject<{
54
+ description: z.ZodString;
55
+ usage: z.ZodString;
56
+ example: z.ZodType<import("@ggui-ai/protocol").JsonValue, unknown, z.core.$ZodTypeInternals<import("@ggui-ai/protocol").JsonValue, unknown>>;
57
+ gotchas: z.ZodOptional<z.ZodString>;
58
+ component: z.ZodString;
59
+ }, z.core.$strict>]>>;
60
+ bundle: z.ZodString;
61
+ visibility: z.ZodEnum<{
62
+ public: "public";
63
+ private: "private";
64
+ }>;
65
+ description: z.ZodString;
66
+ style: z.ZodOptional<z.ZodString>;
67
+ requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
68
+ peerDeps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
69
+ bundleHost: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strict>, z.ZodObject<{
71
+ description: z.ZodOptional<z.ZodString>;
72
+ tags: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
73
+ author: z.ZodOptional<z.ZodObject<{
74
+ name: z.ZodString;
75
+ email: z.ZodOptional<z.ZodEmail>;
76
+ url: z.ZodOptional<z.ZodURL>;
77
+ }, z.core.$strict>>;
78
+ license: z.ZodOptional<z.ZodString>;
79
+ homepage: z.ZodOptional<z.ZodURL>;
80
+ kind: z.ZodLiteral<"blueprint">;
81
+ scope: z.ZodString;
82
+ name: z.ZodString;
83
+ version: z.ZodString;
84
+ source: z.ZodString;
85
+ visibility: z.ZodEnum<{
86
+ public: "public";
87
+ private: "private";
88
+ }>;
89
+ contract: z.ZodOptional<z.ZodType<import("@ggui-ai/protocol").DataContract, unknown, z.core.$ZodTypeInternals<import("@ggui-ai/protocol").DataContract, unknown>>>;
90
+ fixtureProps: z.ZodOptional<z.ZodUnknown>;
91
+ variance: z.ZodOptional<z.ZodType<import("@ggui-ai/protocol").BlueprintVariance, unknown, z.core.$ZodTypeInternals<import("@ggui-ai/protocol").BlueprintVariance, unknown>>>;
92
+ }, z.core.$strict>], "kind">;
93
+ /**
94
+ * Static TypeScript type derived from {@link artifactManifestSchema}.
95
+ *
96
+ * Authors writing tooling that handles both kinds should
97
+ * `import type { ArtifactManifest } from '@ggui-ai/artifact-manifest'`
98
+ * and narrow via `manifest.kind === 'gadget' | 'blueprint'`.
99
+ */
100
+ export type ArtifactManifest = z.infer<typeof artifactManifestSchema>;
101
+ /**
102
+ * Parse a raw JSON value into a validated {@link ArtifactManifest}.
103
+ * Throws a `ZodError` with human-readable issues on invalid input,
104
+ * including unknown / missing `kind` discriminator at `path: ["kind"]`.
105
+ */
106
+ export declare function parseArtifactManifest(raw: unknown): ArtifactManifest;
107
+ /**
108
+ * Assertion helper — narrows `raw` to {@link ArtifactManifest} on
109
+ * success, throws `ZodError` on failure.
110
+ */
111
+ export declare function assertArtifactManifestValid(raw: unknown): asserts raw is ArtifactManifest;
112
+ /**
113
+ * Safe-parse variant — returns a `z.safeParse` result. Prefer this
114
+ * inside CLI tooling where you want to render the issue list without
115
+ * try/catch.
116
+ */
117
+ export declare function safeParseArtifactManifest(raw: unknown): ReturnType<typeof artifactManifestSchema.safeParse>;
118
+ //# sourceMappingURL=artifact-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-manifest.d.ts","sourceRoot":"","sources":["../src/artifact-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAGjC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAatE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAEpE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,OAAO,GACX,OAAO,CAAC,GAAG,IAAI,gBAAgB,CAEjC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,GACX,UAAU,CAAC,OAAO,sBAAsB,CAAC,SAAS,CAAC,CAErD"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Top-level artifact-manifest discriminated union.
3
+ *
4
+ * The marketplace registry hosts two kinds of artifacts:
5
+ *
6
+ * - **gadgets** (`ggui.gadget.json`) — wrapper code bundles
7
+ * (Leaflet, Mapbox, …) published as gadgets.
8
+ * - **blueprints** (`ggui.blueprint.json`) — cached UI blueprints
9
+ * (TSX source + DataContract + variance tags).
10
+ *
11
+ * Both ship under the same `<scope>/<name>@<version>` identifier
12
+ * scheme, the same sigstore/Ed25519 dual-signing model, and the
13
+ * same per-env-isolated registry stack. The DIFFERENCE is the per-
14
+ * kind authoring shape, which this module unifies under one
15
+ * `z.discriminatedUnion("kind", […])` so tooling that doesn't care
16
+ * which kind it has (e.g. signature verification, registry upload,
17
+ * search-index ingestion) can parse once and dispatch later.
18
+ *
19
+ * Re-exports the per-kind schemas as well so callers that DO care
20
+ * about a specific kind can use the narrower parsers without dipping
21
+ * into the union.
22
+ */
23
+ import { z } from 'zod';
24
+ import { gadgetManifestSchema } from './gadget-manifest.js';
25
+ import { blueprintManifestSchema, } from './blueprint-manifest.js';
26
+ /**
27
+ * Discriminated union over every artifact kind the registry accepts.
28
+ * Narrowing is driven by the `kind` literal (`"gadget"` | `"blueprint"`).
29
+ *
30
+ * Strict-object posture inherited from the per-kind schemas: unknown
31
+ * top-level keys fail parse with a clear path. An unknown `kind`
32
+ * value yields a `discriminator`-issue at `path: ["kind"]`, which is
33
+ * the cleanest possible failure mode for a misspelled manifest.
34
+ */
35
+ export const artifactManifestSchema = z.discriminatedUnion('kind', [
36
+ gadgetManifestSchema,
37
+ blueprintManifestSchema,
38
+ ]);
39
+ // Sanity: the union TS type IS the union of the two per-kind types.
40
+ // If a future refactor smuggles a non-GadgetManifest|BlueprintManifest
41
+ // into the schema, the function-parameter assignment below stops
42
+ // compiling. Module-private static check; the body is never invoked.
43
+ function _artifactUnionTypeCheck(union) {
44
+ return union;
45
+ }
46
+ void _artifactUnionTypeCheck;
47
+ /**
48
+ * Parse a raw JSON value into a validated {@link ArtifactManifest}.
49
+ * Throws a `ZodError` with human-readable issues on invalid input,
50
+ * including unknown / missing `kind` discriminator at `path: ["kind"]`.
51
+ */
52
+ export function parseArtifactManifest(raw) {
53
+ return artifactManifestSchema.parse(raw);
54
+ }
55
+ /**
56
+ * Assertion helper — narrows `raw` to {@link ArtifactManifest} on
57
+ * success, throws `ZodError` on failure.
58
+ */
59
+ export function assertArtifactManifestValid(raw) {
60
+ artifactManifestSchema.parse(raw);
61
+ }
62
+ /**
63
+ * Safe-parse variant — returns a `z.safeParse` result. Prefer this
64
+ * inside CLI tooling where you want to render the issue list without
65
+ * try/catch.
66
+ */
67
+ export function safeParseArtifactManifest(raw) {
68
+ return artifactManifestSchema.safeParse(raw);
69
+ }
package/dist/base.d.ts ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Shared identity + metadata building blocks across every artifact-manifest
3
+ * kind. The discriminated union of {@link GadgetManifest} and {@link
4
+ * BlueprintManifest} each extend these — keeping scope/name/version/author
5
+ * regexes in one place so a future widening (e.g. accepting four-segment
6
+ * scopes) lands once and propagates uniformly.
7
+ *
8
+ * No discriminator field lives here — `kind` is intentionally per-variant
9
+ * so zod's `z.discriminatedUnion("kind", […])` can narrow on the literal.
10
+ */
11
+ import { z } from 'zod';
12
+ /**
13
+ * Artifact scope — an npm-style organizational namespace. MUST start
14
+ * with `@` and contain only lowercase alphanumerics + hyphens after
15
+ * the leading `@`. Examples: `@ggui-ai`, `@my-org`, `@example-org`.
16
+ *
17
+ * The `@` prefix is what disambiguates `scope` from `name` in the
18
+ * `<scope>/<name>` identifier — a scope without `@` is ambiguous
19
+ * with a non-scoped artifact name.
20
+ *
21
+ * Shared between {@link GadgetManifest} and {@link BlueprintManifest};
22
+ * both kinds publish under the same `<scope>/<name>@<version>` install
23
+ * identifier so the marketplace search surface and signing trust chain
24
+ * stay symmetric.
25
+ */
26
+ export declare const ArtifactScopeSchema: z.ZodString;
27
+ /**
28
+ * Artifact name regex — kebab-case for both gadgets and blueprints.
29
+ * 2-64 chars, starts + ends with `[a-z0-9]`, hyphens allowed in the
30
+ * middle, no underscores, no single-character names.
31
+ *
32
+ * Gadgets and blueprints share this one rule. Underscored blueprint
33
+ * slugs (`weather_card_v2`) must be renamed with hyphens, and
34
+ * single-letter slugs must pick a longer name.
35
+ */
36
+ export declare const GADGET_NAME_RE: RegExp;
37
+ /**
38
+ * Blueprint-kind name regex — the same kebab-case rule as gadgets.
39
+ * Re-export of {@link GADGET_NAME_RE} kept as a named symbol so
40
+ * callers that read the blueprint-specific name stay self-documenting
41
+ * at the call site.
42
+ */
43
+ export declare const BLUEPRINT_NAME_RE: RegExp;
44
+ /**
45
+ * SemVer with optional pre-release / build metadata. Matches the
46
+ * subset npm + sigstore both accept: `MAJOR.MINOR.PATCH` with
47
+ * optional `-PRE` and `+BUILD` suffixes per semver.org BNF.
48
+ *
49
+ * Mirrors the practical npm-publish regex (loose enough to accept
50
+ * `1.0.0-alpha.1+build.123`, strict enough to reject `1.0`,
51
+ * `v1.0.0`, leading zeros).
52
+ */
53
+ export declare const ArtifactVersionSchema: z.ZodString;
54
+ /**
55
+ * Visibility — controls how the artifact is stored + distributed:
56
+ *
57
+ * - `public` — sigstore-signed, served from S3 `public/` prefix,
58
+ * publicly listable via `/search`.
59
+ * - `private` — Ed25519-signed, served from `private/<orgId>/`
60
+ * with signed CloudFront URLs, only visible to the
61
+ * publisher's Cognito org.
62
+ *
63
+ * Both paths land in the same registry stack; the visibility flag
64
+ * picks the signing trust chain + S3 prefix at publish time. No
65
+ * "internal" / "team" third option in MVP.
66
+ */
67
+ export declare const ArtifactVisibilitySchema: z.ZodEnum<{
68
+ public: "public";
69
+ private: "private";
70
+ }>;
71
+ /**
72
+ * Artifact author metadata — purely informational, surfaced on the
73
+ * registry web UI and `ggui search` output. `name` required so a
74
+ * descriptor that declares an author always has something to render;
75
+ * `email` / `url` optional.
76
+ */
77
+ export declare const ArtifactAuthorSchema: z.ZodObject<{
78
+ name: z.ZodString;
79
+ email: z.ZodOptional<z.ZodEmail>;
80
+ url: z.ZodOptional<z.ZodURL>;
81
+ }, z.core.$strict>;
82
+ /**
83
+ * Optional metadata fields shared by every artifact kind. Lifted out
84
+ * of the per-kind schemas via spread so the variant schemas stay
85
+ * focused on their distinguishing fields.
86
+ */
87
+ export declare const sharedMetadataShape: {
88
+ readonly description: z.ZodOptional<z.ZodString>;
89
+ readonly tags: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
90
+ readonly author: z.ZodOptional<z.ZodObject<{
91
+ name: z.ZodString;
92
+ email: z.ZodOptional<z.ZodEmail>;
93
+ url: z.ZodOptional<z.ZodURL>;
94
+ }, z.core.$strict>>;
95
+ readonly license: z.ZodOptional<z.ZodString>;
96
+ readonly homepage: z.ZodOptional<z.ZodURL>;
97
+ };
98
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,aAK5B,CAAC;AAEL;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,QAAsC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAiB,CAAC;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,aAQ/B,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB;;;EAAgC,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;kBAQ/B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;CA6CtB,CAAC"}
package/dist/base.js ADDED
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Shared identity + metadata building blocks across every artifact-manifest
3
+ * kind. The discriminated union of {@link GadgetManifest} and {@link
4
+ * BlueprintManifest} each extend these — keeping scope/name/version/author
5
+ * regexes in one place so a future widening (e.g. accepting four-segment
6
+ * scopes) lands once and propagates uniformly.
7
+ *
8
+ * No discriminator field lives here — `kind` is intentionally per-variant
9
+ * so zod's `z.discriminatedUnion("kind", […])` can narrow on the literal.
10
+ */
11
+ import { z } from 'zod';
12
+ /**
13
+ * Artifact scope — an npm-style organizational namespace. MUST start
14
+ * with `@` and contain only lowercase alphanumerics + hyphens after
15
+ * the leading `@`. Examples: `@ggui-ai`, `@my-org`, `@example-org`.
16
+ *
17
+ * The `@` prefix is what disambiguates `scope` from `name` in the
18
+ * `<scope>/<name>` identifier — a scope without `@` is ambiguous
19
+ * with a non-scoped artifact name.
20
+ *
21
+ * Shared between {@link GadgetManifest} and {@link BlueprintManifest};
22
+ * both kinds publish under the same `<scope>/<name>@<version>` install
23
+ * identifier so the marketplace search surface and signing trust chain
24
+ * stay symmetric.
25
+ */
26
+ export const ArtifactScopeSchema = z
27
+ .string()
28
+ .regex(/^@[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/, {
29
+ message: 'scope must start with `@` followed by lowercase alphanumerics + hyphens (2-64 chars total, no leading/trailing hyphen after `@`).',
30
+ });
31
+ /**
32
+ * Artifact name regex — kebab-case for both gadgets and blueprints.
33
+ * 2-64 chars, starts + ends with `[a-z0-9]`, hyphens allowed in the
34
+ * middle, no underscores, no single-character names.
35
+ *
36
+ * Gadgets and blueprints share this one rule. Underscored blueprint
37
+ * slugs (`weather_card_v2`) must be renamed with hyphens, and
38
+ * single-letter slugs must pick a longer name.
39
+ */
40
+ export const GADGET_NAME_RE = /^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/;
41
+ /**
42
+ * Blueprint-kind name regex — the same kebab-case rule as gadgets.
43
+ * Re-export of {@link GADGET_NAME_RE} kept as a named symbol so
44
+ * callers that read the blueprint-specific name stay self-documenting
45
+ * at the call site.
46
+ */
47
+ export const BLUEPRINT_NAME_RE = GADGET_NAME_RE;
48
+ /**
49
+ * SemVer with optional pre-release / build metadata. Matches the
50
+ * subset npm + sigstore both accept: `MAJOR.MINOR.PATCH` with
51
+ * optional `-PRE` and `+BUILD` suffixes per semver.org BNF.
52
+ *
53
+ * Mirrors the practical npm-publish regex (loose enough to accept
54
+ * `1.0.0-alpha.1+build.123`, strict enough to reject `1.0`,
55
+ * `v1.0.0`, leading zeros).
56
+ */
57
+ export const ArtifactVersionSchema = z
58
+ .string()
59
+ .regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/, {
60
+ message: 'version must be valid semver (MAJOR.MINOR.PATCH with optional `-pre` / `+build`).',
61
+ });
62
+ /**
63
+ * Visibility — controls how the artifact is stored + distributed:
64
+ *
65
+ * - `public` — sigstore-signed, served from S3 `public/` prefix,
66
+ * publicly listable via `/search`.
67
+ * - `private` — Ed25519-signed, served from `private/<orgId>/`
68
+ * with signed CloudFront URLs, only visible to the
69
+ * publisher's Cognito org.
70
+ *
71
+ * Both paths land in the same registry stack; the visibility flag
72
+ * picks the signing trust chain + S3 prefix at publish time. No
73
+ * "internal" / "team" third option in MVP.
74
+ */
75
+ export const ArtifactVisibilitySchema = z.enum(['public', 'private']);
76
+ /**
77
+ * Artifact author metadata — purely informational, surfaced on the
78
+ * registry web UI and `ggui search` output. `name` required so a
79
+ * descriptor that declares an author always has something to render;
80
+ * `email` / `url` optional.
81
+ */
82
+ export const ArtifactAuthorSchema = z.strictObject({
83
+ name: z.string().min(1).max(200),
84
+ email: z
85
+ .email({ message: 'author.email must be a valid email address' })
86
+ .optional(),
87
+ url: z
88
+ .url({ message: 'author.url must be a valid http(s) URL' })
89
+ .optional(),
90
+ });
91
+ /**
92
+ * Optional metadata fields shared by every artifact kind. Lifted out
93
+ * of the per-kind schemas via spread so the variant schemas stay
94
+ * focused on their distinguishing fields.
95
+ */
96
+ export const sharedMetadataShape = {
97
+ description: z
98
+ .string()
99
+ .min(1)
100
+ .max(280)
101
+ .optional()
102
+ .describe('One-line artifact description shown on registry UI + `ggui search` output. Required at registry-side once published (the publish CLI promotes it to the registry descriptor where it becomes mandatory).'),
103
+ // Caps protect the index size and the wire payload size. 20 entries
104
+ // × 64 chars covers every realistic tagging vocabulary while
105
+ // bounding worst-case spam. The charset `[a-z0-9-]` keeps the
106
+ // publish CLI's case-folding + URL-encoding round-trips
107
+ // deterministic.
108
+ tags: z
109
+ .array(z
110
+ .string()
111
+ .min(1)
112
+ .max(64)
113
+ .regex(/^[a-z0-9-]+$/, 'tag must be lowercase alphanumeric with hyphens only'))
114
+ .max(20, { message: 'at most 20 tags per artifact' })
115
+ .readonly()
116
+ .optional()
117
+ .describe('Free-form tags for `/search?tag=` filtering. Lowercased + deduplicated server-side. Max 20 tags, 64 chars each, charset `[a-z0-9-]`.'),
118
+ author: ArtifactAuthorSchema.optional().describe('Author metadata surfaced on registry UI. All subfields except `name` are optional.'),
119
+ license: z
120
+ .string()
121
+ .min(1)
122
+ .optional()
123
+ .describe('SPDX license identifier (e.g. `Apache-2.0`, `MIT`). Validated as a non-empty string at this layer; SPDX-membership validation is a publish-time concern.'),
124
+ homepage: z
125
+ .url({ message: 'homepage must be a valid http(s) URL' })
126
+ .optional()
127
+ .describe('Project homepage / docs URL. Linkified on registry UI.'),
128
+ };