JSON Color Output¶
Gira supports optional syntax highlighting for JSON output across all commands. By default, JSON output is plain text for better compatibility with AI agents and programmatic usage.
Default Behavior¶
By default, all JSON output is plain text without any ANSI color codes:
Enabling Color¶
Users can enable syntax highlighting for JSON output in two ways:
1. Using the --color flag¶
gira ticket list --format json --color
gira describe --color
gira epic show EPIC-001 --format json --color
2. Using the GIRA_COLOR environment variable¶
export GIRA_COLOR=1
gira ticket list --format json # Now with colors
# Or for a single command:
GIRA_COLOR=1 gira describe
Valid values for GIRA_COLOR are: 1
, true
, yes
(case-insensitive)
Disabling Color Explicitly¶
While color is off by default, you can explicitly disable it:
This is useful if you have GIRA_COLOR=1 set but want plain output for a specific command.
AI Agent Compatibility¶
The default no-color behavior ensures that AI agents and scripts can reliably parse JSON output without dealing with ANSI escape codes. This design choice prioritizes machine readability while still allowing human users to opt into a more visually appealing output.
Implementation for Commands¶
Commands that support JSON output can add color support by:
-
Importing the helper functions:
-
Adding color options to the command:
-
Passing color kwargs to print_output:
Examples¶
Plain JSON (default)¶
$ gira ticket list --format json --status todo
[
{
"id": "GCM-123",
"title": "Fix login bug",
"status": "todo"
}
]