reskill 1.13.0 → 1.14.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/README.md +5 -2
- package/README.zh-CN.md +5 -2
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/index.js +121 -3
- package/dist/core/skill-manager.d.ts +17 -0
- package/dist/core/skill-manager.d.ts.map +1 -1
- package/dist/index.js +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ npx reskill@latest install github:user/skill1 github:user/skill2@v1.0.0
|
|
|
117
117
|
|
|
118
118
|
### Monorepo Support
|
|
119
119
|
|
|
120
|
-
For repositories containing multiple skills (monorepo),
|
|
120
|
+
For repositories containing multiple skills (monorepo), you can install a specific skill by path or install all skills from a parent directory:
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
123
|
# Shorthand format with subpath
|
|
@@ -130,9 +130,12 @@ npx reskill@latest install git@gitlab.company.com:team/skills.git/backend/apis@v
|
|
|
130
130
|
|
|
131
131
|
# GitHub web URL automatically extracts subpath
|
|
132
132
|
npx reskill@latest install https://github.com/org/monorepo/tree/main/skills/planning
|
|
133
|
+
|
|
134
|
+
# Point to a parent directory — auto-detects and installs all child skills
|
|
135
|
+
npx reskill@latest install https://github.com/org/monorepo/tree/main/skills
|
|
133
136
|
```
|
|
134
137
|
|
|
135
|
-
|
|
138
|
+
When the target directory has no root `SKILL.md` but contains subdirectories with `SKILL.md` files, reskill automatically discovers and installs all child skills. Each skill is saved separately in `skills.json`.
|
|
136
139
|
|
|
137
140
|
### HTTP/OSS URL Support
|
|
138
141
|
|
package/README.zh-CN.md
CHANGED
|
@@ -117,7 +117,7 @@ npx reskill@latest install github:user/skill1 github:user/skill2@v1.0.0
|
|
|
117
117
|
|
|
118
118
|
### Monorepo 支持
|
|
119
119
|
|
|
120
|
-
对于包含多个技能的仓库(monorepo
|
|
120
|
+
对于包含多个技能的仓库(monorepo),可以指定技能目录的路径安装单个技能,也可以指向父目录一键安装所有技能:
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
123
|
# 简写格式带子路径
|
|
@@ -130,9 +130,12 @@ npx reskill@latest install git@gitlab.company.com:team/skills.git/backend/apis@v
|
|
|
130
130
|
|
|
131
131
|
# GitHub 网页 URL 自动提取子路径
|
|
132
132
|
npx reskill@latest install https://github.com/org/monorepo/tree/main/skills/planning
|
|
133
|
+
|
|
134
|
+
# 指向父目录 — 自动发现并安装所有子技能
|
|
135
|
+
npx reskill@latest install https://github.com/org/monorepo/tree/main/skills
|
|
133
136
|
```
|
|
134
137
|
|
|
135
|
-
|
|
138
|
+
当目标目录没有根 `SKILL.md` 但包含带有 `SKILL.md` 的子目录时,reskill 会自动发现并安装所有子技能。每个技能会分别保存到 `skills.json` 中。
|
|
136
139
|
|
|
137
140
|
### HTTP/OSS URL 支持
|
|
138
141
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/install.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/install.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAs5BpC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,SA8GvB,CAAC;AAEL,eAAe,cAAc,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -4338,6 +4338,54 @@ class RegistryResolver {
|
|
|
4338
4338
|
// Multi-Agent installation methods
|
|
4339
4339
|
// ============================================================================
|
|
4340
4340
|
/**
|
|
4341
|
+
* Detect whether a ref points to a single skill or a multi-skill directory.
|
|
4342
|
+
*
|
|
4343
|
+
* Returns `{ type: 'single' }` when the cached root contains a SKILL.md (or
|
|
4344
|
+
* when the source is registry/HTTP — those are always single-skill).
|
|
4345
|
+
* Returns `{ type: 'multi', skills }` when the root has **no** SKILL.md but
|
|
4346
|
+
* `discoverSkillsInDir()` finds child skills underneath.
|
|
4347
|
+
*
|
|
4348
|
+
* The method caches the repo as a side-effect so that the subsequent
|
|
4349
|
+
* `installToAgents` / `installSkillsFromRepo` call hits the cache.
|
|
4350
|
+
*/ async detectSkillsInRef(ref) {
|
|
4351
|
+
// Only Git refs can be multi-skill directories
|
|
4352
|
+
if (this.isRegistrySource(ref) || this.isHttpSource(ref)) return {
|
|
4353
|
+
type: 'single'
|
|
4354
|
+
};
|
|
4355
|
+
const resolved = await this.resolver.resolve(ref);
|
|
4356
|
+
const { parsed } = resolved;
|
|
4357
|
+
const gitRef = resolved.ref;
|
|
4358
|
+
// Ensure the repo is cached (result unused — we only need the side-effect)
|
|
4359
|
+
if (!await this.cache.get(parsed, gitRef)) await this.cache.cache(resolved.repoUrl, parsed, gitRef, gitRef);
|
|
4360
|
+
const cachePath = this.cache.getCachePath(parsed, gitRef);
|
|
4361
|
+
// When parsed.skillName is set (ref has #fragment), resolve to the
|
|
4362
|
+
// specific skill subdirectory so we check the right SKILL.md.
|
|
4363
|
+
const sourcePath = this.resolveSourcePath(cachePath, parsed);
|
|
4364
|
+
const metadata = this.getSkillMetadataFromDir(sourcePath);
|
|
4365
|
+
if (metadata) return {
|
|
4366
|
+
type: 'single'
|
|
4367
|
+
};
|
|
4368
|
+
// No SKILL.md at root — check for child skills.
|
|
4369
|
+
// cachePath is correct here (not sourcePath) for two reasons:
|
|
4370
|
+
// 1. When parsed.skillName is set, resolveSourcePath() either returns a
|
|
4371
|
+
// subdirectory (→ metadata found → already returned 'single' above) or
|
|
4372
|
+
// throws (skill not found). So we never reach this line with
|
|
4373
|
+
// sourcePath ≠ cachePath.
|
|
4374
|
+
// 2. When parsed.subPath is set, CacheManager.cache() already copies only
|
|
4375
|
+
// the subPath subdirectory into cachePath, so discovery is scoped to
|
|
4376
|
+
// the intended directory automatically.
|
|
4377
|
+
const discovered = discoverSkillsInDir(cachePath);
|
|
4378
|
+
if (discovered.length > 0) return {
|
|
4379
|
+
type: 'multi',
|
|
4380
|
+
skills: discovered
|
|
4381
|
+
};
|
|
4382
|
+
// No skills found at all. Return 'single' so the caller proceeds to
|
|
4383
|
+
// installToAgents, which will produce a clear error ("no SKILL.md found").
|
|
4384
|
+
return {
|
|
4385
|
+
type: 'single'
|
|
4386
|
+
};
|
|
4387
|
+
}
|
|
4388
|
+
/**
|
|
4341
4389
|
* Install skill to multiple agents
|
|
4342
4390
|
*
|
|
4343
4391
|
* @param ref - Skill reference (e.g., github:user/repo@v1.0.0 or HTTP URL)
|
|
@@ -6540,6 +6588,18 @@ class AuthManager {
|
|
|
6540
6588
|
const { skills, options, configLoader, skipConfirm } = ctx;
|
|
6541
6589
|
const skill = skills[0];
|
|
6542
6590
|
const cwd = process.cwd();
|
|
6591
|
+
const skillManager = new SkillManager(void 0, {
|
|
6592
|
+
global: installGlobally
|
|
6593
|
+
});
|
|
6594
|
+
// Detect whether the ref points to a multi-skill directory
|
|
6595
|
+
spinner.start('Resolving skill...');
|
|
6596
|
+
const detection = await skillManager.detectSkillsInRef(skill);
|
|
6597
|
+
spinner.stop('Resolved');
|
|
6598
|
+
if ('multi' === detection.type) {
|
|
6599
|
+
await installAutoDetectedMultiSkill(skill, detection.skills, ctx, skillManager, targetAgents, installGlobally, installMode, spinner);
|
|
6600
|
+
return;
|
|
6601
|
+
}
|
|
6602
|
+
// --- Single skill path (existing behaviour) ---
|
|
6543
6603
|
// Show installation summary
|
|
6544
6604
|
const summaryLines = [
|
|
6545
6605
|
__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(skill),
|
|
@@ -6559,9 +6619,6 @@ class AuthManager {
|
|
|
6559
6619
|
}
|
|
6560
6620
|
// Execute installation
|
|
6561
6621
|
spinner.start(`Installing ${skill}...`);
|
|
6562
|
-
const skillManager = new SkillManager(void 0, {
|
|
6563
|
-
global: installGlobally
|
|
6564
|
-
});
|
|
6565
6622
|
const { skill: installed, results } = await skillManager.installToAgents(skill, targetAgents, {
|
|
6566
6623
|
force: options.force,
|
|
6567
6624
|
save: false !== options.save && !installGlobally,
|
|
@@ -6583,6 +6640,67 @@ class AuthManager {
|
|
|
6583
6640
|
});
|
|
6584
6641
|
}
|
|
6585
6642
|
}
|
|
6643
|
+
/**
|
|
6644
|
+
* Handle auto-detected multi-skill directory: show summary, confirm, install all.
|
|
6645
|
+
*
|
|
6646
|
+
* Called when `detectSkillsInRef` discovers that the ref points to a parent
|
|
6647
|
+
* directory (no SKILL.md at root) containing multiple child skills.
|
|
6648
|
+
*/ async function installAutoDetectedMultiSkill(ref, discoveredSkills, ctx, skillManager, targetAgents, installGlobally, installMode, spinner) {
|
|
6649
|
+
const { options, configLoader, skipConfirm } = ctx;
|
|
6650
|
+
const skillNames = discoveredSkills.map((s)=>s.name);
|
|
6651
|
+
// Show discovered skills
|
|
6652
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.step(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].bold(`Found ${discoveredSkills.length} skill(s)`));
|
|
6653
|
+
for (const s of discoveredSkills)__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.message(` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(s.name)}${s.description ? ` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(s.description)}` : ''}`);
|
|
6654
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.message('');
|
|
6655
|
+
// Show installation summary
|
|
6656
|
+
const summaryLines = [
|
|
6657
|
+
__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(ref),
|
|
6658
|
+
` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('→')} ${formatAgentNames(targetAgents)}`,
|
|
6659
|
+
` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('Skills:')} ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(skillNames.join(', '))}`,
|
|
6660
|
+
` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('Scope:')} ${installGlobally ? 'Global' : 'Project'}${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(', Mode:')} ${installMode}`
|
|
6661
|
+
];
|
|
6662
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.note(summaryLines.join('\n'), 'Multi-Skill Install');
|
|
6663
|
+
// Confirm
|
|
6664
|
+
if (!skipConfirm) {
|
|
6665
|
+
const confirmed = await __WEBPACK_EXTERNAL_MODULE__clack_prompts__.confirm({
|
|
6666
|
+
message: 'Install all discovered skills?'
|
|
6667
|
+
});
|
|
6668
|
+
if (__WEBPACK_EXTERNAL_MODULE__clack_prompts__.isCancel(confirmed) || !confirmed) {
|
|
6669
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.cancel('Installation cancelled');
|
|
6670
|
+
process.exit(0);
|
|
6671
|
+
}
|
|
6672
|
+
}
|
|
6673
|
+
// Install all discovered skills (empty skillNames = install all)
|
|
6674
|
+
spinner.start('Installing skills...');
|
|
6675
|
+
const result = await skillManager.installSkillsFromRepo(ref, [], targetAgents, {
|
|
6676
|
+
force: options.force,
|
|
6677
|
+
save: false !== options.save && !installGlobally,
|
|
6678
|
+
mode: installMode,
|
|
6679
|
+
registry: options.registry,
|
|
6680
|
+
token: options.token
|
|
6681
|
+
});
|
|
6682
|
+
spinner.stop('Installation complete');
|
|
6683
|
+
if (result.listOnly) return;
|
|
6684
|
+
const { installed, skipped } = result;
|
|
6685
|
+
// Display results
|
|
6686
|
+
if (0 === installed.length && skipped.length > 0) {
|
|
6687
|
+
const skipLines = skipped.map((s)=>` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('–')} ${s.name}: ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(s.reason)}`);
|
|
6688
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.note(skipLines.join('\n'), __WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('All skills were already installed'));
|
|
6689
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.info('Use --force to reinstall.');
|
|
6690
|
+
return;
|
|
6691
|
+
}
|
|
6692
|
+
const resultLines = installed.map((r)=>` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('✓')} ${r.skill.name}@${r.skill.version}`);
|
|
6693
|
+
if (skipped.length > 0) for (const s of skipped)resultLines.push(` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('–')} ${s.name}: ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(s.reason)}`);
|
|
6694
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.note(resultLines.join('\n'), __WEBPACK_EXTERNAL_MODULE_chalk__["default"].green(`Installed ${installed.length} skill(s)`));
|
|
6695
|
+
// Save installation defaults
|
|
6696
|
+
if (!installGlobally && installed.length > 0 && configLoader.exists()) {
|
|
6697
|
+
configLoader.reload();
|
|
6698
|
+
configLoader.updateDefaults({
|
|
6699
|
+
targetAgents,
|
|
6700
|
+
installMode
|
|
6701
|
+
});
|
|
6702
|
+
}
|
|
6703
|
+
}
|
|
6586
6704
|
/**
|
|
6587
6705
|
* Multi-skill path: list or install selected skills from a single repo (--skill / --list)
|
|
6588
6706
|
*/ async function installMultiSkillFromRepo(ref, skillNames, listOnly, ctx, targetAgents, installGlobally, installMode, spinner) {
|
|
@@ -180,6 +180,23 @@ export declare class SkillManager {
|
|
|
180
180
|
latest: string;
|
|
181
181
|
updateAvailable: boolean;
|
|
182
182
|
}>>;
|
|
183
|
+
/**
|
|
184
|
+
* Detect whether a ref points to a single skill or a multi-skill directory.
|
|
185
|
+
*
|
|
186
|
+
* Returns `{ type: 'single' }` when the cached root contains a SKILL.md (or
|
|
187
|
+
* when the source is registry/HTTP — those are always single-skill).
|
|
188
|
+
* Returns `{ type: 'multi', skills }` when the root has **no** SKILL.md but
|
|
189
|
+
* `discoverSkillsInDir()` finds child skills underneath.
|
|
190
|
+
*
|
|
191
|
+
* The method caches the repo as a side-effect so that the subsequent
|
|
192
|
+
* `installToAgents` / `installSkillsFromRepo` call hits the cache.
|
|
193
|
+
*/
|
|
194
|
+
detectSkillsInRef(ref: string): Promise<{
|
|
195
|
+
type: 'single';
|
|
196
|
+
} | {
|
|
197
|
+
type: 'multi';
|
|
198
|
+
skills: ParsedSkillWithPath[];
|
|
199
|
+
}>;
|
|
183
200
|
/**
|
|
184
201
|
* Install skill to multiple agents
|
|
185
202
|
*
|
|
@@ -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,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,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,QAAQ,CAAU;gBAEd,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;IAc/D;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;OA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,OAAO,CAAA;KAAO,GACpD,OAAO,CACN;QAAE,QAAQ,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,mBAAmB,EAAE,CAAA;KAAE,GACjD;QACE,QAAQ,EAAE,KAAK,CAAC;QAChB,SAAS,EAAE,KAAK,CAAC;YACf,KAAK,EAAE,cAAc,CAAC;YACtB,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,aAAa,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
|
@@ -4333,6 +4333,54 @@ class RegistryResolver {
|
|
|
4333
4333
|
// Multi-Agent installation methods
|
|
4334
4334
|
// ============================================================================
|
|
4335
4335
|
/**
|
|
4336
|
+
* Detect whether a ref points to a single skill or a multi-skill directory.
|
|
4337
|
+
*
|
|
4338
|
+
* Returns `{ type: 'single' }` when the cached root contains a SKILL.md (or
|
|
4339
|
+
* when the source is registry/HTTP — those are always single-skill).
|
|
4340
|
+
* Returns `{ type: 'multi', skills }` when the root has **no** SKILL.md but
|
|
4341
|
+
* `discoverSkillsInDir()` finds child skills underneath.
|
|
4342
|
+
*
|
|
4343
|
+
* The method caches the repo as a side-effect so that the subsequent
|
|
4344
|
+
* `installToAgents` / `installSkillsFromRepo` call hits the cache.
|
|
4345
|
+
*/ async detectSkillsInRef(ref) {
|
|
4346
|
+
// Only Git refs can be multi-skill directories
|
|
4347
|
+
if (this.isRegistrySource(ref) || this.isHttpSource(ref)) return {
|
|
4348
|
+
type: 'single'
|
|
4349
|
+
};
|
|
4350
|
+
const resolved = await this.resolver.resolve(ref);
|
|
4351
|
+
const { parsed } = resolved;
|
|
4352
|
+
const gitRef = resolved.ref;
|
|
4353
|
+
// Ensure the repo is cached (result unused — we only need the side-effect)
|
|
4354
|
+
if (!await this.cache.get(parsed, gitRef)) await this.cache.cache(resolved.repoUrl, parsed, gitRef, gitRef);
|
|
4355
|
+
const cachePath = this.cache.getCachePath(parsed, gitRef);
|
|
4356
|
+
// When parsed.skillName is set (ref has #fragment), resolve to the
|
|
4357
|
+
// specific skill subdirectory so we check the right SKILL.md.
|
|
4358
|
+
const sourcePath = this.resolveSourcePath(cachePath, parsed);
|
|
4359
|
+
const metadata = this.getSkillMetadataFromDir(sourcePath);
|
|
4360
|
+
if (metadata) return {
|
|
4361
|
+
type: 'single'
|
|
4362
|
+
};
|
|
4363
|
+
// No SKILL.md at root — check for child skills.
|
|
4364
|
+
// cachePath is correct here (not sourcePath) for two reasons:
|
|
4365
|
+
// 1. When parsed.skillName is set, resolveSourcePath() either returns a
|
|
4366
|
+
// subdirectory (→ metadata found → already returned 'single' above) or
|
|
4367
|
+
// throws (skill not found). So we never reach this line with
|
|
4368
|
+
// sourcePath ≠ cachePath.
|
|
4369
|
+
// 2. When parsed.subPath is set, CacheManager.cache() already copies only
|
|
4370
|
+
// the subPath subdirectory into cachePath, so discovery is scoped to
|
|
4371
|
+
// the intended directory automatically.
|
|
4372
|
+
const discovered = discoverSkillsInDir(cachePath);
|
|
4373
|
+
if (discovered.length > 0) return {
|
|
4374
|
+
type: 'multi',
|
|
4375
|
+
skills: discovered
|
|
4376
|
+
};
|
|
4377
|
+
// No skills found at all. Return 'single' so the caller proceeds to
|
|
4378
|
+
// installToAgents, which will produce a clear error ("no SKILL.md found").
|
|
4379
|
+
return {
|
|
4380
|
+
type: 'single'
|
|
4381
|
+
};
|
|
4382
|
+
}
|
|
4383
|
+
/**
|
|
4336
4384
|
* Install skill to multiple agents
|
|
4337
4385
|
*
|
|
4338
4386
|
* @param ref - Skill reference (e.g., github:user/repo@v1.0.0 or HTTP URL)
|