reskill 1.21.0 → 1.22.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 +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/index.js +104 -35
- package/dist/core/skill-manager.d.ts +17 -2
- package/dist/core/skill-manager.d.ts.map +1 -1
- package/dist/index.js +76 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ npx reskill@latest <command> # Or use npx directly
|
|
|
70
70
|
| `--no-save` | `install` | Install without saving to `skills.json` (for personal skills) |
|
|
71
71
|
| `-g, --global` | `install`, `uninstall`, `list` | Install/manage skills globally (user directory) |
|
|
72
72
|
| `-a, --agent <agents...>` | `install` | Specify target agents (e.g., `cursor`, `claude-code`) |
|
|
73
|
+
| `-a, --agent <agent>` | `list` | List skills installed to a specific agent |
|
|
73
74
|
| `--mode <mode>` | `install` | Installation mode: `symlink` (default) or `copy` |
|
|
74
75
|
| `--all` | `install` | Install to all agents |
|
|
75
76
|
| `-y, --yes` | `install`, `uninstall`, `publish` | Skip confirmation prompts |
|
package/README.zh-CN.md
CHANGED
|
@@ -70,6 +70,7 @@ npx reskill@latest <command> # 或直接使用 npx
|
|
|
70
70
|
| `--no-save` | `install` | 安装时不保存到 `skills.json`(用于个人技能) |
|
|
71
71
|
| `-g, --global` | `install`, `uninstall`, `list` | 全局安装/管理技能(用户目录) |
|
|
72
72
|
| `-a, --agent <agents...>` | `install` | 指定目标 Agent(如 `cursor`, `claude-code`) |
|
|
73
|
+
| `-a, --agent <agent>` | `list` | 列出安装到指定 Agent 的技能 |
|
|
73
74
|
| `--mode <mode>` | `install` | 安装模式:`symlink`(默认)或 `copy` |
|
|
74
75
|
| `--all` | `install` | 安装到所有 Agent |
|
|
75
76
|
| `-y, --yes` | `install`, `uninstall`, `publish` | 跳过确认提示 |
|
|
@@ -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;AA+7BpC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,SAuHvB,CAAC;AAEL,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC;;GAEG;AACH,eAAO,MAAM,WAAW,SAyDpB,CAAC;AAEL,eAAe,WAAW,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -4308,6 +4308,16 @@ class RegistryResolver {
|
|
|
4308
4308
|
return this.isGlobal;
|
|
4309
4309
|
}
|
|
4310
4310
|
/**
|
|
4311
|
+
* Determine if the installation is effectively global.
|
|
4312
|
+
*
|
|
4313
|
+
* Claude Cowork 3P always installs to a global app-managed directory regardless
|
|
4314
|
+
* of the isGlobal flag. When all target agents are claude-cowork-3p, the
|
|
4315
|
+
* installation should be treated as global (skip skills.json/skills.lock writes).
|
|
4316
|
+
*/ isEffectivelyGlobal(targetAgents) {
|
|
4317
|
+
if (this.isGlobal) return true;
|
|
4318
|
+
return targetAgents.length > 0 && targetAgents.every((a)=>a === claude_3p_installer_CLAUDE_COWORK_3P_AGENT);
|
|
4319
|
+
}
|
|
4320
|
+
/**
|
|
4311
4321
|
* Get project root directory
|
|
4312
4322
|
*/ getProjectRoot() {
|
|
4313
4323
|
return this.projectRoot;
|
|
@@ -4717,8 +4727,10 @@ class RegistryResolver {
|
|
|
4717
4727
|
/**
|
|
4718
4728
|
* List installed skills
|
|
4719
4729
|
*
|
|
4720
|
-
*
|
|
4721
|
-
|
|
4730
|
+
* When `agent` is specified, lists skills installed to that specific agent.
|
|
4731
|
+
* Otherwise checks both canonical (.agents/skills/) and legacy (.skills/) locations.
|
|
4732
|
+
*/ list(options) {
|
|
4733
|
+
if (options?.agent) return this.listByAgent(options.agent);
|
|
4722
4734
|
const skills = [];
|
|
4723
4735
|
const seenNames = new Set();
|
|
4724
4736
|
// Check canonical location first (.agents/skills/)
|
|
@@ -4752,6 +4764,38 @@ class RegistryResolver {
|
|
|
4752
4764
|
seenNames.add(name);
|
|
4753
4765
|
}
|
|
4754
4766
|
}
|
|
4767
|
+
// In global mode, also include claude-cowork-3p skills (always global)
|
|
4768
|
+
if (this.isGlobal) try {
|
|
4769
|
+
for (const name of listClaude3pSkills()){
|
|
4770
|
+
if (seenNames.has(name)) continue;
|
|
4771
|
+
const skillPath = getClaude3pSkillPath(name);
|
|
4772
|
+
const skill = this.getInstalledSkillFromPath(name, skillPath);
|
|
4773
|
+
if (skill) {
|
|
4774
|
+
skills.push(skill);
|
|
4775
|
+
seenNames.add(name);
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
} catch {
|
|
4779
|
+
// Claude Cowork 3P not configured or accessible — skip silently
|
|
4780
|
+
}
|
|
4781
|
+
return skills;
|
|
4782
|
+
}
|
|
4783
|
+
/**
|
|
4784
|
+
* List skills installed to a specific agent
|
|
4785
|
+
*/ listByAgent(agent) {
|
|
4786
|
+
const installer = new Installer({
|
|
4787
|
+
cwd: this.projectRoot,
|
|
4788
|
+
global: this.isGlobal
|
|
4789
|
+
});
|
|
4790
|
+
const skillNames = installer.listInstalledSkills(agent);
|
|
4791
|
+
const skills = [];
|
|
4792
|
+
for (const name of skillNames)try {
|
|
4793
|
+
const skillPath = installer.getAgentSkillPath(name, agent);
|
|
4794
|
+
const skill = this.getInstalledSkillFromPath(name, skillPath);
|
|
4795
|
+
if (skill) skills.push(skill);
|
|
4796
|
+
} catch {
|
|
4797
|
+
// Skip skills whose paths cannot be resolved (e.g. claude-3p not configured)
|
|
4798
|
+
}
|
|
4755
4799
|
return skills;
|
|
4756
4800
|
}
|
|
4757
4801
|
/**
|
|
@@ -5005,14 +5049,15 @@ class RegistryResolver {
|
|
|
5005
5049
|
const results = await installer.installToAgents(skillInfo.dirPath, skillInfo.name, targetAgents, {
|
|
5006
5050
|
mode: mode
|
|
5007
5051
|
});
|
|
5008
|
-
|
|
5052
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5053
|
+
if (!effectivelyGlobal) this.lockManager.lockSkill(skillInfo.name, {
|
|
5009
5054
|
source: skillSource,
|
|
5010
5055
|
version: semanticVersion,
|
|
5011
5056
|
ref: gitRef,
|
|
5012
5057
|
resolved: repoUrl,
|
|
5013
5058
|
commit: cacheResult.commit
|
|
5014
5059
|
});
|
|
5015
|
-
if (!
|
|
5060
|
+
if (!effectivelyGlobal && save) {
|
|
5016
5061
|
this.config.ensureExists();
|
|
5017
5062
|
this.config.addSkill(skillInfo.name, `${baseRefForSave}#${skillInfo.name}`);
|
|
5018
5063
|
}
|
|
@@ -5070,8 +5115,9 @@ class RegistryResolver {
|
|
|
5070
5115
|
const results = await installer.installToAgents(sourcePath, skillName, targetAgents, {
|
|
5071
5116
|
mode: mode
|
|
5072
5117
|
});
|
|
5073
|
-
// Update lock file (project mode only)
|
|
5074
|
-
|
|
5118
|
+
// Update lock file (project mode only, skip for effectively-global installs)
|
|
5119
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5120
|
+
if (!effectivelyGlobal) {
|
|
5075
5121
|
const lockSource = registryContext?.lockSource ?? `${parsed.registry}:${parsed.owner}/${parsed.repo}${parsed.subPath ? `/${parsed.subPath}` : ''}`;
|
|
5076
5122
|
this.lockManager.lockSkill(skillName, {
|
|
5077
5123
|
source: lockSource,
|
|
@@ -5082,8 +5128,8 @@ class RegistryResolver {
|
|
|
5082
5128
|
registry: registryContext?.registryUrl
|
|
5083
5129
|
});
|
|
5084
5130
|
}
|
|
5085
|
-
// Update skills.json (project mode only)
|
|
5086
|
-
if (!
|
|
5131
|
+
// Update skills.json (project mode only, skip for effectively-global installs)
|
|
5132
|
+
if (!effectivelyGlobal && save) {
|
|
5087
5133
|
this.config.ensureExists();
|
|
5088
5134
|
const configRef = registryContext?.configRef ?? this.config.normalizeSkillRef(ref);
|
|
5089
5135
|
this.config.addSkill(skillName, configRef);
|
|
@@ -5141,8 +5187,9 @@ class RegistryResolver {
|
|
|
5141
5187
|
const results = await installer.installToAgents(sourcePath, skillName, targetAgents, {
|
|
5142
5188
|
mode: mode
|
|
5143
5189
|
});
|
|
5144
|
-
// Update lock file (project mode only)
|
|
5145
|
-
|
|
5190
|
+
// Update lock file (project mode only, skip for effectively-global installs)
|
|
5191
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5192
|
+
if (!effectivelyGlobal) {
|
|
5146
5193
|
const lockSource = registryContext?.lockSource ?? `http:${httpInfo.host}/${skillName}`;
|
|
5147
5194
|
this.lockManager.lockSkill(skillName, {
|
|
5148
5195
|
source: lockSource,
|
|
@@ -5153,8 +5200,8 @@ class RegistryResolver {
|
|
|
5153
5200
|
registry: registryContext?.registryUrl
|
|
5154
5201
|
});
|
|
5155
5202
|
}
|
|
5156
|
-
// Update skills.json (project mode only)
|
|
5157
|
-
if (!
|
|
5203
|
+
// Update skills.json (project mode only, skip for effectively-global installs)
|
|
5204
|
+
if (!effectivelyGlobal && save) {
|
|
5158
5205
|
this.config.ensureExists();
|
|
5159
5206
|
const configRef = registryContext?.configRef ?? ref;
|
|
5160
5207
|
this.config.addSkill(skillName, configRef);
|
|
@@ -5274,8 +5321,9 @@ class RegistryResolver {
|
|
|
5274
5321
|
const results = await installer.installToAgents(extractedPath, shortName, targetAgents, {
|
|
5275
5322
|
mode: mode
|
|
5276
5323
|
});
|
|
5277
|
-
// 7. Update lock file (project mode only)
|
|
5278
|
-
|
|
5324
|
+
// 7. Update lock file (project mode only, skip for effectively-global installs)
|
|
5325
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5326
|
+
if (!effectivelyGlobal) this.lockManager.lockSkill(shortName, {
|
|
5279
5327
|
source: `registry:${resolvedParsed.fullName}`,
|
|
5280
5328
|
version,
|
|
5281
5329
|
ref: version,
|
|
@@ -5283,8 +5331,8 @@ class RegistryResolver {
|
|
|
5283
5331
|
commit: resolved.integrity,
|
|
5284
5332
|
registry: resolvedRegistryUrl
|
|
5285
5333
|
});
|
|
5286
|
-
// 8. Update skills.json (project mode only)
|
|
5287
|
-
if (!
|
|
5334
|
+
// 8. Update skills.json (project mode only, skip for effectively-global installs)
|
|
5335
|
+
if (!effectivelyGlobal && save) {
|
|
5288
5336
|
this.config.ensureExists();
|
|
5289
5337
|
// Save with full name for registry skills
|
|
5290
5338
|
this.config.addSkill(shortName, ref);
|
|
@@ -5350,7 +5398,8 @@ class RegistryResolver {
|
|
|
5350
5398
|
registryContext
|
|
5351
5399
|
};
|
|
5352
5400
|
// Save custom registry to skills.json.registries (for reinstall without lock file)
|
|
5353
|
-
|
|
5401
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5402
|
+
if (!effectivelyGlobal && options.registry) {
|
|
5354
5403
|
const registryName = this.deriveRegistryName(options.registry);
|
|
5355
5404
|
if (registryName) {
|
|
5356
5405
|
this.config.ensureExists();
|
|
@@ -5453,8 +5502,9 @@ class RegistryResolver {
|
|
|
5453
5502
|
const metadata = this.getSkillMetadataFromDir(extractedPath);
|
|
5454
5503
|
const skillName = metadata?.name ?? shortName;
|
|
5455
5504
|
const semanticVersion = metadata?.version ?? version;
|
|
5456
|
-
// Update lock file (project mode only)
|
|
5457
|
-
|
|
5505
|
+
// Update lock file (project mode only, skip for effectively-global installs)
|
|
5506
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5507
|
+
if (!effectivelyGlobal) this.lockManager.lockSkill(skillName, {
|
|
5458
5508
|
source: `registry:${parsed.fullName}`,
|
|
5459
5509
|
version: semanticVersion,
|
|
5460
5510
|
ref: version,
|
|
@@ -5462,8 +5512,8 @@ class RegistryResolver {
|
|
|
5462
5512
|
commit: '',
|
|
5463
5513
|
registry: registryUrl
|
|
5464
5514
|
});
|
|
5465
|
-
// Update skills.json (project mode only)
|
|
5466
|
-
if (!
|
|
5515
|
+
// Update skills.json (project mode only, skip for effectively-global installs)
|
|
5516
|
+
if (!effectivelyGlobal && save) {
|
|
5467
5517
|
this.config.ensureExists();
|
|
5468
5518
|
this.config.addSkill(skillName, parsed.fullName);
|
|
5469
5519
|
// Save custom registry to skills.json.registries (for reinstall without lock file)
|
|
@@ -5537,10 +5587,11 @@ class RegistryResolver {
|
|
|
5537
5587
|
installDir: defaults.installDir
|
|
5538
5588
|
});
|
|
5539
5589
|
const results = installer.uninstallFromAgents(name, targetAgents);
|
|
5540
|
-
// Remove from lock file (project mode only)
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5590
|
+
// Remove from lock file (project mode only, skip for effectively-global installs)
|
|
5591
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5592
|
+
if (!effectivelyGlobal) this.lockManager.remove(name);
|
|
5593
|
+
// Remove from skills.json (project mode only, skip for effectively-global installs)
|
|
5594
|
+
if (!effectivelyGlobal && this.config.exists()) this.config.removeSkill(name);
|
|
5544
5595
|
const successCount = Array.from(results.values()).filter((r)=>r).length;
|
|
5545
5596
|
logger_logger.success(`Uninstalled ${name} from ${successCount} agent(s)`);
|
|
5546
5597
|
return results;
|
|
@@ -7609,12 +7660,19 @@ const DEFAULT_INSTALL_DIR = '.skills';
|
|
|
7609
7660
|
// ============================================================================
|
|
7610
7661
|
/**
|
|
7611
7662
|
* Resolve installation scope (global vs project)
|
|
7612
|
-
*/ async function resolveInstallScope(ctx) {
|
|
7663
|
+
*/ async function resolveInstallScope(ctx, targetAgents) {
|
|
7613
7664
|
const { options, isReinstallAll, skipConfirm } = ctx;
|
|
7614
7665
|
// Explicit --global flag
|
|
7615
7666
|
if (void 0 !== options.global) return options.global;
|
|
7616
|
-
// Skip prompt for reinstall-all (always project scope)
|
|
7667
|
+
// Skip prompt for reinstall-all (always project scope).
|
|
7668
|
+
// Must be checked before the claude-cowork-3p override to avoid
|
|
7669
|
+
// "Cannot install all skills globally" when 3p is the only detected agent.
|
|
7617
7670
|
if (isReinstallAll) return false;
|
|
7671
|
+
// claude-cowork-3p always installs globally — skip prompt
|
|
7672
|
+
if (targetAgents.length > 0 && targetAgents.every((a)=>a === claude_3p_installer_CLAUDE_COWORK_3P_AGENT)) {
|
|
7673
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.info('Using global scope (claude-cowork-3p is always global)');
|
|
7674
|
+
return true;
|
|
7675
|
+
}
|
|
7618
7676
|
// Skip prompt if --yes
|
|
7619
7677
|
if (skipConfirm) return false;
|
|
7620
7678
|
// Prompt user
|
|
@@ -7644,10 +7702,12 @@ const DEFAULT_INSTALL_DIR = '.skills';
|
|
|
7644
7702
|
// ============================================================================
|
|
7645
7703
|
/**
|
|
7646
7704
|
* Resolve installation mode (symlink vs copy)
|
|
7647
|
-
*/ async function resolveInstallMode(ctx) {
|
|
7705
|
+
*/ async function resolveInstallMode(ctx, targetAgents) {
|
|
7648
7706
|
const { options, storedMode, isReinstallAll, skipConfirm } = ctx;
|
|
7649
7707
|
// Priority 1: CLI --mode option
|
|
7650
7708
|
if (options.mode) return options.mode;
|
|
7709
|
+
// claude-cowork-3p always uses copy mode — skip prompt
|
|
7710
|
+
if (targetAgents.length > 0 && targetAgents.every((a)=>a === claude_3p_installer_CLAUDE_COWORK_3P_AGENT)) return 'copy';
|
|
7651
7711
|
// Priority 2: Reinstall all with stored mode
|
|
7652
7712
|
if (isReinstallAll && storedMode) {
|
|
7653
7713
|
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.info(`Using saved install mode: ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(storedMode)}`);
|
|
@@ -8129,14 +8189,14 @@ const DEFAULT_INSTALL_DIR = '.skills';
|
|
|
8129
8189
|
// Step 1: Resolve target agents
|
|
8130
8190
|
targetAgents = await resolveTargetAgents(ctx, spinner);
|
|
8131
8191
|
// Step 2: Resolve installation scope
|
|
8132
|
-
installGlobally = await resolveInstallScope(ctx);
|
|
8192
|
+
installGlobally = await resolveInstallScope(ctx, targetAgents);
|
|
8133
8193
|
// Validate: Cannot install all skills globally
|
|
8134
8194
|
if (ctx.isReinstallAll && installGlobally) {
|
|
8135
8195
|
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.error('Cannot install all skills globally. Please specify a skill to install.');
|
|
8136
8196
|
process.exit(1);
|
|
8137
8197
|
}
|
|
8138
8198
|
// Step 3: Resolve installation mode
|
|
8139
|
-
installMode = await resolveInstallMode(ctx);
|
|
8199
|
+
installMode = await resolveInstallMode(ctx, targetAgents);
|
|
8140
8200
|
}
|
|
8141
8201
|
// Step 4: Execute installation
|
|
8142
8202
|
if (ctx.isReinstallAll) await installAllSkills(ctx, targetAgents, installMode, spinner);
|
|
@@ -8154,14 +8214,23 @@ const DEFAULT_INSTALL_DIR = '.skills';
|
|
|
8154
8214
|
});
|
|
8155
8215
|
/**
|
|
8156
8216
|
* list command - List installed skills
|
|
8157
|
-
*/ const listCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('list').alias('ls').description('List installed skills').option('-j, --json', 'Output as JSON').option('-g, --global', 'List globally installed skills').action((options)=>{
|
|
8158
|
-
const
|
|
8217
|
+
*/ const listCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('list').alias('ls').description('List installed skills').option('-j, --json', 'Output as JSON').option('-g, --global', 'List globally installed skills').option('-a, --agent <agent>', 'List skills installed to a specific agent').action((options)=>{
|
|
8218
|
+
const agentInput = options.agent;
|
|
8219
|
+
if (void 0 !== agentInput && !isValidAgentType(agentInput)) {
|
|
8220
|
+
logger_logger.error(`Invalid agent: ${agentInput}`);
|
|
8221
|
+
process.exit(1);
|
|
8222
|
+
}
|
|
8223
|
+
const agent = agentInput;
|
|
8224
|
+
// claude-cowork-3p is always global
|
|
8225
|
+
const isGlobal = options.global || agent === claude_3p_installer_CLAUDE_COWORK_3P_AGENT;
|
|
8159
8226
|
const skillManager = new SkillManager(void 0, {
|
|
8160
8227
|
global: isGlobal
|
|
8161
8228
|
});
|
|
8162
|
-
const skills = skillManager.list(
|
|
8229
|
+
const skills = skillManager.list(agent ? {
|
|
8230
|
+
agent
|
|
8231
|
+
} : void 0);
|
|
8163
8232
|
if (0 === skills.length) {
|
|
8164
|
-
const location = isGlobal ? 'globally' : 'in this project';
|
|
8233
|
+
const location = agent ? `for ${getAgentConfig(agent).displayName}` : isGlobal ? 'globally' : 'in this project';
|
|
8165
8234
|
logger_logger.info(`No skills installed ${location}`);
|
|
8166
8235
|
return;
|
|
8167
8236
|
}
|
|
@@ -8169,7 +8238,7 @@ const DEFAULT_INSTALL_DIR = '.skills';
|
|
|
8169
8238
|
console.log(JSON.stringify(skills, null, 2));
|
|
8170
8239
|
return;
|
|
8171
8240
|
}
|
|
8172
|
-
const scopeLabel = isGlobal ? 'global' : 'project';
|
|
8241
|
+
const scopeLabel = agent ? getAgentConfig(agent).displayName : isGlobal ? 'global' : 'project';
|
|
8173
8242
|
logger_logger.log(`Installed Skills (${scopeLabel}):`);
|
|
8174
8243
|
logger_logger.newline();
|
|
8175
8244
|
const headers = [
|
|
@@ -41,6 +41,14 @@ export declare class SkillManager {
|
|
|
41
41
|
* Check if in global mode
|
|
42
42
|
*/
|
|
43
43
|
isGlobalMode(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Determine if the installation is effectively global.
|
|
46
|
+
*
|
|
47
|
+
* Claude Cowork 3P always installs to a global app-managed directory regardless
|
|
48
|
+
* of the isGlobal flag. When all target agents are claude-cowork-3p, the
|
|
49
|
+
* installation should be treated as global (skip skills.json/skills.lock writes).
|
|
50
|
+
*/
|
|
51
|
+
private isEffectivelyGlobal;
|
|
44
52
|
/**
|
|
45
53
|
* Get project root directory
|
|
46
54
|
*/
|
|
@@ -154,9 +162,16 @@ export declare class SkillManager {
|
|
|
154
162
|
/**
|
|
155
163
|
* List installed skills
|
|
156
164
|
*
|
|
157
|
-
*
|
|
165
|
+
* When `agent` is specified, lists skills installed to that specific agent.
|
|
166
|
+
* Otherwise checks both canonical (.agents/skills/) and legacy (.skills/) locations.
|
|
167
|
+
*/
|
|
168
|
+
list(options?: {
|
|
169
|
+
agent?: AgentType;
|
|
170
|
+
}): InstalledSkill[];
|
|
171
|
+
/**
|
|
172
|
+
* List skills installed to a specific agent
|
|
158
173
|
*/
|
|
159
|
-
|
|
174
|
+
private listByAgent;
|
|
160
175
|
/**
|
|
161
176
|
* Detect which agents have a skill installed (symlink or copy)
|
|
162
177
|
*
|
|
@@ -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;AAoB3B,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,qBAAqB,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;AAoB3B,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG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;;;;;OAKG;YACW,wBAAwB;IA2FtC;;;;;;;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;CA0BtF;AAED,eAAe,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4698,6 +4698,16 @@ class RegistryResolver {
|
|
|
4698
4698
|
return this.isGlobal;
|
|
4699
4699
|
}
|
|
4700
4700
|
/**
|
|
4701
|
+
* Determine if the installation is effectively global.
|
|
4702
|
+
*
|
|
4703
|
+
* Claude Cowork 3P always installs to a global app-managed directory regardless
|
|
4704
|
+
* of the isGlobal flag. When all target agents are claude-cowork-3p, the
|
|
4705
|
+
* installation should be treated as global (skip skills.json/skills.lock writes).
|
|
4706
|
+
*/ isEffectivelyGlobal(targetAgents) {
|
|
4707
|
+
if (this.isGlobal) return true;
|
|
4708
|
+
return targetAgents.length > 0 && targetAgents.every((a)=>a === CLAUDE_COWORK_3P_AGENT);
|
|
4709
|
+
}
|
|
4710
|
+
/**
|
|
4701
4711
|
* Get project root directory
|
|
4702
4712
|
*/ getProjectRoot() {
|
|
4703
4713
|
return this.projectRoot;
|
|
@@ -5107,8 +5117,10 @@ class RegistryResolver {
|
|
|
5107
5117
|
/**
|
|
5108
5118
|
* List installed skills
|
|
5109
5119
|
*
|
|
5110
|
-
*
|
|
5111
|
-
|
|
5120
|
+
* When `agent` is specified, lists skills installed to that specific agent.
|
|
5121
|
+
* Otherwise checks both canonical (.agents/skills/) and legacy (.skills/) locations.
|
|
5122
|
+
*/ list(options) {
|
|
5123
|
+
if (options?.agent) return this.listByAgent(options.agent);
|
|
5112
5124
|
const skills = [];
|
|
5113
5125
|
const seenNames = new Set();
|
|
5114
5126
|
// Check canonical location first (.agents/skills/)
|
|
@@ -5142,6 +5154,38 @@ class RegistryResolver {
|
|
|
5142
5154
|
seenNames.add(name);
|
|
5143
5155
|
}
|
|
5144
5156
|
}
|
|
5157
|
+
// In global mode, also include claude-cowork-3p skills (always global)
|
|
5158
|
+
if (this.isGlobal) try {
|
|
5159
|
+
for (const name of listClaude3pSkills()){
|
|
5160
|
+
if (seenNames.has(name)) continue;
|
|
5161
|
+
const skillPath = getClaude3pSkillPath(name);
|
|
5162
|
+
const skill = this.getInstalledSkillFromPath(name, skillPath);
|
|
5163
|
+
if (skill) {
|
|
5164
|
+
skills.push(skill);
|
|
5165
|
+
seenNames.add(name);
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
} catch {
|
|
5169
|
+
// Claude Cowork 3P not configured or accessible — skip silently
|
|
5170
|
+
}
|
|
5171
|
+
return skills;
|
|
5172
|
+
}
|
|
5173
|
+
/**
|
|
5174
|
+
* List skills installed to a specific agent
|
|
5175
|
+
*/ listByAgent(agent) {
|
|
5176
|
+
const installer = new Installer({
|
|
5177
|
+
cwd: this.projectRoot,
|
|
5178
|
+
global: this.isGlobal
|
|
5179
|
+
});
|
|
5180
|
+
const skillNames = installer.listInstalledSkills(agent);
|
|
5181
|
+
const skills = [];
|
|
5182
|
+
for (const name of skillNames)try {
|
|
5183
|
+
const skillPath = installer.getAgentSkillPath(name, agent);
|
|
5184
|
+
const skill = this.getInstalledSkillFromPath(name, skillPath);
|
|
5185
|
+
if (skill) skills.push(skill);
|
|
5186
|
+
} catch {
|
|
5187
|
+
// Skip skills whose paths cannot be resolved (e.g. claude-3p not configured)
|
|
5188
|
+
}
|
|
5145
5189
|
return skills;
|
|
5146
5190
|
}
|
|
5147
5191
|
/**
|
|
@@ -5395,14 +5439,15 @@ class RegistryResolver {
|
|
|
5395
5439
|
const results = await installer.installToAgents(skillInfo.dirPath, skillInfo.name, targetAgents, {
|
|
5396
5440
|
mode: mode
|
|
5397
5441
|
});
|
|
5398
|
-
|
|
5442
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5443
|
+
if (!effectivelyGlobal) this.lockManager.lockSkill(skillInfo.name, {
|
|
5399
5444
|
source: skillSource,
|
|
5400
5445
|
version: semanticVersion,
|
|
5401
5446
|
ref: gitRef,
|
|
5402
5447
|
resolved: repoUrl,
|
|
5403
5448
|
commit: cacheResult.commit
|
|
5404
5449
|
});
|
|
5405
|
-
if (!
|
|
5450
|
+
if (!effectivelyGlobal && save) {
|
|
5406
5451
|
this.config.ensureExists();
|
|
5407
5452
|
this.config.addSkill(skillInfo.name, `${baseRefForSave}#${skillInfo.name}`);
|
|
5408
5453
|
}
|
|
@@ -5460,8 +5505,9 @@ class RegistryResolver {
|
|
|
5460
5505
|
const results = await installer.installToAgents(sourcePath, skillName, targetAgents, {
|
|
5461
5506
|
mode: mode
|
|
5462
5507
|
});
|
|
5463
|
-
// Update lock file (project mode only)
|
|
5464
|
-
|
|
5508
|
+
// Update lock file (project mode only, skip for effectively-global installs)
|
|
5509
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5510
|
+
if (!effectivelyGlobal) {
|
|
5465
5511
|
const lockSource = registryContext?.lockSource ?? `${parsed.registry}:${parsed.owner}/${parsed.repo}${parsed.subPath ? `/${parsed.subPath}` : ''}`;
|
|
5466
5512
|
this.lockManager.lockSkill(skillName, {
|
|
5467
5513
|
source: lockSource,
|
|
@@ -5472,8 +5518,8 @@ class RegistryResolver {
|
|
|
5472
5518
|
registry: registryContext?.registryUrl
|
|
5473
5519
|
});
|
|
5474
5520
|
}
|
|
5475
|
-
// Update skills.json (project mode only)
|
|
5476
|
-
if (!
|
|
5521
|
+
// Update skills.json (project mode only, skip for effectively-global installs)
|
|
5522
|
+
if (!effectivelyGlobal && save) {
|
|
5477
5523
|
this.config.ensureExists();
|
|
5478
5524
|
const configRef = registryContext?.configRef ?? this.config.normalizeSkillRef(ref);
|
|
5479
5525
|
this.config.addSkill(skillName, configRef);
|
|
@@ -5531,8 +5577,9 @@ class RegistryResolver {
|
|
|
5531
5577
|
const results = await installer.installToAgents(sourcePath, skillName, targetAgents, {
|
|
5532
5578
|
mode: mode
|
|
5533
5579
|
});
|
|
5534
|
-
// Update lock file (project mode only)
|
|
5535
|
-
|
|
5580
|
+
// Update lock file (project mode only, skip for effectively-global installs)
|
|
5581
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5582
|
+
if (!effectivelyGlobal) {
|
|
5536
5583
|
const lockSource = registryContext?.lockSource ?? `http:${httpInfo.host}/${skillName}`;
|
|
5537
5584
|
this.lockManager.lockSkill(skillName, {
|
|
5538
5585
|
source: lockSource,
|
|
@@ -5543,8 +5590,8 @@ class RegistryResolver {
|
|
|
5543
5590
|
registry: registryContext?.registryUrl
|
|
5544
5591
|
});
|
|
5545
5592
|
}
|
|
5546
|
-
// Update skills.json (project mode only)
|
|
5547
|
-
if (!
|
|
5593
|
+
// Update skills.json (project mode only, skip for effectively-global installs)
|
|
5594
|
+
if (!effectivelyGlobal && save) {
|
|
5548
5595
|
this.config.ensureExists();
|
|
5549
5596
|
const configRef = registryContext?.configRef ?? ref;
|
|
5550
5597
|
this.config.addSkill(skillName, configRef);
|
|
@@ -5664,8 +5711,9 @@ class RegistryResolver {
|
|
|
5664
5711
|
const results = await installer.installToAgents(extractedPath, shortName, targetAgents, {
|
|
5665
5712
|
mode: mode
|
|
5666
5713
|
});
|
|
5667
|
-
// 7. Update lock file (project mode only)
|
|
5668
|
-
|
|
5714
|
+
// 7. Update lock file (project mode only, skip for effectively-global installs)
|
|
5715
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5716
|
+
if (!effectivelyGlobal) this.lockManager.lockSkill(shortName, {
|
|
5669
5717
|
source: `registry:${resolvedParsed.fullName}`,
|
|
5670
5718
|
version,
|
|
5671
5719
|
ref: version,
|
|
@@ -5673,8 +5721,8 @@ class RegistryResolver {
|
|
|
5673
5721
|
commit: resolved.integrity,
|
|
5674
5722
|
registry: resolvedRegistryUrl
|
|
5675
5723
|
});
|
|
5676
|
-
// 8. Update skills.json (project mode only)
|
|
5677
|
-
if (!
|
|
5724
|
+
// 8. Update skills.json (project mode only, skip for effectively-global installs)
|
|
5725
|
+
if (!effectivelyGlobal && save) {
|
|
5678
5726
|
this.config.ensureExists();
|
|
5679
5727
|
// Save with full name for registry skills
|
|
5680
5728
|
this.config.addSkill(shortName, ref);
|
|
@@ -5740,7 +5788,8 @@ class RegistryResolver {
|
|
|
5740
5788
|
registryContext
|
|
5741
5789
|
};
|
|
5742
5790
|
// Save custom registry to skills.json.registries (for reinstall without lock file)
|
|
5743
|
-
|
|
5791
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5792
|
+
if (!effectivelyGlobal && options.registry) {
|
|
5744
5793
|
const registryName = this.deriveRegistryName(options.registry);
|
|
5745
5794
|
if (registryName) {
|
|
5746
5795
|
this.config.ensureExists();
|
|
@@ -5843,8 +5892,9 @@ class RegistryResolver {
|
|
|
5843
5892
|
const metadata = this.getSkillMetadataFromDir(extractedPath);
|
|
5844
5893
|
const skillName = metadata?.name ?? shortName;
|
|
5845
5894
|
const semanticVersion = metadata?.version ?? version;
|
|
5846
|
-
// Update lock file (project mode only)
|
|
5847
|
-
|
|
5895
|
+
// Update lock file (project mode only, skip for effectively-global installs)
|
|
5896
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5897
|
+
if (!effectivelyGlobal) this.lockManager.lockSkill(skillName, {
|
|
5848
5898
|
source: `registry:${parsed.fullName}`,
|
|
5849
5899
|
version: semanticVersion,
|
|
5850
5900
|
ref: version,
|
|
@@ -5852,8 +5902,8 @@ class RegistryResolver {
|
|
|
5852
5902
|
commit: '',
|
|
5853
5903
|
registry: registryUrl
|
|
5854
5904
|
});
|
|
5855
|
-
// Update skills.json (project mode only)
|
|
5856
|
-
if (!
|
|
5905
|
+
// Update skills.json (project mode only, skip for effectively-global installs)
|
|
5906
|
+
if (!effectivelyGlobal && save) {
|
|
5857
5907
|
this.config.ensureExists();
|
|
5858
5908
|
this.config.addSkill(skillName, parsed.fullName);
|
|
5859
5909
|
// Save custom registry to skills.json.registries (for reinstall without lock file)
|
|
@@ -5927,10 +5977,11 @@ class RegistryResolver {
|
|
|
5927
5977
|
installDir: defaults.installDir
|
|
5928
5978
|
});
|
|
5929
5979
|
const results = installer.uninstallFromAgents(name, targetAgents);
|
|
5930
|
-
// Remove from lock file (project mode only)
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5980
|
+
// Remove from lock file (project mode only, skip for effectively-global installs)
|
|
5981
|
+
const effectivelyGlobal = this.isEffectivelyGlobal(targetAgents);
|
|
5982
|
+
if (!effectivelyGlobal) this.lockManager.remove(name);
|
|
5983
|
+
// Remove from skills.json (project mode only, skip for effectively-global installs)
|
|
5984
|
+
if (!effectivelyGlobal && this.config.exists()) this.config.removeSkill(name);
|
|
5934
5985
|
const successCount = Array.from(results.values()).filter((r)=>r).length;
|
|
5935
5986
|
logger_logger.success(`Uninstalled ${name} from ${successCount} agent(s)`);
|
|
5936
5987
|
return results;
|