blun-king-cli 9.1.4 → 9.1.6

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.
@@ -81,13 +81,21 @@ function readPackageVersion() {
81
81
  return version;
82
82
  }
83
83
 
84
+ function shouldDetachProtectedCore(options = {}) {
85
+ const platform = options.platform || process.platform;
86
+ const stdinIsTTY = Object.hasOwn(options, 'stdinIsTTY')
87
+ ? options.stdinIsTTY
88
+ : process.stdin.isTTY;
89
+ return platform !== 'win32' || stdinIsTTY !== true;
90
+ }
91
+
84
92
  function spawnProtectedCore(args, env, cwd) {
85
93
  const child = spawn(
86
94
  process.execPath,
87
95
  [path.join(PKG, 'bin', 'core-bootstrap.js'), ...args],
88
96
  {
89
97
  cwd,
90
- detached: true,
98
+ detached: shouldDetachProtectedCore(),
91
99
  env,
92
100
  stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
93
101
  windowsHide: true,
@@ -290,4 +298,4 @@ async function runLauncher(options = {}) {
290
298
  }
291
299
  }
292
300
 
293
- module.exports = { resolveLauncherPrivatePaths, runLauncher };
301
+ module.exports = { resolveLauncherPrivatePaths, runLauncher, shouldDetachProtectedCore };
@@ -620,10 +620,19 @@ function createInstallInvocation(version, options = {}) {
620
620
  if (platform !== 'win32' && path.basename(installPrefix) === 'lib') {
621
621
  installPrefix = path.dirname(installPrefix);
622
622
  }
623
- let npmConfigPath;
624
- if (options.npmConfigPath) {
625
- npmConfigPath = fs.realpathSync(path.resolve(options.npmConfigPath));
626
- if (!fs.statSync(npmConfigPath).isFile()) throw new Error('INVALID_NPM_CONFIG_PATH');
623
+ let npmUserConfigPath;
624
+ let npmGlobalConfigPath;
625
+ if (options.npmUserConfigPath || options.npmGlobalConfigPath) {
626
+ if (!options.npmUserConfigPath || !options.npmGlobalConfigPath) {
627
+ throw new Error('INVALID_NPM_CONFIG_PATHS');
628
+ }
629
+ npmUserConfigPath = fs.realpathSync(path.resolve(options.npmUserConfigPath));
630
+ npmGlobalConfigPath = fs.realpathSync(path.resolve(options.npmGlobalConfigPath));
631
+ if (!fs.statSync(npmUserConfigPath).isFile()
632
+ || !fs.statSync(npmGlobalConfigPath).isFile()
633
+ || npmUserConfigPath === npmGlobalConfigPath) {
634
+ throw new Error('INVALID_NPM_CONFIG_PATHS');
635
+ }
627
636
  }
628
637
  return {
629
638
  command: execPath,
@@ -638,16 +647,21 @@ function createInstallInvocation(version, options = {}) {
638
647
  '--ignore-scripts=false',
639
648
  '--package-lock-only=false',
640
649
  `--prefix=${installPrefix}`,
641
- ...(npmConfigPath ? [
642
- `--userconfig=${npmConfigPath}`,
643
- `--globalconfig=${npmConfigPath}`,
650
+ ...(npmUserConfigPath ? [
651
+ `--userconfig=${npmUserConfigPath}`,
652
+ `--globalconfig=${npmGlobalConfigPath}`,
644
653
  ] : []),
645
654
  ],
646
655
  windowsVerbatimArguments: false,
647
656
  };
648
657
  }
649
658
 
650
- function createInstallEnvironment(sourceEnv, installDirectory, npmConfigPath) {
659
+ function createInstallEnvironment(
660
+ sourceEnv,
661
+ installDirectory,
662
+ npmUserConfigPath,
663
+ npmGlobalConfigPath,
664
+ ) {
651
665
  const allowedKeys = new Set([
652
666
  'appdata',
653
667
  'comspec',
@@ -685,8 +699,8 @@ function createInstallEnvironment(sourceEnv, installDirectory, npmConfigPath) {
685
699
  result.npm_config_dry_run = 'false';
686
700
  result.npm_config_ignore_scripts = 'false';
687
701
  result.npm_config_package_lock_only = 'false';
688
- result.npm_config_userconfig = npmConfigPath;
689
- result.npm_config_globalconfig = npmConfigPath;
702
+ result.npm_config_userconfig = npmUserConfigPath;
703
+ result.npm_config_globalconfig = npmGlobalConfigPath;
690
704
  return result;
691
705
  }
692
706
 
@@ -763,7 +777,8 @@ function preparePinnedInstaller(version, options = {}) {
763
777
  let closeSettled = false;
764
778
  let selectedAction;
765
779
  let installDirectory;
766
- let npmConfigPath;
780
+ let npmUserConfigPath;
781
+ let npmGlobalConfigPath;
767
782
  let disconnectTimer;
768
783
  const close = Promise.withResolvers();
769
784
  const closePromise = close.promise;
@@ -848,9 +863,15 @@ function preparePinnedInstaller(version, options = {}) {
848
863
  resolveInstallTempRoot(options),
849
864
  options.blunDir,
850
865
  );
851
- npmConfigPath = path.join(installDirectory, 'npmrc');
852
- writePrivateFile(npmConfigPath, '');
853
- invocation = createInstallInvocation(version, { ...options, npmConfigPath });
866
+ npmUserConfigPath = path.join(installDirectory, 'user-npmrc');
867
+ npmGlobalConfigPath = path.join(installDirectory, 'global-npmrc');
868
+ writePrivateFile(npmUserConfigPath, '');
869
+ writePrivateFile(npmGlobalConfigPath, '');
870
+ invocation = createInstallInvocation(version, {
871
+ ...options,
872
+ npmUserConfigPath,
873
+ npmGlobalConfigPath,
874
+ });
854
875
  child = forkImpl(path.join(__dirname, 'update-lease.js'), ['--installer-worker'], {
855
876
  detached: true,
856
877
  execPath: invocation.command,
@@ -858,7 +879,8 @@ function preparePinnedInstaller(version, options = {}) {
858
879
  env: createInstallEnvironment(
859
880
  options.env || process.env,
860
881
  installDirectory,
861
- npmConfigPath,
882
+ npmUserConfigPath,
883
+ npmGlobalConfigPath,
862
884
  ),
863
885
  stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
864
886
  windowsHide: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.4",
3
+ "version": "9.1.6",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {