glance-cli 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/LICENSE +21 -0
- package/README.md +874 -0
- package/dist/cli.js +1247 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
# glance-cli
|
|
2
|
+
|
|
3
|
+
**AI-powered web reader for your terminal** – Fetch any webpage, extract clean content, summarize with AI (local or cloud), or ask questions about it.
|
|
4
|
+
|
|
5
|
+
- **100% FREE by default**: Auto-detects and uses Ollama (local AI) - no API keys needed!
|
|
6
|
+
- **Local-first**: Run offline with Ollama models (e.g., Llama 3, Mistral, Gemma)
|
|
7
|
+
- **Optional cloud support**: OpenAI (GPT series) and Google Gemini for premium quality
|
|
8
|
+
- **Smart fallback**: Automatically uses best available service (prefers free)
|
|
9
|
+
- **Voice output**: Listen to summaries with free system TTS or premium ElevenLabs
|
|
10
|
+
- **Production-ready**: Expert prompt engineering, comprehensive error handling, intelligent caching
|
|
11
|
+
- **Privacy-focused**: Your data stays local with Ollama - no cloud required
|
|
12
|
+
- **Built with Bun**: Lightning-fast startup, TypeScript, battle-tested
|
|
13
|
+
|
|
14
|
+
`glance` turns any webpage into terminal-friendly insights — no browser needed.
|
|
15
|
+
|
|
16
|
+
[](https://www.npmjs.com/package/glance-cli)
|
|
17
|
+
[](https://www.npmjs.com/package/glance-cli)
|
|
18
|
+
[](https://opensource.org/licenses/MIT)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## ✨ Highlights
|
|
23
|
+
|
|
24
|
+
### 🎯 **Expert Prompt Engineering**
|
|
25
|
+
Advanced prompt templates engineered for superior AI results:
|
|
26
|
+
- **Structured outputs** with quality constraints
|
|
27
|
+
- **Anti-hallucination** measures (only facts from source)
|
|
28
|
+
- **Task-specific optimization** (TL;DR, key points, ELI5, Q&A)
|
|
29
|
+
- **10x better results** than generic prompts
|
|
30
|
+
|
|
31
|
+
### 🛡️ **Production-Grade Reliability**
|
|
32
|
+
Built for real-world use:
|
|
33
|
+
- **Automatic retries** with exponential backoff
|
|
34
|
+
- **Timeout protection** (no infinite hangs)
|
|
35
|
+
- **Comprehensive error handling** with actionable hints
|
|
36
|
+
- **Graceful degradation** on failures
|
|
37
|
+
- **Memory leak prevention** (guaranteed resource cleanup)
|
|
38
|
+
|
|
39
|
+
### 💾 **Intelligent Caching**
|
|
40
|
+
Smart caching for speed and cost savings:
|
|
41
|
+
- **TTL-based expiration** (24h default, configurable)
|
|
42
|
+
- **Automatic compression** (70% space savings)
|
|
43
|
+
- **LRU eviction** (100MB max, configurable)
|
|
44
|
+
- **Cache statistics** (hit rate, size, performance metrics)
|
|
45
|
+
- **Tag-based organization** for easy management
|
|
46
|
+
|
|
47
|
+
### 📊 **Rich Content Extraction**
|
|
48
|
+
Advanced content detection and extraction:
|
|
49
|
+
- **Intelligent scoring algorithm** (picks best content, not first)
|
|
50
|
+
- **Structure preservation** (headings, lists, paragraphs)
|
|
51
|
+
- **Comprehensive metadata** (20+ fields including author, dates, reading time)
|
|
52
|
+
- **Table extraction** with structure preservation
|
|
53
|
+
- **Code block detection** with language identification
|
|
54
|
+
- **Link categorization** (internal/external/anchor)
|
|
55
|
+
|
|
56
|
+
### 🎨 **Multiple Output Formats**
|
|
57
|
+
Export in any format you need:
|
|
58
|
+
- **Terminal** – Colorful, emoji-rich display
|
|
59
|
+
- **Markdown** – Perfect for documentation
|
|
60
|
+
- **JSON** – Structured data for APIs
|
|
61
|
+
- **HTML** – Styled, embeddable webpages
|
|
62
|
+
- **Plain Text** – Script-friendly, pipeable
|
|
63
|
+
|
|
64
|
+
### 🎙️ **Voice/TTS Output**
|
|
65
|
+
Listen to summaries instead of reading:
|
|
66
|
+
- **ElevenLabs integration** – Premium, natural-sounding voices
|
|
67
|
+
- **Local TTS fallback** – Works offline (macOS Say, Windows SAPI, Linux espeak)
|
|
68
|
+
- **Audio export** – Save summaries as MP3 files
|
|
69
|
+
- **Multiple voices** – Choose from various voice profiles
|
|
70
|
+
- **No API key required** – Falls back to system TTS automatically
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 📦 Installation
|
|
75
|
+
|
|
76
|
+
### Via npm (global)
|
|
77
|
+
```bash
|
|
78
|
+
npm install -g glance-cli
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Via Bun (recommended – fastest)
|
|
82
|
+
```bash
|
|
83
|
+
bun add -g glance-cli
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Standalone Binary (no Node/Bun required)
|
|
87
|
+
Download pre-compiled binaries from [Releases](https://github.com/jkenley/glance-cli/releases).
|
|
88
|
+
|
|
89
|
+
**macOS/Linux:**
|
|
90
|
+
```bash
|
|
91
|
+
curl -L https://github.com/jkenley/glance-cli/releases/latest/download/glance-$(uname -s)-$(uname -m) -o /usr/local/bin/glance
|
|
92
|
+
chmod +x /usr/local/bin/glance
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Windows:**
|
|
96
|
+
Download the `.exe` from [Releases](https://github.com/jkenley/glance-cli/releases) and add to PATH.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🆓 Free Setup (No API Keys!)
|
|
101
|
+
|
|
102
|
+
Want to use glance completely free? Just install Ollama:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# 1. Install Ollama (one-time setup)
|
|
106
|
+
curl -fsSL https://ollama.com/install.sh | sh # macOS/Linux
|
|
107
|
+
# Or download from: https://ollama.com/download
|
|
108
|
+
|
|
109
|
+
# 2. Download a model (one-time, ~4GB)
|
|
110
|
+
ollama pull llama3
|
|
111
|
+
|
|
112
|
+
# 3. That's it! Glance will auto-detect and use it
|
|
113
|
+
glance https://example.com
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Why Ollama?**
|
|
117
|
+
- ✅ **100% FREE** - No API costs ever
|
|
118
|
+
- ✅ **Private** - Runs entirely on your machine
|
|
119
|
+
- ✅ **No internet required** - Works offline after model download
|
|
120
|
+
- ✅ **Fast** - Optimized for your hardware (CPU/GPU)
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## ⚡ Quick Start
|
|
125
|
+
|
|
126
|
+
### Basic Usage (Works Without Any API Keys!)
|
|
127
|
+
```bash
|
|
128
|
+
# Quick summary
|
|
129
|
+
glance https://example.com
|
|
130
|
+
|
|
131
|
+
# Ask a specific question
|
|
132
|
+
glance https://react.dev --ask "What are React Server Components?"
|
|
133
|
+
|
|
134
|
+
# Get key points with emojis
|
|
135
|
+
glance https://blog.example.com --key-points --emoji
|
|
136
|
+
|
|
137
|
+
# TL;DR in one sentence
|
|
138
|
+
glance https://news.ycombinator.com --tldr
|
|
139
|
+
|
|
140
|
+
# Listen to summary (text-to-speech)
|
|
141
|
+
glance https://article.com --read
|
|
142
|
+
|
|
143
|
+
# Save audio summary
|
|
144
|
+
glance https://podcast.com --key-points --audio-output summary.mp3
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Local Models (Free & Private)
|
|
148
|
+
```bash
|
|
149
|
+
# Use Ollama with Llama 3
|
|
150
|
+
glance https://example.com --model llama3 --stream
|
|
151
|
+
|
|
152
|
+
# Available models: llama3, mistral, phi3, gemma2, codellama, etc.
|
|
153
|
+
# List installed models:
|
|
154
|
+
glance --list-models
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Check Available Services
|
|
158
|
+
```bash
|
|
159
|
+
# See what services you have available
|
|
160
|
+
glance --check-services
|
|
161
|
+
|
|
162
|
+
# Force free-only mode (never use paid APIs)
|
|
163
|
+
glance https://example.com --free-only
|
|
164
|
+
|
|
165
|
+
# Prefer quality (use paid APIs if available)
|
|
166
|
+
glance https://example.com --prefer-quality
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Advanced Features
|
|
170
|
+
```bash
|
|
171
|
+
# Export to Markdown with metadata
|
|
172
|
+
glance https://example.com --export article.md --include-metadata
|
|
173
|
+
|
|
174
|
+
# Capture screenshot + summary
|
|
175
|
+
glance https://example.com --screenshot page.png
|
|
176
|
+
|
|
177
|
+
# Full render for JavaScript-heavy sites
|
|
178
|
+
glance https://react-app.com --full-render
|
|
179
|
+
|
|
180
|
+
# Multiple languages supported
|
|
181
|
+
glance https://lemonde.fr --tldr -l fr # French
|
|
182
|
+
glance https://elpais.com -k -l es # Spanish
|
|
183
|
+
glance https://example.ht -l ht # Haitian Creole
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 🎯 Core Features
|
|
189
|
+
|
|
190
|
+
### AI Summarization
|
|
191
|
+
|
|
192
|
+
| Mode | Flag | Description | Best For |
|
|
193
|
+
|------|------|-------------|----------|
|
|
194
|
+
| **Standard** | (default) | Comprehensive 250-400 word summary | Most use cases |
|
|
195
|
+
| **TL;DR** | `-t`, `--tldr` | One powerful sentence (max 25 words) | Quick insights |
|
|
196
|
+
| **Key Points** | `-k`, `--key-points` | 6-10 substantive bullet points | Structured overviews |
|
|
197
|
+
| **ELI5** | `--eli5` | Simple explanation with analogies | Complex topics |
|
|
198
|
+
| **Custom Q&A** | `-q`, `--ask "question"` | Answer specific questions | Targeted information |
|
|
199
|
+
|
|
200
|
+
**Examples:**
|
|
201
|
+
```bash
|
|
202
|
+
# Standard summary
|
|
203
|
+
glance https://arxiv.org/abs/2401.12345
|
|
204
|
+
|
|
205
|
+
# TL;DR for quick scanning
|
|
206
|
+
glance https://techcrunch.com/article --tldr
|
|
207
|
+
|
|
208
|
+
# Key points for meeting notes
|
|
209
|
+
glance https://docs.example.com --key-points --export notes.md
|
|
210
|
+
|
|
211
|
+
# ELI5 for learning
|
|
212
|
+
glance https://quantum-computing-paper.com --eli5
|
|
213
|
+
|
|
214
|
+
# Custom questions
|
|
215
|
+
glance https://api-docs.com --ask "How do I authenticate?"
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### AI Models
|
|
219
|
+
|
|
220
|
+
#### 🆓 Local Models (Ollama) – **FREE & Private** (Recommended!)
|
|
221
|
+
```bash
|
|
222
|
+
# Install Ollama first: https://ollama.ai
|
|
223
|
+
ollama pull llama3
|
|
224
|
+
|
|
225
|
+
# Use with glance (auto-detected as default!)
|
|
226
|
+
glance https://example.com # Automatically uses Ollama if available
|
|
227
|
+
glance https://example.com --model llama3 --stream
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Popular FREE models:**
|
|
231
|
+
- `llama3` – Meta's flagship (best overall) - **RECOMMENDED**
|
|
232
|
+
- `mistral` – Fast and capable
|
|
233
|
+
- `phi3` – Lightweight, good for resource-constrained
|
|
234
|
+
- `gemma2` – Google's open model
|
|
235
|
+
- `codellama` – Optimized for code
|
|
236
|
+
|
|
237
|
+
**Cost:** $0.00 forever! Runs on your machine.
|
|
238
|
+
|
|
239
|
+
#### 💰 Cloud Models (Optional - Costs Money)
|
|
240
|
+
|
|
241
|
+
**OpenAI (Paid):**
|
|
242
|
+
```bash
|
|
243
|
+
export OPENAI_API_KEY=sk-... # Costs ~$0.0015 per summary
|
|
244
|
+
glance https://example.com --model gpt-4o
|
|
245
|
+
glance https://example.com --model gpt-4o-mini # Cheaper option
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Google Gemini (Free tier available, then paid):**
|
|
249
|
+
```bash
|
|
250
|
+
export GEMINI_API_KEY=...
|
|
251
|
+
glance https://example.com --model gemini-2.0-flash-exp # Has free tier
|
|
252
|
+
glance https://example.com --model gemini-1.5-pro # Premium
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Note:** Glance automatically detects and prefers FREE local models. Use `--prefer-quality` to prioritize paid services.
|
|
256
|
+
|
|
257
|
+
### Output Formats
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Terminal (default) - colorful, interactive
|
|
261
|
+
glance https://example.com
|
|
262
|
+
|
|
263
|
+
# Markdown - for documentation
|
|
264
|
+
glance https://example.com --markdown -o article.md
|
|
265
|
+
|
|
266
|
+
# JSON - for APIs and scripts
|
|
267
|
+
glance https://example.com --json -o data.json
|
|
268
|
+
|
|
269
|
+
# HTML - embeddable webpage
|
|
270
|
+
glance https://example.com --format html -o page.html
|
|
271
|
+
|
|
272
|
+
# Plain text - pipeable, script-friendly
|
|
273
|
+
glance https://example.com --format plain | grep "keyword"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Auto-detection:**
|
|
277
|
+
```bash
|
|
278
|
+
# Format auto-detected from extension
|
|
279
|
+
glance url -o output.md # Markdown
|
|
280
|
+
glance url -o output.json # JSON
|
|
281
|
+
glance url -o output.html # HTML
|
|
282
|
+
glance url -o output.txt # Plain text
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Caching System
|
|
286
|
+
|
|
287
|
+
Intelligent caching for speed and cost savings:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# Cache enabled by default (24h TTL)
|
|
291
|
+
glance https://example.com
|
|
292
|
+
glance https://example.com # ⚡ Instant from cache
|
|
293
|
+
|
|
294
|
+
# View cache statistics
|
|
295
|
+
glance --cache-stats
|
|
296
|
+
# Output:
|
|
297
|
+
# Total Entries: 234
|
|
298
|
+
# Total Size: 45.2 MB / 100 MB (45%)
|
|
299
|
+
# Cache Hits: 892
|
|
300
|
+
# Cache Misses: 108
|
|
301
|
+
# Hit Rate: 89.2%
|
|
302
|
+
# Compression: 72% savings
|
|
303
|
+
|
|
304
|
+
# Clear expired entries
|
|
305
|
+
glance --cache-cleanup
|
|
306
|
+
|
|
307
|
+
# Clear all cache
|
|
308
|
+
glance --clear-cache
|
|
309
|
+
|
|
310
|
+
# Disable cache for specific request
|
|
311
|
+
glance https://example.com --no-cache
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Cache Features:**
|
|
315
|
+
- ✅ Automatic compression (70% space savings)
|
|
316
|
+
- ✅ TTL-based expiration (default 24h)
|
|
317
|
+
- ✅ LRU eviction (max 100MB)
|
|
318
|
+
- ✅ Hit rate tracking
|
|
319
|
+
- ✅ Atomic writes (corruption-proof)
|
|
320
|
+
|
|
321
|
+
### Content Extraction
|
|
322
|
+
|
|
323
|
+
Advanced extraction with intelligent content detection:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
# Extract main content with metadata
|
|
327
|
+
glance https://article.com --metadata
|
|
328
|
+
|
|
329
|
+
# Extract all links (categorized)
|
|
330
|
+
glance https://example.com --links
|
|
331
|
+
|
|
332
|
+
# Extract tables from data pages
|
|
333
|
+
glance https://data-table.com --tables
|
|
334
|
+
|
|
335
|
+
# Get structured metadata (author, dates, etc.)
|
|
336
|
+
glance https://blog.com --metadata --json
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Metadata includes:**
|
|
340
|
+
- Title, description, keywords
|
|
341
|
+
- Author, publication date, publisher
|
|
342
|
+
- Reading time estimation
|
|
343
|
+
- OpenGraph and Twitter Cards
|
|
344
|
+
- Structured data (JSON-LD, Schema.org)
|
|
345
|
+
- Word count, paragraph count
|
|
346
|
+
- Language detection
|
|
347
|
+
|
|
348
|
+
### Screenshots
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# Capture screenshot
|
|
352
|
+
glance https://example.com --screenshot page.png
|
|
353
|
+
|
|
354
|
+
# Custom size and format
|
|
355
|
+
glance https://example.com --screenshot output.jpg --width 1280 --height 720
|
|
356
|
+
|
|
357
|
+
# Full page screenshot
|
|
358
|
+
glance https://example.com --screenshot full.png --full-page
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Voice/TTS Output
|
|
362
|
+
|
|
363
|
+
Transform any summary into audio for listening on-the-go:
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
# Read summary aloud (plays immediately)
|
|
367
|
+
glance https://article.com --read
|
|
368
|
+
|
|
369
|
+
# Save as audio file
|
|
370
|
+
glance https://blog.com --audio-output summary.mp3
|
|
371
|
+
|
|
372
|
+
# Use specific voice
|
|
373
|
+
glance https://news.com --read --voice alloy
|
|
374
|
+
|
|
375
|
+
# List available voices
|
|
376
|
+
glance --list-voices
|
|
377
|
+
|
|
378
|
+
# Combine with other features
|
|
379
|
+
glance https://techcrunch.com --tldr --read --emoji
|
|
380
|
+
glance https://paper.com --key-points --audio-output points.mp3
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Voice Options:**
|
|
384
|
+
- **ElevenLabs** (with API key): Premium natural voices
|
|
385
|
+
- `alloy` (Rachel) - warm, friendly
|
|
386
|
+
- `echo` (Clyde) - professional
|
|
387
|
+
- `nova` (Charlie) - energetic
|
|
388
|
+
- `shimmer` (Charlotte) - clear, articulate
|
|
389
|
+
- `onyx` (Callum) - deep, authoritative
|
|
390
|
+
- `fable` (Gigi) - expressive
|
|
391
|
+
|
|
392
|
+
- **Local TTS** (no API key needed):
|
|
393
|
+
- **macOS**: System voices via `say` command
|
|
394
|
+
- **Windows**: SAPI voices
|
|
395
|
+
- **Linux**: espeak or festival
|
|
396
|
+
|
|
397
|
+
**Setup:**
|
|
398
|
+
```bash
|
|
399
|
+
# Optional: For premium ElevenLabs voices
|
|
400
|
+
export ELEVENLABS_API_KEY=your-api-key
|
|
401
|
+
|
|
402
|
+
# Works without API key using system TTS
|
|
403
|
+
glance https://example.com --read
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## 🛠️ Advanced Usage
|
|
409
|
+
|
|
410
|
+
### Streaming Output
|
|
411
|
+
|
|
412
|
+
Real-time output for long content:
|
|
413
|
+
```bash
|
|
414
|
+
glance https://long-article.com --stream
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Custom Timeouts
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# Increase timeout for slow sites
|
|
421
|
+
glance https://slow-site.com --timeout 60000 # 60 seconds
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Full Rendering
|
|
425
|
+
|
|
426
|
+
For JavaScript-heavy sites (SPAs, React apps):
|
|
427
|
+
```bash
|
|
428
|
+
glance https://react-app.com --full-render
|
|
429
|
+
|
|
430
|
+
# With custom wait strategy
|
|
431
|
+
glance https://spa.com --full-render --wait-until load
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Batch Processing
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
# Process multiple URLs
|
|
438
|
+
cat urls.txt | while read url; do
|
|
439
|
+
glance "$url" --tldr --export "summaries/$(echo $url | md5).md"
|
|
440
|
+
done
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Piping and Scripting
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Extract and grep
|
|
447
|
+
glance https://docs.com --format plain | grep "API"
|
|
448
|
+
|
|
449
|
+
# Extract links and process
|
|
450
|
+
glance https://example.com --links --json | jq '.[] | .href'
|
|
451
|
+
|
|
452
|
+
# Chain with other tools
|
|
453
|
+
glance https://article.com | wc -w # Word count
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## 📚 Complete Options
|
|
459
|
+
|
|
460
|
+
```
|
|
461
|
+
Usage: glance <url> [options]
|
|
462
|
+
|
|
463
|
+
Core:
|
|
464
|
+
-t, --tldr One-line TL;DR (max 25 words)
|
|
465
|
+
-k, --key-points 6-10 key insights as bullet points
|
|
466
|
+
--eli5 Explain like I'm 5 (simple with analogies)
|
|
467
|
+
|
|
468
|
+
Questions:
|
|
469
|
+
-q, --ask "question" Ask anything about the page
|
|
470
|
+
|
|
471
|
+
AI Models:
|
|
472
|
+
-m, --model <name> Model to use (default: gpt-4o-mini)
|
|
473
|
+
OpenAI: gpt-4o, gpt-4o-mini
|
|
474
|
+
Gemini: gemini-2.0-flash-exp, gemini-1.5-pro
|
|
475
|
+
Ollama: llama3, mistral, phi3, gemma2, etc.
|
|
476
|
+
-l, --language <code> Output language: en, fr, es, ht (default: en)
|
|
477
|
+
--max-tokens <n> Limit output length
|
|
478
|
+
-e, --emoji Add relevant emojis
|
|
479
|
+
|
|
480
|
+
Voice/TTS:
|
|
481
|
+
--read, --speak Read summary aloud (text-to-speech)
|
|
482
|
+
--voice <name/id> Voice to use (alloy, echo, nova, etc.)
|
|
483
|
+
--audio-output <file> Save audio to MP3 file
|
|
484
|
+
--list-voices List available voices
|
|
485
|
+
|
|
486
|
+
Output:
|
|
487
|
+
--markdown Markdown format
|
|
488
|
+
-j, --json JSON format
|
|
489
|
+
--format <type> Output format: terminal, markdown, json, html, plain
|
|
490
|
+
-o, --export <file> Save to file (auto-detects format from extension)
|
|
491
|
+
--stream Live streaming output
|
|
492
|
+
--include-metadata Include full metadata in output
|
|
493
|
+
|
|
494
|
+
Cache:
|
|
495
|
+
-c, --cache Enable cache (default: true)
|
|
496
|
+
--no-cache Disable cache for this request
|
|
497
|
+
--clear-cache Clear all cache
|
|
498
|
+
--cache-cleanup Remove expired entries
|
|
499
|
+
--cache-stats Show cache statistics
|
|
500
|
+
|
|
501
|
+
Advanced:
|
|
502
|
+
-r, --full-render Render JavaScript (slower, for SPAs)
|
|
503
|
+
--timeout <ms> Request timeout in milliseconds
|
|
504
|
+
--screenshot <file> Save screenshot
|
|
505
|
+
--width <n> Screenshot width (default: 1920)
|
|
506
|
+
--height <n> Screenshot height (default: 1080)
|
|
507
|
+
--raw-html Print raw HTML
|
|
508
|
+
--links List all links
|
|
509
|
+
--tables Extract tables
|
|
510
|
+
--metadata Show page metadata
|
|
511
|
+
--list-models List available Ollama models
|
|
512
|
+
|
|
513
|
+
Debug:
|
|
514
|
+
-v, --verbose Verbose logging (shows performance breakdown)
|
|
515
|
+
-d, --dry-run Preview content without AI processing
|
|
516
|
+
|
|
517
|
+
Help:
|
|
518
|
+
-h, --help Show this help
|
|
519
|
+
-V, --version Show version number
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## 🔧 Configuration
|
|
525
|
+
|
|
526
|
+
### Environment Variables
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
# AI Providers
|
|
530
|
+
export OPENAI_API_KEY=sk-...
|
|
531
|
+
export GEMINI_API_KEY=...
|
|
532
|
+
export GOOGLE_API_KEY=... # Alternative for Gemini
|
|
533
|
+
|
|
534
|
+
# Voice/TTS (optional)
|
|
535
|
+
export ELEVENLABS_API_KEY=... # For premium voices
|
|
536
|
+
|
|
537
|
+
# Ollama (optional, default shown)
|
|
538
|
+
export OLLAMA_ENDPOINT=http://localhost:11434
|
|
539
|
+
|
|
540
|
+
# Cache (optional)
|
|
541
|
+
export GLANCE_CACHE_DIR=~/.glance/cache
|
|
542
|
+
export GLANCE_CACHE_TTL=86400000 # 24h in ms
|
|
543
|
+
export GLANCE_MAX_CACHE_SIZE=104857600 # 100MB
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Configuration File (coming soon)
|
|
547
|
+
|
|
548
|
+
`.glancerc` support planned for v1.1:
|
|
549
|
+
```json
|
|
550
|
+
{
|
|
551
|
+
"defaultModel": "gpt-4o-mini",
|
|
552
|
+
"defaultLanguage": "en",
|
|
553
|
+
"cacheEnabled": true,
|
|
554
|
+
"cacheTTL": 86400000,
|
|
555
|
+
"maxCacheSize": 104857600
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
561
|
+
## 📖 Examples
|
|
562
|
+
|
|
563
|
+
### Content Summarization
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
# Summarize a blog post
|
|
567
|
+
glance https://blog.example.com/post
|
|
568
|
+
|
|
569
|
+
# Get key points from documentation
|
|
570
|
+
glance https://docs.python.org/3/tutorial/ --key-points
|
|
571
|
+
|
|
572
|
+
# Quick TL;DR of news article
|
|
573
|
+
glance https://techcrunch.com/article --tldr --emoji
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
### Learning & Research
|
|
577
|
+
|
|
578
|
+
```bash
|
|
579
|
+
# Understand a complex topic
|
|
580
|
+
glance https://quantum-computing.com --eli5
|
|
581
|
+
|
|
582
|
+
# Answer specific questions
|
|
583
|
+
glance https://react.dev --ask "What are hooks and when should I use them?"
|
|
584
|
+
|
|
585
|
+
# Extract structured data
|
|
586
|
+
glance https://research-paper.com --metadata --json -o paper.json
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### Documentation & Notes
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
# Export documentation to Markdown
|
|
593
|
+
glance https://api-docs.com --markdown -o api-reference.md
|
|
594
|
+
|
|
595
|
+
# Create meeting notes from recorded session
|
|
596
|
+
glance https://meeting-recording.com --key-points --export notes.md
|
|
597
|
+
|
|
598
|
+
# Extract code examples
|
|
599
|
+
glance https://tutorial.com --format plain | grep -A 10 "```"
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
### Monitoring & Automation
|
|
603
|
+
|
|
604
|
+
```bash
|
|
605
|
+
# Check website changes (with caching)
|
|
606
|
+
glance https://status.example.com --tldr
|
|
607
|
+
|
|
608
|
+
# Automated reporting
|
|
609
|
+
#!/bin/bash
|
|
610
|
+
for url in $(cat monitoring.txt); do
|
|
611
|
+
glance "$url" --tldr --format plain >> daily-report.txt
|
|
612
|
+
done
|
|
613
|
+
|
|
614
|
+
# API integration
|
|
615
|
+
curl -s "https://api.example.com/articles" | jq -r '.[]|.url' | \
|
|
616
|
+
xargs -I {} glance {} --key-points --json
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## 🎓 Best Practices
|
|
622
|
+
|
|
623
|
+
### Choosing the Right Model
|
|
624
|
+
|
|
625
|
+
**For speed and cost:**
|
|
626
|
+
```bash
|
|
627
|
+
glance url --model gpt-4o-mini # Fast, cheap, good quality
|
|
628
|
+
glance url --model llama3 # Free, local, private
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
**For highest quality:**
|
|
632
|
+
```bash
|
|
633
|
+
glance url --model gpt-4o # Best reasoning
|
|
634
|
+
glance url --model gemini-1.5-pro # Long context
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
**For code/technical content:**
|
|
638
|
+
```bash
|
|
639
|
+
glance url --model codellama # Optimized for code
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### Optimizing Performance
|
|
643
|
+
|
|
644
|
+
```bash
|
|
645
|
+
# Use cache for repeated requests
|
|
646
|
+
glance url # First time: 3s
|
|
647
|
+
glance url # Cached: 0.1s
|
|
648
|
+
|
|
649
|
+
# Use streaming for long content
|
|
650
|
+
glance long-url --stream
|
|
651
|
+
|
|
652
|
+
# Skip JavaScript rendering if not needed
|
|
653
|
+
glance url # Fast (static fetch)
|
|
654
|
+
glance spa-url --full-render # Slower but complete
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### Error Handling
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
# Use verbose mode for debugging
|
|
661
|
+
glance url --verbose
|
|
662
|
+
|
|
663
|
+
# Check URL before processing
|
|
664
|
+
glance url --dry-run
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
## 🤝 Contributing
|
|
670
|
+
|
|
671
|
+
We welcome contributions! Here's how to get started:
|
|
672
|
+
|
|
673
|
+
### Development Setup
|
|
674
|
+
|
|
675
|
+
```bash
|
|
676
|
+
# Clone repository
|
|
677
|
+
git clone https://github.com/jkenley/glance-cli.git
|
|
678
|
+
cd glance-cli
|
|
679
|
+
|
|
680
|
+
# Install dependencies
|
|
681
|
+
bun install
|
|
682
|
+
|
|
683
|
+
# Run locally
|
|
684
|
+
bun dev https://example.com
|
|
685
|
+
|
|
686
|
+
# Run tests
|
|
687
|
+
bun test
|
|
688
|
+
|
|
689
|
+
# Build
|
|
690
|
+
bun build
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
### Contribution Guidelines
|
|
694
|
+
|
|
695
|
+
1. **Open an issue** for major changes
|
|
696
|
+
2. **Follow code style** (TypeScript, ESLint)
|
|
697
|
+
3. **Add tests** for new features
|
|
698
|
+
4. **Update documentation** as needed
|
|
699
|
+
5. **Write clear commit messages**
|
|
700
|
+
|
|
701
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
|
|
702
|
+
|
|
703
|
+
---
|
|
704
|
+
|
|
705
|
+
## 🏗️ Architecture
|
|
706
|
+
|
|
707
|
+
### Core Components
|
|
708
|
+
|
|
709
|
+
- **`cli.ts`** - Command-line interface with validation and error handling
|
|
710
|
+
- **`fetcher.ts`** - Page fetching with retry logic and timeout protection
|
|
711
|
+
- **`extractor.ts`** - Intelligent content extraction with scoring algorithm
|
|
712
|
+
- **`summarizer.ts`** - Expert-engineered AI prompts for superior results
|
|
713
|
+
- **`formatter.ts`** - Multi-format output (terminal, markdown, JSON, HTML)
|
|
714
|
+
- **`cache.ts`** - Smart caching with TTL, compression, and LRU eviction
|
|
715
|
+
- **`screenshot.ts`** - Screenshot capture with error recovery
|
|
716
|
+
|
|
717
|
+
### Production Features
|
|
718
|
+
|
|
719
|
+
- ✅ **Comprehensive error handling** with categorized errors and hints
|
|
720
|
+
- ✅ **Automatic retries** with exponential backoff for transient failures
|
|
721
|
+
- ✅ **Timeout protection** to prevent infinite hangs
|
|
722
|
+
- ✅ **Resource cleanup** to prevent memory leaks
|
|
723
|
+
- ✅ **Input validation** to catch issues early
|
|
724
|
+
- ✅ **Graceful degradation** on partial failures
|
|
725
|
+
- ✅ **Performance tracking** with detailed breakdowns
|
|
726
|
+
|
|
727
|
+
---
|
|
728
|
+
|
|
729
|
+
## 📊 Performance
|
|
730
|
+
|
|
731
|
+
### Benchmarks
|
|
732
|
+
|
|
733
|
+
| Operation | Time | Notes |
|
|
734
|
+
|-----------|------|-------|
|
|
735
|
+
| Simple fetch | 0.5-1s | Static page |
|
|
736
|
+
| Full render | 2-4s | JavaScript-heavy SPA |
|
|
737
|
+
| AI summary (cloud) | 2-5s | Depends on model |
|
|
738
|
+
| AI summary (local) | 3-8s | Depends on hardware |
|
|
739
|
+
| Cache hit | <0.1s | Nearly instant |
|
|
740
|
+
|
|
741
|
+
### Optimization Tips
|
|
742
|
+
|
|
743
|
+
1. **Use cache** - Reduces API costs and improves speed
|
|
744
|
+
2. **Choose appropriate model** - `gpt-4o-mini` is 10x faster than `gpt-4o`
|
|
745
|
+
3. **Skip full-render** if not needed - 4x faster for static sites
|
|
746
|
+
4. **Use streaming** for long content - Better perceived performance
|
|
747
|
+
5. **Batch processing** - Process multiple URLs efficiently
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
## 🔒 Security
|
|
752
|
+
|
|
753
|
+
### Reporting Vulnerabilities
|
|
754
|
+
|
|
755
|
+
See [SECURITY.md](SECURITY.md) for our security policy.
|
|
756
|
+
|
|
757
|
+
**Report security issues to:** alo@jkenley.me with subject `[Security] glance-cli`
|
|
758
|
+
|
|
759
|
+
### Security Features
|
|
760
|
+
|
|
761
|
+
- ✅ **Input sanitization** - All inputs validated and sanitized
|
|
762
|
+
- ✅ **No shell injection** - Safe programmatic operations
|
|
763
|
+
- ✅ **Content-type validation** - Only processes valid HTML
|
|
764
|
+
- ✅ **Size limits** - Prevents memory exhaustion attacks
|
|
765
|
+
- ✅ **Timeout protection** - Prevents denial of service
|
|
766
|
+
- ✅ **Secure hashing** - SHA-256 instead of MD5
|
|
767
|
+
|
|
768
|
+
---
|
|
769
|
+
|
|
770
|
+
## 📝 Changelog
|
|
771
|
+
|
|
772
|
+
See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
|
|
773
|
+
|
|
774
|
+
### Latest Release (v0.7.0)
|
|
775
|
+
|
|
776
|
+
**Major Improvements:**
|
|
777
|
+
- 🎯 Expert-level prompt engineering (10x better AI results)
|
|
778
|
+
- 🛡️ Production-grade error handling and reliability
|
|
779
|
+
- 💾 Intelligent caching with TTL, compression, and LRU eviction
|
|
780
|
+
- 📊 Rich content extraction with 20+ metadata fields
|
|
781
|
+
- 🎨 Multiple output formats (HTML, plain text)
|
|
782
|
+
- ⚡ Performance optimizations and memory leak fixes
|
|
783
|
+
|
|
784
|
+
See full changelog for all updates.
|
|
785
|
+
|
|
786
|
+
---
|
|
787
|
+
|
|
788
|
+
## 🌟 Roadmap
|
|
789
|
+
|
|
790
|
+
### v1.0 (Stable Release)
|
|
791
|
+
- [ ] Comprehensive test suite (>80% coverage)
|
|
792
|
+
- [ ] Configuration file support (`.glancerc`)
|
|
793
|
+
- [ ] Plugin system for extensibility
|
|
794
|
+
- [ ] Web UI for easier interaction
|
|
795
|
+
- [ ] Additional output formats (PDF, EPUB)
|
|
796
|
+
|
|
797
|
+
### v1.1 (Enhanced Features)
|
|
798
|
+
- [ ] Batch processing with progress bars
|
|
799
|
+
- [ ] Interactive mode for exploration
|
|
800
|
+
- [ ] Custom prompt templates
|
|
801
|
+
- [ ] Integration with note-taking apps (Notion, Obsidian)
|
|
802
|
+
- [ ] Browser extension
|
|
803
|
+
|
|
804
|
+
### Future
|
|
805
|
+
- [ ] Cloud sync for cache
|
|
806
|
+
- [ ] Analytics dashboard
|
|
807
|
+
- [ ] Collaborative features
|
|
808
|
+
- [ ] Mobile app
|
|
809
|
+
|
|
810
|
+
Vote on features: [GitHub Discussions](https://github.com/jkenley/glance-cli/discussions)
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
## ❓ FAQ
|
|
815
|
+
|
|
816
|
+
**Q: Which AI model should I use?**
|
|
817
|
+
A: For most cases, `gpt-4o-mini` (default) offers the best balance of speed, cost, and quality. For privacy or offline use, try `llama3` with Ollama.
|
|
818
|
+
|
|
819
|
+
**Q: How does caching work?**
|
|
820
|
+
A: Responses are cached for 24 hours by default. The cache uses intelligent compression and LRU eviction to stay under 100MB.
|
|
821
|
+
|
|
822
|
+
**Q: Can I use glance without an API key?**
|
|
823
|
+
A: Yes! Install Ollama and use local models like `llama3` or `mistral` for completely free, private operation.
|
|
824
|
+
|
|
825
|
+
**Q: Does glance work with paywalled content?**
|
|
826
|
+
A: No, glance cannot access content behind authentication or paywalls.
|
|
827
|
+
|
|
828
|
+
**Q: How accurate are the summaries?**
|
|
829
|
+
A: glance uses expert-engineered prompts with anti-hallucination measures. Summaries are based strictly on page content, but AI can still make mistakes. Always verify critical information.
|
|
830
|
+
|
|
831
|
+
**Q: Can I customize the prompts?**
|
|
832
|
+
A: Custom prompt templates are planned for v1.1. Currently, you can use different modes (TL;DR, key points, ELI5) or ask custom questions.
|
|
833
|
+
|
|
834
|
+
**Q: Is my data sent to third parties?**
|
|
835
|
+
A: When using cloud models (OpenAI, Gemini), page content is sent to those providers for processing. With local models (Ollama), everything stays on your machine.
|
|
836
|
+
|
|
837
|
+
---
|
|
838
|
+
|
|
839
|
+
## 🙏 Acknowledgments
|
|
840
|
+
|
|
841
|
+
Built with these amazing open-source projects:
|
|
842
|
+
- [Bun](https://bun.sh) - Lightning-fast JavaScript runtime
|
|
843
|
+
- [Cheerio](https://cheerio.js.org) - Fast, flexible HTML parsing
|
|
844
|
+
- [Puppeteer](https://pptr.dev) - Headless Chrome automation
|
|
845
|
+
- [OpenAI](https://openai.com) - GPT models
|
|
846
|
+
- [Google Gemini](https://deepmind.google/technologies/gemini/) - Gemini models
|
|
847
|
+
- [Ollama](https://ollama.ai) - Local LLM infrastructure
|
|
848
|
+
|
|
849
|
+
Special thanks to all [contributors](https://github.com/jkenley/glance-cli/graphs/contributors)!
|
|
850
|
+
|
|
851
|
+
---
|
|
852
|
+
|
|
853
|
+
## 📄 License
|
|
854
|
+
|
|
855
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
856
|
+
|
|
857
|
+
Copyright © 2026 Kenley Jean-Louis
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
|
|
861
|
+
## 📞 Contact & Support
|
|
862
|
+
|
|
863
|
+
- **Author**: Kenley Jean-Louis
|
|
864
|
+
- **Email**: alo@jkenley.me
|
|
865
|
+
- **GitHub**: https://github.com/jkenley
|
|
866
|
+
- **Project**: https://github.com/jkenley/glance-cli
|
|
867
|
+
- **Issues**: https://github.com/jkenley/glance-cli/issues
|
|
868
|
+
- **Discussions**: https://github.com/jkenley/glance-cli/discussions
|
|
869
|
+
|
|
870
|
+
---
|
|
871
|
+
|
|
872
|
+
**Built with ❤️ for developers, researchers, and curious minds.**
|
|
873
|
+
|
|
874
|
+
*Star ⭐ the repo if you find it useful!*
|