Skip to content

Development

nornzach edited this page Aug 10, 2026 · 1 revision

Development

Prerequisites

  • macOS (required for DMG build targets)
  • Bun >= 1.3.14
  • Two repos checked out in a nested layout:
omp-monorepo/                    # clone of omp (the agent)
├── packages/
│   ├── gui/                     # clone of oh-my-pi-gui (this repo)
│   ├── coding-agent/
│   └── natives/
└── ...

Clone & Setup

# 1. Clone the monorepo
git clone https://github.com/nornzach/oh-my-pi.git omp-monorepo
cd omp-monorepo && bun install && cd ..

# 2. Clone the GUI into packages/gui
cd omp-monorepo/packages
git clone https://github.com/nornzach/oh-my-pi-gui.git gui
cd gui && bun install

Build Commands

From packages/gui/:

# Build renderer + main + preload -> out/
bun run build

# Compile the agent sidecar binary
bun run build:omp           # arm64 (Apple Silicon)
bun run build:omp:x64       # x64 (Intel)

# Package into DMG
bun run package:mac:arm64   # -> dist/omp-<ver>-arm64.dmg
bun run package:mac:x64     # -> dist/omp-<ver>.dmg

# Other platforms (experimental)
bun run package:win
bun run package:linux

resources/omp* are gitignored build artifacts (~120 MB each). You must run build:omp before packaging.

Dev Commands

# Start dev mode with HMR
bun run dev

# Run against monorepo agent source instead of bundled sidecar
OMP_SIDECAR=source bun run dev

# Type checking
bun run check:types         # tsc --noEmit

# Lint & format
bun run check               # biome check + tsc
bun run lint                # biome lint
bun run fix                 # biome check --write --unsafe
bun run fmt                 # biome format --write

# Tests
bun run test                # vitest run
bun run test:watch          # vitest (watch mode)
bun run test:e2e            # playwright
bun run bench               # vitest bench

Code Generation

bun run gen:types           # Generate TypeScript types
bun run gen:icons            # Generate icons
bun run gen:settings-schema  # Generate settings schema

Release Checklist

Before cutting a release:

bun run check:types          # must pass
bunx biome check .           # must pass
bunx vitest run              # must pass
bun run build                # must succeed
bun run package:mac:arm64    # build DMG
bun run package:mac:x64      # build Intel DMG

Code Conventions

  • No any types — use proper TypeScript types everywhere
  • Private fields — use #private class fields, not underscore convention
  • i18n — all user-facing strings go through useT() hook; update both en.ts and zh.ts
  • Markdown rendering — always sanitize model output through MarkdownRenderer
  • Tests — use the linkedom harness pattern for DOM testing

Upstream Sync

To sync the monorepo with upstream omp changes:

bash packages/gui/scripts/sync-upstream.sh

This re-provisions natives, rebuilds the sidecar, and runs the GUI build + tests.

If you hit a merge conflict during sync:

SKIP_MERGE=1 bash packages/gui/scripts/sync-upstream.sh

Then resolve conflicts manually and re-run.

Scripts Directory

Script Purpose
build-bundled-omp.ts Compile the agent sidecar binary
gen-types.ts Generate TypeScript types
gen-icons.ts Generate icons
gen-settings-schema.ts Generate settings schema
smoke-sidecar.mjs Smoke-test the sidecar binary
sync-upstream.sh Sync monorepo with upstream

Tech Stack

Layer Technology
Shell Electron 35
UI React 19
State Zustand
Bundler electron-vite
Packager electron-builder
Linter Biome
Tests Vitest + Playwright
Types TypeScript (strict)
Styles Tailwind CSS

Clone this wiki locally