import type { StarshipConfig } from "../config.js"; import type { ModuleName } from "../modules/catalog.js"; import type { WorkspaceSnapshot } from "../modules/types.js"; export interface WorkspaceExecResult { stdout: string; stderr: string; code: number; killed: boolean; } export type WorkspaceExec = ( command: string, args: string[], options: { cwd: string; timeout: number; maxOutputBytes: number; signal?: AbortSignal; environment: Readonly>; }, ) => Promise; export interface WorkspaceEntry { name: string; isFile: boolean; isDirectory: boolean; } export interface WorkspaceFileSystem { readFile(path: string, maxBytes: number): Promise; readDirectory(path: string): Promise; fileExists(path: string): Promise; } export interface WorkspaceRefreshInput { cwd: string; config: StarshipConfig; environment: Readonly>; homeDir: string; platform: NodeJS.Platform; hostname: string; username: string; exec: WorkspaceExec; fileSystem?: Partial; fileExists?(path: string): Promise; reason?: "initial" | "event" | "periodic"; previous?: WorkspaceSnapshot; signal?: AbortSignal; } export interface CollectorContext { input: WorkspaceRefreshInput; fs: WorkspaceFileSystem; requirements: ReadonlyMap>; entries(): Promise; options(name: ModuleName): Readonly>; needs(name: ModuleName, variable?: string): boolean; } export const PRIVATE_STYLE_SELECTOR = "__pi_style_selector"; export type MutableModuleSnapshot = Record>;