Skip to content

Commit 1717017

Browse files
authored
feat: always display username@hostname in starship prompt
Configure starship to always display username and hostname (not just during SSH sessions) for better VM identification clarity. This change complements the vm-infra configurable username feature (maxrantil/vm-infra#117, PR maxrantil/vm-infra#118). Changes: - Added [username] section with show_always = true (yellow for users, red for root) - Added [hostname] section with ssh_only = false (green with @ prefix) - Updated format string to include $username$hostname - Trim domain suffix for cleaner display Benefits: - Multi-VM clarity: Instantly see which VM you're in - Security: Root user shown in red (warning indicator) - Universal: Works in all contexts (SSH, console, tmux)
1 parent be769fd commit 1717017

2 files changed

Lines changed: 109 additions & 57 deletions

File tree

SESSION_HANDOVER.md

Lines changed: 89 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,109 @@
1-
# Session Handoff: VM Issues - Gruvbox, Starship, Browser Fixes
1+
# Session Handoff: Starship Always-Show Username/Hostname Feature
22

3-
**Date**: 2025-11-17
4-
**PR**: maxrantil/dotfiles#74
5-
**Branch**: fix/vm-issues-gruvbox-starship-browser
3+
**Date**: 2025-11-18
4+
**PR**: maxrantil/dotfiles#75
5+
**Branch**: feat/starship-always-show-username
66

77
## ✅ Completed Work
88

9-
### Issues Fixed
10-
1. **Gruvbox colorscheme error in VMs**: Disabled gruvbox for minimal VM setup
11-
2. **Starship git_status warnings**: Fixed format string syntax
12-
3. **BROWSER not found for gh CLI**: Auto-detect available browser
13-
14-
### Changes Implemented
15-
1. **init.vim**:
16-
- Commented out gruvbox plugin line
17-
- Removed gruvbox configuration
18-
- Added comment explaining it's disabled for minimal VM setup
19-
20-
2. **starship.toml**:
21-
- Fixed format strings to consistently use `${count}` placeholder
22-
- Updated conflicted, stashed, renamed indicators
9+
### Feature Implemented
10+
**Starship Prompt Enhancement**: Configured starship to always display `username@hostname` in the prompt (not just during SSH sessions).
11+
12+
### Changes Made
13+
1. **starship.toml**:
14+
- Added `[username]` section with `show_always = true`
15+
- Yellow for regular users
16+
- Red for root (warning indicator)
17+
- Added `[hostname]` section with `ssh_only = false`
18+
- Green color with `@` prefix
19+
- Trim domain suffix (`.local`)
20+
- Updated format string to include `$username$hostname`
21+
22+
### Context & Integration
23+
This change complements the vm-infra configurable username feature:
24+
- vm-infra Issue: maxrantil/vm-infra#117
25+
- vm-infra PR: maxrantil/vm-infra#118
26+
- VMs now provisioned with configurable usernames and hostnames
27+
- Prompt shows `developer@work-vm-1` or `testuser@test-vm-2` for instant context
28+
29+
### Before/After
30+
**Before**:
31+
```
32+
~/projects
33+
34+
```
2335

24-
3. **.zshenv**:
25-
- Changed from hardcoded `BROWSER="firefox"`
26-
- Now auto-detects: chromium-browser > firefox > chromium > xdg-open
27-
- Prioritizes chromium-browser for VM usage
36+
**After**:
37+
```
38+
┌───────────────────>
39+
│developer@work-vm-1~/projects main
40+
└─>❯
41+
```
2842

29-
### Testing Results
30-
✅ init.vim: No errors when opening vim
31-
✅ starship: No warnings in git directories
32-
✅ BROWSER: Auto-detects available browser (falls back gracefully)
43+
### Benefits
44+
- **Multi-VM Clarity**: Instantly see which VM you're in
45+
- **Security**: Root user shown in red (immediate warning)
46+
- **Universal**: Works in all contexts (SSH, console, tmux)
47+
48+
### Agent Validation Status
49+
-**ux-accessibility-i18n-agent**: APPROVED (4.5/5)
50+
- Excellent UX for multi-VM workflows
51+
- Color choices appropriate and accessible
52+
- Screen reader compatible
53+
- Recommends contrast verification testing (not blocking)
54+
-**code-quality-analyzer**: APPROVED (4.6/5)
55+
- Valid starship configuration
56+
- Excellent documentation
57+
- Negligible performance impact
58+
- Minor cosmetic improvements suggested (optional)
59+
-**documentation-knowledge-manager**: Session handoff now complete
3360

3461
## 🎯 Current Project State
3562

36-
**Tests**: ✅ All pre-commit hooks passing locally
37-
**Branch**: fix/vm-issues-gruvbox-starship-browser
38-
**CI/CD**: 🔄 Running (PR #74)
39-
**Status**: Ready for merge after session handoff doc
63+
**Tests**: ✅ All pre-commit hooks passing
64+
**Branch**: feat/starship-always-show-username
65+
**CI/CD**: 🔄 Running (PR #75) - session handoff doc now updated
66+
**Status**: Ready for merge after CI passes
67+
68+
### File Changes
69+
- **Modified**: `starship.toml` (+20 lines, -1 line)
70+
- Added [username] section
71+
- Added [hostname] section
72+
- Updated format string
4073

4174
## 📋 Next Session Priorities
4275

4376
**Immediate Next Steps:**
44-
1. Merge PR #74 after CI passes
45-
2. Test in VM to verify fixes work
46-
3. Document X11 forwarding setup for gh CLI
47-
4. Consider adding chromium-browser to Ansible playbook
48-
49-
**VM Browser Setup:**
50-
For gh CLI web auth to work:
51-
```bash
52-
# Install chromium
53-
sudo apt install chromium-browser
54-
55-
# SSH with X11 forwarding
56-
ssh -X -i ~/.ssh/vm_key user@vm-ip
57-
58-
# Now gh auth login will open browser on host
59-
```
77+
1. Merge PR #75 after CI passes (all checks should be green now)
78+
2. Test in VM to verify prompt display with configurable usernames
79+
3. Validate integration with vm-infra PR #118 deployment
80+
4. Monitor for any prompt performance impact
81+
82+
**Optional Enhancements** (from code-quality-analyzer):
83+
- Remove redundant `disabled = false` lines (cosmetic)
84+
- Add test coverage for root user styling
85+
- Add test coverage for hostname domain trimming
86+
- Update README.md to document prompt behavior
87+
88+
**Future Considerations:**
89+
- Test with various username/hostname combinations in vm-infra
90+
- Evaluate if additional starship customizations needed for VM workflows
91+
- Consider contrast verification testing for accessibility
6092

6193
## 📝 Startup Prompt for Next Session
6294

63-
Read CLAUDE.md to understand our workflow, then verify dotfiles PR #74 CI status and merge if green.
95+
Read CLAUDE.md to understand our workflow, then merge dotfiles PR #75 (starship always-show username/hostname feature) after CI validation.
6496

65-
**Immediate priority**: Merge maxrantil/dotfiles#74 after CI passes
66-
**Context**: Fixed three VM issues - gruvbox errors, starship warnings, browser detection
67-
**Reference docs**: SESSION_HANDOVER.md (this file)
68-
**Ready state**: PR pushed, awaiting CI validation
97+
**Immediate priority**: Merge maxrantil/dotfiles#75 after CI passes
98+
**Context**: Starship now always displays username@hostname for multi-VM clarity
99+
**Reference docs**: PR #75 description, vm-infra#117, vm-infra#118, SESSION_HANDOVER.md
100+
**Ready state**: All tests passing, simple config change, agent-validated
69101

70-
**Expected scope**: Merge PR, test in VM, update Ansible if needed
102+
**Expected scope**: Merge PR, test prompt display in VM, validate vm-infra integration works as expected
71103

72104
## 📚 Key Reference Documents
73-
- maxrantil/dotfiles#74 (this PR)
74-
- init.vim (gruvbox disabled)
75-
- starship.toml (git_status fixed)
76-
- .zshenv (browser auto-detection)
105+
- maxrantil/dotfiles#75 (this PR - starship username/hostname always-show)
106+
- maxrantil/vm-infra#117 (issue - configurable VM usernames)
107+
- maxrantil/vm-infra#118 (PR - implementation of configurable usernames)
108+
- `starship.toml:14-31` (username/hostname configuration added)
109+
- `STARSHIP_CONFIG_NOTE.md` (in vm-infra repo - implementation guide)

starship.toml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,33 @@
33

44
format = """
55
[┌───────────────────>](bold green)
6-
[│](bold green)$directory$git_branch$git_status
6+
[│](bold green)$username$hostname$directory$git_branch$git_status
77
[└─>](bold green) """
88

99
[directory]
1010
style = "blue bold"
1111
truncation_length = 3
1212
truncate_to_repo = true
1313

14+
# ===================================
15+
# USERNAME - Always show for VM clarity
16+
# ===================================
17+
[username]
18+
show_always = true # Show even when not SSH'd in
19+
format = "[$user]($style)" # Format: username only
20+
style_user = "bold yellow" # Yellow for regular users
21+
style_root = "bold red" # Red for root (warning!)
22+
disabled = false
23+
24+
# ===================================
25+
# HOSTNAME - Always show for VM clarity
26+
# ===================================
27+
[hostname]
28+
ssh_only = false # Show even when not SSH'd in
29+
format = "[@$hostname](bold green) " # Format: @hostname with space
30+
trim_at = "." # Remove domain suffix
31+
disabled = false
32+
1433
[git_branch]
1534
symbol = " "
1635
style = "bold purple"

0 commit comments

Comments
 (0)