@tienne/gestalt 0.9.1 → 0.10.0

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.
Files changed (149) hide show
  1. package/CLAUDE.md +75 -0
  2. package/dist/package.json +2 -1
  3. package/dist/skills/blast-radius/SKILL.md +134 -0
  4. package/dist/skills/build-graph/SKILL.md +100 -0
  5. package/dist/skills/diff-radius/SKILL.md +125 -0
  6. package/dist/skills/setup/SKILL.md +150 -0
  7. package/dist/src/cli/commands/graph-visualize.d.ts +11 -0
  8. package/dist/src/cli/commands/graph-visualize.d.ts.map +1 -0
  9. package/dist/src/cli/commands/graph-visualize.js +26 -0
  10. package/dist/src/cli/commands/graph-visualize.js.map +1 -0
  11. package/dist/src/cli/commands/init.d.ts +5 -0
  12. package/dist/src/cli/commands/init.d.ts.map +1 -0
  13. package/dist/src/cli/commands/init.js +79 -0
  14. package/dist/src/cli/commands/init.js.map +1 -0
  15. package/dist/src/cli/index.d.ts.map +1 -1
  16. package/dist/src/cli/index.js +23 -0
  17. package/dist/src/cli/index.js.map +1 -1
  18. package/dist/src/code-graph/blast-radius.d.ts +9 -0
  19. package/dist/src/code-graph/blast-radius.d.ts.map +1 -0
  20. package/dist/src/code-graph/blast-radius.js +139 -0
  21. package/dist/src/code-graph/blast-radius.js.map +1 -0
  22. package/dist/src/code-graph/engine.d.ts +46 -0
  23. package/dist/src/code-graph/engine.d.ts.map +1 -0
  24. package/dist/src/code-graph/engine.js +301 -0
  25. package/dist/src/code-graph/engine.js.map +1 -0
  26. package/dist/src/code-graph/git-hook.d.ts +22 -0
  27. package/dist/src/code-graph/git-hook.d.ts.map +1 -0
  28. package/dist/src/code-graph/git-hook.js +100 -0
  29. package/dist/src/code-graph/git-hook.js.map +1 -0
  30. package/dist/src/code-graph/index.d.ts +7 -0
  31. package/dist/src/code-graph/index.d.ts.map +1 -0
  32. package/dist/src/code-graph/index.js +6 -0
  33. package/dist/src/code-graph/index.js.map +1 -0
  34. package/dist/src/code-graph/plugins/go.d.ts +3 -0
  35. package/dist/src/code-graph/plugins/go.d.ts.map +1 -0
  36. package/dist/src/code-graph/plugins/go.js +126 -0
  37. package/dist/src/code-graph/plugins/go.js.map +1 -0
  38. package/dist/src/code-graph/plugins/index.d.ts +16 -0
  39. package/dist/src/code-graph/plugins/index.d.ts.map +1 -0
  40. package/dist/src/code-graph/plugins/index.js +36 -0
  41. package/dist/src/code-graph/plugins/index.js.map +1 -0
  42. package/dist/src/code-graph/plugins/java.d.ts +3 -0
  43. package/dist/src/code-graph/plugins/java.d.ts.map +1 -0
  44. package/dist/src/code-graph/plugins/java.js +108 -0
  45. package/dist/src/code-graph/plugins/java.js.map +1 -0
  46. package/dist/src/code-graph/plugins/kotlin.d.ts +3 -0
  47. package/dist/src/code-graph/plugins/kotlin.d.ts.map +1 -0
  48. package/dist/src/code-graph/plugins/kotlin.js +94 -0
  49. package/dist/src/code-graph/plugins/kotlin.js.map +1 -0
  50. package/dist/src/code-graph/plugins/objc.d.ts +3 -0
  51. package/dist/src/code-graph/plugins/objc.d.ts.map +1 -0
  52. package/dist/src/code-graph/plugins/objc.js +129 -0
  53. package/dist/src/code-graph/plugins/objc.js.map +1 -0
  54. package/dist/src/code-graph/plugins/python.d.ts +3 -0
  55. package/dist/src/code-graph/plugins/python.d.ts.map +1 -0
  56. package/dist/src/code-graph/plugins/python.js +116 -0
  57. package/dist/src/code-graph/plugins/python.js.map +1 -0
  58. package/dist/src/code-graph/plugins/rust.d.ts +3 -0
  59. package/dist/src/code-graph/plugins/rust.d.ts.map +1 -0
  60. package/dist/src/code-graph/plugins/rust.js +108 -0
  61. package/dist/src/code-graph/plugins/rust.js.map +1 -0
  62. package/dist/src/code-graph/plugins/swift.d.ts +3 -0
  63. package/dist/src/code-graph/plugins/swift.d.ts.map +1 -0
  64. package/dist/src/code-graph/plugins/swift.js +106 -0
  65. package/dist/src/code-graph/plugins/swift.js.map +1 -0
  66. package/dist/src/code-graph/plugins/typescript.d.ts +3 -0
  67. package/dist/src/code-graph/plugins/typescript.d.ts.map +1 -0
  68. package/dist/src/code-graph/plugins/typescript.js +209 -0
  69. package/dist/src/code-graph/plugins/typescript.js.map +1 -0
  70. package/dist/src/code-graph/storage.d.ts +19 -0
  71. package/dist/src/code-graph/storage.d.ts.map +1 -0
  72. package/dist/src/code-graph/storage.js +182 -0
  73. package/dist/src/code-graph/storage.js.map +1 -0
  74. package/dist/src/code-graph/types.d.ts +93 -0
  75. package/dist/src/code-graph/types.d.ts.map +1 -0
  76. package/dist/src/code-graph/types.js +17 -0
  77. package/dist/src/code-graph/types.js.map +1 -0
  78. package/dist/src/core/config.d.ts +1 -0
  79. package/dist/src/core/config.d.ts.map +1 -1
  80. package/dist/src/core/config.js +1 -1
  81. package/dist/src/core/config.js.map +1 -1
  82. package/dist/src/core/types.d.ts +1 -0
  83. package/dist/src/core/types.d.ts.map +1 -1
  84. package/dist/src/execute/passthrough-engine.d.ts +4 -1
  85. package/dist/src/execute/passthrough-engine.d.ts.map +1 -1
  86. package/dist/src/execute/passthrough-engine.js +54 -4
  87. package/dist/src/execute/passthrough-engine.js.map +1 -1
  88. package/dist/src/execute/prompts.d.ts +2 -2
  89. package/dist/src/execute/prompts.d.ts.map +1 -1
  90. package/dist/src/execute/prompts.js +7 -3
  91. package/dist/src/execute/prompts.js.map +1 -1
  92. package/dist/src/execute/repository.d.ts.map +1 -1
  93. package/dist/src/execute/repository.js +1 -0
  94. package/dist/src/execute/repository.js.map +1 -1
  95. package/dist/src/execute/session.d.ts +3 -1
  96. package/dist/src/execute/session.d.ts.map +1 -1
  97. package/dist/src/execute/session.js +3 -1
  98. package/dist/src/execute/session.js.map +1 -1
  99. package/dist/src/graph-viz/engine.d.ts +20 -0
  100. package/dist/src/graph-viz/engine.d.ts.map +1 -0
  101. package/dist/src/graph-viz/engine.js +81 -0
  102. package/dist/src/graph-viz/engine.js.map +1 -0
  103. package/dist/src/graph-viz/html-generator.d.ts +7 -0
  104. package/dist/src/graph-viz/html-generator.d.ts.map +1 -0
  105. package/dist/src/graph-viz/html-generator.js +699 -0
  106. package/dist/src/graph-viz/html-generator.js.map +1 -0
  107. package/dist/src/graph-viz/index.d.ts +6 -0
  108. package/dist/src/graph-viz/index.d.ts.map +1 -0
  109. package/dist/src/graph-viz/index.js +5 -0
  110. package/dist/src/graph-viz/index.js.map +1 -0
  111. package/dist/src/graph-viz/port-finder.d.ts +2 -0
  112. package/dist/src/graph-viz/port-finder.d.ts.map +1 -0
  113. package/dist/src/graph-viz/port-finder.js +26 -0
  114. package/dist/src/graph-viz/port-finder.js.map +1 -0
  115. package/dist/src/graph-viz/server.d.ts +26 -0
  116. package/dist/src/graph-viz/server.d.ts.map +1 -0
  117. package/dist/src/graph-viz/server.js +104 -0
  118. package/dist/src/graph-viz/server.js.map +1 -0
  119. package/dist/src/graph-viz/types.d.ts +11 -0
  120. package/dist/src/graph-viz/types.d.ts.map +1 -0
  121. package/dist/src/graph-viz/types.js +2 -0
  122. package/dist/src/graph-viz/types.js.map +1 -0
  123. package/dist/src/mcp/schemas.d.ts +57 -0
  124. package/dist/src/mcp/schemas.d.ts.map +1 -1
  125. package/dist/src/mcp/schemas.js +28 -0
  126. package/dist/src/mcp/schemas.js.map +1 -1
  127. package/dist/src/mcp/server.d.ts.map +1 -1
  128. package/dist/src/mcp/server.js +28 -1
  129. package/dist/src/mcp/server.js.map +1 -1
  130. package/dist/src/mcp/tools/code-graph-passthrough.d.ts +16 -0
  131. package/dist/src/mcp/tools/code-graph-passthrough.d.ts.map +1 -0
  132. package/dist/src/mcp/tools/code-graph-passthrough.js +65 -0
  133. package/dist/src/mcp/tools/code-graph-passthrough.js.map +1 -0
  134. package/dist/src/mcp/tools/execute-passthrough.d.ts.map +1 -1
  135. package/dist/src/mcp/tools/execute-passthrough.js +1 -1
  136. package/dist/src/mcp/tools/execute-passthrough.js.map +1 -1
  137. package/dist/src/mcp/tools/graph-visualize-passthrough.d.ts +13 -0
  138. package/dist/src/mcp/tools/graph-visualize-passthrough.d.ts.map +1 -0
  139. package/dist/src/mcp/tools/graph-visualize-passthrough.js +26 -0
  140. package/dist/src/mcp/tools/graph-visualize-passthrough.js.map +1 -0
  141. package/dist/src/mcp/tools/index.d.ts +1 -0
  142. package/dist/src/mcp/tools/index.d.ts.map +1 -1
  143. package/dist/src/mcp/tools/index.js +1 -0
  144. package/dist/src/mcp/tools/index.js.map +1 -1
  145. package/package.json +2 -1
  146. package/skills/blast-radius/SKILL.md +134 -0
  147. package/skills/build-graph/SKILL.md +100 -0
  148. package/skills/diff-radius/SKILL.md +125 -0
  149. package/skills/setup/SKILL.md +150 -0
