# Cade localhost CAD pipeline

Cade turns a strict DimensionGraph plus its source PNG into a validated OCCT
B-rep, AP242 STEP, exact-HLR front/top/side SVGs, a traffic report, and a build
report. The delivered product boundary is Windows x64 and localhost only.

## One-command install and run

Prerequisites are Windows x64, Visual Studio 2022 with Desktop C++ tools, CMake
3.24 or newer, and PowerShell. From the repository root run:

```powershell
powershell -ExecutionPolicy Bypass -File .\tools\run_local.ps1
```

The command selects one installed MSVC toolset for both vcpkg and Cade,
configures a Release build, builds, installs a self-contained local tree under
`out/cade-local`, and starts four workers on `http://127.0.0.1:8765`. Open that
address in a browser. Press Ctrl+C in the terminal to stop. Jobs, atomically
persisted state, and anonymous local metrics stay under
`out/cade-local/data/jobs`; nothing is transmitted.

Useful overrides:

```powershell
.\tools\run_local.ps1 -Port 9000 -Workers 2
.\tools\run_local.ps1 -InstallDirectory C:\CadeLocal
```

`-SkipBuild -NoLaunch` installs and verifies an existing configured build. It is
intended for packaging checks, not the first build.

## Demo

With the service running, use a second PowerShell terminal:

```powershell
powershell -ExecutionPolicy Bypass -File .\tools\demo_local.ps1
```

The script is hard-limited to `127.0.0.1` or `localhost`. It submits the committed
plate PNG and DimensionGraph, waits for deterministic validation, rejects any red
traffic row, and downloads the source, STEP, three SVGs, traffic, build report,
and result envelope to `out/demo-local`.

The installed copy is also self-contained:

```powershell
powershell -ExecutionPolicy Bypass -File .\out\cade-local\share\cade\demo\demo_local.ps1
```

## Manual developer build

The one-command script is the supported path. For an explicit build, enter an
x64 Visual Studio developer shell and use one MSVC toolset throughout:

```powershell
cmake -S . -B build-local -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake"
cmake --build build-local --parallel
ctest --test-dir build-local --output-on-failure
cmake --install build-local --prefix out/cade-local
```

The repository contains the hash-pinned PDFium archive; runtime operation does
not download a model, call a cloud service, require an account, or read an API
key. The strict HTTP contract is in `docs/local_api_v1.md`; DimensionGraph v0 is
in `docs/dimension_graph_v0.md`.

## CLI

The thin CLI remains available for graph-only deterministic builds:

```powershell
.\out\cade-local\bin\cade-cli.exe .\testdata\graphs\plate_01.json --output-dir .\out\cli-demo
```

## Evidence and limits

Start with `docs/g3_report.md`, then follow its audit-file table. In particular,
the web product requires an explicit DimensionGraph; it does not silently claim
that the integrated localhost service reads dimensions from pixels. The blind
Agent-Reader evidence, synthetic recall, real-scan boundary, concurrency test,
unmeasured provider cost/latency, and remaining pilot risks are all reported
there rather than hidden behind a green UI.
