Skip to content

History#406

Merged
arkml merged 4 commits intodevfrom
history
Feb 27, 2026
Merged

History#406
arkml merged 4 commits intodevfrom
history

Conversation

@arkml
Copy link
Contributor

@arkml arkml commented Feb 25, 2026

Version History — Full Change Summary

New files

packages/core/src/knowledge/version_history.ts — Git-based version history engine using isomorphic-git.
Manages a dedicated git repo inside ~/.rowboat/knowledge/.

  • initRepo() — Creates a git repo in the knowledge dir on first run, stages all existing .md files,
    makes an initial commit.
  • commitAll(message, author) — Stages all changed/added/deleted .md files and commits. No-ops if
    nothing changed. Serialized via a promise-based mutex to prevent concurrent index corruption. Notifies
    registered listeners after each successful commit.
  • onCommit(listener) — Registers a callback fired after each commit. Returns a cleanup function.
  • getFileHistory(path) — Walks git log, compares blob OIDs between consecutive commits to find ones
    where the file actually changed. Returns most recent first, capped at 50 entries.
  • getFileAtCommit(path, oid) — Reads file content at a specific commit.
  • restoreFile(path, oid) — Writes historical content to disk, then commits the restoration.

apps/renderer/src/components/version-history-panel.tsx — Side panel UI for browsing and restoring
versions.

  • Shows commit list with timestamps, "Current version" label on the latest.
  • Clicking an older entry fetches that version's content and previews it read-only in the editor.
  • "Restore this version" button writes the old content back and commits it.
  • Auto-refreshes when new commits land via knowledge:didCommit IPC event.

Modified files

packages/core/src/config/config.ts

  • Fires initRepo() on startup (async, fire-and-forget via dynamic import).
  • Fixed missing trailing newline.

packages/core/src/index.ts

  • Exports versionHistory module from the @x/core barrel.
  • Fixed missing trailing newline.

packages/core/package.json

  • Added isomorphic-git dependency.

packages/core/src/knowledge/build_graph.ts

  • Calls commitAll('Knowledge update', 'Rowboat') after each successful batch in both
    buildGraphWithFiles and processVoiceMemosForKnowledge. Wrapped in try/catch so failures don't break
    graph building.

packages/core/src/workspace/workspace.ts

  • Added scheduleKnowledgeCommit — a 3-minute debounced commit. Resets on every writeFile to a
    knowledge/*.md file. Collapses an entire editing session into a single commit.

packages/shared/src/ipc.ts

  • Added 3 invoke channels: knowledge:history, knowledge:fileAtCommit, knowledge:restore with Zod
    schemas.
  • Added 1 send channel: knowledge:didCommit (fire-and-forget, for panel refresh).

apps/main/src/ipc.ts

  • IPC handlers for the 3 knowledge channels, delegating to versionHistory.
  • emitKnowledgeCommitEvent() — broadcasts knowledge:didCommit to all renderer windows.
  • Subscribes versionHistory.onCommit → emitKnowledgeCommitEvent in setupIpcHandlers.

apps/renderer/src/App.tsx

  • State: versionHistoryPath (which file's history is open) and viewingHistoricalVersion (oid + content
    of previewed version).
  • History toggle button (clock icon) in the toolbar, visible only for knowledge/*.md files.
  • Editor shows historical content read-only when a past version is selected. onChange is guarded to
    prevent the historical content from overwriting the editor cache.
  • Panel auto-closes when switching files.
  • Restore handler: calls IPC, reloads file, closes panel.

apps/renderer/src/components/markdown-editor.tsx

  • Added editable prop (defaults to true). Syncs to TipTap via editor.setEditable() in a useEffect.

Bug fixes applied during this session

  1. Race condition: commitAll is now serialized via a promise mutex — concurrent calls from user edits
    and graph builder can't corrupt the git index.
  2. History performance: getFileHistory caps results at 50 instead of walking all commits unbounded.
  3. Trailing newlines: config.ts and index.ts no longer end without a newline.
  4. Panel refresh: Panel auto-refreshes via knowledge:didCommit events after new commits land.
  5. Lock icon: Replaced with Clock icon for clearer "past version" semantics; removed unused import * as
    React.
  6. Current version bug: Guarded the editor onChange so viewing a historical version doesn't overwrite
    the editor cache, which was preventing "click back to current" from working.

@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rowboat Ready Ready Preview, Comment Feb 27, 2026 2:38pm

Request Review

@arkml arkml merged commit d7dc27a into dev Feb 27, 2026
5 checks passed
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