batless exists to VIEW code files in a non-blocking, AI-friendly way.
Following the Unix philosophy, batless intentionally maintains a narrow, focused scope:
"Write programs that do one thing and do it well. Write programs to work together with other programs." — Doug McIlroy, Unix Philosophy
✅ A non-blocking code viewer
- Views individual files with syntax highlighting
- Provides multiple output modes (plain, highlight, json, summary)
- Never blocks or waits for user input
- Optimized for automation and AI workflows
- Memory-efficient streaming for large files
✅ An AI-friendly formatter
- JSON output with structured metadata
- Token counting for context estimation
- AI model profiles (Claude, GPT, Copilot)
- Summary mode for code structure extraction
✅ A cat/bat alternative
- Drop-in replacement for
catwith highlighting - Compatible with pipelines and scripts
- Predictable, scriptable output
❌ Not a search tool (use grep, rg, ag)
❌ Not a file browser (use ls, find, fd)
❌ Not a text editor (use vim, nano, code)
❌ Not an interactive pager (use less, more, bat)
❌ Not a Git tool (use git, tig, lazygit)
Decision: Keep searching separate
Rationale:
grepandrgare mature, optimized search tools- Search requires different performance characteristics (indexing, parallel scanning)
- Would duplicate existing excellent tools
- Violates "do one thing well" principle
Better approach: Excellent error messages with hints
Decision: Keep file discovery separate
Rationale:
ls,find,fd,treeare purpose-built for this- Directory traversal adds complexity
- Respecting
.gitignorerequires git integration - Metadata display (size, dates, permissions) is
lsterritory
Better approach: Document the pipeline pattern
Decision: This one is debatable
Arguments FOR adding --range:
- Very common use case
- Simple to implement
- Doesn't violate core mission
- Would improve usability significantly
Arguments AGAINST:
sed,head,tailalready exist- Adds API surface area
- Not strictly "viewing" (more like "extracting")
Recommendation: Consider for v0.4.0, but with caveats:
- Only if trivial to implement
- Only basic syntax:
-r START:END - No complex features (negative indices, multiple ranges)
Instead of adding features, improve the user experience when using the right tools:
Current:
Error: unexpected argument '--pattern' found
Improved:
Error: unexpected argument '--pattern' found
💡 Tip: batless is a file viewer, not a search tool.
To search for patterns, use:
grep -rn "pattern" src/
rg "pattern" src/ # even faster!
Then view results with batless:
batless $(grep -l "pattern" src/*)
Current state: Documentation exists but could be better integrated
Improvements:
- Quick reference guide with common patterns
- Cheat sheet for "I want to X" → "Use Y"
- Examples of batless in pipelines
- Integration guides for AI workflows
Make batless work excellently with other tools:
# Find and view pattern matches
grep -l "TODO" src/*.rs | xargs batless -n
# View specific ranges from multiple files
find . -name "*.py" -exec sh -c 'echo "=== {} ==="; sed -n "1,50p" {} | batless --language=python' \;
# AI workflow: search, extract, analyze
rg -l "async fn" src/ | while read f; do
batless --mode=json --summary "$f"
done | jq -s '[.[] | {file: .file, async_functions: .summary_lines}]'batless --help-examples
COMMON PATTERNS
View a file with line numbers:
batless -n src/main.rs
View specific line range (use sed):
sed -n '10,50p' file.py | batless --language=python
Find and view files containing pattern:
grep -l "pattern" src/* | xargs batless
List files in directory (use ls/fd):
fd -e py | xargs batless --mode=summary
AI workflow - extract structure:
batless --mode=json --summary src/*.rs | jq '.summary_lines'- Enhanced error messages with helpful hints
- Add
--help-examplessubcommand - Improve documentation with pipeline patterns
- Add cookbook of common workflows
- Better integration with grep/find/fd in docs
Impact: 90% of user confusion solved Effort: Low (mostly documentation) Maintains: Focused scope, Unix philosophy
Only if:
- Community strongly requests it
- Implementation is trivial (<100 lines)
- Doesn't add dependencies
- Doesn't compromise performance
Implementation:
// Simple, no-frills range support
--range START:END // e.g., --range 10:50No complex features:
- ❌ Negative indices
- ❌ Multiple ranges
- ❌ Regex-based ranges
- ❌ Context lines
Do NOT add:
- Pattern searching (
--pattern) - File listing (
--list) - Interactive features
- Git integration
- Diff viewing
- Anything that violates core mission
When considering new features, ask:
-
Does it help VIEW code better?
- ✅ Yes → Consider
- ❌ No → Reject
-
Can existing tools do it well?
- ✅ Yes, and they're standard → Reject
- ❌ No good alternative → Consider
-
Does it add complexity?
- ✅ Significant → Reject
- ❌ Trivial → Consider
-
Is it automatable?
- ✅ Yes → Prefer pipeline pattern
- ❌ No → Consider built-in
Users tried:
batless --list .vscode/batless --pattern "import.*@/" src/
Wrong response: Add these features
Right response:
- Fix documentation ✅ (Done)
- Improve error messages with hints ✅ (Recommended)
- Document the correct tools to use ✅ (Recommended)
- Show pipeline patterns ✅ (Recommended)
Recommendation: Stick to the middle ground
- ✅ Keep batless focused on viewing files
- ✅ Enhance user experience through better errors/docs
- ✅ Embrace the pipeline model
- ✅ Document integrations with other tools
- 🤔 Maybe add
--rangeif trivial to implement
Success metric: Users understand batless's role and naturally reach for the right tool for each task.
- Add helpful hints to error messages
- Create
--help-examplescommand - Write cookbook of common patterns
- Improve CLAUDE.md examples
- Add pipeline integration guide
- Evaluate
--rangefeature request - Survey users on most common pain points
- Measure: Are users still trying wrong commands?
-
Add pattern searching -
Add file listing -
Add interactive features -
Become bat++
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." — Antoine de Saint-Exupéry
This philosophy guide ensures batless remains:
- Simple to understand
- Easy to maintain
- Reliable in behavior
- Composable with other tools
- Focused on its core mission
Last Updated: October 14, 2025