Skip to content

Cortex Configuration File Reference

This page provides detailed information about the Cortex configuration file, its format, and available options.

Overview

The Cortex configuration file allows you to customize the behavior of the Cortex CLI and set default options for various commands. The configuration uses YAML format and is located at ~/.config/cortex.yml by default.

File Location

The default location for the Cortex configuration file is:

  • ~/.config/cortex.yml (Unix/Linux/macOS)
  • %USERPROFILE%\.config\cortex.yml (Windows)

You can override this location by using the --config flag when running Cortex commands:

bash
cortex --config /path/to/custom-config.yml <command>

Configuration Format

The configuration file uses YAML format and is organized into sections that correspond to different aspects of the Cortex CLI:

yaml
# Example structure
auth:
  # Authentication settings
  
api:
  # API-related settings
  
defaults:
  # Default values for commands
  
plugins:
  # Plugin configurations

Configuration Sections

auth

The auth section contains authentication-related settings.

OptionTypeDefaultDescription
token_pathstring~/.config/cortex/tokens.jsonPath where authentication tokens are stored
refresh_thresholdinteger86400Time in seconds before token refresh
scopestringfullAuthentication scope (full, read, write)

Example:

yaml
auth:
  token_path: ~/.cortex/tokens.json
  refresh_threshold: 43200
  scope: full

api

The api section configures API connection settings.

OptionTypeDefaultDescription
endpointstringhttps://api.cortexcli.com/v1API endpoint URL
timeoutinteger30Request timeout in seconds
retry_attemptsinteger3Number of retry attempts for failed requests
retry_delayinteger5Delay between retries in seconds

Example:

yaml
api:
  endpoint: https://custom-endpoint.example.com/v1
  timeout: 60
  retry_attempts: 5
  retry_delay: 2

defaults

The defaults section sets default values for various commands.

OptionTypeDefaultDescription
outputstringtextDefault output format (text, json, yaml)
colorbooleantrueWhether to use colored output
verbosebooleanfalseEnable verbose output by default

Example:

yaml
defaults:
  output: json
  color: true
  verbose: true

test

The test section configures test-related settings.

OptionTypeDefaultDescription
parallelbooleanfalseRun tests in parallel by default
reporterstringstandardDefault test reporter
timeoutinteger30Test timeout in seconds
pathstring./testsDefault test directory

Example:

yaml
test:
  parallel: true
  reporter: detailed
  timeout: 60
  path: ./custom-tests

lint

The lint section configures linting settings.

OptionTypeDefaultDescription
rulesstringstandardDefault ruleset to use
fixbooleanfalseAutomatically fix issues when possible
ignore_patternsarray[]Patterns to ignore

Example:

yaml
lint:
  rules: strict
  fix: true
  ignore_patterns:
    - "*.test.js"
    - "node_modules/**"

plugins

The plugins section configures plugin settings.

OptionTypeDefaultDescription
directorystring~/.cortex/pluginsDirectory for installed plugins
auto_updatebooleantrueAutomatically update plugins
disabledarray[]List of disabled plugins

Example:

yaml
plugins:
  directory: ~/custom-plugins
  auto_update: false
  disabled:
    - legacy-plugin

logging

The logging section configures logging behavior.

OptionTypeDefaultDescription
levelstringinfoLog level (debug, info, warn, error)
filestring~/.cortex/logs/cortex.logLog file location
max_sizeinteger10Maximum log file size in MB
max_filesinteger5Number of log files to keep

Example:

yaml
logging:
  level: debug
  file: ~/logs/cortex-custom.log
  max_size: 20
  max_files: 10

cache

The cache section configures caching behavior.

OptionTypeDefaultDescription
directorystring~/.cache/cortexCache directory location
ttlinteger3600Default cache TTL in seconds
max_sizeinteger100Maximum cache size in MB

Example:

yaml
cache:
  directory: ~/custom-cache
  ttl: 7200
  max_size: 200

Complete Example

Here's a complete example of a Cortex configuration file with commonly used settings:

yaml
# Cortex CLI Configuration (~/.config/cortex.yml)

auth:
  token_path: ~/.cortex/tokens.json
  refresh_threshold: 43200
  scope: full

api:
  endpoint: https://api.cortexcli.com/v1
  timeout: 45
  retry_attempts: 3
  retry_delay: 5

defaults:
  output: text
  color: true
  verbose: false

test:
  parallel: true
  reporter: detailed
  timeout: 60
  path: ./tests

lint:
  rules: standard
  fix: false
  ignore_patterns:
    - "*.test.js"
    - "node_modules/**"

plugins:
  directory: ~/.cortex/plugins
  auto_update: true
  disabled: []

logging:
  level: info
  file: ~/.cortex/logs/cortex.log
  max_size: 10
  max_files: 5

cache:
  directory: ~/.cache/cortex
  ttl: 3600
  max_size: 100

Managing Configuration

You can manage your configuration using the cortex config command:

SubcommandDescriptionExample
getGet a configuration valuecortex config get api.timeout
setSet a configuration valuecortex config set api.timeout=60
listList all configurationscortex config list
resetReset to default valuescortex config reset

For more information about Cortex CLI commands, refer to the API Reference page.