Skip to content

@jsvision/ui / resolveCapabilities

Function: resolveCapabilities()

resolveCapabilities(options?): CapabilityResolution

Defined in: core/dist/engine/capability/index.d.ts:51

Detect the running terminal's capabilities synchronously from environment variables and the known-terminal table.

With no options, the result is computed once and cached for the process; pass refresh: true to recompute. Every input is injectable (env, platform, override) so you can force a specific configuration or keep tests hermetic. For the most accurate detection (a live terminal probe), use resolveCapabilitiesAsync.

Parameters

options?

SyncResolveOptions

Optional override (force fields), injected env/platform, and a refresh flag to bypass the cache.

Returns

CapabilityResolution

A deep-frozen { profile, reasons }. Read .profile for the caps.

Example

ts
import { resolveCapabilities } from '@jsvision/core';

// Ambient detection (cached per process):
const caps = resolveCapabilities().profile;
if (caps.colorDepth === 'truecolor') { ... }

// Force a configuration (e.g. for a test or a screenshot):
const forced = resolveCapabilities({
  override: { colorDepth: 'truecolor', altScreen: true },
}).profile;