@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 +89 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +294 -267
- package/dist/index.d.ts +294 -267
- package/dist/index.js +82 -162
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -89,13 +89,27 @@ 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/
|
|
93
|
-
* the variant directory name in `@teamix-evo/
|
|
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.
|
|
97
97
|
*/
|
|
98
|
-
variant: z.string().optional()
|
|
98
|
+
variant: z.string().optional(),
|
|
99
|
+
/**
|
|
100
|
+
* Default install scope for this skill. Per ADR 0033.
|
|
101
|
+
*
|
|
102
|
+
* - `"global"` — entry skill (lifecycle / orchestrator). `skills add` in
|
|
103
|
+
* project scope SKIPS these unless explicitly named on the
|
|
104
|
+
* command line (then installs with a warning). Recommended
|
|
105
|
+
* to install once via `skills add <id> --scope global`.
|
|
106
|
+
* - `"project"` — variant content skill (default when omitted). Installed
|
|
107
|
+
* with the project that uses it.
|
|
108
|
+
*
|
|
109
|
+
* `undefined` is treated as `"project"` — old manifests without this field
|
|
110
|
+
* still validate.
|
|
111
|
+
*/
|
|
112
|
+
scope: SkillScopeSchema.optional()
|
|
99
113
|
});
|
|
100
114
|
var SkillsPackageManifestSchema = z.object({
|
|
101
115
|
$schema: z.string().optional(),
|
|
@@ -155,8 +169,8 @@ var UiEntrySchema = z.object({
|
|
|
155
169
|
files: z.array(UiEntryFileSchema).min(1),
|
|
156
170
|
/**
|
|
157
171
|
* Optional path to an AI-readable meta document (frontmatter + Markdown).
|
|
158
|
-
*
|
|
159
|
-
*
|
|
172
|
+
* Read directly from `@teamix-evo/ui` by MCP at runtime — no consumer-side
|
|
173
|
+
* copy is written (per ADR 0020 §3).
|
|
160
174
|
*/
|
|
161
175
|
meta: z.string().optional(),
|
|
162
176
|
/** Other UI entries this one depends on (e.g. "button" depends on "cn") */
|
|
@@ -208,73 +222,81 @@ var UiPackageManifestSchema = z.object({
|
|
|
208
222
|
engines: z.object({
|
|
209
223
|
"teamix-evo": z.string().min(1)
|
|
210
224
|
}),
|
|
211
|
-
/**
|
|
212
|
-
entries: z.array(UiEntrySchema)
|
|
225
|
+
/** Active list of entries shipped (and exposed) by this package. */
|
|
226
|
+
entries: z.array(UiEntrySchema),
|
|
227
|
+
/**
|
|
228
|
+
* Archived entries that are kept in source for Storybook documentation only
|
|
229
|
+
* and are NOT exposed through the active distribution chain. Per ADR 0028:
|
|
230
|
+
* - `teamix-evo ui add <id>` rejects ids found here unless `--include-deprecated` is passed
|
|
231
|
+
* - MCP `list_components` / `find_components` exclude these by default
|
|
232
|
+
* - Storybook keeps the story under `废弃 · Deprecated/` with a banner
|
|
233
|
+
* Optional for backwards compatibility — older manifests without this field
|
|
234
|
+
* still validate.
|
|
235
|
+
*/
|
|
236
|
+
deprecatedEntries: z.array(UiEntrySchema).optional()
|
|
213
237
|
});
|
|
214
238
|
|
|
215
|
-
// src/schema/
|
|
239
|
+
// src/schema/tokens-pack.ts
|
|
216
240
|
import { z as z2 } from "zod";
|
|
217
241
|
var VARIANT_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
218
242
|
var SEMVER_RE = /^\d+\.\d+\.\d+/;
|
|
219
|
-
var
|
|
243
|
+
var TokensPackLinkedSchema = z2.object({
|
|
220
244
|
"biz-ui": z2.string().optional(),
|
|
221
245
|
templates: z2.string().optional()
|
|
222
246
|
});
|
|
223
|
-
var
|
|
224
|
-
|
|
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
|
-
*/
|
|
247
|
+
var TokensVariantEntrySchema = z2.object({
|
|
248
|
+
/** Variant id — lowercase kebab-case. */
|
|
231
249
|
name: z2.string().min(1).regex(
|
|
232
250
|
VARIANT_NAME_RE,
|
|
233
|
-
|
|
234
|
-
)
|
|
251
|
+
"Variant name must be lowercase letters/digits/hyphens (no leading hyphen)."
|
|
252
|
+
),
|
|
235
253
|
/** Human-readable display name (e.g. "OpenTrek" for variant id "opentrek"). */
|
|
236
254
|
displayName: z2.string().min(1),
|
|
237
|
-
/**
|
|
255
|
+
/** Variant version — semver. May trail the package version when only a subset of variants change. */
|
|
238
256
|
version: z2.string().regex(SEMVER_RE, "Invalid semver version"),
|
|
257
|
+
/** Optional one-liner description; surfaced in `tokens list-variants` output. */
|
|
258
|
+
description: z2.string().optional(),
|
|
239
259
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
260
|
+
* Files this variant advertises, paths relative to the tokens package root
|
|
261
|
+
* (e.g. `variants/opentrek/theme.css`). The validator walks these to
|
|
262
|
+
* confirm presence; the CLI consumes them at install time.
|
|
242
263
|
*/
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
|
|
246
|
-
/** Soft cross-package links (biz-ui / templates with same variant name). */
|
|
247
|
-
linked: DesignPackLinkedSchema.optional()
|
|
264
|
+
files: z2.array(z2.string().min(1)).min(1),
|
|
265
|
+
/** Soft cross-package links (biz-ui / templates with the same variant name). */
|
|
266
|
+
linked: TokensPackLinkedSchema.optional()
|
|
248
267
|
});
|
|
249
|
-
var
|
|
268
|
+
var TokensPackageManifestSchema = z2.object({
|
|
250
269
|
$schema: z2.string().optional(),
|
|
251
270
|
schemaVersion: z2.literal(1),
|
|
252
|
-
/** Always `"
|
|
253
|
-
package: z2.literal("
|
|
254
|
-
/** Semver of the entire
|
|
271
|
+
/** Always `"tokens"` — disambiguates from other teamix-evo package manifests. */
|
|
272
|
+
package: z2.literal("tokens"),
|
|
273
|
+
/** Semver of the entire tokens package. */
|
|
255
274
|
version: z2.string().regex(SEMVER_RE, "Invalid semver version"),
|
|
256
275
|
/** Engine compatibility. */
|
|
257
276
|
engines: z2.object({ "teamix-evo": z2.string().min(1) }),
|
|
258
|
-
/**
|
|
259
|
-
|
|
260
|
-
/** All shipped variants (excluding `
|
|
261
|
-
variants: z2.array(
|
|
277
|
+
/** Optional package-level description. */
|
|
278
|
+
description: z2.string().optional(),
|
|
279
|
+
/** All shipped variants (excluding scaffold dirs that begin with `_`). */
|
|
280
|
+
variants: z2.array(TokensVariantEntrySchema),
|
|
281
|
+
/**
|
|
282
|
+
* Reserved for future shared assets that span variants (e.g. browser
|
|
283
|
+
* quirks resets co-shipped at the package root). Empty array today.
|
|
284
|
+
*/
|
|
285
|
+
shared: z2.array(z2.string()).optional()
|
|
262
286
|
});
|
|
263
|
-
var
|
|
287
|
+
var TokensPackLockSchema = z2.object({
|
|
264
288
|
$schema: z2.string().optional(),
|
|
265
289
|
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
290
|
variant: z2.object({
|
|
272
291
|
name: z2.string().min(1),
|
|
273
292
|
displayName: z2.string().min(1),
|
|
274
293
|
version: z2.string().regex(SEMVER_RE),
|
|
275
294
|
from: z2.string().min(1)
|
|
295
|
+
// e.g. "@teamix-evo/tokens"
|
|
276
296
|
}),
|
|
277
|
-
|
|
297
|
+
/** Tokens package version — useful when variant version trails the package. */
|
|
298
|
+
packageVersion: z2.string().regex(SEMVER_RE),
|
|
299
|
+
linked: TokensPackLinkedSchema.optional(),
|
|
278
300
|
installedAt: z2.string().datetime()
|
|
279
301
|
});
|
|
280
302
|
|
|
@@ -394,7 +416,7 @@ var InstalledResourceSchema = z5.object({
|
|
|
394
416
|
scope: SkillScopeSchema.optional()
|
|
395
417
|
});
|
|
396
418
|
var InstalledPackageSchema = z5.object({
|
|
397
|
-
/** Full package name (e.g. "@teamix-evo/
|
|
419
|
+
/** Full package name (e.g. "@teamix-evo/tokens") */
|
|
398
420
|
package: z5.string().min(1),
|
|
399
421
|
/** Variant identifier (use "_flat" for non-variant packages such as skills) */
|
|
400
422
|
variant: z5.string().min(1),
|
|
@@ -685,143 +707,43 @@ async function loadUiPackageManifest(packageDir) {
|
|
|
685
707
|
return result.data;
|
|
686
708
|
}
|
|
687
709
|
|
|
688
|
-
// src/
|
|
710
|
+
// src/tokens-pack-loader.ts
|
|
689
711
|
import * as fs2 from "fs/promises";
|
|
690
712
|
import * as path2 from "path";
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const manifestPath = path2.join(packDir, "pack.json");
|
|
713
|
+
async function loadTokensPackageManifest(packageDir) {
|
|
714
|
+
const manifestPath = path2.join(packageDir, "manifest.json");
|
|
694
715
|
let raw;
|
|
695
716
|
try {
|
|
696
717
|
raw = await fs2.readFile(manifestPath, "utf-8");
|
|
697
718
|
} catch (err) {
|
|
698
719
|
const code = err.code;
|
|
699
720
|
if (code === "ENOENT") {
|
|
700
|
-
throw new Error(`
|
|
721
|
+
throw new Error(`Tokens package manifest not found: ${manifestPath}`);
|
|
701
722
|
}
|
|
702
723
|
throw new Error(
|
|
703
|
-
`Failed to read
|
|
724
|
+
`Failed to read tokens package manifest at ${manifestPath}: ${err.message}`
|
|
704
725
|
);
|
|
705
726
|
}
|
|
706
727
|
let parsed;
|
|
707
728
|
try {
|
|
708
729
|
parsed = JSON.parse(raw);
|
|
709
730
|
} 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
731
|
throw new Error(
|
|
745
|
-
`
|
|
732
|
+
`Invalid JSON in tokens package manifest at ${manifestPath}`
|
|
746
733
|
);
|
|
747
734
|
}
|
|
748
|
-
|
|
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);
|
|
735
|
+
const result = TokensPackageManifestSchema.safeParse(parsed);
|
|
755
736
|
if (!result.success) {
|
|
756
737
|
throw new Error(
|
|
757
|
-
`Invalid
|
|
738
|
+
`Invalid tokens package manifest:
|
|
758
739
|
${result.error.message}
|
|
759
740
|
File: ${manifestPath}`
|
|
760
741
|
);
|
|
761
742
|
}
|
|
762
743
|
return result.data;
|
|
763
744
|
}
|
|
764
|
-
|
|
765
|
-
|
|
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 };
|
|
745
|
+
function getVariantEntry(catalog, variantName) {
|
|
746
|
+
return catalog.variants.find((v) => v.name === variantName);
|
|
825
747
|
}
|
|
826
748
|
|
|
827
749
|
// src/variant-ui-pack-loader.ts
|
|
@@ -1000,10 +922,6 @@ function getUpdateAction(strategy, options) {
|
|
|
1000
922
|
}
|
|
1001
923
|
}
|
|
1002
924
|
export {
|
|
1003
|
-
DesignPackLinkedSchema,
|
|
1004
|
-
DesignPackLockSchema,
|
|
1005
|
-
DesignPackManifestSchema,
|
|
1006
|
-
DesignPackageManifestSchema,
|
|
1007
925
|
InstalledManifestSchema,
|
|
1008
926
|
InstalledPackageSchema,
|
|
1009
927
|
InstalledResourceSchema,
|
|
@@ -1018,6 +936,10 @@ export {
|
|
|
1018
936
|
SkillsLockSchema,
|
|
1019
937
|
SkillsPackageManifestSchema,
|
|
1020
938
|
TailwindVersionSchema,
|
|
939
|
+
TokensPackLinkedSchema,
|
|
940
|
+
TokensPackLockSchema,
|
|
941
|
+
TokensPackageManifestSchema,
|
|
942
|
+
TokensVariantEntrySchema,
|
|
1021
943
|
UiAliasSchema,
|
|
1022
944
|
UiAliasesSchema,
|
|
1023
945
|
UiEntryFileSchema,
|
|
@@ -1030,15 +952,14 @@ export {
|
|
|
1030
952
|
VariantUiPackageManifestSchema,
|
|
1031
953
|
VariantUiPackageNameSchema,
|
|
1032
954
|
getUpdateAction,
|
|
955
|
+
getVariantEntry,
|
|
1033
956
|
hasManagedRegion,
|
|
1034
|
-
loadDesignPack,
|
|
1035
|
-
loadDesignPackageManifest,
|
|
1036
957
|
loadSkillsPackageManifest,
|
|
958
|
+
loadTokensPackageManifest,
|
|
1037
959
|
loadUiPackageManifest,
|
|
1038
960
|
loadVariantManifest,
|
|
1039
961
|
loadVariantUiPackageCatalog,
|
|
1040
962
|
loadVariantUiPackageManifest,
|
|
1041
|
-
mergeDefaultAndVariant,
|
|
1042
963
|
parseManagedRegions,
|
|
1043
964
|
replaceManagedRegion,
|
|
1044
965
|
resolveUiEntryOrder,
|
|
@@ -1049,7 +970,6 @@ export {
|
|
|
1049
970
|
validateSkillsLock,
|
|
1050
971
|
validateSkillsPackage,
|
|
1051
972
|
validateUiDependencyGraph,
|
|
1052
|
-
validateUiPackage
|
|
1053
|
-
walkPackTree
|
|
973
|
+
validateUiPackage
|
|
1054
974
|
};
|
|
1055
975
|
//# sourceMappingURL=index.js.map
|