Skip to content

[M1-T02] Configure dual-mode architecture #8

@RichardHightower

Description

@RichardHightower

Task: M1-T02

Milestone: M1 - Project Setup (1 day)
Feature: RuleZ UI

Description

Set up the dual-mode architecture that allows the app to run in both Tauri desktop mode and web browser mode (for Playwright testing).

Acceptance Criteria

  • Create src/lib/tauri.ts with isTauri() detection
  • Implement web fallback pattern for all Tauri commands
  • Add mock data module for browser testing
  • Verify HMR works in both modes

Implementation

// src/lib/tauri.ts
export const isTauri = (): boolean => {
  return typeof window !== 'undefined' && !!window.__TAURI__;
};

export async function invoke<T>(cmd: string, args?: Record<string, unknown>): Promise<T> {
  if (isTauri() && window.__TAURI__) {
    return window.__TAURI__.invoke<T>(cmd, args);
  }
  throw new Error(`Tauri not available for command: ${cmd}`);
}

Dependencies

  • Depends on: M1-T01

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions