|
| 1 | +# code-context-graph |
| 2 | + |
| 3 | +코드베이스를 Tree-sitter로 파싱하여 지식 그래프를 구축하는 로컬 코드 분석 도구. |
| 4 | + |
| 5 | +Follow the global prompt rules first. This file adds project-specific skill routing for a project that uses the `agent-team` CLI (github.com/tae2089/agent-team) as its durable work ledger. |
| 6 | + |
| 7 | +## MCP 서버 |
| 8 | + |
| 9 | +`.mcp.json`에 등록된 ccg MCP 서버가 29개 도구를 제공합니다: |
| 10 | + |
| 11 | +- `parse_project`, `build_or_update_graph`, `run_postprocess` |
| 12 | +- `get_node`, `search`, `query_graph`, `list_graph_stats`, `get_minimal_context` |
| 13 | +- `get_impact_radius`, `trace_flow` |
| 14 | +- `find_large_functions`, `find_dead_code` |
| 15 | +- `detect_changes`, `get_affected_flows`, `list_flows` |
| 16 | +- `list_communities`, `get_community`, `get_architecture_overview` |
| 17 | +- `get_annotation` |
| 18 | +- `build_rag_index`, `get_rag_tree`, `get_doc_content`, `search_docs` |
| 19 | +- `upload_file`, `upload_files`, `list_workspaces`, `list_files`, `delete_file`, `delete_workspace` |
| 20 | + |
| 21 | +HTTP 모드 (`--transport streamable-http`)에서는 `/health` 및 `/webhook` 엔드포인트도 제공합니다. |
| 22 | +Webhook은 `--allow-repo` 플래그로 허용 리포지토리를 설정하면 활성화됩니다. |
| 23 | +레포별 브랜치 필터링: `--allow-repo "org/api:main,develop"` (glob 패턴, 미지정 시 main/master 기본). |
| 24 | +GitHub (`X-Hub-Signature-256`) 및 Gitea (`X-Gitea-Signature`, `X-Gitea-Event`) 호환. |
| 25 | +Push 이벤트 수신 → 자동 clone/pull → 그래프 빌드 → DB 저장 파이프라인. |
| 26 | +Graceful shutdown: SIGINT/SIGTERM 시 진행 중인 clone/build에 context cancel 전파. |
| 27 | + |
| 28 | +## CLI Skills (5개) |
| 29 | + |
| 30 | +| Skill | 설명 | |
| 31 | +| ---------------- | ----------------------------------------------------------- | |
| 32 | +| `/ccg` | 코어 빌드 & 검색 — 파싱, 그래프 빌드, 쿼리, 검색 | |
| 33 | +| `/ccg-analyze` | 코드 분석 — 영향 반경, 플로우 추적, 데드코드, 아키텍처 | |
| 34 | +| `/ccg-annotate` | 어노테이션 시스템 — AI 어노테이션 워크플로우, 태그 레퍼런스 | |
| 35 | +| `/ccg-docs` | 문서 — 문서 생성, RAG 인덱싱, lint | |
| 36 | +| `/ccg-workspace` | 파일 워크스페이스 — 파일/워크스페이스 업로드, 목록, 삭제 | |
| 37 | + |
| 38 | +주요 커맨드: |
| 39 | + |
| 40 | +- `ccg build [dir]` — 코드 그래프 빌드 (`--exclude`, `--no-recursive` 지원) |
| 41 | +- `ccg search <query>` — 전문 검색 (어노테이션 포함) |
| 42 | +- `ccg docs [--out dir]` — 마크다운 문서 생성 |
| 43 | +- `ccg lint [--strict]` — 문서 품질 체크 |
| 44 | +- `ccg annotate [file|dir]` — AI 어노테이션 생성 |
| 45 | + |
| 46 | +`.ccg.yaml`로 exclude 패턴, DB 설정 등을 프로젝트 기본값으로 관리할 수 있습니다. |
| 47 | + |
| 48 | +## 문서 |
| 49 | + |
| 50 | +상세 문서는 `guide/` 디렉토리를 참조하세요: |
| 51 | + |
| 52 | +- [CLI Reference](guide/cli-reference.md) — 전체 명령어, 플래그, 설정 파일 |
| 53 | +- [MCP Tools](guide/mcp-tools.md) — 29개 MCP 도구, Skills, AI-Driven Annotation |
| 54 | +- [Annotations](guide/annotations.md) — 어노테이션 태그, 예시, 검색 |
| 55 | +- [Webhook](guide/webhook.md) — Webhook sync, 브랜치 필터링, HMAC, graceful shutdown |
| 56 | +- [Docker](guide/docker.md) — Docker 빌드, MCP 서버, PostgreSQL 배포 |
| 57 | +- [Development](guide/development.md) — 개발 가이드, Integration test, 프로젝트 구조 |
| 58 | +- [Architecture](guide/architecture.md) — 데이터 흐름, 컴포넌트, DB 스키마 |
| 59 | + |
| 60 | +## 개발 규칙 |
| 61 | + |
| 62 | +- TDD: Red → Green → Refactor |
| 63 | +- Tidy First: 구조적 변경과 행위 변경 분리 |
| 64 | +- GORM 쿼리만 사용 (raw SQL 금지) |
| 65 | +- 테스트: `CGO_ENABLED=1 go test -tags "fts5" ./... -count=1` |
| 66 | +- Integration test: `./scripts/integration-test.sh` (Gitea + PostgreSQL + ccg Docker 전체 파이프라인) |
| 67 | + |
| 68 | +## Skill Routing |
| 69 | + |
| 70 | +- When writing, modifying, or reviewing code, apply `coding-quality-guardrails` as the quality gate. |
| 71 | +- When debugging bugs, regressions, flaky behavior, or failing tests, use `diagnosing-bugs` before changing behavior. |
| 72 | +- Before implementing new logic with branching, side effects, resource lifecycles, or ordering constraints, use `flow-design` and keep the design note in the task workspace. |
| 73 | +- When designing module boundaries, refactoring, or shaping interfaces, use `codebase-design`. |
| 74 | +- When aligning terminology or modeling the domain, use `domain-modeling`. |
| 75 | +- When a plan is fuzzy, high-impact, or lacks testable acceptance criteria, use `planning-grill` to sharpen scope, acceptance, and failure modes before decomposing it. |
| 76 | +- For multi-step or multi-agent work, use `decompose-and-dispatch` to split the work into bounded units. Use `execute-dispatch-unit` only for a clearly assigned unit with scope, dependencies, and verification. |
| 77 | +- When preparing context for human or AI code review, use `ready-code-review`; do not use it to perform the review itself. |
| 78 | +- To record a session, distill completed work into a replayable recipe, or replay a `recipe.yaml`, use `session-recipe`. |
| 79 | + |
| 80 | +## agent-team Routing |
| 81 | + |
| 82 | +agent-team bundles its own skills; restrict them as follows so methodology stays single-sourced: |
| 83 | + |
| 84 | +- Use only agent-team's CLI operation skills (the `agent-team-*` prefix: run/task/message/inbox/sync/event commands), and load `agent-team-shared` before any command-specific one — it defines the state directory, global flags, and error handling they all assume. Never use its `recipe-*` and `persona-*` skills — the skills routed above own all methodology, even where an excluded skill looks like a closer match (worker checkpoints → `execute-dispatch-unit`'s Ledger Checkpoints; plan sharpening / `recipe-agent-team-planning-grill` → `planning-grill`; decomposition → `decompose-and-dispatch`; architecture → `codebase-design`; terminology → `domain-modeling`). |
| 85 | +- When executing an assigned unit, follow `execute-dispatch-unit` for scope, verification, and reporting; its Ledger Checkpoints section defines which `agent-team-*` calls to make. |
| 86 | +- When planning, `decompose-and-dispatch` owns decomposition and executor mapping, and its Durable Ledger section defines the run/task registration calls. |
| 87 | +- Do not route by the word "recipe": here it means a replayable session recipe (`session-recipe`, `recipe.yaml`); agent-team's `recipe-*` skills are excluded above. |
0 commit comments