Skip to content

feat: serve a git repository as the library's source from the reader's own server - #81

Merged
bencode merged 2 commits into
mainfrom
feat/built-in-source
Oct 3, 2026
Merged

bencode merged 2 commits into
mainfrom
feat/built-in-source

Conversation

@bencode

@bencode bencode commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Moves the source service from lesscap/work into the reader's server, so anyone can follow a local repository with one command:

GAMMA_SOURCE_NAME=notes GAMMA_SOURCE_WORKTREE=$HOME/notes pnpm dev

Set GAMMA_SOURCE_NAME with exactly one of these:

  • GAMMA_SOURCE_WORKTREE serves the files on disk, committed or not, leaving out what git ignores.
  • GAMMA_SOURCE_REPO serves the committed files of a clone the server pulls every GAMMA_SOURCE_PULL_SECONDS.
  • GAMMA_SOURCE_URL names an address that already serves a source. This is unchanged.

A served repository appears at /api/library, and /api/source points the reader there. The browser protocol is unchanged, so ui-packages/web is untouched apart from dropping the /work dev proxy, which nothing needs any more. GAMMA_SOURCE_INCLUDE is now optional; leaving it out lists the whole repository. The README gains a "Sync from a repository" section.

The code comes from lesscap/work web-packages/brain2, with its tests. brain2.lesscap.com still runs that service and is left alone here.

Checked:

  • pnpm check.
  • Against a local brain2:
    • /api/source points at /api/library, and the listing has 1,839 files.
    • An uncommitted file shows up at once and leaves when deleted.
    • In a browser, the brain2 project syncs with only the reader running; nothing listens on 3310.

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