Skip to content
ab-613Public

About

The Featherweight Desktop & Browser IDE (<0.2s startup, ~35MB RAM, zero build step, Vanilla JS + Python)

Resources

Stars

246 stars

Watchers

2 watching

Forks

Repository files navigation

LiteCode ⚡

The Featherweight Desktop & Browser IDE.
< 0.2s startup • ~35 MB RAM footprint • Zero build step • Pure Vanilla HTML/CSS/JS • Monaco Editor • Seti Icons • xterm.js

Live Demo Architecture Docs License: GPL-3.0

LiteCode Workbench Animated Demo

🎞️ View Multi-View Animated GIF Tour (Explorer • Search • Git Graph • Run & Debug)

LiteCode 4-Step Animated GIF Tour

LiteCode is an ultra-lightweight, zero-bloat code editor and full development workbench designed to replicate the exact look, density, keyboard muscle memory, and core workflow of Visual Studio Code—without the 1.5–2 GB Electron memory overhead.

It runs seamlessly in two modes from the exact same zero-build codebase:

  1. Desktop Mode (Primary — Native OS Speed): Launch LiteCode.bat (Windows), ./litecode.sh (macOS/Linux), or python server.py --desktop to open LiteCode in a native frameless desktop window backed directly by your local OS filesystem, native Git CLI, Git Credential Manager, and native OS shell (PowerShell, bash, or zsh).
  2. Browser Mode (Zero-Install Web IDE): Host statically on Cloudflare Pages / GitHub Pages (or open in any Chromium browser) to edit local folders via the File System Access API (showDirectoryPicker), persist virtual workspaces in IndexedDB, and run Node.js / Linux commands inside an in-browser WebContainer.

📊 Why LiteCode?

Metric Electron IDE (VS Code) LiteCode (Desktop Mode)
Cold Startup Time 2.5s – 5.0s < 0.2s (Instant)
Idle RAM Usage ~650 MB – 1.8 GB ~35 MB (Shared OS WebView + Python stdlib)
Disk Footprint ~450 MB < 450 KB total repository size
Build / Bundler Step Complex Webpack / Vite / Electron build Zero-build (index.html, style.css, script.js, server.py)

✨ Complete Feature Set

1. Real Multi-Model Monaco Editor & Emmet

  • Per-Tab ITextModel & ICodeEditorViewState: Every open tab preserves its own independent undo/redo stack (Ctrl+Z / Ctrl+Y), cursor position, selection, and scroll position.
  • Emmet Abbreviation Expansion: Built-in Emmet support (emmet-monaco-es) + quick snippets (!, html:5, link:css, script:src, .container, ul>li*3) across HTML, CSS, SCSS, Less, JSX, and TSX.
  • Clickable Local File Links (Ctrl+Click): import, require(), <script src="...">, <link href="...">, and CSS url(...) paths in the editor are automatically linked—hold Ctrl/Cmd and click to open the target file directly in a new tab.
  • Synced Monaco Context Menus Everywhere: Right-clicking inside the Monaco editor, file tree, tabs, activity bar, or terminal opens a unified, pixel-accurate VS Code Dark+ context menu wired to real Monaco and workbench commands (Go to Definition, Go to Symbol, Rename Symbol, Change All Occurrences, Format Document, Cut/Copy/Paste).

2. Full Local Git & PAT-Free GitHub Integration (Ctrl+Shift+G)

  • Pre-Init Onboarding View: Open any folder and immediately choose to:
    • Initialize Repository (git init -b main) locally.
    • Publish / Connect to a GitHub Repository (pick from your GitHub account or create a brand-new public/private repo in one click).
    • Clone / Open a GitHub Repository directly into your workspace.
  • PAT-Free GitHub Sign-In (Sign in with GitHub):
    1. 1-Click Native Sign-In (Git Credential Manager / gh CLI): Automatically detects existing credentials from Windows/macOS/Linux Git Credential Manager (git credential fill) or triggers the native OS browser sign-in window—no Personal Access Token needed.
    2. GitHub OAuth Device Flow (github.com/login/device): Generates an 8-character one-time code, copies it to your clipboard, opens GitHub in your browser, and automatically polls until authorized.
    3. PAT Fallback: Optional collapsible section for headless or restricted environments.
  • Complete Daily Git Workflow:
    • Separate Staged Changes and Changes trees with individual Open File, Stage (+), Unstage (-), Discard Changes (↶), and side-by-side/inline Diff Inspector.
    • Split ✓ Commit | v button supporting Commit, Commit (Amend), Commit & Push, and Commit & Sync.
    • Interactive Branch Picker in the Status Bar (Create New Branch..., checkout existing branches) and real Fetch / Pull / Push / Sync actions.
    • Collapsible GRAPH commit history at the bottom of Source Control—click any commit to inspect its full git show --stat --patch diff inside Monaco.

