Skip to main content

Contributing to Tempest

This guide covers the Tempest project structure, development workflow, and how to extend the application with new features like agents, themes, and Tauri commands.

Project Structure

Tempest is organized into frontend (React/TypeScript) and backend (Rust/Tauri) components:

Running the Dev Build

Prerequisites: Node.js 18+, Rust 1.77+, WebView2 Runtime (Windows only)
The dev command:
  1. Runs npm run build:atlas to build the Token Intelligence server
  2. Launches Tauri in dev mode, which starts:
    • Vite dev server on http://localhost:5173
    • Tauri webview pointing to the dev server
    • File watcher that hot-reloads on changes
The app opens in a frameless window with custom styling via Tauri’s window configuration. For frontend-only work without rebuilding Rust:
This starts the Vite dev server only. Changes to React/TypeScript hot-reload instantly.

Production Build

The build output goes to dist-installers/ with platform-specific installers (Windows .msi, macOS .app.tar.gz, Linux .AppImage).

Adding a New Agent to NewSessionMenu

Agents are defined in src/components/NewSessionMenu.tsx in the AGENT_CONFIGS array.

Step 1: Prepare the agent icon

Add a new SVG icon to src/assets/agent-icons/:
If the icon is monochrome, it will be inverted in dark mode automatically.

Step 2: Add the agent config

In NewSessionMenu.tsx, add a new entry to AGENT_CONFIGS:

Step 3: Import the icon

At the top of NewSessionMenu.tsx, add an import:

Step 4: Test

Restart the dev server. The new agent should appear in the “Agent Session” submenu.

Adding a New Theme

Themes are JSON files stored in src/themes/{theme-name}/theme.json.

Step 1: Create the theme file

In src/themes/my-theme/theme.json:
All color tokens are required. See src/themes/origin-dark/theme.json for the complete reference.

Step 2: Register the theme

In src/themes/ThemeContext.tsx, import and add the new theme:

Step 3: Test

Restart the dev server and open Settings > Appearance. Your theme should appear in the theme grid.

Adding a New Tauri Command

Tauri commands bridge the React frontend and Rust backend. They are called from TypeScript via invoke() and handled by #[tauri::command] functions in Rust.

Example: Read a File

Step 1: Add the Rust function in src-tauri/src/lib.rs:
Tauri automatically serializes the return type to JSON and deserializes errors. Step 2: Register the command in the builder in lib.rs:
Step 3: Call from React in src/components/MyComponent.tsx:

Tauri Command Patterns

Returning data:
Returns JSON-serializable types. Use serde::Serialize on structs. Taking parameters:
Function arguments are automatically deserialized from the invoke call’s payload. Long-running commands with streaming: For long operations (like indexing files), use Tauri channels:
On the frontend, listen for events:

Code Patterns and Style

React Components

Components use functional components with hooks:

CSS Variables for Theming

Always use CSS variables for colors and UI tokens. Never hardcode color values.
CSS variables follow the naming pattern: --tempest-{token.with.dots} becomes --tempest-{token-with-dashes}.

Error Handling

Use Result types and bubble errors:

State Management

Use Zustand stores for global state. Example from src/store/appSettings.ts:

TypeScript Types

Always define prop types and return types explicitly:

Testing

Currently, the codebase does not have automated tests. Manual testing via the dev build is the standard approach. To test a feature:
  1. Run npm run dev
  2. Interact with the feature in the app
  3. Check the browser console (F12) for errors
  4. Verify the expected behavior
For debugging:
  • Use React DevTools browser extension to inspect component state
  • Use the Tauri DevTools (right-click > Inspect) to see window/console output
  • Add console.log() statements liberally

Building for Release

Installers are saved to dist-installers/:
  • Windows: .msi file
  • macOS: .app.tar.gz (requires signing, see Tauri docs)
  • Linux: .AppImage

Performance Considerations

Large File Trees

The file tree in the right sidebar is lazy-loaded. Nested folders do not fetch contents until expanded. This keeps the sidebar responsive even in large monorepos.

Git Status

Git status operations are debounced and only refresh the Changes tab, not the file tree. This prevents layout shifts while browsing.

Terminal Rendering

The embedded xterm.js terminal uses WebGL acceleration when available (via @xterm/addon-webgl). The WebGL context is pooled to avoid creating too many contexts simultaneously.

Code Editor

Syntax highlighting uses CodeMirror with language-specific tokenizers. Avoid rendering very large files (10k+ lines) in the editor at once.

Debugging Tips

  1. Frontend logs - Open DevTools (F12) and check the Console tab
  2. Tauri logs - Right-click the Tempest window and select “Inspect” to see the native console
  3. React state - Install React DevTools browser extension and inspect component props/state
  4. Network requests - Check the Network tab for API calls (e.g., GitHub PR creation)
  5. Git operations - Git commands are invoked via Tauri; check stderr for git error messages

Next Steps

  • Explore src/components/ to understand UI patterns
  • Read through src-tauri/src/lib.rs to see available Tauri commands
  • Check ROADMAP.md for upcoming features and architecture decisions
  • Join the community on X/Twitter (@usetempest) for questions and discussions