Skip to content

Commit 6d475f8

Browse files
heqikaicursoragent
andcommitted
feat(desktop): add macOS Tauri app with bundled Node runtime
Ship a desktop MVP that stages embedded Node + CodeDelta server, serves the existing web UI on a single port, and wraps it in Tauri with single-instance and lifecycle management. Includes staging script, CI workflow, boot screen, and docs. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5c7b754 commit 6d475f8

84 files changed

Lines changed: 10921 additions & 7 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Desktop (macOS)
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- 'apps/desktop/**'
9+
- 'apps/web/**'
10+
- 'packages/**'
11+
- 'scripts/desktop-stage.mjs'
12+
- 'src/**'
13+
14+
jobs:
15+
build-macos:
16+
runs-on: macos-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: '22'
23+
cache: npm
24+
25+
- name: Install Rust
26+
uses: dtolnay/rust-toolchain@1.88.0
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Stage desktop runtime
32+
run: npm run stage:desktop
33+
34+
- name: Build desktop app
35+
run: npm run build:app -w @codedelta/desktop
36+
37+
- name: Upload dmg artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: codedelta-macos-dmg
41+
path: |
42+
apps/desktop/src-tauri/target/release/bundle/dmg/*.dmg
43+
if-no-files-found: error
44+
45+
# Optional: add APPLE_CERTIFICATE / notarytool steps when signing secrets are configured.

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ npm-debug.log*
4949

5050
# CodeDelta local cache (repos, snapshots, settings)
5151
.codedelta/
52+
.codedelta-desktop-smoke/
53+
54+
# Desktop bundled runtime (generated by npm run stage:desktop)
55+
apps/desktop/src-tauri/resources/runtime/
56+
apps/desktop/src-tauri/target/
57+
apps/desktop/src-tauri/.cargo-home/
58+
59+
# Local-only docs (not for GitHub)
60+
docs/codedelta/wechat-article-codedelta.md
5261

5362
test_frameworks
5463

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ packages/
193193
codedelta-trace-engine/
194194
codedelta-provider-runtime/
195195
apps/web/ # React UI
196+
apps/desktop/ # macOS desktop shell (Tauri 2)
196197
```
197198

198199
Roadmap and deferred work: [docs/codedelta/ROADMAP.md](docs/codedelta/ROADMAP.md).
@@ -205,6 +206,34 @@ Roadmap and deferred work: [docs/codedelta/ROADMAP.md](docs/codedelta/ROADMAP.md
205206
- UI: tables/lists (no full graph canvas yet)
206207
- Symbol click opens **file** diff, not symbol-to-hunk mapping
207208

209+
## Desktop (macOS)
210+
211+
CodeDelta ships a **macOS desktop app** (`apps/desktop`) that bundles Node 20 and the API server — no separate Node install required for end users.
212+
213+
**Requirements to build:** macOS (arm64 or x64), [Xcode Command Line Tools](https://developer.apple.com/xcode/resources/), [Rust 1.88+](https://rustup.rs/) (use `rustup`; Homebrew `cargo` alone may be too old), and repo dev dependencies (`npm ci`).
214+
215+
```bash
216+
# One-time: stage embedded Node + server runtime (~200MB under apps/desktop/src-tauri/resources/runtime/)
217+
npm run stage:desktop
218+
219+
# Build .app + .dmg (unsigned; Gatekeeper may prompt on first open)
220+
npm run build:desktop
221+
222+
# Dev: API + Vite + Tauri window (uses localhost:5173 + :3847, not bundled runtime)
223+
npm run dev:desktop
224+
```
225+
226+
**Runtime data:** `~/Library/Application Support/CodeDelta` (repos, snapshots, settings).
227+
228+
**Git:** must be on `PATH` for import/compare/trace (the app shows a banner if `git` is missing).
229+
230+
| Variable | Desktop default | Meaning |
231+
|----------|-----------------|---------|
232+
| `CODEDELTA_CACHE_DIR` | `~/Library/Application Support/CodeDelta` | Cache root (set by Tauri) |
233+
| `CODEDELTA_MONOREPO_ROOT` | bundled `runtime/app` | CodeGraph dist root |
234+
| `CODEDELTA_STATIC_DIR` | bundled `runtime/web-dist` | Web UI static files |
235+
| `CODEDELTA_DESKTOP` | `1` | Desktop mode flag |
236+
208237
## Development
209238

210239
```bash
@@ -222,6 +251,9 @@ Environment variables:
222251
|----------|---------|---------|
223252
| `CODEDELTA_CACHE_DIR` | `.codedelta/` | Cache root |
224253
| `CODEDELTA_PORT` | `3847` | API port |
254+
| `CODEDELTA_MONOREPO_ROOT` | (monorepo root) | CodeGraph dist root; required for desktop bundle |
255+
| `CODEDELTA_STATIC_DIR` || Serve web UI from this directory (desktop production) |
256+
| `CODEDELTA_DESKTOP` || When `1`, default cache dir on macOS is Application Support |
225257
| `CODEDELTA_SNAPSHOT_TIMEOUT_MS` | `120000` | Snapshot build timeout |
226258
| `CODEDELTA_SNAPSHOT_MAX_NODES` | `50000` | Snapshot node cap |
227259

apps/desktop/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target/
2+
/app-icon.png
3+
/app-icon.ppm
4+
/.cargo-home/

apps/desktop/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@codedelta/desktop",
3+
"version": "0.1.0",
4+
"private": true,
5+
"description": "CodeDelta desktop shell (macOS, Tauri 2)",
6+
"scripts": {
7+
"dev": "PATH=\"$HOME/.cargo/bin:$PATH\" tauri dev",
8+
"build:app": "PATH=\"$HOME/.cargo/bin:$PATH\" tauri build"
9+
},
10+
"devDependencies": {
11+
"@tauri-apps/cli": "^2.5.0"
12+
},
13+
"license": "MIT"
14+
}

0 commit comments

Comments
 (0)