intentpatch 0.2.0 → 0.4.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 (126) hide show
  1. package/README.ko.md +66 -22
  2. package/README.md +48 -20
  3. package/dist/application/ports/module-reference-extractor.d.ts +1 -0
  4. package/dist/application/ports/module-reference-extractor.d.ts.map +1 -1
  5. package/dist/application/ports/parse-failure.d.ts +7 -0
  6. package/dist/application/ports/parse-failure.d.ts.map +1 -0
  7. package/dist/application/ports/parse-failure.js +5 -0
  8. package/dist/application/ports/parse-failure.js.map +1 -0
  9. package/dist/application/ports/pnpm-lock-parser.d.ts +20 -0
  10. package/dist/application/ports/pnpm-lock-parser.d.ts.map +1 -0
  11. package/dist/application/ports/pnpm-lock-parser.js +2 -0
  12. package/dist/application/ports/pnpm-lock-parser.js.map +1 -0
  13. package/dist/application/ports/pnpm-workspace-parser.d.ts +14 -0
  14. package/dist/application/ports/pnpm-workspace-parser.d.ts.map +1 -0
  15. package/dist/application/ports/pnpm-workspace-parser.js +2 -0
  16. package/dist/application/ports/pnpm-workspace-parser.js.map +1 -0
  17. package/dist/application/rules/added-dependency-usage-rule.d.ts +16 -0
  18. package/dist/application/rules/added-dependency-usage-rule.d.ts.map +1 -0
  19. package/dist/application/rules/added-dependency-usage-rule.js +89 -0
  20. package/dist/application/rules/added-dependency-usage-rule.js.map +1 -0
  21. package/dist/application/rules/npm-workspace-dependency-rule.d.ts.map +1 -1
  22. package/dist/application/rules/npm-workspace-dependency-rule.js +10 -58
  23. package/dist/application/rules/npm-workspace-dependency-rule.js.map +1 -1
  24. package/dist/application/rules/package-dependency-rule.d.ts.map +1 -1
  25. package/dist/application/rules/package-dependency-rule.js +1 -3
  26. package/dist/application/rules/package-dependency-rule.js.map +1 -1
  27. package/dist/application/rules/pnpm-lockfile-rule.d.ts +12 -0
  28. package/dist/application/rules/pnpm-lockfile-rule.d.ts.map +1 -0
  29. package/dist/application/rules/pnpm-lockfile-rule.js +119 -0
  30. package/dist/application/rules/pnpm-lockfile-rule.js.map +1 -0
  31. package/dist/application/rules/pnpm-workspace-dependency-rule.d.ts +12 -0
  32. package/dist/application/rules/pnpm-workspace-dependency-rule.d.ts.map +1 -0
  33. package/dist/application/rules/pnpm-workspace-dependency-rule.js +59 -0
  34. package/dist/application/rules/pnpm-workspace-dependency-rule.js.map +1 -0
  35. package/dist/application/services/analyze-import-impact.d.ts.map +1 -1
  36. package/dist/application/services/analyze-import-impact.js +27 -8
  37. package/dist/application/services/analyze-import-impact.js.map +1 -1
  38. package/dist/application/services/compare-source-symbols.d.ts.map +1 -1
  39. package/dist/application/services/compare-source-symbols.js +3 -0
  40. package/dist/application/services/compare-source-symbols.js.map +1 -1
  41. package/dist/application/services/is-maintained-source-path.d.ts +3 -0
  42. package/dist/application/services/is-maintained-source-path.d.ts.map +1 -0
  43. package/dist/application/services/is-maintained-source-path.js +14 -0
  44. package/dist/application/services/is-maintained-source-path.js.map +1 -0
  45. package/dist/application/services/workspace-manifest-analysis.d.ts +12 -0
  46. package/dist/application/services/workspace-manifest-analysis.d.ts.map +1 -0
  47. package/dist/application/services/workspace-manifest-analysis.js +60 -0
  48. package/dist/application/services/workspace-manifest-analysis.js.map +1 -0
  49. package/dist/domain/symbol-change.d.ts +1 -1
  50. package/dist/domain/symbol-change.d.ts.map +1 -1
  51. package/dist/domain/symbol-change.js +1 -0
  52. package/dist/domain/symbol-change.js.map +1 -1
  53. package/dist/domain/value-guards.d.ts +3 -0
  54. package/dist/domain/value-guards.d.ts.map +1 -0
  55. package/dist/domain/value-guards.js +5 -0
  56. package/dist/domain/value-guards.js.map +1 -0
  57. package/dist/infrastructure/config/json-change-contract-loader.d.ts.map +1 -1
  58. package/dist/infrastructure/config/json-change-contract-loader.js +1 -3
  59. package/dist/infrastructure/config/json-change-contract-loader.js.map +1 -1
  60. package/dist/infrastructure/config/text-intent-loader.d.ts +5 -0
  61. package/dist/infrastructure/config/text-intent-loader.d.ts.map +1 -0
  62. package/dist/infrastructure/config/text-intent-loader.js +30 -0
  63. package/dist/infrastructure/config/text-intent-loader.js.map +1 -0
  64. package/dist/infrastructure/git/git-file-snapshot-source.d.ts.map +1 -1
  65. package/dist/infrastructure/git/git-file-snapshot-source.js +3 -1
  66. package/dist/infrastructure/git/git-file-snapshot-source.js.map +1 -1
  67. package/dist/infrastructure/npm/npm-package-lock-parser.d.ts.map +1 -1
  68. package/dist/infrastructure/npm/npm-package-lock-parser.js +2 -6
  69. package/dist/infrastructure/npm/npm-package-lock-parser.js.map +1 -1
  70. package/dist/infrastructure/pnpm/pnpm-lock-parser.d.ts +6 -0
  71. package/dist/infrastructure/pnpm/pnpm-lock-parser.d.ts.map +1 -0
  72. package/dist/infrastructure/pnpm/pnpm-lock-parser.js +122 -0
  73. package/dist/infrastructure/pnpm/pnpm-lock-parser.js.map +1 -0
  74. package/dist/infrastructure/pnpm/pnpm-workspace-parser.d.ts +6 -0
  75. package/dist/infrastructure/pnpm/pnpm-workspace-parser.d.ts.map +1 -0
  76. package/dist/infrastructure/pnpm/pnpm-workspace-parser.js +62 -0
  77. package/dist/infrastructure/pnpm/pnpm-workspace-parser.js.map +1 -0
  78. package/dist/infrastructure/typescript/javascript-symbol-extractor.d.ts +7 -0
  79. package/dist/infrastructure/typescript/javascript-symbol-extractor.d.ts.map +1 -0
  80. package/dist/infrastructure/typescript/javascript-symbol-extractor.js +105 -0
  81. package/dist/infrastructure/typescript/javascript-symbol-extractor.js.map +1 -0
  82. package/dist/infrastructure/typescript/package-module-reference-extractor.d.ts +5 -0
  83. package/dist/infrastructure/typescript/package-module-reference-extractor.d.ts.map +1 -0
  84. package/dist/infrastructure/typescript/package-module-reference-extractor.js +5 -0
  85. package/dist/infrastructure/typescript/package-module-reference-extractor.js.map +1 -0
  86. package/dist/infrastructure/typescript/parse-typescript-source.js +27 -12
  87. package/dist/infrastructure/typescript/parse-typescript-source.js.map +1 -1
  88. package/dist/infrastructure/typescript/source-module-reference-extractor.d.ts +7 -0
  89. package/dist/infrastructure/typescript/source-module-reference-extractor.d.ts.map +1 -0
  90. package/dist/infrastructure/typescript/source-module-reference-extractor.js +50 -0
  91. package/dist/infrastructure/typescript/source-module-reference-extractor.js.map +1 -0
  92. package/dist/infrastructure/typescript/typescript-config-loader.d.ts.map +1 -1
  93. package/dist/infrastructure/typescript/typescript-config-loader.js +1 -3
  94. package/dist/infrastructure/typescript/typescript-config-loader.js.map +1 -1
  95. package/dist/infrastructure/typescript/typescript-module-alias-resolver.d.ts.map +1 -1
  96. package/dist/infrastructure/typescript/typescript-module-alias-resolver.js +16 -1
  97. package/dist/infrastructure/typescript/typescript-module-alias-resolver.js.map +1 -1
  98. package/dist/infrastructure/typescript/typescript-module-reference-extractor.d.ts +3 -5
  99. package/dist/infrastructure/typescript/typescript-module-reference-extractor.d.ts.map +1 -1
  100. package/dist/infrastructure/typescript/typescript-module-reference-extractor.js +3 -35
  101. package/dist/infrastructure/typescript/typescript-module-reference-extractor.js.map +1 -1
  102. package/dist/presentation/analyze-repository.d.ts +2 -0
  103. package/dist/presentation/analyze-repository.d.ts.map +1 -1
  104. package/dist/presentation/analyze-repository.js +25 -4
  105. package/dist/presentation/analyze-repository.js.map +1 -1
  106. package/dist/presentation/cli/arguments.d.ts +1 -0
  107. package/dist/presentation/cli/arguments.d.ts.map +1 -1
  108. package/dist/presentation/cli/arguments.js +7 -0
  109. package/dist/presentation/cli/arguments.js.map +1 -1
  110. package/dist/presentation/cli/main.js +5 -0
  111. package/dist/presentation/cli/main.js.map +1 -1
  112. package/dist/presentation/cli/text-report.d.ts.map +1 -1
  113. package/dist/presentation/cli/text-report.js +1 -0
  114. package/dist/presentation/cli/text-report.js.map +1 -1
  115. package/dist/presentation/github/action-inputs.d.ts +2 -0
  116. package/dist/presentation/github/action-inputs.d.ts.map +1 -1
  117. package/dist/presentation/github/action-inputs.js +10 -0
  118. package/dist/presentation/github/action-inputs.js.map +1 -1
  119. package/dist/presentation/github/pr-body-intent.d.ts +3 -0
  120. package/dist/presentation/github/pr-body-intent.d.ts.map +1 -0
  121. package/dist/presentation/github/pr-body-intent.js +15 -0
  122. package/dist/presentation/github/pr-body-intent.js.map +1 -0
  123. package/dist/presentation/github/run-action.d.ts.map +1 -1
  124. package/dist/presentation/github/run-action.js +10 -0
  125. package/dist/presentation/github/run-action.js.map +1 -1
  126. package/package.json +3 -2
