nexora-code 1.0.3 → 1.0.4

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/bundle.cjs CHANGED
@@ -284542,6 +284542,513 @@ var init_archiver = __esm({
284542
284542
  }
284543
284543
  });
284544
284544
 
284545
+ // scripts/desktop/windows-wt-profile.cjs
284546
+ var require_windows_wt_profile = __commonJS({
284547
+ "scripts/desktop/windows-wt-profile.cjs"(exports2, module2) {
284548
+ "use strict";
284549
+ var fs51 = require("fs");
284550
+ var path55 = require("path");
284551
+ function getWTSettingsPath() {
284552
+ const localAppData = process.env.LOCALAPPDATA || "";
284553
+ const candidates = [
284554
+ // Store version
284555
+ path55.join(localAppData, "Packages", "Microsoft.WindowsTerminal_8wekyb3d8bbwe", "LocalState", "settings.json"),
284556
+ // Preview version
284557
+ path55.join(localAppData, "Packages", "Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe", "LocalState", "settings.json"),
284558
+ // Winget / scoop version
284559
+ path55.join(localAppData, "Microsoft", "Windows Terminal", "settings.json")
284560
+ ];
284561
+ return candidates.find((p) => {
284562
+ try {
284563
+ fs51.accessSync(p);
284564
+ return true;
284565
+ } catch {
284566
+ return false;
284567
+ }
284568
+ }) || null;
284569
+ }
284570
+ function detectBestShell() {
284571
+ const { execSync: execSync5 } = require("child_process");
284572
+ try {
284573
+ execSync5("where pwsh.exe", { stdio: "pipe" });
284574
+ return { shellExe: "pwsh.exe", shellArgs: "-NoExit -Command nexora-code" };
284575
+ } catch {
284576
+ }
284577
+ return {
284578
+ shellExe: "powershell.exe",
284579
+ shellArgs: "-NoExit -Command nexora-code"
284580
+ };
284581
+ }
284582
+ async function repairWTProfile() {
284583
+ const settingsPath = getWTSettingsPath();
284584
+ if (!settingsPath) return;
284585
+ let settings;
284586
+ try {
284587
+ const raw = fs51.readFileSync(settingsPath, "utf-8");
284588
+ const stripped = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
284589
+ settings = JSON.parse(stripped);
284590
+ } catch {
284591
+ return;
284592
+ }
284593
+ const profiles = settings?.profiles?.list;
284594
+ if (!Array.isArray(profiles)) return;
284595
+ let modified = false;
284596
+ for (const profile of profiles) {
284597
+ if (profile.name === "Nexora Code" && profile.commandline === "nexora-code") {
284598
+ const { shellExe, shellArgs } = detectBestShell();
284599
+ profile.commandline = `${shellExe} ${shellArgs}`;
284600
+ modified = true;
284601
+ console.log(" \u2713 Repaired corrupted Windows Terminal profile.");
284602
+ console.log(` \u2713 Fixed commandline \u2192 ${profile.commandline}`);
284603
+ }
284604
+ }
284605
+ if (modified) {
284606
+ fs51.writeFileSync(settingsPath, JSON.stringify(settings, null, 4), "utf-8");
284607
+ }
284608
+ }
284609
+ module2.exports = { repairWTProfile };
284610
+ }
284611
+ });
284612
+
284613
+ // scripts/desktop/windows.cjs
284614
+ var require_windows2 = __commonJS({
284615
+ "scripts/desktop/windows.cjs"(exports2, module2) {
284616
+ "use strict";
284617
+ var { execSync: execSync5 } = require("child_process");
284618
+ var path55 = require("path");
284619
+ var fs51 = require("fs");
284620
+ var { repairWTProfile } = require_windows_wt_profile();
284621
+ function detectWindowsTerminal() {
284622
+ try {
284623
+ const wtPath = execSync5("where wt.exe", { stdio: "pipe" }).toString().trim();
284624
+ if (wtPath) {
284625
+ try {
284626
+ execSync5("where pwsh.exe", { stdio: "pipe" });
284627
+ return {
284628
+ label: "Windows Terminal + PowerShell 7",
284629
+ shellExe: wtPath,
284630
+ shellArgs: "pwsh.exe -NoExit -Command nexora-code"
284631
+ };
284632
+ } catch {
284633
+ return {
284634
+ label: "Windows Terminal + PowerShell 5",
284635
+ shellExe: wtPath,
284636
+ shellArgs: "powershell.exe -NoExit -Command nexora-code"
284637
+ };
284638
+ }
284639
+ }
284640
+ } catch {
284641
+ }
284642
+ try {
284643
+ const pwsh7 = execSync5("where pwsh.exe", { stdio: "pipe" }).toString().trim();
284644
+ if (pwsh7) return {
284645
+ label: "PowerShell 7",
284646
+ shellExe: pwsh7,
284647
+ shellArgs: "-NoExit -Command nexora-code"
284648
+ };
284649
+ } catch {
284650
+ }
284651
+ const ps5 = `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
284652
+ return {
284653
+ label: "PowerShell 5",
284654
+ shellExe: ps5,
284655
+ shellArgs: "-NoExit -Command nexora-code"
284656
+ };
284657
+ }
284658
+ async function createWindowsShortcut(ctx) {
284659
+ await repairWTProfile();
284660
+ const shortcutPath = path55.join(ctx.desktopPath, "Nexora Code.lnk");
284661
+ const iconPath = path55.join(ctx.iconDir, "icon.ico");
284662
+ const iconExists = fs51.existsSync(iconPath);
284663
+ const terminal2 = detectWindowsTerminal();
284664
+ const escapedShortcut = shortcutPath.replace(/'/g, "''");
284665
+ const escapedShellExe = terminal2.shellExe.replace(/'/g, "''");
284666
+ const escapedArgs = terminal2.shellArgs.replace(/'/g, "''");
284667
+ const iconLine = iconExists ? `$lnk.IconLocation = '${iconPath.replace(/'/g, "''")}'; ` : "";
284668
+ const psLines = [
284669
+ `$s = New-Object -ComObject WScript.Shell`,
284670
+ `$lnk = $s.CreateShortcut('${escapedShortcut}')`,
284671
+ `$lnk.TargetPath = '${escapedShellExe}'`,
284672
+ `$lnk.Arguments = '${escapedArgs}'`,
284673
+ `$lnk.WorkingDirectory = $env:USERPROFILE`,
284674
+ `$lnk.Description = 'Launch Nexora Code AI Workspace'`,
284675
+ iconExists ? `$lnk.IconLocation = '${iconPath.replace(/'/g, "''")}'` : "",
284676
+ `$lnk.Save()`
284677
+ ].filter(Boolean).join("; ");
284678
+ try {
284679
+ execSync5(
284680
+ `powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "${psLines}"`,
284681
+ { stdio: "pipe", timeout: 2e4 }
284682
+ );
284683
+ console.log(` \u2713 Shortcut created: ${shortcutPath}`);
284684
+ console.log(` \u2713 Shell target: ${terminal2.shellExe}`);
284685
+ console.log(` \u2713 Launch command: ${terminal2.shellArgs}`);
284686
+ console.log(` \u2713 Terminal: ${terminal2.label}`);
284687
+ if (iconExists) console.log(` \u2713 Icon applied: Nexora Code logo`);
284688
+ console.log("");
284689
+ console.log(' \u2192 Double-click "Nexora Code" on your Desktop to launch!');
284690
+ console.log("");
284691
+ } catch (err6) {
284692
+ throw new Error(`Windows .lnk creation failed: ${err6.message}`);
284693
+ }
284694
+ }
284695
+ function removeWindowsShortcut(ctx) {
284696
+ const shortcutPath = path55.join(ctx.desktopPath, "Nexora Code.lnk");
284697
+ try {
284698
+ fs51.unlinkSync(shortcutPath);
284699
+ console.log(" \u2713 Desktop shortcut removed: Nexora Code.lnk");
284700
+ } catch {
284701
+ }
284702
+ }
284703
+ module2.exports = { createWindowsShortcut, removeWindowsShortcut };
284704
+ }
284705
+ });
284706
+
284707
+ // scripts/desktop/macos.cjs
284708
+ var require_macos = __commonJS({
284709
+ "scripts/desktop/macos.cjs"(exports2, module2) {
284710
+ "use strict";
284711
+ var { execSync: execSync5 } = require("child_process");
284712
+ var path55 = require("path");
284713
+ var fs51 = require("fs");
284714
+ var APP_NAME = "Nexora Code";
284715
+ function detectMacTerminalScript() {
284716
+ if (fs51.existsSync("/Applications/iTerm.app")) {
284717
+ return `#!/bin/bash
284718
+ open -a iTerm -- bash -c "nexora-code; exec bash"
284719
+ `;
284720
+ }
284721
+ if (fs51.existsSync("/Applications/Warp.app")) {
284722
+ return `#!/bin/bash
284723
+ open -a Warp
284724
+ osascript -e 'tell application "Warp" to activate'
284725
+ `;
284726
+ }
284727
+ if (fs51.existsSync("/Applications/Hyper.app")) {
284728
+ return `#!/bin/bash
284729
+ open -a Hyper
284730
+ `;
284731
+ }
284732
+ return `#!/bin/bash
284733
+ osascript <<'APPLESCRIPT'
284734
+ tell application "Terminal"
284735
+ activate
284736
+ do script "nexora-code"
284737
+ end tell
284738
+ APPLESCRIPT
284739
+ `;
284740
+ }
284741
+ function buildPlist(hasIcon) {
284742
+ return `<?xml version="1.0" encoding="UTF-8"?>
284743
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
284744
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
284745
+ <plist version="1.0">
284746
+ <dict>
284747
+ <key>CFBundleExecutable</key>
284748
+ <string>nexora-launcher</string>
284749
+ <key>CFBundleIdentifier</key>
284750
+ <string>cloud.getnexora.code</string>
284751
+ <key>CFBundleName</key>
284752
+ <string>${APP_NAME}</string>
284753
+ <key>CFBundleDisplayName</key>
284754
+ <string>${APP_NAME}</string>
284755
+ <key>CFBundleVersion</key>
284756
+ <string>1.0.0</string>
284757
+ <key>CFBundleShortVersionString</key>
284758
+ <string>1.0.0</string>
284759
+ <key>CFBundlePackageType</key>
284760
+ <string>APPL</string>
284761
+ ${hasIcon ? "<key>CFBundleIconFile</key>\n <string>AppIcon</string>" : ""}
284762
+ <key>LSMinimumSystemVersion</key>
284763
+ <string>11.0</string>
284764
+ <key>NSHighResolutionCapable</key>
284765
+ <true/>
284766
+ <key>LSUIElement</key>
284767
+ <false/>
284768
+ </dict>
284769
+ </plist>
284770
+ `;
284771
+ }
284772
+ function createMacosShortcut(ctx) {
284773
+ const appBundlePath = path55.join(ctx.desktopPath, `${APP_NAME}.app`);
284774
+ const macOSDir = path55.join(appBundlePath, "Contents", "MacOS");
284775
+ const resourceDir = path55.join(appBundlePath, "Contents", "Resources");
284776
+ const icnsPath = path55.join(ctx.iconDir, "icon.icns");
284777
+ const hasIcon = fs51.existsSync(icnsPath);
284778
+ fs51.mkdirSync(macOSDir, { recursive: true });
284779
+ fs51.mkdirSync(resourceDir, { recursive: true });
284780
+ const launcherContent = detectMacTerminalScript();
284781
+ const launcherPath = path55.join(macOSDir, "nexora-launcher");
284782
+ fs51.writeFileSync(launcherPath, launcherContent, "utf-8");
284783
+ fs51.chmodSync(launcherPath, 493);
284784
+ fs51.writeFileSync(
284785
+ path55.join(appBundlePath, "Contents", "Info.plist"),
284786
+ buildPlist(hasIcon),
284787
+ "utf-8"
284788
+ );
284789
+ if (hasIcon) {
284790
+ fs51.copyFileSync(icnsPath, path55.join(resourceDir, "AppIcon.icns"));
284791
+ }
284792
+ try {
284793
+ execSync5(`xattr -dr com.apple.quarantine "${appBundlePath}"`, { stdio: "pipe" });
284794
+ } catch {
284795
+ }
284796
+ try {
284797
+ execSync5(`touch "${appBundlePath}"`, { stdio: "pipe" });
284798
+ } catch {
284799
+ }
284800
+ console.log(` \u2713 App bundle created: ${appBundlePath}`);
284801
+ createCommandFallback(ctx.desktopPath);
284802
+ console.log("");
284803
+ console.log(` \u2192 Double-click "${APP_NAME}" on your Desktop to launch Nexora!`);
284804
+ console.log("");
284805
+ }
284806
+ function createCommandFallback(desktopPath) {
284807
+ const commandPath = path55.join(desktopPath, `${APP_NAME} (Terminal).command`);
284808
+ const commandContent = `#!/bin/bash
284809
+ clear
284810
+ nexora-code
284811
+ exec $SHELL
284812
+ `;
284813
+ fs51.writeFileSync(commandPath, commandContent, "utf-8");
284814
+ fs51.chmodSync(commandPath, 493);
284815
+ console.log(` \u2713 .command fallback: ${commandPath}`);
284816
+ }
284817
+ function removeMacosShortcut(ctx) {
284818
+ const targets = [
284819
+ path55.join(ctx.desktopPath, `${APP_NAME}.app`),
284820
+ path55.join(ctx.desktopPath, `${APP_NAME} (Terminal).command`)
284821
+ ];
284822
+ for (const t of targets) {
284823
+ try {
284824
+ fs51.rmSync(t, { recursive: true, force: true });
284825
+ console.log(` \u2713 Removed: ${t}`);
284826
+ } catch {
284827
+ }
284828
+ }
284829
+ }
284830
+ module2.exports = { createMacosShortcut, removeMacosShortcut };
284831
+ }
284832
+ });
284833
+
284834
+ // scripts/desktop/linux.cjs
284835
+ var require_linux = __commonJS({
284836
+ "scripts/desktop/linux.cjs"(exports2, module2) {
284837
+ "use strict";
284838
+ var { execSync: execSync5 } = require("child_process");
284839
+ var path55 = require("path");
284840
+ var fs51 = require("fs");
284841
+ var TERMINAL_CANDIDATES = [
284842
+ { bin: "gnome-terminal", args: '-- bash -c "nexora-code; exec bash"' },
284843
+ { bin: "konsole", args: '-e bash -c "nexora-code; exec bash"' },
284844
+ { bin: "xfce4-terminal", args: `--command="bash -c 'nexora-code; exec bash'"` },
284845
+ { bin: "tilix", args: `-e "bash -c 'nexora-code; exec bash'"` },
284846
+ { bin: "alacritty", args: '-e bash -c "nexora-code; exec bash"' },
284847
+ { bin: "kitty", args: 'bash -c "nexora-code; exec bash"' },
284848
+ { bin: "xterm", args: '-e "nexora-code; bash"' },
284849
+ { bin: "x-terminal-emulator", args: '-e bash -c "nexora-code; exec bash"' }
284850
+ // Debian/Ubuntu alias
284851
+ ];
284852
+ function detectLinuxTerminal() {
284853
+ for (const candidate of TERMINAL_CANDIDATES) {
284854
+ try {
284855
+ execSync5(`which ${candidate.bin}`, { stdio: "pipe" });
284856
+ return candidate;
284857
+ } catch {
284858
+ continue;
284859
+ }
284860
+ }
284861
+ return null;
284862
+ }
284863
+ function createLinuxShortcut(ctx) {
284864
+ const terminal2 = detectLinuxTerminal();
284865
+ const iconPath = path55.join(ctx.iconDir, "icon.png");
284866
+ const iconExists = fs51.existsSync(iconPath);
284867
+ const execLine = terminal2 ? `${terminal2.bin} ${terminal2.args}` : "nexora-code";
284868
+ const iconLine = iconExists ? iconPath : "utilities-terminal";
284869
+ const desktopContent = [
284870
+ "[Desktop Entry]",
284871
+ "Version=1.0",
284872
+ "Type=Application",
284873
+ "Name=Nexora Code",
284874
+ "GenericName=AI Developer Workspace",
284875
+ "Comment=Launch Nexora Code \u2014 World-class AI coding assistant",
284876
+ `Exec=${execLine}`,
284877
+ `Icon=${iconLine}`,
284878
+ "Terminal=false",
284879
+ // false: the terminal emulator handles this
284880
+ "StartupNotify=true",
284881
+ "Categories=Development;IDE;",
284882
+ "Keywords=nexora;code;ai;developer;assistant;cli;",
284883
+ "StartupWMClass=nexora-code"
284884
+ ].join("\n") + "\n";
284885
+ const desktopFilePath = path55.join(ctx.desktopPath, "nexora-code.desktop");
284886
+ fs51.writeFileSync(desktopFilePath, desktopContent, "utf-8");
284887
+ fs51.chmodSync(desktopFilePath, 493);
284888
+ console.log(` \u2713 Desktop launcher: ${desktopFilePath}`);
284889
+ const appMenuDir = path55.join(ctx.realHomeDir, ".local", "share", "applications");
284890
+ const appMenuPath = path55.join(appMenuDir, "nexora-code.desktop");
284891
+ try {
284892
+ fs51.mkdirSync(appMenuDir, { recursive: true });
284893
+ fs51.writeFileSync(appMenuPath, desktopContent, "utf-8");
284894
+ fs51.chmodSync(appMenuPath, 493);
284895
+ console.log(` \u2713 App menu entry: ${appMenuPath}`);
284896
+ try {
284897
+ execSync5("update-desktop-database ~/.local/share/applications", { stdio: "pipe" });
284898
+ } catch {
284899
+ }
284900
+ } catch (err6) {
284901
+ console.log(` \u26A0 App menu entry skipped: ${err6.message}`);
284902
+ }
284903
+ if (terminal2) {
284904
+ console.log(` \u2713 Terminal detected: ${terminal2.bin}`);
284905
+ } else {
284906
+ console.log(" \u26A0 No terminal emulator detected \u2014 using system default.");
284907
+ }
284908
+ console.log("");
284909
+ console.log(" \u2192 Double-click the icon on your Desktop to launch Nexora Code!");
284910
+ if (!terminal2) {
284911
+ console.log(' \u2192 Or run "nexora-code" directly in your terminal.');
284912
+ }
284913
+ console.log("");
284914
+ }
284915
+ function removeLinuxShortcut(ctx) {
284916
+ const targets = [
284917
+ path55.join(ctx.desktopPath, "nexora-code.desktop"),
284918
+ path55.join(ctx.realHomeDir, ".local", "share", "applications", "nexora-code.desktop")
284919
+ ];
284920
+ for (const t of targets) {
284921
+ try {
284922
+ fs51.unlinkSync(t);
284923
+ console.log(` \u2713 Removed: ${t}`);
284924
+ } catch {
284925
+ }
284926
+ }
284927
+ try {
284928
+ execSync5("update-desktop-database ~/.local/share/applications", { stdio: "pipe" });
284929
+ } catch {
284930
+ }
284931
+ }
284932
+ module2.exports = { createLinuxShortcut, removeLinuxShortcut };
284933
+ }
284934
+ });
284935
+
284936
+ // scripts/desktop/shortcut.cjs
284937
+ var require_shortcut = __commonJS({
284938
+ "scripts/desktop/shortcut.cjs"(exports2, module2) {
284939
+ "use strict";
284940
+ var os18 = require("os");
284941
+ var path55 = require("path");
284942
+ var fs51 = require("fs");
284943
+ function fileExistsSync(p) {
284944
+ try {
284945
+ fs51.accessSync(p);
284946
+ return true;
284947
+ } catch {
284948
+ return false;
284949
+ }
284950
+ }
284951
+ function getRealHomeDir() {
284952
+ if (process.env.SUDO_USER) {
284953
+ const plat = process.platform;
284954
+ if (plat === "linux") return `/home/${process.env.SUDO_USER}`;
284955
+ if (plat === "darwin") return `/Users/${process.env.SUDO_USER}`;
284956
+ }
284957
+ return process.env.USERPROFILE || process.env.HOME || os18.homedir();
284958
+ }
284959
+ function findDesktopPath(homeDir, platform2) {
284960
+ const candidates = [];
284961
+ if (platform2 === "windows") {
284962
+ candidates.push(
284963
+ path55.join(homeDir, "Desktop"),
284964
+ path55.join(homeDir, "OneDrive", "Desktop"),
284965
+ // Very common on Win11 + OneDrive
284966
+ path55.join(homeDir, "OneDrive - Personal", "Desktop")
284967
+ );
284968
+ } else if (platform2 === "macos") {
284969
+ candidates.push(path55.join(homeDir, "Desktop"));
284970
+ } else {
284971
+ const xdgDesktop = process.env.XDG_DESKTOP_DIR;
284972
+ if (xdgDesktop) candidates.push(xdgDesktop);
284973
+ candidates.push(
284974
+ path55.join(homeDir, "Desktop"),
284975
+ path55.join(homeDir, "Escritorio"),
284976
+ // Spanish
284977
+ path55.join(homeDir, "Bureau"),
284978
+ // French
284979
+ path55.join(homeDir, "Schreibtisch"),
284980
+ // German
284981
+ path55.join(homeDir, "\u30C7\u30B9\u30AF\u30C8\u30C3\u30D7"),
284982
+ // Japanese
284983
+ path55.join(homeDir, "\u684C\u9762")
284984
+ // Chinese (Simplified)
284985
+ );
284986
+ }
284987
+ for (const candidate of candidates) {
284988
+ if (fileExistsSync(candidate)) return candidate;
284989
+ }
284990
+ return null;
284991
+ }
284992
+ function getPackageDir() {
284993
+ return path55.resolve(__dirname, "..", "..");
284994
+ }
284995
+ function buildUserContext() {
284996
+ const rawPlatform = process.platform;
284997
+ const platform2 = rawPlatform === "win32" ? "windows" : rawPlatform === "darwin" ? "macos" : "linux";
284998
+ const realHomeDir = getRealHomeDir();
284999
+ const desktopPath = findDesktopPath(realHomeDir, platform2);
285000
+ const packageDir = getPackageDir();
285001
+ const iconDir = path55.join(packageDir, "assets");
285002
+ const binaryName = platform2 === "windows" ? "nexora-code.cmd" : "nexora-code";
285003
+ const npmBinDir = path55.dirname(process.execPath);
285004
+ const binaryPath = path55.join(npmBinDir, binaryName);
285005
+ return { platform: platform2, realHomeDir, desktopPath, packageDir, binaryPath, iconDir };
285006
+ }
285007
+ async function createShortcut() {
285008
+ const ctx = buildUserContext();
285009
+ if (!ctx.desktopPath) {
285010
+ console.log(" \u2139 No desktop found (headless / server / WSL environment).");
285011
+ console.log(' Run "nexora-code" in any terminal to start.');
285012
+ return;
285013
+ }
285014
+ console.log("");
285015
+ console.log(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
285016
+ console.log(" \u2502 Nexora Code \u2014 Desktop Shortcut Setup \u2502");
285017
+ console.log(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
285018
+ console.log("");
285019
+ switch (ctx.platform) {
285020
+ case "windows":
285021
+ await require_windows2().createWindowsShortcut(ctx);
285022
+ break;
285023
+ case "macos":
285024
+ await require_macos().createMacosShortcut(ctx);
285025
+ break;
285026
+ case "linux":
285027
+ await require_linux().createLinuxShortcut(ctx);
285028
+ break;
285029
+ default:
285030
+ console.log(" \u26A0 Unrecognised platform \u2014 skipping shortcut creation.");
285031
+ }
285032
+ }
285033
+ async function removeShortcut() {
285034
+ const ctx = buildUserContext();
285035
+ if (!ctx.desktopPath) return;
285036
+ switch (ctx.platform) {
285037
+ case "windows":
285038
+ await require_windows2().removeWindowsShortcut(ctx);
285039
+ break;
285040
+ case "macos":
285041
+ await require_macos().removeMacosShortcut(ctx);
285042
+ break;
285043
+ case "linux":
285044
+ await require_linux().removeLinuxShortcut(ctx);
285045
+ break;
285046
+ }
285047
+ }
285048
+ module2.exports = { createShortcut, removeShortcut, buildUserContext };
285049
+ }
285050
+ });
285051
+
284545
285052
  // node_modules/pdfjs-dist/legacy/build/pdf.mjs
284546
285053
  var pdf_exports = {};
284547
285054
  __export(pdf_exports, {
@@ -318475,7 +318982,7 @@ function updateNotifier(options) {
318475
318982
  // package.json
318476
318983
  var package_default = {
318477
318984
  name: "nexora-code",
318478
- version: "1.0.3",
318985
+ version: "1.0.4",
318479
318986
  description: "Nexora Code \u2014 World-Class AI Coding Agent CLI. BYOK \xB7 51 tools \xB7 Multi-action \xB7 Streaming \xB7 Session Memory",
318480
318987
  author: "Enoch Boadu",
318481
318988
  license: "MIT",
@@ -332861,6 +333368,19 @@ var args = import_node_process51.default.argv.slice(2);
332861
333368
  var subcommand = args[0]?.toLowerCase();
332862
333369
  var headless2 = args.includes("--headless");
332863
333370
  async function main2() {
333371
+ if (args.includes("--repair-shortcut")) {
333372
+ const { createShortcut, removeShortcut } = await Promise.resolve().then(() => __toESM(require_shortcut(), 1));
333373
+ console.log("\n Nexora Code \u2014 Repairing desktop shortcut...\n");
333374
+ try {
333375
+ await removeShortcut();
333376
+ await createShortcut();
333377
+ console.log("\n \u2713 Shortcut repaired successfully.\n");
333378
+ import_node_process51.default.exit(0);
333379
+ } catch (err6) {
333380
+ console.error("\n \u2717 Repair failed:", err6.message);
333381
+ import_node_process51.default.exit(1);
333382
+ }
333383
+ }
332864
333384
  const taskIdIndex = args.indexOf("--task-id");
332865
333385
  if (taskIdIndex !== -1 && args[taskIdIndex + 1]) {
332866
333386
  await runBackgroundWorker(args[taskIdIndex + 1]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexora-code",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Nexora Code — World-Class AI Coding Agent CLI. BYOK · 51 tools · Multi-action · Streaming · Session Memory",
5
5
  "author": "Enoch Boadu",
6
6
  "license": "MIT",
@@ -94,4 +94,4 @@
94
94
  "workspaces": [
95
95
  "packages/*"
96
96
  ]
97
- }
97
+ }
@@ -11,7 +11,7 @@
11
11
 
12
12
  const { createShortcut } = require('./shortcut.cjs');
13
13
 
14
- function main() {
14
+ async function main() {
15
15
  // ── Guard 1: Only run on global installs (-g flag) ──────────────────────────
16
16
  // npm sets npm_config_global=true for `npm install -g` commands.
17
17
  // Local `npm install` inside the project does NOT set this.
@@ -34,7 +34,10 @@ function main() {
34
34
  process.exit(0);
35
35
  }
36
36
 
37
- createShortcut();
37
+ await createShortcut();
38
38
  }
39
39
 
40
- main();
40
+ main().catch(err => {
41
+ // Never let shortcut errors break the install
42
+ process.exit(0);
43
+ });
@@ -8,7 +8,7 @@
8
8
 
9
9
  const { removeShortcut } = require('./shortcut.cjs');
10
10
 
11
- function main() {
11
+ async function main() {
12
12
  // Only clean up after global uninstalls — not local dev uninstalls
13
13
  const isGlobalUninstall = process.env.npm_config_global === 'true';
14
14
  if (!isGlobalUninstall) {
@@ -17,13 +17,11 @@ function main() {
17
17
 
18
18
  console.log('');
19
19
  console.log(' Nexora Code — Cleaning up desktop shortcut...');
20
- removeShortcut();
20
+ await removeShortcut();
21
21
  }
22
22
 
23
23
  // Never let cleanup errors break the uninstall
24
- try {
25
- main();
26
- } catch (err) {
24
+ main().catch(err => {
27
25
  console.log(` ⚠ Cleanup warning: ${err.message}`);
28
26
  process.exit(0);
29
- }
27
+ });
@@ -101,7 +101,7 @@ function buildUserContext() {
101
101
 
102
102
  // ── Public API ────────────────────────────────────────────────────────────────
103
103
 
104
- function createShortcut() {
104
+ async function createShortcut() {
105
105
  const ctx = buildUserContext();
106
106
 
107
107
  if (!ctx.desktopPath) {
@@ -117,22 +117,22 @@ function createShortcut() {
117
117
  console.log('');
118
118
 
119
119
  switch (ctx.platform) {
120
- case 'windows': require('./windows.cjs').createWindowsShortcut(ctx); break;
121
- case 'macos': require('./macos.cjs').createMacosShortcut(ctx); break;
122
- case 'linux': require('./linux.cjs').createLinuxShortcut(ctx); break;
120
+ case 'windows': await require('./windows.cjs').createWindowsShortcut(ctx); break;
121
+ case 'macos': await require('./macos.cjs').createMacosShortcut(ctx); break;
122
+ case 'linux': await require('./linux.cjs').createLinuxShortcut(ctx); break;
123
123
  default:
124
124
  console.log(' ⚠ Unrecognised platform — skipping shortcut creation.');
125
125
  }
126
126
  }
127
127
 
128
- function removeShortcut() {
128
+ async function removeShortcut() {
129
129
  const ctx = buildUserContext();
130
130
  if (!ctx.desktopPath) return;
131
131
 
132
132
  switch (ctx.platform) {
133
- case 'windows': require('./windows.cjs').removeWindowsShortcut(ctx); break;
134
- case 'macos': require('./macos.cjs').removeMacosShortcut(ctx); break;
135
- case 'linux': require('./linux.cjs').removeLinuxShortcut(ctx); break;
133
+ case 'windows': await require('./windows.cjs').removeWindowsShortcut(ctx); break;
134
+ case 'macos': await require('./macos.cjs').removeMacosShortcut(ctx); break;
135
+ case 'linux': await require('./linux.cjs').removeLinuxShortcut(ctx); break;
136
136
  }
137
137
  }
138
138
 
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ function getWTSettingsPath() {
7
+ const localAppData = process.env.LOCALAPPDATA || '';
8
+ const candidates = [
9
+ // Store version
10
+ path.join(localAppData, 'Packages', 'Microsoft.WindowsTerminal_8wekyb3d8bbwe', 'LocalState', 'settings.json'),
11
+ // Preview version
12
+ path.join(localAppData, 'Packages', 'Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe', 'LocalState', 'settings.json'),
13
+ // Winget / scoop version
14
+ path.join(localAppData, 'Microsoft', 'Windows Terminal', 'settings.json'),
15
+ ];
16
+ return candidates.find(p => {
17
+ try { fs.accessSync(p); return true; } catch { return false; }
18
+ }) || null;
19
+ }
20
+
21
+ function detectBestShell() {
22
+ const { execSync } = require('child_process');
23
+
24
+ try {
25
+ execSync('where pwsh.exe', { stdio: 'pipe' });
26
+ return { shellExe: 'pwsh.exe', shellArgs: '-NoExit -Command nexora-code' };
27
+ } catch { /* not found */ }
28
+
29
+ return {
30
+ shellExe: 'powershell.exe',
31
+ shellArgs: '-NoExit -Command nexora-code',
32
+ };
33
+ }
34
+
35
+ async function repairWTProfile() {
36
+ const settingsPath = getWTSettingsPath();
37
+ if (!settingsPath) return; // WT not installed or can't find settings
38
+
39
+ let settings;
40
+ try {
41
+ const raw = fs.readFileSync(settingsPath, 'utf-8');
42
+ // WT settings.json may have comments — strip them before parsing
43
+ const stripped = raw.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
44
+ settings = JSON.parse(stripped);
45
+ } catch {
46
+ return; // Can't parse — don't corrupt the file
47
+ }
48
+
49
+ const profiles = settings?.profiles?.list;
50
+ if (!Array.isArray(profiles)) return;
51
+
52
+ let modified = false;
53
+
54
+ for (const profile of profiles) {
55
+ // Find any profile where commandline is set to bare "nexora-code"
56
+ if (
57
+ profile.name === 'Nexora Code' &&
58
+ profile.commandline === 'nexora-code'
59
+ ) {
60
+ const { shellExe, shellArgs } = detectBestShell();
61
+ profile.commandline = `${shellExe} ${shellArgs}`;
62
+ modified = true;
63
+
64
+ console.log(' ✓ Repaired corrupted Windows Terminal profile.');
65
+ console.log(` ✓ Fixed commandline → ${profile.commandline}`);
66
+ }
67
+ }
68
+
69
+ if (modified) {
70
+ // Write back with 4-space indent to match WT's own format
71
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 4), 'utf-8');
72
+ }
73
+ }
74
+
75
+ module.exports = { repairWTProfile };
@@ -8,36 +8,50 @@ const { execSync } = require('child_process');
8
8
  const path = require('path');
9
9
  const fs = require('fs');
10
10
 
11
+ const { repairWTProfile } = require('./windows-wt-profile.cjs');
12
+
11
13
  /**
12
14
  * Detect the best available terminal on Windows.
13
15
  * Priority: Windows Terminal > PowerShell 7 > PowerShell 5
14
16
  */
15
17
  function detectWindowsTerminal() {
16
- // Windows Terminal (wt.exe) — best colour/font support
18
+ // Windows Terminal (wt.exe) — best experience
17
19
  try {
18
- execSync('where wt.exe', { stdio: 'pipe' });
19
- return {
20
- exe: 'wt.exe',
21
- args: 'nexora-code',
22
- label: 'Windows Terminal',
23
- };
24
- } catch { /* not installed */ }
20
+ const wtPath = execSync('where wt.exe', { stdio: 'pipe' }).toString().trim();
21
+ if (wtPath) {
22
+ try {
23
+ execSync('where pwsh.exe', { stdio: 'pipe' });
24
+ return {
25
+ label: 'Windows Terminal + PowerShell 7',
26
+ shellExe: wtPath,
27
+ shellArgs: 'pwsh.exe -NoExit -Command nexora-code',
28
+ };
29
+ } catch {
30
+ return {
31
+ label: 'Windows Terminal + PowerShell 5',
32
+ shellExe: wtPath,
33
+ shellArgs: 'powershell.exe -NoExit -Command nexora-code',
34
+ };
35
+ }
36
+ }
37
+ } catch { /* wt not found */ }
25
38
 
26
39
  // PowerShell 7+ (pwsh.exe) — modern, cross-platform
27
40
  try {
28
- execSync('where pwsh.exe', { stdio: 'pipe' });
29
- return {
30
- exe: 'pwsh.exe',
31
- args: '-NoExit -Command nexora-code',
32
- label: 'PowerShell 7',
41
+ const pwsh7 = execSync('where pwsh.exe', { stdio: 'pipe' }).toString().trim();
42
+ if (pwsh7) return {
43
+ label: 'PowerShell 7',
44
+ shellExe: pwsh7,
45
+ shellArgs: '-NoExit -Command nexora-code',
33
46
  };
34
47
  } catch { /* not installed */ }
35
48
 
36
49
  // PowerShell 5 (built into all Windows 10/11) — guaranteed fallback
50
+ const ps5 = `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
37
51
  return {
38
- exe: 'powershell.exe',
39
- args: '-NoExit -Command nexora-code',
40
- label: 'PowerShell 5 (built-in)',
52
+ label: 'PowerShell 5',
53
+ shellExe: ps5,
54
+ shellArgs: '-NoExit -Command nexora-code',
41
55
  };
42
56
  }
43
57
 
@@ -45,25 +59,31 @@ function detectWindowsTerminal() {
45
59
  * Creates a Windows .lnk shortcut using PowerShell's WScript.Shell COM object.
46
60
  * No external libraries required.
47
61
  */
48
- function createWindowsShortcut(ctx) {
62
+ async function createWindowsShortcut(ctx) {
63
+ // Repair any bad WT profile from a previous install attempt first
64
+ await repairWTProfile();
65
+
49
66
  const shortcutPath = path.join(ctx.desktopPath, 'Nexora Code.lnk');
50
67
  const iconPath = path.join(ctx.iconDir, 'icon.ico');
51
68
  const iconExists = fs.existsSync(iconPath);
52
69
  const terminal = detectWindowsTerminal();
53
70
 
54
- // Escape single-quotes in paths for PowerShell string literals
55
- const safeShortcutPath = shortcutPath.replace(/'/g, "''");
56
- const safeIconPath = iconPath.replace(/'/g, "''");
57
- const safeWorkingDir = '%USERPROFILE%';
71
+ // Escape single quotes for PowerShell string embedding
72
+ const escapedShortcut = shortcutPath.replace(/'/g, "''");
73
+ const escapedShellExe = terminal.shellExe.replace(/'/g, "''");
74
+ const escapedArgs = terminal.shellArgs.replace(/'/g, "''");
75
+ const iconLine = iconExists
76
+ ? `$lnk.IconLocation = '${iconPath.replace(/'/g, "''")}'; `
77
+ : '';
58
78
 
59
79
  const psLines = [
60
80
  `$s = New-Object -ComObject WScript.Shell`,
61
- `$lnk = $s.CreateShortcut('${safeShortcutPath}')`,
62
- `$lnk.TargetPath = '${terminal.exe}'`,
63
- `$lnk.Arguments = '${terminal.args}'`,
64
- `$lnk.WorkingDirectory = '$env:USERPROFILE'`,
81
+ `$lnk = $s.CreateShortcut('${escapedShortcut}')`,
82
+ `$lnk.TargetPath = '${escapedShellExe}'`,
83
+ `$lnk.Arguments = '${escapedArgs}'`,
84
+ `$lnk.WorkingDirectory = $env:USERPROFILE`,
65
85
  `$lnk.Description = 'Launch Nexora Code AI Workspace'`,
66
- iconExists ? `$lnk.IconLocation = '${safeIconPath}'` : '',
86
+ iconExists ? `$lnk.IconLocation = '${iconPath.replace(/'/g, "''")}'` : '',
67
87
  `$lnk.Save()`,
68
88
  ].filter(Boolean).join('; ');
69
89
 
@@ -73,7 +93,9 @@ function createWindowsShortcut(ctx) {
73
93
  { stdio: 'pipe', timeout: 20_000 }
74
94
  );
75
95
  console.log(` ✓ Shortcut created: ${shortcutPath}`);
76
- console.log(` ✓ Opens with: ${terminal.label}`);
96
+ console.log(` ✓ Shell target: ${terminal.shellExe}`);
97
+ console.log(` ✓ Launch command: ${terminal.shellArgs}`);
98
+ console.log(` ✓ Terminal: ${terminal.label}`);
77
99
  if (iconExists) console.log(` ✓ Icon applied: Nexora Code logo`);
78
100
  console.log('');
79
101
  console.log(' → Double-click "Nexora Code" on your Desktop to launch!');