Skip to content

feat: start a project from a git repository or template - #34

Merged
robertjndw merged 2 commits into
mainfrom
feat/git-template-import
Oct 23, 2026
Merged

robertjndw merged 2 commits into
mainfrom
feat/git-template-import

Conversation

@robertjndw

Copy link
Copy Markdown
Owner

What and why

Lets people start a project from a public Git repository, optionally from a branch, tag or folder. It's a one-time copy with no link back to the repository, so a repo of templates can serve as a starting point.

  • The dialog looks up the branches as soon as a URL is pasted, then lists the folders, with Typst folders first. Links to /tree/<ref>/<folder> land on that branch and folder.
  • Projects are built in the browser, so the browser fetches a shallow snapshot with isomorphic-git. The server only relays the two read-only upload-pack requests on /api/git/: https only, no private or loopback addresses (checked at DNS time), redirects re-checked, and size and time caps.
  • Admins can list templates (TYPSTRY_TEMPLATES), limit hosts (TYPSTRY_GIT_HOSTS) or turn it off (TYPSTRY_GIT_IMPORT=off). Not available in the static build.

Checklist

  • The checks in CONTRIBUTING.md pass locally
  • Docs updated if behaviour, configuration or a known limit changed
  • No changes under fixtures/compat/, and a format change follows Compatibility

The server relays the two read-only smart HTTP requests a clone needs, and the browser fetches a shallow snapshot with isomorphic-git and imports it like a zip. Admins can list templates and limit the hosts.
- don't report progress from read(), so a failed read no longer leaves
  the folder picker stuck on "Reading files"
- share one isomorphic-git cache across fetch, readTree and readBlob
- resolve branch names with slashes in pasted links against the real refs
- keep only the current snapshot in memory
- start the relay deadline before reading the request body
- keep the combobox highlight within the rendered rows
- drop a redundant blob copy and a stale debounce skip
@robertjndw
robertjndw merged commit 1817a45 into main Oct 23, 2026
10 checks passed
@robertjndw
robertjndw deleted the feat/git-template-import branch October 23, 2026 21:37
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