<# .SYNOPSIS docs/diagrams 의 다이어그램 4종을 spec JSON 에서 다시 생성한다. .DESCRIPTION PROJECT_MAP 에 적혀 있던 "archify validate -> deliver -> visual-check" 절차는 그대로는 실행되지 않았다 - archify 라는 실행 파일이 PATH 에 없고, 실제로는 저장소 밖 사용자 전역 스킬을 node 로 불러야 한다. 이 스크립트가 그 절차다. 순서: 1. validate (--quality showcase) 합성/기하 검증 2. deliver 산출물 HTML 을 원자적으로 교체 3. visual-check 실제 브라우저 증거 (Chrome 필요) 4. manifest 갱신 tests/test_diagram_sync.py 의 수신증 산출물은 바이트 결정적이다. 그래서 4번의 수신증만으로 드리프트를 잡을 수 있고, 테스트는 브라우저도 Node 도 없이 돈다. .PARAMETER SkipVisualCheck 3단계를 건너뛴다. Chrome 이 없는 빌드 호스트용. 건너뛰면 그 사실을 출력한다 (조용한 통과 금지). .PARAMETER ArchifyHome archify 스킬 경로. 기본값은 $env:ARCHIFY_HOME, 없으면 ~/.claude/skills/archify. .EXAMPLE .\scripts ebuild-diagrams.ps1 .EXAMPLE .\scripts ebuild-diagrams.ps1 -SkipVisualCheck #> [CmdletBinding()] param( [switch]$SkipVisualCheck, [string]$ArchifyHome ) $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot Set-Location -LiteralPath $repoRoot if (-not $ArchifyHome) { if ($env:ARCHIFY_HOME) { $ArchifyHome = $env:ARCHIFY_HOME } else { $ArchifyHome = Join-Path $HOME '.claude/skills/archify' } } $cli = Join-Path $ArchifyHome 'bin/archify.mjs' if (-not (Test-Path -LiteralPath $cli)) { Write-Host "archify CLI not found: $cli" -ForegroundColor Red Write-Host 'Set -ArchifyHome or $env:ARCHIFY_HOME to the archify skill directory.' -ForegroundColor Red exit 1 } # (type, basename) - tests/test_diagram_sync.py 및 update_diagram_manifest.py 와 같은 목록 $diagrams = @( @{ Type = 'architecture'; Base = 'system-architecture' }, @{ Type = 'dataflow'; Base = 'evidence-dataflow' }, @{ Type = 'workflow'; Base = 'operator-review-workflow' }, @{ Type = 'workflow'; Base = 'review-guide' }, @{ Type = 'lifecycle'; Base = 'submission-lifecycle' } ) $failures = @() $skipped = @() foreach ($d in $diagrams) { $spec = Join-Path $repoRoot ("docs/diagrams/{0}.{1}.json" -f $d.Base, $d.Type) $html = Join-Path $repoRoot ("docs/diagrams/{0}.html" -f $d.Base) Write-Host "`n=== $($d.Base) ($($d.Type)) ===" -ForegroundColor Cyan & node $cli validate $d.Type $spec --quality showcase if ($LASTEXITCODE -ne 0) { $failures += "validate:$($d.Base)"; continue } & node $cli deliver $d.Type $spec $html --quality showcase if ($LASTEXITCODE -ne 0) { $failures += "deliver:$($d.Base)"; continue } if ($SkipVisualCheck) { $skipped += $d.Base; continue } & node $cli visual-check $html # exit 2 = skipped (Chrome/Chromium 부재). 실패와 구분해 기록한다. if ($LASTEXITCODE -eq 2) { $skipped += $d.Base } elseif ($LASTEXITCODE -ne 0) { $failures += "visual-check:$($d.Base)" } } Write-Host "`n=== manifest ===" -ForegroundColor Cyan & python (Join-Path $PSScriptRoot 'update_diagram_manifest.py') if ($LASTEXITCODE -ne 0) { $failures += 'manifest' } Write-Host '' if ($skipped.Count -gt 0) { Write-Host "VISUAL-CHECK SKIPPED (no browser evidence): $($skipped -join ', ')" -ForegroundColor Yellow } if ($failures.Count -gt 0) { Write-Host "REBUILD FAILED: $($failures -join ', ')" -ForegroundColor Red exit 1 } Write-Host 'REBUILD OK - run verify.ps1 to confirm the diagram gate' -ForegroundColor Green exit 0