@teamix-evo/registry 0.2.0 → 0.5.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.
- package/dist/index.cjs +370 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1077 -106
- package/dist/index.d.ts +1077 -106
- package/dist/index.js +356 -51
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -82,7 +82,20 @@ var SkillEntrySchema = z.object({
|
|
|
82
82
|
/** Managed region IDs to maintain on update */
|
|
83
83
|
managedRegions: z.array(z.string()).optional(),
|
|
84
84
|
/** Whether the source is a Handlebars template */
|
|
85
|
-
template: z.boolean().optional()
|
|
85
|
+
template: z.boolean().optional(),
|
|
86
|
+
/**
|
|
87
|
+
* Variant identifier when this skill is bound to a specific design variant
|
|
88
|
+
* (e.g. `"opentrek"`, `"uni-manager"`). Optional — neutral skills (manage,
|
|
89
|
+
* coding-conventions, baseline design-rules) leave it unset.
|
|
90
|
+
*
|
|
91
|
+
* When present, the CLI installs this skill ONLY if the consumer's
|
|
92
|
+
* `.teamix-evo/tokens-lock.json` records the same variant. MUST equal
|
|
93
|
+
* the variant directory name in `@teamix-evo/tokens/variants/<name>/`.
|
|
94
|
+
*
|
|
95
|
+
* Mirrors `UiEntrySchema.variant` semantics in @teamix-evo/biz-ui &
|
|
96
|
+
* @teamix-evo/templates per ADR 0014.
|
|
97
|
+
*/
|
|
98
|
+
variant: z.string().optional()
|
|
86
99
|
});
|
|
87
100
|
var SkillsPackageManifestSchema = z.object({
|
|
88
101
|
$schema: z.string().optional(),
|
|
@@ -102,9 +115,17 @@ var UiEntryTypeSchema = z.enum([
|
|
|
102
115
|
"component",
|
|
103
116
|
"hook",
|
|
104
117
|
"util",
|
|
105
|
-
"block"
|
|
118
|
+
"block",
|
|
119
|
+
"template"
|
|
120
|
+
]);
|
|
121
|
+
var UiAliasSchema = z.enum([
|
|
122
|
+
"components",
|
|
123
|
+
"hooks",
|
|
124
|
+
"utils",
|
|
125
|
+
"lib",
|
|
126
|
+
"business",
|
|
127
|
+
"templates"
|
|
106
128
|
]);
|
|
107
|
-
var UiAliasSchema = z.enum(["components", "hooks", "utils", "lib"]);
|
|
108
129
|
var UiEntryStatusSchema = z.enum([
|
|
109
130
|
"stable",
|
|
110
131
|
"experimental",
|
|
@@ -134,8 +155,8 @@ var UiEntrySchema = z.object({
|
|
|
134
155
|
files: z.array(UiEntryFileSchema).min(1),
|
|
135
156
|
/**
|
|
136
157
|
* Optional path to an AI-readable meta document (frontmatter + Markdown).
|
|
137
|
-
*
|
|
138
|
-
*
|
|
158
|
+
* Read directly from `@teamix-evo/ui` by MCP at runtime — no consumer-side
|
|
159
|
+
* copy is written (per ADR 0020 §3).
|
|
139
160
|
*/
|
|
140
161
|
meta: z.string().optional(),
|
|
141
162
|
/** Other UI entries this one depends on (e.g. "button" depends on "cn") */
|
|
@@ -167,7 +188,14 @@ var UiEntrySchema = z.object({
|
|
|
167
188
|
* If this entry is `deprecated`, the id of the entry that supersedes it.
|
|
168
189
|
* Consumers (and AI) should migrate to `replacedBy` rather than this entry.
|
|
169
190
|
*/
|
|
170
|
-
replacedBy: z.string().optional()
|
|
191
|
+
replacedBy: z.string().optional(),
|
|
192
|
+
/**
|
|
193
|
+
* Variant identifier when this entry is shipped from a variant-aware
|
|
194
|
+
* package (`@teamix-evo/biz-ui` or `@teamix-evo/templates` per ADR 0014).
|
|
195
|
+
* Optional — entries from `@teamix-evo/ui` (variant-agnostic) leave it unset.
|
|
196
|
+
* MUST equal the variant directory name when present.
|
|
197
|
+
*/
|
|
198
|
+
variant: z.string().optional()
|
|
171
199
|
});
|
|
172
200
|
var UiPackageManifestSchema = z.object({
|
|
173
201
|
$schema: z.string().optional(),
|
|
@@ -180,28 +208,160 @@ var UiPackageManifestSchema = z.object({
|
|
|
180
208
|
engines: z.object({
|
|
181
209
|
"teamix-evo": z.string().min(1)
|
|
182
210
|
}),
|
|
183
|
-
/**
|
|
184
|
-
entries: z.array(UiEntrySchema)
|
|
211
|
+
/** Active list of entries shipped (and exposed) by this package. */
|
|
212
|
+
entries: z.array(UiEntrySchema),
|
|
213
|
+
/**
|
|
214
|
+
* Archived entries that are kept in source for Storybook documentation only
|
|
215
|
+
* and are NOT exposed through the active distribution chain. Per ADR 0028:
|
|
216
|
+
* - `teamix-evo ui add <id>` rejects ids found here unless `--include-deprecated` is passed
|
|
217
|
+
* - MCP `list_components` / `find_components` exclude these by default
|
|
218
|
+
* - Storybook keeps the story under `废弃 · Deprecated/` with a banner
|
|
219
|
+
* Optional for backwards compatibility — older manifests without this field
|
|
220
|
+
* still validate.
|
|
221
|
+
*/
|
|
222
|
+
deprecatedEntries: z.array(UiEntrySchema).optional()
|
|
185
223
|
});
|
|
186
224
|
|
|
187
|
-
// src/schema/
|
|
225
|
+
// src/schema/tokens-pack.ts
|
|
188
226
|
import { z as z2 } from "zod";
|
|
189
|
-
var
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
227
|
+
var VARIANT_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
228
|
+
var SEMVER_RE = /^\d+\.\d+\.\d+/;
|
|
229
|
+
var TokensPackLinkedSchema = z2.object({
|
|
230
|
+
"biz-ui": z2.string().optional(),
|
|
231
|
+
templates: z2.string().optional()
|
|
232
|
+
});
|
|
233
|
+
var TokensVariantEntrySchema = z2.object({
|
|
234
|
+
/** Variant id — lowercase kebab-case. */
|
|
235
|
+
name: z2.string().min(1).regex(
|
|
236
|
+
VARIANT_NAME_RE,
|
|
237
|
+
"Variant name must be lowercase letters/digits/hyphens (no leading hyphen)."
|
|
238
|
+
),
|
|
239
|
+
/** Human-readable display name (e.g. "OpenTrek" for variant id "opentrek"). */
|
|
240
|
+
displayName: z2.string().min(1),
|
|
241
|
+
/** Variant version — semver. May trail the package version when only a subset of variants change. */
|
|
242
|
+
version: z2.string().regex(SEMVER_RE, "Invalid semver version"),
|
|
243
|
+
/** Optional one-liner description; surfaced in `tokens list-variants` output. */
|
|
244
|
+
description: z2.string().optional(),
|
|
245
|
+
/**
|
|
246
|
+
* Files this variant advertises, paths relative to the tokens package root
|
|
247
|
+
* (e.g. `variants/opentrek/theme.css`). The validator walks these to
|
|
248
|
+
* confirm presence; the CLI consumes them at install time.
|
|
249
|
+
*/
|
|
250
|
+
files: z2.array(z2.string().min(1)).min(1),
|
|
251
|
+
/** Soft cross-package links (biz-ui / templates with the same variant name). */
|
|
252
|
+
linked: TokensPackLinkedSchema.optional()
|
|
253
|
+
});
|
|
254
|
+
var TokensPackageManifestSchema = z2.object({
|
|
255
|
+
$schema: z2.string().optional(),
|
|
256
|
+
schemaVersion: z2.literal(1),
|
|
257
|
+
/** Always `"tokens"` — disambiguates from other teamix-evo package manifests. */
|
|
258
|
+
package: z2.literal("tokens"),
|
|
259
|
+
/** Semver of the entire tokens package. */
|
|
260
|
+
version: z2.string().regex(SEMVER_RE, "Invalid semver version"),
|
|
261
|
+
/** Engine compatibility. */
|
|
262
|
+
engines: z2.object({ "teamix-evo": z2.string().min(1) }),
|
|
263
|
+
/** Optional package-level description. */
|
|
264
|
+
description: z2.string().optional(),
|
|
265
|
+
/** All shipped variants (excluding scaffold dirs that begin with `_`). */
|
|
266
|
+
variants: z2.array(TokensVariantEntrySchema),
|
|
267
|
+
/**
|
|
268
|
+
* Reserved for future shared assets that span variants (e.g. browser
|
|
269
|
+
* quirks resets co-shipped at the package root). Empty array today.
|
|
270
|
+
*/
|
|
271
|
+
shared: z2.array(z2.string()).optional()
|
|
272
|
+
});
|
|
273
|
+
var TokensPackLockSchema = z2.object({
|
|
274
|
+
$schema: z2.string().optional(),
|
|
275
|
+
schemaVersion: z2.literal(1),
|
|
276
|
+
variant: z2.object({
|
|
277
|
+
name: z2.string().min(1),
|
|
278
|
+
displayName: z2.string().min(1),
|
|
279
|
+
version: z2.string().regex(SEMVER_RE),
|
|
280
|
+
from: z2.string().min(1)
|
|
281
|
+
// e.g. "@teamix-evo/tokens"
|
|
282
|
+
}),
|
|
283
|
+
/** Tokens package version — useful when variant version trails the package. */
|
|
284
|
+
packageVersion: z2.string().regex(SEMVER_RE),
|
|
285
|
+
linked: TokensPackLinkedSchema.optional(),
|
|
286
|
+
installedAt: z2.string().datetime()
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// src/schema/variant-ui-pack.ts
|
|
290
|
+
import { z as z3 } from "zod";
|
|
291
|
+
var SEMVER_RE2 = /^\d+\.\d+\.\d+/;
|
|
292
|
+
var VARIANT_NAME_RE2 = /^[a-z][a-z0-9-]*$/;
|
|
293
|
+
var VariantUiPackageNameSchema = z3.enum(["biz-ui", "templates"]);
|
|
294
|
+
var VariantUiPackageManifestSchema = z3.object({
|
|
295
|
+
$schema: z3.string().optional(),
|
|
296
|
+
schemaVersion: z3.literal(1),
|
|
297
|
+
/** Discriminator. */
|
|
298
|
+
package: VariantUiPackageNameSchema,
|
|
299
|
+
/**
|
|
300
|
+
* Variant identifier — lowercase kebab-case, MUST match the parent
|
|
301
|
+
* directory name (e.g. `opentrek` for `variants/opentrek/manifest.json`).
|
|
302
|
+
* `_template` is also accepted for the variant scaffold.
|
|
303
|
+
*/
|
|
304
|
+
variant: z3.string().min(1).regex(
|
|
305
|
+
VARIANT_NAME_RE2,
|
|
306
|
+
'Variant id must be lowercase letters/digits/hyphens (no leading hyphen). Special: "_template" allowed.'
|
|
307
|
+
).or(z3.literal("_template")),
|
|
308
|
+
/** Semver of this variant. */
|
|
309
|
+
version: z3.string().regex(SEMVER_RE2, "Invalid semver version"),
|
|
310
|
+
/** Engine compatibility. */
|
|
311
|
+
engines: z3.object({ "teamix-evo": z3.string().min(1) }),
|
|
312
|
+
/** Flat list of entries shipped by this variant. */
|
|
313
|
+
entries: z3.array(UiEntrySchema)
|
|
314
|
+
}).superRefine((data, ctx) => {
|
|
315
|
+
for (const [i, entry] of data.entries.entries()) {
|
|
316
|
+
if (entry.variant !== void 0 && entry.variant !== data.variant) {
|
|
317
|
+
ctx.addIssue({
|
|
318
|
+
code: z3.ZodIssueCode.custom,
|
|
319
|
+
path: ["entries", i, "variant"],
|
|
320
|
+
message: `Entry "${entry.id}" declares variant "${entry.variant}" but lives in manifest of variant "${data.variant}".`
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
195
324
|
});
|
|
196
|
-
var
|
|
325
|
+
var VariantUiPackageCatalogSchema = z3.object({
|
|
326
|
+
$schema: z3.string().optional(),
|
|
327
|
+
schemaVersion: z3.literal(1),
|
|
328
|
+
package: VariantUiPackageNameSchema,
|
|
329
|
+
/** Semver of the entire package. */
|
|
330
|
+
version: z3.string().regex(SEMVER_RE2, "Invalid semver version"),
|
|
331
|
+
engines: z3.object({ "teamix-evo": z3.string().min(1) }),
|
|
332
|
+
/** Variants this package ships (excluding `_template`). */
|
|
333
|
+
variants: z3.array(
|
|
334
|
+
z3.object({
|
|
335
|
+
name: z3.string().min(1).regex(VARIANT_NAME_RE2),
|
|
336
|
+
displayName: z3.string().min(1),
|
|
337
|
+
version: z3.string().regex(SEMVER_RE2),
|
|
338
|
+
description: z3.string().optional()
|
|
339
|
+
})
|
|
340
|
+
)
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// src/schema/config.ts
|
|
344
|
+
import { z as z4 } from "zod";
|
|
345
|
+
var TailwindVersionSchema = z4.literal("v4");
|
|
346
|
+
var UiAliasesSchema = z4.object({
|
|
347
|
+
components: z4.string().min(1),
|
|
348
|
+
hooks: z4.string().min(1),
|
|
349
|
+
utils: z4.string().min(1),
|
|
350
|
+
lib: z4.string().min(1),
|
|
351
|
+
/** Biz-ui components (variant-bound). Defaults to `src/components/business/`. */
|
|
352
|
+
business: z4.string().min(1).default("src/components/business"),
|
|
353
|
+
/** Page templates (variant-bound). Defaults to `src/templates/`. */
|
|
354
|
+
templates: z4.string().min(1).default("src/templates")
|
|
355
|
+
});
|
|
356
|
+
var PackageEntrySchema = z4.object({
|
|
197
357
|
/** Variant identifier (e.g. "opentrek"; use "_flat" for skills/ui) */
|
|
198
|
-
variant:
|
|
358
|
+
variant: z4.string().min(1),
|
|
199
359
|
/** Semver version string */
|
|
200
|
-
version:
|
|
360
|
+
version: z4.string().min(1),
|
|
201
361
|
/** Tailwind CSS version this project uses (only meaningful for design package). */
|
|
202
362
|
tailwind: TailwindVersionSchema.optional(),
|
|
203
363
|
/** IDEs this package was installed for (only meaningful for skills package). */
|
|
204
|
-
ides:
|
|
364
|
+
ides: z4.array(SkillIdeSchema).optional(),
|
|
205
365
|
/** Install scope (only meaningful for skills package). */
|
|
206
366
|
scope: SkillScopeSchema.optional(),
|
|
207
367
|
/** Path aliases for ui entry installation (only meaningful for ui package). */
|
|
@@ -210,53 +370,79 @@ var PackageEntrySchema = z2.object({
|
|
|
210
370
|
* Default icon library declared by the project (only meaningful for ui).
|
|
211
371
|
* Declarative only — does NOT trigger code rewrites; ui entries hardcode imports.
|
|
212
372
|
*/
|
|
213
|
-
iconLibrary:
|
|
373
|
+
iconLibrary: z4.string().min(1).optional(),
|
|
214
374
|
/** Whether the project uses TSX (true) or JSX (false). ui-specific. */
|
|
215
|
-
tsx:
|
|
375
|
+
tsx: z4.boolean().optional(),
|
|
216
376
|
/** Whether to emit React Server Components markers (`"use client"`). ui-specific. */
|
|
217
|
-
rsc:
|
|
377
|
+
rsc: z4.boolean().optional()
|
|
218
378
|
});
|
|
219
|
-
var ProjectConfigSchema =
|
|
220
|
-
$schema:
|
|
221
|
-
schemaVersion:
|
|
379
|
+
var ProjectConfigSchema = z4.object({
|
|
380
|
+
$schema: z4.string().optional(),
|
|
381
|
+
schemaVersion: z4.literal(1),
|
|
222
382
|
/** IDE identifier */
|
|
223
|
-
ide:
|
|
383
|
+
ide: z4.string().min(1),
|
|
224
384
|
/** Installed packages keyed by package name */
|
|
225
|
-
packages:
|
|
385
|
+
packages: z4.record(z4.string(), PackageEntrySchema)
|
|
226
386
|
});
|
|
227
387
|
|
|
228
388
|
// src/schema/installed.ts
|
|
229
|
-
import { z as
|
|
230
|
-
var InstalledResourceSchema =
|
|
389
|
+
import { z as z5 } from "zod";
|
|
390
|
+
var InstalledResourceSchema = z5.object({
|
|
231
391
|
/** Resource identifier matching the variant manifest */
|
|
232
|
-
id:
|
|
392
|
+
id: z5.string().min(1),
|
|
233
393
|
/** Target path where the resource was installed (absolute or project-relative) */
|
|
234
|
-
target:
|
|
394
|
+
target: z5.string().min(1),
|
|
235
395
|
/** Content hash for change detection (e.g. "sha256:...") */
|
|
236
|
-
hash:
|
|
396
|
+
hash: z5.string().min(1),
|
|
237
397
|
/** Update strategy that was applied */
|
|
238
|
-
strategy:
|
|
398
|
+
strategy: z5.enum(["frozen", "regenerable", "managed"]),
|
|
239
399
|
/** IDE this resource was installed for (skill resources only) */
|
|
240
400
|
ide: SkillIdeSchema.optional(),
|
|
241
401
|
/** Install scope (skill resources only) */
|
|
242
402
|
scope: SkillScopeSchema.optional()
|
|
243
403
|
});
|
|
244
|
-
var InstalledPackageSchema =
|
|
245
|
-
/** Full package name (e.g. "@teamix-evo/
|
|
246
|
-
package:
|
|
404
|
+
var InstalledPackageSchema = z5.object({
|
|
405
|
+
/** Full package name (e.g. "@teamix-evo/tokens") */
|
|
406
|
+
package: z5.string().min(1),
|
|
247
407
|
/** Variant identifier (use "_flat" for non-variant packages such as skills) */
|
|
248
|
-
variant:
|
|
408
|
+
variant: z5.string().min(1),
|
|
249
409
|
/** Installed version */
|
|
250
|
-
version:
|
|
410
|
+
version: z5.string().min(1),
|
|
251
411
|
/** ISO 8601 timestamp of installation */
|
|
252
|
-
installedAt:
|
|
412
|
+
installedAt: z5.string().min(1),
|
|
253
413
|
/** List of installed resources */
|
|
254
|
-
resources:
|
|
414
|
+
resources: z5.array(InstalledResourceSchema)
|
|
255
415
|
});
|
|
256
|
-
var InstalledManifestSchema =
|
|
257
|
-
schemaVersion:
|
|
416
|
+
var InstalledManifestSchema = z5.object({
|
|
417
|
+
schemaVersion: z5.literal(1),
|
|
258
418
|
/** List of installed packages */
|
|
259
|
-
installed:
|
|
419
|
+
installed: z5.array(InstalledPackageSchema)
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// src/schema/skills-lock.ts
|
|
423
|
+
import { z as z6 } from "zod";
|
|
424
|
+
var SkillsLockEntrySchema = z6.object({
|
|
425
|
+
/** Semver version installed from upstream */
|
|
426
|
+
version: z6.string().min(1),
|
|
427
|
+
/** Upstream package name (typically `@teamix-evo/skills`) */
|
|
428
|
+
from: z6.string().min(1),
|
|
429
|
+
/** ISO 8601 install / last-sync timestamp */
|
|
430
|
+
installedAt: z6.string().min(1),
|
|
431
|
+
/** Install scope at time of mirror */
|
|
432
|
+
scope: SkillScopeSchema,
|
|
433
|
+
/**
|
|
434
|
+
* IDEs this skill was mirrored to. Each ide ↔ a mirror path under
|
|
435
|
+
* `<projectRoot>/.<ide>/skills/<id>/` (project) or `~/.<ide>/skills/<id>/`
|
|
436
|
+
* (global). The path itself is reconstructed from `scope` + adapter; we
|
|
437
|
+
* record the ide identifier rather than the full path to keep the lock
|
|
438
|
+
* portable across machines.
|
|
439
|
+
*/
|
|
440
|
+
mirroredTo: z6.array(SkillIdeSchema)
|
|
441
|
+
});
|
|
442
|
+
var SkillsLockSchema = z6.object({
|
|
443
|
+
schemaVersion: z6.literal(1),
|
|
444
|
+
/** Map of skill id → lock entry */
|
|
445
|
+
skills: z6.record(z6.string().min(1), SkillsLockEntrySchema)
|
|
260
446
|
});
|
|
261
447
|
|
|
262
448
|
// src/loader.ts
|
|
@@ -266,8 +452,8 @@ import * as path from "path";
|
|
|
266
452
|
// src/validator.ts
|
|
267
453
|
function formatZodError(error) {
|
|
268
454
|
return error.issues.map((issue) => {
|
|
269
|
-
const
|
|
270
|
-
return ` - ${
|
|
455
|
+
const path4 = issue.path.length > 0 ? issue.path.join(".") : "(root)";
|
|
456
|
+
return ` - ${path4}: ${issue.message}`;
|
|
271
457
|
}).join("\n");
|
|
272
458
|
}
|
|
273
459
|
function validateManifest(data) {
|
|
@@ -303,6 +489,17 @@ function validateInstalled(data) {
|
|
|
303
489
|
${formatZodError(result.error)}`
|
|
304
490
|
};
|
|
305
491
|
}
|
|
492
|
+
function validateSkillsLock(data) {
|
|
493
|
+
const result = SkillsLockSchema.safeParse(data);
|
|
494
|
+
if (result.success) {
|
|
495
|
+
return { success: true, data: result.data };
|
|
496
|
+
}
|
|
497
|
+
return {
|
|
498
|
+
success: false,
|
|
499
|
+
error: `Invalid skills lock:
|
|
500
|
+
${formatZodError(result.error)}`
|
|
501
|
+
};
|
|
502
|
+
}
|
|
306
503
|
function validateSkillsPackage(data) {
|
|
307
504
|
const result = SkillsPackageManifestSchema.safeParse(data);
|
|
308
505
|
if (result.success) {
|
|
@@ -359,22 +556,22 @@ function validateUiDependencyGraph(entries) {
|
|
|
359
556
|
const color = /* @__PURE__ */ new Map();
|
|
360
557
|
for (const id of idToEntry.keys()) color.set(id, WHITE);
|
|
361
558
|
const cycles = [];
|
|
362
|
-
function dfs(id,
|
|
559
|
+
function dfs(id, path4) {
|
|
363
560
|
color.set(id, GRAY);
|
|
364
|
-
|
|
561
|
+
path4.push(id);
|
|
365
562
|
const entry = idToEntry.get(id);
|
|
366
563
|
const deps = entry?.registryDependencies ?? [];
|
|
367
564
|
for (const dep of deps) {
|
|
368
565
|
if (!idToEntry.has(dep)) continue;
|
|
369
566
|
const c = color.get(dep);
|
|
370
567
|
if (c === GRAY) {
|
|
371
|
-
const startIdx =
|
|
372
|
-
cycles.push([...
|
|
568
|
+
const startIdx = path4.indexOf(dep);
|
|
569
|
+
cycles.push([...path4.slice(startIdx), dep]);
|
|
373
570
|
} else if (c === WHITE) {
|
|
374
|
-
dfs(dep,
|
|
571
|
+
dfs(dep, path4);
|
|
375
572
|
}
|
|
376
573
|
}
|
|
377
|
-
|
|
574
|
+
path4.pop();
|
|
378
575
|
color.set(id, BLACK);
|
|
379
576
|
}
|
|
380
577
|
for (const id of idToEntry.keys()) {
|
|
@@ -496,6 +693,100 @@ async function loadUiPackageManifest(packageDir) {
|
|
|
496
693
|
return result.data;
|
|
497
694
|
}
|
|
498
695
|
|
|
696
|
+
// src/tokens-pack-loader.ts
|
|
697
|
+
import * as fs2 from "fs/promises";
|
|
698
|
+
import * as path2 from "path";
|
|
699
|
+
async function loadTokensPackageManifest(packageDir) {
|
|
700
|
+
const manifestPath = path2.join(packageDir, "manifest.json");
|
|
701
|
+
let raw;
|
|
702
|
+
try {
|
|
703
|
+
raw = await fs2.readFile(manifestPath, "utf-8");
|
|
704
|
+
} catch (err) {
|
|
705
|
+
const code = err.code;
|
|
706
|
+
if (code === "ENOENT") {
|
|
707
|
+
throw new Error(`Tokens package manifest not found: ${manifestPath}`);
|
|
708
|
+
}
|
|
709
|
+
throw new Error(
|
|
710
|
+
`Failed to read tokens package manifest at ${manifestPath}: ${err.message}`
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
let parsed;
|
|
714
|
+
try {
|
|
715
|
+
parsed = JSON.parse(raw);
|
|
716
|
+
} catch {
|
|
717
|
+
throw new Error(
|
|
718
|
+
`Invalid JSON in tokens package manifest at ${manifestPath}`
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
const result = TokensPackageManifestSchema.safeParse(parsed);
|
|
722
|
+
if (!result.success) {
|
|
723
|
+
throw new Error(
|
|
724
|
+
`Invalid tokens package manifest:
|
|
725
|
+
${result.error.message}
|
|
726
|
+
File: ${manifestPath}`
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
return result.data;
|
|
730
|
+
}
|
|
731
|
+
function getVariantEntry(catalog, variantName) {
|
|
732
|
+
return catalog.variants.find((v) => v.name === variantName);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// src/variant-ui-pack-loader.ts
|
|
736
|
+
import * as fs3 from "fs/promises";
|
|
737
|
+
import * as path3 from "path";
|
|
738
|
+
async function readJson(filePath, kind) {
|
|
739
|
+
let raw;
|
|
740
|
+
try {
|
|
741
|
+
raw = await fs3.readFile(filePath, "utf-8");
|
|
742
|
+
} catch (err) {
|
|
743
|
+
const code = err.code;
|
|
744
|
+
if (code === "ENOENT") {
|
|
745
|
+
throw new Error(`${kind} not found: ${filePath}`);
|
|
746
|
+
}
|
|
747
|
+
throw new Error(
|
|
748
|
+
`Failed to read ${kind} at ${filePath}: ${err.message}`
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
try {
|
|
752
|
+
return JSON.parse(raw);
|
|
753
|
+
} catch {
|
|
754
|
+
throw new Error(`Invalid JSON in ${kind} at ${filePath}`);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
async function loadVariantUiPackageCatalog(packageDir) {
|
|
758
|
+
const manifestPath = path3.join(packageDir, "manifest.json");
|
|
759
|
+
const data = await readJson(manifestPath, "variant-ui catalog");
|
|
760
|
+
const result = VariantUiPackageCatalogSchema.safeParse(data);
|
|
761
|
+
if (!result.success) {
|
|
762
|
+
throw new Error(
|
|
763
|
+
`Invalid catalog:
|
|
764
|
+
${result.error.message}
|
|
765
|
+
File: ${manifestPath}`
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
return result.data;
|
|
769
|
+
}
|
|
770
|
+
async function loadVariantUiPackageManifest(variantDir) {
|
|
771
|
+
const manifestPath = path3.join(variantDir, "manifest.json");
|
|
772
|
+
const data = await readJson(manifestPath, "variant-ui manifest");
|
|
773
|
+
const result = VariantUiPackageManifestSchema.safeParse(data);
|
|
774
|
+
if (!result.success) {
|
|
775
|
+
throw new Error(
|
|
776
|
+
`Invalid variant manifest:
|
|
777
|
+
${result.error.message}
|
|
778
|
+
File: ${manifestPath}`
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
const dirName = path3.basename(variantDir);
|
|
782
|
+
if (result.data.variant !== dirName) {
|
|
783
|
+
throw new Error(
|
|
784
|
+
`Variant manifest mismatch: variants/${dirName}/manifest.json declares variant="${result.data.variant}". Names must match.`
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
return result.data;
|
|
788
|
+
}
|
|
789
|
+
|
|
499
790
|
// src/managed-regions.ts
|
|
500
791
|
var REGION_PATTERN = /<!-- teamix-evo:managed:start id="([^"]+)" -->([\s\S]*?)<!-- teamix-evo:managed:end id="\1" -->/g;
|
|
501
792
|
var START_MARKER_PATTERN = /<!-- teamix-evo:managed:start id="([^"]+)" -->/g;
|
|
@@ -627,8 +918,14 @@ export {
|
|
|
627
918
|
SkillEntrySchema,
|
|
628
919
|
SkillIdeSchema,
|
|
629
920
|
SkillScopeSchema,
|
|
921
|
+
SkillsLockEntrySchema,
|
|
922
|
+
SkillsLockSchema,
|
|
630
923
|
SkillsPackageManifestSchema,
|
|
631
924
|
TailwindVersionSchema,
|
|
925
|
+
TokensPackLinkedSchema,
|
|
926
|
+
TokensPackLockSchema,
|
|
927
|
+
TokensPackageManifestSchema,
|
|
928
|
+
TokensVariantEntrySchema,
|
|
632
929
|
UiAliasSchema,
|
|
633
930
|
UiAliasesSchema,
|
|
634
931
|
UiEntryFileSchema,
|
|
@@ -637,11 +934,18 @@ export {
|
|
|
637
934
|
UiPackageManifestSchema,
|
|
638
935
|
UpdateStrategySchema,
|
|
639
936
|
VariantManifestSchema,
|
|
937
|
+
VariantUiPackageCatalogSchema,
|
|
938
|
+
VariantUiPackageManifestSchema,
|
|
939
|
+
VariantUiPackageNameSchema,
|
|
640
940
|
getUpdateAction,
|
|
941
|
+
getVariantEntry,
|
|
641
942
|
hasManagedRegion,
|
|
642
943
|
loadSkillsPackageManifest,
|
|
944
|
+
loadTokensPackageManifest,
|
|
643
945
|
loadUiPackageManifest,
|
|
644
946
|
loadVariantManifest,
|
|
947
|
+
loadVariantUiPackageCatalog,
|
|
948
|
+
loadVariantUiPackageManifest,
|
|
645
949
|
parseManagedRegions,
|
|
646
950
|
replaceManagedRegion,
|
|
647
951
|
resolveUiEntryOrder,
|
|
@@ -649,6 +953,7 @@ export {
|
|
|
649
953
|
validateConfig,
|
|
650
954
|
validateInstalled,
|
|
651
955
|
validateManifest,
|
|
956
|
+
validateSkillsLock,
|
|
652
957
|
validateSkillsPackage,
|
|
653
958
|
validateUiDependencyGraph,
|
|
654
959
|
validateUiPackage
|