hedgequantx 2.7.64 → 2.7.66

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.7.64",
3
+ "version": "2.7.66",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -159,75 +159,94 @@ const dashboardMenu = async (service) => {
159
159
  * Handle update process
160
160
  */
161
161
  const handleUpdate = async () => {
162
+ console.clear();
163
+ displayBanner();
162
164
  prepareStdin();
163
165
 
166
+ const boxWidth = getLogoWidth();
167
+ const W = boxWidth - 2;
168
+
169
+ console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
170
+ console.log(chalk.cyan('║') + chalk.yellow.bold(centerText('UPDATE HQX', W)) + chalk.cyan('║'));
171
+ console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
172
+
164
173
  let spinner = null;
165
174
  let currentVersion = 'unknown';
166
175
 
167
176
  try {
177
+ // Get current version
168
178
  try {
169
179
  currentVersion = require('../../package.json').version || 'unknown';
170
180
  } catch (e) {}
171
181
 
172
- console.log(chalk.cyan(`\n CURRENT VERSION: V${currentVersion}`));
182
+ console.log(chalk.cyan(`\n CURRENT VERSION: V${currentVersion.toUpperCase()}`));
173
183
  spinner = ora({ text: 'CHECKING FOR UPDATES...', color: 'yellow' }).start();
174
184
 
185
+ // Check latest version from npm
175
186
  let latestVersion;
176
187
  try {
177
- latestVersion = execSync('npm view hedgequantx version', {
188
+ latestVersion = execSync('npm view hedgequantx version 2>/dev/null', {
178
189
  stdio: ['pipe', 'pipe', 'pipe'],
179
190
  timeout: 30000,
180
191
  encoding: 'utf8'
181
192
  }).trim();
182
193
 
183
194
  if (!latestVersion || !/^\d+\.\d+\.\d+/.test(latestVersion)) {
184
- throw new Error('Invalid version format');
195
+ throw new Error('INVALID VERSION FORMAT');
185
196
  }
186
197
  } catch (e) {
187
198
  spinner.fail('CANNOT REACH NPM REGISTRY');
188
- console.log(chalk.gray(` ERROR: ${e.message.toUpperCase()}`));
189
- console.log(chalk.yellow(' TRY MANUALLY: npm install -g hedgequantx@latest'));
199
+ console.log(chalk.yellow('\n TRY MANUALLY: npm update -g hedgequantx'));
190
200
  await prompts.waitForEnter();
191
201
  return;
192
202
  }
193
203
 
194
- spinner.succeed(`LATEST VERSION: V${latestVersion}`);
204
+ spinner.succeed(`LATEST VERSION: V${latestVersion.toUpperCase()}`);
195
205
 
206
+ // Already up to date
196
207
  if (currentVersion === latestVersion) {
197
- console.log(chalk.green(' ALREADY UP TO DATE!'));
208
+ console.log(chalk.green('\n ALREADY UP TO DATE!'));
198
209
  await prompts.waitForEnter();
199
210
  return;
200
211
  }
201
212
 
202
- console.log(chalk.yellow(` UPDATE AVAILABLE: V${currentVersion} → V${latestVersion}`));
213
+ // Update available
214
+ console.log(chalk.yellow(`\n UPDATE AVAILABLE: V${currentVersion} → V${latestVersion}`));
203
215
  spinner = ora({ text: 'INSTALLING UPDATE...', color: 'yellow' }).start();
204
216
 
217
+ // Try to install update
205
218
  try {
206
- // Try with sudo first on Unix systems
207
- const isWindows = process.platform === 'win32';
208
- const cmd = isWindows
209
- ? 'npm install -g hedgequantx@latest'
210
- : 'npm install -g hedgequantx@latest';
211
-
212
- execSync(cmd, {
219
+ execSync('npm update -g hedgequantx 2>/dev/null', {
213
220
  stdio: ['pipe', 'pipe', 'pipe'],
214
221
  timeout: 180000,
215
222
  encoding: 'utf8'
216
223
  });
217
224
  } catch (e) {
218
- spinner.fail('UPDATE FAILED - PERMISSION DENIED?');
219
- console.log(chalk.gray(` ERROR: ${e.message.toUpperCase()}`));
220
- console.log(chalk.yellow(' TRY MANUALLY WITH SUDO:'));
221
- console.log(chalk.white(' sudo npm install -g hedgequantx@latest'));
222
- await prompts.waitForEnter();
223
- return;
225
+ // Try without redirecting stderr
226
+ try {
227
+ execSync('npm update -g hedgequantx', {
228
+ stdio: ['pipe', 'pipe', 'pipe'],
229
+ timeout: 180000,
230
+ encoding: 'utf8'
231
+ });
232
+ } catch (e2) {
233
+ spinner.fail('UPDATE FAILED');
234
+ console.log(chalk.yellow('\n TRY MANUALLY:'));
235
+ console.log(chalk.white(' npm update -g hedgequantx'));
236
+ console.log(chalk.gray(' OR WITH SUDO:'));
237
+ console.log(chalk.white(' sudo npm update -g hedgequantx'));
238
+ await prompts.waitForEnter();
239
+ return;
240
+ }
224
241
  }
225
242
 
226
243
  spinner.succeed(`UPDATED TO V${latestVersion}!`);
244
+ console.log(chalk.green('\n ✓ UPDATE SUCCESSFUL!'));
227
245
  console.log(chalk.cyan(' RESTARTING HQX...'));
228
246
 
229
- await new Promise(r => setTimeout(r, 1500));
247
+ await new Promise(r => setTimeout(r, 1000));
230
248
 
249
+ // Restart HQX
231
250
  try {
232
251
  const child = spawn('hqx', [], {
233
252
  stdio: 'inherit',
@@ -244,8 +263,7 @@ const handleUpdate = async () => {
244
263
 
245
264
  } catch (error) {
246
265
  if (spinner) spinner.fail('UPDATE ERROR');
247
- console.log(chalk.gray(` ERROR: ${error.message.toUpperCase()}`));
248
- console.log(chalk.yellow(' TRY MANUALLY: npm install -g hedgequantx@latest'));
266
+ console.log(chalk.yellow('\n TRY MANUALLY: npm update -g hedgequantx'));
249
267
  await prompts.waitForEnter();
250
268
  }
251
269
  };
@@ -354,9 +354,9 @@ const getLoginUrl = async (provider) => {
354
354
 
355
355
  const headless = isHeadless();
356
356
 
357
- // For headless/VPS, use -no-browser flag and specify auth-dir
357
+ // For headless/VPS, use -no-browser flag and specify config (which contains auth-dir)
358
358
  return new Promise((resolve) => {
359
- const args = [flag, '-no-browser', '-auth-dir', AUTH_DIR];
359
+ const args = [flag, '-no-browser', '-config', CONFIG_PATH];
360
360
  const child = spawn(BINARY_PATH, args, {
361
361
  cwd: INSTALL_DIR
362
362
  });