Sign inSign up

jhonasiv/shell-kit:latest

Manifest digest

sha256:dda1a59c447477d975c435c49579ae33137ca2561086f581d1fae4063ccba8a2

Last pushed

13 days by jhonasiv

Type

Sandbox Kit

Manifest digest

sha256:dda1a59c447477d975c435c49579ae33137ca2561086f581d1fae4063ccba8a2

yaml
schemaVersion: "2"
kind: mixin
name: dotfiles-shell
version: 0.1.0
displayName: Dotfiles shell
description: Installs all the tools for a shell sandbox meant for testing and development related to shell, symlinks the zsh, starship and tmux dotfiles from the workspace into $HOME, and documents the headless test recipe.
sourceURL: https://github.com/jhonasiv/dotfiles
requires:
    agent: pi
licenses:
    - MIT
agentInstructions:
    content: |
        # dotfiles-shell kit

        This sandbox is for developing the shell part of the dotfiles repo
        (zsh, starship, tmux).

        ## What is installed

        zsh, starship, fzf, zoxide, tmux, git. Everything else is stock.

        ## Deployment

        `dotfiles-shell-link.sh` runs on every sandbox start. It finds the repo
        (WORKSPACE_DIR, else /home/agent/workspace, else /workspace, by looking
        for sbxenv.yaml) and creates:

        - ~/.config/zsh -> <repo>/zsh (antidote is vendored inside)
        - ~/.config/starship/starship.toml -> <repo>/starship.toml
        - ~/.config/tmux/tmux.conf -> <repo>/tmux/tmux.conf
        - ~/.zshenv with ZDOTDIR=$HOME/.config/zsh (only if the file is missing)
        - ~/.tmux/plugins/tpm (cloned from GitHub if missing)

        First zsh boot runs `antidote load`, which clones the plugins listed in
        .zsh_plugins.txt from GitHub. That needs network; it happens once and is
        cached.

        ## Headless tests

        All tests are headless. There is no display, so do not try to render
        anything.

        Syntax check every zsh file:

            for f in "$REPO"/zsh/*.zsh "$REPO"/zsh/.zshrc "$REPO"/zsh/.zshenv \
                     "$REPO"/zsh/plugins/*.zsh "$REPO"/zsh/integrations/*.zsh; do
              zsh -n "$f" || echo "FAIL: $f"
            done

        Boot test (first run also warms the antidote plugin cache):

            ZDOTDIR="$HOME/.config/zsh" zsh -ic exit 2>&1 | grep -iE 'error|not found'

        Starship config parse:

            starship print-config --config "$HOME/.config/starship/starship.toml"

        tmux config parse plus plugin load:

            tmux -L sbx-test -f "$HOME/.config/tmux/tmux.conf" new-session -d \
              && sleep 1 && tmux -L sbx-test kill-server

        ## Known limits

        - secrets.zsh is gitignored and absent in the sandbox; the zsh config
          sources it unconditionally, so the boot test may report that. That is
          expected, not a regression.
        - Rendering, colors and fonts are out of scope.
permissions:
    network:
        allow:
            - archive.ubuntu.com
            - security.ubuntu.com
            - deb.debian.org
            - security.debian.org
            - github.com
            - api.github.com
            - '*.githubusercontent.com'
setup:
    install:
        - command: |
            (apt-get update \
            && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
              zsh tmux fzf zoxide git curl ca-certificates) | tee /home/agent/shell-log || true
          user: root
          description: Install zsh, tmux, fzf and zoxide from apt
        - command: |
            if ! command -v starship >/dev/null 2>&1; then
              curl -sSfL https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz \
                | tar -xz -C /usr/local/bin
            fi
          user: root
          description: Install starship from GitHub releases
    startup:
        - command:
            - /bin/sh
            - /home/agent/.local/bin/dotfiles-shell-link.sh
          user: "1000"
          description: Symlink shell dotfiles from the workspace into $HOME