From deep-work
Analyzes code metrics, complexity, and dependency patterns in target files or directory, producing informational insight reports usable standalone or as quality gate.
npx claudepluginhub sungmin-cho/claude-deep-worktarget file or directory (optional)> **Deprecated in v5.2** β μ΄ μ»€λ§¨λλ `/deep-work` auto-flowμμ μλ μ€νλ©λλ€. > μλ νΈμΆλ μ¬μ ν κ°λ₯ν©λλ€. ν΅ν© μν¬νλ‘μ°λ `/deep-work`μ μ°Έκ³ νμΈμ. # Code Insight Analysis You are performing a **Code Insight Analysis** β measuring code metrics, complexity indicators, and dependency patterns to provide informational reports. This is the **Insight tier** of the 3-tier Quality Gate system. ## Critical Constraints - **DO NOT modify any code files.** This is an analysis-only operation. - **Read, analyze, and report findings.** - **Insight results NEVER block the workflow.** They are purely informational. - **Save analy...
/deep-insightAnalyzes code metrics, complexity, and dependency patterns in target files or directory, producing informational insight reports usable standalone or as quality gate.
Deprecated in v5.2 β μ΄ μ»€λ§¨λλ
/deep-workauto-flowμμ μλ μ€νλ©λλ€. μλ νΈμΆλ μ¬μ ν κ°λ₯ν©λλ€. ν΅ν© μν¬νλ‘μ°λ/deep-workμ μ°Έκ³ νμΈμ.
You are performing a Code Insight Analysis β measuring code metrics, complexity indicators, and dependency patterns to provide informational reports. This is the Insight tier of the 3-tier Quality Gate system.
Resolve the current session's state file:
DEEP_WORK_SESSION_ID env var is set β .claude/deep-work.${DEEP_WORK_SESSION_ID}.md.claude/deep-work-current-session pointer file exists β read session ID β .claude/deep-work.${SESSION_ID}.md.claude/deep-work.local.mdSet $STATE_FILE to the resolved path.
Check if $STATE_FILE exists and has an active session (current_phase is not idle and not empty).
Workflow Mode (active deep-work session):
work_dir from the state fileWORK_DIR to the value of work_dir$WORK_DIR/plan.md to extract the list of files (from "Files to Modify" section)git diff --name-only from baseline$WORK_DIR/file-changes.log exists, use it for additional file tracking dataStandalone Mode (no active session):
$ARGUMENTS is provided: use as target (file path, directory, or glob pattern)$ARGUMENTS is empty: detect scope automatically:
git diff --name-only HEAD~1 for recently changed filesGather the list of files to analyze. For each file:
If the total number of files exceeds 50, prioritize:
Display progress:
βΉοΈ Insight λΆμ λμ: [N]κ° νμΌ
- src/auth/service.ts (245 lines)
- src/models/user.ts (180 lines)
- ...
If exceeding 50 files:
β οΈ λΆμ λμμ΄ 50κ°λ₯Ό μ΄κ³Όν©λλ€. μμ 50κ° νμΌλ§ λΆμν©λλ€.
Execute 4 categories of analysis. Each analysis should be resilient β if one fails, continue with the rest.
For each target file, measure:
grep -c patterns appropriate for the language:
function , => {, method definitions in classesdef func fn export , Python: __all__, Go: uppercase functions)Generate summary table:
## A. νμΌ λ©νΈλ¦
| νμΌ | μ½λ μ€ μ | ν¨μ μ | Export μ |
|------|-----------|---------|----------|
| src/auth.ts | 245 | 12 | 5 |
| src/db.ts | 180 | 8 | 3 |
**ν©κ³**: μ½λ 425μ€, ν¨μ 20κ°, Export 8κ°
For each target file, check:
Generate findings:
## B. 볡μ‘λ μ§ν
### λν νμΌ (300μ€ μ΄κ³Ό)
| νμΌ | μ€ μ | μν |
|------|------|------|
| src/auth.ts | 456 | β οΈ λν |
### μ₯ν¨μ (50μ€ μ΄κ³Ό)
| νμΌ | ν¨μλͺ
| μ€ μ |
|------|--------|------|
| src/auth.ts | handleLogin | 82 |
### κΉμ μ€μ²© (4λ¨κ³ μ΄κ³Ό)
| νμΌ | μ΅λ κΉμ΄ | μμΉ |
|------|----------|------|
| src/parser.ts | 6 | line 45-78 |
**μμ½**: λν νμΌ Nκ°, μ₯ν¨μ Nκ°, κΉμ μ€μ²© Nκ°
If no issues found for a subcategory, display: "μμ β "
For each target file, parse import/require statements:
import ... from '...', require('...')import ..., from ... import ...import "...", import (...)Build a simple adjacency list of internal dependencies (skip external packages).
Check for:
A β B β C β AGenerate findings:
## C. μμ‘΄μ± λΆμ
### Import ν΅κ³
| νμΌ | Import μ | λ΄λΆ | μΈλΆ |
|------|----------|------|------|
| src/auth.ts | 8 | 3 | 5 |
### μν μ°Έμ‘°
μμ β
(or: β οΈ μν μ°Έμ‘° λ°κ²¬: src/a.ts β src/b.ts β src/a.ts)
### Hub νμΌ (5+ μ°Έμ‘°)
| νμΌ | μ°Έμ‘° μ |
|------|---------|
| src/utils.ts | 12 |
### Import κΉμ΄
μ΅λ Import 체μΈ: 4 (src/page.ts β src/auth.ts β src/db.ts β src/config.ts)
Only execute this section when in workflow mode with an active session.
Read $WORK_DIR/file-changes.log if it exists, or fall back to git diff --stat.
Generate:
## D. λ³κ²½ μμ½
| νλͺ© | κ° |
|------|---|
| μ΄ λ³κ²½ νμΌ μ | N |
| μ κ· μμ± | N |
| μμ | N |
| μμ | N |
| μΆκ° μ€ μ | +N |
| μμ μ€ μ | -N |
### νμΌλ³ μμ νμ (file-changes.log κΈ°μ€)
| νμΌ | μμ νμ |
|------|----------|
| src/auth.ts | 5 |
| src/db.ts | 3 |
If neither file-changes.log nor git data is available, display:
λ³κ²½ λ°μ΄ν° μμ β git diff λλ file-changes.logλ₯Ό μ¬μ©ν μ μμ΅λλ€.
If in workflow mode and $WORK_DIR/plan.md contains a Quality Gates table with βΉοΈ markers:
## μ¬μ©μ μ μ Insight Gates
| Gate | λͺ
λ Ήμ΄ | κ²°κ³Ό | μΆλ ₯ |
|------|--------|------|------|
| Complexity Score | `npx complexity-report` | βΉοΈ INFO | score: 12.3 |
If a user-defined Insight gate command fails:
| Gate Name | `command` | βΉοΈ SKIP | λͺ
λ Ήμ΄ μ€ν μ€ν¨ (exit code: N) |
Combine all analyses into a concise overview:
## μ’
ν© μΈμ¬μ΄νΈ μμ½
| μΉ΄ν
κ³ λ¦¬ | ν΅μ¬ μμΉ | μ£Όλͺ© ν¬μΈνΈ |
|----------|----------|------------|
| νμΌ λ©νΈλ¦ | NνμΌ, Nμ€, Nν¨μ | β |
| 볡μ‘λ | λν N / μ₯ν¨μ N / κΉμ μ€μ²© N | [κ°μ₯ μ¬κ°ν νλͺ©] |
| μμ‘΄μ± | μν μ°Έμ‘° N / Hub N / μ΅λ κΉμ΄ N | [κ°μ₯ μ¬κ°ν νλͺ©] |
| λ³κ²½ μμ½ | +N/-Nμ€, NνμΌ | β |
**νμ **: βΉοΈ Insight β μν¬νλ‘μ° μ°¨λ¨ μμ, μ°Έκ³ μ© μ 보 μ 곡
Workflow Mode:
$WORK_DIR/insight-report.mdβΉοΈ Insight λΆμ μλ£ β κ²°κ³Όκ° $WORK_DIR/insight-report.mdμ μ μ₯λμμ΅λλ€.
Standalone Mode:
./insight-report.mdIf called as a Quality Gate during Test phase:
quality-gates.md as Insight entryIf called outside the Test phase:
If any analysis section fails (e.g., no git repo, unsupported language):
β οΈ [Section Name] λΆμ μ€ν¨: [reason]