@cannbot-ai/install-helper 0.0.2-beta.74 → 0.0.2-beta.75
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 -1
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/install.ps1 +40 -6
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ curl -fsSL https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.sh | b
|
|
|
15
15
|
### Windows
|
|
16
16
|
|
|
17
17
|
```powershell
|
|
18
|
-
|
|
18
|
+
iwr -useb https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.ps1 | iex
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
### npm(全平台,需要 Node.js 18+)
|
package/dist/index.js
CHANGED
|
@@ -3163,8 +3163,8 @@ async function installPlugin(opts) {
|
|
|
3163
3163
|
}
|
|
3164
3164
|
|
|
3165
3165
|
// src/core/skill-installer.ts
|
|
3166
|
-
import { existsSync as existsSync14, mkdirSync as mkdirSync6, symlinkSync as symlinkSync2, unlinkSync as unlinkSync5, readdirSync as readdirSync4,
|
|
3167
|
-
import { join as join13, dirname as dirname6 } from "path";
|
|
3166
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync6, symlinkSync as symlinkSync2, unlinkSync as unlinkSync5, readdirSync as readdirSync4, rmSync as rmSync2, realpathSync as realpathSync2 } from "fs";
|
|
3167
|
+
import { join as join13, dirname as dirname6, isAbsolute } from "path";
|
|
3168
3168
|
import { select as select3, checkbox, Separator as Separator2 } from "@inquirer/prompts";
|
|
3169
3169
|
import chalk5 from "chalk";
|
|
3170
3170
|
import Table from "cli-table3";
|
|
@@ -3191,6 +3191,17 @@ async function installSkills(skillIds, tool, level, repoPath) {
|
|
|
3191
3191
|
}
|
|
3192
3192
|
try {
|
|
3193
3193
|
const resolvedSource = realpathSync2(sourcePath);
|
|
3194
|
+
if (isSymlink(targetPath)) {
|
|
3195
|
+
try {
|
|
3196
|
+
const currentTarget = realpathSync2(targetPath);
|
|
3197
|
+
if (currentTarget === resolvedSource) {
|
|
3198
|
+
results.push({ skillId, success: true });
|
|
3199
|
+
installedIds.push(skillId);
|
|
3200
|
+
continue;
|
|
3201
|
+
}
|
|
3202
|
+
} catch {
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3194
3205
|
if (existsSync14(targetPath) || isSymlink(targetPath)) {
|
|
3195
3206
|
unlinkSync5(targetPath);
|
|
3196
3207
|
}
|
|
@@ -3239,7 +3250,7 @@ async function uninstallSkills(skillIds, tool, level) {
|
|
|
3239
3250
|
try {
|
|
3240
3251
|
const entries = readdirSync4(skillsDir);
|
|
3241
3252
|
if (entries.length === 0) {
|
|
3242
|
-
|
|
3253
|
+
rmSync2(skillsDir, { recursive: true });
|
|
3243
3254
|
logger.step(` ${t("uninstall_clean_empty_dir")}: skills/`);
|
|
3244
3255
|
}
|
|
3245
3256
|
} catch {
|
|
@@ -3418,7 +3429,7 @@ function listAllSkills() {
|
|
|
3418
3429
|
}
|
|
3419
3430
|
function resolveSkillSourcePath(skill, repoPath) {
|
|
3420
3431
|
if (skill.filePath) {
|
|
3421
|
-
const absPath = skill.filePath
|
|
3432
|
+
const absPath = isAbsolute(skill.filePath) ? skill.filePath : join13(repoPath, skill.filePath);
|
|
3422
3433
|
if (existsSync14(absPath)) {
|
|
3423
3434
|
return dirname6(absPath);
|
|
3424
3435
|
}
|
|
@@ -4232,7 +4243,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
|
|
|
4232
4243
|
}
|
|
4233
4244
|
|
|
4234
4245
|
// src/commands/uninstall.ts
|
|
4235
|
-
import { existsSync as existsSync17, unlinkSync as unlinkSync7, rmdirSync
|
|
4246
|
+
import { existsSync as existsSync17, unlinkSync as unlinkSync7, rmdirSync, readdirSync as readdirSync6 } from "fs";
|
|
4236
4247
|
import { resolve, basename as basename3, sep } from "path";
|
|
4237
4248
|
import chalk11 from "chalk";
|
|
4238
4249
|
async function uninstallCommand(names, options) {
|
|
@@ -4292,7 +4303,7 @@ async function uninstallCommand(names, options) {
|
|
|
4292
4303
|
if (existsSync17(dirPath)) {
|
|
4293
4304
|
const entries = readdirSync6(dirPath);
|
|
4294
4305
|
if (entries.length === 0) {
|
|
4295
|
-
|
|
4306
|
+
rmdirSync(dirPath);
|
|
4296
4307
|
const name = basename3(dirPath);
|
|
4297
4308
|
logger.step(` ${t("uninstall_clean_empty_dir")}: ${name}/`);
|
|
4298
4309
|
removedDirs++;
|