OpenCode 설치 스크립트 추가 및 README 갱신
This commit is contained in:
1 parent
ae8397aef4
commit
4e82bde404
5 files changed
+409
-2
No files matched your search
@@ -28,6 +28,7 @@
|
||||
* **[Antigravity CLI (agy)](https://antigravity.google)** - Antigravity 2.0 플랫폼의 경량화 터미널 코딩 에이전트 CLI
|
||||
* **[Claude Code](https://code.claude.com/)** - Anthropic의 차세대 터미널 기반 대화형 AI 코딩 어시스턴트 CLI
|
||||
* **[Codex CLI](https://developers.openai.com/codex/cli)** - OpenAI의 공식 터미널 기반 로컬 대화형 코딩 에이전트 CLI
|
||||
* **[OpenCode](https://opencode.ai/)** - 75개 이상의 LLM 프로바이더를 지원하는 터미널 TUI 기반 오픈소스 AI 코딩 에이전트
|
||||
* **[pi](https://pi.dev/)** - 대화형 CLI AI 코딩 어시스턴트 및 추천 플러그인 패키지 일괄 설치 도구
|
||||
* **[Open Code Review (ocr)](https://github.com/alibaba/open-code-review)** - AI 기반의 오픈소스 코드 리뷰 자동화 도구
|
||||
|
||||
@@ -125,6 +126,11 @@
|
||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-codex-cli.sh?ref_type=heads" | bash
|
||||
```
|
||||
|
||||
* **OpenCode:**
|
||||
```bash
|
||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-opencode.sh?ref_type=heads" | bash
|
||||
```
|
||||
|
||||
* **pi (Pi Coding Agent + 추천 패키지):**
|
||||
```bash
|
||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-pi.sh?ref_type=heads" | bash
|
||||
@@ -299,6 +305,16 @@
|
||||
$t="$env:TEMP\install-codex-cli.ps1"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-codex-cli.ps1' -OutFile $t; powershell -ExecutionPolicy Bypass -File $t
|
||||
```
|
||||
|
||||
* **OpenCode:**
|
||||
* **CMD 창에서 설치 시:**
|
||||
```cmd
|
||||
powershell -ExecutionPolicy Bypass -c "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $t=\"$env:TEMP\install-opencode.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-opencode.ps1' -OutFile $t; & $t"
|
||||
```
|
||||
* **파워쉘 창에서 설치 시:**
|
||||
```powershell
|
||||
$t="$env:TEMP\install-opencode.ps1"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-opencode.ps1' -OutFile $t; powershell -ExecutionPolicy Bypass -File $t
|
||||
```
|
||||
|
||||
* **pi (Pi Coding Agent + 추천 패키지):**
|
||||
* **CMD 창에서 설치 시:**
|
||||
```cmd
|
||||
@@ -618,7 +634,26 @@ codex # 대화형 코딩 TUI 세션 시작
|
||||
codex -p "작업명령" # 로컬 파일 시스템 변경 및 빌드 직접 지시 (단발)
|
||||
```
|
||||
|
||||
#### 4.4. Pi Coding Agent
|
||||
#### 4.4. OpenCode
|
||||
터미널, IDE, 데스크톱 환경을 아우르는 오픈소스 AI 코딩 에이전트 CLI입니다. 특정 AI 프로바이더에 종속되지 않고 OpenAI, Anthropic, Google(Gemini)뿐 아니라 Ollama 등 로컬 모델을 포함한 75개 이상의 LLM 프로바이더를 자유롭게 연결하여 코드베이스 분석, 파일 편집, 터미널 명령 실행 등을 수행합니다.
|
||||
|
||||
* **터미널 중심 TUI 환경** — 반응성이 뛰어나고 직관적인 터미널 UI를 통해 대화형으로 코딩 작업 수행
|
||||
* **멀티 모델 & 프로바이더 자유도** — OpenAI, Claude, Gemini 및 Ollama 로컬 LLM 등 75종 이상의 다양한 모델을 유연하게 전환
|
||||
* **역할별 에이전트 모드** — 분석 및 읽기 전용인 'Plan' 모드와 직접 수정 및 빌드를 실행하는 'Build' 모드 분리 운용
|
||||
* **프로젝트 인지력** — 프로젝트 내 `AGENTS.md` 생성을 통해 코드베이스 아키텍처 및 코딩 컨벤션을 스스로 학습
|
||||
|
||||
```bash
|
||||
opencode # 가동 명령어
|
||||
```
|
||||
|
||||
##### [OpenCode 기본 사용법]
|
||||
```bash
|
||||
opencode # 대화형 코딩 TUI 세션 시작
|
||||
opencode auth login # AI 모델 프로바이더 계정 및 API 키 연동
|
||||
opencode --help # 도움말 및 사용 가능 옵션 확인
|
||||
```
|
||||
|
||||
#### 4.5. Pi Coding Agent
|
||||
CLI 기반의 최첨단 AI 코딩 파트너입니다. 본 저장소의 `install-pi` 설치 도구를 활용하면 에이전트 본체뿐 아니라 성능 극대화를 지원하는 핵심 플러그인 에코시스템 15종을 단번에 일괄 셋업할 수 있습니다.
|
||||
|
||||
##### [일괄 설치되는 추천 패키지 리스트]
|
||||
@@ -663,7 +698,7 @@ pi --help # 도움말 및 사용 가능 커맨드 파악
|
||||
pi list # 현재 설치 완료된 플러그인 에코시스템 목록 출력
|
||||
```
|
||||
|
||||
#### 4.5. Open Code Review
|
||||
#### 4.6. Open Code Review
|
||||
Alibaba에서 개발한 AI 기반 오픈소스 코드 리뷰 자동화 도구입니다. 결정론적 엔지니어링 분석 기법과 LLM 에이전트의 강점을 하이브리드로 결합하여 코드 변경 사항의 컨텍스트를 깊이 있게 추적하고 리뷰 의견을 생성합니다.
|
||||
|
||||
##### [주요 특징]
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# OpenCode 설치 스크립트 및 README 갱신 실행 계획
|
||||
|
||||
## 1. 개요
|
||||
터미널 기반 오픈소스 AI 코딩 에이전트인 **OpenCode**의 설치 스크립트(`install-opencode.sh`, `install-opencode.ps1`)를 생성하고, `README.md`의 "4.4 Pi Coding Agent" 자리에 OpenCode 설명을 배치하며 Pi Coding Agent를 4.5로, Open Code Review를 4.6으로 재정렬합니다.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A["실행 계획 수립 (IMP-PLAN)"] --> B["install-opencode.sh 생성"]
|
||||
B --> C["install-opencode.ps1 생성"]
|
||||
C --> D["README.md 갱신 (섹션 4.4에 OpenCode 추가 및 번호 재정렬)"]
|
||||
D --> E["동작 검증"]
|
||||
E --> F["단계별 보고서 작성 (PHASE01)"]
|
||||
F --> G["graphify 업데이트"]
|
||||
G --> H["Git 커밋 및 푸시"]
|
||||
```
|
||||
|
||||
## 2. 단계별 작업 항목
|
||||
|
||||
### 1단계: install-opencode.sh 구현
|
||||
- [x] 공식 설치 스크립트(`https://opencode.ai/install`) 연동 및 검증
|
||||
- [x] `$HOME/.local/bin` 심볼릭 링크 연동 로직 추가
|
||||
- [x] 실행 권한 부여(`chmod +x`) 및 로컬 셸 문법 확인
|
||||
|
||||
### 2단계: install-opencode.ps1 구현
|
||||
- [x] CPU 아키텍처(x64, arm64) 자동 감지 로직 구현
|
||||
- [x] GitHub Releases(`anomalyco/opencode`) 최신 바이너리 zip 다운로드
|
||||
- [x] `$env:USERPROFILE\.local\bin`에 `opencode.exe` 배포
|
||||
- [x] 세션 및 사용자 영구 PATH 등록 로직 구현
|
||||
|
||||
### 3단계: README.md 문서 갱신
|
||||
- [x] 상단 AI 에이전트 목록에 OpenCode 추가
|
||||
- [x] macOS/Linux 설치 가이드에 `install-opencode.sh` 추가
|
||||
- [x] Windows 설치 가이드에 `install-opencode.ps1` 추가
|
||||
- [x] 상세 사용법 4.4에 OpenCode 추가, 기존 4.4 Pi -> 4.5, 4.5 ocr -> 4.6 번호 재정렬
|
||||
|
||||
### 4단계: 사후 처리 및 검증
|
||||
- [x] 스크립트 로컬 동작 검증
|
||||
- [x] 단계별 보고서(`INSTALL-OPENCODE-PHASE01.md`) 작성
|
||||
- [x] graphify 그래프 갱신
|
||||
- [x] Git 커밋 및 푸시
|
||||
@@ -0,0 +1,41 @@
|
||||
# OpenCode 설치 스크립트 구축 및 문서 반영 완료 보고서 (PHASE01)
|
||||
|
||||
## 1. 개요
|
||||
오픈소스 AI 코딩 에이전트인 **OpenCode**를 macOS, Linux 및 Windows 환경에서 손쉽게 설치할 수 있도록 원클릭 설치 스크립트(`install-opencode.sh`, `install-opencode.ps1`)를 구축하고, `README.md` 가이드에 OpenCode를 추가하며 기존 도구(Pi Coding Agent, Open Code Review)의 번호를 순서대로 재정렬하였습니다.
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A["OpenCode 설치 스크립트 제작"] --> B["install-opencode.sh (macOS/Linux)"]
|
||||
A --> C["install-opencode.ps1 (Windows)"]
|
||||
B --> D["README.md 동기화"]
|
||||
C --> D
|
||||
D --> E["4.4 OpenCode 추가"]
|
||||
D --> F["4.5 Pi Coding Agent 재배치"]
|
||||
D --> G["4.6 Open Code Review 재배치"]
|
||||
```
|
||||
|
||||
## 2. 주요 작업 내역
|
||||
|
||||
### 1) `install-opencode.sh` (macOS / Linux)
|
||||
- **공식 설치 인스톨러 연동**: `curl -fsSL https://opencode.ai/install | bash`를 안전하게 실행.
|
||||
- **PATH 및 바이너리 연동**: 설치 완료 후 `~/.opencode/bin/opencode` 바이너리가 존재할 경우, 본 저장소의 표준 바이너리 경로인 `~/.local/bin/opencode`로 심볼릭 링크를 자동 연결.
|
||||
- **실행 권한 부여**: `chmod +x install-opencode.sh` 적용 및 구문 유효성 검증 완료.
|
||||
|
||||
### 2) `install-opencode.ps1` (Windows PowerShell)
|
||||
- **CPU 아키텍처 자동 판별**: `AMD64`/`x64` 및 `ARM64` 환경을 자동 감지하여 적합한 zip 아카이브(`opencode-windows-x64.zip` / `opencode-windows-arm64.zip`) 타겟팅.
|
||||
- **GitHub Releases 연동 및 Fallback**: `anomalyco/opencode` 최신 릴리스 API를 호출하여 자산을 자동 매칭하며, 네트워크 제한 시 안전한 Fallback 버전 제공.
|
||||
- **바이너리 추출 및 배포**: `$env:USERPROFILE\.local\bin`에 `opencode.exe` 자동 압축 해제 및 배치.
|
||||
- **PATH 환경 변수 자동 반영**: 현재 세션 `$env:Path` 즉시 등록 및 Windows 사용자 레지스트리(User PATH) 영구 등록.
|
||||
|
||||
### 3) `README.md` 개정
|
||||
- **상단 카테고리 목록**: `### 🤖 4. AI 개발 에이전트` 목록에 OpenCode 항목 추가.
|
||||
- **macOS / Linux 설치 섹션**: `install-opencode.sh` 원격 실행 원라이너 추가.
|
||||
- **Windows 설치 섹션**: CMD 및 PowerShell 각각에서 실행 가능한 `install-opencode.ps1` 원라이너 추가.
|
||||
- **도구별 상세 사용법 재정렬**:
|
||||
- `#### 4.4. OpenCode` 신규 작성 (개요, 특징, TUI 기본 명령어)
|
||||
- `#### 4.5. Pi Coding Agent` (기존 4.4에서 4.5로 순번 변경)
|
||||
- `#### 4.6. Open Code Review` (기존 4.5에서 4.6으로 순번 변경)
|
||||
|
||||
## 3. 결과 검증
|
||||
- Bash 문법 검증: `bash -n install-opencode.sh` 통과.
|
||||
- `README.md` 링크 및 마크다운 서식 정합성 확인 완료.
|
||||
@@ -0,0 +1,234 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs OpenCode (open-source AI coding agent) on Windows.
|
||||
|
||||
.DESCRIPTION
|
||||
Auto-detects the latest release from https://github.com/anomalyco/opencode/releases,
|
||||
downloads the zip file matching your Windows architecture, extracts opencode.exe
|
||||
to $env:USERPROFILE\.local\bin, and adds the directory to your User PATH.
|
||||
|
||||
Supported architectures:
|
||||
- x64 (AMD64 / Intel 64-bit)
|
||||
- ARM64 (Qualcomm Snapdragon, ARM 64-bit)
|
||||
|
||||
.PARAMETER InstallDir
|
||||
Directory to install opencode.exe. Default: $env:USERPROFILE\.local\bin
|
||||
|
||||
.PARAMETER AddToPath
|
||||
Whether to permanently add InstallDir to user PATH. Default: $true
|
||||
|
||||
.EXAMPLE
|
||||
.\install-opencode.ps1
|
||||
|
||||
# One-liner install from remote (works on Windows 10+):
|
||||
powershell -ExecutionPolicy Bypass -c "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $t=\"$env:TEMP\install-opencode.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-opencode.ps1' -OutFile $t; & $t"
|
||||
|
||||
.NOTES
|
||||
If execution policy error occurs:
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string] $InstallDir = "$env:USERPROFILE\.local\bin",
|
||||
[bool] $AddToPath = $true
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Enforce TLS 1.2+ for HTTPS downloads (required on Windows 10 / PowerShell 5.1)
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Constants
|
||||
# ────────────────────────────────────────────
|
||||
$REPO = "anomalyco/opencode"
|
||||
$API_URL = "https://api.github.com/repos/$REPO/releases/latest"
|
||||
$FALLBACK_TAG = "v1.18.35"
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Utility functions (English only to prevent Windows console encoding issues)
|
||||
# ────────────────────────────────────────────
|
||||
function Info { Write-Host "[INFO] $args" -ForegroundColor Cyan }
|
||||
function Warn { Write-Host "[WARN] $args" -ForegroundColor Yellow }
|
||||
function Success { Write-Host "[OK] $args" -ForegroundColor Green }
|
||||
function ErrExit { Write-Host "[ERROR] $args" -ForegroundColor Red; exit 1 }
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Platform detection
|
||||
# ────────────────────────────────────────────
|
||||
function Get-Platform {
|
||||
$arch = $env:PROCESSOR_ARCHITEW6432
|
||||
if (-not $arch) { $arch = $env:PROCESSOR_ARCHITECTURE }
|
||||
|
||||
switch -Regex ($arch) {
|
||||
'^(AMD64|x64)$' { return 'windows-x64' }
|
||||
'^(ARM64)$' { return 'windows-arm64' }
|
||||
default {
|
||||
ErrExit "Unsupported CPU architecture: '$arch'. Supported: x64, ARM64."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Fetch latest release tag and asset URL
|
||||
# ────────────────────────────────────────────
|
||||
function Get-ReleaseInfo {
|
||||
param([string]$Platform)
|
||||
|
||||
Info "Fetching latest OpenCode release from GitHub..."
|
||||
$tag = $FALLBACK_TAG
|
||||
$assetUrl = $null
|
||||
$targetPattern = "opencode-${Platform}.zip"
|
||||
|
||||
try {
|
||||
$headers = @{ 'User-Agent' = 'install-opencode-ps1' }
|
||||
$release = Invoke-RestMethod -Uri $API_URL -Headers $headers -TimeoutSec 10 -UseBasicParsing
|
||||
if ($release -and $release.tag_name) {
|
||||
$tag = $release.tag_name
|
||||
$asset = $release.assets | Where-Object { $_.name -like "*${Platform}.zip" } | Select-Object -First 1
|
||||
if ($asset -and $asset.browser_download_url) {
|
||||
$assetUrl = $asset.browser_download_url
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Warn "GitHub API lookup failed: $_"
|
||||
Warn "Using fallback release tag: $FALLBACK_TAG"
|
||||
}
|
||||
|
||||
if (-not $assetUrl) {
|
||||
$cleanTag = $tag.TrimStart('v')
|
||||
$assetUrl = "https://github.com/$REPO/releases/download/$tag/opencode-$Platform.zip"
|
||||
}
|
||||
|
||||
return @{
|
||||
Tag = $tag
|
||||
Url = $assetUrl
|
||||
}
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Download and install binary
|
||||
# ────────────────────────────────────────────
|
||||
function Install-OpenCode {
|
||||
param(
|
||||
[string]$Url,
|
||||
[string]$TargetDir
|
||||
)
|
||||
|
||||
if (-not (Test-Path $TargetDir)) {
|
||||
New-Item -ItemType Directory -Path $TargetDir -Force | Out-Null
|
||||
}
|
||||
|
||||
$tmpDir = Join-Path $env:TEMP "opencode_install_$(Get-Random)"
|
||||
New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null
|
||||
$zipPath = Join-Path $tmpDir "opencode.zip"
|
||||
|
||||
try {
|
||||
Info "Downloading OpenCode archive..."
|
||||
Info "URL: $Url"
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
Invoke-WebRequest -Uri $Url -OutFile $zipPath -UseBasicParsing
|
||||
$ProgressPreference = 'Continue'
|
||||
|
||||
if (-not (Test-Path $zipPath)) {
|
||||
ErrExit "Failed to download OpenCode archive from $Url"
|
||||
}
|
||||
|
||||
Info "Extracting opencode.exe to $TargetDir..."
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
$archive = [System.IO.Compression.ZipFile]::OpenRead($zipPath)
|
||||
$extracted = $false
|
||||
|
||||
foreach ($entry in $archive.Entries) {
|
||||
if ($entry.Name -eq "opencode.exe") {
|
||||
$destFile = Join-Path $TargetDir "opencode.exe"
|
||||
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $destFile, $true)
|
||||
$extracted = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
$archive.Dispose()
|
||||
|
||||
if (-not $extracted) {
|
||||
ErrExit "opencode.exe was not found inside the downloaded archive."
|
||||
}
|
||||
|
||||
Success "opencode.exe installed successfully into $TargetDir"
|
||||
} finally {
|
||||
if (Test-Path $tmpDir) {
|
||||
Remove-Item -Path $tmpDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Register PATH environment variable
|
||||
# ────────────────────────────────────────────
|
||||
function Update-PathEnvironment {
|
||||
param([string]$Dir)
|
||||
|
||||
$normalizedDir = $Dir.TrimEnd('\')
|
||||
|
||||
# Current session PATH
|
||||
if ($env:Path -notlike "*$normalizedDir*") {
|
||||
$env:Path = "$normalizedDir;$env:Path"
|
||||
Info "Added $normalizedDir to current session PATH."
|
||||
}
|
||||
|
||||
# Permanent User PATH in Windows Registry
|
||||
$userPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')
|
||||
if (-not $userPath) { $userPath = '' }
|
||||
$pathParts = $userPath -split ';' | Where-Object { $_ -ne '' }
|
||||
|
||||
$alreadyInPath = $false
|
||||
foreach ($p in $pathParts) {
|
||||
if ($p.Trim().TrimEnd('\') -eq $normalizedDir) {
|
||||
$alreadyInPath = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $alreadyInPath) {
|
||||
$newUserPath = if ($userPath) { "$normalizedDir;$userPath" } else { $normalizedDir }
|
||||
[System.Environment]::SetEnvironmentVariable('Path', $newUserPath, 'User')
|
||||
Success "Added $normalizedDir to User PATH permanently."
|
||||
Warn "Please open a new terminal window for PATH changes to take full effect."
|
||||
} else {
|
||||
Info "$normalizedDir is already present in User PATH."
|
||||
}
|
||||
}
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# Main Entry Point
|
||||
# ────────────────────────────────────────────
|
||||
function Main {
|
||||
Info "===== OpenCode install script (Windows PowerShell) ====="
|
||||
Info "Target install directory: $InstallDir"
|
||||
|
||||
$platform = Get-Platform
|
||||
Info "Detected platform: $platform"
|
||||
|
||||
$releaseInfo = Get-ReleaseInfo -Platform $platform
|
||||
Info "Release version: $($releaseInfo.Tag)"
|
||||
|
||||
Install-OpenCode -Url $releaseInfo.Url -TargetDir $InstallDir
|
||||
|
||||
if ($AddToPath) {
|
||||
Update-PathEnvironment -Dir $InstallDir
|
||||
} else {
|
||||
Warn "Skipping PATH environment update as requested (-AddToPath `$false)."
|
||||
}
|
||||
|
||||
Success "OpenCode installation completed successfully!"
|
||||
Info ""
|
||||
Info "How to run:"
|
||||
Info " opencode - Launch interactive TUI coding session"
|
||||
Info " opencode auth login - Configure AI model provider accounts"
|
||||
Info " opencode --help - Show help and available commands"
|
||||
Info ""
|
||||
}
|
||||
|
||||
Main
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
# OpenCode 네이티브 설치 스크립트
|
||||
#
|
||||
# macOS, Linux 환경에서 curl을 사용하여 공식 설치 스크립트를 다운로드하고 bash로 실행합니다.
|
||||
# 공식 웹사이트: https://opencode.ai
|
||||
# 공식 GitHub: https://github.com/anomalyco/opencode
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 유틸리티 함수 (모두 stderr 출력)
|
||||
# ────────────────────────────────────────────
|
||||
info() { echo "[INFO] $*" >&2; }
|
||||
warn() { echo "[WARN] $*" >&2; }
|
||||
error() { echo "[ERROR] $*" >&2; exit 1; }
|
||||
success() { echo "[OK] $*" >&2; }
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 필수 명령어 확인
|
||||
# ────────────────────────────────────────────
|
||||
for cmd in curl bash; do
|
||||
if ! command -v "$cmd" &>/dev/null; then
|
||||
error "'$cmd' 명령어가 필요합니다. 먼저 설치해 주세요."
|
||||
fi
|
||||
done
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 메인 설치 로직
|
||||
# ────────────────────────────────────────────
|
||||
main() {
|
||||
info "OpenCode (오픈소스 AI 코딩 에이전트) 설치를 시작합니다..."
|
||||
info "공식 설치 스크립트 실행 중: curl -fsSL https://opencode.ai/install | bash"
|
||||
|
||||
# 공식 스크립트 실행
|
||||
if curl -fsSL https://opencode.ai/install | bash; then
|
||||
success "OpenCode 설치가 성공적으로 완료되었습니다!"
|
||||
|
||||
# ~/.local/bin 경로가 존재하고 ~/.opencode/bin/opencode가 있는 경우 심볼릭 링크 연결
|
||||
local opencode_bin="$HOME/.opencode/bin/opencode"
|
||||
local local_bin="$HOME/.local/bin"
|
||||
if [ -x "$opencode_bin" ] && [ -d "$local_bin" ]; then
|
||||
ln -sf "$opencode_bin" "$local_bin/opencode" 2>/dev/null || true
|
||||
info "$local_bin/opencode 에 심볼릭 링크를 구성했습니다."
|
||||
fi
|
||||
|
||||
info "새로운 터미널 창을 열거나 환경 변수를 반영한 뒤 아래 명령어를 통해 실행하세요:"
|
||||
info " opencode # 대화형 코딩 TUI 세션 시작"
|
||||
info " opencode auth login # AI 모델 프로바이더 인증 설정"
|
||||
info " opencode --help # 도움말 및 사용법 확인"
|
||||
else
|
||||
error "OpenCode 공식 설치 스크립트 실행 중 에러가 발생했습니다."
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in new issue
Block a user