batless 0.2.2

A non-blocking, LLM-friendly code viewer inspired by bat
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# Changelog

## [0.2.2] - 2025-08-03

### Added

- Complete cat replacement functionality with `-n/--number` and `-b/--number-nonblank` flags
- Exact compatibility with system cat line numbering format (6-character right-aligned + tab)
- Perfect newline handling to match cat/less output exactly

### Fixed

- Critical newline bug that was causing shell "%" indicators on incomplete lines
- Test failures in CI/CD pipeline (test_max_lines_limit)
- Clippy warnings for format strings and conditional logic
- Truncation message formatting for better test compatibility

### Changed

- Standardized all output to use `println!("{formatted_output}")` for consistent newlines
- Modernized format strings to resolve clippy uninlined-format-args warnings
- Simplified conditional logic in main.rs to eliminate clippy if-same-then-else warnings
- Enhanced CI/CD pipeline reliability with comprehensive bug fixes

## [0.2.1] - 2025-08-02

### 🧙 Enhanced Features & Complete v0.2.1 Milestone

This release completes the v0.2.1 milestone with PAGER compatibility and comprehensive streaming features for handling large files efficiently.

#### 🆕 New Features

- **🔧 PAGER Compatibility**: Use batless as a drop-in replacement for cat/less
  - `--plain`: Plain text output mode equivalent to `--mode plain`
  - `--unbuffered`, `--number`: Compatibility flags (ignored for compatibility)
  - Stdin support: Read from pipes and redirects (`echo "content" | batless --plain`)
  - GitHub CLI integration: `PAGER="batless --plain" gh pr view 46`
  - Automatic color disabling in plain mode for better PAGER compatibility

- **🌊 Enhanced JSON Output**: Complete streaming and resumable processing
  - `--streaming-json`: Enable streaming mode for large file processing
  - `--streaming-chunk-size <SIZE>`: Configure chunk size (default: 1000 lines)
  - `--enable-resume --checkpoint <FILE>`: Resume processing from saved checkpoint
  - Stdin support for streaming operations (pipelines and PAGER usage)
  - JSON schema versioning with backwards compatibility
  - Comprehensive streaming validation and error handling

- **🌊 Streaming JSON Output**: Process very large files efficiently with streaming
  - `--streaming-json`: Enable streaming mode for large file processing
  - `--streaming-chunk-size <SIZE>`: Configure chunk size (default: 1000 lines)
  - Schema versioning with JSON output versioned as "2.1"
  - Chunk-based processing with metadata and checksums
- **⏯️ Resume Capability**: Checkpoint and resume interrupted processing
  - `--enable-resume`: Enable checkpoint-based resuming
  - `--checkpoint <FILE>`: Specify checkpoint file location
  - Configuration compatibility validation for safe resuming
- **🧙 Interactive Configuration Wizard**: User-friendly profile setup
  - `--configure`: Launch interactive configuration wizard
  - `--list-profiles`: Display all available custom profiles
  - `--edit-profile <PATH>`: Edit existing profiles interactively
  - Comprehensive profile management with timestamps and validation
- **🔍 Debug Mode**: Detailed processing information for troubleshooting
  - `--debug`: Enable debug output with timing and processing details
  - File statistics, processing time, and configuration details
  - Helpful for performance tuning and issue diagnosis

#### Enhanced

- **📊 JSON Schema System**: Added streaming chunk schema support
  - New `streaming_chunk` schema for validating streaming output
  - Enhanced error messages with field-level validation
  - Schema version tracking for compatibility
- **⚙️ Configuration System**: Extended with new streaming and debug options
  - Support for streaming configuration in custom profiles
  - Debug mode configuration persistence
  - Enhanced validation for streaming parameters

#### Developer Experience

- **🎯 Comprehensive CLI**: All new features fully integrated into help system
- **📝 Enhanced Documentation**: Complete CLI help for all new options
- **🧪 Test Coverage**: 162 tests covering all new functionality
- **🔒 Security**: Full security audit passed with no vulnerabilities
- **⚡ Performance**: Optimized for large file processing with streaming

#### Technical Details

- Added `streaming.rs` module for streaming JSON functionality
- Added `wizard.rs` module for interactive configuration management
- Extended configuration system with streaming and debug support
- Enhanced JSON schema validation with streaming support
- Added chrono dependency for timestamp management
- Maintained full backward compatibility with existing features

## [0.2.2] - 2025-08-03

### Added
<!-- New features -->

### Changed
<!-- Changes in existing functionality -->
- 1df3e83 docs: Correct v0.2.2 status - features complete but not yet released
- 684d543 docs: Clean up TODO.md header formatting after v0.2.2 release
- 22bca40 Fix CI/CD pipeline issues: test failures and clippy warnings

### Fixed
<!-- Bug fixes -->

### Removed
<!-- Features removed in this version -->

## [0.2.0] - 2025-07-31

### 🚀 Major Release: Enhanced AI Integration

This release represents a major milestone in batless development, introducing comprehensive AI integration features that make batless the premier tool for AI-assisted code analysis.

#### Added

- **🔢 SummaryLevel Enum System**: Granular control over summary detail levels
  - `--summary-level <LEVEL>`: Choose from none/minimal/standard/detailed
  - Replaces boolean summary mode with fine-grained control
  - Backward compatibility maintained with deprecated `--summary` flag
- **🤖 AI Model Token Counting**: Precise token estimation for major AI models
  - `--count-tokens`: Display comprehensive token analysis
  - `--ai-model <MODEL>`: Support for GPT-4, GPT-3.5, Claude, Generic models
  - Model-specific context windows and token-per-word ratios
  - Context usage percentage and overflow warnings
- **📐 Context Window Optimization**: Smart content fitting for AI models
  - `--fit-context`: Automatically truncate content to fit context windows
  - `--prompt-tokens <N>`: Reserve space for prompts (default: 500)
  - Word boundary preservation to maintain code readability
  - Clear user feedback on truncation operations
- **✅ JSON Schema Validation**: Runtime validation for AI compatibility
  - `--validate-json`: Validate JSON output against predefined schemas
  - `--get-schema <FORMAT>`: Retrieve schemas for external tool integration
  - Comprehensive schemas for file_info, json_output, token_count, processing_stats
  - Detailed validation error messages with helpful suggestions

#### Enhanced

- **AI Profile System**: All profiles now use new SummaryLevel enum
- **CLI Integration**: 7 new flags seamlessly integrated with existing interface
- **Testing**: 2 new tests added (now 145 total), all passing
- **Error Handling**: Enhanced JSON validation with specific error messages

#### Technical

- **New Modules**: `token_counter.rs` (416 lines) and `json_schema.rs` (400+ lines)
- **Performance**: Minimal overhead added, startup time maintained under 5ms
- **Code Quality**: Zero build warnings, comprehensive test coverage
- **Backward Compatibility**: All existing functionality preserved

### Breaking Changes

- None - this release maintains full backward compatibility

### Migration Guide

- Existing users can immediately benefit from new features without any changes
- Consider migrating from `--summary` to `--summary-level standard` for future compatibility
- New JSON schema validation helps ensure AI tool compatibility

## [0.2.2] - 2025-08-03

### Added
<!-- New features -->

### Changed
<!-- Changes in existing functionality -->
- 1df3e83 docs: Correct v0.2.2 status - features complete but not yet released
- 684d543 docs: Clean up TODO.md header formatting after v0.2.2 release
- 22bca40 Fix CI/CD pipeline issues: test failures and clippy warnings

### Fixed
<!-- Bug fixes -->

### Removed
<!-- Features removed in this version -->

## [0.1.5] - 2025-01-28

### Added

- **Shell completions** for bash, zsh, fish, and PowerShell (`--generate-completions` flag)
- **AI tool presets** via `--profile` flag with optimized configurations:
  - `claude`: 4K lines, summary mode for Claude's context window
  - `copilot`: 2K lines, JSON + tokens for GitHub Copilot integration
  - `chatgpt`: 3K lines, JSON + tokens for OpenAI ChatGPT
  - `assistant`: 5K lines, summary mode for general AI assistants
- **Enhanced error messages** with contextual help and suggestions:
  - Error codes (E101-E501) for programmatic handling
  - "Did you mean" suggestions using Levenshtein distance algorithm
  - Smart file suggestions from current directory for typos
  - Improved permission denied messages with actionable advice
- Custom error types for better error handling and user experience
- Modular architecture with separate modules for each concern:
  - `config` - Configuration management with validation
  - `error` - Custom error types and result handling
  - `file_info` - File metadata and processing results
  - `formatter` - Output formatting for different modes
  - `highlighter` - Syntax highlighting functionality
  - `language` - Language detection and theme management
  - `processor` - Core file processing logic
  - `summarizer` - Code summary extraction
  - `tokenizer` - Token extraction for AI processing
- Performance benchmark suite using Criterion
- Comprehensive unit tests for all modules (107 tests total)
- Enhanced language detection with fallback mechanisms
- Advanced tokenization strategies for different file types
- Improved summary extraction supporting 15+ programming languages
- Comprehensive TODO list update reflecting current v0.1.4 status
- Shell completions for bash, zsh, fish, and PowerShell

### Changed

- Refactored monolithic `lib.rs` (595 lines) into focused modules
- Updated dependency configuration to eliminate security vulnerabilities
- Fixed all clippy warnings (25+ style and performance improvements)
- Improved error message formatting with inline string interpolation
- Enhanced code consistency across all modules

### Fixed

- Unused import warnings in formatter module
- Clippy warnings for uninlined format arguments
- Code style inconsistencies across modules
- Potential performance issues identified by clippy
- Improved error messages with specific error types and context
- Enhanced JSON output format for better backward compatibility
- Upgraded syntax highlighting to use minimal syntect features
- Streamlined CLI error handling with proper stderr output
- Security vulnerability: Eliminated unmaintained `yaml-rust` dependency (RUSTSEC-2024-0320)
- Memory efficiency improvements in large file processing
- Enhanced encoding detection for non-UTF-8 files
- Improved comment filtering in summary mode for more accurate results
- Fixed truncation handling to properly report line vs byte limits

### Security

- Removed indirect dependency on unmaintained `yaml-rust` crate
- Updated syntect dependency to use minimal feature set without YAML loading
- Enhanced input validation and error handling throughout the codebase
- Added comprehensive test coverage including property-based tests

### Performance

- Maintained streaming architecture while improving modularity
- Optimized syntax highlighting with selective feature loading
- Enhanced caching strategies for repeated file processing
- Reduced memory footprint through better resource management

### Technical Debt Resolution

- Code complexity reduced from single 595-line file to 9 focused modules
- Test coverage expanded from basic integration tests to 107 unit tests
- Error handling improved from generic errors to 11 specific error types
- Documentation enhanced with comprehensive inline comments
- Build warnings eliminated and code quality improved

## [0.2.2] - 2025-08-03

### Added
<!-- New features -->

### Changed
<!-- Changes in existing functionality -->
- 1df3e83 docs: Correct v0.2.2 status - features complete but not yet released
- 684d543 docs: Clean up TODO.md header formatting after v0.2.2 release
- 22bca40 Fix CI/CD pipeline issues: test failures and clippy warnings

### Fixed
<!-- Bug fixes -->

### Removed
<!-- Features removed in this version -->

## [0.1.4] - 2025-07-26

### Added

- PR-based release workflow that respects branch protection rules
- Comprehensive development guide with release process documentation
- Benchmark files and performance test results

### Changed

- Updated release process to use PRs instead of direct main branch pushes
- Enhanced CLAUDE.md with development workflow guidelines
- Improved CI/CD automation with branch protection compliance

### Fixed

- Release workflow failures due to branch protection rules
- Cargo.lock tracking for binary crate reproducible builds
- Missing GH_TOKEN in GitHub Actions workflows

## [0.2.2] - 2025-08-03

### Added
<!-- New features -->

### Changed
<!-- Changes in existing functionality -->
- 1df3e83 docs: Correct v0.2.2 status - features complete but not yet released
- 684d543 docs: Clean up TODO.md header formatting after v0.2.2 release
- 22bca40 Fix CI/CD pipeline issues: test failures and clippy warnings

### Fixed
<!-- Bug fixes -->

### Removed
<!-- Features removed in this version -->

## [0.1.3] - 2025-07-25

### Added

- Manual workflow dispatch system for granular CI/CD control
- Repository health check automation with issue creation
- Comprehensive performance benchmarking with regression detection
- Enhanced dependency management with grouped Dependabot updates

### Changed

- Optimized CI/CD workflows with consolidated caching strategy
- Enhanced error handling with graceful failures and proper timeouts
- Updated security tools with locked dependencies and latest versions
- Improved release process with retry logic and better artifact management

### Fixed

- Replaced deprecated `actions/upload-release-asset@v1` with modern alternatives
- Fixed caching inefficiencies with restore keys and matrix strategy support
- Enhanced workflow stability with better external dependency handling

### Security

- Updated OSSF Scorecard to latest version with proper token handling
- Enhanced security audit workflows with better reporting
- Replaced unmaintained `atty` dependency with `is-terminal` to fix RUSTSEC-2024-0375 and RUSTSEC-2021-0145
- Updated author information in Cargo.toml

### Performance

- Implemented comprehensive benchmarking suite with criterion
- Added performance regression detection in CI/CD
- Performance baseline documentation in `docs/PERFORMANCE_BASELINE.md`

## [0.2.2] - 2025-08-03

### Added
<!-- New features -->

### Changed
<!-- Changes in existing functionality -->
- 1df3e83 docs: Correct v0.2.2 status - features complete but not yet released
- 684d543 docs: Clean up TODO.md header formatting after v0.2.2 release
- 22bca40 Fix CI/CD pipeline issues: test failures and clippy warnings

### Fixed
<!-- Bug fixes -->

### Removed
<!-- Features removed in this version -->

## [0.1.1] - 2025-07-23

### Added

- Comprehensive release infrastructure with GitHub Actions
- Cross-platform binary builds (Linux, macOS, Windows)
- Automated Homebrew tap updates
- Enhanced CI/CD pipeline for releases

### Changed

- Replaced unmaintained `atty` dependency with `is-terminal` for better security
- Simplified release workflow for faster build times
- Improved release automation scripts

### Fixed

- Security vulnerability in dependency chain
- Release workflow compatibility issues

### Infrastructure

- Set up automated crates.io publishing
- Added cross-platform binary distribution
- Enhanced security scanning and dependency management

## [0.2.2] - 2025-08-03

### Added
<!-- New features -->

### Changed
<!-- Changes in existing functionality -->
- 1df3e83 docs: Correct v0.2.2 status - features complete but not yet released
- 684d543 docs: Clean up TODO.md header formatting after v0.2.2 release
- 22bca40 Fix CI/CD pipeline issues: test failures and clippy warnings

### Fixed
<!-- Bug fixes -->

### Removed
<!-- Features removed in this version -->

## [0.1.0] - 2025-07-22

### Added

- 🎯 **Core batless functionality** - non-blocking code viewer for AI and automation
- 🎨 **Syntax highlighting** for 100+ programming languages via syntect
- 📊 **Multiple output modes**: plain, highlight, JSON, and summary
- 🤖 **AI-optimized features**:
  - Summary mode extracts functions, classes, imports
  - Token extraction for LLM context processing
  - JSON output with metadata and structure
-**Performance features**:
  - Smart file limiting by lines and bytes
  - Memory-efficient streaming architecture
  - Cached syntax definitions for fast startup
- 🔒 **Enterprise-grade security**:
  - Comprehensive test coverage with property-based testing
  - Daily vulnerability scanning and dependency auditing
  - Supply chain security with SBOM generation
  - Memory safety validation and fuzz testing
- 📦 **Professional distribution**:
  - Cross-platform binaries (Linux, macOS, Windows)
  - Homebrew tap integration
  - Docker containerization
  - GitHub Actions CI/CD pipeline

### Features for AI Assistants

- Always non-blocking output (never hangs or waits for input)
- Clean, predictable output format
- JSON mode for structured data extraction
- Safe defaults for automated workflows
- No decorations or interactive elements

### Features for CI/CD

- Guaranteed streaming output
- Configurable color control for different environments
- Error handling that doesn't break pipelines
- Memory efficient for large codebases
- Single binary with no external dependencies

### Technical Details

- Built with Rust for performance and safety
- Uses syntect for syntax highlighting
- Clap for CLI argument parsing
- Supports all major operating systems
- Release binary size: ~2MB
- Fast startup time with lazy loading

### Comparison with `bat`

- ✅ Never blocks (unlike `bat` which can use `less`)
- ✅ JSON output mode (not available in `bat`)
- ✅ Byte limiting support (not in `bat`)
- ✅ AI/automation focused design
- ❌ No Git integration (by design)
- ❌ No line numbers (by design for clean output)
- ❌ No file headers (by design for minimal output)

[0.1.1]: https://github.com/docdyhr/batless/releases/tag/v0.1.1
[0.1.0]: https://github.com/docdyhr/batless/releases/tag/v0.1.0