vybcel
Version:
Vybcel Development Agent and Vite Plugin for seamless code sync and auto-deploy
118 lines (111 loc) • 3.2 kB
text/typescript
import { Plugin } from 'vite';
interface AgentConfig {
projectId: string;
wsUrl: string;
debug?: boolean;
toolbar?: {
enabled?: boolean;
position?: 'top' | 'bottom';
autoOpen?: boolean;
};
}
interface FileChange {
projectId: string;
filePath: string;
content: string;
hash: string;
timestamp: number;
}
interface FileDelete {
projectId: string;
filePath: string;
timestamp: number;
}
declare class VybcelAgent {
private socket;
private watcher;
private httpServer;
private isConnected;
private isGitRepo;
private config;
constructor(config: AgentConfig);
start(): Promise<void>;
private startLocalServer;
private openUrlInSystem;
private checkGitRepository;
private initializeGitRepository;
private connectWebSocket;
private setupEventHandlers;
private discardLocalChanges;
private gitPullWithToken;
private updateLocalFiles;
private startFileWatcher;
private handleFileChange;
private handleFileDelete;
private openPreviewIfEnabled;
stop(): void;
}
interface VersionInfo {
current: string;
latest?: string;
hasUpdate: boolean;
}
/**
* Получает текущую версию из package.json
*/
declare function getCurrentVersion(): string;
/**
* Сравнивает две версии (семантическое версионирование)
*/
declare function isNewerVersion(latest: string, current: string): boolean;
/**
* Выполняет полную проверку версии и возвращает информацию
*/
declare function checkForUpdates(wsUrl: string): Promise<VersionInfo>;
interface VSCodeConfig {
autoOpen: boolean;
port: number;
url?: string;
}
/**
* Детектирует, запущен ли VS Code или Cursor
*/
declare function detectVSCode(): boolean;
/**
* Основная функция для открытия превью
*/
declare function openPreview(config: VSCodeConfig, debug?: boolean): Promise<void>;
interface VybcelConfig {
projectId: string;
wsUrl?: string;
debug?: boolean;
toolbar?: {
enabled?: boolean;
position?: 'top' | 'bottom';
autoUpdate?: boolean;
updateChannel?: 'stable' | 'beta' | 'dev';
};
}
interface VybcelPluginOptions {
configPath?: string;
websocketUrl?: string;
autoUpdate?: boolean;
updateEndpoint?: string;
}
interface ToolbarVersion {
version: string;
build: number;
channel: 'stable' | 'beta' | 'dev';
url: string;
checksum: string;
releaseNotes?: string;
timestamp: number;
}
interface UpdateCheckResponse {
hasUpdate: boolean;
currentVersion: string;
latestVersion?: ToolbarVersion;
forceUpdate?: boolean;
}
declare function vybcelPlugin(options?: VybcelPluginOptions): Plugin;
export { type AgentConfig, type FileChange, type FileDelete, type ToolbarVersion, type UpdateCheckResponse, type VSCodeConfig, type VersionInfo, VybcelAgent, type VybcelConfig, type VybcelPluginOptions, checkForUpdates, detectVSCode, getCurrentVersion, isNewerVersion, openPreview, vybcelPlugin as plugin };