claude-mux 0.7.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.
- package/.beads/README.md +81 -0
- package/.beads/config.yaml +62 -0
- package/.beads/interactions.jsonl +0 -0
- package/.beads/issues.jsonl +5 -0
- package/.beads/metadata.json +4 -0
- package/.eslintrc.json +25 -0
- package/.gitattributes +3 -0
- package/.prettierrc +7 -0
- package/CLAUDE.md +123 -0
- package/LICENSE +21 -0
- package/PLAN-beads-integration.md +250 -0
- package/README.md +366 -0
- package/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +147 -0
- package/dist/app.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +65 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +5 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/serve.d.ts +8 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +59 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/setup.d.ts +4 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +12 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/tui.d.ts +9 -0
- package/dist/commands/tui.d.ts.map +1 -0
- package/dist/commands/tui.js +234 -0
- package/dist/commands/tui.js.map +1 -0
- package/dist/commands/uninstall.d.ts +4 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +12 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/components/Header.d.ts +7 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +14 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/HelpDialog.d.ts +6 -0
- package/dist/components/HelpDialog.d.ts.map +1 -0
- package/dist/components/HelpDialog.js +14 -0
- package/dist/components/HelpDialog.js.map +1 -0
- package/dist/components/SessionEntry.d.ts +17 -0
- package/dist/components/SessionEntry.d.ts.map +1 -0
- package/dist/components/SessionEntry.js +102 -0
- package/dist/components/SessionEntry.js.map +1 -0
- package/dist/components/SessionList.d.ts +14 -0
- package/dist/components/SessionList.d.ts.map +1 -0
- package/dist/components/SessionList.js +57 -0
- package/dist/components/SessionList.js.map +1 -0
- package/dist/components/StatusBar.d.ts +6 -0
- package/dist/components/StatusBar.d.ts.map +1 -0
- package/dist/components/StatusBar.js +7 -0
- package/dist/components/StatusBar.js.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +6 -0
- package/dist/components/index.js.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +3 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +4 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +23 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/sessions-json.d.ts +85 -0
- package/dist/db/sessions-json.d.ts.map +1 -0
- package/dist/db/sessions-json.js +242 -0
- package/dist/db/sessions-json.js.map +1 -0
- package/dist/db/sessions.d.ts +38 -0
- package/dist/db/sessions.d.ts.map +1 -0
- package/dist/db/sessions.js +87 -0
- package/dist/db/sessions.js.map +1 -0
- package/dist/hooks/claude-mux-hook.d.ts +15 -0
- package/dist/hooks/claude-mux-hook.d.ts.map +1 -0
- package/dist/hooks/claude-mux-hook.js +396 -0
- package/dist/hooks/claude-mux-hook.js.map +1 -0
- package/dist/hooks/claude-watch-hook.d.ts +15 -0
- package/dist/hooks/claude-watch-hook.d.ts.map +1 -0
- package/dist/hooks/claude-watch-hook.js +396 -0
- package/dist/hooks/claude-watch-hook.js.map +1 -0
- package/dist/server/custom-server.d.ts +13 -0
- package/dist/server/custom-server.d.ts.map +1 -0
- package/dist/server/custom-server.js +63 -0
- package/dist/server/custom-server.js.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +1143 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/middleware/cors.d.ts +2 -0
- package/dist/server/middleware/cors.d.ts.map +1 -0
- package/dist/server/middleware/cors.js +11 -0
- package/dist/server/middleware/cors.js.map +1 -0
- package/dist/server/routes/sessions.d.ts +3 -0
- package/dist/server/routes/sessions.d.ts.map +1 -0
- package/dist/server/routes/sessions.js +78 -0
- package/dist/server/routes/sessions.js.map +1 -0
- package/dist/server/routes/stream.d.ts +3 -0
- package/dist/server/routes/stream.d.ts.map +1 -0
- package/dist/server/routes/stream.js +45 -0
- package/dist/server/routes/stream.js.map +1 -0
- package/dist/server/types.d.ts +28 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server/watcher.d.ts +22 -0
- package/dist/server/watcher.d.ts.map +1 -0
- package/dist/server/watcher.js +119 -0
- package/dist/server/watcher.js.map +1 -0
- package/dist/server/websocket.d.ts +51 -0
- package/dist/server/websocket.d.ts.map +1 -0
- package/dist/server/websocket.js +156 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/server/ws-handlers.d.ts +174 -0
- package/dist/server/ws-handlers.d.ts.map +1 -0
- package/dist/server/ws-handlers.js +695 -0
- package/dist/server/ws-handlers.js.map +1 -0
- package/dist/setup/hooks.d.ts +44 -0
- package/dist/setup/hooks.d.ts.map +1 -0
- package/dist/setup/hooks.js +267 -0
- package/dist/setup/hooks.js.map +1 -0
- package/dist/setup/index.d.ts +3 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +3 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/setup/wizard.d.ts +4 -0
- package/dist/setup/wizard.d.ts.map +1 -0
- package/dist/setup/wizard.js +72 -0
- package/dist/setup/wizard.js.map +1 -0
- package/dist/tmux/detect.d.ts +25 -0
- package/dist/tmux/detect.d.ts.map +1 -0
- package/dist/tmux/detect.js +71 -0
- package/dist/tmux/detect.js.map +1 -0
- package/dist/tmux/navigate.d.ts +13 -0
- package/dist/tmux/navigate.d.ts.map +1 -0
- package/dist/tmux/navigate.js +41 -0
- package/dist/tmux/navigate.js.map +1 -0
- package/dist/tmux/pane.d.ts +57 -0
- package/dist/tmux/pane.d.ts.map +1 -0
- package/dist/tmux/pane.js +156 -0
- package/dist/tmux/pane.js.map +1 -0
- package/dist/tmux/resize.d.ts +10 -0
- package/dist/tmux/resize.d.ts.map +1 -0
- package/dist/tmux/resize.js +25 -0
- package/dist/tmux/resize.js.map +1 -0
- package/dist/utils/paths.d.ts +7 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +9 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/pid.d.ts +5 -0
- package/dist/utils/pid.d.ts.map +1 -0
- package/dist/utils/pid.js +14 -0
- package/dist/utils/pid.js.map +1 -0
- package/dist/utils/version.d.ts +6 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +6 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/web/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
- package/dist/web/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
- package/dist/web/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
- package/dist/web/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
- package/dist/web/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
- package/dist/web/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
- package/dist/web/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
- package/dist/web/client/_app/immutable/chunks/C9P-coqM.js +1 -0
- package/dist/web/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
- package/dist/web/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
- package/dist/web/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
- package/dist/web/client/_app/immutable/chunks/HKNo9LID.js +5 -0
- package/dist/web/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
- package/dist/web/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
- package/dist/web/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
- package/dist/web/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
- package/dist/web/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
- package/dist/web/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
- package/dist/web/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
- package/dist/web/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
- package/dist/web/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
- package/dist/web/client/_app/version.json +1 -0
- package/dist/web/client/robots.txt +3 -0
- package/dist/web/env.js +32 -0
- package/dist/web/handler.js +744 -0
- package/dist/web/index.js +49 -0
- package/dist/web/server/chunks/0-BHWsmCJv.js +23 -0
- package/dist/web/server/chunks/0-BHWsmCJv.js.map +1 -0
- package/dist/web/server/chunks/1-YRx6A8Tm.js +17 -0
- package/dist/web/server/chunks/1-YRx6A8Tm.js.map +1 -0
- package/dist/web/server/chunks/2-eC6JuGAo.js +22 -0
- package/dist/web/server/chunks/2-eC6JuGAo.js.map +1 -0
- package/dist/web/server/chunks/3-Bk-wV20p.js +32 -0
- package/dist/web/server/chunks/3-Bk-wV20p.js.map +1 -0
- package/dist/web/server/chunks/4-nteBgDrW.js +21 -0
- package/dist/web/server/chunks/4-nteBgDrW.js.map +1 -0
- package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js +35 -0
- package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js.map +1 -0
- package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js +453 -0
- package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js.map +1 -0
- package/dist/web/server/chunks/_page.svelte-Be6iabRn.js +34 -0
- package/dist/web/server/chunks/_page.svelte-Be6iabRn.js.map +1 -0
- package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js +576 -0
- package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js.map +1 -0
- package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js +2722 -0
- package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-3WAmKvn2.js +34 -0
- package/dist/web/server/chunks/_server.ts-3WAmKvn2.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BAWJCSFb.js +29 -0
- package/dist/web/server/chunks/_server.ts-BAWJCSFb.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BPpMOZCm.js +24 -0
- package/dist/web/server/chunks/_server.ts-BPpMOZCm.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BUKgRb6U.js +13 -0
- package/dist/web/server/chunks/_server.ts-BUKgRb6U.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BVHUS8fm.js +41 -0
- package/dist/web/server/chunks/_server.ts-BVHUS8fm.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BrF3od0O.js +45 -0
- package/dist/web/server/chunks/_server.ts-BrF3od0O.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-C4oPmOJR.js +38 -0
- package/dist/web/server/chunks/_server.ts-C4oPmOJR.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-CDAUUmG_.js +21 -0
- package/dist/web/server/chunks/_server.ts-CDAUUmG_.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-CR0uWvpz.js +24 -0
- package/dist/web/server/chunks/_server.ts-CR0uWvpz.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-CSqdCNGi.js +21 -0
- package/dist/web/server/chunks/_server.ts-CSqdCNGi.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-DI9fzUo9.js +52 -0
- package/dist/web/server/chunks/_server.ts-DI9fzUo9.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-DNjJTClI.js +46 -0
- package/dist/web/server/chunks/_server.ts-DNjJTClI.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-DdbOAkOj.js +22 -0
- package/dist/web/server/chunks/_server.ts-DdbOAkOj.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-Df2isGQc.js +41 -0
- package/dist/web/server/chunks/_server.ts-Df2isGQc.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-Vpw25_-3.js +12 -0
- package/dist/web/server/chunks/_server.ts-Vpw25_-3.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-WldRpSRi.js +26 -0
- package/dist/web/server/chunks/_server.ts-WldRpSRi.js.map +1 -0
- package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js +2890 -0
- package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js.map +1 -0
- package/dist/web/server/chunks/auth-DrUf-v4J.js +51 -0
- package/dist/web/server/chunks/auth-DrUf-v4J.js.map +1 -0
- package/dist/web/server/chunks/button-D6xS9rHt.js +2335 -0
- package/dist/web/server/chunks/button-D6xS9rHt.js.map +1 -0
- package/dist/web/server/chunks/chunk-EKzHsMy_.js +42 -0
- package/dist/web/server/chunks/chunks-DmdqVYC7.js +58 -0
- package/dist/web/server/chunks/chunks-DmdqVYC7.js.map +1 -0
- package/dist/web/server/chunks/client-CUrSQijh.js +18 -0
- package/dist/web/server/chunks/client-CUrSQijh.js.map +1 -0
- package/dist/web/server/chunks/clsx-FzI4_gi0.js +332 -0
- package/dist/web/server/chunks/clsx-FzI4_gi0.js.map +1 -0
- package/dist/web/server/chunks/error.svelte-D-c-9pTE.js +27 -0
- package/dist/web/server/chunks/error.svelte-D-c-9pTE.js.map +1 -0
- package/dist/web/server/chunks/events-BDBlYddw.js +89 -0
- package/dist/web/server/chunks/events-BDBlYddw.js.map +1 -0
- package/dist/web/server/chunks/exports-CCurQ-Tl.js +131 -0
- package/dist/web/server/chunks/exports-CCurQ-Tl.js.map +1 -0
- package/dist/web/server/chunks/hooks.server-BK1bopsh.js +86 -0
- package/dist/web/server/chunks/hooks.server-BK1bopsh.js.map +1 -0
- package/dist/web/server/chunks/index2-BQnysSj-.js +2588 -0
- package/dist/web/server/chunks/index2-BQnysSj-.js.map +1 -0
- package/dist/web/server/chunks/internal-DLENj6YI.js +61 -0
- package/dist/web/server/chunks/internal-DLENj6YI.js.map +1 -0
- package/dist/web/server/chunks/pane-Dg3pKvsm.js +94 -0
- package/dist/web/server/chunks/pane-Dg3pKvsm.js.map +1 -0
- package/dist/web/server/chunks/sessions-json-DgfkCLO7.js +107 -0
- package/dist/web/server/chunks/sessions-json-DgfkCLO7.js.map +1 -0
- package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js +178 -0
- package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js.map +1 -0
- package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js +7 -0
- package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js.map +1 -0
- package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js +733 -0
- package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js.map +1 -0
- package/dist/web/server/index.js +4907 -0
- package/dist/web/server/index.js.map +1 -0
- package/dist/web/server/manifest.js +233 -0
- package/dist/web/server/manifest.js.map +1 -0
- package/docs/images/desktop-dashboard.png +0 -0
- package/docs/images/desktop-session.png +0 -0
- package/docs/images/mobile-dashboard.png +0 -0
- package/docs/images/mobile-session.png +0 -0
- package/docs/release-checklist.md +228 -0
- package/docs/removing-hooks.md +135 -0
- package/docs/state-transitions.md +109 -0
- package/package.json +71 -0
- package/src/app.tsx +188 -0
- package/src/cli.ts +83 -0
- package/src/commands/index.ts +4 -0
- package/src/commands/serve.ts +75 -0
- package/src/commands/setup.ts +13 -0
- package/src/commands/tui.ts +255 -0
- package/src/commands/uninstall.ts +13 -0
- package/src/components/Header.tsx +32 -0
- package/src/components/HelpDialog.tsx +45 -0
- package/src/components/SessionEntry.tsx +202 -0
- package/src/components/SessionList.tsx +98 -0
- package/src/components/StatusBar.tsx +26 -0
- package/src/components/index.ts +5 -0
- package/src/db/index.ts +20 -0
- package/src/db/sessions-json.ts +314 -0
- package/src/hooks/claude-mux-hook.ts +498 -0
- package/src/server/watcher.ts +128 -0
- package/src/server/ws-handlers.ts +922 -0
- package/src/setup/hooks.ts +333 -0
- package/src/setup/index.ts +2 -0
- package/src/setup/wizard.ts +81 -0
- package/src/tmux/detect.ts +87 -0
- package/src/tmux/navigate.ts +42 -0
- package/src/tmux/pane.ts +167 -0
- package/src/tmux/resize.ts +28 -0
- package/src/utils/paths.ts +11 -0
- package/src/utils/pid.ts +12 -0
- package/src/utils/version.ts +5 -0
- package/tests/components/Header.test.tsx +42 -0
- package/tests/components/SessionEntry-extended.test.tsx +165 -0
- package/tests/components/SessionEntry.test.tsx +138 -0
- package/tests/components/SessionList.test.tsx +110 -0
- package/tests/components/StatusBar.test.tsx +31 -0
- package/tests/db/index.test.ts +78 -0
- package/tests/db/sessions.test.ts +230 -0
- package/tests/server/integration.test.ts +319 -0
- package/tests/server/sessions.test.ts +114 -0
- package/tests/setup/hooks-integration.test.ts +148 -0
- package/tests/setup/hooks.test.ts +123 -0
- package/tests/tmux/detect.test.ts +54 -0
- package/tests/tmux/navigate.test.ts +30 -0
- package/tests/utils/pid.test.ts +17 -0
- package/tsconfig.cli.json +9 -0
- package/tsconfig.json +22 -0
- package/vitest.config.ts +29 -0
- package/web/.svelte-kit/adapter-bun/.vite/manifest.json +408 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DldLgTc-.css +1 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
- package/web/.svelte-kit/adapter-bun/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
- package/web/.svelte-kit/adapter-bun/chunks/alert-dialog-description.js +2670 -0
- package/web/.svelte-kit/adapter-bun/chunks/auth.js +59 -0
- package/web/.svelte-kit/adapter-bun/chunks/button.js +82 -0
- package/web/.svelte-kit/adapter-bun/chunks/client.js +29 -0
- package/web/.svelte-kit/adapter-bun/chunks/context.js +133 -0
- package/web/.svelte-kit/adapter-bun/chunks/environment.js +34 -0
- package/web/.svelte-kit/adapter-bun/chunks/events.js +121 -0
- package/web/.svelte-kit/adapter-bun/chunks/exports.js +174 -0
- package/web/.svelte-kit/adapter-bun/chunks/false.js +4 -0
- package/web/.svelte-kit/adapter-bun/chunks/index.js +59 -0
- package/web/.svelte-kit/adapter-bun/chunks/index2.js +2828 -0
- package/web/.svelte-kit/adapter-bun/chunks/internal.js +920 -0
- package/web/.svelte-kit/adapter-bun/chunks/pane.js +82 -0
- package/web/.svelte-kit/adapter-bun/chunks/sessions-json.js +124 -0
- package/web/.svelte-kit/adapter-bun/chunks/sessions.svelte.js +229 -0
- package/web/.svelte-kit/adapter-bun/chunks/shared.js +542 -0
- package/web/.svelte-kit/adapter-bun/chunks/state.svelte.js +16 -0
- package/web/.svelte-kit/adapter-bun/chunks/utils.js +43 -0
- package/web/.svelte-kit/adapter-bun/chunks/ws-handlers.js +782 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/login/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/beads/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/browse/_server.ts.js +50 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/chrome/_server.ts.js +30 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/files/image/_server.ts.js +53 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/health/_server.ts.js +7 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_server.ts.js +49 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
- package/web/.svelte-kit/adapter-bun/entries/fallbacks/error.svelte.js +27 -0
- package/web/.svelte-kit/adapter-bun/entries/hooks.server.js +105 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/_layout.svelte.js +499 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/_page.svelte.js +3057 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.server.ts.js +15 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.svelte.js +37 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/session/_target_/_page.svelte.js +653 -0
- package/web/.svelte-kit/adapter-bun/index.js +3864 -0
- package/web/.svelte-kit/adapter-bun/internal.js +13 -0
- package/web/.svelte-kit/adapter-bun/manifest-full.js +167 -0
- package/web/.svelte-kit/adapter-bun/manifest.js +171 -0
- package/web/.svelte-kit/adapter-bun/nodes/0.js +8 -0
- package/web/.svelte-kit/adapter-bun/nodes/1.js +8 -0
- package/web/.svelte-kit/adapter-bun/nodes/2.js +8 -0
- package/web/.svelte-kit/adapter-bun/nodes/3.js +10 -0
- package/web/.svelte-kit/adapter-bun/nodes/4.js +8 -0
- package/web/.svelte-kit/adapter-bun/remote-entry.js +541 -0
- package/web/.svelte-kit/adapter-node/.vite/manifest.json +223 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_layout.4NiX29PU.css +1 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.BEMzYUGV.css +1 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.DOJn7TG7.css +1 -0
- package/web/.svelte-kit/adapter-node/chunks/context.js +121 -0
- package/web/.svelte-kit/adapter-node/chunks/environment.js +34 -0
- package/web/.svelte-kit/adapter-node/chunks/exports.js +174 -0
- package/web/.svelte-kit/adapter-node/chunks/false.js +4 -0
- package/web/.svelte-kit/adapter-node/chunks/index.js +59 -0
- package/web/.svelte-kit/adapter-node/chunks/index2.js +2710 -0
- package/web/.svelte-kit/adapter-node/chunks/internal.js +1005 -0
- package/web/.svelte-kit/adapter-node/chunks/sessions-json.js +109 -0
- package/web/.svelte-kit/adapter-node/chunks/sessions.svelte.js +67 -0
- package/web/.svelte-kit/adapter-node/chunks/shared.js +542 -0
- package/web/.svelte-kit/adapter-node/chunks/state.svelte.js +16 -0
- package/web/.svelte-kit/adapter-node/chunks/utils.js +43 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/browse/_server.ts.js +50 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/health/_server.ts.js +7 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +30 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/send/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_server.ts.js +126 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
- package/web/.svelte-kit/adapter-node/entries/fallbacks/error.svelte.js +44 -0
- package/web/.svelte-kit/adapter-node/entries/pages/_layout.svelte.js +12 -0
- package/web/.svelte-kit/adapter-node/entries/pages/_page.svelte.js +87 -0
- package/web/.svelte-kit/adapter-node/entries/pages/session/_target_/_page.svelte.js +76 -0
- package/web/.svelte-kit/adapter-node/index.js +3864 -0
- package/web/.svelte-kit/adapter-node/internal.js +13 -0
- package/web/.svelte-kit/adapter-node/manifest-full.js +103 -0
- package/web/.svelte-kit/adapter-node/manifest.js +107 -0
- package/web/.svelte-kit/adapter-node/nodes/0.js +8 -0
- package/web/.svelte-kit/adapter-node/nodes/1.js +8 -0
- package/web/.svelte-kit/adapter-node/nodes/2.js +8 -0
- package/web/.svelte-kit/adapter-node/nodes/3.js +8 -0
- package/web/.svelte-kit/adapter-node/remote-entry.js +541 -0
- package/web/.svelte-kit/ambient.d.ts +187 -0
- package/web/.svelte-kit/generated/client/app.js +33 -0
- package/web/.svelte-kit/generated/client/matchers.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/0.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/1.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/2.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/3.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/4.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/app.js +33 -0
- package/web/.svelte-kit/generated/client-optimized/matchers.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/0.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/1.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/2.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/3.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/4.js +1 -0
- package/web/.svelte-kit/generated/root.js +3 -0
- package/web/.svelte-kit/generated/root.svelte +68 -0
- package/web/.svelte-kit/generated/server/internal.js +53 -0
- package/web/.svelte-kit/non-ambient.d.ts +73 -0
- package/web/.svelte-kit/output/client/.vite/manifest.json +203 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/C9P-coqM.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/HKNo9LID.js +5 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
- package/web/.svelte-kit/output/client/_app/version.json +1 -0
- package/web/.svelte-kit/output/client/robots.txt +3 -0
- package/web/.svelte-kit/output/server/.vite/manifest.json +408 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DldLgTc-.css +1 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
- package/web/.svelte-kit/output/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
- package/web/.svelte-kit/output/server/chunks/alert-dialog-description.js +2670 -0
- package/web/.svelte-kit/output/server/chunks/auth.js +59 -0
- package/web/.svelte-kit/output/server/chunks/button.js +82 -0
- package/web/.svelte-kit/output/server/chunks/client.js +29 -0
- package/web/.svelte-kit/output/server/chunks/context.js +133 -0
- package/web/.svelte-kit/output/server/chunks/environment.js +34 -0
- package/web/.svelte-kit/output/server/chunks/events.js +121 -0
- package/web/.svelte-kit/output/server/chunks/exports.js +174 -0
- package/web/.svelte-kit/output/server/chunks/false.js +4 -0
- package/web/.svelte-kit/output/server/chunks/index.js +59 -0
- package/web/.svelte-kit/output/server/chunks/index2.js +2828 -0
- package/web/.svelte-kit/output/server/chunks/internal.js +920 -0
- package/web/.svelte-kit/output/server/chunks/pane.js +82 -0
- package/web/.svelte-kit/output/server/chunks/sessions-json.js +124 -0
- package/web/.svelte-kit/output/server/chunks/sessions.svelte.js +229 -0
- package/web/.svelte-kit/output/server/chunks/shared.js +542 -0
- package/web/.svelte-kit/output/server/chunks/state.svelte.js +16 -0
- package/web/.svelte-kit/output/server/chunks/utils.js +43 -0
- package/web/.svelte-kit/output/server/chunks/ws-handlers.js +782 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/auth/login/_server.ts.js +22 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/beads/_server.ts.js +22 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/browse/_server.ts.js +50 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/chrome/_server.ts.js +30 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/files/image/_server.ts.js +53 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/health/_server.ts.js +7 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_server.ts.js +49 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
- package/web/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +27 -0
- package/web/.svelte-kit/output/server/entries/hooks.server.js +105 -0
- package/web/.svelte-kit/output/server/entries/pages/_layout.svelte.js +499 -0
- package/web/.svelte-kit/output/server/entries/pages/_page.svelte.js +3057 -0
- package/web/.svelte-kit/output/server/entries/pages/login/_page.server.ts.js +15 -0
- package/web/.svelte-kit/output/server/entries/pages/login/_page.svelte.js +37 -0
- package/web/.svelte-kit/output/server/entries/pages/session/_target_/_page.svelte.js +653 -0
- package/web/.svelte-kit/output/server/index.js +3864 -0
- package/web/.svelte-kit/output/server/internal.js +13 -0
- package/web/.svelte-kit/output/server/manifest-full.js +167 -0
- package/web/.svelte-kit/output/server/manifest.js +167 -0
- package/web/.svelte-kit/output/server/nodes/0.js +8 -0
- package/web/.svelte-kit/output/server/nodes/1.js +8 -0
- package/web/.svelte-kit/output/server/nodes/2.js +8 -0
- package/web/.svelte-kit/output/server/nodes/3.js +10 -0
- package/web/.svelte-kit/output/server/nodes/4.js +8 -0
- package/web/.svelte-kit/output/server/remote-entry.js +541 -0
- package/web/.svelte-kit/tsconfig.json +58 -0
- package/web/.svelte-kit/types/route_meta_data.json +55 -0
- package/web/.svelte-kit/types/src/routes/$types.d.ts +24 -0
- package/web/.svelte-kit/types/src/routes/api/auth/login/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/auth/logout/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/beads/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/browse/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/chrome/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/files/image/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/health/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/projects/new-session/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/kill/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/restart/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/screenshots/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/send/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[target]/output/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/tmux/panes/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/login/$types.d.ts +25 -0
- package/web/.svelte-kit/types/src/routes/login/proxy+page.server.ts +19 -0
- package/web/.svelte-kit/types/src/routes/session/[target]/$types.d.ts +19 -0
- package/web/README.md +42 -0
- package/web/components.json +16 -0
- package/web/package.json +35 -0
- package/web/src/app.css +128 -0
- package/web/src/app.d.ts +13 -0
- package/web/src/app.html +11 -0
- package/web/src/hooks.server.ts +156 -0
- package/web/src/lib/assets/favicon.svg +1 -0
- package/web/src/lib/components/AllSessionsPanel.svelte +789 -0
- package/web/src/lib/components/BeadsPanel.svelte +146 -0
- package/web/src/lib/components/IssueItem.svelte +287 -0
- package/web/src/lib/components/ScreenshotsPanel.svelte +336 -0
- package/web/src/lib/components/SessionsSidebar.svelte +312 -0
- package/web/src/lib/components/TerminalRenderer.svelte +189 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +18 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +18 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +29 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +17 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +20 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +20 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte +7 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +17 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog.svelte +7 -0
- package/web/src/lib/components/ui/alert-dialog/index.ts +37 -0
- package/web/src/lib/components/ui/badge/badge.svelte +50 -0
- package/web/src/lib/components/ui/badge/index.ts +2 -0
- package/web/src/lib/components/ui/button/button.svelte +86 -0
- package/web/src/lib/components/ui/button/index.ts +17 -0
- package/web/src/lib/components/ui/checkbox/checkbox.svelte +36 -0
- package/web/src/lib/components/ui/checkbox/index.ts +6 -0
- package/web/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog-content.svelte +45 -0
- package/web/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
- package/web/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-portal.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
- package/web/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog.svelte +7 -0
- package/web/src/lib/components/ui/dialog/index.ts +34 -0
- package/web/src/lib/components/ui/scroll-area/index.ts +10 -0
- package/web/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte +31 -0
- package/web/src/lib/components/ui/scroll-area/scroll-area.svelte +43 -0
- package/web/src/lib/components/ui/textarea/index.ts +7 -0
- package/web/src/lib/components/ui/textarea/textarea.svelte +23 -0
- package/web/src/lib/index.ts +1 -0
- package/web/src/lib/server/auth.ts +90 -0
- package/web/src/lib/stores/beads.svelte.ts +163 -0
- package/web/src/lib/stores/input-injection.svelte.ts +39 -0
- package/web/src/lib/stores/preferences.svelte.ts +55 -0
- package/web/src/lib/stores/sessions.svelte.ts +108 -0
- package/web/src/lib/stores/terminal.svelte.ts +96 -0
- package/web/src/lib/stores/websocket-base.svelte.ts +209 -0
- package/web/src/lib/types/terminal.ts +31 -0
- package/web/src/lib/utils/terminal-parser.ts +239 -0
- package/web/src/lib/utils.ts +13 -0
- package/web/src/routes/+layout.svelte +450 -0
- package/web/src/routes/+page.svelte +19 -0
- package/web/src/routes/api/auth/login/+server.ts +34 -0
- package/web/src/routes/api/auth/logout/+server.ts +10 -0
- package/web/src/routes/api/beads/+server.ts +28 -0
- package/web/src/routes/api/browse/+server.ts +59 -0
- package/web/src/routes/api/chrome/+server.ts +35 -0
- package/web/src/routes/api/files/image/+server.ts +64 -0
- package/web/src/routes/api/health/+server.ts +6 -0
- package/web/src/routes/api/projects/new-session/+server.ts +50 -0
- package/web/src/routes/api/sessions/+server.ts +62 -0
- package/web/src/routes/api/sessions/[id]/+server.ts +19 -0
- package/web/src/routes/api/sessions/[id]/kill/+server.ts +46 -0
- package/web/src/routes/api/sessions/[id]/restart/+server.ts +59 -0
- package/web/src/routes/api/sessions/[id]/screenshots/+server.ts +32 -0
- package/web/src/routes/api/sessions/[id]/send/+server.ts +31 -0
- package/web/src/routes/api/sessions/[target]/output/+server.ts +13 -0
- package/web/src/routes/api/tmux/panes/+server.ts +32 -0
- package/web/src/routes/login/+page.server.ts +18 -0
- package/web/src/routes/login/+page.svelte +69 -0
- package/web/src/routes/session/[target]/+page.svelte +450 -0
- package/web/static/robots.txt +3 -0
- package/web/svelte.config.js +20 -0
- package/web/tsconfig.json +20 -0
- package/web/vite.config.ts +154 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { execFileSync } from "child_process";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resize a tmux window to the specified dimensions.
|
|
5
|
+
* Uses resize-window instead of resize-pane for detached sessions.
|
|
6
|
+
*
|
|
7
|
+
* @param target - The tmux target in format "session:window.pane"
|
|
8
|
+
* @param cols - Number of columns (clamped to 20-500)
|
|
9
|
+
* @param rows - Number of rows (clamped to 5-200)
|
|
10
|
+
*/
|
|
11
|
+
export function resizeTmuxWindow(target: string, cols: number, rows: number): void {
|
|
12
|
+
try {
|
|
13
|
+
const safeCols = Math.max(20, Math.min(500, Math.floor(cols)));
|
|
14
|
+
const safeRows = Math.max(5, Math.min(200, Math.floor(rows)));
|
|
15
|
+
// Extract window target (session:window) from full target (session:window.pane)
|
|
16
|
+
const windowTarget = target.replace(/\.\d+$/, "");
|
|
17
|
+
execFileSync(
|
|
18
|
+
"tmux",
|
|
19
|
+
["resize-window", "-t", windowTarget, "-x", String(safeCols), "-y", String(safeRows)],
|
|
20
|
+
{
|
|
21
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
22
|
+
timeout: 2000,
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
} catch {
|
|
26
|
+
// Pane may not exist or tmux error - ignore
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { homedir } from "os";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
|
|
4
|
+
export const CLAUDE_WATCH_DIR = join(homedir(), ".claude-watch");
|
|
5
|
+
export const SESSIONS_DIR = join(CLAUDE_WATCH_DIR, "sessions");
|
|
6
|
+
export const CONFIG_PATH = join(CLAUDE_WATCH_DIR, "config.json");
|
|
7
|
+
|
|
8
|
+
export const CLAUDE_DIR = join(homedir(), ".claude");
|
|
9
|
+
export const CLAUDE_SETTINGS_PATH = join(CLAUDE_DIR, "settings.json");
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_SERVER_PORT = 3456;
|
package/src/utils/pid.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a process with the given PID is still alive.
|
|
3
|
+
*/
|
|
4
|
+
export function isPidAlive(pid: number): boolean {
|
|
5
|
+
try {
|
|
6
|
+
// Sending signal 0 doesn't kill the process but checks if it exists
|
|
7
|
+
process.kill(pid, 0);
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { render } from "ink-testing-library";
|
|
4
|
+
import { Header } from "../../src/components/Header.js";
|
|
5
|
+
|
|
6
|
+
describe("Header", () => {
|
|
7
|
+
it("should render title", () => {
|
|
8
|
+
const { lastFrame } = render(<Header claudeCount={0} tmuxCount={0} />);
|
|
9
|
+
|
|
10
|
+
const output = lastFrame();
|
|
11
|
+
expect(output).toContain("claude-watch");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should show claude count", () => {
|
|
15
|
+
const { lastFrame } = render(<Header claudeCount={2} tmuxCount={0} />);
|
|
16
|
+
|
|
17
|
+
const output = lastFrame();
|
|
18
|
+
expect(output).toContain("2 claude");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should show tmux count", () => {
|
|
22
|
+
const { lastFrame } = render(<Header claudeCount={0} tmuxCount={3} />);
|
|
23
|
+
|
|
24
|
+
const output = lastFrame();
|
|
25
|
+
expect(output).toContain("3 tmux");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should show both counts", () => {
|
|
29
|
+
const { lastFrame } = render(<Header claudeCount={2} tmuxCount={3} />);
|
|
30
|
+
|
|
31
|
+
const output = lastFrame();
|
|
32
|
+
expect(output).toContain("2 claude");
|
|
33
|
+
expect(output).toContain("3 tmux");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should show no sessions when both are zero", () => {
|
|
37
|
+
const { lastFrame } = render(<Header claudeCount={0} tmuxCount={0} />);
|
|
38
|
+
|
|
39
|
+
const output = lastFrame();
|
|
40
|
+
expect(output).toContain("no sessions");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { render } from "ink-testing-library";
|
|
4
|
+
import { SessionEntry } from "../../src/components/SessionEntry.js";
|
|
5
|
+
import type { Session } from "../../src/db/index.js";
|
|
6
|
+
import type { DisplayItem } from "../../src/components/SessionEntry.js";
|
|
7
|
+
|
|
8
|
+
describe("SessionEntry extended", () => {
|
|
9
|
+
const baseSession: Session = {
|
|
10
|
+
id: "test-session",
|
|
11
|
+
pid: 1234,
|
|
12
|
+
cwd: "/home/user/project",
|
|
13
|
+
tmux_target: "main:0.1",
|
|
14
|
+
state: "busy",
|
|
15
|
+
current_action: null,
|
|
16
|
+
prompt_text: null,
|
|
17
|
+
last_update: Date.now(),
|
|
18
|
+
metadata: null,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function makeClaudeItem(session: Session): DisplayItem {
|
|
22
|
+
return { type: "claude", session };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe("getStateText edge cases", () => {
|
|
26
|
+
it("should show prompt text for waiting state when available", () => {
|
|
27
|
+
const session: Session = {
|
|
28
|
+
...baseSession,
|
|
29
|
+
state: "waiting",
|
|
30
|
+
prompt_text: "What should I do?",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const { lastFrame } = render(
|
|
34
|
+
<SessionEntry item={makeClaudeItem(session)} isSelected={false} showBlink={true} width={120} />
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const output = lastFrame();
|
|
38
|
+
// Prompt text appears in the state column (may be truncated due to column width)
|
|
39
|
+
expect(output).toContain("Waiting: What should");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should truncate long prompt text", () => {
|
|
43
|
+
const session: Session = {
|
|
44
|
+
...baseSession,
|
|
45
|
+
state: "waiting",
|
|
46
|
+
prompt_text: "This is a very long prompt that should be truncated because it exceeds the maximum length",
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const { lastFrame } = render(
|
|
50
|
+
<SessionEntry item={makeClaudeItem(session)} isSelected={false} showBlink={true} />
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const output = lastFrame();
|
|
54
|
+
expect(output).toContain("…");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("should show Working... when busy with no action", () => {
|
|
58
|
+
const session: Session = {
|
|
59
|
+
...baseSession,
|
|
60
|
+
state: "busy",
|
|
61
|
+
current_action: null,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const { lastFrame } = render(
|
|
65
|
+
<SessionEntry item={makeClaudeItem(session)} isSelected={false} showBlink={true} />
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const output = lastFrame();
|
|
69
|
+
expect(output).toContain("Working...");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("should handle unknown state gracefully", () => {
|
|
73
|
+
const session: Session = {
|
|
74
|
+
...baseSession,
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
state: "unknown" as any,
|
|
77
|
+
current_action: null,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const { lastFrame } = render(
|
|
81
|
+
<SessionEntry item={makeClaudeItem(session)} isSelected={false} showBlink={true} />
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const output = lastFrame();
|
|
85
|
+
expect(output).toContain("unknown");
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe("truncatePath edge cases", () => {
|
|
90
|
+
it("should handle path that starts with HOME", () => {
|
|
91
|
+
const originalHome = process.env.HOME;
|
|
92
|
+
process.env.HOME = "/home/testuser";
|
|
93
|
+
|
|
94
|
+
const session: Session = {
|
|
95
|
+
...baseSession,
|
|
96
|
+
cwd: "/home/testuser/projects/myproject",
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const { lastFrame } = render(
|
|
100
|
+
<SessionEntry item={makeClaudeItem(session)} isSelected={false} showBlink={true} />
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const output = lastFrame();
|
|
104
|
+
// Should show ~ instead of full home path
|
|
105
|
+
expect(output).toBeDefined();
|
|
106
|
+
|
|
107
|
+
process.env.HOME = originalHome;
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("should handle USERPROFILE on Windows-like systems", () => {
|
|
111
|
+
const originalHome = process.env.HOME;
|
|
112
|
+
const originalUserProfile = process.env.USERPROFILE;
|
|
113
|
+
|
|
114
|
+
delete process.env.HOME;
|
|
115
|
+
process.env.USERPROFILE = "/home/winuser";
|
|
116
|
+
|
|
117
|
+
const session: Session = {
|
|
118
|
+
...baseSession,
|
|
119
|
+
cwd: "/home/winuser/documents/project",
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const { lastFrame } = render(
|
|
123
|
+
<SessionEntry item={makeClaudeItem(session)} isSelected={false} showBlink={true} />
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const output = lastFrame();
|
|
127
|
+
expect(output).toBeDefined();
|
|
128
|
+
|
|
129
|
+
process.env.HOME = originalHome;
|
|
130
|
+
process.env.USERPROFILE = originalUserProfile;
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe("tmux session entries", () => {
|
|
135
|
+
it("should render tmux session with window count", () => {
|
|
136
|
+
const item: DisplayItem = {
|
|
137
|
+
type: "tmux",
|
|
138
|
+
tmuxSession: { name: "dev", windowCount: 3, attached: false },
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const { lastFrame } = render(
|
|
142
|
+
<SessionEntry item={item} isSelected={false} showBlink={true} />
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const output = lastFrame();
|
|
146
|
+
expect(output).toContain("tmux");
|
|
147
|
+
expect(output).toContain("dev");
|
|
148
|
+
expect(output).toContain("3 windows");
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("should show attached status for tmux session", () => {
|
|
152
|
+
const item: DisplayItem = {
|
|
153
|
+
type: "tmux",
|
|
154
|
+
tmuxSession: { name: "main", windowCount: 1, attached: true },
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const { lastFrame } = render(
|
|
158
|
+
<SessionEntry item={item} isSelected={false} showBlink={true} />
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
const output = lastFrame();
|
|
162
|
+
expect(output).toContain("attached");
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { render } from "ink-testing-library";
|
|
4
|
+
import { SessionEntry, type DisplayItem } from "../../src/components/SessionEntry.js";
|
|
5
|
+
import type { Session } from "../../src/db/index.js";
|
|
6
|
+
|
|
7
|
+
const mockSession: Session = {
|
|
8
|
+
id: "test-session",
|
|
9
|
+
pid: 1234,
|
|
10
|
+
cwd: "/home/user/project",
|
|
11
|
+
tmux_target: "main:0.1",
|
|
12
|
+
state: "busy",
|
|
13
|
+
current_action: "Running: Bash",
|
|
14
|
+
prompt_text: null,
|
|
15
|
+
last_update: Date.now(),
|
|
16
|
+
metadata: null,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function makeClaudeItem(session: Session): DisplayItem {
|
|
20
|
+
return { type: "claude", session };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe("SessionEntry", () => {
|
|
24
|
+
it("should render session with busy state", () => {
|
|
25
|
+
const { lastFrame } = render(
|
|
26
|
+
<SessionEntry item={makeClaudeItem(mockSession)} isSelected={false} showBlink={true} />
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const output = lastFrame();
|
|
30
|
+
expect(output).toContain("●");
|
|
31
|
+
expect(output).toContain("project");
|
|
32
|
+
expect(output).toContain("main:0.1");
|
|
33
|
+
expect(output).toContain("Running: Bash");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should render selection indicator when selected", () => {
|
|
37
|
+
const { lastFrame } = render(
|
|
38
|
+
<SessionEntry item={makeClaudeItem(mockSession)} isSelected={true} showBlink={true} />
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const output = lastFrame();
|
|
42
|
+
expect(output).toContain("▶");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("should not show selection indicator when not selected", () => {
|
|
46
|
+
const { lastFrame } = render(
|
|
47
|
+
<SessionEntry item={makeClaudeItem(mockSession)} isSelected={false} showBlink={true} />
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const output = lastFrame();
|
|
51
|
+
expect(output).not.toContain("▶");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("should render waiting state correctly", () => {
|
|
55
|
+
const waitingSession: Session = {
|
|
56
|
+
...mockSession,
|
|
57
|
+
state: "waiting",
|
|
58
|
+
current_action: null,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const { lastFrame } = render(
|
|
62
|
+
<SessionEntry item={makeClaudeItem(waitingSession)} isSelected={false} showBlink={true} />
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const output = lastFrame();
|
|
66
|
+
expect(output).toContain("Waiting");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("should render permission state correctly", () => {
|
|
70
|
+
const permissionSession: Session = {
|
|
71
|
+
...mockSession,
|
|
72
|
+
state: "permission",
|
|
73
|
+
current_action: null,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const { lastFrame } = render(
|
|
77
|
+
<SessionEntry item={makeClaudeItem(permissionSession)} isSelected={false} showBlink={true} />
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const output = lastFrame();
|
|
81
|
+
expect(output).toContain("permission");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("should render idle state correctly", () => {
|
|
85
|
+
const idleSession: Session = {
|
|
86
|
+
...mockSession,
|
|
87
|
+
state: "idle",
|
|
88
|
+
current_action: null,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const { lastFrame } = render(
|
|
92
|
+
<SessionEntry item={makeClaudeItem(idleSession)} isSelected={false} showBlink={true} />
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const output = lastFrame();
|
|
96
|
+
expect(output).toContain("Idle");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("should hide bullet for busy state when showBlink is false", () => {
|
|
100
|
+
const { lastFrame } = render(
|
|
101
|
+
<SessionEntry item={makeClaudeItem(mockSession)} isSelected={false} showBlink={false} />
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const output = lastFrame();
|
|
105
|
+
// The bullet should be replaced with a space during blink-off phase
|
|
106
|
+
// We just verify the component renders without error
|
|
107
|
+
expect(output).toBeDefined();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("should show dash when tmux_target is null", () => {
|
|
111
|
+
const noTmuxSession: Session = {
|
|
112
|
+
...mockSession,
|
|
113
|
+
tmux_target: null,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const { lastFrame } = render(
|
|
117
|
+
<SessionEntry item={makeClaudeItem(noTmuxSession)} isSelected={false} showBlink={true} />
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const output = lastFrame();
|
|
121
|
+
// Now shows "—" instead of "no tmux"
|
|
122
|
+
expect(output).toContain("—");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("should truncate long paths", () => {
|
|
126
|
+
const longPathSession: Session = {
|
|
127
|
+
...mockSession,
|
|
128
|
+
cwd: "/home/user/very/long/path/to/some/deeply/nested/project",
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const { lastFrame } = render(
|
|
132
|
+
<SessionEntry item={makeClaudeItem(longPathSession)} isSelected={false} showBlink={true} />
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const output = lastFrame();
|
|
136
|
+
expect(output).toContain("…");
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { render } from "ink-testing-library";
|
|
4
|
+
import { SessionList } from "../../src/components/SessionList.js";
|
|
5
|
+
import type { Session } from "../../src/db/index.js";
|
|
6
|
+
|
|
7
|
+
const mockSessions: Session[] = [
|
|
8
|
+
{
|
|
9
|
+
id: "session-1",
|
|
10
|
+
pid: 1001,
|
|
11
|
+
cwd: "/home/user/project1",
|
|
12
|
+
tmux_target: "main:0.0",
|
|
13
|
+
state: "busy",
|
|
14
|
+
current_action: "Running: Bash",
|
|
15
|
+
prompt_text: null,
|
|
16
|
+
last_update: Date.now(),
|
|
17
|
+
metadata: null,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "session-2",
|
|
21
|
+
pid: 1002,
|
|
22
|
+
cwd: "/home/user/project2",
|
|
23
|
+
tmux_target: "dev:1.0",
|
|
24
|
+
state: "idle",
|
|
25
|
+
current_action: null,
|
|
26
|
+
prompt_text: null,
|
|
27
|
+
last_update: Date.now(),
|
|
28
|
+
metadata: null,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
describe("SessionList", () => {
|
|
33
|
+
it("should render empty state when no sessions", () => {
|
|
34
|
+
const { lastFrame } = render(
|
|
35
|
+
<SessionList sessions={[]} tmuxSessions={[]} selectedIndex={0} showBlink={true} />
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const output = lastFrame();
|
|
39
|
+
expect(output).toContain("No sessions");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should render multiple sessions", () => {
|
|
43
|
+
const { lastFrame } = render(
|
|
44
|
+
<SessionList sessions={mockSessions} tmuxSessions={[]} selectedIndex={0} showBlink={true} />
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const output = lastFrame();
|
|
48
|
+
expect(output).toContain("project1");
|
|
49
|
+
expect(output).toContain("project2");
|
|
50
|
+
expect(output).toContain("main:0.0");
|
|
51
|
+
expect(output).toContain("dev:1.0");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("should highlight selected session", () => {
|
|
55
|
+
const { lastFrame } = render(
|
|
56
|
+
<SessionList sessions={mockSessions} tmuxSessions={[]} selectedIndex={1} showBlink={true} />
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const output = lastFrame();
|
|
60
|
+
// The second session should have the selection indicator
|
|
61
|
+
expect(output).toContain("▶");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("should show all session states", () => {
|
|
65
|
+
const sessionsWithStates: Session[] = [
|
|
66
|
+
{ ...mockSessions[0], state: "permission" },
|
|
67
|
+
{ ...mockSessions[1], state: "waiting" },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const { lastFrame } = render(
|
|
71
|
+
<SessionList sessions={sessionsWithStates} tmuxSessions={[]} selectedIndex={0} showBlink={true} />
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const output = lastFrame();
|
|
75
|
+
expect(output).toContain("permission");
|
|
76
|
+
expect(output).toContain("Waiting");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("should show tmux sessions without claude instances", () => {
|
|
80
|
+
const tmuxSessions = [
|
|
81
|
+
{ name: "other", windowCount: 2, attached: false },
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const { lastFrame } = render(
|
|
85
|
+
<SessionList sessions={mockSessions} tmuxSessions={tmuxSessions} selectedIndex={0} showBlink={true} />
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const output = lastFrame();
|
|
89
|
+
expect(output).toContain("other");
|
|
90
|
+
expect(output).toContain("tmux");
|
|
91
|
+
expect(output).toContain("2 windows");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("should not duplicate tmux sessions that have claude instances", () => {
|
|
95
|
+
// main session is already used by mockSessions[0]
|
|
96
|
+
const tmuxSessions = [
|
|
97
|
+
{ name: "main", windowCount: 1, attached: true },
|
|
98
|
+
{ name: "other", windowCount: 2, attached: false },
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const { lastFrame } = render(
|
|
102
|
+
<SessionList sessions={mockSessions} tmuxSessions={tmuxSessions} selectedIndex={0} showBlink={true} />
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const output = lastFrame();
|
|
106
|
+
// "main" should only appear once (from claude session, not as separate tmux entry)
|
|
107
|
+
// "other" should appear as tmux session
|
|
108
|
+
expect(output).toContain("other");
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { render } from "ink-testing-library";
|
|
4
|
+
import { StatusBar } from "../../src/components/StatusBar.js";
|
|
5
|
+
|
|
6
|
+
describe("StatusBar", () => {
|
|
7
|
+
it("should show keyboard shortcuts", () => {
|
|
8
|
+
const { lastFrame } = render(<StatusBar inTmux={true} />);
|
|
9
|
+
|
|
10
|
+
const output = lastFrame();
|
|
11
|
+
expect(output).toContain("[h]");
|
|
12
|
+
expect(output).toContain("Help");
|
|
13
|
+
expect(output).toContain("[prefix+W]");
|
|
14
|
+
expect(output).toContain("[q]");
|
|
15
|
+
expect(output).toContain("Quit");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should show warning when not in tmux", () => {
|
|
19
|
+
const { lastFrame } = render(<StatusBar inTmux={false} />);
|
|
20
|
+
|
|
21
|
+
const output = lastFrame();
|
|
22
|
+
expect(output).toContain("not in tmux");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should not show warning when in tmux", () => {
|
|
26
|
+
const { lastFrame } = render(<StatusBar inTmux={true} />);
|
|
27
|
+
|
|
28
|
+
const output = lastFrame();
|
|
29
|
+
expect(output).not.toContain("not in tmux");
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { mkdirSync, rmSync, existsSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { tmpdir } from "os";
|
|
5
|
+
import {
|
|
6
|
+
cleanupStaleSessions,
|
|
7
|
+
upsertSession,
|
|
8
|
+
getAllSessions,
|
|
9
|
+
setSessionsDir,
|
|
10
|
+
} from "../../src/db/index.js";
|
|
11
|
+
|
|
12
|
+
const testDir = join(tmpdir(), `claude-watch-index-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
13
|
+
|
|
14
|
+
describe("db/index (JSON files)", () => {
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
mkdirSync(testDir, { recursive: true });
|
|
17
|
+
setSessionsDir(testDir);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
setSessionsDir(null); // Reset to default
|
|
22
|
+
if (existsSync(testDir)) {
|
|
23
|
+
rmSync(testDir, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("cleanupStaleSessions", () => {
|
|
28
|
+
it("should remove sessions with dead PIDs", () => {
|
|
29
|
+
// Insert a session with a non-existent PID
|
|
30
|
+
upsertSession({
|
|
31
|
+
id: "dead-session",
|
|
32
|
+
pid: 999999999, // Very unlikely to exist
|
|
33
|
+
cwd: "/test",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const removed = cleanupStaleSessions();
|
|
37
|
+
expect(removed).toBe(1);
|
|
38
|
+
|
|
39
|
+
const sessions = getAllSessions();
|
|
40
|
+
expect(sessions.find((s) => s.id === "dead-session")).toBeUndefined();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("should keep sessions with alive PIDs", () => {
|
|
44
|
+
// Insert a session with our current PID
|
|
45
|
+
upsertSession({
|
|
46
|
+
id: "alive-session",
|
|
47
|
+
pid: process.pid,
|
|
48
|
+
cwd: "/test",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const removed = cleanupStaleSessions();
|
|
52
|
+
expect(removed).toBe(0);
|
|
53
|
+
|
|
54
|
+
const sessions = getAllSessions();
|
|
55
|
+
expect(sessions.find((s) => s.id === "alive-session")).toBeDefined();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should handle empty directory", () => {
|
|
59
|
+
const removed = cleanupStaleSessions();
|
|
60
|
+
expect(removed).toBe(0);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should skip sessions with PID 0", () => {
|
|
64
|
+
// Sessions with PID 0 should only be cleaned by session-end
|
|
65
|
+
upsertSession({
|
|
66
|
+
id: "unknown-pid-session",
|
|
67
|
+
pid: 0,
|
|
68
|
+
cwd: "/test",
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const removed = cleanupStaleSessions();
|
|
72
|
+
expect(removed).toBe(0);
|
|
73
|
+
|
|
74
|
+
const sessions = getAllSessions();
|
|
75
|
+
expect(sessions.find((s) => s.id === "unknown-pid-session")).toBeDefined();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|