diff --git a/.claude/skills/init-project/SKILL.md b/.claude/skills/init-project/SKILL.md index f0d4c30..a0c7d21 100644 --- a/.claude/skills/init-project/SKILL.md +++ b/.claude/skills/init-project/SKILL.md @@ -22,22 +22,131 @@ $ARGUMENTS가 "auto"이거나 비어있으면 다음 순서로 감지: - 빌드 파일, 설정 파일, 디렉토리 구조 파악 - 사용 중인 프레임워크, 라이브러리 감지 - 기존 `.claude/` 디렉토리 존재 여부 확인 +- eslint, prettier, checkstyle, spotless 등 lint 도구 설치 여부 확인 ### 2. CLAUDE.md 생성 프로젝트 루트에 CLAUDE.md를 생성하고 다음 내용 포함: - 프로젝트 개요 (이름, 타입, 주요 기술 스택) - 빌드/실행 명령어 (감지된 빌드 도구 기반) - 테스트 실행 명령어 +- lint 실행 명령어 (감지된 도구 기반) - 프로젝트 디렉토리 구조 요약 - 팀 컨벤션 참조 (`.claude/rules/` 안내) ### 3. .claude/ 디렉토리 구성 이미 팀 표준 파일이 존재하면 건너뜀. 없는 경우: -- `.claude/settings.json` — 프로젝트 타입별 표준 권한 설정 +- `.claude/settings.json` — 프로젝트 타입별 표준 권한 설정 + hooks 섹션 (4단계 참조) - `.claude/rules/` — 팀 규칙 파일 (team-policy, git-workflow, code-style, naming, testing) -- `.claude/skills/` — 팀 스킬 (create-mr, fix-issue, sync-team-workflow) +- `.claude/skills/` — 팀 스킬 (create-mr, fix-issue, sync-team-workflow, init-project) -### 4. Git Hooks 설정 +### 4. Hook 스크립트 생성 +`.claude/scripts/` 디렉토리를 생성하고 다음 스크립트 파일 생성 (chmod +x): + +- `.claude/scripts/on-pre-compact.sh`: + +```bash +#!/bin/bash +# PreCompact hook: systemMessage만 지원 (hookSpecificOutput 사용 불가) +INPUT=$(cat) +cat </dev/null || echo "") +if [ -z "$CWD" ]; then + CWD=$(pwd) +fi +PROJECT_HASH=$(echo "$CWD" | sed 's|/|-|g') +MEMORY_DIR="$HOME/.claude/projects/$PROJECT_HASH/memory" +CONTEXT="" +if [ -f "$MEMORY_DIR/MEMORY.md" ]; then + SUMMARY=$(head -100 "$MEMORY_DIR/MEMORY.md" | python3 -c "import sys;print(sys.stdin.read().replace('\\\\','\\\\\\\\').replace('\"','\\\\\"').replace('\n','\\\\n'))" 2>/dev/null) + CONTEXT="컨텍스트가 압축되었습니다.\\n\\n[세션 요약]\\n${SUMMARY}" +fi +if [ -f "$MEMORY_DIR/project-snapshot.md" ]; then + SNAP=$(head -50 "$MEMORY_DIR/project-snapshot.md" | python3 -c "import sys;print(sys.stdin.read().replace('\\\\','\\\\\\\\').replace('\"','\\\\\"').replace('\n','\\\\n'))" 2>/dev/null) + CONTEXT="${CONTEXT}\\n\\n[프로젝트 최신 상태]\\n${SNAP}" +fi +if [ -n "$CONTEXT" ]; then + CONTEXT="${CONTEXT}\\n\\n위 내용을 참고하여 작업을 이어가세요. 상세 내용은 memory/ 디렉토리의 각 파일을 참조하세요." + echo "{\"hookSpecificOutput\":{\"additionalContext\":\"${CONTEXT}\"}}" +else + echo "{\"hookSpecificOutput\":{\"additionalContext\":\"컨텍스트가 압축되었습니다. memory 파일이 없으므로 사용자에게 이전 작업 내용을 확인하세요.\"}}" +fi +``` + +- `.claude/scripts/on-commit.sh`: + +```bash +#!/bin/bash +INPUT=$(cat) +COMMAND=$(echo "$INPUT" | python3 -c "import sys,json;print(json.load(sys.stdin).get('tool_input',{}).get('command',''))" 2>/dev/null || echo "") +if echo "$COMMAND" | grep -qE 'git commit'; then + cat </memory/`) 다음 파일들을 생성: + +- `memory/MEMORY.md` — 프로젝트 분석 결과 기반 핵심 요약 (200줄 이내) + - 현재 상태, 프로젝트 개요, 기술 스택, 주요 패키지 구조, 상세 참조 링크 +- `memory/project-snapshot.md` — 디렉토리 구조, 패키지 구성, 주요 의존성, API 엔드포인트 +- `memory/project-history.md` — "초기 팀 워크플로우 구성" 항목으로 시작 +- `memory/api-types.md` — 주요 인터페이스/DTO/Entity 타입 요약 +- `memory/decisions.md` — 빈 템플릿 (# 의사결정 기록) +- `memory/debugging.md` — 빈 템플릿 (# 디버깅 경험 & 패턴) + +### 10. Lint 도구 확인 +- TypeScript: eslint, prettier 설치 여부 확인. 미설치 시 사용자에게 설치 제안 +- Java: checkstyle, spotless 등 설정 확인 +- CLAUDE.md에 lint 실행 명령어가 이미 기록되었는지 확인 + +### 11. workflow-version.json 생성 +Gitea API로 최신 팀 워크플로우 버전을 조회: +```bash +curl -sf --max-time 5 "https://gitea.gc-si.dev/gc/template-common/raw/branch/develop/workflow-version.json" +``` +조회 성공 시 해당 `version` 값 사용, 실패 시 "1.0.0" 기본값 사용. + +`.claude/workflow-version.json` 파일 생성: ```json { - "applied_global_version": "1.0.0", - "applied_date": "현재날짜", - "project_type": "감지된타입" + "applied_global_version": "<조회된 버전>", + "applied_date": "<현재날짜>", + "project_type": "<감지된타입>", + "gitea_url": "https://gitea.gc-si.dev" } ``` -### 8. 검증 및 요약 +### 12. 검증 및 요약 - 생성/수정된 파일 목록 출력 - `git config core.hooksPath` 확인 - 빌드 명령 실행 가능 확인 -- 다음 단계 안내 (개발 시작, 첫 커밋 방법 등) +- Hook 스크립트 실행 권한 확인 +- 다음 단계 안내: + - 개발 시작, 첫 커밋 방법 + - 범용 스킬: `/api-registry`, `/changelog`, `/swagger-spec` diff --git a/.claude/skills/sync-team-workflow/SKILL.md b/.claude/skills/sync-team-workflow/SKILL.md index 43dd367..56bb2fd 100644 --- a/.claude/skills/sync-team-workflow/SKILL.md +++ b/.claude/skills/sync-team-workflow/SKILL.md @@ -13,11 +13,11 @@ Gitea API로 template-common 리포의 workflow-version.json 조회: ```bash GITEA_URL=$(python3 -c "import json; print(json.load(open('.claude/workflow-version.json')).get('gitea_url', 'https://gitea.gc-si.dev'))" 2>/dev/null || echo "https://gitea.gc-si.dev") -curl -sf "${GITEA_URL}/api/v1/repos/gc/template-common/raw/workflow-version.json" +curl -sf "${GITEA_URL}/gc/template-common/raw/branch/develop/workflow-version.json" ``` ### 2. 버전 비교 -로컬 `.claude/workflow-version.json`과 비교: +로컬 `.claude/workflow-version.json`의 `applied_global_version` 필드와 비교: - 버전 일치 → "최신 버전입니다" 안내 후 종료 - 버전 불일치 → 미적용 변경 항목 추출하여 표시 @@ -49,6 +49,7 @@ Gitea API로 해당 타입 + common 템플릿 파일 다운로드: .claude/skills/create-mr/SKILL.md .claude/skills/fix-issue/SKILL.md .claude/skills/sync-team-workflow/SKILL.md +.claude/skills/init-project/SKILL.md ``` #### 4-4. Git Hooks (덮어쓰기 + 실행 권한) @@ -56,13 +57,23 @@ Gitea API로 해당 타입 + common 템플릿 파일 다운로드: chmod +x .githooks/* ``` +#### 4-5. Hook 스크립트 갱신 +init-project SKILL.md의 코드 블록에서 최신 스크립트를 추출하여 덮어쓰기: +``` +.claude/scripts/on-pre-compact.sh +.claude/scripts/on-post-compact.sh +.claude/scripts/on-commit.sh +``` +실행 권한 부여: `chmod +x .claude/scripts/*.sh` + ### 5. 로컬 버전 업데이트 `.claude/workflow-version.json` 갱신: ```json { "applied_global_version": "새버전", "applied_date": "오늘날짜", - "project_type": "감지된타입" + "project_type": "감지된타입", + "gitea_url": "https://gitea.gc-si.dev" } ``` diff --git a/workflow-version.json b/workflow-version.json index 7e4fa16..746b521 100644 --- a/workflow-version.json +++ b/workflow-version.json @@ -1,9 +1,30 @@ { - "version": "1.1.0", + "version": "1.2.0", "updated": "2026-02-14", "gitea_url": "https://gitea.gc-si.dev", "nexus_url": "https://nexus.gc-si.dev", "changes": [ + { + "version": "1.2.0", + "date": "2026-02-14", + "description": "워크플로우 시스템 분리 및 통합", + "items": [ + "SessionStart hook: Gitea API 직접 조회 방식으로 전환", + "init-project: memory, hook 스크립트, lint 감지, git exclude 통합", + "프로젝트 workflow-version.json: applied_global_version 형식 통일", + "미초기화 팀 프로젝트 자동 감지 (team-policy.md 기반)", + "범용 스킬 분리: api-registry, changelog, swagger-spec" + ], + "affected_files": [ + ".claude/workflow-version.json", + ".claude/skills/init-project/SKILL.md", + ".claude/skills/sync-team-workflow/SKILL.md", + ".claude/scripts/on-pre-compact.sh", + ".claude/scripts/on-post-compact.sh", + ".claude/scripts/on-commit.sh", + ".claude/settings.json (hooks 섹션)" + ] + }, { "version": "1.1.0", "date": "2026-02-14",