hedgequantx 2.6.65 → 2.6.67

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.6.65",
3
+ "version": "2.6.67",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -645,18 +645,21 @@ const selectProviderOption = async (provider) => {
645
645
 
646
646
  /**
647
647
  * Open URL in default browser
648
+ * @returns {Promise<boolean>} true if browser opened, false if failed
648
649
  */
649
650
  const openBrowser = (url) => {
650
- const { exec } = require('child_process');
651
- const platform = process.platform;
652
-
653
- let cmd;
654
- if (platform === 'darwin') cmd = `open "${url}"`;
655
- else if (platform === 'win32') cmd = `start "" "${url}"`;
656
- else cmd = `xdg-open "${url}"`;
657
-
658
- exec(cmd, (err) => {
659
- if (err) console.log(chalk.white(' Could not open browser automatically'));
651
+ return new Promise((resolve) => {
652
+ const { exec } = require('child_process');
653
+ const platform = process.platform;
654
+
655
+ let cmd;
656
+ if (platform === 'darwin') cmd = `open "${url}"`;
657
+ else if (platform === 'win32') cmd = `start "" "${url}"`;
658
+ else cmd = `xdg-open "${url}"`;
659
+
660
+ exec(cmd, (err) => {
661
+ resolve(!err);
662
+ });
660
663
  });
661
664
  };
662
665
 
@@ -748,14 +751,26 @@ const setupOAuthConnection = async (provider) => {
748
751
 
749
752
  // Wait a moment then open browser
750
753
  await new Promise(resolve => setTimeout(resolve, 3000));
751
- openBrowser(url);
754
+ const browserOpened = await openBrowser(url);
752
755
 
753
756
  // Redraw with code input
754
757
  console.clear();
755
758
  displayBanner();
756
759
  drawBoxHeaderContinue('CLAUDE PRO/MAX LOGIN', boxWidth);
757
760
 
758
- console.log(makeLine(chalk.green('BROWSER OPENED')));
761
+ if (browserOpened) {
762
+ console.log(makeLine(chalk.green('BROWSER OPENED')));
763
+ } else {
764
+ console.log(makeLine(chalk.yellow('COULD NOT OPEN BROWSER (VPS/SSH?)')));
765
+ console.log(makeLine(''));
766
+ console.log(makeLine(chalk.white('OPEN THIS URL IN YOUR BROWSER:')));
767
+ console.log(makeLine(''));
768
+ // Split URL into chunks that fit the box width
769
+ const maxUrlLen = W - 4;
770
+ for (let i = 0; i < url.length; i += maxUrlLen) {
771
+ console.log(makeLine(chalk.cyan(url.substring(i, i + maxUrlLen))));
772
+ }
773
+ }
759
774
  console.log(makeLine(''));
760
775
  console.log(makeLine(chalk.white('AFTER LOGGING IN, YOU WILL SEE A CODE')));
761
776
  console.log(makeLine(chalk.white('COPY THE ENTIRE CODE AND PASTE IT BELOW')));
@@ -878,10 +893,22 @@ const setupConnection = async (provider, option) => {
878
893
 
879
894
  // Show URL and open browser
880
895
  if (option.url && (field === 'apiKey' || field === 'sessionKey' || field === 'accessToken')) {
881
- console.log(makeLine(chalk.cyan('LINK: ') + chalk.green(option.url)));
882
- console.log(makeLine(''));
883
- console.log(makeLine(chalk.white('OPENING BROWSER...')));
884
- openBrowser(option.url);
896
+ const browserOpened = await openBrowser(option.url);
897
+ if (browserOpened) {
898
+ console.log(makeLine(chalk.green('BROWSER OPENED')));
899
+ console.log(makeLine(''));
900
+ console.log(makeLine(chalk.cyan('LINK: ') + chalk.white(option.url)));
901
+ } else {
902
+ console.log(makeLine(chalk.yellow('COULD NOT OPEN BROWSER (VPS/SSH?)')));
903
+ console.log(makeLine(''));
904
+ console.log(makeLine(chalk.white('OPEN THIS URL IN YOUR BROWSER:')));
905
+ console.log(makeLine(''));
906
+ // Split URL into chunks that fit the box width
907
+ const maxUrlLen = W - 4;
908
+ for (let i = 0; i < option.url.length; i += maxUrlLen) {
909
+ console.log(makeLine(chalk.cyan(option.url.substring(i, i + maxUrlLen))));
910
+ }
911
+ }
885
912
  }
886
913
 
887
914
  // Show default for endpoint