@cannbot-ai/install-helper 1.1.6-beta.10 → 1.1.6-beta.12
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 +39 -8
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -4995,7 +4995,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
|
|
|
4995
4995
|
|
|
4996
4996
|
// src/commands/uninstall.ts
|
|
4997
4997
|
init_registry();
|
|
4998
|
-
import { existsSync as existsSync18, unlinkSync as unlinkSync6, rmdirSync, readdirSync as readdirSync7 } from "fs";
|
|
4998
|
+
import { existsSync as existsSync18, unlinkSync as unlinkSync6, rmdirSync, readdirSync as readdirSync7, readFileSync as readFileSync9 } from "fs";
|
|
4999
4999
|
import { resolve, basename as basename3, sep, join as join18 } from "path";
|
|
5000
5000
|
import chalk11 from "chalk";
|
|
5001
5001
|
import { select as select5, checkbox as checkbox2, Separator as Separator4, confirm as confirm3 } from "@inquirer/prompts";
|
|
@@ -5008,6 +5008,8 @@ init_manifest();
|
|
|
5008
5008
|
init_theme();
|
|
5009
5009
|
init_wizard();
|
|
5010
5010
|
async function uninstallCommand(names, options) {
|
|
5011
|
+
const userSpecifiedTool = !!options.tool;
|
|
5012
|
+
const userSpecifiedLevel = !!options.level;
|
|
5011
5013
|
const tool = options.tool ? validateTool(options.tool) : "opencode";
|
|
5012
5014
|
const level = options.level ? validateLevel(options.level) : "project";
|
|
5013
5015
|
if (options.all) {
|
|
@@ -5019,7 +5021,7 @@ async function uninstallCommand(names, options) {
|
|
|
5019
5021
|
return;
|
|
5020
5022
|
}
|
|
5021
5023
|
if (names.length === 0) {
|
|
5022
|
-
await uninstallInteractive(tool, level);
|
|
5024
|
+
await uninstallInteractive(tool, level, userSpecifiedTool, userSpecifiedLevel);
|
|
5023
5025
|
return;
|
|
5024
5026
|
}
|
|
5025
5027
|
const plugins = [];
|
|
@@ -5111,7 +5113,7 @@ async function uninstallRecent(tool, level, yes) {
|
|
|
5111
5113
|
logger.success(t("skill_uninstall_done"));
|
|
5112
5114
|
logger.blank();
|
|
5113
5115
|
}
|
|
5114
|
-
async function uninstallInteractive(defaultTool, defaultLevel) {
|
|
5116
|
+
async function uninstallInteractive(defaultTool, defaultLevel, userSpecifiedTool, userSpecifiedLevel) {
|
|
5115
5117
|
let tool = defaultTool;
|
|
5116
5118
|
let level = defaultLevel;
|
|
5117
5119
|
const allInstalledPlugins = scanInstalled();
|
|
@@ -5171,7 +5173,7 @@ async function uninstallInteractive(defaultTool, defaultLevel) {
|
|
|
5171
5173
|
}
|
|
5172
5174
|
if (toolsWithContent.size === 1) {
|
|
5173
5175
|
tool = [...toolsWithContent][0];
|
|
5174
|
-
} else if (toolsWithContent.has(defaultTool)) {
|
|
5176
|
+
} else if (userSpecifiedTool && toolsWithContent.has(defaultTool)) {
|
|
5175
5177
|
tool = defaultTool;
|
|
5176
5178
|
} else {
|
|
5177
5179
|
const detected = await selectToolWithDetection();
|
|
@@ -5190,7 +5192,7 @@ async function uninstallInteractive(defaultTool, defaultLevel) {
|
|
|
5190
5192
|
}
|
|
5191
5193
|
if (levelsWithContent.size === 1) {
|
|
5192
5194
|
level = [...levelsWithContent][0];
|
|
5193
|
-
} else if (levelsWithContent.has(defaultLevel)) {
|
|
5195
|
+
} else if (userSpecifiedLevel && levelsWithContent.has(defaultLevel)) {
|
|
5194
5196
|
level = defaultLevel;
|
|
5195
5197
|
} else {
|
|
5196
5198
|
const { stepLevel: stepLevel2 } = await Promise.resolve().then(() => (init_wizard(), wizard_exports));
|
|
@@ -5275,7 +5277,36 @@ async function uninstallPlugins(pluginIds, batchMode) {
|
|
|
5275
5277
|
async function uninstallPluginById(pluginId, batchMode) {
|
|
5276
5278
|
const plugin = findPlugin(pluginId);
|
|
5277
5279
|
if (!plugin) return;
|
|
5278
|
-
|
|
5280
|
+
let record = readRecord(plugin.id);
|
|
5281
|
+
if (!record) {
|
|
5282
|
+
for (const toolName of VALID_TOOLS) {
|
|
5283
|
+
for (const lvl of ["project", "global"]) {
|
|
5284
|
+
const configRoot2 = getConfigRoot(toolName, lvl);
|
|
5285
|
+
const manifestPath = join18(configRoot2, `${pluginId}-manifest.json`);
|
|
5286
|
+
if (!existsSync18(manifestPath)) continue;
|
|
5287
|
+
let manifest = null;
|
|
5288
|
+
try {
|
|
5289
|
+
manifest = JSON.parse(readFileSync9(manifestPath, "utf-8"));
|
|
5290
|
+
} catch {
|
|
5291
|
+
continue;
|
|
5292
|
+
}
|
|
5293
|
+
const installPath = lvl === "project" ? process.cwd() : configRoot2;
|
|
5294
|
+
record = scanInstalledFiles(
|
|
5295
|
+
pluginId,
|
|
5296
|
+
plugin.displayName,
|
|
5297
|
+
toolName,
|
|
5298
|
+
lvl,
|
|
5299
|
+
installPath,
|
|
5300
|
+
configRoot2,
|
|
5301
|
+
manifest,
|
|
5302
|
+
plugin.externalRepos?.map((r) => basename3(r.dir)),
|
|
5303
|
+
plugin.configRootConfigLink
|
|
5304
|
+
);
|
|
5305
|
+
break;
|
|
5306
|
+
}
|
|
5307
|
+
if (record) break;
|
|
5308
|
+
}
|
|
5309
|
+
}
|
|
5279
5310
|
if (!record) {
|
|
5280
5311
|
logger.warn(`${plugin.displayName} ${t("uninstall_no_record")}`);
|
|
5281
5312
|
logger.info(`${t("uninstall_no_record_hint")}`);
|
|
@@ -5567,7 +5598,7 @@ async function langCommand(action, value) {
|
|
|
5567
5598
|
// src/cli.ts
|
|
5568
5599
|
init_config();
|
|
5569
5600
|
init_i18n();
|
|
5570
|
-
import { readFileSync as
|
|
5601
|
+
import { readFileSync as readFileSync10, existsSync as existsSync20 } from "fs";
|
|
5571
5602
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
5572
5603
|
import { dirname as dirname6, join as join20 } from "path";
|
|
5573
5604
|
function readVersion() {
|
|
@@ -5587,7 +5618,7 @@ function readVersion() {
|
|
|
5587
5618
|
];
|
|
5588
5619
|
for (const pkgPath of candidates) {
|
|
5589
5620
|
if (existsSync20(pkgPath)) {
|
|
5590
|
-
const pkg = JSON.parse(
|
|
5621
|
+
const pkg = JSON.parse(readFileSync10(pkgPath, "utf-8"));
|
|
5591
5622
|
if (pkg.version && (pkg.name === "@cannbot-ai/install-helper" || pkg.name?.startsWith("@cannbot-ai/install-helper-"))) {
|
|
5592
5623
|
return pkg.version;
|
|
5593
5624
|
}
|