jui-tools-mcp-server 2.17.0 → 2.18.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 (33) hide show
  1. package/README.md +2 -2
  2. package/dist/tools/infra/infra_cost.js +65 -2
  3. package/dist/tools/infra/infra_validate.d.ts +0 -5
  4. package/dist/tools/infra/infra_validate.js +41 -4
  5. package/package.json +1 -1
  6. package/scripts/record-infra-fixtures.sh +65 -0
  7. package/src/tools/infra/infra_cost.ts +57 -2
  8. package/src/tools/infra/infra_validate.ts +39 -4
  9. package/tests/fixtures/infra/RECORDED_FROM +1 -1
  10. package/tests/fixtures/infra/answers-without-plan.json +9 -0
  11. package/tests/fixtures/infra/check-infra.json +8 -6
  12. package/tests/fixtures/infra/cost-infra.day.json +2 -2
  13. package/tests/fixtures/infra/cost-infra.month-by-node.json +10 -2
  14. package/tests/fixtures/infra/cost-infra.month.json +21 -4
  15. package/tests/fixtures/infra/cost-infra.plan-bad.json +16 -0
  16. package/tests/fixtures/infra/cost-infra.plan-move-account.json +167 -0
  17. package/tests/fixtures/infra/cost-infra.plan-move.json +174 -0
  18. package/tests/fixtures/infra/cost-infra.plan-none.json +16 -0
  19. package/tests/fixtures/infra/cost-infra.plan-shrink.json +162 -0
  20. package/tests/fixtures/infra/validate-infra-load.errors.json +2 -1
  21. package/tests/fixtures/infra/validate-infra-load.unreadable.json +1 -0
  22. package/tests/fixtures/infra/validate-infra.errors.json +6 -2
  23. package/tests/fixtures/infra/validate-infra.ok.json +1 -1
  24. package/tests/fixtures/infra/validate-infra.plan-both.json +504 -0
  25. package/tests/fixtures/infra/validate-infra.plan-duplicate.json +539 -0
  26. package/tests/fixtures/infra/validate-infra.plan-edge-end.json +539 -0
  27. package/tests/fixtures/infra/validate-infra.plan-half.json +49 -0
  28. package/tests/fixtures/infra/validate-infra.plan-move.json +506 -0
  29. package/tests/fixtures/infra/validate-infra.plan-none.json +49 -0
  30. package/tests/fixtures/infra/validate-infra.plan-order-unknown.json +539 -0
  31. package/tests/fixtures/infra/validate-infra.plan-remove-missing.json +539 -0
  32. package/tests/fixtures/infra/validate-infra.plans.json +506 -0
  33. package/tests/tools_infra.test.ts +208 -0
