This repository was archived by the owner on Apr 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup
More file actions
executable file
·292 lines (266 loc) · 8.79 KB
/
Copy pathsetup
File metadata and controls
executable file
·292 lines (266 loc) · 8.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/usr/bin/env bash
# breeze setup — installs the poller, statusline hook, and skill symlink
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BREEZE_DIR="${BREEZE_DIR:-$HOME/.breeze}"
SKILL_DIR="$HOME/.claude/skills"
echo "=== breeze setup ==="
echo ""
# 1. Check prerequisites
echo "Checking prerequisites..."
if ! command -v gh &>/dev/null; then
echo "ERROR: gh CLI is not installed. Install it: https://cli.github.com/"
exit 1
fi
if ! gh auth status &>/dev/null; then
echo "ERROR: gh is not authenticated. Run 'gh auth login' first."
exit 1
fi
if ! command -v jq &>/dev/null; then
echo "ERROR: jq is not installed. Install it: brew install jq (macOS) or apt install jq (Linux)"
exit 1
fi
echo " gh CLI: OK"
echo " jq: OK"
echo ""
# 2. Create breeze directory and default config
echo "Setting up ~/.breeze..."
mkdir -p "$BREEZE_DIR"
if [ ! -f "$BREEZE_DIR/config.yaml" ]; then
cat > "$BREEZE_DIR/config.yaml" << 'EOF'
# breeze configuration
# List specific repos to watch, or remove this section to watch all
repos:
- all
# Poll interval in seconds (used by launchd/crontab)
poll_interval: 180
# Append footer to comments/reviews posted by breeze
footer: true
# Automatically mark notifications as read after polling
auto_mark_read: false
# Priority ordering (highest first)
priority:
- review_requested
- mention
- assign
- participating
EOF
echo " Created default config at $BREEZE_DIR/config.yaml"
else
echo " Config already exists at $BREEZE_DIR/config.yaml"
fi
echo ""
# 3. Make scripts executable
echo "Making scripts executable..."
chmod +x "$SCRIPT_DIR/bin/breeze-poll"
chmod +x "$SCRIPT_DIR/bin/breeze-status"
echo " OK"
echo ""
# Detect Rust toolchain — if present, prefer the unified breeze-runner daemon
# over the legacy shell poller.
USE_RUNNER=0
RUNNER_BIN=""
if command -v cargo &>/dev/null; then
echo "Building breeze-runner (release)..."
if cargo build --release --manifest-path "$SCRIPT_DIR/breeze-runner/Cargo.toml" 2>&1 | tail -5; then
RUNNER_BIN="$SCRIPT_DIR/breeze-runner/target/release/breeze-runner"
if [ -x "$RUNNER_BIN" ]; then
USE_RUNNER=1
echo " breeze-runner built at $RUNNER_BIN"
fi
else
echo " WARN: cargo build failed; falling back to shell poller"
fi
echo ""
fi
# 4. Install skill symlink
echo "Installing Claude Code skill..."
mkdir -p "$SKILL_DIR"
if [ -L "$SKILL_DIR/breeze" ] || [ -d "$SKILL_DIR/breeze" ]; then
rm -rf "$SKILL_DIR/breeze"
fi
ln -s "$SCRIPT_DIR/skill" "$SKILL_DIR/breeze"
echo " Symlinked $SKILL_DIR/breeze -> $SCRIPT_DIR/skill"
if [ -L "$SKILL_DIR/breeze-watch" ] || [ -d "$SKILL_DIR/breeze-watch" ]; then
rm -rf "$SKILL_DIR/breeze-watch"
fi
ln -s "$SCRIPT_DIR/skill-watch" "$SKILL_DIR/breeze-watch"
echo " Symlinked $SKILL_DIR/breeze-watch -> $SCRIPT_DIR/skill-watch"
if [ -L "$SKILL_DIR/breeze-upgrade" ] || [ -d "$SKILL_DIR/breeze-upgrade" ]; then
rm -rf "$SKILL_DIR/breeze-upgrade"
fi
ln -s "$SCRIPT_DIR/skill-upgrade" "$SKILL_DIR/breeze-upgrade"
echo " Symlinked $SKILL_DIR/breeze-upgrade -> $SCRIPT_DIR/skill-upgrade"
echo ""
# 5. Install service (platform-specific)
echo "Installing service..."
if [ "$(uname)" = "Darwin" ]; then
PLIST_DIR="$HOME/Library/LaunchAgents"
mkdir -p "$PLIST_DIR"
# Always clean up any prior breeze-poll plist — the runner supersedes it.
LEGACY_PLIST="$PLIST_DIR/com.breeze.poll.plist"
if [ -f "$LEGACY_PLIST" ]; then
launchctl unload "$LEGACY_PLIST" 2>/dev/null || true
rm -f "$LEGACY_PLIST"
echo " Removed legacy com.breeze.poll.plist"
fi
if [ "$USE_RUNNER" = "1" ]; then
PLIST_FILE="$PLIST_DIR/com.breeze.runner.plist"
launchctl unload "$PLIST_FILE" 2>/dev/null || true
cat > "$PLIST_FILE" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.breeze.runner</string>
<key>ProgramArguments</key>
<array>
<string>$RUNNER_BIN</string>
<string>run</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>$BREEZE_DIR/runner.log</string>
<key>StandardErrorPath</key>
<string>$BREEZE_DIR/runner-error.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
<key>BREEZE_DIR</key>
<string>$BREEZE_DIR</string>
</dict>
</dict>
</plist>
EOF
launchctl load "$PLIST_FILE"
echo " Installed unified daemon plist at $PLIST_FILE"
echo " Dashboard: http://127.0.0.1:7878"
else
PLIST_FILE="$PLIST_DIR/com.breeze.poll.plist"
cat > "$PLIST_FILE" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.breeze.poll</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>$SCRIPT_DIR/bin/breeze-poll</string>
</array>
<key>StartInterval</key>
<integer>60</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>$BREEZE_DIR/poll.log</string>
<key>StandardErrorPath</key>
<string>$BREEZE_DIR/poll-error.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
</dict>
</dict>
</plist>
EOF
launchctl load "$PLIST_FILE"
echo " Installed legacy shell poller at $PLIST_FILE"
echo " (install Rust + cargo and re-run setup for the unified daemon + dashboard)"
fi
else
# Linux: crontab — shell poller path. systemd unit for the runner is out
# of scope here; run \`breeze-runner start\` manually for now.
CRON_CMD="* * * * * /bin/bash $SCRIPT_DIR/bin/breeze-poll >> $BREEZE_DIR/poll.log 2>&1"
(crontab -l 2>/dev/null | grep -v breeze-poll; echo "$CRON_CMD") | crontab -
echo " Installed crontab entry (every minute)"
if [ "$USE_RUNNER" = "1" ]; then
echo " For the unified daemon + dashboard, also run: $RUNNER_BIN start"
fi
fi
echo ""
# 6. Install statusline
echo "Installing statusline..."
SETTINGS_FILE="$HOME/.claude/settings.json"
BREEZE_STATUS_CMD="$SCRIPT_DIR/bin/breeze-status"
if [ -f "$SETTINGS_FILE" ]; then
CURRENT_CMD=$(jq -r '.statusLine.command // empty' "$SETTINGS_FILE" 2>/dev/null)
if [ -n "$CURRENT_CMD" ]; then
if echo "$CURRENT_CMD" | grep -q "breeze-status"; then
echo " Statusline already includes breeze"
else
# Chain breeze output as an additional line after the existing statusline
# Use a wrapper that runs both and combines output
WRAPPER="$SCRIPT_DIR/bin/breeze-statusline-wrapper"
cat > "$WRAPPER" << WEOF
#!/usr/bin/env bash
# Runs existing statusline command, then appends breeze status
INPUT=\$(cat)
EXISTING=\$(echo "\$INPUT" | $CURRENT_CMD 2>/dev/null || true)
BREEZE=\$(echo "\$INPUT" | $BREEZE_STATUS_CMD 2>/dev/null || true)
[ -n "\$EXISTING" ] && echo "\$EXISTING"
[ -n "\$BREEZE" ] && echo "\$BREEZE"
WEOF
chmod +x "$WRAPPER"
# Update settings.json
TMP_SETTINGS=$(mktemp)
jq --arg cmd "$WRAPPER" '.statusLine.command = $cmd | .statusLine.refreshInterval = 1' "$SETTINGS_FILE" > "$TMP_SETTINGS"
mv "$TMP_SETTINGS" "$SETTINGS_FILE"
echo " Chained breeze into existing statusline"
echo " Previous: $CURRENT_CMD"
echo " Wrapper: $WRAPPER"
fi
else
# No existing statusline, install breeze directly
TMP_SETTINGS=$(mktemp)
jq --arg cmd "$BREEZE_STATUS_CMD" '.statusLine = {"type":"command","command":$cmd,"refreshInterval":60}' "$SETTINGS_FILE" > "$TMP_SETTINGS"
mv "$TMP_SETTINGS" "$SETTINGS_FILE"
echo " Installed breeze as statusline command"
fi
else
echo " WARN: ~/.claude/settings.json not found. Add statusline manually."
fi
echo ""
# 7. Run initial poll
echo "Running initial poll..."
if [ "$USE_RUNNER" = "1" ]; then
"$RUNNER_BIN" poll || true
else
bash "$SCRIPT_DIR/bin/breeze-poll"
fi
echo ""
# 8. Show status
echo "=== Setup complete ==="
echo ""
echo " Inbox: $BREEZE_DIR/inbox.json"
echo " Config: $BREEZE_DIR/config.yaml"
echo " Skill: $SKILL_DIR/breeze"
if [ "$USE_RUNNER" = "1" ]; then
echo " Logs: $BREEZE_DIR/runner.log"
echo " Dashboard: http://127.0.0.1:7878"
else
echo " Logs: $BREEZE_DIR/poll.log"
fi
echo ""
echo "Usage:"
echo " /breeze — open your notification inbox in Claude Code"
if [ "$USE_RUNNER" = "1" ]; then
echo " open http://127.0.0.1:7878 — live dashboard in your browser"
fi
echo ""
echo "To stop the service:"
if [ "$(uname)" = "Darwin" ]; then
if [ "$USE_RUNNER" = "1" ]; then
echo " launchctl unload ~/Library/LaunchAgents/com.breeze.runner.plist"
else
echo " launchctl unload ~/Library/LaunchAgents/com.breeze.poll.plist"
fi
else
echo " crontab -e (remove the breeze-poll line)"
fi