๐ฆ batless
The Ultimate Non-Blocking Code Viewer
Built for automation, AI assistants, and modern CLI workflows
๐ฏ Why batless?
Transform code viewing from blocking interactive pagers to predictable streaming output:
โ Before: bat file.rs โ hangs in CI/CD, requires terminal, blocks automation
โ
After: batless file.rs โ streams immediately, works everywhere, never blocks
Key Advantages:
- ๐ Never Blocks: Guaranteed non-blocking operation for CI/CD and automation
- ๐ค AI-Optimized: JSON output, summaries, and tokens for LLM processing
- โก Blazing Fast: <5ms typical startup (modern hardware), streaming architecture, ~2MB binary
- ๐ง Automation-First: Clean defaults, predictable behavior, perfect for scripts
- ๐ Smart Output: Multiple modes including summary extraction and token analysis
batless is a minimal, blazing-fast syntax viewer that never blocks, never pages, never hangs. While bat is a feature-rich "cat with wings" for human users, batless is purpose-built for:
- ๐ค AI code assistants that need predictable, streaming output
- ๐ CI/CD pipelines where interactive pagers would hang forever
- ๐ Automation scripts that require guaranteed non-blocking behavior
- ๐ Modern workflows where JSON output and code summaries matter more than line numbers
Core guarantee: batless will NEVER wait for user input or block your pipeline.
๐ Quick Start
Get up and running in under 2 minutes:
Prerequisites
- Rust Toolchain: For building from source (or use pre-built binaries)
- Terminal: Any POSIX-compatible shell
- Files to View: Any text-based source code files
3-Step Setup
1๏ธโฃ Install batless (Choose One)
# Option A: Pre-built binaries (fastest)
|
# Option B: Via Cargo
# Option C: Homebrew (macOS/Linux)
&&
2๏ธโฃ Test Your Installation
# View a file with syntax highlighting
# Test JSON output mode
3๏ธโฃ Integrate with Your Workflow
# CI/CD pipeline usage
# AI assistant context
# Machine-readable version metadata
๐บ Try the Demo | ๐ Complete Setup Guide
๐ What Makes batless Special
๐ Feature Comparison
| Feature | batless |
bat |
cat |
|---|---|---|---|
| Never Blocks | โ Guaranteed | โ Uses pager | โ Simple output |
| Syntax Highlighting | โ 100+ languages | โ Rich highlighting | โ None |
| JSON Output | โ First-class | โ Not supported | โ Not supported |
| Summary Mode | โ AI-optimized | โ Not supported | โ Not supported |
| Memory Usage | โ Streaming | โ ๏ธ Loads full file | โ Streaming |
| Binary Size | โ ~2MB | โ ๏ธ ~10MB | โ System binary |
| Startup Time | โ <5ms (typical) | โ ๏ธ ~180ms | โ <10ms |
๐ Core Capabilities
Non-Blocking Guarantees
- ๐ซ NEVER uses a pager - no
less, nomore, no blocking - โก NEVER waits for input - always streams output immediately
- ๐ NEVER hangs in pipes - safe for
|,>, and subprocess calls - ๐ ALWAYS returns quickly - even on huge files (streaming architecture)
Syntax & Language Support
- ๐จ Syntax highlighting for 100+ languages via syntect
- ๐ Language auto-detection with manual override support
- ๐ญ Theme support - Multiple color schemes available
- ๐ Universal support - Works with any text-based file format
Smart Output Modes
- ๐ Multiple output modes: plain, highlighted, JSON, summary
- ๐ Smart limiting by lines AND/OR bytes
- ๐พ Memory efficient - true streaming, never loads full files
- ๐ฏ Predictable behavior - same output in terminal or pipe
Built for Automation
- ๐ค AI-optimized JSON output with metadata, tokens, and summaries
- ๐ Summary mode extracts functions, classes, imports only
- ๐ค Token extraction for LLM context processing
- ๐ซ Clean defaults - no line numbers, headers, or decorations
- ๐ฆ Single ~2MB binary with minimal dependencies
- ๐ Sub-50ms startup with cached syntax definitions
โก Installation Options
GitHub Releases (Recommended)
Download pre-compiled binaries for your platform:
# macOS/Linux - download and extract latest release
|
# Or use wget
Available builds:
- Linux:
x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-gnu - macOS:
x86_64-apple-darwin(Intel),aarch64-apple-darwin(Apple Silicon) - Windows:
x86_64-pc-windows-msvc
Homebrew (macOS/Linux)
# Add the tap (one-time setup)
# Install batless
# Or install directly without adding tap
Homebrew Tap Repository: docdyhr/homebrew-batless
From Crates.io
# Install the latest version:
Docker (Containerized Environments)
# Quick syntax highlighting in any environment
# JSON output for CI/CD pipelines
# Summary mode for AI code analysis
From Source
๐บ Homebrew Tap
The docdyhr/homebrew-batless tap provides the official Homebrew formula for batless.
Features
- โ Automatically updated with every release
- โ Comprehensive testing included in formula
- โ Cross-platform support (macOS & Linux)
- โ Zero maintenance - formula stays in sync with releases
Installation Commands
# Method 1: Add tap first (recommended)
# Method 2: Direct install
# Upgrade to latest version
The formula automatically compiles from source using Rust, ensuring optimal performance for your system.
๐ฏ Real-World Use Cases
๐ค AI Assistant Integration
๐ Complete AI & Editor Integration Guide - Comprehensive setup for Zed, VS Code, and GitHub CLI
Quick Examples:
# Use built-in AI profiles for optimal results
# Smart GitHub CLI integration
Advanced AI Workflows:
# Context-aware fitting for AI models
# Token counting for context planning
# Multi-file AI context building
| |
๐ CI/CD Pipeline Integration
GitHub Actions Example:
- name: Show failing test context
run: |
batless --mode=summary --max-lines=100 tests/failing_test.rs
- name: Extract code metrics
run: |
batless --mode=json src/main.rs | jq '.total_lines'
Jenkins Pipeline:
GitLab CI:
code_review:
script:
- batless --color=never --max-lines=50 src/main.rs
- batless --mode=summary --max-lines=100 tests/
๐ ๏ธ Development Workflows
Code Review Automation:
# Show changed files without paging
|
# Generate PR context for AI review
# Quick file preview in terminal
Documentation Generation:
# Extract code structure for docs
# Generate API documentation context
|
# Create code snippets for tutorials
๐ Performance Monitoring
Build System Integration:
# Show code during build failures (non-blocking)
# Get code summary for automated analysis
# Extract enhanced metadata for build systems
|
Large File Processing:
# Process huge files without memory issues
# Stream first 1000 lines of large dataset
# Extract key information from massive JSON
๐ Usage
Version Metadata (--version-json)
Machine-readable build metadata for scripting, telemetry, reproducibility & SBOM enrichment:
Example output:
Field reference:
- name โ Crate/binary identifier
- version โ Semantic version
- git_hash โ Commit hash embedded at build ("unknown" if not provided)
- build_timestamp โ UTC ISO 8601 timestamp ("unknown" if not injected)
- authors โ Cargo package authors string
Build script injects BATLESS_GIT_HASH and BATLESS_BUILD_TIMESTAMP for release artifacts.
Performance note: <5ms reflects median cold start across local Apple Silicon & GitHub macOS runners per
PERFORMANCE_REPORT.md. Conservative claim leaves room for variance; earlier <50ms badge updated for precision.
Basic Usage
# View a file with syntax highlighting
# Plain text output (no colors)
# JSON output for parsing
PAGER Compatibility
๐ง Use as PAGER replacement - Perfect for tools like GitHub CLI:
# GitHub CLI integration
PAGER="batless --plain"
# General PAGER replacement
# Pipeline input support
|
# Compatible flags (ignored for compatibility)
Key PAGER features:
- โ
--plainflag for plain text output (no colors/decorations) - โ stdin support for pipeline input
- โ Compatible with existing PAGER workflows
- โ
Gracefully ignores common PAGER flags (
--unbuffered,--number)
Limiting Output
# Limit to first 50 lines
# Limit to first 1KB
# Combine limits
Language and Syntax
# Auto-detect language (default)
# Force specific language
# List supported languages
Color and Themes
# Control color output
# Choose syntax theme
# List all supported languages and themes
# Strip ANSI codes from output
Enhanced JSON Mode Examples
# Get structured file info with enhanced metadata
# Compact vs pretty JSON
Output:
AI-Friendly Summary Mode
# Extract only important code structures (perfect for AI context)
# Get function signatures, class definitions, imports only
Advanced JSON with Tokens and Summary
# Full AI analysis with tokens and code summary
Enhanced output:
Streaming Large Files
For very large files, batless offers a streaming JSON mode that processes the file in chunks, ensuring low memory usage regardless of file size.
# Stream a large file as JSON chunks
This command will output a series of JSON objects, each representing a chunk of the file. This is ideal for processing large log files or data sets in automated pipelines without loading the entire file into memory.
๐ณ Docker Usage
Container-Based Code Analysis
# Basic syntax highlighting
# JSON output for CI/CD integration
# AI-friendly summary extraction
CI/CD Pipeline Integration
# GitHub Actions example
- name: Analyze code structure
run: |
docker run --rm -v ${{ github.workspace }}:/workspace \
ghcr.io/docdyhr/batless:latest \
--mode=json --max-lines=100 /workspace/src/main.rs | \
jq '.summary_lines | length'
# GitLab CI example
analyze_code:
image: docker:latest
script:
- docker run --rm -v $PWD:/workspace
ghcr.io/docdyhr/batless:latest
--mode=summary /workspace/src/
Kubernetes Jobs
apiVersion: batch/v1
kind: Job
metadata:
name: code-analysis
spec:
template:
spec:
containers:
- name: batless
image: ghcr.io/docdyhr/batless:latest
args:
volumeMounts:
- name: source-code
mountPath: /workspace
volumes:
- name: source-code
hostPath:
path: /path/to/source
restartPolicy: Never
๐ค AI Assistant Integration
Claude Code Assistant
# Get code structure for AI analysis
# Full AI context with summary and tokens
# List supported languages for analysis
|
CI/CD Pipelines
# Show code during build failures (non-blocking)
# Get code summary for automated analysis
# Extract enhanced metadata for build systems
|
๐จ Available Themes
Popular themes include:
base16-ocean.dark(default)InspiredGitHubSolarized (dark)Solarized (light)Monokai1337
View all available themes:
๐ฃ๏ธ Supported Languages
Support for 100+ languages including:
- Rust, Python, JavaScript, TypeScript
- C, C++, Java, Go, Swift
- HTML, CSS, JSON, YAML, TOML
- Shell, Bash, PowerShell
- And many more...
View all supported languages:
โ๏ธ Configuration
batless supports flexible configuration through files and command-line arguments, with a clear precedence hierarchy:
Configuration Precedence (highest to lowest):
- Command-line arguments
- Project-level config (
.batlessrc,batless.toml) - User home config (
~/.batlessrc,~/.config/batless/config.toml) - System defaults
Configuration Files
TOML Format (Recommended)
Create batless.toml in your project root or ~/.config/batless/config.toml:
# Maximum lines to display
= 15000
# Maximum bytes to process (optional)
= 1048576 # 1MB
# Override language detection
= "rust"
# Theme for syntax highlighting
= "monokai"
# Color output control
= true
# Strip ANSI escape sequences
= false
# Include tokens in JSON output
= false
# Enable summary mode by default
= true
JSON Format (.batlessrc)
Create .batlessrc in your project root or home directory:
Configuration Examples
Project-Specific Settings
For a Rust project, create batless.toml:
# Optimize for Rust development
= 20000
= "base16-ocean.dark"
= "rust"
= true
= true
AI Assistant Profile
For AI code analysis, create .batlessrc:
CI/CD Pipeline Settings
For automation environments:
= 1000
= false
= true
= false
Custom Config File
Use --config to specify a custom configuration file:
# Use specific config file
# Override with command line args
Configuration Discovery
batless automatically searches for config files in this order:
- Project level:
.batlessrc,batless.toml - User home:
~/.batlessrc,~/.config/batless/config.toml - System level: System config directories
AI Tool Profiles
Instead of manual configuration, use built-in AI profiles:
# Claude-optimized (4K lines, summary mode)
# GitHub Copilot (2K lines, JSON + tokens)
# ChatGPT-optimized (3K lines, JSON + tokens)
# General AI assistant (5K lines, summary)
Custom AI Profiles
For more granular control, you can create your own profiles. For example, create a file named my-claude-profile.json:
Then, use it with the --custom-profile flag:
This allows you to define and reuse complex configurations for different AI models or tasks.
Validation and Help
batless validates all configuration and provides helpful error messages:
# Example validation error
)
Common configuration patterns and their use cases are documented in the project wiki.
๐ Why batless instead of bat?
When to use batless
- โ CI/CD pipelines - Guaranteed to never hang waiting for input
- โ AI assistants - Clean output with JSON mode and code summaries
- โ Automation scripts - Predictable, streaming behavior
- โ Large file processing - Memory-efficient streaming architecture
- โ Headless environments - No terminal detection or pager issues
When to use bat
- โ Interactive terminal use - Rich features like paging and git integration
- โ Human code review - Line numbers, file headers, and decorations
- โ Git workflows - Shows inline diffs and modifications
- โ Terminal multiplexing - Full terminal UI features
Feature Comparison
| Feature | batless |
bat |
|---|---|---|
| Core Philosophy | Built for machines | Built for humans |
| Blocking behavior | โ NEVER blocks | โ Uses interactive pager |
| Default output | โ Clean, no decorations | โ Headers, grids, line numbers |
| JSON output | โ First-class with metadata | โ Not supported |
| Summary mode | โ Extract code structure | โ Not supported |
| Token extraction | โ For AI processing | โ Not supported |
| Byte limiting | โ Memory-safe streaming | โ Loads entire file |
| Binary size | โ ~2MB minimal | โ ~10MB with features |
| Startup time | โ <5ms typical | โ ๏ธ ~180ms full init |
| Dependencies | โ 9 crates | โ 20+ crates |
| Git integration | โ No (by design) | โ Full support |
| Line numbers | โ No (use cat -n if needed) |
โ Configurable |
| Interactive paging | โ No (by design) | โ Smart pager integration |
๐งช Testing & Status
Current Test Status โ
- Main Test Suite: 100% passed
- Integration Tests: 100% passed
- Property-Based Tests: 100% passed
- Security Audit: Clean
- CI/CD Pipeline: Fully functional
Test Your Installation
# Run the demo script
# Test with a sample file
|
# Verify JSON output
|
๐ Security Status
Comprehensive Security Testing
Our security posture is continuously monitored through automated testing and vulnerability scanning:
| Security Area | Status | Coverage |
|---|---|---|
| Memory Safety | โ Secure | Rust's memory safety guarantees |
| Input Validation | โ Secure | All inputs validated and sanitized |
| Dependency Audit | โ Secure | Regular cargo audit checks |
| Binary Security | โ Secure | Stripped, optimized releases |
| Supply Chain | โ Secure | Trusted dependencies only |
Security Features
- ๐ก๏ธ Memory Safety: Built with Rust for guaranteed memory safety
- ๐ Input Validation: All file paths and parameters validated
- ๐ Dependency Audit: Automated vulnerability scanning
- ๐จ Safe Defaults: No unsafe operations or external commands
Security Testing Commands
# Security audit
# Dependency check
# Format and lint checks
๐ Troubleshooting
Quick Diagnostics
Installation Issues
# Verify Rust toolchain
# Check binary location
# Test basic functionality
|
Performance Issues
# Check syntax cache
||
# Benchmark performance
# Memory usage monitoring
Output Format Issues
# Test color support
# Verify JSON format
|
# Check theme availability
Common Error Solutions
| Error | Cause | Solution |
|---|---|---|
No such file or directory |
File path incorrect | Verify file path exists |
Permission denied |
File permissions | Check read permissions |
Language not found |
Unknown extension | Use --language flag |
JSON parse error |
Invalid JSON output | Check file encoding |
Binary not found |
Installation issue | Reinstall or check PATH |
Getting Help
Self-Diagnostics
# Version and build info
# List all supported languages
# List all themes
# Test configuration
Community Support
- ๐ Report Issues
- ๐ฌ Discussions
- ๐ Documentation
- ๐ง Contact
๐ ๏ธ Development
Running Tests
# Run all tests
# Run property-based tests
# Run benchmarks
# Run security checks
Building & Quality Checks
# Build release
# Comprehensive linting
# Code formatting
# Security audit
# Generate coverage report
Security & Testing
This project maintains high security and quality standards:
- โ 90%+ test coverage with unit, integration, and property-based tests
- โ Daily security audits with automated vulnerability scanning
- โ Fuzz testing for crash resistance and input validation
- โ Memory safety verification with Valgrind
- โ Supply chain security with OSSF Scorecard monitoring
- โ Performance benchmarking with regression detection
See SECURITY_TESTING.md for detailed security measures.
๐ Performance
batless is designed for speed and low memory usage:
- Streaming: Never loads entire files into memory
- Fast startup: Cached syntax sets and optimized loading
- Efficient highlighting: Pre-loaded syntax and theme sets
- Small binary: ~2MB release build
- Memory efficient: Constant memory usage regardless of file size
Enhanced benchmarks on a 10MB Python file:
batless (optimized): 95ms (streaming + cached)
batless (summary): 45ms (structure only)
bat: 180ms (full load)
cat: 50ms (no highlighting)
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Branch Protection & Contributing
This repository uses branch protection rules to ensure code quality and security:
- Pull requests required - No direct commits to
main - CI/CD checks required - All tests must pass
- GPG signed commits recommended - For authenticity verification
Quick Setup
# Setup branch protection (one-time)
# Verify configuration
Development Workflow
# 1. Create feature branch
# 2. Make changes and commit
# 3. Push and create PR
# 4. Wait for CI, then merge
See docs/BRANCH_PROTECTION.md for detailed guidance.
Release Automation
This project features fully automated releases and Homebrew tap updates:
- Automated Releases: Every git tag triggers cross-platform binary builds, GitHub releases, and crates.io publishing
- Homebrew Integration: The homebrew-batless tap automatically updates with each release
- Zero Maintenance: Formula SHA256 hashes and versions are calculated and updated automatically
Release Process
# Create and push a new tag - everything else is automated
# Automated workflows will:
# โ
Build binaries for all platforms
# โ
Create GitHub release with assets
# โ
Publish to crates.io
# โ
Update Homebrew tap with correct SHA256
# โ
Users get latest version via all install methods
See docs/HOMEBREW_AUTOMATION.md for technical details.
Development Setup
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Special thanks to:
- sharkdp/bat - Inspiration for syntax highlighting excellence
- syntect - Powerful syntax highlighting engine
- Rust Community - For building amazing tools and ecosystem
- AI Assistant Communities - For driving the need for automation-friendly tools
๐ Documentation
Getting Started
- Quick Start Guide - Get running in 2 minutes
- Installation Guide - All installation methods
- Usage Examples - Common workflows and patterns
- Troubleshooting - Common issues and solutions
Advanced Usage
- ๐ค AI & Editor Integration Guide - Complete setup for Zed, VS Code, and GitHub CLI
- Configuration Guide - All configuration options and profiles
- AI Integration Examples - Claude, ChatGPT, Copilot
- CI/CD Integration - GitHub Actions, Jenkins, GitLab
- Performance Tuning - Optimization tips and benchmarks
Development
- Contributing Guide - Development guidelines and setup
- Architecture Overview - Module map, data flow, and extension points
- Performance Guard - Benchmark baseline & regression detection
- Security Guidelines - Security best practices
- Release Process - How releases are managed
๐ Next Steps
Ready to transform your code viewing experience?
- โก Install batless - Choose your preferred method (2 minutes)
- ๐ฏ Try Real Examples - See what's possible with your workflow
- ๐ค Integrate with AI - Enhance your AI assistant workflows
- ๐ฌ Join Community - Get help and share ideas
๐ Links & Resources
Distribution Channels
- Main Repository: github.com/docdyhr/batless
- Homebrew Tap: github.com/docdyhr/homebrew-batless
- Crates.io Package: crates.io/crates/batless
- Documentation: docs.rs/batless
Community & Support
- Issues & Bug Reports: github.com/docdyhr/batless/issues
- Feature Discussions: github.com/docdyhr/batless/discussions
- Security Reports: security@docdyhr.com
- General Support: support@docdyhr.com
โญ Found this helpful? Give us a star on GitHub! โญ