package/CLAUDE.md CHANGED
@@ -11,6 +11,7 @@
11
11
  - **Resilience Engine**: Stagnation 감지 → Lateral Thinking Personas → Human Escalation
12
12
  - **MCP Server**: stdio transport로 Claude Code 등 AI 에이전트와 통합
13
13
  - **Skill System**: SKILL.md 기반 확장, chokidar hot-reload 지원. 각 스킬(`/interview`, `/spec`, `/execute`)은 실행 중 Claude Code Task 패널에 진행 상태를 `TaskCreate`/`TaskUpdate`로 실시간 표시 (공통 진행 패널)
14
+ - **Code Knowledge Graph**: 코드베이스 정적 분석 → 의존성 그래프화 → Blast-Radius로 영향 파일 추림. Execute 파이프라인 태스크 실행 시 `suggestedFiles`로 자동 컨텍스트 주입해 불필요한 파일 읽기를 줄임
14
15
  - **Event Store**: better-sqlite3 WAL 모드 이벤트 소싱
15
16
 
16
17
  ## Tech Stack
@@ -25,6 +26,9 @@ pnpm tsx bin/gestalt.ts interview "topic" # Interactive interview
25
26
  pnpm tsx bin/gestalt.ts spec <session-id> # Generate spec
26
27
  pnpm tsx bin/gestalt.ts status # Check sessions
