dmux 3.0.2 → 3.1.1

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.
Files changed (102) hide show
  1. package/dist/DmuxApp.d.ts.map +1 -1
  2. package/dist/DmuxApp.js +242 -23
  3. package/dist/DmuxApp.js.map +1 -1
  4. package/dist/PaneAnalyzer.d.ts +0 -4
  5. package/dist/PaneAnalyzer.d.ts.map +1 -1
  6. package/dist/PaneAnalyzer.js +2 -17
  7. package/dist/PaneAnalyzer.js.map +1 -1
  8. package/dist/_plugin-vue_export-helper.css +1 -1
  9. package/dist/actions/paneActions.d.ts.map +1 -1
  10. package/dist/actions/paneActions.js +94 -40
  11. package/dist/actions/paneActions.js.map +1 -1
  12. package/dist/components/ActionConfirmDialog.js +1 -1
  13. package/dist/components/ActionConfirmDialog.js.map +1 -1
  14. package/dist/components/CloseOptionsDialog.d.ts.map +1 -1
  15. package/dist/components/CloseOptionsDialog.js +9 -7
  16. package/dist/components/CloseOptionsDialog.js.map +1 -1
  17. package/dist/components/FooterHelp.js +1 -1
  18. package/dist/components/FooterHelp.js.map +1 -1
  19. package/dist/components/HooksDialog.d.ts +12 -0
  20. package/dist/components/HooksDialog.d.ts.map +1 -0
  21. package/dist/components/HooksDialog.js +52 -0
  22. package/dist/components/HooksDialog.js.map +1 -0
  23. package/dist/components/MergeConfirmationDialog.d.ts.map +1 -1
  24. package/dist/components/MergeConfirmationDialog.js +2 -1
  25. package/dist/components/MergeConfirmationDialog.js.map +1 -1
  26. package/dist/components/NewPaneDialog.d.ts.map +1 -1
  27. package/dist/components/NewPaneDialog.js +1 -3
  28. package/dist/components/NewPaneDialog.js.map +1 -1
  29. package/dist/components/SettingsDialog.d.ts +16 -0
  30. package/dist/components/SettingsDialog.d.ts.map +1 -0
  31. package/dist/components/SettingsDialog.js +95 -0
  32. package/dist/components/SettingsDialog.js.map +1 -0
  33. package/dist/dashboard.js +2 -2
  34. package/dist/hooks/useAutoUpdater.js +2 -2
  35. package/dist/hooks/useAutoUpdater.js.map +1 -1
  36. package/dist/hooks/usePaneCreation.d.ts.map +1 -1
  37. package/dist/hooks/usePaneCreation.js +22 -3
  38. package/dist/hooks/usePaneCreation.js.map +1 -1
  39. package/dist/hooks/usePanes.js +2 -2
  40. package/dist/hooks/usePanes.js.map +1 -1
  41. package/dist/hooks/useTerminalWidth.d.ts.map +1 -1
  42. package/dist/hooks/useTerminalWidth.js +5 -0
  43. package/dist/hooks/useTerminalWidth.js.map +1 -1
  44. package/dist/hooks/useWorktreeActions.js +4 -4
  45. package/dist/hooks/useWorktreeActions.js.map +1 -1
  46. package/dist/server/embedded-assets.d.ts.map +1 -1
  47. package/dist/server/embedded-assets.js +251 -47
  48. package/dist/server/embedded-assets.js.map +1 -1
  49. package/dist/server/index.d.ts.map +1 -1
  50. package/dist/server/index.js +2 -1
  51. package/dist/server/index.js.map +1 -1
  52. package/dist/server/routes.d.ts.map +1 -1
  53. package/dist/server/routes.js +195 -55
  54. package/dist/server/routes.js.map +1 -1
  55. package/dist/services/ConfigWatcher.d.ts +9 -0
  56. package/dist/services/ConfigWatcher.d.ts.map +1 -1
  57. package/dist/services/ConfigWatcher.js +17 -0
  58. package/dist/services/ConfigWatcher.js.map +1 -1
  59. package/dist/services/StatusDetector.js +7 -7
  60. package/dist/services/StatusDetector.js.map +1 -1
  61. package/dist/services/TunnelService.d.ts.map +1 -1
  62. package/dist/services/TunnelService.js +25 -3
  63. package/dist/services/TunnelService.js.map +1 -1
  64. package/dist/shared/StateManager.d.ts +11 -0
  65. package/dist/shared/StateManager.d.ts.map +1 -1
  66. package/dist/shared/StateManager.js +26 -0
  67. package/dist/shared/StateManager.js.map +1 -1
  68. package/dist/types.d.ts +16 -0
  69. package/dist/types.d.ts.map +1 -1
  70. package/dist/utils/conflictResolutionPane.d.ts.map +1 -1
  71. package/dist/utils/conflictResolutionPane.js +3 -2
  72. package/dist/utils/conflictResolutionPane.js.map +1 -1
  73. package/dist/utils/generated-agents-doc.d.ts +6 -0
  74. package/dist/utils/generated-agents-doc.d.ts.map +1 -0
  75. package/dist/utils/generated-agents-doc.js +430 -0
  76. package/dist/utils/generated-agents-doc.js.map +1 -0
  77. package/dist/utils/hooks.d.ts +70 -0
  78. package/dist/utils/hooks.d.ts.map +1 -0
  79. package/dist/utils/hooks.js +216 -0
  80. package/dist/utils/hooks.js.map +1 -0
  81. package/dist/utils/hooksDocs.d.ts +42 -0
  82. package/dist/utils/hooksDocs.d.ts.map +1 -0
  83. package/dist/utils/hooksDocs.js +325 -0
  84. package/dist/utils/hooksDocs.js.map +1 -0
  85. package/dist/utils/paneCapture.d.ts +21 -0
  86. package/dist/utils/paneCapture.d.ts.map +1 -0
  87. package/dist/utils/paneCapture.js +96 -0
  88. package/dist/utils/paneCapture.js.map +1 -0
  89. package/dist/utils/paneCreation.d.ts +1 -0
  90. package/dist/utils/paneCreation.d.ts.map +1 -1
  91. package/dist/utils/paneCreation.js +90 -18
  92. package/dist/utils/paneCreation.js.map +1 -1
  93. package/dist/utils/settingsManager.d.ts +49 -0
  94. package/dist/utils/settingsManager.d.ts.map +1 -0
  95. package/dist/utils/settingsManager.js +172 -0
  96. package/dist/utils/settingsManager.js.map +1 -0
  97. package/dist/utils/tmux.d.ts.map +1 -1
  98. package/dist/utils/tmux.js +79 -20
  99. package/dist/utils/tmux.js.map +1 -1
  100. package/dist/workers/PaneWorker.js +3 -6
  101. package/dist/workers/PaneWorker.js.map +1 -1
  102. package/package.json +4 -3
