@teamix-evo/registry 0.7.0 → 0.9.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,18 @@ 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,
42
+ PromoteFeatureVectorSchema: () => PromoteFeatureVectorSchema,
43
+ PromoteFileTypeSchema: () => PromoteFileTypeSchema,
44
+ PromoteModeSchema: () => PromoteModeSchema,
38
45
  ResourceSchema: () => ResourceSchema,
39
46
  ResourceTypeSchema: () => ResourceTypeSchema,
40
47
  SkillEntrySchema: () => SkillEntrySchema,
@@ -44,6 +51,8 @@ __export(index_exports, {
44
51
  SkillsLockSchema: () => SkillsLockSchema,
45
52
  SkillsPackageManifestSchema: () => SkillsPackageManifestSchema,
46
53
  TailwindVersionSchema: () => TailwindVersionSchema,
54
+ TokenRenameEntrySchema: () => TokenRenameEntrySchema,
55
+ TokenRenameRecordSchema: () => TokenRenameRecordSchema,
47
56
  TokensPackLinkedSchema: () => TokensPackLinkedSchema,
48
57
  TokensPackLockSchema: () => TokensPackLockSchema,
49
58
  TokensPackageManifestSchema: () => TokensPackageManifestSchema,
@@ -55,10 +64,20 @@ __export(index_exports, {
55
64
  UiEntryTypeSchema: () => UiEntryTypeSchema,
56
65
  UiPackageManifestSchema: () => UiPackageManifestSchema,
57
66
  UpdateStrategySchema: () => UpdateStrategySchema,
67
+ UpgradeRiskLevelSchema: () => UpgradeRiskLevelSchema,
68
+ UpgradeStagingCategorySchema: () => UpgradeStagingCategorySchema,
69
+ UpgradeStagingCurrentSchema: () => UpgradeStagingCurrentSchema,
70
+ UpgradeStagingDiffSchema: () => UpgradeStagingDiffSchema,
71
+ UpgradeStagingEntrySchema: () => UpgradeStagingEntrySchema,
72
+ UpgradeStagingIncomingSchema: () => UpgradeStagingIncomingSchema,
73
+ UpgradeStagingManifestSchema: () => UpgradeStagingManifestSchema,
74
+ UpgradeStagingPromotionSchema: () => UpgradeStagingPromotionSchema,
75
+ UpgradeStagingTriggerSchema: () => UpgradeStagingTriggerSchema,
58
76
  VariantManifestSchema: () => VariantManifestSchema,
59
77
  VariantUiPackageCatalogSchema: () => VariantUiPackageCatalogSchema,
60
78
  VariantUiPackageManifestSchema: () => VariantUiPackageManifestSchema,
61
79
  VariantUiPackageNameSchema: () => VariantUiPackageNameSchema,
80
+ extractFrontmatter: () => extractFrontmatter,
62
81
  getUpdateAction: () => getUpdateAction,
63
82
  getVariantEntry: () => getVariantEntry,
64
83
  hasManagedRegion: () => hasManagedRegion,
@@ -69,9 +88,11 @@ __export(index_exports, {
69
88
  loadVariantUiPackageCatalog: () => loadVariantUiPackageCatalog,
70
89
  loadVariantUiPackageManifest: () => loadVariantUiPackageManifest,
71
90
  parseManagedRegions: () => parseManagedRegions,
91
+ replaceFrontmatter: () => replaceFrontmatter,
72
92
  replaceManagedRegion: () => replaceManagedRegion,
73
93
  resolveUiEntryOrder: () => resolveUiEntryOrder,
74
94
  shouldUpdate: () => shouldUpdate,
95
+ splitManagedRegions: () => splitManagedRegions,
75
96
  validateConfig: () => validateConfig,
76
97
  validateInstalled: () => validateInstalled,
77
98
  validateManifest: () => validateManifest,
@@ -328,6 +349,16 @@ var TokensPackLinkedSchema = import_zod2.z.object({
328
349
  "biz-ui": import_zod2.z.string().optional(),
329
350
  templates: import_zod2.z.string().optional()
330
351
  });
352
+ var TokenRenameEntrySchema = import_zod2.z.object({
353
+ /** Variant version at which the rename took effect (semver). */
354
+ sinceVersion: import_zod2.z.string().regex(SEMVER_RE, "Invalid semver version"),
355
+ /** Old token name (with or without leading `--`; both forms accepted). */
356
+ from: import_zod2.z.string().min(1),
357
+ /** New token name. */
358
+ to: import_zod2.z.string().min(1),
359
+ /** Optional one-liner rationale surfaced in the upgrade-hints file. */
360
+ description: import_zod2.z.string().optional()
361
+ });
331
362
  var TokensVariantEntrySchema = import_zod2.z.object({
332
363
  /** Variant id — lowercase kebab-case. */
333
364
  name: import_zod2.z.string().min(1).regex(
@@ -347,7 +378,12 @@ var TokensVariantEntrySchema = import_zod2.z.object({
347
378
  */
348
379
  files: import_zod2.z.array(import_zod2.z.string().min(1)).min(1),
349
380
  /** Soft cross-package links (biz-ui / templates with the same variant name). */
350
- linked: TokensPackLinkedSchema.optional()
381
+ linked: TokensPackLinkedSchema.optional(),
382
+ /**
383
+ * Token rename log accumulated across this variant's version history.
384
+ * Empty / absent when the variant has never renamed a token.
385
+ */
386
+ renames: import_zod2.z.array(TokenRenameEntrySchema).optional()
351
387
  });
352
388
  var TokensPackageManifestSchema = import_zod2.z.object({
353
389
  $schema: import_zod2.z.string().optional(),
@@ -474,7 +510,28 @@ var PackageEntrySchema = import_zod4.z.object({
474
510
  /** Whether to emit React Server Components markers (`"use client"`). ui-specific. */
475
511
  rsc: import_zod4.z.boolean().optional()
476
512
  });
477
- var ProjectConfigSchema = import_zod4.z.object({
513
+ var TokenRenameRecordSchema = import_zod4.z.object({
514
+ /** ISO-8601 UTC timestamp at which the variant switch was performed. */
515
+ ts: import_zod4.z.string().min(1),
516
+ /** Variant the project was on before the switch. */
517
+ fromVariant: import_zod4.z.string().min(1),
518
+ /** Variant the project switched to. */
519
+ toVariant: import_zod4.z.string().min(1),
520
+ /**
521
+ * Token rename mapping — old token name → new token name.
522
+ * Empty object is legal (e.g. switch with zero rename).
523
+ */
524
+ renames: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.string())
525
+ });
526
+ var LastUpdateRecordSchema = import_zod4.z.object({
527
+ /** ISO-8601 UTC timestamp of the last successful update. */
528
+ ts: import_zod4.z.string().min(1),
529
+ /** Version the package was on before this update. */
530
+ fromVersion: import_zod4.z.string().min(1),
531
+ /** Version the package was on after this update. */
532
+ toVersion: import_zod4.z.string().min(1)
533
+ });
534
+ var ProjectConfigV1Schema = import_zod4.z.object({
478
535
  $schema: import_zod4.z.string().optional(),
479
536
  schemaVersion: import_zod4.z.literal(1),
480
537
  /** IDE identifier */
@@ -482,6 +539,31 @@ var ProjectConfigSchema = import_zod4.z.object({
482
539
  /** Installed packages keyed by package name */
483
540
  packages: import_zod4.z.record(import_zod4.z.string(), PackageEntrySchema)
484
541
  });
542
+ var ProjectConfigV2Schema = import_zod4.z.object({
543
+ $schema: import_zod4.z.string().optional(),
544
+ schemaVersion: import_zod4.z.literal(2),
545
+ /** IDE identifier */
546
+ ide: import_zod4.z.string().min(1),
547
+ /** Installed packages keyed by package name */
548
+ packages: import_zod4.z.record(import_zod4.z.string(), PackageEntrySchema),
549
+ /** Variant in effect before the most recent `variant switch`, if any. */
550
+ priorVariant: import_zod4.z.string().min(1).optional(),
551
+ /** Last successful update record keyed by package name. */
552
+ lastUpdate: import_zod4.z.record(import_zod4.z.string(), LastUpdateRecordSchema).optional(),
553
+ /** Token rename log accumulated across variant switches (oldest → newest). */
554
+ tokenRenameHistory: import_zod4.z.array(TokenRenameRecordSchema).optional()
555
+ });
556
+ var ProjectConfigSchema = import_zod4.z.discriminatedUnion("schemaVersion", [
557
+ ProjectConfigV1Schema,
558
+ ProjectConfigV2Schema
559
+ ]).transform((cfg) => {
560
+ if (cfg.schemaVersion === 2) return cfg;
561
+ const { schemaVersion: _v1, ...rest } = cfg;
562
+ return {
563
+ ...rest,
564
+ schemaVersion: 2
565
+ };
566
+ });
485
567
 
486
568
  // src/schema/installed.ts
487
569
  var import_zod5 = require("zod");
@@ -497,7 +579,26 @@ var InstalledResourceSchema = import_zod5.z.object({
497
579
  /** IDE this resource was installed for (skill resources only) */
498
580
  ide: SkillIdeSchema.optional(),
499
581
  /** Install scope (skill resources only) */
500
- scope: SkillScopeSchema.optional()
582
+ scope: SkillScopeSchema.optional(),
583
+ /**
584
+ * Origin of the file content. Optional for backwards compatibility — older
585
+ * manifests without this field still validate.
586
+ *
587
+ * - `teamix-evo` : installed from `@teamix-evo/ui` (or biz-ui)
588
+ * - `shadcn-native` : matches an upstream registry entry verbatim
589
+ * - `custom` : user-modified or hand-authored, no upstream match
590
+ * - `custom-legacy` : user version preserved during a Coexist promotion
591
+ * (see ADR / promote-to-biz)
592
+ * - `detected` : adopted via `ui add --adopt`, registry id matched but
593
+ * content has not been verified against upstream hash
594
+ */
595
+ sourceLineage: import_zod5.z.enum([
596
+ "teamix-evo",
597
+ "shadcn-native",
598
+ "custom",
599
+ "custom-legacy",
600
+ "detected"
601
+ ]).optional()
501
602
  });
502
603
  var InstalledPackageSchema = import_zod5.z.object({
503
604
  /** Full package name (e.g. "@teamix-evo/tokens") */
@@ -543,6 +644,152 @@ var SkillsLockSchema = import_zod6.z.object({
543
644
  skills: import_zod6.z.record(import_zod6.z.string().min(1), SkillsLockEntrySchema)
544
645
  });
545
646
 
647
+ // src/schema/upgrade-staging.ts
648
+ var import_zod7 = require("zod");
649
+ var UpgradeRiskLevelSchema = import_zod7.z.enum([
650
+ /** Hash matches — nothing to do. */
651
+ "unchanged",
652
+ /** Single-file change, no exported API surface delta. */
653
+ "upgradable-low",
654
+ /** Multi-file change or new exports / new cva variants (additive). */
655
+ "upgradable-medium",
656
+ /** Removed cva variants / renamed exports / props type narrowing. */
657
+ "risky",
658
+ /** Entry no longer exists upstream / file removed. */
659
+ "breaking",
660
+ /** Present in `src/components/{ui,biz-ui}/` but absent from installed manifest. */
661
+ "foreign"
662
+ ]);
663
+ var ComponentLineageSchema = import_zod7.z.enum([
664
+ "teamix-evo",
665
+ "shadcn-native",
666
+ "mixed",
667
+ "custom-only"
668
+ ]);
669
+ var UpgradeStagingCategorySchema = import_zod7.z.enum(["ui", "biz-ui"]);
670
+ var UpgradeStagingTriggerSchema = import_zod7.z.enum([
671
+ "update",
672
+ "ui-upgrade",
673
+ "biz-ui-upgrade"
674
+ ]);
675
+ var UpgradeStagingCurrentSchema = import_zod7.z.object({
676
+ /** Project-relative path of the component file (e.g. `src/components/ui/button.tsx`). */
677
+ target: import_zod7.z.string().min(1),
678
+ /** Hash recorded in `.teamix-evo/manifest.json` at install time, or null when foreign. */
679
+ hash: import_zod7.z.string().nullable(),
680
+ /** Lineage of *this specific component* (independent of project-wide lineage). */
681
+ sourceLineage: import_zod7.z.enum(["teamix-evo", "shadcn-native", "custom", "absent"])
682
+ });
683
+ var UpgradeStagingIncomingSchema = import_zod7.z.object({
684
+ /** Package-level version the incoming source comes from. */
685
+ sourceVersion: import_zod7.z.string().min(1),
686
+ /** Hash of incoming source after applying the consumer's import-rewrite aliases. */
687
+ hash: import_zod7.z.string().min(1),
688
+ /** Path of the incoming source file relative to the staging dir (e.g. `button/incoming.tsx`). */
689
+ relPath: import_zod7.z.string().min(1)
690
+ });
691
+ var UpgradeStagingDiffSchema = import_zod7.z.object({
692
+ riskLevel: UpgradeRiskLevelSchema,
693
+ /** Human-readable, machine-parsable hints (e.g. `"new prop: loading"`, `"removed cva variant: ghost"`). */
694
+ hints: import_zod7.z.array(import_zod7.z.string()),
695
+ /** Number of files that differ for this entry (almost always 1 today; reserved for multi-file entries). */
696
+ filesChangedCount: import_zod7.z.number().int().nonnegative(),
697
+ /**
698
+ * Path of the unified diff relative to the staging dir, when CLI emitted one.
699
+ * Reserved for a future emitter — in schema v1 the CLI does **not** pre-render
700
+ * `diff.unified.patch`; the consumer of the staging (the `teamix-evo-upgrade`
701
+ * skill) computes the diff on the fly from `current.tsx` vs `incoming.tsx`.
702
+ */
703
+ diffRelPath: import_zod7.z.string().optional()
704
+ });
705
+ var PromoteFileTypeSchema = import_zod7.z.enum([
706
+ "component",
707
+ "hook",
708
+ "util",
709
+ "type",
710
+ "provider"
711
+ ]);
712
+ var PromoteModeSchema = import_zod7.z.enum([
713
+ "Coexist",
714
+ "Preset",
715
+ "Wrapper",
716
+ "Compose",
717
+ "Variant",
718
+ "Fork",
719
+ "TokenOnly",
720
+ "ManualReview"
721
+ ]);
722
+ var PromoteFeatureVectorSchema = import_zod7.z.object({
723
+ apiDelta: import_zod7.z.object({
724
+ added: import_zod7.z.array(import_zod7.z.string()),
725
+ removed: import_zod7.z.array(import_zod7.z.string()),
726
+ signatureChanged: import_zod7.z.boolean()
727
+ }),
728
+ styleDelta: import_zod7.z.object({
729
+ classNameDiff: import_zod7.z.boolean(),
730
+ tokenUsageDiff: import_zod7.z.boolean()
731
+ }),
732
+ logicDelta: import_zod7.z.object({
733
+ hasState: import_zod7.z.boolean(),
734
+ hasEffect: import_zod7.z.boolean(),
735
+ hasExtraImports: import_zod7.z.boolean()
736
+ }),
737
+ cvaDelta: import_zod7.z.object({
738
+ addedVariants: import_zod7.z.array(import_zod7.z.string()),
739
+ modifiedVariants: import_zod7.z.array(import_zod7.z.string())
740
+ }),
741
+ structureDelta: import_zod7.z.object({
742
+ isComposition: import_zod7.z.boolean(),
743
+ atomicChildren: import_zod7.z.array(import_zod7.z.string())
744
+ })
745
+ });
746
+ var UpgradeStagingPromotionSchema = import_zod7.z.object({
747
+ fileType: PromoteFileTypeSchema,
748
+ featureVector: PromoteFeatureVectorSchema,
749
+ recommendedModes: import_zod7.z.array(PromoteModeSchema),
750
+ confidence: import_zod7.z.number().min(0).max(1),
751
+ reasons: import_zod7.z.array(import_zod7.z.string())
752
+ });
753
+ var UpgradeStagingEntrySchema = import_zod7.z.object({
754
+ /** Component identifier matching the upstream registry (e.g. `"button"`). */
755
+ id: import_zod7.z.string().min(1),
756
+ /** Which package category this entry belongs to. */
757
+ category: UpgradeStagingCategorySchema,
758
+ current: UpgradeStagingCurrentSchema,
759
+ /** Absent when the entry is `breaking` (no incoming) or `foreign` (no upstream). */
760
+ incoming: UpgradeStagingIncomingSchema.optional(),
761
+ diff: UpgradeStagingDiffSchema,
762
+ /**
763
+ * Optional promotion-planning payload (Init landing plan Phase 2.C.2). Only
764
+ * emitted when the CLI was able to compare current/incoming sources —
765
+ * `breaking` / `foreign` entries leave it undefined.
766
+ */
767
+ promotion: UpgradeStagingPromotionSchema.optional()
768
+ });
769
+ var UpgradeStagingManifestSchema = import_zod7.z.object({
770
+ schemaVersion: import_zod7.z.literal(1),
771
+ /** ISO-8601 timestamp the staging dir was created (matches dir suffix). */
772
+ ts: import_zod7.z.string().min(1),
773
+ /** Which package category this staging covers. */
774
+ package: UpgradeStagingCategorySchema,
775
+ /** Which command produced this staging. */
776
+ trigger: UpgradeStagingTriggerSchema,
777
+ /** Variant applicable to the staging (always `_flat` for ui; concrete variant for biz-ui). */
778
+ variant: import_zod7.z.string().min(1),
779
+ /** Installed package version (from `.teamix-evo/manifest.json`); empty string when foreign-only. */
780
+ fromVersion: import_zod7.z.string(),
781
+ /** Upstream package version. */
782
+ toVersion: import_zod7.z.string().min(1),
783
+ /** Project-wide lineage classification. */
784
+ lineage: ComponentLineageSchema,
785
+ /** Aggregate counts grouped by riskLevel for quick AI summarization. */
786
+ summary: import_zod7.z.object({
787
+ total: import_zod7.z.number().int().nonnegative(),
788
+ byRisk: import_zod7.z.record(UpgradeRiskLevelSchema, import_zod7.z.number().int().nonnegative())
789
+ }),
790
+ entries: import_zod7.z.array(UpgradeStagingEntrySchema)
791
+ });
792
+
546
793
  // src/loader.ts
547
794
  var fs = __toESM(require("fs/promises"), 1);
548
795
  var path = __toESM(require("path"), 1);
@@ -967,9 +1214,48 @@ function hasManagedRegion(content, id) {
967
1214
  );
968
1215
  return pattern.test(content);
969
1216
  }
1217
+ function splitManagedRegions(content) {
1218
+ parseManagedRegions(content);
1219
+ const regionRe = new RegExp(REGION_PATTERN.source, "g");
1220
+ const segments = [];
1221
+ let cursor = 0;
1222
+ let match;
1223
+ while ((match = regionRe.exec(content)) !== null) {
1224
+ const id = match[1];
1225
+ const regionContent = match[2];
1226
+ const start = match.index;
1227
+ const end = start + match[0].length;
1228
+ segments.push({ kind: "unmanaged", content: content.slice(cursor, start) });
1229
+ segments.push({
1230
+ kind: "managed",
1231
+ region: {
1232
+ id,
1233
+ startMarker: `<!-- teamix-evo:managed:start id="${id}" -->`,
1234
+ endMarker: `<!-- teamix-evo:managed:end id="${id}" -->`,
1235
+ content: regionContent
1236
+ }
1237
+ });
1238
+ cursor = end;
1239
+ }
1240
+ segments.push({ kind: "unmanaged", content: content.slice(cursor) });
1241
+ return segments;
1242
+ }
970
1243
  function escapeRegExp(str) {
971
1244
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
972
1245
  }
1246
+ var FRONTMATTER_PATTERN = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/;
1247
+ function extractFrontmatter(content) {
1248
+ const m = content.match(FRONTMATTER_PATTERN);
1249
+ return m ? m[0] : null;
1250
+ }
1251
+ function replaceFrontmatter(content, newFrontmatter) {
1252
+ const m = content.match(FRONTMATTER_PATTERN);
1253
+ if (!m) {
1254
+ return newFrontmatter.endsWith("\n") ? newFrontmatter + content : `${newFrontmatter}
1255
+ ${content}`;
1256
+ }
1257
+ return newFrontmatter + content.slice(m[0].length);
1258
+ }
973
1259
 
974
1260
  // src/strategy.ts
975
1261
  function shouldUpdate(strategy, resourceExists) {
@@ -1007,11 +1293,18 @@ function getUpdateAction(strategy, options) {
1007
1293
  }
1008
1294
  // Annotate the CommonJS export names for ESM import in node:
1009
1295
  0 && (module.exports = {
1296
+ ComponentLineageSchema,
1010
1297
  InstalledManifestSchema,
1011
1298
  InstalledPackageSchema,
1012
1299
  InstalledResourceSchema,
1300
+ LastUpdateRecordSchema,
1013
1301
  PackageEntrySchema,
1014
1302
  ProjectConfigSchema,
1303
+ ProjectConfigV1Schema,
1304
+ ProjectConfigV2Schema,
1305
+ PromoteFeatureVectorSchema,
1306
+ PromoteFileTypeSchema,
1307
+ PromoteModeSchema,
1015
1308
  ResourceSchema,
1016
1309
  ResourceTypeSchema,
1017
1310
  SkillEntrySchema,
@@ -1021,6 +1314,8 @@ function getUpdateAction(strategy, options) {
1021
1314
  SkillsLockSchema,
1022
1315
  SkillsPackageManifestSchema,
1023
1316
  TailwindVersionSchema,
1317
+ TokenRenameEntrySchema,
1318
+ TokenRenameRecordSchema,
1024
1319
  TokensPackLinkedSchema,
1025
1320
  TokensPackLockSchema,
1026
1321
  TokensPackageManifestSchema,
@@ -1032,10 +1327,20 @@ function getUpdateAction(strategy, options) {
1032
1327
  UiEntryTypeSchema,
1033
1328
  UiPackageManifestSchema,
1034
1329
  UpdateStrategySchema,
1330
+ UpgradeRiskLevelSchema,
1331
+ UpgradeStagingCategorySchema,
1332
+ UpgradeStagingCurrentSchema,
1333
+ UpgradeStagingDiffSchema,
1334
+ UpgradeStagingEntrySchema,
1335
+ UpgradeStagingIncomingSchema,
1336
+ UpgradeStagingManifestSchema,
1337
+ UpgradeStagingPromotionSchema,
1338
+ UpgradeStagingTriggerSchema,
1035
1339
  VariantManifestSchema,
1036
1340
  VariantUiPackageCatalogSchema,
1037
1341
  VariantUiPackageManifestSchema,
1038
1342
  VariantUiPackageNameSchema,
1343
+ extractFrontmatter,
1039
1344
  getUpdateAction,
1040
1345
  getVariantEntry,
1041
1346
  hasManagedRegion,
@@ -1046,9 +1351,11 @@ function getUpdateAction(strategy, options) {
1046
1351
  loadVariantUiPackageCatalog,
1047
1352
  loadVariantUiPackageManifest,
1048
1353
  parseManagedRegions,
1354
+ replaceFrontmatter,
1049
1355
  replaceManagedRegion,
1050
1356
  resolveUiEntryOrder,
1051
1357
  shouldUpdate,
1358
+ splitManagedRegions,
1052
1359
  validateConfig,
1053
1360
  validateInstalled,
1054
1361
  validateManifest,