Commit Graph

5 Commits

Author SHA1 Message Date
40452e100e Refactor: Extract testable functions and improve code organization
- Extract TokenUsage as named type (eliminates inline struct repetition)
- Refactor main() into testable functions:
  - readInputFromStdin: Read JSON from stdin
  - parseStatusInput: Validate and parse JSON
  - buildStatusLine: Construct left and right statusline parts
  - calculatePadding: Compute padding for alignment
  - formatOutput: Combine components into final output
- Add comprehensive tests for extracted functions
- Improve coverage from 45% to 71% (+26 percentage points)
- All new functions have 100% test coverage
- Clean linting with zero issues
2025-12-18 11:31:35 +01:00
4773460f3f Add golangci-lint config and lint tasks
- Add .golangci.yml with sensible defaults for the project
- Add lint and lint:fix tasks to Taskfile
- Remove unused findGitRoot function
- Apply gofumpt formatting fixes
2025-12-18 06:36:56 +01:00
1cca87af90 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.
2025-12-18 06:36:56 +01:00
f1ca1ccaa0 Use go-git for native git operations
Replace exec-based git calls with go-git/v6 library for ~5.6x
speedup over shell version. Only pgrep remains as external call.
2025-12-18 06:36:55 +01:00
135bbf68f1 Add Go statusline implementation
Replace shell-based statusline with native Go for ~4x speedup.
Parses JSON natively, detects git status, checks gitea process,
and formats colored output with proper terminal width handling.
2025-12-18 06:36:55 +01:00