@skild/core 0.2.8 → 0.2.9
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.d.ts +5 -1
- package/dist/index.js +30 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -140,6 +140,10 @@ declare function initSkill(name: string, options?: InitOptions): string;
|
|
|
140
140
|
|
|
141
141
|
declare function fetchWithTimeout(input: RequestInfo | URL, init?: RequestInit, timeoutMs?: number): Promise<Response>;
|
|
142
142
|
|
|
143
|
+
declare function normalizeAlias(input: unknown): string | null;
|
|
144
|
+
declare function isValidAlias(input: string): boolean;
|
|
145
|
+
declare function assertValidAlias(input: string): void;
|
|
146
|
+
|
|
143
147
|
declare const DEFAULT_REGISTRY_URL = "https://registry.skild.sh";
|
|
144
148
|
interface RegistrySpecifier {
|
|
145
149
|
canonicalName: string;
|
|
@@ -211,4 +215,4 @@ declare function uninstallSkill(name: string, options?: InstallOptions & {
|
|
|
211
215
|
}): void;
|
|
212
216
|
declare function updateSkill(name?: string, options?: UpdateOptions): Promise<InstallRecord[]>;
|
|
213
217
|
|
|
214
|
-
export { DEFAULT_REGISTRY_URL, type DependencySourceType, type GlobalConfig, type InstallOptions, type InstallRecord, type InstallScope, type InstalledDependency, type ListOptions, type Lockfile, PLATFORMS, type Platform, type RegistryAuth, SkildError, type SkillFrontmatter, type SkillValidationIssue, type SkillValidationResult, type UpdateOptions, canonicalNameToInstallDirName, clearRegistryAuth, downloadAndExtractTarball, fetchWithTimeout, getSkillInfo, getSkillInstallDir, getSkillsDir, initSkill, installRegistrySkill, installSkill, listAllSkills, listSkills, loadOrCreateGlobalConfig, loadRegistryAuth, parseRegistrySpecifier, resolveRegistryAlias, resolveRegistryUrl, resolveRegistryVersion, saveRegistryAuth, searchRegistrySkills, splitCanonicalName, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
|
|
218
|
+
export { DEFAULT_REGISTRY_URL, type DependencySourceType, type GlobalConfig, type InstallOptions, type InstallRecord, type InstallScope, type InstalledDependency, type ListOptions, type Lockfile, PLATFORMS, type Platform, type RegistryAuth, SkildError, type SkillFrontmatter, type SkillValidationIssue, type SkillValidationResult, type UpdateOptions, assertValidAlias, canonicalNameToInstallDirName, clearRegistryAuth, downloadAndExtractTarball, fetchWithTimeout, getSkillInfo, getSkillInstallDir, getSkillsDir, initSkill, installRegistrySkill, installSkill, isValidAlias, listAllSkills, listSkills, loadOrCreateGlobalConfig, loadRegistryAuth, normalizeAlias, parseRegistrySpecifier, resolveRegistryAlias, resolveRegistryUrl, resolveRegistryVersion, saveRegistryAuth, searchRegistrySkills, splitCanonicalName, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
|
package/dist/index.js
CHANGED
|
@@ -262,6 +262,33 @@ async function fetchWithTimeout(input, init = {}, timeoutMs = 1e4) {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
// src/alias.ts
|
|
266
|
+
function normalizeAlias(input) {
|
|
267
|
+
if (typeof input !== "string") return null;
|
|
268
|
+
const v = input.trim();
|
|
269
|
+
return v ? v : null;
|
|
270
|
+
}
|
|
271
|
+
function isValidAlias(input) {
|
|
272
|
+
const alias = input.trim();
|
|
273
|
+
if (!alias) return false;
|
|
274
|
+
if (alias.length < 3 || alias.length > 64) return false;
|
|
275
|
+
if (alias.includes("--")) return false;
|
|
276
|
+
return /^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(alias);
|
|
277
|
+
}
|
|
278
|
+
function assertValidAlias(input) {
|
|
279
|
+
const alias = input.trim();
|
|
280
|
+
if (!alias) throw new SkildError("INVALID_SOURCE", "Missing alias.");
|
|
281
|
+
if (alias.length < 3 || alias.length > 64) {
|
|
282
|
+
throw new SkildError("INVALID_SOURCE", "Alias length must be between 3 and 64.");
|
|
283
|
+
}
|
|
284
|
+
if (alias.includes("--")) {
|
|
285
|
+
throw new SkildError("INVALID_SOURCE", "Invalid alias format: consecutive hyphens are not allowed.");
|
|
286
|
+
}
|
|
287
|
+
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(alias)) {
|
|
288
|
+
throw new SkildError("INVALID_SOURCE", "Invalid alias format. Use lowercase letters, numbers, and hyphens.");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
265
292
|
// src/registry.ts
|
|
266
293
|
import fs5 from "fs";
|
|
267
294
|
import path5 from "path";
|
|
@@ -1084,6 +1111,7 @@ export {
|
|
|
1084
1111
|
DEFAULT_REGISTRY_URL,
|
|
1085
1112
|
PLATFORMS,
|
|
1086
1113
|
SkildError,
|
|
1114
|
+
assertValidAlias,
|
|
1087
1115
|
canonicalNameToInstallDirName,
|
|
1088
1116
|
clearRegistryAuth,
|
|
1089
1117
|
downloadAndExtractTarball,
|
|
@@ -1094,10 +1122,12 @@ export {
|
|
|
1094
1122
|
initSkill,
|
|
1095
1123
|
installRegistrySkill,
|
|
1096
1124
|
installSkill,
|
|
1125
|
+
isValidAlias,
|
|
1097
1126
|
listAllSkills,
|
|
1098
1127
|
listSkills,
|
|
1099
1128
|
loadOrCreateGlobalConfig,
|
|
1100
1129
|
loadRegistryAuth,
|
|
1130
|
+
normalizeAlias,
|
|
1101
1131
|
parseRegistrySpecifier,
|
|
1102
1132
|
resolveRegistryAlias,
|
|
1103
1133
|
resolveRegistryUrl,
|