Skip to content

feat: file browser with markdown viewer#6

Merged
dimakis merged 1 commit into
mainfrom
feat/file-viewer
Apr 1, 2026
Merged

feat: file browser with markdown viewer#6
dimakis merged 1 commit into
mainfrom
feat/file-viewer

Conversation

@dimakis
Copy link
Copy Markdown
Owner

@dimakis dimakis commented Apr 1, 2026

Summary

  • New /files route: directory browser + file viewer
  • Markdown files (.md, .mdx) render with react-markdown + remark-gfm
  • Non-markdown files render as preformatted code
  • Navigation: back button, parent directory (..), URL param-based
  • "Files" quick action card on home screen
  • File access restricted to REPO_PATH and worktrees (server-side)

Cherry-picked from feat/markdown-viewer and adapted for the refactored codebase.

Test plan

  • 70 tests passing
  • tsc --noEmit clean
  • Frontend builds successfully
  • Server starts and serves the new route

Made with Cursor

New /files route with directory browsing and file viewing. Markdown files
render with react-markdown + remark-gfm (headings, tables, code blocks,
links). Non-markdown files display as preformatted text. Navigation: back
button, parent directory (..), breadcrumb via URL params. Files quick
action card added to home screen.

Cherry-picked from feat/markdown-viewer and adapted for the refactored
codebase (session-stabilization changes).