3. Authentic VS Code Sidebar Views

  • Explorer (Ctrl+Shift+E): Workspace file tree with official 19px Seti UI file icons, inline file/folder creation and rename (F2), drag-and-drop / clipboard file operations, and bottom-docked Open Editors, Outline (live symbol extractor), and Timeline sections.
  • Search & Replace (Ctrl+Shift+F): Multi-file workspace search and replace with collapsible Replace input, inline Aa (Match Case), ab (Match Whole Word), .* (Use Regular Expression), and AB (Preserve Case) toggles, plus highlighted match previews and single-match or file-wide replacement.
  • Run and Debug (Ctrl+Shift+D): One-click Run and Debug button that executes the active .py, .js, .ts, .sh, or .bat script in the integrated terminal (or launches Live Preview for .html files), plus automatic .vscode/launch.json generation.
  • Extensions (Ctrl+Shift+X): Browse, filter (@installed, @popular, @recommended), install, disable, or uninstall extensions with split Install | v menus.

4. Integrated Dock (Terminal, Problems, Output, Ports) & AI Assistant

  • **Live-Streaming VS Code Terminal (Ctrl+\``):** Powered by xterm.js+FitAddon with authentic Dark+ ANSI colors. Streams output line-by-line in real time via NDJSON (/api/exec_stream), supports **Ctrl+C** process tree cancellation (/api/exec_kill), auto-detects localhost dev server ports (http://localhost:3000`, :5173, :8000) for 1-click Live Preview, and runs inside an in-browser WebContainer when hosted on the web.
  • Hybrid Eager + Lazy Monorepo Loader: Small/medium projects ($\le 150$ files) load into memory in a single shot for 0ms tab switches and instant regex search; large monorepos lazy-load files on demand via GET /api/read in < 5ms.
  • Live HTML Preview (Ctrl+Shift+V): Preview HTML/CSS/JS projects side-by-side inside an editor tab.
  • BYOK AI Engineer (Ctrl+Alt+B): Optional right-hand AI coding assistant (agent.js) powered by Gemini SSE streaming with workspace search, surgical file editing, inline diff review (Accept / Reject), and terminal command execution.

🚀 Quick Start

Option 1: Native Desktop Mode (Recommended)

Prerequisites: Python 3.8+ (uses only the Python standard library—zero pip install dependencies required).

  • Windows (One-Click): Double-click LiteCode.bat (launches the native window directly with pythonw—no stray CMD window) or drag-and-drop any project folder onto LiteCode.bat.
  • Install litecode . CLI & "Open with LiteCode" Right-Click Menu (Optional 1-Time Setup):
    python server.py --install
    • Adds litecode to your User PATH so you can type litecode . inside any folder in your terminal (just like code .).
    • Registers "Open with LiteCode" in the Windows Explorer right-click context menu for folders (uses HKCU—no Admin required).
  • macOS / Linux:
    chmod +x litecode.sh
    ./litecode.sh .
  • Open Any Folder Directly:
    python server.py --desktop /path/to/your/project
    (Automatically selects a free localhost port starting at 8765, so it never collides with your 8000 / 3000 / 5173 dev servers).

Option 2: Local Web Server Mode

Run the backend server and open http://127.0.0.1:8080 in any browser:

python server.py --port 8080

Option 3: Static Browser Deployment (GitHub Pages / Cloudflare Pages)

Because LiteCode has zero build steps, it deploys directly to GitHub Pages (https://ab-613.github.io/LiteCode/) via the included .github/workflows/pages.yml workflow and coi-serviceworker.js (which automatically enables Cross-Origin Isolation on GitHub Pages so in-browser WebContainers boot with zero server config).

Or deploy to Cloudflare Pages under any project name:

npx wrangler pages deploy . --project-name litecode-ide

🧪 Included Examples (examples/)

Open the examples/ folder in the LiteCode Explorer to test the workbench immediately:

Example File What It Demonstrates How to Run
examples/web-app/index.html Interactive counter & CPS meter with linked styles.css and app.js. Open examples/web-app/index.html and press Ctrl+Shift+V (or click the Open Live Preview icon in the top-right tab bar). Try Ctrl+Click on styles.css or app.js!
examples/python-quickstart.py Zero-dependency Python benchmark & ANSI terminal output. Open the file, switch to Run and Debug (Ctrl+Shift+D), and click Run and Debug (or run python examples/python-quickstart.py in the Terminal).
examples/node-quickstart.js Node.js script compatible with both Desktop Mode and Browser WebContainers. Open the file and click Run and Debug, or run node examples/node-quickstart.js in the Terminal.

⌨️ Keyboard Shortcuts

Shortcut Action
Ctrl+P / Cmd+P Quick Open: Fuzzy search and jump to any file in the workspace
Ctrl+Shift+P / F1 Command Palette: Run any editor or workbench command
Ctrl+S Save Active File to disk / File System API / IndexedDB
Ctrl+B Toggle Primary Sidebar
`Ctrl+`` Toggle Integrated Terminal Panel
Ctrl+Alt+B Toggle AI Engineer Panel
Ctrl+Shift+E Focus Explorer View
Ctrl+Shift+F Focus Search & Replace View
Ctrl+Shift+G Focus Source Control (Git) View
Ctrl+Shift+D Focus Run and Debug View
Ctrl+Shift+X Focus Extensions View
Ctrl+Shift+V Open Live HTML Preview Tab
Ctrl+W Close Active Editor Tab
Ctrl+Shift+T Reopen Closed Editor Tab
F2 Rename Selected File/Folder (Explorer) or Rename Symbol (Editor)
Delete Delete Selected File/Folder (when Explorer is focused)

🏗️ Project Architecture

LiteCode/
├── index.html                  # App shell: loads Codicons, Monaco AMD loader, xterm.js, Emmet, KaTeX
├── style.css                   # VS Code Dark+ theme, 19px Seti icon mappings, compact workbench layout
├── script.js                   # Core IDE engine: FSManager, EditorManager, TerminalManager, Git SCM, Views
├── agent.js                    # BYOK Gemini SSE streaming agent with tool-calling & inline diffs
├── server.py                   # Zero-dependency Python stdlib desktop backend (FS, Shell, Git, OAuth)
├── seti.woff                   # Official Seti UI file icon font
├── LiteCode.bat                # Windows 1-click desktop launcher
├── litecode.sh                 # macOS / Linux 1-click desktop launcher
├── package.json                # Convenience npm scripts (start, desktop, serve, deploy)
├── _headers                    # COOP/COEP headers for Cloudflare Pages WebContainer support
└── examples/                   # Ready-to-run HTML/CSS/JS, Python, and Node.js examples
    ├── web-app/
    │   ├── index.html
    │   ├── styles.css
    │   └── app.js
    ├── python-quickstart.py
    └── node-quickstart.js

Desktop Backend API (server.py)

When running in Desktop Mode, server.py exposes a clean JSON REST API on 127.0.0.1 (see docs/ARCHITECTURE.md for the full technical deep-dive):

  • GET /api/ping — Returns runtime mode, OS platform, workspace root, and live Git status.
  • GET /api/workspace — Scans workspace tree using a hybrid eager/lazy budget and returns file metadata + Git status.
  • GET /api/read?path=... — On-demand lazy loader for large files or monorepos (> 150 files).
  • POST /api/write, /api/mkdir, /api/delete, /api/rename — Atomic filesystem operations.
  • POST /api/set_workspace — Opens the native OS folder picker dialog and switches the active workspace root.
  • POST /api/exec_stream & /api/exec_kill — Real-time NDJSON line-by-line terminal process streaming + Ctrl+C process-tree termination.
  • POST /api/git — Executes real Git & GitHub operations (status, init, stage, unstage, discard, commit, fetch, pull, push, sync, checkout, set_remote, clone, show_commit, file_diff, github_native_auth, github_device_start, github_device_poll).

📚 Additional Documentation


📜 License & Disclaimer

Licensed under the GNU General Public License v3.0 (GPL-3.0).

Disclaimer: LiteCode is an independent, community-built open-source code editor and is not affiliated with, endorsed by, or sponsored by Microsoft Corporation (Visual Studio Code) or Google LLC.

About

The Featherweight Desktop & Browser IDE (<0.2s startup, ~35MB RAM, zero build step, Vanilla JS + Python)

Resources

Stars

246 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages