Repository navigation
feat: keep a project in step with a deployment's remote source - #77
Merged
Merged
Conversation
A deployment can name a remote source with GAMMA_SOURCE_NAME and GAMMA_SOURCE_URL, served at /api/source. The reader then opens one project for that source and checks it when the library opens and when the reader returns to it. When the source has changed it says so, and Sync brings in added and changed files and removes the ones that left. A file edited in the library since the last sync is kept rather than replaced, and counts as synced, so its next version arrives once the edit reaches the source. The source is any address serving a listing of paths and opaque versions and each file under its path; the reader knows nothing about where it comes from or who may read it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A deployment can bind the reader to a remote source. The reader then keeps one project in step with it. It checks the source on its own, but only syncs when the reader asks. This is how brain2.lesscap.com serves the team knowledge base. The source itself is lesscap/work#1.
The reader stays generic. Nothing in it knows about GitHub, brain2, or who may read: sign-in belongs to the site in front of it.
Configuration
GAMMA_SOURCE_NAME=brain2 GAMMA_SOURCE_URL=/work/brain2 # same origin, behind the site's sign-inThe server returns these at
GET /api/source. Without them it returns 404 and nothing changes.Source protocol
Versions are opaque strings. They only need to change when the content changes.
Behaviour
source-<name>, creating it if needed. A/p/<id>link to another project still wins.Code
features/source/:protocol.ts: the protocol types and checks;plan.ts:planSyncandsnapshotAfter, both pure;use-source-sync.ts;sync-status.tsx;load-source.ts.source-config.tsand one route inapp.ts.project-root(open the source's project),project-store(openSourceProject), the optionalProject.source, one line in the file panel,library.reload, and one storage key base.Verification
pnpm checkpasses. New tests:planSyncunit tests: changes, removals, edits kept, first sync, and the next version arriving;/api/source;/p/source-brain2, reports changes, and syncs in about 7.5 s;