@angular-modernizer/adapter-mcp 0.3.0 → 1.1.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 (298) hide show
  1. package/README.md +181 -282
  2. package/dist/cli.js +21 -13
  3. package/dist/core/project-analyzer.d.ts +3 -12
  4. package/dist/core/project-analyzer.js +3 -12
  5. package/dist/index.d.ts +122 -6
  6. package/dist/index.js +49 -5
  7. package/dist/mcp-watcher.d.ts +32 -7
  8. package/dist/mcp-watcher.js +16 -15
  9. package/dist/scan-host/scan-host.d.ts +119 -0
  10. package/dist/scan-host/scan-host.js +376 -0
  11. package/dist/scan-host/scan-protocol.d.ts +35 -0
  12. package/dist/scan-host/scan-protocol.js +6 -0
  13. package/dist/scan-host/scan-worker.d.ts +14 -0
  14. package/dist/scan-host/scan-worker.js +48 -0
  15. package/dist/server/limited-stdio-transport.d.ts +75 -0
  16. package/dist/server/limited-stdio-transport.js +115 -0
  17. package/dist/server/mcp-server.d.ts +20 -18
  18. package/dist/server/mcp-server.js +42 -79
  19. package/dist/server/package-version.d.ts +16 -0
  20. package/dist/server/package-version.js +37 -0
  21. package/dist/server/sdk-server.d.ts +71 -0
  22. package/dist/server/sdk-server.js +113 -0
  23. package/dist/server/tool-registry.d.ts +6 -9
  24. package/dist/server/tool-registry.js +6 -12
  25. package/dist/streaming/progress-store.d.ts +22 -5
  26. package/dist/streaming/progress-store.js +9 -5
  27. package/dist/tools/analyze-build-impact.d.ts +276 -35
  28. package/dist/tools/analyze-build-impact.js +175 -28
  29. package/dist/tools/analyze-core-to-shared.d.ts +176 -16
  30. package/dist/tools/analyze-core-to-shared.js +124 -19
  31. package/dist/tools/analyze-parser-performance.d.ts +209 -15
  32. package/dist/tools/analyze-parser-performance.js +119 -56
  33. package/dist/tools/analyze-project.d.ts +349 -17
  34. package/dist/tools/analyze-project.js +282 -97
  35. package/dist/tools/check-incremental-compatibility.d.ts +74 -12
  36. package/dist/tools/check-incremental-compatibility.js +69 -10
  37. package/dist/tools/collect-feedback.d.ts +225 -21
  38. package/dist/tools/collect-feedback.js +199 -118
  39. package/dist/tools/compare-health.d.ts +413 -0
  40. package/dist/tools/compare-health.js +479 -0
  41. package/dist/tools/extract-libraries.d.ts +200 -24
  42. package/dist/tools/extract-libraries.js +131 -27
  43. package/dist/tools/find-angular-symbol.d.ts +92 -24
  44. package/dist/tools/find-angular-symbol.js +70 -20
  45. package/dist/tools/find-component-hosts.d.ts +603 -27
  46. package/dist/tools/find-component-hosts.js +223 -19
  47. package/dist/tools/find-usages.d.ts +102 -22
  48. package/dist/tools/find-usages.js +81 -21
  49. package/dist/tools/get-bootstrap-execution.d.ts +183 -25
  50. package/dist/tools/get-bootstrap-execution.js +109 -25
  51. package/dist/tools/get-call-graph.d.ts +127 -12
  52. package/dist/tools/get-call-graph.js +84 -19
  53. package/dist/tools/get-operation-progress-tool.d.ts +126 -8
  54. package/dist/tools/get-operation-progress-tool.js +124 -12
  55. package/dist/tools/get-operation-progress.d.ts +27 -1
  56. package/dist/tools/get-operation-progress.js +5 -5
  57. package/dist/tools/helpers/analysis-output.d.ts +182 -0
  58. package/dist/tools/helpers/analysis-output.js +165 -0
  59. package/dist/tools/helpers/batch-kernel.d.ts +14 -0
  60. package/dist/tools/helpers/batch-kernel.js +12 -0
  61. package/dist/tools/helpers/build-schemas.d.ts +36 -0
  62. package/dist/tools/helpers/build-schemas.js +23 -0
  63. package/dist/tools/helpers/citation-file-source.d.ts +10 -0
  64. package/dist/tools/helpers/citation-file-source.js +82 -0
  65. package/dist/tools/helpers/compact-output.d.ts +2 -1
  66. package/dist/tools/helpers/compact-output.js +2 -1
  67. package/dist/tools/helpers/finding-window.d.ts +43 -0
  68. package/dist/tools/helpers/finding-window.js +64 -0
  69. package/dist/tools/helpers/health-delta.d.ts +99 -0
  70. package/dist/tools/helpers/health-delta.js +236 -0
  71. package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
  72. package/dist/tools/helpers/investigation-schemas.js +48 -0
  73. package/dist/tools/helpers/library-imports.d.ts +57 -0
  74. package/dist/tools/helpers/library-imports.js +151 -0
  75. package/dist/tools/helpers/load-source-files.d.ts +30 -0
  76. package/dist/tools/helpers/load-source-files.js +34 -0
  77. package/dist/tools/helpers/output-contract.d.ts +32 -0
  78. package/dist/tools/helpers/output-contract.js +32 -0
  79. package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
  80. package/dist/tools/helpers/platform-root-resolver.js +75 -48
  81. package/dist/tools/helpers/process-output.d.ts +19 -0
  82. package/dist/tools/helpers/process-output.js +31 -0
  83. package/dist/tools/helpers/project-cache.d.ts +60 -37
  84. package/dist/tools/helpers/project-cache.js +54 -37
  85. package/dist/tools/helpers/project-decorators.d.ts +14 -0
  86. package/dist/tools/helpers/project-decorators.js +22 -0
  87. package/dist/tools/helpers/rule-matcher.js +5 -0
  88. package/dist/tools/helpers/rule-runner.d.ts +25 -13
  89. package/dist/tools/helpers/rule-runner.js +45 -24
  90. package/dist/tools/helpers/scan-cache.d.ts +22 -0
  91. package/dist/tools/helpers/scan-cache.js +34 -0
  92. package/dist/tools/helpers/scan-engine.d.ts +107 -0
  93. package/dist/tools/helpers/scan-engine.js +197 -0
  94. package/dist/tools/helpers/scan-plan.d.ts +5 -2
  95. package/dist/tools/helpers/scan-plan.js +18 -3
  96. package/dist/tools/helpers/scope-paths.d.ts +17 -0
  97. package/dist/tools/helpers/scope-paths.js +32 -0
  98. package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
  99. package/dist/tools/helpers/suggestion-generator.js +0 -12
  100. package/dist/tools/helpers/tool-cache.d.ts +11 -0
  101. package/dist/tools/helpers/tool-cache.js +15 -0
  102. package/dist/tools/helpers/tool-context.d.ts +63 -0
  103. package/dist/tools/helpers/tool-context.js +79 -0
  104. package/dist/tools/helpers/transform-safety.d.ts +40 -0
  105. package/dist/tools/helpers/transform-safety.js +87 -0
  106. package/dist/tools/helpers/validation-output.d.ts +53 -0
  107. package/dist/tools/helpers/validation-output.js +48 -0
  108. package/dist/tools/inspect-form-group.d.ts +262 -24
  109. package/dist/tools/inspect-form-group.js +134 -13
  110. package/dist/tools/inspect-i18n.d.ts +410 -23
  111. package/dist/tools/inspect-i18n.js +213 -13
  112. package/dist/tools/inspect-template.d.ts +260 -22
  113. package/dist/tools/inspect-template.js +174 -13
  114. package/dist/tools/learn-patterns.d.ts +210 -13
  115. package/dist/tools/learn-patterns.js +113 -12
  116. package/dist/tools/list-imports.d.ts +152 -34
  117. package/dist/tools/list-imports.js +124 -18
  118. package/dist/tools/orchestrate-migration.d.ts +159 -14
  119. package/dist/tools/orchestrate-migration.js +147 -20
  120. package/dist/tools/parse-stack-trace.d.ts +78 -21
  121. package/dist/tools/parse-stack-trace.js +44 -7
  122. package/dist/tools/plan-migration.d.ts +395 -26
  123. package/dist/tools/plan-migration.js +173 -22
  124. package/dist/tools/resolve-type.d.ts +57 -9
  125. package/dist/tools/resolve-type.js +49 -12
  126. package/dist/tools/review-feedback.d.ts +214 -16
  127. package/dist/tools/review-feedback.js +142 -57
  128. package/dist/tools/rollback-changes.d.ts +88 -7
  129. package/dist/tools/rollback-changes.js +74 -19
  130. package/dist/tools/run-angular-cli.d.ts +57 -12
  131. package/dist/tools/run-angular-cli.js +76 -13
  132. package/dist/tools/run-build.d.ts +127 -13
  133. package/dist/tools/run-build.js +128 -16
  134. package/dist/tools/run-schematic.d.ts +82 -12
  135. package/dist/tools/run-schematic.js +115 -18
  136. package/dist/tools/scan-all.d.ts +88 -23
  137. package/dist/tools/scan-all.js +161 -220
  138. package/dist/tools/scan-angular.d.ts +60 -19
  139. package/dist/tools/scan-angular.js +100 -141
  140. package/dist/tools/scan-architecture.d.ts +92 -24
  141. package/dist/tools/scan-architecture.js +268 -211
  142. package/dist/tools/scan-solid.d.ts +59 -19
  143. package/dist/tools/scan-solid.js +98 -139
  144. package/dist/tools/search-codebase.d.ts +110 -23
  145. package/dist/tools/search-codebase.js +67 -11
  146. package/dist/tools/server-status.d.ts +392 -26
  147. package/dist/tools/server-status.js +260 -27
  148. package/dist/tools/suggest-improvements.d.ts +105 -10
  149. package/dist/tools/suggest-improvements.js +91 -51
  150. package/dist/tools/trace-output-flow.d.ts +713 -26
  151. package/dist/tools/trace-output-flow.js +396 -33
  152. package/dist/tools/transform-code-batch.d.ts +3 -0
  153. package/dist/tools/transform-code-batch.js +10 -5
  154. package/dist/tools/transform-code.d.ts +402 -18
  155. package/dist/tools/transform-code.js +708 -649
  156. package/dist/tools/validate-before-transform.d.ts +136 -7
  157. package/dist/tools/validate-before-transform.js +65 -9
  158. package/dist/tools/validate-project-compatibility.d.ts +82 -15
  159. package/dist/tools/validate-project-compatibility.js +84 -15
  160. package/dist/tools/validate-transformation.d.ts +243 -8
  161. package/dist/tools/validate-transformation.js +127 -23
  162. package/dist/tools/verify-citations.d.ts +202 -0
  163. package/dist/tools/verify-citations.js +221 -0
  164. package/dist/types.d.ts +78 -11
  165. package/dist/types.js +0 -5
  166. package/dist/utils/format-tool-response.d.ts +22 -59
  167. package/dist/utils/format-tool-response.js +25 -134
  168. package/package.json +31 -20
  169. package/dist/cli.d.ts.map +0 -1
  170. package/dist/cli.js.map +0 -1
  171. package/dist/core/project-analyzer.d.ts.map +0 -1
  172. package/dist/core/project-analyzer.js.map +0 -1
  173. package/dist/index.d.ts.map +0 -1
  174. package/dist/index.js.map +0 -1
  175. package/dist/mcp-watcher.d.ts.map +0 -1
  176. package/dist/mcp-watcher.js.map +0 -1
  177. package/dist/server/json-rpc-handler.d.ts +0 -98
  178. package/dist/server/json-rpc-handler.d.ts.map +0 -1
  179. package/dist/server/json-rpc-handler.js +0 -301
  180. package/dist/server/json-rpc-handler.js.map +0 -1
  181. package/dist/server/mcp-server.d.ts.map +0 -1
  182. package/dist/server/mcp-server.js.map +0 -1
  183. package/dist/server/stdio-guard.d.ts.map +0 -1
  184. package/dist/server/stdio-guard.js.map +0 -1
  185. package/dist/server/tool-registry.d.ts.map +0 -1
  186. package/dist/server/tool-registry.js.map +0 -1
  187. package/dist/streaming/progress-store.d.ts.map +0 -1
  188. package/dist/streaming/progress-store.js.map +0 -1
  189. package/dist/tools/analyze-build-impact.d.ts.map +0 -1
  190. package/dist/tools/analyze-build-impact.js.map +0 -1
  191. package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
  192. package/dist/tools/analyze-core-to-shared.js.map +0 -1
  193. package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
  194. package/dist/tools/analyze-parser-performance.js.map +0 -1
  195. package/dist/tools/analyze-project.d.ts.map +0 -1
  196. package/dist/tools/analyze-project.js.map +0 -1
  197. package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
  198. package/dist/tools/check-incremental-compatibility.js.map +0 -1
  199. package/dist/tools/collect-feedback.d.ts.map +0 -1
  200. package/dist/tools/collect-feedback.js.map +0 -1
  201. package/dist/tools/extract-libraries.d.ts.map +0 -1
  202. package/dist/tools/extract-libraries.js.map +0 -1
  203. package/dist/tools/find-angular-symbol.d.ts.map +0 -1
  204. package/dist/tools/find-angular-symbol.js.map +0 -1
  205. package/dist/tools/find-component-hosts.d.ts.map +0 -1
  206. package/dist/tools/find-component-hosts.js.map +0 -1
  207. package/dist/tools/find-usages.d.ts.map +0 -1
  208. package/dist/tools/find-usages.js.map +0 -1
  209. package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
  210. package/dist/tools/get-bootstrap-execution.js.map +0 -1
  211. package/dist/tools/get-call-graph.d.ts.map +0 -1
  212. package/dist/tools/get-call-graph.js.map +0 -1
  213. package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
  214. package/dist/tools/get-operation-progress-tool.js.map +0 -1
  215. package/dist/tools/get-operation-progress.d.ts.map +0 -1
  216. package/dist/tools/get-operation-progress.js.map +0 -1
  217. package/dist/tools/helpers/compact-output.d.ts.map +0 -1
  218. package/dist/tools/helpers/compact-output.js.map +0 -1
  219. package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
  220. package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
  221. package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
  222. package/dist/tools/helpers/find-ts-config.js.map +0 -1
  223. package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
  224. package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
  225. package/dist/tools/helpers/project-cache.d.ts.map +0 -1
  226. package/dist/tools/helpers/project-cache.js.map +0 -1
  227. package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
  228. package/dist/tools/helpers/rule-matcher.js.map +0 -1
  229. package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
  230. package/dist/tools/helpers/rule-runner.js.map +0 -1
  231. package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
  232. package/dist/tools/helpers/scan-plan.js.map +0 -1
  233. package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
  234. package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
  235. package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
  236. package/dist/tools/helpers/suggestion-generator.js.map +0 -1
  237. package/dist/tools/inspect-form-group.d.ts.map +0 -1
  238. package/dist/tools/inspect-form-group.js.map +0 -1
  239. package/dist/tools/inspect-i18n.d.ts.map +0 -1
  240. package/dist/tools/inspect-i18n.js.map +0 -1
  241. package/dist/tools/inspect-template.d.ts.map +0 -1
  242. package/dist/tools/inspect-template.js.map +0 -1
  243. package/dist/tools/learn-patterns.d.ts.map +0 -1
  244. package/dist/tools/learn-patterns.js.map +0 -1
  245. package/dist/tools/list-imports.d.ts.map +0 -1
  246. package/dist/tools/list-imports.js.map +0 -1
  247. package/dist/tools/orchestrate-migration.d.ts.map +0 -1
  248. package/dist/tools/orchestrate-migration.js.map +0 -1
  249. package/dist/tools/parse-stack-trace.d.ts.map +0 -1
  250. package/dist/tools/parse-stack-trace.js.map +0 -1
  251. package/dist/tools/plan-migration.d.ts.map +0 -1
  252. package/dist/tools/plan-migration.js.map +0 -1
  253. package/dist/tools/resolve-type.d.ts.map +0 -1
  254. package/dist/tools/resolve-type.js.map +0 -1
  255. package/dist/tools/review-feedback.d.ts.map +0 -1
  256. package/dist/tools/review-feedback.js.map +0 -1
  257. package/dist/tools/rollback-changes.d.ts.map +0 -1
  258. package/dist/tools/rollback-changes.js.map +0 -1
  259. package/dist/tools/run-angular-cli.d.ts.map +0 -1
  260. package/dist/tools/run-angular-cli.js.map +0 -1
  261. package/dist/tools/run-build.d.ts.map +0 -1
  262. package/dist/tools/run-build.js.map +0 -1
  263. package/dist/tools/run-schematic.d.ts.map +0 -1
  264. package/dist/tools/run-schematic.js.map +0 -1
  265. package/dist/tools/scan-all.d.ts.map +0 -1
  266. package/dist/tools/scan-all.js.map +0 -1
  267. package/dist/tools/scan-angular.d.ts.map +0 -1
  268. package/dist/tools/scan-angular.js.map +0 -1
  269. package/dist/tools/scan-architecture.d.ts.map +0 -1
  270. package/dist/tools/scan-architecture.js.map +0 -1
  271. package/dist/tools/scan-solid.d.ts.map +0 -1
  272. package/dist/tools/scan-solid.js.map +0 -1
  273. package/dist/tools/search-codebase.d.ts.map +0 -1
  274. package/dist/tools/search-codebase.js.map +0 -1
  275. package/dist/tools/server-status.d.ts.map +0 -1
  276. package/dist/tools/server-status.js.map +0 -1
  277. package/dist/tools/shared/scan-types.d.ts +0 -200
  278. package/dist/tools/shared/scan-types.d.ts.map +0 -1
  279. package/dist/tools/shared/scan-types.js +0 -7
  280. package/dist/tools/shared/scan-types.js.map +0 -1
  281. package/dist/tools/suggest-improvements.d.ts.map +0 -1
  282. package/dist/tools/suggest-improvements.js.map +0 -1
  283. package/dist/tools/trace-output-flow.d.ts.map +0 -1
  284. package/dist/tools/trace-output-flow.js.map +0 -1
  285. package/dist/tools/transform-code-batch.d.ts.map +0 -1
  286. package/dist/tools/transform-code-batch.js.map +0 -1
  287. package/dist/tools/transform-code.d.ts.map +0 -1
  288. package/dist/tools/transform-code.js.map +0 -1
  289. package/dist/tools/validate-before-transform.d.ts.map +0 -1
  290. package/dist/tools/validate-before-transform.js.map +0 -1
  291. package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
  292. package/dist/tools/validate-project-compatibility.js.map +0 -1
  293. package/dist/tools/validate-transformation.d.ts.map +0 -1
  294. package/dist/tools/validate-transformation.js.map +0 -1
  295. package/dist/types.d.ts.map +0 -1
  296. package/dist/types.js.map +0 -1
  297. package/dist/utils/format-tool-response.d.ts.map +0 -1
  298. package/dist/utils/format-tool-response.js.map +0 -1
