# @kolu/surface-app hello-world — standalone example.
#
# Run from this directory: `just dev` boots the surface-app server + Vite client,
# showing the freshness contract, the skew rail (useSurfaceApp), and a live
# app-specific serverStats cell composed alongside surface-app's buildInfo.
#
# Uses the root devShell for tooling. Reuses the same IN_NIX_SHELL detection the
# root justfile does so `just dev` inside `nix develop` skips the re-entry.

repo_root := justfile_directory() / "../../.."
nix_shell := if env('IN_NIX_SHELL', '') != '' { '' } else { 'nix develop ' + repo_root + ' --accept-flake-config -c' }

# List available recipes
default:
    @just --list

# Install pnpm deps (delegates to the workspace at the repo root)
install:
    cd {{ repo_root }} && {{ nix_shell }} pnpm install

# Boot server (:7710) + Vite client (:5175). Open http://localhost:5175
dev *args: install
    cd {{ justfile_directory() }} && {{ nix_shell }} pnpm run dev {{ args }}

# Build the client, then serve it from the server (prod-like: real cache-control,
# library-served /sw.js). Open http://127.0.0.1:7710
start *args: build
    cd {{ justfile_directory() }} && {{ nix_shell }} pnpm run start {{ args }}

# Build the static client bundle (vite build → dist/)
build:
    cd {{ justfile_directory() }} && {{ nix_shell }} pnpm run build:client

# Typecheck this example only
typecheck:
    cd {{ justfile_directory() }} && {{ nix_shell }} pnpm typecheck
