# BurningTimes 조직 레포 - 신 PC 셋팅 검증 스크립트 (Windows / PowerShell) # # 목적: `setup/setup_windows.ps1` 실행 후, 본 PC가 조직 레포를 정상 사용할 수 있는 상태인지 # 파일 존재·OS 동작(reparse point)·실행 결과(JSON 파싱) 3축으로 검증. # # 사용: PowerShell에서 # .\scripts\verify_setup.ps1 # 또는 (상세 출력) .\scripts\verify_setup.ps1 -Verbose # # Exit code: 0 = OK, 1 = 결함 발견 (stderr에 항목 나열) [CmdletBinding()] param() $ErrorActionPreference = "Stop" $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path $fail = @() $warn = @() function Check([string]$name, [bool]$ok, [string]$detail) { if ($ok) { Write-Host "[OK] $name — $detail" } else { Write-Host "[FAIL] $name — $detail" -ForegroundColor Red $script:fail += "$name :: $detail" } } function Warn([string]$name, [string]$detail) { Write-Host "[WARN] $name — $detail" -ForegroundColor Yellow $script:warn += "$name :: $detail" } Write-Host "=== BurningTimes 셋팅 검증 ===" Write-Host "RepoRoot: $repoRoot" Write-Host "" # 1. paths.local.json 실파일·파싱·필수 키 (2026-04-18 worktree fallback 추가) $pathsFile = Join-Path $repoRoot "paths.local.json" if (-not (Test-Path $pathsFile)) { # worktree 감지 — 공통 git dir 기반 메인 레포 루트 추론 (C34-15 worktree 안전성) try { $gitCommon = (& git -C $repoRoot rev-parse --git-common-dir 2>$null) | Out-String $gitCommon = $gitCommon.Trim() if ($gitCommon -and (Test-Path $gitCommon)) { $mainRoot = Split-Path (Resolve-Path $gitCommon).Path -Parent $altPaths = Join-Path $mainRoot "paths.local.json" if (Test-Path $altPaths) { $pathsFile = $altPaths Warn "paths.local.json worktree fallback" "본 worktree 없음 → 메인 레포 경유: $pathsFile" } } } catch {} } $paths = $null if (Test-Path $pathsFile) { try { $raw = Get-Content $pathsFile -Raw -Encoding UTF8 $paths = $raw | ConvertFrom-Json Check "paths.local.json 존재·JSON 파싱" $true $pathsFile } catch { Check "paths.local.json 존재·JSON 파싱" $false "JSON 파싱 실패: $_" } } else { Check "paths.local.json 존재" $false "파일 없음(메인 레포도). setup_windows.ps1 선행 필요: $pathsFile" } $required = @("BURNINGTIMES_ROOT","UNITY_PROJECT_ROOT","FRAMEWORK_PKG_ROOT","TABLE_EXPORT_ROOT") if ($paths) { foreach ($k in $required) { $v = $paths.$k $ok = [bool]$v Check "paths.local.json 키 [$k]" $ok ("값=" + ($v -as [string])) } # BURNINGTIMES_ROOT 실제 디렉토리 존재 여부 if ($paths.BURNINGTIMES_ROOT) { Check "BURNINGTIMES_ROOT 디렉토리 존재" (Test-Path $paths.BURNINGTIMES_ROOT) $paths.BURNINGTIMES_ROOT } # Unity·Framework·TableExport는 경고 수준 (존재하지 않아도 일부 작업은 가능) foreach ($k in @("UNITY_PROJECT_ROOT","FRAMEWORK_PKG_ROOT","TABLE_EXPORT_ROOT")) { $v = $paths.$k if ($v -and -not (Test-Path $v)) { Warn "$k 디렉토리 미존재" "$v (해당 부서 작업 시 필요)" } } } # 3. 경로 추상화 적용 여부 (CLAUDE.md 계열에 구 하드코딩 경로 잔존 확인) $hardcodePatterns = @("C:/Users/PC/Documents", "D:/BurningTimes/FilGoodBandits", "D:/BurningTimes/BurningTimes.Framework") $scanTargets = @( (Join-Path $repoRoot "CLAUDE.md"), (Join-Path $repoRoot ".claude\skills") ) | Where-Object { Test-Path $_ } $hits = @() foreach ($t in $scanTargets) { $files = if ((Get-Item $t).PSIsContainer) { Get-ChildItem $t -Recurse -File -Include *.md } else { @(Get-Item $t) } foreach ($f in $files) { $content = Get-Content $f.FullName -Raw -ErrorAction SilentlyContinue foreach ($p in $hardcodePatterns) { if ($content -match [regex]::Escape($p)) { $hits += "$($f.FullName) :: '$p'" } } } } if ($hits.Count -eq 0) { Check "CLAUDE.md 계열 경로 추상화" $true "하드코딩 구 경로 미발견" } else { Warn "CLAUDE.md 계열 경로 추상화" ("잔존 " + $hits.Count + "건 — 변수화 후보") foreach ($h in $hits) { Write-Host " - $h" -ForegroundColor DarkYellow } } # 4. .gitignore 핵심 규칙 (paths.local.json 무시) $gi = Join-Path $repoRoot ".gitignore" if (Test-Path $gi) { $giText = Get-Content $gi -Raw Check ".gitignore paths.local.json 제외" ($giText -match "paths\.local\.json") ".gitignore 라인 확인됨" } else { Check ".gitignore 존재" $false ".gitignore 파일 없음" } # 2.8. Unity 프로젝트 자동 pull 설정 검증 (C30 자동 이행 · 2026-04-20 옵션 A PD 승인) $pathsLocal = Join-Path $repoRoot "paths.local.json" if (Test-Path $pathsLocal) { try { $pathsJson = Get-Content $pathsLocal -Raw | ConvertFrom-Json $unityRoot = $pathsJson.UNITY_PROJECT_ROOT if ($unityRoot) { Check "Unity 프로젝트 경로 설정 (paths.local.json)" $true $unityRoot if (Test-Path $unityRoot) { $unityGit = Join-Path $unityRoot ".git" if (Test-Path $unityGit) { Check "Unity 프로젝트 git 레포 실체" $true $unityRoot } else { Warn "Unity 프로젝트 git 레포 아님" "$unityRoot — C30 수동 점검 대상 외 (C34-12 Degraded)" } } else { Warn "Unity 프로젝트 경로 부재" "$unityRoot — paths.local.json UNITY_PROJECT_ROOT 재확인 필요" } } else { Warn "UNITY_PROJECT_ROOT 미설정" "paths.local.json에 경로 지정 필요" } } catch { Warn "paths.local.json 파싱 실패" $_.Exception.Message } } else { Warn "paths.local.json 부재" "paths.local.json.template 복사 후 UNITY_PROJECT_ROOT 설정 필요 (C30 자동 pull 미작동)" } $unitySyncScript = Join-Path $repoRoot "scripts\unity_project_sync.sh" Check "scripts/unity_project_sync.sh 존재" (Test-Path $unitySyncScript) $unitySyncScript # 5. settings.json (조직 공용 승인) 존재 $settings = Join-Path $repoRoot ".claude\settings.json" Check ".claude/settings.json (조직 공용 승인)" (Test-Path $settings) $settings # 결과 Write-Host "" Write-Host "=== 결과 요약 ===" Write-Host "PASS: 상기 [OK] 표기" if ($warn.Count -gt 0) { Write-Host "WARN: $($warn.Count)건 — 블로커 아님" -ForegroundColor Yellow } if ($fail.Count -gt 0) { Write-Host "FAIL: $($fail.Count)건 — 아래 항목 해결 필요" -ForegroundColor Red foreach ($f in $fail) { Write-Host " - $f" -ForegroundColor Red } exit 1 } Write-Host "셋팅 검증 통과. 작업 착수 가능." -ForegroundColor Green exit 0