Commit Graph

323 Commits

Author SHA1 Message Date
Brian Krabach 74a02cc05b fix: add six dependency — undeclared transitive dep of python-pam (breaks macOS clean envs)
python-pam imports six but doesn't declare it. On Linux, six is usually
present system-wide. On macOS uv tool environments (clean/isolated),
import pam fails with 'No module named six'. Adding six explicitly to
our deps ensures PAM auth works on macOS.
2026-03-30 07:06:08 -07:00
Brian Krabach 514ed5dc77 fix: add python-multipart dependency, fix launchd service name
python-multipart is required by FastAPI for form POST handling (login).
Was missing from pyproject.toml — crash on macOS first run.

launchd plist now uses the muxplex entry point script directly instead
of python -m muxplex, so macOS shows 'muxplex' in Activity Monitor,
launchctl list, and login items instead of 'python3'.
2026-03-30 07:01:01 -07:00
Brian Krabach cf1182b100 feat: add muxplex doctor subcommand — dependency + config diagnostics
Checks Python version, tmux, ttyd, muxplex version, settings file,
auth status (PAM/password/auto-generate), active tmux sessions,
platform, and service installation status. Platform-specific install
hints for missing dependencies. Non-fatal — always completes.
2026-03-30 06:47:36 -07:00
Brian Krabach d20f85a23e docs: add prerequisites section to README with platform-specific install instructions
- Expand Prerequisites section with bullet format (was a sparse table)
- Add tmux and ttyd per-platform install commands (macOS, Ubuntu/WSL)
- Note that muxplex prints install instructions if either dependency is missing
- Update 'Install as a Service' section with macOS launchd instructions
- Update Usage table to reflect platform-aware install-service behavior
2026-03-30 06:30:55 -07:00
Brian Krabach 54ad5fbeea feat: preflight dependency check for tmux and ttyd at startup
- Add _check_dependencies() that checks shutil.which() for tmux and ttyd
- Print clear error with per-platform install hints when either is missing
- Call _check_dependencies() in main() before serve — not for install-service,
  show-password, or reset-secret (those don't need the binary dependencies)
- Tests: exits on missing ttyd, exits on missing tmux, passes when both present,
  called for serve but not for install-service
2026-03-30 06:30:45 -07:00
Brian Krabach eb8b09a3cf feat: platform-aware install-service — launchd on macOS, systemd on Linux
- Add _install_launchd() that writes ~/Library/LaunchAgents/com.muxplex.plist
- Refactor existing systemd code into _install_systemd()
- install_service() now detects sys.platform == 'darwin' and delegates accordingly
- Update install-service help text to mention both platforms
- Tests: launchd plist on macOS, systemd on Linux, no cross-contamination
2026-03-30 06:29:45 -07:00
Brian Krabach d1c245a2c3 test: remove 26 stale command palette tests (palette was removed in Phase 1) 2026-03-30 03:45:42 -07:00
Brian Krabach 17616166bc feat: kill session — DELETE endpoint, hover × button with confirmation 2026-03-30 03:35:39 -07:00
Brian Krabach ffa8167c8f fix: new session poll-until-ready before auto-opening 2026-03-30 03:30:16 -07:00
Brian Krabach 424a4f5377 fix: settings modal dismiss — add close button, fix backdrop click 2026-03-30 03:27:47 -07:00
Brian Krabach 6f598524a9 fix: apply ruff formatting and add null guard for tab lookup in test
- Apply ruff auto-format to test_frontend_css.py, test_frontend_html.py,
  test_frontend_js.py (whitespace/line-length normalization)
- Add assert-not-None guard before tab.get() in settings tabs test,
  matching the pattern already used for display_tab (fixes pyright error)

Co-authored-by: Amplifier <amplifier@amplified.dev>
2026-03-30 02:54:07 -07:00
Brian Krabach bac23f26dc fix: apply getVisibleSessions filter in renderSheetList for mobile bottom sheet
Hidden sessions were still appearing in the mobile bottom-sheet session
switcher because renderSheetList() read _currentSessions directly,
bypassing the getVisibleSessions() helper used by renderGrid() and
renderSidebar().

- app.js: sortByPriority now receives getVisibleSessions(_currentSessions)
  instead of _currentSessions directly in renderSheetList()
- test_frontend_js.py: add test_render_sheet_list_filters_hidden_sessions
  to assert getVisibleSessions is called in renderSheetList body

Completes consistent hidden-sessions filtering across all three render
paths (grid, sidebar, mobile bottom sheet).

Co-authored-by: Amplifier <amplifier@amplified.dev>
2026-03-30 02:49:41 -07:00
Brian Krabach d2f3b43759 test: add frontend tests for settings dialog and new session UI 2026-03-30 02:36:08 -07:00
Brian Krabach 851036bac0 refactor: code quality improvements for task-7 settings effects
- Extract getVisibleSessions() helper to consolidate hidden-session
  filter used by renderGrid() and renderSidebar() (DRY reduction)
- Add comment to terminal.js magic literal 600 noting it matches
  MOBILE_THRESHOLD in app.js
- Move TERMINAL_JS_PATH and _TERMINAL_JS module fixtures to the top
  of the test file alongside JS_PATH and _JS for consistency
- Strengthen test_render_grid_uses_visible_for_empty_state_check to
  assert visible.length specifically, distinguishing it from
  test_render_grid_creates_visible_array
- Update renderGrid/renderSidebar filter tests to assert getVisibleSessions()
  call; add test_get_visible_sessions_filters_hidden_sessions to cover
  the extracted helper directly
2026-03-30 02:28:54 -07:00
Brian Krabach 142c68d644 feat: apply settings effects — font size, grid columns, hidden sessions, sort order
- terminal.js createTerminal(): read fontSize from localStorage 'muxplex.display',
  default 14, apply Math.min(storedFontSize, 12) mobile cap
- app.js renderGrid(): filter hidden sessions via _serverSettings.hidden_sessions,
  create visible array, apply alphabetical sort via localeCompare when sort_order is
  'alphabetical'; 'recent'/'manual' use server-provided order
- app.js renderSidebar(): apply same hidden sessions filter, use visible array
- app.js DOMContentLoaded: call loadServerSettings() after startPolling() in restoreState().then()
- tests: 13 new tests in test_frontend_js.py covering all spec requirements

Co-authored-by: Amplifier <amplifier@example.com>
2026-03-30 02:16:45 -07:00
Brian Krabach 1af141a294 docs: fix orphaned JSDoc — move showNewSessionInput comment above its function 2026-03-30 02:07:15 -07:00
Brian Krabach 5b971a0ecc refactor: apply code quality suggestions from task-6-mobile-fab review
Three suggestions from the code review applied:

1. Extract _createSessionInput() factory to eliminate five-line
   duplication between showNewSessionInput and showFabSessionInput.
   Both functions now call the shared factory. Updated 4 existing
   tests to check _createSessionInput's body; added 7 new tests
   covering factory behavior and factory usage in each consumer.

2. Fix .new-session-fab:focus-visible outline color from var(--accent)
   to var(--bg) — the FAB background is already var(--accent), so
   using the same color for the outline created zero contrast.
   Added 1 new test to guard this going forward.

3. Add early-return guard in showFabSessionInput against duplicate
   overlays: if (document.querySelector('.fab-input-overlay')) return;
   Prevents a second overlay being created if called programmatically
   while one is already open. Added 1 new test.

532 tests pass (9 new tests added, 523 unchanged).
2026-03-30 02:00:22 -07:00
Brian Krabach 9978544dc1 fix: use fixed-position overlay for FAB session input (mobile visibility) 2026-03-30 01:45:51 -07:00
Brian Krabach dbb8b2bd73 feat: add mobile FAB for new session creation 2026-03-30 01:34:31 -07:00
Brian Krabach d76042560a feat: add sidebar + New sticky footer with inline input
- Add div.sidebar-footer with button#sidebar-new-session-btn.sidebar-new-btn
  ('+ New') to #session-sidebar in index.html, positioned after #sidebar-list
- Add CSS for .sidebar-footer (padding: 8px, border-top, flex-shrink: 0)
- Add CSS for .sidebar-new-btn (width: 100%, dashed border, dim text, hover
  effects with muted text and border color)
- Bind #sidebar-new-session-btn click to showNewSessionInput() in
  bindStaticEventListeners()
- Add 15 tests covering HTML structure, CSS rules, and JS binding

🤖 Co-authored-by: Amplifier <amplifier@example.com>
2026-03-30 01:23:37 -07:00
Brian Krabach 84fb7826d7 feat: add header + button with inline name input for session creation
- Add showNewSessionInput(btn): creates inline text input with class
  'new-session-input', placeholder 'Session name…', autocomplete off,
  spellcheck false; hides button, inserts input before it, focuses it.
  Handles Enter (create), Escape (cancel), and blur (150ms delayed cleanup).
- Add createNewSession(name): POSTs to /api/sessions, shows toast with
  created session name, calls pollSessions(), and if ss.auto_open_created
  !== false calls openSession(data.name) after 500ms delay.
- Bind #new-session-btn click to showNewSessionInput in bindStaticEventListeners.
- Export showNewSessionInput and createNewSession from module.exports.
- Add .new-session-input CSS (bg, border 1px solid accent, border-radius 4px,
  font-size 13px, font-ui, padding 4px 10px, width 180px, outline none) and
  ::placeholder { color: var(--text-dim) } in style.css.
- Add 28 new tests covering all spec requirements (19 JS structural, 9 CSS).
2026-03-30 01:08:19 -07:00
Brian Krabach 5f81b87348 feat: add New Session settings tab with template textarea 2026-03-30 01:03:54 -07:00
Brian Krabach 2e86692c3c fix: add null guard to _updateNotificationUI and .catch() to requestPermission
- _updateNotificationUI: add guard 'if (!statusEl || !reqBtn) return;' so
  future call sites without explicit null checks cannot throw TypeError
- Notification.requestPermission(): add .catch(console.error) for defensive
  error handling — promise always resolves in practice but unhandled rejections
  would be silently swallowed
- Tests: add test_update_notification_ui_has_null_guard and
  test_bind_static_event_listeners_permission_btn_has_catch to enforce both

435 tests pass (2 new)

Co-authored-by: Amplifier <amplifier@amp.dev>
2026-03-30 00:35:21 -07:00
Brian Krabach e5827a8037 refactor: extract _updateNotificationUI helper, use const, fix double query
- Extract shared _updateNotificationUI(statusEl, reqBtn, permission) helper
  to remove duplicated notification status UI update logic from openSettings
  and the requestPermission click handler
- Replace var with const for local bindings in new Notifications handlers
- Use this.checked in bell sound change handler instead of re-querying
  the DOM element that was already looked up for addEventListener
2026-03-30 00:29:38 -07:00
Brian Krabach 2f909eae89 feat: add Notifications settings tab 2026-03-30 00:18:05 -07:00
Brian Krabach c955aadad1 feat: add Sessions settings tab with server-side persistence 2026-03-29 23:57:22 -07:00
Brian Krabach f380307f08 fix: rename data-panel to data-tab on settings panels to match switchSettingsTab()
switchSettingsTab() in app.js reads panel.dataset.tab (data-tab attribute).
The four .settings-panel elements in index.html were using data-panel instead,
causing all panels to get hidden on every tab click — the settings dialog rendered
as a blank content area after any tab interaction.

Fix: Change data-panel="..." to data-tab="..." on all four panel divs.

Tests added:
- test_html_settings_panels_use_data_tab: verifies each .settings-panel uses
  data-tab and not data-panel
- test_html_settings_tab_panel_data_tab_alignment: cross-checks that every tab
  button data-tab value has a matching .settings-panel data-tab value, preventing
  this class of HTML/JS attribute mismatch from recurring
2026-03-29 23:47:59 -07:00
Brian Krabach fd4e91bc51 feat: wire Display tab — font size, hover delay, grid columns with immediate apply 2026-03-29 23:28:12 -07:00
Brian Krabach bb21ce7aa9 style: reformat DISPLAY_DEFAULTS to multi-line, simplify switchSettingsTab panel lookup 2026-03-29 23:21:48 -07:00
Brian Krabach 1eec617cb9 feat: add settings dialog open/close, tab switching, localStorage management 2026-03-29 23:16:19 -07:00
Brian Krabach b20759c6cb feat: add settings dialog HTML structure and CSS 2026-03-29 23:04:11 -07:00
Brian Krabach 19ec5c02a5 feat: add POST /api/sessions endpoint for new session creation 2026-03-29 22:54:23 -07:00
Brian Krabach 6c72bd05cc feat: add GET/PATCH /api/settings endpoints 2026-03-29 22:47:53 -07:00
Brian Krabach 85d3bb1312 fix: use deepcopy for DEFAULT_SETTINGS and narrow exception catch in settings module
- Replace DEFAULT_SETTINGS.copy() with copy.deepcopy(DEFAULT_SETTINGS) in
  load_settings() and save_settings() to prevent mutation of module-level
  mutable defaults (hidden_sessions list was shared via shallow copy)
- Replace except (json.JSONDecodeError, Exception) with
  except (FileNotFoundError, json.JSONDecodeError) to only suppress expected
  errors and let unexpected exceptions (PermissionError etc.) propagate
- Add two regression tests:
  test_load_does_not_mutate_default_settings: verifies deepcopy isolation
  test_load_propagates_non_json_errors: verifies narrow exception handling
2026-03-29 22:43:24 -07:00
Brian Krabach ffecfa69cb feat: add server-side settings module 2026-03-29 22:36:19 -07:00
Brian Krabach 8e4f17068d refactor: remove command palette JavaScript 2026-03-29 22:28:20 -07:00
Brian Krabach a971cb9bbd refactor: remove orphaned command palette HTML remnants from index.html 2026-03-29 22:16:03 -07:00
Brian Krabach 80dc082df0 refactor: remove command palette HTML and CSS 2026-03-29 22:12:07 -07:00
Brian Krabach 77eecd1d72 docs: add settings panel and new session design document 2026-03-29 21:55:40 -07:00
Brian Krabach e4efadddf4 fix: remove gradient fades, fix sidebar active indicator full-height
Remove tile-body::before and sidebar-item-body::before gradient overlays
that obscured ANSI colors at the bottom of previews. Replace box-shadow
inset with border-left on sidebar-item--active so the cyan accent stripe
spans the full item height (was only showing on the header).
2026-03-29 19:41:49 -07:00
Brian Krabach 583de6ec2d feat: match preview styling to xterm.js — palette, background, font, line-height
ANSI_COLORS: replaced with xterm.js default GTK/Tango palette.
Background: #000000 on tile-body, sidebar-item-body, preview-popover.
Font: 'SF Mono', 'Fira Code', Consolas, monospace (same as terminal).
Line-height: 1.0 across all preview surfaces (xterm.js default).
Gradient overlays: fade to #000 instead of theme bg.
Result: previews are visually indistinguishable from the terminal.
2026-03-29 19:19:05 -07:00
Brian Krabach 85298abdcc fix: match tile + sidebar preview text color to xterm.js foreground (#c9d1d9) 2026-03-29 18:59:44 -07:00
Brian Krabach 71fdd544b2 fix: match preview text color to xterm.js foreground (#c9d1d9) 2026-03-29 18:48:51 -07:00
Brian Krabach bf76affef2 refactor: remove dimmer overlay, add cyan border to preview popover
ANSI colors make the overlay content readable without dimming. Removed
preview-dimmer, liftHoveredTile(), tile--previewing/item--previewing —
all dead code now. Added var(--accent) 2px border to .preview-popover
for visual separation.
2026-03-29 18:44:55 -07:00
Brian Krabach b3b2165524 feat: ANSI color rendering in preview snapshots
Server: add -e flag to tmux capture-pane to preserve escape sequences.
Frontend: ansiToHtml() parser converts SGR codes (bold, italic, dim,
16-color, 256-color) to <span> tags with inline styles. Applied to
dashboard tiles, sidebar items, and hover overlay. No external deps.
2026-03-29 18:24:15 -07:00
Brian Krabach dbade5a3d9 fix: preview overlay text color — use primary text, not disabled dim 2026-03-29 18:09:09 -07:00
Brian Krabach af95b90b02 feat: hover preview as full-window overlay with text wrap + click-to-navigate
Replace side-positioned popover with a viewport-covering overlay (5vh/5vw
margins). pre-wrap + word-break wraps terminal text to fit any viewport.
pointer-events:none on overlay lets mouseleave fire on the original tile.
Click anywhere while preview is active navigates to that session.
Removes repositionPreview() — no JS positioning needed.
2026-03-29 18:00:36 -07:00
Brian Krabach 5906de9e67 fix: rewrite hover preview — track by session name, survive innerHTML rebuilds
Previous approach guarded renderGrid/renderSidebar from running while
preview active, but catch-up renders, stale DOM references, and timer
races caused flicker, wrong positioning, and stale content.

New approach: track _previewSessionName (string, not DOM node). Renders
run normally. After each innerHTML rebuild, liftHoveredTile() re-applies
z-index to the new DOM element. repositionPreview() re-queries DOM each
call. Timer always cleared when entering a new tile. No render guards.
2026-03-29 17:40:54 -07:00
Brian Krabach 06d1e02ce1 fix: hover preview flashing — skip grid/sidebar re-render while preview active
Poll cycle rebuilds innerHTML every ~2s, destroying the hovered tile's
DOM element and tile--previewing class. Fix: renderGrid() and
renderSidebar() early-return when _previewPopover is non-null. On
hidePreview(), a catch-up render fires so no data is stale.
2026-03-29 17:21:15 -07:00
Brian Krabach 905cbf35e5 feat: hover preview dim effect — overlay dims page, hovered tile + popover stand out
1.5s hover delay (up from 350ms) for deliberate preview. When popover
appears, a semi-transparent dimmer covers the page (z-index 499). The
hovered tile/sidebar-item gets z-index 500 (same as popover) so it
appears above the dimmer alongside the preview. Both cleaned up on
mouseleave via hidePreview().
2026-03-29 16:56:09 -07:00