@cannbot-ai/install-helper 0.0.2-beta.54 → 0.0.2-beta.56
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 +43 -8
- package/dist/index.js.map +1 -1
- package/dist/locales/en_US.json +1 -0
- package/dist/locales/zh_CN.json +1 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -88,6 +88,7 @@ var zh_CN_default = {
|
|
|
88
88
|
error_script_not_found: "\u672A\u627E\u5230\u5B89\u88C5\u811A\u672C: {path}",
|
|
89
89
|
error_unknown: "\u672A\u77E5\u9519\u8BEF",
|
|
90
90
|
error_not_installed: "\u672A\u5B89\u88C5",
|
|
91
|
+
error_no_shell: "\u672A\u627E\u5230 bash \u6216 sh\uFF0C\u65E0\u6CD5\u6267\u884C\u5B89\u88C5\u811A\u672C\u3002\u8BF7\u5B89\u88C5 Git Bash \u6216 WSL",
|
|
91
92
|
error_symlink_windows: "\u521B\u5EFA\u7B26\u53F7\u94FE\u63A5\u5931\u8D25\uFF0C\u8BF7\u4EE5\u7BA1\u7406\u5458\u8EAB\u4EFD\u8FD0\u884C\u6216\u5F00\u542F Windows \u5F00\u53D1\u8005\u6A21\u5F0F",
|
|
92
93
|
quick_start: "\u542F\u52A8\u547D\u4EE4",
|
|
93
94
|
quick_start_hint: "\u8BD5\u8BD5\u8F93\u5165: \u5E2E\u6211\u5F00\u53D1\u4E00\u4E2A Abs \u7B97\u5B50",
|
|
@@ -270,6 +271,7 @@ var en_US_default = {
|
|
|
270
271
|
error_script_not_found: "Script not found: {path}",
|
|
271
272
|
error_unknown: "Unknown error",
|
|
272
273
|
error_not_installed: "Not installed",
|
|
274
|
+
error_no_shell: "bash or sh not found, cannot execute install script. Please install Git Bash or WSL",
|
|
273
275
|
error_symlink_windows: "Failed to create symlink, please run as administrator or enable Windows Developer Mode",
|
|
274
276
|
quick_start: "Launch command",
|
|
275
277
|
quick_start_hint: "Try: help me develop an Abs operator",
|
|
@@ -2367,7 +2369,7 @@ function createRepositoryManager(customPath) {
|
|
|
2367
2369
|
// src/core/installer.ts
|
|
2368
2370
|
import { existsSync as existsSync13 } from "fs";
|
|
2369
2371
|
import { join as join12 } from "path";
|
|
2370
|
-
import { execa as execa4 } from "execa";
|
|
2372
|
+
import { execa as execa4, execaSync } from "execa";
|
|
2371
2373
|
|
|
2372
2374
|
// src/core/record.ts
|
|
2373
2375
|
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync7, unlinkSync as unlinkSync2 } from "fs";
|
|
@@ -2936,6 +2938,18 @@ async function installViaManifest(plugin, repoPath, tool, level, installPath) {
|
|
|
2936
2938
|
}
|
|
2937
2939
|
|
|
2938
2940
|
// src/core/installer.ts
|
|
2941
|
+
function findShell() {
|
|
2942
|
+
const candidates = process.platform === "win32" ? ["bash", "sh"] : ["bash", "sh"];
|
|
2943
|
+
for (const cmd of candidates) {
|
|
2944
|
+
try {
|
|
2945
|
+
const detectCmd = process.platform === "win32" ? "where" : "which";
|
|
2946
|
+
execaSync(detectCmd, [cmd], { timeout: 3e3 });
|
|
2947
|
+
return cmd;
|
|
2948
|
+
} catch {
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
return null;
|
|
2952
|
+
}
|
|
2939
2953
|
async function installPlugin(opts) {
|
|
2940
2954
|
const plugin = getPluginById(opts.pluginId);
|
|
2941
2955
|
if (!plugin) {
|
|
@@ -3060,7 +3074,17 @@ async function installPlugin(opts) {
|
|
|
3060
3074
|
args.push(opts.installPath);
|
|
3061
3075
|
}
|
|
3062
3076
|
try {
|
|
3063
|
-
const shell =
|
|
3077
|
+
const shell = findShell();
|
|
3078
|
+
if (!shell) {
|
|
3079
|
+
return {
|
|
3080
|
+
success: false,
|
|
3081
|
+
pluginId: opts.pluginId,
|
|
3082
|
+
skillsCount: 0,
|
|
3083
|
+
agentsCount: 0,
|
|
3084
|
+
errors: [t("error_no_shell")],
|
|
3085
|
+
warnings: []
|
|
3086
|
+
};
|
|
3087
|
+
}
|
|
3064
3088
|
const execOptions = {
|
|
3065
3089
|
cwd,
|
|
3066
3090
|
timeout: 3e5,
|
|
@@ -4191,7 +4215,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
|
|
|
4191
4215
|
|
|
4192
4216
|
// src/commands/uninstall.ts
|
|
4193
4217
|
import { existsSync as existsSync17, unlinkSync as unlinkSync7, rmdirSync as rmdirSync2, readdirSync as readdirSync6 } from "fs";
|
|
4194
|
-
import { resolve, basename as basename2 } from "path";
|
|
4218
|
+
import { resolve, basename as basename2, sep } from "path";
|
|
4195
4219
|
import chalk11 from "chalk";
|
|
4196
4220
|
async function uninstallCommand(names, options) {
|
|
4197
4221
|
const tool = options.tool ? validateTool(options.tool) : "opencode";
|
|
@@ -4225,7 +4249,7 @@ async function uninstallCommand(names, options) {
|
|
|
4225
4249
|
const allowedBases = [resolve(configRoot), resolve(record.installPath)];
|
|
4226
4250
|
const isSafePath = (p) => {
|
|
4227
4251
|
const resolved = resolve(p);
|
|
4228
|
-
return allowedBases.some((base) => resolved === base || resolved.startsWith(base +
|
|
4252
|
+
return allowedBases.some((base) => resolved === base || resolved.startsWith(base + sep));
|
|
4229
4253
|
};
|
|
4230
4254
|
let removedFiles = 0;
|
|
4231
4255
|
let removedDirs = 0;
|
|
@@ -4541,17 +4565,28 @@ function createCLI() {
|
|
|
4541
4565
|
}
|
|
4542
4566
|
|
|
4543
4567
|
// src/index.ts
|
|
4568
|
+
function isExitError(error) {
|
|
4569
|
+
if (!error) return false;
|
|
4570
|
+
return error.name === "ExitPromptError" || error.message?.includes("force closed") || error.message?.includes("SIGINT") || error.constructor?.name === "ExitPromptError";
|
|
4571
|
+
}
|
|
4572
|
+
function handleExit(error) {
|
|
4573
|
+
if (isExitError(error)) {
|
|
4574
|
+
console.log("\n" + t("init_cancelled"));
|
|
4575
|
+
process.exit(0);
|
|
4576
|
+
}
|
|
4577
|
+
}
|
|
4544
4578
|
process.on("SIGINT", () => {
|
|
4545
4579
|
console.log("\n" + t("init_cancelled"));
|
|
4546
4580
|
process.exit(0);
|
|
4547
4581
|
});
|
|
4548
4582
|
process.on("uncaughtException", (error) => {
|
|
4549
|
-
|
|
4550
|
-
console.log("\n" + t("init_cancelled"));
|
|
4551
|
-
process.exit(0);
|
|
4552
|
-
}
|
|
4583
|
+
handleExit(error);
|
|
4553
4584
|
throw error;
|
|
4554
4585
|
});
|
|
4586
|
+
process.on("unhandledRejection", (error) => {
|
|
4587
|
+
handleExit(error);
|
|
4588
|
+
process.exit(1);
|
|
4589
|
+
});
|
|
4555
4590
|
var program = createCLI();
|
|
4556
4591
|
program.parse();
|
|
4557
4592
|
//# sourceMappingURL=index.js.map
|