Skip to content

Commit bdd49e6

Browse files
authored
Merge pull request #1 from metaspartan/development
mactop v2.0.0
2 parents 7c6aa36 + 10d086d commit bdd49e6

29 files changed

+2138
-1951
lines changed

.cursorrules

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# AI Coding Rules for mactop
2+
3+
## General Principles
4+
- **Modern Go**: Use Go 1.21+ features where appropriate.
5+
- **DRY (Don't Repeat Yourself)**: Avoid code duplication. Extract common logic into helper functions or packages.
6+
- **Clean Code**: Write readable, maintainable, and self-documenting code. No comments.
7+
- **Error Handling**: proper error checks, wrap errors with context using `fmt.Errorf("%w", err)` or `errors.Join`.
8+
- **Concurrency**: Use `sync.Mutex` for shared state, `channels` for communication, and `context` for cancellation.
9+
10+
## Formatting & Style
11+
- Follow `gofmt` and `goimports` standards.
12+
- Use explicit variable names (avoid single letters unless for loop indices like `i`).
13+
- Group imports: standard library first, then 3rd party, then local.
14+
- Ensure `make sexy` passes.
15+
16+
## Testing
17+
- Write table-driven tests.
18+
- Ensure high test coverage for logic-heavy functions.
19+
- Use `t.Parallel()` where safe.
20+
21+
## Project Structure
22+
- `internal/`: Private application code.
23+
24+
## Specific to mactop
25+
- `app.go` should remain the coordinator but delegate work to specific domains (metrics, ui, parsing).
26+
- Ensure cross-compilation compatibility where possible (though heavily macOS focused to support all Apple Silicon devices).

.goreleaser.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ changelog:
3535

3636
brews:
3737
- name: "{{ .ProjectName }}"
38-
homepage: "https://github.com/context-labs/mactop"
38+
homepage: "https://github.com/metaspartan/mactop"
3939
description: "Apple Silicon Monitor Top written in Go Lang"
40-
url_template: "https://github.com/context-labs/mactop/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
41-
caveats: "mactop requires macOS 12+, and runs only on Apple Silicon."
40+
url_template: "https://github.com/metaspartan/mactop/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
41+
caveats: "mactop requires macOS 12+, and runs exclusively on Apple Silicon."
4242
install: |
4343
bin.install "{{ .ProjectName }}"
4444
repository:
45-
owner: "context-labs"
45+
owner: "metaspartan"
4646
name: "mactop"

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ run:
99
go run main.go
1010

1111
test:
12-
go test -v ./...
12+
go test -v ./internal/app/...
1313

1414
clean:
1515
rm -f $(APP_NAME)
16+
17+
sexy:
18+
go fmt ./...
19+
go vet ./...
20+
$$(go env GOPATH)/bin/gocyclo -over 15 .
21+
$$(go env GOPATH)/bin/ineffassign ./...

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# mactop
22

3-
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/context-labs/mactop/total) ![GitHub Release](https://img.shields.io/github/v/release/context-labs/mactop)
3+
[![Go Report Card](https://goreportcard.com/badge/github.com/metaspartan/mactop)](https://goreportcard.com/report/github.com/metaspartan/mactop/v2)
4+
[![GoDoc](https://godoc.org/github.com/metaspartan/mactop?status.svg)](https://godoc.org/github.com/metaspartan/mactop/v2)
5+
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/metaspartan/mactop/total) ![GitHub Release](https://img.shields.io/github/v/release/metaspartan/mactop)
46

57
`mactop` is a terminal-based monitoring tool "top" designed to display real-time metrics for Apple Silicon chips written by Carsen Klock. It provides a simple and efficient way to monitor CPU and GPU usage, E-Cores and P-Cores, power consumption, GPU frequency, temperatures, and other system metrics directly from your terminal
68

7-
![mactop](screenshotm.png)
9+
![mactop](mactop.gif)
810

911
## Compatibility
1012

@@ -24,9 +26,9 @@
2426
- Disk I/O activity (read/write speeds)
2527
- Multiple volume display (shows Mac HD + mounted external volumes)
2628
- Easy-to-read terminal UI
27-
- **7 Layouts**: Default, Alternative, Alternative Full, Vertical, Compact, Dashboard, and Gauges Only (`L` to cycle layouts)
29+
- **10 Layouts**: (`L` to cycle layouts)
2830
- **Persistent Settings**: Remembers your Layout and Theme choice across restarts
29-
- Customizable UI color (green, red, blue, cyan, magenta, yellow, and white) (`C` to cycle colors)
31+
- Customizable UI color (green, red, blue, skyblue, magenta, yellow, gold, silver, white, lime, orange, violet, and pink) (`C` to cycle colors)
3032
- Customizable update interval (default is 1000ms) (`-` or `=` to speed up, `+` to slow down)
3133
- Process list matching htop format (VIRT in GB, CPU normalized by core count)
3234
- **Process Management**: Kill processes directly from the UI (F9). List pauses while selecting.
@@ -39,7 +41,7 @@
3941

4042
## Install via Homebrew
4143

42-
You can install [mactop](https://github.com/context-labs/mactop) via Homebrew! https://brew.sh
44+
You can install [mactop](https://github.com/metaspartan/mactop) via Homebrew! https://brew.sh
4345

4446
```bash
4547
brew install mactop
@@ -67,7 +69,7 @@ To install `mactop`, follow these steps:
6769

6870
2. Clone the repository:
6971
```bash
70-
git clone https://github.com/context-labs/mactop.git
72+
git clone https://github.com/metaspartan/mactop.git
7173
cd mactop
7274
```
7375

@@ -99,7 +101,7 @@ mactop --interval 1000 --color green
99101
- `--count`: Number of samples to collect in headless mode (0 = infinite).
100102
- `--interval` or `-i`: Set the update interval in milliseconds. Default is 1000.
101103
- `--color` or `-c`: Set the UI color. Default is white.
102-
Options are 'green', 'red', 'blue', 'cyan', 'magenta', 'yellow', and 'white'. (-c green)
104+
Options are 'green', 'red', 'blue', 'skyblue', 'magenta', 'yellow', 'gold', 'silver', 'white', 'lime', 'orange', 'violet', and 'pink'. (-c green)
103105
- `--prometheus` or `-p`: Set and enable the local Prometheus metrics server on the given port. Default is disabled. (e.g. -p 2112 to enable Prometheus metrics on port 2112)
104106
- `--unit-network`: Network unit: auto, byte, kb, mb, gb (default: auto)
105107
- `--unit-disk`: Disk unit: auto, byte, kb, mb, gb (default: auto)
@@ -114,7 +116,7 @@ Use the following keys to interact with the application while its running:
114116
- `r`: Refresh the UI data manually.
115117
- `c`: Cycle through the color themes.
116118
- `p`: Party Mode (Randomly cycles through colors)
117-
- `l`: Cycle through the 7 available layouts.
119+
- `l`: Cycle through the 10 available layouts.
118120
- `+` or `=`: Increase update interval (slower updates).
119121
- `-`: Decrease update interval (faster updates).
120122
- `F9`: Kill the currently selected process (pauses updates while selecting).
@@ -252,15 +254,16 @@ Distributed under the MIT License. See `LICENSE` for more information.
252254

253255
Carsen Klock - [@carsenklock](https://x.com/carsenklock)
254256

255-
Project Link: [https://github.com/context-labs/mactop](https://github.com/context-labs/mactop)
257+
Project Link: [https://github.com/metaspartan/mactop](https://github.com/metaspartan/mactop)
256258

257259
## Disclaimer
258260

259261
This tool is not officially supported by Apple. It is provided as is, and may not work as expected. Use at your own risk.
260262

261263
## Acknowledgements
262264

263-
- [termui](https://github.com/gizak/termui) for the terminal UI framework.
265+
- [gotui](https://github.com/metaspartan/gotui) for the modern terminal UI framework.
266+
- [termui](https://github.com/gizak/termui) for the original terminal UI framework.
264267
- [gopsutil](https://github.com/shirou/gopsutil) for system memory, network, and disk monitoring.
265268
- [asitop](https://github.com/tlkh/asitop) for the original inspiration!
266269
- [htop](https://github.com/htop-dev/htop) for the process list and CPU cores inspiration!

go.mod

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
module github.com/context-labs/mactop/v2
1+
module github.com/metaspartan/mactop/v2
22

33
go 1.25.5
44

55
require (
6-
github.com/gizak/termui/v3 v3.1.0
7-
github.com/prometheus/client_golang v1.20.5
8-
github.com/shirou/gopsutil/v4 v4.25.10
9-
golang.org/x/term v0.37.0
6+
github.com/metaspartan/gotui/v4 v4.2.2
7+
github.com/prometheus/client_golang v1.23.2
8+
github.com/shirou/gopsutil/v4 v4.25.11
9+
golang.org/x/term v0.38.0
1010
)
1111

1212
require (
1313
github.com/beorn7/perks v1.0.1 // indirect
1414
github.com/cespare/xxhash/v2 v2.3.0 // indirect
15-
github.com/ebitengine/purego v0.9.0 // indirect
15+
github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
16+
github.com/ebitengine/purego v0.9.1 // indirect
1617
github.com/gdamore/encoding v1.0.1 // indirect
17-
github.com/gdamore/tcell/v2 v2.13.2 // indirect
18+
github.com/gdamore/tcell/v2 v2.13.4 // indirect
1819
github.com/go-ole/go-ole v1.2.6 // indirect
19-
github.com/klauspost/compress v1.17.9 // indirect
20+
github.com/kr/text v0.2.0 // indirect
2021
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
2122
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
22-
github.com/mattn/go-runewidth v0.0.4 // indirect
23-
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
23+
github.com/mattn/go-runewidth v0.0.19 // indirect
24+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
2425
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
25-
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d // indirect
2626
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
27-
github.com/prometheus/client_model v0.6.1 // indirect
28-
github.com/prometheus/common v0.55.0 // indirect
29-
github.com/prometheus/procfs v0.15.1 // indirect
27+
github.com/prometheus/client_model v0.6.2 // indirect
28+
github.com/prometheus/common v0.66.1 // indirect
29+
github.com/prometheus/procfs v0.16.1 // indirect
3030
github.com/rivo/uniseg v0.4.7 // indirect
31-
github.com/tklauser/go-sysconf v0.3.15 // indirect
32-
github.com/tklauser/numcpus v0.10.0 // indirect
31+
github.com/tklauser/go-sysconf v0.3.16 // indirect
32+
github.com/tklauser/numcpus v0.11.0 // indirect
3333
github.com/yusufpapurcu/wmi v1.2.4 // indirect
34-
golang.org/x/sys v0.38.0 // indirect
35-
golang.org/x/text v0.31.0 // indirect
36-
google.golang.org/protobuf v1.34.2 // indirect
34+
go.yaml.in/yaml/v2 v2.4.2 // indirect
35+
golang.org/x/image v0.34.0 // indirect
36+
golang.org/x/sys v0.39.0 // indirect
37+
golang.org/x/text v0.32.0 // indirect
38+
google.golang.org/protobuf v1.36.8 // indirect
3739
)
38-
39-
replace github.com/nsf/termbox-go => ./internal/termbox_shim

0 commit comments

Comments
 (0)