Use gopsutil for cross-platform process detection

Replace pgrep with gopsutil/v4 for pure Go process detection.
Now fully cross-platform (Linux, FreeBSD, macOS, Windows) with
zero external exec calls. Add Taskfile and test fixture.
This commit is contained in:
2025-12-18 05:41:19 +01:00
parent f1ca1ccaa0
commit 1cca87af90
6 changed files with 172 additions and 5 deletions

36
test/fixture.json Normal file
View File

@ -0,0 +1,36 @@
{
"hook_event_name": "Status",
"session_id": "abc123def456",
"transcript_path": "/tmp/transcript.json",
"cwd": "/root/projects/statusline",
"model": {
"id": "claude-opus-4-5-20251101",
"display_name": "Opus 4.5"
},
"workspace": {
"current_dir": "/root/projects/statusline",
"project_dir": "/root/projects/statusline"
},
"version": "1.0.80",
"output_style": {
"name": "default"
},
"cost": {
"total_cost_usd": 0.01234,
"total_duration_ms": 45000,
"total_api_duration_ms": 2300,
"total_lines_added": 156,
"total_lines_removed": 23
},
"context_window": {
"total_input_tokens": 15234,
"total_output_tokens": 4521,
"context_window_size": 200000,
"current_usage": {
"input_tokens": 8500,
"output_tokens": 1200,
"cache_creation_input_tokens": 5000,
"cache_read_input_tokens": 2000
}
}
}