@ekkos/cli 1.0.25 → 1.0.26
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/dist/commands/run.js +57 -17
- package/package.json +1 -1
package/dist/commands/run.js
CHANGED
|
@@ -400,9 +400,51 @@ function getEkkosEnv() {
|
|
|
400
400
|
}
|
|
401
401
|
return env;
|
|
402
402
|
}
|
|
403
|
-
// ekkOS-managed Claude installation path
|
|
403
|
+
// ekkOS-managed Claude installation path (npm fallback)
|
|
404
404
|
const EKKOS_CLAUDE_DIR = path.join(os.homedir(), '.ekkos', 'claude-code');
|
|
405
405
|
const EKKOS_CLAUDE_BIN = path.join(EKKOS_CLAUDE_DIR, 'node_modules', '.bin', isWindows ? 'claude.cmd' : 'claude');
|
|
406
|
+
// Native installer versions directory (Anthropic's official distribution — no npm warning)
|
|
407
|
+
// Claude Code uses XDG_DATA_HOME/.local/share on all platforms (no Windows-specific AppData branch).
|
|
408
|
+
// On Windows this resolves to %USERPROFILE%\.local\share\claude\versions\<version>
|
|
409
|
+
const NATIVE_CLAUDE_VERSIONS_DIR = path.join(process.env.XDG_DATA_HOME || path.join(os.homedir(), '.local', 'share'), 'claude', 'versions');
|
|
410
|
+
/**
|
|
411
|
+
* Find the latest native-installed Claude binary.
|
|
412
|
+
* Anthropic's native installer puts versioned binaries under ~/.local/share/claude/versions/<version>
|
|
413
|
+
* These do NOT print the npm-to-native migration warning.
|
|
414
|
+
* Returns the path to the latest binary, or null if none found.
|
|
415
|
+
*/
|
|
416
|
+
function resolveNativeClaudeBin() {
|
|
417
|
+
try {
|
|
418
|
+
if (!fs.existsSync(NATIVE_CLAUDE_VERSIONS_DIR))
|
|
419
|
+
return null;
|
|
420
|
+
const entries = fs.readdirSync(NATIVE_CLAUDE_VERSIONS_DIR)
|
|
421
|
+
.filter(v => !v.endsWith('.tmp') && !v.endsWith('.lock'));
|
|
422
|
+
// Strip .exe suffix for sorting, then pick latest semver
|
|
423
|
+
const versions = entries
|
|
424
|
+
.map(v => v.replace(/\.exe$/i, ''))
|
|
425
|
+
.filter(v => /^\d+\.\d+\.\d+$/.test(v))
|
|
426
|
+
.sort((a, b) => {
|
|
427
|
+
const pa = a.split('.').map(Number);
|
|
428
|
+
const pb = b.split('.').map(Number);
|
|
429
|
+
for (let i = 0; i < 3; i++) {
|
|
430
|
+
if ((pa[i] || 0) !== (pb[i] || 0))
|
|
431
|
+
return (pb[i] || 0) - (pa[i] || 0);
|
|
432
|
+
}
|
|
433
|
+
return 0;
|
|
434
|
+
});
|
|
435
|
+
if (versions.length === 0)
|
|
436
|
+
return null;
|
|
437
|
+
// On Windows the binary is named "<version>.exe", on Unix just "<version>"
|
|
438
|
+
const binName = isWindows ? `${versions[0]}.exe` : versions[0];
|
|
439
|
+
const bin = path.join(NATIVE_CLAUDE_VERSIONS_DIR, binName);
|
|
440
|
+
if (fs.existsSync(bin) && fs.statSync(bin).isFile())
|
|
441
|
+
return bin;
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
catch {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
406
448
|
/**
|
|
407
449
|
* Check if a Claude installation exists and get its version
|
|
408
450
|
* Returns version string if found, null otherwise
|
|
@@ -504,34 +546,32 @@ function installEkkosClaudeVersion() {
|
|
|
504
546
|
}
|
|
505
547
|
}
|
|
506
548
|
/**
|
|
507
|
-
* Resolve full path to claude executable
|
|
508
|
-
* Returns direct path if found with correct version, otherwise 'npx:VERSION'
|
|
509
|
-
*
|
|
510
|
-
* IMPORTANT: We pin to a specific Claude Code version (currently 2.1.33) to ensure
|
|
511
|
-
* consistent behavior with ekkOS context management and eviction patches.
|
|
512
|
-
*
|
|
513
|
-
* CRITICAL: ekkos run ONLY uses the ekkOS-managed installation at ~/.ekkos/claude-code/
|
|
514
|
-
* This ensures complete separation from the user's existing Claude installation (Homebrew/npm).
|
|
515
|
-
* The user's `claude` command remains untouched and can be any version.
|
|
549
|
+
* Resolve full path to claude executable.
|
|
516
550
|
*
|
|
517
551
|
* Priority:
|
|
518
|
-
* 1.
|
|
519
|
-
* 2.
|
|
520
|
-
* 3.
|
|
552
|
+
* 1. Native installer binary (~/.local/share/claude/versions/<latest>) — no npm warning
|
|
553
|
+
* 2. ekkOS-managed npm installation (~/.ekkos/claude-code) — existing installs
|
|
554
|
+
* 3. Auto-install via npm to ekkOS-managed directory
|
|
555
|
+
* 4. npx fallback (rare, shows npm deprecation warning)
|
|
521
556
|
*/
|
|
522
557
|
function resolveClaudePath() {
|
|
523
|
-
// PRIORITY 1:
|
|
558
|
+
// PRIORITY 1: Native installer binary (Anthropic's official distribution)
|
|
559
|
+
// These binaries do not print the npm-to-native migration warning.
|
|
560
|
+
const nativeBin = resolveNativeClaudeBin();
|
|
561
|
+
if (nativeBin) {
|
|
562
|
+
return nativeBin;
|
|
563
|
+
}
|
|
564
|
+
// PRIORITY 2: ekkOS-managed npm installation (existing users before native installer)
|
|
524
565
|
if (fs.existsSync(EKKOS_CLAUDE_BIN) && checkClaudeVersion(EKKOS_CLAUDE_BIN)) {
|
|
525
566
|
return EKKOS_CLAUDE_BIN;
|
|
526
567
|
}
|
|
527
|
-
// PRIORITY
|
|
568
|
+
// PRIORITY 3: Auto-install to ekkOS-managed directory
|
|
528
569
|
if (installEkkosClaudeVersion()) {
|
|
529
570
|
if (fs.existsSync(EKKOS_CLAUDE_BIN)) {
|
|
530
571
|
return EKKOS_CLAUDE_BIN;
|
|
531
572
|
}
|
|
532
573
|
}
|
|
533
|
-
// PRIORITY
|
|
534
|
-
// This is rare - only happens if install failed
|
|
574
|
+
// PRIORITY 4: Fall back to npx (rare — only if install failed, will show deprecation warning)
|
|
535
575
|
return `npx:${PINNED_CLAUDE_VERSION}`;
|
|
536
576
|
}
|
|
537
577
|
/**
|