@emend-ai/utim 1.44.9 → 1.45.2

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.
Files changed (2) hide show
  1. package/bin/utim.js +38 -9
  2. package/package.json +1 -1
package/bin/utim.js CHANGED
@@ -78,17 +78,46 @@ function isUtimInstalled(python) {
78
78
  // ── Run pip install with given extra flags — always show output ───────────────
79
79
  function runPip(python, extraFlags) {
80
80
  try {
81
- const r = spawnSync(
82
- python,
83
- ['-m', 'pip', 'install', '--upgrade', ...extraFlags, 'utim-cli'],
84
- {
85
- stdio: 'inherit', // Always show output so errors are visible
86
- shell: isWin,
81
+ if (isWin) {
82
+ // On Windows: spawn in a new Command Prompt window and block until it is closed.
83
+ const cmdStr = `title UTIM Setup & echo ======================================== & echo Installing UTIM Python engine and dependencies... & echo ======================================== & "${python}" -m pip install --upgrade ${extraFlags.join(' ')} utim-cli & echo ======================================== & echo Installation complete. You can close this window. & pause`;
84
+ spawnSync('cmd.exe', ['/c', 'start', '/wait', 'cmd.exe', '/c', cmdStr], {
85
+ stdio: 'ignore',
86
+ shell: true,
87
87
  windowsHide: false,
88
- timeout: 300000,
88
+ });
89
+ // After the popup window closes, verify if the pip package was actually installed
90
+ return isUtimInstalled(python);
91
+ } else if (isMac) {
92
+ // On macOS: use osascript to run it in a new Terminal window.
93
+ const lockFile = require('path').join(os.tmpdir(), `utim_install_${Date.now()}.lock`);
94
+ fs.writeFileSync(lockFile, 'running');
95
+ const installCmd = `echo "Installing UTIM Python engine..."; "${python}" -m pip install --upgrade ${extraFlags.join(' ')} utim-cli; rm -f "${lockFile}"; exit`;
96
+ const osaScript = `tell application "Terminal" to do script "${installCmd.replace(/"/g, '\\"')}"`;
97
+
98
+ spawnSync('osascript', ['-e', osaScript], { stdio: 'ignore' });
99
+
100
+ // Poll for lockfile deletion (timeout after 5 minutes)
101
+ let elapsed = 0;
102
+ while (fs.existsSync(lockFile) && elapsed < 300) {
103
+ spawnSync('sleep', ['1']);
104
+ elapsed++;
89
105
  }
90
- );
91
- return r.status === 0;
106
+ try { fs.unlinkSync(lockFile); } catch (_) {}
107
+ return isUtimInstalled(python);
108
+ } else {
109
+ // Linux / Termux fallback: run in current terminal
110
+ const r = spawnSync(
111
+ python,
112
+ ['-m', 'pip', 'install', '--upgrade', ...extraFlags, 'utim-cli'],
113
+ {
114
+ stdio: 'inherit',
115
+ shell: false,
116
+ timeout: 300000,
117
+ }
118
+ );
119
+ return r.status === 0;
120
+ }
92
121
  } catch (_) {
93
122
  return false;
94
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emend-ai/utim",
3
- "version": "1.44.9",
3
+ "version": "1.45.2",
4
4
  "description": "UTIM – Universal Terminal Intelligence Manager. An agentic AI coding assistant for your terminal.",
5
5
  "keywords": [
6
6
  "ai",