CLI Examples & Terminal Output

Explore TONL's powerful command-line interface with real terminal examples showing all available commands and their output.

v2.4.1 - Interactive Stats Dashboard

Quick Installation

Get started with TONL CLI in seconds

📦 Install TONL

npm install -g tonl

Install globally using npm or yarn

✅ Verify Installation

tonl --version

Should show version 2.4.1

CLI Command Examples

Real terminal output showing TONL commands in action

📊 File Analysis Command

Analyze file statistics and compression metrics

Command:
tonl stats package.json
tonl stats package.json
📊 Analyzing package.json...
📖 File size: 2,456 bytes
⚙️ Processing data structure...
✅ Analysis complete!
📈 Statistics:
JSON: 2,456 bytes, 624 tokens
TONL: 1,678 bytes, 412 tokens
💰 Compression: 31.7% bytes, 34.0% tokens
⚡ Processing time: 12ms
🔍 Data structure: 1 object, 8 properties, 2 nested objects

🎮 Interactive Dashboard

Launch the interactive stats dashboard (v2.4.1)

Command:
tonl stats data.json --interactive
tonl stats data.json -i
🚀 TONL Interactive Stats Dashboard v2.4.1
==========================================
📊 Analyzing data.json...
📖 Reading data.json (1,245 bytes)...
⚙️ Processing data...
✅ Analysis complete!
📈 Results: 1,245 bytes → 892 bytes (28.4% savings)
🧠 Tokens: 412 → 267 (35.2% reduction)
Interactive Menu:
1. 📊 Analyze another file
2. ⚖️ Compare two files
3. 🎨 Change theme (default, neon, matrix, cyberpunk)
4. 🔍 Change tokenizer (gpt-5, claude-sonnet-4.5, gemini-3-pro)
5. 📈 Detailed statistics
6. ❌ Exit
tonl>
_

⚡ Encode Command

Convert JSON to TONL format with optimization

Command:
tonl encode users.json --out users.tonl --smart
tonl encode users.json --out users.tonl --smart
📖 Reading users.json (3,567 bytes)...
🔍 Analyzing data structure...
Found: 1 array, 150 objects, 8 properties per object
⚙️ Smart encoding enabled...
Optimal delimiter: comma (,)
Optimization: dictionary + delta encoding
✅ Encoding complete!
📊 Results:
Original: 3,567 bytes (JSON)
Compressed: 1,892 bytes (TONL)
💰 Savings: 1,675 bytes (47.0%)
✅ Written to: users.tonl

⚖️ File Comparison

Compare JSON vs TONL files with detailed metrics

Command:
tonl stats config.json --compare --tokenizer claude-sonnet-4.5
tonl stats config.json --compare --tokenizer claude-sonnet-4.5
📊 Analyzing config.json...
⚖️ Comparing JSON vs TONL formats...
🧠 Token analysis using Claude Sonnet 4.5 tokenizer...
📋 File Comparison Results:
📄 JSON Format:
Size: 8,234 bytes
GPT-5 Tokens: 2,156
Cost: ~$0.02156
📄 TONL Format:
Size: 4,891 bytes
GPT-5 Tokens: 1,342
Cost: ~$0.01342
💰 Savings: 3,343 bytes (40.6%), 814 tokens (37.7%)
💸 Cost Reduction: 37.7% cheaper
🔧 Optimization applied: dictionary encoding + smart delimiter selection

🎨 Theme Customization

Use different visual themes for interactive mode

Available Themes:
tonl stats data.json -i --theme neon tonl stats data.json -i --theme matrix tonl stats data.json -i --theme cyberpunk tonl stats data.json -i --theme default
tonl stats data.json -i --theme neon
🚀 TONL Interactive Stats Dashboard v2.4.1
==========================================
📊 Analyzing data.json with NEON theme...
📖 Reading file...
✅ Analysis complete!
🎨 Current Theme: NEON
- Bright magenta and cyan colors
- High contrast terminal interface
- Perfect for demonstrations and presentations
tonl>
Type 'theme' to change visual style

🔍 Multi-Tokenizer Analysis

Compare token costs across different LLM models

Command:
tonl stats large-dataset.json --tokenizer gemini-2.5-pro
tonl stats large-dataset.json --tokenizer gemini-2.5-pro
📊 Analyzing large-dataset.json...
📖 File size: 125,678 bytes
🧠 Token analysis using Gemini 2.5 Pro tokenizer...
⚙️ Processing large dataset (10,500 records)...
✅ Analysis complete!
📈 Gemini 2.5 Pro Token Analysis:
JSON: 42,156 tokens
TONL: 24,891 tokens
💰 Token savings: 17,265 tokens (41.0%)
💸 Cost savings: ~$0.17265 (assuming $0.01/1K tokens)
🔄 Available tokenizers: gpt-5, claude-sonnet-4.5, gemini-2.5-pro, gemini-3-pro, llama-4, o200k, cl100k
Use --tokenizer flag to specify model for optimization

📖 Decode Command

Convert TONL back to JSON format

Command:
tonl decode data.tonl --out data.json
tonl decode data.tonl --out data.json
📖 Reading data.tonl...
🔍 Parsing TONL format...
Format detected: Standard TONL with type hints
Schema: users[150]{id:u32,name:str,email:str,age:u32,active:bool}
⚙️ Converting to JSON...
Validating data integrity...
✅ 150 records validated successfully
✅ Decoding complete!
📊 Results:
TONL: 8,912 bytes (input)
JSON: 15,432 bytes (output)
✅ Round-trip successful: 100% data integrity maintained
✅ Written to: data.json