Skip to content

Commit 7965471

Browse files
Merge pull request #41 from johnlindquist/feat/add-session-dir-flag
feat: add --session-dir flag to print temp session directory path
2 parents ab71158 + 7ec7129 commit 7965471

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

templates/hooks/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bun
22

3+
import {tmpdir} from 'node:os'
4+
import * as path from 'node:path'
35
import type {
46
NotificationPayload,
57
PostToolUsePayload,
@@ -12,10 +14,17 @@ import type {
1214
UserPromptSubmitPayload,
1315
UserPromptSubmitResponse,
1416
} from './lib'
15-
1617
import {runHook} from './lib'
1718
import {saveSessionData} from './session'
1819

20+
// Check for --session-dir flag
21+
const args = process.argv.slice(2)
22+
if (args.includes('--session-dir')) {
23+
const SESSIONS_DIR = path.join(tmpdir(), 'claude-hooks-sessions')
24+
console.log(SESSIONS_DIR)
25+
process.exit(0)
26+
}
27+
1928
// PreToolUse handler - called before Claude uses any tool
2029
async function preToolUse(payload: PreToolUsePayload): Promise<PreToolUseResponse> {
2130
// Save session data (optional - remove if not needed)

0 commit comments

Comments
 (0)