zwift-log-parser 0.0.0-stage → 0.0.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Christopher J. Walker
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.
package/README.md CHANGED
@@ -1,3 +1,268 @@
1
- # Temporary Holding Version
1
+ # Zwift Log Parser
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A TypeScript command-line tool for parsing and analyzing Zwift activity log files. Built with [Bun](https://bun.sh) and [React Ink](https://github.com/vadimdemedes/ink).
4
+
5
+ ## Features
6
+
7
+ - 📊 **FPS Analysis** — Visualize frame rate performance with ASCII graphs and statistics
8
+ - 🗺️ **Route Tracking** — Identify routes/activities with duration, distance, and elevation data
9
+ - 🌍 **World Sessions** — Track world changes and activity segments
10
+ - 💻 **System Information** — Extract GPU, CPU, RAM, resolution, and graphics settings
11
+ - 🎮 **Session Metadata** — View game version, launcher version, device info, and timestamps
12
+ - 📤 **JSON Export** — Output data as JSON for further processing
13
+ - 🔧 **Flexible Options** — Enable/disable specific analysis sections as needed
14
+ - 📁 **Interactive File Picker** — Browse and select log files if no path is provided
15
+
16
+ ## Installation
17
+
18
+ ### From a GitHub Release
19
+
20
+ Every release ships an npm package tarball attached to the release page —
21
+ no cloning required. Get the tarball URL from
22
+ <https://github.com/chrisjwalk/zwift-log-parser/releases/latest>, then:
23
+
24
+ ```bash
25
+ # replace v0.0.1 with the release you want
26
+ npm install -g https://github.com/chrisjwalk/zwift-log-parser/releases/download/v0.0.1/zwift-log-parser-0.0.1.tgz
27
+ zwift-log-parser /path/to/your/Log.txt
28
+ ```
29
+
30
+ Requires Node.js.
31
+
32
+ ### From npm
33
+
34
+ Once the package is published to the npm registry:
35
+
36
+ ```bash
37
+ npm install -g zwift-log-parser
38
+ zwift-log-parser /path/to/your/Log.txt
39
+ ```
40
+
41
+ ### Local Development
42
+
43
+ ```bash
44
+ git clone https://github.com/chrisjwalk/zwift-log-parser.git
45
+ cd zwift-log-parser
46
+ bun install
47
+ bun run build
48
+ npm link # makes the zwift-log-parser command available globally
49
+ zwift-log-parser /path/to/your/Log.txt
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ ### Basic Usage
55
+
56
+ ```bash
57
+ zwift-log-parser /path/to/Log.txt
58
+ ```
59
+
60
+ If no file path is provided, an interactive file picker will launch:
61
+
62
+ ```bash
63
+ zwift-log-parser
64
+ ```
65
+
66
+ ### Command-Line Options
67
+
68
+ ```
69
+ zwift-log-parser [logfile] [options]
70
+
71
+ Arguments:
72
+ logfile Path to Zwift log file to parse
73
+
74
+ Options:
75
+ -V, --version Output the version number
76
+ --no-fps Skip FPS analysis and graphs
77
+ --no-routes Skip route/activity information
78
+ --no-metadata Skip session and system metadata
79
+ --json Output results as JSON instead of formatted display
80
+ -h, --help Display help information
81
+ ```
82
+
83
+ ### Examples
84
+
85
+ ```bash
86
+ # Analyze everything (default)
87
+ zwift-log-parser ~/Documents/Zwift/Logs/Log.txt
88
+
89
+ # Routes and metadata only, no FPS graph
90
+ zwift-log-parser ~/Documents/Zwift/Logs/Log.txt --no-fps
91
+
92
+ # Export to JSON for further processing
93
+ zwift-log-parser ~/Documents/Zwift/Logs/Log.txt --json > output.json
94
+
95
+ # FPS analysis only
96
+ zwift-log-parser ~/Documents/Zwift/Logs/Log.txt --no-routes --no-metadata
97
+ ```
98
+
99
+ ## Sample Output
100
+
101
+ ```
102
+ 🚴 Zwift Log Parser v0.0.1
103
+
104
+ Session Information
105
+ Log Date/Time: 21:09:07 2026-01-08
106
+ Game Version: 1.104.4(157262) rc/1.104.4
107
+ Device: PC
108
+
109
+ System Information
110
+ GPU: NVIDIA GeForce RTX 5060/PCIe/SSE2
111
+ Driver: 4.6.0 NVIDIA 591.74
112
+ CPU: 12th Gen Intel(R) Core(TM) i5-12600KF
113
+ RAM: 64GB
114
+ Resolution: 1920x1080
115
+ Graphics: ultra
116
+
117
+ Worlds
118
+ Watopia
119
+ • Triple Flat Loops
120
+ • The Big Ring
121
+
122
+ FPS Analysis
123
+
124
+ 📍 Watopia
125
+
126
+ 126.00 ┤
127
+ 121.33 ┤ ╭───╮ ╭──────╮
128
+ 116.67 ┼──╯ │ ╭╮ │ ╰╮
129
+ ...
130
+
131
+ Time: 1h 48m 52s | Average: 99.76 | Min: 61.73 | Max: 120.97
132
+ ```
133
+
134
+ ## Development
135
+
136
+ ### Project Structure
137
+
138
+ This is a Bun workspace monorepo with two packages:
139
+
140
+ ```
141
+ core/ # Parser library (@zwift-log-parser/core)
142
+ ├── src/
143
+ │ ├── index.ts # Library entry point
144
+ │ └── lib/
145
+ │ ├── parser.ts # ZwiftLogParser class
146
+ │ ├── file-picker.ts # Interactive file picker
147
+ │ └── __fixtures__/ # Test data (real log files)
148
+ └── package.json
149
+
150
+ cli/ # CLI application
151
+ ├── src/
152
+ │ ├── main.tsx # Entry point — argument parsing
153
+ │ ├── App.tsx # Root React Ink component
154
+ │ └── components/ # Individual UI panel components
155
+ │ ├── Banner.tsx
156
+ │ ├── MetadataPanel.tsx
157
+ │ ├── WorldsPanel.tsx
158
+ │ ├── FpsPanel.tsx
159
+ │ └── Section.tsx
160
+ └── package.json
161
+
162
+ scripts/
163
+ └── build.ts # Bun build script (bundles CLI via esbuild)
164
+
165
+ bin/
166
+ └── zwift-log-parser.js # npm bin wrapper
167
+ ```
168
+
169
+ ### Available Commands
170
+
171
+ ```bash
172
+ bun install # Install dependencies
173
+ bun run build # Build CLI bundle to dist/
174
+ bun run dev # Run CLI directly with Bun (no build needed)
175
+ bun start # Run the built CLI from dist/
176
+ bun test # Run all tests
177
+ bun lint # Lint all source files with ESLint
178
+ bun run clean # Remove build artifacts
179
+ bun run pack # Create npm tarball in dist/
180
+ ```
181
+
182
+ ### Cutting a Release
183
+
184
+ 1. Bump `version` in `package.json`
185
+ 2. Tag and push:
186
+
187
+ ```bash
188
+ git tag v0.0.1 && git push origin v0.0.1
189
+ ```
190
+
191
+ The release workflow verifies the tag matches `package.json` version, runs
192
+ lint + tests, builds, smoke-tests the tarball, and attaches
193
+ `zwift-log-parser-<version>.tgz` to a GitHub Release.
194
+
195
+ ### Development Workflow
196
+
197
+ ```bash
198
+ # 1. Install dependencies
199
+ bun install
200
+
201
+ # 2. Run directly without building (fastest iteration)
202
+ bun run dev /path/to/Log.txt
203
+
204
+ # 3. Build for production
205
+ bun run build
206
+
207
+ # 4. Test the built bundle
208
+ bun start /path/to/Log.txt
209
+
210
+ # 5. Run tests
211
+ bun test
212
+
213
+ # 6. Lint
214
+ bun lint
215
+ ```
216
+
217
+ ### Publishing to npm
218
+
219
+ ```bash
220
+ # Bump version, build, and publish
221
+ npm version patch
222
+ bun run build
223
+ npm publish --access public
224
+ ```
225
+
226
+ To test the package locally before publishing:
227
+
228
+ ```bash
229
+ bun run pack
230
+ npm install -g dist/zwift-log-parser-<version>.tgz
231
+ ```
232
+
233
+ ## Technology Stack
234
+
235
+ - **Runtime**: [Bun](https://bun.sh)
236
+ - **Language**: TypeScript 6.0
237
+ - **UI**: [React Ink](https://github.com/vadimdemedes/ink) 7 (terminal UI, React 19)
238
+ - **Bundler**: esbuild (via Bun build API)
239
+ - **CLI Arg Parsing**: Commander.js
240
+ - **FPS Graphs**: asciichart
241
+ - **File Picker**: @inquirer/prompts
242
+ - **Testing**: Vitest
243
+ - **Linting**: ESLint 10 + typescript-eslint
244
+
245
+ ## Architecture
246
+
247
+ ### Core Library (`@zwift-log-parser/core`)
248
+
249
+ Provides the `ZwiftLogParser` class and `pickFile()` utility:
250
+
251
+ - `parseMetadata(content)` — session and system info
252
+ - `parseRouteSessions(content)` — routes and world sessions with timing
253
+ - `parseFPSLines(content)` — raw FPS sample array
254
+ - `parseFpsPerWorld(content)` — FPS data grouped by world, with timestamps
255
+ - `calculateFpsStats(fps)` — average, min, max statistics
256
+ - `downsampleData(data, width)` — reduce data points for graph rendering
257
+
258
+ ### CLI Application
259
+
260
+ Built with React Ink — the terminal output is a rendered React component tree. Commander.js handles argument and option parsing before React renders.
261
+
262
+ ## Contributing
263
+
264
+ Contributions are welcome! Please feel free to submit issues or pull requests.
265
+
266
+ ## License
267
+
268
+ MIT
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Lightweight CLI shim that runs the compiled CLI output at dist/cli/main.js
4
+ // Keep this file minimal so it can be executed directly from the package 'bin' field
5
+ import('../dist/cli/main.js');