Fix arithmetic increment bug in installer causing silent exit

((var++)) returns exit code 1 when incrementing from 0, which
triggers set -e. Added || true to all 13 arithmetic operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 17:31:57 +09:00
parent 2aa9d098cb
commit 9ba0748bf2

View File

@@ -145,18 +145,18 @@ setup_global_commands() {
local current_link
current_link=$(readlink "$target")
if [[ "$current_link" == "$cmd_file" ]]; then
((skipped++))
((skipped++)) || true
else
rm "$target"
ln -s "$cmd_file" "$target"
((updated++))
((updated++)) || true
fi
elif [[ -f "$target" ]]; then
warn "Skipping $filename (non-symlink file exists at $target)"
((skipped++))
((skipped++)) || true
else
ln -s "$cmd_file" "$target"
((linked++))
((linked++)) || true
fi
done
@@ -188,7 +188,7 @@ remove_global_commands() {
link_target=$(readlink "$link")
if [[ "$link_target" == "$REPO_COMMANDS_DIR/"* ]]; then
rm "$link"
((removed++))
((removed++)) || true
fi
done
@@ -339,24 +339,24 @@ validate_installation() {
local checks_total=7
# Check directories
[[ -d "$CONFIG_DIR" ]] && ((checks_passed++)) && success "Config directory exists" || warn "Config directory missing"
[[ -d "$CONFIG_DIR/credentials" ]] && ((checks_passed++)) && success "Credentials directory exists" || warn "Credentials directory missing"
[[ -d "$CONFIG_DIR" ]] && { ((checks_passed++)) || true; success "Config directory exists"; } || warn "Config directory missing"
[[ -d "$CONFIG_DIR/credentials" ]] && { ((checks_passed++)) || true; success "Credentials directory exists"; } || warn "Credentials directory missing"
# Check files
[[ -f "$ENV_FILE" ]] && ((checks_passed++)) && success "Environment file exists" || warn "Environment file missing"
[[ -f "$CONFIG_DIR/config.yaml" ]] && ((checks_passed++)) && success "Config file exists" || warn "Config file missing"
[[ -f "$ENV_FILE" ]] && { ((checks_passed++)) || true; success "Environment file exists"; } || warn "Environment file missing"
[[ -f "$CONFIG_DIR/config.yaml" ]] && { ((checks_passed++)) || true; success "Config file exists"; } || warn "Config file missing"
# Check virtual environment
[[ -d "$VENV_DIR" ]] && ((checks_passed++)) && success "Virtual environment exists" || warn "Virtual environment missing"
[[ -d "$VENV_DIR" ]] && { ((checks_passed++)) || true; success "Virtual environment exists"; } || warn "Virtual environment missing"
# Check skills directory
[[ -d "$SKILLS_DIR/01-ourdigital-brand-guide" ]] && ((checks_passed++)) && success "Skills directory valid" || warn "Skills not found"
[[ -d "$SKILLS_DIR/01-ourdigital-brand-guide" ]] && { ((checks_passed++)) || true; success "Skills directory valid"; } || warn "Skills not found"
# Check global commands
local cmd_count
cmd_count=$(find "$CLAUDE_COMMANDS_DIR" -maxdepth 1 -type l -lname "$REPO_COMMANDS_DIR/*" 2>/dev/null | wc -l | tr -d ' ')
if [[ $cmd_count -gt 0 ]]; then
((checks_passed++))
((checks_passed++)) || true
success "Global slash commands installed ($cmd_count commands)"
else
warn "No global slash commands found (run with --commands to install)"
@@ -391,7 +391,7 @@ show_skills() {
for pattern in "${pattern_arr[@]}"; do
for dir in "$SKILLS_DIR"/$pattern; do
if [[ -d "$dir" ]]; then
((count++))
((count++)) || true
names+=("$(basename "$dir")")
fi
done
@@ -425,7 +425,7 @@ show_global_commands() {
local link_target
link_target=$(readlink "$link")
if [[ "$link_target" == "$REPO_COMMANDS_DIR/"* ]]; then
((cmd_count++))
((cmd_count++)) || true
local name
name=$(basename "$link" .md)
categories+=("$name")
@@ -441,13 +441,13 @@ show_global_commands() {
local seo=0 gtm=0 jamie=0 notebooklm=0 notion=0 ourdigital=0 other=0
for name in "${categories[@]}"; do
case "$name" in
seo-*) ((seo++)) ;;
gtm-*) ((gtm++)) ;;
jamie-*) ((jamie++)) ;;
notebooklm-*) ((notebooklm++)) ;;
notion-*) ((notion++)) ;;
ourdigital-*) ((ourdigital++)) ;;
*) ((other++)) ;;
seo-*) ((seo++)) || true ;;
gtm-*) ((gtm++)) || true ;;
jamie-*) ((jamie++)) || true ;;
notebooklm-*) ((notebooklm++)) || true ;;
notion-*) ((notion++)) || true ;;
ourdigital-*) ((ourdigital++)) || true ;;
*) ((other++)) || true ;;
esac
done