@@ -0,0 +1,182 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Output parts of the analysis tools
3
+ *
4
+ * Schema pieces and summary helpers shared by analyze-project and the scans.
5
+ * Objects stay open, see `output-contract.ts`.
6
+ */
7
+ /** `pagination` of a paged result list. */
8
+ export declare const PAGINATION_SCHEMA: {
9
+ readonly type: "object";
10
+ readonly properties: {
11
+ readonly totalResults: {
12
+ readonly type: "integer";
13
+ };
14
+ readonly returnedResults: {
15
+ readonly type: "integer";
16
+ };
17
+ readonly offset: {
18
+ readonly type: "integer";
19
+ };
20
+ readonly hasMore: {
21
+ readonly type: "boolean";
22
+ };
23
+ };
24
+ readonly required: readonly ["totalResults", "returnedResults", "offset", "hasMore"];
25
+ };
26
+ /** Pagination of a result list, as the analysis tools report it. */
27
+ export interface Pagination {
28
+ totalResults: number;
29
+ returnedResults: number;
30
+ offset: number;
31
+ hasMore: boolean;
32
+ }
33
+ /**
34
+ * Names at most `max` entries, comma separated, with "and N more" for the
35
+ * rest; `undefined` for an empty list.
36
+ */
37
+ export declare function nameList(items: readonly string[], max: number): string | undefined;
38
+ /**
39
+ * `name n` pairs of a count record, largest first (ties by name), at most
40
+ * `max` of them; `undefined` for an empty record.
41
+ */
42
+ export declare function countList(counts: Record<string, number>, max: number): string | undefined;
43
+ /**
44
+ * Line about the returned page, or `undefined` when the page holds every
45
+ * result.
46
+ */
47
+ export declare function pageNote(pagination: Pagination | undefined, noun: string): string | undefined;
48
+ /** Counts of a scan over all violations, independent of the page. */
49
+ export interface ScanCounts {
50
+ /** Number of all violations. */
51
+ totalViolations: number;
52
+ /** Number of analyzed files. */
53
+ analyzedFiles: number;
54
+ /** Violations per severity. */
55
+ bySeverity: Record<string, number>;
56
+ /** Violations per category. */
57
+ byCategory: Record<string, number>;
58
+ /** Violations per rule id. */
59
+ byRule: Record<string, number>;
60
+ }
61
+ /** Fields of a scan violation the summary names. */
62
+ export interface ScanViolationLine {
63
+ ruleId: string;
64
+ severity: string;
65
+ filePath: string;
66
+ line?: number;
67
+ message: string;
68
+ }
69
+ /** `counts` of a scan. */
70
+ export declare const SCAN_COUNTS_SCHEMA: {
71
+ readonly type: "object";
72
+ readonly properties: {
73
+ readonly totalViolations: {
74
+ readonly type: "integer";
75
+ };
76
+ readonly analyzedFiles: {
77
+ readonly type: "integer";
78
+ };
79
+ readonly bySeverity: {
80
+ readonly type: "object";
81
+ readonly additionalProperties: {
82
+ readonly type: "integer";
83
+ };
84
+ };
85
+ readonly byCategory: {
86
+ readonly type: "object";
87
+ readonly additionalProperties: {
88
+ readonly type: "integer";
89
+ };
90
+ };
91
+ readonly byRule: {
92
+ readonly type: "object";
93
+ readonly additionalProperties: {
94
+ readonly type: "integer";
95
+ };
96
+ };
97
+ };
98
+ readonly required: readonly ["totalViolations", "analyzedFiles", "bySeverity", "byCategory", "byRule"];
99
+ };
100
+ /** One entry of `violations` of a scan. */
101
+ export declare const SCAN_VIOLATION_SCHEMA: {
102
+ readonly type: "object";
103
+ readonly properties: {
104
+ readonly id: {
105
+ readonly type: "string";
106
+ };
107
+ readonly ruleId: {
108
+ readonly type: "string";
109
+ };
110
+ readonly severity: {
111
+ readonly type: "string";
112
+ };
113
+ readonly message: {
114
+ readonly type: "string";
115
+ };
116
+ readonly filePath: {
117
+ readonly type: "string";
118
+ };
119
+ readonly line: {
120
+ readonly type: "integer";
121
+ };
122
+ readonly column: {
123
+ readonly type: "integer";
124
+ };
125
+ readonly category: {
126
+ readonly type: "string";
127
+ };
128
+ readonly suggestedFix: {
129
+ readonly type: "string";
130
+ };
131
+ readonly metadata: {
132
+ readonly type: "object";
133
+ };
134
+ };
135
+ readonly required: readonly ["ruleId", "severity", "message", "filePath"];
136
+ };
137
+ /**
138
+ * Run details of a scan that stopped early (time budget or cancellation);
139
+ * scan-architecture always reports them.
140
+ */
141
+ export declare const SCAN_EXECUTION_SCHEMA: {
142
+ readonly type: "object";
143
+ readonly properties: {
144
+ readonly maxDurationMs: {
145
+ readonly type: "number";
146
+ };
147
+ readonly incomplete: {
148
+ readonly type: "boolean";
149
+ };
150
+ readonly stopReason: {
151
+ readonly type: "string";
152
+ };
153
+ readonly skippedFiles: {
154
+ readonly type: "integer";
155
+ };
156
+ readonly ruleTimings: {
157
+ readonly type: "array";
158
+ readonly items: {
159
+ readonly type: "object";
160
+ };
161
+ };
162
+ readonly note: {
163
+ readonly type: "string";
164
+ };
165
+ };
166
+ readonly required: readonly ["incomplete", "skippedFiles"];
167
+ };
168
+ /**
169
+ * Output schema of a scan: violations, counts, metadata and summary, plus
170
+ * the tool's own fields. Only `counts`, `metadata` and `summary` are required.
171
+ */
172
+ export declare function scanOutputSchema(extra?: Record<string, unknown>): {
173
+ type: 'object';
174
+ properties: Record<string, unknown>;
175
+ required: string[];
176
+ };
177
+ /**
178
+ * Text summary of a scan: totals per severity, the largest rules and
179
+ * categories, the first violations of the page and the page itself.
180
+ */
181
+ export declare function describeScan(counts: ScanCounts, violations: readonly ScanViolationLine[], pagination: Pagination | undefined, notes?: readonly string[]): string;
182
+ //# sourceMappingURL=analysis-output.d.ts.map
@@ -0,0 +1,165 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Output parts of the analysis tools
3
+ *
4
+ * Schema pieces and summary helpers shared by analyze-project and the scans.
5
+ * Objects stay open, see `output-contract.ts`.
6
+ */
7
+ /** `pagination` of a paged result list. */
8
+ export const PAGINATION_SCHEMA = {
9
+ type: 'object',
10
+ properties: {
11
+ totalResults: { type: 'integer' },
12
+ returnedResults: { type: 'integer' },
13
+ offset: { type: 'integer' },
14
+ hasMore: { type: 'boolean' },
15
+ },
16
+ required: ['totalResults', 'returnedResults', 'offset', 'hasMore'],
17
+ };
18
+ /**
19
+ * Names at most `max` entries, comma separated, with "and N more" for the
20
+ * rest; `undefined` for an empty list.
21
+ */
22
+ export function nameList(items, max) {
23
+ if (items.length === 0) {
24
+ return undefined;
25
+ }
26
+ const more = items.length > max ? ` and ${items.length - max} more` : '';
27
+ return `${items.slice(0, max).join(', ')}${more}`;
28
+ }
29
+ /**
30
+ * `name n` pairs of a count record, largest first (ties by name), at most
31
+ * `max` of them; `undefined` for an empty record.
32
+ */
33
+ export function countList(counts, max) {
34
+ const sorted = Object.entries(counts).sort(([nameA, countA], [nameB, countB]) => countB - countA || nameA.localeCompare(nameB));
35
+ return nameList(sorted.map(([name, count]) => `${name} ${count}`), max);
36
+ }
37
+ /**
38
+ * Line about the returned page, or `undefined` when the page holds every
39
+ * result.
40
+ */
41
+ export function pageNote(pagination, noun) {
42
+ if (pagination === undefined || pagination.returnedResults === pagination.totalResults) {
43
+ return undefined;
44
+ }
45
+ const { offset, returnedResults, totalResults, hasMore } = pagination;
46
+ const range = returnedResults === 0
47
+ ? `none of ${totalResults} ${noun} (offset ${offset})`
48
+ : `${noun} ${offset + 1} to ${offset + returnedResults} of ${totalResults}`;
49
+ return `Showing ${range}${hasMore ? '; resultOffset pages on' : ''}.`;
50
+ }
51
+ const COUNT_RECORD = { type: 'object', additionalProperties: { type: 'integer' } };
52
+ /** `counts` of a scan. */
53
+ export const SCAN_COUNTS_SCHEMA = {
54
+ type: 'object',
55
+ properties: {
56
+ totalViolations: { type: 'integer' },
57
+ analyzedFiles: { type: 'integer' },
58
+ bySeverity: COUNT_RECORD,
59
+ byCategory: COUNT_RECORD,
60
+ byRule: COUNT_RECORD,
61
+ },
62
+ required: ['totalViolations', 'analyzedFiles', 'bySeverity', 'byCategory', 'byRule'],
63
+ };
64
+ /** One entry of `violations` of a scan. */
65
+ export const SCAN_VIOLATION_SCHEMA = {
66
+ type: 'object',
67
+ properties: {
68
+ id: { type: 'string' },
69
+ ruleId: { type: 'string' },
70
+ severity: { type: 'string' },
71
+ message: { type: 'string' },
72
+ filePath: { type: 'string' },
73
+ line: { type: 'integer' },
74
+ column: { type: 'integer' },
75
+ category: { type: 'string' },
76
+ suggestedFix: { type: 'string' },
77
+ metadata: { type: 'object' },
78
+ },
79
+ required: ['ruleId', 'severity', 'message', 'filePath'],
80
+ };
81
+ /**
82
+ * Run details of a scan that stopped early (time budget or cancellation);
83
+ * scan-architecture always reports them.
84
+ */
85
+ export const SCAN_EXECUTION_SCHEMA = {
86
+ type: 'object',
87
+ properties: {
88
+ maxDurationMs: { type: 'number' },
89
+ incomplete: { type: 'boolean' },
90
+ stopReason: { type: 'string' },
91
+ skippedFiles: { type: 'integer' },
92
+ ruleTimings: { type: 'array', items: { type: 'object' } },
93
+ note: { type: 'string' },
94
+ },
95
+ required: ['incomplete', 'skippedFiles'],
96
+ };
97
+ /**
98
+ * Output schema of a scan: violations, counts, metadata and summary, plus
99
+ * the tool's own fields. Only `counts`, `metadata` and `summary` are required.
100
+ */
101
+ export function scanOutputSchema(extra = {}) {
102
+ return {
103
+ type: 'object',
104
+ properties: {
105
+ violations: { type: 'array', items: SCAN_VIOLATION_SCHEMA },
106
+ counts: SCAN_COUNTS_SCHEMA,
107
+ metadata: {
108
+ type: 'object',
109
+ properties: {
110
+ rulesExecuted: { type: 'array', items: { type: 'string' } },
111
+ duration: { type: 'number' },
112
+ projectRoot: { type: 'string' },
113
+ },
114
+ required: ['rulesExecuted', 'duration', 'projectRoot'],
115
+ },
116
+ pagination: PAGINATION_SCHEMA,
117
+ orchestration: { type: 'object' },
118
+ ...extra,
119
+ summary: { type: 'string' },
120
+ },
121
+ required: ['counts', 'metadata', 'summary'],
122
+ };
123
+ }
124
+ /** Rules and categories named in a scan summary. */
125
+ const SUMMARY_COUNTS = 10;
126
+ /** Violations spelled out in a scan summary; the rest is in `violations`. */
127
+ const SUMMARY_VIOLATIONS = 5;
128
+ /** Longest violation message in a scan summary. */
129
+ const SUMMARY_MESSAGE_LENGTH = 160;
130
+ /**
131
+ * Text summary of a scan: totals per severity, the largest rules and
132
+ * categories, the first violations of the page and the page itself.
133
+ */
134
+ export function describeScan(counts, violations, pagination, notes = []) {
135
+ const severity = countList(counts.bySeverity, SUMMARY_COUNTS);
136
+ const lines = [
137
+ `${counts.totalViolations} violation(s) in ${counts.analyzedFiles} analyzed file(s)` +
138
+ (severity === undefined ? '.' : ` (${severity}).`),
139
+ ];
140
+ const rules = countList(counts.byRule, SUMMARY_COUNTS);
141
+ if (rules !== undefined) {
142
+ lines.push(`Rules: ${rules}.`);
143
+ }
144
+ const categories = countList(counts.byCategory, SUMMARY_COUNTS);
145
+ if (categories !== undefined) {
146
+ lines.push(`Categories: ${categories}.`);
147
+ }
148
+ if (violations.length > 0) {
149
+ lines.push(`First ${Math.min(violations.length, SUMMARY_VIOLATIONS)} returned:`);
150
+ for (const v of violations.slice(0, SUMMARY_VIOLATIONS)) {
151
+ const at = v.line === undefined ? v.filePath : `${v.filePath}:${v.line}`;
152
+ const message = v.message.length > SUMMARY_MESSAGE_LENGTH
153
+ ? `${v.message.slice(0, SUMMARY_MESSAGE_LENGTH - 3)}...`
154
+ : v.message;
155
+ lines.push(`- ${v.severity} ${v.ruleId} ${at}: ${message}`);
156
+ }
157
+ }
158
+ const page = pageNote(pagination, 'violations');
159
+ if (page !== undefined) {
160
+ lines.push(page);
161
+ }
162
+ lines.push(...notes);
163
+ return lines.join('\n');
164
+ }
165
+ //# sourceMappingURL=analysis-output.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * One kernel for all files of a transform-code batch. The batch used to build
3
+ * a kernel per file, and each kernel loads the whole tsconfig program: about
4
+ * 3 s per file on a 330-file package, about 8 s on a large app.
5
+ *
6
+ * The kernel loads on the first task. Tasks run one after another even when
7
+ * the batch runs files in parallel, because they share one ts-morph project.
8
+ * A failed load fails every task with the same error.
9
+ */
10
+ export interface BatchKernel<K> {
11
+ run<T>(task: (kernel: K) => Promise<T>): Promise<T>;
12
+ }
13
+ export declare function createBatchKernel<K>(load: () => Promise<K>): BatchKernel<K>;
14
+ //# sourceMappingURL=batch-kernel.d.ts.map
@@ -0,0 +1,12 @@
1
+ export function createBatchKernel(load) {
2
+ let kernel;
3
+ let queue = Promise.resolve();
4
+ return {
5
+ run(task) {
6
+ const next = queue.then(async () => task(await (kernel ??= load())));
7
+ queue = next.catch(() => undefined);
8
+ return next;
9
+ },
10
+ };
11
+ }
12
+ //# sourceMappingURL=batch-kernel.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Output schema pieces of the build tools
3
+ *
4
+ * Shared by run-build and check-incremental-compatibility, which both return
5
+ * the `IncompatibilityCheck` list of the core IncompatibilityDetector.
6
+ */
7
+ /** Schema of an `IncompatibilityCheck` list. */
8
+ export declare const INCOMPATIBILITY_ISSUES_SCHEMA: {
9
+ readonly type: "array";
10
+ readonly items: {
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ readonly type: {
14
+ readonly type: "string";
15
+ };
16
+ readonly detected: {
17
+ readonly type: "boolean";
18
+ };
19
+ readonly severity: {
20
+ readonly type: "string";
21
+ readonly enum: readonly ["blocker", "warning"];
22
+ };
23
+ readonly message: {
24
+ readonly type: "string";
25
+ };
26
+ readonly recommendation: {
27
+ readonly type: "string";
28
+ };
29
+ readonly details: {
30
+ readonly type: "object";
31
+ };
32
+ };
33
+ readonly required: readonly ["type", "detected", "severity", "message", "recommendation"];
34
+ };
35
+ };
36
+ //# sourceMappingURL=build-schemas.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Output schema pieces of the build tools
3
+ *
4
+ * Shared by run-build and check-incremental-compatibility, which both return
5
+ * the `IncompatibilityCheck` list of the core IncompatibilityDetector.
6
+ */
7
+ /** Schema of an `IncompatibilityCheck` list. */
8
+ export const INCOMPATIBILITY_ISSUES_SCHEMA = {
9
+ type: 'array',
10
+ items: {
11
+ type: 'object',
12
+ properties: {
13
+ type: { type: 'string' },
14
+ detected: { type: 'boolean' },
15
+ severity: { type: 'string', enum: ['blocker', 'warning'] },
16
+ message: { type: 'string' },
17
+ recommendation: { type: 'string' },
18
+ details: { type: 'object' },
19
+ },
20
+ required: ['type', 'detected', 'severity', 'message', 'recommendation'],
21
+ },
22
+ };
23
+ //# sourceMappingURL=build-schemas.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Node file system implementation of the api `CitationFileSource`.
3
+ *
4
+ * Lists repository files with `git ls-files` (tracked and untracked, ignored
5
+ * files excluded), and walks the directory without dependency and build
6
+ * folders when the root is not a git repository.
7
+ */
8
+ import { type CitationFileSource } from '@angular-modernizer/api';
9
+ export declare function createNodeCitationFileSource(root: string): CitationFileSource;
10
+ //# sourceMappingURL=citation-file-source.d.ts.map
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Node file system implementation of the api `CitationFileSource`.
3
+ *
4
+ * Lists repository files with `git ls-files` (tracked and untracked, ignored
5
+ * files excluded), and walks the directory without dependency and build
6
+ * folders when the root is not a git repository.
7
+ */
8
+ import { execFileSync } from 'node:child_process';
9
+ import { readFileSync, readdirSync, statSync } from 'node:fs';
10
+ import { join, sep } from 'node:path';
11
+ const SKIPPED_DIRECTORIES = new Set([
12
+ 'node_modules',
13
+ '.git',
14
+ '.angular',
15
+ '.nx',
16
+ 'dist',
17
+ 'coverage',
18
+ 'out-tsc',
19
+ ]);
20
+ /** Stops the walk on a mistaken root such as `/`. */
21
+ const MAX_WALKED_FILES = 200_000;
22
+ export function createNodeCitationFileSource(root) {
23
+ return {
24
+ listFiles: () => gitFiles(root) ?? walk(root),
25
+ isFile: (path) => {
26
+ try {
27
+ return statSync(path).isFile();
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ },
33
+ readFile: (path) => readFileSync(path, 'utf8'),
34
+ };
35
+ }
36
+ function gitFiles(root) {
37
+ try {
38
+ const out = execFileSync('git', ['ls-files', '--cached', '--others', '--exclude-standard'], {
39
+ cwd: root,
40
+ encoding: 'utf8',
41
+ maxBuffer: 64 * 1024 * 1024,
42
+ stdio: ['ignore', 'pipe', 'ignore'],
43
+ });
44
+ return out
45
+ .split('\n')
46
+ .filter(Boolean)
47
+ .map((f) => f.split('/').join(sep));
48
+ }
49
+ catch {
50
+ return undefined;
51
+ }
52
+ }
53
+ function walk(root) {
54
+ const files = [];
55
+ const stack = [''];
56
+ while (stack.length > 0 && files.length < MAX_WALKED_FILES) {
57
+ const dir = stack.pop();
58
+ if (dir === undefined) {
59
+ break;
60
+ }
61
+ let entries;
62
+ try {
63
+ entries = readdirSync(join(root, dir), { withFileTypes: true });
64
+ }
65
+ catch {
66
+ continue;
67
+ }
68
+ for (const entry of entries) {
69
+ const rel = dir === '' ? entry.name : join(dir, entry.name);
70
+ if (entry.isDirectory()) {
71
+ if (!SKIPPED_DIRECTORIES.has(entry.name)) {
72
+ stack.push(rel);
73
+ }
74
+ }
75
+ else {
76
+ files.push(rel);
77
+ }
78
+ }
79
+ }
80
+ return files;
81
+ }
82
+ //# sourceMappingURL=citation-file-source.js.map
@@ -12,7 +12,8 @@
12
12
  * `truncated: true` when anything was cut. Counts always describe the full
13
13
  * result, never the shortened list.
14
14
  * Both are opt-in; without them the tools return everything, as before. The
15
- * JSON-RPC handler's 4 MB limit stays the last line of defence.
15
+ * 4 MB response limit of the stdio transport (`server/limited-stdio-transport.ts`)
16
+ * stays the last line of defence.
16
17
  */
17
18
  /** JSON schema entries for the two shared parameters. */
18
19
  export declare const COMPACT_OUTPUT_SCHEMA: {
@@ -12,7 +12,8 @@
12
12
  * `truncated: true` when anything was cut. Counts always describe the full
13
13
  * result, never the shortened list.
14
14
  * Both are opt-in; without them the tools return everything, as before. The
15
- * JSON-RPC handler's 4 MB limit stays the last line of defence.
15
+ * 4 MB response limit of the stdio transport (`server/limited-stdio-transport.ts`)
16
+ * stays the last line of defence.
16
17
  */
17
18
  import { relative, sep } from 'node:path';
18
19
  /** JSON schema entries for the two shared parameters. */
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Result window of scan-all.
3
+ *
4
+ * Every finding, from the cache or newly analyzed, passes through the same
5
+ * steps: the rule filter, then the totals of the summary, then the page
6
+ * [offset, offset + limit). The window holds at most `limit` findings, so a
7
+ * large project does not keep all findings in memory for one page.
8
+ */
9
+ /** A finding as scan-all collects and caches it. */
10
+ export interface WindowFinding {
11
+ ruleId?: unknown;
12
+ filePath?: unknown;
13
+ severity?: unknown;
14
+ category?: unknown;
15
+ }
16
+ export interface FindingTotals {
17
+ totalViolations: number;
18
+ bySeverity: Record<string, number>;
19
+ byCategory: Record<string, number>;
20
+ byRule: Record<string, number>;
21
+ }
22
+ export declare class FindingWindow<T extends WindowFinding> {
23
+ private readonly offset;
24
+ private readonly limit;
25
+ private readonly rules;
26
+ private readonly page;
27
+ private readonly totals;
28
+ /**
29
+ * @param rules - Rule IDs to keep; empty or undefined keeps every rule
30
+ * @param offset - Index of the first finding of the page
31
+ * @param limit - Maximum number of findings on the page
32
+ */
33
+ constructor(rules: readonly string[] | undefined, offset: number, limit: number);
34
+ /** Count the finding and keep it when it falls on the page. */
35
+ add(finding: T): void;
36
+ /** Findings of the page, in the order they were added. */
37
+ getPage(): readonly T[];
38
+ /** Totals over every finding that passed the rule filter. */
39
+ getTotals(): FindingTotals;
40
+ /** Whether findings follow after the page. */
41
+ hasMore(): boolean;
42
+ }
43
+ //# sourceMappingURL=finding-window.d.ts.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Result window of scan-all.
3
+ *
4
+ * Every finding, from the cache or newly analyzed, passes through the same
5
+ * steps: the rule filter, then the totals of the summary, then the page
6
+ * [offset, offset + limit). The window holds at most `limit` findings, so a
7
+ * large project does not keep all findings in memory for one page.
8
+ */
9
+ export class FindingWindow {
10
+ offset;
11
+ limit;
12
+ rules;
13
+ page = [];
14
+ totals = {
15
+ totalViolations: 0,
16
+ bySeverity: {},
17
+ byCategory: {},
18
+ byRule: {},
19
+ };
20
+ /**
21
+ * @param rules - Rule IDs to keep; empty or undefined keeps every rule
22
+ * @param offset - Index of the first finding of the page
23
+ * @param limit - Maximum number of findings on the page
24
+ */
25
+ constructor(rules, offset, limit) {
26
+ this.offset = offset;
27
+ this.limit = limit;
28
+ this.rules = rules?.length ? new Set(rules) : undefined;
29
+ }
30
+ /** Count the finding and keep it when it falls on the page. */
31
+ add(finding) {
32
+ if (typeof finding.ruleId !== 'string' || !finding.filePath) {
33
+ return;
34
+ }
35
+ if (this.rules && !this.rules.has(finding.ruleId)) {
36
+ return;
37
+ }
38
+ const index = this.totals.totalViolations++;
39
+ increment(this.totals.byRule, finding.ruleId);
40
+ increment(this.totals.bySeverity, String(finding.severity));
41
+ increment(this.totals.byCategory, typeof finding.category === 'string' && finding.category
42
+ ? finding.category
43
+ : 'General');
44
+ if (index >= this.offset && index < this.offset + this.limit) {
45
+ this.page.push(finding);
46
+ }
47
+ }
48
+ /** Findings of the page, in the order they were added. */
49
+ getPage() {
50
+ return this.page;
51
+ }
52
+ /** Totals over every finding that passed the rule filter. */
53
+ getTotals() {
54
+ return this.totals;
55
+ }
56
+ /** Whether findings follow after the page. */
57
+ hasMore() {
58
+ return this.offset + this.limit < this.totals.totalViolations;
59
+ }
60
+ }
61
+ function increment(counts, key) {
62
+ counts[key] = (counts[key] ?? 0) + 1;
63
+ }
64
+ //# sourceMappingURL=finding-window.js.map