Made-with: Cursor
@dimakis dimakis merged commit f56b2fa into main Apr 1, 2026
1 check passed
@dimakis dimakis deleted the feat/file-viewer branch April 1, 2026 07:05
dimakis added a commit that referenced this pull request Apr 10, 2026
- Add script existence check before exec (was #1 critical)
- Add Zod CalendarResponse schema for stdout validation (#2)
- Check r.ok before parsing fetch response in hook (#3)
- Compute today fresh in handleToday to avoid stale date (#6)
- Extract EventCard + SprintBar to separate component files (#7)
- Extract calendar CSS to dedicated calendar.css (#8)
- Add tests: Day/Week toggle, Today button, EventCard expand,
  milestone expand, non-ok HTTP response handling (#4, #5)

832 tests passing (5 new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dimakis added a commit that referenced this pull request Apr 10, 2026
- Add script existence check before exec (was #1 critical)
- Add Zod CalendarResponse schema for stdout validation (#2)
- Check r.ok before parsing fetch response in hook (#3)
- Compute today fresh in handleToday to avoid stale date (#6)
- Extract EventCard + SprintBar to separate component files (#7)
- Extract calendar CSS to dedicated calendar.css (#8)
- Add tests: Day/Week toggle, Today button, EventCard expand,
  milestone expand, non-ok HTTP response handling (#4, #5)

832 tests passing (5 new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dimakis added a commit that referenced this pull request Apr 10, 2026
…sprints (#164)

* feat(calendar): add calendar view with meetings, milestones, and sprints

Unified calendar page that merges Google Calendar events, release
milestones, and sprint boundaries via the mgmt calendar_api.py backend.
Mobile-first day/week view with responsive desktop grid layout.

- GET /api/calendar endpoint shells out to calendar_api.py
- useCalendarData hook with date navigation
- CalendarView page with EventCard expand/collapse
- Sprint bars, milestone badges, attendee chips
- Day/Week toggle, prev/next/today navigation
- 17 tests (5 server + 5 hook + 7 page)
- Quick action added to .mitzo.json
- Route at /calendar behind ProtectedRoute

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(calendar): address all Centaur review findings

- Add script existence check before exec (was #1 critical)
- Add Zod CalendarResponse schema for stdout validation (#2)
- Check r.ok before parsing fetch response in hook (#3)
- Compute today fresh in handleToday to avoid stale date (#6)
- Extract EventCard + SprintBar to separate component files (#7)
- Extract calendar CSS to dedicated calendar.css (#8)
- Add tests: Day/Week toggle, Today button, EventCard expand,
  milestone expand, non-ok HTTP response handling (#4, #5)

832 tests passing (5 new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(calendar): resolve lint errors and review findings

- Remove unused imports (beforeEach, writeFileSync, result)
- Fix toLocalDate to use local timezone instead of UTC
- Remove dead 'sprint' variant from CalendarEvent.type union

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: format global.css with prettier

Also add .claude/worktrees/ to .prettierignore to prevent
worktree artifacts from failing format checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
dimakis added a commit that referenced this pull request Apr 24, 2026
…ests

- Fix duplicate event replay: stop replaying suspend buffer in
  handleReconnect since EventStore already covers the suspension period.
  resume() now only clears suspend state.
- Fix switchSession sending suspend: remove session_suspend from
  switchSession() — it was designed for iOS backgrounding, not session
  switching. clearSession() already stops tracking the old session.
- Fix suspend blocking all watchers: broadcast to other watchers even
  when the driver is suspended, since suspend is per-clientId not
  per-session.
- Add JSDoc to _lastClientSeq explaining it's reserved for future
  seq-based replay optimisation.
- Add integration tests for POST /api/sessions/suspend REST endpoint.
- Add unit tests for sendSuspend() on MitzoConnection.
- Update reconnect test to verify buffer events are NOT replayed.

Note: findings #4 (double-fire buffer reset) and #6 (connectionId
entropy) were already addressed — idempotency guard exists at L354,
and connectionId uses crypto.randomUUID() not Math.random().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dimakis added a commit that referenced this pull request Apr 24, 2026
* feat(harness): add proactive session suspend to protocol and registry

Signal the server BEFORE iOS kills the WebSocket, enabling event
buffering and instant resume. Adds SessionSuspendMessage to the v2
protocol, suspend/resume/bufferEvent methods to SessionRegistry with
grace timer that transitions to detach on expiry, and SUSPEND_GRACE_MS
+ SUSPEND_BUFFER_MAX constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(server): add session suspend handling, query-loop buffering, and REST endpoint

- handleSessionSuspend handler with ownership verification and OTel span
- Query loop buffers events for suspended sessions instead of delivering
- Reconnect handler replays buffered events and sends session_resumed
- WS close handler skips detach for suspended sessions
- POST /api/sessions/suspend for sendBeacon fallback (no auth, same-origin)
- vitest alias for worktree-local workspace packages
- Tests for all new handlers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(client): add proactive suspend signaling to connection and store

Sends session_suspend via WS + sendBeacon on visibilitychange:hidden,
pagehide, and Capacitor appStateChange:inactive. Enables server-side
event buffering before iOS kills the WebSocket.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(suspend): address review findings on proactive session suspend

- Only send session_suspend on switch when lastSeq > 0 (skip idle sessions)
- Log warning on suspend buffer overflow instead of silently dropping events
- Add client-side handler for session_resumed (debug log for observability)
- Use withSpan helper for handleSessionSuspend (consistent with other handlers)
- Remove worktree-only vitest.config.ts @mitzo/* aliases
- Add isSuspended/bufferEvent to query-loop and token-update test mocks

Made-with: Cursor

* fix(suspend): address self-review — idempotency, entropy, test gaps

- Make suspend() idempotent: second call refreshes grace timer but
  preserves buffered events (visibilitychange + pagehide can fire twice)
- Use crypto.randomUUID() for connectionId (replaces Math.random)
- Add query-loop test: suspended sessions buffer via registry, not transport
- Add REST endpoint tests: 204 success, 400 validation, ownership check
- Add session-registry test: second suspend preserves existing buffer

Made-with: Cursor

* fix(suspend): address Centaur review — duplicate replay, broadcast, tests

- Fix duplicate event replay: stop replaying suspend buffer in
  handleReconnect since EventStore already covers the suspension period.
  resume() now only clears suspend state.
- Fix switchSession sending suspend: remove session_suspend from
  switchSession() — it was designed for iOS backgrounding, not session
  switching. clearSession() already stops tracking the old session.
- Fix suspend blocking all watchers: broadcast to other watchers even
  when the driver is suspended, since suspend is per-clientId not
  per-session.
- Add JSDoc to _lastClientSeq explaining it's reserved for future
  seq-based replay optimisation.
- Add integration tests for POST /api/sessions/suspend REST endpoint.
- Add unit tests for sendSuspend() on MitzoConnection.
- Update reconnect test to verify buffer events are NOT replayed.

Note: findings #4 (double-fire buffer reset) and #6 (connectionId
entropy) were already addressed — idempotency guard exists at L354,
and connectionId uses crypto.randomUUID() not Math.random().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix prettier formatting in ws-handler-v2 test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(suspend): address Codex review — sendBeacon fallback + auth

- Fix sendBeacon double-send: only fire sendBeacon when WS send fails
  or socket is closed. Prevents duplicate suspend signals that refresh
  the grace timer twice and extend suspension.
- Add authentication to POST /api/sessions/suspend: verify session
  cookie (sendBeacon sends cookies automatically on same-origin). The
  endpoint was unauthenticated and relied solely on connectionId
  ownership, which could be replayed.
- Update tests to require auth cookie for suspend endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant