reskill 1.0.1 → 1.1.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 +7 -4
- package/README.zh-CN.md +7 -4
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/index.js +113 -18
- package/dist/core/installer.d.ts +4 -0
- package/dist/core/installer.d.ts.map +1 -1
- package/dist/core/skill-manager.d.ts +1 -1
- package/dist/core/skill-manager.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -40,10 +40,10 @@ npx reskill@latest <command> # Or use npx directly
|
|
|
40
40
|
|
|
41
41
|
## Commands
|
|
42
42
|
|
|
43
|
-
| Command
|
|
44
|
-
|
|
|
45
|
-
| `init`
|
|
46
|
-
| `install [
|
|
43
|
+
| Command | Description |
|
|
44
|
+
| --------------------- | ----------------------------------------- |
|
|
45
|
+
| `init` | Initialize `skills.json` |
|
|
46
|
+
| `install [skills...]` | Install one or more skills |
|
|
47
47
|
| `list` | List installed skills |
|
|
48
48
|
| `info <skill>` | Show skill details |
|
|
49
49
|
| `update [skill]` | Update skills |
|
|
@@ -74,6 +74,9 @@ npx reskill@latest install gitlab.company.com:team/skill@v1.0.0
|
|
|
74
74
|
|
|
75
75
|
# Default registry (from skills.json)
|
|
76
76
|
npx reskill@latest install user/skill@v1.0.0
|
|
77
|
+
|
|
78
|
+
# Install multiple skills at once
|
|
79
|
+
npx reskill@latest install github:user/skill1 github:user/skill2@v1.0.0
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
## Version Specification
|
package/README.zh-CN.md
CHANGED
|
@@ -40,10 +40,10 @@ npx reskill@latest <command> # 或直接使用 npx
|
|
|
40
40
|
|
|
41
41
|
## 命令
|
|
42
42
|
|
|
43
|
-
| 命令
|
|
44
|
-
|
|
|
45
|
-
| `init`
|
|
46
|
-
| `install [
|
|
43
|
+
| 命令 | 说明 |
|
|
44
|
+
| --------------------- | ----------------------- |
|
|
45
|
+
| `init` | 初始化 `skills.json` |
|
|
46
|
+
| `install [skills...]` | 安装一个或多个 skills |
|
|
47
47
|
| `list` | 列出已安装的 skills |
|
|
48
48
|
| `info <skill>` | 查看 skill 详情 |
|
|
49
49
|
| `update [skill]` | 更新 skills |
|
|
@@ -61,6 +61,9 @@ github:user/skill@v1.0.0 # GitHub 简写
|
|
|
61
61
|
gitlab:group/skill@latest # GitLab 简写
|
|
62
62
|
gitlab.company.com:team/skill@v1.0.0 # 自建实例
|
|
63
63
|
https://github.com/user/repo/tree/main/path # 网页 URL(支持子路径)
|
|
64
|
+
|
|
65
|
+
# 一次安装多个 skills
|
|
66
|
+
reskill install github:user/skill1 github:user/skill2@v1.0.0
|
|
64
67
|
```
|
|
65
68
|
|
|
66
69
|
## 版本规范
|
|
@@ -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;AAwqBpC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,SA+DvB,CAAC;AAEL,eAAe,cAAc,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -519,8 +519,9 @@ function installer_isPathSafe(basePath, targetPath) {
|
|
|
519
519
|
const normalizedTarget = __WEBPACK_EXTERNAL_MODULE_node_path__.normalize(__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(targetPath));
|
|
520
520
|
return normalizedTarget.startsWith(normalizedBase + __WEBPACK_EXTERNAL_MODULE_node_path__.sep) || normalizedTarget === normalizedBase;
|
|
521
521
|
}
|
|
522
|
-
function installer_getCanonicalSkillsDir(isGlobal, cwd) {
|
|
522
|
+
function installer_getCanonicalSkillsDir(isGlobal, cwd, installDir) {
|
|
523
523
|
const baseDir = isGlobal ? (0, __WEBPACK_EXTERNAL_MODULE_node_os__.homedir)() : cwd || process.cwd();
|
|
524
|
+
if (installDir && !isGlobal) return __WEBPACK_EXTERNAL_MODULE_node_path__.join(baseDir, installDir);
|
|
524
525
|
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(baseDir, installer_AGENTS_DIR, installer_SKILLS_SUBDIR);
|
|
525
526
|
}
|
|
526
527
|
function installer_ensureDir(dirPath) {
|
|
@@ -581,13 +582,15 @@ async function installer_createSymlink(target, linkPath) {
|
|
|
581
582
|
class Installer {
|
|
582
583
|
cwd;
|
|
583
584
|
isGlobal;
|
|
585
|
+
installDir;
|
|
584
586
|
constructor(options = {}){
|
|
585
587
|
this.cwd = options.cwd || process.cwd();
|
|
586
588
|
this.isGlobal = options.global || false;
|
|
589
|
+
this.installDir = options.installDir;
|
|
587
590
|
}
|
|
588
591
|
getCanonicalPath(skillName) {
|
|
589
592
|
const sanitized = installer_sanitizeName(skillName);
|
|
590
|
-
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
593
|
+
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd, this.installDir);
|
|
591
594
|
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
592
595
|
}
|
|
593
596
|
getAgentSkillPath(skillName, agentType) {
|
|
@@ -600,7 +603,7 @@ class Installer {
|
|
|
600
603
|
const agent = getAgentConfig(agentType);
|
|
601
604
|
const installMode = options.mode || 'symlink';
|
|
602
605
|
const sanitized = installer_sanitizeName(skillName);
|
|
603
|
-
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
606
|
+
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd, this.installDir);
|
|
604
607
|
const canonicalDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
605
608
|
const agentBase = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
606
609
|
const agentDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(agentBase, sanitized);
|
|
@@ -1288,8 +1291,11 @@ class SkillManager {
|
|
|
1288
1291
|
getSkillPath(name) {
|
|
1289
1292
|
const canonicalPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.getCanonicalSkillsDir(), name);
|
|
1290
1293
|
if (exists(canonicalPath)) return canonicalPath;
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1294
|
+
const installDir = this.getInstallDir();
|
|
1295
|
+
const installPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(installDir, name);
|
|
1296
|
+
if (exists(installPath)) return installPath;
|
|
1297
|
+
const defaults = this.config.getDefaults();
|
|
1298
|
+
if ('.skills' !== defaults.installDir && !this.isGlobal) return installPath;
|
|
1293
1299
|
return canonicalPath;
|
|
1294
1300
|
}
|
|
1295
1301
|
async install(ref, options = {}) {
|
|
@@ -1534,9 +1540,11 @@ class SkillManager {
|
|
|
1534
1540
|
const skillJson = readJson(skillJsonPath);
|
|
1535
1541
|
if (skillJson.version) semanticVersion = skillJson.version;
|
|
1536
1542
|
} catch {}
|
|
1543
|
+
const defaults = this.config.getDefaults();
|
|
1537
1544
|
const installer = new Installer({
|
|
1538
1545
|
cwd: this.projectRoot,
|
|
1539
|
-
global: this.isGlobal
|
|
1546
|
+
global: this.isGlobal,
|
|
1547
|
+
installDir: defaults.installDir
|
|
1540
1548
|
});
|
|
1541
1549
|
const results = await installer.installToAgents(sourcePath, skillName, targetAgents, {
|
|
1542
1550
|
mode: mode
|
|
@@ -1592,9 +1600,11 @@ class SkillManager {
|
|
|
1592
1600
|
return Object.keys(agents);
|
|
1593
1601
|
}
|
|
1594
1602
|
uninstallFromAgents(name, targetAgents) {
|
|
1603
|
+
const defaults = this.config.getDefaults();
|
|
1595
1604
|
const installer = new Installer({
|
|
1596
1605
|
cwd: this.projectRoot,
|
|
1597
|
-
global: this.isGlobal
|
|
1606
|
+
global: this.isGlobal,
|
|
1607
|
+
installDir: defaults.installDir
|
|
1598
1608
|
});
|
|
1599
1609
|
const results = installer.uninstallFromAgents(name, targetAgents);
|
|
1600
1610
|
if (!this.isGlobal) this.lockManager.remove(name);
|
|
@@ -2485,7 +2495,7 @@ function filterValidAgents(storedAgents, validAgents) {
|
|
|
2485
2495
|
const filtered = storedAgents.filter((a)=>validAgents.includes(a));
|
|
2486
2496
|
return filtered.length > 0 ? filtered : void 0;
|
|
2487
2497
|
}
|
|
2488
|
-
function createInstallContext(
|
|
2498
|
+
function createInstallContext(skills, options) {
|
|
2489
2499
|
const configLoader = new ConfigLoader();
|
|
2490
2500
|
const allAgentTypes = Object.keys(agents);
|
|
2491
2501
|
const hasSkillsJson = configLoader.exists();
|
|
@@ -2493,7 +2503,7 @@ function createInstallContext(skill, options) {
|
|
|
2493
2503
|
const storedAgents = filterValidAgents(storedDefaults?.targetAgents, allAgentTypes);
|
|
2494
2504
|
const storedMode = storedDefaults?.installMode;
|
|
2495
2505
|
return {
|
|
2496
|
-
|
|
2506
|
+
skills,
|
|
2497
2507
|
options,
|
|
2498
2508
|
configLoader,
|
|
2499
2509
|
allAgentTypes,
|
|
@@ -2501,7 +2511,8 @@ function createInstallContext(skill, options) {
|
|
|
2501
2511
|
storedAgents,
|
|
2502
2512
|
hasStoredAgents: !!storedAgents && storedAgents.length > 0,
|
|
2503
2513
|
storedMode,
|
|
2504
|
-
isReinstallAll:
|
|
2514
|
+
isReinstallAll: 0 === skills.length,
|
|
2515
|
+
isBatchInstall: skills.length > 1,
|
|
2505
2516
|
skipConfirm: options.yes ?? false
|
|
2506
2517
|
};
|
|
2507
2518
|
}
|
|
@@ -2574,12 +2585,9 @@ async function promptAgentSelection(availableAgents, initialValues, showHint = f
|
|
|
2574
2585
|
return selected;
|
|
2575
2586
|
}
|
|
2576
2587
|
async function resolveInstallScope(ctx) {
|
|
2577
|
-
const { options,
|
|
2588
|
+
const { options, isReinstallAll, skipConfirm } = ctx;
|
|
2578
2589
|
if (void 0 !== options.global) return options.global;
|
|
2579
|
-
if (
|
|
2580
|
-
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.info(`Found ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan('skills.json')}, installing to project`);
|
|
2581
|
-
return false;
|
|
2582
|
-
}
|
|
2590
|
+
if (isReinstallAll) return false;
|
|
2583
2591
|
if (skipConfirm) return false;
|
|
2584
2592
|
const scope = await __WEBPACK_EXTERNAL_MODULE__clack_prompts__.select({
|
|
2585
2593
|
message: 'Installation scope',
|
|
@@ -2677,7 +2685,8 @@ async function installAllSkills(ctx, targetAgents, installMode, spinner) {
|
|
|
2677
2685
|
});
|
|
2678
2686
|
}
|
|
2679
2687
|
async function installSingleSkill(ctx, targetAgents, installGlobally, installMode, spinner) {
|
|
2680
|
-
const {
|
|
2688
|
+
const { skills, options, configLoader, skipConfirm } = ctx;
|
|
2689
|
+
const skill = skills[0];
|
|
2681
2690
|
const cwd = process.cwd();
|
|
2682
2691
|
const summaryLines = [
|
|
2683
2692
|
__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(skill),
|
|
@@ -2715,6 +2724,81 @@ async function installSingleSkill(ctx, targetAgents, installGlobally, installMod
|
|
|
2715
2724
|
});
|
|
2716
2725
|
}
|
|
2717
2726
|
}
|
|
2727
|
+
async function installMultipleSkills(ctx, targetAgents, installGlobally, installMode, spinner) {
|
|
2728
|
+
const { skills, options, configLoader, skipConfirm } = ctx;
|
|
2729
|
+
const summaryLines = [
|
|
2730
|
+
`${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(skills.length)} skills:`,
|
|
2731
|
+
...skills.map((s)=>` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('•')} ${s}`),
|
|
2732
|
+
'',
|
|
2733
|
+
` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('→')} ${formatAgentNames(targetAgents)}`,
|
|
2734
|
+
` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim('Scope:')} ${installGlobally ? 'Global' : 'Project'}${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(', Mode:')} ${installMode}`
|
|
2735
|
+
];
|
|
2736
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.note(summaryLines.join('\n'), 'Installation Summary');
|
|
2737
|
+
if (!skipConfirm) {
|
|
2738
|
+
const confirmed = await __WEBPACK_EXTERNAL_MODULE__clack_prompts__.confirm({
|
|
2739
|
+
message: 'Proceed with installation?'
|
|
2740
|
+
});
|
|
2741
|
+
if (__WEBPACK_EXTERNAL_MODULE__clack_prompts__.isCancel(confirmed) || !confirmed) {
|
|
2742
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.cancel('Installation cancelled');
|
|
2743
|
+
process.exit(0);
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
const skillManager = new SkillManager(void 0, {
|
|
2747
|
+
global: installGlobally
|
|
2748
|
+
});
|
|
2749
|
+
const successfulSkills = [];
|
|
2750
|
+
const failedSkills = [];
|
|
2751
|
+
spinner.start(`Installing ${skills.length} skills in parallel...`);
|
|
2752
|
+
const installPromises = skills.map(async (skillRef)=>{
|
|
2753
|
+
try {
|
|
2754
|
+
const { skill: installed, results } = await skillManager.installToAgents(skillRef, targetAgents, {
|
|
2755
|
+
force: options.force,
|
|
2756
|
+
save: false !== options.save && !installGlobally,
|
|
2757
|
+
mode: installMode
|
|
2758
|
+
});
|
|
2759
|
+
const successful = Array.from(results.values()).filter((r)=>r.success);
|
|
2760
|
+
if (successful.length > 0) return {
|
|
2761
|
+
success: true,
|
|
2762
|
+
skillRef,
|
|
2763
|
+
skill: installed
|
|
2764
|
+
};
|
|
2765
|
+
const firstError = Array.from(results.values()).find((r)=>!r.success)?.error;
|
|
2766
|
+
return {
|
|
2767
|
+
success: false,
|
|
2768
|
+
skillRef,
|
|
2769
|
+
error: firstError || 'Unknown error'
|
|
2770
|
+
};
|
|
2771
|
+
} catch (error) {
|
|
2772
|
+
return {
|
|
2773
|
+
success: false,
|
|
2774
|
+
skillRef,
|
|
2775
|
+
error: error.message
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2778
|
+
});
|
|
2779
|
+
const results = await Promise.all(installPromises);
|
|
2780
|
+
spinner.stop(`Processed ${skills.length} skills`);
|
|
2781
|
+
for (const result of results)if (result.success) {
|
|
2782
|
+
successfulSkills.push(result.skill);
|
|
2783
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.success(`${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('✓')} ${result.skill.name}@${result.skill.version}`);
|
|
2784
|
+
} else {
|
|
2785
|
+
failedSkills.push({
|
|
2786
|
+
ref: result.skillRef,
|
|
2787
|
+
error: result.error
|
|
2788
|
+
});
|
|
2789
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.error(`${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].red('✗')} ${result.skillRef}`);
|
|
2790
|
+
}
|
|
2791
|
+
console.log();
|
|
2792
|
+
displayBatchInstallResults(successfulSkills, failedSkills, targetAgents.length);
|
|
2793
|
+
if (!installGlobally && successfulSkills.length > 0 && configLoader.exists()) {
|
|
2794
|
+
configLoader.reload();
|
|
2795
|
+
configLoader.updateDefaults({
|
|
2796
|
+
targetAgents,
|
|
2797
|
+
installMode
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2800
|
+
if (failedSkills.length > 0) process.exit(1);
|
|
2801
|
+
}
|
|
2718
2802
|
function displayInstallSummary(info) {
|
|
2719
2803
|
const summaryLines = [
|
|
2720
2804
|
`${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(info.skillCount)} skill(s) → ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].cyan(info.agentCount)} agent(s)`,
|
|
@@ -2726,6 +2810,16 @@ function displayInstallResults(skillCount, agentCount, totalInstalled, totalFail
|
|
|
2726
2810
|
if (0 === totalFailed) __WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.success(`Installed ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green(skillCount)} skill(s) to ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green(agentCount)} agent(s)`);
|
|
2727
2811
|
else __WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.warn(`Installed ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green(totalInstalled)} successfully, ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].red(totalFailed)} failed`);
|
|
2728
2812
|
}
|
|
2813
|
+
function displayBatchInstallResults(successfulSkills, failedSkills, agentCount) {
|
|
2814
|
+
if (successfulSkills.length > 0) {
|
|
2815
|
+
const resultLines = successfulSkills.map((s)=>` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('✓')} ${s.name}@${s.version}`);
|
|
2816
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.note(resultLines.join('\n'), __WEBPACK_EXTERNAL_MODULE_chalk__["default"].green(`Installed ${successfulSkills.length} skill(s) to ${agentCount} agent(s)`));
|
|
2817
|
+
}
|
|
2818
|
+
if (failedSkills.length > 0) {
|
|
2819
|
+
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.error(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].red(`Failed to install ${failedSkills.length} skill(s):`));
|
|
2820
|
+
for (const { ref, error } of failedSkills)__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.message(` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].red('✗')} ${ref}: ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(error)}`);
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2729
2823
|
function displaySingleSkillResults(installed, successful, failed, cwd) {
|
|
2730
2824
|
if (successful.length > 0) {
|
|
2731
2825
|
const resultLines = [];
|
|
@@ -2754,12 +2848,12 @@ function displaySingleSkillResults(installed, successful, failed, cwd) {
|
|
|
2754
2848
|
for (const [agent, result] of failed)__WEBPACK_EXTERNAL_MODULE__clack_prompts__.log.message(` ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].red('✗')} ${agents[agent].displayName}: ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].dim(result.error)}`);
|
|
2755
2849
|
}
|
|
2756
2850
|
}
|
|
2757
|
-
const installCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('install').alias('i').description('Install
|
|
2851
|
+
const installCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('install').alias('i').description('Install one or more skills, or all skills from skills.json').argument('[skills...]', 'Skill references (e.g., github:user/skill@v1.0.0 or git@github.com:user/repo.git)').option('-f, --force', 'Force reinstall even if already installed').option('-g, --global', 'Install globally to user home directory').option('--no-save', 'Do not save to skills.json').option('-a, --agent <agents...>', 'Specify target agents (e.g., cursor, claude-code)').option('--mode <mode>', 'Installation mode: symlink or copy').option('-y, --yes', 'Skip confirmation prompts').option('--all', 'Install to all agents (implies -y -g)').action(async (skills, options)=>{
|
|
2758
2852
|
if (options.all) {
|
|
2759
2853
|
options.yes = true;
|
|
2760
2854
|
options.global = true;
|
|
2761
2855
|
}
|
|
2762
|
-
const ctx = createInstallContext(
|
|
2856
|
+
const ctx = createInstallContext(skills, options);
|
|
2763
2857
|
console.log();
|
|
2764
2858
|
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.intro(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].bgCyan.black(' reskill '));
|
|
2765
2859
|
try {
|
|
@@ -2772,6 +2866,7 @@ const installCommand = new __WEBPACK_EXTERNAL_MODULE_commander__.Command('instal
|
|
|
2772
2866
|
}
|
|
2773
2867
|
const installMode = await resolveInstallMode(ctx);
|
|
2774
2868
|
if (ctx.isReinstallAll) await installAllSkills(ctx, targetAgents, installMode, spinner);
|
|
2869
|
+
else if (ctx.isBatchInstall) await installMultipleSkills(ctx, targetAgents, installGlobally, installMode, spinner);
|
|
2775
2870
|
else await installSingleSkill(ctx, targetAgents, installGlobally, installMode, spinner);
|
|
2776
2871
|
console.log();
|
|
2777
2872
|
__WEBPACK_EXTERNAL_MODULE__clack_prompts__.outro(__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('Done!'));
|
package/dist/core/installer.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface InstallerOptions {
|
|
|
39
39
|
cwd?: string;
|
|
40
40
|
/** Installation mode */
|
|
41
41
|
mode?: InstallMode;
|
|
42
|
+
/** Custom installation directory (relative to cwd), overrides default .agents/skills */
|
|
43
|
+
installDir?: string;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* Default files to exclude when copying skills
|
|
@@ -55,9 +57,11 @@ export declare const EXCLUDE_PREFIX = "_";
|
|
|
55
57
|
export declare class Installer {
|
|
56
58
|
private cwd;
|
|
57
59
|
private isGlobal;
|
|
60
|
+
private installDir?;
|
|
58
61
|
constructor(options?: {
|
|
59
62
|
cwd?: string;
|
|
60
63
|
global?: boolean;
|
|
64
|
+
installDir?: string;
|
|
61
65
|
});
|
|
62
66
|
/**
|
|
63
67
|
* Get canonical installation path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/core/installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,gDAAgD;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB;IACpB,KA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-
* Checks canonical location first, then falls back to
|
|
56
|
+
* Checks canonical location first, then falls back to configured installDir.
|
|
57
57
|
*/
|
|
58
58
|
getSkillPath(name: string): string;
|
|
59
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-manager.d.ts","sourceRoot":"","sources":["../../src/core/skill-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAanF,OAAO,
|
|
1
|
+
{"version":3,"file":"skill-manager.d.ts","sourceRoot":"","sources":["../../src/core/skill-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAanF,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAc;IAC9B,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;IAS/D;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;OAKG;IACH,aAAa,IAAI,MAAM;IAOvB;;;;;;OAMG;IACH,qBAAqB,IAAI,MAAM;IAM/B;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAA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,aAAa,CAAC,CAAC;KACxC,CAAC;IA4FF;;;;;;;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
|
@@ -470,8 +470,9 @@ function installer_isPathSafe(basePath, targetPath) {
|
|
|
470
470
|
const normalizedTarget = __WEBPACK_EXTERNAL_MODULE_node_path__.normalize(__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(targetPath));
|
|
471
471
|
return normalizedTarget.startsWith(normalizedBase + __WEBPACK_EXTERNAL_MODULE_node_path__.sep) || normalizedTarget === normalizedBase;
|
|
472
472
|
}
|
|
473
|
-
function installer_getCanonicalSkillsDir(isGlobal, cwd) {
|
|
473
|
+
function installer_getCanonicalSkillsDir(isGlobal, cwd, installDir) {
|
|
474
474
|
const baseDir = isGlobal ? (0, __WEBPACK_EXTERNAL_MODULE_node_os__.homedir)() : cwd || process.cwd();
|
|
475
|
+
if (installDir && !isGlobal) return __WEBPACK_EXTERNAL_MODULE_node_path__.join(baseDir, installDir);
|
|
475
476
|
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(baseDir, installer_AGENTS_DIR, installer_SKILLS_SUBDIR);
|
|
476
477
|
}
|
|
477
478
|
function installer_ensureDir(dirPath) {
|
|
@@ -532,13 +533,15 @@ async function installer_createSymlink(target, linkPath) {
|
|
|
532
533
|
class Installer {
|
|
533
534
|
cwd;
|
|
534
535
|
isGlobal;
|
|
536
|
+
installDir;
|
|
535
537
|
constructor(options = {}){
|
|
536
538
|
this.cwd = options.cwd || process.cwd();
|
|
537
539
|
this.isGlobal = options.global || false;
|
|
540
|
+
this.installDir = options.installDir;
|
|
538
541
|
}
|
|
539
542
|
getCanonicalPath(skillName) {
|
|
540
543
|
const sanitized = installer_sanitizeName(skillName);
|
|
541
|
-
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
544
|
+
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd, this.installDir);
|
|
542
545
|
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
543
546
|
}
|
|
544
547
|
getAgentSkillPath(skillName, agentType) {
|
|
@@ -551,7 +554,7 @@ class Installer {
|
|
|
551
554
|
const agent = getAgentConfig(agentType);
|
|
552
555
|
const installMode = options.mode || 'symlink';
|
|
553
556
|
const sanitized = installer_sanitizeName(skillName);
|
|
554
|
-
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
557
|
+
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd, this.installDir);
|
|
555
558
|
const canonicalDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
556
559
|
const agentBase = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
557
560
|
const agentDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(agentBase, sanitized);
|
|
@@ -1280,8 +1283,11 @@ class SkillManager {
|
|
|
1280
1283
|
getSkillPath(name) {
|
|
1281
1284
|
const canonicalPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.getCanonicalSkillsDir(), name);
|
|
1282
1285
|
if (exists(canonicalPath)) return canonicalPath;
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1286
|
+
const installDir = this.getInstallDir();
|
|
1287
|
+
const installPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(installDir, name);
|
|
1288
|
+
if (exists(installPath)) return installPath;
|
|
1289
|
+
const defaults = this.config.getDefaults();
|
|
1290
|
+
if ('.skills' !== defaults.installDir && !this.isGlobal) return installPath;
|
|
1285
1291
|
return canonicalPath;
|
|
1286
1292
|
}
|
|
1287
1293
|
async install(ref, options = {}) {
|
|
@@ -1526,9 +1532,11 @@ class SkillManager {
|
|
|
1526
1532
|
const skillJson = readJson(skillJsonPath);
|
|
1527
1533
|
if (skillJson.version) semanticVersion = skillJson.version;
|
|
1528
1534
|
} catch {}
|
|
1535
|
+
const defaults = this.config.getDefaults();
|
|
1529
1536
|
const installer = new Installer({
|
|
1530
1537
|
cwd: this.projectRoot,
|
|
1531
|
-
global: this.isGlobal
|
|
1538
|
+
global: this.isGlobal,
|
|
1539
|
+
installDir: defaults.installDir
|
|
1532
1540
|
});
|
|
1533
1541
|
const results = await installer.installToAgents(sourcePath, skillName, targetAgents, {
|
|
1534
1542
|
mode: mode
|
|
@@ -1584,9 +1592,11 @@ class SkillManager {
|
|
|
1584
1592
|
return Object.keys(agents);
|
|
1585
1593
|
}
|
|
1586
1594
|
uninstallFromAgents(name, targetAgents) {
|
|
1595
|
+
const defaults = this.config.getDefaults();
|
|
1587
1596
|
const installer = new Installer({
|
|
1588
1597
|
cwd: this.projectRoot,
|
|
1589
|
-
global: this.isGlobal
|
|
1598
|
+
global: this.isGlobal,
|
|
1599
|
+
installDir: defaults.installDir
|
|
1590
1600
|
});
|
|
1591
1601
|
const results = installer.uninstallFromAgents(name, targetAgents);
|
|
1592
1602
|
if (!this.isGlobal) this.lockManager.remove(name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reskill",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "AI Skills Package Manager - Git-based skills management for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
|
-
"url": "https://github.com/kanyun-
|
|
42
|
+
"url": "https://github.com/kanyun-inc/reskill.git"
|
|
43
43
|
},
|
|
44
|
-
"homepage": "https://github.com/kanyun-
|
|
44
|
+
"homepage": "https://github.com/kanyun-inc/reskill#readme",
|
|
45
45
|
"bugs": {
|
|
46
|
-
"url": "https://github.com/kanyun-
|
|
46
|
+
"url": "https://github.com/kanyun-inc/reskill/issues"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@clack/prompts": "^0.9.1",
|