addyosmani / addyosmani/agent-skills

SessionStart hook fails on Windows (bash syntax run through pwsh)

未关闭
#488 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
93.8k
派生
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)

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。