203 lines
10 KiB
PowerShell
203 lines
10 KiB
PowerShell
# BurningTimes 조직 레포 - Windows PC 셋업
|
|
# 사용: PowerShell에서 실행
|
|
# .\setup_windows.ps1 ← 기본 셋업만
|
|
# .\setup_windows.ps1 -CreateShortcuts ← 기본 셋업 + 바탕화면 바로가기 3종 생성 (주의 아래)
|
|
# .\setup_windows.ps1 -BurningTimesRoot "C:\..." ← 레포 경로 지정
|
|
# .\setup_windows.ps1 -CreateShortcuts -ClaudeExePath "C:\Tools\claude\claude.exe"
|
|
# ← claude.exe 자동 탐지 실패 시 경로 수동 지정
|
|
#
|
|
# ⚠️ 바로가기 관련 주의 (2026-04-15 실증)
|
|
# Windows Store(MSIX) 버전 Claude 앱은 single-instance + WorkingDirectory 무시 특성이 있어
|
|
# 바로가기로 부서 세션을 분리할 수 없다. MSIX 앱 사용자는 앱 실행 후 **입력창 위 "폴더 칩"**
|
|
# 을 클릭해 부서 폴더를 선택하는 것이 정답이다. 바로가기 옵션은 non-MSIX 환경(CLI 등)에서만
|
|
# 유의미하므로 필요한 사람만 -CreateShortcuts 로 명시 선택할 것.
|
|
# 상세: memory/org/feedback_permissions_portability.md
|
|
|
|
param(
|
|
[string]$BurningTimesRoot = $(Resolve-Path (Join-Path $PSScriptRoot "..")).Path,
|
|
[string]$UnityRoot = "",
|
|
[string]$FrameworkRoot = "",
|
|
[string]$GiteaUrl = "https://burning.i234.me",
|
|
[string]$GiteaSsh = "ssh://git@burning.i234.me:30030",
|
|
[switch]$CreateShortcuts,
|
|
[string]$ClaudeExePath = ""
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
# 경로 추정: BurningTimesRoot 드라이브 기반 동적 default (PC별 하드코딩 회피)
|
|
# 사용자가 -UnityRoot/-FrameworkRoot 명시하면 그 값 우선, 미명시면 BurningTimesRoot 드라이브의 \BurningTimes\* 패턴으로 추정
|
|
$rootDriveLetter = (Split-Path $BurningTimesRoot -Qualifier).TrimEnd(':')
|
|
if (-not $UnityRoot) { $UnityRoot = "${rootDriveLetter}:\BurningTimes\FilGoodBandits\DeckBuilding" }
|
|
if (-not $FrameworkRoot) { $FrameworkRoot = "${rootDriveLetter}:\BurningTimes\BurningTimes.Framework" }
|
|
|
|
Write-Host "=== BurningTimes 조직 레포 셋업 ==="
|
|
Write-Host "BurningTimesRoot: $BurningTimesRoot"
|
|
Write-Host "UnityRoot: $UnityRoot $(if (-not (Test-Path $UnityRoot)) { '(경로 미존재 - paths.local.json 생성 후 수동 수정 권장)' })"
|
|
Write-Host "FrameworkRoot: $FrameworkRoot $(if (-not (Test-Path $FrameworkRoot)) { '(경로 미존재 - paths.local.json 생성 후 수동 수정 권장)' })"
|
|
|
|
# 1. Git 확인
|
|
git --version | Out-Null
|
|
if (-not $?) { throw "Git이 설치되지 않았습니다." }
|
|
|
|
# 2. paths.local.json 생성
|
|
$pathsFile = Join-Path $BurningTimesRoot "paths.local.json"
|
|
if (-not (Test-Path $pathsFile)) {
|
|
$paths = [ordered]@{
|
|
"_description" = "로컬 환경 경로. 커밋 금지."
|
|
BURNINGTIMES_ROOT = $BurningTimesRoot
|
|
UNITY_PROJECT_ROOT = $UnityRoot
|
|
FRAMEWORK_PKG_ROOT = $FrameworkRoot
|
|
TABLE_EXPORT_ROOT = (Join-Path $UnityRoot "Assets\ResWork\Table\Export")
|
|
GITEA_URL = $GiteaUrl
|
|
GITEA_SSH = $GiteaSsh
|
|
HOSTNAME = $env:COMPUTERNAME
|
|
}
|
|
# UTF-8 BOM 없음으로 명시 출력 (PowerShell 5.1의 기본 -Encoding utf8은 BOM 포함 + 한국어 깨짐 이슈 회피)
|
|
$jsonText = $paths | ConvertTo-Json -Depth 5
|
|
[System.IO.File]::WriteAllText($pathsFile, $jsonText, [System.Text.UTF8Encoding]::new($false))
|
|
Write-Host "paths.local.json 작성 완료 (UTF-8 no BOM): $pathsFile"
|
|
} else {
|
|
Write-Host "paths.local.json 이미 존재. 유지."
|
|
}
|
|
|
|
# 3.7. Unity MCP 외부 저장소 자동 clone (A안, 2026-04-21 PD님 직접 승인)
|
|
# - CoplayDev/unity-mcp 외부 저장소를 BT 레포 내부에 clone
|
|
# - BT 레포 `.gitignore`로 추적 제외 (외부 저장소 분리 유지)
|
|
# - 업데이트는 `cd 코어코드/unity-mcp && git pull` 수동
|
|
Write-Host "=== Unity MCP 외부 저장소 셋업 ==="
|
|
$unityMcpPath = Join-Path $BurningTimesRoot "코어코드\unity-mcp"
|
|
if (-not (Test-Path $unityMcpPath)) {
|
|
$parent = Split-Path $unityMcpPath -Parent
|
|
if (-not (Test-Path $parent)) {
|
|
New-Item -ItemType Directory -Path $parent -Force | Out-Null
|
|
}
|
|
Write-Host "[setup] unity-mcp clone 시작..."
|
|
git clone https://github.com/CoplayDev/unity-mcp.git $unityMcpPath
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "✅ unity-mcp clone 완료: $unityMcpPath"
|
|
} else {
|
|
Write-Warning "unity-mcp clone 실패 — 네트워크·권한 확인 후 수동 실행 필요: git clone https://github.com/CoplayDev/unity-mcp.git `"$unityMcpPath`""
|
|
}
|
|
} else {
|
|
Write-Host "[setup] unity-mcp 이미 존재: $unityMcpPath"
|
|
Write-Host " (업데이트는 수동: cd '$unityMcpPath'; git pull)"
|
|
}
|
|
|
|
# 4. .claude/settings.json 부서 동기화 (루트 SOT → 개발팀/기획팀 복제)
|
|
# Claude Code는 .claude/ 계층 auto-merge를 지원하지 않으므로 자식 디렉토리에서 세션 시작 시
|
|
# 루트 settings.json을 인식하지 못함. 이를 우회하기 위해 루트 settings.json을 부서 디렉토리로 복제.
|
|
$rootSettings = Join-Path $BurningTimesRoot ".claude\settings.json"
|
|
if (Test-Path $rootSettings) {
|
|
$deptPaths = @("개발팀", "기획팀")
|
|
foreach ($dept in $deptPaths) {
|
|
$deptClaudeDir = Join-Path $BurningTimesRoot "$dept\.claude"
|
|
$deptSettings = Join-Path $deptClaudeDir "settings.json"
|
|
if (-not (Test-Path $deptClaudeDir)) {
|
|
New-Item -ItemType Directory -Path $deptClaudeDir -Force | Out-Null
|
|
}
|
|
Copy-Item -Path $rootSettings -Destination $deptSettings -Force
|
|
Write-Host "settings.json 동기화: $dept/.claude/settings.json"
|
|
}
|
|
} else {
|
|
Write-Warning "루트 .claude/settings.json 미발견. 부서 동기화 생략."
|
|
}
|
|
|
|
# 5. (선택) 부서별 바탕화면 바로가기 3종 생성
|
|
# Claude Code 앱의 "New Session"은 현재 열린 프로젝트 컨텍스트 내에서 새 대화를 만드는 동작이라
|
|
# 루트에서 앱이 시작되면 부서 폴더 진입이 어려움. 각 부서 폴더를 WorkingDirectory로 지정한 바로가기로 우회.
|
|
if ($CreateShortcuts) {
|
|
Write-Host ""
|
|
Write-Host "=== 부서별 바탕화면 바로가기 생성 ==="
|
|
|
|
# 1) MSIX/Store 패키지 우선 탐지 (PD님 환경 표준)
|
|
$msixPkg = $null
|
|
try { $msixPkg = Get-AppxPackage -Name '*Claude*' -ErrorAction SilentlyContinue | Select-Object -First 1 } catch {}
|
|
|
|
$msixLaunchArg = $null
|
|
if ($msixPkg) {
|
|
# AppxManifest에서 AppId 추출
|
|
$manifestPath = Join-Path $msixPkg.InstallLocation 'AppxManifest.xml'
|
|
$appId = 'App'
|
|
if (Test-Path $manifestPath) {
|
|
try {
|
|
[xml]$m = Get-Content $manifestPath
|
|
$appIdNode = $m.Package.Applications.Application | Select-Object -First 1
|
|
if ($appIdNode -and $appIdNode.Id) { $appId = $appIdNode.Id }
|
|
} catch {}
|
|
}
|
|
$msixLaunchArg = "shell:AppsFolder\$($msixPkg.PackageFamilyName)!$appId"
|
|
Write-Host "Claude MSIX 패키지 탐지: $($msixPkg.PackageFamilyName) / AppId=$appId"
|
|
}
|
|
|
|
# 2) MSIX 미탐지 시 일반 claude.exe 탐색 (fallback)
|
|
if (-not $msixLaunchArg -and -not $ClaudeExePath) {
|
|
$candidatePaths = @(
|
|
"$env:LOCALAPPDATA\Programs\claude\claude.exe",
|
|
"$env:LOCALAPPDATA\AnthropicClaude\claude.exe",
|
|
"$env:LOCALAPPDATA\claude\claude.exe",
|
|
"$env:ProgramFiles\claude\claude.exe",
|
|
"${env:ProgramFiles(x86)}\claude\claude.exe",
|
|
"$env:LOCALAPPDATA\Programs\Claude\Claude.exe"
|
|
)
|
|
foreach ($cp in $candidatePaths) {
|
|
if (Test-Path $cp) { $ClaudeExePath = $cp; Write-Host "claude.exe 자동 탐지: $ClaudeExePath"; break }
|
|
}
|
|
if (-not $ClaudeExePath) {
|
|
$where = (Get-Command claude.exe -ErrorAction SilentlyContinue).Source
|
|
if ($where) { $ClaudeExePath = $where; Write-Host "claude.exe PATH에서 탐지: $ClaudeExePath" }
|
|
}
|
|
}
|
|
|
|
if (-not $msixLaunchArg -and (-not $ClaudeExePath -or -not (Test-Path $ClaudeExePath))) {
|
|
Write-Warning "Claude 실행 수단 탐지 실패 (MSIX·exe 모두). 바로가기 생성 생략."
|
|
Write-Warning "수동 지정: .\setup_windows.ps1 -CreateShortcuts -ClaudeExePath '<실제 경로>'"
|
|
} else {
|
|
$WshShell = New-Object -ComObject WScript.Shell
|
|
$desktop = [Environment]::GetFolderPath("Desktop")
|
|
|
|
$targets = @(
|
|
@{ Name = "BurningTimes_총괄PM"; Dir = $BurningTimesRoot; Desc = "BurningTimes 총괄PM 세션 (루트)" },
|
|
@{ Name = "BurningTimes_개발팀"; Dir = (Join-Path $BurningTimesRoot "개발팀"); Desc = "BurningTimes 개발팀 세션" },
|
|
@{ Name = "BurningTimes_기획팀"; Dir = (Join-Path $BurningTimesRoot "기획팀"); Desc = "BurningTimes 기획팀 세션" }
|
|
)
|
|
|
|
foreach ($t in $targets) {
|
|
if (-not (Test-Path $t.Dir)) {
|
|
Write-Warning "대상 디렉토리 없음. 건너뜀: $($t.Dir)"
|
|
continue
|
|
}
|
|
$shortcutPath = Join-Path $desktop "$($t.Name).lnk"
|
|
$sc = $WshShell.CreateShortcut($shortcutPath)
|
|
if ($msixLaunchArg) {
|
|
# MSIX 앱: explorer.exe shell:AppsFolder\... 방식
|
|
$sc.TargetPath = "explorer.exe"
|
|
$sc.Arguments = $msixLaunchArg
|
|
} else {
|
|
# 일반 exe 방식
|
|
$sc.TargetPath = $ClaudeExePath
|
|
$sc.IconLocation = "$ClaudeExePath,0"
|
|
}
|
|
$sc.WorkingDirectory = $t.Dir
|
|
$sc.Description = $t.Desc
|
|
$sc.Save()
|
|
Write-Host "바로가기 생성: $shortcutPath (WD=$($t.Dir))"
|
|
}
|
|
|
|
Write-Host ""
|
|
if ($msixLaunchArg) {
|
|
Write-Host "바로가기 3종 생성 완료 (MSIX 모드)."
|
|
Write-Host "※ MSIX 앱은 WorkingDirectory가 전달되지 않을 수 있음. 바로가기 더블클릭 후 실제 프로젝트 경로 확인 필수."
|
|
} else {
|
|
Write-Host "바로가기 3종 생성 완료."
|
|
}
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "셋업 완료. 'git pull'로 최신 상태 유지 권장."
|
|
Write-Host "※ .claude/settings.json 변경사항은 세션 재시작 후 적용됨."
|
|
if (-not $CreateShortcuts) {
|
|
Write-Host "※ 부서별 바탕화면 바로가기 필요 시: .\setup_windows.ps1 -CreateShortcuts"
|
|
}
|