How to Identify Feature Names in Cypress Source Code: A Complete Guide

Feature names in Cypress are centrally defined as string literals in the FeatureFlag enum (or constant map) located at packages/config/src/featureFlags.ts, then typed in packages/types/src/studio/studio-server-types.ts and exposed via GraphQL in packages/data-context/schemas/cloud.graphql.

Cypress uses a feature-flag system to gate experimental functionality across its open-source monorepo. Understanding how to locate these identifiers is essential for contributors debugging Studio features or extending cloud integrations. This guide maps the exact file paths and search patterns needed to enumerate every available feature flag.

Where Feature Names Are Defined in the Cypress Repository

The Central Feature Flag Module

The authoritative list lives in packages/config/src/featureFlags.ts. This file exports the FeatureFlag enum (or FEATURE_FLAGS constant object) that assigns human-readable strings to each capability.

// packages/config/src/featureFlags.ts
export enum FeatureFlag {
  studioAI = 'studioAI',
  studioNonNativeEvents = 'studioNonNativeEvents',
  // Additional flags follow...
}

Importing this module provides compile-time safety, preventing typos when checking flag states elsewhere in the codebase.

TypeScript Type Definitions

Runtime type contracts are declared in packages/types/src/studio/studio-server-types.ts. This file defines the shape of the featureFlags payload sent between the Cypress binary and the Studio UI.

// packages/types/src/studio/studio-server-types.ts
export interface StudioServerTypes {
  featureFlags: {
    studioAI: boolean;
    studioNonNativeEvents: boolean;
  }
}

These interface properties mirror the enum values from the config package, ensuring type consistency across the server-client boundary.

GraphQL Schema for Cloud Integration

Flags exposed to the Cypress Cloud service are cataloged in packages/data-context/schemas/cloud.graphql. The FeatureFlags type in this schema surfaces the same identifiers to GraphQL consumers.


# packages/data-context/schemas/cloud.graphql

type FeatureFlags {
  studioAI: Boolean!
  studioNonNativeEvents: Boolean!
}

This schema synchronizes feature availability between the local app and cloud dashboards.

How to Locate Feature Names Programmatically

To discover every feature name without browsing files manually, search the repository for the enum definition and its usages.

Step 1: Search for the enum declaration using ripgrep or grep.


# From repository root

rg "export (enum|const) Feature" packages/config/src/

Step 2: Extract all values programmatically by importing the module in a TypeScript script.

import { FeatureFlag } from '@cypress/config'

// Convert enum to array of feature name strings
const allFeatureNames = Object.values(FeatureFlag) as string[]
console.log('Available Cypress features:', allFeatureNames)

Step 3: Find runtime consumption patterns to understand context. Search for isFeatureEnabled or direct featureFlags property access.

rg "isFeatureEnabled\(" packages/
rg "featureFlags\." packages/

Consuming Feature Flags in Practice

Once you have identified a feature name, use the provided utilities to check its state.

Check a flag using the helper function:

import { isFeatureEnabled, FeatureFlag } from '@cypress/config'

async function initializeStudio() {
  if (await isFeatureEnabled(FeatureFlag.studioAI)) {
    await loadAIComponents()
  }
}

Access flags from the configuration object:

import { getConfig } from '@cypress/config'

const config = await getConfig()
if (config.featureFlags?.studioNonNativeEvents) {
  enableNonNativeEventCapture()
}

Query flags via GraphQL (cloud context):

query GetCurrentFeatures {
  featureFlags {
    studioAI
    studioNonNativeEvents
  }
}

Summary

  • Feature names originate as string literals in the FeatureFlag enum at packages/config/src/featureFlags.ts.
  • Type safety is enforced by interfaces in packages/types/src/studio/studio-server-types.ts.
  • Cloud synchronization occurs through the GraphQL schema at packages/data-context/schemas/cloud.graphql.
  • Runtime detection uses isFeatureEnabled() or direct config property checks.
  • Search commands like rg "FeatureFlag" quickly reveal all usage sites across the monorepo.

Frequently Asked Questions

Where are Cypress feature flags defined?

Cypress feature flags are defined in packages/config/src/featureFlags.ts as an exported enum or constant map. This file serves as the single source of truth for all feature names used throughout the application and cloud services.

How do I check if a specific feature is enabled in Cypress?

Use the isFeatureEnabled() utility imported from @cypress/config, passing the enum member (e.g., FeatureFlag.studioAI). Alternatively, read the boolean value directly from the featureFlags property on the configuration object returned by getConfig().

Can I query feature flags from the Cypress Cloud API?

Yes. The GraphQL schema at packages/data-context/schemas/cloud.graphql exposes a FeatureFlags type with boolean fields for each flag. You can query these fields to determine which features are active for the current user session.

What is the relationship between the enum and the TypeScript interfaces?

The FeatureFlag enum in the config package provides the canonical string values, while the interfaces in the types package define the runtime object shape. This separation allows the Studio server to send feature states as JSON keys that match the enum values, maintaining type safety across the client-server boundary.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →