Files
ccs/src/cliproxy/binary/extractor.ts
T
kaitranntt 2794a548a5 fix(cliproxy): complete backend switching with proper binary extraction
- Add backend field to BinaryManagerConfig type for installer context
- Thread backend parameter through tar/zip extractors to use correct names
- Delete existing binary before install to prevent mismatched binaries
- Track backend in session metadata for debugging/monitoring
- Validate and preserve backend field in config mergeWithDefaults
- Pass backend to registerSession for session tracking

The core issue was extractors calling getExecutableName() without the
backend parameter, causing it to default to 'plus' regardless of user
selection. This resulted in wrong binaries being extracted/renamed.
2026-01-23 15:17:32 -05:00

31 lines
831 B
TypeScript

/**
* Archive Extractor
* Facade for tar.gz and zip archive extraction.
*/
import { ArchiveExtension, CLIProxyBackend } from '../types';
import { DEFAULT_BACKEND } from '../platform-detector';
import { extractTarGz } from './tar-extractor';
import { extractZip } from './zip-extractor';
// Re-export for convenience
export { extractTarGz } from './tar-extractor';
export { extractZip } from './zip-extractor';
/**
* Extract archive based on extension
*/
export async function extractArchive(
archivePath: string,
destDir: string,
extension: ArchiveExtension,
verbose = false,
backend: CLIProxyBackend = DEFAULT_BACKEND
): Promise<void> {
if (extension === 'tar.gz') {
await extractTarGz(archivePath, destDir, verbose, backend);
} else {
await extractZip(archivePath, destDir, verbose, backend);
}
}