/** * GitHub Codespaces CLI Wrapper * * Low-level `gh` CLI wrapper for codespace lifecycle management, * remote command execution, and port forwarding. * * All functions shell out to the `gh` CLI via child_process.exec. * The consuming Provider class handles mapping these results to * the unified Workspace type. * * @see i-1f59 - Port Codespaces CLI utilities from deprecated code * @see s-84xz - Codespaces Provider Implementation specification */ import type { ExecResult } from '../types.js'; export type { ExecResult }; /** * Codespace info as returned by the gh CLI (JSON output). */ export interface GhCodespace { name: string; state: string; repository: string; createdAt: string; lastUsedAt?: string; } /** * Port info as returned by `gh codespace ports --json`. */ export interface GhPort { sourcePort: number; browseUrl: string; } /** * Execute a command in a codespace via SSH using a login shell. * * Uses base64 encoding to avoid all quoting/escaping issues when passing * commands through SSH. The command is decoded and executed inside a * `bash -l -c` login shell for proper environment setup. * * @param name - Codespace name * @param command - Command to execute * @param options - Execution options * @returns ExecResult with exitCode, stdout, stderr */ export declare function execInCodespace(name: string, command: string, options?: { background?: boolean; timeout?: number; }): Promise; /** * Create a new GitHub Codespace. * * @returns The codespace name (string output from gh CLI). */ export declare function createCodespace(repo: string, branch: string, machine: string, retentionDays: number): Promise; /** * Start a stopped codespace. * * The gh CLI has no dedicated `start` subcommand. SSHing into a stopped * codespace triggers an auto-start, so we run a no-op command via SSH. */ export declare function startCodespace(name: string): Promise; /** * Stop a running codespace. */ export declare function stopCodespace(name: string): Promise; /** * Delete a codespace (force). */ export declare function deleteCodespace(name: string): Promise; /** * Get info about a specific codespace. * * @returns Codespace info, or null if not found. */ export declare function getCodespace(name: string): Promise; /** * List all codespaces for the authenticated user. */ export declare function listCodespaces(): Promise; /** * Register a codespace port with GitHub's forwarding system. * * Spawns a `gh codespace ports forward` process, waits briefly for the port * to register, then kills the process. The port remains registered with * GitHub after the forward process exits. * * Handles local port conflicts by incrementing the local port until an * available one is found (tries up to 20 ports). The local port doesn't * matter for registration — only the remote codespace port matters. * * @param name - Codespace name * @param port - Remote codespace port to register */ export declare function forwardPort(name: string, port: number): Promise; /** * Get the public browse URL for a forwarded codespace port. * * Queries GitHub's port forwarding system for the public URL. The port * must have been registered via `forwardPort` first. * * @param name - Codespace name * @param port - Remote codespace port * @returns The public browse URL (e.g. https://name-3000.app.github.dev) */ export declare function getPortUrl(name: string, port: number): Promise; /** * Get all forwarded ports for a codespace. */ export declare function getPorts(name: string): Promise; //# sourceMappingURL=cli.d.ts.map