package/README.ko.md CHANGED
@@ -21,7 +21,7 @@ LLM 없이도 재현 가능한 분석을 제공하고, AI 설명 기능은 선
21
21
 
22
22
  ## 빠른 시작
23
23
 
24
- Node.js 20 이상과 Git이 설치되어 있어야 합니다. npm에 공개된 v0.2.0은 전역 설치 없이
24
+ Node.js 20 이상과 Git이 설치되어 있어야 합니다. npm에 공개된 v0.4.0은 전역 설치 없이
25
25
  실행할 수 있습니다.
26
26
 
27
27
  ```bash
@@ -67,7 +67,7 @@ jobs:
67
67
 
68
68
  - name: Analyze pull request
69
69
  id: intentpatch
70
- uses: xx2xxjaeil/intent-patch@v0.2.0
70
+ uses: xx2xxjaeil/intent-patch@v0.4.0
71
71
  with:
72
72
  fail-on: high
73
73
 
@@ -79,8 +79,10 @@ jobs:
79
79
  path: intentpatch-report
80
80
  ```
81
81
 
82
- Action은 릴리스 버전이나 불변 commit SHA로 고정하는 방식을 권장합니다. v0.2.0에는 TypeScript
83
- 경로 별칭과 npm lockfile/workspace 분석이 포함되며, `@main`은 미릴리스 변경을 따라갑니다.
82
+ Action은 릴리스 버전이나 불변 commit SHA로 고정하는 방식을 권장합니다. v0.4.0에는
83
+ JS/JSX import 영향 범위 분석과 ESM export 변경 분석이 추가됐습니다. 외부 저장소에서의
84
+ 검증 결과는 [평가 보고서](./docs/external-repository-evaluation.md)에 기록했습니다. `@main`은
85
+ 미릴리스 변경을 따라갑니다.
84
86
  Action은 PR·push 이벤트의 commit 범위를 자동으로 선택하고 다음 결과를 남깁니다.
85
87
 
86
88
  - GitHub Actions Job Summary의 Markdown 보고서
@@ -127,10 +129,16 @@ LOW 구현체가 하나뿐인 추상화 추가
127
129
  분석 결과는 단순한 경고 문구가 아니라 관련 파일, 규칙 ID, 판단 근거와 함께 제공하는 것을
128
130
  원칙으로 합니다.
129
131
 
132
+ 실제 IntentPatch 커밋을 분석한 [독립 실행형 HTML 예시](./docs/examples/intent-input-change.html)와
133
+ [자체 변경 3건의 검증 결과](./docs/real-world-evaluation.md)와
134
+ [외부 저장소 6건의 검증 결과](./docs/external-repository-evaluation.md)를 볼 수 있습니다. 저장소를 clone한
135
+ 뒤 HTML 파일을 브라우저에서 열어 주세요. GitHub 파일 화면은 렌더링 대신 소스를 보여줄 수
136
+ 있습니다.
137
+
130
138
  ## 현재 구현된 기능
131
139
 
132
140
  현재 소스는 Git 변경사항 수집, 루트·npm workspace `package.json`의 직접 dependency와 npm lockfile 분석, TypeScript
133
- 최상위 심볼과 공개 API 변경 분석, 기존 구현 중복·단일 구현 추상화 신호, import graph 기반
141
+ 최상위 TypeScript·JavaScript 심볼과 공개 export 변경 분석, 기존 구현 중복·단일 구현 추상화 신호, import graph 기반
134
142
  영향 범위와 테스트 동반 변경 분석을 제공합니다.
135
143
 
136
144
  - `HEAD`와 현재 working tree 비교
@@ -145,16 +153,20 @@ LOW 구현체가 하나뿐인 추상화 추가
145
153
  - 외부 CDN이나 JavaScript dependency가 필요 없는 인라인 CSS·SVG 시각화