@@ -0,0 +1,506 @@
1
+ {
2
+ "ok": true,
3
+ "dir": "docs/infra",
4
+ "version": 0,
5
+ "files": [
6
+ "external.json",
7
+ "main.json"
8
+ ],
9
+ "environments": [
10
+ {
11
+ "id": "production",
12
+ "label": "本番",
13
+ "kind": "production"
14
+ },
15
+ {
16
+ "id": "staging",
17
+ "label": "ステージング",
18
+ "kind": "staging"
19
+ }
20
+ ],
21
+ "flows": [],
22
+ "problems": [],
23
+ "icons": {},
24
+ "migrations": [
25
+ {
26
+ "name": "move",
27
+ "dir": "docs/infra/migrations/move",
28
+ "steps": [
29
+ {
30
+ "index": 1,
31
+ "node": "db-prod",
32
+ "kind": "replace",
33
+ "edgesRemoved": [],
34
+ "edgesAdded": []
35
+ },
36
+ {
37
+ "index": 2,
38
+ "node": "worker-prod",
39
+ "kind": "add",
40
+ "edgesRemoved": [],
41
+ "edgesAdded": [
42
+ "api-prod->worker-prod"
43
+ ]
44
+ },
45
+ {
46
+ "index": 3,
47
+ "node": "api-stg",
48
+ "kind": "remove",
49
+ "edgesRemoved": [
50
+ "api-stg->stripe",
51
+ "alb-stg->api-stg",
52
+ "api-stg->db-stg"
53
+ ],
54
+ "edgesAdded": []
55
+ }
56
+ ],
57
+ "counts": {
58
+ "added": 1,
59
+ "replaced": 1,
60
+ "removed": 1,
61
+ "edgesAdded": 1,
62
+ "edgesRemoved": 3
63
+ },
64
+ "model": {
65
+ "version": 0,
66
+ "files": [
67
+ "external.json",
68
+ "main.json",
69
+ "move/changes.json"
70
+ ],
71
+ "environments": [
72
+ {
73
+ "id": "production",
74
+ "label": "本番",
75
+ "kind": "production"
76
+ },
77
+ {
78
+ "id": "staging",
79
+ "label": "ステージング",
80
+ "kind": "staging"
81
+ }
82
+ ],
83
+ "groups": [
84
+ {
85
+ "id": "aws-prod",
86
+ "kind": "account",
87
+ "provider": "aws",
88
+ "label": "本番アカウント",
89
+ "environments": [
90
+ "production"
91
+ ],
92
+ "providerResolved": "aws"
93
+ },
94
+ {
95
+ "id": "aws-stg",
96
+ "kind": "account",
97
+ "provider": "aws",
98
+ "label": "ステージングアカウント",
99
+ "environments": [
100
+ "staging"
101
+ ],
102
+ "providerResolved": "aws"
103
+ },
104
+ {
105
+ "id": "apne1-prod",
106
+ "kind": "region",
107
+ "region": "ap-northeast-1",
108
+ "parent": "aws-prod",
109
+ "environments": [
110
+ "production"
111
+ ],
112
+ "label": "apne1-prod",
113
+ "providerResolved": "aws"
114
+ },
115
+ {
116
+ "id": "apne1-stg",
117
+ "kind": "region",
118
+ "region": "ap-northeast-1",
119
+ "parent": "aws-stg",
120
+ "environments": [
121
+ "staging"
122
+ ],
123
+ "label": "apne1-stg",
124
+ "providerResolved": "aws"
125
+ },
126
+ {
127
+ "id": "vpc-prod",
128
+ "kind": "network",
129
+ "parent": "apne1-prod",
130
+ "label": "VPC (2 AZ)",
131
+ "environments": [
132
+ "production"
133
+ ],
134
+ "providerResolved": "aws"
135
+ },
136
+ {
137
+ "id": "vpc-stg",
138
+ "kind": "network",
139
+ "parent": "apne1-stg",
140
+ "label": "VPC (1 AZ)",
141
+ "environments": [
142
+ "staging"
143
+ ],
144
+ "providerResolved": "aws"
145
+ },
146
+ {
147
+ "id": "private-prod",
148
+ "kind": "subnet",
149
+ "parent": "vpc-prod",
150
+ "visibility": "private",
151
+ "environments": [
152
+ "production"
153
+ ],
154
+ "label": "private-prod",
155
+ "providerResolved": "aws"
156
+ },
157
+ {
158
+ "id": "private-stg",
159
+ "kind": "subnet",
160
+ "parent": "vpc-stg",
161
+ "visibility": "private",
162
+ "environments": [
163
+ "staging"
164
+ ],
165
+ "label": "private-stg",
166
+ "providerResolved": "aws"
167
+ }
168
+ ],
169
+ "nodes": [
170
+ {
171
+ "id": "stripe",
172
+ "category": "external.saas",
173
+ "provider": "stripe",
174
+ "label": "Stripe",
175
+ "managed_by": "external",
176
+ "evidence": [
177
+ {
178
+ "file": "backend/app/config.py",
179
+ "pattern": "stripe_"
180
+ }
181
+ ],
182
+ "count": 1,
183
+ "providerResolved": "stripe",
184
+ "regionResolved": "",
185
+ "fold": false,
186
+ "environments": [
187
+ "production",
188
+ "staging"
189
+ ]
190
+ },
191
+ {
192
+ "id": "mailer",
193
+ "category": "mail",
194
+ "provider": "sendgrid",
195
+ "label": "メール配信",
196
+ "managed_by": "external",
197
+ "count": 1,
198
+ "providerResolved": "sendgrid",
199
+ "regionResolved": "",
200
+ "fold": false,
201
+ "environments": [
202
+ "production",
203
+ "staging"
204
+ ]
205
+ },
206
+ {
207
+ "id": "cdn",
208
+ "category": "edge.cdn",
209
+ "service": "cloudfront",
210
+ "provider": "aws",
211
+ "label": "CloudFront",
212
+ "count": 1,
213
+ "providerResolved": "aws",
214
+ "regionResolved": "",
215
+ "managed_by": "iac",
216
+ "fold": false,
217
+ "environments": [
218
+ "production",
219
+ "staging"
220
+ ]
221
+ },
222
+ {
223
+ "id": "alb-prod",
224
+ "category": "load_balancer",
225
+ "service": "elb.alb",
226
+ "group": "vpc-prod",
227
+ "environments": [
228
+ "production"
229
+ ],
230
+ "label": "alb-prod",
231
+ "count": 1,
232
+ "providerResolved": "aws",
233
+ "regionResolved": "ap-northeast-1",
234
+ "managed_by": "iac",
235
+ "fold": false
236
+ },
237
+ {
238
+ "id": "alb-stg",
239
+ "category": "load_balancer",
240
+ "service": "elb.alb",
241
+ "group": "vpc-stg",
242
+ "environments": [
243
+ "staging"
244
+ ],
245
+ "label": "alb-stg",
246
+ "count": 1,
247
+ "providerResolved": "aws",
248
+ "regionResolved": "ap-northeast-1",
249
+ "managed_by": "iac",
250
+ "fold": false
251
+ },
252
+ {
253
+ "id": "api-prod",
254
+ "category": "compute.container",
255
+ "service": "ecs.fargate",
256
+ "group": "private-prod",
257
+ "count": 3,
258
+ "app": "backend",
259
+ "iac": [
260
+ "module.api.aws_ecs_service.this"
261
+ ],
262
+ "environments": [
263
+ "production"
264
+ ],
265
+ "spec": [
266
+ {
267
+ "key": "cpu",
268
+ "value": "1024"
269
+ },
270
+ {
271
+ "key": "memory",
272
+ "value": "2048"
273
+ },
274
+ {
275
+ "key": "tasks",
276
+ "value": "3"
277
+ }
278
+ ],
279
+ "label": "api-prod",
280
+ "providerResolved": "aws",
281
+ "regionResolved": "ap-northeast-1",
282
+ "managed_by": "iac",
283
+ "fold": false
284
+ },
285
+ {
286
+ "id": "db-stg",
287
+ "category": "database.relational",
288
+ "service": "rds.mysql",
289
+ "group": "private-stg",
290
+ "engine": "mysql 8.4",
291
+ "data_doc": "docs/db",
292
+ "environments": [
293
+ "staging"
294
+ ],
295
+ "label": "db-stg",
296
+ "count": 1,
297
+ "providerResolved": "aws",
298
+ "regionResolved": "ap-northeast-1",
299
+ "managed_by": "iac",
300
+ "fold": false
301
+ },
302
+ {
303
+ "id": "assets",
304
+ "category": "storage.object",
305
+ "service": "s3",
306
+ "provider": "aws",
307
+ "region": "ap-northeast-1",
308
+ "label": "アセットのバケツ",
309
+ "count": 1,
310
+ "providerResolved": "aws",
311
+ "regionResolved": "ap-northeast-1",
312
+ "managed_by": "iac",
313
+ "fold": false,
314
+ "environments": [
315
+ "production",
316
+ "staging"
317
+ ]
318
+ },
319
+ {
320
+ "id": "api-role",
321
+ "category": "security.iam",
322
+ "service": "iam.role",
323
+ "provider": "aws",
324
+ "label": "API の実行ロール",
325
+ "count": 1,
326
+ "providerResolved": "aws",
327
+ "regionResolved": "",
328
+ "managed_by": "iac",
329
+ "fold": true,
330
+ "environments": [
331
+ "production",
332
+ "staging"
333
+ ]
334
+ },
335
+ {
336
+ "id": "api-5xx",
337
+ "category": "monitoring.alarm",
338
+ "service": "cloudwatch.alarm",
339
+ "provider": "aws",
340
+ "label": "API の 5xx",
341
+ "environments": [
342
+ "production"
343
+ ],
344
+ "count": 1,
345
+ "providerResolved": "aws",
346
+ "regionResolved": "",
347
+ "managed_by": "iac",
348
+ "fold": true
349
+ },
350
+ {
351
+ "id": "db-prod",
352
+ "category": "database.relational",
353
+ "service": "rds.postgres",
354
+ "group": "private-prod",
355
+ "ha": "multi-az",
356
+ "environments": [
357
+ "production"
358
+ ],
359
+ "spec": [
360
+ {
361
+ "key": "instance_class",
362
+ "value": "db.r6g.large"
363
+ },
364
+ {
365
+ "key": "storage_gb",
366
+ "value": "200"
367
+ }
368
+ ],
369
+ "label": "db-prod",
370
+ "count": 1,
371
+ "providerResolved": "aws",
372
+ "regionResolved": "ap-northeast-1",
373
+ "managed_by": "iac",
374
+ "fold": false
375
+ },
376
+ {
377
+ "id": "worker-prod",
378
+ "category": "compute.container",
379
+ "service": "ecs.fargate",
380
+ "group": "private-prod",
381
+ "count": 1,
382
+ "environments": [
383
+ "production"
384
+ ],
385
+ "spec": [
386
+ {
387
+ "key": "cpu",
388
+ "value": "512"
389
+ },
390
+ {
391
+ "key": "memory",
392
+ "value": "1024"
393
+ },
394
+ {
395
+ "key": "tasks",
396
+ "value": "1"
397
+ }
398
+ ],
399
+ "label": "worker-prod",
400
+ "providerResolved": "aws",
401
+ "regionResolved": "ap-northeast-1",
402
+ "managed_by": "iac",
403
+ "fold": false
404
+ }
405
+ ],
406
+ "edges": [
407
+ {
408
+ "from": "api-prod",
409
+ "to": "stripe",
410
+ "protocol": "https",
411
+ "direction": "out",
412
+ "environments": [
413
+ "production"
414
+ ],
415
+ "crossProvider": true
416
+ },
417
+ {
418
+ "from": "api-prod",
419
+ "to": "mailer",
420
+ "protocol": "https",
421
+ "direction": "out",
422
+ "environments": [
423
+ "production"
424
+ ],
425
+ "crossProvider": true
426
+ },
427
+ {
428
+ "from": "cdn",
429
+ "to": "alb-prod",
430
+ "protocol": "https",
431
+ "port": 443,
432
+ "environments": [
433
+ "production"
434
+ ],
435
+ "direction": "out",
436
+ "crossProvider": false
437
+ },
438
+ {
439
+ "from": "cdn",
440
+ "to": "alb-stg",
441
+ "protocol": "https",
442
+ "port": 443,
443
+ "environments": [
444
+ "staging"
445
+ ],
446
+ "direction": "out",
447
+ "crossProvider": false
448
+ },
449
+ {
450
+ "from": "alb-prod",
451
+ "to": "api-prod",
452
+ "protocol": "http",
453
+ "port": 8000,
454
+ "direction": "out",
455
+ "environments": [
456
+ "production"
457
+ ],
458
+ "crossProvider": false
459
+ },
460
+ {
461
+ "from": "api-prod",
462
+ "to": "db-prod",
463
+ "protocol": "mysql",
464
+ "port": 3306,
465
+ "direction": "out",
466
+ "environments": [
467
+ "production"
468
+ ],
469
+ "crossProvider": false
470
+ },
471
+ {
472
+ "from": "cdn",
473
+ "to": "assets",
474
+ "protocol": "https",
475
+ "direction": "out",
476
+ "environments": [
477
+ "production",
478
+ "staging"
479
+ ],
480
+ "crossProvider": false
481
+ },
482
+ {
483
+ "from": "api-prod",
484
+ "to": "worker-prod",
485
+ "protocol": "https",
486
+ "port": 443,
487
+ "direction": "out",
488
+ "environments": [
489
+ "production"
490
+ ],
491
+ "crossProvider": false
492
+ }
493
+ ],
494
+ "flows": []
495
+ },
496
+ "problems": [],
497
+ "ok": true
498
+ }
499
+ ],
500
+ "readMs": 6,
501
+ "counts": {
502
+ "groups": 8,
503
+ "nodes": 12,
504
+ "edges": 10
505
+ }
506
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "ok": true,
3
+ "dir": "docs/infra",
4
+ "version": 0,
5
+ "files": [
6
+ "external.json",
7
+ "main.json"
8
+ ],
9
+ "environments": [
10
+ {
11
+ "id": "production",
12
+ "label": "本番",
13
+ "kind": "production"
14
+ },
15
+ {
16
+ "id": "staging",
17
+ "label": "ステージング",
18
+ "kind": "staging"
19
+ }
20
+ ],
21
+ "flows": [],
22
+ "problems": [],
23
+ "icons": {},
24
+ "migrations": [
25
+ {
26
+ "name": "nope",
27
+ "dir": "docs/infra/migrations/nope",
28
+ "ok": false,
29
+ "steps": [],
30
+ "counts": {},
31
+ "problems": [
32
+ {
33
+ "file": "nope",
34
+ "path": "/",
35
+ "code": "migration.no_plan",
36
+ "message": "no plan 'nope' in docs/infra/migrations",
37
+ "severity": "error",
38
+ "short": "docs/infra/migrations/nope: / という計画がありません(migration.no_plan)"
39
+ }
40
+ ]
41
+ }
42
+ ],
43
+ "readMs": 2,
44
+ "counts": {
45
+ "groups": 8,
46
+ "nodes": 12,
47
+ "edges": 10
48
+ }
49
+ }