diff --git a/.claude/hooks/SessionStart b/.claude/hooks/SessionStart index 97214ae..215bf16 100755 --- a/.claude/hooks/SessionStart +++ b/.claude/hooks/SessionStart @@ -2,7 +2,7 @@ # SessionStart hook for Claude Code online environment # This script sets up the Python development environment using pixi -set -e +set -eo pipefail echo "🚀 Setting up Python Template environment..." @@ -15,6 +15,7 @@ if ! command -v pixi &> /dev/null; then export PATH="$HOME/.pixi/bin:$PATH" # Source bashrc to get pixi in PATH (if bashrc was updated) + # shellcheck disable=SC1091 [ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc" echo "✅ Pixi installed successfully" diff --git a/.devcontainer/claude-code/install.sh b/.devcontainer/claude-code/install.sh index 020018f..a52d2b4 100755 --- a/.devcontainer/claude-code/install.sh +++ b/.devcontainer/claude-code/install.sh @@ -1,5 +1,5 @@ -#!/bin/sh -set -eu +#!/bin/bash +set -euo pipefail # Claude Code CLI Local Feature Install Script # Installs Claude Code via pixi and sets up configuration directories @@ -83,6 +83,7 @@ install_claude_code() { # Add pixi bin path to user's profile if not already there local profile="$TARGET_HOME/.profile" + # shellcheck disable=SC2016 local pixi_path_line='export PATH="$HOME/.pixi/bin:$PATH"' if [ -f "$profile" ] && ! grep -q '\.pixi/bin' "$profile"; then echo "$pixi_path_line" >> "$profile" @@ -93,6 +94,7 @@ install_claude_code() { # Workaround: pixi trampoline fails for bash scripts, so add env bin directly # This conditionally adds the path only if the env exists + # shellcheck disable=SC2016 local env_path_line='[ -d "$HOME/.pixi/envs/claude-shim/bin" ] && export PATH="$HOME/.pixi/envs/claude-shim/bin:$PATH"' if [ -f "$profile" ] && ! grep -q 'pixi/envs/claude-shim' "$profile"; then echo "# Workaround: pixi trampoline fails for bash scripts" >> "$profile" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 03641c7..591412f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,8 +12,8 @@ "features": { "./claude-code": {}, - "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/devcontainers/features/common-utils:2": {} + // "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + // "ghcr.io/devcontainers/features/common-utils:2": {} }, "initializeCommand": ".devcontainer/claude-code/init-host.sh", diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae2c7df..2f838de 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,6 +48,12 @@ repos: # Run the formatter. - id: ruff-format types_or: [ python, pyi ] + # Shell script linter + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.11.0 + hooks: + - id: shellcheck + # Checks for spelling mistakes - repo: https://github.com/codespell-project/codespell rev: v2.3.0 diff --git a/scripts/launch_vscode.sh b/scripts/launch_vscode.sh index fa6b029..18e375e 100755 --- a/scripts/launch_vscode.sh +++ b/scripts/launch_vscode.sh @@ -1,5 +1,5 @@ #! /bin/bash -set -e +set -eo pipefail export COMPOSE_DOCKER_CLI_BUILD=1 export DOCKER_BUILDKIT=1 @@ -25,14 +25,16 @@ if [ ! -d "$VENV_DIR" ]; then echo "Creating virtual environment in $VENV_DIR..." python3 -m venv "$VENV_DIR" echo "Activating the virtual environment..." - source $VENV_DIR/bin/activate + # shellcheck disable=SC1091 + source "$VENV_DIR/bin/activate" echo "Installing deps rocker..." pip install deps-rocker pixi-rocker rockervsc echo "Virtual environment setup and deps rocker installation complete." else echo "Virtual environment already exists in $VENV_DIR." echo "Activating the existing virtual environment..." - source $VENV_DIR/bin/activate + # shellcheck disable=SC1091 + source "$VENV_DIR/bin/activate" fi rockervsc diff --git a/scripts/rename_project.sh b/scripts/rename_project.sh index ce4847c..c1b6590 100755 --- a/scripts/rename_project.sh +++ b/scripts/rename_project.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -eo pipefail # Escape characters special in sed replacement strings (\, &, /) escape_sed() { printf '%s\n' "$1" | sed 's/[\\&/]/\\&/g'; } diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh index 35e8117..e2726cd 100755 --- a/scripts/setup_host.sh +++ b/scripts/setup_host.sh @@ -1,4 +1,5 @@ #! /bin/bash +set -eo pipefail #Sets up docker, nvidia docker git-lfs and rocker which are used to clone and setup docker containers @@ -6,7 +7,7 @@ # https://docs.docker.com/engine/install/ubuntu/ #remove incorrect docker -for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done +for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove "$pkg"; done # Add Docker's official GPG key: sudo apt update @@ -16,6 +17,7 @@ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyring sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: +# shellcheck disable=SC1091 echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ @@ -52,11 +54,12 @@ echo "you may need to restart your machine" #INSTALL PIXI curl -fsSL https://pixi.sh/install.sh | bash +# shellcheck disable=SC2016 echo 'eval "$(pixi completion --shell bash)"' >> ~/.bashrc #INSTALL UV curl -LsSf https://astral.sh/uv/install.sh | sh sudo groupadd docker -sudo usermod -aG docker $USER +sudo usermod -aG docker "$USER" newgrp docker || true diff --git a/scripts/update_from_template.sh b/scripts/update_from_template.sh index d8683e7..96d4fb8 100755 --- a/scripts/update_from_template.sh +++ b/scripts/update_from_template.sh @@ -1,4 +1,5 @@ #! /bin/bash +set -eo pipefail git config --global pull.rebase false git remote add template https://github.com/blooop/python_template.git