#!/usr/bin/env node import { type ProviderRegistry } from './providers/registry.js'; import type { ProviderInput, ProviderName, ProviderOutput } from './providers/types.js'; export type BranchAction = { action: 'up'; } | { action: 'attach'; } | { action: 'stop'; } | { action: 'rm'; } | { action: 'url'; open: boolean; } | { action: 'password'; }; export declare class CliUsageError extends Error { readonly exitCode = 2; constructor(message: string); } export type ParsedCommand = { kind: 'init'; force: boolean; } | { kind: 'list'; provider?: ProviderName; } | { kind: 'set-provider'; provider: ProviderName; } | { kind: 'branch'; branch: string; provider?: ProviderName; action: BranchAction; envPath?: string; exposePorts?: number[]; timeoutMs?: number; vcpus?: number; } | { kind: 'help'; scope: 'global' | 'init' | 'list' | 'branch'; branch?: string; action?: BranchAction; } | { kind: 'version'; } | { kind: 'error'; message: string; exitCode: number; }; /** * Resolve a branch action from validated action flags. * --open/-o implies --url and may be paired with --url itself. */ export declare function resolveBranchAction(rest: string[]): BranchAction; /** Parse the CLI grammar without touching the repository or a provider. */ export declare function parseCliArgs(args: string[]): ParsedCommand; /** Alias retained as the parser's public, descriptive entry point. */ export declare const parseArgs: typeof parseCliArgs; export interface DispatchIO { stdin: ProviderInput; stdout: ProviderOutput; stderr: ProviderOutput; } export interface DispatchOptions { providerRegistry?: ProviderRegistry; /** Overridable for tests; defaults to the XDG state home. */ stateHome?: string; /** Alias useful for callers embedding the parser/dispatcher. */ registry?: ProviderRegistry; repoRoot?: string | null; env?: Record; tty?: boolean; } export declare function dispatch(args: string[], io: DispatchIO, options?: DispatchOptions): Promise; /** * Determine whether this module is the process entry point. * * When installed globally via npm, the `devbox` bin is a symlink to * `dist/cli.js`. `process.argv[1]` is the symlink path, while `import.meta.url` * is the real file URL — they don't match string-for-string. Resolve both to * their real paths and compare those. */ export declare function isMainEntry(argv1: string, moduleUrl: string): boolean;