/claude-forge:sync-docs --check-onlyfrom claude-forge
Synchronizes documentation files (prompt_plan.md, spec.md, CLAUDE.md, rules/) with recent code changes from git diff analysis. Supports --check-only mode.
Ships in claude-forge. Installing the plugin adds it to Claude Code.
인자로 전달된 작업 설명을 확인한다. 인자가 없으면 최근 커밋 메시지에서 작업 내용을 추론한다.
git log --oneline -5
인자에 --check-only가 포함되어 있으면:
이 판단은 이후 모든 단계에 적용된다. --check-only 모드에서는 Read/Glob/Grep/Bash(git)만 사용한다.
현재 브랜치에서 변경된 파일과 내용을 파악한다.
diff 범위 자동 감지:
# main/master 브랜치와의 분기점 기반 (우선)
BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)
if [ -n "$BASE" ] && [ "$BASE" != "$(git rev-parse HEAD)" ]; then
git diff --name-only "$BASE"..HEAD
git diff --stat "$BASE"..HEAD
else
# 분기점이 없으면 (main 브랜치 자체) 최근 커밋 기반
COMMIT_COUNT=$(git rev-list --count HEAD 2>/dev/null || echo "0")
if [ "$COMMIT_COUNT" -eq 0 ]; then
echo "NO_COMMITS"
elif [ "$COMMIT_COUNT" -ge 3 ]; then
git diff --name-only HEAD~3..HEAD
git diff --stat HEAD~3..HEAD
else
git diff --name-only HEAD~1..HEAD
git diff --stat HEAD~1..HEAD
fi
fi
NO_COMMITS가 출력되면 동기화할 변경사항이 없으므로 사용자에게 알리고 종료한다.
소스 코드(git diff)가 최우선 진실 소스(source of truth)이다. 문서 간 불일치가 발견되면, 코드 상태를 기준으로 모든 문서를 일관되게 업데이트한다.
Glob 패턴으로 prompt_plan.md를 탐색한다:
./prompt_plan.md./.claude/prompt_plan.md./docs/prompt_plan.md업데이트 항목:
- [x])파일이 없으면 건너뛴다.
Glob 패턴으로 spec.md를 탐색한다:
./spec.md./docs/spec.md./.claude/spec.md업데이트 항목:
파일이 없으면 건너뛴다.
Glob 패턴으로 CLAUDE.md를 탐색한다:
./CLAUDE.md./.claude/CLAUDE.md발견된 경로를 이후 단계에서도 일관되게 사용한다.
CLAUDE.md는 60줄 이하를 유지한다. 이를 초과하면 Claude가 규칙을 무시하기 시작한다.
CLAUDE.md에 허용되는 내용 (Core 정보만):
CLAUDE.md에 넣으면 안 되는 내용 → rules/로 이동:
.claude/rules/ 디렉토리의 규칙 파일을 코드 변경에 맞게 동기화한다.
Glob: .claude/rules/**/*.md
기존 rules 파일 목록과 각 파일의 주제를 파악한다.
변경된 코드의 성격에 따라 대상 rules 파일을 결정한다:
| 변경 성격 | 대상 rules 파일 | 동작 |
|---|---|---|
| API 엔드포인트 추가/변경 | rules/api-design.md | 엔드포인트 목록 업데이트 |
| DB 스키마/마이그레이션 | rules/database.md | 테이블/컬럼 변경 반영 |
| 컴포넌트 패턴 변경 | rules/frontend.md | 패턴 규칙 업데이트 |
| 테스트 설정 변경 | rules/testing.md | 테스트 규칙 업데이트 |
| 인증/보안 변경 | rules/security.md | 보안 규칙 업데이트 |
| 빌드/CI 변경 | rules/build.md | 빌드 규칙 업데이트 |
rules 파일에 paths frontmatter가 있으면 유지한다. 새 파일 생성 시 적절한 paths를 추가한다:
---
paths:
- "src/api/**/*.ts"
---
5단계에서 발견한 CLAUDE.md 경로를 사용하여 줄 수를 최종 검증한다.
| 줄 수 | 상태 | 동작 |
|---|---|---|
| ≤ 60 | 정상 | 완료 |
| 61-80 | 경고 | 출력에 경고 표시, 분리 제안 |
| > 80 | 초과 | 상세 내용을 rules/로 분리 실행 (6-4 예외 조항 적용) |
동기화로 파일이 변경된 경우 다음 액션을 안내한다:
--check-only 모드 → "적용하려면: /sync-docs"════════════════════════════════════════════════════════════════
Sync Docs v7 (문서 동기화)
════════════════════════════════════════════════════════════════
작업: [완료한 작업 설명]
동기화 결과:
prompt_plan.md [업데이트 / 없음 / 변경없음]
spec.md [업데이트 / 없음 / 변경없음]
CLAUDE.md [업데이트 / 없음 / 변경없음] (N줄)
rules/ [N개 업데이트 / 변경없음]
변경 요약:
- [변경 항목 1]
- [변경 항목 2]
CLAUDE.md: N줄 (정상 / 경고: 60줄 초과)
다음: /quick-commit
════════════════════════════════════════════════════════════════
════════════════════════════════════════════════════════════════
Sync Docs v7 (check-only)
════════════════════════════════════════════════════════════════
변경 필요 사항:
prompt_plan.md:
- [ ] → [x] Task 3: API 엔드포인트 구현
- 진행률: 3/7 → 4/7
spec.md:
- API 섹션에 POST /api/users 추가 필요
CLAUDE.md (현재 N줄):
- 새 명령어 추가 필요: pnpm db:migrate
- 경고: 80줄 초과 → rules/ 분리 필요
→ 코딩 컨벤션 (15줄) → rules/code-style.md로 이동 제안
rules/:
- rules/api-design.md: POST /api/users 엔드포인트 추가 필요
- rules/database.md: users 테이블 스키마 변경 반영 필요
적용하려면: /sync-docs (--check-only 없이 실행)
════════════════════════════════════════════════════════════════
════════════════════════════════════════════════════════════════
Sync Docs v7 (문서 동기화)
════════════════════════════════════════════════════════════════
동기화 대상 문서를 찾을 수 없습니다.
확인할 위치:
- prompt_plan.md (프로젝트 루트, .claude/, docs/)
- spec.md (프로젝트 루트, docs/, .claude/)
- CLAUDE.md (프로젝트 루트, .claude/)
- .claude/rules/*.md
════════════════════════════════════════════════════════════════
════════════════════════════════════════════════════════════════
Sync Docs v7 (CLAUDE.md 분리)
════════════════════════════════════════════════════════════════
CLAUDE.md가 N줄 → 60줄로 축소
분리된 내용:
→ rules/code-style.md (15줄 이동, 신규 생성)
→ rules/testing.md (12줄 이동, 기존 파일)
CLAUDE.md: N줄 → 60줄 (정상)
════════════════════════════════════════════════════════════════
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
Claude Code installs this plugin but refuses to load it
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
Checked against Claude Code 2.1.332. The listing below is what the repository ships; Claude Code doesn't load it as published.
42 commands in this plugin
/auto/auto - 원스톱 자동 워크플로우 (v6)계획부터 PR까지 원버튼 자동 실행. 중간에 멈추지 않습니다./build-fixBuild and Fix> **참고**: 빌드 에러가 아키텍처 문제에서 기인하는 경우, `/plan`으로 구조적 해결 방안을 먼저 수립하세요./checkpoint/checkpoint - 작업 상태 저장/복원 (v6)작업 상태 저장/복원 (v6)/code-reviewCode Review방금 작성한 코드를 보안+품질 검사합니다./commit-push-prTask검증 완료 후 커밋 & PR & 머지 + MCP 알림 (v6)/debugging-strategiesMaster systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.2 plugins ship this exact command · first indexed Mar 16, 2026
Other plugins' commands for the same job