claude code 추가
This commit is contained in:
1 parent
c0058e6719
commit
75e37cc7f0
3 files changed
+152
-1
No files matched your search
@@ -0,0 +1,74 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs Claude Code (Anthropic's command-line AI assistant) on Windows using WinGet.
|
||||
|
||||
.DESCRIPTION
|
||||
Installs Claude Code natively via winget (Anthropic.ClaudeCode).
|
||||
This native installation method is recommended for Windows.
|
||||
|
||||
.EXAMPLE
|
||||
.\install-claude-code.ps1
|
||||
|
||||
# One-liner install from remote (works on Windows 10+):
|
||||
powershell -ExecutionPolicy Bypass -c "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $t=\"$env:TEMP\install-claude-code.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-claude-code.ps1' -OutFile $t; & $t"
|
||||
|
||||
.NOTES
|
||||
If execution policy error occurs:
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
# 최신 윈도우 환경 및 에러 발생 시 즉시 중단 설정
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# HTTPS 다운로드를 위한 TLS 1.2 강제 (PowerShell 5.1 호환성 보장)
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 유틸리티 함수 정의 (모든 안내 문구는 영문으로 작성)
|
||||
# ────────────────────────────────────────────
|
||||
function Write-Info { param([string]$msg) Write-Host "[INFO] $msg" -ForegroundColor Cyan }
|
||||
# 정보 출력
|
||||
function Write-Warn { param([string]$msg) Write-Host "[WARN] $msg" -ForegroundColor Yellow }
|
||||
# 경고 출력
|
||||
function Write-Success { param([string]$msg) Write-Host "[OK] $msg" -ForegroundColor Green }
|
||||
# 성공 출력
|
||||
function Write-Err { param([string]$msg) Write-Host "[ERROR] $msg" -ForegroundColor Red; exit 1 }
|
||||
# 에러 출력 및 스크립트 강제 종료
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 메인 설치 프로세스
|
||||
# ────────────────────────────────────────────
|
||||
function Main {
|
||||
Write-Info "===== Claude Code install script (Windows PowerShell) ====="
|
||||
Write-Info "Installing Claude Code (command-line AI assistant) natively..."
|
||||
|
||||
# 1) winget 명령어 가용성 확인
|
||||
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
|
||||
Write-Err "winget is required to install Claude Code. Please install it from the Microsoft Store or https://learn.microsoft.com/en-us/windows/package-manager/winget/"
|
||||
}
|
||||
|
||||
# 2) winget을 통한 Anthropic.ClaudeCode 설치 가동
|
||||
try {
|
||||
Write-Info "Running winget installer..."
|
||||
# 라이센스 및 소스 협약 자동 수락 처리와 함께 설치 실행
|
||||
winget install --id Anthropic.ClaudeCode --accept-package-agreements --accept-source-agreements 2>&1 | Out-Null
|
||||
|
||||
Write-Success "Claude Code has been successfully installed!"
|
||||
Write-Info "Please restart your terminal window or refresh your PATH environment variable."
|
||||
Write-Info "Run command: claude"
|
||||
} catch {
|
||||
Write-Err "Failed to install Claude Code via winget: $_"
|
||||
}
|
||||
}
|
||||
|
||||
# 예기치 못한 전체 프로세스 에러 감지를 위한 Trap 설정
|
||||
trap {
|
||||
Write-Err "An unexpected error occurred during installation: $_"
|
||||
}
|
||||
|
||||
Main
|
||||
Reference in new issue
Block a user