1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 19:44:44 +00:00
Commit Graph

73 Commits

Author SHA1 Message Date
tw93
87f605e9a8 test: add tests for cmd/status and conclude merge 2026-01-30 10:59:09 +08:00
Dylan Joss
b8e15b1c16 test: add tests for parsing and filtering functions (#385)
Add unit tests for parsing functions in `cmd/status/view_test.go`:
- `parseInt`: parses integers from strings with padding/decimals
- `parseRefreshRate`: parses display refresh rates from system output
- `isNoiseInterface`: filters noise network interfaces
- `parsePMSet`: parses macOS pmset battery output

Coverage for `cmd/status` improved from 8.4% to 12.6%.
2026-01-29 11:40:00 +08:00
tw93
64f79a59d8 feat: optimize log system and add mo log command
- Add get_timestamp() helper and optimize log rotation
- Create mo log viewer with search/filter capabilities
- Improve test coverage to 18.4% with better assertions
- Add security fixes for grep injection prevention
2026-01-28 19:46:01 +08:00
Dylan Joss
f815a5f28c test: add tests for byte formatters and disk helpers (#382)
Add unit tests for additional utility functions in `cmd/status/view_test.go`:
- `humanBytes`: byte formatting with decimals and units
- `humanBytesCompact`: compact byte formatting
- `splitDisks`: separates internal/external disks
- `diskLabel`: generates numbered disk labels

Coverage for cmd/status improved from 6.9% to 8.4%.
2026-01-28 19:12:04 +08:00
Dylan Joss
a9c5794ec4 test: add tests for utility functions and heap implementations (#380)
Add unit tests for utility functions in cmd/status/view_test.go:
- formatRate: MB/s rate formatting with adaptive precision
- shorten: string truncation with ellipsis
- humanBytesShort: byte formatting with binary units

Add unit tests for heap implementations in cmd/analyze/heap_test.go:
- entryHeap: min-heap for dirEntry (basic ops, empty, single element)
- largeFileHeap: min-heap for fileEntry (basic ops, top N pattern)
2026-01-28 11:25:08 +08:00
tw93
e966838c82 style: standardize punctuation across codebase
- Replace parentheses with commas for supplementary info
- Use commas instead of em-dashes for separators
- Update bullet points from - to * in some contexts
- Improve version extraction regex with fallback logic
2026-01-26 14:36:06 +08:00
Tw93
6be7f7d0f8 Merge branch 'pr-348' 2026-01-22 17:22:48 +08:00
Dylan Joss
217eb986e2 test: add formatUnusedTime tests and fix duplicate comment
Add unit tests for formatUnusedTime in cmd/analyze/format_test.go:
- Zero time (time.Time{}) returns empty string
- Recent files (< 90 days) return empty string
- Boundary tests at 89/90 days threshold
- Month formatting (3mo, 4mo, 6mo, 11mo, 12mo)
- Year formatting (1yr, 2yr, 3yr)
- Boundary tests at year transitions

Also remove duplicate "Memory pressure penalty" comment in
cmd/status/metrics_health.go (line 72-73).
2026-01-21 22:42:13 -08:00
Tw93
74c9b51cc9 Merge pull request #344 from dwjoss/dwjoss/add-ring-buffer-tests
test: add unit tests for RingBuffer in cmd/status
2026-01-22 11:10:30 +08:00
Dylan Joss
3c761865f8 Uses slices for equality comparison 2026-01-21 11:46:50 -08:00
Dylan Joss
046843a012 Add more tests 2026-01-21 11:29:37 -08:00
Dylan Joss
3148971506 test: add unit tests for RingBuffer in cmd/status
Add comprehensive test coverage for the RingBuffer circular buffer
data structure used in network history tracking.

Test cases:
- Constructor initialization (NewRingBuffer)
- Empty buffer returns nil slice
- Adding elements within capacity
- Exact capacity boundary
- Wrap-around behavior with chronological ordering
- Multiple wrap-arounds stress test
- Single-element buffer edge case
- Slice returns independent copy (not reference)
2026-01-21 00:15:35 -08:00
Tw93
7a5bdac385 feat: add uptime display to status header (#329)
Show system uptime in the header row with a concise format (e.g., "up 1d 5h").
Simplify title from "Mole Status" to "Status" for better fit.
2026-01-18 16:52:44 +08:00
Tw93
72f42a363e chore: remove redundant sensors card and bump version to 1.22.1
- Disable sensors data collection (CPU temp already shown in CPU card)
- Remove unused sensor-related functions (collectSensors, prettifyLabel, hasSensorData, renderSensorsCard)
- Remove unused gopsutil/sensors import
- Fix inline spinner disown call with explicit PID
- Update version from 1.22.0 to 1.22.1
- Update SECURITY_AUDIT.md to match new version and date
2026-01-17 10:46:11 +08:00
Tw93
a8a9b2f4f6 Merge branch 'main' into dev 2026-01-17 08:22:02 +08:00
Oleksandr Redko
9b16601117 chore: format code; fix lint issues 2026-01-16 17:39:05 +02:00
Oleksandr Redko
a589b9f2e1 chore(deps): bump shirou/gopsutil from v3 to v4 2026-01-16 17:23:00 +02:00
Tw93
d8217235bd chore: clean up dev comments and remove AI-style formatting from README 2026-01-16 15:26:15 +08:00
Tw93
8cc39585ea feat: improve network status graph with sparklines and responsive width 2026-01-16 14:50:10 +08:00
Andrei Murariu
205f3adbd2 imp: mo status network graph 2026-01-15 14:53:34 +02:00
Tw93
00a712711e chore: auto format code 2026-01-14 03:59:21 +00:00
Tw93
facaf5b34c fix: precision issue in battery metrics and adaptive purge UI
- cmd/status: use ParseUint to handle negative battery power values correctly
- bin/purge: make path truncation adaptive to terminal width
2026-01-14 11:57:10 +08:00
Tw93
9b3220bfe4 fix: handle uint64 overflow in battery power metrics
- Fix display of invalid large values like 18446744073709544W
- macOS ioreg returns negative values as uint64 (two's complement)
- Detect overflow pattern (value > 2^63) and convert to signed
- Validate reasonable power range (-200W to 200W) for battery
- Add range validation for SystemPower (0 to 1000W)

Root cause: During charging, battery power is negative but ioreg
formats it as unsigned uint64, causing overflow. This fix properly
converts these values back to signed integers.
2026-01-14 11:26:37 +08:00
Tw93
5afd602027 refactor: optimize CPU temp feature with tests and performance fix
- Restore performance test threshold to 200ms (from 500ms)
  User caching is highly effective (~8ms for 100 calls)
- Add unit tests for colorizeTemp() covering thresholds and edge cases
2026-01-14 10:31:01 +08:00
Copper-Eye
fae1c88fa2 add cpu temp display and optimize user check 2026-01-13 17:21:03 -04:00
Tw93
180037c22b feat(status): persist cat visibility preference
- Add loadCatHidden/saveCatHidden functions
- Save preference to ~/.config/mole/status_prefs
- Load preference on startup
2026-01-08 15:58:50 +08:00
Tw93
79a19ffbfe Go code formatting optimization 2026-01-08 15:26:35 +08:00
Tw93
64a580b3a7 feat: cat hide toggle and critical fixes (#272)
- Add 'k' key to hide/show cat in mo status
- Hand-crafted mirror frames for better left-walking animation
- Fix extra blank lines bug (strings.Lines → strings.Split)
- Fix battery power overflow (ParseInt for negative values)
- Optimize README Tips section (8 → 5 items)
2026-01-08 11:27:47 +08:00
Tw93
0d15177735 refactor: remove trimName and renderGPUCard functions 2026-01-06 21:07:51 +08:00
Tw93
c2c589ac81 Merge pull request #264 from alexandear-org/refactor/do-not-use-deprecated-funcs
refactor: replace deprecated `Start` with `Run`
2026-01-06 21:05:10 +08:00
Tw93
f69f53a607 refactor: complete Go modernization with strings.Lines() 2026-01-06 21:03:46 +08:00
Oleksandr Redko
158af1e1ba refactor: modernize Go code 2026-01-06 12:04:27 +02:00
Oleksandr Redko
80757ec074 refactor: replace deprecated Start with Run 2026-01-06 11:46:59 +02:00
Tw93
8cb1bc6fbe Merge pull request #236 from jimmystridh/fix/preserve-sort-state-after-uninstall
fix(ui): preserve sort state after uninstall
2026-01-03 13:57:28 +08:00
Tw93
da7bb2cde2 feat: add screen refresh rate display in status view 2026-01-03 13:33:49 +08:00
Tw93
87963f9e68 chore: auto format code 2026-01-02 11:59:49 +00:00
Tw93
57024f6417 Merge branch 'main' of github.com:tw93/Mole 2026-01-02 19:59:13 +08:00
Tw93
cc0cbef8d9 feat: display macOS battery capacity and cached memory, and refine status view presentation 2026-01-02 19:59:07 +08:00
Tw93
ecbe43fa35 chore: auto format code 2026-01-02 11:27:06 +00:00
Tw93
6c8c87bef6 refactor: remove Christmas seasonal feature 2026-01-02 19:26:22 +08:00
Tw93
9aa569cbb6 feat: Enhance clean, optimize, analyze, and status commands, and update security audit documentation. 2025-12-31 16:23:31 +08:00
Tw93
fe3f99e520 chore: auto format code 2025-12-22 11:31:14 +00:00
Tw93
f410f356df feat: Display system, adapter, and battery power metrics in status view 2025-12-22 19:30:35 +08:00
Tw93
87fdd26272 feat: Add git hooks to enforce universal binary builds and improve CPU metric calculation. 2025-12-22 16:30:22 +08:00
Tw93
ab0e7da434 chore: auto format code 2025-12-19 12:38:14 +00:00
Tw93
be43f68cc1 feat: enhance status UI with new styles and icons, refactor battery metrics with caching, and centralize Apple Silicon clean logic. 2025-12-19 20:34:23 +08:00
Tw93
5456d60876 chore: auto format code 2025-12-12 06:12:13 +00:00
Tw93
42634fbf3d Parallelize metric collection, enhance Touch ID script reliability with improved cleanup and backup, and add debug logging tests. 2025-12-12 14:11:37 +08:00
Tw93
558ee86d1f chore: auto format code 2025-12-12 02:50:46 +00:00
Tw93
f858d43b88 There is no blank line at the end of status 2025-12-12 10:49:57 +08:00