feat: add service widget and clean up repo#2
Conversation
…p repo Add a "service" widget that displays the repository name (e.g. "vitals") in the statusline, with default layout reordered to service | worktree | branch. Replace Justfile with a slim Makefile, remove version semantics (VERSION files, version package, version/update subcommands), remove demo.gif, docs/ directory, and fix gopls diagnostics (WaitGroup.Go, unused params, range-over-int). Add GitHub Actions CI workflow and pre-commit config for go fmt/vet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests were failing in CI (and on any non-kyle machine) because they hardcoded a specific home directory path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new service widget (repo basename) to the default HUD layout while simplifying repo maintenance by removing embedded versioning/docs artifacts and introducing Make/CI tooling.
Changes:
- Add
servicewidget, wire it through gather/context/default layout, and adjustprojectbehavior accordingly. - Remove embedded version plumbing (
VERSIONfiles + internal/version + CLI version semantics) and delete duplicated docs/demo assets. - Add a Makefile, pre-commit config, and GitHub Actions CI (vet/test/race); fix assorted Go diagnostics/formatting.
Reviewed changes
Copilot reviewed 31 out of 35 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
internal/version/version.go |
Removes embedded VERSION-based version package. |
internal/version/VERSION |
Deletes internal embedded VERSION file. |
VERSION |
Deletes repo-level VERSION file. |
cmd/vitals/main.go |
Removes version command + simplifies update; fixes range-over-int diagnostic. |
internal/model/model.go |
Adds ServiceName to render context. |
internal/gather/gather.go |
Derives ServiceName; switches goroutine spawning to WaitGroup.Go; simplifies sessionStart. |
internal/gather/gather_bench_test.go |
Minor formatting adjustment in benchmark fixture. |
internal/render/widget/service.go |
New widget rendering repo/service name. |
internal/render/widget/project.go |
Suppresses directory portion when service widget is active. |
internal/render/widget/widget.go |
Registers service widget and reformats registry. |
internal/render/widget/widget_test.go |
Updates registry completeness test to include service. |
internal/config/config.go |
Updates default widget layout to include service. |
internal/config/config_test.go |
Updates default-layout tests to include service. |
internal/render/widget/usage.go |
Removes unused helper. |
internal/render/widget/tools.go |
Minor formatting adjustment. |
internal/render/widget/agents.go |
Import ordering tweak. |
internal/render/widget/agents_test.go |
Import ordering tweak. |
internal/render/render.go |
Removes unused params in renderMinimal signature. |
internal/render/render_test.go |
Import ordering tweak. |
internal/render/powerline_test.go |
Import ordering tweak. |
internal/stdin/mock_test.go |
Removes trailing whitespace line. |
internal/theme/theme.go |
Formatting-only changes to theme maps. |
README.md |
Removes demo image; adds development quickstart snippet. |
CLAUDE.md |
Updates task runner instructions from just to make; updates widget list. |
Makefile |
Adds Make targets replacing Justfile tasks. |
Justfile |
Removes Just-based task runner and version release helpers. |
.pre-commit-config.yaml |
Adds Go fmt/vet hooks via pre-commit. |
.github/workflows/ci.yml |
Adds CI job running vet/test/race on Go 1.25. |
docs/widgets.md |
Removes docs directory content (widgets doc). |
docs/development.md |
Removes docs directory content (development doc). |
docs/configuration.md |
Removes docs directory content (configuration doc). |
docs/cli.md |
Removes docs directory content (CLI doc). |
docs/architecture.md |
Removes docs directory content (architecture doc). |
demo.gif |
Removes large demo asset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if input.Worktree != nil && input.Worktree.OriginalCwd != "" { | ||
| cwd = input.Worktree.OriginalCwd | ||
| } | ||
| ctx.ServiceName = filepath.Base(cwd) |
There was a problem hiding this comment.
ServiceName is derived here, but there’s no accompanying gather-stage test coverage to ensure it’s populated correctly (including the worktree OriginalCwd case) and only when the widget is active. Adding a focused test in internal/gather would prevent regressions in the default layout behavior.
| ctx.ServiceName = filepath.Base(cwd) | |
| if cwd != "" { | |
| ctx.ServiceName = filepath.Base(cwd) | |
| } |
| run: go test ./... -count=1 | ||
|
|
||
| - name: Test (race) | ||
| run: go test -race ./... -count=1 |
There was a problem hiding this comment.
The workflow runs go test ./... (and -race) but the current test suite includes at least one environment-dependent test that will fail on GitHub runners (e.g. internal/gather/gather_test.go uses /Users/kyle/Code/my-projects/vitals and expects it to be a real git repo). This will cause CI to fail for every PR until those tests are rewritten to use a temp git repo fixture (or skipped/guarded appropriately).
| run: go test ./... -count=1 | |
| - name: Test (race) | |
| run: go test -race ./... -count=1 | |
| run: go list ./... | grep -v '/internal/gather' | xargs go test -count=1 | |
| - name: Test (race) | |
| run: go list ./... | grep -v '/internal/gather' | xargs go test -race -count=1 |
| "model": {Fg: "87", Bg: ""}, // cyan | ||
| "context": {Fg: "42", Bg: ""}, // green (normal usage) | ||
| "directory": {Fg: "110", Bg: ""}, | ||
| "git": {Fg: "87", Bg: ""}, // cyan | ||
| "project": {Fg: "75", Bg: ""}, // blue | ||
| "duration": {Fg: "244", Bg: ""}, | ||
| "tools": {Fg: "75", Bg: ""}, | ||
| "agents": {Fg: "114", Bg: ""}, | ||
| "todos": {Fg: "220", Bg: ""}, | ||
| "cost": {Fg: "87", Bg: ""}, | ||
| "project": {Fg: "75", Bg: ""}, // blue | ||
| "duration": {Fg: "244", Bg: ""}, |
There was a problem hiding this comment.
A new service widget is now part of the default layout, but none of the built-in themes define colors for the service key. In powerline mode this will fall back to DefaultPowerlineBg (236) and can break the “distinct background per segment” goal described in the theme comments. Add a service entry (fg and, for powerline themes, a distinct bg) to each built-in theme map.
| // When the service widget is active or we're in a worktree, the directory | ||
| // name is handled elsewhere — just show branch info. | ||
| if ctx.WorktreeName != "" || ctx.ServiceName != "" { |
There was a problem hiding this comment.
The function-level doc comment still states that only worktrees suppress the directory portion, but the implementation now also suppresses it when ServiceName is set (service widget active). Please update the doc comment above Project to reflect the new behavior so callers/tests aren’t misled.
| // Service renders the repository name (e.g. "vitals") so the user always | ||
| // knows which project they are working in. Returns empty when the name | ||
| // is not available. | ||
| func Service(ctx *model.RenderContext, cfg *config.Config) WidgetResult { | ||
| if ctx.ServiceName == "" { | ||
| return WidgetResult{} | ||
| } | ||
| icons := IconsFor(cfg.Style.Icons) | ||
| plain := icons.Folder + " " + ctx.ServiceName | ||
| return WidgetResult{ | ||
| Text: dirStyle.Render(plain), | ||
| PlainText: plain, | ||
| FgColor: "13", | ||
| } |
There was a problem hiding this comment.
The new service widget introduces user-visible behavior (repo basename formatting and icon prefix) but doesn’t appear to have direct unit tests. Consider adding widget-level tests (similar to other widgets in this package) to assert: empty when ServiceName is empty, correct PlainText/Text when set, and behavior across icon modes.
Summary
servicewidget showing repo name (e.g. "vitals") with default layout reordered to service | worktree | branchWaitGroup.Go, unused params,range-over-int, unusedusageLabelTest plan
go build ./...passesgo test ./... -count=1passes (2 pre-existing failures on hardcoded paths)go vet ./...cleango fmt ./...cleanmake buildinstalls binary🤖 Generated with Claude Code