Read design files from the local checkout with a Forgejo fallback #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/local-design-reads"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Previewing design files through orbit's web dashboard required committing
and pushing to Forgejo for every change, then waiting for the API cache to
catch up before the preview reflected the update. That's a slow loop when
you're iterating on a stylesheet or a markdown spec.
This PR points orbit at the local working-tree checkout for design reads,
with the Forgejo API as a fallback when the checkout is unavailable. Set
ORBIT_SOURCE_ROOTto the directory containing your repo checkouts (e.g.,~/source), and orbit resolves{sourceRoot}/{owner}/{slug}/design/foreach registered project. Unset it to fall back to Forgejo-only reads.
The
designspackageNew
designs.Sourceinterface with three implementations.LocalSourcereads from the working tree and has traversal and symlink-escape guards —
it resolves symlinks and re-validates containment before reading to close
the TOCTOU window.
ForgejoSourcewraps the existingforgejo.Client.ChainSourcecomposes them, trying each in order and falling through onErrNotFound.Web and API handlers now depend on the
Sourceinterface rather thancalling
forgejo.Clientdirectly for design reads. Production wiring inmain.gocomposes aChainSourceofLocalSource+ForgejoSourcesolocal wins when present.
Security
The design-preview route enforces an extension allowlist (HTML, CSS, JS,
images, fonts, markdown, text — 15 types total). Unsupported extensions
return 415. Every design response carries
Cache-Control: no-storetoprevent any layer from caching stale content while iterating.
Also
Adds
CLAUDE.mdwith the repo conventions that will grow alongside thecodebase: squash-merge policy, deployment notes, source layout.
Implements the Source interface by reading design files from a local {sourceRoot}/{owner}/{slug}/design/ tree, with traversal and symlink escape guards on ReadFile. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Local-checkout design readsto Read design files from the local checkout with a Forgejo fallbackRead design files from the local checkout with a Forgejo fallbackto Read design files from the local checkout with a Forgejo fallback (test)Read design files from the local checkout with a Forgejo fallback (test)to Read design files from the local checkout with a Forgejo fallback