Commit bde8122
feat: migrate from electron to tauri (#37)
* feat: add Tauri 2.0 POC project structure (Electron → Tauri migration Fase 1)
- Add src-tauri/ with Cargo.toml, Rust entry points, and shell detection commands
- Add tauri.conf.json with frameless window, CSP, and capabilities config
- Add TauriTerminal component (xterm.js + tauri-plugin-pty + WebGL)
- Add TauriTitleBar with Tauri window API (minimize/maximize/close/drag)
- Add TauriApp entry point with show-on-ready pattern
- Add vite.config.tauri.ts for dual-build (Electron + Tauri side-by-side)
- Add tauri-index.html as separate entry for Tauri build
- Add Tauri npm deps (@tauri-apps/api, tauri-pty, @tauri-apps/plugin-os)
- Add dev:tauri and build:tauri scripts to package.json
- Update .gitignore for dist-tauri/ and src-tauri/target/
- All 653 existing tests pass, both typechecks pass
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: resolve code review findings in Tauri POC (F1-F5)
- F1 [HIGH]: Store PTY event handler disposables, unlisten on cleanup
- F2 [MEDIUM]: Track WebGL addon in ref, dispose explicitly, check disposed flag
- F3 [MEDIUM]: Fix race condition in TauriTitleBar resize listener with mounted flag
- F4 [MEDIUM]: Add disposedRef guard to ResizeObserver, fix cleanup order
- F5 [MEDIUM]: Validate PATH-based shells on Windows using 'where' command
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: add url config to tauri window for production build
Tauri defaults to loading index.html but our entry is tauri-index.html.
Without explicit url config, the frontend never loads and window stays hidden.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: add gitignore for agent files
* chore: untrack docs folder and add to gitignore
* feat(pty): add Rust PTY manager with multi-terminal support
* feat(trackers): add Rust CWD, Git, and exit code trackers
* feat(commands): register Tauri IPC commands and wire Rust backend modules
* feat(terminal-api): add Tauri terminal IPC adapter layer
* fix(types): add index signature to TerminalSpawnOptions for Tauri invoke
* feat(terminal): migrate ConnectedTerminal to Tauri terminal API
* refactor(hooks): migrate terminal tracking hooks to Tauri API
* build(deps): add Tauri plugin dependencies for persistence, fs, dialog, clipboard
* feat(persistence): add Tauri persistence and filesystem adapter
* feat(adapters): add Tauri dialog, clipboard, and window adapter
* feat(api): add unified API bridge and barrel exports
* refactor(hooks): migrate persistence and filesystem hooks to Tauri adapter
* refactor(stores): migrate Zustand stores to Tauri adapter
* refactor(components): migrate UI components to Tauri adapter
* refactor(app): migrate pages, layout, and TauriApp to full Tauri UI
* test: add Tauri mock infrastructure and adapter unit tests
* fix: correct IPC argument mapping, event shapes, window controls, and shell detection
* fix: resolve shell default, filesystem timeout, and window state edge cases
* build(deps): add Tauri updater and process plugin dependencies
* feat(updater-api): add Tauri updater adapter with safe update and version skip
* refactor(updater): migrate updater store and hooks to Tauri plugin
* ci: add Tauri release workflow and update PR validation
* test: add updater adapter tests and update existing test suites
* feat(tauri): complete Fase 4 - add backup/rollback adapters and NSIS config
AC-10: Implement backup and rollback Tauri adapters
- Add tauri-backup-api.ts with createBackup, listBackups, restoreBackup, cleanupOldBackups
- Add tauri-rollback-api.ts with keepPreviousVersion, availableRollbacks, installRollback
- Use @tauri-apps/plugin-fs and @tauri-apps/plugin-store instead of Electron APIs
- Add 13 tests covering API structure and error handling
AC-12: Update README with Tauri build instructions
- Add Tauri 2.0 badge and dual backend support description
- Document Rust toolchain and platform-specific prerequisites
- Add Tauri development and build commands
- Include migration status link
AC-14: Create benchmark documentation
- Add docs/benchmark-electron-vs-tauri.md with comparison tables
- Document bundle size, RAM usage, startup time targets
- Include methodology and measurement procedures
AC-15: Enhance NSIS installer configuration
- Add windows.nsis config with installMode, languages, shortcuts
- Configure publisher, copyright, and category metadata
- Set up WebView2 bootstrapper for Windows
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: spam terminal
* fix: add isTauriContext guards to prevent browser crash
Without these guards, getCurrentWindow() throws TypeError in plain
browser because window.__TAURI_INTERNALS__ is undefined. This crashed
the entire React app via error boundary when TitleBar.tsx called
windowApi.onMaximizeChange() in a useEffect.
- tauri-window-api.ts: add isTauriContext() helper, guard all methods
(minimize, toggleMaximize, close, onMaximizeChange, onCloseRequested,
respondToClose) to return early/noop when not in Tauri context
- TauriApp.tsx: guard showWindow() call with isTauriContext check
- TitleBar.tsx: related cleanup from guard addition
* fix: defer initial fitAddon.fit() to requestAnimationFrame
WebglAddon.activate() is async internally. Calling fitAddon.fit()
synchronously right after loadWebglAddon() caused an uncaught:
TypeError: Cannot read properties of undefined (reading 'dimensions')
5 times on startup (once per terminal), sourced from xterm's
RenderService.get dimensions() -> this._renderer.value.dimensions
where _renderer.value is undefined until WebGL finishes initializing.
Fix: wrap initial fit() call in requestAnimationFrame() so the WebGL
renderer has one frame tick to complete initialization.
Also fixes debounce test regression: add mockClear() after spawn
assertion to account for the needsResizeOnReadyRef immediate-resize
path that fires before the xterm onResize debounce under test.
* perf: reduce PTY kill timeout from 2000ms to 300ms
Reduces perceived lag when closing a terminal tab. The kill operation
should be near-instant for graceful shutdown; 300ms is a sufficient
safety margin for the race to avoid hanging the close flow.
* refactor(tauri): consolidate GitStatus type to shared IPC contract
- Re-export GitStatus from @shared/types/ipc.types in project.ts
- Update use-git-status.ts to import from shared types
- Ensures type consistency between Rust backend and renderer
- Eliminates duplicate GitStatus definition
This aligns the renderer domain model with the Tauri IPC contract,
ensuring the GitStatus interface matches the Rust tracker's serialized
output (camelCase, same fields).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(shared): add canonical Migration API contract
Define canonical MigrationApi interface with 6 methods:
- getVersion, getSchemaInfo, getHistory, getRegistered, runMigration, rollback
- Add IpcResult<T> type definitions for error handling
- Document Rust command naming mapping (snake_case)
This contract is used by both renderer adapters and Rust backend.
* feat(rust): implement data migration backend with store plugin
- Add MigrationManager with Tauri store plugin integration
- Implement data_migration_get_registered: return actual migrations
- Implement data_migration_run_migrations: process pending migrations
- Implement data_migration_rollback: execute rollback to version
- Register MigrationManager in app state
Replaces placeholder implementations with working backend.
* fix(rust): fix CWD and Git tracker polling not starting
- Fix ensure_polling_started() implementation (was empty)
- Add interior mutability pattern (Arc<RwLock<Option<JoinHandle>>>)
- Add is_polling_started atomic flag for proper one-time initialization
- Add poll_count indicator for testability
- Fix shutdown() to properly abort tasks
Closes: CWD changes were never detected, terminal-cwd-changed event never fired
* feat(renderer): add Tauri adapters for Session and Data Migration
- Implement SessionApi interface using @tauri-apps/plugin-store
- Implement MigrationApi interface with canonical contract
- Map invoke calls to Rust commands (snake_case)
- Handle IpcResult<T> success/error responses
These adapters complete the Tauri implementation for Session and Data Migration domains.
* refactor(renderer): make facade Tauri-first with Electron compatibility
- Add isTauriContext() guard using window.__TAURI_INTERNALS__
- Export sessionApi from Tauri adapter on Tauri runtime
- Export dataMigrationApi from Tauri adapter on Tauri runtime
- Mark session-api.ts and data-migration-api.ts as deprecated (Electron only)
- Add explicit error boundaries for wrong context usage
BREAKING-CHANGE: Session and Data Migration APIs now route to Tauri
by default. Electron fallback available via compatibility modules.
* docs(renderer): document keyboard and system event fallback mode
- Document Fallback Mode decision for keyboard events (WebView2 limitation)
- Document Heartbeat approach for system power-resume (chosen, not workaround)
- Add TODO for what would be needed for Backend Event Mode
- Reference decision document from keyboard/system APIs
Decision: Fallback Mode over Backend Event Mode due to technical limitations.
See: docs/decisions/keyboard-system-event-mode-final.md
* feat(renderer): implement bootstrap context detection and visibility integration
- Add isTauriContext() detection in main.tsx bootstrap
- Route to TauriApp component when Tauri context detected
- Integrate visibility state with backend terminal_set_visibility command
- Ensure visibility-aware polling works end-to-end
Enables CPU-saving pause/resume behavior for trackers when app hidden.
* test(renderer): add test suite for Session, Data Migration, and parity
- Add 18 automated parity checks (Implemented/Wired/Verified per domain)
- Test Session adapter with all 5 methods (save, restore, clear, flush, hasSession)
- Test Data Migration adapter with canonical contract (rollback payload shape)
- Test facade routing uses Tauri adapters on Tauri runtime
- Add visibility transition and recovery scenarios
Covers regression prevention for Tauri-first facade pattern.
* test(main): add Electron IPC compatibility tests
- Test session:save, session:restore, session:clear, session:flush, session:hasSession
- Test dataMigration:runMigrations, dataMigration:rollback, etc.
- Verify IpcResult pattern compatibility between Electron and Tauri
- Validate legacy vs canonical method name mappings
Ensures Electron compatibility path continues working during coexistence.
* chore: update supporting types and preload interfaces
- Sync preload TypeScript definitions with Tauri API changes
- Update project types for new migration domain types
- Minor main process adjustments for compatibility
No functional changes, type sync only.
* feat: add logging support for terminal events and improve PTY management
* feat: enhance PTY management with dedicated writer and improve error handling in IPC tests
* feat: add various icon assets for Tauri application including adaptive icons and SVG
* feat: update Tauri configuration and dependencies, add MCP bridge plugin
* feat: add Git Bash path candidates and improve shell resolution on Windows
* feat(tauri): eliminate cmd.exe spawn for shell detection
- add resolve_executable_from_path() to search PATH without spawning cmd
- add is_builtin_windows_shell() to allow known shells without PATH resolution
- cache shell detection results with OnceLock to avoid repeated lookups
- add debug logging for shell availability checks
* feat(tauri): improve pty manager spawn and orphan detection
- replace CommandExt CREATE_NO_WINDOW with resolve_executable_from_path
- refactor orphan detection loop to use tokio interval
- extract reader/writer setup into cleaner patterns
* feat(tauri): stabilize git tracker polling and spawn-less git detection
- replace git binary detection via cmd spawn with resolve_command_candidates_from_path
- use RwLock + AtomicBool for thread-safe polling state
- apply rustfmt formatting to cwd_tracker and exit_code_tracker
* chore(tauri): apply rustfmt to migrations.rs
* feat(renderer): async terminal restore with pty spawn on startup
- make restoreFromLayout and createDefaultTerminal async
- spawn PTY via terminalApi.spawn() before creating terminal store entry
- link terminal to ptyId via setTerminalPtyId after spawn
- add PROJECT_RESTORE_LOCKS to prevent concurrent restore for same project
- add normalizeShellForStartup() to skip cmd.exe on Windows Tauri
- guard setTerminalPtyId against ptyId conflicts and double-assignment
- cache detectShells IPC result on frontend to deduplicate startup calls
* feat(renderer): explicit pty spawn in workspace and autoSpawn control
- add autoSpawn prop to ConnectedTerminal to skip implicit PTY spawn
- integrate addRendererRef/removeRendererRef for PTY ref counting
- update onCloseTerminal signature to include tabId
- spawn PTY explicitly before adding terminal in WorkspaceLayout
- refactor close-confirm state to track both terminalId and tabId
* test: add/update tests for terminal restore and store
- add tests for autoSpawn=false in ConnectedTerminal
- add tests for setTerminalPtyId conflict guard in terminal-store
- add use-terminal-restore.test.ts covering normalizeShellForStartup and restore lock
* chore(tauri-platform): tighten desktop integration plumbing
* fix(migrations): execute handlers and rollback safely
* fix(terminal-runtime): harden Windows PTY and restore flow
* fix(windows-env): preserve PATH case-insensitively for PTY shells
* chore(electron-cleanup): remove legacy main and preload runtime
* chore(tooling): finalize Tauri-only build and release config
* refactor(runtime): harden Tauri renderer adapters and window state
* feat(desktop): wire native menu and recovery-aware updater flow
* feat(shortcuts): switch defaults to Tauri-safe tab navigation
* docs(repo): refresh credits and Tauri contributor metadata
* chore(types): simplify rollback request compatibility alias
* test(tauri): realign regression coverage with Tauri-only runtime
* feat(window-api): add global Window interface with API definitions
* chore(release): prepare 0.3.0 beta packaging
* ci(release): run tauri-action through npm
* chore(release): bump beta package version to 0.3.0-2
* chore(ci-docs): fix safe workflow and documentation findings
* fix(tauri-windows): harden shell test and conpty utilities
* fix(git-tracker): refresh cwd and branch polling safely
* chore(rustfmt): normalize pending Rust formatting
* fix(ci): use tauri-action@v0 and bump version to 0.3.0-3
* fix(release): restore cross-platform Rust dependencies
* fix(pty-manager): simplify default shell resolution for non-Windows environments
* docs(readme): fix linux dependency code fence
* ci(release): harden workflow and validation matrix
* fix(tauri): harden runtime and migration startup
* fix(capabilities): allow process relaunch
* ci: stabilize tauri release workflow reruns
* docs: add missing linux tauri dependency
* fix: harden migration registration and persistence
* fix: harden terminal and git tracker runtime
* ci(fork): add push-based monitoring workflow
* fix(rust): resolve clippy warnings blocking fork CI
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 7fd4dfa commit bde8122
File tree
245 files changed
+30045
-23749
lines changed- .github/workflows
- docs
- adr
- src-tauri
- capabilities
- icons
- android
- mipmap-anydpi-v26
- mipmap-hdpi
- mipmap-mdpi
- mipmap-xhdpi
- mipmap-xxhdpi
- mipmap-xxxhdpi
- values
- ios
- src
- pty
- trackers
- src
- main
- ipc
- services
- preload
- renderer
- components
- file-explorer
- terminal
- workspace
- hooks
- layouts
- lib
- __tests__
- pages
- stores
- types
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
245 files changed
+30045
-23749
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 48 | | |
54 | 49 | | |
55 | 50 | | |
56 | 51 | | |
| 52 | + | |
57 | 53 | | |
58 | | - | |
59 | | - | |
| 54 | + | |
| 55 | + | |
60 | 56 | | |
61 | 57 | | |
62 | | - | |
| 58 | + | |
63 | 59 | | |
64 | 60 | | |
65 | | - | |
| 61 | + | |
66 | 62 | | |
67 | 63 | | |
68 | | - | |
| 64 | + | |
69 | 65 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
74 | 109 | | |
75 | 110 | | |
76 | 111 | | |
77 | 112 | | |
78 | 113 | | |
79 | | - | |
80 | | - | |
| 114 | + | |
| 115 | + | |
81 | 116 | | |
82 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
83 | 137 | | |
84 | 138 | | |
85 | 139 | | |
86 | 140 | | |
87 | 141 | | |
| 142 | + | |
88 | 143 | | |
89 | | - | |
90 | | - | |
| 144 | + | |
| 145 | + | |
91 | 146 | | |
92 | | - | |
93 | | - | |
| 147 | + | |
| 148 | + | |
0 commit comments