Configuration Guide

Master CodeContext configuration for your workflow

CodeContext offers extensive configuration options to tailor documentation generation to your specific needs. From AI model selection to output formatting, you have full control over how your documentation is created.

Configuration Hierarchy

  1. 1Default settings (built-in)
  2. 2Global config file (~/.codecontext/config.json)
  3. 3Project config (.codecontext/config.json)
  4. 4Environment variables
  5. 5Command-line flags

Configuration File Structure

{
  "version": "2.0.0",
  "ai": {
    "provider": "openai",
    "model": "basic",
    "temperature": 0.7,
    "maxTokens": 2000
  },
  "output": {
    "format": "markdown",
    "style": "technical",
    "language": "en",
    "badges": true,
    "emoji": false,
    "tableOfContents": true
  },
  "update": {
    "autoCommit": false,
    "commitMessage": "docs: update documentation",
    "preserveCustom": true,
    "gitHooks": false,
    "watchIgnore": ["node_modules", "dist", "*.test.js"]
  },
  "generation": {
    "readme": {
      "sections": ["overview", "installation", "usage", "api", "contributing"],
      "template": "default"
    },
    "changelog": {
      "format": "keepachangelog",
      "unreleased": true,
      "types": ["feat", "fix", "docs", "style", "refactor", "test", "chore"]
    }
  },
  "ignore": [
    "node_modules/**",
    "dist/**",
    "*.test.js",
    "*.spec.js"
  ]
}

Configuration Categories

AI Configuration

Provider Selection

ai.provider: "codecontext"

Choose your AI provider. Each requires corresponding API keys.

Model Configuration

ai.model: "basic" | "advanced"

Select specific model. Pro users get access to advanced models.

Temperature

ai.temperature: 0.0 - 1.0

Controls creativity. Lower = more focused, Higher = more creative.

Output Configuration

Writing Style

output.style: "technical" | "friendly" | "concise" | "detailed"

Adjust tone and verbosity of generated documentation.

Formatting Options

output.badges: true

Include status badges

output.emoji: false

Use emojis in headers

output.tableOfContents: true

Generate TOC

output.codeBlocks: "syntax"

Code highlighting

Update Behavior

Git Integration

update.autoCommit: boolean

Automatically commit after updates

update.commitMessage: string

Custom commit message template

update.gitHooks: boolean

Enable pre-commit hooks

Content Preservation

update.preserveCustom: true

Preserves content between custom section markers

Environment Variables

Override configuration using environment variables:

# API Keys
export OPENAI_API_KEY="sk-..."
export MISTRAL_API_KEY="..."

# Configuration Overrides
export CODECONTEXT_AI_MODEL="advanced"
export CODECONTEXT_OUTPUT_STYLE="friendly"
export CODECONTEXT_UPDATE_AUTO_COMMIT="true"

# Feature Flags
export CODECONTEXT_EXPERIMENTAL_FEATURES="true"
export CODECONTEXT_DEBUG="true"

Project-Specific Settings

Ignore Patterns

Exclude files from documentation analysis:

{
  "ignore": [
    "node_modules/**",
    "dist/**",
    "coverage/**",
    "*.test.{js,ts}",
    "*.spec.{js,ts}",
    "__tests__/**",
    ".next/**",
    ".cache/**"
  ]
}

Custom Sections

Define which sections to include in README:

{
  "generation": {
    "readme": {
      "sections": [
        "overview",
        "features",
        "installation",
        "usage",
        "api",
        "configuration",
        "contributing",
        "license"
      ],
      "customSections": {
        "deployment": "## Deployment\n\nCustom deployment instructions..."
      }
    }
  }
}

Advanced ConfigurationPRO

Custom Templates

template.path: "./docs/templates"

Use your own documentation templates

Multi-Language

output.languages: ["en", "es", "fr"]

Generate docs in multiple languages

Webhook Notifications

webhooks.onUpdate: "https://..."

Send notifications on updates

Performance Tuning

performance.parallel: 4

Process files in parallel

Configuration Best Practices

  • Start with defaults: Only configure what you need to change
  • Use project config: Check in .codecontext/config.json for team consistency
  • Environment for secrets: Never put API keys in config files
  • Test incrementally: Change one setting at a time
  • Document custom settings: Add comments explaining non-obvious choices

Related Topics

);