UNPKG

@xec-sh/core

Version:

Universal shell execution engine

48 lines (47 loc) 1.75 kB
import type { SSHAdapterOptions } from '../core/command.js'; import type { ProcessPromise, ExecutionEngine } from '../core/execution-engine.js'; export interface SSHTunnel { localPort: number; localHost: string; remoteHost: string; remotePort: number; isOpen: boolean; open(): Promise<void>; close(): Promise<void>; } export interface SSHExecutionContext { (strings: TemplateStringsArray, ...values: any[]): ProcessPromise; exec(strings: TemplateStringsArray, ...values: any[]): ProcessPromise; raw(strings: TemplateStringsArray, ...values: any[]): ProcessPromise; tunnel(options: { localPort?: number; localHost?: string; remoteHost: string; remotePort: number; }): Promise<SSHTunnel>; uploadFile(localPath: string, remotePath: string): Promise<void>; downloadFile(remotePath: string, localPath: string): Promise<void>; uploadDirectory(localPath: string, remotePath: string): Promise<void>; env(env: Record<string, string>): SSHExecutionContext; cd(dir: string): SSHExecutionContext; timeout(ms: number): SSHExecutionContext; shell(shell: string | boolean): SSHExecutionContext; retry(options: { maxRetries?: number; initialDelay?: number; maxDelay?: number; factor?: number; }): SSHExecutionContext; } export declare function createSSHExecutionContext(engine: ExecutionEngine, sshOptions: Omit<SSHAdapterOptions, 'type'>, commandConfig?: { env?: Record<string, string>; cwd?: string; timeout?: number; shell?: string | boolean; retry?: { maxRetries?: number; initialDelay?: number; maxDelay?: number; factor?: number; }; }): SSHExecutionContext;