//#region src/normalize.d.ts /** * Shared parsers for CI env values: ref → branch, repo string → { owner, name }, env value → deployment enum. */ type DeploymentEnvironment = ('development' | 'preview' | 'staging' | 'production' | 'test'); interface RepoParts { owner: string; name: string; } //#endregion //#region src/runtime.d.ts /** * JS runtime + OS detection, independent of CI/deploy platform detection. * Reads ambient globals (globalThis, process) rather than an env record, since these * signals (Deno global, process.versions.bun, navigator.userAgent, ...) aren't env vars. */ type JsRuntime = 'node' | 'deno' | 'bun' | 'workerd' | 'fastly' | 'netlify' | 'edge-light' | 'browser' | undefined; interface RuntimeInfo { runtime: JsRuntime; isNode: boolean; isDeno: boolean; isBun: boolean; /** Cloudflare Workers */ isWorkerd: boolean; isFastly: boolean; isNetlify: boolean; /** Generic "edge" runtime (Vercel Edge Functions, Netlify Edge Functions, ...) */ isEdgeLight: boolean; isBrowser: boolean; } /** * Detects the current JS runtime. Pass a custom `globalObj` (defaults to `globalThis`) for testing. */ declare function detectRuntime(globalObj?: any): RuntimeInfo; type OsPlatform = 'darwin' | 'win32' | 'linux' | undefined; interface OsInfo { platform: OsPlatform; isMac: boolean; isWindows: boolean; isLinux: boolean; } /** * Detects the current OS from `process.platform`. Pass a custom `processObj` for testing. * Only meaningful on Node/Bun/Deno; returns all-false when `process.platform` isn't available (e.g. browser, Workers). */ declare function detectOs(processObj?: any): OsInfo; //#endregion //#region src/types.d.ts /** Env-like object: keys are variable names, values are string or undefined (missing). */ type EnvRecord = Record; interface CiEnvInfo { isCI: boolean; name?: string; docsUrl?: string; isPR?: boolean; repo?: RepoParts; fullRepoName?: string; branch?: string; prNumber?: number; commitSha?: string; commitShaShort?: string; environment?: DeploymentEnvironment; /** Unique run/build id (e.g. GITHUB_RUN_ID, BUILD_ID) */ runId?: string; /** URL to the run or deploy in the CI/deploy UI */ buildUrl?: string; /** Workflow or pipeline name */ workflowName?: string; /** User or app that triggered the run (e.g. GITHUB_ACTOR) */ actor?: string; /** Event type (e.g. push, pull_request, workflow_dispatch) */ eventName?: string; raw?: Record; /** Ambient JS runtime info (not derived from the env record; see `detectRuntime`) */ runtime: RuntimeInfo; /** Ambient OS info (not derived from the env record; see `detectOs`) */ os: OsInfo; } //#endregion //#region src/detect.d.ts /** * Compute CiEnvInfo from the given env record. Uses in-package platform definitions. * If env.CI === 'false', returns isCI: false (escape hatch). */ declare function getCiEnv(env: EnvRecord): CiEnvInfo; /** * Convenience: compute CiEnvInfo from the current process.env. * Equivalent to getCiEnv(process.env). */ declare function getCiEnvFromProcess(): CiEnvInfo; //#endregion export { type CiEnvInfo, type DeploymentEnvironment, type EnvRecord, type JsRuntime, type OsInfo, type OsPlatform, type RuntimeInfo, detectOs, detectRuntime, getCiEnv, getCiEnvFromProcess }; //# sourceMappingURL=index.d.mts.map