@qiaolei81/copilot-session-viewer 0.3.3 → 0.3.5

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.
Files changed (60) hide show
  1. package/bin/copilot-session-viewer +2 -2
  2. package/dist/server.min.js +99 -0
  3. package/package.json +14 -3
  4. package/public/vendor/marked.umd.min.js +8 -0
  5. package/public/vendor/purify.min.js +3 -0
  6. package/public/vendor/vue-virtual-scroller.css +1 -0
  7. package/public/vendor/vue-virtual-scroller.min.js +2 -0
  8. package/public/vendor/vue.global.prod.min.js +19 -0
  9. package/views/session-vue.ejs +5 -5
  10. package/views/time-analyze.ejs +2 -2
  11. package/.nycrc +0 -29
  12. package/AGENTS.md +0 -109
  13. package/CHANGELOG.md +0 -313
  14. package/CONTRIBUTING.md +0 -104
  15. package/RELEASE.md +0 -146
  16. package/docs/API.md +0 -471
  17. package/docs/DEVELOPMENT.md +0 -556
  18. package/docs/INSTALLATION.md +0 -329
  19. package/docs/README.md +0 -102
  20. package/docs/TROUBLESHOOTING.md +0 -630
  21. package/docs/images/homepage.png +0 -0
  22. package/docs/images/session-detail.png +0 -0
  23. package/docs/images/time-analysis.png +0 -0
  24. package/docs/unified-event-format-design.md +0 -844
  25. package/docs/unified-event-format-implementation.md +0 -350
  26. package/eslint.config.mjs +0 -133
  27. package/examples/parser-usage.js +0 -114
  28. package/lib/parsers/README.md +0 -239
  29. package/lib/parsers/base-parser.js +0 -53
  30. package/lib/parsers/claude-parser.js +0 -181
  31. package/lib/parsers/copilot-parser.js +0 -143
  32. package/lib/parsers/index.js +0 -15
  33. package/lib/parsers/parser-factory.js +0 -77
  34. package/lib/parsers/pi-mono-parser.js +0 -119
  35. package/lib/parsers/vscode-parser.js +0 -591
  36. package/scripts/release.sh +0 -43
  37. package/server.js +0 -29
  38. package/src/app.js +0 -129
  39. package/src/config/index.js +0 -27
  40. package/src/controllers/insightController.js +0 -136
  41. package/src/controllers/sessionController.js +0 -449
  42. package/src/controllers/tagController.js +0 -113
  43. package/src/controllers/uploadController.js +0 -648
  44. package/src/middleware/common.js +0 -67
  45. package/src/middleware/rateLimiting.js +0 -62
  46. package/src/models/Session.js +0 -146
  47. package/src/routes/api.js +0 -11
  48. package/src/routes/insights.js +0 -12
  49. package/src/routes/pages.js +0 -12
  50. package/src/routes/uploads.js +0 -14
  51. package/src/schemas/event.schema.js +0 -73
  52. package/src/services/eventNormalizer.js +0 -291
  53. package/src/services/insightService.js +0 -535
  54. package/src/services/sessionRepository.js +0 -1092
  55. package/src/services/sessionService.js +0 -1919
  56. package/src/services/tagService.js +0 -205
  57. package/src/telemetry.js +0 -152
  58. package/src/utils/fileUtils.js +0 -305
  59. package/src/utils/helpers.js +0 -45
  60. package/src/utils/processManager.js +0 -85
