# garabik/grc architecture

> Architecture diagram of the GitHub repository garabik/grc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/garabik/grc
- Repository: https://github.com/garabik/grc

## Overview

GRC is a command-line output colouriser. Its principal workflow is: a user invokes `grc`, which selects a colourisation configuration for a command, runs that command, and pipes its standard output through `grcat` to produce coloured output. `grcat` can also be used directly as a stdin-to-stdout filter. The README documents rule matching, replacement, skipping, commands, concatenation, and multiline blocks; the tree includes many command-specific rule files. Source excerpts are limited to one configuration, so internal call details beyond documented behavior are not asserted.

Main entry points: [`grc`](https://github.com/garabik/grc/blob/master/grc) (GRC frontend), [`grcat`](https://github.com/garabik/grc/blob/master/grcat) (GRC filter), [`grc.conf`](https://github.com/garabik/grc/blob/master/grc.conf) (Command mappings), [`colourfiles`](https://github.com/garabik/grc/tree/master/colourfiles) (Built-in presets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Command frontend"]
  node_grc["GRC frontend"]
  node_grcmap["Command mappings<br/>[grc.conf]"]
end

subgraph group_engine["Colourisation engine"]
  node_grcat["GRC filter"]
  node_ruleconfig["Rule configuration"]
end

subgraph group_rules["Colour rules"]
  node_presets["Built-in presets"]
end

node_user(("User"))
node_command["Target command"]
node_output(("Coloured output"))

node_user -->|"invokes"| node_grc
node_grc -->|"selects from"| node_grcmap
node_grc -->|"runs"| node_command
node_grc -->|"pipes output to"| node_grcat
node_grc -->|"chooses"| node_ruleconfig
node_user -->|"runs directly"| node_grcat
node_command -->|"streams stdout"| node_grcat
node_grcat -->|"loads"| node_ruleconfig
node_ruleconfig -.->|"may use"| node_presets
node_grcat -->|"writes coloured text"| node_output

click node_grc "https://github.com/garabik/grc/blob/master/grc"
click node_grcmap "https://github.com/garabik/grc/blob/master/grc.conf"
click node_grcat "https://github.com/garabik/grc/blob/master/grcat"
click node_presets "https://github.com/garabik/grc/tree/master/colourfiles"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_grc,node_grcmap,node_user toneBlue
class node_grcat,node_ruleconfig toneAmber
class node_presets toneMint
class node_command,node_output toneIndigo
```

## Components

### Command frontend

- [GRC frontend](https://github.com/garabik/grc/blob/master/grc): `grc`
- [Command mappings](https://github.com/garabik/grc/blob/master/grc.conf): `grc.conf`

### Colourisation engine

- [GRC filter](https://github.com/garabik/grc/blob/master/grcat): `grcat`
- **Rule configuration**

### Colour rules

- [Built-in presets](https://github.com/garabik/grc/tree/master/colourfiles): `colourfiles`

### Other components

- **User**
- **Target command**
- **Coloured output**

## Connections

- User → GRC frontend: invokes (evidence: `README.markdown`)
- GRC frontend → Command mappings: selects from (evidence: `README.markdown`)
- GRC frontend → Target command: runs (evidence: `README.markdown`)
- GRC frontend → GRC filter: pipes output to (evidence: `README.markdown`)
- GRC frontend → Rule configuration: chooses (evidence: `README.markdown`)
- User → GRC filter: runs directly (evidence: `README.markdown`)
- Target command → GRC filter: streams stdout (evidence: `README.markdown`)
- GRC filter → Rule configuration: loads (evidence: `README.markdown`)
- Rule configuration → Built-in presets: may use
- GRC filter → Coloured output: writes coloured text (evidence: `README.markdown`)