27
28
  pnpm tsx bin/gestalt.ts setup # Generate gestalt.json config
29
+ pnpm tsx bin/gestalt.ts init # One-step onboarding: gestalt.json + code graph + post-commit hook
30
+ pnpm tsx bin/gestalt.ts init --skip-graph # Skip code graph build
31
+ pnpm tsx bin/gestalt.ts init --skip-hook # Skip post-commit hook installation
28
32
  ```
29
33
 
30
34
  ## Configuration
@@ -89,6 +93,7 @@ interface GestaltConfig {
89
93
  - `ges_generate_spec`: sessionId? (optional), text? (optional), force?, spec? (passthrough)
90
94
  - `ges_execute`: action=[start|plan_step|plan_complete|execute_start|execute_task|evaluate|status|evolve_fix|evolve|evolve_patch|evolve_re_execute|evolve_lateral|evolve_lateral_result|role_match|role_consensus]
91
95
  - `ges_create_agent`: action=[start|submit] — 인터뷰 기반 커스텀 Role Agent 생성
96
+ - `ges_code_graph`: action=[build|blast_radius|query|stats|db_exists] — 코드 지식 그래프 관리
92
97
  - `ges_status`: sessionId?
93
98
 
94
99
  ## MCP Passthrough Mode
@@ -367,6 +372,7 @@ ges_execute({ action: "role_consensus", sessionId: "<id>", consensus: {...} })
367
372
  - `src/spec/` — SpecGenerator, SpecExtractor
368
373
  - `src/execute/` — ExecuteEngine, DAG Validator, ExecuteSessionManager
369
374
  - `src/resilience/` — Stagnation Detector, Lateral Thinking Personas, Human Escalation
375
+ - `src/code-graph/` — CodeGraphEngine, CodeGraphStore, BlastRadius, 언어 플러그인 8개
370
376
  - `src/skills/` — SkillRegistry, parser
371
377
  - `src/agent/` — AgentRegistry, FiguralRouter, multi-provider LLM, RoleAgentRegistry, PassthroughAgentGenerator
372
378
  - `src/registry/` — BaseRegistry 추상 클래스
@@ -376,6 +382,75 @@ ges_execute({ action: "role_consensus", sessionId: "<id>", consensus: {...} })
376
382
  - `src/cli/` — commander 기반 CLI (interview, spec, status, setup)
377
383
  - `schemas/` — JSON Schema (gestalt.schema.json)
378
384
  - `role-agents/` — 내장 Role Agent 정의 (architect, frontend-developer 등 8개)
385
+ - `skills/` — 외부 스킬 정의 (`build-graph`, `blast-radius`)
386
+
387
+ ## Code Knowledge Graph
388
+
389
+ 코드베이스를 정적 분석해 의존성 그래프를 빌드하고, 변경 영향 파일을 빠르게 추려 AI 컨텍스트를 절약한다.
390
+
391
+ ### ges_code_graph MCP 툴
392
+
393
+ ```
394
+ // 그래프 빌드 (최초 또는 full rebuild)
395
+ ges_code_graph({ action: "build", repoRoot: "<절대경로>" })
396
+ → { nodesBuilt, edgesBuilt, timeTakenMs, installedHook }
397
+
398
+ // Blast-Radius 분석 (커밋 기준 영향범위)
399
+ ges_code_graph({ action: "blast_radius", repoRoot: "<경로>", base?: "HEAD~1", changedFiles?: [...], maxDepth?: 2 })
400
+ → { changedFiles, impactedFiles, riskScore, summary }
401
+
402
+ // Diff-Radius 분석 (미커밋 변경 기준 영향범위)
403
+ ges_code_graph({ action: "diff_radius", repoRoot: "<경로>", diffMode?: "staged"|"unstaged"|"all", maxDepth?: 2 })
404
+ → { changedFiles, impactedFiles, riskScore, summary }
405
+
406
+ // 키워드 기반 관련 파일 검색
407
+ ges_code_graph({ action: "query", repoRoot: "<경로>", pattern: "callers_of"|"callees_of"|"tests_for"|"imports_of", target: "<노드명>" })
408
+ → { nodes, edges }
409
+
410
+ // 그래프 통계
411
+ ges_code_graph({ action: "stats", repoRoot: "<경로>" })
412
+ → { totalFiles, totalNodes, totalEdges, lastBuiltAt, dbSizeBytes }
413
+
414
+ // DB 존재 여부 확인
415
+ ges_code_graph({ action: "db_exists", repoRoot: "<경로>" })
416
+ → { exists: boolean }
417
+ ```
418
+
419
+ 저장소: `.gestalt/code-graph.db` (WAL SQLite, EventStore DB와 별도)
420
+
421
+ ### 자동 컨텍스트 주입 (Execute 파이프라인 통합)
422
+
423
+ `ges_execute { action: "start", spec: {...}, codeGraphRepoRoot: "/path" }` 호출 시 활성화.
424
+
425
+ 태스크 실행 시 `buildNextTaskContext()`가 자동으로:
426
+ 1. 태스크 title + description에서 키워드를 추출 (`extractKeywords()`)
427
+ 2. `codeGraphEngine.searchByKeywords()`로 관련 파일 최대 10개 검색
428
+ 3. `execute_task` 응답의 `suggestedFiles` 필드로 반환
429
+
430
+ Claude Code가 `suggestedFiles`를 받으면 해당 파일을 먼저 Read한 뒤 태스크를 수행한다 (`EXECUTE_EXECUTION_SYSTEM_PROMPT` 지시).
431
+
432
+ code-graph.db가 없거나 검색 실패 시 `suggestedFiles`는 undefined — 기존 동작 그대로 유지 (graceful fallback).
433
+
434
+ ### 스킬
435
+
436
+ | 스킬 | 파일 | 설명 |
437
+ |------|------|------|
438
+ | `/build-graph` | `skills/build-graph/SKILL.md` | 코드 그래프 빌드 및 증분 갱신 |
439
+ | `/blast-radius` | `skills/blast-radius/SKILL.md` (v1.1.0) | 영향범위 분석 (커밋 기준), 23개 트리거 |
440
+ | `/diff-radius` | `skills/diff-radius/SKILL.md` (v1.0.0) | 영향범위 분석 (미커밋 기준), staged/unstaged/all 지원 |
441
+
442
+ blast-radius 스킬은 "영향범위", "어디까지 영향받아", "사이드 이펙트", "리팩토링" 등 자연스러운 한국어 표현으로 자동 발동한다. CLAUDE.md나 훅과 달리 호출 시에만 토큰이 발생한다.
443
+
444
+ ### 언어 플러그인 (8개)
445
+
446
+ TypeScript/JavaScript, Python, Go, Java, Kotlin, Rust, Swift, Objective-C
447
+
448
+ 각 플러그인: `{ language, extensions[], parse(filePath) → {nodes, edges} }`
449
+ TypeScript 플러그인은 TypeScript Compiler API 사용 (Tree-sitter 불필요).
450
+
451
+ ### 주의사항
452
+ - `glob` 패키지 미사용 → `readdirSync({ recursive: true })`로 파일 수집, `Dirent.parentPath` 활용
453
+ - `noUncheckedIndexedAccess` 환경 → 배열 인덱스·regex 캡처그룹에 `!` 단언 필수
379
454
 
380
455
  ## Conventions
381
456
  - MCP 서버에서 `console.log` 사용 금지 → stderr(`log()` 유틸)
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tienne/gestalt",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "TypeScript AI Development Harness - Gestalt psychology-driven requirement clarification",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -48,6 +48,7 @@
48
48
  "jimp": "^1.6.0",
49
49
  "node-notifier": "^10.0.1",
50
50
  "node-pty": "^1.1.0",
51
+ "open": "^11.0.0",
51
52
  "openai": "^6.27.0",
52
53
  "react": "^19.2.4",
53
54
  "zod": "^3.24.2"
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: blast-radius
3
+ version: "1.1.0"
4
+ description: "코드 변경 전 영향 범위를 파악해 읽어야 할 파일만 컨텍스트에 제공한다. 변경 범위가 불확실하거나 사이드 이펙트가 걱정될 때 자동 발동한다."
5
+ triggers:
6
+ # 영향범위 확인 의도
7
+ - "영향범위"
8
+ - "영향범위 확인"
9
+ - "영향범위 얼마나 돼"
10
+ - "어디까지 영향받아"
11
+ - "어디 영향받아"
12
+ - "뭐가 깨질 수 있어"
13
+ - "어떤 파일 같이 봐야 해"
14
+ - "관련 파일 뭐 있어"
15
+ - "어디 의존하고 있어"
16
+ - "어디서 쓰이고 있어"
17
+ # 변경 전 안전 확인 의도
18
+ - "건드리기 전에"
19
+ - "수정 전에 확인"
20
+ - "수정 범위"
21
+ - "사이드 이펙트"
22
+ # 범위가 큰 변경 작업
23
+ - "시그니처 바꿔"
24
+ - "인터페이스 변경"
25
+ - "타입 바꿔"
26
+ - "리팩토링"
27
+ # 기존 영어 표현 유지
28
+ - "blast radius"
29
+ - "blast-radius"
30
+ - "impact analysis"
31
+ inputs:
32
+ repoRoot:
33
+ type: string
34
+ required: false
35
+ description: "Repository root path (defaults to current working directory)"
36
+ changedFiles:
37
+ type: string[]
38
+ required: false
39
+ description: "Changed file paths (auto-detected from git diff HEAD~1 if omitted)"
40
+ base:
41
+ type: string
42
+ required: false
43
+ description: "Git base ref for diff detection (default: HEAD~1)"
44
+ maxDepth:
45
+ type: number
46
+ required: false
47
+ description: "BFS traversal depth (default: 2)"
48
+ outputs:
49
+ - changedFiles
50
+ - impactedFiles
51
+ - riskScore
52
+ - summary
53
+ ---
54
+
55
+ # Blast Radius Skill
56
+
57
+ 최근 코드 변경의 영향 범위를 분석해 **읽어야 할 파일만** 컨텍스트에 제공합니다. 불필요한 파일 읽기를 줄여 LLM 토큰 사용을 최소화합니다.
58
+
59
+ ## 전제 조건
60
+
61
+ 코드 지식 그래프가 먼저 빌드되어 있어야 합니다:
62
+ ```
63
+ /build-graph
64
+ ```
65
+
66
+ ## 실행 방법
67
+
68
+ ### 기본 (마지막 커밋 변경 파일 자동 감지)
69
+
70
+ ```
71
+ ges_code_graph {
72
+ action: "blast_radius",
73
+ repoRoot: "<현재 디렉토리 절대 경로>"
74
+ }
75
+ ```
76
+
77
+ ### 변경 파일 직접 지정
78
+
79
+ ```
80
+ ges_code_graph {
81
+ action: "blast_radius",
82
+ repoRoot: "<경로>",
83
+ changedFiles: ["src/auth.ts", "src/middleware.ts"]
84
+ }
85
+ ```
86
+
87
+ ### Git base ref 지정
88
+
89
+ ```
90
+ ges_code_graph {
91
+ action: "blast_radius",
92
+ repoRoot: "<경로>",
93
+ base: "main"
94
+ }
95
+ ```
96
+
97
+ ## 결과 해석
98
+
99
+ | 필드 | 설명 |
100
+ |------|------|
101
+ | `changedFiles` | 변경된 파일 목록 |
102
+ | `impactedFiles` | 영향받는 파일 목록 (테스트 파일 우선 정렬) |
103
+ | `riskScore` | 위험도 점수 0~1 (전체 대비 영향 노드 비율) |
104
+ | `summary` | 한 줄 요약 |
105
+
106
+ ## Skill Instructions
107
+
108
+ 1. `repoRoot`가 주어지지 않으면 현재 작업 디렉토리를 절대 경로로 사용합니다.
109
+ 2. 코드 그래프 DB가 없으면 먼저 `/build-graph`를 실행하도록 안내합니다:
110
+ - `ges_code_graph { action: "db_exists", repoRoot: "<repoRoot>" }` 호출
111
+ - `exists: false`이면 빌드 먼저 안내
112
+ 3. `ges_code_graph { action: "blast_radius", repoRoot: "<repoRoot>", changedFiles?: [...], base?: "...", maxDepth?: 2 }` 호출합니다.
113
+ 4. 결과를 다음 형식으로 표시합니다:
114
+
115
+ ```
116
+ ## 영향범위 분석 결과
117
+
118
+ **변경된 파일** (N개):
119
+ - src/auth.ts
120
+ - src/middleware.ts
121
+
122
+ **영향받는 파일** (M개):
123
+ - src/auth.test.ts ← 테스트 파일 우선
124
+ - src/api/routes.ts
125
+ - src/api/middleware.ts
126
+
127
+ **위험도**: 0.23 (낮음)
128
+ **요약**: {summary}
129
+ ```
130
+
131
+ 5. `impactedFiles` 목록을 컨텍스트로 활용합니다:
132
+ - "아래 파일들이 영향을 받을 수 있습니다. 관련 작업 전 이 파일들을 먼저 읽어보겠습니다:" 형식으로 안내
133
+ - 파일이 많으면 (10개 이상) 가장 중요한 파일(테스트 파일, 핵심 모듈)을 우선 읽도록 제안
134
+ 6. 빌드된 그래프가 오래된 경우 `/build-graph --incremental` 실행을 권장합니다.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: build-graph
3
+ version: "1.0.0"
4
+ description: "Build a code knowledge graph for the current repository to enable blast-radius analysis"
5
+ triggers:
6
+ - "build graph"
7
+ - "build-graph"
8
+ - "index codebase"
9
+ - "build code graph"
10
+ inputs:
11
+ repoRoot:
12
+ type: string
13
+ required: false
14
+ description: "Repository root path (defaults to current working directory)"
15
+ include:
16
+ type: string[]
17
+ required: false
18
+ description: "Glob patterns to include (default: **/*)"
19
+ exclude:
20
+ type: string[]
21
+ required: false
22
+ description: "Glob patterns to exclude"
23
+ mode:
24
+ type: string
25
+ required: false
26
+ description: "Build mode: 'full' (default) or 'incremental' (hash-based, skip unchanged files)"
27
+ outputs:
28
+ - nodesBuilt
29
+ - edgesBuilt
30
+ - timeTakenMs
31
+ ---
32
+
33
+ # Build Graph Skill
34
+
35
+ 코드베이스를 정적 분석해 코드 지식 그래프를 빌드합니다. 이 그래프를 바탕으로 `/blast-radius` 스킬을 사용할 수 있습니다.
36
+
37
+ ## 목적
38
+
39
+ 코드 지식 그래프는 파일·함수·클래스 사이의 의존 관계를 SQLite DB(`.gestalt/code-graph.db`)에 저장합니다. 한 번 빌드해두면 `blast-radius` 분석으로 변경 영향 파일만 빠르게 조회할 수 있어 불필요한 파일 읽기를 크게 줄일 수 있습니다.
40
+
41
+ ## 지원 언어
42
+
43
+ TypeScript / JavaScript, Python, Go, Java, Kotlin, Rust, Swift, Objective-C
44
+
45
+ ## 실행 방법
46
+
47
+ ### 기본 (전체 빌드)
48
+
49
+ ```
50
+ ges_code_graph {
51
+ action: "build",
52
+ repoRoot: "<현재 디렉토리 절대 경로>"
53
+ }
54
+ ```
55
+
56
+ ### 증분 빌드 (변경 파일만 재파싱)
57
+
58
+ ```
59
+ ges_code_graph {
60
+ action: "build",
61
+ repoRoot: "<현재 디렉토리 절대 경로>",
62
+ mode: "incremental"
63
+ }
64
+ ```
65
+
66
+ ### 특정 디렉토리만 포함
67
+
68
+ ```
69
+ ges_code_graph {
70
+ action: "build",
71
+ repoRoot: "<경로>",
72
+ include: ["src/**", "lib/**"],
73
+ exclude: ["**/*.test.ts", "dist/**"]
74
+ }
75
+ ```
76
+
77
+ ## 빌드 후 통계 확인
78
+
79
+ ```
80
+ ges_code_graph {
81
+ action: "stats",
82
+ repoRoot: "<경로>"
83
+ }
84
+ ```
85
+
86
+ ## 결과 해석
87
+
88
+ | 필드 | 설명 |
89
+ |------|------|
90
+ | `nodesBuilt` | 인덱싱된 노드 수 (파일·함수·클래스·타입) |
91
+ | `edgesBuilt` | 인덱싱된 엣지 수 (호출·임포트·상속·포함 관계) |
92
+ | `timeTakenMs` | 소요 시간 (밀리초) |
93
+
94
+ ## Skill Instructions
95
+
96
+ 1. `repoRoot`가 주어지지 않으면 현재 작업 디렉토리(`cwd`)를 절대 경로로 사용합니다.
97
+ 2. `ges_code_graph { action: "build", repoRoot: "<repoRoot>", mode: "<mode>" }`를 호출합니다.
98
+ 3. 빌드 결과를 사용자에게 표시합니다.
99
+ 4. "그래프 빌드 완료! 이제 `/blast-radius`로 변경 영향 파일을 분석할 수 있습니다." 안내를 포함합니다.
100
+ 5. 오류가 발생하면 오류 내용을 표시하고 지원 언어인지 확인하도록 안내합니다.
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: diff-radius
3
+ version: "1.0.0"
4
+ description: "커밋 전 미저장·스테이징 변경의 영향범위를 분석한다. 작업 중인 코드가 어디까지 영향 주는지 바로 확인할 때 자동 발동한다."
5
+ triggers:
6
+ # 작업 중 변경 확인
7
+ - "지금 바꾼 거 영향범위"
8
+ - "작업 중인 거 영향범위"
9
+ - "저장한 거 영향범위"
10
+ - "수정 중인 거 영향범위"
11
+ - "아직 커밋 안 한 거 영향범위"
12
+ - "미커밋 영향범위"
13
+ # 스테이징 확인
14
+ - "스테이징된 거 영향범위"
15
+ - "staged 영향범위"
16
+ - "git add 한 거 영향범위"
17
+ # 커밋 전 안전 확인
18
+ - "커밋 전에 영향범위"
19
+ - "올리기 전에 영향범위"
20
+ - "푸시 전에 영향범위"
21
+ inputs:
22
+ repoRoot:
23
+ type: string
24
+ required: false
25
+ description: "Repository root path (defaults to current working directory)"
26
+ diffMode:
27
+ type: string
28
+ required: false
29
+ description: "staged: git diff --cached, unstaged: git diff, all: staged+unstaged (default)"
30
+ maxDepth:
31
+ type: number
32
+ required: false
33
+ description: "BFS traversal depth (default: 2)"
34
+ outputs:
35
+ - changedFiles
36
+ - impactedFiles
37
+ - riskScore
38
+ - summary
39
+ ---
40
+
41
+ # Diff Radius Skill
42
+
43
+ 커밋하지 않은 변경의 영향범위를 분석합니다. `/blast-radius`가 커밋 기준이라면, 이 스킬은 **지금 작업 중인 변경** 기준으로 동작합니다.
44
+
45
+ ## 전제 조건
46
+
47
+ 코드 지식 그래프가 먼저 빌드되어 있어야 합니다:
48
+ ```
49
+ /build-graph
50
+ ```
51
+
52
+ ## 실행 방법
53
+
54
+ ### 기본 (staged + unstaged 전체)
55
+
56
+ ```
57
+ ges_code_graph {
58
+ action: "diff_radius",
59
+ repoRoot: "<현재 디렉토리 절대 경로>"
60
+ }
61
+ ```
62
+
63
+ ### 스테이징된 변경만 (git add 한 것)
64
+
65
+ ```
66
+ ges_code_graph {
67
+ action: "diff_radius",
68
+ repoRoot: "<경로>",
69
+ diffMode: "staged"
70
+ }
71
+ ```
72
+
73
+ ### 아직 스테이징 안 된 변경만
74
+
75
+ ```
76
+ ges_code_graph {
77
+ action: "diff_radius",
78
+ repoRoot: "<경로>",
79
+ diffMode: "unstaged"
80
+ }
81
+ ```
82
+
83
+ ## blast-radius와 차이
84
+
85
+ | | `/blast-radius` | `/diff-radius` |
86
+ |---|---|---|
87
+ | 기준 | 마지막 커밋 (`HEAD~1`) | 현재 작업 중인 변경 |
88
+ | git 명령 | `git diff HEAD~1` | `git diff HEAD` / `git diff --cached` |
89
+ | 용도 | 배포된 변경 영향 확인 | 커밋 전 영향범위 사전 확인 |
90
+
91
+ ## 결과 해석
92
+
93
+ | 필드 | 설명 |
94
+ |------|------|
95
+ | `changedFiles` | 변경된 파일 목록 |
96
+ | `impactedFiles` | 영향받는 파일 목록 (테스트 파일 우선 정렬) |
97
+ | `riskScore` | 위험도 점수 0~1 |
98
+ | `summary` | 한 줄 요약 |
99
+
100
+ ## Skill Instructions
101
+
102
+ 1. `repoRoot`가 주어지지 않으면 현재 작업 디렉토리를 절대 경로로 사용합니다.
103
+ 2. 코드 그래프 DB가 없으면 먼저 `/build-graph`를 실행하도록 안내합니다:
104
+ - `ges_code_graph { action: "db_exists", repoRoot: "<repoRoot>" }` 호출
105
+ - `exists: false`이면 빌드 먼저 안내
106
+ 3. `ges_code_graph { action: "diff_radius", repoRoot: "<repoRoot>", diffMode?: "staged"|"unstaged"|"all", maxDepth?: 2 }` 호출합니다.
107
+ 4. 결과를 다음 형식으로 표시합니다:
108
+
109
+ ```
110
+ ## 영향범위 분석 결과 (미커밋 변경)
111
+
112
+ **변경된 파일** (N개):
113
+ - src/auth.ts
114
+ - src/middleware.ts
115
+
116
+ **영향받는 파일** (M개):
117
+ - src/auth.test.ts ← 테스트 파일 우선
118
+ - src/api/routes.ts
119
+
120
+ **위험도**: 0.23 (낮음)
121
+ **요약**: {summary}
122
+ ```
123
+
124
+ 5. `impactedFiles` 목록을 컨텍스트로 활용합니다.
125
+ 6. 변경된 파일이 없으면 "현재 미커밋 변경이 없습니다." 안내합니다.
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: setup
3
+ version: "1.0.0"
4
+ description: "Gestalt 프로젝트 초기 설정 — gestalt.json 생성, 코드 그래프 빌드, post-commit 훅 설치"
5
+ triggers:
6
+ - "gestalt 초기화"
7
+ - "gestalt init"
8
+ - "gestalt setup"
9
+ - "setup gestalt"
10
+ - "프로젝트 설정"
11
+ inputs:
12
+ cwd:
13
+ type: string
14
+ required: false
15
+ description: "초기화할 프로젝트 디렉토리 (기본값: 현재 디렉토리)"
16
+ outputs:
17
+ - gestalt.json
18
+ - code-graph.db
19
+ - post-commit hook
20
+ ---
21
+
22
+ # Setup Skill
23
+
24
+ `gestalt init` 명령어와 동일한 초기화 작업을 Claude Code 스킬로 실행한다.
25
+
26
+ ## 실행 단계
27
+
28
+ 1. **선택 화면**: `AskUserQuestion`으로 실행할 단계를 다중 선택
29
+ 2. **gestalt.json 생성**: 프로젝트 루트에 기본 설정 파일 생성
30
+ 3. **코드 그래프 빌드**: `ges_code_graph { action: "build" }`로 의존성 그래프 구축
31
+ 4. **post-commit 훅 설치**: `gestalt init --skip-graph --skip-hook`을 활용해 훅만 설치
32
+
33
+ ---
34
+
35
+ ## 실행 방법
36
+
37
+ ### Step 1 — 실행할 단계 선택
38
+
39
+ `AskUserQuestion`으로 다음 질문을 표시한다. **3개 모두 기본 선택**으로 제시한다.
40
+
41
+ ```
42
+ 질문: "실행할 초기화 단계를 선택하세요 (기본: 전체)"
43
+ multiSelect: true
44
+ 옵션:
45
+ - label: "gestalt.json 생성 (Recommended)"
46
+ description: "프로젝트 루트에 gestalt.json 설정 파일을 생성합니다"
47
+ - label: "코드 그래프 빌드 (Recommended)"
48
+ description: "코드베이스를 분석해 의존성 그래프를 구축합니다 (시간이 걸릴 수 있음)"
49
+ - label: "post-commit 훅 설치 (Recommended)"
50
+ description: "커밋 시 코드 그래프를 자동으로 갱신하는 git 훅을 설치합니다"
51
+ ```
52
+
53
+ 선택된 항목에 따라 아래 단계를 순서대로 실행한다. 아무것도 선택하지 않으면 중단한다.
54
+
55
+ ---
56
+
57
+ ### Step 2 — gestalt.json 생성 (선택된 경우)
58
+
59
+ 프로젝트 루트에 `gestalt.json`이 이미 존재하는지 확인한다.
60
+
61
+ **파일이 없으면**: Bash로 생성한다.
62
+
63
+ ```bash
64
+ ! pnpm tsx bin/gestalt.ts setup
65
+ ```
66
+
67
+ 또는 npx로 설치된 환경이면:
68
+
69
+ ```bash
70
+ ! npx @tienne/gestalt setup
71
+ ```
72
+
73
+ **파일이 이미 존재하면**: 사용자에게 덮어쓸지 확인 후 진행한다.
74
+
75
+ 성공 시 출력:
76
+ ```
77
+ ✓ gestalt.json 생성 완료
78
+ ```
79
+
80
+ ---
81
+
82
+ ### Step 3 — 코드 그래프 빌드 (선택된 경우)
83
+
84
+ `ges_code_graph` MCP 툴을 사용한다.
85
+
86
+ ```
87
+ ges_code_graph({ action: "build", repoRoot: "<현재 디렉토리 절대경로>" })
88
+ ```
89
+
90
+ 응답 예시:
91
+ ```json
92
+ { "nodesBuilt": 1192, "edgesBuilt": 1321, "timeTakenMs": 4200 }
93
+ ```
94
+
95
+ 성공 시 출력:
96
+ ```
97
+ ✓ 코드 그래프 빌드 완료: 노드 {nodesBuilt}개, 엣지 {edgesBuilt}개 ({timeTakenMs}ms)
98
+ ```
99
+
100
+ 실패해도 다음 단계를 계속 진행한다 (non-fatal).
101
+
102
+ ---
103
+
104
+ ### Step 4 — post-commit 훅 설치 (선택된 경우)
105
+
106
+ ```bash
107
+ ! pnpm tsx bin/gestalt.ts init --skip-graph
108
+ ```
109
+
110
+ 또는:
111
+
112
+ ```bash
113
+ ! npx @tienne/gestalt init --skip-graph
114
+ ```
115
+
116
+ 성공 시 출력:
117
+ ```
118
+ ✓ post-commit 훅 설치 완료
119
+ ```
120
+
121
+ ---
122
+
123
+ ### Step 5 — 완료 메시지
124
+
125
+ 선택된 모든 단계 완료 후:
126
+
127
+ ```
128
+ Gestalt 초기화 완료!
129
+
130
+ 완료된 단계:
131
+ ✓ gestalt.json 생성
132
+ ✓ 코드 그래프 빌드 (노드 1192개, 엣지 1321개)
133
+ ✓ post-commit 훅 설치
134
+
135
+ 이제 다음 스킬을 바로 사용할 수 있습니다:
136
+ /gestalt:interview — 요구사항 인터뷰
137
+ /build-graph — 코드 그래프 갱신
138
+ /blast-radius — 영향 범위 분석
139
+ ```
140
+
141
+ ---
142
+
143
+ ## 에러 처리
144
+
145
+ | 상황 | 대응 |
146
+ |------|------|
147
+ | `gestalt.json` 이미 존재 | 덮어쓸지 확인 후 진행 |
148
+ | 코드 그래프 빌드 실패 | 경고 출력 후 다음 단계 계속 |
149
+ | git 저장소 아님 | post-commit 훅 설치 건너뜀 + 안내 |
150
+ | CLI 명령어 없음 | `pnpm add @tienne/gestalt` 안내 |
@@ -0,0 +1,11 @@
1
+ export interface GraphVisualizeOptions {
2
+ repoRoot?: string;
3
+ port?: number;
4
+ noBrowser?: boolean;
5
+ }
6
+ /**
7
+ * CLI entry point for `gestalt graph-visualize`.
8
+ * Starts the visualization server and keeps the process alive until Ctrl+C.
9
+ */
10
+ export declare function graphVisualizeCommand(opts?: GraphVisualizeOptions): Promise<void>;
11
+ //# sourceMappingURL=graph-visualize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-visualize.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/graph-visualize.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB3F"}
@@ -0,0 +1,26 @@
1
+ import { resolve } from 'node:path';
2
+ import { GraphVisualizationEngine } from '../../graph-viz/engine.js';
3
+ /**
4
+ * CLI entry point for `gestalt graph-visualize`.
5
+ * Starts the visualization server and keeps the process alive until Ctrl+C.
6
+ */
7
+ export async function graphVisualizeCommand(opts = {}) {
8
+ const repoRoot = resolve(opts.repoRoot ?? process.cwd());
9
+ const port = opts.port ? Number(opts.port) : undefined;
10
+ const openBrowser = !opts.noBrowser;
11
+ const engine = new GraphVisualizationEngine();
12
+ try {
13
+ const result = await engine.start({ repoRoot, port, openBrowser });
14
+ console.log(`\nGraph visualization running at: ${result.url}`);
15
+ console.log(`${result.message}`);
16
+ console.log('\nPress Ctrl+C to stop the server.\n');
17
+ // Keep process alive until SIGINT (the server's own SIGINT handler will exit)
18
+ await new Promise(() => { });
19
+ }
20
+ catch (err) {
21
+ const msg = err instanceof Error ? err.message : String(err);
22
+ console.error(`Error starting graph visualization: ${msg}`);
23
+ process.exit(1);
24
+ }
25
+ }
26
+ //# sourceMappingURL=graph-visualize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-visualize.js","sourceRoot":"","sources":["../../../../src/cli/commands/graph-visualize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAQrE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAA8B,EAAE;IAC1E,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvD,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;IAEpC,MAAM,MAAM,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAE9C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,qCAAqC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QAEpD,8EAA8E;QAC9E,MAAM,IAAI,OAAO,CAAO,GAAG,EAAE,GAA2B,CAAC,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,KAAK,CAAC,uCAAuC,GAAG,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function initCommand(options: {
2
+ skipGraph?: boolean;
3
+ skipHook?: boolean;
4
+ }): Promise<void>;
5
+ //# sourceMappingURL=init.d.ts.map