Expand description
Output mode detection for agent-safe console output.
This module provides automatic detection of whether output should be plain text (for AI agents and CI) or richly formatted (for humans).
§Detection Priority
The detection follows this priority order (first match wins):
SQLMODEL_PLAIN=1- Force plain outputSQLMODEL_JSON=1- Force JSON outputSQLMODEL_RICH=1- Force rich output (overrides agent detection!)NO_COLOR- Standard env var for disabling colorsCI=true- CI environment detectionTERM=dumb- Dumb terminal- Agent env vars - Claude Code, Codex CLI, Cursor, etc.
!is_terminal(stdout)- Piped or redirected output- Default: Rich output
§Agent Detection
The following AI coding agents are detected:
- Claude Code (
CLAUDE_CODE) - OpenAI Codex CLI (
CODEX_CLI) - Cursor IDE (
CURSOR_SESSION) - Aider (
AIDER_MODEL,AIDER_REPO) - GitHub Copilot (
GITHUB_COPILOT) - Continue.dev (
CONTINUE_SESSION) - Generic agent marker (
AGENT_MODE)
Enums§
- Output
Mode - Output mode for console rendering.