pi/kimi2.5 로 작업; bottom 수정 및 lazygit 추가

This commit is contained in:
Jerry Chae committed 2026-05-12 16:33:08 +09:00
1 parent a07e58ce04
commit dd494a4991
7 files changed
+746 -120

No files matched your search

+54 -53
View File
@@ -1,22 +1,22 @@
#Requires -Version 5.1
#Requires -Version 5.1
<#
.SYNOPSIS
bottom(btm) 프로세스 모니터를 GitHub Nightly 최신 버전으로 설치합니다.
Installs bottom(btm) process monitor from GitHub Nightly releases.
.DESCRIPTION
https://github.com/ClementTsang/bottom/releases 에서 최신 Nightly 릴리스를
자동으로 탐지하고, 현재 Windows 아키텍처에 맞는 zip 파일을 다운로드하여
설치합니다.
Auto-detects the latest Nightly release from
https://github.com/ClementTsang/bottom/releases, downloads the zip
file matching your Windows architecture, and installs it.
지원 아키텍처:
Supported architectures:
- x64 (AMD64 / Intel 64bit)
- ARM64 (Snapdragon X Elite, Qualcomm ARM 등)
- ARM64 (Snapdragon X Elite, Qualcomm ARM, etc.)
.PARAMETER InstallDir
btm.exe 를 설치할 디렉토리. 기본값: $env:USERPROFILE\.local\bin
Directory to install btm.exe. Default: $env:USERPROFILE\.local\bin
.PARAMETER AddToPath
InstallDir 을 영구적으로 사용자 PATH에 추가할지 여부. 기본값: $true
Whether to permanently add InstallDir to user PATH. Default: $true
.EXAMPLE
.\install-bottom.ps1
@@ -24,7 +24,7 @@
.\install-bottom.ps1 -AddToPath $false
.NOTES
실행 정책 오류 발생 시:
If execution policy error occurs:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
#>
@@ -38,13 +38,13 @@ Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
# ────────────────────────────────────────────
# 상수
# Constants
# ────────────────────────────────────────────
$REPO = "ClementTsang/bottom"
$API_URL = "https://api.github.com/repos/$REPO/releases"
# ────────────────────────────────────────────
# 유틸리티 함수
# Utility functions
# ────────────────────────────────────────────
function Write-Info { param([string]$msg) Write-Host "[INFO] $msg" -ForegroundColor Cyan }
function Write-Warn { param([string]$msg) Write-Host "[WARN] $msg" -ForegroundColor Yellow }
@@ -52,18 +52,19 @@ function Write-Success { param([string]$msg) Write-Host "[OK] $msg" -Foregrou
function Write-Err { param([string]$msg) Write-Host "[ERROR] $msg" -ForegroundColor Red; exit 1 }
# ────────────────────────────────────────────
# TLS 1.2 강제 (Windows 7/8.1 대비)
# Enforce TLS 1.2 (for Windows 7/8.1 compatibility)
# ────────────────────────────────────────────
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# ────────────────────────────────────────────
# 아키텍처 감지
# Architecture detection
# ────────────────────────────────────────────
function Get-Platform {
# 1) 환경변수를 먼저 확인 (Windows on ARM의 32-bit PowerShell에서도 OS 아키를 정확히 판별)
# - 네이티브 프로세스 : PROCESSOR_ARCHITECTURE = AMD64 / ARM64 / x86
# 1) Check environment variables first (even 32-bit PowerShell on
# Windows ARM can correctly detect OS architecture)
# - Native process : PROCESSOR_ARCHITECTURE = AMD64 / ARM64 / x86
# - WOW64(32bit on 64bit): PROCESSOR_ARCHITECTURE = x86,
# PROCESSOR_ARCHITEW6432 = AMD64 또는 ARM64 (실제 OS 아키)
# PROCESSOR_ARCHITEW6432 = AMD64 or ARM64 (actual OS arch)
$envArch = $env:PROCESSOR_ARCHITEW6432
if (-not $envArch) { $envArch = $env:PROCESSOR_ARCHITECTURE }
@@ -73,47 +74,47 @@ function Get-Platform {
'^x86$' { return "i686-pc-windows-msvc" }
}
# 2) Fallback: .NET RuntimeInformation (PS 5.1 + .NET Framework 4.7.1+ 필요)
# 2) Fallback: .NET RuntimeInformation (requires PS 5.1 + .NET Framework 4.7.1+)
try {
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
switch ($arch) {
'X64' { return "x86_64-pc-windows-msvc" }
'Arm64' { return "aarch64-pc-windows-msvc" }
'X86' { return "i686-pc-windows-msvc" }
default { Write-Err "지원하지 않는 아키텍처: $arch" }
default { Write-Err "Unsupported architecture: $arch" }
}
} catch {
Write-Err "아키텍처 감지에 실패했습니다: $_"
Write-Err "Failed to detect architecture: $_"
}
}
# ────────────────────────────────────────────
# 최신 Nightly 릴리스 태그 가져오기
# Get latest Nightly release tag
# ────────────────────────────────────────────
function Get-LatestNightlyTag {
Write-Info "GitHub API로 최신 Nightly 릴리스 정보를 조회합니다..."
Write-Info "Fetching latest Nightly release from GitHub API..."
try {
$releases = Invoke-RestMethod -Uri $API_URL -UseBasicParsing `
-Headers @{ 'User-Agent' = 'install-bottom-ps1' }
} catch {
Write-Err "GitHub API 호출에 실패했습니다: $_"
Write-Err "Failed to call GitHub API: $_"
}
# prerelease=true 이고 tag_name 이 'nightly-' 로 시작하는 첫 번째 항목
# Get first item where prerelease=true and tag_name starts with 'nightly-'
$nightly = $releases | Where-Object {
$_.prerelease -eq $true -and $_.tag_name -like 'nightly-*'
} | Select-Object -First 1
if (-not $nightly) {
Write-Err "Nightly 릴리스를 찾을 수 없습니다."
Write-Err "Could not find Nightly release."
}
return $nightly.tag_name
}
# ────────────────────────────────────────────
# 다운로드 URL 조합
# Build download URL
# ────────────────────────────────────────────
function Get-DownloadUrl {
param([string]$Tag, [string]$Triple)
@@ -122,55 +123,55 @@ function Get-DownloadUrl {
}
# ────────────────────────────────────────────
# 다운로드 & 압축 해제 & 설치
# Download, extract & install
# ────────────────────────────────────────────
function Install-Bottom {
param([string]$Url)
# 임시 디렉토리 생성
# Create temp directory
$tmpDir = Join-Path $env:TEMP "bottom_install_$(Get-Random)"
New-Item -ItemType Directory -Path $tmpDir | Out-Null
try {
$zipPath = Join-Path $tmpDir "bottom.zip"
Write-Info "다운로드 중: $Url"
Write-Info "Downloading: $Url"
try {
# PowerShell 5+ 에서 진행률 표시
# Suppress progress bar in PowerShell 5+
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $Url -OutFile $zipPath -UseBasicParsing
$ProgressPreference = 'Continue'
} catch {
Write-Err "다운로드 실패: $_"
Write-Err "Download failed: $_"
}
Write-Info "압축 해제 중..."
Write-Info "Extracting..."
Expand-Archive -Path $zipPath -DestinationPath $tmpDir -Force
# btm.exe 찾기
# Find btm.exe
$btmExe = Get-ChildItem -Path $tmpDir -Recurse -Filter "btm.exe" |
Select-Object -First 1
if (-not $btmExe) {
Write-Err "압축 파일에서 'btm.exe'를 찾을 수 없습니다."
Write-Err "Cannot find 'btm.exe' in the archive."
}
# 설치 디렉토리 생성
# Create install directory
if (-not (Test-Path $InstallDir)) {
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
}
$destPath = Join-Path $InstallDir "btm.exe"
Write-Info "설치 중: $destPath"
Write-Info "Installing: $destPath"
Copy-Item -Path $btmExe.FullName -Destination $destPath -Force
Write-Success "설치 완료!"
Write-Success "Installation complete!"
# 버전 확인
Write-Info "버전 확인:"
# Check version
Write-Info "Version check:"
& $destPath --version
} finally {
# 임시 파일 정리
# Cleanup temp files
if (Test-Path $tmpDir) {
Remove-Item -Path $tmpDir -Recurse -Force -ErrorAction SilentlyContinue
}
@@ -178,42 +179,42 @@ function Install-Bottom {
}
# ────────────────────────────────────────────
# PATH 등록 (사용자 환경변수)
# Add to PATH (user environment variable)
# ────────────────────────────────────────────
function Add-ToUserPath {
param([string]$Dir)
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
if (-not $currentPath) { $currentPath = '' }
# 결과가 단일 항목일 때도 배열로 강제 (-contains 안전성 확보)
# Force array even with single result (for safe -contains check)
$dirs = @($currentPath -split ';' | Where-Object { $_ -ne '' })
if ($dirs -contains $Dir) {
Write-Info "'$Dir' 은 이미 PATH에 등록되어 있습니다."
Write-Info "'$Dir' is already in your PATH."
return
}
$newPath = ($dirs + $Dir) -join ';'
[Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')
# 현재 세션에도 반영
# Also reflect in current session
$env:PATH = "$env:PATH;$Dir"
Write-Success "'$Dir' 을 사용자 PATH에 영구 등록했습니다."
Write-Warn "새 터미널을 열어야 PATH 변경이 적용됩니다."
Write-Success "'$Dir' has been permanently added to user PATH."
Write-Warn "Open a new terminal for PATH changes to take effect."
}
# ────────────────────────────────────────────
# 메인
# ────────────────────────────────────────────
function Main {
Write-Info "===== bottom(btm) 설치 스크립트 (Windows PowerShell) ====="
Write-Info "===== bottom(btm) install script (Windows PowerShell) ====="
$triple = Get-Platform
Write-Info "감지된 플랫폼: $triple"
Write-Info "Detected platform: $triple"
$tag = Get-LatestNightlyTag
Write-Info "최신 Nightly 태그: $tag"
Write-Info "Latest Nightly tag: $tag"
$url = Get-DownloadUrl -Tag $tag -Triple $triple
Install-Bottom -Url $url
@@ -221,12 +222,12 @@ function Main {
if ($AddToPath) {
Add-ToUserPath -Dir $InstallDir
} else {
Write-Warn "PATH 자동 등록을 건너뜁니다."
Write-Warn "수동으로 PATH에 추가하세요: $InstallDir"
Write-Warn "Skipping automatic PATH registration."
Write-Warn "Add to PATH manually: $InstallDir"
}
Write-Success "모든 작업이 완료되었습니다."
Write-Info "사용법: btm"
Write-Success "All tasks completed."
Write-Info "Usage: btm"
}
Main