zioinfo-mail/setup/guardia_setup.ps1
DESKTOP-TKLFCPR\ython 28d3ba4836 refactor(cleanup): commit folder reorganization - scripts/, _archive/, docs/ restructure
- Move backend/frontend/messenger/ old paths to _archive/
- Reorganize scripts into scripts/deploy, check, push, setup, misc
- Move docs (pptx, docx) to docs/
- Add .claude agents and skills for fullstack/folder-cleanup harness
- workspace/ projects remain intact

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 19:43:09 +09:00

147 lines
5.6 KiB
PowerShell

# ============================================================
# GUARDiA - Claude Code + MCP Filesystem 자동 설치 스크립트
# PowerShell을 관리자 권한으로 실행 후 붙여넣기
# ============================================================
$ErrorActionPreference = "Stop"
function Write-Step($msg) {
Write-Host "`n>>> $msg" -ForegroundColor Cyan
}
function Write-OK($msg) {
Write-Host " [OK] $msg" -ForegroundColor Green
}
function Write-Warn($msg) {
Write-Host " [!!] $msg" -ForegroundColor Yellow
}
# ──────────────────────────────────────────
# 1. C:\GUARDiA 디렉토리 생성
# ──────────────────────────────────────────
Write-Step "1/5 C:\GUARDiA 디렉토리 확인"
if (-not (Test-Path "C:\GUARDiA")) {
New-Item -ItemType Directory -Path "C:\GUARDiA" | Out-Null
Write-OK "C:\GUARDiA 생성 완료"
} else {
Write-OK "C:\GUARDiA 이미 존재"
}
# ──────────────────────────────────────────
# 2. Claude Code 설치
# ──────────────────────────────────────────
Write-Step "2/5 Claude Code 설치"
$claudePath = "$env:USERPROFILE\.local\bin\claude.exe"
$claudeInstalled = $false
if (Get-Command claude -ErrorAction SilentlyContinue) {
Write-OK "claude 명령어 이미 사용 가능"
$claudeInstalled = $true
} elseif (Test-Path $claudePath) {
Write-OK "claude.exe 존재 - PATH만 추가 필요"
} else {
Write-Warn "Claude Code 설치 중..."
try {
Invoke-RestMethod https://claude.ai/install.ps1 | Invoke-Expression
Write-OK "Claude Code 설치 완료"
} catch {
Write-Warn "공식 설치 실패 - npm으로 재시도"
if (Get-Command npm -ErrorAction SilentlyContinue) {
npm install -g @anthropic-ai/claude-code
Write-OK "npm 설치 완료"
} else {
Write-Host "`n[오류] npm도 없습니다. Node.js를 먼저 설치해 주세요:" -ForegroundColor Red
Write-Host " https://nodejs.org/en/download" -ForegroundColor Yellow
exit 1
}
}
}
# ──────────────────────────────────────────
# 3. PATH 등록
# ──────────────────────────────────────────
Write-Step "3/5 PATH 환경변수 등록"
$localBin = "$env:USERPROFILE\.local\bin"
$npmGlobal = (npm config get prefix 2>$null)
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
$pathsToAdd = @($localBin)
if ($npmGlobal) { $pathsToAdd += "$npmGlobal" }
foreach ($p in $pathsToAdd) {
if ($currentPath -notlike "*$p*") {
[Environment]::SetEnvironmentVariable("PATH", "$currentPath;$p", [EnvironmentVariableTarget]::User)
$env:PATH = "$env:PATH;$p"
Write-OK "PATH 추가: $p"
} else {
Write-OK "이미 PATH에 있음: $p"
}
}
# ──────────────────────────────────────────
# 4. .mcp.json 생성 (Claude Code 프로젝트 설정)
# ──────────────────────────────────────────
Write-Step "4/5 C:\GUARDiA\.mcp.json 생성"
$mcpConfig = @{
mcpServers = @{
filesystem = @{
command = "cmd"
args = @("/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:/GUARDiA")
}
}
} | ConvertTo-Json -Depth 5
$mcpPath = "C:\GUARDiA\.mcp.json"
Set-Content -Path $mcpPath -Value $mcpConfig -Encoding UTF8
Write-OK ".mcp.json 저장 완료: $mcpPath"
# ──────────────────────────────────────────
# 5. Claude Desktop config 업데이트
# ──────────────────────────────────────────
Write-Step "5/5 Claude Desktop 설정 업데이트"
$desktopConfigDir = "$env:APPDATA\Claude"
$desktopConfigPath = "$desktopConfigDir\claude_desktop_config.json"
if (-not (Test-Path $desktopConfigDir)) {
New-Item -ItemType Directory -Path $desktopConfigDir | Out-Null
}
$desktopConfig = @{
mcpServers = @{
filesystem = @{
command = "npx"
args = @("-y", "@modelcontextprotocol/server-filesystem", "C:\\GUARDiA")
}
}
} | ConvertTo-Json -Depth 5
Set-Content -Path $desktopConfigPath -Value $desktopConfig -Encoding UTF8
Write-OK "claude_desktop_config.json 저장 완료"
# ──────────────────────────────────────────
# 완료 메시지
# ──────────────────────────────────────────
Write-Host "`n============================================" -ForegroundColor Magenta
Write-Host " 설치 완료!" -ForegroundColor Magenta
Write-Host "============================================" -ForegroundColor Magenta
Write-Host @"
:
1. PowerShell (PATH )
2. Claude Desktop
3. Claude Code :
cd C:\GUARDiA
claude
4. Claude Code :
/mcp (MCP )
/doctor ( )
"@ -ForegroundColor White