addyosmani / addyosmani/agent-skills
SessionStart hook fails on Windows (bash syntax run through pwsh)
- 主要语言
- JavaScript
- 星标
- 94.1k
- 派生
- 10k
- 平均合并
- 3 天 15 小时
- 30 天内合并 PR
- 23
描述
## 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)
贡献指南
调研方向
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.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- bash, powershell, shell
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 72/100