@teamix-evo/registry 0.3.0 → 0.6.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,13 +173,27 @@ 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.
183
181
  */
184
- variant: import_zod.z.string().optional()
182
+ variant: import_zod.z.string().optional(),
183
+ /**
184
+ * Default install scope for this skill. Per ADR 0033.
185
+ *
186
+ * - `"global"` — entry skill (lifecycle / orchestrator). `skills add` in
187
+ * project scope SKIPS these unless explicitly named on the
188
+ * command line (then installs with a warning). Recommended
189
+ * to install once via `skills add <id> --scope global`.
190
+ * - `"project"` — variant content skill (default when omitted). Installed
191
+ * with the project that uses it.
192
+ *
193
+ * `undefined` is treated as `"project"` — old manifests without this field
194
+ * still validate.
195
+ */
196
+ scope: SkillScopeSchema.optional()
185
197
  });
186
198
  var SkillsPackageManifestSchema = import_zod.z.object({
187
199
  $schema: import_zod.z.string().optional(),
@@ -241,8 +253,8 @@ var UiEntrySchema = import_zod.z.object({
241
253
  files: import_zod.z.array(UiEntryFileSchema).min(1),
242
254
  /**
243
255
  * 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.
256
+ * Read directly from `@teamix-evo/ui` by MCP at runtime — no consumer-side
257
+ * copy is written (per ADR 0020 §3).
246
258
  */
247
259
  meta: import_zod.z.string().optional(),
248
260
  /** Other UI entries this one depends on (e.g. "button" depends on "cn") */
@@ -294,73 +306,81 @@ var UiPackageManifestSchema = import_zod.z.object({
294
306
  engines: import_zod.z.object({
295
307
  "teamix-evo": import_zod.z.string().min(1)
296
308
  }),
297
- /** Flat list of entries shipped by this package */
298
- entries: import_zod.z.array(UiEntrySchema)
309
+ /** Active list of entries shipped (and exposed) by this package. */
310
+ entries: import_zod.z.array(UiEntrySchema),
311
+ /**
312
+ * Archived entries that are kept in source for Storybook documentation only
313
+ * and are NOT exposed through the active distribution chain. Per ADR 0028:
314
+ * - `teamix-evo ui add <id>` rejects ids found here unless `--include-deprecated` is passed
315
+ * - MCP `list_components` / `find_components` exclude these by default
316
+ * - Storybook keeps the story under `废弃 · Deprecated/` with a banner
317
+ * Optional for backwards compatibility — older manifests without this field
318
+ * still validate.
319
+ */
320
+ deprecatedEntries: import_zod.z.array(UiEntrySchema).optional()
299
321
  });
300
322
 
301
- // src/schema/design-pack.ts
323
+ // src/schema/tokens-pack.ts
302
324
  var import_zod2 = require("zod");
303
325
  var VARIANT_NAME_RE = /^[a-z][a-z0-9-]*$/;
304
326
  var SEMVER_RE = /^\d+\.\d+\.\d+/;
305
- var DesignPackLinkedSchema = import_zod2.z.object({
327
+ var TokensPackLinkedSchema = import_zod2.z.object({
306
328
  "biz-ui": import_zod2.z.string().optional(),
307
329
  templates: import_zod2.z.string().optional()
308
330
  });
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
- */
331
+ var TokensVariantEntrySchema = import_zod2.z.object({
332
+ /** Variant id — lowercase kebab-case. */
317
333
  name: import_zod2.z.string().min(1).regex(
318
334
  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")),
335
+ "Variant name must be lowercase letters/digits/hyphens (no leading hyphen)."
336
+ ),
321
337
  /** Human-readable display name (e.g. "OpenTrek" for variant id "opentrek"). */
322
338
  displayName: import_zod2.z.string().min(1),
323
- /** Semver. */
339
+ /** Variant version — semver. May trail the package version when only a subset of variants change. */
324
340
  version: import_zod2.z.string().regex(SEMVER_RE, "Invalid semver version"),
341
+ /** Optional one-liner description; surfaced in `tokens list-variants` output. */
342
+ description: import_zod2.z.string().optional(),
325
343
  /**
326
- * Parent pack name. Required for variants, must be omitted for `default`.
327
- * Currently only `"default"` is a valid parent.
344
+ * Files this variant advertises, paths relative to the tokens package root
345
+ * (e.g. `variants/opentrek/theme.css`). The validator walks these to
346
+ * confirm presence; the CLI consumes them at install time.
328
347
  */
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()
348
+ files: import_zod2.z.array(import_zod2.z.string().min(1)).min(1),
349
+ /** Soft cross-package links (biz-ui / templates with the same variant name). */
350
+ linked: TokensPackLinkedSchema.optional()
334
351
  });
335
- var DesignPackageManifestSchema = import_zod2.z.object({
352
+ var TokensPackageManifestSchema = import_zod2.z.object({
336
353
  $schema: import_zod2.z.string().optional(),
337
354
  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. */
355
+ /** Always `"tokens"` disambiguates from other teamix-evo package manifests. */
356
+ package: import_zod2.z.literal("tokens"),
357
+ /** Semver of the entire tokens package. */
341
358
  version: import_zod2.z.string().regex(SEMVER_RE, "Invalid semver version"),
342
359
  /** Engine compatibility. */
343
360
  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)
361
+ /** Optional package-level description. */
362
+ description: import_zod2.z.string().optional(),
363
+ /** All shipped variants (excluding scaffold dirs that begin with `_`). */
364
+ variants: import_zod2.z.array(TokensVariantEntrySchema),
365
+ /**
366
+ * Reserved for future shared assets that span variants (e.g. browser
367
+ * quirks resets co-shipped at the package root). Empty array today.
368
+ */
369
+ shared: import_zod2.z.array(import_zod2.z.string()).optional()
348
370
  });
349
- var DesignPackLockSchema = import_zod2.z.object({
371
+ var TokensPackLockSchema = import_zod2.z.object({
350
372
  $schema: import_zod2.z.string().optional(),
351
373
  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
374
  variant: import_zod2.z.object({
358
375
  name: import_zod2.z.string().min(1),
359
376
  displayName: import_zod2.z.string().min(1),
360
377
  version: import_zod2.z.string().regex(SEMVER_RE),
361
378
  from: import_zod2.z.string().min(1)
379
+ // e.g. "@teamix-evo/tokens"
362
380
  }),
363
- linked: DesignPackLinkedSchema.optional(),
381
+ /** Tokens package version — useful when variant version trails the package. */
382
+ packageVersion: import_zod2.z.string().regex(SEMVER_RE),
383
+ linked: TokensPackLinkedSchema.optional(),
364
384
  installedAt: import_zod2.z.string().datetime()
365
385
  });
366
386
 
@@ -480,7 +500,7 @@ var InstalledResourceSchema = import_zod5.z.object({
480
500
  scope: SkillScopeSchema.optional()
481
501
  });
482
502
  var InstalledPackageSchema = import_zod5.z.object({
483
- /** Full package name (e.g. "@teamix-evo/design") */
503
+ /** Full package name (e.g. "@teamix-evo/tokens") */
484
504
  package: import_zod5.z.string().min(1),
485
505
  /** Variant identifier (use "_flat" for non-variant packages such as skills) */
486
506
  variant: import_zod5.z.string().min(1),
@@ -771,143 +791,43 @@ async function loadUiPackageManifest(packageDir) {
771
791
  return result.data;
772
792
  }
773
793
 
774
- // src/design-pack-loader.ts
794
+ // src/tokens-pack-loader.ts
775
795
  var fs2 = __toESM(require("fs/promises"), 1);
776
796
  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");
797
+ async function loadTokensPackageManifest(packageDir) {
798
+ const manifestPath = path2.join(packageDir, "manifest.json");
780
799
  let raw;
781
800
  try {
782
801
  raw = await fs2.readFile(manifestPath, "utf-8");
783
802
  } catch (err) {
784
803
  const code = err.code;
785
804
  if (code === "ENOENT") {
786
- throw new Error(`Design pack manifest not found: ${manifestPath}`);
805
+ throw new Error(`Tokens package manifest not found: ${manifestPath}`);
787
806
  }
788
807
  throw new Error(
789
- `Failed to read design pack manifest at ${manifestPath}: ${err.message}`
808
+ `Failed to read tokens package manifest at ${manifestPath}: ${err.message}`
790
809
  );
791
810
  }
792
811
  let parsed;
793
812
  try {
794
813
  parsed = JSON.parse(raw);
795
814
  } 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
815
  throw new Error(
831
- `Failed to read design package manifest at ${manifestPath}: ${err.message}`
816
+ `Invalid JSON in tokens package manifest at ${manifestPath}`
832
817
  );
833
818
  }
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);
819
+ const result = TokensPackageManifestSchema.safeParse(parsed);
841
820
  if (!result.success) {
842
821
  throw new Error(
843
- `Invalid design package manifest:
822
+ `Invalid tokens package manifest:
844
823
  ${result.error.message}
845
824
  File: ${manifestPath}`
846
825
  );
847
826
  }
848
827
  return result.data;
849
828
  }
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 };
829
+ function getVariantEntry(catalog, variantName) {
830
+ return catalog.variants.find((v) => v.name === variantName);
911
831
  }
912
832
 
913
833
  // src/variant-ui-pack-loader.ts
@@ -1087,10 +1007,6 @@ function getUpdateAction(strategy, options) {
1087
1007
  }
1088
1008
  // Annotate the CommonJS export names for ESM import in node:
1089
1009
  0 && (module.exports = {
1090
- DesignPackLinkedSchema,
1091
- DesignPackLockSchema,
1092
- DesignPackManifestSchema,
1093
- DesignPackageManifestSchema,
1094
1010
  InstalledManifestSchema,
1095
1011
  InstalledPackageSchema,
1096
1012
  InstalledResourceSchema,
@@ -1105,6 +1021,10 @@ function getUpdateAction(strategy, options) {
1105
1021
  SkillsLockSchema,
1106
1022
  SkillsPackageManifestSchema,
1107
1023
  TailwindVersionSchema,
1024
+ TokensPackLinkedSchema,
1025
+ TokensPackLockSchema,
1026
+ TokensPackageManifestSchema,
1027
+ TokensVariantEntrySchema,
1108
1028
  UiAliasSchema,
1109
1029
  UiAliasesSchema,
1110
1030
  UiEntryFileSchema,
@@ -1117,15 +1037,14 @@ function getUpdateAction(strategy, options) {
1117
1037
  VariantUiPackageManifestSchema,
1118
1038
  VariantUiPackageNameSchema,
1119
1039
  getUpdateAction,
1040
+ getVariantEntry,
1120
1041
  hasManagedRegion,
1121
- loadDesignPack,
1122
- loadDesignPackageManifest,
1123
1042
  loadSkillsPackageManifest,
1043
+ loadTokensPackageManifest,
1124
1044
  loadUiPackageManifest,
1125
1045
  loadVariantManifest,
1126
1046
  loadVariantUiPackageCatalog,
1127
1047
  loadVariantUiPackageManifest,
1128
- mergeDefaultAndVariant,
1129
1048
  parseManagedRegions,
1130
1049
  replaceManagedRegion,
1131
1050
  resolveUiEntryOrder,
@@ -1136,7 +1055,6 @@ function getUpdateAction(strategy, options) {
1136
1055
  validateSkillsLock,
1137
1056
  validateSkillsPackage,
1138
1057
  validateUiDependencyGraph,
1139
- validateUiPackage,
1140
- walkPackTree
1058
+ validateUiPackage
1141
1059
  });
1142
1060
  //# sourceMappingURL=index.cjs.map