@yeongjaeyou/claude-code-config 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ #!/bin/bash
2
+ # Claude Code OSC Notification Script
3
+ # /dev/tty로 출력하여 터미널에 직접 전달
4
+
5
+ # stdin에서 JSON 읽기 (timeout으로 blocking 방지)
6
+ INPUT=$(timeout 1 cat 2>/dev/null || true)
7
+
8
+ # JSON 파싱
9
+ if command -v jq &>/dev/null && [ -n "$INPUT" ]; then
10
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
11
+ CWD=$(echo "$INPUT" | jq -r '.cwd // empty' 2>/dev/null)
12
+ EVENT=$(echo "$INPUT" | jq -r '.hook_event_name // empty' 2>/dev/null)
13
+ NOTIF_TYPE=$(echo "$INPUT" | jq -r '.notification_type // empty' 2>/dev/null)
14
+ MESSAGE=$(echo "$INPUT" | jq -r '.message // empty' 2>/dev/null)
15
+
16
+ FOLDER=$(basename "${CWD:-$PWD}" 2>/dev/null)
17
+ SHORT_ID="${SESSION_ID:0:8}"
18
+
19
+ # 제목 구성
20
+ TITLE="Claude"
21
+ [ -n "$FOLDER" ] && TITLE="$TITLE - $FOLDER"
22
+ [ -n "$SHORT_ID" ] && TITLE="$TITLE [$SHORT_ID]"
23
+
24
+ # 본문 구성
25
+ case "$EVENT" in
26
+ "Stop")
27
+ BODY="Task completed"
28
+ ;;
29
+ "Notification")
30
+ case "$NOTIF_TYPE" in
31
+ "permission_prompt") BODY="Permission needed" ;;
32
+ "idle_prompt") BODY="Waiting for input" ;;
33
+ *) BODY="${MESSAGE:-$NOTIF_TYPE}" ;;
34
+ esac
35
+ ;;
36
+ *)
37
+ BODY="${MESSAGE:-Notification}"
38
+ ;;
39
+ esac
40
+ else
41
+ TITLE="${1:-Claude Code}"
42
+ BODY="${2:-Task completed}"
43
+ fi
44
+
45
+ # OSC 777 알림 출력 (OSC 9는 중복 알림 발생하므로 제외)
46
+ # /dev/tty 사용 가능 시 직접 출력, 아니면 stdout
47
+ {
48
+ printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY"
49
+ } > /dev/tty 2>/dev/null || {
50
+ printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY"
51
+ }
52
+
53
+ exit 0
package/README.md CHANGED
@@ -267,6 +267,27 @@ cp node_modules/@yeongjaeyou/claude-code-config/.mcp.json .
267
267
  - Hugging Face model/dataset/Spaces search via `huggingface_hub` API
268
268
  - Download and analyze source code in temp directory (`/tmp/`)
269
269
 
270
+ ## Notification Hooks
271
+
272
+ Desktop notifications for Claude Code events using OSC escape sequences.
273
+
274
+ ### Quick Setup
275
+
276
+ ```bash
277
+ # 1. Install Terminal Notification extension in VSCode
278
+ # 2. Global install includes notify_osc.sh and auto-registers hooks
279
+ npx @yeongjaeyou/claude-code-config --global
280
+ ```
281
+
282
+ ### Supported Events
283
+
284
+ | Event | Description |
285
+ |-------|-------------|
286
+ | Stop | Task completion |
287
+ | Notification | Permission requests, idle prompts |
288
+
289
+ See [docs/notification-setup.md](docs/notification-setup.md) for detailed setup guide.
290
+
270
291
  ## License
271
292
 
272
293
  MIT License
package/bin/cli.js CHANGED
@@ -180,6 +180,33 @@ const DEFAULT_HOOKS_CONFIG = {
180
180
  ]
181
181
  };
182
182
 
183
+ // Global-only notification hooks (OSC desktop alerts)
184
+ const GLOBAL_NOTIFICATION_HOOKS = {
185
+ Stop: [
186
+ {
187
+ hooks: [
188
+ {
189
+ type: 'command',
190
+ command: '~/.claude/hooks/notify_osc.sh',
191
+ timeout: 10
192
+ }
193
+ ]
194
+ }
195
+ ],
196
+ Notification: [
197
+ {
198
+ matcher: '',
199
+ hooks: [
200
+ {
201
+ type: 'command',
202
+ command: '~/.claude/hooks/notify_osc.sh',
203
+ timeout: 10
204
+ }
205
+ ]
206
+ }
207
+ ]
208
+ };
209
+
183
210
  /**
184
211
  * Check if a hook with the same command already exists
185
212
  * @param {Array} hooks - Existing hooks array
@@ -232,6 +259,22 @@ function mergeSettingsJson() {
232
259
  console.log('inject-guidelines hook already exists in settings.json');
233
260
  }
234
261
 
262
+ // Add notification hooks for global install only
263
+ if (isGlobal) {
264
+ for (const [event, hookConfigs] of Object.entries(GLOBAL_NOTIFICATION_HOOKS)) {
265
+ if (!settings.hooks[event]) {
266
+ settings.hooks[event] = [];
267
+ }
268
+ const notifCommand = hookConfigs[0].hooks[0].command;
269
+ if (!hookExists(settings.hooks[event], notifCommand)) {
270
+ settings.hooks[event].push(hookConfigs[0]);
271
+ console.log(`Added ${event} notification hook to settings.json`);
272
+ } else {
273
+ console.log(`${event} notification hook already exists in settings.json`);
274
+ }
275
+ }
276
+ }
277
+
235
278
  // Write merged settings
236
279
  try {
237
280
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
@@ -337,6 +380,13 @@ async function main() {
337
380
  if (isGlobal) {
338
381
  console.log('Global installation complete.');
339
382
  console.log('Claude Code commands are now available in all projects.');
383
+ console.log('');
384
+ console.log('Desktop notifications enabled:');
385
+ console.log(' - Stop: Task completion alerts');
386
+ console.log(' - Notification: Permission/idle prompts');
387
+ console.log('');
388
+ console.log('Note: Install "Terminal Notification" VSCode extension for alerts.');
389
+ console.log('See docs/notification-setup.md for detailed setup guide.');
340
390
  }
341
391
  }
342
392
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeongjaeyou/claude-code-config",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Claude Code CLI custom commands, agents, and skills",
5
5
  "bin": {
6
6
  "claude-code-config": "./bin/cli.js"