Skip to content

Commit 60cc4d2

Browse files
committed
feat(desktop): merge Windows Tauri dev, libsql-rusqlite, and CLI automation
2 parents 92946de + d89c934 commit 60cc4d2

File tree

10 files changed

+1124
-362
lines changed

10 files changed

+1124
-362
lines changed

.github/workflows/ci-mac.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI Mac
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-macos:
8+
name: Build desktop (${{ matrix.runner }})
9+
runs-on: ${{ matrix.runner }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
runner: [macos-latest, macos-15-intel]
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Bun
19+
uses: oven-sh/setup-bun@v2
20+
with:
21+
bun-version: latest
22+
23+
- name: Setup Rust
24+
uses: dtolnay/rust-toolchain@stable
25+
26+
- name: Install dependencies
27+
run: bun install
28+
29+
- name: Build desktop app
30+
run: bun run desktop:build

apps/desktop/scripts/tauri-dev-win.ps1

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,58 @@
1-
param()
1+
<#
2+
.SYNOPSIS
3+
Windows Tauri development script with proper toolchain configuration.
24
3-
# Resolve cargo home dynamically
4-
$cargoHome = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { Join-Path $env:USERPROFILE '.cargo' }
5+
.DESCRIPTION
6+
Sets up the PATH and environment for Tauri development on Windows.
7+
Ensures Ninja CMake generator and proper tooling are available.
58
6-
$requiredDirs = @(
7-
(Join-Path $cargoHome 'bin')
9+
.PARAMETER CustomPaths
10+
Additional directories to prepend to PATH. Can be used multiple times.
11+
12+
.EXAMPLE
13+
.\tauri-dev-win.ps1
14+
15+
.EXAMPLE
16+
.\tauri-dev-win.ps1 -CustomPaths "C:\Custom\Tool\bin"
17+
#>
18+
19+
param(
20+
[string[]]$CustomPaths = @()
821
)
922

10-
# Discover tool paths dynamically instead of hardcoding user-specific locations
11-
foreach ($tool in @('cmake', 'nasm', 'ninja')) {
12-
$cmd = Get-Command $tool -ErrorAction SilentlyContinue
13-
if ($cmd) {
14-
$toolDir = Split-Path $cmd.Source -Parent
15-
$requiredDirs += $toolDir
16-
}
23+
# Standard Windows Tauri toolchain paths
24+
$tauriRequiredDirs = @(
25+
$env:RUSTUP_HOME,
26+
$env:CARGO_HOME,
27+
$env:RUSTUP_TOOLCHAIN,
28+
'C:\Program Files\CMake\bin',
29+
'C:\Users\$env:USERNAME\.cargo\bin',
30+
'C:\Users\$env:USERNAME\tools\nasm\nasm-3.01'
31+
)
32+
33+
# Add ninja if installed via winget
34+
$ninjaPath = Get-Command ninja -ErrorAction SilentlyContinue
35+
if ($ninjaPath) {
36+
$tauriRequiredDirs += $ninjaPath.Source
37+
} elseif (Test-Path "C:\Users\$env:USERNAME\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe") {
38+
$tauriRequiredDirs += "C:\Users\$env:USERNAME\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe"
1739
}
1840

19-
# Also add common install locations as fallback
20-
$cmakeFallback = 'C:\Program Files\CMake\bin'
21-
if ((Test-Path $cmakeFallback) -and ($requiredDirs -notcontains $cmakeFallback)) {
22-
$requiredDirs += $cmakeFallback
41+
# Add custom paths if provided
42+
if ($CustomPaths.Count -gt 0) {
43+
$tauriRequiredDirs += $CustomPaths
2344
}
2445

25-
$env:PATH = ($requiredDirs + ($env:PATH -split ';')) | Where-Object { $_ -and $_ -ne '' } | Select-Object -Unique
26-
$env:PATH = $env:PATH -join ';'
46+
# Build new PATH
47+
$env:PATH = ($tauriRequiredDirs | Where-Object { $_ -and $_ -ne '' } | Select-Object -Unique) -join ';'
48+
49+
# Set CMake generators for Tauri
2750
$env:CMAKE_GENERATOR = 'Ninja'
2851
$env:AWS_LC_SYS_CMAKE_GENERATOR = 'Ninja'
2952

3053
Push-Location (Resolve-Path "$PSScriptRoot\..")
3154
try {
55+
Write-Host "Starting Tauri development server..." -ForegroundColor Green
3256
bun x tauri dev
3357
} finally {
3458
Pop-Location

apps/desktop/src-tauri/vendor/libsql-sys/Cargo.toml.orig

Lines changed: 0 additions & 35 deletions
This file was deleted.

tools/dora-cli/cli.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package main
2+
3+
import (
4+
"errors"
5+
"flag"
6+
"fmt"
7+
"os"
8+
"strings"
9+
)
10+
11+
func runCLI(args []string) error {
12+
if len(args) == 0 {
13+
return nil
14+
}
15+
16+
switch args[0] {
17+
case "vm":
18+
return runVMCommand(args[1:])
19+
case "ci":
20+
return runCICommand(args[1:])
21+
case "help", "-h", "--help":
22+
printCLIUsage()
23+
return nil
24+
default:
25+
return fmt.Errorf("unknown command %q", args[0])
26+
}
27+
}
28+
29+
func runCICommand(args []string) error {
30+
if len(args) == 0 {
31+
return errors.New("missing ci subcommand (expected: mac)")
32+
}
33+
if args[0] != "mac" {
34+
return fmt.Errorf("unknown ci subcommand %q", args[0])
35+
}
36+
37+
fs := flag.NewFlagSet("ci mac", flag.ContinueOnError)
38+
fs.SetOutput(os.Stderr)
39+
ref := fs.String("ref", "main", "Git ref (branch/tag) to dispatch")
40+
workflow := fs.String("workflow", "ci-mac.yml", "Workflow file name or workflow id")
41+
repo := fs.String("repo", "", "Override repo (owner/name). Defaults to current git remote")
42+
if err := fs.Parse(args[1:]); err != nil {
43+
return err
44+
}
45+
46+
ghArgs := []string{"workflow", "run", *workflow, "--ref", *ref}
47+
if strings.TrimSpace(*repo) != "" {
48+
ghArgs = append(ghArgs, "--repo", *repo)
49+
}
50+
return runCommandStreaming("gh", ghArgs...)
51+
}
52+
53+
func printCLIUsage() {
54+
fmt.Println("dora CLI")
55+
fmt.Println("")
56+
fmt.Println("Usage:")
57+
fmt.Println(" dora # interactive TUI")
58+
fmt.Println(" dora vm <subcommand> [flags]")
59+
fmt.Println(" dora ci mac [--ref main] [--workflow ci-mac.yml]")
60+
fmt.Println("")
61+
fmt.Println("VM subcommands:")
62+
fmt.Println(" init initialize VM config/storage")
63+
fmt.Println(" ensure create/define/start VM")
64+
fmt.Println(" run run command inside guest via qemu guest agent")
65+
fmt.Println(" logs show VM state/log pointers")
66+
fmt.Println(" clean stop VM and clean ephemeral artifacts")
67+
fmt.Println(" nuke undefine VM and remove all managed artifacts")
68+
}

tools/dora-cli/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import (
88
)
99

1010
func main() {
11+
if len(os.Args) > 1 {
12+
if err := runCLI(os.Args[1:]); err != nil {
13+
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
14+
os.Exit(1)
15+
}
16+
return
17+
}
18+
1119
p := tea.NewProgram(initialModel(), tea.WithAltScreen())
1220
if _, err := p.Run(); err != nil {
1321
fmt.Printf("Alas, there's been an error: %v", err)

0 commit comments

Comments
 (0)