Skip to content
CAI
Software that uses CAICheck a score

sharkdp/bat

67.4

Adequate · 27 September 2026

9k

lines of production code

Rust

primary language

3

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a command-line syntax highlighting tool that displays file contents with color-coded formatting for a wide variety of programming languages, configuration files, and system logs. It provides features such as Git integration, line numbering, and customizable themes, while supporting secure display of untrusted input and streaming output. The tool is designed as a drop-in replacement for \cat\ with enhanced visual capabilities and includes a library interface for programmatic use.

How it got here

2018–2020 — Architecture modularization and test infrastructure

77 changes.

The project underwent a major internal restructuring to replace its monolithic codebase with a modular architecture, separating concerns into distinct components for assets, configuration, and control flow. This period also established a comprehensive testing ecosystem, introducing snapshot testing, performance benchmarks, and extensive syntax regression suites to ensure reliability and visual consistency.

2021 — syntax highlighting test expansion and asset optimization

32 changes.

This period focused on significantly expanding syntax highlighting test coverage for a wide variety of programming languages, configuration files, and system logs, while also introducing test utilities for integration testing. Concurrently, the project implemented lazy loading for syntax and theme assets to improve startup performance and added CLI support for handling ignored file suffixes.

2022–2025 — syntax mapping expansion and test coverage

12 changes.

This period focused on significantly expanding the syntax mapping system to recognize a wide variety of configuration files, programming languages, and platform-specific formats across Linux, Unix, macOS, and Windows. Concurrently, the project strengthened its testing infrastructure by adding comprehensive syntax highlighting tests for new languages and tools, while refactoring the build process to support automated shell completion generation.

Features

Add PowerShell completion support and update shell completions

Users on Windows can now use tab-completion for bat via a new PowerShell completion script (\_bat.ps1.in), which provides completions for options, themes, languages, and the cache subcommand. The Bash, Fish, and Zsh completion scripts have also been updated to include recently added CLI arguments (such as --unbuffered, --sanitize, --no-custom-assets, and --lessopen) and to fix various completion behaviors, including improved escaping in Bash and corrected language/theme listing in Zsh.

assets/completions · high confidence

Add new syntax highlighting themes and submodule-based theme sources

The theme asset directory now includes several new syntax highlighting themes: Catppuccin, Coldark, DarkNeon, Nord-sublime, TwoDark, 1337-Scheme, and a collection of Sublime Text-style themes (Dracula, GitHub, Gruvbox, OneHalf, Monokai Extended, Snazzy, Zenburn) which are integrated as git submodules. Additionally, new built-in theme files have been added: 'ansi' (replacing the previous ansi-light and ansi-dark themes) which uses 4-bit ANSI codes for base16 support, and 'base16-256' for terminals using 256-color base16 variants. These changes expand the available color schemes for syntax highlighting in the application.

assets/themes · high confidence

Added placeholder directories for macOS and Windows syntax mappings

Created empty .gitkeep files in the src/syntax\_mapping/builtins/macos and src/syntax\_mapping/builtins/windows directories. This establishes the directory structure for platform-specific syntax mapping configurations, allowing future additions of target-specific mapping rules without these directories being ignored by version control.

_src/syntax\_mapping/builtins/macos, src/syntax\mapping/builtins/windows · medium confidence

Automated asset generation and caching infrastructure

The assets directory now includes a new \create.sh\ script that automates the process of building the syntax and theme cache. This script initializes necessary git submodules, applies specific patches to upstream syntax definitions, and runs \bat cache --build\ to generate the final binary assets. It also introduces \.gitattributes\ to mark linguist-vendored files and \.ignore\ files to prevent the syntax and theme source directories from being tracked as regular content, streamlining the maintenance of syntax highlighting and color themes.

assets · high confidence

Expanded syntax highlighting support for Apache, AsciiDoc, Assembly, and CSV formats

This update adds comprehensive syntax highlighting definitions for several new and existing file formats. Apache configuration files (e.g., .htaccess, envvars) now receive detailed keyword and directive highlighting. AsciiDoc documents are supported with proper scoping for attributes, blocks, and inline elements. Assembly code for both ARM and x86\_64 architectures is now highlighted, covering registers, mnemonics, and preprocessor directives. Additionally, CSV files gain robust support for comma, pipe, semicolon, and tab separators, with specific scoping for different field types.

assets/syntaxes · high confidence

Initial repository structure and comprehensive changelog for bat v0.26.1

This change establishes the initial repository structure for the bat project, including the addition of a detailed CHANGELOG.md that documents the features, bugfixes, and syntax updates introduced in versions up to v0.26.1. Key user-facing capabilities documented include the new \--sanitize\ flag for secure display of untrusted input (mitigating Trojan-Source spoofing), \--number-nonblank\ for cat compatibility, \--unbuffered\ mode for streaming, and word wrapping support. The repository also includes the initial \.gitmodules\ file defining syntax and theme assets, the \CONTRIBUTING.md\ guide for maintainers, and the Apache 2.0 license file.

(repo-wide) · high confidence

New --acknowledgements option to include third-party license texts

The build process now supports a new \--acknowledgements\ flag that generates a consolidated text file containing the project's NOTICE file and the full text of third-party licenses (MIT, BSD, Apache 2.0, and CC BY 4.0) found in the source directory. This allows users to easily distribute legal attribution information alongside the built assets.

_src/assets/build\assets · high confidence

New diagnostic script for bat configuration and environment

A new \info.sh\ script has been added to the diagnostics directory to help users troubleshoot issues by collecting and reporting on their system environment and bat configuration. The script detects the correct bat executable (handling both \bat\ and \batcat\ names), identifies custom syntaxes and themes, checks for wrapper scripts or shell functions/aliases, and gathers OS and shell version details. It presents a consent banner before running and outputs the collected data in a markdown-friendly format for easy inclusion in bug reports.

diagnostics · high confidence

Support for ignored-suffix CLI arguments and new default ignored suffixes

Users can now use the new \--ignored-suffix\ CLI argument to specify additional file name suffixes that should be stripped when determining syntax mappings. The default set of ignored suffixes has been expanded to include Debian/Ubuntu package manager backup files (\.dpkg-new\, \.dpkg-tmp\, \.dpkg-dist\, \.dpkg-old\, \.ucf-dist\, \.ucf-new\, \.ucf-old\) and Red Hat package manager backup files (\.rpmnew\, \.rpmorig\, \.rpmsave\), in addition to existing editor and build system backups. This ensures that syntax detection correctly identifies the underlying file type for these common backup variants.

_src/syntax\mapping · high confidence

Architecture

Major restructuring of the internal architecture and module organization

The application's internal codebase has been significantly refactored to improve modularity and maintainability. The monolithic structure has been split into distinct, focused modules: \assets.rs\ now handles syntax and theme loading (including lazy-loading for performance), \config.rs\ centralizes all configuration options, \controller.rs\ manages the high-level execution flow, \decorations.rs\ handles UI elements like line numbers and git markers, \diff.rs\ implements Git integration using the \gix\ library, \error.rs\ standardizes error handling with \thiserror\, \input.rs\ defines the input abstraction, and \less.rs\ manages pager version detection. This reorganization separates concerns, making the codebase easier to navigate and extend.

src · high confidence

bat binary is restructured into a modular src/bin/bat/ layout

The \bat\ executable source has been reorganized from a flat structure into a modular \src/bin/bat/\ directory, introducing dedicated modules for application logic (\app.rs\), CLI argument definition (\clap\_app.rs\), configuration file and environment variable handling (\config.rs\), system directory resolution (\directories.rs\), input abstraction (\input.rs\), and asset management (\assets.rs\). This change separates concerns such as config file generation, argument parsing, and cache directory resolution into their own files, improving maintainability and testability of the binary without altering the user-facing command-line interface.

src/bin · high confidence

Behavioural changes

Assets are now loaded lazily to improve startup time

The asset loading mechanism has been refactored to support lazy initialization. Themes are now stored in a \LazyThemeSet\ that deserializes individual themes on demand rather than loading the entire set at once, and syntax sets are handled via a \SerializedSyntaxSet\ enum that defers deserialization until needed. This change, combined with the new \AssetsMetadata\ structure for version compatibility checks, reduces the initial memory footprint and improves application startup performance.

src/assets · high confidence

Build script refactored into modules with shell completion generation

The build script has been reorganized into separate modules (\application\, \syntax\_mapping\, \util\) to improve maintainability. A new feature allows the build process to automatically generate man pages and shell completions (Bash, Fish, PowerShell, and Zsh) from templates, with the resulting file paths exposed to the compiler via environment variables. The syntax mapping logic has also been updated to support case-sensitive glob matching and brace expansion in matcher patterns.

build · high confidence

Expanded Linux configuration file syntax detection

The application now recognizes syntax for a broader range of Linux system and container configuration files. Users will see correct syntax highlighting for Podman quadlet files (including build, pod, and artifact types), Flatpak references, DNF and Pacman package manager configurations, Paru AUR helper settings, Kubernetes configs, and various systemd unit files. Additionally, container-related .conf files are now mapped to TOML syntax, and OS release files are detected as shell scripts.

_src/syntax\mapping/builtins/linux · high confidence

Expanded syntax detection for common configuration and data files

The syntax mapping system now recognizes a wider variety of file types, improving how they are displayed and highlighted. New mappings include JSON variants (JSON Lines, JSONC, JSON-LD, GeoJSON, ndjson, and VS Code workspaces) as JSON, .NET project files (including the new .slnx extension) as XML, and Bazel BUILD files as Python (Starling). Configuration files such as AWS credentials, GCloud CLI configs, SSH configs (including subdirectories), and Git config/ignore/attribute files are now correctly identified. Additional support covers Justfiles as Makefiles, Mill build files as Scala, CITATION.cff as YAML, nix flake.lock as JSON, SARIF files as JSON, Rusty Object Notation (.ron) as Rust, Nmap scripts as Lua, PAC files as JavaScript, and .mkd files as Markdown. The system also handles ambiguous extensions like .conf by defaulting to unknown, and maps ignore files to Git Ignore syntax.

_src/syntax\mapping/builtins/common · high confidence

Expanded syntax highlighting for Unix system files and configurations

This update adds specific syntax mappings for a variety of Unix-family system files and configuration formats, ensuring correct highlighting in the editor. Key additions include mappings for Apache and Nginx configuration files, Certbot renewal configurations, and Wireguard settings, all treated as INI or their respective syntaxes. Shell configuration files (such as .bashrc, .zshrc, .kshrc, and profile scripts) are now explicitly mapped to Bash or KornShell syntax. Additional mappings cover Ghostty terminal configurations, Fish shell history files, system logs like dmesg (Syslog), and mail spool files (Email).

_src/syntax\mapping/builtins/unix-family · high confidence

Syntax highlighting and theme patches for improved code and log readability

This update applies patches to syntax definitions and color themes to enhance code highlighting and visual clarity. New syntax support includes Rust code blocks in Markdown, Puppet syntax in Markdown, MediaWiki, Groff (with updated file extensions), and XAML files. Shell script detection is expanded to recognize shebangs for bun, uv, dash, ksh, tclsh, wish, and expect, while ebuild and eclass files are now highlighted using shell syntax. Several themes (1337, Monokai Extended, OneHalfDark, TwoDark) are patched to improve the appearance of JSON keys, Man page syntax, and error/warning lines, and specific syntax fixes address C\# tuple parsing, JavaDoc comment detection, and TodoTxt attribute scopes.

assets/patches · high confidence

Updated library usage examples to reflect new PrettyPrinter API

The examples in the \examples/\ directory have been rewritten to demonstrate the library's new builder-based API. Simple scripts like \simple.rs\ and \cat.rs\ now use the \PrettyPrinter\ fluent interface for configuration, while more complex scenarios such as \advanced.rs\ showcase features like syntax highlighting, custom themes, and paging modes. New examples like \inputs.rs\ and \yaml.rs\ illustrate how to handle multiple input sources and embedded data using the updated \Input\ API, and \list\_syntaxes\_and\_themes.rs\ provides a way to inspect available syntaxes and themes via the printer instance.

examples · high confidence

Updated manual page with new options and documentation fixes

The man page for bat has been updated to reflect recent command-line changes. It now documents the new --wrap mode (including word wrapping), the --nonprintable-notation option, and the --file-name flag. The --paging option documentation was corrected to use the proper --paging=never syntax instead of the previous --pager=never. Additionally, the manual now includes details on the --builtin pager option, clarifies that 'full' is the default style, and adds sections for custom languages and themes.

assets/manual · high confidence

Test coverage

2 commits adding/updating tests in tests/syntax-tests/source/PowerShell; Add Lean syntax highlighting test coverage; Add NAnt Build File syntax tests; Add Tcl syntax highlighting regression tests; Add Vue component syntax tests; Added AWK quicksort syntax test; Added ActionScript 3 syntax highlighting test; Added ActionScript 3 syntax test coverage; Added Bash syntax highlighting tests; Added Batch syntax test and build script; Added C syntax highlighting test suite; Added C++ syntax highlighting test file; Added CSV syntax highlighting test fixtures; Added Common Lisp syntax highlighting test; Added Common Lisp syntax highlighting test files; Added Crystal syntax test file; Added Elm syntax regression test; Added Fortran Modern syntax tests for stdlib\_io savetxt and loadtxt; Added GDScript syntax highlighting test file; Added Lean syntax highlighting tests and license documentation; Added Literate Haskell syntax tests; Added Nix syntax test case; Added Protocol Buffer syntax tests for Vyconf; Added Puppet syntax tests for large exported classes and nodes; Added QML syntax tests for the Bat application UI; Added R syntax test suite; Added Rego syntax tests for Kubernetes procMount policy; Added Robot Framework syntax tests for AWS S3 recipe; Added Ruby syntax highlighting test for RepeatedSubstring class; Added Salt State (SLS) syntax tests; Added Svelte syntax regression tests; Added Tcl syntax regression tests for shebang and core language features; Added Terraform syntax highlighting test case; Added TypeScript syntax test files; Added Varlink certification syntax tests; Added Verilog syntax tests for pipelined division module; Added XAML syntax tests for ItemPage; Added XML syntax test fixtures for .NET project files; Added benchmark source files for syntax highlighting speed tests; Added benchmark suite for startup and syntax highlighting performance; Added plaintext syntax test fixtures and documentation; Added regression test for custom assets color behavior; Added regression tests for syntax detection edge cases; Added snapshot testing infrastructure for bat output; Added syntax highlighting regression test for Ruby Haml; Added syntax highlighting regression tests for Manpage format; Added syntax highlighting test cases for log files; Added syntax highlighting test file for hosts format; Added syntax highlighting test for AWK quicksort; Added syntax highlighting test for Batch build scripts; Added syntax highlighting test for Scala ConcurrentEffectLaws; Added syntax highlighting test for Syslog logs; Added syntax highlighting test for email headers; Added syntax highlighting test for fish history files; Added syntax highlighting tests for /etc/fstab; Added syntax highlighting tests for /etc/group files; Added syntax highlighting tests for ASP, AppleScript, Fish, Objective-C, Regular Expressions, Ruby on Rails, and Textile; Added syntax highlighting tests for Apache httpd.conf; Added syntax highlighting tests for Cabal, Go, Python, XML, and Nim files; Added syntax highlighting tests for Debian sources.list files; Added syntax highlighting tests for Idris 2; Added syntax highlighting tests for JSON and NDJSON formats; Added syntax highlighting tests for MediaWiki markup; Added syntax highlighting tests for NSIS scripts; Added syntax highlighting tests for Ninja build files; Added syntax highlighting tests for Org mode; Added syntax highlighting tests for Solidity ERC721 contracts; Added syntax highlighting tests for Stylus gradients; Added syntax highlighting tests for Svelte files; Added syntax highlighting tests for TypeScript React components; Added syntax highlighting tests for bat command help output; Added syntax highlighting tests for complex Nginx configurations; Added syntax highlighting tests for ignored filename suffixes; Added syntax highlighting tests for the D programming language; Added syntax highlighting tests for the Diff file format; Added syntax highlighting tests for the Zig language; Added syntax regression and custom assets test suite; Added syntax regression tests for SSH Config highlighting; Added syntax test for Vyper crowdsale contract; Added syntax test for bat command help output; Added syntax test for email message parsing; Added syntax tests for /etc/passwd file highlighting; Added syntax tests for JSON and NDJSON formats; Added syntax tests for Jsonnet standard library documentation generation; Added syntax tests for Less files; Added syntax tests for Scala ConcurrentEffectLaws; Added syntax tests for Solidity ERC721 implementation; Added syntax tests for Strace output highlighting; Added syntax tests for dash shell script highlighting; Added syntax-highlighting tests for /proc/cpuinfo and /proc/meminfo; Added syslog syntax highlighting test fixture; Added test data for fish\_history syntax parsing; Added test fixtures for integration testing; Added test fixtures for startup-time benchmarking; Added test infrastructure and fixtures for CI and integration testing; Added test scripts for performance profiling and license compliance; Added test utilities for command execution and mocked pagers; Added x86-64 NASM syntax highlighting tests; Initial syntax regression tests for Rust paging logic; Snapshot testing infrastructure for visual regression; Updated SCSS syntax highlighting test suite; Updated SCSS syntax test with unlicensed example.

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 55 → 67 (+12.4)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 79 (-21.3)
  • Architecture 99 (new)
  • Maturity 59 → 57 (-1.4)
  • Readiness 44 → 78 (+33.7)
  • Security 59 → 71 (+12.4)

