intentpatch 0.0.0-stage → 0.1.1

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 (244) hide show
  1. package/LICENSE +21 -0
  2. package/README.ko.md +470 -0
  3. package/README.md +436 -2
  4. package/dist/application/ports/analysis-rule.d.ts +23 -0
  5. package/dist/application/ports/analysis-rule.d.ts.map +1 -0
  6. package/dist/application/ports/analysis-rule.js +2 -0
  7. package/dist/application/ports/analysis-rule.js.map +1 -0
  8. package/dist/application/ports/change-impact-analyzer.d.ts +6 -0
  9. package/dist/application/ports/change-impact-analyzer.d.ts.map +1 -0
  10. package/dist/application/ports/change-impact-analyzer.js +2 -0
  11. package/dist/application/ports/change-impact-analyzer.js.map +1 -0
  12. package/dist/application/ports/change-source.d.ts +10 -0
  13. package/dist/application/ports/change-source.d.ts.map +1 -0
  14. package/dist/application/ports/change-source.js +2 -0
  15. package/dist/application/ports/change-source.js.map +1 -0
  16. package/dist/application/ports/code-structure-analyzer.d.ts +6 -0
  17. package/dist/application/ports/code-structure-analyzer.d.ts.map +1 -0
  18. package/dist/application/ports/code-structure-analyzer.js +2 -0
  19. package/dist/application/ports/code-structure-analyzer.js.map +1 -0
  20. package/dist/application/ports/code-structure-extractor.d.ts +33 -0
  21. package/dist/application/ports/code-structure-extractor.d.ts.map +1 -0
  22. package/dist/application/ports/code-structure-extractor.js +2 -0
  23. package/dist/application/ports/code-structure-extractor.js.map +1 -0
  24. package/dist/application/ports/file-snapshot-source.d.ts +10 -0
  25. package/dist/application/ports/file-snapshot-source.d.ts.map +1 -0
  26. package/dist/application/ports/file-snapshot-source.js +2 -0
  27. package/dist/application/ports/file-snapshot-source.js.map +1 -0
  28. package/dist/application/ports/module-reference-extractor.d.ts +13 -0
  29. package/dist/application/ports/module-reference-extractor.d.ts.map +1 -0
  30. package/dist/application/ports/module-reference-extractor.js +2 -0
  31. package/dist/application/ports/module-reference-extractor.js.map +1 -0
  32. package/dist/application/ports/project-file-source.d.ts +16 -0
  33. package/dist/application/ports/project-file-source.d.ts.map +1 -0
  34. package/dist/application/ports/project-file-source.js +2 -0
  35. package/dist/application/ports/project-file-source.js.map +1 -0
  36. package/dist/application/ports/source-symbol-extractor.d.ts +14 -0
  37. package/dist/application/ports/source-symbol-extractor.d.ts.map +1 -0
  38. package/dist/application/ports/source-symbol-extractor.js +2 -0
  39. package/dist/application/ports/source-symbol-extractor.js.map +1 -0
  40. package/dist/application/ports/symbol-change-analyzer.d.ts +6 -0
  41. package/dist/application/ports/symbol-change-analyzer.d.ts.map +1 -0
  42. package/dist/application/ports/symbol-change-analyzer.js +2 -0
  43. package/dist/application/ports/symbol-change-analyzer.js.map +1 -0
  44. package/dist/application/ports/test-change-analyzer.d.ts +6 -0
  45. package/dist/application/ports/test-change-analyzer.d.ts.map +1 -0
  46. package/dist/application/ports/test-change-analyzer.js +2 -0
  47. package/dist/application/ports/test-change-analyzer.js.map +1 -0
  48. package/dist/application/rules/change-budget-rule.d.ts +7 -0
  49. package/dist/application/rules/change-budget-rule.d.ts.map +1 -0
  50. package/dist/application/rules/change-budget-rule.js +42 -0
  51. package/dist/application/rules/change-budget-rule.js.map +1 -0
  52. package/dist/application/rules/duplicate-implementation-rule.d.ts +7 -0
  53. package/dist/application/rules/duplicate-implementation-rule.d.ts.map +1 -0
  54. package/dist/application/rules/duplicate-implementation-rule.js +20 -0
  55. package/dist/application/rules/duplicate-implementation-rule.js.map +1 -0
  56. package/dist/application/rules/expected-scope-rule.d.ts +7 -0
  57. package/dist/application/rules/expected-scope-rule.d.ts.map +1 -0
  58. package/dist/application/rules/expected-scope-rule.js +27 -0
  59. package/dist/application/rules/expected-scope-rule.js.map +1 -0
  60. package/dist/application/rules/missing-test-change-rule.d.ts +7 -0
  61. package/dist/application/rules/missing-test-change-rule.d.ts.map +1 -0
  62. package/dist/application/rules/missing-test-change-rule.js +25 -0
  63. package/dist/application/rules/missing-test-change-rule.js.map +1 -0
  64. package/dist/application/rules/package-dependency-rule.d.ts +13 -0
  65. package/dist/application/rules/package-dependency-rule.d.ts.map +1 -0
  66. package/dist/application/rules/package-dependency-rule.js +174 -0
  67. package/dist/application/rules/package-dependency-rule.js.map +1 -0
  68. package/dist/application/rules/public-api-compatibility-rule.d.ts +7 -0
  69. package/dist/application/rules/public-api-compatibility-rule.d.ts.map +1 -0
  70. package/dist/application/rules/public-api-compatibility-rule.js +92 -0
  71. package/dist/application/rules/public-api-compatibility-rule.js.map +1 -0
  72. package/dist/application/rules/public-api-removal-rule.d.ts +7 -0
  73. package/dist/application/rules/public-api-removal-rule.d.ts.map +1 -0
  74. package/dist/application/rules/public-api-removal-rule.js +45 -0
  75. package/dist/application/rules/public-api-removal-rule.js.map +1 -0
  76. package/dist/application/rules/single-implementation-abstraction-rule.d.ts +7 -0
  77. package/dist/application/rules/single-implementation-abstraction-rule.d.ts.map +1 -0
  78. package/dist/application/rules/single-implementation-abstraction-rule.js +20 -0
  79. package/dist/application/rules/single-implementation-abstraction-rule.js.map +1 -0
  80. package/dist/application/services/analyze-code-structure.d.ts +14 -0
  81. package/dist/application/services/analyze-code-structure.d.ts.map +1 -0
  82. package/dist/application/services/analyze-code-structure.js +113 -0
  83. package/dist/application/services/analyze-code-structure.js.map +1 -0
  84. package/dist/application/services/analyze-import-impact.d.ts +14 -0
  85. package/dist/application/services/analyze-import-impact.d.ts.map +1 -0
  86. package/dist/application/services/analyze-import-impact.js +142 -0
  87. package/dist/application/services/analyze-import-impact.js.map +1 -0
  88. package/dist/application/services/analyze-test-changes.d.ts +8 -0
  89. package/dist/application/services/analyze-test-changes.d.ts.map +1 -0
  90. package/dist/application/services/analyze-test-changes.js +41 -0
  91. package/dist/application/services/analyze-test-changes.js.map +1 -0
  92. package/dist/application/services/compare-source-symbols.d.ts +13 -0
  93. package/dist/application/services/compare-source-symbols.d.ts.map +1 -0
  94. package/dist/application/services/compare-source-symbols.js +103 -0
  95. package/dist/application/services/compare-source-symbols.js.map +1 -0
  96. package/dist/application/services/path-pattern.d.ts +3 -0
  97. package/dist/application/services/path-pattern.d.ts.map +1 -0
  98. package/dist/application/services/path-pattern.js +34 -0
  99. package/dist/application/services/path-pattern.js.map +1 -0
  100. package/dist/application/services/rule-engine.d.ts +9 -0
  101. package/dist/application/services/rule-engine.d.ts.map +1 -0
  102. package/dist/application/services/rule-engine.js +13 -0
  103. package/dist/application/services/rule-engine.js.map +1 -0
  104. package/dist/application/use-cases/analyze-changes.d.ts +28 -0
  105. package/dist/application/use-cases/analyze-changes.d.ts.map +1 -0
  106. package/dist/application/use-cases/analyze-changes.js +88 -0
  107. package/dist/application/use-cases/analyze-changes.js.map +1 -0
  108. package/dist/domain/change-contract.d.ts +33 -0
  109. package/dist/domain/change-contract.d.ts.map +1 -0
  110. package/dist/domain/change-contract.js +76 -0
  111. package/dist/domain/change-contract.js.map +1 -0
  112. package/dist/domain/change.d.ts +37 -0
  113. package/dist/domain/change.d.ts.map +1 -0
  114. package/dist/domain/change.js +61 -0
  115. package/dist/domain/change.js.map +1 -0
  116. package/dist/domain/code-structure.d.ts +38 -0
  117. package/dist/domain/code-structure.d.ts.map +1 -0
  118. package/dist/domain/code-structure.js +63 -0
  119. package/dist/domain/code-structure.js.map +1 -0
  120. package/dist/domain/finding.d.ts +24 -0
  121. package/dist/domain/finding.d.ts.map +1 -0
  122. package/dist/domain/finding.js +30 -0
  123. package/dist/domain/finding.js.map +1 -0
  124. package/dist/domain/impact.d.ts +45 -0
  125. package/dist/domain/impact.d.ts.map +1 -0
  126. package/dist/domain/impact.js +60 -0
  127. package/dist/domain/impact.js.map +1 -0
  128. package/dist/domain/report.d.ts +22 -0
  129. package/dist/domain/report.d.ts.map +1 -0
  130. package/dist/domain/report.js +2 -0
  131. package/dist/domain/report.js.map +1 -0
  132. package/dist/domain/symbol-change.d.ts +60 -0
  133. package/dist/domain/symbol-change.d.ts.map +1 -0
  134. package/dist/domain/symbol-change.js +79 -0
  135. package/dist/domain/symbol-change.js.map +1 -0
  136. package/dist/domain/test-change.d.ts +29 -0
  137. package/dist/domain/test-change.d.ts.map +1 -0
  138. package/dist/domain/test-change.js +35 -0
  139. package/dist/domain/test-change.js.map +1 -0
  140. package/dist/infrastructure/config/json-change-contract-loader.d.ts +6 -0
  141. package/dist/infrastructure/config/json-change-contract-loader.d.ts.map +1 -0
  142. package/dist/infrastructure/config/json-change-contract-loader.js +130 -0
  143. package/dist/infrastructure/config/json-change-contract-loader.js.map +1 -0
  144. package/dist/infrastructure/filesystem/repository-path.d.ts +3 -0
  145. package/dist/infrastructure/filesystem/repository-path.d.ts.map +1 -0
  146. package/dist/infrastructure/filesystem/repository-path.js +11 -0
  147. package/dist/infrastructure/filesystem/repository-path.js.map +1 -0
  148. package/dist/infrastructure/git/diff-parser.d.ts +3 -0
  149. package/dist/infrastructure/git/diff-parser.d.ts.map +1 -0
  150. package/dist/infrastructure/git/diff-parser.js +124 -0
  151. package/dist/infrastructure/git/diff-parser.js.map +1 -0
  152. package/dist/infrastructure/git/git-change-source.d.ts +13 -0
  153. package/dist/infrastructure/git/git-change-source.d.ts.map +1 -0
  154. package/dist/infrastructure/git/git-change-source.js +43 -0
  155. package/dist/infrastructure/git/git-change-source.js.map +1 -0
  156. package/dist/infrastructure/git/git-file-snapshot-source.d.ts +14 -0
  157. package/dist/infrastructure/git/git-file-snapshot-source.d.ts.map +1 -0
  158. package/dist/infrastructure/git/git-file-snapshot-source.js +87 -0
  159. package/dist/infrastructure/git/git-file-snapshot-source.js.map +1 -0
  160. package/dist/infrastructure/git/git-project-file-source.d.ts +16 -0
  161. package/dist/infrastructure/git/git-project-file-source.d.ts.map +1 -0
  162. package/dist/infrastructure/git/git-project-file-source.js +113 -0
  163. package/dist/infrastructure/git/git-project-file-source.js.map +1 -0
  164. package/dist/infrastructure/git/untracked-file-collector.d.ts +4 -0
  165. package/dist/infrastructure/git/untracked-file-collector.d.ts.map +1 -0
  166. package/dist/infrastructure/git/untracked-file-collector.js +52 -0
  167. package/dist/infrastructure/git/untracked-file-collector.js.map +1 -0
  168. package/dist/infrastructure/process/command-runner.d.ts +17 -0
  169. package/dist/infrastructure/process/command-runner.d.ts.map +1 -0
  170. package/dist/infrastructure/process/command-runner.js +35 -0
  171. package/dist/infrastructure/process/command-runner.js.map +1 -0
  172. package/dist/infrastructure/typescript/parse-typescript-source.d.ts +11 -0
  173. package/dist/infrastructure/typescript/parse-typescript-source.d.ts.map +1 -0
  174. package/dist/infrastructure/typescript/parse-typescript-source.js +31 -0
  175. package/dist/infrastructure/typescript/parse-typescript-source.js.map +1 -0
  176. package/dist/infrastructure/typescript/typescript-code-structure-extractor.d.ts +7 -0
  177. package/dist/infrastructure/typescript/typescript-code-structure-extractor.d.ts.map +1 -0
  178. package/dist/infrastructure/typescript/typescript-code-structure-extractor.js +80 -0
  179. package/dist/infrastructure/typescript/typescript-code-structure-extractor.js.map +1 -0
  180. package/dist/infrastructure/typescript/typescript-module-reference-extractor.d.ts +7 -0
  181. package/dist/infrastructure/typescript/typescript-module-reference-extractor.d.ts.map +1 -0
  182. package/dist/infrastructure/typescript/typescript-module-reference-extractor.js +37 -0
  183. package/dist/infrastructure/typescript/typescript-module-reference-extractor.js.map +1 -0
  184. package/dist/infrastructure/typescript/typescript-symbol-extractor.d.ts +7 -0
  185. package/dist/infrastructure/typescript/typescript-symbol-extractor.d.ts.map +1 -0
  186. package/dist/infrastructure/typescript/typescript-symbol-extractor.js +206 -0
  187. package/dist/infrastructure/typescript/typescript-symbol-extractor.js.map +1 -0
  188. package/dist/presentation/analyze-repository.d.ts +10 -0
  189. package/dist/presentation/analyze-repository.d.ts.map +1 -0
  190. package/dist/presentation/analyze-repository.js +55 -0
  191. package/dist/presentation/analyze-repository.js.map +1 -0
  192. package/dist/presentation/cli/arguments.d.ts +26 -0
  193. package/dist/presentation/cli/arguments.d.ts.map +1 -0
  194. package/dist/presentation/cli/arguments.js +120 -0
  195. package/dist/presentation/cli/arguments.js.map +1 -0
  196. package/dist/presentation/cli/failure-policy.d.ts +3 -0
  197. package/dist/presentation/cli/failure-policy.d.ts.map +1 -0
  198. package/dist/presentation/cli/failure-policy.js +5 -0
  199. package/dist/presentation/cli/failure-policy.js.map +1 -0
  200. package/dist/presentation/cli/main.d.ts +3 -0
  201. package/dist/presentation/cli/main.d.ts.map +1 -0
  202. package/dist/presentation/cli/main.js +71 -0
  203. package/dist/presentation/cli/main.js.map +1 -0
  204. package/dist/presentation/cli/report-file-writer.d.ts +3 -0
  205. package/dist/presentation/cli/report-file-writer.d.ts.map +1 -0
  206. package/dist/presentation/cli/report-file-writer.js +9 -0
  207. package/dist/presentation/cli/report-file-writer.js.map +1 -0
  208. package/dist/presentation/cli/report-formatter.d.ts +5 -0
  209. package/dist/presentation/cli/report-formatter.d.ts.map +1 -0
  210. package/dist/presentation/cli/report-formatter.js +14 -0
  211. package/dist/presentation/cli/report-formatter.js.map +1 -0
  212. package/dist/presentation/cli/text-report.d.ts +3 -0
  213. package/dist/presentation/cli/text-report.d.ts.map +1 -0
  214. package/dist/presentation/cli/text-report.js +151 -0
  215. package/dist/presentation/cli/text-report.js.map +1 -0
  216. package/dist/presentation/github/action-inputs.d.ts +14 -0
  217. package/dist/presentation/github/action-inputs.d.ts.map +1 -0
  218. package/dist/presentation/github/action-inputs.js +24 -0
  219. package/dist/presentation/github/action-inputs.js.map +1 -0
  220. package/dist/presentation/github/action-main.d.ts +3 -0
  221. package/dist/presentation/github/action-main.d.ts.map +1 -0
  222. package/dist/presentation/github/action-main.js +20 -0
  223. package/dist/presentation/github/action-main.js.map +1 -0
  224. package/dist/presentation/github/action-runtime.d.ts +22 -0
  225. package/dist/presentation/github/action-runtime.d.ts.map +1 -0
  226. package/dist/presentation/github/action-runtime.js +58 -0
  227. package/dist/presentation/github/action-runtime.js.map +1 -0
  228. package/dist/presentation/github/comparison.d.ts +11 -0
  229. package/dist/presentation/github/comparison.d.ts.map +1 -0
  230. package/dist/presentation/github/comparison.js +35 -0
  231. package/dist/presentation/github/comparison.js.map +1 -0
  232. package/dist/presentation/github/markdown-summary.d.ts +4 -0
  233. package/dist/presentation/github/markdown-summary.d.ts.map +1 -0
  234. package/dist/presentation/github/markdown-summary.js +47 -0
  235. package/dist/presentation/github/markdown-summary.js.map +1 -0
  236. package/dist/presentation/github/run-action.d.ts +7 -0
  237. package/dist/presentation/github/run-action.d.ts.map +1 -0
  238. package/dist/presentation/github/run-action.js +81 -0
  239. package/dist/presentation/github/run-action.js.map +1 -0
  240. package/dist/presentation/html/html-report.d.ts +4 -0
  241. package/dist/presentation/html/html-report.d.ts.map +1 -0
  242. package/dist/presentation/html/html-report.js +362 -0
  243. package/dist/presentation/html/html-report.js.map +1 -0
  244. package/package.json +57 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IntentPatch contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ko.md ADDED
@@ -0,0 +1,470 @@
1
+ # IntentPatch
2
+
3
+ [English](./README.md) | **한국어**
4
+
5
+ [![CI](https://github.com/xx2xxjaeil/intent-patch/actions/workflows/ci.yml/badge.svg)](https://github.com/xx2xxjaeil/intent-patch/actions/workflows/ci.yml)
6
+
7
+ > AI 코딩 에이전트가 만든 변경을 근거 중심으로 분석하는 오픈소스 도구
8
+
9
+ Codex, Claude Code, Cursor 같은 AI 코딩 에이전트는 짧은 요청만으로 여러 파일을 빠르게
10
+ 수정합니다. 하지만 변경된 파일이 많아질수록 다음 질문에 답하기 어려워집니다.
11
+
12
+ - 요청한 범위보다 많은 파일을 수정하지 않았는가?
13
+ - 기존 코드를 재사용하지 않고 비슷한 로직을 새로 만들지 않았는가?
14
+ - 불필요한 라이브러리나 추상화를 추가하지 않았는가?
15
+ - 이번 변경이 다른 모듈에 어디까지 영향을 주는가?
16
+ - 중요한 동작에 대한 테스트가 함께 추가되었는가?
17
+
18
+ IntentPatch는 이러한 질문에 답하기 위해 **Git diff, 정적 분석, 의존 관계 분석**을 결합합니다.
19
+ LLM 없이도 재현 가능한 분석을 제공하고, AI 설명 기능은 선택적으로 결합하는 것을 목표로
20
+ 합니다.
21
+
22
+ ## 빠른 시작
23
+
24
+ Node.js 20 이상과 Git이 설치되어 있어야 합니다. 현재 npm 공개 전에는 저장소를 빌드해 바로
25
+ 실행할 수 있습니다.
26
+
27
+ ```bash
28
+ git clone https://github.com/xx2xxjaeil/intent-patch.git
29
+ cd intent-patch
30
+ npm ci
31
+ npm run build
32
+ node dist/presentation/cli/main.js --version
33
+ node dist/presentation/cli/main.js analyze --cwd /path/to/repository
34
+ ```
35
+
36
+ npm 릴리스가 공개된 뒤에는 설치 없이 같은 CLI를 실행할 수 있습니다.
37
+
38
+ ```bash
39
+ npx intentpatch analyze --cwd /path/to/repository
40
+ npx intentpatch analyze --format html --output intentpatch-report.html
41
+ ```
42
+
43
+ 핵심 분석에는 API key, 유료 AI 모델, 서버 또는 데이터베이스가 필요하지 않습니다. 분석할 Git
44
+ 저장소의 파일은 로컬에서 처리하며 LLM 연결은 현재 기본 실행 경로에 포함되지 않습니다.
45
+
46
+ ## GitHub Action
47
+
48
+ Pull Request에서 요청 범위와 위험 변경을 자동 검사할 수 있습니다. 정확한 base·head commit을
49
+ 사용하도록 checkout의 전체 히스토리를 가져와야 합니다.
50
+
51
+ ```yaml
52
+ name: IntentPatch
53
+
54
+ on:
55
+ pull_request:
56
+
57
+ permissions:
58
+ contents: read
59
+
60
+ jobs:
61
+ analyze:
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - uses: actions/checkout@v6
65
+ with:
66
+ fetch-depth: 0
67
+
68
+ - name: Analyze pull request
69
+ id: intentpatch
70
+ uses: xx2xxjaeil/intent-patch@main
71
+ with:
72
+ fail-on: high
73
+
74
+ - name: Upload reports
75
+ if: always()
76
+ uses: actions/upload-artifact@v4
77
+ with:
78
+ name: intentpatch-report
79
+ path: intentpatch-report
80
+ ```
81
+
82
+ 현재 개발 버전은 `@main`으로 실행합니다. 첫 번째 정식 릴리스 후에는 불변 SHA 또는 `@v1`
83
+ 태그로 고정하는 방식을 권장합니다. Action은 PR·push 이벤트의 commit 범위를 자동으로
84
+ 선택하고 다음 결과를 남깁니다.
85
+
86
+ - GitHub Actions Job Summary의 Markdown 보고서
87
+ - 심각도별 workflow annotation
88
+ - artifact 업로드에 사용할 JSON·HTML 보고서
89
+ - `high`, `medium`, `low` 기준의 품질 게이트
90
+ - finding 수와 보고서 경로 Action output
91
+
92
+ 입력·출력과 이벤트별 비교 기준은 [GitHub Action 사용 문서](./docs/github-action.md)에서
93
+ 확인할 수 있습니다.
94
+
95
+ ## 프로젝트가 지향하는 결과
96
+
97
+ ```text
98
+ IntentPatch Change Report
99
+
100
+ Target HEAD → working tree
101
+ Files changed 12
102
+ Lines +438 / -51
103
+ Direct dependents 2
104
+ Transitive impact 4
105
+ Tests changed 3
106
+ Missing test changes 1
107
+ New dependencies 2
108
+ Risky API changes 1
109
+ Duplicate candidates 1
110
+ Single implementations 1
111
+
112
+ Impacted files
113
+
114
+ → direct src/api/delete-user.ts
115
+ changed: src/lib/auth.ts
116
+ → transitive · 2 hops src/app.ts
117
+ changed: src/lib/auth.ts
118
+
119
+ Potential issues
120
+
121
+ HIGH 공개 함수 시그니처 호환성 파괴
122
+ MEDIUM 기존 인증 로직과 동일한 구현 발견
123
+ MEDIUM 요청과 관련성이 낮아 보이는 파일 4개 변경
124
+ LOW 구현체가 하나뿐인 추상화 추가
125
+ ```
126
+
127
+ 분석 결과는 단순한 경고 문구가 아니라 관련 파일, 규칙 ID, 판단 근거와 함께 제공하는 것을
128
+ 원칙으로 합니다.
129
+
130
+ ## 현재 구현된 기능
131
+
132
+ 현재 버전은 Git 변경사항 수집, 루트 `package.json`의 직접 dependency 분석, TypeScript
133
+ 최상위 심볼과 공개 API 변경 분석, 기존 구현 중복·단일 구현 추상화 신호, import graph 기반
134
+ 영향 범위와 테스트 동반 변경 분석을 제공합니다.
135
+
136
+ - `HEAD`와 현재 working tree 비교
137
+ - 두 Git reference 또는 브랜치 비교
138
+ - 추가, 수정, 삭제, 이름 변경 등 파일 상태 분류
139
+ - 파일별 추가·삭제 라인 수 계산
140
+ - binary 파일 구분
141
+ - working tree 분석 시 untracked 파일 포함
142
+ - 터미널용 텍스트 보고서
143
+ - 후속 도구 연동을 위한 JSON 보고서
144
+ - 요약 카드, finding, 테스트 신호와 영향 그래프를 담은 단일 HTML 보고서
145
+ - 외부 CDN이나 JavaScript dependency가 필요 없는 인라인 CSS·SVG 시각화
146
+ - production·development dependency 추가 탐지
147
+ - dependency 삭제, 버전 변경, 섹션 이동 탐지
148
+ - 잘못된 `package.json`을 예외 대신 근거가 포함된 finding으로 보고
149
+ - finding 심각도(`high`, `medium`, `low`) 집계
150
+ - CI 품질 게이트를 위한 `--fail-on` 종료 코드
151
+ - 설치된 패키지 버전을 확인하는 `--version` 명령
152
+ - `.ts`·`.tsx` 파일의 최상위 함수·클래스·인터페이스·타입 별칭 추출
153
+ - 심볼 추가·수정·삭제 탐지와 소스 위치 표시
154
+ - 직접 `export`된 선언, 로컬 export 목록과 외부 re-export를 공개 심볼 근거에 보존
155
+ - 공개 심볼 삭제와 `export` 해제를 호환성 위험 `high` finding으로 탐지
156
+ - 공개 함수의 기존 호출 시그니처 제거와 공개 인터페이스의 호환성 파괴를 `high` finding으로 탐지
157
+ - 구현이 추가된 기존 overload는 제외하고 기존 overload가 사라진 경우만 함수 계약 변경으로 판정
158
+ - 공백과 주석을 제외한 구현 토큰이 같은 신규 함수와 기존 함수를 재사용 후보 `medium` finding으로 탐지
159
+ - 신규 인터페이스를 명시적으로 구현하는 클래스가 하나뿐이면 추상화 검토 `low` finding으로 탐지
160
+ - rename 전후 파일 경로를 사용한 심볼 비교
161
+ - 구문 오류가 있는 파일을 누락시키지 않고 분석 불가 근거로 보고
162
+ - `.ts`·`.tsx` 파일의 상대 경로 정적 import와 re-export 관계 수집
163
+ - `.js`·`.jsx`·`.mjs`·`.cjs` specifier를 대응하는 TypeScript 소스로 해석
164
+ - 변경 모듈을 import하는 직접 의존자와 여러 단계를 거친 간접 영향 파일 계산
165
+ - 해결하지 못한 상대 import와 읽기·파싱 실패를 분석 근거로 보존
166
+ - working tree의 tracked·untracked 파일 또는 지정한 head ref를 동일한 결과점에서 분석
167
+ - `.intentpatch.json`에 요청 의도, 예상 경로, 허용 경로와 변경량 예산 선언
168
+ - 예상·허용 패턴을 벗어난 변경 파일을 파일별 `medium` finding으로 탐지
169
+ - 변경 파일 수와 측정 라인 예산 초과를 수치 근거가 있는 `low` finding으로 탐지
170
+ - Contract가 지정한 소스·테스트 경로를 분류하고 파일명 기준으로 관련 변경 연결
171
+ - 테스트 변경 수와 추가·삭제 수를 별도의 분석 사실로 집계
172
+ - 관련 테스트 변경이 없는 소스 파일을 `medium` finding으로 탐지
173
+ - `*`, `**`, `?` 기반의 저장소 상대 경로 패턴 지원
174
+ - Pull Request·push commit 범위를 자동 판별하는 GitHub Action
175
+ - GitHub Job Summary, workflow annotation, JSON·HTML artifact용 보고서 생성
176
+
177
+ 아직 lockfile의 전이 dependency 분석, path alias 해석, JavaScript·메서드 구조 분석과 AI 리뷰
178
+ 기능은 구현되지 않았습니다.
179
+
180
+ ## 상세 사용법
181
+
182
+ 현재 저장소의 working tree를 분석합니다.
183
+
184
+ ```bash
185
+ node dist/presentation/cli/main.js analyze
186
+ ```
187
+
188
+ 다른 Git 저장소를 분석할 수도 있습니다.
189
+
190
+ ```bash
191
+ node dist/presentation/cli/main.js analyze --cwd /path/to/repository
192
+ ```
193
+
194
+ 두 브랜치를 비교합니다. 내부적으로 merge base 기준의 변경사항을 분석합니다.
195
+
196
+ ```bash
197
+ node dist/presentation/cli/main.js analyze \
198
+ --cwd /path/to/repository \
199
+ --base main \
200
+ --head feature/account-deletion
201
+ ```
202
+
203
+ JSON으로 출력합니다.
204
+
205
+ ```bash
206
+ node dist/presentation/cli/main.js analyze --json
207
+ ```
208
+
209
+ 브라우저에서 볼 수 있는 HTML 보고서를 파일로 생성합니다.
210
+
211
+ ```bash
212
+ node dist/presentation/cli/main.js analyze \
213
+ --format html \
214
+ --output intentpatch-report.html
215
+ ```
216
+
217
+ HTML 파일에는 스타일과 dependency 영향 SVG 그래프가 모두 포함되므로 별도 서버나 API key 없이
218
+ 바로 열 수 있습니다. `--output`은 텍스트와 JSON 형식에도 사용할 수 있으며 상대 경로는
219
+ IntentPatch를 실행한 현재 디렉터리를 기준으로 해석합니다. 기존 `--json`은
220
+ `--format json`의 단축 옵션입니다.
221
+
222
+ ### Change Contract로 요청 범위 검사
223
+
224
+ 분석할 저장소의 `.intentpatch.json`에 이번 요청의 기대 범위를 선언할 수 있습니다.
225
+
226
+ ```json
227
+ {
228
+ "intent": "회원 탈퇴 기능 구현",
229
+ "scope": {
230
+ "include": ["src/user/**", "tests/user/**"],
231
+ "allow": ["package.json", "package-lock.json"],
232
+ "maxFiles": 8,
233
+ "maxLines": 300
234
+ },
235
+ "tests": {
236
+ "requireFor": ["src/**/*.ts", "src/**/*.tsx"],
237
+ "include": ["tests/**/*.test.ts", "tests/**/*.test.tsx"],
238
+ "exclude": ["src/**/*.d.ts"]
239
+ }
240
+ }
241
+ ```
242
+
243
+ - `include`: 요청 수행 중 변경될 것으로 예상한 경로
244
+ - `allow`: 설정이나 lockfile처럼 함께 변경되어도 허용하는 예외 경로
245
+ - `maxFiles`: 변경 파일 수의 상한
246
+ - `maxLines`: 측정 가능한 추가·삭제 라인 합의 상한
247
+ - `tests.requireFor`: 테스트 동반 변경을 확인할 소스 경로
248
+ - `tests.include`: 테스트 파일로 분류할 경로
249
+ - `tests.exclude`: 생성 파일이나 선언 파일처럼 검사에서 제외할 소스 경로
250
+
251
+ 테스트 연결은 결정적인 결과를 위해 파일명을 사용합니다. 예를 들어 `src/user.ts`는
252
+ `tests/user.test.ts`, `user.spec.ts`, `user.integration.test.ts` 같은 변경과 연결됩니다.
253
+
254
+ 기본 파일 대신 별도 계약을 사용하려면 `--config`를 지정합니다. 상대 경로는 `--cwd`를 기준으로
255
+ 해석합니다.
256
+
257
+ ```bash
258
+ node dist/presentation/cli/main.js analyze \
259
+ --cwd /path/to/repository \
260
+ --config contracts/delete-user.json
261
+ ```
262
+
263
+ 복사해서 시작할 수 있는 설정은 [`.intentpatch.example.json`](./.intentpatch.example.json)에
264
+ 있습니다. Contract가 없으면 기존 분석은 그대로 실행되고 scope 규칙만 비활성화됩니다.
265
+
266
+ 지정한 심각도 이상의 finding이 있으면 보고서를 출력한 뒤 종료 코드 `1`을 반환합니다.
267
+
268
+ ```bash
269
+ node dist/presentation/cli/main.js analyze --fail-on medium
270
+ ```
271
+
272
+ `medium`은 `medium`과 `high` finding에 반응하며, `low`를 지정하면 모든 finding을 품질
273
+ 게이트 대상으로 취급합니다. 잘못된 CLI 사용은 종료 코드 `2`를 반환합니다.
274
+
275
+ dependency 변경과 코드 영향 범위를 다음과 같이 근거와 함께 출력합니다.
276
+
277
+ ```text
278
+ IntentPatch Change Report
279
+
280
+ Files changed 2
281
+ Changed symbols 2
282
+ Import edges 18
283
+ Direct dependents 1
284
+ Transitive impact 2
285
+ Tests changed 1
286
+ Tests added 0
287
+ Missing test changes 1
288
+ New dependencies 1
289
+ Risky API changes 1
290
+ Duplicate candidates 1
291
+ Single implementations 1
292
+ Findings 6
293
+
294
+ Changed symbols
295
+
296
+ M Class UserService src/user/service.ts:12
297
+ A Function deleteUser src/user/service.ts:48
298
+
299
+ Impacted files
300
+
301
+ → direct src/api/delete-user.ts
302
+ changed: src/user/service.ts
303
+ → transitive · 2 hops src/app.ts
304
+ changed: src/user/service.ts
305
+
306
+ Potential issues
307
+
308
+ HIGH Public export removed
309
+ src/user/service.ts · api/export-removed
310
+ The function deleteUser is no longer exported.
311
+
312
+ MEDIUM New production dependency
313
+ package.json · dependency/new-production
314
+ dayjs@^1.11.0 was added to dependencies.
315
+
316
+ MEDIUM Change outside expected scope
317
+ src/payment/billing.ts · scope/outside-expected-path
318
+ src/payment/billing.ts does not match any expected or allowed path pattern.
319
+
320
+ MEDIUM Source change without matching test change
321
+ src/payment/billing.ts · tests/missing-related-change
322
+ src/payment/billing.ts changed without a changed test sharing the same basename.
323
+
324
+ MEDIUM New function duplicates existing implementation
325
+ src/user/service.ts · structure/duplicate-implementation
326
+ The new function verifySession has the same normalized implementation as authorize.
327
+
328
+ LOW New interface has one implementation
329
+ src/user/service.ts · structure/single-implementation-abstraction
330
+ The new interface DeletionStrategy is implemented only by DefaultDeletionStrategy.
331
+ ```
332
+
333
+ 개발 중에는 빌드 없이 실행할 수 있습니다.
334
+
335
+ ```bash
336
+ npm run dev -- analyze --cwd /path/to/repository
337
+ ```
338
+
339
+ ## 아키텍처
340
+
341
+ 기능이 늘어나도 Git, UI, 분석 규칙이 서로 강하게 결합되지 않도록 클린 아키텍처의 의존성
342
+ 방향을 적용했습니다.
343
+
344
+ ```text
345
+ presentation ───────▶ application ───────▶ domain
346
+ │ ▲
347
+ └──▶ infrastructure ──┘
348
+ ```
349
+
350
+ | 계층 | 책임 |
351
+ | --- | --- |
352
+ | `domain` | 변경 파일, Change Contract, finding, 심볼 변경, dependency 영향 등 핵심 모델 |
353
+ | `application` | 분석 유스케이스, 규칙 엔진, 심볼·영향 계산과 외부 데이터 포트 |
354
+ | `infrastructure` | Git 명령·diff 파싱·프로젝트 파일 공급·TypeScript AST 파싱 |
355
+ | `presentation` | CLI 인자 처리, 의존성 조립, 텍스트·JSON·HTML 출력 |
356
+
357
+ 하위 계층이 외부 구현을 참조하지 않도록 아키텍처 테스트가 import 방향을 검사합니다.
358
+ 구현상의 주요 판단과 확장 지점은 [상세 아키텍처 문서](./docs/architecture.md)에서 설명합니다.
359
+
360
+ ## 설계 원칙
361
+
362
+ - **Deterministic first:** 핵심 분석은 동일한 입력에 동일한 결과를 반환합니다.
363
+ - **Evidence over claims:** 확실하지 않은 판단을 사실처럼 단정하지 않습니다.
364
+ - **LLM optional:** AI 연결 없이도 기본 분석 기능을 사용할 수 있어야 합니다.
365
+ - **Dependency minimalism:** 편의를 위한 라이브러리를 무분별하게 추가하지 않습니다.
366
+ - **Explicit boundaries:** 도메인 로직과 Git·CLI 같은 외부 기술을 분리합니다.
367
+
368
+ ## 테스트와 품질 검사
369
+
370
+ ```bash
371
+ npm run check
372
+ ```
373
+
374
+ 위 명령은 다음 검사를 순서대로 실행합니다.
375
+
376
+ - 엄격한 TypeScript 타입 검사
377
+ - Biome 린트 및 포맷 검사
378
+ - 도메인과 유스케이스 단위 테스트
379
+ - 실제 임시 Git 저장소를 사용하는 통합 테스트
380
+ - 생성한 npm tarball을 임시 프로젝트에 설치하고 실행하는 패키지 통합 테스트
381
+ - 계층 간 의존 방향을 검증하는 아키텍처 테스트
382
+
383
+ 프로덕션 빌드만 확인하려면 다음 명령을 사용합니다.
384
+
385
+ ```bash
386
+ npm run build
387
+ ```
388
+
389
+ npm에 포함될 파일과 패키지 생성을 확인하려면 실제 공개 없이 dry-run을 실행합니다.
390
+
391
+ ```bash
392
+ npm pack --dry-run
393
+ ```
394
+
395
+ ## 릴리스
396
+
397
+ `v0.1.0`처럼 `package.json` 버전과 일치하는 태그를 기본 브랜치의 커밋에 push하면 릴리스
398
+ 워크플로가 다음 작업을 순서대로 수행합니다.
399
+
400
+ 1. 태그·버전·기본 브랜치 포함 여부 검증
401
+ 2. 전체 품질 검사와 npm 패키지 내용 dry-run
402
+ 3. npm Trusted Publishing(OIDC)을 이용한 공개 배포
403
+ 4. 자동 생성한 변경 내역을 포함하는 GitHub Release 생성
404
+
405
+ 장기 npm token을 GitHub secret으로 저장하지 않으며, 공개 저장소에서 OIDC로 배포한 패키지에는
406
+ npm provenance가 자동 생성됩니다. 아직 npm에 존재하지 않는 신규 패키지는 Trusted Publisher를
407
+ 연결하기 전에 최초 1회 등록이 필요합니다. 초기 등록과 이후 버전 배포 절차는
408
+ [릴리스 운영 가이드](./docs/releasing.md)에 정리했습니다.
409
+
410
+ ## 로드맵
411
+
412
+ 1. ✅ `package.json` 직접 dependency 변경 탐지와 규칙 엔진
413
+ 2. ✅ TypeScript AST 기반 함수·클래스·인터페이스·타입 변경 분석
414
+ 3. ✅ 상대 경로 정적 import graph 기반 변경 영향 범위 계산
415
+ 4. ✅ Change Contract 기반 예상 범위 이탈과 변경량 예산 탐지
416
+ 5. ✅ Contract 기반 관련 테스트 변경 누락 탐지
417
+ 6. lockfile과 workspace를 고려한 package manager adapter
418
+ 7. ✅ 직접 export된 공개 심볼 삭제와 export 해제 탐지
419
+ 8. ✅ 단일 HTML 대시보드와 SVG 기반 dependency 영향 그래프
420
+ 9. ✅ re-export·함수/인터페이스 호환성과 기존 코드 중복 가능성 탐지
421
+ 10. ✅ 구현체가 하나뿐인 신규 인터페이스 탐지
422
+ 11. ✅ PR·push 비교, Job Summary와 artifact 출력을 제공하는 GitHub Action
423
+ 12. Codex·Claude Code·Cursor adapter
424
+ 13. 근거 기반 결과에 대한 선택적 LLM 설명
425
+
426
+ ## 현재 제한사항
427
+
428
+ - 분석 대상은 최소 한 번 이상 커밋된 Git 저장소여야 합니다.
429
+ - untracked symbolic link는 안전을 위해 내용을 읽지 않습니다.
430
+ - 10 MiB를 초과하는 untracked 파일은 라인 수를 측정하지 않습니다.
431
+ - dependency 분석은 저장소 루트의 npm `package.json`에 선언된 `dependencies`와
432
+ `devDependencies`를 대상으로 합니다.
433
+ - lockfile의 전이 dependency, workspace package, 코드에서의 실제 사용 여부는 아직 분석하지 않습니다.
434
+ - 심볼 분석은 `.ts`와 `.tsx`의 이름이 있는 최상위 함수, 클래스, 인터페이스, 타입
435
+ 별칭만 지원합니다.
436
+ - 공개 API 분석은 이름이 있는 최상위 함수·인터페이스, 로컬 `export { name }`, 외부
437
+ `export { name } from`, `export * from`을 지원합니다. package `exports`, 익명 default export,
438
+ 클래스·타입 별칭의 세부 계약은 아직 해석하지 않습니다.
439
+ - 함수 호환성은 명시된 파라미터·반환 타입 텍스트를 비교합니다. 추론된 반환 타입 변화나
440
+ TypeScript의 구조적 타입 할당 가능성까지 판정하지 않습니다.
441
+ - 중복 구현 후보는 새로 추가된 최상위 함수와 기존 최상위 함수의 토큰이 공백·주석을 제외하고
442
+ 완전히 같으며 본문이 12토큰 이상일 때만 보고합니다. 식별자 이름이 바뀐 유사 코드, 메서드,
443
+ 의미적으로만 같은 구현은 탐지하지 않습니다.
444
+ - 단일 구현 추상화는 새 인터페이스를 `implements`로 명시한 이름 있는 클래스가 정확히 하나일 때만
445
+ 보고합니다. TypeScript의 구조적 구현, factory 반환 타입과 런타임 등록은 계산하지 않습니다.
446
+ - 메서드, 변수 선언, enum, 중첩 선언, JavaScript 파일은 아직 심볼 분석 대상이 아닙니다.
447
+ - 선언 내부의 포맷이나 주석 변경도 심볼 수정으로 집계될 수 있습니다.
448
+ - 영향 분석은 `.ts`·`.tsx` 파일의 상대 경로 정적 `import`, side-effect import,
449
+ `export ... from`, `import = require()`를 대상으로 합니다.
450
+ - 외부 package import는 그래프에서 제외하며 path alias, dynamic `import()`, 일반 `require()`는
451
+ 아직 해석하지 않습니다.
452
+ - 영향 그래프는 비교 결과점(working tree 또는 head ref)의 파일을 기준으로 만듭니다. 따라서
453
+ 삭제된 모듈을 가리키던 과거 import의 영향은 현재 단계에서 계산할 수 없습니다.
454
+ - 영향 분석용 소스 파일은 파일당 1 MiB로 제한하며, symbolic link는 읽지 않습니다.
455
+ - IntentPatch는 자연어 intent만으로 예상 경로를 추측하지 않습니다. 범위 판단은 Contract에 명시한
456
+ `include`와 `allow`를 기준으로 수행합니다.
457
+ - 경로 패턴은 저장소 상대 경로와 `*`, `**`, `?`만 지원합니다. 부정 패턴과 brace 확장은 아직
458
+ 지원하지 않습니다.
459
+ - `maxLines`는 측정 가능한 텍스트 파일의 추가·삭제 라인만 합산합니다. Binary와 측정 불가 파일을
460
+ 0줄이라고 간주하지 않지만, 해당 파일의 크기를 라인 예산에 포함하지도 않습니다.
461
+ - 테스트 분석은 실행 결과나 코드 커버리지를 측정하지 않고 Contract에 지정된 변경 파일만
462
+ 비교합니다.
463
+ - 관련 테스트는 현재 소스와 테스트의 파일명이 같은지로 판단하므로 이름이 다른 통합 테스트나
464
+ 하나의 테스트가 여러 소스를 검증하는 관계는 자동으로 연결하지 못합니다.
465
+ - HTML 영향 그래프는 변경 모듈과 영향 파일을 결정적인 두 열 레이아웃으로 표시합니다. 노드 이동,
466
+ 확대·축소와 필터링을 제공하는 대화형 웹 UI는 아직 구현하지 않았습니다.
467
+
468
+ ## 라이선스
469
+
470
+ [MIT](./LICENSE)