@qiaolei81/copilot-session-viewer 0.1.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/.env.example ADDED
@@ -0,0 +1,14 @@
1
+ # Copilot Session Viewer - Environment Configuration
2
+
3
+ # Server port
4
+ PORT=3838
5
+
6
+ # Node environment (development | production)
7
+ NODE_ENV=development
8
+
9
+ # Session state directory path
10
+ # Default: ~/.copilot/session-state
11
+ SESSION_DIR=/Users/yourusername/.copilot/session-state
12
+
13
+ # Optional: Enable debug logging
14
+ # DEBUG=copilot-session-viewer:*
package/.eslintignore ADDED
@@ -0,0 +1,20 @@
1
+ # Dependencies
2
+ node_modules/
3
+ package-lock.json
4
+
5
+ # Build output
6
+ dist/
7
+ coverage/
8
+
9
+ # Test artifacts
10
+ *.log
11
+ .DS_Store
12
+
13
+ # Debug scripts
14
+ check-*.js
15
+ test-*.js
16
+ debug-*.js
17
+ verify-*.js
18
+
19
+ # External libraries
20
+ public/hyperlist.js
package/AGENTS.md ADDED
@@ -0,0 +1,109 @@
1
+ # AGENTS.md
2
+
3
+ ## Project overview
4
+ Web UI for viewing and analyzing GitHub Copilot CLI session logs. Built with Express.js, EJS templates, and vanilla JavaScript (Vue 3 for session detail view).
5
+
6
+ ## Setup commands
7
+ - Install deps: `npm install`
8
+ - Start server: `npm start`
9
+ - Dev mode (auto-reload): `npm run dev`
10
+ - Run all tests: `npm run test:all`
11
+ - Lint code: `npm run lint`
12
+ - Fix lint issues: `npm run lint:fix`
13
+
14
+ ## Code style
15
+ - JavaScript (Node.js 22+)
16
+ - Single quotes for strings
17
+ - No unused variables (prefix with `_` if intentionally unused in catch blocks)
18
+ - Error handling: always include `{ cause }` when re-throwing errors
19
+ - ESLint enforced (no errors, warnings acceptable)
20
+
21
+ ## File structure
22
+ ```
23
+ server.js # Main Express app
24
+ src/
25
+ config.js # Configuration constants
26
+ session.js # Session data model
27
+ sessionRepository.js # Session loading/caching
28
+ insightService.js # Copilot-based analysis
29
+ processManager.js # Background process tracking
30
+ fileUtils.js # File operations
31
+ helpers.js # Utility functions
32
+ views/
33
+ index.ejs # Session list (main page)
34
+ session-vue.ejs # Session detail (Vue 3)
35
+ time-analyze.ejs # Timeline analysis
36
+ __tests__/ # Jest unit tests
37
+ __tests__/e2e/ # Playwright e2e tests
38
+ ```
39
+
40
+ ## Testing instructions
41
+ - **Unit tests**: `npm test` (Jest)
42
+ - **E2E tests**: `npm run test:e2e` (Playwright)
43
+ - **Coverage**: `npm run test:coverage`
44
+ - Always run `npm run lint` before committing
45
+ - E2E tests expect server running on port 3838
46
+ - Tests use `~/.copilot/session-state/` by default
47
+
48
+ ## Common tasks
49
+
50
+ ### Adding a new route
51
+ 1. Add route handler in `server.js`
52
+ 2. Create corresponding view in `views/`
53
+ 3. Add E2E test in `__tests__/e2e/`
54
+ 4. Update README if user-facing
55
+
56
+ ### Modifying session parsing
57
+ 1. Edit `src/session.js` or `src/fileUtils.js`
58
+ 2. Run unit tests: `npm test`
59
+ 3. Test with real sessions from `~/.copilot/session-state/`
60
+
61
+ ### UI changes
62
+ - Main page: edit `views/index.ejs` (vanilla JS)
63
+ - Session detail: edit `views/session-vue.ejs` (Vue 3 CDN)
64
+ - Time analysis: edit `views/time-analyze.ejs` (vanilla JS)
65
+ - Restart server to see changes: `npm run dev` (auto-reload)
66
+
67
+ ## Important constraints
68
+
69
+ ### Security
70
+ - No authentication (local-only tool)
71
+ - Helmet.js for basic security headers
72
+ - Rate limiting on upload endpoint
73
+ - Input validation on file paths
74
+ - CORS restricted to localhost origins
75
+
76
+ ### Dependencies
77
+ - **copilot CLI** must be in PATH (used by insightService)
78
+ - Node.js 22+ (uses native fetch, improved performance)
79
+ - Session files: `~/.copilot/session-state/` (configurable via SESSION_DIR env)
80
+
81
+ ### Performance
82
+ - Session list caches for 30 seconds
83
+ - Virtual scrolling for large event lists (vue-recycle-scroller)
84
+ - Compression enabled (gzip)
85
+ - Static assets served via Express
86
+
87
+ ## Debugging tips
88
+ - Check server logs: `tail -f /tmp/copilot-session-viewer.log` (if running via nohup)
89
+ - Inspect session files: `cat ~/.copilot/session-state/<session-id>/events.jsonl`
90
+ - Browser DevTools console for client-side issues
91
+ - Use `DEBUG=*` env var for verbose logging (if implemented)
92
+
93
+ ## Commit guidelines
94
+ - Use conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`
95
+ - Run `npm run lint:fix` before committing
96
+ - All tests must pass: `npm run test:all`
97
+ - Keep commits atomic and focused
98
+
99
+ ## Known gotchas
100
+ - Vue 3 templates auto-unwrap refs - don't use `.value` in templates
101
+ - `filteredEvents` vs `flatEvents` - use correct one for virtual scroller indices
102
+ - Platform-specific paths: always rely on system PATH, never hardcode `/opt/homebrew` etc.
103
+ - EJS escaping: use `<%- %>` for trusted HTML, `<%= %>` for user input
104
+
105
+ ## PR instructions
106
+ - Title format: `<type>: <description>` (e.g., `feat: add brand colors for model badges`)
107
+ - Link related issues if any
108
+ - Include screenshots for UI changes
109
+ - Verify all tests pass locally before pushing
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-02-15
9
+
10
+ ### Added
11
+ - Initial release of Copilot Session Viewer
12
+ - Web UI for viewing GitHub Copilot CLI session logs
13
+ - Session list with search, filtering, and sorting
14
+ - Detailed session view with Vue 3 and virtual scrolling
15
+ - Time analysis view with sub-agents, turns, and tool breakdown
16
+ - Copilot Insight feature (AI-generated analysis)
17
+ - Model badge colors (Claude, GPT, Gemini)
18
+ - E2E and unit test coverage (17 Playwright + 20 Jest tests)
19
+ - AGENTS.md for AI coding agents
20
+ - Security headers (Helmet.js)
21
+ - Rate limiting for uploads
22
+ - Compression middleware
23
+
24
+ ### Security
25
+ - Input validation for session IDs
26
+ - XSS prevention with proper escaping
27
+ - CORS restricted to localhost
28
+ - File upload size limits (50MB)
29
+
30
+ [0.1.0]: https://github.com/qiaolei81/copilot-session-viewer/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lei Qiao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.