intentpatch 0.1.0 → 0.2.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.
- package/README.ko.md +488 -0
- package/README.md +215 -211
- package/dist/application/ports/module-alias-resolver.d.ts +11 -0
- package/dist/application/ports/module-alias-resolver.d.ts.map +1 -0
- package/dist/application/ports/module-alias-resolver.js +2 -0
- package/dist/application/ports/module-alias-resolver.js.map +1 -0
- package/dist/application/ports/package-lock-parser.d.ts +20 -0
- package/dist/application/ports/package-lock-parser.d.ts.map +1 -0
- package/dist/application/ports/package-lock-parser.js +2 -0
- package/dist/application/ports/package-lock-parser.js.map +1 -0
- package/dist/application/rules/npm-lockfile-rule.d.ts +12 -0
- package/dist/application/rules/npm-lockfile-rule.d.ts.map +1 -0
- package/dist/application/rules/npm-lockfile-rule.js +109 -0
- package/dist/application/rules/npm-lockfile-rule.js.map +1 -0
- package/dist/application/rules/npm-workspace-dependency-rule.d.ts +10 -0
- package/dist/application/rules/npm-workspace-dependency-rule.d.ts.map +1 -0
- package/dist/application/rules/npm-workspace-dependency-rule.js +155 -0
- package/dist/application/rules/npm-workspace-dependency-rule.js.map +1 -0
- package/dist/application/rules/package-dependency-rule.d.ts +4 -3
- package/dist/application/rules/package-dependency-rule.d.ts.map +1 -1
- package/dist/application/rules/package-dependency-rule.js +33 -28
- package/dist/application/rules/package-dependency-rule.js.map +1 -1
- package/dist/application/services/analyze-import-impact.d.ts +3 -1
- package/dist/application/services/analyze-import-impact.d.ts.map +1 -1
- package/dist/application/services/analyze-import-impact.js +12 -7
- package/dist/application/services/analyze-import-impact.js.map +1 -1
- package/dist/infrastructure/git/git-file-snapshot-source.d.ts.map +1 -1
- package/dist/infrastructure/git/git-file-snapshot-source.js +4 -2
- package/dist/infrastructure/git/git-file-snapshot-source.js.map +1 -1
- package/dist/infrastructure/npm/npm-package-lock-parser.d.ts +6 -0
- package/dist/infrastructure/npm/npm-package-lock-parser.d.ts.map +1 -0
- package/dist/infrastructure/npm/npm-package-lock-parser.js +93 -0
- package/dist/infrastructure/npm/npm-package-lock-parser.js.map +1 -0
- package/dist/infrastructure/typescript/typescript-config-loader.d.ts +17 -0
- package/dist/infrastructure/typescript/typescript-config-loader.d.ts.map +1 -0
- package/dist/infrastructure/typescript/typescript-config-loader.js +99 -0
- package/dist/infrastructure/typescript/typescript-config-loader.js.map +1 -0
- package/dist/infrastructure/typescript/typescript-module-alias-resolver.d.ts +10 -0
- package/dist/infrastructure/typescript/typescript-module-alias-resolver.d.ts.map +1 -0
- package/dist/infrastructure/typescript/typescript-module-alias-resolver.js +78 -0
- package/dist/infrastructure/typescript/typescript-module-alias-resolver.js.map +1 -0
- package/dist/presentation/analyze-repository.d.ts.map +1 -1
- package/dist/presentation/analyze-repository.js +7 -3
- package/dist/presentation/analyze-repository.js.map +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
# IntentPatch
|
|
2
2
|
|
|
3
|
+
**English** | [한국어](./README.ko.md)
|
|
4
|
+
|
|
3
5
|
[](https://github.com/xx2xxjaeil/intent-patch/actions/workflows/ci.yml)
|
|
4
6
|
|
|
5
|
-
>
|
|
7
|
+
> Evidence-based change-scope analysis for code written by AI coding agents
|
|
8
|
+
|
|
9
|
+
AI coding agents such as Codex, Claude Code, and Cursor can change many files from a short request. As the patch grows, it becomes harder to answer a few important questions:
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
- Did the agent change files outside the requested scope?
|
|
12
|
+
- Did it recreate logic that already existed?
|
|
13
|
+
- Did it add an unnecessary dependency or abstraction?
|
|
14
|
+
- How far can the change affect other modules?
|
|
15
|
+
- Were relevant tests changed with the production code?
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
- 기존 코드를 재사용하지 않고 비슷한 로직을 새로 만들지 않았는가?
|
|
12
|
-
- 불필요한 라이브러리나 추상화를 추가하지 않았는가?
|
|
13
|
-
- 이번 변경이 다른 모듈에 어디까지 영향을 주는가?
|
|
14
|
-
- 중요한 동작에 대한 테스트가 함께 추가되었는가?
|
|
17
|
+
IntentPatch combines **Git diff analysis, static analysis, and dependency analysis** to answer those questions. Its core analysis is deterministic and works without an LLM. Optional AI explanations can be added later without making the core tool dependent on a model provider.
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
LLM 없이도 재현 가능한 분석을 제공하고, AI 설명 기능은 선택적으로 결합하는 것을 목표로
|
|
18
|
-
합니다.
|
|
19
|
+
## Quick start
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
IntentPatch requires Node.js 20 or later and Git. Run the published v0.2.0 CLI without
|
|
22
|
+
installing it globally:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx intentpatch analyze --cwd /path/to/repository
|
|
26
|
+
npx intentpatch analyze --format html --output intentpatch-report.html
|
|
27
|
+
```
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
실행할 수 있습니다.
|
|
29
|
+
To run the current source version instead, build it from the repository:
|
|
24
30
|
|
|
25
31
|
```bash
|
|
26
32
|
git clone https://github.com/xx2xxjaeil/intent-patch.git
|
|
@@ -31,20 +37,11 @@ node dist/presentation/cli/main.js --version
|
|
|
31
37
|
node dist/presentation/cli/main.js analyze --cwd /path/to/repository
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npx intentpatch analyze --cwd /path/to/repository
|
|
38
|
-
npx intentpatch analyze --format html --output intentpatch-report.html
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
핵심 분석에는 API key, 유료 AI 모델, 서버 또는 데이터베이스가 필요하지 않습니다. 분석할 Git
|
|
42
|
-
저장소의 파일은 로컬에서 처리하며 LLM 연결은 현재 기본 실행 경로에 포함되지 않습니다.
|
|
40
|
+
The core analyzer needs no API key, paid AI model, server, or database. Repository files are processed locally, and no LLM is used in the default execution path.
|
|
43
41
|
|
|
44
42
|
## GitHub Action
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
사용하도록 checkout의 전체 히스토리를 가져와야 합니다.
|
|
44
|
+
Use IntentPatch in pull requests to check scope and risky changes automatically. The checkout must include the full Git history so the action can compare the exact base and head commits.
|
|
48
45
|
|
|
49
46
|
```yaml
|
|
50
47
|
name: IntentPatch
|
|
@@ -65,7 +62,7 @@ jobs:
|
|
|
65
62
|
|
|
66
63
|
- name: Analyze pull request
|
|
67
64
|
id: intentpatch
|
|
68
|
-
uses: xx2xxjaeil/intent-patch@
|
|
65
|
+
uses: xx2xxjaeil/intent-patch@v0.2.0
|
|
69
66
|
with:
|
|
70
67
|
fail-on: high
|
|
71
68
|
|
|
@@ -77,20 +74,20 @@ jobs:
|
|
|
77
74
|
path: intentpatch-report
|
|
78
75
|
```
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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.
|
|
79
|
+
|
|
80
|
+
The action detects the comparison range for pull request and push events and produces:
|
|
83
81
|
|
|
84
|
-
- GitHub Actions Job Summary
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
- `high`, `medium`, `low`
|
|
88
|
-
- finding
|
|
82
|
+
- a Markdown report in the GitHub Actions Job Summary;
|
|
83
|
+
- workflow annotations grouped by severity;
|
|
84
|
+
- JSON and HTML reports that can be uploaded as artifacts;
|
|
85
|
+
- a quality gate at the `high`, `medium`, or `low` threshold;
|
|
86
|
+
- action outputs containing finding counts and report paths.
|
|
89
87
|
|
|
90
|
-
|
|
91
|
-
확인할 수 있습니다.
|
|
88
|
+
See the [GitHub Action guide](./docs/github-action.md) for inputs, outputs, and event-specific comparison behavior.
|
|
92
89
|
|
|
93
|
-
##
|
|
90
|
+
## What the report looks like
|
|
94
91
|
|
|
95
92
|
```text
|
|
96
93
|
IntentPatch Change Report
|
|
@@ -116,80 +113,88 @@ Impacted files
|
|
|
116
113
|
|
|
117
114
|
Potential issues
|
|
118
115
|
|
|
119
|
-
HIGH
|
|
120
|
-
MEDIUM
|
|
121
|
-
MEDIUM
|
|
122
|
-
LOW
|
|
116
|
+
HIGH Breaking change to a public function signature
|
|
117
|
+
MEDIUM Implementation duplicates existing authentication logic
|
|
118
|
+
MEDIUM Four files changed outside the expected scope
|
|
119
|
+
LOW New abstraction has only one implementation
|
|
123
120
|
```
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
122
|
+
Every finding includes the relevant file, a stable rule ID, and evidence for the decision instead of only presenting an unexplained warning.
|
|
123
|
+
|
|
124
|
+
## Implemented capabilities
|
|
125
|
+
|
|
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.
|
|
127
|
+
|
|
128
|
+
### Git and reporting
|
|
129
|
+
|
|
130
|
+
- Compare `HEAD` with the current working tree.
|
|
131
|
+
- Compare two Git references or branches from their merge base.
|
|
132
|
+
- Classify added, modified, deleted, and renamed files.
|
|
133
|
+
- Count added and deleted lines per file.
|
|
134
|
+
- Distinguish binary files.
|
|
135
|
+
- Include untracked files in working-tree analysis.
|
|
136
|
+
- Render terminal-friendly text and machine-readable JSON reports.
|
|
137
|
+
- Generate a standalone HTML report containing summary cards, findings, test signals, and an impact graph.
|
|
138
|
+
- Render the visualization with inline CSS and SVG, without a CDN or runtime JavaScript dependency.
|
|
139
|
+
- Aggregate findings by `high`, `medium`, and `low` severity.
|
|
140
|
+
- Return a CI-friendly exit code through `--fail-on`.
|
|
141
|
+
- Print the installed package version through `--version`.
|
|
142
|
+
|
|
143
|
+
### Dependencies and TypeScript structure
|
|
144
|
+
|
|
145
|
+
- Detect additions to production and development dependencies.
|
|
146
|
+
- Detect dependency removal, version changes, and section moves.
|
|
147
|
+
- Report malformed `package.json` files as evidence-backed findings instead of crashing.
|
|
148
|
+
- Compare resolved package additions, removals, and version changes in npm `package-lock.json` v2/v3.
|
|
149
|
+
- Keep scoped and nested installation paths distinct, and exclude local workspace links.
|
|
150
|
+
- Report malformed or unsupported lockfiles as findings rather than silently skipping them.
|
|
151
|
+
- Attribute direct dependency changes to changed npm workspace manifests selected by the root `workspaces` patterns.
|
|
152
|
+
- Report changes to workspace patterns and manifest moves into or out of a configured workspace.
|
|
153
|
+
- Extract top-level named functions, classes, interfaces, and type aliases from `.ts` and `.tsx` files.
|
|
154
|
+
- Detect symbol additions, modifications, and removals with source locations.
|
|
155
|
+
- Preserve direct exports, local export lists, and external re-exports as public-symbol evidence.
|
|
156
|
+
- Report removed public symbols and removed exports as high-severity compatibility risks.
|
|
157
|
+
- Detect removed public function call signatures and incompatible public interface changes.
|
|
158
|
+
- Exclude overloads that only gain an implementation while reporting previously available overloads that disappear.
|
|
159
|
+
- Find newly added functions whose normalized implementation matches an existing function.
|
|
160
|
+
- Report a newly added interface when exactly one class explicitly implements it.
|
|
161
|
+
- Compare symbols correctly across renamed files.
|
|
162
|
+
- Preserve syntax errors as analysis evidence instead of silently dropping a file.
|
|
163
|
+
|
|
164
|
+
### Impact, scope, and tests
|
|
165
|
+
|
|
166
|
+
- Build relative static import and re-export relationships for `.ts` and `.tsx` files.
|
|
167
|
+
- Resolve local imports through the nearest `tsconfig.json` or `jsconfig.json` `paths` and
|
|
168
|
+
`baseUrl`, including relative `extends` files.
|
|
169
|
+
- Resolve `.js`, `.jsx`, `.mjs`, and `.cjs` import specifiers to matching TypeScript sources.
|
|
170
|
+
- Calculate direct importers and transitively impacted files for changed modules.
|
|
171
|
+
- Preserve unresolved relative imports and file read or parse failures as evidence.
|
|
172
|
+
- Build the graph at the same result point as the diff: the working tree or the selected head ref.
|
|
173
|
+
- Read intent, expected paths, allowed paths, and change budgets from `.intentpatch.json`.
|
|
174
|
+
- Report each file outside expected and allowed patterns as a medium-severity finding.
|
|
175
|
+
- Report file-count and measurable-line budget overruns with numeric evidence.
|
|
176
|
+
- Classify source and test paths declared by the contract and connect related changes by basename.
|
|
177
|
+
- Report test file counts and added or deleted tests as separate facts.
|
|
178
|
+
- Report source files without a related test change as medium-severity findings.
|
|
179
|
+
- Support repository-relative `*`, `**`, and `?` path patterns.
|
|
180
|
+
|
|
181
|
+
Transitive lockfile dependency provenance, JavaScript and method-level structure analysis, and optional AI review are not implemented yet.
|
|
182
|
+
|
|
183
|
+
## CLI usage
|
|
184
|
+
|
|
185
|
+
Analyze the current repository's working tree:
|
|
181
186
|
|
|
182
187
|
```bash
|
|
183
188
|
node dist/presentation/cli/main.js analyze
|
|
184
189
|
```
|
|
185
190
|
|
|
186
|
-
|
|
191
|
+
Analyze another Git repository:
|
|
187
192
|
|
|
188
193
|
```bash
|
|
189
194
|
node dist/presentation/cli/main.js analyze --cwd /path/to/repository
|
|
190
195
|
```
|
|
191
196
|
|
|
192
|
-
|
|
197
|
+
Compare two branches. IntentPatch analyzes their changes from the merge base:
|
|
193
198
|
|
|
194
199
|
```bash
|
|
195
200
|
node dist/presentation/cli/main.js analyze \
|
|
@@ -198,13 +203,13 @@ node dist/presentation/cli/main.js analyze \
|
|
|
198
203
|
--head feature/account-deletion
|
|
199
204
|
```
|
|
200
205
|
|
|
201
|
-
JSON
|
|
206
|
+
Write JSON output:
|
|
202
207
|
|
|
203
208
|
```bash
|
|
204
209
|
node dist/presentation/cli/main.js analyze --json
|
|
205
210
|
```
|
|
206
211
|
|
|
207
|
-
|
|
212
|
+
Create a standalone HTML report:
|
|
208
213
|
|
|
209
214
|
```bash
|
|
210
215
|
node dist/presentation/cli/main.js analyze \
|
|
@@ -212,18 +217,15 @@ node dist/presentation/cli/main.js analyze \
|
|
|
212
217
|
--output intentpatch-report.html
|
|
213
218
|
```
|
|
214
219
|
|
|
215
|
-
HTML
|
|
216
|
-
바로 열 수 있습니다. `--output`은 텍스트와 JSON 형식에도 사용할 수 있으며 상대 경로는
|
|
217
|
-
IntentPatch를 실행한 현재 디렉터리를 기준으로 해석합니다. 기존 `--json`은
|
|
218
|
-
`--format json`의 단축 옵션입니다.
|
|
220
|
+
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`.
|
|
219
221
|
|
|
220
|
-
###
|
|
222
|
+
### Check request scope with a Change Contract
|
|
221
223
|
|
|
222
|
-
|
|
224
|
+
Create `.intentpatch.json` in the repository being analyzed and declare the expected scope of the request:
|
|
223
225
|
|
|
224
226
|
```json
|
|
225
227
|
{
|
|
226
|
-
"intent": "
|
|
228
|
+
"intent": "Implement account deletion",
|
|
227
229
|
"scope": {
|
|
228
230
|
"include": ["src/user/**", "tests/user/**"],
|
|
229
231
|
"allow": ["package.json", "package-lock.json"],
|
|
@@ -238,19 +240,17 @@ IntentPatch를 실행한 현재 디렉터리를 기준으로 해석합니다.
|
|
|
238
240
|
}
|
|
239
241
|
```
|
|
240
242
|
|
|
241
|
-
- `include`:
|
|
242
|
-
- `allow`:
|
|
243
|
-
- `maxFiles`:
|
|
244
|
-
- `maxLines`:
|
|
245
|
-
- `tests.requireFor`:
|
|
246
|
-
- `tests.include`:
|
|
247
|
-
- `tests.exclude`:
|
|
243
|
+
- `include`: paths expected to change for the request;
|
|
244
|
+
- `allow`: exceptional paths such as configuration or lockfiles;
|
|
245
|
+
- `maxFiles`: maximum number of changed files;
|
|
246
|
+
- `maxLines`: maximum total of measurable added and deleted lines;
|
|
247
|
+
- `tests.requireFor`: source paths that require a related test change;
|
|
248
|
+
- `tests.include`: paths classified as tests;
|
|
249
|
+
- `tests.exclude`: generated or declaration files excluded from the source check.
|
|
248
250
|
|
|
249
|
-
|
|
250
|
-
`tests/user.test.ts`, `user.spec.ts`, `user.integration.test.ts` 같은 변경과 연결됩니다.
|
|
251
|
+
Test matching uses basenames for deterministic results. For example, `src/user.ts` can match changed files such as `tests/user.test.ts`, `user.spec.ts`, or `user.integration.test.ts`.
|
|
251
252
|
|
|
252
|
-
|
|
253
|
-
해석합니다.
|
|
253
|
+
Use `--config` to select another contract. Relative paths are resolved from `--cwd`:
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
256
|
node dist/presentation/cli/main.js analyze \
|
|
@@ -258,19 +258,19 @@ node dist/presentation/cli/main.js analyze \
|
|
|
258
258
|
--config contracts/delete-user.json
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
Start with [`.intentpatch.example.json`](./.intentpatch.example.json). Without a contract, all existing analysis still runs and only the scope rules are disabled.
|
|
262
|
+
|
|
263
|
+
### Quality gates
|
|
263
264
|
|
|
264
|
-
|
|
265
|
+
Return exit code `1` after rendering the report when a finding meets or exceeds the selected severity:
|
|
265
266
|
|
|
266
267
|
```bash
|
|
267
268
|
node dist/presentation/cli/main.js analyze --fail-on medium
|
|
268
269
|
```
|
|
269
270
|
|
|
270
|
-
`medium
|
|
271
|
-
게이트 대상으로 취급합니다. 잘못된 CLI 사용은 종료 코드 `2`를 반환합니다.
|
|
271
|
+
`medium` reacts to both medium- and high-severity findings. `low` treats every finding as a quality-gate failure. Invalid CLI usage returns exit code `2`.
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
An evidence-rich result looks like this:
|
|
274
274
|
|
|
275
275
|
```text
|
|
276
276
|
IntentPatch Change Report
|
|
@@ -328,16 +328,15 @@ LOW New interface has one implementation
|
|
|
328
328
|
The new interface DeletionStrategy is implemented only by DefaultDeletionStrategy.
|
|
329
329
|
```
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
Run the TypeScript entry point directly during development:
|
|
332
332
|
|
|
333
333
|
```bash
|
|
334
334
|
npm run dev -- analyze --cwd /path/to/repository
|
|
335
335
|
```
|
|
336
336
|
|
|
337
|
-
##
|
|
337
|
+
## Architecture
|
|
338
338
|
|
|
339
|
-
|
|
340
|
-
방향을 적용했습니다.
|
|
339
|
+
IntentPatch applies Clean Architecture dependency direction so Git, presentation, and analysis rules do not become tightly coupled as the project grows.
|
|
341
340
|
|
|
342
341
|
```text
|
|
343
342
|
presentation ───────▶ application ───────▶ domain
|
|
@@ -345,109 +344,114 @@ presentation ───────▶ application ───────▶ domai
|
|
|
345
344
|
└──▶ infrastructure ──┘
|
|
346
345
|
```
|
|
347
346
|
|
|
348
|
-
|
|
|
347
|
+
| Layer | Responsibility |
|
|
349
348
|
| --- | --- |
|
|
350
|
-
| `domain` |
|
|
351
|
-
| `application` |
|
|
352
|
-
| `infrastructure` | Git
|
|
353
|
-
| `presentation` | CLI
|
|
349
|
+
| `domain` | Core models for changed files, Change Contracts, findings, symbol changes, and dependency impact |
|
|
350
|
+
| `application` | Analysis use cases, rule engine, symbol and impact calculations, and ports for external data |
|
|
351
|
+
| `infrastructure` | Git commands, diff parsing, project-file access, and TypeScript AST parsing |
|
|
352
|
+
| `presentation` | CLI argument handling, dependency composition, and text, JSON, and HTML output |
|
|
354
353
|
|
|
355
|
-
|
|
356
|
-
구현상의 주요 판단과 확장 지점은 [상세 아키텍처 문서](./docs/architecture.md)에서 설명합니다.
|
|
354
|
+
Architecture tests enforce the import direction so inner layers never depend on external implementations. See the [architecture document](./docs/architecture.md) for design decisions and extension points.
|
|
357
355
|
|
|
358
|
-
##
|
|
356
|
+
## Design principles
|
|
359
357
|
|
|
360
|
-
- **Deterministic first:**
|
|
361
|
-
- **Evidence over claims:**
|
|
362
|
-
- **LLM optional:**
|
|
363
|
-
- **Dependency minimalism:**
|
|
364
|
-
- **Explicit boundaries:**
|
|
358
|
+
- **Deterministic first:** the same input produces the same core analysis result.
|
|
359
|
+
- **Evidence over claims:** uncertain signals are not presented as facts.
|
|
360
|
+
- **LLM optional:** useful analysis remains available without an AI provider.
|
|
361
|
+
- **Dependency minimalism:** convenience alone does not justify another library.
|
|
362
|
+
- **Explicit boundaries:** domain logic stays separate from external details such as Git and CLI frameworks.
|
|
365
363
|
|
|
366
|
-
##
|
|
364
|
+
## Testing and quality checks
|
|
367
365
|
|
|
368
366
|
```bash
|
|
369
367
|
npm run check
|
|
370
368
|
```
|
|
371
369
|
|
|
372
|
-
|
|
370
|
+
This command runs:
|
|
373
371
|
|
|
374
|
-
-
|
|
375
|
-
- Biome
|
|
376
|
-
-
|
|
377
|
-
-
|
|
378
|
-
-
|
|
379
|
-
-
|
|
372
|
+
- strict TypeScript type checking;
|
|
373
|
+
- Biome lint and format checks;
|
|
374
|
+
- domain and use-case unit tests;
|
|
375
|
+
- integration tests against real temporary Git repositories;
|
|
376
|
+
- a package integration test that installs the generated npm tarball in a temporary project and executes it;
|
|
377
|
+
- architecture tests that enforce dependency direction;
|
|
378
|
+
- a reproducibility check for the bundled GitHub Action.
|
|
380
379
|
|
|
381
|
-
|
|
380
|
+
Run only the production build with:
|
|
382
381
|
|
|
383
382
|
```bash
|
|
384
383
|
npm run build
|
|
385
384
|
```
|
|
386
385
|
|
|
387
|
-
|
|
386
|
+
Inspect the files that would be published without creating a public release:
|
|
388
387
|
|
|
389
388
|
```bash
|
|
390
389
|
npm pack --dry-run
|
|
391
390
|
```
|
|
392
391
|
|
|
393
|
-
##
|
|
394
|
-
|
|
395
|
-
1.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
-
|
|
413
|
-
-
|
|
414
|
-
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
-
|
|
428
|
-
|
|
429
|
-
-
|
|
430
|
-
-
|
|
431
|
-
-
|
|
432
|
-
|
|
433
|
-
-
|
|
434
|
-
|
|
435
|
-
-
|
|
436
|
-
|
|
437
|
-
-
|
|
438
|
-
-
|
|
439
|
-
|
|
440
|
-
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
392
|
+
## Release process
|
|
393
|
+
|
|
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:
|
|
395
|
+
|
|
396
|
+
1. Validate the tag, package version, and default-branch ancestry.
|
|
397
|
+
2. Run the full quality suite and inspect the npm package with a dry run.
|
|
398
|
+
3. Publish through npm Trusted Publishing with OpenID Connect.
|
|
399
|
+
4. Create a GitHub Release with automatically generated notes.
|
|
400
|
+
|
|
401
|
+
No long-lived npm token is stored as a GitHub secret. Public packages published through OIDC receive npm provenance automatically. A package that does not yet exist on npm needs a one-time bootstrap before a Trusted Publisher can be configured. See the [release operations guide](./docs/releasing.md) for bootstrap and subsequent release procedures.
|
|
402
|
+
|
|
403
|
+
## Roadmap
|
|
404
|
+
|
|
405
|
+
1. ✅ Direct `package.json` dependency detection and rule engine
|
|
406
|
+
2. ✅ TypeScript AST analysis for functions, classes, interfaces, and types
|
|
407
|
+
3. ✅ Relative static import graph and change-impact calculation
|
|
408
|
+
- ✅ TypeScript `paths` and `baseUrl` aliases from the nearest project config
|
|
409
|
+
4. ✅ Change Contract scope and change-budget analysis
|
|
410
|
+
5. ✅ Contract-based detection of missing related test changes
|
|
411
|
+
6. Package-manager adapters for lockfiles and workspaces
|
|
412
|
+
- ✅ npm `package-lock.json` v2/v3 resolved package changes
|
|
413
|
+
- ✅ npm workspace manifest dependency changes
|
|
414
|
+
- pnpm and Yarn adapters
|
|
415
|
+
7. ✅ Detection of removed public exports
|
|
416
|
+
8. ✅ Standalone HTML dashboard and SVG dependency-impact graph
|
|
417
|
+
9. ✅ Re-export and function/interface compatibility checks plus possible code duplication
|
|
418
|
+
10. ✅ Detection of newly introduced single-implementation interfaces
|
|
419
|
+
11. ✅ GitHub Action with PR/push comparison, Job Summary, annotations, and artifacts
|
|
420
|
+
12. Codex, Claude Code, and Cursor adapters
|
|
421
|
+
13. Optional LLM explanations grounded in deterministic evidence
|
|
422
|
+
|
|
423
|
+
## Current limitations
|
|
424
|
+
|
|
425
|
+
- The target must be a Git repository with at least one commit.
|
|
426
|
+
- Untracked symbolic links are not read for safety.
|
|
427
|
+
- 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.
|
|
429
|
+
- 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.
|
|
430
|
+
- 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.
|
|
435
|
+
- Function compatibility compares explicitly written parameter and return-type text. It does not evaluate inferred return types or full TypeScript structural assignability.
|
|
436
|
+
- 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
|
+
- 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.
|
|
439
|
+
- 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
|
|
442
|
+
`jsconfig.json`, with relative `extends` support.
|
|
443
|
+
- 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.
|
|
446
|
+
- 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
|
+
- Source files used for impact analysis are limited to 1 MiB per file, and symbolic links are not read.
|
|
448
|
+
- IntentPatch does not infer expected paths from natural-language intent. Scope decisions use the contract's explicit `include` and `allow` patterns.
|
|
449
|
+
- Path patterns support only repository-relative `*`, `**`, and `?`; negation and brace expansion are not supported.
|
|
450
|
+
- `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.
|
|
451
|
+
- Test analysis compares only the changed paths declared in the contract; it does not execute tests or measure coverage.
|
|
452
|
+
- Related tests are matched by basename. Integration tests with different names or one test covering several source files cannot be linked automatically yet.
|
|
453
|
+
- The HTML impact graph uses a deterministic two-column layout. Interactive node movement, zooming, and filtering are not implemented yet.
|
|
454
|
+
|
|
455
|
+
## License
|
|
452
456
|
|
|
453
457
|
[MIT](./LICENSE)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ImpactAnalysisIssue } from "../../domain/impact.js";
|
|
2
|
+
import type { AnalysisTarget } from "../../domain/report.js";
|
|
3
|
+
/** 분석 결과점에서 해석 가능한 비상대 경로 import를 찾는 언어별 출력 포트다. */
|
|
4
|
+
export interface ModuleAliasResolver {
|
|
5
|
+
prepare(target: AnalysisTarget, repositoryPaths: readonly string[], sourcePaths: ReadonlySet<string>): Promise<PreparedModuleAliasResolver>;
|
|
6
|
+
}
|
|
7
|
+
export interface PreparedModuleAliasResolver {
|
|
8
|
+
readonly issues: readonly ImpactAnalysisIssue[];
|
|
9
|
+
resolve(importer: string, specifier: string): string | undefined;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=module-alias-resolver.d.ts.map
|