# Developer README [Back to RuneStone](../README.md) ## Test changes without a full rebuild From the repository folder, run: ```powershell pnpm tauri dev ``` For a fresh checkout, complete [Run from source](#run-from-source) first. This command starts Vite and opens RuneStone in a native desktop window. Keep the terminal open while you edit the source. Svelte, TypeScript, and CSS changes update through hot module replacement (HMR), or a page reload when required. Frontend changes do not need a Rust rebuild or an installer. The first launch compiles the Rust app and its dependencies. Later launches reuse Cargo's cached output. Rust changes still need compilation, but Cargo reuses unchanged build output. Tauri then restarts the app automatically. See [Tauri development](https://v2.tauri.app/develop/) and [Vite HMR](https://vite.dev/guide/features.html#hot-module-replacement) for details. ### Daily workflow 1. Start `pnpm tauri dev` in a terminal at the repository root. 2. Open a test workspace with the folder button in the development window. 3. Edit a source file in your code editor. 4. Save the source file, then test the change in the development window. 5. To stop the development session, press Ctrl+C in its terminal. Use sample documents for feature tests. The desktop app reads and writes real files. Save open documents before a change that reloads or restarts the app. A reload can reset editor state, and a Rust restart ends terminal sessions. `pnpm tauri dev` starts `pnpm dev` through `beforeDevCommand` in `src-tauri/tauri.conf.json`. Do not start a separate `pnpm dev` process for this workflow. The frontend uses port 1420, and Tauri loads `http://localhost:1420`. ### What needs a rebuild? | Change or task | Action | | --- | --- | | Svelte, TypeScript, or CSS under `src/` | Save the source file. Vite updates the interface without a Rust rebuild. | | Feature source under `plugins/` | Run `pnpm build:plugins`, then uninstall and install the changed package through Settings. | | Rust code under `src-tauri/src/` | Save the source file. Tauri rebuilds the changed Rust code and restarts the app. | | Rust dependencies or build settings | Allow Cargo to compile the affected dependencies. These changes can take longer. | | JavaScript dependencies after a pull or branch change | Stop development, run `pnpm install --frozen-lockfile`, then start `pnpm tauri dev` again. | | Tauri configuration, capabilities, or Vite configuration | Restart `pnpm tauri dev` to check the new settings. Native changes can require compilation. | | Release or installer behavior | Use the [release guide](releases.md). Packaging requires a release build. | Keep `src-tauri/target/` between sessions so Cargo can reuse its build cache. Do not run `cargo clean` as part of normal feature tests. An installed copy from the Start menu uses its packaged code and does not show source changes. Use the window that `pnpm tauri dev` opens. ## Stack RuneStone uses Tauri 2 and Rust for the desktop host. The interface uses Svelte 5, TypeScript, and Vite. CodeMirror handles live Markdown editing, Monaco handles source editing, and xterm handles terminals. Windows is the first target. The older WriterHost component remains unused. See the setup steps below to install dependencies and run the desktop app. See the [roadmap](roadmap.md) for goals and milestones. See the [product scope](product-scope.md) for capabilities and architecture constraints. Agent instructions and UI design rules live in [AGENTS.md](../AGENTS.md). See the [plugin guide](plugins.md) to build and install feature packages, use the API, and understand current plugin boundaries. ## Run from source These steps are for developers. App users can use the [Windows installer](installation.md). ### Requirements - Node.js 22.12 or later and pnpm - A current stable Rust toolchain - Microsoft C++ Build Tools and Microsoft Edge WebView2 on Windows Use the [Tauri prerequisites guide](https://v2.tauri.app/start/prerequisites/) to install the Windows build tools and Rust toolchain. 1. Download or clone this repository. 2. Open a terminal in the repository folder. 3. Run `pnpm install --frozen-lockfile`. 4. Run `pnpm tauri dev`. 5. Use the folder button in the app to open a workspace or create one. See the [release guide](releases.md) to build a Windows installer. ## Checks Run checks from the repository folder in a second terminal. These commands do not require an installer. For type errors while you edit: ```powershell pnpm check:watch ``` For one test file: ```powershell node --experimental-strip-types --test scripts/tableSelection.spec.ts ``` For the full set of checks: ```sh pnpm build:plugins pnpm check pnpm test pnpm build cargo test --manifest-path src-tauri/Cargo.toml --lib --offline ``` The offline Rust command requires cached dependencies. Omit `--offline` if Cargo needs to download them. `pnpm build` checks the production frontend build. It is not required after each source edit. `pnpm preview` serves the last frontend build and does not watch source changes. Use `pnpm tauri build` to build the release desktop app. The Rust tests cover real terminal shells, working directories, Unicode output, resizing, exit status, and session termination. Native terminal tests launch each detected shell profile and check shell prompt integration. ## Browser smoke tests `pnpm dev` starts only the Vite server at `http://127.0.0.1:1420`. A browser can show the interface, but real folder access, file writes, and terminals require the desktop host. Use `pnpm tauri dev` for manual tests of those features. Run `pnpm build:plugins` before tests that use Terminal or Table formulas. These tests load the compiled packages through the production module loader. The browser tests use the real interface with mocked desktop communication. They do not replace native desktop tests. 1. Install Playwright, or set `PLAYWRIGHT_MODULE` to a shared Playwright package. 2. Start the frontend with `pnpm dev`, or reuse the server from an active `pnpm tauri dev` session. 3. In a second terminal, run a smoke script, such as `node scripts/workbench.smoke.mjs`. Playwright is not a dependency in `package.json`. Set `PLAYWRIGHT_MODULE` to the absolute path of an existing Playwright package if you use a shared installation. That package must have Chromium installed, or you must select an installed browser with `CHROME_PATH`. For example, in PowerShell, replace these example paths with your local paths: ```powershell $env:PLAYWRIGHT_MODULE = "C:\tools\browser-tests\node_modules\playwright" $env:CHROME_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe" node scripts/workbench.smoke.mjs ``` | Script | Coverage | | --- | --- | | `scripts/workbench.smoke.mjs` | The Svelte, Monaco, and xterm interface | | `scripts/pluginInstall.smoke.mjs` | Package review, external commands and views, the uninstall confirmation, and cleanup | | `scripts/plugins.smoke.mjs` | Plugin toggles, formula source preservation, terminal cleanup, and preferences across windows | | `scripts/terminal.smoke.mjs` | Terminal groups, single-session layout, menus, profiles, history, tasks, settings, and editor actions | | `scripts/images.smoke.mjs` | Image drops, clipboard imports, source editing, zoom, undo, failed writes, and tab changes during imports | | `scripts/imageNavigation.smoke.mjs` | Navigator pointer drags, hidden image source, selection, context actions, inline/reference images, and drag cancellation | Additional smoke scripts live in `scripts/`. ## Development help | Problem | Action | | --- | --- | | Port 1420 is already in use | Stop the other RuneStone development server in its terminal, then retry. Vite uses a fixed port. | | The app still shows the old interface | Use the development window. Check the terminal for compile errors, then restart the development command if needed. | | Browser view says desktop features require `pnpm tauri dev` | Start that command and use its native window for real workspace and terminal tests. | | Windows cannot find `link.exe`, or Rust cannot link the app | Install the C++ build tools and Windows SDK from the Tauri prerequisites guide above. Open a new terminal. | | A smoke test cannot find Playwright or Chromium | Set `PLAYWRIGHT_MODULE` to an installed package. Install its Chromium browser or set `CHROME_PATH`. | | Cargo reports missing dependencies with `--offline` | Run the command without `--offline` while connected to the internet. | Read Rust errors in the terminal that runs `pnpm tauri dev`. In the Windows development window, press Ctrl+Shift+I to open the web inspector. Use its console for frontend errors. See [Tauri's inspector instructions](https://v2.tauri.app/develop/#opening-the-web-inspector).