146
154
  - production·development dependency 추가 탐지
147
155
  - dependency 삭제, 버전 변경, 섹션 이동 탐지
156
+ - 새 직접 dependency에 정적 JS/TS 참조가 없으면 `low` 심각도의 검토 후보로 표시
148
157
  - 잘못된 `package.json`을 예외 대신 근거가 포함된 finding으로 보고
149
158
  - npm `package-lock.json` v2/v3의 실제 설치 패키지 추가·삭제·버전 변경 비교
150
159
  - scoped·중첩 설치 경로를 구분하고 로컬 workspace 링크는 제외
160
+ - pnpm `pnpm-lock.yaml` v9의 레지스트리 패키지 추가·삭제·버전 변경 비교(2개 문서 형식 포함)
151
161
  - 잘못되었거나 미지원인 lockfile을 누락하지 않고 finding으로 보고
152
162
  - 루트 `workspaces` 패턴에 속한 변경 manifest의 직접 dependency를 workspace별로 보고
163
+ - `pnpm-workspace.yaml`의 포함·제외 패턴에 속한 변경 manifest의 직접 dependency를 보고
153
164
  - workspace 설정 변경과 manifest의 workspace 안팎 이동을 탐지
154
165
  - finding 심각도(`high`, `medium`, `low`) 집계
155
166
  - CI 품질 게이트를 위한 `--fail-on` 종료 코드
156
167
  - 설치된 패키지 버전을 확인하는 `--version` 명령
157
168
  - `.ts`·`.tsx` 파일의 최상위 함수·클래스·인터페이스·타입 별칭 추출
169
+ - `.js`·`.jsx`·`.mjs`·`.cjs`의 최상위 함수·클래스·변수와 식별 가능한 ESM export 추적
158
170
  - 심볼 추가·수정·삭제 탐지와 소스 위치 표시
159
171
  - 직접 `export`된 선언, 로컬 export 목록과 외부 re-export를 공개 심볼 근거에 보존
160
172
  - 공개 심볼 삭제와 `export` 해제를 호환성 위험 `high` finding으로 탐지
@@ -164,7 +176,7 @@ LOW 구현체가 하나뿐인 추상화 추가
164
176
  - 신규 인터페이스를 명시적으로 구현하는 클래스가 하나뿐이면 추상화 검토 `low` finding으로 탐지
165
177
  - rename 전후 파일 경로를 사용한 심볼 비교
166
178
  - 구문 오류가 있는 파일을 누락시키지 않고 분석 불가 근거로 보고
167
- - `.ts`·`.tsx` 파일의 상대 경로 정적 import와 re-export 관계 수집
179
+ - JS/TS 소스의 상대 경로 정적 import·re-export·문자열 `require()`·`import()` 관계 수집
168
180
  - 가장 가까운 `tsconfig.json`·`jsconfig.json`의 `paths`·`baseUrl`과 상대 경로 `extends`를
169
181
  사용해 로컬 별칭 import 해석
170
182
  - `.js`·`.jsx`·`.mjs`·`.cjs` specifier를 대응하는 TypeScript 소스로 해석
@@ -172,6 +184,7 @@ LOW 구현체가 하나뿐인 추상화 추가
172
184
  - 해결하지 못한 상대 import와 읽기·파싱 실패를 분석 근거로 보존
173
185
  - working tree의 tracked·untracked 파일 또는 지정한 head ref를 동일한 결과점에서 분석
174
186
  - `.intentpatch.json`에 요청 의도, 예상 경로, 허용 경로와 변경량 예산 선언
187
+ - CLI 요청 문서 또는 선택적으로 GitHub PR 본문에서 요청 의도를 입력
175
188
  - 예상·허용 패턴을 벗어난 변경 파일을 파일별 `medium` finding으로 탐지
176
189
  - 변경 파일 수와 측정 라인 예산 초과를 수치 근거가 있는 `low` finding으로 탐지
177
190
  - Contract가 지정한 소스·테스트 경로를 분류하고 파일명 기준으로 관련 변경 연결
@@ -181,7 +194,7 @@ LOW 구현체가 하나뿐인 추상화 추가
181
194
  - Pull Request·push commit 범위를 자동 판별하는 GitHub Action
182
195
  - GitHub Job Summary, workflow annotation, JSON·HTML artifact용 보고서 생성
183
196
 
184
- 아직 lockfile 전이 dependency의 부모 귀속 분석, JavaScript·메서드 구조 분석과 AI 리뷰
197
+ 아직 lockfile 전이 dependency의 부모 귀속 분석, JavaScript 중복 구현·메서드 구조 분석과 AI 리뷰
185
198
  기능은 구현되지 않았습니다.
186
199
 
187
200
  ## 상세 사용법
@@ -226,6 +239,16 @@ HTML 파일에는 스타일과 dependency 영향 SVG 그래프가 모두 포함
226
239
  IntentPatch를 실행한 현재 디렉터리를 기준으로 해석합니다. 기존 `--json`은
227
240
  `--format json`의 단축 옵션입니다.
228
241
 
242
+ 계약 파일 없이 원래 요청을 보고서에 담으려면 분석할 저장소 안에 텍스트·Markdown 파일을 저장하고 실행합니다.
243
+
244
+ ```bash
245
+ intentpatch analyze --intent-file request.md --format html --output report.html
246
+ ```
247
+
248
+ `--intent-file`은 계약의 `intent`만 덮어쓰며 기존 scope·테스트 정책은 유지합니다.
249
+ 요청 파일은 저장소 안의 일반 파일이어야 하고 64 KiB 이하여야 합니다. 요청 문장만으로
250
+ 예상 경로를 추측하거나 범위 검사를 활성화하지 않습니다.
251
+
229
252
  ### Change Contract로 요청 범위 검사
230
253
 
231
254
  분석할 저장소의 `.intentpatch.json`에 이번 요청의 기대 범위를 선언할 수 있습니다.
@@ -401,7 +424,7 @@ npm pack --dry-run
401
424
 
402
425
  ## 릴리스
403
426
 
404
- `v0.1.0`처럼 `package.json` 버전과 일치하는 태그를 기본 브랜치의 커밋에 push하면 릴리스
427
+ `v0.4.0`처럼 `package.json` 버전과 일치하는 태그를 기본 브랜치의 커밋에 push하면 릴리스
405
428
  워크플로가 다음 작업을 순서대로 수행합니다.
406
429
 
407
430
  1. 태그·버전·기본 브랜치 포함 여부 검증
@@ -419,19 +442,25 @@ npm provenance가 자동 생성됩니다. 아직 npm에 존재하지 않는 신
419
442
  1. ✅ `package.json` 직접 dependency 변경 탐지와 규칙 엔진
420
443
  2. ✅ TypeScript AST 기반 함수·클래스·인터페이스·타입 변경 분석
421
444
  3. ✅ 상대 경로 정적 import graph 기반 변경 영향 범위 계산
445
+ - ✅ JS/JSX의 ESM·문자열 `require()`·동적 import 관계
422
446
  - ✅ 가장 가까운 TypeScript 프로젝트 설정의 `paths`·`baseUrl` 별칭 해석
423
447
  4. ✅ Change Contract 기반 예상 범위 이탈과 변경량 예산 탐지
424
448
  5. ✅ Contract 기반 관련 테스트 변경 누락 탐지
425
449
  6. lockfile과 workspace를 고려한 package manager adapter
426
450
  - ✅ npm `package-lock.json` v2/v3의 설치 패키지 변경
427
451
  - ✅ npm workspace manifest의 직접 dependency 변경
428
- - pnpm·Yarn adapter
452
+ - ✅ pnpm `pnpm-lock.yaml` v9의 레지스트리 패키지 변경
453
+ - ✅ pnpm workspace manifest의 직접 dependency 변경
454
+ - Yarn adapter
429
455
  7. ✅ 직접 export된 공개 심볼 삭제와 export 해제 탐지
456
+ - ✅ JavaScript ESM의 이름 있는 export·default export 삭제 탐지
430
457
  8. ✅ 단일 HTML 대시보드와 SVG 기반 dependency 영향 그래프
431
458
  9. ✅ re-export·함수/인터페이스 호환성과 기존 코드 중복 가능성 탐지
432
459
  10. ✅ 구현체가 하나뿐인 신규 인터페이스 탐지
433
460
  11. ✅ PR·push 비교, Job Summary와 artifact 출력을 제공하는 GitHub Action
434
- 12. Codex·Claude Code·Cursor adapter
461
+ 12. 요청 입력과 에이전트 adapter
462
+ - ✅ CLI 요청 문서와 선택적 GitHub PR 본문 입력
463
+ - Codex·Claude Code·Cursor 전용 adapter
435
464
  13. 근거 기반 결과에 대한 선택적 LLM 설명
436
465
 
437
466
  ## 현재 제한사항
@@ -439,19 +468,32 @@ npm provenance가 자동 생성됩니다. 아직 npm에 존재하지 않는 신
439
468
  - 분석 대상은 최소 한 번 이상 커밋된 Git 저장소여야 합니다.
440
469
  - untracked symbolic link는 안전을 위해 내용을 읽지 않습니다.
441
470
  - 10 MiB를 초과하는 untracked 파일은 라인 수를 측정하지 않습니다.
442
- - 직접 dependency 선언 분석은 저장소 루트와 변경된 npm workspace `package.json`의
471
+ - 직접 dependency 선언 분석은 저장소 루트와 변경된 npm·pnpm workspace `package.json`의
443
472
  `dependencies`와 `devDependencies`를 대상으로 합니다.
473
+ - 정적 참조 없음 finding은 미사용 확정이 아닌 검토 후보입니다. 유지보수 대상 JS/TS
474
+ 소스의 명시적 import·re-export·문자열 `require()`·`import()`를 살펴봅니다. CLI나 설정
475
+ 파일에서만 사용하는 경우는 놓칠 수 있습니다. 파일 읽기·파싱이 불완전하거나 계산된 module
476
+ load가 있거나, 스캔한 소스가 없거나, 소스 파일이 5,000개를 넘으면 후보를 보고하지 않습니다.
444
477
  - npm `package-lock.json` v2/v3은 설치 경로와 버전을 비교합니다. 부모 dependency 귀속,
445
478
  integrity hash나 취약점 정보까지 분석하지는 않습니다.
479
+ - pnpm `pnpm-lock.yaml` v9은 프로젝트 문서의 레지스트리 패키지 ID와 버전을 비교합니다.
480
+ integrity만 바뀐 경우, 로컬·Git 패키지, snapshot의 peer 변형, 부모 dependency 귀속은 분석하지 않습니다.
481
+ 루트의 직접 dependency 여부는 루트 importer를 기준으로 표시합니다.
446
482
  - workspace 판별은 루트의 npm `workspaces` 배열과 명시 경로, `*`·`**`·`?` 패턴을 지원합니다.
447
483
  부정·중괄호·문자 클래스 패턴은 미지원 finding으로 보고합니다.
448
- - pnpm·Yarn lockfile, 코드에서의 실제 dependency 사용 여부는 아직 분석하지 않습니다.
449
- - working tree의 `package-lock.json`은 10 MiB, 그 외 텍스트 snapshot은 1 MiB로 제한합니다.
450
- - 심볼 분석은 `.ts`와 `.tsx`의 이름이 있는 최상위 함수, 클래스, 인터페이스, 타입
484
+ - pnpm workspace는 `pnpm-workspace.yaml`의 `packages`에 명시한 `*`·`**`·`?`와 선행 `!`
485
+ 제외 패턴을 지원합니다. npm 설정이 함께 있으면 중복 보고를 막기 위해 pnpm 설정을
486
+ 우선합니다. 그 외 glob 문법과 catalog는 해석하지 않습니다.
487
+ - Yarn lockfile과 런타임에서의 실제 dependency 사용 여부는 아직 분석하지 않습니다.
488
+ - working tree의 `package-lock.json`·`pnpm-lock.yaml`은 10 MiB, 그 외 텍스트 snapshot은 1 MiB로 제한합니다.
489
+ - TypeScript 심볼 분석은 `.ts`와 `.tsx`의 이름이 있는 최상위 함수, 클래스, 인터페이스, 타입
451
490
  별칭만 지원합니다.
452
- - 공개 API 분석은 이름이 있는 최상위 함수·인터페이스, 로컬 `export { name }`, 외부
453
- `export { name } from`, `export * from`을 지원합니다. package `exports`, 익명 default export,
454
- 클래스·타입 별칭의 세부 계약은 아직 해석하지 않습니다.
491
+ - JavaScript 심볼 분석은 `.js`·`.jsx`·`.mjs`·`.cjs`의 최상위 함수·클래스·변수 및 식별 가능한
492
+ ESM export를 추적합니다. CommonJS `module.exports`는 아직 공개 API 분석 대상이 아닙니다.
493
+ - TypeScript 공개 API 분석은 이름이 있는 최상위 함수·인터페이스, 로컬 `export { name }`, 외부
494
+ `export { name } from`, `export * from`을 지원합니다. JavaScript는 이름 있는 ESM export와
495
+ default export 삭제를 탐지하지만 함수의 타입 호환성을 추정하지 않습니다. package `exports`와
496
+ 클래스·타입 별칭의 세부 계약은 해석하지 않습니다.
455
497
  - 함수 호환성은 명시된 파라미터·반환 타입 텍스트를 비교합니다. 추론된 반환 타입 변화나
456
498
  TypeScript의 구조적 타입 할당 가능성까지 판정하지 않습니다.
457
499
  - 중복 구현 후보는 새로 추가된 최상위 함수와 기존 최상위 함수의 토큰이 공백·주석을 제외하고
@@ -459,17 +501,19 @@ npm provenance가 자동 생성됩니다. 아직 npm에 존재하지 않는 신
459
501
  의미적으로만 같은 구현은 탐지하지 않습니다.
460
502
  - 단일 구현 추상화는 새 인터페이스를 `implements`로 명시한 이름 있는 클래스가 정확히 하나일 때만
461
503
  보고합니다. TypeScript의 구조적 구현, factory 반환 타입과 런타임 등록은 계산하지 않습니다.
462
- - 메서드, 변수 선언, enum, 중첩 선언, JavaScript 파일은 아직 심볼 분석 대상이 아닙니다.
504
+ - 메서드, TypeScript 변수 선언, enum, 중첩 선언은 아직 심볼 분석 대상이 아닙니다.
463
505
  - 선언 내부의 포맷이나 주석 변경도 심볼 수정으로 집계될 수 있습니다.
464
- - 영향 분석은 `.ts`·`.tsx` 파일의 정적 `import`, side-effect import, `export ... from`,
465
- `import = require()`를 대상으로 합니다. 로컬 별칭은 가장 가까운 `tsconfig.json` 또는
506
+ - 영향 분석은 JS/TS 소스의 정적 `import`, side-effect import, `export ... from`,
507
+ `import = require()` 및 문자열 `require()`·`import()`를 대상으로 합니다. 로컬 별칭은 가장 가까운 `tsconfig.json` 또는
466
508
  `jsconfig.json`과 상대 경로 `extends`를 해석합니다.
467
509
  - 외부 패키지 설정을 참조하는 `extends`, project references, 임의 이름의 설정 파일,
468
- package `imports`·`exports`, 외부 package import, dynamic `import()`, 일반 `require()`는
469
- 아직 그래프에 포함하지 않습니다.
510
+ package `imports`·`exports`, 외부 package import, 계산된 모듈 경로는 아직 그래프에서
511
+ 해석하지 않습니다.
470
512
  - 영향 그래프는 비교 결과점(working tree 또는 head ref)의 파일을 기준으로 만듭니다. 따라서
471
513
  삭제된 모듈을 가리키던 과거 import의 영향은 현재 단계에서 계산할 수 없습니다.
472
514
  - 영향 분석용 소스 파일은 파일당 1 MiB로 제한하며, symbolic link는 읽지 않습니다.
515
+ - `dist`·`build`·`coverage`·`action-dist`·`node_modules` 같은 생성 디렉터리는 Git 변경량에는
516
+ 포함하지만 심볼·import graph·정적 package 참조 분석에서는 제외합니다.
473
517
  - IntentPatch는 자연어 intent만으로 예상 경로를 추측하지 않습니다. 범위 판단은 Contract에 명시한
474
518
  `include`와 `allow`를 기준으로 수행합니다.
475
519
  - 경로 패턴은 저장소 상대 경로와 `*`, `**`, `?`만 지원합니다. 부정 패턴과 brace 확장은 아직
package/README.md CHANGED
@@ -18,7 +18,7 @@ IntentPatch combines **Git diff analysis, static analysis, and dependency analys
18
18
 
19
19
  ## Quick start
20
20
 
21
- IntentPatch requires Node.js 20 or later and Git. Run the published v0.2.0 CLI without
21
+ IntentPatch requires Node.js 20 or later and Git. Run the published v0.4.0 CLI without
22
22
  installing it globally:
23
23
 
24
24
  ```bash
@@ -62,7 +62,7 @@ jobs:
62
62
 
63
63
  - name: Analyze pull request
64
64
  id: intentpatch
65
- uses: xx2xxjaeil/intent-patch@v0.2.0
65
+ uses: xx2xxjaeil/intent-patch@v0.4.0
66
66
  with:
67
67
  fail-on: high
68
68
 
@@ -74,8 +74,9 @@ jobs:
74
74
  path: intentpatch-report
75
75
  ```
76
76
 
77
- Pin the action to a released version or an immutable commit SHA. The v0.2.0 release includes
78
- TypeScript path aliases and npm lockfile/workspace analysis; `@main` follows unreleased changes.
77
+ Pin the action to a released version or an immutable commit SHA. The v0.4.0 release adds
78
+ JS/JSX import-impact and ESM export analysis, with external-repository evaluation documented in
79
+ [the evaluation report](./docs/external-repository-evaluation.md). `@main` follows unreleased changes.
79
80
 
80
81
  The action detects the comparison range for pull request and push events and produces:
81
82
 
@@ -121,9 +122,15 @@ LOW New abstraction has only one implementation
121
122
 
122
123
  Every finding includes the relevant file, a stable rule ID, and evidence for the decision instead of only presenting an unexplained warning.
123
124
 
125
+ For a report generated from an actual IntentPatch commit, see the
126
+ [standalone HTML example](./docs/examples/intent-input-change.html) and the
127
+ [three-case self-evaluation](./docs/real-world-evaluation.md) and
128
+ [six-case external evaluation](./docs/external-repository-evaluation.md). After cloning,
129
+ open the HTML file locally in a browser; GitHub may show its source rather than render it.
130
+
124
131
  ## Implemented capabilities
125
132
 
126
- The current source tree analyzes Git changes, direct dependencies in the root `package.json`, top-level TypeScript symbols and public API changes, possible duplicate implementations, single-implementation abstractions, import-graph impact, and related test changes.
133
+ The current source tree analyzes Git changes, direct dependencies in the root `package.json`, top-level TypeScript and JavaScript symbols and public exports, possible duplicate implementations, single-implementation abstractions, import-graph impact, and related test changes.
127
134
 
128
135
  ### Git and reporting
129
136
 
@@ -144,13 +151,17 @@ The current source tree analyzes Git changes, direct dependencies in the root `p
144
151
 
145
152
  - Detect additions to production and development dependencies.
146
153
  - Detect dependency removal, version changes, and section moves.
154
+ - Flag a newly added direct dependency with no static JS/TS import as a low-severity review candidate.
147
155
  - Report malformed `package.json` files as evidence-backed findings instead of crashing.
148
156
  - Compare resolved package additions, removals, and version changes in npm `package-lock.json` v2/v3.
149
157
  - Keep scoped and nested installation paths distinct, and exclude local workspace links.
158
+ - Compare resolved registry package changes in pnpm `pnpm-lock.yaml` v9, including two-document lockfiles.
150
159
  - Report malformed or unsupported lockfiles as findings rather than silently skipping them.
151
160
  - Attribute direct dependency changes to changed npm workspace manifests selected by the root `workspaces` patterns.
161
+ - Analyze changed pnpm workspace manifests selected by `pnpm-workspace.yaml`, including exclusion patterns.
152
162
  - Report changes to workspace patterns and manifest moves into or out of a configured workspace.
153
163
  - Extract top-level named functions, classes, interfaces, and type aliases from `.ts` and `.tsx` files.
164
+ - Track named top-level JavaScript/JSX functions, classes, variables, ESM export aliases, and default exports without inferring type compatibility.
154
165
  - Detect symbol additions, modifications, and removals with source locations.
155
166
  - Preserve direct exports, local export lists, and external re-exports as public-symbol evidence.
156
167
  - Report removed public symbols and removed exports as high-severity compatibility risks.
@@ -163,7 +174,7 @@ The current source tree analyzes Git changes, direct dependencies in the root `p
163
174
 
164
175
  ### Impact, scope, and tests
165
176
 
