# Dotfiles task runner (bombadil + git).
#
# Symlinked to ~/.justfile by bombadil, so it works as just's global justfile:
#   just -g <recipe>      # from anywhere
#   just <recipe>         # from $HOME
#
# Recipes reference exported variables as shell $vars rather than just's
# double-brace interpolation: bombadil renders every dotfile through Tera, which
# would try to evaluate a double-brace expression as a template variable.

# Theme profile to link with: dark or light.
export theme := "dark"

# Host profile, auto-detected from hostname. Each machine links only its own
# Claude agents/skills; everything else is shared.
export host := if `hostname` == "daniel-desktop" { "desktop" } else { "xps" }

# List available recipes.
default:
    @just -g --list

# Re-link all dotfiles for this host and theme.
link:
    bombadil link -f -p "$theme" "$host"

alias relink := link

# Re-link with the dark theme.
dark:
    bombadil link -f -p dark "$host"

# Re-link with the light theme.
light:
    bombadil link -f -p light "$host"

# Watch dotfiles and re-link automatically on change.
watch:
    bombadil watch -f -p "$theme" "$host"

# Remove all bombadil-managed symlinks.
unlink:
    bombadil unlink

# Pull the latest dotfiles from the remote and re-link.
update:
    git -C ~/src/dotfiles pull --ff-only
    bombadil link -f -p "$theme" "$host"

# Show the dotfiles repo's git status.
status:
    git -C ~/src/dotfiles status

# Open the bombadil config in $EDITOR.
edit:
    $EDITOR ~/src/dotfiles/bombadil.toml
