@teamix-evo/registry 0.1.0

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.
@@ -0,0 +1,505 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Update strategy for a resource.
5
+ * - frozen: CLI will not modify after first install
6
+ * - regenerable: Entire file is rewritten on update
7
+ * - managed: Only managed regions are rewritten, rest is preserved
8
+ */
9
+ declare const UpdateStrategySchema: z.ZodEnum<["frozen", "regenerable", "managed"]>;
10
+ /**
11
+ * Resource type discriminator.
12
+ */
13
+ declare const ResourceTypeSchema: z.ZodEnum<["doc", "tokens", "ai-rules", "config"]>;
14
+ /**
15
+ * A single resource entry within a variant manifest.
16
+ */
17
+ declare const ResourceSchema: z.ZodObject<{
18
+ /** Unique identifier for the resource within the manifest */
19
+ id: z.ZodString;
20
+ /** Resource type */
21
+ type: z.ZodEnum<["doc", "tokens", "ai-rules", "config"]>;
22
+ /** Source path (relative to variant root), typically a template */
23
+ source: z.ZodString;
24
+ /** Target path (relative to project root) where the resource is installed */
25
+ target: z.ZodString;
26
+ /** How the resource is updated */
27
+ updateStrategy: z.ZodEnum<["frozen", "regenerable", "managed"]>;
28
+ /** Whether the source is a Handlebars template */
29
+ template: z.ZodOptional<z.ZodBoolean>;
30
+ /** IDs of managed regions (only relevant when updateStrategy is "managed") */
31
+ managedRegions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
32
+ /** Whether to recursively process directory contents */
33
+ recursive: z.ZodOptional<z.ZodBoolean>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ id: string;
36
+ type: "doc" | "tokens" | "ai-rules" | "config";
37
+ source: string;
38
+ target: string;
39
+ updateStrategy: "frozen" | "regenerable" | "managed";
40
+ template?: boolean | undefined;
41
+ managedRegions?: string[] | undefined;
42
+ recursive?: boolean | undefined;
43
+ }, {
44
+ id: string;
45
+ type: "doc" | "tokens" | "ai-rules" | "config";
46
+ source: string;
47
+ target: string;
48
+ updateStrategy: "frozen" | "regenerable" | "managed";
49
+ template?: boolean | undefined;
50
+ managedRegions?: string[] | undefined;
51
+ recursive?: boolean | undefined;
52
+ }>;
53
+ /**
54
+ * Variant manifest schema — describes a variant package and its resources.
55
+ */
56
+ declare const VariantManifestSchema: z.ZodObject<{
57
+ $schema: z.ZodOptional<z.ZodString>;
58
+ schemaVersion: z.ZodLiteral<1>;
59
+ /** Package name (e.g. "design") */
60
+ package: z.ZodString;
61
+ /** Variant identifier (e.g. "opentrek") */
62
+ variant: z.ZodString;
63
+ /** Human-readable name */
64
+ displayName: z.ZodString;
65
+ /** Description of the variant */
66
+ description: z.ZodString;
67
+ /** Semver version string */
68
+ version: z.ZodString;
69
+ /** Engine compatibility */
70
+ engines: z.ZodObject<{
71
+ "teamix-evo": z.ZodString;
72
+ }, "strip", z.ZodTypeAny, {
73
+ "teamix-evo": string;
74
+ }, {
75
+ "teamix-evo": string;
76
+ }>;
77
+ /** Supported IDE identifiers */
78
+ ide: z.ZodArray<z.ZodString, "many">;
79
+ /** List of resources provided by this variant */
80
+ resources: z.ZodArray<z.ZodObject<{
81
+ /** Unique identifier for the resource within the manifest */
82
+ id: z.ZodString;
83
+ /** Resource type */
84
+ type: z.ZodEnum<["doc", "tokens", "ai-rules", "config"]>;
85
+ /** Source path (relative to variant root), typically a template */
86
+ source: z.ZodString;
87
+ /** Target path (relative to project root) where the resource is installed */
88
+ target: z.ZodString;
89
+ /** How the resource is updated */
90
+ updateStrategy: z.ZodEnum<["frozen", "regenerable", "managed"]>;
91
+ /** Whether the source is a Handlebars template */
92
+ template: z.ZodOptional<z.ZodBoolean>;
93
+ /** IDs of managed regions (only relevant when updateStrategy is "managed") */
94
+ managedRegions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
95
+ /** Whether to recursively process directory contents */
96
+ recursive: z.ZodOptional<z.ZodBoolean>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ id: string;
99
+ type: "doc" | "tokens" | "ai-rules" | "config";
100
+ source: string;
101
+ target: string;
102
+ updateStrategy: "frozen" | "regenerable" | "managed";
103
+ template?: boolean | undefined;
104
+ managedRegions?: string[] | undefined;
105
+ recursive?: boolean | undefined;
106
+ }, {
107
+ id: string;
108
+ type: "doc" | "tokens" | "ai-rules" | "config";
109
+ source: string;
110
+ target: string;
111
+ updateStrategy: "frozen" | "regenerable" | "managed";
112
+ template?: boolean | undefined;
113
+ managedRegions?: string[] | undefined;
114
+ recursive?: boolean | undefined;
115
+ }>, "many">;
116
+ }, "strip", z.ZodTypeAny, {
117
+ schemaVersion: 1;
118
+ package: string;
119
+ variant: string;
120
+ displayName: string;
121
+ description: string;
122
+ version: string;
123
+ engines: {
124
+ "teamix-evo": string;
125
+ };
126
+ ide: string[];
127
+ resources: {
128
+ id: string;
129
+ type: "doc" | "tokens" | "ai-rules" | "config";
130
+ source: string;
131
+ target: string;
132
+ updateStrategy: "frozen" | "regenerable" | "managed";
133
+ template?: boolean | undefined;
134
+ managedRegions?: string[] | undefined;
135
+ recursive?: boolean | undefined;
136
+ }[];
137
+ $schema?: string | undefined;
138
+ }, {
139
+ schemaVersion: 1;
140
+ package: string;
141
+ variant: string;
142
+ displayName: string;
143
+ description: string;
144
+ version: string;
145
+ engines: {
146
+ "teamix-evo": string;
147
+ };
148
+ ide: string[];
149
+ resources: {
150
+ id: string;
151
+ type: "doc" | "tokens" | "ai-rules" | "config";
152
+ source: string;
153
+ target: string;
154
+ updateStrategy: "frozen" | "regenerable" | "managed";
155
+ template?: boolean | undefined;
156
+ managedRegions?: string[] | undefined;
157
+ recursive?: boolean | undefined;
158
+ }[];
159
+ $schema?: string | undefined;
160
+ }>;
161
+
162
+ /**
163
+ * Package entry within a project config.
164
+ */
165
+ declare const PackageEntrySchema: z.ZodObject<{
166
+ /** Variant identifier (e.g. "opentrek") */
167
+ variant: z.ZodString;
168
+ /** Semver version string */
169
+ version: z.ZodString;
170
+ }, "strip", z.ZodTypeAny, {
171
+ variant: string;
172
+ version: string;
173
+ }, {
174
+ variant: string;
175
+ version: string;
176
+ }>;
177
+ /**
178
+ * Project configuration schema — teamix-evo config.json at project root.
179
+ */
180
+ declare const ProjectConfigSchema: z.ZodObject<{
181
+ $schema: z.ZodOptional<z.ZodString>;
182
+ schemaVersion: z.ZodLiteral<1>;
183
+ /** IDE identifier */
184
+ ide: z.ZodString;
185
+ /** Installed packages keyed by package name */
186
+ packages: z.ZodRecord<z.ZodString, z.ZodObject<{
187
+ /** Variant identifier (e.g. "opentrek") */
188
+ variant: z.ZodString;
189
+ /** Semver version string */
190
+ version: z.ZodString;
191
+ }, "strip", z.ZodTypeAny, {
192
+ variant: string;
193
+ version: string;
194
+ }, {
195
+ variant: string;
196
+ version: string;
197
+ }>>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ schemaVersion: 1;
200
+ ide: string;
201
+ packages: Record<string, {
202
+ variant: string;
203
+ version: string;
204
+ }>;
205
+ $schema?: string | undefined;
206
+ }, {
207
+ schemaVersion: 1;
208
+ ide: string;
209
+ packages: Record<string, {
210
+ variant: string;
211
+ version: string;
212
+ }>;
213
+ $schema?: string | undefined;
214
+ }>;
215
+
216
+ /**
217
+ * An installed resource entry — tracks individual resource installation state.
218
+ */
219
+ declare const InstalledResourceSchema: z.ZodObject<{
220
+ /** Resource identifier matching the variant manifest */
221
+ id: z.ZodString;
222
+ /** Target path where the resource was installed */
223
+ target: z.ZodString;
224
+ /** Content hash for change detection (e.g. "sha256:...") */
225
+ hash: z.ZodString;
226
+ /** Update strategy that was applied */
227
+ strategy: z.ZodEnum<["frozen", "regenerable", "managed"]>;
228
+ }, "strip", z.ZodTypeAny, {
229
+ id: string;
230
+ target: string;
231
+ hash: string;
232
+ strategy: "frozen" | "regenerable" | "managed";
233
+ }, {
234
+ id: string;
235
+ target: string;
236
+ hash: string;
237
+ strategy: "frozen" | "regenerable" | "managed";
238
+ }>;
239
+ /**
240
+ * An installed package entry — tracks a single package installation.
241
+ */
242
+ declare const InstalledPackageSchema: z.ZodObject<{
243
+ /** Full package name (e.g. "@teamix-evo/design") */
244
+ package: z.ZodString;
245
+ /** Variant identifier */
246
+ variant: z.ZodString;
247
+ /** Installed version */
248
+ version: z.ZodString;
249
+ /** ISO 8601 timestamp of installation */
250
+ installedAt: z.ZodString;
251
+ /** List of installed resources */
252
+ resources: z.ZodArray<z.ZodObject<{
253
+ /** Resource identifier matching the variant manifest */
254
+ id: z.ZodString;
255
+ /** Target path where the resource was installed */
256
+ target: z.ZodString;
257
+ /** Content hash for change detection (e.g. "sha256:...") */
258
+ hash: z.ZodString;
259
+ /** Update strategy that was applied */
260
+ strategy: z.ZodEnum<["frozen", "regenerable", "managed"]>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ id: string;
263
+ target: string;
264
+ hash: string;
265
+ strategy: "frozen" | "regenerable" | "managed";
266
+ }, {
267
+ id: string;
268
+ target: string;
269
+ hash: string;
270
+ strategy: "frozen" | "regenerable" | "managed";
271
+ }>, "many">;
272
+ }, "strip", z.ZodTypeAny, {
273
+ package: string;
274
+ variant: string;
275
+ version: string;
276
+ resources: {
277
+ id: string;
278
+ target: string;
279
+ hash: string;
280
+ strategy: "frozen" | "regenerable" | "managed";
281
+ }[];
282
+ installedAt: string;
283
+ }, {
284
+ package: string;
285
+ variant: string;
286
+ version: string;
287
+ resources: {
288
+ id: string;
289
+ target: string;
290
+ hash: string;
291
+ strategy: "frozen" | "regenerable" | "managed";
292
+ }[];
293
+ installedAt: string;
294
+ }>;
295
+ /**
296
+ * Installed manifest schema — tracks all installed packages in a project.
297
+ * Stored at `.teamix-evo/manifest.json`.
298
+ */
299
+ declare const InstalledManifestSchema: z.ZodObject<{
300
+ schemaVersion: z.ZodLiteral<1>;
301
+ /** List of installed packages */
302
+ installed: z.ZodArray<z.ZodObject<{
303
+ /** Full package name (e.g. "@teamix-evo/design") */
304
+ package: z.ZodString;
305
+ /** Variant identifier */
306
+ variant: z.ZodString;
307
+ /** Installed version */
308
+ version: z.ZodString;
309
+ /** ISO 8601 timestamp of installation */
310
+ installedAt: z.ZodString;
311
+ /** List of installed resources */
312
+ resources: z.ZodArray<z.ZodObject<{
313
+ /** Resource identifier matching the variant manifest */
314
+ id: z.ZodString;
315
+ /** Target path where the resource was installed */
316
+ target: z.ZodString;
317
+ /** Content hash for change detection (e.g. "sha256:...") */
318
+ hash: z.ZodString;
319
+ /** Update strategy that was applied */
320
+ strategy: z.ZodEnum<["frozen", "regenerable", "managed"]>;
321
+ }, "strip", z.ZodTypeAny, {
322
+ id: string;
323
+ target: string;
324
+ hash: string;
325
+ strategy: "frozen" | "regenerable" | "managed";
326
+ }, {
327
+ id: string;
328
+ target: string;
329
+ hash: string;
330
+ strategy: "frozen" | "regenerable" | "managed";
331
+ }>, "many">;
332
+ }, "strip", z.ZodTypeAny, {
333
+ package: string;
334
+ variant: string;
335
+ version: string;
336
+ resources: {
337
+ id: string;
338
+ target: string;
339
+ hash: string;
340
+ strategy: "frozen" | "regenerable" | "managed";
341
+ }[];
342
+ installedAt: string;
343
+ }, {
344
+ package: string;
345
+ variant: string;
346
+ version: string;
347
+ resources: {
348
+ id: string;
349
+ target: string;
350
+ hash: string;
351
+ strategy: "frozen" | "regenerable" | "managed";
352
+ }[];
353
+ installedAt: string;
354
+ }>, "many">;
355
+ }, "strip", z.ZodTypeAny, {
356
+ schemaVersion: 1;
357
+ installed: {
358
+ package: string;
359
+ variant: string;
360
+ version: string;
361
+ resources: {
362
+ id: string;
363
+ target: string;
364
+ hash: string;
365
+ strategy: "frozen" | "regenerable" | "managed";
366
+ }[];
367
+ installedAt: string;
368
+ }[];
369
+ }, {
370
+ schemaVersion: 1;
371
+ installed: {
372
+ package: string;
373
+ variant: string;
374
+ version: string;
375
+ resources: {
376
+ id: string;
377
+ target: string;
378
+ hash: string;
379
+ strategy: "frozen" | "regenerable" | "managed";
380
+ }[];
381
+ installedAt: string;
382
+ }[];
383
+ }>;
384
+
385
+ /** Resource update strategy */
386
+ type UpdateStrategy = z.infer<typeof UpdateStrategySchema>;
387
+ /** Resource type discriminator */
388
+ type ResourceType = z.infer<typeof ResourceTypeSchema>;
389
+ /** A single resource entry within a variant manifest */
390
+ type Resource = z.infer<typeof ResourceSchema>;
391
+ /** Variant manifest describing a package variant and its resources */
392
+ type VariantManifest = z.infer<typeof VariantManifestSchema>;
393
+ /** A package entry in the project config */
394
+ type PackageEntry = z.infer<typeof PackageEntrySchema>;
395
+ /** Project configuration (config.json) */
396
+ type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
397
+ /** An installed resource tracking entry */
398
+ type InstalledResource = z.infer<typeof InstalledResourceSchema>;
399
+ /** An installed package tracking entry */
400
+ type InstalledPackage = z.infer<typeof InstalledPackageSchema>;
401
+ /** Installed manifest tracking all packages in a project */
402
+ type InstalledManifest = z.infer<typeof InstalledManifestSchema>;
403
+ /** Managed region parsed from document content */
404
+ interface ManagedRegion {
405
+ /** Region identifier */
406
+ id: string;
407
+ /** The full start marker string */
408
+ startMarker: string;
409
+ /** The full end marker string */
410
+ endMarker: string;
411
+ /** Content between start and end markers */
412
+ content: string;
413
+ }
414
+ /** Generic result type for validation operations */
415
+ type Result<T> = {
416
+ success: true;
417
+ data: T;
418
+ } | {
419
+ success: false;
420
+ error: string;
421
+ };
422
+
423
+ /**
424
+ * Load and validate a variant manifest from a package directory.
425
+ *
426
+ * Reads `manifest.json` from the given directory, parses it as JSON,
427
+ * and validates it against the VariantManifest schema.
428
+ *
429
+ * @param packageDir - Absolute or relative path to the variant package directory
430
+ * @returns The validated VariantManifest
431
+ * @throws Error if the file cannot be read or the manifest is invalid
432
+ */
433
+ declare function loadVariantManifest(packageDir: string): Promise<VariantManifest>;
434
+
435
+ /**
436
+ * Validate unknown data against the VariantManifest schema.
437
+ * Returns a discriminated Result with either the parsed data or a friendly error message.
438
+ */
439
+ declare function validateManifest(data: unknown): Result<VariantManifest>;
440
+ /**
441
+ * Validate unknown data against the ProjectConfig schema.
442
+ */
443
+ declare function validateConfig(data: unknown): Result<ProjectConfig>;
444
+ /**
445
+ * Validate unknown data against the InstalledManifest schema.
446
+ */
447
+ declare function validateInstalled(data: unknown): Result<InstalledManifest>;
448
+
449
+ /**
450
+ * Parse all managed regions from document content.
451
+ *
452
+ * @param content - The full document content
453
+ * @returns Array of parsed ManagedRegion objects
454
+ * @throws Error if there are unmatched start/end markers
455
+ */
456
+ declare function parseManagedRegions(content: string): ManagedRegion[];
457
+ /**
458
+ * Replace the content of a specific managed region by id.
459
+ * Content outside managed regions is preserved.
460
+ *
461
+ * @param content - The full document content
462
+ * @param id - The region id to replace
463
+ * @param newContent - The new content for the region
464
+ * @returns The updated document content
465
+ * @throws Error if the region id is not found
466
+ */
467
+ declare function replaceManagedRegion(content: string, id: string, newContent: string): string;
468
+ /**
469
+ * Check whether a managed region with the given id exists in the content.
470
+ *
471
+ * @param content - The full document content
472
+ * @param id - The region id to check
473
+ * @returns true if the region exists
474
+ */
475
+ declare function hasManagedRegion(content: string, id: string): boolean;
476
+
477
+ /**
478
+ * Determine whether a resource should be updated based on its strategy
479
+ * and whether it already exists.
480
+ *
481
+ * @param strategy - The update strategy for the resource
482
+ * @param resourceExists - Whether the resource file already exists
483
+ * @returns true if the resource should be updated/created
484
+ */
485
+ declare function shouldUpdate(strategy: UpdateStrategy, resourceExists: boolean): boolean;
486
+ /** Possible actions returned by getUpdateAction */
487
+ type UpdateAction = "skip" | "overwrite" | "managed-update";
488
+ interface UpdateActionOptions {
489
+ /** Whether the resource file already exists */
490
+ exists: boolean;
491
+ /** Hash of the new content to be written */
492
+ hash?: string;
493
+ /** Hash of the currently installed content */
494
+ currentHash?: string;
495
+ }
496
+ /**
497
+ * Determine the specific update action to take for a resource.
498
+ *
499
+ * @param strategy - The update strategy for the resource
500
+ * @param options - Context about the resource's current state
501
+ * @returns The action to perform
502
+ */
503
+ declare function getUpdateAction(strategy: UpdateStrategy, options: UpdateActionOptions): UpdateAction;
504
+
505
+ export { type InstalledManifest, InstalledManifestSchema, type InstalledPackage, InstalledPackageSchema, type InstalledResource, InstalledResourceSchema, type ManagedRegion, type PackageEntry, PackageEntrySchema, type ProjectConfig, ProjectConfigSchema, type Resource, ResourceSchema, type ResourceType, ResourceTypeSchema, type Result, type UpdateAction, type UpdateActionOptions, type UpdateStrategy, UpdateStrategySchema, type VariantManifest, VariantManifestSchema, getUpdateAction, hasManagedRegion, loadVariantManifest, parseManagedRegions, replaceManagedRegion, shouldUpdate, validateConfig, validateInstalled, validateManifest };