Skip to content

Commit b7de434

Browse files
authored
add CCfW hooks (#22803)
Shamelessly lifted from uv. Biggest win here is giving CCfW access to the `gh` CLI tool, which it always otherwise tries and fails to use.
1 parent b912dfc commit b7de434

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

.claude/hooks/session-start-web.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Install `gh`
5+
if ! command -v gh &> /dev/null; then
6+
apt-get update -qq
7+
apt-get install -y -qq gh
8+
fi
9+
10+
# Install clippy and rustfmt for the active toolchain.
11+
rustup component add clippy rustfmt

.claude/hooks/session-start.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Dispatch to web hook if running remotely
5+
if [ "${CLAUDE_CODE_REMOTE:-}" = "true" ]; then
6+
exec "$(dirname "$0")/session-start-web.sh"
7+
fi

.claude/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"hooks": {
3+
"SessionStart": [
4+
{
5+
"matcher": "startup",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": ".claude/hooks/session-start.sh"
10+
}
11+
]
12+
}
13+
]
14+
}
15+
}

0 commit comments

Comments
 (0)