From a0d52ae092896105a28f487009d8f5dc012d53c4 Mon Sep 17 00:00:00 2001 From: Janik von Rotz Date: Wed, 14 Oct 2026 16:13:42 +0200 Subject: [PATCH] feat: add .env template and validate SOPS age key presence --- .env.template | 1 + bin/init-project | 3 +++ bin/show-project-setup | 9 +++++---- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..b1178eb --- /dev/null +++ b/.env.template @@ -0,0 +1 @@ +# Project environment diff --git a/bin/init-project b/bin/init-project index 047d49f..4da97e5 100755 --- a/bin/init-project +++ b/bin/init-project @@ -13,6 +13,9 @@ init-project() { echo "Copy taskfile template." cp -n "$HOME/taskfile.build/task.template" ./task + echo "Copy env template." + cp -n "$HOME/taskfile.build/.env.template" ./.env.template + echo "Copy agents template." cp -n "$HOME/taskfile.build/AGENTS.md.template" ./AGENTS.md diff --git a/bin/show-project-setup b/bin/show-project-setup index 936e109..f0a438b 100755 --- a/bin/show-project-setup +++ b/bin/show-project-setup @@ -7,7 +7,8 @@ show-project-setup() { project_name=$(basename -s .git "$(git remote get-url origin 2>/dev/null)" 2>/dev/null) project_name=${project_name:-${PWD##*/}} - local key_name="${1:-$project_name}" + local key_name + key_name=$(echo "${1:-$project_name}" | tr '[:upper:]' '[:lower:]') local age_key_file="$HOME/.config/sops/age/keys.txt" local branch branch=$(git symbolic-ref --short -q HEAD) @@ -38,10 +39,10 @@ show-project-setup() { echo "SOPS config: not found" fi - if [[ -f "$age_key_file" ]]; then - echo "Age key file exists." + if [[ -f "$age_key_file" ]] && grep -q "# name: $key_name" "$age_key_file"; then + echo "Age key: exists" else - echo "Age key file: not found" + echo "Age key: not found" fi } sps() {