UNPKG

@glyphtek/scriptit

Version:

A cross-runtime CLI and library for running scripts with environment management, TUI, and support for lambda functions. Optimized for Bun with compatibility for Node.js and Deno.

37 lines 1.94 kB
import type { RunnerConfig } from "./common/types/index.js"; import { type EffectiveConfig } from "./core/index.js"; export interface ScriptExecutionResult { [key: string]: unknown; } export type ScriptEventHandler = { "script:beforeExecute": (scriptPath: string, params: Record<string, unknown>) => void; "script:afterExecute": (scriptPath: string, result: ScriptExecutionResult) => void; "script:error": (scriptPath: string, error: unknown) => void; "script:log": (scriptPath: string, message: string) => void; "tui:beforeStart": () => void; "tui:afterEnd": () => void; }; export interface CreateScriptRunnerOptions extends Partial<Omit<RunnerConfig, "loadedConfigPath">> { configFile?: string; initialEnv?: Record<string, string | undefined>; workingDirectory?: string; consoleInterception?: { enabled?: boolean; includeLevel?: boolean; preserveOriginal?: boolean; useColors?: boolean; }; } export interface ScriptRunnerInstance { config: EffectiveConfig; environment: Record<string, string | undefined>; executeScript: (scriptPath: string, executionParams?: Record<string, unknown>, customLogger?: (message: string) => void) => Promise<ScriptExecutionResult>; runTUI: () => Promise<void>; listScripts: () => Promise<string[]>; on: <K extends keyof ScriptEventHandler>(eventName: K, listener: ScriptEventHandler[K]) => ScriptRunnerInstance; off: <K extends keyof ScriptEventHandler>(eventName: K, listener: ScriptEventHandler[K]) => ScriptRunnerInstance; emit: <K extends keyof ScriptEventHandler>(eventName: K, ...args: Parameters<ScriptEventHandler[K]>) => boolean; } export declare function createScriptRunner(options?: CreateScriptRunnerOptions): Promise<ScriptRunnerInstance>; export type { RunnerConfig, ScriptContext, ScriptModule, ColoredConsole, } from "./common/types/index.js"; //# sourceMappingURL=lib.d.ts.map