@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.js CHANGED
@@ -89,8 +89,8 @@ var SkillEntrySchema = z.object({
89
89
  * coding-conventions, baseline design-rules) leave it unset.
90
90
  *
91
91
  * When present, the CLI installs this skill ONLY if the consumer's
92
- * `.teamix-evo/design/pack.lock.json` records the same variant. MUST equal
93
- * the variant directory name in `@teamix-evo/design/variants/<name>/`.
92
+ * `.teamix-evo/tokens-lock.json` records the same variant. MUST equal
93
+ * the variant directory name in `@teamix-evo/tokens/variants/<name>/`.
94
94
  *
95
95
  * Mirrors `UiEntrySchema.variant` semantics in @teamix-evo/biz-ui &
96
96
  * @teamix-evo/templates per ADR 0014.
@@ -155,8 +155,8 @@ var UiEntrySchema = z.object({
155
155
  files: z.array(UiEntryFileSchema).min(1),
156
156
  /**
157
157
  * Optional path to an AI-readable meta document (frontmatter + Markdown).
158
- * When set, CLI install drops it at `.teamix-evo/design/components/<id>.meta.md`
159
- * for design's ai-rules to consume.
158
+ * Read directly from `@teamix-evo/ui` by MCP at runtime — no consumer-side
159
+ * copy is written (per ADR 0020 §3).
160
160
  */
161
161
  meta: z.string().optional(),
162
162
  /** Other UI entries this one depends on (e.g. "button" depends on "cn") */
@@ -208,73 +208,81 @@ var UiPackageManifestSchema = z.object({
208
208
  engines: z.object({
209
209
  "teamix-evo": z.string().min(1)
210
210
  }),
211
- /** Flat list of entries shipped by this package */
212
- 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()
213
223
  });
214
224
 
215
- // src/schema/design-pack.ts
225
+ // src/schema/tokens-pack.ts
216
226
  import { z as z2 } from "zod";
217
227
  var VARIANT_NAME_RE = /^[a-z][a-z0-9-]*$/;
218
228
  var SEMVER_RE = /^\d+\.\d+\.\d+/;
219
- var DesignPackLinkedSchema = z2.object({
229
+ var TokensPackLinkedSchema = z2.object({
220
230
  "biz-ui": z2.string().optional(),
221
231
  templates: z2.string().optional()
222
232
  });
223
- var DesignPackManifestSchema = z2.object({
224
- $schema: z2.string().optional(),
225
- schemaVersion: z2.literal(1),
226
- /**
227
- * Pack identifier.
228
- * - `"default"` for the built-in baseline (only valid name when `extends` is absent)
229
- * - lowercase kebab-case for variants (`opentrek`, `uni-manager`, `acme-erp`, `_template`)
230
- */
233
+ var TokensVariantEntrySchema = z2.object({
234
+ /** Variant id — lowercase kebab-case. */
231
235
  name: z2.string().min(1).regex(
232
236
  VARIANT_NAME_RE,
233
- 'Pack name must be lowercase letters/digits/hyphens (no leading hyphen). Special: "_template" allowed for the variant scaffold.'
234
- ).or(z2.literal("_template")).or(z2.literal("default")),
237
+ "Variant name must be lowercase letters/digits/hyphens (no leading hyphen)."
238
+ ),
235
239
  /** Human-readable display name (e.g. "OpenTrek" for variant id "opentrek"). */
236
240
  displayName: z2.string().min(1),
237
- /** Semver. */
241
+ /** Variant version — semver. May trail the package version when only a subset of variants change. */
238
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(),
239
245
  /**
240
- * Parent pack name. Required for variants, must be omitted for `default`.
241
- * Currently only `"default"` is a valid parent.
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.
242
249
  */
243
- extends: z2.string().optional(),
244
- /** Optional one-liner; useful for `design list-variants` output. */
245
- description: z2.string().optional(),
246
- /** Soft cross-package links (biz-ui / templates with same variant name). */
247
- linked: DesignPackLinkedSchema.optional()
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()
248
253
  });
249
- var DesignPackageManifestSchema = z2.object({
254
+ var TokensPackageManifestSchema = z2.object({
250
255
  $schema: z2.string().optional(),
251
256
  schemaVersion: z2.literal(1),
252
- /** Always `"design"` for this package. */
253
- package: z2.literal("design"),
254
- /** Semver of the entire design package. */
257
+ /** Always `"tokens"` disambiguates from other teamix-evo package manifests. */
258
+ package: z2.literal("tokens"),
259
+ /** Semver of the entire tokens package. */
255
260
  version: z2.string().regex(SEMVER_RE, "Invalid semver version"),
256
261
  /** Engine compatibility. */
257
262
  engines: z2.object({ "teamix-evo": z2.string().min(1) }),
258
- /** The default baseline pack — always present. */
259
- default: DesignPackManifestSchema,
260
- /** All shipped variants (excluding `_template/`). */
261
- variants: z2.array(DesignPackManifestSchema)
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()
262
272
  });
263
- var DesignPackLockSchema = z2.object({
273
+ var TokensPackLockSchema = z2.object({
264
274
  $schema: z2.string().optional(),
265
275
  schemaVersion: z2.literal(1),
266
- default: z2.object({
267
- version: z2.string().regex(SEMVER_RE),
268
- from: z2.string().min(1)
269
- // e.g. "@teamix-evo/design"
270
- }),
271
276
  variant: z2.object({
272
277
  name: z2.string().min(1),
273
278
  displayName: z2.string().min(1),
274
279
  version: z2.string().regex(SEMVER_RE),
275
280
  from: z2.string().min(1)
281
+ // e.g. "@teamix-evo/tokens"
276
282
  }),
277
- linked: DesignPackLinkedSchema.optional(),
283
+ /** Tokens package version — useful when variant version trails the package. */
284
+ packageVersion: z2.string().regex(SEMVER_RE),
285
+ linked: TokensPackLinkedSchema.optional(),
278
286
  installedAt: z2.string().datetime()
279
287
  });
280
288
 
@@ -394,7 +402,7 @@ var InstalledResourceSchema = z5.object({
394
402
  scope: SkillScopeSchema.optional()
395
403
  });
396
404
  var InstalledPackageSchema = z5.object({
397
- /** Full package name (e.g. "@teamix-evo/design") */
405
+ /** Full package name (e.g. "@teamix-evo/tokens") */
398
406
  package: z5.string().min(1),
399
407
  /** Variant identifier (use "_flat" for non-variant packages such as skills) */
400
408
  variant: z5.string().min(1),
@@ -685,143 +693,43 @@ async function loadUiPackageManifest(packageDir) {
685
693
  return result.data;
686
694
  }
687
695
 
688
- // src/design-pack-loader.ts
696
+ // src/tokens-pack-loader.ts
689
697
  import * as fs2 from "fs/promises";
690
698
  import * as path2 from "path";
691
- var PACK_METADATA_FILES = /* @__PURE__ */ new Set(["pack.json"]);
692
- async function loadDesignPack(packDir) {
693
- const manifestPath = path2.join(packDir, "pack.json");
699
+ async function loadTokensPackageManifest(packageDir) {
700
+ const manifestPath = path2.join(packageDir, "manifest.json");
694
701
  let raw;
695
702
  try {
696
703
  raw = await fs2.readFile(manifestPath, "utf-8");
697
704
  } catch (err) {
698
705
  const code = err.code;
699
706
  if (code === "ENOENT") {
700
- throw new Error(`Design pack manifest not found: ${manifestPath}`);
707
+ throw new Error(`Tokens package manifest not found: ${manifestPath}`);
701
708
  }
702
709
  throw new Error(
703
- `Failed to read design pack manifest at ${manifestPath}: ${err.message}`
710
+ `Failed to read tokens package manifest at ${manifestPath}: ${err.message}`
704
711
  );
705
712
  }
706
713
  let parsed;
707
714
  try {
708
715
  parsed = JSON.parse(raw);
709
716
  } catch {
710
- throw new Error(`Invalid JSON in design pack manifest at ${manifestPath}`);
711
- }
712
- const result = DesignPackManifestSchema.safeParse(parsed);
713
- if (!result.success) {
714
- throw new Error(
715
- `Invalid design pack manifest:
716
- ${result.error.message}
717
- File: ${manifestPath}`
718
- );
719
- }
720
- if (result.data.name === "default" && result.data.extends !== void 0) {
721
- throw new Error(
722
- `Pack "default" must not have "extends" field: ${manifestPath}`
723
- );
724
- }
725
- if (result.data.name !== "default" && result.data.extends !== "default") {
726
- throw new Error(
727
- `Variant pack "${result.data.name}" must declare extends: "default" (got ${JSON.stringify(
728
- result.data.extends
729
- )}): ${manifestPath}`
730
- );
731
- }
732
- return result.data;
733
- }
734
- async function loadDesignPackageManifest(packageDir) {
735
- const manifestPath = path2.join(packageDir, "manifest.json");
736
- let raw;
737
- try {
738
- raw = await fs2.readFile(manifestPath, "utf-8");
739
- } catch (err) {
740
- const code = err.code;
741
- if (code === "ENOENT") {
742
- throw new Error(`Design package manifest not found: ${manifestPath}`);
743
- }
744
717
  throw new Error(
745
- `Failed to read design package manifest at ${manifestPath}: ${err.message}`
718
+ `Invalid JSON in tokens package manifest at ${manifestPath}`
746
719
  );
747
720
  }
748
- let parsed;
749
- try {
750
- parsed = JSON.parse(raw);
751
- } catch {
752
- throw new Error(`Invalid JSON in design package manifest at ${manifestPath}`);
753
- }
754
- const result = DesignPackageManifestSchema.safeParse(parsed);
721
+ const result = TokensPackageManifestSchema.safeParse(parsed);
755
722
  if (!result.success) {
756
723
  throw new Error(
757
- `Invalid design package manifest:
724
+ `Invalid tokens package manifest:
758
725
  ${result.error.message}
759
726
  File: ${manifestPath}`
760
727
  );
761
728
  }
762
729
  return result.data;
763
730
  }
764
- async function walkPackTree(packDir) {
765
- const out = [];
766
- async function recurse(absDir, relDir) {
767
- const entries = await fs2.readdir(absDir, { withFileTypes: true });
768
- for (const entry of entries) {
769
- const abs = path2.join(absDir, entry.name);
770
- const rel = relDir ? path2.posix.join(relDir, entry.name) : entry.name;
771
- if (entry.isDirectory()) {
772
- await recurse(abs, rel);
773
- } else if (entry.isFile()) {
774
- if (relDir === "" && PACK_METADATA_FILES.has(entry.name)) continue;
775
- out.push(rel);
776
- }
777
- }
778
- }
779
- try {
780
- await recurse(packDir, "");
781
- } catch (err) {
782
- const code = err.code;
783
- if (code === "ENOENT") {
784
- throw new Error(`Pack directory not found: ${packDir}`);
785
- }
786
- throw err;
787
- }
788
- return out.sort();
789
- }
790
- async function mergeDefaultAndVariant(defaultDir, variantDir) {
791
- const defaultFiles = new Set(await walkPackTree(defaultDir));
792
- const variantFiles = new Set(await walkPackTree(variantDir));
793
- const overrides = [];
794
- const variantAdds = [];
795
- const defaultPassThrough = [];
796
- const files = [];
797
- const allPaths = Array.from(/* @__PURE__ */ new Set([...defaultFiles, ...variantFiles])).sort();
798
- for (const rel of allPaths) {
799
- const inDefault = defaultFiles.has(rel);
800
- const inVariant = variantFiles.has(rel);
801
- if (inVariant && inDefault) {
802
- overrides.push(rel);
803
- files.push({
804
- relPath: rel,
805
- sourcePath: path2.join(variantDir, rel),
806
- origin: "variant"
807
- });
808
- } else if (inVariant) {
809
- variantAdds.push(rel);
810
- files.push({
811
- relPath: rel,
812
- sourcePath: path2.join(variantDir, rel),
813
- origin: "variant"
814
- });
815
- } else {
816
- defaultPassThrough.push(rel);
817
- files.push({
818
- relPath: rel,
819
- sourcePath: path2.join(defaultDir, rel),
820
- origin: "default"
821
- });
822
- }
823
- }
824
- return { files, overrides, variantAdds, defaultPassThrough };
731
+ function getVariantEntry(catalog, variantName) {
732
+ return catalog.variants.find((v) => v.name === variantName);
825
733
  }
826
734
 
827
735
  // src/variant-ui-pack-loader.ts
@@ -1000,10 +908,6 @@ function getUpdateAction(strategy, options) {
1000
908
  }
1001
909
  }
1002
910
  export {
1003
- DesignPackLinkedSchema,
1004
- DesignPackLockSchema,
1005
- DesignPackManifestSchema,
1006
- DesignPackageManifestSchema,
1007
911
  InstalledManifestSchema,
1008
912
  InstalledPackageSchema,
1009
913
  InstalledResourceSchema,
@@ -1018,6 +922,10 @@ export {
1018
922
  SkillsLockSchema,
1019
923
  SkillsPackageManifestSchema,
1020
924
  TailwindVersionSchema,
925
+ TokensPackLinkedSchema,
926
+ TokensPackLockSchema,
927
+ TokensPackageManifestSchema,
928
+ TokensVariantEntrySchema,
1021
929
  UiAliasSchema,
1022
930
  UiAliasesSchema,
1023
931
  UiEntryFileSchema,
@@ -1030,15 +938,14 @@ export {
1030
938
  VariantUiPackageManifestSchema,
1031
939
  VariantUiPackageNameSchema,
1032
940
  getUpdateAction,
941
+ getVariantEntry,
1033
942
  hasManagedRegion,
1034
- loadDesignPack,
1035
- loadDesignPackageManifest,
1036
943
  loadSkillsPackageManifest,
944
+ loadTokensPackageManifest,
1037
945
  loadUiPackageManifest,
1038
946
  loadVariantManifest,
1039
947
  loadVariantUiPackageCatalog,
1040
948
  loadVariantUiPackageManifest,
1041
- mergeDefaultAndVariant,
1042
949
  parseManagedRegions,
1043
950
  replaceManagedRegion,
1044
951
  resolveUiEntryOrder,
@@ -1049,7 +956,6 @@ export {
1049
956
  validateSkillsLock,
1050
957
  validateSkillsPackage,
1051
958
  validateUiDependencyGraph,
1052
- validateUiPackage,
1053
- walkPackTree
959
+ validateUiPackage
1054
960
  };
1055
961
  //# sourceMappingURL=index.js.map