@juho0719/cckit 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -0
- package/package.json +1 -1
- package/assets/agents/architect.md +0 -211
- package/assets/agents/build-error-resolver.md +0 -114
- package/assets/agents/ccwin-code-reviewer.md +0 -224
- package/assets/agents/database-reviewer.md +0 -91
- package/assets/agents/doc-updater.md +0 -107
- package/assets/agents/e2e-runner.md +0 -107
- package/assets/agents/planner.md +0 -212
- package/assets/agents/python-reviewer.md +0 -98
- package/assets/agents/refactor-cleaner.md +0 -85
- package/assets/agents/security-reviewer.md +0 -108
- package/assets/agents/superpower-code-reviewer.md +0 -48
- package/assets/agents/tdd-guide.md +0 -80
- package/assets/commands/build-fix.md +0 -62
- package/assets/commands/checkpoint.md +0 -74
- package/assets/commands/code-review.md +0 -40
- package/assets/commands/e2e.md +0 -362
- package/assets/commands/eval.md +0 -120
- package/assets/commands/orchestrate.md +0 -172
- package/assets/commands/plan.md +0 -113
- package/assets/commands/python-review.md +0 -297
- package/assets/commands/refactor-clean.md +0 -80
- package/assets/commands/sessions.md +0 -305
- package/assets/commands/tdd.md +0 -326
- package/assets/commands/test-coverage.md +0 -69
- package/assets/commands/update-codemaps.md +0 -72
- package/assets/commands/update-docs.md +0 -84
- package/assets/commands/verify.md +0 -59
- package/assets/hooks/agent-track.sh +0 -53
- package/assets/hooks/auto-commit-push.sh +0 -123
- package/assets/hooks/on-prompt-start.sh +0 -6
- package/assets/hooks/post-edit-format.js +0 -48
- package/assets/hooks/post-edit-typecheck.js +0 -94
- package/assets/hooks/skill-track.sh +0 -26
- package/assets/hooks/subagent-notify.sh +0 -20
- package/assets/rules/common/agents.md +0 -49
- package/assets/rules/common/coding-style.md +0 -48
- package/assets/rules/common/git-workflow.md +0 -45
- package/assets/rules/common/hooks.md +0 -30
- package/assets/rules/common/patterns.md +0 -31
- package/assets/rules/common/performance.md +0 -55
- package/assets/rules/common/security.md +0 -29
- package/assets/rules/common/testing.md +0 -29
- package/assets/rules/python/coding-style.md +0 -42
- package/assets/rules/python/hooks.md +0 -19
- package/assets/rules/python/patterns.md +0 -39
- package/assets/rules/python/security.md +0 -30
- package/assets/rules/python/testing.md +0 -38
- package/assets/rules/typescript/coding-style.md +0 -18
- package/assets/rules/typescript/hooks.md +0 -19
- package/assets/rules/typescript/patterns.md +0 -39
- package/assets/rules/typescript/security.md +0 -30
- package/assets/rules/typescript/testing.md +0 -38
- package/assets/skills/api-design/SKILL.md +0 -522
- package/assets/skills/backend-patterns/SKILL.md +0 -597
- package/assets/skills/brainstorming/SKILL.md +0 -96
- package/assets/skills/coding-standards/SKILL.md +0 -529
- package/assets/skills/database-migrations/SKILL.md +0 -334
- package/assets/skills/deployment-patterns/SKILL.md +0 -426
- package/assets/skills/dispatching-parallel-agents/SKILL.md +0 -180
- package/assets/skills/docker-patterns/SKILL.md +0 -363
- package/assets/skills/e2e-testing/SKILL.md +0 -325
- package/assets/skills/eval-harness/SKILL.md +0 -235
- package/assets/skills/executing-plans/SKILL.md +0 -84
- package/assets/skills/finishing-a-development-branch/SKILL.md +0 -200
- package/assets/skills/frontend-patterns/SKILL.md +0 -641
- package/assets/skills/iterative-retrieval/SKILL.md +0 -210
- package/assets/skills/postgres-patterns/SKILL.md +0 -145
- package/assets/skills/python-patterns/SKILL.md +0 -749
- package/assets/skills/python-testing/SKILL.md +0 -815
- package/assets/skills/receiving-code-review/SKILL.md +0 -213
- package/assets/skills/requesting-code-review/SKILL.md +0 -105
- package/assets/skills/requesting-code-review/code-reviewer-template.md +0 -146
- package/assets/skills/subagent-driven-development/SKILL.md +0 -242
- package/assets/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -20
- package/assets/skills/subagent-driven-development/implementer-prompt.md +0 -78
- package/assets/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -61
- package/assets/skills/systematic-debugging/CREATION-LOG.md +0 -114
- package/assets/skills/systematic-debugging/SKILL.md +0 -296
- package/assets/skills/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/assets/skills/systematic-debugging/condition-based-waiting.md +0 -115
- package/assets/skills/systematic-debugging/defense-in-depth.md +0 -122
- package/assets/skills/systematic-debugging/root-cause-tracing.md +0 -169
- package/assets/skills/systematic-debugging/scripts/find-polluter.sh +0 -63
- package/assets/skills/systematic-debugging/test-academic.md +0 -14
- package/assets/skills/systematic-debugging/test-pressure-1.md +0 -58
- package/assets/skills/systematic-debugging/test-pressure-2.md +0 -68
- package/assets/skills/systematic-debugging/test-pressure-3.md +0 -69
- package/assets/skills/tdd-workflow/SKILL.md +0 -409
- package/assets/skills/test-driven-development/SKILL.md +0 -371
- package/assets/skills/test-driven-development/testing-anti-patterns.md +0 -299
- package/assets/skills/using-git-worktrees/SKILL.md +0 -218
- package/assets/skills/verification-before-completion/SKILL.md +0 -139
- package/assets/skills/verification-loop/SKILL.md +0 -125
- package/assets/skills/writing-plans/SKILL.md +0 -116
- package/assets/statusline/statusline.sh +0 -186
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Update Codemaps
|
|
2
|
-
|
|
3
|
-
Analyze the codebase structure and generate token-lean architecture documentation.
|
|
4
|
-
|
|
5
|
-
## Step 1: Scan Project Structure
|
|
6
|
-
|
|
7
|
-
1. Identify the project type (monorepo, single app, library, microservice)
|
|
8
|
-
2. Find all source directories (src/, lib/, app/, packages/)
|
|
9
|
-
3. Map entry points (main.ts, index.ts, app.py, main.go, etc.)
|
|
10
|
-
|
|
11
|
-
## Step 2: Generate Codemaps
|
|
12
|
-
|
|
13
|
-
Create or update codemaps in `docs/CODEMAPS/` (or `.reports/codemaps/`):
|
|
14
|
-
|
|
15
|
-
| File | Contents |
|
|
16
|
-
|------|----------|
|
|
17
|
-
| `architecture.md` | High-level system diagram, service boundaries, data flow |
|
|
18
|
-
| `backend.md` | API routes, middleware chain, service → repository mapping |
|
|
19
|
-
| `frontend.md` | Page tree, component hierarchy, state management flow |
|
|
20
|
-
| `data.md` | Database tables, relationships, migration history |
|
|
21
|
-
| `dependencies.md` | External services, third-party integrations, shared libraries |
|
|
22
|
-
|
|
23
|
-
### Codemap Format
|
|
24
|
-
|
|
25
|
-
Each codemap should be token-lean — optimized for AI context consumption:
|
|
26
|
-
|
|
27
|
-
```markdown
|
|
28
|
-
# Backend Architecture
|
|
29
|
-
|
|
30
|
-
## Routes
|
|
31
|
-
POST /api/users → UserController.create → UserService.create → UserRepo.insert
|
|
32
|
-
GET /api/users/:id → UserController.get → UserService.findById → UserRepo.findById
|
|
33
|
-
|
|
34
|
-
## Key Files
|
|
35
|
-
src/services/user.ts (business logic, 120 lines)
|
|
36
|
-
src/repos/user.ts (database access, 80 lines)
|
|
37
|
-
|
|
38
|
-
## Dependencies
|
|
39
|
-
- PostgreSQL (primary data store)
|
|
40
|
-
- Redis (session cache, rate limiting)
|
|
41
|
-
- Stripe (payment processing)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Step 3: Diff Detection
|
|
45
|
-
|
|
46
|
-
1. If previous codemaps exist, calculate the diff percentage
|
|
47
|
-
2. If changes > 30%, show the diff and request user approval before overwriting
|
|
48
|
-
3. If changes <= 30%, update in place
|
|
49
|
-
|
|
50
|
-
## Step 4: Add Metadata
|
|
51
|
-
|
|
52
|
-
Add a freshness header to each codemap:
|
|
53
|
-
|
|
54
|
-
```markdown
|
|
55
|
-
<!-- Generated: 2026-02-11 | Files scanned: 142 | Token estimate: ~800 -->
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Step 5: Save Analysis Report
|
|
59
|
-
|
|
60
|
-
Write a summary to `.reports/codemap-diff.txt`:
|
|
61
|
-
- Files added/removed/modified since last scan
|
|
62
|
-
- New dependencies detected
|
|
63
|
-
- Architecture changes (new routes, new services, etc.)
|
|
64
|
-
- Staleness warnings for docs not updated in 90+ days
|
|
65
|
-
|
|
66
|
-
## Tips
|
|
67
|
-
|
|
68
|
-
- Focus on **high-level structure**, not implementation details
|
|
69
|
-
- Prefer **file paths and function signatures** over full code blocks
|
|
70
|
-
- Keep each codemap under **1000 tokens** for efficient context loading
|
|
71
|
-
- Use ASCII diagrams for data flow instead of verbose descriptions
|
|
72
|
-
- Run after major feature additions or refactoring sessions
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Update Documentation
|
|
2
|
-
|
|
3
|
-
Sync documentation with the codebase, generating from source-of-truth files.
|
|
4
|
-
|
|
5
|
-
## Step 1: Identify Sources of Truth
|
|
6
|
-
|
|
7
|
-
| Source | Generates |
|
|
8
|
-
|--------|-----------|
|
|
9
|
-
| `package.json` scripts | Available commands reference |
|
|
10
|
-
| `.env.example` | Environment variable documentation |
|
|
11
|
-
| `openapi.yaml` / route files | API endpoint reference |
|
|
12
|
-
| Source code exports | Public API documentation |
|
|
13
|
-
| `Dockerfile` / `docker-compose.yml` | Infrastructure setup docs |
|
|
14
|
-
|
|
15
|
-
## Step 2: Generate Script Reference
|
|
16
|
-
|
|
17
|
-
1. Read `package.json` (or `Makefile`, `Cargo.toml`, `pyproject.toml`)
|
|
18
|
-
2. Extract all scripts/commands with their descriptions
|
|
19
|
-
3. Generate a reference table:
|
|
20
|
-
|
|
21
|
-
```markdown
|
|
22
|
-
| Command | Description |
|
|
23
|
-
|---------|-------------|
|
|
24
|
-
| `npm run dev` | Start development server with hot reload |
|
|
25
|
-
| `npm run build` | Production build with type checking |
|
|
26
|
-
| `npm test` | Run test suite with coverage |
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Step 3: Generate Environment Documentation
|
|
30
|
-
|
|
31
|
-
1. Read `.env.example` (or `.env.template`, `.env.sample`)
|
|
32
|
-
2. Extract all variables with their purposes
|
|
33
|
-
3. Categorize as required vs optional
|
|
34
|
-
4. Document expected format and valid values
|
|
35
|
-
|
|
36
|
-
```markdown
|
|
37
|
-
| Variable | Required | Description | Example |
|
|
38
|
-
|----------|----------|-------------|---------|
|
|
39
|
-
| `DATABASE_URL` | Yes | PostgreSQL connection string | `postgres://user:pass@host:5432/db` |
|
|
40
|
-
| `LOG_LEVEL` | No | Logging verbosity (default: info) | `debug`, `info`, `warn`, `error` |
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Step 4: Update Contributing Guide
|
|
44
|
-
|
|
45
|
-
Generate or update `docs/CONTRIBUTING.md` with:
|
|
46
|
-
- Development environment setup (prerequisites, install steps)
|
|
47
|
-
- Available scripts and their purposes
|
|
48
|
-
- Testing procedures (how to run, how to write new tests)
|
|
49
|
-
- Code style enforcement (linter, formatter, pre-commit hooks)
|
|
50
|
-
- PR submission checklist
|
|
51
|
-
|
|
52
|
-
## Step 5: Update Runbook
|
|
53
|
-
|
|
54
|
-
Generate or update `docs/RUNBOOK.md` with:
|
|
55
|
-
- Deployment procedures (step-by-step)
|
|
56
|
-
- Health check endpoints and monitoring
|
|
57
|
-
- Common issues and their fixes
|
|
58
|
-
- Rollback procedures
|
|
59
|
-
- Alerting and escalation paths
|
|
60
|
-
|
|
61
|
-
## Step 6: Staleness Check
|
|
62
|
-
|
|
63
|
-
1. Find documentation files not modified in 90+ days
|
|
64
|
-
2. Cross-reference with recent source code changes
|
|
65
|
-
3. Flag potentially outdated docs for manual review
|
|
66
|
-
|
|
67
|
-
## Step 7: Show Summary
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
Documentation Update
|
|
71
|
-
──────────────────────────────
|
|
72
|
-
Updated: docs/CONTRIBUTING.md (scripts table)
|
|
73
|
-
Updated: docs/ENV.md (3 new variables)
|
|
74
|
-
Flagged: docs/DEPLOY.md (142 days stale)
|
|
75
|
-
Skipped: docs/API.md (no changes detected)
|
|
76
|
-
──────────────────────────────
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Rules
|
|
80
|
-
|
|
81
|
-
- **Single source of truth**: Always generate from code, never manually edit generated sections
|
|
82
|
-
- **Preserve manual sections**: Only update generated sections; leave hand-written prose intact
|
|
83
|
-
- **Mark generated content**: Use `<!-- AUTO-GENERATED -->` markers around generated sections
|
|
84
|
-
- **Don't create docs unprompted**: Only create new doc files if the command explicitly requests it
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Verification Command
|
|
2
|
-
|
|
3
|
-
Run comprehensive verification on current codebase state.
|
|
4
|
-
|
|
5
|
-
## Instructions
|
|
6
|
-
|
|
7
|
-
Execute verification in this exact order:
|
|
8
|
-
|
|
9
|
-
1. **Build Check**
|
|
10
|
-
- Run the build command for this project
|
|
11
|
-
- If it fails, report errors and STOP
|
|
12
|
-
|
|
13
|
-
2. **Type Check**
|
|
14
|
-
- Run TypeScript/type checker
|
|
15
|
-
- Report all errors with file:line
|
|
16
|
-
|
|
17
|
-
3. **Lint Check**
|
|
18
|
-
- Run linter
|
|
19
|
-
- Report warnings and errors
|
|
20
|
-
|
|
21
|
-
4. **Test Suite**
|
|
22
|
-
- Run all tests
|
|
23
|
-
- Report pass/fail count
|
|
24
|
-
- Report coverage percentage
|
|
25
|
-
|
|
26
|
-
5. **Console.log Audit**
|
|
27
|
-
- Search for console.log in source files
|
|
28
|
-
- Report locations
|
|
29
|
-
|
|
30
|
-
6. **Git Status**
|
|
31
|
-
- Show uncommitted changes
|
|
32
|
-
- Show files modified since last commit
|
|
33
|
-
|
|
34
|
-
## Output
|
|
35
|
-
|
|
36
|
-
Produce a concise verification report:
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
VERIFICATION: [PASS/FAIL]
|
|
40
|
-
|
|
41
|
-
Build: [OK/FAIL]
|
|
42
|
-
Types: [OK/X errors]
|
|
43
|
-
Lint: [OK/X issues]
|
|
44
|
-
Tests: [X/Y passed, Z% coverage]
|
|
45
|
-
Secrets: [OK/X found]
|
|
46
|
-
Logs: [OK/X console.logs]
|
|
47
|
-
|
|
48
|
-
Ready for PR: [YES/NO]
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
If any critical issues, list them with fix suggestions.
|
|
52
|
-
|
|
53
|
-
## Arguments
|
|
54
|
-
|
|
55
|
-
$ARGUMENTS can be:
|
|
56
|
-
- `quick` - Only build + types
|
|
57
|
-
- `full` - All checks (default)
|
|
58
|
-
- `pre-commit` - Checks relevant for commits
|
|
59
|
-
- `pre-pr` - Full checks plus security scan
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Agent 툴 실행 추적 — 여러 에이전트 동시 지원
|
|
3
|
-
# @hook-event PreToolUse|Agent|pre
|
|
4
|
-
# @hook-event PostToolUse|Agent|post
|
|
5
|
-
|
|
6
|
-
AGENT_STATE_DIR="/tmp/claude-agents"
|
|
7
|
-
mkdir -p "$AGENT_STATE_DIR"
|
|
8
|
-
|
|
9
|
-
EVENT="${1:-post}"
|
|
10
|
-
INPUT=$(cat)
|
|
11
|
-
|
|
12
|
-
# subagent_type + description으로 고유 파일명 생성
|
|
13
|
-
AGENT_ID=$(echo "$INPUT" | python3 -c "
|
|
14
|
-
import sys, json, hashlib
|
|
15
|
-
try:
|
|
16
|
-
d = json.load(sys.stdin)
|
|
17
|
-
ti = d.get('tool_input', {})
|
|
18
|
-
key = (ti.get('subagent_type', '') or '') + '|' + (ti.get('description', '') or '')
|
|
19
|
-
print(hashlib.md5(key.encode()).hexdigest()[:12])
|
|
20
|
-
except:
|
|
21
|
-
print('')
|
|
22
|
-
" 2>/dev/null)
|
|
23
|
-
|
|
24
|
-
if [ -z "$AGENT_ID" ]; then
|
|
25
|
-
exit 0
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
if [ "$EVENT" = "pre" ]; then
|
|
29
|
-
SUBAGENT_TYPE=$(echo "$INPUT" | python3 -c "
|
|
30
|
-
import sys, json
|
|
31
|
-
try:
|
|
32
|
-
d = json.load(sys.stdin)
|
|
33
|
-
print(d.get('tool_input', {}).get('subagent_type', '') or '')
|
|
34
|
-
except:
|
|
35
|
-
print('')
|
|
36
|
-
" 2>/dev/null)
|
|
37
|
-
|
|
38
|
-
DESCRIPTION=$(echo "$INPUT" | python3 -c "
|
|
39
|
-
import sys, json
|
|
40
|
-
try:
|
|
41
|
-
d = json.load(sys.stdin)
|
|
42
|
-
desc = d.get('tool_input', {}).get('description', '') or ''
|
|
43
|
-
print(desc[:50] if len(desc) > 50 else desc)
|
|
44
|
-
except:
|
|
45
|
-
print('')
|
|
46
|
-
" 2>/dev/null)
|
|
47
|
-
|
|
48
|
-
if [ -n "$SUBAGENT_TYPE" ]; then
|
|
49
|
-
echo "${SUBAGENT_TYPE}|${DESCRIPTION}" > "${AGENT_STATE_DIR}/${AGENT_ID}"
|
|
50
|
-
fi
|
|
51
|
-
else
|
|
52
|
-
rm -f "${AGENT_STATE_DIR}/${AGENT_ID}"
|
|
53
|
-
fi
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Auto commit & push hook - runs when Claude Code finishes a response
|
|
3
|
-
# @hook-event Stop||
|
|
4
|
-
# Compatible with bash 3.2 (macOS default)
|
|
5
|
-
|
|
6
|
-
# Get the working directory from the hook input
|
|
7
|
-
WORK_DIR=$(echo "$CLAUDE_HOOK_INPUT" | jq -r '.cwd // empty' 2>/dev/null)
|
|
8
|
-
if [ -z "$WORK_DIR" ]; then
|
|
9
|
-
WORK_DIR="$(pwd)"
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
cd "$WORK_DIR" 2>/dev/null || exit 0
|
|
13
|
-
|
|
14
|
-
# Check if we're in a git repo
|
|
15
|
-
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
|
16
|
-
exit 0
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
# Check if there are any changes
|
|
20
|
-
if git diff --quiet && git diff --cached --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
|
|
21
|
-
exit 0
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
|
|
25
|
-
if [ -z "$BRANCH" ]; then
|
|
26
|
-
exit 0
|
|
27
|
-
fi
|
|
28
|
-
|
|
29
|
-
# Stage all changes
|
|
30
|
-
git add -A
|
|
31
|
-
|
|
32
|
-
# ── 변경 파일 목록 수집 ───────────────────────────────
|
|
33
|
-
ADDED_FILES=$(git diff --cached --diff-filter=A --name-only)
|
|
34
|
-
MODIFIED_FILES=$(git diff --cached --diff-filter=M --name-only)
|
|
35
|
-
DELETED_FILES=$(git diff --cached --diff-filter=D --name-only)
|
|
36
|
-
|
|
37
|
-
ALL_FILES=$(git diff --cached --name-only)
|
|
38
|
-
ADDED_COUNT=$(echo "$ADDED_FILES" | grep -c . || true)
|
|
39
|
-
MODIFIED_COUNT=$(echo "$MODIFIED_FILES" | grep -c . || true)
|
|
40
|
-
DELETED_COUNT=$(echo "$DELETED_FILES" | grep -c . || true)
|
|
41
|
-
|
|
42
|
-
# ── 커밋 타입 감지 ────────────────────────────────────
|
|
43
|
-
# test: 파일이 모두 테스트/설정 관련이면 test/chore
|
|
44
|
-
HAS_TEST=$(echo "$ALL_FILES" | grep -E "(\.test\.|\.spec\.|__tests__|e2e/)" | head -1)
|
|
45
|
-
HAS_CONFIG=$(echo "$ALL_FILES" | grep -E "\.(config|json|yaml|yml|env|toml)$" | head -1)
|
|
46
|
-
HAS_ROADMAP=$(echo "$ALL_FILES" | grep -E "roadmap|ROADMAP|\.md$" | head -1)
|
|
47
|
-
HAS_SRC=$(echo "$ALL_FILES" | grep -E "^src/" | head -1)
|
|
48
|
-
|
|
49
|
-
if [ -n "$HAS_TEST" ] && [ -z "$HAS_SRC" ]; then
|
|
50
|
-
COMMIT_TYPE="test"
|
|
51
|
-
elif [ -n "$HAS_CONFIG" ] && [ -z "$HAS_SRC" ]; then
|
|
52
|
-
COMMIT_TYPE="chore"
|
|
53
|
-
elif [ -n "$HAS_ROADMAP" ] && [ -z "$HAS_SRC" ]; then
|
|
54
|
-
COMMIT_TYPE="docs"
|
|
55
|
-
else
|
|
56
|
-
COMMIT_TYPE="feat"
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
# ── 스코프: 가장 많이 변경된 2단계 디렉토리 ────────────
|
|
60
|
-
SCOPE=$(echo "$ALL_FILES" \
|
|
61
|
-
| awk -F'/' 'NF>=2 {print $1"/"$2} NF==1 {print $1}' \
|
|
62
|
-
| sort | uniq -c | sort -rn \
|
|
63
|
-
| awk 'NR==1{print $2}')
|
|
64
|
-
[ -z "$SCOPE" ] && SCOPE="root"
|
|
65
|
-
|
|
66
|
-
# ── Subject: 주요 파일명 나열 (확장자 제거, 최대 3개) ───
|
|
67
|
-
key_files() {
|
|
68
|
-
echo "$1" | while IFS= read -r f; do
|
|
69
|
-
[ -n "$f" ] && basename "$f" | sed 's/\.[^.]*$//'
|
|
70
|
-
done | head -3 | tr '\n' ',' | sed 's/,$//' | sed 's/,/, /g'
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
ADDED_NAMES=$(key_files "$ADDED_FILES")
|
|
74
|
-
MODIFIED_NAMES=$(key_files "$MODIFIED_FILES")
|
|
75
|
-
DELETED_NAMES=$(key_files "$DELETED_FILES")
|
|
76
|
-
|
|
77
|
-
SUBJECT_PARTS=""
|
|
78
|
-
[ -n "$ADDED_NAMES" ] && SUBJECT_PARTS="${SUBJECT_PARTS}add ${ADDED_NAMES}"
|
|
79
|
-
[ -n "$MODIFIED_NAMES" ] && SUBJECT_PARTS="${SUBJECT_PARTS:+$SUBJECT_PARTS; }update ${MODIFIED_NAMES}"
|
|
80
|
-
[ -n "$DELETED_NAMES" ] && SUBJECT_PARTS="${SUBJECT_PARTS:+$SUBJECT_PARTS; }remove ${DELETED_NAMES}"
|
|
81
|
-
|
|
82
|
-
# 파일이 4개 이상이면 개수도 병기
|
|
83
|
-
TOTAL=$((ADDED_COUNT + MODIFIED_COUNT + DELETED_COUNT))
|
|
84
|
-
if [ "$TOTAL" -gt 3 ]; then
|
|
85
|
-
SUBJECT_PARTS="${SUBJECT_PARTS} (+$((TOTAL - 3)) more)"
|
|
86
|
-
fi
|
|
87
|
-
|
|
88
|
-
SUBJECT="${COMMIT_TYPE}(${SCOPE}): ${SUBJECT_PARTS}"
|
|
89
|
-
|
|
90
|
-
# ── Body: 전체 파일 목록 ─────────────────────────────
|
|
91
|
-
BODY=""
|
|
92
|
-
if [ -n "$ADDED_FILES" ]; then
|
|
93
|
-
BODY="${BODY}New files:\n"
|
|
94
|
-
while IFS= read -r f; do
|
|
95
|
-
[ -n "$f" ] && BODY="${BODY} + ${f}\n"
|
|
96
|
-
done <<< "$ADDED_FILES"
|
|
97
|
-
fi
|
|
98
|
-
if [ -n "$MODIFIED_FILES" ]; then
|
|
99
|
-
[ -n "$BODY" ] && BODY="${BODY}\n"
|
|
100
|
-
BODY="${BODY}Modified:\n"
|
|
101
|
-
while IFS= read -r f; do
|
|
102
|
-
[ -n "$f" ] && BODY="${BODY} ~ ${f}\n"
|
|
103
|
-
done <<< "$MODIFIED_FILES"
|
|
104
|
-
fi
|
|
105
|
-
if [ -n "$DELETED_FILES" ]; then
|
|
106
|
-
[ -n "$BODY" ] && BODY="${BODY}\n"
|
|
107
|
-
BODY="${BODY}Deleted:\n"
|
|
108
|
-
while IFS= read -r f; do
|
|
109
|
-
[ -n "$f" ] && BODY="${BODY} - ${f}\n"
|
|
110
|
-
done <<< "$DELETED_FILES"
|
|
111
|
-
fi
|
|
112
|
-
|
|
113
|
-
FULL_MSG="${SUBJECT}\n\n${BODY}"
|
|
114
|
-
|
|
115
|
-
git commit -m "$(printf "%b" "$FULL_MSG")" --no-verify 2>/dev/null
|
|
116
|
-
|
|
117
|
-
# Push to remote if available
|
|
118
|
-
REMOTE=$(git remote 2>/dev/null | head -1)
|
|
119
|
-
if [ -n "$REMOTE" ]; then
|
|
120
|
-
git push "$REMOTE" "$BRANCH" --no-verify 2>/dev/null
|
|
121
|
-
fi
|
|
122
|
-
|
|
123
|
-
exit 0
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* PostToolUse Hook: Auto-format JS/TS files with Prettier after edits
|
|
4
|
-
*
|
|
5
|
-
* Cross-platform (Windows, macOS, Linux)
|
|
6
|
-
*
|
|
7
|
-
* Runs after Edit tool use. If the edited file is a JS/TS file,
|
|
8
|
-
* formats it with Prettier. Fails silently if Prettier isn't installed.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const { execFileSync } = require('child_process');
|
|
12
|
-
const path = require('path');
|
|
13
|
-
|
|
14
|
-
const MAX_STDIN = 1024 * 1024; // 1MB limit
|
|
15
|
-
let data = '';
|
|
16
|
-
process.stdin.setEncoding('utf8');
|
|
17
|
-
|
|
18
|
-
process.stdin.on('data', chunk => {
|
|
19
|
-
if (data.length < MAX_STDIN) {
|
|
20
|
-
const remaining = MAX_STDIN - data.length;
|
|
21
|
-
data += chunk.substring(0, remaining);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
process.stdin.on('end', () => {
|
|
26
|
-
try {
|
|
27
|
-
const input = JSON.parse(data);
|
|
28
|
-
const filePath = input.tool_input?.file_path;
|
|
29
|
-
|
|
30
|
-
if (filePath && /\.(ts|tsx|js|jsx)$/.test(filePath)) {
|
|
31
|
-
try {
|
|
32
|
-
// Use npx.cmd on Windows to avoid shell: true which enables command injection
|
|
33
|
-
const npxBin = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
34
|
-
execFileSync(npxBin, ['prettier', '--write', filePath], {
|
|
35
|
-
cwd: path.dirname(path.resolve(filePath)),
|
|
36
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
37
|
-
timeout: 15000
|
|
38
|
-
});
|
|
39
|
-
} catch {
|
|
40
|
-
// Prettier not installed, file missing, or failed — non-blocking
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
} catch {
|
|
44
|
-
// Invalid input — pass through
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
process.exit(0);
|
|
48
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* PostToolUse Hook: TypeScript check after editing .ts/.tsx files
|
|
4
|
-
*
|
|
5
|
-
* Cross-platform (Windows, macOS, Linux)
|
|
6
|
-
*
|
|
7
|
-
* Runs after Edit tool use on TypeScript files. Walks up from the file's
|
|
8
|
-
* directory to find the nearest tsconfig.json, then runs tsc --noEmit
|
|
9
|
-
* and reports only errors related to the edited file.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const { execFileSync } = require("child_process");
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
|
|
16
|
-
const MAX_STDIN = 1024 * 1024; // 1MB limit
|
|
17
|
-
let data = "";
|
|
18
|
-
process.stdin.setEncoding("utf8");
|
|
19
|
-
|
|
20
|
-
process.stdin.on("data", (chunk) => {
|
|
21
|
-
if (data.length < MAX_STDIN) {
|
|
22
|
-
const remaining = MAX_STDIN - data.length;
|
|
23
|
-
data += chunk.substring(0, remaining);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
process.stdin.on("end", () => {
|
|
28
|
-
try {
|
|
29
|
-
const input = JSON.parse(data);
|
|
30
|
-
const filePath = input.tool_input?.file_path;
|
|
31
|
-
|
|
32
|
-
if (filePath && /\.(ts|tsx)$/.test(filePath)) {
|
|
33
|
-
const resolvedPath = path.resolve(filePath);
|
|
34
|
-
if (!fs.existsSync(resolvedPath)) {
|
|
35
|
-
process.exit(0);
|
|
36
|
-
}
|
|
37
|
-
// Find nearest tsconfig.json by walking up (max 20 levels to prevent infinite loop)
|
|
38
|
-
let dir = path.dirname(resolvedPath);
|
|
39
|
-
const root = path.parse(dir).root;
|
|
40
|
-
let depth = 0;
|
|
41
|
-
|
|
42
|
-
while (dir !== root && depth < 20) {
|
|
43
|
-
if (fs.existsSync(path.join(dir, "tsconfig.json"))) {
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
dir = path.dirname(dir);
|
|
47
|
-
depth++;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (fs.existsSync(path.join(dir, "tsconfig.json"))) {
|
|
51
|
-
try {
|
|
52
|
-
// Use npx.cmd on Windows to avoid shell: true which enables command injection
|
|
53
|
-
const npxBin = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
54
|
-
execFileSync(npxBin, ["tsc", "--noEmit", "--pretty", "false"], {
|
|
55
|
-
cwd: dir,
|
|
56
|
-
encoding: "utf8",
|
|
57
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
58
|
-
timeout: 30000,
|
|
59
|
-
});
|
|
60
|
-
} catch (err) {
|
|
61
|
-
// tsc exits non-zero when there are errors — filter to edited file
|
|
62
|
-
const output = (err.stdout || "") + (err.stderr || "");
|
|
63
|
-
// Compute paths that uniquely identify the edited file.
|
|
64
|
-
// tsc output uses paths relative to its cwd (the tsconfig dir),
|
|
65
|
-
// so check for the relative path, absolute path, and original path.
|
|
66
|
-
// Avoid bare basename matching — it causes false positives when
|
|
67
|
-
// multiple files share the same name (e.g., src/utils.ts vs tests/utils.ts).
|
|
68
|
-
const relPath = path.relative(dir, resolvedPath);
|
|
69
|
-
const candidates = new Set([filePath, resolvedPath, relPath]);
|
|
70
|
-
const relevantLines = output
|
|
71
|
-
.split("\n")
|
|
72
|
-
.filter((line) => {
|
|
73
|
-
for (const candidate of candidates) {
|
|
74
|
-
if (line.includes(candidate)) return true;
|
|
75
|
-
}
|
|
76
|
-
return false;
|
|
77
|
-
})
|
|
78
|
-
.slice(0, 10);
|
|
79
|
-
|
|
80
|
-
if (relevantLines.length > 0) {
|
|
81
|
-
console.error(
|
|
82
|
-
"[Hook] TypeScript errors in " + path.basename(filePath) + ":",
|
|
83
|
-
);
|
|
84
|
-
relevantLines.forEach((line) => console.error(line));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
} catch {
|
|
90
|
-
// Invalid input — pass through
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
process.exit(0);
|
|
94
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Skill 툴 실행 추적
|
|
3
|
-
# @hook-event PreToolUse|Skill|pre
|
|
4
|
-
# @hook-event PostToolUse|Skill|post
|
|
5
|
-
|
|
6
|
-
SKILL_STATE_FILE="/tmp/claude-active-skill.txt"
|
|
7
|
-
|
|
8
|
-
EVENT="${1:-post}"
|
|
9
|
-
INPUT=$(cat)
|
|
10
|
-
|
|
11
|
-
if [ "$EVENT" = "pre" ]; then
|
|
12
|
-
SKILL_NAME=$(echo "$INPUT" | python3 -c "
|
|
13
|
-
import sys, json
|
|
14
|
-
try:
|
|
15
|
-
d = json.load(sys.stdin)
|
|
16
|
-
print(d.get('tool_input', {}).get('skill', '') or '')
|
|
17
|
-
except:
|
|
18
|
-
print('')
|
|
19
|
-
" 2>/dev/null)
|
|
20
|
-
|
|
21
|
-
if [ -n "$SKILL_NAME" ]; then
|
|
22
|
-
echo "$SKILL_NAME" > "$SKILL_STATE_FILE"
|
|
23
|
-
fi
|
|
24
|
-
else
|
|
25
|
-
rm -f "$SKILL_STATE_FILE"
|
|
26
|
-
fi
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# 응답 완료 시 macOS 알림 발송 — 마지막 커밋 메시지를 요약으로 표시
|
|
3
|
-
# @hook-event Stop||
|
|
4
|
-
|
|
5
|
-
WORK_DIR=$(echo "$CLAUDE_HOOK_INPUT" | jq -r '.cwd // empty' 2>/dev/null)
|
|
6
|
-
if [ -z "$WORK_DIR" ]; then
|
|
7
|
-
WORK_DIR="$(pwd)"
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
# 마지막 git 커밋 메시지를 알림 본문으로 사용
|
|
11
|
-
MSG=""
|
|
12
|
-
if git -C "$WORK_DIR" rev-parse --is-inside-work-tree &>/dev/null; then
|
|
13
|
-
MSG=$(git -C "$WORK_DIR" log --oneline -1 --format="%s" 2>/dev/null)
|
|
14
|
-
fi
|
|
15
|
-
|
|
16
|
-
if [ -z "$MSG" ]; then
|
|
17
|
-
MSG="응답이 완료됐습니다."
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
osascript -e "display notification \"${MSG}\" with title \"Claude Code\" subtitle \"응답 완료\" sound name \"Glass\""
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Agent Orchestration
|
|
2
|
-
|
|
3
|
-
## Available Agents
|
|
4
|
-
|
|
5
|
-
Located in `~/.claude/agents/`:
|
|
6
|
-
|
|
7
|
-
| Agent | Purpose | When to Use |
|
|
8
|
-
|-------|---------|-------------|
|
|
9
|
-
| planner | Implementation planning | Complex features, refactoring |
|
|
10
|
-
| architect | System design | Architectural decisions |
|
|
11
|
-
| tdd-guide | Test-driven development | New features, bug fixes |
|
|
12
|
-
| code-reviewer | Code review | After writing code |
|
|
13
|
-
| security-reviewer | Security analysis | Before commits |
|
|
14
|
-
| build-error-resolver | Fix build errors | When build fails |
|
|
15
|
-
| e2e-runner | E2E testing | Critical user flows |
|
|
16
|
-
| refactor-cleaner | Dead code cleanup | Code maintenance |
|
|
17
|
-
| doc-updater | Documentation | Updating docs |
|
|
18
|
-
|
|
19
|
-
## Immediate Agent Usage
|
|
20
|
-
|
|
21
|
-
No user prompt needed:
|
|
22
|
-
1. Complex feature requests - Use **planner** agent
|
|
23
|
-
2. Code just written/modified - Use **code-reviewer** agent
|
|
24
|
-
3. Bug fix or new feature - Use **tdd-guide** agent
|
|
25
|
-
4. Architectural decision - Use **architect** agent
|
|
26
|
-
|
|
27
|
-
## Parallel Task Execution
|
|
28
|
-
|
|
29
|
-
ALWAYS use parallel Task execution for independent operations:
|
|
30
|
-
|
|
31
|
-
```markdown
|
|
32
|
-
# GOOD: Parallel execution
|
|
33
|
-
Launch 3 agents in parallel:
|
|
34
|
-
1. Agent 1: Security analysis of auth module
|
|
35
|
-
2. Agent 2: Performance review of cache system
|
|
36
|
-
3. Agent 3: Type checking of utilities
|
|
37
|
-
|
|
38
|
-
# BAD: Sequential when unnecessary
|
|
39
|
-
First agent 1, then agent 2, then agent 3
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Multi-Perspective Analysis
|
|
43
|
-
|
|
44
|
-
For complex problems, use split role sub-agents:
|
|
45
|
-
- Factual reviewer
|
|
46
|
-
- Senior engineer
|
|
47
|
-
- Security expert
|
|
48
|
-
- Consistency reviewer
|
|
49
|
-
- Redundancy checker
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Coding Style
|
|
2
|
-
|
|
3
|
-
## Immutability (CRITICAL)
|
|
4
|
-
|
|
5
|
-
ALWAYS create new objects, NEVER mutate existing ones:
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
// Pseudocode
|
|
9
|
-
WRONG: modify(original, field, value) → changes original in-place
|
|
10
|
-
CORRECT: update(original, field, value) → returns new copy with change
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Rationale: Immutable data prevents hidden side effects, makes debugging easier, and enables safe concurrency.
|
|
14
|
-
|
|
15
|
-
## File Organization
|
|
16
|
-
|
|
17
|
-
MANY SMALL FILES > FEW LARGE FILES:
|
|
18
|
-
- High cohesion, low coupling
|
|
19
|
-
- 200-400 lines typical, 800 max
|
|
20
|
-
- Extract utilities from large modules
|
|
21
|
-
- Organize by feature/domain, not by type
|
|
22
|
-
|
|
23
|
-
## Error Handling
|
|
24
|
-
|
|
25
|
-
ALWAYS handle errors comprehensively:
|
|
26
|
-
- Handle errors explicitly at every level
|
|
27
|
-
- Provide user-friendly error messages in UI-facing code
|
|
28
|
-
- Log detailed error context on the server side
|
|
29
|
-
- Never silently swallow errors
|
|
30
|
-
|
|
31
|
-
## Input Validation
|
|
32
|
-
|
|
33
|
-
ALWAYS validate at system boundaries:
|
|
34
|
-
- Validate all user input before processing
|
|
35
|
-
- Use schema-based validation where available
|
|
36
|
-
- Fail fast with clear error messages
|
|
37
|
-
- Never trust external data (API responses, user input, file content)
|
|
38
|
-
|
|
39
|
-
## Code Quality Checklist
|
|
40
|
-
|
|
41
|
-
Before marking work complete:
|
|
42
|
-
- [ ] Code is readable and well-named
|
|
43
|
-
- [ ] Functions are small (<50 lines)
|
|
44
|
-
- [ ] Files are focused (<800 lines)
|
|
45
|
-
- [ ] No deep nesting (>4 levels)
|
|
46
|
-
- [ ] Proper error handling
|
|
47
|
-
- [ ] No hardcoded values (use constants or config)
|
|
48
|
-
- [ ] No mutation (immutable patterns used)
|