24 Commits

Author SHA1 Message Date
32b48c7e5c Add extra spacing between git info and token usage 2026-02-09 16:46:47 +01:00
bca7b59248 Drop padding and terminal width detection
Output left + right with a single space separator instead of trying
to right-align to a detected terminal width. Terminal detection is
unreliable when all fds are piped by Claude Code, and hardcoding a
width defeats the purpose. Also removes the x/term dependency.
2026-02-08 23:37:48 +01:00
27128e2e3b Use STATUSLINE_WIDTH env var for reliable width detection
term.GetSize returns unreliable values when running inside Claude Code
over SSH. Replace the hardcoded statuslineWidthOffset with STATUSLINE_WIDTH
env var (set in Claude Code settings), falling back to terminal detection,
then 80 columns.
2026-02-08 23:27:26 +01:00
a06aa4c549 Fix right-alignment by detecting terminal width from stderr/stdin
When Claude Code captures stdout, term.GetSize on stdout fails and
falls back to 80 columns. Now tries stderr and stdin first (which
remain connected to the TTY), then COLUMNS env var, then 80.
2026-02-08 23:14:13 +01:00
29350032ba Add MIT license and fix Taskfile install path 2026-02-08 23:10:27 +01:00
0ff559c7ea Use GOBIN for one-step install in README 2026-02-08 23:08:36 +01:00
35af56ea9d Add README with installation and configuration instructions 2026-02-08 23:03:58 +01:00
ed312a3ed0 Update deps and boost test coverage from 70.8% to 90%
Update go-git v6, gopsutil v4.26.1, x/term v0.39.0, and transitive deps.
Refactor main() into testable run() function, add injectable processLister
and termWidthFunc for test isolation, and add tests covering detached HEAD,
dirty/clean worktree, empty repo, process listing errors, and terminal
width fallback.
2026-02-08 22:58:08 +01:00
99ad5b9d7f Format markdown and YAML files with deno fmt 2025-12-18 19:42:05 +01:00
0638707349 Use golang.org/x/term for terminal width detection
Replace direct unix.IoctlGetWinsize() call with term.GetSize() for
cleaner API. No binary size change as x/sys remains an indirect
dependency.
2025-12-18 18:36:54 +01:00
58aaad4c9c Add comprehensive edge case tests for status line functions 2025-12-18 11:31:35 +01:00
52d6bbaf84 Add OpenCode config with golangci-lint LSP 2025-12-18 11:31:35 +01:00
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
47ea4eb509 Add AGENTS.md and bump to Go 1.25 2025-12-18 11:31:35 +01:00
b6148b9fd8 Add CLAUDE.md for Claude Code guidance 2025-12-18 07:53:50 +01:00
80ce148a3e Update module path to Gitea 2025-12-18 06:36:56 +01:00
f1de3c2050 Add unit tests and test tasks
- Add main_test.go with tests for formatContextInfo, stripANSI,
  StatusInput parsing, getGitInfo, and getGiteaStatus
- Add test, test:cover, test:fixture tasks to Taskfile
- 45% code coverage
2025-12-18 06:36:56 +01:00
db80a7da81 Add modernize tasks to Taskfile 2025-12-18 06:36:56 +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
ffb73d6544 statusline.sh 2025-12-18 06:36:55 +01:00
1416373348 batman 2025-12-18 06:36:55 +01:00