# Release Runbook

Status: VERIFIED BY LOCAL SELF-TEST

## Public SDK Export

0. Run the self-test:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\Invoke-H8PublicationSelfTest.ps1
```

1. Start from `C:\hades\Hecton8_PublicationArchitecture`.
2. Run the direct production gate. It should fail while production remains dirty.
3. Move or rewrite approved public contracts into explicit public-facing folders in
   a dedicated staging branch, or prepare them directly in the public SDK repo.
4. Verify every allowlisted production path is clean in Git.
5. Run `New-H8PublicationExport.ps1`.
6. Run `Test-H8PublicationGate.ps1` on the export folder.
7. Initialize a new Git repo from the export folder.
8. Run `Invoke-H8RepoPreflight.ps1`.
9. Review every file in `git status --short`.
10. Commit only after human review.

## Commands

Direct production gate:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\Test-H8PublicationGate.ps1 `
  -Root C:\hades\Hecton8 `
  -DenyProfile .\profiles\public-sdk.deny `
  -ReportPath .\out\current-production-public-sdk-gate.json
```

Clean export:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\New-H8PublicationExport.ps1 `
  -SourceRoot C:\hades\Hecton8 `
  -DestinationRoot C:\hades\Hecton8_PublicSDK_Export `
  -AllowProfile .\profiles\public-sdk.allow `
  -DenyProfile .\profiles\public-sdk.deny `
  -TemplateRoot .\templates\public-sdk `
  -TrustedOutputRoot C:\hades\Hecton8_PublicSDK_Export `
  -Force
```

`-TemplateRoot` is a control-plane input only. It must stay inside
`Hecton8_PublicationArchitecture\templates\<target>`. Never use production,
workspace, or generated repo folders as templates.

The default `public-sdk.allow` selects zero production files. Add explicit allow
entries only after `PUBLIC_API_PROMOTION.md` review.

Manifest:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\New-H8PublicationManifest.ps1 `
  -Root C:\hades\Hecton8_PublicSDK_Export `
  -DenyProfile .\profiles\public-sdk.deny `
  -ReportPath .\out\public-sdk-export-manifest.json `
  -ScanAllFiles
```

Report paths for manifest, classification, receipt, preflight, and other release
evidence must be outside the repo being scanned. In-repo report paths are
rejected because they dirty the reviewed root after validation.
Promotion records and workspace remote reports follow the same rule: never write
release evidence inside production or generated repository roots.

Use `-ScanAllFiles` only before `git init` or when scanning a plain folder.
After Git exists, omit `-ScanAllFiles` so the gate checks tracked/indexed files and
does not fail on the internal `.git` database.

Classification:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\Get-H8PublicationClassification.ps1 `
  -Root C:\hades\Hecton8_PublicSDK_Export `
  -DenyProfile .\profiles\public-sdk.deny `
  -CandidateProfile .\profiles\public-sdk.c2 `
  -ReportPath .\out\public-sdk-export-classification.json `
  -ScanAllFiles
```

Preflight:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\Invoke-H8RepoPreflight.ps1 `
  -Root C:\hades\Hecton8_PublicSDK_Export `
  -Target public-sdk `
  -AllowedRemoteUrl https://github.com/OWNER/Hecton8-PublicSDK.git
```

Export receipt:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\New-H8ExportReceipt.ps1 `
  -Root C:\hades\Hecton8_PublicSDK_Export `
  -Target public-sdk `
  -ReportPath .\out\public-sdk-export-receipt.json
```

Repo isolation:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\Test-H8RepoIsolation.ps1 `
  -Root C:\hades\Hecton8_PublicSDK_Export `
  -ProductionRoot C:\hades\Hecton8 `
  -ReportPath .\out\public-sdk-repo-isolation.json
```

Initialize clean Git repo:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\tools\Initialize-H8CleanRepo.ps1 `
  -Root C:\hades\Hecton8_PublicSDK_Export `
  -InitialBranch main
```

## Stop Conditions

Stop if:

- export gate fails;
- export contains production `.git`;
- export contains vendor folders;
- export contains raw art/audio/model/binary data;
- export contains agent logs, reports, prompts, or archive material;
- export contains production `AGENTS.md`, `TASTE.md`, or production package manifests;
- export cannot explain why each file is public.

## Review Rule

The gate blocks known bad material. It does not prove that a remaining file is safe.
Human review still owns the final decision.
