# InfraFabric Red Team — Shadow Dossiers (Front-End)

A minimalist React + Vite publication hub for InfraFabric’s “Shadow Dossiers” drops:
- serious, paper/ink layout
- staged/publication statuses (draft/scheduled/live)
- verifiability hooks (evidence index + optional SHA-256 + size)
- **no client-side model keys** (roast generator is feature-flagged and calls a server endpoint)

## Local dev

Prereqs: Node.js 18+

```bash
npm install
npm run dev
```

Open: http://localhost:3000

## Production (self-host)

```bash
npm install
npm run build
PORT=8080 npm run start
```

## Environment variables

Create `.env.local` from `.env.example`:

- `VITE_PUBLIC_BASE_URL`  
  Optional. When set (e.g. `https://infrafabric.io`) it will prefix dossier `pdfPath`/`evidencePath`.

- `VITE_ENABLE_ROAST`  
  Defaults to `false`. When `true`, renders the Roast Generator UI which calls `POST /api/roast`.

## Private upload (internal)

The server exposes a token-gated upload flow that generates a shadow dossier via the `revoice` pipeline:

- Set server env:
  - `PRIVATE_UPLOAD_TOKEN` (required)
  - `PRIVATE_UPLOAD_STYLE` (optional, default `if.dave.v1.2`)
  - `PRIVATE_UPLOAD_MAX_BYTES` (optional, default 25MB)
- Open: `/private/<PRIVATE_UPLOAD_TOKEN>`

## Staging behavior (important)

This bundle is **pre-launch**. Dossier buttons are gated by `dossier.status`:

- `draft` / `scheduled`: download + evidence links remain disabled, and the UI shows “staged.”
- `live`: links activate (and optional SHA-256/bytes render if populated).

Update dossier status and paths in `constants.tsx`.

## Codex/server implementation checklist

See `CODEX_IMPLEMENTATION.md` for the complete checklist and stubs.

Quick summary:
1. Publish PDFs and evidence pages at:
   - `/static/hosted/<dossier>.pdf`
   - `/static/hosted/evidence/index.html`
2. Set `VITE_PUBLIC_BASE_URL` in the deployment environment if needed.
3. (Optional) Implement `POST /api/roast` server-side and set `VITE_ENABLE_ROAST=true`.

## Hash helper

Compute SHA-256 + bytes for a PDF and paste into the dossier entry:

```bash
node scripts/hash.mjs /path/to/file.pdf
```
