surfmon 0.3.2__tar.gz
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.
- surfmon-0.3.2/LICENSE +21 -0
- surfmon-0.3.2/PKG-INFO +339 -0
- surfmon-0.3.2/README.md +305 -0
- surfmon-0.3.2/pyproject.toml +241 -0
- surfmon-0.3.2/src/surfmon/__init__.py +12 -0
- surfmon-0.3.2/src/surfmon/cli.py +998 -0
- surfmon-0.3.2/src/surfmon/compare.py +242 -0
- surfmon-0.3.2/src/surfmon/config.py +155 -0
- surfmon-0.3.2/src/surfmon/monitor.py +791 -0
- surfmon-0.3.2/src/surfmon/output.py +305 -0
surfmon-0.3.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ismar Iljazovic
|
|
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.
|
surfmon-0.3.2/PKG-INFO
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: surfmon
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Monitor Windsurf and Windsurf Next resource usage and diagnose problems
|
|
5
|
+
Keywords:
|
|
6
|
+
Author: Ismar Iljazovic
|
|
7
|
+
Author-email: Ismar Iljazovic <ismar@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Documentation
|
|
17
|
+
Classifier: Topic :: Software Development
|
|
18
|
+
Classifier: Topic :: Utilities
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Dist: typer>=0.21
|
|
21
|
+
Requires-Dist: psutil>=7.2
|
|
22
|
+
Requires-Dist: rich>=14.3
|
|
23
|
+
Requires-Dist: python-decouple>=3.8
|
|
24
|
+
Requires-Dist: matplotlib>=3.10
|
|
25
|
+
Requires-Python: >=3.14
|
|
26
|
+
Project-URL: Homepage, https://detailobsessed.github.io/surfmon
|
|
27
|
+
Project-URL: Documentation, https://detailobsessed.github.io/surfmon
|
|
28
|
+
Project-URL: Changelog, https://detailobsessed.github.io/surfmon/changelog
|
|
29
|
+
Project-URL: Repository, https://github.com/detailobsessed/surfmon
|
|
30
|
+
Project-URL: Issues, https://github.com/detailobsessed/surfmon/issues
|
|
31
|
+
Project-URL: Discussions, https://github.com/detailobsessed/surfmon/discussions
|
|
32
|
+
Project-URL: Funding, https://github.com/sponsors/ichoosetoaccept
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Surfmon
|
|
36
|
+
|
|
37
|
+
**Surf**ace **Mon**itor for Windsurf IDE - A comprehensive performance monitoring tool
|
|
38
|
+
|
|
39
|
+
A comprehensive monitoring tool for analyzing Windsurf IDE performance and resource usage.
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- 📊 **Real-time process monitoring** - Track all Windsurf processes, memory, and CPU usage
|
|
44
|
+
- 🔍 **Language server detection** - Identify and monitor language servers (Java, Python, Windsurf's own, etc.)
|
|
45
|
+
- 🔌 **MCP server tracking** - List enabled MCP servers from configuration
|
|
46
|
+
- 📝 **Log analysis** - Detect common issues like extension host crashes and network timeouts
|
|
47
|
+
- 📤 **Multiple output formats** - Console (with colors), JSON, and Markdown
|
|
48
|
+
- ⚠️ **Issue detection** - Automatically identify configuration problems and performance issues
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cd surfmon
|
|
54
|
+
uv sync
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
The tool provides a Typer-based CLI with multiple commands:
|
|
60
|
+
|
|
61
|
+
### Quick performance check
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Basic monitoring (console output)
|
|
65
|
+
uv run surfmon check
|
|
66
|
+
|
|
67
|
+
# Verbose mode (show all processes)
|
|
68
|
+
uv run surfmon check --verbose
|
|
69
|
+
|
|
70
|
+
# Save reports for later analysis
|
|
71
|
+
uv run surfmon check --json report.json --markdown report.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Continuous monitoring
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Watch mode - live updating dashboard
|
|
78
|
+
uv run surfmon watch
|
|
79
|
+
|
|
80
|
+
# Custom intervals
|
|
81
|
+
uv run surfmon watch -i 10 -s 600 # Check every 10s, save every 10min
|
|
82
|
+
|
|
83
|
+
# Run for specific number of checks
|
|
84
|
+
uv run surfmon watch -i 10 -n 720 # 720 checks at 10s intervals = 2 hours
|
|
85
|
+
|
|
86
|
+
# Custom output directory
|
|
87
|
+
uv run surfmon watch -o ~/my-windsurf-watch
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Compare reports
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Compare before/after reports
|
|
94
|
+
uv run surfmon compare before.json after.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Clean up orphaned processes
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Interactive cleanup (asks for confirmation)
|
|
101
|
+
uv run surfmon cleanup
|
|
102
|
+
|
|
103
|
+
# Force cleanup (no confirmation)
|
|
104
|
+
uv run surfmon cleanup --force
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Remove duplicate reports
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Dry run - see what would be deleted
|
|
111
|
+
uv run surfmon prune ../reports/watch --dry-run
|
|
112
|
+
|
|
113
|
+
# Actually delete duplicates (keeps latest by default)
|
|
114
|
+
uv run surfmon prune ../reports/watch
|
|
115
|
+
|
|
116
|
+
# Keep oldest instead of latest
|
|
117
|
+
uv run surfmon prune ../reports/watch --no-keep-latest
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Version info
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
uv run surfmon version
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## What it monitors
|
|
127
|
+
|
|
128
|
+
### System Resources
|
|
129
|
+
|
|
130
|
+
- Total and available memory
|
|
131
|
+
- Memory usage percentage
|
|
132
|
+
- Swap usage
|
|
133
|
+
- CPU cores
|
|
134
|
+
|
|
135
|
+
### Windsurf Specific
|
|
136
|
+
|
|
137
|
+
- **Process count** - Number of Windsurf-related processes
|
|
138
|
+
- **Total memory** - Combined memory usage across all processes
|
|
139
|
+
- **Total CPU** - Combined CPU usage
|
|
140
|
+
- **Top processes** - Ranked by memory usage
|
|
141
|
+
- **Language servers** - Dedicated tracking for LS processes
|
|
142
|
+
- **Extensions count** - Number of installed extensions
|
|
143
|
+
- **MCP servers** - Which MCP servers are enabled
|
|
144
|
+
|
|
145
|
+
### Issue Detection
|
|
146
|
+
|
|
147
|
+
- **Orphaned crash handlers** - Detects chrome_crashpad_handler processes that remain after Windsurf closes
|
|
148
|
+
- Extension host crashes/exits
|
|
149
|
+
- Update service timeouts (NextDNS blocking)
|
|
150
|
+
- Telemetry connection failures
|
|
151
|
+
- `logs` directory in extensions folder (causes package.json errors)
|
|
152
|
+
|
|
153
|
+
## Exit codes
|
|
154
|
+
|
|
155
|
+
- `0` - Success, no issues detected
|
|
156
|
+
- `1` - Issues detected (check console output)
|
|
157
|
+
- `130` - Interrupted by user (Ctrl+C)
|
|
158
|
+
|
|
159
|
+
## Use cases
|
|
160
|
+
|
|
161
|
+
### 1. Before/after comparison
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Before making changes
|
|
165
|
+
uv run surfmon check --json before.json
|
|
166
|
+
|
|
167
|
+
# Make your changes (disable extensions, update NextDNS, etc.)
|
|
168
|
+
|
|
169
|
+
# After making changes
|
|
170
|
+
uv run surfmon check --json after.json
|
|
171
|
+
|
|
172
|
+
# Compare the reports
|
|
173
|
+
uv run surfmon compare before.json after.json
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 2. Continuous monitoring with live display
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Watch mode - live updating table, saves reports every 5 minutes
|
|
180
|
+
uv run surfmon watch
|
|
181
|
+
|
|
182
|
+
# Custom intervals
|
|
183
|
+
uv run surfmon watch -i 10 -s 600 # Check every 10s, save every 10min
|
|
184
|
+
|
|
185
|
+
# Run for specific duration (e.g., 2 hours = 720 checks at 10s intervals)
|
|
186
|
+
uv run surfmon watch -i 10 -n 720
|
|
187
|
+
|
|
188
|
+
# Custom output directory
|
|
189
|
+
uv run surfmon watch -o ~/my-windsurf-watch
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
This provides a **live dashboard** that updates every few seconds showing:
|
|
193
|
+
|
|
194
|
+
- Process count changes (↑/↓)
|
|
195
|
+
- Memory usage changes with color coding
|
|
196
|
+
- CPU usage trends
|
|
197
|
+
- Language server count
|
|
198
|
+
- Issue detection
|
|
199
|
+
|
|
200
|
+
**Historical tracking:** Watch mode saves timestamped JSON reports (e.g., `20260204-131500.json`) for historical analysis. If nothing changes between intervals, duplicate reports accumulate. Use `prune` to remove them:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
uv run surfmon prune ../reports/watch --dry-run
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Perfect for:
|
|
207
|
+
|
|
208
|
+
- Monitoring during long work sessions
|
|
209
|
+
- Detecting memory leaks over time
|
|
210
|
+
- Seeing immediate impact of changes
|
|
211
|
+
- Historical analysis of resource usage patterns
|
|
212
|
+
|
|
213
|
+
### 3. Automated health check
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Run as a health check (non-zero exit on issues)
|
|
217
|
+
if ! uv run surfmon check; then
|
|
218
|
+
echo "Windsurf has issues!"
|
|
219
|
+
fi
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Common issues detected
|
|
223
|
+
|
|
224
|
+
| Issue | Cause | Fix |
|
|
225
|
+
| ----- | ----- | --- |
|
|
226
|
+
| Orphaned crash handlers | Windsurf bug - crash reporters not cleaned up on exit | `uv run surfmon cleanup --force` |
|
|
227
|
+
| `logs` directory error | Marimo extension creates logs in wrong place | `mv ~/.windsurf/extensions/logs ~/Library/Application\ Support/Windsurf/extension-logs/` |
|
|
228
|
+
| Update service timeouts | NextDNS blocking `windsurf-stable.codeium.com` | Whitelist `*.codeium.com` in NextDNS |
|
|
229
|
+
| Telemetry failures | NextDNS blocking `windsurf-telemetry.codeium.com` | Whitelist or disable telemetry |
|
|
230
|
+
| High memory usage | Too many language servers or extensions | Disable unused extensions |
|
|
231
|
+
| Multiple extension hosts | Extension crashes | Check logs for problematic extensions |
|
|
232
|
+
|
|
233
|
+
## Dependencies
|
|
234
|
+
|
|
235
|
+
- `psutil` - Cross-platform system and process utilities
|
|
236
|
+
- `rich` - Beautiful terminal output with tables and colors
|
|
237
|
+
- `typer` - CLI framework for future command expansion
|
|
238
|
+
- `pytest` + `pytest-cov` - Testing framework (dev)
|
|
239
|
+
|
|
240
|
+
## Requirements
|
|
241
|
+
|
|
242
|
+
- Python 3.14+ (managed by uv)
|
|
243
|
+
- macOS (currently, but easily portable to Linux/Windows)
|
|
244
|
+
- Windsurf IDE installed
|
|
245
|
+
|
|
246
|
+
## Development
|
|
247
|
+
|
|
248
|
+
### Package Structure
|
|
249
|
+
|
|
250
|
+
The tool is organized as a proper Python package:
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
surfmon/
|
|
254
|
+
├── src/windsurf_monitor/
|
|
255
|
+
│ ├── __init__.py
|
|
256
|
+
│ ├── cli.py # Typer CLI with subcommands
|
|
257
|
+
│ ├── monitor.py # Core monitoring logic
|
|
258
|
+
│ ├── output.py # Display and formatting utilities
|
|
259
|
+
│ └── compare.py # Report comparison utilities
|
|
260
|
+
├── tests/
|
|
261
|
+
│ └── test_monitor.py # Comprehensive test suite (19 tests, 91% coverage)
|
|
262
|
+
├── main.py # Legacy script (deprecated)
|
|
263
|
+
├── compare.py # Legacy script (deprecated)
|
|
264
|
+
├── watch.py # Legacy script (deprecated)
|
|
265
|
+
├── monitor.sh # Legacy script (deprecated)
|
|
266
|
+
└── pyproject.toml # Project config with console script entry point
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Key Components
|
|
270
|
+
|
|
271
|
+
**Core Module** (`src/windsurf_monitor/monitor.py`):
|
|
272
|
+
|
|
273
|
+
- `ProcessInfo` - Dataclass for process information
|
|
274
|
+
- `SystemInfo` - Dataclass for system resources
|
|
275
|
+
- `MonitoringReport` - Complete report structure
|
|
276
|
+
- `generate_report()` - Main data collection function
|
|
277
|
+
- `get_windsurf_processes()` - Process detection
|
|
278
|
+
- `find_language_servers()` - Language server identification
|
|
279
|
+
- `get_mcp_config()` - MCP server configuration parsing
|
|
280
|
+
- `check_log_issues()` - Log analysis for common issues
|
|
281
|
+
- `save_report_json()` - JSON export
|
|
282
|
+
|
|
283
|
+
**CLI Module** (`src/windsurf_monitor/cli.py`):
|
|
284
|
+
|
|
285
|
+
- `check` - Quick performance check command
|
|
286
|
+
- `watch` - Continuous monitoring with live dashboard
|
|
287
|
+
- `compare` - Report comparison command
|
|
288
|
+
- `version` - Version information
|
|
289
|
+
|
|
290
|
+
**Output Module** (`src/windsurf_monitor/output.py`):
|
|
291
|
+
|
|
292
|
+
- `display_report()` - Rich terminal output formatting
|
|
293
|
+
- `save_report_markdown()` - Markdown export
|
|
294
|
+
|
|
295
|
+
**Compare Module** (`src/windsurf_monitor/compare.py`):
|
|
296
|
+
|
|
297
|
+
- `compare_reports()` - Before/after analysis with colored diffs
|
|
298
|
+
- `format_diff()` - Colored change formatting
|
|
299
|
+
- `load_report()` - JSON report loading
|
|
300
|
+
|
|
301
|
+
### Running Tests
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Run all tests
|
|
305
|
+
uv run pytest tests/ -v
|
|
306
|
+
|
|
307
|
+
# Run with coverage
|
|
308
|
+
uv run pytest tests/ --cov=windsurf_monitor --cov-report=term-missing
|
|
309
|
+
|
|
310
|
+
# Run specific test class
|
|
311
|
+
uv run pytest tests/test_monitor.py::TestGetWindsurfProcesses -v
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Test Coverage**: 19 tests covering 91% of code
|
|
315
|
+
|
|
316
|
+
- Process detection and error handling
|
|
317
|
+
- System info gathering
|
|
318
|
+
- Language server identification
|
|
319
|
+
- MCP config parsing
|
|
320
|
+
- Extension counting
|
|
321
|
+
- Log issue detection
|
|
322
|
+
- Full report generation
|
|
323
|
+
|
|
324
|
+
## Future Enhancements
|
|
325
|
+
|
|
326
|
+
### Planned
|
|
327
|
+
|
|
328
|
+
- [ ] Historical trend analysis (compare multiple JSON reports)
|
|
329
|
+
- [ ] Alerts when thresholds exceeded
|
|
330
|
+
- [ ] Extension-specific resource tracking
|
|
331
|
+
- [ ] Network connection monitoring
|
|
332
|
+
- [ ] Automatic issue remediation suggestions
|
|
333
|
+
- [ ] Web dashboard for reports
|
|
334
|
+
- [ ] Cross-platform support (Linux, Windows)
|
|
335
|
+
- [ ] Add tests for CLI, output, and compare modules
|
|
336
|
+
|
|
337
|
+
### Architecture Notes
|
|
338
|
+
|
|
339
|
+
The package uses a modern Typer-based CLI with proper testing infrastructure. Core logic is cleanly separated in the `src/windsurf_monitor` package, making it easy to add new commands or integrate the monitoring functionality into other tools.
|
surfmon-0.3.2/README.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Surfmon
|
|
2
|
+
|
|
3
|
+
**Surf**ace **Mon**itor for Windsurf IDE - A comprehensive performance monitoring tool
|
|
4
|
+
|
|
5
|
+
A comprehensive monitoring tool for analyzing Windsurf IDE performance and resource usage.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 📊 **Real-time process monitoring** - Track all Windsurf processes, memory, and CPU usage
|
|
10
|
+
- 🔍 **Language server detection** - Identify and monitor language servers (Java, Python, Windsurf's own, etc.)
|
|
11
|
+
- 🔌 **MCP server tracking** - List enabled MCP servers from configuration
|
|
12
|
+
- 📝 **Log analysis** - Detect common issues like extension host crashes and network timeouts
|
|
13
|
+
- 📤 **Multiple output formats** - Console (with colors), JSON, and Markdown
|
|
14
|
+
- ⚠️ **Issue detection** - Automatically identify configuration problems and performance issues
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cd surfmon
|
|
20
|
+
uv sync
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
The tool provides a Typer-based CLI with multiple commands:
|
|
26
|
+
|
|
27
|
+
### Quick performance check
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Basic monitoring (console output)
|
|
31
|
+
uv run surfmon check
|
|
32
|
+
|
|
33
|
+
# Verbose mode (show all processes)
|
|
34
|
+
uv run surfmon check --verbose
|
|
35
|
+
|
|
36
|
+
# Save reports for later analysis
|
|
37
|
+
uv run surfmon check --json report.json --markdown report.md
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Continuous monitoring
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Watch mode - live updating dashboard
|
|
44
|
+
uv run surfmon watch
|
|
45
|
+
|
|
46
|
+
# Custom intervals
|
|
47
|
+
uv run surfmon watch -i 10 -s 600 # Check every 10s, save every 10min
|
|
48
|
+
|
|
49
|
+
# Run for specific number of checks
|
|
50
|
+
uv run surfmon watch -i 10 -n 720 # 720 checks at 10s intervals = 2 hours
|
|
51
|
+
|
|
52
|
+
# Custom output directory
|
|
53
|
+
uv run surfmon watch -o ~/my-windsurf-watch
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Compare reports
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Compare before/after reports
|
|
60
|
+
uv run surfmon compare before.json after.json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Clean up orphaned processes
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Interactive cleanup (asks for confirmation)
|
|
67
|
+
uv run surfmon cleanup
|
|
68
|
+
|
|
69
|
+
# Force cleanup (no confirmation)
|
|
70
|
+
uv run surfmon cleanup --force
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Remove duplicate reports
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Dry run - see what would be deleted
|
|
77
|
+
uv run surfmon prune ../reports/watch --dry-run
|
|
78
|
+
|
|
79
|
+
# Actually delete duplicates (keeps latest by default)
|
|
80
|
+
uv run surfmon prune ../reports/watch
|
|
81
|
+
|
|
82
|
+
# Keep oldest instead of latest
|
|
83
|
+
uv run surfmon prune ../reports/watch --no-keep-latest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Version info
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
uv run surfmon version
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## What it monitors
|
|
93
|
+
|
|
94
|
+
### System Resources
|
|
95
|
+
|
|
96
|
+
- Total and available memory
|
|
97
|
+
- Memory usage percentage
|
|
98
|
+
- Swap usage
|
|
99
|
+
- CPU cores
|
|
100
|
+
|
|
101
|
+
### Windsurf Specific
|
|
102
|
+
|
|
103
|
+
- **Process count** - Number of Windsurf-related processes
|
|
104
|
+
- **Total memory** - Combined memory usage across all processes
|
|
105
|
+
- **Total CPU** - Combined CPU usage
|
|
106
|
+
- **Top processes** - Ranked by memory usage
|
|
107
|
+
- **Language servers** - Dedicated tracking for LS processes
|
|
108
|
+
- **Extensions count** - Number of installed extensions
|
|
109
|
+
- **MCP servers** - Which MCP servers are enabled
|
|
110
|
+
|
|
111
|
+
### Issue Detection
|
|
112
|
+
|
|
113
|
+
- **Orphaned crash handlers** - Detects chrome_crashpad_handler processes that remain after Windsurf closes
|
|
114
|
+
- Extension host crashes/exits
|
|
115
|
+
- Update service timeouts (NextDNS blocking)
|
|
116
|
+
- Telemetry connection failures
|
|
117
|
+
- `logs` directory in extensions folder (causes package.json errors)
|
|
118
|
+
|
|
119
|
+
## Exit codes
|
|
120
|
+
|
|
121
|
+
- `0` - Success, no issues detected
|
|
122
|
+
- `1` - Issues detected (check console output)
|
|
123
|
+
- `130` - Interrupted by user (Ctrl+C)
|
|
124
|
+
|
|
125
|
+
## Use cases
|
|
126
|
+
|
|
127
|
+
### 1. Before/after comparison
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Before making changes
|
|
131
|
+
uv run surfmon check --json before.json
|
|
132
|
+
|
|
133
|
+
# Make your changes (disable extensions, update NextDNS, etc.)
|
|
134
|
+
|
|
135
|
+
# After making changes
|
|
136
|
+
uv run surfmon check --json after.json
|
|
137
|
+
|
|
138
|
+
# Compare the reports
|
|
139
|
+
uv run surfmon compare before.json after.json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2. Continuous monitoring with live display
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Watch mode - live updating table, saves reports every 5 minutes
|
|
146
|
+
uv run surfmon watch
|
|
147
|
+
|
|
148
|
+
# Custom intervals
|
|
149
|
+
uv run surfmon watch -i 10 -s 600 # Check every 10s, save every 10min
|
|
150
|
+
|
|
151
|
+
# Run for specific duration (e.g., 2 hours = 720 checks at 10s intervals)
|
|
152
|
+
uv run surfmon watch -i 10 -n 720
|
|
153
|
+
|
|
154
|
+
# Custom output directory
|
|
155
|
+
uv run surfmon watch -o ~/my-windsurf-watch
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This provides a **live dashboard** that updates every few seconds showing:
|
|
159
|
+
|
|
160
|
+
- Process count changes (↑/↓)
|
|
161
|
+
- Memory usage changes with color coding
|
|
162
|
+
- CPU usage trends
|
|
163
|
+
- Language server count
|
|
164
|
+
- Issue detection
|
|
165
|
+
|
|
166
|
+
**Historical tracking:** Watch mode saves timestamped JSON reports (e.g., `20260204-131500.json`) for historical analysis. If nothing changes between intervals, duplicate reports accumulate. Use `prune` to remove them:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
uv run surfmon prune ../reports/watch --dry-run
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Perfect for:
|
|
173
|
+
|
|
174
|
+
- Monitoring during long work sessions
|
|
175
|
+
- Detecting memory leaks over time
|
|
176
|
+
- Seeing immediate impact of changes
|
|
177
|
+
- Historical analysis of resource usage patterns
|
|
178
|
+
|
|
179
|
+
### 3. Automated health check
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Run as a health check (non-zero exit on issues)
|
|
183
|
+
if ! uv run surfmon check; then
|
|
184
|
+
echo "Windsurf has issues!"
|
|
185
|
+
fi
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Common issues detected
|
|
189
|
+
|
|
190
|
+
| Issue | Cause | Fix |
|
|
191
|
+
| ----- | ----- | --- |
|
|
192
|
+
| Orphaned crash handlers | Windsurf bug - crash reporters not cleaned up on exit | `uv run surfmon cleanup --force` |
|
|
193
|
+
| `logs` directory error | Marimo extension creates logs in wrong place | `mv ~/.windsurf/extensions/logs ~/Library/Application\ Support/Windsurf/extension-logs/` |
|
|
194
|
+
| Update service timeouts | NextDNS blocking `windsurf-stable.codeium.com` | Whitelist `*.codeium.com` in NextDNS |
|
|
195
|
+
| Telemetry failures | NextDNS blocking `windsurf-telemetry.codeium.com` | Whitelist or disable telemetry |
|
|
196
|
+
| High memory usage | Too many language servers or extensions | Disable unused extensions |
|
|
197
|
+
| Multiple extension hosts | Extension crashes | Check logs for problematic extensions |
|
|
198
|
+
|
|
199
|
+
## Dependencies
|
|
200
|
+
|
|
201
|
+
- `psutil` - Cross-platform system and process utilities
|
|
202
|
+
- `rich` - Beautiful terminal output with tables and colors
|
|
203
|
+
- `typer` - CLI framework for future command expansion
|
|
204
|
+
- `pytest` + `pytest-cov` - Testing framework (dev)
|
|
205
|
+
|
|
206
|
+
## Requirements
|
|
207
|
+
|
|
208
|
+
- Python 3.14+ (managed by uv)
|
|
209
|
+
- macOS (currently, but easily portable to Linux/Windows)
|
|
210
|
+
- Windsurf IDE installed
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
### Package Structure
|
|
215
|
+
|
|
216
|
+
The tool is organized as a proper Python package:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
surfmon/
|
|
220
|
+
├── src/windsurf_monitor/
|
|
221
|
+
│ ├── __init__.py
|
|
222
|
+
│ ├── cli.py # Typer CLI with subcommands
|
|
223
|
+
│ ├── monitor.py # Core monitoring logic
|
|
224
|
+
│ ├── output.py # Display and formatting utilities
|
|
225
|
+
│ └── compare.py # Report comparison utilities
|
|
226
|
+
├── tests/
|
|
227
|
+
│ └── test_monitor.py # Comprehensive test suite (19 tests, 91% coverage)
|
|
228
|
+
├── main.py # Legacy script (deprecated)
|
|
229
|
+
├── compare.py # Legacy script (deprecated)
|
|
230
|
+
├── watch.py # Legacy script (deprecated)
|
|
231
|
+
├── monitor.sh # Legacy script (deprecated)
|
|
232
|
+
└── pyproject.toml # Project config with console script entry point
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Key Components
|
|
236
|
+
|
|
237
|
+
**Core Module** (`src/windsurf_monitor/monitor.py`):
|
|
238
|
+
|
|
239
|
+
- `ProcessInfo` - Dataclass for process information
|
|
240
|
+
- `SystemInfo` - Dataclass for system resources
|
|
241
|
+
- `MonitoringReport` - Complete report structure
|
|
242
|
+
- `generate_report()` - Main data collection function
|
|
243
|
+
- `get_windsurf_processes()` - Process detection
|
|
244
|
+
- `find_language_servers()` - Language server identification
|
|
245
|
+
- `get_mcp_config()` - MCP server configuration parsing
|
|
246
|
+
- `check_log_issues()` - Log analysis for common issues
|
|
247
|
+
- `save_report_json()` - JSON export
|
|
248
|
+
|
|
249
|
+
**CLI Module** (`src/windsurf_monitor/cli.py`):
|
|
250
|
+
|
|
251
|
+
- `check` - Quick performance check command
|
|
252
|
+
- `watch` - Continuous monitoring with live dashboard
|
|
253
|
+
- `compare` - Report comparison command
|
|
254
|
+
- `version` - Version information
|
|
255
|
+
|
|
256
|
+
**Output Module** (`src/windsurf_monitor/output.py`):
|
|
257
|
+
|
|
258
|
+
- `display_report()` - Rich terminal output formatting
|
|
259
|
+
- `save_report_markdown()` - Markdown export
|
|
260
|
+
|
|
261
|
+
**Compare Module** (`src/windsurf_monitor/compare.py`):
|
|
262
|
+
|
|
263
|
+
- `compare_reports()` - Before/after analysis with colored diffs
|
|
264
|
+
- `format_diff()` - Colored change formatting
|
|
265
|
+
- `load_report()` - JSON report loading
|
|
266
|
+
|
|
267
|
+
### Running Tests
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Run all tests
|
|
271
|
+
uv run pytest tests/ -v
|
|
272
|
+
|
|
273
|
+
# Run with coverage
|
|
274
|
+
uv run pytest tests/ --cov=windsurf_monitor --cov-report=term-missing
|
|
275
|
+
|
|
276
|
+
# Run specific test class
|
|
277
|
+
uv run pytest tests/test_monitor.py::TestGetWindsurfProcesses -v
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**Test Coverage**: 19 tests covering 91% of code
|
|
281
|
+
|
|
282
|
+
- Process detection and error handling
|
|
283
|
+
- System info gathering
|
|
284
|
+
- Language server identification
|
|
285
|
+
- MCP config parsing
|
|
286
|
+
- Extension counting
|
|
287
|
+
- Log issue detection
|
|
288
|
+
- Full report generation
|
|
289
|
+
|
|
290
|
+
## Future Enhancements
|
|
291
|
+
|
|
292
|
+
### Planned
|
|
293
|
+
|
|
294
|
+
- [ ] Historical trend analysis (compare multiple JSON reports)
|
|
295
|
+
- [ ] Alerts when thresholds exceeded
|
|
296
|
+
- [ ] Extension-specific resource tracking
|
|
297
|
+
- [ ] Network connection monitoring
|
|
298
|
+
- [ ] Automatic issue remediation suggestions
|
|
299
|
+
- [ ] Web dashboard for reports
|
|
300
|
+
- [ ] Cross-platform support (Linux, Windows)
|
|
301
|
+
- [ ] Add tests for CLI, output, and compare modules
|
|
302
|
+
|
|
303
|
+
### Architecture Notes
|
|
304
|
+
|
|
305
|
+
The package uses a modern Typer-based CLI with proper testing infrastructure. Core logic is cleanly separated in the `src/windsurf_monitor` package, making it easy to add new commands or integrate the monitoring functionality into other tools.
|