diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed934e0..7e6636b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,11 +35,11 @@ jobs: - uses: actions/checkout@v4 - name: Check for non-English strings run: | - GERMAN=$(grep -rlE 'ä|ö|ü|ß' --include='*.sh' . || true) + GERMAN=$(grep -rlP '\xc3[\xa4\xb6\xbc\x9f]' --include='*.sh' --exclude-dir=tests . || true) if [[ -n "$GERMAN" ]]; then echo "Files with German characters:" echo "$GERMAN" - grep -rnE 'ä|ö|ü|ß' --include='*.sh' . + grep -rnP '\xc3[\xa4\xb6\xbc\x9f]' --include='*.sh' --exclude-dir=tests . exit 1 fi echo "All clear — no German strings found." diff --git a/config.sh b/config.sh index 09f8e2b..4f95095 100755 --- a/config.sh +++ b/config.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -# Night Shift Configuration +# Night Shift Configuration. Sourced by coordinator.sh, worker.sh, etc. +# shellcheck disable=SC2034 # Edit this file to match your environment # ─── Repositories to scan ─── diff --git a/coordinator.sh b/coordinator.sh index 7d2fa51..590224d 100755 --- a/coordinator.sh +++ b/coordinator.sh @@ -35,9 +35,12 @@ main() { log "Ollama: $(curl -s -o /dev/null -w '%{http_code}' http://localhost:11434/api/tags 2>/dev/null || echo 'OFFLINE')" log "--- Repo Status ---" for rp in "${REPOS[@]}"; do - local rn=$(basename "$rp") - local rchanges=$(git -C "$rp" status --porcelain 2>/dev/null | wc -l) - local rbranch=$(git -C "$rp" branch --show-current 2>/dev/null) + local rn + rn=$(basename "$rp") + local rchanges + rchanges=$(git -C "$rp" status --porcelain 2>/dev/null | wc -l) + local rbranch + rbranch=$(git -C "$rp" branch --show-current 2>/dev/null) log " $rn: Branch=$rbranch, Changes=$rchanges" done log "---" diff --git a/tests/test-nightshift.sh b/tests/test-nightshift.sh index 7a5acad..90d4afe 100755 --- a/tests/test-nightshift.sh +++ b/tests/test-nightshift.sh @@ -290,7 +290,7 @@ if command -v shellcheck &>/dev/null; then for script in config.sh coordinator.sh worker.sh summary.sh summary-morning.sh lesson-generator.sh install.sh; do TESTS_RUN=$((TESTS_RUN + 1)) sc_output=$(shellcheck -S warning "$PROJECT_DIR/$script" 2>&1 || true) - sc_errors=$(echo "$sc_output" | grep -c "^In " || echo "0") + sc_errors=$(echo "$sc_output" | grep -c "^In " || true) if [[ "$sc_errors" -eq 0 ]]; then TESTS_PASSED=$((TESTS_PASSED + 1)) echo -e " ${GREEN}PASS${NC} shellcheck: $script" @@ -313,7 +313,7 @@ echo "=== Language Check (English only) ===" german_found=false for script in config.sh coordinator.sh worker.sh summary.sh summary-morning.sh lesson-generator.sh install.sh; do TESTS_RUN=$((TESTS_RUN + 1)) - german_lines=$(grep -cE 'ä|ö|ü|ß' "$PROJECT_DIR/$script" 2>/dev/null | tr -d '[:space:]' || echo "0") + german_lines=$(grep -cP '\xc3[\xa4\xb6\xbc\x9f]' "$PROJECT_DIR/$script" 2>/dev/null | tr -d '[:space:]' || echo "0") german_lines="${german_lines:-0}" if [[ "$german_lines" -eq 0 ]]; then TESTS_PASSED=$((TESTS_PASSED + 1)) diff --git a/worker.sh b/worker.sh index 848e7a8..f326128 100755 --- a/worker.sh +++ b/worker.sh @@ -18,7 +18,7 @@ main() { exit 1 fi - IFS='|' read -r repo category title description risk_level llm_tier run_id <<< "$task_data" + IFS='|' read -r repo category title description _risk_level llm_tier _run_id <<< "$task_data" # Resolve repo path — supports both basename and absolute path in REPOS local repo_path="" @@ -32,7 +32,8 @@ main() { repo_path="$repo" fi - local branch_name="nightshift/${category}-$(date +%Y%m%d)-$(echo "$title" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | head -c 40)" + local branch_name + branch_name="nightshift/${category}-$(date +%Y%m%d)-$(echo "$title" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | head -c 40)" log "Worker started: [$category] $title (Repo: $repo)" local safe_branch @@ -73,7 +74,8 @@ main() { if ! git rev-parse --verify "$base_branch" &>/dev/null; then base_branch="main" fi - local backup_tag="nightshift-backup/$(date +%Y%m%d-%H%M%S)-${repo}" + local backup_tag + backup_tag="nightshift-backup/$(date +%Y%m%d-%H%M%S)-${repo}" git tag "$backup_tag" "$base_branch" 2>/dev/null || true # Create branch