@@ -1,630 +0,0 @@
1
- # 🔧 Troubleshooting
2
-
3
- Common issues and solutions for Copilot Session Viewer.
4
-
5
- ---
6
-
7
- ## Quick Diagnostics
8
-
9
- ### System Check
10
-
11
- Run this diagnostic script to check your setup:
12
-
13
- ```bash
14
- # Check Node.js version
15
- echo "Node.js: $(node --version)"
16
-
17
- # Check npm version
18
- echo "npm: $(npm --version)"
19
-
20
- # Check if Copilot CLI is installed
21
- if command -v copilot &> /dev/null; then
22
- echo "Copilot CLI: $(copilot --version)"
23
- else
24
- echo "❌ Copilot CLI: Not installed"
25
- fi
26
-
27
- # Check session directory
28
- if [ -d ~/.copilot/session-state ]; then
29
- echo "Session directory: ✅ Exists ($(ls ~/.copilot/session-state | wc -l) sessions)"
30
- else
31
- echo "Session directory: ❌ Not found"
32
- fi
33
-
34
- # Check if port 3838 is available
35
- if lsof -i :3838 &> /dev/null; then
36
- echo "Port 3838: ❌ In use"
37
- else
38
- echo "Port 3838: ✅ Available"
39
- fi
40
- ```
41
-
42
- ---
43
-
44
- ## Installation Issues
45
-
46
- ### Node.js Version Problems
47
-
48
- **Issue:** `Error: Node.js version X.X.X is not supported`
49
-
50
- **Solution:**
51
- ```bash
52
- # Install Node Version Manager (nvm)
53
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
54
- source ~/.bashrc # or ~/.zshrc
55
-
56
- # Install and use latest LTS
57
- nvm install --lts
58
- nvm use --lts
59
- nvm alias default lts/*
60
-
61
- # Verify version
62
- node --version # Should be ≥ 18.0.0
63
- ```
64
-
65
- ### npm Permission Errors
66
-
67
- **Issue:** `Error: EACCES: permission denied`
68
-
69
- **Solution for macOS/Linux:**
70
- ```bash
71
- # Option 1: Fix npm permissions (recommended)
72
- mkdir ~/.npm-global
73
- npm config set prefix '~/.npm-global'
74
- echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc # or ~/.zshrc
75
- source ~/.bashrc # or ~/.zshrc
76
-
77
- # Option 2: Use npx instead
78
- npx -y @qiaolei81/copilot-session-viewer
79
- ```
80
-
81
- **Solution for Windows:**
82
- ```powershell
83
- # Run PowerShell as Administrator, then:
84
- npm install -g @qiaolei81/copilot-session-viewer
85
- ```
86
-
87
- ### Package Not Found
88
-
89
- **Issue:** `Error: Cannot find package '@qiaolei81/copilot-session-viewer'`
90
-
91
- **Solution:**
92
- ```bash
93
- # Clear npm cache
94
- npm cache clean --force
95
-
96
- # Try with specific registry
97
- npm install -g @qiaolei81/copilot-session-viewer --registry https://registry.npmjs.org/
98
-
99
- # Or use npx
100
- npx -y @qiaolei81/copilot-session-viewer
101
- ```
102
-
103
- ---
104
-
105
- ## Server Startup Issues
106
-
107
- ### Port Already in Use
108
-
109
- **Issue:** `Error: listen EADDRINUSE: address already in use :::3838`
110
-
111
- **Solution:**
112
- ```bash
113
- # Option 1: Kill process using port 3838
114
- lsof -ti:3838 | xargs kill -9
115
-
116
- # Option 2: Use different port
117
- PORT=3839 npx @qiaolei81/copilot-session-viewer
118
-
119
- # Option 3: Find and stop the conflicting service
120
- lsof -i :3838 # Shows what's using the port
121
- ```
122
-
123
- ### Session Directory Not Found
124
-
125
- **Issue:** `Error: ENOENT: no such file or directory, scandir '/Users/xxx/.copilot/session-state'`
126
-
127
- **Solution:**
128
- ```bash
129
- # Option 1: Install and run Copilot CLI to create directory
130
- npm install -g @github/copilot-cli
131
- copilot --version # This should create the directory
132
-
133
- # Option 2: Create directory manually and add test session
134
- mkdir -p ~/.copilot/session-state/test-session
135
- echo '{"type":"session.start","timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'"}' > ~/.copilot/session-state/test-session/events.jsonl
136
-
137
- # Option 3: Use custom directory
138
- SESSION_DIR="/path/to/your/sessions" npx @qiaolei81/copilot-session-viewer
139
- ```
140
-
141
- ### File Permission Issues
142
-
143
- **Issue:** `Error: EACCES: permission denied, open '/Users/xxx/.copilot/session-state/...'`
144
-
145
- **Solution:**
146
- ```bash
147
- # Fix permissions on session directory
148
- chmod -R 755 ~/.copilot/session-state/
149
-
150
- # If that doesn't work, check ownership
151
- ls -la ~/.copilot/session-state/
152
- # If owned by root or another user:
153
- sudo chown -R $(whoami) ~/.copilot/session-state/
154
- ```
155
-
156
- ---
157
-
158
- ## Application Runtime Issues
159
-
160
- ### Sessions Not Appearing
161
-
162
- **Issue:** Homepage shows "No sessions found" but sessions exist
163
-
164
- **Diagnosis:**
165
- ```bash
166
- # Check if sessions exist
167
- ls -la ~/.copilot/session-state/
168
-
169
- # Check session format
170
- ls ~/.copilot/session-state/*/events.jsonl
171
- # OR
172
- ls ~/.copilot/session-state/*.jsonl
173
- ```
174
-
175
- **Solution:**
176
- ```bash
177
- # If sessions are empty directories, they need events.jsonl files
178
- for dir in ~/.copilot/session-state/*/; do
179
- if [ ! -f "$dir/events.jsonl" ]; then
180
- echo "Missing events.jsonl in $dir"
181
- fi
182
- done
183
-
184
- # Create minimal events file for testing
185
- echo '{"type":"session.start","timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'"}' > ~/.copilot/session-state/test/events.jsonl
186
- ```
187
-
188
- ### Infinite Scroll Not Working
189
-
190
- **Issue:** "Load More Sessions" button doesn't appear or doesn't work
191
-
192
- **Solution:**
193
- ```bash
194
- # Check browser console for JavaScript errors
195
- # Open Developer Tools (F12) and look in Console tab
196
-
197
- # Common fixes:
198
- # 1. Refresh the page
199
- # 2. Clear browser cache (Ctrl+F5 or Cmd+Shift+R)
200
- # 3. Check if sessions are loading in browser Network tab
201
- ```
202
-
203
- ### Session Detail Page Errors
204
-
205
- **Issue:** `404 Not Found` when clicking on sessions
206
-
207
- **Solution:**
208
- ```bash
209
- # Verify session ID format
210
- # Should be UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
211
-
212
- # Check server logs for specific error
213
- # Look in terminal where you started the server
214
-
215
- # Try accessing session directly
216
- curl http://localhost:3838/api/sessions/YOUR_SESSION_ID/events
217
- ```
218
-
219
- ---
220
-
221
- ## AI Insight Issues
222
-
223
- ### Copilot CLI Not Found
224
-
225
- **Issue:** `Error: copilot command not found`
226
-
227
- **Solution:**
228
- ```bash
229
- # Install GitHub Copilot CLI
230
- npm install -g @github/copilot-cli
231
-
232
- # Or use GitHub CLI (if available)
233
- gh extension install github/gh-copilot
234
-
235
- # Verify installation
236
- copilot --version
237
- copilot --yolo -p "test" # Test yolo mode
238
- ```
239
-
240
- ### Insight Generation Timeout
241
-
242
- **Issue:** Insight generation hangs or times out
243
-
244
- **Solution:**
245
- ```bash
246
- # Check if copilot --yolo works manually
247
- copilot --yolo -p "Analyze this simple session data"
248
-
249
- # If it hangs, try:
250
- # 1. Restart Copilot CLI: copilot auth logout && copilot auth login
251
- # 2. Check internet connection
252
- # 3. Try with smaller session (fewer events)
253
-
254
- # Temporary workaround: Skip AI insights
255
- ENABLE_INSIGHTS=false npx @qiaolei81/copilot-session-viewer
256
- ```
257
-
258
- ### Insight Permission Issues
259
-
260
- **Issue:** `Error: EACCES: permission denied, open 'copilot-insight.md'`
261
-
262
- **Solution:**
263
- ```bash
264
- # Fix permissions on session directory
265
- chmod 755 ~/.copilot/session-state/YOUR_SESSION_ID/
266
- chmod 644 ~/.copilot/session-state/YOUR_SESSION_ID/*
267
-
268
- # If insight file exists but can't be overwritten
269
- rm ~/.copilot/session-state/YOUR_SESSION_ID/copilot-insight.md
270
- ```
271
-
272
- ---
273
-
274
- ## Browser Issues
275
-
276
- ### Page Not Loading
277
-
278
- **Issue:** Browser shows "This site can't be reached" or connection errors
279
-
280
- **Diagnosis:**
281
- ```bash
282
- # Test if server is running
283
- curl http://localhost:3838
284
- # Should return HTML content
285
-
286
- # Test API endpoint
287
- curl http://localhost:3838/api/sessions
288
- # Should return JSON array
289
- ```
290
-
291
- **Solution:**
292
- ```bash
293
- # Check if server started successfully
294
- # Look for this message in terminal:
295
- # "🚀 Copilot Session Viewer running at http://localhost:3838"
296
-
297
- # If not running, check for error messages
298
- # Common issues:
299
- # - Port in use (see Port Already in Use section)
300
- # - Missing dependencies (run npm install)
301
- # - Node.js version (see Node.js Version Problems section)
302
- ```
303
-
304
- ### JavaScript Errors
305
-
306
- **Issue:** Features not working, console shows errors
307
-
308
- **Solution:**
309
- 1. **Open browser Developer Tools** (F12)
310
- 2. **Check Console tab** for error messages
311
- 3. **Common fixes:**
312
- ```javascript
313
- // If you see "ReferenceError: Vue is not defined"
314
- // Check internet connection (Vue is loaded from CDN)
315
-
316
- // If you see "TypeError: Cannot read property..."
317
- // Refresh the page and clear cache
318
- ```
319
-
320
- ### Virtual Scrolling Issues
321
-
322
- **Issue:** Session event list is choppy or not scrolling smoothly
323
-
324
- **Solution:**
325
- 1. **Switch to legacy view** if available
326
- 2. **Clear browser cache** (Ctrl+F5)
327
- 3. **Reduce session size** - Split large sessions
328
- 4. **Update browser** to latest version
329
- 5. **Try different browser** (Chrome, Firefox, Safari)
330
-
331
- ---
332
-
333
- ## Performance Issues
334
-
335
- ### Slow Session Loading
336
-
337
- **Issue:** Homepage takes a long time to load with many sessions
338
-
339
- **Solution:**
340
- ```bash
341
- # Check session count
342
- ls ~/.copilot/session-state/ | wc -l
343
-
344
- # If > 1000 sessions, consider:
345
- # 1. Archive old sessions
346
- mkdir ~/.copilot/session-state-archive
347
- mv ~/.copilot/session-state/old-session-* ~/.copilot/session-state-archive/
348
-
349
- # 2. Use session filtering (future feature)
350
- # 3. Increase pagination limit
351
- # Edit your .env file:
352
- echo "DEFAULT_LIMIT=10" >> .env
353
- ```
354
-
355
- ### Memory Usage Issues
356
-
357
- **Issue:** High memory usage or browser crashes
358
-
359
- **Solution:**
360
- 1. **Close other browser tabs**
361
- 2. **Reduce virtual scroll buffer** (edit session-vue.ejs)
362
- 3. **Use pagination instead of infinite scroll**
363
- 4. **Split large sessions** into smaller files
364
-
365
- ### Network Issues
366
-
367
- **Issue:** API requests are slow or timing out
368
-
369
- **Solution:**
370
- ```bash
371
- # Test local performance
372
- time curl http://localhost:3838/api/sessions
373
-
374
- # If slow (> 2 seconds), check:
375
- # 1. Disk I/O performance
376
- # 2. Antivirus software interfering
377
- # 3. Large session files
378
- ```
379
-
380
- ---
381
-
382
- ## Data Issues
383
-
384
- ### Corrupted Session Data
385
-
386
- **Issue:** Sessions show as "Error parsing session" or have missing data
387
-
388
- **Solution:**
389
- ```bash
390
- # Check JSONL file format
391
- head ~/.copilot/session-state/SESSION_ID/events.jsonl
392
- # Each line should be valid JSON
393
-
394
- # Validate JSON format
395
- cat ~/.copilot/session-state/SESSION_ID/events.jsonl | while read line; do
396
- echo "$line" | jq . > /dev/null || echo "Invalid JSON: $line"
397
- done
398
-
399
- # Fix common issues:
400
- # 1. Remove empty lines
401
- sed -i '' '/^$/d' ~/.copilot/session-state/SESSION_ID/events.jsonl
402
-
403
- # 2. Fix trailing commas (if any)
404
- # Manual editing required
405
- ```
406
-
407
- ### Missing Workspace Data
408
-
409
- **Issue:** Sessions show "No workspace information"
410
-
411
- **Solution:**
412
- ```bash
413
- # Check if workspace.yaml exists
414
- ls ~/.copilot/session-state/SESSION_ID/workspace.yaml
415
-
416
- # If missing, create minimal file:
417
- cat > ~/.copilot/session-state/SESSION_ID/workspace.yaml << EOF
418
- cwd: /unknown
419
- copilot_version: unknown
420
- model: unknown
421
- EOF
422
- ```
423
-
424
- ---
425
-
426
- ## Development Issues
427
-
428
- ### Hot Reload Not Working
429
-
430
- **Issue:** Changes to EJS templates don't reflect immediately
431
-
432
- **Solution:**
433
- ```bash
434
- # Ensure development mode
435
- NODE_ENV=development npm run dev
436
-
437
- # Check that nodemon is running (should show in terminal)
438
- # If not, install nodemon:
439
- npm install -g nodemon
440
-
441
- # Force restart
442
- # Press Ctrl+C and restart npm run dev
443
- ```
444
-
445
- ### Test Failures
446
-
447
- **Issue:** `npm test` fails with various errors
448
-
449
- **Solution:**
450
- ```bash
451
- # Update test snapshots (if Jest snapshots)
452
- npm test -- --updateSnapshot
453
-
454
- # Clear test cache
455
- npm test -- --clearCache
456
-
457
- # Run tests with verbose output
458
- npm test -- --verbose
459
-
460
- # Run specific test file
461
- npm test -- --testPathPattern=sessionRepository
462
- ```
463
-
464
- ### Linting Errors
465
-
466
- **Issue:** `npm run lint` shows style violations
467
-
468
- **Solution:**
469
- ```bash
470
- # Auto-fix most issues
471
- npm run lint -- --fix
472
-
473
- # Check specific rules
474
- npm run lint -- --rule no-unused-vars
475
-
476
- # Disable rule temporarily (use sparingly)
477
- // eslint-disable-next-line no-unused-vars
478
- const unusedVariable = 'temporary';
479
- ```
480
-
481
- ---
482
-
483
- ## Environment-Specific Issues
484
-
485
- ### Windows Issues
486
-
487
- **PowerShell Execution Policy:**
488
- ```powershell
489
- # If scripts can't run
490
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
491
- ```
492
-
493
- **Path Issues:**
494
- ```powershell
495
- # Session directory path
496
- $sessionDir = "$env:USERPROFILE\.copilot\session-state"
497
- if (Test-Path $sessionDir) { "✅ Sessions found" } else { "❌ No sessions" }
498
- ```
499
-
500
- ### macOS Issues
501
-
502
- **Gatekeeper Issues:**
503
- ```bash
504
- # If npm packages are quarantined
505
- xattr -r -d com.apple.quarantine ~/.npm-global/
506
-
507
- # Homebrew permission issues
508
- sudo chown -R $(whoami) $(brew --prefix)/*
509
- ```
510
-
511
- ### Linux Issues
512
-
513
- **Missing Dependencies:**
514
- ```bash
515
- # Ubuntu/Debian
516
- sudo apt-get update
517
- sudo apt-get install build-essential
518
-
519
- # CentOS/RHEL/Fedora
520
- sudo yum groupinstall "Development Tools"
521
- # OR
522
- sudo dnf groupinstall "Development Tools"
523
- ```
524
-
525
- ---
526
-
527
- ## Getting More Help
528
-
529
- ### Enable Debug Mode
530
-
531
- ```bash
532
- # Start with detailed logging
533
- DEBUG=copilot-viewer:* npm run dev
534
-
535
- # Or for production
536
- DEBUG=copilot-viewer:* npm start
537
- ```
538
-
539
- ### Collect System Information
540
-
541
- ```bash
542
- # Create diagnostic report
543
- echo "=== System Info ===" > debug-info.txt
544
- echo "OS: $(uname -a)" >> debug-info.txt
545
- echo "Node: $(node --version)" >> debug-info.txt
546
- echo "npm: $(npm --version)" >> debug-info.txt
547
- echo "Copilot CLI: $(copilot --version 2>&1)" >> debug-info.txt
548
- echo "Session Dir: $(ls -la ~/.copilot/session-state 2>&1)" >> debug-info.txt
549
- echo "Process: $(ps aux | grep copilot-session-viewer)" >> debug-info.txt
550
- ```
551
-
552
- ### Create Minimal Reproduction
553
-
554
- ```bash
555
- # Create test case
556
- mkdir test-case
557
- cd test-case
558
-
559
- # Create minimal session
560
- mkdir -p test-sessions/test-id
561
- echo '{"type":"session.start","timestamp":"2026-02-15T12:00:00.000Z"}' > test-sessions/test-id/events.jsonl
562
-
563
- # Run viewer with test directory
564
- SESSION_DIR=./test-sessions npx @qiaolei81/copilot-session-viewer
565
- ```
566
-
567
- ### Community Support
568
-
569
- - **🔍 Search existing issues:** [GitHub Issues](https://github.com/qiaolei81/copilot-session-viewer/issues)
570
- - **💬 Ask questions:** [GitHub Discussions](https://github.com/qiaolei81/copilot-session-viewer/discussions)
571
- - **🐛 Report bugs:** [New Issue](https://github.com/qiaolei81/copilot-session-viewer/issues/new)
572
-
573
- ### Bug Report Template
574
-
575
- When reporting issues, include:
576
-
577
- ```markdown
578
- ## Environment
579
- - OS: [e.g., macOS 14.2, Windows 11, Ubuntu 22.04]
580
- - Node.js: [e.g., 18.19.0]
581
- - npm: [e.g., 10.2.3]
582
- - Package version: [e.g., 0.1.3]
583
- - Copilot CLI: [e.g., 0.0.410]
584
-
585
- ## Steps to Reproduce
586
- 1. Run command: `...`
587
- 2. Navigate to: `...`
588
- 3. Click on: `...`
589
- 4. Error occurs: `...`
590
-
591
- ## Expected Behavior
592
- [What should happen]
593
-
594
- ## Actual Behavior
595
- [What actually happens]
596
-
597
- ## Error Messages
598
- ```
599
- [Paste any error messages or logs]
600
- ```
601
-
602
- ## Additional Context
603
- [Any other relevant information]
604
- ```
605
-
606
- ---
607
-
608
- ## Known Issues & Workarounds
609
-
610
- ### Large Session Performance
611
-
612
- **Issue:** Sessions with >10,000 events may be slow
613
-
614
- **Workaround:** Use the Vue.js virtual scrolling view (automatically enabled for large sessions)
615
-
616
- ### Import/Export on Windows
617
-
618
- **Issue:** ZIP file paths may have issues on Windows
619
-
620
- **Workaround:** Use forward slashes in paths, avoid special characters in session IDs
621
-
622
- ### Copilot CLI Rate Limiting
623
-
624
- **Issue:** AI insight generation may hit rate limits
625
-
626
- **Workaround:** Wait a few minutes between insight generations
627
-
628
- ---
629
-
630
- **Still having issues?** Don't hesitate to reach out to the community! 🤝
Binary file
Binary file
Binary file