claude-scionos 4.1.4 → 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.
package/README.fr.md CHANGED
@@ -87,11 +87,13 @@ Ordre de résolution du token :
87
87
  3. stockage local sécurisé spécifique au service via `claude-scionos auth login --service llm`
88
88
  4. saisie manuelle en mode guidé
89
89
 
90
- Backends de stockage sécurisés :
91
-
92
- - Windows : fichier local chiffré via DPAPI, lié à l'utilisateur courant
93
- - macOS : Keychain
94
- - Linux : Secret Service via `secret-tool`
90
+ Backends de stockage sécurisés :
91
+
92
+ - Windows : fichier local chiffré via DPAPI, lié à l'utilisateur courant
93
+ - macOS : Keychain
94
+ - Linux : Secret Service via `secret-tool`
95
+
96
+ Sous Windows, si le fichier local du token est vide ou corrompu, `claude-scionos` le traite désormais comme absent au lieu d'essayer de l'utiliser. Il faut relancer `claude-scionos auth login` pour enregistrer un nouveau token.
95
97
 
96
98
  Gestion du token :
97
99
 
@@ -130,12 +132,13 @@ Le wrapper transmet les arguments Claude Code habituels. Le proxy local n'est la
130
132
 
131
133
  `claude-scionos doctor` doit être la première commande à lancer quand un client signale un problème.
132
134
 
133
- Cas courants :
134
-
135
- - `Claude Code CLI not found` : installer `@anthropic-ai/claude-code`
136
- - `Git Bash is required on Windows` : installer Git for Windows
137
- - `ANTHROPIC_AUTH_TOKEN ... is required when using --no-prompt` : définir la variable d'environnement ou stocker le token au préalable
138
- - `secret-tool not found` : installer un client Secret Service sous Linux ou utiliser la variable d'environnement
135
+ Cas courants :
136
+
137
+ - `Claude Code CLI not found` : installer `@anthropic-ai/claude-code`
138
+ - `Git Bash is required on Windows` : installer Git for Windows
139
+ - `ANTHROPIC_AUTH_TOKEN ... is required when using --no-prompt` : définir la variable d'environnement ou stocker le token au préalable
140
+ - `Stored token` est indiqué comme absent sous Windows alors qu'un login a déjà été fait : relancer `claude-scionos auth login`, car le fichier DPAPI local peut être vide ou corrompu
141
+ - `secret-tool not found` : installer un client Secret Service sous Linux ou utiliser la variable d'environnement
139
142
 
140
143
  ## Développement
141
144
 
package/README.md CHANGED
@@ -87,11 +87,13 @@ Token resolution order:
87
87
  3. Service-specific secure local storage from `claude-scionos auth login --service llm`
88
88
  4. Manual prompt in guided mode
89
89
 
90
- Secure storage backends:
91
-
92
- - Windows: DPAPI-encrypted local file bound to the current user
93
- - macOS: Keychain
94
- - Linux: Secret Service via `secret-tool`
90
+ Secure storage backends:
91
+
92
+ - Windows: DPAPI-encrypted local file bound to the current user
93
+ - macOS: Keychain
94
+ - Linux: Secret Service via `secret-tool`
95
+
96
+ On Windows, if the secure token file is empty or corrupted, `claude-scionos` now treats it as missing instead of trying to use it. Run `claude-scionos auth login` again to store a fresh token.
95
97
 
96
98
  Manage the token with:
97
99
 
@@ -130,12 +132,13 @@ The wrapper forwards regular Claude Code flags and arguments. The local proxy is
130
132
 
131
133
  `claude-scionos doctor` should be the first command to run when a client reports an issue.
132
134
 
133
- Common cases:
134
-
135
- - `Claude Code CLI not found`: install `@anthropic-ai/claude-code`
136
- - `Git Bash is required on Windows`: install Git for Windows
137
- - `ANTHROPIC_AUTH_TOKEN ... is required when using --no-prompt`: set the environment variable or store the token first
138
- - `secret-tool not found`: install a Secret Service client on Linux or rely on the environment variable
135
+ Common cases:
136
+
137
+ - `Claude Code CLI not found`: install `@anthropic-ai/claude-code`
138
+ - `Git Bash is required on Windows`: install Git for Windows
139
+ - `ANTHROPIC_AUTH_TOKEN ... is required when using --no-prompt`: set the environment variable or store the token first
140
+ - `Stored token` is missing on Windows even though you already logged in: re-run `claude-scionos auth login` because the local DPAPI token file may be empty or corrupted
141
+ - `secret-tool not found`: install a Secret Service client on Linux or rely on the environment variable
139
142
 
140
143
  ## Development
141
144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-scionos",
3
- "version": "4.1.4",
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
@@ -199,6 +199,14 @@ function getWindowsTokenFile(serviceValue = DEFAULT_SERVICE) {
199
199
  return path.join(os.homedir(), '.claude-scionos', service.secureStorageFileName);
200
200
  }
201
201
 
202
+ function hasNonEmptyWindowsTokenFile(tokenFile) {
203
+ try {
204
+ return fs.statSync(tokenFile).size > 0;
205
+ } catch {
206
+ return false;
207
+ }
208
+ }
209
+
202
210
  function getServiceStrategies(serviceValue = DEFAULT_SERVICE) {
203
211
  const service = getServiceConfig(serviceValue);
204
212
  if (!service?.strategyValues?.length) {
@@ -378,16 +386,21 @@ function commandExists(command) {
378
386
  return !result.error;
379
387
  }
380
388
 
381
- function runPowerShell(command, env = {}) {
382
- const powershell = process.env.SystemRoot
383
- ? path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe')
384
- : 'powershell.exe';
385
-
386
- const result = spawnSync(powershell, ['-NoProfile', '-NonInteractive', '-Command', command], {
387
- encoding: 'utf8',
388
- env: {
389
- ...process.env,
390
- ...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,
391
404
  },
392
405
  });
393
406
 
@@ -431,14 +444,21 @@ function storeToken(token, serviceValue = DEFAULT_SERVICE) {
431
444
  const tokenFile = getWindowsTokenFile(service.value);
432
445
  fs.mkdirSync(path.dirname(tokenFile), {recursive: true});
433
446
  runPowerShell(
434
- '$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',
435
448
  {
436
- SCIONOS_TOKEN: token,
437
- SCIONOS_TOKEN_FILE: tokenFile,
449
+ env: {
450
+ SCIONOS_TOKEN_FILE: tokenFile,
451
+ },
452
+ input: token,
438
453
  },
439
454
  );
455
+
456
+ if (!hasNonEmptyWindowsTokenFile(tokenFile)) {
457
+ throw new Error('Secure token file was created but no encrypted content was written');
458
+ }
459
+
440
460
  return storage;
441
- }
461
+ }
442
462
 
443
463
  if (process.platform === 'darwin') {
444
464
  const result = runCommand('security', [
@@ -494,10 +514,16 @@ function getStoredToken(serviceValue = DEFAULT_SERVICE) {
494
514
  return null;
495
515
  }
496
516
 
517
+ if (!hasNonEmptyWindowsTokenFile(tokenFile)) {
518
+ return null;
519
+ }
520
+
497
521
  const token = runPowerShell(
498
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) }',
499
523
  {
500
- SCIONOS_TOKEN_FILE: tokenFile,
524
+ env: {
525
+ SCIONOS_TOKEN_FILE: tokenFile,
526
+ },
501
527
  },
502
528
  );
503
529
  return token || null;