moadim 1.2.0

Loop engine for AI agents — routines over REST, MCP, and a built-in web UI
name: Prebuilt Client

# Guard against a stale (or silently broken) `prebuilt-client.html` — the
# self-contained React client bundle `build.rs` copies at compile time (via
# `src/build/client.rs`), and falls back to verbatim whenever `pnpm` isn't
# installed (e.g. `cargo install moadim` from a git checkout, or a Docker
# build that never installs pnpm). It ships to those builds exactly as
# committed, so it has to stay in lockstep with `client/src` by hand — this
# job verifies that in CI, mirroring `prebuilt-ui.yml`'s freshness check for
# the Yew `ui/` bundle.
#
# This job rebuilds the client with pnpm (same as publish.yml does at release
# time) and fails if the freshly built `prebuilt-client.html` doesn't match
# what's committed, so a PR that changes `client/` can't merge without also
# regenerating the fallback bundle.

permissions:
  contents: read

on:
  pull_request:
    paths:
      - 'client/**'
      - 'src/build/client.rs'
      - 'prebuilt-client.html'
      - 'pnpm-workspace.yaml'

jobs:
  freshness:
    name: prebuilt-client-html-fresh
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Install pnpm
        uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9

      - name: Install Node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: 22
          cache: pnpm

      - name: Install Rust
        uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
        with:
          toolchain: stable

      - name: Cache cargo registry (registry only, not target)
        uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-

      - name: Install workspace dependencies
        run: pnpm install --frozen-lockfile

      - name: Rebuild the client (build.rs regenerates prebuilt-client.html via pnpm)
        run: cargo check

      - name: Fail if the committed prebuilt-client.html is stale
        run: |
          if ! git diff --exit-code -- prebuilt-client.html; then
            echo ""
            echo "prebuilt-client.html is out of date for the current client/ source."
            echo "Rebuild it locally (pnpm install && cargo build) and commit the result."
            exit 1
          fi