Skip to content

Commit d4a6038

Browse files
committed
feat: Initialize project with internal package structure, build system, CI/CD, and governance documents.
1 parent b979bb6 commit d4a6038

19 files changed

Lines changed: 1689 additions & 1295 deletions

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version: '1.22'
17+
- name: golangci-lint
18+
uses: golangci/golangci-lint-action@v6
19+
with:
20+
version: latest
21+
22+
test:
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, macos-latest]
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: '1.22'
34+
35+
- name: Build
36+
run: go build -v ./...
37+
38+
- name: Test
39+
run: go test -v ./...

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: '1.22'
21+
- name: Run GoReleaser
22+
uses: goreleaser/goreleaser-action@v6
23+
with:
24+
distribution: goreleaser
25+
version: latest
26+
args: release --clean
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.golangci.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
run:
2+
timeout: 5m
3+
tests: true
4+
5+
linters-settings:
6+
errcheck:
7+
check-type-assertions: true
8+
goconst:
9+
min-len: 2
10+
min-occurrences: 2
11+
gocritic:
12+
enabled-tags:
13+
- diagnostic
14+
- experimental
15+
- opinionated
16+
- performance
17+
- style
18+
govet:
19+
check-shadowing: true
20+
misspell:
21+
locale: US
22+
23+
linters:
24+
disable-all: true
25+
enable:
26+
- errcheck
27+
- gosimple
28+
- govet
29+
- ineffassign
30+
- staticcheck
31+
- typecheck
32+
- unused
33+
- goconst
34+
- gofmt
35+
- goimports
36+
- misspell
37+
- unconvert
38+
39+
issues:
40+
exclude-use-default: false
41+
exclude:
42+
# Exclude common false positives or annoyances
43+
- "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked"

CODE_OF_CONDUCT.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to a positive environment for our community include:
10+
11+
* Demonstrating empathy and kindness toward other people
12+
* Being respectful of differing opinions, viewpoints, and experiences
13+
* Giving and gracefully accepting constructive feedback
14+
* Accepting responsibility and apologizing to those affected by our mistakes
15+
* Focusing on what is best not just for us as individuals, but for the overall community
16+
17+
Examples of unacceptable behavior include:
18+
19+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
20+
* Trolling, insulting or derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or email address, without their explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Enforcement Responsibilities
26+
27+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
28+
29+
## Enforcement
30+
31+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement. All complaints will be reviewed and investigated promptly and fairly.
32+
33+
## Attribution
34+
35+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

CONTRIBUTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Contributing to Perfmon
2+
3+
Thank you for your interest in contributing to Perfmon! We welcome contributions from everyone.
4+
5+
## Getting Started
6+
7+
1. **Fork the repository** on GitHub.
8+
2. **Clone your fork** locally.
9+
3. **Create a branch** for your feature or bug fix.
10+
11+
```bash
12+
git checkout -b feature/my-new-feature
13+
```
14+
15+
## Development
16+
17+
Perfmon is written in Go. You will need Go 1.22 or later installed.
18+
19+
### Build and Run
20+
21+
We use a `Makefile` to simplify common tasks.
22+
23+
* **Run locally**:
24+
```bash
25+
make run
26+
```
27+
* **Build binary**:
28+
```bash
29+
make build
30+
```
31+
* **Run tests**:
32+
```bash
33+
make test
34+
```
35+
36+
### Code Style
37+
38+
Please ensure your code is formatted with `gofmt`. We also recommend running `go vet` before submitting.
39+
40+
## Submitting a Pull Request
41+
42+
1. Push your branch to your fork.
43+
2. Open a Pull Request against the `main` branch.
44+
3. Describe your changes and link to any relevant issues.
45+
4. Ensure the CI checks pass.
46+
47+
## License
48+
49+
By contributing, you agree that your contributions will be licensed under the project's [LICENSE](./LICENSE).

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY: build run test clean
2+
3+
build:
4+
go build -o perfmon .
5+
6+
run:
7+
go run .
8+
9+
test:
10+
go test ./...
11+
12+
clean:
13+
rm -f perfmon

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
# Perfmon
22
Perfmon is a TUI that shows essential performance monitoring commands in one place. It uses a tabbed approach for showing the results, making it quick to find stats in one place.
33

4+
5+
![Perfmon Screenshot](assets/screenshot.png)
6+
47
## Features
58
- Tabbed command output with keyboard navigation
69
- Summary strip with sparklines (load, CPU, memory, network)
710
- Disabled tab detection with install hints
811
- Configurable tabs via TOML
912
- Theme toggle (`t`)
1013

14+
15+
[![Go Reference](https://pkg.go.dev/badge/perfmon.svg)](https://pkg.go.dev/perfmon)
16+
[![Go Report Card](https://goreportcard.com/badge/github.com/sumant1122/Perfmon)](https://goreportcard.com/report/github.com/sumant1122/Perfmon)
17+
[![CI](https://github.com/sumant1122/Perfmon/actions/workflows/ci.yml/badge.svg)](https://github.com/sumant1122/Perfmon/actions/workflows/ci.yml)
18+
1119
## Usage
1220
```bash
1321
go run .
@@ -43,21 +51,12 @@ cmd = ["top", "-b", "-n", "1"]
4351
- Memory: `free -m` (Linux)
4452
- Net: `/proc/net/dev` (Linux) or `netstat -ib` (macOS)
4553

54+
If no configuration file is found, Perfmon falls back to a sensible set of defaults (uptime, vmstat, mpstat, iostat, free, sar, top, neofetch).
55+
4656
If a command is missing, the tab is disabled and a hint is shown.
4757

48-
## Config
49-
Perfmon can load a custom tab list from a TOML file. Search order:
50-
1. `PERFMON_CONFIG` env var (full path)
51-
2. `$XDG_CONFIG_HOME/perfmon/config.toml` (or `~/.config/perfmon/config.toml`)
52-
3. `./perfmon.toml`
5358

54-
Example `perfmon.toml`:
55-
```toml
56-
[[tab]]
57-
title = "uptime"
58-
cmd = ["uptime"]
59+
## Development
60+
61+
See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how to set up your development environment and contribute to the project.
5962

60-
[[tab]]
61-
title = "top"
62-
cmd = ["top", "-b", "-n", "1"]
63-
```

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
module prefmon
1+
module perfmon
22

33
go 1.22
44

55
require (
6+
github.com/BurntSushi/toml v1.6.0
67
github.com/charmbracelet/bubbles v0.20.0
78
github.com/charmbracelet/bubbletea v1.1.0
89
github.com/charmbracelet/lipgloss v0.13.0

go.sum

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
2+
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
3+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
4+
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
5+
github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE=
6+
github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU=
7+
github.com/charmbracelet/bubbletea v1.1.0 h1:FjAl9eAL3HBCHenhz/ZPjkKdScmaS5SK69JAK2YJK9c=
8+
github.com/charmbracelet/bubbletea v1.1.0/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4=
9+
github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw=
10+
github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY=
11+
github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY=
12+
github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
13+
github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0=
14+
github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0=
15+
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
16+
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
17+
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
18+
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
19+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
20+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
21+
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
22+
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
23+
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
24+
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
25+
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
26+
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
27+
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
28+
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
29+
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
30+
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
31+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
32+
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
33+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
34+
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
35+
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
36+
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
37+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
38+
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
39+
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
40+
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
41+
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=

0 commit comments

Comments
 (0)