@teamix-evo/registry 0.7.0 → 0.8.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 CHANGED
@@ -30,11 +30,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ ComponentLineageSchema: () => ComponentLineageSchema,
33
34
  InstalledManifestSchema: () => InstalledManifestSchema,
34
35
  InstalledPackageSchema: () => InstalledPackageSchema,
35
36
  InstalledResourceSchema: () => InstalledResourceSchema,
37
+ LastUpdateRecordSchema: () => LastUpdateRecordSchema,
36
38
  PackageEntrySchema: () => PackageEntrySchema,
37
39
  ProjectConfigSchema: () => ProjectConfigSchema,
40
+ ProjectConfigV1Schema: () => ProjectConfigV1Schema,
41
+ ProjectConfigV2Schema: () => ProjectConfigV2Schema,
38
42
  ResourceSchema: () => ResourceSchema,
39
43
  ResourceTypeSchema: () => ResourceTypeSchema,
40
44
  SkillEntrySchema: () => SkillEntrySchema,
@@ -44,6 +48,8 @@ __export(index_exports, {
44
48
  SkillsLockSchema: () => SkillsLockSchema,
45
49
  SkillsPackageManifestSchema: () => SkillsPackageManifestSchema,
46
50
  TailwindVersionSchema: () => TailwindVersionSchema,
51
+ TokenRenameEntrySchema: () => TokenRenameEntrySchema,
52
+ TokenRenameRecordSchema: () => TokenRenameRecordSchema,
47
53
  TokensPackLinkedSchema: () => TokensPackLinkedSchema,
48
54
  TokensPackLockSchema: () => TokensPackLockSchema,
49
55
  TokensPackageManifestSchema: () => TokensPackageManifestSchema,
@@ -55,10 +61,19 @@ __export(index_exports, {
55
61
  UiEntryTypeSchema: () => UiEntryTypeSchema,
56
62
  UiPackageManifestSchema: () => UiPackageManifestSchema,
57
63
  UpdateStrategySchema: () => UpdateStrategySchema,
64
+ UpgradeRiskLevelSchema: () => UpgradeRiskLevelSchema,
65
+ UpgradeStagingCategorySchema: () => UpgradeStagingCategorySchema,
66
+ UpgradeStagingCurrentSchema: () => UpgradeStagingCurrentSchema,
67
+ UpgradeStagingDiffSchema: () => UpgradeStagingDiffSchema,
68
+ UpgradeStagingEntrySchema: () => UpgradeStagingEntrySchema,
69
+ UpgradeStagingIncomingSchema: () => UpgradeStagingIncomingSchema,
70
+ UpgradeStagingManifestSchema: () => UpgradeStagingManifestSchema,
71
+ UpgradeStagingTriggerSchema: () => UpgradeStagingTriggerSchema,
58
72
  VariantManifestSchema: () => VariantManifestSchema,
59
73
  VariantUiPackageCatalogSchema: () => VariantUiPackageCatalogSchema,
60
74
  VariantUiPackageManifestSchema: () => VariantUiPackageManifestSchema,
61
75
  VariantUiPackageNameSchema: () => VariantUiPackageNameSchema,
76
+ extractFrontmatter: () => extractFrontmatter,
62
77
  getUpdateAction: () => getUpdateAction,
63
78
  getVariantEntry: () => getVariantEntry,
64
79
  hasManagedRegion: () => hasManagedRegion,
@@ -69,9 +84,11 @@ __export(index_exports, {
69
84
  loadVariantUiPackageCatalog: () => loadVariantUiPackageCatalog,
70
85
  loadVariantUiPackageManifest: () => loadVariantUiPackageManifest,
71
86
  parseManagedRegions: () => parseManagedRegions,
87
+ replaceFrontmatter: () => replaceFrontmatter,
72
88
  replaceManagedRegion: () => replaceManagedRegion,
73
89
  resolveUiEntryOrder: () => resolveUiEntryOrder,
74
90
  shouldUpdate: () => shouldUpdate,
91
+ splitManagedRegions: () => splitManagedRegions,
75
92
  validateConfig: () => validateConfig,
76
93
  validateInstalled: () => validateInstalled,
77
94
  validateManifest: () => validateManifest,
@@ -328,6 +345,16 @@ var TokensPackLinkedSchema = import_zod2.z.object({
328
345
  "biz-ui": import_zod2.z.string().optional(),
329
346
  templates: import_zod2.z.string().optional()
330
347
  });
348
+ var TokenRenameEntrySchema = import_zod2.z.object({
349
+ /** Variant version at which the rename took effect (semver). */
350
+ sinceVersion: import_zod2.z.string().regex(SEMVER_RE, "Invalid semver version"),
351
+ /** Old token name (with or without leading `--`; both forms accepted). */
352
+ from: import_zod2.z.string().min(1),
353
+ /** New token name. */
354
+ to: import_zod2.z.string().min(1),
355
+ /** Optional one-liner rationale surfaced in the upgrade-hints file. */
356
+ description: import_zod2.z.string().optional()
357
+ });
331
358
  var TokensVariantEntrySchema = import_zod2.z.object({
332
359
  /** Variant id — lowercase kebab-case. */
333
360
  name: import_zod2.z.string().min(1).regex(
@@ -347,7 +374,12 @@ var TokensVariantEntrySchema = import_zod2.z.object({
347
374
  */
348
375
  files: import_zod2.z.array(import_zod2.z.string().min(1)).min(1),
349
376
  /** Soft cross-package links (biz-ui / templates with the same variant name). */
350
- linked: TokensPackLinkedSchema.optional()
377
+ linked: TokensPackLinkedSchema.optional(),
378
+ /**
379
+ * Token rename log accumulated across this variant's version history.
380
+ * Empty / absent when the variant has never renamed a token.
381
+ */
382
+ renames: import_zod2.z.array(TokenRenameEntrySchema).optional()
351
383
  });
352
384
  var TokensPackageManifestSchema = import_zod2.z.object({
353
385
  $schema: import_zod2.z.string().optional(),
@@ -474,7 +506,28 @@ var PackageEntrySchema = import_zod4.z.object({
474
506
  /** Whether to emit React Server Components markers (`"use client"`). ui-specific. */
475
507
  rsc: import_zod4.z.boolean().optional()
476
508
  });
477
- var ProjectConfigSchema = import_zod4.z.object({
509
+ var TokenRenameRecordSchema = import_zod4.z.object({
510
+ /** ISO-8601 UTC timestamp at which the variant switch was performed. */
511
+ ts: import_zod4.z.string().min(1),
512
+ /** Variant the project was on before the switch. */
513
+ fromVariant: import_zod4.z.string().min(1),
514
+ /** Variant the project switched to. */
515
+ toVariant: import_zod4.z.string().min(1),
516
+ /**
517
+ * Token rename mapping — old token name → new token name.
518
+ * Empty object is legal (e.g. switch with zero rename).
519
+ */
520
+ renames: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.string())
521
+ });
522
+ var LastUpdateRecordSchema = import_zod4.z.object({
523
+ /** ISO-8601 UTC timestamp of the last successful update. */
524
+ ts: import_zod4.z.string().min(1),
525
+ /** Version the package was on before this update. */
526
+ fromVersion: import_zod4.z.string().min(1),
527
+ /** Version the package was on after this update. */
528
+ toVersion: import_zod4.z.string().min(1)
529
+ });
530
+ var ProjectConfigV1Schema = import_zod4.z.object({
478
531
  $schema: import_zod4.z.string().optional(),
479
532
  schemaVersion: import_zod4.z.literal(1),
480
533
  /** IDE identifier */
@@ -482,6 +535,31 @@ var ProjectConfigSchema = import_zod4.z.object({
482
535
  /** Installed packages keyed by package name */
483
536
  packages: import_zod4.z.record(import_zod4.z.string(), PackageEntrySchema)
484
537
  });
538
+ var ProjectConfigV2Schema = import_zod4.z.object({
539
+ $schema: import_zod4.z.string().optional(),
540
+ schemaVersion: import_zod4.z.literal(2),
541
+ /** IDE identifier */
542
+ ide: import_zod4.z.string().min(1),
543
+ /** Installed packages keyed by package name */
544
+ packages: import_zod4.z.record(import_zod4.z.string(), PackageEntrySchema),
545
+ /** Variant in effect before the most recent `variant switch`, if any. */
546
+ priorVariant: import_zod4.z.string().min(1).optional(),
547
+ /** Last successful update record keyed by package name. */
548
+ lastUpdate: import_zod4.z.record(import_zod4.z.string(), LastUpdateRecordSchema).optional(),
549
+ /** Token rename log accumulated across variant switches (oldest → newest). */
550
+ tokenRenameHistory: import_zod4.z.array(TokenRenameRecordSchema).optional()
551
+ });
552
+ var ProjectConfigSchema = import_zod4.z.discriminatedUnion("schemaVersion", [
553
+ ProjectConfigV1Schema,
554
+ ProjectConfigV2Schema
555
+ ]).transform((cfg) => {
556
+ if (cfg.schemaVersion === 2) return cfg;
557
+ const { schemaVersion: _v1, ...rest } = cfg;
558
+ return {
559
+ ...rest,
560
+ schemaVersion: 2
561
+ };
562
+ });
485
563
 
486
564
  // src/schema/installed.ts
487
565
  var import_zod5 = require("zod");
@@ -543,6 +621,98 @@ var SkillsLockSchema = import_zod6.z.object({
543
621
  skills: import_zod6.z.record(import_zod6.z.string().min(1), SkillsLockEntrySchema)
544
622
  });
545
623
 
624
+ // src/schema/upgrade-staging.ts
625
+ var import_zod7 = require("zod");
626
+ var UpgradeRiskLevelSchema = import_zod7.z.enum([
627
+ /** Hash matches — nothing to do. */
628
+ "unchanged",
629
+ /** Single-file change, no exported API surface delta. */
630
+ "upgradable-low",
631
+ /** Multi-file change or new exports / new cva variants (additive). */
632
+ "upgradable-medium",
633
+ /** Removed cva variants / renamed exports / props type narrowing. */
634
+ "risky",
635
+ /** Entry no longer exists upstream / file removed. */
636
+ "breaking",
637
+ /** Present in `src/components/{ui,biz-ui}/` but absent from installed manifest. */
638
+ "foreign"
639
+ ]);
640
+ var ComponentLineageSchema = import_zod7.z.enum([
641
+ "teamix-evo",
642
+ "shadcn-native",
643
+ "mixed",
644
+ "custom-only"
645
+ ]);
646
+ var UpgradeStagingCategorySchema = import_zod7.z.enum(["ui", "biz-ui"]);
647
+ var UpgradeStagingTriggerSchema = import_zod7.z.enum([
648
+ "update",
649
+ "ui-upgrade",
650
+ "biz-ui-upgrade"
651
+ ]);
652
+ var UpgradeStagingCurrentSchema = import_zod7.z.object({
653
+ /** Project-relative path of the component file (e.g. `src/components/ui/button.tsx`). */
654
+ target: import_zod7.z.string().min(1),
655
+ /** Hash recorded in `.teamix-evo/manifest.json` at install time, or null when foreign. */
656
+ hash: import_zod7.z.string().nullable(),
657
+ /** Lineage of *this specific component* (independent of project-wide lineage). */
658
+ sourceLineage: import_zod7.z.enum(["teamix-evo", "shadcn-native", "custom", "absent"])
659
+ });
660
+ var UpgradeStagingIncomingSchema = import_zod7.z.object({
661
+ /** Package-level version the incoming source comes from. */
662
+ sourceVersion: import_zod7.z.string().min(1),
663
+ /** Hash of incoming source after applying the consumer's import-rewrite aliases. */
664
+ hash: import_zod7.z.string().min(1),
665
+ /** Path of the incoming source file relative to the staging dir (e.g. `button/incoming.tsx`). */
666
+ relPath: import_zod7.z.string().min(1)
667
+ });
668
+ var UpgradeStagingDiffSchema = import_zod7.z.object({
669
+ riskLevel: UpgradeRiskLevelSchema,
670
+ /** Human-readable, machine-parsable hints (e.g. `"new prop: loading"`, `"removed cva variant: ghost"`). */
671
+ hints: import_zod7.z.array(import_zod7.z.string()),
672
+ /** Number of files that differ for this entry (almost always 1 today; reserved for multi-file entries). */
673
+ filesChangedCount: import_zod7.z.number().int().nonnegative(),
674
+ /**
675
+ * Path of the unified diff relative to the staging dir, when CLI emitted one.
676
+ * Reserved for a future emitter — in schema v1 the CLI does **not** pre-render
677
+ * `diff.unified.patch`; the consumer of the staging (the `teamix-evo-upgrade`
678
+ * skill) computes the diff on the fly from `current.tsx` vs `incoming.tsx`.
679
+ */
680
+ diffRelPath: import_zod7.z.string().optional()
681
+ });
682
+ var UpgradeStagingEntrySchema = import_zod7.z.object({
683
+ /** Component identifier matching the upstream registry (e.g. `"button"`). */
684
+ id: import_zod7.z.string().min(1),
685
+ /** Which package category this entry belongs to. */
686
+ category: UpgradeStagingCategorySchema,
687
+ current: UpgradeStagingCurrentSchema,
688
+ /** Absent when the entry is `breaking` (no incoming) or `foreign` (no upstream). */
689
+ incoming: UpgradeStagingIncomingSchema.optional(),
690
+ diff: UpgradeStagingDiffSchema
691
+ });
692
+ var UpgradeStagingManifestSchema = import_zod7.z.object({
693
+ schemaVersion: import_zod7.z.literal(1),
694
+ /** ISO-8601 timestamp the staging dir was created (matches dir suffix). */
695
+ ts: import_zod7.z.string().min(1),
696
+ /** Which package category this staging covers. */
697
+ package: UpgradeStagingCategorySchema,
698
+ /** Which command produced this staging. */
699
+ trigger: UpgradeStagingTriggerSchema,
700
+ /** Variant applicable to the staging (always `_flat` for ui; concrete variant for biz-ui). */
701
+ variant: import_zod7.z.string().min(1),
702
+ /** Installed package version (from `.teamix-evo/manifest.json`); empty string when foreign-only. */
703
+ fromVersion: import_zod7.z.string(),
704
+ /** Upstream package version. */
705
+ toVersion: import_zod7.z.string().min(1),
706
+ /** Project-wide lineage classification. */
707
+ lineage: ComponentLineageSchema,
708
+ /** Aggregate counts grouped by riskLevel for quick AI summarization. */
709
+ summary: import_zod7.z.object({
710
+ total: import_zod7.z.number().int().nonnegative(),
711
+ byRisk: import_zod7.z.record(UpgradeRiskLevelSchema, import_zod7.z.number().int().nonnegative())
712
+ }),
713
+ entries: import_zod7.z.array(UpgradeStagingEntrySchema)
714
+ });
715
+
546
716
  // src/loader.ts
547
717
  var fs = __toESM(require("fs/promises"), 1);
548
718
  var path = __toESM(require("path"), 1);
@@ -967,9 +1137,48 @@ function hasManagedRegion(content, id) {
967
1137
  );
968
1138
  return pattern.test(content);
969
1139
  }
1140
+ function splitManagedRegions(content) {
1141
+ parseManagedRegions(content);
1142
+ const regionRe = new RegExp(REGION_PATTERN.source, "g");
1143
+ const segments = [];
1144
+ let cursor = 0;
1145
+ let match;
1146
+ while ((match = regionRe.exec(content)) !== null) {
1147
+ const id = match[1];
1148
+ const regionContent = match[2];
1149
+ const start = match.index;
1150
+ const end = start + match[0].length;
1151
+ segments.push({ kind: "unmanaged", content: content.slice(cursor, start) });
1152
+ segments.push({
1153
+ kind: "managed",
1154
+ region: {
1155
+ id,
1156
+ startMarker: `<!-- teamix-evo:managed:start id="${id}" -->`,
1157
+ endMarker: `<!-- teamix-evo:managed:end id="${id}" -->`,
1158
+ content: regionContent
1159
+ }
1160
+ });
1161
+ cursor = end;
1162
+ }
1163
+ segments.push({ kind: "unmanaged", content: content.slice(cursor) });
1164
+ return segments;
1165
+ }
970
1166
  function escapeRegExp(str) {
971
1167
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
972
1168
  }
1169
+ var FRONTMATTER_PATTERN = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/;
1170
+ function extractFrontmatter(content) {
1171
+ const m = content.match(FRONTMATTER_PATTERN);
1172
+ return m ? m[0] : null;
1173
+ }
1174
+ function replaceFrontmatter(content, newFrontmatter) {
1175
+ const m = content.match(FRONTMATTER_PATTERN);
1176
+ if (!m) {
1177
+ return newFrontmatter.endsWith("\n") ? newFrontmatter + content : `${newFrontmatter}
1178
+ ${content}`;
1179
+ }
1180
+ return newFrontmatter + content.slice(m[0].length);
1181
+ }
973
1182
 
974
1183
  // src/strategy.ts
975
1184
  function shouldUpdate(strategy, resourceExists) {
@@ -1007,11 +1216,15 @@ function getUpdateAction(strategy, options) {
1007
1216
  }
1008
1217
  // Annotate the CommonJS export names for ESM import in node:
1009
1218
  0 && (module.exports = {
1219
+ ComponentLineageSchema,
1010
1220
  InstalledManifestSchema,
1011
1221
  InstalledPackageSchema,
1012
1222
  InstalledResourceSchema,
1223
+ LastUpdateRecordSchema,
1013
1224
  PackageEntrySchema,
1014
1225
  ProjectConfigSchema,
1226
+ ProjectConfigV1Schema,
1227
+ ProjectConfigV2Schema,
1015
1228
  ResourceSchema,
1016
1229
  ResourceTypeSchema,
1017
1230
  SkillEntrySchema,
@@ -1021,6 +1234,8 @@ function getUpdateAction(strategy, options) {
1021
1234
  SkillsLockSchema,
1022
1235
  SkillsPackageManifestSchema,
1023
1236
  TailwindVersionSchema,
1237
+ TokenRenameEntrySchema,
1238
+ TokenRenameRecordSchema,
1024
1239
  TokensPackLinkedSchema,
1025
1240
  TokensPackLockSchema,
1026
1241
  TokensPackageManifestSchema,
@@ -1032,10 +1247,19 @@ function getUpdateAction(strategy, options) {
1032
1247
  UiEntryTypeSchema,
1033
1248
  UiPackageManifestSchema,
1034
1249
  UpdateStrategySchema,
1250
+ UpgradeRiskLevelSchema,
1251
+ UpgradeStagingCategorySchema,
1252
+ UpgradeStagingCurrentSchema,
1253
+ UpgradeStagingDiffSchema,
1254
+ UpgradeStagingEntrySchema,
1255
+ UpgradeStagingIncomingSchema,
1256
+ UpgradeStagingManifestSchema,
1257
+ UpgradeStagingTriggerSchema,
1035
1258
  VariantManifestSchema,
1036
1259
  VariantUiPackageCatalogSchema,
1037
1260
  VariantUiPackageManifestSchema,
1038
1261
  VariantUiPackageNameSchema,
1262
+ extractFrontmatter,
1039
1263
  getUpdateAction,
1040
1264
  getVariantEntry,
1041
1265
  hasManagedRegion,
@@ -1046,9 +1270,11 @@ function getUpdateAction(strategy, options) {
1046
1270
  loadVariantUiPackageCatalog,
1047
1271
  loadVariantUiPackageManifest,
1048
1272
  parseManagedRegions,
1273
+ replaceFrontmatter,
1049
1274
  replaceManagedRegion,
1050
1275
  resolveUiEntryOrder,
1051
1276
  shouldUpdate,
1277
+ splitManagedRegions,
1052
1278
  validateConfig,
1053
1279
  validateInstalled,
1054
1280
  validateManifest,