@cannbot-ai/install-helper 1.1.5-beta.0 → 1.1.5
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/index.js +21 -14
- package/dist/index.js.map +1 -1
- package/dist/locales/en_US.json +0 -1
- package/dist/locales/zh_CN.json +0 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -627,8 +627,8 @@ function findPlugin(query) {
|
|
|
627
627
|
(p) => p.aliases.some((a) => a === normalized)
|
|
628
628
|
);
|
|
629
629
|
if (aliasMatch) return aliasMatch;
|
|
630
|
-
const
|
|
631
|
-
if (
|
|
630
|
+
const prefixMatches = PLUGIN_REGISTRY.filter((p) => p.id.startsWith(normalized));
|
|
631
|
+
if (prefixMatches.length === 1) return prefixMatches[0];
|
|
632
632
|
return void 0;
|
|
633
633
|
}
|
|
634
634
|
function getAllPlugins() {
|
|
@@ -791,7 +791,6 @@ var zh_CN_default = {
|
|
|
791
791
|
config_corrupted: "\u914D\u7F6E\u6587\u4EF6\u5DF2\u635F\u574F\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E",
|
|
792
792
|
record_corrupted: "\u5B89\u88C5\u8BB0\u5F55\u5DF2\u635F\u574F\uFF1A{file}",
|
|
793
793
|
skill_record_corrupted: "Skill \u5B89\u88C5\u8BB0\u5F55\u5DF2\u635F\u574F",
|
|
794
|
-
plugin_yaml_error: "\u63D2\u4EF6\u914D\u7F6E\u89E3\u6790\u5931\u8D25\uFF1A{file}",
|
|
795
794
|
record_write_failed: "\u5B89\u88C5\u8BB0\u5F55\u5199\u5165\u5931\u8D25\uFF0C\u5378\u8F7D\u65F6\u53EF\u80FD\u65E0\u6CD5\u81EA\u52A8\u6E05\u7406",
|
|
796
795
|
install_config_failed: "\u914D\u7F6E\u6587\u4EF6\u5B89\u88C5\u5931\u8D25: {error}",
|
|
797
796
|
install_clone_failed: "git clone \u5931\u8D25: {url}\uFF0C\u8BF7\u624B\u52A8\u514B\u9686: git clone {url} {dir}",
|
|
@@ -983,7 +982,6 @@ var en_US_default = {
|
|
|
983
982
|
config_corrupted: "Config file corrupted, using defaults",
|
|
984
983
|
record_corrupted: "Install record corrupted: {file}",
|
|
985
984
|
skill_record_corrupted: "Skill install record corrupted",
|
|
986
|
-
plugin_yaml_error: "Plugin config parse error: {file}",
|
|
987
985
|
record_write_failed: "Install record write failed, uninstall may not work properly",
|
|
988
986
|
install_config_failed: "Failed to install config file: {error}",
|
|
989
987
|
install_clone_failed: "git clone failed: {url}, clone manually: git clone {url} {dir}",
|
|
@@ -1525,7 +1523,7 @@ import { join as join6 } from "path";
|
|
|
1525
1523
|
import { parse, stringify } from "yaml";
|
|
1526
1524
|
|
|
1527
1525
|
// src/utils/fs.ts
|
|
1528
|
-
import { writeFileSync, renameSync, existsSync as existsSync6 } from "fs";
|
|
1526
|
+
import { writeFileSync, renameSync, existsSync as existsSync6, unlinkSync as unlinkSync2 } from "fs";
|
|
1529
1527
|
import { dirname as dirname2 } from "path";
|
|
1530
1528
|
function atomicWriteFileSync(filePath, data, encoding = "utf-8") {
|
|
1531
1529
|
const dir = dirname2(filePath);
|
|
@@ -1534,7 +1532,15 @@ function atomicWriteFileSync(filePath, data, encoding = "utf-8") {
|
|
|
1534
1532
|
}
|
|
1535
1533
|
const tmpPath = `${filePath}.tmp`;
|
|
1536
1534
|
writeFileSync(tmpPath, data, encoding);
|
|
1537
|
-
|
|
1535
|
+
try {
|
|
1536
|
+
renameSync(tmpPath, filePath);
|
|
1537
|
+
} catch (e) {
|
|
1538
|
+
try {
|
|
1539
|
+
unlinkSync2(tmpPath);
|
|
1540
|
+
} catch {
|
|
1541
|
+
}
|
|
1542
|
+
throw e;
|
|
1543
|
+
}
|
|
1538
1544
|
}
|
|
1539
1545
|
|
|
1540
1546
|
// src/utils/config.ts
|
|
@@ -2516,7 +2522,7 @@ import { join as join13, basename as basename2 } from "path";
|
|
|
2516
2522
|
import { execa as execa4, execaSync } from "execa";
|
|
2517
2523
|
|
|
2518
2524
|
// src/core/record.ts
|
|
2519
|
-
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync7, unlinkSync as
|
|
2525
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync7, unlinkSync as unlinkSync3 } from "fs";
|
|
2520
2526
|
import { join as join10 } from "path";
|
|
2521
2527
|
function getInstallsDir() {
|
|
2522
2528
|
return join10(getCannbotConfigDir(), "installs");
|
|
@@ -2548,7 +2554,7 @@ function writeRecord(record) {
|
|
|
2548
2554
|
function deleteRecord(pluginId) {
|
|
2549
2555
|
const recordPath = getRecordPath(pluginId);
|
|
2550
2556
|
if (existsSync11(recordPath)) {
|
|
2551
|
-
|
|
2557
|
+
unlinkSync3(recordPath);
|
|
2552
2558
|
}
|
|
2553
2559
|
}
|
|
2554
2560
|
function scanInstalledFiles(pluginId, displayName, tool, level, installPath, configRoot, manifest, externalRepoNames) {
|
|
@@ -2687,7 +2693,7 @@ function getInstalledSkills(tool, level, installPath) {
|
|
|
2687
2693
|
}
|
|
2688
2694
|
|
|
2689
2695
|
// src/core/backup.ts
|
|
2690
|
-
import { existsSync as existsSync12, copyFileSync, readdirSync as readdirSync3, unlinkSync as
|
|
2696
|
+
import { existsSync as existsSync12, copyFileSync, readdirSync as readdirSync3, unlinkSync as unlinkSync4 } from "fs";
|
|
2691
2697
|
import { join as join11 } from "path";
|
|
2692
2698
|
function detectCurrentPlugin(configRoot, tool, installPath) {
|
|
2693
2699
|
const manifests = readAllManifests(configRoot);
|
|
@@ -2786,7 +2792,7 @@ function restoreBackup(backupPath, configRoot, tool) {
|
|
|
2786
2792
|
function deleteBackup(backupPath) {
|
|
2787
2793
|
try {
|
|
2788
2794
|
if (existsSync12(backupPath)) {
|
|
2789
|
-
|
|
2795
|
+
unlinkSync4(backupPath);
|
|
2790
2796
|
return true;
|
|
2791
2797
|
}
|
|
2792
2798
|
return false;
|
|
@@ -2942,6 +2948,7 @@ async function installExternalRepos(repos, repoPath, configRoot, installPath, le
|
|
|
2942
2948
|
await execa3("git", ["pull", "--quiet"], { cwd: targetDir, timeout: 12e4 });
|
|
2943
2949
|
} catch {
|
|
2944
2950
|
logger.warn(t("external_repo_update_failed").replace("{dir}", repo.dir));
|
|
2951
|
+
continue;
|
|
2945
2952
|
}
|
|
2946
2953
|
} else if (!existsSync13(targetDir)) {
|
|
2947
2954
|
const args = ["clone"];
|
|
@@ -3949,7 +3956,7 @@ async function listCommand() {
|
|
|
3949
3956
|
|
|
3950
3957
|
// src/commands/doctor.ts
|
|
3951
3958
|
import chalk8 from "chalk";
|
|
3952
|
-
import { existsSync as existsSync17, readdirSync as readdirSync5, lstatSync as lstatSync2, unlinkSync as
|
|
3959
|
+
import { existsSync as existsSync17, readdirSync as readdirSync5, lstatSync as lstatSync2, unlinkSync as unlinkSync5, mkdirSync as mkdirSync7 } from "fs";
|
|
3953
3960
|
import { join as join16 } from "path";
|
|
3954
3961
|
async function doctorCommand(options = {}) {
|
|
3955
3962
|
console.log();
|
|
@@ -4105,7 +4112,7 @@ function fixBrokenLinks(dir) {
|
|
|
4105
4112
|
const stats = lstatSync2(fullPath);
|
|
4106
4113
|
if (stats.isSymbolicLink()) {
|
|
4107
4114
|
if (!existsSync17(fullPath)) {
|
|
4108
|
-
|
|
4115
|
+
unlinkSync5(fullPath);
|
|
4109
4116
|
fixed++;
|
|
4110
4117
|
}
|
|
4111
4118
|
}
|
|
@@ -4475,7 +4482,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
|
|
|
4475
4482
|
}
|
|
4476
4483
|
|
|
4477
4484
|
// src/commands/uninstall.ts
|
|
4478
|
-
import { existsSync as existsSync18, unlinkSync as
|
|
4485
|
+
import { existsSync as existsSync18, unlinkSync as unlinkSync6, rmdirSync, readdirSync as readdirSync6 } from "fs";
|
|
4479
4486
|
import { resolve, basename as basename3, sep } from "path";
|
|
4480
4487
|
import chalk11 from "chalk";
|
|
4481
4488
|
async function uninstallCommand(names, options) {
|
|
@@ -4518,7 +4525,7 @@ async function uninstallCommand(names, options) {
|
|
|
4518
4525
|
if (!isSafePath(filePath)) continue;
|
|
4519
4526
|
try {
|
|
4520
4527
|
if (existsSync18(filePath) || isSymlink(filePath)) {
|
|
4521
|
-
|
|
4528
|
+
unlinkSync6(filePath);
|
|
4522
4529
|
const name = basename3(filePath);
|
|
4523
4530
|
logger.step(` ${t("uninstall_remove_label")}: ${name}`);
|
|
4524
4531
|
removedFiles++;
|