@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 +310 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2253 -102
- package/dist/index.d.ts +2253 -102
- package/dist/index.js +289 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -244,6 +244,16 @@ var TokensPackLinkedSchema = z2.object({
|
|
|
244
244
|
"biz-ui": z2.string().optional(),
|
|
245
245
|
templates: z2.string().optional()
|
|
246
246
|
});
|
|
247
|
+
var TokenRenameEntrySchema = z2.object({
|
|
248
|
+
/** Variant version at which the rename took effect (semver). */
|
|
249
|
+
sinceVersion: z2.string().regex(SEMVER_RE, "Invalid semver version"),
|
|
250
|
+
/** Old token name (with or without leading `--`; both forms accepted). */
|
|
251
|
+
from: z2.string().min(1),
|
|
252
|
+
/** New token name. */
|
|
253
|
+
to: z2.string().min(1),
|
|
254
|
+
/** Optional one-liner rationale surfaced in the upgrade-hints file. */
|
|
255
|
+
description: z2.string().optional()
|
|
256
|
+
});
|
|
247
257
|
var TokensVariantEntrySchema = z2.object({
|
|
248
258
|
/** Variant id — lowercase kebab-case. */
|
|
249
259
|
name: z2.string().min(1).regex(
|
|
@@ -263,7 +273,12 @@ var TokensVariantEntrySchema = z2.object({
|
|
|
263
273
|
*/
|
|
264
274
|
files: z2.array(z2.string().min(1)).min(1),
|
|
265
275
|
/** Soft cross-package links (biz-ui / templates with the same variant name). */
|
|
266
|
-
linked: TokensPackLinkedSchema.optional()
|
|
276
|
+
linked: TokensPackLinkedSchema.optional(),
|
|
277
|
+
/**
|
|
278
|
+
* Token rename log accumulated across this variant's version history.
|
|
279
|
+
* Empty / absent when the variant has never renamed a token.
|
|
280
|
+
*/
|
|
281
|
+
renames: z2.array(TokenRenameEntrySchema).optional()
|
|
267
282
|
});
|
|
268
283
|
var TokensPackageManifestSchema = z2.object({
|
|
269
284
|
$schema: z2.string().optional(),
|
|
@@ -390,7 +405,28 @@ var PackageEntrySchema = z4.object({
|
|
|
390
405
|
/** Whether to emit React Server Components markers (`"use client"`). ui-specific. */
|
|
391
406
|
rsc: z4.boolean().optional()
|
|
392
407
|
});
|
|
393
|
-
var
|
|
408
|
+
var TokenRenameRecordSchema = z4.object({
|
|
409
|
+
/** ISO-8601 UTC timestamp at which the variant switch was performed. */
|
|
410
|
+
ts: z4.string().min(1),
|
|
411
|
+
/** Variant the project was on before the switch. */
|
|
412
|
+
fromVariant: z4.string().min(1),
|
|
413
|
+
/** Variant the project switched to. */
|
|
414
|
+
toVariant: z4.string().min(1),
|
|
415
|
+
/**
|
|
416
|
+
* Token rename mapping — old token name → new token name.
|
|
417
|
+
* Empty object is legal (e.g. switch with zero rename).
|
|
418
|
+
*/
|
|
419
|
+
renames: z4.record(z4.string(), z4.string())
|
|
420
|
+
});
|
|
421
|
+
var LastUpdateRecordSchema = z4.object({
|
|
422
|
+
/** ISO-8601 UTC timestamp of the last successful update. */
|
|
423
|
+
ts: z4.string().min(1),
|
|
424
|
+
/** Version the package was on before this update. */
|
|
425
|
+
fromVersion: z4.string().min(1),
|
|
426
|
+
/** Version the package was on after this update. */
|
|
427
|
+
toVersion: z4.string().min(1)
|
|
428
|
+
});
|
|
429
|
+
var ProjectConfigV1Schema = z4.object({
|
|
394
430
|
$schema: z4.string().optional(),
|
|
395
431
|
schemaVersion: z4.literal(1),
|
|
396
432
|
/** IDE identifier */
|
|
@@ -398,6 +434,31 @@ var ProjectConfigSchema = z4.object({
|
|
|
398
434
|
/** Installed packages keyed by package name */
|
|
399
435
|
packages: z4.record(z4.string(), PackageEntrySchema)
|
|
400
436
|
});
|
|
437
|
+
var ProjectConfigV2Schema = z4.object({
|
|
438
|
+
$schema: z4.string().optional(),
|
|
439
|
+
schemaVersion: z4.literal(2),
|
|
440
|
+
/** IDE identifier */
|
|
441
|
+
ide: z4.string().min(1),
|
|
442
|
+
/** Installed packages keyed by package name */
|
|
443
|
+
packages: z4.record(z4.string(), PackageEntrySchema),
|
|
444
|
+
/** Variant in effect before the most recent `variant switch`, if any. */
|
|
445
|
+
priorVariant: z4.string().min(1).optional(),
|
|
446
|
+
/** Last successful update record keyed by package name. */
|
|
447
|
+
lastUpdate: z4.record(z4.string(), LastUpdateRecordSchema).optional(),
|
|
448
|
+
/** Token rename log accumulated across variant switches (oldest → newest). */
|
|
449
|
+
tokenRenameHistory: z4.array(TokenRenameRecordSchema).optional()
|
|
450
|
+
});
|
|
451
|
+
var ProjectConfigSchema = z4.discriminatedUnion("schemaVersion", [
|
|
452
|
+
ProjectConfigV1Schema,
|
|
453
|
+
ProjectConfigV2Schema
|
|
454
|
+
]).transform((cfg) => {
|
|
455
|
+
if (cfg.schemaVersion === 2) return cfg;
|
|
456
|
+
const { schemaVersion: _v1, ...rest } = cfg;
|
|
457
|
+
return {
|
|
458
|
+
...rest,
|
|
459
|
+
schemaVersion: 2
|
|
460
|
+
};
|
|
461
|
+
});
|
|
401
462
|
|
|
402
463
|
// src/schema/installed.ts
|
|
403
464
|
import { z as z5 } from "zod";
|
|
@@ -413,7 +474,26 @@ var InstalledResourceSchema = z5.object({
|
|
|
413
474
|
/** IDE this resource was installed for (skill resources only) */
|
|
414
475
|
ide: SkillIdeSchema.optional(),
|
|
415
476
|
/** Install scope (skill resources only) */
|
|
416
|
-
scope: SkillScopeSchema.optional()
|
|
477
|
+
scope: SkillScopeSchema.optional(),
|
|
478
|
+
/**
|
|
479
|
+
* Origin of the file content. Optional for backwards compatibility — older
|
|
480
|
+
* manifests without this field still validate.
|
|
481
|
+
*
|
|
482
|
+
* - `teamix-evo` : installed from `@teamix-evo/ui` (or biz-ui)
|
|
483
|
+
* - `shadcn-native` : matches an upstream registry entry verbatim
|
|
484
|
+
* - `custom` : user-modified or hand-authored, no upstream match
|
|
485
|
+
* - `custom-legacy` : user version preserved during a Coexist promotion
|
|
486
|
+
* (see ADR / promote-to-biz)
|
|
487
|
+
* - `detected` : adopted via `ui add --adopt`, registry id matched but
|
|
488
|
+
* content has not been verified against upstream hash
|
|
489
|
+
*/
|
|
490
|
+
sourceLineage: z5.enum([
|
|
491
|
+
"teamix-evo",
|
|
492
|
+
"shadcn-native",
|
|
493
|
+
"custom",
|
|
494
|
+
"custom-legacy",
|
|
495
|
+
"detected"
|
|
496
|
+
]).optional()
|
|
417
497
|
});
|
|
418
498
|
var InstalledPackageSchema = z5.object({
|
|
419
499
|
/** Full package name (e.g. "@teamix-evo/tokens") */
|
|
@@ -459,6 +539,152 @@ var SkillsLockSchema = z6.object({
|
|
|
459
539
|
skills: z6.record(z6.string().min(1), SkillsLockEntrySchema)
|
|
460
540
|
});
|
|
461
541
|
|
|
542
|
+
// src/schema/upgrade-staging.ts
|
|
543
|
+
import { z as z7 } from "zod";
|
|
544
|
+
var UpgradeRiskLevelSchema = z7.enum([
|
|
545
|
+
/** Hash matches — nothing to do. */
|
|
546
|
+
"unchanged",
|
|
547
|
+
/** Single-file change, no exported API surface delta. */
|
|
548
|
+
"upgradable-low",
|
|
549
|
+
/** Multi-file change or new exports / new cva variants (additive). */
|
|
550
|
+
"upgradable-medium",
|
|
551
|
+
/** Removed cva variants / renamed exports / props type narrowing. */
|
|
552
|
+
"risky",
|
|
553
|
+
/** Entry no longer exists upstream / file removed. */
|
|
554
|
+
"breaking",
|
|
555
|
+
/** Present in `src/components/{ui,biz-ui}/` but absent from installed manifest. */
|
|
556
|
+
"foreign"
|
|
557
|
+
]);
|
|
558
|
+
var ComponentLineageSchema = z7.enum([
|
|
559
|
+
"teamix-evo",
|
|
560
|
+
"shadcn-native",
|
|
561
|
+
"mixed",
|
|
562
|
+
"custom-only"
|
|
563
|
+
]);
|
|
564
|
+
var UpgradeStagingCategorySchema = z7.enum(["ui", "biz-ui"]);
|
|
565
|
+
var UpgradeStagingTriggerSchema = z7.enum([
|
|
566
|
+
"update",
|
|
567
|
+
"ui-upgrade",
|
|
568
|
+
"biz-ui-upgrade"
|
|
569
|
+
]);
|
|
570
|
+
var UpgradeStagingCurrentSchema = z7.object({
|
|
571
|
+
/** Project-relative path of the component file (e.g. `src/components/ui/button.tsx`). */
|
|
572
|
+
target: z7.string().min(1),
|
|
573
|
+
/** Hash recorded in `.teamix-evo/manifest.json` at install time, or null when foreign. */
|
|
574
|
+
hash: z7.string().nullable(),
|
|
575
|
+
/** Lineage of *this specific component* (independent of project-wide lineage). */
|
|
576
|
+
sourceLineage: z7.enum(["teamix-evo", "shadcn-native", "custom", "absent"])
|
|
577
|
+
});
|
|
578
|
+
var UpgradeStagingIncomingSchema = z7.object({
|
|
579
|
+
/** Package-level version the incoming source comes from. */
|
|
580
|
+
sourceVersion: z7.string().min(1),
|
|
581
|
+
/** Hash of incoming source after applying the consumer's import-rewrite aliases. */
|
|
582
|
+
hash: z7.string().min(1),
|
|
583
|
+
/** Path of the incoming source file relative to the staging dir (e.g. `button/incoming.tsx`). */
|
|
584
|
+
relPath: z7.string().min(1)
|
|
585
|
+
});
|
|
586
|
+
var UpgradeStagingDiffSchema = z7.object({
|
|
587
|
+
riskLevel: UpgradeRiskLevelSchema,
|
|
588
|
+
/** Human-readable, machine-parsable hints (e.g. `"new prop: loading"`, `"removed cva variant: ghost"`). */
|
|
589
|
+
hints: z7.array(z7.string()),
|
|
590
|
+
/** Number of files that differ for this entry (almost always 1 today; reserved for multi-file entries). */
|
|
591
|
+
filesChangedCount: z7.number().int().nonnegative(),
|
|
592
|
+
/**
|
|
593
|
+
* Path of the unified diff relative to the staging dir, when CLI emitted one.
|
|
594
|
+
* Reserved for a future emitter — in schema v1 the CLI does **not** pre-render
|
|
595
|
+
* `diff.unified.patch`; the consumer of the staging (the `teamix-evo-upgrade`
|
|
596
|
+
* skill) computes the diff on the fly from `current.tsx` vs `incoming.tsx`.
|
|
597
|
+
*/
|
|
598
|
+
diffRelPath: z7.string().optional()
|
|
599
|
+
});
|
|
600
|
+
var PromoteFileTypeSchema = z7.enum([
|
|
601
|
+
"component",
|
|
602
|
+
"hook",
|
|
603
|
+
"util",
|
|
604
|
+
"type",
|
|
605
|
+
"provider"
|
|
606
|
+
]);
|
|
607
|
+
var PromoteModeSchema = z7.enum([
|
|
608
|
+
"Coexist",
|
|
609
|
+
"Preset",
|
|
610
|
+
"Wrapper",
|
|
611
|
+
"Compose",
|
|
612
|
+
"Variant",
|
|
613
|
+
"Fork",
|
|
614
|
+
"TokenOnly",
|
|
615
|
+
"ManualReview"
|
|
616
|
+
]);
|
|
617
|
+
var PromoteFeatureVectorSchema = z7.object({
|
|
618
|
+
apiDelta: z7.object({
|
|
619
|
+
added: z7.array(z7.string()),
|
|
620
|
+
removed: z7.array(z7.string()),
|
|
621
|
+
signatureChanged: z7.boolean()
|
|
622
|
+
}),
|
|
623
|
+
styleDelta: z7.object({
|
|
624
|
+
classNameDiff: z7.boolean(),
|
|
625
|
+
tokenUsageDiff: z7.boolean()
|
|
626
|
+
}),
|
|
627
|
+
logicDelta: z7.object({
|
|
628
|
+
hasState: z7.boolean(),
|
|
629
|
+
hasEffect: z7.boolean(),
|
|
630
|
+
hasExtraImports: z7.boolean()
|
|
631
|
+
}),
|
|
632
|
+
cvaDelta: z7.object({
|
|
633
|
+
addedVariants: z7.array(z7.string()),
|
|
634
|
+
modifiedVariants: z7.array(z7.string())
|
|
635
|
+
}),
|
|
636
|
+
structureDelta: z7.object({
|
|
637
|
+
isComposition: z7.boolean(),
|
|
638
|
+
atomicChildren: z7.array(z7.string())
|
|
639
|
+
})
|
|
640
|
+
});
|
|
641
|
+
var UpgradeStagingPromotionSchema = z7.object({
|
|
642
|
+
fileType: PromoteFileTypeSchema,
|
|
643
|
+
featureVector: PromoteFeatureVectorSchema,
|
|
644
|
+
recommendedModes: z7.array(PromoteModeSchema),
|
|
645
|
+
confidence: z7.number().min(0).max(1),
|
|
646
|
+
reasons: z7.array(z7.string())
|
|
647
|
+
});
|
|
648
|
+
var UpgradeStagingEntrySchema = z7.object({
|
|
649
|
+
/** Component identifier matching the upstream registry (e.g. `"button"`). */
|
|
650
|
+
id: z7.string().min(1),
|
|
651
|
+
/** Which package category this entry belongs to. */
|
|
652
|
+
category: UpgradeStagingCategorySchema,
|
|
653
|
+
current: UpgradeStagingCurrentSchema,
|
|
654
|
+
/** Absent when the entry is `breaking` (no incoming) or `foreign` (no upstream). */
|
|
655
|
+
incoming: UpgradeStagingIncomingSchema.optional(),
|
|
656
|
+
diff: UpgradeStagingDiffSchema,
|
|
657
|
+
/**
|
|
658
|
+
* Optional promotion-planning payload (Init landing plan Phase 2.C.2). Only
|
|
659
|
+
* emitted when the CLI was able to compare current/incoming sources —
|
|
660
|
+
* `breaking` / `foreign` entries leave it undefined.
|
|
661
|
+
*/
|
|
662
|
+
promotion: UpgradeStagingPromotionSchema.optional()
|
|
663
|
+
});
|
|
664
|
+
var UpgradeStagingManifestSchema = z7.object({
|
|
665
|
+
schemaVersion: z7.literal(1),
|
|
666
|
+
/** ISO-8601 timestamp the staging dir was created (matches dir suffix). */
|
|
667
|
+
ts: z7.string().min(1),
|
|
668
|
+
/** Which package category this staging covers. */
|
|
669
|
+
package: UpgradeStagingCategorySchema,
|
|
670
|
+
/** Which command produced this staging. */
|
|
671
|
+
trigger: UpgradeStagingTriggerSchema,
|
|
672
|
+
/** Variant applicable to the staging (always `_flat` for ui; concrete variant for biz-ui). */
|
|
673
|
+
variant: z7.string().min(1),
|
|
674
|
+
/** Installed package version (from `.teamix-evo/manifest.json`); empty string when foreign-only. */
|
|
675
|
+
fromVersion: z7.string(),
|
|
676
|
+
/** Upstream package version. */
|
|
677
|
+
toVersion: z7.string().min(1),
|
|
678
|
+
/** Project-wide lineage classification. */
|
|
679
|
+
lineage: ComponentLineageSchema,
|
|
680
|
+
/** Aggregate counts grouped by riskLevel for quick AI summarization. */
|
|
681
|
+
summary: z7.object({
|
|
682
|
+
total: z7.number().int().nonnegative(),
|
|
683
|
+
byRisk: z7.record(UpgradeRiskLevelSchema, z7.number().int().nonnegative())
|
|
684
|
+
}),
|
|
685
|
+
entries: z7.array(UpgradeStagingEntrySchema)
|
|
686
|
+
});
|
|
687
|
+
|
|
462
688
|
// src/loader.ts
|
|
463
689
|
import * as fs from "fs/promises";
|
|
464
690
|
import * as path from "path";
|
|
@@ -883,9 +1109,48 @@ function hasManagedRegion(content, id) {
|
|
|
883
1109
|
);
|
|
884
1110
|
return pattern.test(content);
|
|
885
1111
|
}
|
|
1112
|
+
function splitManagedRegions(content) {
|
|
1113
|
+
parseManagedRegions(content);
|
|
1114
|
+
const regionRe = new RegExp(REGION_PATTERN.source, "g");
|
|
1115
|
+
const segments = [];
|
|
1116
|
+
let cursor = 0;
|
|
1117
|
+
let match;
|
|
1118
|
+
while ((match = regionRe.exec(content)) !== null) {
|
|
1119
|
+
const id = match[1];
|
|
1120
|
+
const regionContent = match[2];
|
|
1121
|
+
const start = match.index;
|
|
1122
|
+
const end = start + match[0].length;
|
|
1123
|
+
segments.push({ kind: "unmanaged", content: content.slice(cursor, start) });
|
|
1124
|
+
segments.push({
|
|
1125
|
+
kind: "managed",
|
|
1126
|
+
region: {
|
|
1127
|
+
id,
|
|
1128
|
+
startMarker: `<!-- teamix-evo:managed:start id="${id}" -->`,
|
|
1129
|
+
endMarker: `<!-- teamix-evo:managed:end id="${id}" -->`,
|
|
1130
|
+
content: regionContent
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
cursor = end;
|
|
1134
|
+
}
|
|
1135
|
+
segments.push({ kind: "unmanaged", content: content.slice(cursor) });
|
|
1136
|
+
return segments;
|
|
1137
|
+
}
|
|
886
1138
|
function escapeRegExp(str) {
|
|
887
1139
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
888
1140
|
}
|
|
1141
|
+
var FRONTMATTER_PATTERN = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/;
|
|
1142
|
+
function extractFrontmatter(content) {
|
|
1143
|
+
const m = content.match(FRONTMATTER_PATTERN);
|
|
1144
|
+
return m ? m[0] : null;
|
|
1145
|
+
}
|
|
1146
|
+
function replaceFrontmatter(content, newFrontmatter) {
|
|
1147
|
+
const m = content.match(FRONTMATTER_PATTERN);
|
|
1148
|
+
if (!m) {
|
|
1149
|
+
return newFrontmatter.endsWith("\n") ? newFrontmatter + content : `${newFrontmatter}
|
|
1150
|
+
${content}`;
|
|
1151
|
+
}
|
|
1152
|
+
return newFrontmatter + content.slice(m[0].length);
|
|
1153
|
+
}
|
|
889
1154
|
|
|
890
1155
|
// src/strategy.ts
|
|
891
1156
|
function shouldUpdate(strategy, resourceExists) {
|
|
@@ -922,11 +1187,18 @@ function getUpdateAction(strategy, options) {
|
|
|
922
1187
|
}
|
|
923
1188
|
}
|
|
924
1189
|
export {
|
|
1190
|
+
ComponentLineageSchema,
|
|
925
1191
|
InstalledManifestSchema,
|
|
926
1192
|
InstalledPackageSchema,
|
|
927
1193
|
InstalledResourceSchema,
|
|
1194
|
+
LastUpdateRecordSchema,
|
|
928
1195
|
PackageEntrySchema,
|
|
929
1196
|
ProjectConfigSchema,
|
|
1197
|
+
ProjectConfigV1Schema,
|
|
1198
|
+
ProjectConfigV2Schema,
|
|
1199
|
+
PromoteFeatureVectorSchema,
|
|
1200
|
+
PromoteFileTypeSchema,
|
|
1201
|
+
PromoteModeSchema,
|
|
930
1202
|
ResourceSchema,
|
|
931
1203
|
ResourceTypeSchema,
|
|
932
1204
|
SkillEntrySchema,
|
|
@@ -936,6 +1208,8 @@ export {
|
|
|
936
1208
|
SkillsLockSchema,
|
|
937
1209
|
SkillsPackageManifestSchema,
|
|
938
1210
|
TailwindVersionSchema,
|
|
1211
|
+
TokenRenameEntrySchema,
|
|
1212
|
+
TokenRenameRecordSchema,
|
|
939
1213
|
TokensPackLinkedSchema,
|
|
940
1214
|
TokensPackLockSchema,
|
|
941
1215
|
TokensPackageManifestSchema,
|
|
@@ -947,10 +1221,20 @@ export {
|
|
|
947
1221
|
UiEntryTypeSchema,
|
|
948
1222
|
UiPackageManifestSchema,
|
|
949
1223
|
UpdateStrategySchema,
|
|
1224
|
+
UpgradeRiskLevelSchema,
|
|
1225
|
+
UpgradeStagingCategorySchema,
|
|
1226
|
+
UpgradeStagingCurrentSchema,
|
|
1227
|
+
UpgradeStagingDiffSchema,
|
|
1228
|
+
UpgradeStagingEntrySchema,
|
|
1229
|
+
UpgradeStagingIncomingSchema,
|
|
1230
|
+
UpgradeStagingManifestSchema,
|
|
1231
|
+
UpgradeStagingPromotionSchema,
|
|
1232
|
+
UpgradeStagingTriggerSchema,
|
|
950
1233
|
VariantManifestSchema,
|
|
951
1234
|
VariantUiPackageCatalogSchema,
|
|
952
1235
|
VariantUiPackageManifestSchema,
|
|
953
1236
|
VariantUiPackageNameSchema,
|
|
1237
|
+
extractFrontmatter,
|
|
954
1238
|
getUpdateAction,
|
|
955
1239
|
getVariantEntry,
|
|
956
1240
|
hasManagedRegion,
|
|
@@ -961,9 +1245,11 @@ export {
|
|
|
961
1245
|
loadVariantUiPackageCatalog,
|
|
962
1246
|
loadVariantUiPackageManifest,
|
|
963
1247
|
parseManagedRegions,
|
|
1248
|
+
replaceFrontmatter,
|
|
964
1249
|
replaceManagedRegion,
|
|
965
1250
|
resolveUiEntryOrder,
|
|
966
1251
|
shouldUpdate,
|
|
1252
|
+
splitManagedRegions,
|
|
967
1253
|
validateConfig,
|
|
968
1254
|
validateInstalled,
|
|
969
1255
|
validateManifest,
|