reskill 1.11.0 → 1.11.2
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/cli/index.js +418 -247
- package/dist/core/config-loader.d.ts +4 -0
- package/dist/core/config-loader.d.ts.map +1 -1
- package/dist/core/lock-manager.d.ts +1 -0
- package/dist/core/lock-manager.d.ts.map +1 -1
- package/dist/core/skill-manager.d.ts +48 -0
- package/dist/core/skill-manager.d.ts.map +1 -1
- package/dist/index.js +226 -38
- package/dist/types/index.d.ts +29 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -97,6 +97,10 @@ export declare class ConfigLoader {
|
|
|
97
97
|
* @param updates - Partial defaults to merge
|
|
98
98
|
*/
|
|
99
99
|
updateDefaults(updates: Partial<SkillsDefaults>): void;
|
|
100
|
+
/**
|
|
101
|
+
* Get all configured registries (custom + default).
|
|
102
|
+
*/
|
|
103
|
+
getRegistries(): Record<string, string>;
|
|
100
104
|
/**
|
|
101
105
|
* Get registry URL by name
|
|
102
106
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/core/config-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiCpE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGrD,CAAC;AAMF;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,MAAM,CAA2B;gBAE7B,WAAW,CAAC,EAAE,MAAM;IAShC;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,aAAa,IAAI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
|
-
{"version":3,"file":"lock-manager.d.ts","sourceRoot":"","sources":["../../src/core/lock-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQjE;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAA2B;gBAE/B,WAAW,CAAC,EAAE,MAAM;IAKhC;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACH,IAAI,IAAI,UAAU;IAsBlB;;OAEG;IACH,MAAM,IAAI,UAAU;IAKpB;;OAEG;IACH,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IASnC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAK1C;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;IAM3C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAU7B;;OAEG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"lock-manager.d.ts","sourceRoot":"","sources":["../../src/core/lock-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQjE;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAA2B;gBAE/B,WAAW,CAAC,EAAE,MAAM;IAKhC;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACH,IAAI,IAAI,UAAU;IAsBlB;;OAEG;IACH,MAAM,IAAI,UAAU;IAKpB;;OAEG;IACH,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IASnC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAK1C;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;IAM3C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAU7B;;OAEG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GACA,WAAW;IAmBd;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IAKrC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK1B;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAQtD;;OAEG;IACH,KAAK,IAAI,IAAI;IAQb;;OAEG;IACH,MAAM,IAAI,IAAI;CAOf;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -113,6 +113,32 @@ export declare class SkillManager {
|
|
|
113
113
|
* Update skill
|
|
114
114
|
*/
|
|
115
115
|
update(name?: string): Promise<InstalledSkill[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Resolve registry URL for a skill reference.
|
|
118
|
+
*
|
|
119
|
+
* Resolution order:
|
|
120
|
+
* 1. Explicit CLI override (options.registry)
|
|
121
|
+
* 2. Scoped skills → getRegistryUrl(scope)
|
|
122
|
+
* 3. Unscoped skills → lock file registry (O(1), no network)
|
|
123
|
+
* 4. Unscoped skills → probe skills.json registries (non-git-host, network)
|
|
124
|
+
* 5. Default → PUBLIC_REGISTRY
|
|
125
|
+
*/
|
|
126
|
+
private resolveRegistryUrl;
|
|
127
|
+
/**
|
|
128
|
+
* Check if a registry entry is a git host (github, gitlab, etc.)
|
|
129
|
+
* Git hosts are not skill registries and should be skipped during probe.
|
|
130
|
+
*/
|
|
131
|
+
private isGitHostRegistry;
|
|
132
|
+
/**
|
|
133
|
+
* Derive a registry name from a URL for storing in skills.json.registries.
|
|
134
|
+
* Returns null for git hosts (already in DEFAULT_REGISTRIES).
|
|
135
|
+
*/
|
|
136
|
+
private deriveRegistryName;
|
|
137
|
+
/**
|
|
138
|
+
* Install skill for update flow. Uses installToAgents so registry refs are
|
|
139
|
+
* routed correctly (Registry > HTTP > Git).
|
|
140
|
+
*/
|
|
141
|
+
private installForUpdate;
|
|
116
142
|
/**
|
|
117
143
|
* List installed skills
|
|
118
144
|
*
|
|
@@ -217,6 +243,28 @@ export declare class SkillManager {
|
|
|
217
243
|
* - local: downloads tarball via Registry API
|
|
218
244
|
*/
|
|
219
245
|
private installFromWebPublished;
|
|
246
|
+
/**
|
|
247
|
+
* Build a Git ref for web-published github/gitlab skills.
|
|
248
|
+
*
|
|
249
|
+
* When `skillPath` is provided (multi-skill repo), constructs a shorthand ref
|
|
250
|
+
* like `github:owner/repo/skills/my-skill` so that only the sub-directory is
|
|
251
|
+
* cached and installed.
|
|
252
|
+
*
|
|
253
|
+
* Fallback: if `parseGitUrl` fails (non-standard URL), appends `#shortName`
|
|
254
|
+
* as a skill-name selector. The `#` fragment is extracted by
|
|
255
|
+
* `GitResolver.parseRef()` as `parsed.skillName`, then matched against
|
|
256
|
+
* SKILL.md `name` fields via `resolveSourcePath` / `discoverSkillsInDir`.
|
|
257
|
+
* This differs from the subPath approach (directory-based) but works because
|
|
258
|
+
* skill names typically match their directory basenames.
|
|
259
|
+
*
|
|
260
|
+
* Returns the raw `sourceUrl` when no `skillPath` is available.
|
|
261
|
+
*/
|
|
262
|
+
private buildGitRefForWebPublished;
|
|
263
|
+
/**
|
|
264
|
+
* Check if a host matches the standard host for a given source type.
|
|
265
|
+
* Standard hosts: github.com for github, gitlab.com for gitlab.
|
|
266
|
+
*/
|
|
267
|
+
private isStandardHost;
|
|
220
268
|
/**
|
|
221
269
|
* Install a skill published via "local folder" mode.
|
|
222
270
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-manager.d.ts","sourceRoot":"","sources":["../../src/core/skill-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,
|
|
1
|
+
{"version":3,"file":"skill-manager.d.ts","sourceRoot":"","sources":["../../src/core/skill-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAmB3B,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,KAA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,CAAC,CAAC;SACxC,CAAC,CAAC;QACH,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAClD,CACJ;IAyHD;;OAEG;YACW,sBAAsB;IAgGpC;;OAEG;YACW,uBAAuB;IAgGrC;;;;;;;OAOG;YACW,2BAA2B;IA6KzC;;;;;;;;OAQG;YACW,uBAAuB;IA2ErC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,0BAA0B;IAyBlC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAQtB;;;;;OAKG;YACW,wBAAwB;IAwFtC;;;;;;;OAOG;IACG,sBAAsB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAWpD;;OAEG;IACH,qBAAqB,IAAI,WAAW;IAQpC;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG;QAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;IAenF;;OAEG;IACH,gBAAgB,IAAI,SAAS,EAAE;IAI/B;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC;CAyBtF;AAED,eAAe,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1987,6 +1987,15 @@ ${CURSOR_BRIDGE_MARKER}
|
|
|
1987
1987
|
// Registry Management
|
|
1988
1988
|
// ==========================================================================
|
|
1989
1989
|
/**
|
|
1990
|
+
* Get all configured registries (custom + default).
|
|
1991
|
+
*/ getRegistries() {
|
|
1992
|
+
const config = this.getConfigOrDefault();
|
|
1993
|
+
return {
|
|
1994
|
+
...DEFAULT_REGISTRIES,
|
|
1995
|
+
...config.registries
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1990
1999
|
* Get registry URL by name
|
|
1991
2000
|
*
|
|
1992
2001
|
* Resolution order:
|
|
@@ -2828,6 +2837,8 @@ ${CURSOR_BRIDGE_MARKER}
|
|
|
2828
2837
|
commit: options.commit,
|
|
2829
2838
|
installedAt: new Date().toISOString()
|
|
2830
2839
|
};
|
|
2840
|
+
// Only persist registry URL for registry-sourced skills
|
|
2841
|
+
if (options.registry) lockedSkill.registry = options.registry;
|
|
2831
2842
|
this.set(name, lockedSkill);
|
|
2832
2843
|
return lockedSkill;
|
|
2833
2844
|
}
|
|
@@ -2892,6 +2903,23 @@ ${CURSOR_BRIDGE_MARKER}
|
|
|
2892
2903
|
// Local development
|
|
2893
2904
|
'http://localhost:3000': '@kanyun-test'
|
|
2894
2905
|
};
|
|
2906
|
+
/**
|
|
2907
|
+
* Get the scope for a given registry URL
|
|
2908
|
+
*
|
|
2909
|
+
* @param registry - Registry URL
|
|
2910
|
+
* @returns Scope string (e.g., "@kanyun") or null if not found
|
|
2911
|
+
*
|
|
2912
|
+
* @example
|
|
2913
|
+
* getScopeForRegistry('https://rush-test.zhenguanyu.com') // '@kanyun'
|
|
2914
|
+
* getScopeForRegistry('https://unknown.com') // null
|
|
2915
|
+
*/ function getScopeForRegistry(registry) {
|
|
2916
|
+
if (!registry) return null;
|
|
2917
|
+
// Try exact match first
|
|
2918
|
+
if (REGISTRY_SCOPE_MAP[registry]) return REGISTRY_SCOPE_MAP[registry];
|
|
2919
|
+
// Try with/without trailing slash
|
|
2920
|
+
const normalized = registry.endsWith('/') ? registry.slice(0, -1) : `${registry}/`;
|
|
2921
|
+
return REGISTRY_SCOPE_MAP[normalized] || null;
|
|
2922
|
+
}
|
|
2895
2923
|
/**
|
|
2896
2924
|
* Get the registry URL for a given scope (reverse lookup)
|
|
2897
2925
|
*
|
|
@@ -3983,8 +4011,11 @@ class RegistryResolver {
|
|
|
3983
4011
|
*/ async installAll(options = {}) {
|
|
3984
4012
|
const skills = this.config.getSkills();
|
|
3985
4013
|
const installed = [];
|
|
4014
|
+
const targetAgents = await detectInstalledAgents();
|
|
3986
4015
|
for (const [name, ref] of Object.entries(skills))try {
|
|
3987
|
-
|
|
4016
|
+
// Use installToAgents (not install) to correctly route registry refs
|
|
4017
|
+
// resolveRegistryUrl inside handles lock file / registries probe fallback
|
|
4018
|
+
const { skill } = await this.installToAgents(ref, targetAgents, {
|
|
3988
4019
|
...options,
|
|
3989
4020
|
save: false
|
|
3990
4021
|
});
|
|
@@ -4030,6 +4061,7 @@ class RegistryResolver {
|
|
|
4030
4061
|
* Update skill
|
|
4031
4062
|
*/ async update(name) {
|
|
4032
4063
|
const updated = [];
|
|
4064
|
+
const targetAgents = await detectInstalledAgents();
|
|
4033
4065
|
if (name) {
|
|
4034
4066
|
// Update single skill
|
|
4035
4067
|
const ref = this.config.getSkillRef(name);
|
|
@@ -4037,9 +4069,10 @@ class RegistryResolver {
|
|
|
4037
4069
|
logger_logger.error(`Skill ${name} not found in skills.json`);
|
|
4038
4070
|
return [];
|
|
4039
4071
|
}
|
|
4040
|
-
// Check if update is needed (skip
|
|
4041
|
-
|
|
4042
|
-
logger_logger.info(`${name} is from
|
|
4072
|
+
// Check if update is needed (skip for HTTP and Registry - always re-download/reinstall)
|
|
4073
|
+
const isRegistry = this.isRegistrySource(ref);
|
|
4074
|
+
if (isRegistry) logger_logger.info(`${name} is from registry, re-installing...`);
|
|
4075
|
+
else if (this.isHttpSource(ref)) logger_logger.info(`${name} is from HTTP source, re-downloading...`);
|
|
4043
4076
|
else {
|
|
4044
4077
|
const resolved = await this.resolver.resolve(ref);
|
|
4045
4078
|
const remoteCommit = await this.cache.getRemoteCommit(resolved.repoUrl, resolved.ref);
|
|
@@ -4048,7 +4081,7 @@ class RegistryResolver {
|
|
|
4048
4081
|
return [];
|
|
4049
4082
|
}
|
|
4050
4083
|
}
|
|
4051
|
-
const skill = await this.
|
|
4084
|
+
const skill = await this.installForUpdate(ref, targetAgents, {
|
|
4052
4085
|
force: true,
|
|
4053
4086
|
save: false
|
|
4054
4087
|
});
|
|
@@ -4057,8 +4090,9 @@ class RegistryResolver {
|
|
|
4057
4090
|
// Update all
|
|
4058
4091
|
const skills = this.config.getSkills();
|
|
4059
4092
|
for (const [skillName, ref] of Object.entries(skills))try {
|
|
4060
|
-
// Check if update is needed (skip
|
|
4061
|
-
if (this.
|
|
4093
|
+
// Check if update is needed (skip for HTTP and Registry)
|
|
4094
|
+
if (this.isRegistrySource(ref)) logger_logger.info(`${skillName} is from registry, re-installing...`);
|
|
4095
|
+
else if (this.isHttpSource(ref)) logger_logger.info(`${skillName} is from HTTP source, re-downloading...`);
|
|
4062
4096
|
else {
|
|
4063
4097
|
const resolved = await this.resolver.resolve(ref);
|
|
4064
4098
|
const remoteCommit = await this.cache.getRemoteCommit(resolved.repoUrl, resolved.ref);
|
|
@@ -4067,7 +4101,7 @@ class RegistryResolver {
|
|
|
4067
4101
|
continue;
|
|
4068
4102
|
}
|
|
4069
4103
|
}
|
|
4070
|
-
const skill = await this.
|
|
4104
|
+
const skill = await this.installForUpdate(ref, targetAgents, {
|
|
4071
4105
|
force: true,
|
|
4072
4106
|
save: false
|
|
4073
4107
|
});
|
|
@@ -4079,6 +4113,70 @@ class RegistryResolver {
|
|
|
4079
4113
|
return updated;
|
|
4080
4114
|
}
|
|
4081
4115
|
/**
|
|
4116
|
+
* Resolve registry URL for a skill reference.
|
|
4117
|
+
*
|
|
4118
|
+
* Resolution order:
|
|
4119
|
+
* 1. Explicit CLI override (options.registry)
|
|
4120
|
+
* 2. Scoped skills → getRegistryUrl(scope)
|
|
4121
|
+
* 3. Unscoped skills → lock file registry (O(1), no network)
|
|
4122
|
+
* 4. Unscoped skills → probe skills.json registries (non-git-host, network)
|
|
4123
|
+
* 5. Default → PUBLIC_REGISTRY
|
|
4124
|
+
*/ async resolveRegistryUrl(ref, explicitRegistry) {
|
|
4125
|
+
if (explicitRegistry) return explicitRegistry;
|
|
4126
|
+
const parsed = parseSkillIdentifier(ref);
|
|
4127
|
+
if (parsed.scope) return getRegistryUrl(parsed.scope);
|
|
4128
|
+
// Fast path: lock file has registry URL
|
|
4129
|
+
const locked = this.lockManager.get(parsed.name);
|
|
4130
|
+
if (locked?.registry) return locked.registry;
|
|
4131
|
+
// Slow path: probe configured registries (skip git hosts)
|
|
4132
|
+
const registries = this.config.getRegistries();
|
|
4133
|
+
for (const [name, url] of Object.entries(registries))if (!this.isGitHostRegistry(name, url)) try {
|
|
4134
|
+
const client = new RegistryClient({
|
|
4135
|
+
registry: url
|
|
4136
|
+
});
|
|
4137
|
+
await client.getSkillInfo(parsed.fullName);
|
|
4138
|
+
return url; // Found it
|
|
4139
|
+
} catch {}
|
|
4140
|
+
return getRegistryUrl(null); // PUBLIC_REGISTRY
|
|
4141
|
+
}
|
|
4142
|
+
/**
|
|
4143
|
+
* Check if a registry entry is a git host (github, gitlab, etc.)
|
|
4144
|
+
* Git hosts are not skill registries and should be skipped during probe.
|
|
4145
|
+
*/ isGitHostRegistry(name, url) {
|
|
4146
|
+
const gitHostNames = new Set(Object.keys(DEFAULT_REGISTRIES));
|
|
4147
|
+
if (gitHostNames.has(name)) return true;
|
|
4148
|
+
const gitHostPatterns = [
|
|
4149
|
+
'github.com',
|
|
4150
|
+
'gitlab.com'
|
|
4151
|
+
];
|
|
4152
|
+
const normalizedUrl = url.toLowerCase();
|
|
4153
|
+
return gitHostPatterns.some((pattern)=>normalizedUrl.includes(pattern));
|
|
4154
|
+
}
|
|
4155
|
+
/**
|
|
4156
|
+
* Derive a registry name from a URL for storing in skills.json.registries.
|
|
4157
|
+
* Returns null for git hosts (already in DEFAULT_REGISTRIES).
|
|
4158
|
+
*/ deriveRegistryName(registryUrl) {
|
|
4159
|
+
// Skip git hosts
|
|
4160
|
+
if (this.isGitHostRegistry('', registryUrl)) return null;
|
|
4161
|
+
// Try known scope mapping first (e.g., kanyun registries)
|
|
4162
|
+
const scope = getScopeForRegistry(registryUrl);
|
|
4163
|
+
if (scope) return scope;
|
|
4164
|
+
// Use hostname as registry name
|
|
4165
|
+
try {
|
|
4166
|
+
const url = new URL(registryUrl);
|
|
4167
|
+
return url.hostname;
|
|
4168
|
+
} catch {
|
|
4169
|
+
return null;
|
|
4170
|
+
}
|
|
4171
|
+
}
|
|
4172
|
+
/**
|
|
4173
|
+
* Install skill for update flow. Uses installToAgents so registry refs are
|
|
4174
|
+
* routed correctly (Registry > HTTP > Git).
|
|
4175
|
+
*/ async installForUpdate(ref, targetAgents, options) {
|
|
4176
|
+
const { skill } = await this.installToAgents(ref, targetAgents, options);
|
|
4177
|
+
return skill;
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4082
4180
|
* List installed skills
|
|
4083
4181
|
*
|
|
4084
4182
|
* Checks both canonical (.agents/skills/) and legacy (.skills/) locations.
|
|
@@ -4345,7 +4443,7 @@ class RegistryResolver {
|
|
|
4345
4443
|
/**
|
|
4346
4444
|
* Install skill from Git to multiple agents
|
|
4347
4445
|
*/ async installToAgentsFromGit(ref, targetAgents, options = {}) {
|
|
4348
|
-
const { save = true, mode = 'symlink' } = options;
|
|
4446
|
+
const { save = true, mode = 'symlink', registryContext } = options;
|
|
4349
4447
|
// Parse reference
|
|
4350
4448
|
const resolved = await this.resolver.resolve(ref);
|
|
4351
4449
|
const { parsed, repoUrl } = resolved;
|
|
@@ -4363,7 +4461,8 @@ class RegistryResolver {
|
|
|
4363
4461
|
const sourcePath = this.resolveSourcePath(cachePath, parsed);
|
|
4364
4462
|
// Get the real skill name from SKILL.md in cache
|
|
4365
4463
|
const metadata = this.getSkillMetadataFromDir(sourcePath);
|
|
4366
|
-
|
|
4464
|
+
// Priority: registryContext name > SKILL.md name > fallback from Git URL
|
|
4465
|
+
const skillName = registryContext?.skillName ?? metadata?.name ?? fallbackName;
|
|
4367
4466
|
const semanticVersion = metadata?.version ?? gitRef;
|
|
4368
4467
|
logger_logger["package"](`Installing ${skillName}@${gitRef} to ${targetAgents.length} agent(s)...`);
|
|
4369
4468
|
// Create Installer with custom installDir from config
|
|
@@ -4378,19 +4477,22 @@ class RegistryResolver {
|
|
|
4378
4477
|
mode: mode
|
|
4379
4478
|
});
|
|
4380
4479
|
// Update lock file (project mode only)
|
|
4381
|
-
if (!this.isGlobal)
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4480
|
+
if (!this.isGlobal) {
|
|
4481
|
+
const lockSource = registryContext?.lockSource ?? `${parsed.registry}:${parsed.owner}/${parsed.repo}${parsed.subPath ? `/${parsed.subPath}` : ''}`;
|
|
4482
|
+
this.lockManager.lockSkill(skillName, {
|
|
4483
|
+
source: lockSource,
|
|
4484
|
+
version: semanticVersion,
|
|
4485
|
+
ref: gitRef,
|
|
4486
|
+
resolved: repoUrl,
|
|
4487
|
+
commit: cacheResult.commit,
|
|
4488
|
+
registry: registryContext?.registryUrl
|
|
4489
|
+
});
|
|
4490
|
+
}
|
|
4388
4491
|
// Update skills.json (project mode only)
|
|
4389
4492
|
if (!this.isGlobal && save) {
|
|
4390
4493
|
this.config.ensureExists();
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
this.config.addSkill(skillName, normalizedRef);
|
|
4494
|
+
const configRef = registryContext?.configRef ?? this.config.normalizeSkillRef(ref);
|
|
4495
|
+
this.config.addSkill(skillName, configRef);
|
|
4394
4496
|
}
|
|
4395
4497
|
// Count results
|
|
4396
4498
|
const successCount = Array.from(results.values()).filter((r)=>r.success).length;
|
|
@@ -4413,7 +4515,7 @@ class RegistryResolver {
|
|
|
4413
4515
|
/**
|
|
4414
4516
|
* Install skill from HTTP/OSS to multiple agents
|
|
4415
4517
|
*/ async installToAgentsFromHttp(ref, targetAgents, options = {}) {
|
|
4416
|
-
const { save = true, mode = 'symlink' } = options;
|
|
4518
|
+
const { save = true, mode = 'symlink', registryContext } = options;
|
|
4417
4519
|
// Parse HTTP reference
|
|
4418
4520
|
const resolved = await this.httpResolver.resolve(ref);
|
|
4419
4521
|
const { parsed, repoUrl, httpInfo } = resolved;
|
|
@@ -4430,7 +4532,8 @@ class RegistryResolver {
|
|
|
4430
4532
|
const sourcePath = this.cache.getCachePath(parsed, version);
|
|
4431
4533
|
// Get the real skill name from SKILL.md in cache
|
|
4432
4534
|
const metadata = this.getSkillMetadataFromDir(sourcePath);
|
|
4433
|
-
|
|
4535
|
+
// Priority: registryContext name > SKILL.md name > fallback from URL
|
|
4536
|
+
const skillName = registryContext?.skillName ?? metadata?.name ?? fallbackName;
|
|
4434
4537
|
const semanticVersion = metadata?.version ?? version;
|
|
4435
4538
|
logger_logger["package"](`Installing ${skillName}@${version} from ${httpInfo.host} to ${targetAgents.length} agent(s)...`);
|
|
4436
4539
|
// Create Installer with custom installDir from config
|
|
@@ -4445,17 +4548,22 @@ class RegistryResolver {
|
|
|
4445
4548
|
mode: mode
|
|
4446
4549
|
});
|
|
4447
4550
|
// Update lock file (project mode only)
|
|
4448
|
-
if (!this.isGlobal)
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4551
|
+
if (!this.isGlobal) {
|
|
4552
|
+
const lockSource = registryContext?.lockSource ?? `http:${httpInfo.host}/${skillName}`;
|
|
4553
|
+
this.lockManager.lockSkill(skillName, {
|
|
4554
|
+
source: lockSource,
|
|
4555
|
+
version: semanticVersion,
|
|
4556
|
+
ref: version,
|
|
4557
|
+
resolved: repoUrl,
|
|
4558
|
+
commit: cacheResult.commit,
|
|
4559
|
+
registry: registryContext?.registryUrl
|
|
4560
|
+
});
|
|
4561
|
+
}
|
|
4455
4562
|
// Update skills.json (project mode only)
|
|
4456
4563
|
if (!this.isGlobal && save) {
|
|
4457
4564
|
this.config.ensureExists();
|
|
4458
|
-
|
|
4565
|
+
const configRef = registryContext?.configRef ?? ref;
|
|
4566
|
+
this.config.addSkill(skillName, configRef);
|
|
4459
4567
|
}
|
|
4460
4568
|
// Count results
|
|
4461
4569
|
const successCount = Array.from(results.values()).filter((r)=>r.success).length;
|
|
@@ -4486,7 +4594,7 @@ class RegistryResolver {
|
|
|
4486
4594
|
const { force = false, save = true, mode = 'symlink' } = options;
|
|
4487
4595
|
// Parse skill identifier and resolve registry URL once (single source of truth)
|
|
4488
4596
|
const parsed = parseSkillIdentifier(ref);
|
|
4489
|
-
const registryUrl = options.registry
|
|
4597
|
+
const registryUrl = await this.resolveRegistryUrl(ref, options.registry);
|
|
4490
4598
|
const client = new RegistryClient({
|
|
4491
4599
|
registry: registryUrl
|
|
4492
4600
|
});
|
|
@@ -4573,13 +4681,22 @@ class RegistryResolver {
|
|
|
4573
4681
|
version,
|
|
4574
4682
|
ref: version,
|
|
4575
4683
|
resolved: resolvedRegistryUrl,
|
|
4576
|
-
commit: resolved.integrity
|
|
4684
|
+
commit: resolved.integrity,
|
|
4685
|
+
registry: resolvedRegistryUrl
|
|
4577
4686
|
});
|
|
4578
4687
|
// 8. Update skills.json (project mode only)
|
|
4579
4688
|
if (!this.isGlobal && save) {
|
|
4580
4689
|
this.config.ensureExists();
|
|
4581
4690
|
// Save with full name for registry skills
|
|
4582
4691
|
this.config.addSkill(shortName, ref);
|
|
4692
|
+
// Save custom registry to skills.json.registries (for reinstall without lock file)
|
|
4693
|
+
if (options.registry) {
|
|
4694
|
+
const registryName = this.deriveRegistryName(options.registry);
|
|
4695
|
+
if (registryName) {
|
|
4696
|
+
this.config.addRegistry(registryName, options.registry);
|
|
4697
|
+
this.config.save();
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4583
4700
|
}
|
|
4584
4701
|
// 9. Count results and log
|
|
4585
4702
|
const successCount = Array.from(results.values()).filter((r)=>r.success).length;
|
|
@@ -4619,16 +4736,41 @@ class RegistryResolver {
|
|
|
4619
4736
|
if (parsed.version && 'latest' !== parsed.version) throw new Error(`Version specifier not supported for web-published skills.\n'${parsed.fullName}' was published via web and does not support versioning.\nUse: reskill install ${parsed.fullName}`);
|
|
4620
4737
|
if (!source_url) throw new Error(`Missing source_url for web-published skill: ${parsed.fullName}`);
|
|
4621
4738
|
logger_logger["package"](`Installing ${parsed.fullName} from ${source_type} source...`);
|
|
4739
|
+
// Build registry context so downstream methods use the registry name
|
|
4740
|
+
// instead of deriving from the source URL (e.g., Git repo name)
|
|
4741
|
+
const shortName = getShortName(parsed.fullName);
|
|
4742
|
+
const registryUrl = await this.resolveRegistryUrl(parsed.fullName, options.registry);
|
|
4743
|
+
const registryContext = {
|
|
4744
|
+
skillName: shortName,
|
|
4745
|
+
configRef: parsed.fullName,
|
|
4746
|
+
lockSource: `registry:${parsed.fullName}`,
|
|
4747
|
+
registryUrl
|
|
4748
|
+
};
|
|
4749
|
+
const optionsWithContext = {
|
|
4750
|
+
...options,
|
|
4751
|
+
registryContext
|
|
4752
|
+
};
|
|
4753
|
+
// Save custom registry to skills.json.registries (for reinstall without lock file)
|
|
4754
|
+
if (!this.isGlobal && options.registry) {
|
|
4755
|
+
const registryName = this.deriveRegistryName(options.registry);
|
|
4756
|
+
if (registryName) {
|
|
4757
|
+
this.config.ensureExists();
|
|
4758
|
+
this.config.load();
|
|
4759
|
+
this.config.addRegistry(registryName, options.registry);
|
|
4760
|
+
this.config.save();
|
|
4761
|
+
}
|
|
4762
|
+
}
|
|
4622
4763
|
switch(source_type){
|
|
4623
4764
|
case 'github':
|
|
4624
4765
|
case 'gitlab':
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4766
|
+
{
|
|
4767
|
+
const gitRef = this.buildGitRefForWebPublished(source_type, source_url, skillInfo.skill_path, parsed);
|
|
4768
|
+
return this.installToAgentsFromGit(gitRef, targetAgents, optionsWithContext);
|
|
4769
|
+
}
|
|
4628
4770
|
case 'oss_url':
|
|
4629
4771
|
case 'custom_url':
|
|
4630
4772
|
// Direct download URL
|
|
4631
|
-
return this.installToAgentsFromHttp(source_url, targetAgents,
|
|
4773
|
+
return this.installToAgentsFromHttp(source_url, targetAgents, optionsWithContext);
|
|
4632
4774
|
case 'local':
|
|
4633
4775
|
// Download tarball via Registry API
|
|
4634
4776
|
return this.installFromRegistryLocal(parsed, targetAgents, options);
|
|
@@ -4637,13 +4779,50 @@ class RegistryResolver {
|
|
|
4637
4779
|
}
|
|
4638
4780
|
}
|
|
4639
4781
|
/**
|
|
4782
|
+
* Build a Git ref for web-published github/gitlab skills.
|
|
4783
|
+
*
|
|
4784
|
+
* When `skillPath` is provided (multi-skill repo), constructs a shorthand ref
|
|
4785
|
+
* like `github:owner/repo/skills/my-skill` so that only the sub-directory is
|
|
4786
|
+
* cached and installed.
|
|
4787
|
+
*
|
|
4788
|
+
* Fallback: if `parseGitUrl` fails (non-standard URL), appends `#shortName`
|
|
4789
|
+
* as a skill-name selector. The `#` fragment is extracted by
|
|
4790
|
+
* `GitResolver.parseRef()` as `parsed.skillName`, then matched against
|
|
4791
|
+
* SKILL.md `name` fields via `resolveSourcePath` / `discoverSkillsInDir`.
|
|
4792
|
+
* This differs from the subPath approach (directory-based) but works because
|
|
4793
|
+
* skill names typically match their directory basenames.
|
|
4794
|
+
*
|
|
4795
|
+
* Returns the raw `sourceUrl` when no `skillPath` is available.
|
|
4796
|
+
*/ buildGitRefForWebPublished(sourceType, sourceUrl, skillPath, parsed) {
|
|
4797
|
+
if (!skillPath) return sourceUrl;
|
|
4798
|
+
const urlParsed = parseGitUrl(sourceUrl);
|
|
4799
|
+
if (urlParsed) {
|
|
4800
|
+
const isSelfHosted = !this.isStandardHost(urlParsed.host, sourceType);
|
|
4801
|
+
const prefix = isSelfHosted ? urlParsed.host : sourceType;
|
|
4802
|
+
return `${prefix}:${urlParsed.owner}/${urlParsed.repo}/${skillPath}`;
|
|
4803
|
+
}
|
|
4804
|
+
const shortName = getShortName(parsed.fullName);
|
|
4805
|
+
if (shortName) return `${sourceUrl}#${shortName}`;
|
|
4806
|
+
return sourceUrl;
|
|
4807
|
+
}
|
|
4808
|
+
/**
|
|
4809
|
+
* Check if a host matches the standard host for a given source type.
|
|
4810
|
+
* Standard hosts: github.com for github, gitlab.com for gitlab.
|
|
4811
|
+
*/ isStandardHost(host, sourceType) {
|
|
4812
|
+
const standardHosts = {
|
|
4813
|
+
github: 'github.com',
|
|
4814
|
+
gitlab: 'gitlab.com'
|
|
4815
|
+
};
|
|
4816
|
+
return standardHosts[sourceType] === host;
|
|
4817
|
+
}
|
|
4818
|
+
/**
|
|
4640
4819
|
* Install a skill published via "local folder" mode.
|
|
4641
4820
|
*
|
|
4642
4821
|
* Downloads tarball via RegistryClient (handles 302 redirects to signed OSS URLs),
|
|
4643
4822
|
* then extracts and installs using the same flow as registry source_type.
|
|
4644
4823
|
*/ async installFromRegistryLocal(parsed, targetAgents, options = {}) {
|
|
4645
4824
|
const { save = true, mode = 'symlink' } = options;
|
|
4646
|
-
const registryUrl =
|
|
4825
|
+
const registryUrl = await this.resolveRegistryUrl(parsed.fullName, options.registry);
|
|
4647
4826
|
const shortName = getShortName(parsed.fullName);
|
|
4648
4827
|
const version = 'latest';
|
|
4649
4828
|
// Download tarball via RegistryClient (handles auth + 302 redirect to signed URL)
|
|
@@ -4679,12 +4858,21 @@ class RegistryResolver {
|
|
|
4679
4858
|
version: semanticVersion,
|
|
4680
4859
|
ref: version,
|
|
4681
4860
|
resolved: registryUrl,
|
|
4682
|
-
commit: ''
|
|
4861
|
+
commit: '',
|
|
4862
|
+
registry: registryUrl
|
|
4683
4863
|
});
|
|
4684
4864
|
// Update skills.json (project mode only)
|
|
4685
4865
|
if (!this.isGlobal && save) {
|
|
4686
4866
|
this.config.ensureExists();
|
|
4687
4867
|
this.config.addSkill(skillName, parsed.fullName);
|
|
4868
|
+
// Save custom registry to skills.json.registries (for reinstall without lock file)
|
|
4869
|
+
if (options.registry) {
|
|
4870
|
+
const registryName = this.deriveRegistryName(options.registry);
|
|
4871
|
+
if (registryName) {
|
|
4872
|
+
this.config.addRegistry(registryName, options.registry);
|
|
4873
|
+
this.config.save();
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
4688
4876
|
}
|
|
4689
4877
|
return {
|
|
4690
4878
|
skill: {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -84,12 +84,18 @@ export interface LockedSkill {
|
|
|
84
84
|
version: string;
|
|
85
85
|
/** Git reference (tag, branch, commit) used for installation */
|
|
86
86
|
ref: string;
|
|
87
|
-
/**
|
|
87
|
+
/** Actual download URL: Git repo URL, HTTP URL, or registry endpoint */
|
|
88
88
|
resolved: string;
|
|
89
89
|
/** Exact commit hash */
|
|
90
90
|
commit: string;
|
|
91
91
|
/** Installation time */
|
|
92
92
|
installedAt: string;
|
|
93
|
+
/**
|
|
94
|
+
* Registry URL for registry-sourced skills.
|
|
95
|
+
* Used as O(1) fast-path lookup during reinstall/update of unscoped skills
|
|
96
|
+
* (e.g., "find-skills") whose skills.json ref carries no registry info.
|
|
97
|
+
*/
|
|
98
|
+
registry?: string;
|
|
93
99
|
}
|
|
94
100
|
/**
|
|
95
101
|
* skills.lock complete schema
|
|
@@ -202,6 +208,24 @@ export interface InstalledSkill {
|
|
|
202
208
|
/** Agents that have this skill installed (symlink or copy) */
|
|
203
209
|
agents?: AgentType[];
|
|
204
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Registry context for web-published skills.
|
|
213
|
+
*
|
|
214
|
+
* When a skill is discovered via registry but installed from an external source
|
|
215
|
+
* (GitHub/GitLab/OSS), this context carries the registry metadata so the
|
|
216
|
+
* downstream install methods use the registry name instead of deriving from
|
|
217
|
+
* the source URL.
|
|
218
|
+
*/
|
|
219
|
+
export interface RegistryInstallContext {
|
|
220
|
+
/** Skill name to use (registry short name, e.g., "vercel-react-best-practices") */
|
|
221
|
+
skillName: string;
|
|
222
|
+
/** Ref to store in skills.json (registry identifier, e.g., "@kanyun/vercel-react-best-practices") */
|
|
223
|
+
configRef: string;
|
|
224
|
+
/** Source to store in skills.lock (e.g., "registry:@kanyun/vercel-react-best-practices") */
|
|
225
|
+
lockSource: string;
|
|
226
|
+
/** Registry URL for lock file (used as fallback during reinstall/update) */
|
|
227
|
+
registryUrl: string;
|
|
228
|
+
}
|
|
205
229
|
/**
|
|
206
230
|
* Installation options
|
|
207
231
|
*/
|
|
@@ -220,6 +244,8 @@ export interface InstallOptions {
|
|
|
220
244
|
yes?: boolean;
|
|
221
245
|
/** Registry URL override (for registry-based installs) */
|
|
222
246
|
registry?: string;
|
|
247
|
+
/** Registry context for web-published skills (carries registry name through Git/HTTP install) */
|
|
248
|
+
registryContext?: RegistryInstallContext;
|
|
223
249
|
}
|
|
224
250
|
/**
|
|
225
251
|
* Update options
|
|
@@ -256,6 +282,8 @@ export interface SkillInfo {
|
|
|
256
282
|
source_type?: SourceType;
|
|
257
283
|
/** Source URL (only present for web-published skills) */
|
|
258
284
|
source_url?: string;
|
|
285
|
+
/** Sub-path within the repository for multi-skill repos, e.g. "skills/accessibility" */
|
|
286
|
+
skill_path?: string;
|
|
259
287
|
/** Publisher ID */
|
|
260
288
|
publisher_id?: string;
|
|
261
289
|
/** Creation timestamp */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAMxE;;GAEG;AACH,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAEvC;;GAEG;AACH,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEvE;;GAEG;AACH,YAAY,EACV,WAAW,EACX,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAMjC;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IAC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