GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - unjs/std-env: Runtime Agnostic Env Info

BranchesTags
Open more actions menu

Latest commit

 

History

279 Commits
279 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.oxfmtrc.json
.oxfmtrc.json
 
 
.oxlintrc.json
.oxlintrc.json
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENCE
LICENCE
 
 
README.md
README.md
 
 
build.config.ts
build.config.ts
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pnpm-workspace.yaml
pnpm-workspace.yaml
 
 
renovate.json
renovate.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

std-env

npm version npm downloads bundle size

Runtime-agnostic JS utils for detecting environments, runtimes, CI providers, and AI coding agents.

Runtime Detection

Detects the current JavaScript runtime based on global variables, following the WinterCG Runtime Keys proposal.

import { runtime, runtimeInfo } from "std-env";

console.log(runtime); // "" | "node" | "deno" | "bun" | "workerd" ...
console.log(runtimeInfo); // { name: "node" }

Individual named exports: isNode, isBun, isDeno, isNetlify, isEdgeLight, isWorkerd, isFastly, isNub

Note

isNode is also true in Bun/Deno with Node.js compatibility mode. Use runtime === "node" for strict checks.

isNub detects Nub, which augments Node.js rather than replacing it. It is additive: isNode is also true and runtime stays "node".

See ./src/runtimes.ts for the full list.

Provider Detection

Detects the current CI/CD provider based on environment variables.

import { isCI, provider, providerInfo } from "std-env";

console.log({ isCI, provider, providerInfo });
// { isCI: true, provider: "github_actions", providerInfo: { name: "github_actions", ci: true } }

Use detectProvider() to re-run detection. See ./src/providers.ts for the full list.

Agent Detection

Detects if the environment is running inside an AI coding agent.

import { isAgent, agent, agentInfo } from "std-env";

console.log({ isAgent, agent, agentInfo });
// { isAgent: true, agent: "claude", agentInfo: { name: "claude" } }

Set the AI_AGENT env var to explicitly specify the agent name. GitHub Copilot aliases github_copilot_vscode_agent and github_copilot_cloud_agent are normalized to copilot. Use detectAgent() to re-run detection.

Supported agents: cursor, claude, copilot, devin, replit, gemini, codex, auggie, opencode, kiro, goose, pi, junie

Flags

import { env, isDevelopment, isProduction } from "std-env";
Export Description
hasTTY stdout TTY is available
hasWindow Global window is available
isCI Running in CI
isColorSupported Terminal color output supported
isDebug DEBUG env var is set
isDevelopment NODE_ENV is dev/development or MODE is development
isLinux Linux platform
isMacOS macOS (darwin) platform
isMinimal MINIMAL env is set, CI, test, or no TTY
isProduction NODE_ENV or MODE is production
isTest NODE_ENV is test or TEST env is set
isWindows Windows platform
platform Value of process.platform
nodeVersion Node.js version string (e.g. "22.0.0")
nodeMajorVersion Node.js major version number (e.g. 22)

See ./src/flags.ts for details.

Environment

Export Description
env Universal process.env (works across all runtimes)
process Universal process shim (works across all runtimes)
nodeENV Current NODE_ENV value (undefined if unset)

License

MIT

About

Runtime Agnostic Env Info

Topics

cicliconsoleenvironmentnodestdtty

Resources

Readme
MIT license
Activity
Custom properties

Stars

647 stars

Watchers

3 watching

Forks

46 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.