diff --git a/src/handlers/installationHandlers.js b/src/handlers/installationHandlers.js index ed5b657..a94366f 100644 --- a/src/handlers/installationHandlers.js +++ b/src/handlers/installationHandlers.js @@ -12,6 +12,7 @@ import { showSuccessMessage, } from "../utils/messages.js"; import { checkDependencies } from "../services/nodeService.js"; +import { getDefaultCodexRootPath } from "../utils/appData.js"; const platform = os.platform(); @@ -155,6 +156,14 @@ async function configureShellPath(installPath) { } } +function getCodexBinPath() { + return getDefaultCodexRootPath(); +} + +function getCodexRootPath() { + return getDefaultCodexRootPath(); +} + async function performInstall(config) { const agreed = await showPrivacyDisclaimer(); if (!agreed) { @@ -323,57 +332,6 @@ function removeDir(dir) { fs.rmSync(dir, { recursive: true, force: true }); } -export async function uninstallCodex(config, showNavigationMenu) { - const { confirm } = await inquirer.prompt([ - { - type: 'confirm', - name: 'confirm', - message: chalk.yellow( - '⚠️ Are you sure you want to uninstall Codex? This action cannot be undone. \n' + - 'All data stored in the local Codex node will be deleted as well.' - ), - default: false - } - } finally { - await runCommand("rm -f install.sh").catch(() => {}); - } - } - - try { - const version = await getCodexVersion(config); - console.log(chalk.green(version)); - - console.log( - showSuccessMessage( - "Codex is successfully installed!\n" + - `Install path: "${config.codexExe}"\n\n` + - "The default configuration should work for most platforms.\n" + - "Please review the configuration before starting Codex.\n", - ), - ); - } catch (error) { - throw new Error( - "Installation completed but Codex command is not available. Please restart your terminal and try again.", - ); - } - - console.log( - showInfoMessage("Please review the configuration before starting Codex."), - ); - - spinner.success(); - return true; - } catch (error) { - spinner.error(); - console.log(showErrorMessage(`Failed to install Codex: ${error.message}`)); - return false; - } -} - -function removeDir(dir) { - fs.rmSync(dir, { recursive: true, force: true }); -} - export async function uninstallCodex(config, showNavigationMenu) { const { confirm } = await inquirer.prompt([ { @@ -414,3 +372,5 @@ export async function uninstallCodex(config, showNavigationMenu) { await showNavigationMenu(); } } + +