Skip to content

Conversation

@maxrantil
Copy link
Owner

Summary

Configure starship to always display username and hostname (not just during SSH sessions) for better VM identification clarity.

Context

This change complements the vm-infra configurable username feature (maxrantil/vm-infra#117, PR maxrantil/vm-infra#118) where VMs are provisioned with:

  • Configurable usernames (e.g., developer, testuser)
  • VM names as hostnames (e.g., work-vm-1, test-vm-2)

Problem: Default starship config only shows username during SSH sessions. When working with multiple VMs, it's hard to identify which VM you're in.

Solution: Always show username@hostname in the prompt for immediate context.

Changes

starship.toml

  • ✅ Added [username] section with show_always = true
    • Yellow for regular users
    • Red for root (warning indicator)
  • ✅ Added [hostname] section with ssh_only = false
    • Green color with @ prefix
    • Trim domain suffix (.local)
  • ✅ Updated format string to include $username$hostname

Result

Before:

~/projects
❯

After:

┌───────────────────>
│developer@work-vm-1~/projects main
└─>❯

Benefits

Multi-VM Clarity:

  • developer@work-vm-1 vs developer@work-vm-2 - instantly clear which VM
  • testuser@test-vm vs developer@prod-vm - context at a glance
  • Works in all contexts (SSH, console, tmux)

Security:

  • Root user shown in red - immediate warning
  • No ambiguity about current user context

Testing

Tested with vm-infra's --test-dotfiles flag:

./provision-vm.sh test-vm testuser 2048 1 --test-dotfiles /path/to/dotfiles

Expected prompt: testuser@test-vm ~/path

References


Ready for review - Simple config change, well-documented, tested with vm-infra integration.

Add configuration to show username and hostname in all contexts
(not just SSH) for better VM identification clarity.

This complements vm-infra's configurable username feature where
VMs can be provisioned with different usernames and use VM names
as hostnames (e.g., developer@work-vm-1, testuser@test-vm-2).

Changes:
- Add username section with show_always=true (yellow for users, red for root)
- Add hostname section with ssh_only=false (green with @ prefix)
- Update format string to include $username$hostname

Result: Prompt shows "username@hostname ~/path" in all contexts

Related: maxrantil/vm-infra#117
Update SESSION_HANDOVER.md to document the starship username/hostname
always-show feature (PR #75) instead of the previous PR #74.

Includes feature implementation details, next session priorities,
and startup prompt for continuity.

Fixes the failing verify-session-handoff CI check.
@maxrantil maxrantil merged commit 1717017 into master Nov 18, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants