강의자료 목록으로

Claude Code 환경 설정 가이드

다른 컴퓨터에서 동일한 Claude Code 환경을 구성하기 위한 가이드.

1. 상태표시줄 스크립트

파일 위치: ~/.claude/statusline.sh

모델명, 작업 디렉토리, Git 브랜치, Context 사용률을 표시한다.

bash
#!/usr/bin/env bash

# Claude Code Status Line Script (Python-based, no jq dependency)
# Displays: Model | Directory | Git Branch | Context %

input=$(cat)

# Python으로 JSON 파싱 (stdin으로 전달)
eval "$(echo "$input" | python -c "
import json, sys, os

raw = sys.stdin.read().strip()
data = json.loads(raw) if raw else {}

model = data.get('model', {}).get('display_name', 'Unknown')

workspace_dir = data.get('workspace', {}).get('current_dir', '') or data.get('cwd', '~')
workspace_name = os.path.basename(workspace_dir)

context_pct = data.get('context_window', {}).get('used_percentage', '')

print(f'model=\\"{model}\\"')
print(f'workspace_dir=\\"{workspace_dir}\\"')
print(f'workspace_name=\\"{workspace_name}\\"')
print(f'context_pct=\\"{context_pct}\\"')
" 2>/dev/null)"

# Fallbacks
model="${model:-Unknown}"
workspace_name="${workspace_name:-~}"

# Git branch
git_branch=""
if [ -n "$workspace_dir" ] && [ -d "$workspace_dir" ]; then
  git_branch=$(git -C "$workspace_dir" --no-optional-locks rev-parse --abbrev-ref HEAD 2>/dev/null)
fi

# Context display
if [ -n "$context_pct" ]; then
  context_display="${context_pct}%"
else
  context_pct="--"
  context_display="--"
fi

# ANSI colors
RESET="\\033[0m"
BOLD="\\033[1m"
DIM="\\033[2m"
BLUE="\\033[34m"
GREEN="\\033[32m"
YELLOW="\\033[33m"
MAGENTA="\\033[35m"
CYAN="\\033[36m"
RED="\\033[31m"

# Context color based on usage
if [ "$context_pct" != "--" ]; then
  if [ "$context_pct" -ge 80 ] 2>/dev/null; then
    CTX_COLOR=$RED
  elif [ "$context_pct" -ge 60 ] 2>/dev/null; then
    CTX_COLOR=$YELLOW
  else
    CTX_COLOR=$GREEN
  fi
else
  CTX_COLOR=$DIM
fi

# Build status line
if [ -n "$git_branch" ]; then
  printf "${BLUE}${BOLD}🤖 %s${RESET} ${DIM}${CYAN}|${RESET} ${MAGENTA}📂 %s${RESET} ${DIM}${CYAN}|${RESET} ${YELLOW}🔀 %s${RESET} ${DIM}${CYAN}|${RESET} ${CTX_COLOR}${BOLD}🧠 %s${RESET}\\n" \\
    "$model" "$workspace_name" "$git_branch" "$context_display"
else
  printf "${BLUE}${BOLD}🤖 %s${RESET} ${DIM}${CYAN}|${RESET} ${MAGENTA}📂 %s${RESET} ${DIM}${CYAN}|${RESET} ${CTX_COLOR}${BOLD}🧠 %s${RESET}\\n" \\
    "$model" "$workspace_name" "$context_display"
fi

표시 항목


2. settings.json

파일 위치: ~/.claude/settings.json

json
{
  "permissions": {
    "allow": [
      "Bash(python -c \\":*)",
      "WebFetch(domain:www.schoolinfo.go.kr)"
    ]
  },
  "enabledPlugins": {
    "frontend-design@claude-code-plugins": true,
    "feature-dev@claude-code-plugins": true,
    "learning-output-style@claude-code-plugins": true,
    "claude-md-management@claude-plugins-official": true,
    "skill-creator@claude-plugins-official": true
  },
  "language": "korean",
  "voiceEnabled": true,
  "statusLine": {
    "type": "command",
    "command": "bash ~/.claude/statusline.sh"
  }
}

주요 설정 설명


3. 새 컴퓨터 설정 순서

bash
# 1. ~/.claude 디렉토리 생성 (없으면)
mkdir -p ~/.claude

# 2. statusline.sh 복사 (이 파일의 코드를 붙여넣기)
nano ~/.claude/statusline.sh
chmod +x ~/.claude/statusline.sh

# 3. settings.json 복사 (이 파일의 JSON을 붙여넣기)
nano ~/.claude/settings.json

# 4. statusLine.command 경로를 새 컴퓨터에 맞게 수정
#    Windows: "bash /c/Users/<username>/.claude/statusline.sh"
#    Mac/Linux: "bash ~/.claude/statusline.sh"

# 5. Claude Code 재시작

주의사항

  • python 이 환경설정되어 있어야 사용 가능함.
  • statusLine.command 경로는 OS에 따라 다르므로 반드시 수정할 것
  • permissions.allow에 프로젝트 특정 경로가 있다면 새 환경에 맞게 수정
  • 플러그인은 Claude Code에서 별도 설치가 필요할 수 있음