Sources and data

community mirrored · updated

data.json

FieldDefaultMeaning
version1Schema version
communityFoldercommunityHolds each source’s mirror folder ('': vault root). publictxt-pages names the same folder in its own settings, set by hand
forkFolder''Where forks go when not to their source folder ('': vault root)
matchFolderstrueFork modal opens on Same folder as in the source
listMirrors / listForksfalseKeep a mirror / fork list in each follow note (lists.md)
clonesFolder.clonesHolds the clones; never empty
gitPathgitThe git executable, for when Obsidian lacks the shell’s PATH (macOS from Finder)
localPaths{}Remote name → absolute folder: a local source’s, or a hosted source’s local copy. Never in a note
checkFrom{}Remote name → local / remote for a hosted source with a local copy. Absent: local. Kept only for names in localPaths
state{}Source key → cache (below)

normalizeData() turns anything loaded into valid data. A folder, here or a follow note’s folder, must be a vault folder (vaultFolderInput(), src/util/validate.ts): no empty, . or .. part and no backslash, so nothing goes outside the vault. One that isn’t takes the default.

State

A cache per source key; safe to delete (at worst everything shows as new). Dropped for sources no longer followed at the next check.

FieldMeaning
seenCommitHead at the last acknowledged check. null: never checked
checkedAtISO datetime of the last check

Follow notes

A source is a note anywhere under the top-level follows/, one per repo (publictext ADR-0014, spec §3.2). The body is the user’s; the plugin touches only front matter and its own list sections.

The file name without .md is the remote name (follows/research.md → research), which mirrors and forks record. It can’t start with . or a space or contain \ / : * ? " < > | # ^ [ ]; unique, compared without case.

KeyTypeRule
urlstringCanonical repo URL. Required unless local
localtruePlugin only. A local source: no url; folder in localPaths
branchstringBranch to track. Absent/blank: the remote’s default
includestring or listRepo-relative folder prefixes ending in /. Empty: whole repo. Narrows “what’s new” only
follow_tagsstring or listPlugin only, for now (spec §13 q1). A tag combo per line: dev obsidian needs both, books -fiction leaves fiction out. Matched at each check (tags.md)
folderstringPlugin only. Mirror folder under communityFolder. Absent: the remote name
list_mirrors / list_forksbooleanPlugin only. Overrides listMirrors / listForks for this note

url, branch, include are the publictext spec’s; the rest are this plugin’s, ignored by other readers, and public with the note.

Source key (Source.url, used by state, clones and checks): the canonical URL, or local:<name>.

Reading (readFollow): local: true makes a local source whatever its url; otherwise no valid url, not a source. follow_tags: words split on spaces, a leading # dropped, - excludes; each tag once by its match form (spec §7.3), lines without a tag and repeated lines (any order or case) dropped. Paths: trailing / added to include, leading / stripped, ./.. segments dropped, lists deduped, a single string read as a list. Two notes with one URL or name: the first by path (byte order) wins, the others show as duplicates.

Canonical repo URL (v0)

https://<host>/<owner>/<repo>: scheme and host lower-cased; .git, trailing /, query and fragment dropped; git@host:owner/repo.git → HTTPS form. Owner and repo keep their case. Anything else is invalid, file: included.

Settings tab

Lists each source (name; URL, or local folder or “none here”; branch, include, mirrors to: community/txt, list switches when set; note path), duplicate and invalid notes, and Add source. Redraws when a note in follows/ changes. Folder fields (Community folder, Fork folder, the form’s Mirror folder) suggest vault folders; one that isn’t a vault folder isn’t saved, and the field says so (Clones folder too). In the form, lists are one path per line, Followed tags one combo per line; Mirror list / Fork list are Default, On, Off.

  • Add: Name, Repo URL, Local path; at least one of the last two. A URL makes a hosted source, and with a path too, the path is its local copy. A path alone (absolute, or a file:/// URL) makes a local source. Each in the other’s field is an error, not moved. URL valid and not followed; name valid and free, suggested when empty (owner-repo, or without a URL the folder’s name). Creates follows/<name>.md; a clash is an error. A folder is inspected first (local.md). A hosted repo isn’t contacted: a wrong URL shows at the first check.
  • Edit: rewrites these keys (processFrontMatter), keeping others and the body. Name and Repo URL are read-only (mirrors and forks record the name; another repo, or a URL for a local source, means remove and add). Local path can change: required for a local source; a hosted source’s, cleared, is forgotten with its checkFrom.
  • Remove: after confirming, trashes the note (trashFile) and forgets its folder here. Mirrors, forks and the clone stay.

Code

Pure: src/sources/schema.ts, repo-url.ts, follow-note.ts, edit.ts. Vault: src/sources/follows.ts, src/settings.ts, src/ui/source-modal.ts.