claude-scionos 4.1.5 → 4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/routerlab.js +23 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-scionos",
3
- "version": "4.1.5",
3
+ "version": "4.1.6",
4
4
  "description": "RouterLab launcher, strategy proxy and secure token wrapper for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/routerlab.js CHANGED
@@ -386,16 +386,21 @@ function commandExists(command) {
386
386
  return !result.error;
387
387
  }
388
388
 
389
- function runPowerShell(command, env = {}) {
390
- const powershell = process.env.SystemRoot
391
- ? path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe')
392
- : 'powershell.exe';
393
-
394
- const result = spawnSync(powershell, ['-NoProfile', '-NonInteractive', '-Command', command], {
395
- encoding: 'utf8',
396
- env: {
397
- ...process.env,
398
- ...env,
389
+ function runPowerShell(command, options = {}) {
390
+ const {
391
+ env = {},
392
+ input,
393
+ } = options;
394
+ const powershell = process.env.SystemRoot
395
+ ? path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe')
396
+ : 'powershell.exe';
397
+
398
+ const result = spawnSync(powershell, ['-NoProfile', '-NonInteractive', '-Command', command], {
399
+ encoding: 'utf8',
400
+ input,
401
+ env: {
402
+ ...process.env,
403
+ ...env,
399
404
  },
400
405
  });
401
406
 
@@ -439,10 +444,12 @@ function storeToken(token, serviceValue = DEFAULT_SERVICE) {
439
444
  const tokenFile = getWindowsTokenFile(service.value);
440
445
  fs.mkdirSync(path.dirname(tokenFile), {recursive: true});
441
446
  runPowerShell(
442
- '$secure = ConvertTo-SecureString $env:SCIONOS_TOKEN -AsPlainText -Force; $encrypted = ConvertFrom-SecureString $secure; Set-Content -Path $env:SCIONOS_TOKEN_FILE -Value $encrypted -NoNewline',
447
+ '$token = [Console]::In.ReadToEnd(); if ([string]::IsNullOrEmpty($token)) { throw "Token input is empty" }; $secure = ConvertTo-SecureString $token -AsPlainText -Force; $encrypted = ConvertFrom-SecureString $secure; Set-Content -Path $env:SCIONOS_TOKEN_FILE -Value $encrypted -NoNewline',
443
448
  {
444
- SCIONOS_TOKEN: token,
445
- SCIONOS_TOKEN_FILE: tokenFile,
449
+ env: {
450
+ SCIONOS_TOKEN_FILE: tokenFile,
451
+ },
452
+ input: token,
446
453
  },
447
454
  );
448
455
 
@@ -514,7 +521,9 @@ function getStoredToken(serviceValue = DEFAULT_SERVICE) {
514
521
  const token = runPowerShell(
515
522
  '$secure = Get-Content -Path $env:SCIONOS_TOKEN_FILE -Raw | ConvertTo-SecureString; $ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secure); try { [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ptr) } finally { [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ptr) }',
516
523
  {
517
- SCIONOS_TOKEN_FILE: tokenFile,
524
+ env: {
525
+ SCIONOS_TOKEN_FILE: tokenFile,
526
+ },
518
527
  },
519
528
  );
520
529
  return token || null;