Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .niteshift/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
# Whiteboard Desktop (Electron). It has no web UI, so there is no port or preview:
# the window opens on the sandbox display (:99), which the user watches in the
# Agent preview. Drive its renderer with
# agent-browser --session app --cdp 9333 snapshot -i
# Restart it after changing Code OSS sources (rerun setup first to rebuild them);
# the Review server and canvas rebuild on launch when stale.
- name: desktop
command: |
export PATH=/opt/whiteboard-node/bin:$PATH
exec pnpm desktop:run
environment:
- name: DISPLAY
value: ":99"
- name: DEV_FAST_REVIEW_REMOTE_DEBUGGING_PORT
value: "9333"
# The sandbox runs as root, which Electron only allows without its sandbox.
- name: DEV_FAST_REVIEW_NO_SANDBOX
value: "1"
restart: on-failure
1 change: 1 addition & 0 deletions .niteshift/settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 1
57 changes: 57 additions & 0 deletions .niteshift/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Prepares a Whiteboard dev environment: the monorepo, the Code OSS fork, a dev-fast
# Desktop build, and Chromium for the canvas browser tests. Safe to rerun; every step
# skips work that is already current.
set -euo pipefail

REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO"

# The monorepo wants Node 24 and the Code OSS fork pins an exact 24.x
# (apps/review-desktop/code-oss/.nvmrc); one install beside the sandbox's Node covers
# both. Niteshift's own tools keep using /usr/local/bin/node.
NODE_VERSION="$(tr -d '[:space:]' < apps/review-desktop/code-oss/.nvmrc)"
NODE_DIR="/opt/node-v$NODE_VERSION-linux-x64"
if [[ ! -x "$NODE_DIR/bin/node" ]]; then
echo "Installing Node $NODE_VERSION into $NODE_DIR"
tmp="$(mktemp -d)"
curl -fsSL --retry 3 "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" -o "$tmp/node.tar.xz"
sudo mkdir -p /opt
sudo tar -xJf "$tmp/node.tar.xz" -C /opt
rm -rf "$tmp"
fi
export PATH="$NODE_DIR/bin:$PATH"
# A stable path for services.yaml, so it does not repeat the version.
sudo ln -sfn "$NODE_DIR" /opt/whiteboard-node

# pnpm comes from packageManager in package.json.
if [[ "$(pnpm -v 2>/dev/null || true)" != "$(node -p "require('./package.json').packageManager.split('@')[1]")" ]]; then
corepack enable pnpm
fi

# Headers for the Code OSS native modules (same list as Whiteboard CI).
missing=()
for pkg in libx11-dev libxkbfile-dev libkrb5-dev libsecret-1-dev python3; do
dpkg -s "$pkg" >/dev/null 2>&1 || missing+=("$pkg")
done
if (( ${#missing[@]} )); then
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "${missing[@]}"
fi

# Fast when node_modules already matches the lockfile.
pnpm install --frozen-lockfile

# Builds Code OSS (npm ci only when its lockfiles change, transpile without the
# typecheck, extensions, Electron) using freshness stamps under code-oss/.build.
REVIEW_DESKTOP_DEV_FAST=1 pnpm desktop:build

# desktop:run rebuilds the Review server and canvas when stale; do it here so the
# desktop service launches quickly.
# shellcheck source=/dev/null
source apps/review-desktop/scripts/freshness.sh
rebuild_review_desktop_outputs "$REPO" "$REPO/packages/review"
node apps/review-desktop/scripts/copy-canvas.mjs

# Chromium for `pnpm --filter @dev.fast/review-canvas test:browser` (Vitest Browser Mode).
pnpm --filter @dev.fast/review-canvas exec playwright install chromium
5 changes: 5 additions & 0 deletions apps/review-desktop/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ fi
if [[ "${DEV_FAST_REVIEW_DISABLE_GPU:-0}" == "1" ]]; then
CODE_ARGS+=(--disable-gpu)
fi
if [[ "${DEV_FAST_REVIEW_NO_SANDBOX:-0}" == "1" ]]; then
# Electron refuses to start as root with the Chromium sandbox, as in
# containers and cloud sandboxes.
CODE_ARGS+=(--no-sandbox)
fi
if [[ "${DEV_FAST_REVIEW_FORCE_ACCESSIBILITY:-0}" == "1" ]]; then
# Keeps Chromium's renderer accessibility tree alive for the generic Linux
# AT-SPI Computer Use backend. It is deliberately opt-in outside DevBoxes.
Expand Down