@codedir/mimir-code 0.1.6 → 0.1.7

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/cli.mjs CHANGED
@@ -6440,6 +6440,7 @@ var UninstallCommand = class {
6440
6440
  await this.removeBinaryInstallation(homeDir, result, quiet);
6441
6441
  }
6442
6442
  if (installType === "npm") {
6443
+ result.isNpmInstall = true;
6443
6444
  await this.removeNpmInstallation(result, quiet);
6444
6445
  }
6445
6446
  if (!keepConfig) {
@@ -6475,6 +6476,23 @@ var UninstallCommand = class {
6475
6476
  logger.debug("Detected npm installation (node_modules in path)");
6476
6477
  return "npm";
6477
6478
  }
6479
+ let currentPath = path8.dirname(scriptPath);
6480
+ for (let i = 0; i < 5; i++) {
6481
+ const packageJsonPath = path8.join(currentPath, "package.json");
6482
+ if (await this.fs.exists(packageJsonPath)) {
6483
+ try {
6484
+ const packageJson = JSON.parse(await this.fs.readFile(packageJsonPath, "utf-8"));
6485
+ if (packageJson.name === "@codedir/mimir-code") {
6486
+ logger.debug("Detected npm installation (found package.json)");
6487
+ return "npm";
6488
+ }
6489
+ } catch (error) {
6490
+ }
6491
+ }
6492
+ const parentPath = path8.dirname(currentPath);
6493
+ if (parentPath === currentPath) break;
6494
+ currentPath = parentPath;
6495
+ }
6478
6496
  const homeDir = os6.homedir();
6479
6497
  const mimirBinPath = path8.normalize(path8.join(homeDir, ".mimir", "bin")).toLowerCase();
6480
6498
  const localBinPath = path8.normalize(path8.join(homeDir, ".local", "bin")).toLowerCase();
@@ -6509,41 +6527,10 @@ var UninstallCommand = class {
6509
6527
  return "unknown";
6510
6528
  }
6511
6529
  }
6512
- async removeNpmInstallation(result, quiet = false) {
6513
- if (!this.executor) {
6514
- if (!quiet) {
6515
- logger.warn("Cannot automatically uninstall npm package.");
6516
- logger.info("Please run manually: npm uninstall -g @codedir/mimir-code");
6517
- }
6518
- return;
6519
- }
6520
- try {
6521
- if (!quiet) {
6522
- logger.info("Removing npm global package...");
6523
- }
6524
- const npmResult = await this.executor.execute(
6525
- "npm",
6526
- ["uninstall", "-g", "@codedir/mimir-code"],
6527
- {
6528
- cwd: process.cwd()
6529
- }
6530
- );
6531
- if (npmResult.exitCode === 0) {
6532
- result.removed.push("npm global package (@codedir/mimir-code)");
6533
- if (!quiet) {
6534
- logger.info("Successfully uninstalled npm package");
6535
- }
6536
- } else {
6537
- throw new Error(`npm uninstall failed: ${npmResult.stderr}`);
6538
- }
6539
- } catch (error) {
6540
- if (!quiet) {
6541
- logger.error("Failed to uninstall npm package", { error });
6542
- logger.info("Please run manually: npm uninstall -g @codedir/mimir-code");
6543
- }
6544
- result.errors.push(
6545
- `npm uninstall failed: ${error instanceof Error ? error.message : String(error)}`
6546
- );
6530
+ async removeNpmInstallation(_result, quiet = false) {
6531
+ if (!quiet) {
6532
+ logger.warn("Detected npm installation");
6533
+ logger.info("To uninstall, please run: npm uninstall -g @codedir/mimir-code");
6547
6534
  }
6548
6535
  }
6549
6536
  async removeBinaryInstallation(homeDir, result, quiet = false) {
@@ -6687,12 +6674,22 @@ del /f /q "%~f0" >nul 2>&1
6687
6674
  printSummary(result) {
6688
6675
  console.log("");
6689
6676
  console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
6690
- if (result.success) {
6677
+ if (result.isNpmInstall) {
6678
+ console.log("\u2139\uFE0F npm Installation Detected");
6679
+ } else if (result.success) {
6691
6680
  console.log("\u2705 Mimir has been uninstalled");
6692
6681
  } else {
6693
6682
  console.log("\u274C Uninstall completed with errors");
6694
6683
  }
6695
6684
  console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
6685
+ if (result.isNpmInstall) {
6686
+ console.log("");
6687
+ console.log("To uninstall the npm package, run:");
6688
+ console.log(" npm uninstall -g @codedir/mimir-code");
6689
+ console.log("");
6690
+ console.log("or with yarn:");
6691
+ console.log(" yarn global remove @codedir/mimir-code");
6692
+ }
6696
6693
  if (result.removed.length > 0) {
6697
6694
  console.log("");
6698
6695
  console.log("Removed:");
@@ -6703,9 +6700,14 @@ del /f /q "%~f0" >nul 2>&1
6703
6700
  console.log("Configuration preserved:");
6704
6701
  console.log(" - ~/.mimir/ (your settings and data)");
6705
6702
  console.log("");
6706
- console.log("To remove it later, run:");
6707
- console.log(" mimir uninstall --yes --remove-config");
6708
- console.log(" or manually: rm -rf ~/.mimir");
6703
+ if (!result.isNpmInstall) {
6704
+ console.log("To remove it later, run:");
6705
+ console.log(" mimir uninstall --yes --remove-config");
6706
+ console.log(" or manually: rm -rf ~/.mimir");
6707
+ } else {
6708
+ console.log("Note: npm uninstall will not remove your configuration");
6709
+ console.log("To remove it manually: rm -rf ~/.mimir");
6710
+ }
6709
6711
  }
6710
6712
  if (result.errors.length > 0) {
6711
6713
  console.log("");