80 lines
1.9 KiB
Python
80 lines
1.9 KiB
Python
import getpass
|
|
|
|
from invoke import task
|
|
|
|
from helpers import append_bashrc_section, load_snippet, run
|
|
|
|
APT_PACKAGES = [
|
|
"git",
|
|
"curl",
|
|
"micro",
|
|
"mc",
|
|
"detox",
|
|
"tree",
|
|
]
|
|
|
|
|
|
@task
|
|
def install_claude(c):
|
|
"""Install Claude Code via the official install script."""
|
|
run(c, "curl -fsSL https://claude.ai/install.sh | bash")
|
|
|
|
|
|
@task
|
|
def install_copilot(c):
|
|
"""Install GitHub Copilot via the official install script."""
|
|
run(c, "curl -fsSL https://gh.io/copilot-install | bash")
|
|
|
|
|
|
@task
|
|
def install_apt_packages(c):
|
|
"""Update apt cache and install base packages."""
|
|
run(c, "sudo apt-get update")
|
|
run(c, f"sudo apt-get install -y {' '.join(APT_PACKAGES)}")
|
|
|
|
|
|
@task
|
|
def install_docker(c):
|
|
"""Install Docker if not already installed and add current user to docker group."""
|
|
run(
|
|
c,
|
|
"command -v docker >/dev/null 2>&1 || curl -fsSL https://get.docker.com | sudo sh",
|
|
)
|
|
run(c, f"sudo usermod -aG docker {getpass.getuser()}")
|
|
|
|
|
|
@task
|
|
def install_uv(c):
|
|
"""Install uv for the current user if not already installed."""
|
|
run(c, "test -f ~/.local/bin/uv || curl -LsSf https://astral.sh/uv/install.sh | sh")
|
|
|
|
|
|
@task
|
|
def install_fzf(c):
|
|
"""Install fzf from git, bat for preview, and configure .bashrc."""
|
|
run(c, "sudo apt-get install -y bat")
|
|
run(
|
|
c,
|
|
"test -d ~/.fzf || git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf",
|
|
)
|
|
run(c, "~/.fzf/install --all")
|
|
append_bashrc_section(c, "fzf", load_snippet("fzf"))
|
|
|
|
|
|
@task
|
|
def install_zoxide(c):
|
|
"""Install zoxide, configure .bashrc, """
|
|
run(c, "sudo apt install -y zoxide fzf")
|
|
append_bashrc_section(c, "zoxide", load_snippet("zoxide"))
|
|
|
|
|
|
@task(install_apt_packages, install_docker, install_uv, install_claude, install_fzf, install_zoxide)
|
|
def bootstrap(c):
|
|
"""Install all base tools."""
|
|
|
|
|
|
@task
|
|
def test(c):
|
|
"""Run tasks in an ephemeral LXD container."""
|
|
run(c, "pytest tests/ -v -s")
|