@teamix-evo/registry 0.3.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 CHANGED
@@ -30,10 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- DesignPackLinkedSchema: () => DesignPackLinkedSchema,
34
- DesignPackLockSchema: () => DesignPackLockSchema,
35
- DesignPackManifestSchema: () => DesignPackManifestSchema,
36
- DesignPackageManifestSchema: () => DesignPackageManifestSchema,
37
33
  InstalledManifestSchema: () => InstalledManifestSchema,
38
34
  InstalledPackageSchema: () => InstalledPackageSchema,
39
35
  InstalledResourceSchema: () => InstalledResourceSchema,
@@ -48,6 +44,10 @@ __export(index_exports, {
48
44
  SkillsLockSchema: () => SkillsLockSchema,
49
45
  SkillsPackageManifestSchema: () => SkillsPackageManifestSchema,
50
46
  TailwindVersionSchema: () => TailwindVersionSchema,
47
+ TokensPackLinkedSchema: () => TokensPackLinkedSchema,
48
+ TokensPackLockSchema: () => TokensPackLockSchema,
49
+ TokensPackageManifestSchema: () => TokensPackageManifestSchema,
50
+ TokensVariantEntrySchema: () => TokensVariantEntrySchema,
51
51
  UiAliasSchema: () => UiAliasSchema,
52
52
  UiAliasesSchema: () => UiAliasesSchema,
53
53
  UiEntryFileSchema: () => UiEntryFileSchema,
@@ -60,15 +60,14 @@ __export(index_exports, {
60
60
  VariantUiPackageManifestSchema: () => VariantUiPackageManifestSchema,
61
61
  VariantUiPackageNameSchema: () => VariantUiPackageNameSchema,
62
62
  getUpdateAction: () => getUpdateAction,
63
+ getVariantEntry: () => getVariantEntry,
63
64
  hasManagedRegion: () => hasManagedRegion,
64
- loadDesignPack: () => loadDesignPack,
65
- loadDesignPackageManifest: () => loadDesignPackageManifest,
66
65
  loadSkillsPackageManifest: () => loadSkillsPackageManifest,
66
+ loadTokensPackageManifest: () => loadTokensPackageManifest,
67
67
  loadUiPackageManifest: () => loadUiPackageManifest,
68
68
  loadVariantManifest: () => loadVariantManifest,
69
69
  loadVariantUiPackageCatalog: () => loadVariantUiPackageCatalog,
70
70
  loadVariantUiPackageManifest: () => loadVariantUiPackageManifest,
71
- mergeDefaultAndVariant: () => mergeDefaultAndVariant,
72
71
  parseManagedRegions: () => parseManagedRegions,
73
72
  replaceManagedRegion: () => replaceManagedRegion,
74
73
  resolveUiEntryOrder: () => resolveUiEntryOrder,
@@ -79,8 +78,7 @@ __export(index_exports, {
79
78
  validateSkillsLock: () => validateSkillsLock,
80
79
  validateSkillsPackage: () => validateSkillsPackage,
81
80
  validateUiDependencyGraph: () => validateUiDependencyGraph,
82
- validateUiPackage: () => validateUiPackage,
83
- walkPackTree: () => walkPackTree
81
+ validateUiPackage: () => validateUiPackage
84
82
  });
85
83
  module.exports = __toCommonJS(index_exports);
86
84
 
@@ -175,8 +173,8 @@ var SkillEntrySchema = import_zod.z.object({
175
173
  * coding-conventions, baseline design-rules) leave it unset.
176
174
  *
177
175
  * When present, the CLI installs this skill ONLY if the consumer's
178
- * `.teamix-evo/design/pack.lock.json` records the same variant. MUST equal
179
- * the variant directory name in `@teamix-evo/design/variants/<name>/`.
176
+ * `.teamix-evo/tokens-lock.json` records the same variant. MUST equal
177
+ * the variant directory name in `@teamix-evo/tokens/variants/<name>/`.
180
178
  *
181
179
  * Mirrors `UiEntrySchema.variant` semantics in @teamix-evo/biz-ui &
182
180
  * @teamix-evo/templates per ADR 0014.
@@ -241,8 +239,8 @@ var UiEntrySchema = import_zod.z.object({
241
239
  files: import_zod.z.array(UiEntryFileSchema).min(1),
242
240
  /**
243
241
  * Optional path to an AI-readable meta document (frontmatter + Markdown).
244
- * When set, CLI install drops it at `.teamix-evo/design/components/<id>.meta.md`
245
- * for design's ai-rules to consume.
242
+ * Read directly from `@teamix-evo/ui` by MCP at runtime — no consumer-side
243
+ * copy is written (per ADR 0020 §3).
246
244
  */
247
245
  meta: import_zod.z.string().optional(),
248
246
  /** Other UI entries this one depends on (e.g. "button" depends on "cn") */
@@ -294,73 +292,81 @@ var UiPackageManifestSchema = import_zod.z.object({
294
292
  engines: import_zod.z.object({
295
293
  "teamix-evo": import_zod.z.string().min(1)
296
294
  }),
297
- /** Flat list of entries shipped by this package */
298
- entries: import_zod.z.array(UiEntrySchema)
295
+ /** Active list of entries shipped (and exposed) by this package. */
296
+ entries: import_zod.z.array(UiEntrySchema),
297
+ /**
298
+ * Archived entries that are kept in source for Storybook documentation only
299
+ * and are NOT exposed through the active distribution chain. Per ADR 0028:
300
+ * - `teamix-evo ui add <id>` rejects ids found here unless `--include-deprecated` is passed
301
+ * - MCP `list_components` / `find_components` exclude these by default
302
+ * - Storybook keeps the story under `废弃 · Deprecated/` with a banner
303
+ * Optional for backwards compatibility — older manifests without this field
304
+ * still validate.
305
+ */
306
+ deprecatedEntries: import_zod.z.array(UiEntrySchema).optional()
299
307
  });
300
308
 
301
- // src/schema/design-pack.ts
309
+ // src/schema/tokens-pack.ts
302
310
  var import_zod2 = require("zod");
303
311
  var VARIANT_NAME_RE = /^[a-z][a-z0-9-]*$/;
304
312
  var SEMVER_RE = /^\d+\.\d+\.\d+/;
305
- var DesignPackLinkedSchema = import_zod2.z.object({
313
+ var TokensPackLinkedSchema = import_zod2.z.object({
306
314
  "biz-ui": import_zod2.z.string().optional(),
307
315
  templates: import_zod2.z.string().optional()
308
316
  });
309
- var DesignPackManifestSchema = import_zod2.z.object({
310
- $schema: import_zod2.z.string().optional(),
311
- schemaVersion: import_zod2.z.literal(1),
312
- /**
313
- * Pack identifier.
314
- * - `"default"` for the built-in baseline (only valid name when `extends` is absent)
315
- * - lowercase kebab-case for variants (`opentrek`, `uni-manager`, `acme-erp`, `_template`)
316
- */
317
+ var TokensVariantEntrySchema = import_zod2.z.object({
318
+ /** Variant id — lowercase kebab-case. */
317
319
  name: import_zod2.z.string().min(1).regex(
318
320
  VARIANT_NAME_RE,
319
- 'Pack name must be lowercase letters/digits/hyphens (no leading hyphen). Special: "_template" allowed for the variant scaffold.'
320
- ).or(import_zod2.z.literal("_template")).or(import_zod2.z.literal("default")),
321
+ "Variant name must be lowercase letters/digits/hyphens (no leading hyphen)."
322
+ ),
321
323
  /** Human-readable display name (e.g. "OpenTrek" for variant id "opentrek"). */
322
324
  displayName: import_zod2.z.string().min(1),
323
- /** Semver. */
325
+ /** Variant version — semver. May trail the package version when only a subset of variants change. */
324
326
  version: import_zod2.z.string().regex(SEMVER_RE, "Invalid semver version"),
327
+ /** Optional one-liner description; surfaced in `tokens list-variants` output. */
328
+ description: import_zod2.z.string().optional(),
325
329
  /**
326
- * Parent pack name. Required for variants, must be omitted for `default`.
327
- * Currently only `"default"` is a valid parent.
330
+ * Files this variant advertises, paths relative to the tokens package root
331
+ * (e.g. `variants/opentrek/theme.css`). The validator walks these to
332
+ * confirm presence; the CLI consumes them at install time.
328
333
  */
329
- extends: import_zod2.z.string().optional(),
330
- /** Optional one-liner; useful for `design list-variants` output. */
331
- description: import_zod2.z.string().optional(),
332
- /** Soft cross-package links (biz-ui / templates with same variant name). */
333
- linked: DesignPackLinkedSchema.optional()
334
+ files: import_zod2.z.array(import_zod2.z.string().min(1)).min(1),
335
+ /** Soft cross-package links (biz-ui / templates with the same variant name). */
336
+ linked: TokensPackLinkedSchema.optional()
334
337
  });
335
- var DesignPackageManifestSchema = import_zod2.z.object({
338
+ var TokensPackageManifestSchema = import_zod2.z.object({
336
339
  $schema: import_zod2.z.string().optional(),
337
340
  schemaVersion: import_zod2.z.literal(1),
338
- /** Always `"design"` for this package. */
339
- package: import_zod2.z.literal("design"),
340
- /** Semver of the entire design package. */
341
+ /** Always `"tokens"` disambiguates from other teamix-evo package manifests. */
342
+ package: import_zod2.z.literal("tokens"),
343
+ /** Semver of the entire tokens package. */
341
344
  version: import_zod2.z.string().regex(SEMVER_RE, "Invalid semver version"),
342
345
  /** Engine compatibility. */
343
346
  engines: import_zod2.z.object({ "teamix-evo": import_zod2.z.string().min(1) }),
344
- /** The default baseline pack — always present. */
345
- default: DesignPackManifestSchema,
346
- /** All shipped variants (excluding `_template/`). */
347
- variants: import_zod2.z.array(DesignPackManifestSchema)
347
+ /** Optional package-level description. */
348
+ description: import_zod2.z.string().optional(),
349
+ /** All shipped variants (excluding scaffold dirs that begin with `_`). */
350
+ variants: import_zod2.z.array(TokensVariantEntrySchema),
351
+ /**
352
+ * Reserved for future shared assets that span variants (e.g. browser
353
+ * quirks resets co-shipped at the package root). Empty array today.
354
+ */
355
+ shared: import_zod2.z.array(import_zod2.z.string()).optional()
348
356
  });
349
- var DesignPackLockSchema = import_zod2.z.object({
357
+ var TokensPackLockSchema = import_zod2.z.object({
350
358
  $schema: import_zod2.z.string().optional(),
351
359
  schemaVersion: import_zod2.z.literal(1),
352
- default: import_zod2.z.object({
353
- version: import_zod2.z.string().regex(SEMVER_RE),
354
- from: import_zod2.z.string().min(1)
355
- // e.g. "@teamix-evo/design"
356
- }),
357
360
  variant: import_zod2.z.object({
358
361
  name: import_zod2.z.string().min(1),
359
362
  displayName: import_zod2.z.string().min(1),
360
363
  version: import_zod2.z.string().regex(SEMVER_RE),
361
364
  from: import_zod2.z.string().min(1)
365
+ // e.g. "@teamix-evo/tokens"
362
366
  }),
363
- linked: DesignPackLinkedSchema.optional(),
367
+ /** Tokens package version — useful when variant version trails the package. */
368
+ packageVersion: import_zod2.z.string().regex(SEMVER_RE),
369
+ linked: TokensPackLinkedSchema.optional(),
364
370
  installedAt: import_zod2.z.string().datetime()
365
371
  });
366
372
 
@@ -480,7 +486,7 @@ var InstalledResourceSchema = import_zod5.z.object({
480
486
  scope: SkillScopeSchema.optional()
481
487
  });
482
488
  var InstalledPackageSchema = import_zod5.z.object({
483
- /** Full package name (e.g. "@teamix-evo/design") */
489
+ /** Full package name (e.g. "@teamix-evo/tokens") */
484
490
  package: import_zod5.z.string().min(1),
485
491
  /** Variant identifier (use "_flat" for non-variant packages such as skills) */
486
492
  variant: import_zod5.z.string().min(1),
@@ -771,143 +777,43 @@ async function loadUiPackageManifest(packageDir) {
771
777
  return result.data;
772
778
  }
773
779
 
774
- // src/design-pack-loader.ts
780
+ // src/tokens-pack-loader.ts
775
781
  var fs2 = __toESM(require("fs/promises"), 1);
776
782
  var path2 = __toESM(require("path"), 1);
777
- var PACK_METADATA_FILES = /* @__PURE__ */ new Set(["pack.json"]);
778
- async function loadDesignPack(packDir) {
779
- const manifestPath = path2.join(packDir, "pack.json");
783
+ async function loadTokensPackageManifest(packageDir) {
784
+ const manifestPath = path2.join(packageDir, "manifest.json");
780
785
  let raw;
781
786
  try {
782
787
  raw = await fs2.readFile(manifestPath, "utf-8");
783
788
  } catch (err) {
784
789
  const code = err.code;
785
790
  if (code === "ENOENT") {
786
- throw new Error(`Design pack manifest not found: ${manifestPath}`);
791
+ throw new Error(`Tokens package manifest not found: ${manifestPath}`);
787
792
  }
788
793
  throw new Error(
789
- `Failed to read design pack manifest at ${manifestPath}: ${err.message}`
794
+ `Failed to read tokens package manifest at ${manifestPath}: ${err.message}`
790
795
  );
791
796
  }
792
797
  let parsed;
793
798
  try {
794
799
  parsed = JSON.parse(raw);
795
800
  } catch {
796
- throw new Error(`Invalid JSON in design pack manifest at ${manifestPath}`);
797
- }
798
- const result = DesignPackManifestSchema.safeParse(parsed);
799
- if (!result.success) {
800
- throw new Error(
801
- `Invalid design pack manifest:
802
- ${result.error.message}
803
- File: ${manifestPath}`
804
- );
805
- }
806
- if (result.data.name === "default" && result.data.extends !== void 0) {
807
- throw new Error(
808
- `Pack "default" must not have "extends" field: ${manifestPath}`
809
- );
810
- }
811
- if (result.data.name !== "default" && result.data.extends !== "default") {
812
- throw new Error(
813
- `Variant pack "${result.data.name}" must declare extends: "default" (got ${JSON.stringify(
814
- result.data.extends
815
- )}): ${manifestPath}`
816
- );
817
- }
818
- return result.data;
819
- }
820
- async function loadDesignPackageManifest(packageDir) {
821
- const manifestPath = path2.join(packageDir, "manifest.json");
822
- let raw;
823
- try {
824
- raw = await fs2.readFile(manifestPath, "utf-8");
825
- } catch (err) {
826
- const code = err.code;
827
- if (code === "ENOENT") {
828
- throw new Error(`Design package manifest not found: ${manifestPath}`);
829
- }
830
801
  throw new Error(
831
- `Failed to read design package manifest at ${manifestPath}: ${err.message}`
802
+ `Invalid JSON in tokens package manifest at ${manifestPath}`
832
803
  );
833
804
  }
834
- let parsed;
835
- try {
836
- parsed = JSON.parse(raw);
837
- } catch {
838
- throw new Error(`Invalid JSON in design package manifest at ${manifestPath}`);
839
- }
840
- const result = DesignPackageManifestSchema.safeParse(parsed);
805
+ const result = TokensPackageManifestSchema.safeParse(parsed);
841
806
  if (!result.success) {
842
807
  throw new Error(
843
- `Invalid design package manifest:
808
+ `Invalid tokens package manifest:
844
809
  ${result.error.message}
845
810
  File: ${manifestPath}`
846
811
  );
847
812
  }
848
813
  return result.data;
849
814
  }
850
- async function walkPackTree(packDir) {
851
- const out = [];
852
- async function recurse(absDir, relDir) {
853
- const entries = await fs2.readdir(absDir, { withFileTypes: true });
854
- for (const entry of entries) {
855
- const abs = path2.join(absDir, entry.name);
856
- const rel = relDir ? path2.posix.join(relDir, entry.name) : entry.name;
857
- if (entry.isDirectory()) {
858
- await recurse(abs, rel);
859
- } else if (entry.isFile()) {
860
- if (relDir === "" && PACK_METADATA_FILES.has(entry.name)) continue;
861
- out.push(rel);
862
- }
863
- }
864
- }
865
- try {
866
- await recurse(packDir, "");
867
- } catch (err) {
868
- const code = err.code;
869
- if (code === "ENOENT") {
870
- throw new Error(`Pack directory not found: ${packDir}`);
871
- }
872
- throw err;
873
- }
874
- return out.sort();
875
- }
876
- async function mergeDefaultAndVariant(defaultDir, variantDir) {
877
- const defaultFiles = new Set(await walkPackTree(defaultDir));
878
- const variantFiles = new Set(await walkPackTree(variantDir));
879
- const overrides = [];
880
- const variantAdds = [];
881
- const defaultPassThrough = [];
882
- const files = [];
883
- const allPaths = Array.from(/* @__PURE__ */ new Set([...defaultFiles, ...variantFiles])).sort();
884
- for (const rel of allPaths) {
885
- const inDefault = defaultFiles.has(rel);
886
- const inVariant = variantFiles.has(rel);
887
- if (inVariant && inDefault) {
888
- overrides.push(rel);
889
- files.push({
890
- relPath: rel,
891
- sourcePath: path2.join(variantDir, rel),
892
- origin: "variant"
893
- });
894
- } else if (inVariant) {
895
- variantAdds.push(rel);
896
- files.push({
897
- relPath: rel,
898
- sourcePath: path2.join(variantDir, rel),
899
- origin: "variant"
900
- });
901
- } else {
902
- defaultPassThrough.push(rel);
903
- files.push({
904
- relPath: rel,
905
- sourcePath: path2.join(defaultDir, rel),
906
- origin: "default"
907
- });
908
- }
909
- }
910
- return { files, overrides, variantAdds, defaultPassThrough };
815
+ function getVariantEntry(catalog, variantName) {
816
+ return catalog.variants.find((v) => v.name === variantName);
911
817
  }
912
818
 
913
819
  // src/variant-ui-pack-loader.ts
@@ -1087,10 +993,6 @@ function getUpdateAction(strategy, options) {
1087
993
  }
1088
994
  // Annotate the CommonJS export names for ESM import in node:
1089
995
  0 && (module.exports = {
1090
- DesignPackLinkedSchema,
1091
- DesignPackLockSchema,
1092
- DesignPackManifestSchema,
1093
- DesignPackageManifestSchema,
1094
996
  InstalledManifestSchema,
1095
997
  InstalledPackageSchema,
1096
998
  InstalledResourceSchema,
@@ -1105,6 +1007,10 @@ function getUpdateAction(strategy, options) {
1105
1007
  SkillsLockSchema,
1106
1008
  SkillsPackageManifestSchema,
1107
1009
  TailwindVersionSchema,
1010
+ TokensPackLinkedSchema,
1011
+ TokensPackLockSchema,
1012
+ TokensPackageManifestSchema,
1013
+ TokensVariantEntrySchema,
1108
1014
  UiAliasSchema,
1109
1015
  UiAliasesSchema,
1110
1016
  UiEntryFileSchema,
@@ -1117,15 +1023,14 @@ function getUpdateAction(strategy, options) {
1117
1023
  VariantUiPackageManifestSchema,
1118
1024
  VariantUiPackageNameSchema,
1119
1025
  getUpdateAction,
1026
+ getVariantEntry,
1120
1027
  hasManagedRegion,
1121
- loadDesignPack,
1122
- loadDesignPackageManifest,
1123
1028
  loadSkillsPackageManifest,
1029
+ loadTokensPackageManifest,
1124
1030
  loadUiPackageManifest,
1125
1031
  loadVariantManifest,
1126
1032
  loadVariantUiPackageCatalog,
1127
1033
  loadVariantUiPackageManifest,
1128
- mergeDefaultAndVariant,
1129
1034
  parseManagedRegions,
1130
1035
  replaceManagedRegion,
1131
1036
  resolveUiEntryOrder,
@@ -1136,7 +1041,6 @@ function getUpdateAction(strategy, options) {
1136
1041
  validateSkillsLock,
1137
1042
  validateSkillsPackage,
1138
1043
  validateUiDependencyGraph,
1139
- validateUiPackage,
1140
- walkPackTree
1044
+ validateUiPackage
1141
1045
  });
1142
1046
  //# sourceMappingURL=index.cjs.map