CLI Configuration

Learn how to configure the LeetCode Ghost Window CLI to customize its behavior to your needs.

Configuration Basics

The LeetCode Ghost Window CLI uses a configuration store to save your settings. These settings are persisted between sessions and are stored securely on your machine.

Configuration File Location

The configuration is stored in a JSON file located in your system's default config directory:

Windows

%APPDATA%\leetcode-joseok\config.json

macOS

~/Library/Preferences/leetcode-joseok/config.json

Linux

~/.config/leetcode-joseok/config.json

Note: We recommend using the CLI commands to manage your configuration rather than editing the JSON file directly, as the CLI ensures proper formatting and validation.

Managing Configuration

Setting Configuration Values

Use the config set command to set configuration values:

leet-joseok config set <key> <value>

Examples:

# Set your OpenAI API key leet-joseok config set apiKey YOUR_OPENAI_API_KEY  # Enable or disable ghost mode leet-joseok config set ghostMode true  # Set preferred programming language leet-joseok config set language python

Retrieving Configuration Values

Use the config get command to retrieve a specific configuration value:

leet-joseok config get <key>

Example:

leet-joseok config get language

Example Output

language: python

Listing All Configuration Values

Use the config list command to see all your current configuration settings:

leet-joseok config list

Example Output

Current configuration:
apiKey: sk-abc...xyz
ghostMode: true
language: python
theme: dark

Available Configuration Options

The following configuration options are available:

KeyTypeDefaultDescription
apiKeystringemptyYour OpenAI API key for AI processing
ghostModebooleantrueWhether ghost mode is enabled by default
languagestringautoPreferred programming language for solutions
themestringdarkUI theme (dark or light)
fontsizenumber14Font size for the application UI
opacitynumber1.0Window opacity (0.0 to 1.0)

Environment Variables

In addition to using the configuration commands, you can also set configuration through environment variables. This is useful for automation scripts or CI/CD environments.

Environment VariableCorresponding Config
OPENAI_API_KEYapiKey
GHOST_MODEghostMode

Example - Using Environment Variables

# On Linux/macOS export OPENAI_API_KEY=your_key_here leet-joseok init  # On Windows (Command Prompt) set OPENAI_API_KEY=your_key_here leet-joseok init  # On Windows (PowerShell) $env:OPENAI_API_KEY = 'your_key_here' leet-joseok init

Best Practices

  • Always set your API key before using features that require AI processing
  • Use environment variables for sensitive information in scripts or shared environments
  • Check your configuration with leet-joseok config list if you encounter unexpected behavior
  • Create a backup of your configuration file if you plan to make significant changes