[PR #57] [MERGED] Fix Stop hook under /bin/sh (dash) #71

Closed
opened 2026-03-03 18:50:26 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/OthmanAdi/planning-with-files/pull/57
Author: @SaladDay
Created: 1/24/2026
Status: Merged
Merged: 1/26/2026
Merged by: @OthmanAdi

Base: masterHead: fix/stop-hook-posix-sh


📝 Commits (1)

  • 1c2dc40 Fix Stop hook for POSIX sh (dash)

📊 Changes

5 files changed (+105 additions, -15 deletions)

View changed files

📝 .codex/skills/planning-with-files/SKILL.md (+21 -3)
📝 .cursor/skills/planning-with-files/SKILL.md (+21 -3)
📝 .kilocode/skills/planning-with-files/SKILL.md (+21 -3)
📝 .opencode/skills/planning-with-files/SKILL.md (+21 -3)
📝 skills/planning-with-files/SKILL.md (+21 -3)

📄 Description

Fix: POSIX sh Compatibility for Claude Code Stop Hook (Debian/Ubuntu)

Summary

On Debian/Ubuntu, Claude Code runs hooks via /bin/sh (often dash). The Stop hook command in several SKILL.md variants used bash-only syntax ([[ ... ]] and &>), causing the following errors:

  • /bin/sh: 1: [[: not found
  • /bin/sh: 1: : Permission denied

This PR rewrites the Stop hook command to be POSIX sh compatible while retaining the original behavior: use PowerShell on Windows when available; otherwise run check-complete.sh.

Changes

  • Replace bashisms ([[ / &>) with POSIX constructs ([ / case / >/dev/null 2>&1)
  • Use uname -s + OS=Windows_NT for shell-agnostic Windows detection
  • Run check-complete.sh via sh (no assumptions about executable bit/shebang)

Affected Files

  • skills/planning-with-files/SKILL.md
  • .codex/skills/planning-with-files/SKILL.md
  • .cursor/skills/planning-with-files/SKILL.md
  • .kilocode/skills/planning-with-files/SKILL.md
  • .opencode/skills/planning-with-files/SKILL.md

Repro / Test

  • Verified the updated Stop hook snippet runs under /bin/sh (dash) without errors:
    CLAUDE_PLUGIN_ROOT=/tmp/planning-with-files /bin/sh -c '<stop hook snippet>'

Context

Addresses the dash//bin/sh Stop hook failure described by @aqlkzf in #32.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/OthmanAdi/planning-with-files/pull/57 **Author:** [@SaladDay](https://github.com/SaladDay) **Created:** 1/24/2026 **Status:** ✅ Merged **Merged:** 1/26/2026 **Merged by:** [@OthmanAdi](https://github.com/OthmanAdi) **Base:** `master` ← **Head:** `fix/stop-hook-posix-sh` --- ### 📝 Commits (1) - [`1c2dc40`](https://github.com/OthmanAdi/planning-with-files/commit/1c2dc407d146d80be44143e18fb2b4fab1d04460) Fix Stop hook for POSIX sh (dash) ### 📊 Changes **5 files changed** (+105 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `.codex/skills/planning-with-files/SKILL.md` (+21 -3) 📝 `.cursor/skills/planning-with-files/SKILL.md` (+21 -3) 📝 `.kilocode/skills/planning-with-files/SKILL.md` (+21 -3) 📝 `.opencode/skills/planning-with-files/SKILL.md` (+21 -3) 📝 `skills/planning-with-files/SKILL.md` (+21 -3) </details> ### 📄 Description # Fix: POSIX sh Compatibility for Claude Code Stop Hook (Debian/Ubuntu) ## Summary On Debian/Ubuntu, Claude Code runs hooks via `/bin/sh` (often `dash`). The Stop hook command in several SKILL.md variants used bash-only syntax (`[[ ... ]]` and `&>`), causing the following errors: - `/bin/sh: 1: [[: not found` - `/bin/sh: 1: : Permission denied` This PR rewrites the Stop hook command to be POSIX `sh` compatible while retaining the original behavior: use PowerShell on Windows when available; otherwise run `check-complete.sh`. ## Changes - Replace bashisms (`[[` / `&>`) with POSIX constructs (`[` / `case` / `>/dev/null 2>&1`) - Use `uname -s` + `OS=Windows_NT` for shell-agnostic Windows detection - Run `check-complete.sh` via `sh` (no assumptions about executable bit/shebang) ## Affected Files - `skills/planning-with-files/SKILL.md` - `.codex/skills/planning-with-files/SKILL.md` - `.cursor/skills/planning-with-files/SKILL.md` - `.kilocode/skills/planning-with-files/SKILL.md` - `.opencode/skills/planning-with-files/SKILL.md` ## Repro / Test - Verified the updated Stop hook snippet runs under `/bin/sh` (dash) without errors: `CLAUDE_PLUGIN_ROOT=/tmp/planning-with-files /bin/sh -c '<stop hook snippet>'` ## Context Addresses the dash/`/bin/sh` Stop hook failure described by @aqlkzf in #32. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 18:50:26 +03:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/planning-with-files#71
No description provided.