Resolved (30)

  • Dimension evaluation failed
  • High IaC: DS-0002 (tests/benchmarks/startup-time-src/Containerfile)
  • High IaC: DS-0002 (tests/syntax-tests/source/Dockerfile/Dockerfile)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 10 more

New (79)

  • App::config (cognitive 66) (src/bin/bat/app.rs)
  • App::config (cyclomatic 49) (src/bin/bat/app.rs)
  • ClassTooLong: App (src/bin/bat/app.rs)
  • ClassTooLong: InteractivePrinter (src/printer.rs)
  • Controller::print_file_ranges (cognitive 38) (src/controller.rs)
  • Controller::print_file_ranges (cyclomatic 19) (src/controller.rs)
  • Controller::run_with_error_handler (cognitive 30) (src/controller.rs)
  • Controller::run_with_error_handler (cyclomatic 18) (src/controller.rs)
  • Coverage not measured — no coverage collector is wired up
  • Dependency advisory scan runs only on code events
  • Dependency hygiene PARTLY measured — Cargo dependencies read, dependency currency not (crates.io unreachable)
  • Dependency source pinned to a moving git ref
  • Documentation: no contributor guidance (README.md)
  • Documentation: no licence statement (README.md)
  • Duplicated block (13–14 lines × 2) (src/vscreen.rs)
  • Duplicated block (9 lines × 2) (src/vscreen.rs)
  • End-of-life runtime: .NET net9.0
  • FileTooLong: bat/clap_app.rs (src/bin/bat/clap_app.rs)
  • FileTooLong: src/printer.rs (src/printer.rs)
  • FunctionTooLong: bat::bin::bat::clap_app::build_app (src/bin/bat/clap_app.rs)
  • …and 59 more

Changes since last survey

  • 34 commits — 20 feature/other, 14 fixes

By area

  • (repo) — 19 commits
  • (root) — 10 commits
  • assets/syntaxes — 2 commits
  • src/bin — 2 commits
  • tests/syntax-tests — 1 commit

Notable commits

  • fix: Fix doubled word in README
  • fix: Merge branch 'master' into fix-binary-detection-across-lines-3554
  • fix: Merge branch 'master' into fix-log-syntax-performance-3866
  • fix: Merge branch 'master' into fix/3697-bat-auto-detect-language-from-stdin
  • fix: Merge pull request #3747 from mvanhorn/fix/3697-bat-auto-detect-language-from-stdin
  • fix: Merge pull request #3876 from Matei02355/fix-log-syntax-performance-3866
  • fix: Merge pull request #3877 from Matei02355/fix-binary-detection-across-lines-3554
  • fix: Merge pull request #3899 from rootsec1/fix/cargo-install-manifest-diagnostic
  • fix: Merge pull request #4015 from mikehasa/fix/track-strikethrough-sgr9
  • fix: fix(syntax): preserve log-level scopes in Syslog
  • fix: fix(syntax): use start-of-line anchor for log levels
  • fix: fix: avoid parsing syntax fixture as Cargo manifest
  • fix: fix: use last occurrence in combined short flags
  • fix: fix: use last occurrence in combined short flags
  • change: Allow boolean flags to be repeated
  • change: Merge pull request #3857 from MeGaurav4/master
  • change: Merge pull request #3885 from latent-9/fix-doc-typos
  • change: Merge pull request #3897 from cuishuang/master
  • change: Merge pull request #3900 from sharkdp/dependabot/cargo/globset-0.4.20
  • change: Merge pull request #3901 from sharkdp/dependabot/cargo/indexmap-2.14.1
  • …and 14 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

sharkdp/bat was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 27 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 4987f76709aae3a1c4db723c53874c9ddcb0c4fd — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-7c1cb6328e11.