addyosmani / addyosmani/agent-skills
SessionStart hook fails on Windows (bash syntax run through pwsh)
- Ngôn ngữ chính
- JavaScript
- Star
- 94.1k
- Fork
- 10k
- Merge trung bình
- 3 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 23
Mô tả
## Bug: SessionStart hook fails on Windows (bash syntax run through pwsh)
`hooks/hooks.json`'s `SessionStart` command uses POSIX/bash syntax:
```
SCRIPT="${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"; [ -f "$SCRIPT" ] || SCRIPT="${CLAUDE_PROJECT_DIR}/.claude/hooks/session-start.sh"; [ -f "$SCRIPT" ]&& bash "$SCRIPT" || true
```
On Windows, Claude Code executes hook commands via `pwsh`, not bash. `[ -f "$SCRIPT" ]` is not valid PowerShell syntax, so the hook fails immediately with:
```
SessionStart:startup hook error
Failed with non-blocking status code: ParserError:
```
on every session start. Additionally, `session-start.sh` itself requires `jq` and `bash`, both non-default on Windows.
### Repro
1. Install the plugin on Windows (PowerShell 7+, no WSL/git-bash `jq`).
2. Start a Claude Code session.
3. See `SessionStart:startup hook error / ParserError` on launch.
### Suggested fix
Branch the hook command on OS (or ship a `.ps1` counterpart) so Windows doesn't shell out to bash/jq. A pure-PowerShell fallback that reads `skills/using-agent-skills/SKILL.md` directly and emits the same JSON payload (no jq dependency) works fine — happy to share the one-liner I used locally as a starting point if useful.
### Environment
- Claude Code v2.1.228, Windows 11, PowerShell 7.6.4
- Plugin: agent-skills (addyosmani/agent-skills)
Hướng dẫn đóng góp
Hướng nghiên cứu
Open `hooks/hooks.json` and inspect the `SessionStart` command that currently uses POSIX test syntax. Also read `hooks/session-start.sh` and the `skills/using-agent-skills/SKILL.md` path it reads to confirm required output shape. Run a fresh Claude Code session on Windows (PowerShell) and check that startup no longer throws `SessionStart:startup hook error`/`ParserError`, and that no `bash`/`jq` dependency is required.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- bash, powershell, shell
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 72/100