@@ -0,0 +1,430 @@
1
+ /**
2
+ * Auto-generated AGENTS.md content
3
+ * DO NOT EDIT MANUALLY - run 'pnpm generate:hooks-docs' to regenerate
4
+ */
5
+ export const AGENTS_MD = `# dmux Hooks System - Agent Reference
6
+
7
+ **Auto-generated documentation for AI agents**
8
+
9
+ This document contains everything an AI agent needs to create, modify, and understand dmux hooks. It is automatically generated from the dmux source code and embedded in the binary.
10
+
11
+ ## What You're Working On
12
+
13
+ You are editing hooks for **dmux**, a tmux pane manager that creates AI-powered development workflows. Each pane runs in its own git worktree with an AI agent (Claude Code or opencode).
14
+
15
+ ## Your Goal
16
+
17
+ Create executable bash scripts in \`.dmux-hooks/\` that run automatically at key lifecycle events.
18
+
19
+ ## Quick Start
20
+
21
+ 1. **Create a hook file**: \`touch .dmux-hooks/worktree_created\`
22
+ 2. **Make it executable**: \`chmod +x .dmux-hooks/worktree_created\`
23
+ 3. **Add shebang**: Start with \`#!/bin/bash\`
24
+ 4. **Use environment variables**: Access \`$DMUX_ROOT\`, \`$DMUX_WORKTREE_PATH\`, etc.
25
+ 5. **Test it**: Set env vars manually and run the script
26
+
27
+ ## Hook Execution Model
28
+
29
+ - **Non-blocking**: Hooks run in background (detached processes)
30
+ - **Silent failures**: Hook errors are logged but don't stop dmux
31
+ - **Environment-based**: All context passed via environment variables
32
+ - **Version controlled**: Hooks in \`.dmux-hooks/\` are shared with team
33
+ - **Priority resolution**: \`.dmux-hooks/\` → \`.dmux/hooks/\` → \`~/.dmux/hooks/\`
34
+
35
+ ## Available Hooks
36
+
37
+ ### Pane Lifecycle Hooks
38
+
39
+ | Hook | When | Common Use Cases |
40
+ |------|------|------------------|
41
+ | \`before_pane_create\` | Before pane creation | Validation, notifications, pre-flight checks |
42
+ | \`pane_created\` | After pane, before worktree | Configure tmux settings, prepare environment |
43
+ | \`worktree_created\` | After full setup | Install deps, copy configs, setup git |
44
+ | \`before_pane_close\` | Before closing | Save state, backup uncommitted work |
45
+ | \`pane_closed\` | After closed | Cleanup resources, analytics, notifications |
46
+
47
+ ### Worktree Lifecycle Hooks
48
+
49
+ | Hook | When | Common Use Cases |
50
+ |------|------|------------------|
51
+ | \`before_worktree_remove\` | Before worktree removal | Archive worktree, save artifacts |
52
+ | \`worktree_removed\` | After worktree removed | Cleanup external references |
53
+
54
+ ### Merge Lifecycle Hooks
55
+
56
+ | Hook | When | Common Use Cases |
57
+ |------|------|------------------|
58
+ | \`pre_merge\` | Before merge operation | Run final tests, create backups |
59
+ | \`post_merge\` | After successful merge | Deploy, close issues, notify team |
60
+
61
+ ### Interactive Hooks (with HTTP callbacks)
62
+
63
+ | Hook | When | Common Use Cases |
64
+ |------|------|------------------|
65
+ | \`run_test\` | When tests triggered | Run test suite, report status via HTTP |
66
+ | \`run_dev\` | When dev server triggered | Start dev server, create tunnel, report URL |
67
+
68
+
69
+ ## Environment Variables
70
+
71
+ ### Always Available
72
+ \`\`\`bash
73
+ DMUX_ROOT="/path/to/project" # Project root directory
74
+ DMUX_SERVER_PORT="3142" # HTTP server port
75
+ \`\`\`
76
+
77
+ ### Pane Context (most hooks)
78
+ \`\`\`bash
79
+ DMUX_PANE_ID="dmux-1234567890" # dmux pane identifier
80
+ DMUX_SLUG="fix-auth-bug" # Branch/worktree name
81
+ DMUX_PROMPT="Fix authentication bug" # User's prompt
82
+ DMUX_AGENT="claude" # Agent type (claude|opencode)
83
+ DMUX_TMUX_PANE_ID="%38" # tmux pane ID
84
+ \`\`\`
85
+
86
+ ### Worktree Context
87
+ \`\`\`bash
88
+ DMUX_WORKTREE_PATH="/path/.dmux/worktrees/fix-auth-bug"
89
+ DMUX_BRANCH="fix-auth-bug" # Same as slug
90
+ \`\`\`
91
+
92
+ ### Merge Context
93
+ \`\`\`bash
94
+ DMUX_TARGET_BRANCH="main" # Branch being merged into
95
+ \`\`\`
96
+
97
+ ## HTTP Callback API
98
+
99
+ Interactive hooks (\`run_test\` and \`run_dev\`) can update dmux UI via HTTP.
100
+
101
+ ### Update Test Status
102
+ \`\`\`bash
103
+ curl -X PUT "http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test" \
104
+ -H "Content-Type: application/json" \
105
+ -d '{"status": "running", "output": "optional test output"}'
106
+
107
+ # Status values: "running" | "passed" | "failed"
108
+ \`\`\`
109
+
110
+ ### Update Dev Server
111
+ \`\`\`bash
112
+ curl -X PUT "http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev" \
113
+ -H "Content-Type: application/json" \
114
+ -d '{"status": "running", "url": "http://localhost:3000"}'
115
+
116
+ # Status values: "running" | "stopped"
117
+ # url: Can be localhost or tunnel URL (ngrok, cloudflared, etc.)
118
+ \`\`\`
119
+
120
+ ## Common Patterns
121
+
122
+ ### Pattern 1: Install Dependencies
123
+ \`\`\`bash
124
+ #!/bin/bash
125
+ # .dmux-hooks/worktree_created
126
+
127
+ cd "$DMUX_WORKTREE_PATH"
128
+
129
+ if [ -f "pnpm-lock.yaml" ]; then
130
+ pnpm install --prefer-offline &
131
+ elif [ -f "package-lock.json" ]; then
132
+ npm install &
133
+ elif [ -f "yarn.lock" ]; then
134
+ yarn install &
135
+ elif [ -f "Gemfile" ]; then
136
+ bundle install &
137
+ elif [ -f "requirements.txt" ]; then
138
+ pip install -r requirements.txt &
139
+ elif [ -f "Cargo.toml" ]; then
140
+ cargo build &
141
+ fi
142
+ \`\`\`
143
+
144
+ ### Pattern 2: Copy Configuration
145
+ \`\`\`bash
146
+ #!/bin/bash
147
+ # .dmux-hooks/worktree_created
148
+
149
+ # Copy environment file
150
+ if [ -f "$DMUX_ROOT/.env.local" ]; then
151
+ cp "$DMUX_ROOT/.env.local" "$DMUX_WORKTREE_PATH/.env.local"
152
+ fi
153
+
154
+ # Copy other config files
155
+ for file in .env.development .npmrc .yarnrc; do
156
+ if [ -f "$DMUX_ROOT/$file" ]; then
157
+ cp "$DMUX_ROOT/$file" "$DMUX_WORKTREE_PATH/$file"
158
+ fi
159
+ done
160
+ \`\`\`
161
+
162
+ ### Pattern 3: Run Tests with Status Updates
163
+ \`\`\`bash
164
+ #!/bin/bash
165
+ # .dmux-hooks/run_test
166
+
167
+ set -e
168
+ cd "$DMUX_WORKTREE_PATH"
169
+ API="http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test"
170
+
171
+ # Update: starting
172
+ curl -s -X PUT "$API" -H "Content-Type: application/json" \
173
+ -d '{"status": "running"}' > /dev/null
174
+
175
+ # Run tests and capture output
176
+ OUTPUT_FILE="/tmp/dmux-test-$DMUX_PANE_ID.txt"
177
+ if pnpm test > "$OUTPUT_FILE" 2>&1; then
178
+ STATUS="passed"
179
+ else
180
+ STATUS="failed"
181
+ fi
182
+
183
+ # Get output (truncate if too long)
184
+ OUTPUT=$(head -c 5000 "$OUTPUT_FILE")
185
+
186
+ # Update: complete
187
+ curl -s -X PUT "$API" -H "Content-Type: application/json" \
188
+ -d "$(jq -n --arg status "$STATUS" --arg output "$OUTPUT" \
189
+ '{status: $status, output: $output}')" > /dev/null
190
+
191
+ rm -f "$OUTPUT_FILE"
192
+ \`\`\`
193
+
194
+ ### Pattern 4: Dev Server with Tunnel
195
+ \`\`\`bash
196
+ #!/bin/bash
197
+ # .dmux-hooks/run_dev
198
+
199
+ set -e
200
+ cd "$DMUX_WORKTREE_PATH"
201
+ API="http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev"
202
+
203
+ # Start dev server in background
204
+ LOG_FILE="/tmp/dmux-dev-$DMUX_PANE_ID.log"
205
+ pnpm dev > "$LOG_FILE" 2>&1 &
206
+ DEV_PID=$!
207
+
208
+ # Wait for server to start
209
+ sleep 5
210
+
211
+ # Detect port from logs
212
+ PORT=$(grep -oP 'localhost:\K\d+' "$LOG_FILE" | head -1)
213
+ [ -z "$PORT" ] && PORT=3000
214
+
215
+ # Optional: Create tunnel with cloudflared
216
+ if command -v cloudflared &> /dev/null; then
217
+ TUNNEL=$(cloudflared tunnel --url "http://localhost:$PORT" 2>&1 | \
218
+ grep -oP 'https://[a-z0-9-]+\.trycloudflare\.com' | head -1)
219
+ URL="\${TUNNEL:-http://localhost:$PORT}"
220
+ else
221
+ URL="http://localhost:$PORT"
222
+ fi
223
+
224
+ # Report status
225
+ curl -s -X PUT "$API" -H "Content-Type: application/json" \
226
+ -d "{\"status\": \"running\", \"url\": \"$URL\"}" > /dev/null
227
+
228
+ echo "[Hook] Dev server running at $URL (PID: $DEV_PID)"
229
+ \`\`\`
230
+
231
+ ### Pattern 5: Post-Merge Deployment
232
+ \`\`\`bash
233
+ #!/bin/bash
234
+ # .dmux-hooks/post_merge
235
+
236
+ set -e
237
+ cd "$DMUX_ROOT"
238
+
239
+ # Only deploy from main/master
240
+ if [ "$DMUX_TARGET_BRANCH" != "main" ] && [ "$DMUX_TARGET_BRANCH" != "master" ]; then
241
+ exit 0
242
+ fi
243
+
244
+ # Push to remote
245
+ git push origin "$DMUX_TARGET_BRANCH"
246
+
247
+ # Trigger deployment (example: Vercel)
248
+ if [ -n "$VERCEL_TOKEN" ]; then
249
+ curl -s -X POST "https://api.vercel.com/v1/deployments" \
250
+ -H "Authorization: Bearer $VERCEL_TOKEN" \
251
+ -H "Content-Type: application/json" \
252
+ -d '{"name": "my-project"}' > /dev/null
253
+ fi
254
+
255
+ # Close GitHub issue if prompt contains #123
256
+ ISSUE=$(echo "$DMUX_PROMPT" | grep -oP '#\K\d+' | head -1)
257
+ if [ -n "$ISSUE" ] && command -v gh &> /dev/null; then
258
+ gh issue close "$ISSUE" \
259
+ -c "Resolved in $DMUX_SLUG, merged to $DMUX_TARGET_BRANCH" \
260
+ 2>/dev/null || true
261
+ fi
262
+ \`\`\`
263
+
264
+ ## Best Practices
265
+
266
+ 1. **Always start with shebang**: \`#!/bin/bash\`
267
+ 2. **Set error handling**: \`set -e\` (exit on error)
268
+ 3. **Make executable**: \`chmod +x .dmux-hooks/hook_name\`
269
+ 4. **Background long operations**: Append \`&\` to avoid blocking
270
+ 5. **Check for required tools**: \`command -v tool &> /dev/null\`
271
+ 6. **Log for debugging**: \`echo "[Hook] message" >> "$DMUX_ROOT/.dmux/hooks.log"\`
272
+ 7. **Handle missing vars gracefully**: \`[ -z "$VAR" ] && exit 0\`
273
+ 8. **Use silent curl**: \`curl -s\` to avoid noise in logs
274
+ 9. **Clean up temp files**: Remove files in \`/tmp/\`
275
+ 10. **Test before committing**: Run hooks manually with mock env vars
276
+
277
+ ## Testing Hooks
278
+
279
+ ### Manual Testing
280
+ \`\`\`bash
281
+ # 1. Set environment variables
282
+ export DMUX_ROOT="$(pwd)"
283
+ export DMUX_PANE_ID="test-pane"
284
+ export DMUX_SLUG="test-branch"
285
+ export DMUX_WORKTREE_PATH="$(pwd)"
286
+ export DMUX_SERVER_PORT="3142"
287
+ export DMUX_AGENT="claude"
288
+ export DMUX_PROMPT="Test prompt"
289
+
290
+ # 2. Run hook directly
291
+ ./.dmux-hooks/worktree_created
292
+
293
+ # 3. Check exit code
294
+ echo $? # Should be 0 for success
295
+ \`\`\`
296
+
297
+ ### Syntax Check
298
+ \`\`\`bash
299
+ # Check for syntax errors without running
300
+ bash -n ./.dmux-hooks/worktree_created
301
+ \`\`\`
302
+
303
+ ### Shellcheck (if available)
304
+ \`\`\`bash
305
+ shellcheck ./.dmux-hooks/worktree_created
306
+ \`\`\`
307
+
308
+ ## Project Context Analysis
309
+
310
+ Before creating hooks, analyze these files in the project:
311
+
312
+ ### Package Manager Detection
313
+ \`\`\`bash
314
+ # Check which package manager is used
315
+ if [ -f "pnpm-lock.yaml" ]; then
316
+ # Use: pnpm install, pnpm test, pnpm dev
317
+ elif [ -f "package-lock.json" ]; then
318
+ # Use: npm install, npm test, npm run dev
319
+ elif [ -f "yarn.lock" ]; then
320
+ # Use: yarn install, yarn test, yarn dev
321
+ fi
322
+ \`\`\`
323
+
324
+ ### Test Command Discovery
325
+ \`\`\`bash
326
+ # Read package.json to find test command
327
+ cat package.json | grep '"test"'
328
+ # Or with jq:
329
+ jq -r '.scripts.test' package.json
330
+ \`\`\`
331
+
332
+ ### Dev Command Discovery
333
+ \`\`\`bash
334
+ # Read package.json to find dev command
335
+ cat package.json | grep '"dev"'
336
+ # Or with jq:
337
+ jq -r '.scripts.dev' package.json
338
+ \`\`\`
339
+
340
+ ### Environment Variables
341
+ \`\`\`bash
342
+ # Check for .env files to copy
343
+ ls -la | grep '\.env'
344
+ \`\`\`
345
+
346
+ ### Build System
347
+ \`\`\`bash
348
+ # Detect build system
349
+ if [ -f "vite.config.ts" ]; then
350
+ # Vite project
351
+ elif [ -f "next.config.js" ]; then
352
+ # Next.js project
353
+ elif [ -f "nuxt.config.ts" ]; then
354
+ # Nuxt project
355
+ fi
356
+ \`\`\`
357
+
358
+ ## Common Mistakes to Avoid
359
+
360
+ ❌ **Blocking operations**: \`sleep 60\` (blocks dmux)
361
+ ✅ **Background long tasks**: \`slow_operation &\`
362
+
363
+ ❌ **Hardcoded paths**: \`/Users/me/project\`
364
+ ✅ **Use variables**: \`"$DMUX_ROOT"\`
365
+
366
+ ❌ **Assuming tools exist**: \`pnpm install\`
367
+ ✅ **Check first**: \`command -v pnpm && pnpm install\`
368
+
369
+ ❌ **No error handling**: Script fails silently
370
+ ✅ **Set error mode**: \`set -e\` or check exit codes
371
+
372
+ ❌ **Forgetting executable bit**: Hook won't run
373
+ ✅ **Make executable**: \`chmod +x\`
374
+
375
+ ❌ **Noisy output**: Clutters dmux logs
376
+ ✅ **Silent operations**: \`curl -s\`, \`> /dev/null 2>&1\`
377
+
378
+ ❌ **Not testing**: Deploy and hope
379
+ ✅ **Test manually**: Run with mock env vars first
380
+
381
+ ## Debugging
382
+
383
+ If a hook isn't working:
384
+
385
+ 1. **Check if file exists**: \`ls -la .dmux-hooks/\`
386
+ 2. **Check permissions**: Should show \`x\` in \`rwxr-xr-x\`
387
+ 3. **Check syntax**: \`bash -n .dmux-hooks/hook_name\`
388
+ 4. **Test manually**: Set env vars and run
389
+ 5. **Check logs**: dmux logs to stderr with \`[Hooks]\` prefix
390
+ 6. **Simplify**: Remove complex parts, test basic version
391
+ 7. **Check tool availability**: \`command -v required_tool\`
392
+
393
+ ### Debug Mode
394
+ \`\`\`bash
395
+ #!/bin/bash
396
+ # Add to top of hook for debugging
397
+ set -x # Print each command before executing
398
+ set -e # Exit on error
399
+
400
+ # Your hook logic here
401
+ \`\`\`
402
+
403
+ ## Summary Checklist
404
+
405
+ When creating a new hook:
406
+
407
+ - [ ] Create file in \`.dmux-hooks/\`
408
+ - [ ] Add shebang: \`#!/bin/bash\`
409
+ - [ ] Make executable: \`chmod +x\`
410
+ - [ ] Add \`set -e\` for error handling
411
+ - [ ] Use environment variables (never hardcode paths)
412
+ - [ ] Background long operations with \`&\`
413
+ - [ ] Check for required tools before using
414
+ - [ ] Test manually with mock env vars
415
+ - [ ] Add comments explaining what it does
416
+ - [ ] Commit to version control
417
+
418
+ ## Getting Help
419
+
420
+ - **Full documentation**: See \`HOOKS.md\` in project root
421
+ - **Claude-specific tips**: See \`CLAUDE.md\` in \`.dmux-hooks/\`
422
+ - **Examples**: Check \`.dmux-hooks/examples/\` directory
423
+ - **dmux API**: See \`API.md\` for REST endpoints
424
+
425
+ ---
426
+
427
+ *This documentation was auto-generated from dmux source code.*
428
+ *Version: 2025-10-13*
429
+ `;
430
+ //# sourceMappingURL=generated-agents-doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-agents-doc.js","sourceRoot":"","sources":["../../src/utils/generated-agents-doc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwaxB,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Hooks System
3
+ *
4
+ * Executes user-defined scripts at key lifecycle events.
5
+ * Hook scripts are stored in .dmux/hooks/ and receive context via environment variables.
6
+ */
7
+ import type { DmuxPane } from '../types.js';
8
+ /**
9
+ * Available hook types
10
+ */
11
+ export type HookType = 'before_pane_create' | 'pane_created' | 'worktree_created' | 'before_pane_close' | 'pane_closed' | 'before_worktree_remove' | 'worktree_removed' | 'pre_merge' | 'post_merge' | 'run_test' | 'run_dev';
12
+ /**
13
+ * Environment data for hooks
14
+ */
15
+ export interface HookEnvironment {
16
+ DMUX_ROOT: string;
17
+ DMUX_SERVER_PORT?: string;
18
+ DMUX_PANE_ID?: string;
19
+ DMUX_SLUG?: string;
20
+ DMUX_PROMPT?: string;
21
+ DMUX_AGENT?: string;
22
+ DMUX_TMUX_PANE_ID?: string;
23
+ DMUX_WORKTREE_PATH?: string;
24
+ DMUX_BRANCH?: string;
25
+ DMUX_TARGET_BRANCH?: string;
26
+ [key: string]: string | undefined;
27
+ }
28
+ /**
29
+ * Find a hook script with priority resolution:
30
+ * 1. .dmux-hooks/ (version controlled, team hooks)
31
+ * 2. .dmux/hooks/ (gitignored, local overrides)
32
+ * 3. ~/.dmux/hooks/ (global user hooks)
33
+ */
34
+ export declare function findHook(projectRoot: string, hookName: HookType): string | null;
35
+ /**
36
+ * Build environment variables for a hook
37
+ */
38
+ export declare function buildHookEnvironment(projectRoot: string, pane?: DmuxPane, extraData?: Record<string, string>): Promise<HookEnvironment>;
39
+ /**
40
+ * Execute a hook script asynchronously
41
+ *
42
+ * Hooks run in the background and don't block dmux operations.
43
+ * Errors are logged but don't crash the application.
44
+ */
45
+ export declare function triggerHook(hookName: HookType, projectRoot: string, pane?: DmuxPane, extraData?: Record<string, string>): Promise<void>;
46
+ /**
47
+ * Execute a hook synchronously (blocking)
48
+ *
49
+ * Use sparingly - only for hooks that MUST complete before proceeding.
50
+ * Most hooks should use triggerHook() instead.
51
+ */
52
+ export declare function triggerHookSync(hookName: HookType, projectRoot: string, pane?: DmuxPane, extraData?: Record<string, string>, timeoutMs?: number): Promise<{
53
+ success: boolean;
54
+ output?: string;
55
+ error?: string;
56
+ }>;
57
+ /**
58
+ * Check if a hook exists for a given hook type
59
+ */
60
+ export declare function hasHook(projectRoot: string, hookName: HookType): boolean;
61
+ /**
62
+ * List all available hooks in the project
63
+ */
64
+ export declare function listAvailableHooks(projectRoot: string): HookType[];
65
+ /**
66
+ * Initialize .dmux-hooks/ directory with documentation and examples
67
+ * This gets called the first time hooks are accessed or when user explicitly initializes
68
+ */
69
+ export declare function initializeHooksDirectory(projectRoot: string): void;
70
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/utils/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,oBAAoB,GACpB,cAAc,GACd,kBAAkB,GAClB,mBAAmB,GACnB,aAAa,GACb,wBAAwB,GACxB,kBAAkB,GAClB,WAAW,GACX,YAAY,GACZ,UAAU,GACV,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,eAAe;IAE9B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAG3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAqB/E;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,QAAQ,EACf,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC,eAAe,CAAC,CAiC1B;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,QAAQ,EACf,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC,CA4Cf;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,QAAQ,EACf,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,SAAS,GAAE,MAAc,GACxB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA+BhE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAExE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,EAAE,CAgBlE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAyDlE"}