bfb4d8bef80b6b6ba8aa3fde12b6626d9ffab13d
Add three core VISION features on top of the barebones MVP: Git workflow (backend + frontend): - Backend: simple-git wrapper with per-project repo isolation, init (idempotent .gitignore reconciliation, handles empty repos), status, log, commit (per-commit identity via -c flags), remote, push, pull - gitFor() now refuses to run without the project's own .git, preventing accidental parent-repo detection when projects/ lives inside the typst-leaf worktree - Frontend: GitPanel (branch, ahead/behind, inline commit, push/pull, remote prompt, collapsible log), SettingsPanel (git identity in localStorage), Ctrl+Shift+S focuses commit input - Status/log refresh driven by gitVersion bumps (no polling) with cancellation guards across project switches - Auto-init on status failure for pre-existing projects Vim mode: - Off-by-default toggle persisted to localStorage - Dynamic monaco-vim import, status bar div, StrictMode-safe lifecycle via editorReady reset on unmount SyncTeX (preview → editor): - Handle tinymist/preview/scrollSource notification and window/showDocument request - Cross-platform path normalization (Windows drive letters, native backslash paths, URL-decoded paths) - Editor jump effect with Monaco selection/reveal/focus, clears on completion Robustness fixes across review cycles: - Cancellation guards on git status/log effects to prevent stale writes - bumpGitVersion after auto-init so log viewer updates - jsonOrThrow extracts structured backend errors, handles empty bodies - SettingsPanel/GitPanel validate localStorage identity shape - GitPanel clears log state on project switch - File path URI encoding preserves path separators (segment-wise encode) - tsconfig lib bumped to ES2021 for String.replaceAll AGENTS.md: removed stale execa/monaco-languageclient references PLAN.md: implementation plan for this chunk
typst-leaf 🍂
A completely self-hostable, high-performance editor for Typst, built on the philosophy of "Git as the Database."
Features:
- Instant Preview: Sub-50ms incremental compilation using
tinymist. - Live diagnostics & autocomplete from the Typst language server.
- Git Native: No hidden databases. Your projects are just folders.
- Hybrid: Run it in a browser, or as a native desktop app via Tauri.
📂 Repository Structure
typst-leaf/
├── typst-leaf-backend/ # Node.js/TS server (spawns tinymist, REST + WS)
├── typst-leaf-frontend/ # React + Monaco frontend (includes Tauri)
├── VISION.md # Project philosophy and architecture
└── AGENTS.md # Guidelines for AI coding assistants
Prerequisites
- Node.js 20+
- pnpm (10+)
- Rust (only required for the Tauri desktop wrapper)
tinymiston yourPATH— the Typst language server & preview engine:cargo install --git https://github.com/Myriad-Dreamin/tinymist --bin tinymist --locked tinymist-cli
🚀 Quick Start (Development)
# 1. Install workspace dependencies
pnpm install
# 2. Start the backend (port 4000)
pnpm --filter typst-leaf-backend dev
# 3. Start the web frontend (port 1420 — mandated by Tauri)
pnpm --filter typst-leaf-frontend dev
# 4. (Optional) Launch the Tauri desktop wrapper
pnpm --filter typst-leaf-frontend tauri dev
Then open http://localhost:1420 in your browser. A hello project is auto-seeded on first run.
Environment variables
| Var | Default | Description |
|---|---|---|
PROJECTS_ROOT |
<repo>/projects |
Directory under which project folders live. The backend refuses to read or write outside this root. |
TINYMIST_PREVIEW_HOST |
127.0.0.1 |
Host the tinymist preview server binds to. |
TINYMIST_PREVIEW_PORT |
23635 |
Port the tinymist preview server binds to. |
PORT (backend) |
4000 |
Backend HTTP/WS port. |
FRONTEND_ORIGIN (backend) |
http://localhost:1420 |
CORS origin allowed to call the REST API. |
🏗️ Architecture
- Editor: Monaco Editor
- LSP:
tinymistover a WebSocket thin proxy - Preview: Backend spawns
tinymist preview <file>on demand; the frontend iframes its webview for live SVG updates. - Data plane:
ws://localhost:4000/lsp→tinymist lsp(single active connection, takeover on reconnect)GET /api/projects,GET/PUT /api/projects/:p/file?path=…,POST /api/projects/:p/focus?path=…
Description
Languages
TypeScript
98.6%
Rust
0.5%
CSS
0.5%
HTML
0.4%