flowchart TD
A[/"gh 필요 · /gh-setup"/] --> B[detect: OS·터미널·다운로더·패키지매니저]
B --> C[settings.json 생성 또는 갱신]
C --> D[status: gh 설치·인증·gh-attach 확인]
D -->|gh 설치 안 됨| E[plan: OS별 설치 명령 생성]
D -->|gh 설치됨| J{로그인됨?}
E --> F{권한 필요?}
F -- 불필요 --> G["install: gh 자동 설치 + gh-attach 확장 자동 설치"]
F -- 필요 --> H[사용자가 실행할 명령 제시]
H --> H1[사용자 실행 대기]
G --> I[status 재확인]
H1 --> I
I -->|실패| E
I -->|설치 확인| J
J -- 예 --> G2["install: gh-attach 확장만 확인·자동 설치(멱등)"]
J -- 아니오 --> K[환경별 login 명령 안내]
K --> K1[사용자 실행 대기] --> L[gh auth status 확인] --> G2
G2 --> Z[준비 완료 · 원래 작업으로 복귀]
Script path
Among the following, the first path that exists를 <skill> is used.
.claude/skills/gh-setup # 현재 프로젝트 (Claude Code)
.codex/skills/gh-setup # 현재 프로젝트 (Codex)
~/.claude/skills/gh-setup # 홈 설치
~/.codex/skills/gh-setup # 홈 설치
Runtime routing
Always routeris called. The router searches in the order node → python and passes it on, and if neither exists, it handles it with its own fallback.
sh <skill>/scripts/gh-env.sh <서브커맨드> # macOS / Linux / WSL
powershell -ExecutionPolicy Bypass -File <skill>/scripts/gh-env.ps1 <서브커맨드> # Windows
In the output, RUNTIME= lets you know which implementation ran (node / python / sh / ps1).
Fallback (sh / ps1) only does detection and guidance. install automatic execution and config set are not supported.
detect 감지 후 ~/.issue/settings.json 생성·갱신
status gh 설치·인증·gh-attach 확장 확인 후 settings.gh 갱신
plan OS별 설치 명령 목록 ([auto] / [user] / [guide] 표시)
install [--dry-run] [auto] 표시된 명령만 실행. gh 확인 뒤 gh-attach 확장도 자동 설치(멱등)
login 환경에 맞는 로그인 방법 안내
config get [key] 설정 읽기
config set <k> <v> terminals / downloaders 순서 변경 (쉼표 구분)
Execution order
Step 1 — Detection and status check
sh <skill>/scripts/gh-env.sh detect
sh <skill>/scripts/gh-env.sh status
GH_INSTALLED=1 and GH_AUTHENTICATED=1 even if GH_ATTACH_INSTALLED=1 if it is not, go to Step 2.
install if gh already exists, does not touch that part and only checks/installs the gh-attach extension, so it is safe to call every time. If all three are 1, it ends here. Return directly to the original task.
Step 2 — Installation
sh <skill>/scripts/gh-env.sh plan
sh <skill>/scripts/gh-env.sh install
install 은 [auto] only the step is executed (gh's own automatic installation command + after checking gh, the following
gh extension install sudosubin/gh-attach). [user] the remaining commands are delivered to the user like this.
아래 명령을 프롬프트에 그대로 붙여 실행해 주세요 (`!` 로 시작하면 이 세션에서 바로 돌아갑니다).
! sudo apt update && sudo apt install gh -y
For the detailed matrix, references/install-matrix.md.
Step 3 — Login
sh <skill>/scripts/gh-env.sh login
LOGIN_REQUIRED=1 if so, wait until the user runs the guided command. For details, references/auth-login.md.
Step 4 — Verification and return
sh <skill>/scripts/gh-env.sh status
GH_INSTALLED=1, GH_AUTHENTICATED=1 after checking, continue the original task. GH_ATTACH_INSTALLED=0
Even if remains (this is a rare case since installation should normally work without login), do not block it — automatic upload of private repository
images will not work, but it is unrelated to the gh flow itself, so return to the original task, and when it becomes necessary
(the image upload step of issue-start/issue-end), that skill will automatically fall back to manual upload.
Final report
플랫폼 <os> / <arch> (<family>)
터미널 <선호 0번>
gh <버전> · 로그인 <계정>
gh-attach <설치됨 | 없음>
설정 ~/.issue/settings.json
다음 <원래 하려던 작업>