Where to Find the Configuration Handler Code in continuedev/continue
The configuration handler code in continuedev/continue is implemented primarily in extensions/cli/src/configLoader.ts, which exports the loadConfiguration function to orchestrate config loading, and in gui/src/redux/slices/configSlice.ts, which manages configuration state for the user interface.
The Continue repository separates configuration concerns between its command-line interface and graphical interface. Understanding where these components live helps developers customize assistant configurations, debug loading issues, or extend the configuration system.
Core Configuration Handler in the CLI Extension
The CLI extension serves as the primary configuration handler for the Continue project. This TypeScript-based module determines which configuration source to use, validates the schema, and returns a unified configuration object.
Primary Entry Point: loadConfiguration
In extensions/cli/src/configLoader.ts, the loadConfiguration function acts as the central orchestrator. This async function accepts authentication details, an optional explicit config path, an API client, and injection blocks to produce a resolved configuration.
The function signature handles multiple input scenarios:
- Local
config.yamlfiles - Remote default configurations
- Assistant slugs (identifiers for pre-built assistants)
Helper Functions for Source Resolution
The configuration handler relies on several specialized helpers defined in the same file:
determineConfigSource: Decides whether to load from a local file, remote URL, or assistant slug based on CLI flags and environment variablesloadFromSource: Executes the actual loading logic once a source is identifiedloadConfigYaml: Parses YAML configuration files with schema validationloadAssistantSlug: Fetches configuration for a specific assistant identifiergetUriFromSource: Converts configuration sources into resolvable URIs
These functions work together to support Continue's flexible configuration system, allowing users to specify configs via the --config CLI flag or the CONTINUE_CONFIG environment variable.
GUI State Management for Configuration
While the CLI handles loading and validation, the graphical interface maintains its own copy of the configuration for reactive UI updates.
Redux Slice Implementation
The file gui/src/redux/slices/configSlice.ts implements the configuration handler for the React-based frontend. This Redux slice stores the loaded configuration as an AssistantUnrolled object, enabling components to access settings without re-fetching from the CLI layer.
The slice manages the configuration lifecycle:
- Stores the parsed configuration object
- Tracks loading states
- Handles configuration updates and mutations
This separation ensures that the CLI extension (extensions/cli/src/configLoader.ts) handles the heavy lifting of file I/O and validation, while the GUI slice (gui/src/redux/slices/configSlice.ts) provides fast, reactive access for the interface.
Practical Implementation Examples
Loading Configuration in CLI Commands
When building CLI tools or scripts that interact with Continue, import the configuration handler directly from the CLI extension:
// Example: Using the config loader in a CLI command
import { loadConfiguration } from "./extensions/cli/src/configLoader.js";
import { createDefaultApiClient } from "@continuedev/sdk";
async function main() {
const auth = await getAuthConfig(); // workos auth details
const api = createDefaultApiClient(); // SDK API client
const injectBlocks = []; // optional package identifiers
const { config, source } = await loadConfiguration(
auth,
process.env.CONTINUE_CONFIG, // CLI flag (--config) – optional
api,
injectBlocks,
false, // isHeadless?
);
console.log("Loaded config from:", source);
console.log("Config schema version:", config.schema);
}
This pattern allows programmatic access to the same configuration resolution logic used by the Continue CLI, supporting both headless and interactive modes.
Accessing Configuration in React Components
Frontend components access the configuration through the Redux store managed by gui/src/redux/slices/configSlice.ts:
// Example: Accessing the config in the UI (React component)
import { useAppSelector } from "../store";
import type { AssistantUnrolled } from "@continuedev/config-yaml";
export function ConfigDisplay() {
const config: AssistantUnrolled | null = useAppSelector(
(state) => state.config.config,
);
return config ? (
<pre>{JSON.stringify(config, null, 2)}</pre>
) : (
<p>No configuration loaded.</p>
);
}
Supporting Files and Documentation
Beyond the primary configuration handlers, Continue includes additional files that support the configuration ecosystem:
extensions/cli/src/config.ts: A lightweight wrapper used primarily for testing CLI commands with mock configurationsdocs/guides/understanding-configs.mdx: Comprehensive documentation explaining the configuration flow, schema versions, and best practices
These files provide context for how loadConfiguration in extensions/cli/src/configLoader.ts interacts with the broader system, including validation rules and migration paths for configuration schemas.
Summary
- The main configuration handler code resides in
extensions/cli/src/configLoader.ts, which exportsloadConfigurationand helper functions likedetermineConfigSourceandloadConfigYaml - GUI components access configuration state through
gui/src/redux/slices/configSlice.ts, which maintains a Redux store of theAssistantUnrolledconfiguration object - The system supports multiple configuration sources including local YAML files, remote URLs, and assistant slugs
- Helper functions in the CLI extension handle source resolution, validation, and URI generation independently of the UI layer
Frequently Asked Questions
How does Continue decide which configuration file to load?
Continue uses the determineConfigSource function in extensions/cli/src/configLoader.ts to prioritize configuration sources. It checks for the CONTINUE_CONFIG environment variable or --config CLI flag first, then falls back to default locations or remote configurations based on the authentication context.
Can I use the configuration handler outside of the Continue CLI?
Yes, you can import loadConfiguration from extensions/cli/src/configLoader.ts into external TypeScript or JavaScript projects. You will need to provide a valid authentication configuration, an API client instance, and optionally specify injection blocks and headless mode flags.
What is the difference between configLoader.ts and configSlice.ts?
extensions/cli/src/configLoader.ts handles the actual loading, parsing, and validation of configuration files from disk or remote sources, while gui/src/redux/slices/configSlice.ts manages the configuration state within the React application using Redux. The CLI loader runs in Node.js, whereas the Redux slice operates in the browser context.
Where is the configuration schema defined?
The configuration schema types, including AssistantUnrolled, are imported from the @continuedev/config-yaml package, which defines the TypeScript interfaces used by both extensions/cli/src/configLoader.ts and gui/src/redux/slices/configSlice.ts.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →