openapi-usage 0.0.1 → 0.0.3
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.ja.md +223 -0
- package/README.md +108 -46
- package/dist/cli.d.ts +5 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -3
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +30 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +68 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +1 -2
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -6
- package/dist/output.js.map +1 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +55 -10
- package/dist/runner.js.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
package/README.ja.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# openapi-usage
|
|
2
|
+
|
|
3
|
+
[English](./README.md)
|
|
4
|
+
|
|
5
|
+
OpenAPI 仕様を正として、フロントエンドの API 呼び出しを静的解析し、**呼び出し元の可視化**と**未使用 API の検知**を行うツール。
|
|
6
|
+
|
|
7
|
+
## インストール
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install openapi-usage
|
|
11
|
+
# or
|
|
12
|
+
pnpm add openapi-usage
|
|
13
|
+
# or
|
|
14
|
+
yarn add openapi-usage
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
グローバルインストール(CLIとして使用):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g openapi-usage
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 前提条件
|
|
24
|
+
|
|
25
|
+
- `openapi-typescript` + `openapi-fetch` を使用したAPIクライアント
|
|
26
|
+
- `createClient()` で作成されたクライアント(変数名は自動検出)
|
|
27
|
+
- 動的パス生成なし(文字列リテラルのみ)
|
|
28
|
+
|
|
29
|
+
## 検知パターン
|
|
30
|
+
|
|
31
|
+
### 検知できる
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// 文字列リテラル
|
|
35
|
+
client.GET("/users");
|
|
36
|
+
|
|
37
|
+
// createClient で作成した任意の変数名
|
|
38
|
+
const api = createClient<paths>();
|
|
39
|
+
api.GET("/users");
|
|
40
|
+
|
|
41
|
+
// 三項演算子
|
|
42
|
+
client.GET(isAdmin ? "/admins" : "/users");
|
|
43
|
+
|
|
44
|
+
// 単純な変数参照
|
|
45
|
+
const path = "/users";
|
|
46
|
+
client.GET(path);
|
|
47
|
+
|
|
48
|
+
// パスパラメータ(推奨パターン)
|
|
49
|
+
client.GET("/users/{id}", { params: { path: { id: userId } } });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 検知できない
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// テンプレートリテラル(型安全性も失われるため非推奨)
|
|
56
|
+
client.GET(`/users/${id}`);
|
|
57
|
+
|
|
58
|
+
// 関数の戻り値
|
|
59
|
+
const path = getPath();
|
|
60
|
+
client.GET(path);
|
|
61
|
+
|
|
62
|
+
// 文字列結合
|
|
63
|
+
client.GET("/users" + "/" + id);
|
|
64
|
+
|
|
65
|
+
// 動的に構築されたパス
|
|
66
|
+
const base = "/users";
|
|
67
|
+
client.GET(`${base}/${id}`);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> **Note:** 検知できないパターンは `openapi-fetch` の型安全性も失われます。
|
|
71
|
+
> パスパラメータは `params.path` で渡す方法を推奨します。
|
|
72
|
+
|
|
73
|
+
## 設定ファイル
|
|
74
|
+
|
|
75
|
+
YAML形式の設定ファイルで openapi-usage を設定できます。以下のファイル名は自動的に検出されます:
|
|
76
|
+
|
|
77
|
+
- `openapi-usage.yaml`
|
|
78
|
+
- `openapi-usage.yml`
|
|
79
|
+
- `.openapi-usage.yaml`
|
|
80
|
+
- `.openapi-usage.yml`
|
|
81
|
+
|
|
82
|
+
### 設定例
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
# openapi-usage.yaml
|
|
86
|
+
openapi: ./openapi.json
|
|
87
|
+
src: ./src
|
|
88
|
+
output: ./api-usage.json
|
|
89
|
+
level: error
|
|
90
|
+
|
|
91
|
+
# 特定のエンドポイントを無視
|
|
92
|
+
ignore:
|
|
93
|
+
- "GET /health"
|
|
94
|
+
- "GET /metrics"
|
|
95
|
+
- "* /internal/*" # ワイルドカードパターン
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 設定オプション
|
|
99
|
+
|
|
100
|
+
| オプション | 説明 |
|
|
101
|
+
|------------|------|
|
|
102
|
+
| `openapi` | OpenAPI仕様ファイル(json)のパス |
|
|
103
|
+
| `src` | 解析対象ディレクトリ |
|
|
104
|
+
| `output` | JSON出力先パス |
|
|
105
|
+
| `level` | 重大度レベル: `error` または `warn` |
|
|
106
|
+
| `ignore` | 無視するエンドポイントのリスト(ワイルドカード対応) |
|
|
107
|
+
|
|
108
|
+
### ignoreパターン
|
|
109
|
+
|
|
110
|
+
`ignore` オプションは完全一致とワイルドカードパターンをサポートします:
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
ignore:
|
|
114
|
+
# 完全一致
|
|
115
|
+
- "GET /health"
|
|
116
|
+
- "POST /internal/webhook"
|
|
117
|
+
|
|
118
|
+
# ワイルドカードパターン
|
|
119
|
+
- "* /internal/*" # /internal/ 配下のすべてのメソッド
|
|
120
|
+
- "GET /admin/*" # /admin/ 配下のすべてのGETリクエスト
|
|
121
|
+
- "* /v1/deprecated/*" # 非推奨のv1エンドポイントすべて
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## CLI オプション
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
openapi-usage [options]
|
|
128
|
+
|
|
129
|
+
オプション:
|
|
130
|
+
-o, --openapi <path> OpenAPI仕様ファイル(json)のパス
|
|
131
|
+
-s, --src <path> 解析対象ディレクトリ
|
|
132
|
+
--output <path> JSON出力先パス
|
|
133
|
+
--check チェックモード(未使用があればexit 1、--level errorの場合)
|
|
134
|
+
--level <level> 未使用APIの重大度レベル: "error" または "warn"(デフォルト: "error")
|
|
135
|
+
-c, --config <path> 設定ファイル(YAML)のパス
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
CLIオプションは設定ファイルの設定を上書きします。
|
|
139
|
+
|
|
140
|
+
### 重大度レベル
|
|
141
|
+
|
|
142
|
+
`--level` オプションは未使用APIが検出されたときの動作を制御します:
|
|
143
|
+
|
|
144
|
+
- `--level error`(デフォルト): 未使用APIが見つかった場合、終了コード1で終了
|
|
145
|
+
- `--level warn`: 終了コード0で終了し、警告のみ表示
|
|
146
|
+
|
|
147
|
+
## 出力形式
|
|
148
|
+
|
|
149
|
+
### ツリー表示(--check モード)
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
GET /users
|
|
153
|
+
├─ src/pages/Users.tsx:42
|
|
154
|
+
└─ src/hooks/useUsers.ts:18
|
|
155
|
+
|
|
156
|
+
DELETE /users/{id}
|
|
157
|
+
└─ (未使用)
|
|
158
|
+
|
|
159
|
+
───────────────────────────────────
|
|
160
|
+
未使用 API: 1件
|
|
161
|
+
- DELETE /users/{id}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### JSON出力(--output モード)
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"generated_at": "2026-01-13T10:00:00Z",
|
|
169
|
+
"endpoints": [
|
|
170
|
+
{
|
|
171
|
+
"method": "GET",
|
|
172
|
+
"path": "/users",
|
|
173
|
+
"usages": [
|
|
174
|
+
{ "file": "src/pages/Users.tsx", "line": 42 }
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"summary": {
|
|
179
|
+
"total": 50,
|
|
180
|
+
"used": 49,
|
|
181
|
+
"unused": 1
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## 終了コード
|
|
187
|
+
|
|
188
|
+
| コード | 意味 |
|
|
189
|
+
|--------|------|
|
|
190
|
+
| 0 | 未使用 API なし(または `--level warn`) |
|
|
191
|
+
| 1 | 未使用 API あり(`--level error` の場合) |
|
|
192
|
+
|
|
193
|
+
## ライブラリとして使用
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import {
|
|
197
|
+
loadOpenAPISpec,
|
|
198
|
+
parseOpenAPISpec,
|
|
199
|
+
analyzeTypeScriptFiles,
|
|
200
|
+
generateJsonOutput,
|
|
201
|
+
} from "openapi-usage";
|
|
202
|
+
|
|
203
|
+
// OpenAPI仕様を読み込み
|
|
204
|
+
const specResult = loadOpenAPISpec("./openapi.json");
|
|
205
|
+
if (!specResult.success) {
|
|
206
|
+
console.error(specResult.error);
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// エンドポイント一覧を抽出
|
|
211
|
+
const endpoints = parseOpenAPISpec(specResult.spec);
|
|
212
|
+
|
|
213
|
+
// TypeScriptファイルを解析
|
|
214
|
+
const usages = analyzeTypeScriptFiles(endpoints, { srcPath: "./src" });
|
|
215
|
+
|
|
216
|
+
// JSON出力を生成
|
|
217
|
+
const output = generateJsonOutput(usages);
|
|
218
|
+
console.log(JSON.stringify(output, null, 2));
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## ライセンス
|
|
222
|
+
|
|
223
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# openapi-usage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[日本語](./README.ja.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A tool for statically analyzing frontend API calls using OpenAPI spec as the source of truth. It provides **call site visualization** and **unused API detection**.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npm install openapi-usage
|
|
@@ -12,79 +14,139 @@ pnpm add openapi-usage
|
|
|
12
14
|
yarn add openapi-usage
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
Global installation (for CLI usage):
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
npm install -g openapi-usage
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
##
|
|
23
|
+
## Prerequisites
|
|
22
24
|
|
|
23
|
-
- `openapi-typescript` + `openapi-fetch`
|
|
24
|
-
- `createClient()`
|
|
25
|
-
-
|
|
25
|
+
- API client using `openapi-typescript` + `openapi-fetch`
|
|
26
|
+
- Client created with `createClient()` (variable name is auto-detected)
|
|
27
|
+
- No dynamic path generation (string literals only)
|
|
26
28
|
|
|
27
|
-
##
|
|
29
|
+
## Detection Patterns
|
|
28
30
|
|
|
29
|
-
###
|
|
31
|
+
### Detectable
|
|
30
32
|
|
|
31
33
|
```typescript
|
|
32
|
-
//
|
|
34
|
+
// String literals
|
|
33
35
|
client.GET("/users");
|
|
34
36
|
|
|
35
|
-
// createClient
|
|
37
|
+
// Any variable name created with createClient
|
|
36
38
|
const api = createClient<paths>();
|
|
37
39
|
api.GET("/users");
|
|
38
40
|
|
|
39
|
-
//
|
|
41
|
+
// Ternary operator
|
|
40
42
|
client.GET(isAdmin ? "/admins" : "/users");
|
|
41
43
|
|
|
42
|
-
//
|
|
44
|
+
// Simple variable reference
|
|
43
45
|
const path = "/users";
|
|
44
46
|
client.GET(path);
|
|
45
47
|
|
|
46
|
-
//
|
|
48
|
+
// Path parameters (recommended pattern)
|
|
47
49
|
client.GET("/users/{id}", { params: { path: { id: userId } } });
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
###
|
|
52
|
+
### Not Detectable
|
|
51
53
|
|
|
52
54
|
```typescript
|
|
53
|
-
//
|
|
55
|
+
// Template literals (not recommended as it also breaks type safety)
|
|
54
56
|
client.GET(`/users/${id}`);
|
|
55
57
|
|
|
56
|
-
//
|
|
58
|
+
// Function return values
|
|
57
59
|
const path = getPath();
|
|
58
60
|
client.GET(path);
|
|
59
61
|
|
|
60
|
-
//
|
|
62
|
+
// String concatenation
|
|
61
63
|
client.GET("/users" + "/" + id);
|
|
62
64
|
|
|
63
|
-
//
|
|
65
|
+
// Dynamically constructed paths
|
|
64
66
|
const base = "/users";
|
|
65
67
|
client.GET(`${base}/${id}`);
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
> **Note:**
|
|
69
|
-
>
|
|
70
|
+
> **Note:** Patterns that cannot be detected also lose `openapi-fetch` type safety.
|
|
71
|
+
> For path parameters, using `params.path` is recommended.
|
|
70
72
|
|
|
71
|
-
##
|
|
73
|
+
## Configuration File
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
You can configure openapi-usage using a YAML configuration file. The following filenames are automatically detected:
|
|
76
|
+
|
|
77
|
+
- `openapi-usage.yaml`
|
|
78
|
+
- `openapi-usage.yml`
|
|
79
|
+
- `.openapi-usage.yaml`
|
|
80
|
+
- `.openapi-usage.yml`
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
-o, --openapi <path> OpenAPI仕様ファイル(json)のパス
|
|
78
|
-
-s, --src <path> 解析対象ディレクトリ
|
|
82
|
+
### Example Configuration
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
```yaml
|
|
85
|
+
# openapi-usage.yaml
|
|
86
|
+
openapi: ./openapi.json
|
|
87
|
+
src: ./src
|
|
88
|
+
output: ./api-usage.json
|
|
89
|
+
level: error
|
|
90
|
+
|
|
91
|
+
# Ignore specific endpoints
|
|
92
|
+
ignore:
|
|
93
|
+
- "GET /health"
|
|
94
|
+
- "GET /metrics"
|
|
95
|
+
- "* /internal/*" # Wildcard pattern
|
|
83
96
|
```
|
|
84
97
|
|
|
85
|
-
|
|
98
|
+
### Configuration Options
|
|
99
|
+
|
|
100
|
+
| Option | Description |
|
|
101
|
+
|--------|-------------|
|
|
102
|
+
| `openapi` | Path to OpenAPI spec file (json) |
|
|
103
|
+
| `src` | Source directory to analyze |
|
|
104
|
+
| `output` | Output JSON file path |
|
|
105
|
+
| `level` | Severity level: `error` or `warn` |
|
|
106
|
+
| `ignore` | List of endpoints to ignore (supports wildcards) |
|
|
107
|
+
|
|
108
|
+
### Ignore Patterns
|
|
109
|
+
|
|
110
|
+
The `ignore` option supports exact matches and wildcard patterns:
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
ignore:
|
|
114
|
+
# Exact match
|
|
115
|
+
- "GET /health"
|
|
116
|
+
- "POST /internal/webhook"
|
|
117
|
+
|
|
118
|
+
# Wildcard patterns
|
|
119
|
+
- "* /internal/*" # All methods under /internal/
|
|
120
|
+
- "GET /admin/*" # All GET requests under /admin/
|
|
121
|
+
- "* /v1/deprecated/*" # All deprecated v1 endpoints
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## CLI Options
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
openapi-usage [options]
|
|
128
|
+
|
|
129
|
+
Options:
|
|
130
|
+
-o, --openapi <path> Path to OpenAPI spec file (json)
|
|
131
|
+
-s, --src <path> Source directory to analyze
|
|
132
|
+
--output <path> Output JSON file path
|
|
133
|
+
--check Check mode (exit 1 if unused APIs exist with --level error)
|
|
134
|
+
--level <level> Set severity level for unused APIs: "error" or "warn" (default: "error")
|
|
135
|
+
-c, --config <path> Path to config file (YAML)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
CLI options override configuration file settings.
|
|
139
|
+
|
|
140
|
+
### Severity Level
|
|
141
|
+
|
|
142
|
+
The `--level` option controls the behavior when unused APIs are detected:
|
|
143
|
+
|
|
144
|
+
- `--level error` (default): Exit with code 1 when unused APIs are found
|
|
145
|
+
- `--level warn`: Exit with code 0, only display warnings
|
|
146
|
+
|
|
147
|
+
## Output Format
|
|
86
148
|
|
|
87
|
-
###
|
|
149
|
+
### Tree Display (--check mode)
|
|
88
150
|
|
|
89
151
|
```
|
|
90
152
|
GET /users
|
|
@@ -92,14 +154,14 @@ GET /users
|
|
|
92
154
|
└─ src/hooks/useUsers.ts:18
|
|
93
155
|
|
|
94
156
|
DELETE /users/{id}
|
|
95
|
-
└─ (
|
|
157
|
+
└─ (unused)
|
|
96
158
|
|
|
97
159
|
───────────────────────────────────
|
|
98
|
-
|
|
160
|
+
Unused APIs: 1
|
|
99
161
|
- DELETE /users/{id}
|
|
100
162
|
```
|
|
101
163
|
|
|
102
|
-
### JSON
|
|
164
|
+
### JSON Output (--output mode)
|
|
103
165
|
|
|
104
166
|
```json
|
|
105
167
|
{
|
|
@@ -121,14 +183,14 @@ DELETE /users/{id}
|
|
|
121
183
|
}
|
|
122
184
|
```
|
|
123
185
|
|
|
124
|
-
##
|
|
186
|
+
## Exit Codes
|
|
125
187
|
|
|
126
|
-
|
|
|
127
|
-
|
|
128
|
-
| 0 |
|
|
129
|
-
| 1 |
|
|
188
|
+
| Code | Meaning |
|
|
189
|
+
|------|---------|
|
|
190
|
+
| 0 | No unused APIs (or `--level warn`) |
|
|
191
|
+
| 1 | Unused APIs exist (with `--level error`) |
|
|
130
192
|
|
|
131
|
-
##
|
|
193
|
+
## Library Usage
|
|
132
194
|
|
|
133
195
|
```typescript
|
|
134
196
|
import {
|
|
@@ -138,24 +200,24 @@ import {
|
|
|
138
200
|
generateJsonOutput,
|
|
139
201
|
} from "openapi-usage";
|
|
140
202
|
|
|
141
|
-
// OpenAPI
|
|
203
|
+
// Load OpenAPI spec
|
|
142
204
|
const specResult = loadOpenAPISpec("./openapi.json");
|
|
143
205
|
if (!specResult.success) {
|
|
144
206
|
console.error(specResult.error);
|
|
145
207
|
process.exit(1);
|
|
146
208
|
}
|
|
147
209
|
|
|
148
|
-
//
|
|
210
|
+
// Extract endpoint list
|
|
149
211
|
const endpoints = parseOpenAPISpec(specResult.spec);
|
|
150
212
|
|
|
151
|
-
// TypeScript
|
|
213
|
+
// Analyze TypeScript files
|
|
152
214
|
const usages = analyzeTypeScriptFiles(endpoints, { srcPath: "./src" });
|
|
153
215
|
|
|
154
|
-
// JSON
|
|
216
|
+
// Generate JSON output
|
|
155
217
|
const output = generateJsonOutput(usages);
|
|
156
218
|
console.log(JSON.stringify(output, null, 2));
|
|
157
219
|
```
|
|
158
220
|
|
|
159
|
-
##
|
|
221
|
+
## License
|
|
160
222
|
|
|
161
223
|
MIT
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
export type SeverityLevel = "error" | "warn";
|
|
2
3
|
export interface CliOptions {
|
|
3
|
-
openapi
|
|
4
|
-
src
|
|
4
|
+
openapi?: string;
|
|
5
|
+
src?: string;
|
|
5
6
|
output?: string;
|
|
6
7
|
check?: boolean;
|
|
8
|
+
level?: SeverityLevel;
|
|
9
|
+
config?: string;
|
|
7
10
|
}
|
|
8
11
|
/**
|
|
9
12
|
* CLIプログラムを作成する
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,UAAU;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAavC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAOvE"}
|
package/dist/cli.js
CHANGED
|
@@ -7,10 +7,12 @@ export function createProgram() {
|
|
|
7
7
|
return new Command()
|
|
8
8
|
.name("openapi-usage")
|
|
9
9
|
.description("Analyze API usage based on OpenAPI spec")
|
|
10
|
-
.
|
|
11
|
-
.
|
|
10
|
+
.option("-o, --openapi <path>", "Path to OpenAPI spec file")
|
|
11
|
+
.option("-s, --src <path>", "Path to source directory")
|
|
12
12
|
.option("--output <path>", "Output JSON file path")
|
|
13
|
-
.option("--check", "Check mode (exit 1 if unused APIs exist)")
|
|
13
|
+
.option("--check", "Check mode (exit 1 if unused APIs exist)")
|
|
14
|
+
.option("--level <level>", 'Severity level for unused APIs: "error" or "warn"')
|
|
15
|
+
.option("-c, --config <path>", "Path to config file (YAML)");
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* コマンドライン引数をパースしてオプションを取得する
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC5B,OAAO,IAAI,OAAO,EAAE;SAClB,IAAI,CAAC,eAAe,CAAC;SACrB,WAAW,CAAC,yCAAyC,CAAC;SACtD,MAAM,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;SAC3D,MAAM,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;SACtD,MAAM,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAClD,MAAM,CAAC,SAAS,EAAE,0CAA0C,CAAC;SAC7D,MAAM,CACN,iBAAiB,EACjB,mDAAmD,CACnD;SACA,MAAM,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,IAAe;IAC1D,IAAI,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,EAAc,CAAC;AACnC,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SeverityLevel } from "./cli.js";
|
|
2
|
+
export interface Config {
|
|
3
|
+
openapi?: string;
|
|
4
|
+
src?: string;
|
|
5
|
+
output?: string;
|
|
6
|
+
level?: SeverityLevel;
|
|
7
|
+
ignore?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface LoadConfigResult {
|
|
10
|
+
success: true;
|
|
11
|
+
config: Config;
|
|
12
|
+
}
|
|
13
|
+
export interface LoadConfigError {
|
|
14
|
+
success: false;
|
|
15
|
+
error: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 設定ファイルを探して読み込む
|
|
19
|
+
* @param configPath - 明示的に指定された設定ファイルパス(省略時はデフォルトファイルを探索)
|
|
20
|
+
* @returns 設定オブジェクトまたはエラー
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadConfig(configPath?: string): LoadConfigResult | LoadConfigError;
|
|
23
|
+
/**
|
|
24
|
+
* エンドポイントがignoreリストにマッチするか判定
|
|
25
|
+
* @param endpoint - "METHOD /path" 形式のエンドポイント
|
|
26
|
+
* @param ignorePatterns - ignoreパターンの配列
|
|
27
|
+
* @returns マッチした場合はtrue
|
|
28
|
+
*/
|
|
29
|
+
export declare function isIgnored(endpoint: string, ignorePatterns: string[]): boolean;
|
|
30
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,MAAM;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACd;AASD;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,UAAU,CAAC,EAAE,MAAM,GACjB,gBAAgB,GAAG,eAAe,CAiCpC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAc7E"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { parse } from "yaml";
|
|
4
|
+
const DEFAULT_CONFIG_FILES = [
|
|
5
|
+
"openapi-usage.yaml",
|
|
6
|
+
"openapi-usage.yml",
|
|
7
|
+
".openapi-usage.yaml",
|
|
8
|
+
".openapi-usage.yml",
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* 設定ファイルを探して読み込む
|
|
12
|
+
* @param configPath - 明示的に指定された設定ファイルパス(省略時はデフォルトファイルを探索)
|
|
13
|
+
* @returns 設定オブジェクトまたはエラー
|
|
14
|
+
*/
|
|
15
|
+
export function loadConfig(configPath) {
|
|
16
|
+
let resolvedPath;
|
|
17
|
+
if (configPath) {
|
|
18
|
+
resolvedPath = resolve(process.cwd(), configPath);
|
|
19
|
+
if (!existsSync(resolvedPath)) {
|
|
20
|
+
return {
|
|
21
|
+
success: false,
|
|
22
|
+
error: `Config file not found: ${resolvedPath}`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
for (const filename of DEFAULT_CONFIG_FILES) {
|
|
28
|
+
const candidate = resolve(process.cwd(), filename);
|
|
29
|
+
if (existsSync(candidate)) {
|
|
30
|
+
resolvedPath = candidate;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!resolvedPath) {
|
|
36
|
+
return { success: true, config: {} };
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const content = readFileSync(resolvedPath, "utf-8");
|
|
40
|
+
const parsed = parse(content);
|
|
41
|
+
return { success: true, config: parsed ?? {} };
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
45
|
+
return { success: false, error: `Failed to parse config file: ${message}` };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* エンドポイントがignoreリストにマッチするか判定
|
|
50
|
+
* @param endpoint - "METHOD /path" 形式のエンドポイント
|
|
51
|
+
* @param ignorePatterns - ignoreパターンの配列
|
|
52
|
+
* @returns マッチした場合はtrue
|
|
53
|
+
*/
|
|
54
|
+
export function isIgnored(endpoint, ignorePatterns) {
|
|
55
|
+
for (const pattern of ignorePatterns) {
|
|
56
|
+
if (pattern.includes("*")) {
|
|
57
|
+
const regex = new RegExp(`^${pattern.replace(/\*/g, ".*").replace(/\//g, "\\/")}$`);
|
|
58
|
+
if (regex.test(endpoint)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (endpoint === pattern) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAqB7B,MAAM,oBAAoB,GAAG;IAC5B,oBAAoB;IACpB,mBAAmB;IACnB,qBAAqB;IACrB,oBAAoB;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACzB,UAAmB;IAEnB,IAAI,YAAgC,CAAC;IAErC,IAAI,UAAU,EAAE,CAAC;QAChB,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC/B,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,0BAA0B,YAAY,EAAE;aAC/C,CAAC;QACH,CAAC;IACF,CAAC;SAAM,CAAC;QACP,KAAK,MAAM,QAAQ,IAAI,oBAAoB,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;YACnD,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC3B,YAAY,GAAG,SAAS,CAAC;gBACzB,MAAM;YACP,CAAC;QACF,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@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { type AnalyzeOptions, analyzeSourceFile, analyzeTypeScriptFiles, extractStringLiterals, findMatchingEndpoint, findOpenApiFetchClients, } from "./analyzer.js";
|
|
2
|
-
export { type CliOptions, createProgram, parseArgs } from "./cli.js";
|
|
2
|
+
export { type CliOptions, createProgram, parseArgs, type SeverityLevel, } from "./cli.js";
|
|
3
|
+
export { type Config, isIgnored, loadConfig } from "./config.js";
|
|
3
4
|
export { type LoadResult, loadOpenAPISpec, parseOpenAPISpec, } from "./openapi-parser.js";
|
|
4
5
|
export { formatSummary, formatTree, generateJsonOutput, getUnusedEndpoints, } from "./output.js";
|
|
5
6
|
export { type RunResult, run } from "./runner.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,cAAc,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,cAAc,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACN,KAAK,UAAU,EACf,aAAa,EACb,SAAS,EACT,KAAK,aAAa,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EACN,KAAK,UAAU,EACf,eAAe,EACf,gBAAgB,GAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,SAAS,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlD,YAAY,EACX,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,KAAK,GACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// Analyzer
|
|
3
3
|
export { analyzeSourceFile, analyzeTypeScriptFiles, extractStringLiterals, findMatchingEndpoint, findOpenApiFetchClients, } from "./analyzer.js";
|
|
4
4
|
// CLI
|
|
5
|
-
export { createProgram, parseArgs } from "./cli.js";
|
|
5
|
+
export { createProgram, parseArgs, } from "./cli.js";
|
|
6
|
+
// Config
|
|
7
|
+
export { isIgnored, loadConfig } from "./config.js";
|
|
6
8
|
// OpenAPI Parser
|
|
7
9
|
export { loadOpenAPISpec, parseOpenAPISpec, } from "./openapi-parser.js";
|
|
8
10
|
// Output
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,WAAW;AACX,OAAO,EAEN,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,eAAe,CAAC;AAEvB,MAAM;AACN,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,WAAW;AACX,OAAO,EAEN,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,eAAe,CAAC;AAEvB,MAAM;AACN,OAAO,EAEN,aAAa,EACb,SAAS,GAET,MAAM,UAAU,CAAC;AAClB,SAAS;AACT,OAAO,EAAe,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,iBAAiB;AACjB,OAAO,EAEN,eAAe,EACf,gBAAgB,GAChB,MAAM,qBAAqB,CAAC;AAC7B,SAAS;AACT,OAAO,EACN,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,aAAa,CAAC;AACrB,SAAS;AACT,OAAO,EAAkB,GAAG,EAAE,MAAM,aAAa,CAAC;AAalD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/output.d.ts
CHANGED
|
@@ -20,8 +20,7 @@ export declare const formatSummary: (usages: Map<string, Usage[]>) => string[];
|
|
|
20
20
|
/**
|
|
21
21
|
* API使用状況をJSON出力用のオブジェクトに変換する
|
|
22
22
|
* @param usages - エンドポイントごとの使用箇所マップ
|
|
23
|
-
* @param generatedAt - 生成日時(省略時は現在時刻)
|
|
24
23
|
* @returns JSON出力用のApiDependenciesオブジェクト
|
|
25
24
|
*/
|
|
26
|
-
export declare const generateJsonOutput: (usages: Map<string, Usage[]
|
|
25
|
+
export declare const generateJsonOutput: (usages: Map<string, Usage[]>) => ApiDependencies;
|
|
27
26
|
//# sourceMappingURL=output.d.ts.map
|
package/dist/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAY,KAAK,EAAE,MAAM,YAAY,CAAC;AAkBnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAAG,MAAM,EAG9D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAAG,MAAM,EAGlD,CAAC;AAEvB;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAAG,MAAM,EAalE,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAY,KAAK,EAAE,MAAM,YAAY,CAAC;AAkBnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAAG,MAAM,EAG9D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAAG,MAAM,EAGlD,CAAC;AAEvB;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAAG,MAAM,EAalE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC9B,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAC1B,eAkBF,CAAC"}
|
package/dist/output.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const sortByKey = (entries) => entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
2
2
|
const formatUsageLines = (key, usages) => {
|
|
3
3
|
if (usages.length === 0) {
|
|
4
|
-
return [key, "└─ (
|
|
4
|
+
return [key, "└─ (unused)", ""];
|
|
5
5
|
}
|
|
6
6
|
const usageLines = usages.map((usage, index) => {
|
|
7
7
|
const prefix = index === usages.length - 1 ? "└─" : "├─";
|
|
@@ -32,21 +32,20 @@ export const formatSummary = (usages) => {
|
|
|
32
32
|
const unused = getUnusedEndpoints(usages);
|
|
33
33
|
const separator = "─".repeat(35);
|
|
34
34
|
if (unused.length === 0) {
|
|
35
|
-
return [separator, "
|
|
35
|
+
return [separator, "Unused APIs: 0"];
|
|
36
36
|
}
|
|
37
37
|
return [
|
|
38
38
|
separator,
|
|
39
|
-
|
|
39
|
+
`Unused APIs: ${unused.length}`,
|
|
40
40
|
...unused.map((endpoint) => ` - ${endpoint}`),
|
|
41
41
|
];
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* API使用状況をJSON出力用のオブジェクトに変換する
|
|
45
45
|
* @param usages - エンドポイントごとの使用箇所マップ
|
|
46
|
-
* @param generatedAt - 生成日時(省略時は現在時刻)
|
|
47
46
|
* @returns JSON出力用のApiDependenciesオブジェクト
|
|
48
47
|
*/
|
|
49
|
-
export const generateJsonOutput = (usages
|
|
48
|
+
export const generateJsonOutput = (usages) => {
|
|
50
49
|
const entries = sortByKey([...usages.entries()]);
|
|
51
50
|
const endpoints = entries.map(([key, usageList]) => {
|
|
52
51
|
const [method, path] = key.split(" ", 2);
|
|
@@ -54,7 +53,6 @@ export const generateJsonOutput = (usages, generatedAt = new Date()) => {
|
|
|
54
53
|
});
|
|
55
54
|
const used = entries.filter(([, list]) => list.length > 0).length;
|
|
56
55
|
return {
|
|
57
|
-
generated_at: generatedAt.toISOString(),
|
|
58
56
|
endpoints,
|
|
59
57
|
summary: {
|
|
60
58
|
total: endpoints.length,
|
package/dist/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,CAAI,OAAsB,EAAiB,EAAE,CAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAElD,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAE,MAAe,EAAY,EAAE;IACnE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output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AAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IAElE,OAAO;QACN,SAAS;QACT,OAAO,EAAE;YACR,KAAK,EAAE,SAAS,CAAC,MAAM;YACvB,IAAI;YACJ,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI;SAC/B;KACD,CAAC;AACH,CAAC,CAAC"}
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,UAAU,CAAC;AAW1D,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AA0FD;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CA2DlD"}
|
package/dist/runner.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { analyzeTypeScriptFiles } from "./analyzer.js";
|
|
4
|
+
import { isIgnored, loadConfig } from "./config.js";
|
|
4
5
|
import { loadOpenAPISpec, parseOpenAPISpec } from "./openapi-parser.js";
|
|
5
6
|
import { formatSummary, formatTree, generateJsonOutput, getUnusedEndpoints, } from "./output.js";
|
|
6
|
-
function
|
|
7
|
+
function mergeOptions(cliOptions, config) {
|
|
8
|
+
const openapi = cliOptions.openapi ?? config.openapi;
|
|
9
|
+
const src = cliOptions.src ?? config.src;
|
|
10
|
+
if (!openapi) {
|
|
11
|
+
return {
|
|
12
|
+
error: "OpenAPI spec path is required (--openapi or config file)",
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (!src) {
|
|
16
|
+
return { error: "Source directory is required (--src or config file)" };
|
|
17
|
+
}
|
|
7
18
|
return {
|
|
8
|
-
openapiPath: resolve(process.cwd(),
|
|
9
|
-
srcPath: resolve(process.cwd(),
|
|
19
|
+
openapiPath: resolve(process.cwd(), openapi),
|
|
20
|
+
srcPath: resolve(process.cwd(), src),
|
|
21
|
+
output: cliOptions.output ?? config.output,
|
|
22
|
+
check: cliOptions.check,
|
|
23
|
+
level: cliOptions.level ?? config.level ?? "error",
|
|
24
|
+
ignore: config.ignore ?? [],
|
|
10
25
|
};
|
|
11
26
|
}
|
|
12
27
|
function validatePaths(openapiPath, srcPath) {
|
|
@@ -37,13 +52,35 @@ function printUsageReport(usages) {
|
|
|
37
52
|
console.log(line);
|
|
38
53
|
}
|
|
39
54
|
}
|
|
55
|
+
function filterIgnoredEndpoints(usages, ignorePatterns) {
|
|
56
|
+
if (ignorePatterns.length === 0) {
|
|
57
|
+
return usages;
|
|
58
|
+
}
|
|
59
|
+
const filtered = new Map();
|
|
60
|
+
for (const [endpoint, usageList] of usages) {
|
|
61
|
+
if (!isIgnored(endpoint, ignorePatterns)) {
|
|
62
|
+
filtered.set(endpoint, usageList);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return filtered;
|
|
66
|
+
}
|
|
40
67
|
/**
|
|
41
68
|
* API使用状況解析を実行する
|
|
42
69
|
* @param options - CLIオプション(OpenAPIパス、ソースパス等)
|
|
43
70
|
* @returns 実行結果(成功/失敗、終了コード、エラーメッセージ)
|
|
44
71
|
*/
|
|
45
72
|
export function run(options) {
|
|
46
|
-
const
|
|
73
|
+
const configResult = loadConfig(options.config);
|
|
74
|
+
if (!configResult.success) {
|
|
75
|
+
console.error(`Error: ${configResult.error}`);
|
|
76
|
+
return { success: false, exitCode: 1, error: configResult.error };
|
|
77
|
+
}
|
|
78
|
+
const resolved = mergeOptions(options, configResult.config);
|
|
79
|
+
if ("error" in resolved) {
|
|
80
|
+
console.error(`Error: ${resolved.error}`);
|
|
81
|
+
return { success: false, exitCode: 1, error: resolved.error };
|
|
82
|
+
}
|
|
83
|
+
const { openapiPath, srcPath, output, check, level, ignore } = resolved;
|
|
47
84
|
const validationError = validatePaths(openapiPath, srcPath);
|
|
48
85
|
if (validationError) {
|
|
49
86
|
console.error(`Error: ${validationError}`);
|
|
@@ -58,16 +95,24 @@ export function run(options) {
|
|
|
58
95
|
const endpoints = parseOpenAPISpec(specResult.spec);
|
|
59
96
|
console.log(`Found ${endpoints.size} endpoints`);
|
|
60
97
|
console.log(`Analyzing source files: ${srcPath}`);
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
98
|
+
const rawUsages = analyzeTypeScriptFiles(endpoints, { srcPath });
|
|
99
|
+
const usages = filterIgnoredEndpoints(rawUsages, ignore);
|
|
100
|
+
if (ignore.length > 0) {
|
|
101
|
+
const ignoredCount = rawUsages.size - usages.size;
|
|
102
|
+
if (ignoredCount > 0) {
|
|
103
|
+
console.log(`Ignored ${ignoredCount} endpoints`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (output) {
|
|
107
|
+
writeJsonOutput(output, usages);
|
|
64
108
|
}
|
|
65
|
-
if (
|
|
109
|
+
if (check) {
|
|
66
110
|
printUsageReport(usages);
|
|
67
|
-
const
|
|
111
|
+
const hasUnused = getUnusedEndpoints(usages).length > 0;
|
|
112
|
+
const exitCode = hasUnused && level === "error" ? 1 : 0;
|
|
68
113
|
return { success: true, exitCode };
|
|
69
114
|
}
|
|
70
|
-
if (!
|
|
115
|
+
if (!output && !check) {
|
|
71
116
|
printUsageReport(usages);
|
|
72
117
|
}
|
|
73
118
|
return { success: true, exitCode: 0 };
|
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,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B,CAAC;IACxB,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,QAAQ;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;CACF;AAED,eAAO,MAAM,YAAY,oDAAqD,CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2CA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-usage",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "OpenAPI仕様を正としてAPIの使用状況を静的解析し、未使用APIを検知するツール",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"commander": "^14.0.2",
|
|
58
|
-
"ts-morph": "^27.0.2"
|
|
58
|
+
"ts-morph": "^27.0.2",
|
|
59
|
+
"yaml": "^2.8.2"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@biomejs/biome": "^2.3.11",
|