# Configuration Management Libraries in ContinueDev/Continue: A Complete Technical Guide

> Explore the configuration management libraries in continuedev/continue. Learn how YAML, Zod, Dotenv and more parse and validate user settings for seamless integration.

- Repository: [Continue/continue](https://github.com/continuedev/continue)
- Tags: deep-dive
- Published: 2026-06-18

---

**Continue uses a stack of six specialized Node.js libraries—`@continuedev/config-yaml`, `@continuedev/config-types`, `yaml`, `zod`, `dotenv`, and `comment-json`—to parse, validate, and load user configurations from YAML, JSON, and environment files.**

The open-source Continue project relies on a modular architecture for handling user settings across its VS Code extension, CLI client, and core runtime. Understanding the configuration management libraries in continuedev/continue reveals how the tool securely processes API keys, validates model definitions, and maintains backward compatibility with legacy JSON configs while supporting modern YAML workflows.

## Core Configuration Management Libraries

Continue’s configuration system is decentralized across two internal monorepo packages and four external dependencies. Each library serves a distinct purpose in the configuration pipeline.

### @continuedev/config-yaml and @continuedev/config-types

The `@continuedev/config-yaml` package serves as the primary abstraction layer for reading and converting user configuration files. It exports utilities like `loadConfig` and `convertJsonToYamlConfig`, and ships with a CLI tool (`config-yaml`) used by both the VS Code extension and CLI client. This package is declared in [[`packages/config-yaml/package.json`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/package.json)](https://github.com/continuedev/continue/blob/main/packages/config-yaml/package.json).

Complementing this, `@continuedev/config-types` provides shared TypeScript definitions and Zod schemas that describe the shape of a Continue configuration. Other packages import these types to avoid pulling in the full `config-yaml` implementation, reducing bundle size. You can find its definition in [[`packages/config-types/package.json`](https://github.com/continuedev/continue/blob/main/packages/config-types/package.json)](https://github.com/continuedev/continue/blob/main/packages/config-types/package.json).

### yaml and comment-json for File Parsing

For actual file parsing, Continue uses the `yaml` library to handle [`config.yaml`](https://github.com/continuedev/continue/blob/main/config.yaml) files. It is imported in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts#L5) and used to convert raw YAML strings into JavaScript objects.

To support legacy configurations, the `comment-json` library parses JSON files that may contain comments (such as [`config.json`](https://github.com/continuedev/continue/blob/main/config.json)). Unlike standard `JSON.parse()`, this preserves comments when files are edited programmatically. It is imported in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts#L8).

### zod for Schema Validation

The `zod` library acts as the schema-validation engine throughout the codebase. It defines strict shapes for model definitions, tool overrides, and agent configurations. Declared as a dependency in both [[`packages/config-yaml/package.json`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/package.json)](https://github.com/continuedev/continue/blob/main/packages/config-yaml/package.json#L27) and [[`packages/config-types/package.json`](https://github.com/continuedev/continue/blob/main/packages/config-types/package.json)](https://github.com/continuedev/continue/blob/main/packages/config-types/package.json#L19), Zod validates configurations at runtime, providing detailed error messages when users supply malformed settings.

### dotenv for Secret Management

Before parsing YAML or JSON, Continue loads environment variables using `dotenv`. This reads a `.env` file located at `~/.continue/.env` and injects values into `process.env`. This approach keeps API keys and tokens out of source control. The implementation resides in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts#L9-L15) via the `getContinueDotEnv` function.

## The Configuration Loading Pipeline

The configuration management libraries work in a strict four-stage pipeline to ensure security and type safety:

1. **Environment Injection** – `dotenv` loads secrets from `~/.continue/.env` into the process environment, making API keys available before configuration parsing begins.

2. **File Parsing** – `yaml` and `comment-json` parse the user’s [`config.yaml`](https://github.com/continuedev/continue/blob/main/config.yaml) or [`config.json`](https://github.com/continuedev/continue/blob/main/config.json) into plain JavaScript objects, handling comments and multi-document YAML where necessary.

3. **Schema Validation** – `zod` validates the parsed object against strict TypeScript schemas exported from `@continuedev/config-types`, catching type mismatches and missing required fields.

4. **API Consumption** – `@continuedev/config-yaml` wraps the validated data into typed objects (like `ConfigYaml`) that the VS Code extension, CLI, and core runtime consume through functions like `loadConfig`.

## Working with Configuration in Code

The following examples demonstrate how these libraries integrate into Continue’s actual source code.

### Loading the Primary Configuration

The core runtime uses `getPrimaryConfigFilePath` combined with the `yaml` parser to load settings:

```typescript
import { getPrimaryConfigFilePath } from "@continuedev/continue";
import { ConfigYaml } from "@continuedev/config-yaml";
import * as YAML from "yaml";
import * as fs from "fs";

export async function loadContinueConfig(): Promise<ConfigYaml> {
  const path = getPrimaryConfigFilePath();            // <-- core/util/paths.ts
  const raw = fs.readFileSync(path, "utf8");
  return YAML.parse(raw) as ConfigYaml;               // validated later by Zod
}

```

The `getPrimaryConfigFilePath` helper is defined in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts#L32-L38) and handles platform-specific path resolution.

### Converting JSON to YAML via CLI

Users can convert legacy JSON configurations to YAML using the CLI helper bundled with `@continuedev/config-yaml`:

```bash
npx config-yaml convert ./config.json ./config.yaml

```

The CLI entry point is exported from [`packages/config-yaml/dist/cli.js`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/dist/cli.js) and referenced in the package’s `bin` field (see [[`packages/config-yaml/package.json`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/package.json)](https://github.com/continuedev/continue/blob/main/packages/config-yaml/package.json#L15-L17)).

### Accessing Environment Secrets

To retrieve sensitive values without exposing them in configuration files:

```typescript
import { getContinueDotEnv } from "@continuedev/continue";

const env = getContinueDotEnv(); // reads ~/.continue/.env
const openAiKey = env.OPENAI_API_KEY;

```

This function is implemented in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts#L77-L83) and ensures consistent secret handling across the VS Code extension and CLI.

## Summary

- **Six core libraries** power Continue’s configuration: `@continuedev/config-yaml`, `@continuedev/config-types`, `yaml`, `zod`, `dotenv`, and `comment-json`.
- **File locations** are centralized in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts), which handles `.env` loading, path resolution, and file reading.
- **Schema validation** occurs through `zod` schemas defined in `@continuedev/config-types`, ensuring type safety across the monorepo.
- **Secret management** uses `dotenv` to isolate API keys from version-controlled configuration files.
- **CLI tooling** via `config-yaml` enables JSON-to-YAML migration and configuration validation from the terminal.

## Frequently Asked Questions

### How does Continue handle API keys securely in configuration files?

Continue uses the `dotenv` library to load secrets from a `.env` file located at `~/.continue/.env` before parsing the main configuration. This keeps API keys out of YAML and JSON files that might be committed to version control. The `getContinueDotEnv` function in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts#L77-L83) manages this loading process consistently across the VS Code extension and CLI.

### What validates the shape of Continue’s configuration files?

The `zod` library provides runtime schema validation for all Continue configurations. It defines TypeScript-compatible schemas in `@continuedev/config-types` that check model definitions, tool configurations, and agent rules. If a user provides an invalid configuration, Zod generates detailed error messages indicating exactly which fields failed validation.

### Can Continue parse JSON files that contain comments?

Yes, Continue uses the `comment-json` library specifically for parsing JSON files that include comments, such as legacy [`config.json`](https://github.com/continuedev/continue/blob/main/config.json) files. Unlike standard `JSON.parse()`, this library preserves comments when the file is read and can maintain them during programmatic edits, ensuring a smooth migration path to YAML configurations.

### Where is the configuration loading logic centralized in the codebase?

The primary configuration loading logic resides in [[`core/util/paths.ts`](https://github.com/continuedev/continue/blob/main/core/util/paths.ts)](https://github.com/continuedev/continue/blob/main/core/util/paths.ts), which exports utilities like `getPrimaryConfigFilePath` and `getContinueDotEnv`. Higher-level abstractions are packaged in `@continuedev/config-yaml`, while type definitions live in `@continuedev/config-types`, creating a clear separation between file system operations, validation logic, and type safety.