166
- - Build relative static import and re-export relationships for `.ts` and `.tsx` files.
177
+ - Build relative string-literal import, re-export, `require()`, and `import()` relationships for TypeScript and JavaScript modules, including JSX.
167
178
  - Resolve local imports through the nearest `tsconfig.json` or `jsconfig.json` `paths` and
168
179
  `baseUrl`, including relative `extends` files.
169
180
  - Resolve `.js`, `.jsx`, `.mjs`, and `.cjs` import specifiers to matching TypeScript sources.
@@ -171,6 +182,7 @@ The current source tree analyzes Git changes, direct dependencies in the root `p
171
182
  - Preserve unresolved relative imports and file read or parse failures as evidence.
172
183
  - Build the graph at the same result point as the diff: the working tree or the selected head ref.
173
184
  - Read intent, expected paths, allowed paths, and change budgets from `.intentpatch.json`.
185
+ - Accept a request text/Markdown file through the CLI, or opt in to using the PR body in the GitHub Action.
174
186
  - Report each file outside expected and allowed patterns as a medium-severity finding.
175
187
  - Report file-count and measurable-line budget overruns with numeric evidence.
176
188
  - Classify source and test paths declared by the contract and connect related changes by basename.
@@ -178,7 +190,7 @@ The current source tree analyzes Git changes, direct dependencies in the root `p
178
190
  - Report source files without a related test change as medium-severity findings.
179
191
  - Support repository-relative `*`, `**`, and `?` path patterns.
180
192
 
181
- Transitive lockfile dependency provenance, JavaScript and method-level structure analysis, and optional AI review are not implemented yet.
193
+ Transitive lockfile dependency provenance, JavaScript duplicate-implementation and method-level structure analysis, and optional AI review are not implemented yet.
182
194
 
183
195
  ## CLI usage
184
196
 
@@ -219,6 +231,14 @@ node dist/presentation/cli/main.js analyze \
219
231
 
220
232
  The HTML file contains all styles and the dependency-impact SVG, so it opens directly without a server or API key. `--output` also works with text and JSON formats. Relative output paths are resolved from the directory where IntentPatch is executed. `--json` is an alias for `--format json`.
221
233
 
234
+ To include the original request without writing a contract, save it in the analyzed repository and run:
235
+
236
+ ```bash
237
+ intentpatch analyze --intent-file request.md --format html --output report.html
238
+ ```
239
+
240
+ `--intent-file` overrides only the contract's `intent`; existing scope and test policies remain intact. The file must be a regular file inside the analyzed repository and at most 64 KiB. Request text alone does not infer expected paths or activate scope checks.
241
+
222
242
  ### Check request scope with a Change Contract
223
243
 
224
244
  Create `.intentpatch.json` in the repository being analyzed and declare the expected scope of the request:
@@ -391,7 +411,7 @@ npm pack --dry-run
391
411
 
392
412
  ## Release process
393
413
 
394
- Pushing a tag such as `v0.1.0`, matching the version in `package.json`, from a commit contained in the default branch triggers the release workflow:
414
+ Pushing a tag such as `v0.4.0`, matching the version in `package.json`, from a commit contained in the default branch triggers the release workflow:
395
415
 
396
416
  1. Validate the tag, package version, and default-branch ancestry.
397
417
  2. Run the full quality suite and inspect the npm package with a dry run.
@@ -406,18 +426,24 @@ No long-lived npm token is stored as a GitHub secret. Public packages published
406
426
  2. ✅ TypeScript AST analysis for functions, classes, interfaces, and types
407
427
  3. ✅ Relative static import graph and change-impact calculation
408
428
  - ✅ TypeScript `paths` and `baseUrl` aliases from the nearest project config
429
+ - ✅ JS/JSX ESM, CommonJS `require()`, and string-literal dynamic imports
409
430
  4. ✅ Change Contract scope and change-budget analysis
410
431
  5. ✅ Contract-based detection of missing related test changes
411
432
  6. Package-manager adapters for lockfiles and workspaces
412
433
  - ✅ npm `package-lock.json` v2/v3 resolved package changes
413
434
  - ✅ npm workspace manifest dependency changes
414
- - pnpm and Yarn adapters
435
+ - ✅ pnpm `pnpm-lock.yaml` v9 resolved registry package changes
436
+ - ✅ pnpm workspace manifest dependency changes
437
+ - Yarn adapter
415
438
  7. ✅ Detection of removed public exports
439
+ - ✅ Named and default ESM exports in JavaScript, without inferred type compatibility
416
440
  8. ✅ Standalone HTML dashboard and SVG dependency-impact graph
417
441
  9. ✅ Re-export and function/interface compatibility checks plus possible code duplication
418
442
  10. ✅ Detection of newly introduced single-implementation interfaces
419
443
  11. ✅ GitHub Action with PR/push comparison, Job Summary, annotations, and artifacts
420
- 12. Codex, Claude Code, and Cursor adapters
444
+ 12. Request capture and agent adapters
445
+ - ✅ CLI request file and opt-in GitHub PR body
446
+ - Codex, Claude Code, and Cursor-specific adapters
421
447
  13. Optional LLM explanations grounded in deterministic evidence
422
448
 
423
449
  ## Current limitations
@@ -425,26 +451,28 @@ No long-lived npm token is stored as a GitHub secret. Public packages published
425
451
  - The target must be a Git repository with at least one commit.
426
452
  - Untracked symbolic links are not read for safety.
427
453
  - Line counts are skipped for untracked files larger than 10 MiB.
428
- - Direct dependency declarations are analyzed from `dependencies` and `devDependencies` in the root npm `package.json` and changed npm workspace manifests.
454
+ - Direct dependency declarations are analyzed from `dependencies` and `devDependencies` in the root `package.json` and changed npm/pnpm workspace manifests.
455
+ - The no-static-reference finding is a review candidate, not proof that a package is unused. It checks explicit JS/TS imports, re-exports, literal `require()` and `import()` across maintained source files; CLI-only/configuration usage may not appear. It does not emit a candidate if source reads or parsing are incomplete, a computed module load exists, no source was scanned, or more than 5,000 source files are present.
429
456
  - npm `package-lock.json` v2/v3 analysis compares installed package paths and versions, not dependency provenance, integrity hashes, or vulnerability data. It does not attribute transitive packages to their parents.
457
+ - pnpm `pnpm-lock.yaml` v9 analysis compares registry package IDs and versions in the project document. It ignores integrity-only edits, local/Git packages, snapshot peer variants, and dependency provenance. Root-direct evidence comes from the root importer only.
430
458
  - Workspace detection supports the root npm `workspaces` array with explicit paths and `*`, `**`, and `?` globs. Negation, brace, and character-class patterns are reported as unsupported.
431
- - pnpm and Yarn lockfiles and real dependency usage in source code are not analyzed yet.
432
- - Working-tree `package-lock.json` files are limited to 10 MiB; other text snapshots retain the 1 MiB limit.
433
- - Symbol analysis supports named top-level functions, classes, interfaces, and type aliases in `.ts` and `.tsx` files.
434
- - Public API analysis supports named top-level functions and interfaces, local `export { name }`, external `export { name } from`, and `export * from`. Package `exports`, anonymous default exports, and detailed class or type-alias contracts are not interpreted yet.
459
+ - pnpm workspace detection reads `pnpm-workspace.yaml` `packages` patterns with `*`, `**`, `?`, and leading `!` exclusions. When both npm and pnpm workspace settings exist, pnpm settings take precedence to avoid duplicate findings. Other glob features and pnpm catalogs are not interpreted.
460
+ - Yarn lockfiles and runtime dependency usage are not analyzed yet.
461
+ - Working-tree `package-lock.json` and `pnpm-lock.yaml` files are limited to 10 MiB; other text snapshots retain the 1 MiB limit.
462
+ - TypeScript symbol analysis supports named top-level functions, classes, interfaces, and type aliases in `.ts` and `.tsx` files. JavaScript symbol analysis supports named top-level functions, classes, variables, and identifiable ESM exports in `.js`, `.jsx`, `.mjs`, and `.cjs` files.
463
+ - TypeScript public API analysis supports named top-level functions and interfaces, local `export { name }`, external `export { name } from`, and `export * from`. JavaScript supports identifiable named and default ESM export removal, but does not infer function signatures. Package `exports`, CommonJS `module.exports`, and detailed class or type-alias contracts are not interpreted yet.
435
464
  - Function compatibility compares explicitly written parameter and return-type text. It does not evaluate inferred return types or full TypeScript structural assignability.
436
465
  - Duplicate candidates require a newly added top-level function and an existing top-level function to have exactly the same normalized tokens after comments and whitespace are removed, with at least 12 body tokens. Renamed identifiers, methods, and semantically equivalent implementations are not detected.
437
466
  - A single-implementation abstraction is reported only when exactly one named class explicitly uses `implements` for a new interface. Structural implementation, factory return types, and runtime registration are not calculated.
438
- - Methods, variable declarations, enums, nested declarations, and JavaScript files are not included in symbol analysis.
467
+ - Methods, TypeScript variable declarations, enums, and nested declarations are not included in symbol analysis.
439
468
  - Formatting or comment changes inside a declaration can be counted as symbol modifications.
440
- - Impact analysis covers static `import`, side-effect imports, `export ... from`, and
441
- `import = require()` in `.ts` and `.tsx` files. Local aliases use the nearest `tsconfig.json` or
469
+ - Impact analysis covers static `import`, side-effect imports, `export ... from`, `import = require()`, and string-literal `require()` and `import()` in JS/TS source files. Local aliases use the nearest `tsconfig.json` or
442
470
  `jsconfig.json`, with relative `extends` support.
443
471
  - Package-based config `extends`, project references, arbitrary config filenames, package
444
- `imports`/`exports`, external package imports, dynamic `import()`, and ordinary `require()` are
445
- not included in the graph.
472
+ `imports`/`exports`, external package imports, and computed module loads are not resolved in the graph.
446
473
  - The graph is built from files at the comparison result point: the working tree or head ref. Impact from historical imports that referenced a deleted module cannot be calculated yet.
447
474
  - Source files used for impact analysis are limited to 1 MiB per file, and symbolic links are not read.
475
+ - Generated directories such as `dist`, `build`, `coverage`, `action-dist`, and `node_modules` remain visible in Git change counts but are excluded from symbol, import-graph, and static package-reference scans.
448
476
  - IntentPatch does not infer expected paths from natural-language intent. Scope decisions use the contract's explicit `include` and `allow` patterns.
449
477
  - Path patterns support only repository-relative `*`, `**`, and `?`; negation and brace expansion are not supported.
450
478
  - `maxLines` sums only measurable added and deleted lines in text files. Binary or unmeasurable files are not treated as zero lines, but their size is not included in the budget.
@@ -1,6 +1,7 @@
1
1
  export type ModuleReferenceExtractionResult = Readonly<{
2
2
  kind: "success";
3
3
  specifiers: readonly string[];
4
+ hasDynamicSpecifier?: boolean;
4
5
  }> | Readonly<{
5
6
  kind: "unavailable";
6
7
  reason: string;
@@ -1 +1 @@
1
- {"version":3,"file":"module-reference-extractor.d.ts","sourceRoot":"","sources":["../../../src/application/ports/module-reference-extractor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,+BAA+B,GACvC,QAAQ,CAAC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,GAC5D,QAAQ,CAAC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEtD,oDAAoD;AACpD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,+BAA+B,CAAC;CACxE"}
1
+ {"version":3,"file":"module-reference-extractor.d.ts","sourceRoot":"","sources":["../../../src/application/ports/module-reference-extractor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,+BAA+B,GACvC,QAAQ,CAAC;IACP,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC,GACF,QAAQ,CAAC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEtD,oDAAoD;AACpD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,+BAA+B,CAAC;CACxE"}
@@ -0,0 +1,7 @@
1
+ /** 여러 package-manager 파서에서 같은 실패 형태를 사용한다. */
2
+ export declare function invalidParseResult(reason: string): Readonly<{
3
+ ok: false;
4
+ kind: "invalid";
5
+ reason: string;
6
+ }>;
7
+ //# sourceMappingURL=parse-failure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-failure.d.ts","sourceRoot":"","sources":["../../../src/application/ports/parse-failure.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GACb,QAAQ,CAAC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAE1D"}
@@ -0,0 +1,5 @@
1
+ /** 여러 package-manager 파서에서 같은 실패 형태를 사용한다. */
2
+ export function invalidParseResult(reason) {
3
+ return Object.freeze({ ok: false, kind: "invalid", reason });
4
+ }
5
+ //# sourceMappingURL=parse-failure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-failure.js","sourceRoot":"","sources":["../../../src/application/ports/parse-failure.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,UAAU,kBAAkB,CAChC,MAAc;IAEd,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,20 @@
1
+ /** pnpm v9 lockfile의 프로젝트 패키지 목록에서 비교할 사실이다. */
2
+ export interface PnpmLockedPackage {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly version: string;
6
+ readonly rootDirect: boolean;
7
+ }
8
+ export type PnpmLockParseResult = Readonly<{
9
+ ok: true;
10
+ packages: ReadonlyMap<string, PnpmLockedPackage>;
11
+ }> | Readonly<{
12
+ ok: false;
13
+ kind: "invalid" | "unsupported";
14
+ reason: string;
15
+ }>;
16
+ /** YAML 파일 형식 해석을 분석 규칙에서 분리하는 입력 포트다. */
17
+ export interface PnpmLockParser {
18
+ parse(content: string): PnpmLockParseResult;
19
+ }
20
+ //# sourceMappingURL=pnpm-lock-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpm-lock-parser.d.ts","sourceRoot":"","sources":["../../../src/application/ports/pnpm-lock-parser.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;CAAE,CAAC,GACxE,QAAQ,CAAC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE7E,0CAA0C;AAC1C,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAAC;CAC7C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pnpm-lock-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpm-lock-parser.js","sourceRoot":"","sources":["../../../src/application/ports/pnpm-lock-parser.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { WorkspacePatterns } from "../services/workspace-manifest-analysis.js";
2
+ export type PnpmWorkspaceParseResult = Readonly<{
3
+ ok: true;
4
+ patterns: WorkspacePatterns;
5
+ }> | Readonly<{
6
+ ok: false;
7
+ kind: "invalid" | "unsupported";
8
+ reason: string;
9
+ }>;
10
+ /** pnpm 설정 파일을 workspace glob 사실로 바꾸는 출력 포트다. */
11
+ export interface PnpmWorkspaceParser {
12
+ parse(content: string | undefined): PnpmWorkspaceParseResult;
13
+ }
14
+ //# sourceMappingURL=pnpm-workspace-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpm-workspace-parser.d.ts","sourceRoot":"","sources":["../../../src/application/ports/pnpm-workspace-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,MAAM,MAAM,wBAAwB,GAChC,QAAQ,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,CAAC,GACnD,QAAQ,CAAC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE7E,iDAAiD;AACjD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,wBAAwB,CAAC;CAC9D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pnpm-workspace-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpm-workspace-parser.js","sourceRoot":"","sources":["../../../src/application/ports/pnpm-workspace-parser.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { Finding } from "../../domain/finding.js";
2
+ import type { AnalysisContext, AnalysisRule } from "../ports/analysis-rule.js";
3
+ import type { FileSnapshotSource } from "../ports/file-snapshot-source.js";
4
+ import type { ModuleReferenceExtractor } from "../ports/module-reference-extractor.js";
5
+ import type { PnpmWorkspaceParser } from "../ports/pnpm-workspace-parser.js";
6
+ import type { ProjectFileSource } from "../ports/project-file-source.js";
7
+ /** 새 직접 dependency의 정적 소스 참조가 없을 때만 검토 후보를 제시한다. */
8
+ export declare class AddedDependencyUsageRule implements AnalysisRule {
9
+ private readonly snapshots;
10
+ private readonly files;
11
+ private readonly extractor;
12
+ private readonly pnpmWorkspaceParser;
13
+ constructor(snapshots: FileSnapshotSource, files: ProjectFileSource, extractor: ModuleReferenceExtractor, pnpmWorkspaceParser: PnpmWorkspaceParser);
14
+ analyze(context: AnalysisContext): Promise<readonly Finding[]>;
15
+ }
16
+ //# sourceMappingURL=added-dependency-usage-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"added-dependency-usage-rule.d.ts","sourceRoot":"","sources":["../../../src/application/rules/added-dependency-usage-rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAOzE,oDAAoD;AACpD,qBAAa,wBAAyB,YAAW,YAAY;IAEzD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAHnB,SAAS,EAAE,kBAAkB,EAC7B,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,wBAAwB,EACnC,mBAAmB,EAAE,mBAAmB;IAG9C,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC;CAkE5E"}
@@ -0,0 +1,89 @@
1
+ import { isMaintainedSourcePath } from "../services/is-maintained-source-path.js";
2
+ import { NpmWorkspaceDependencyRule } from "./npm-workspace-dependency-rule.js";
3
+ import { PackageDependencyRule } from "./package-dependency-rule.js";
4
+ import { PnpmWorkspaceDependencyRule } from "./pnpm-workspace-dependency-rule.js";
5
+ const rootManifest = "package.json";
6
+ /** 새 직접 dependency의 정적 소스 참조가 없을 때만 검토 후보를 제시한다. */
7
+ export class AddedDependencyUsageRule {
8
+ snapshots;
9
+ files;
10
+ extractor;
11
+ pnpmWorkspaceParser;
12
+ constructor(snapshots, files, extractor, pnpmWorkspaceParser) {
13
+ this.snapshots = snapshots;
14
+ this.files = files;
15
+ this.extractor = extractor;
16
+ this.pnpmWorkspaceParser = pnpmWorkspaceParser;
17
+ }
18
+ async analyze(context) {
19
+ const manifestFindings = (await Promise.all([
20
+ new PackageDependencyRule(this.snapshots, rootManifest).analyze(context),
21
+ new NpmWorkspaceDependencyRule(this.snapshots).analyze(context),
22
+ new PnpmWorkspaceDependencyRule(this.snapshots, this.pnpmWorkspaceParser).analyze(context),
23
+ ])).flat();
24
+ const added = manifestFindings.filter((finding) => finding.ruleId === "dependency/new-production" ||
25
+ finding.ruleId === "dependency/new-development");
26
+ if (added.length === 0)
27
+ return [];
28
+ const paths = (await this.files.listPaths(context.target)).filter((path) => this.extractor.supports(path) && isMaintainedSourcePath(path));
29
+ const referenced = new Set();
30
+ if (paths.length === 0 || paths.length > 5_000)
31
+ return [];
32
+ let complete = true;
33
+ // 읽기·파싱 실패나 계산할 수 없는 동적 import가 있으면 미사용 후보를 단정하지 않는다.
34
+ for (const path of paths) {
35
+ const file = await this.files.read(context.target, path);
36
+ if (file.kind !== "success") {
37
+ complete = false;
38
+ break;
39
+ }
40
+ const references = this.extractor.extract(path, file.content);
41
+ if (references.kind !== "success" || references.hasDynamicSpecifier === true) {
42
+ complete = false;
43
+ break;
44
+ }
45
+ for (const specifier of references.specifiers) {
46
+ const packageName = packageNameFromSpecifier(specifier);
47
+ if (packageName !== undefined)
48
+ referenced.add(packageName);
49
+ }
50
+ }
51
+ if (!complete)
52
+ return [];
53
+ return added.flatMap((finding) => {
54
+ const name = finding.evidence.package;
55
+ if (typeof name !== "string" || referenced.has(name))
56
+ return [];
57
+ return [
58
+ {
59
+ ruleId: "dependency/no-static-reference",
60
+ severity: "low",
61
+ title: "New dependency has no static source reference",
62
+ description: `${name} was added to ${finding.file}, but no static JS/TS import was found. Check CLI, configuration, and generated-code usage before removing it.`,
63
+ file: finding.file,
64
+ evidence: {
65
+ package: name,
66
+ section: String(finding.evidence.section),
67
+ scannedFiles: paths.length,
68
+ ...(finding.evidence.workspace === undefined
69
+ ? {}
70
+ : { workspace: finding.evidence.workspace }),
71
+ ...(finding.evidence.packageManager === undefined
72
+ ? {}
73
+ : { packageManager: finding.evidence.packageManager }),
74
+ },
75
+ },
76
+ ];
77
+ });
78
+ }
79
+ }
80
+ function packageNameFromSpecifier(specifier) {
81
+ if (specifier.startsWith(".") ||
82
+ specifier.startsWith("/") ||
83
+ specifier.startsWith("#") ||
84
+ specifier.startsWith("node:"))
85
+ return undefined;
86
+ const parts = specifier.split("/");
87
+ return specifier.startsWith("@") && parts.length >= 2 ? `${parts[0]}/${parts[1]}` : parts[0];
88
+ }
89
+ //# sourceMappingURL=added-dependency-usage-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"added-dependency-usage-rule.js","sourceRoot":"","sources":["../../../src/application/rules/added-dependency-usage-rule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;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