# Benac

Benac is currently a GraphMD-backed specification repository plus the first C1
Hello World PWA workspace.

## Existing Docs Pipeline

```bash
npm ci
npm test
```

`npm test` regenerates the terms document and SyRS from GraphMD records before
validating the dataset.

## Building the C1 PWA

The C1 PWA is a static Rust-authored browser app. It is built with Trunk and is
intended to be served over HTTPS without a backend authority.

```bash
rustup target add wasm32-unknown-unknown
cargo test --workspace
cargo run -p xtask -- build-hello-world-fixtures
trunk build apps/pwa/index.html --release --dist dist
cargo run -p xtask -- finalize-pwa-dist dist
cargo run -p xtask -- validate-pwa-dist dist
```

For local container builds, use the cache-aware wrapper:

```bash
scripts/build-pwa-container.sh --sync-root
```

It keeps Cargo, Rustup, Trunk, wasm-bindgen, and wasm-opt caches under
`/tmp` by default so repeated phase builds do not re-download the Trunk helper
tools while keeping the repository clean. Override with `BENAC_CARGO_HOME`,
`BENAC_RUSTUP_HOME`, `BENAC_BUILD_CACHE_ROOT`, `BENAC_TRUNK_HOME`, or
`BENAC_XDG_CACHE_HOME` if needed.

The PWA scaffold lives under `apps/pwa`. Core Benac logic belongs in
`crates/benac-core`; browser host adapters belong in `crates/benac-browser`.
The operator sidecar in `tools/gravitational_lens` remains separate from Benac
Core.

## Static Deployment

The deployable artifact is the `dist/` directory produced by the C1 PWA build.
The `pwa-build` workflow uploads that directory and, when deploy secrets are
configured, publishes it as an atomic static release under:

```text
/srv/benac/releases/<git-sha>/
/srv/benac/current -> releases/<git-sha>
```

Required deploy secrets are `BENAC_DEPLOY_HOST`, `BENAC_DEPLOY_USER`,
`BENAC_DEPLOY_PATH`, and `BENAC_DEPLOY_SSH_KEY`. The default deploy path is
`/srv/benac`.

Manual iOS and Android acceptance steps are in
`docs/checklists/c1-pwa-ios-android-acceptance.md`.
