@angular-modernizer/adapter-mcp 0.2.0 → 1.0.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.md +188 -235
- package/dist/cli.js +77 -27
- package/dist/index.d.ts +11 -3
- package/dist/index.js +10 -2
- package/dist/mcp-watcher.d.ts +6 -1
- package/dist/mcp-watcher.js +14 -10
- package/dist/server/limited-stdio-transport.d.ts +68 -0
- package/dist/server/limited-stdio-transport.js +115 -0
- package/dist/server/mcp-server.d.ts +41 -12
- package/dist/server/mcp-server.js +113 -94
- package/dist/server/package-version.d.ts +16 -0
- package/dist/server/package-version.js +37 -0
- package/dist/server/sdk-server.d.ts +70 -0
- package/dist/server/sdk-server.js +113 -0
- package/dist/server/stdio-guard.d.ts +20 -0
- package/dist/server/stdio-guard.js +48 -0
- package/dist/server/tool-registry.d.ts +3 -2
- package/dist/server/tool-registry.js +5 -5
- package/dist/tools/analyze-build-impact.d.ts +346 -14
- package/dist/tools/analyze-build-impact.js +315 -31
- package/dist/tools/analyze-core-to-shared.d.ts +134 -4
- package/dist/tools/analyze-core-to-shared.js +113 -9
- package/dist/tools/analyze-parser-performance.d.ts +200 -7
- package/dist/tools/analyze-parser-performance.js +108 -47
- package/dist/tools/analyze-project.d.ts +267 -5
- package/dist/tools/analyze-project.js +196 -8
- package/dist/tools/check-incremental-compatibility.d.ts +61 -1
- package/dist/tools/check-incremental-compatibility.js +58 -2
- package/dist/tools/collect-feedback.d.ts +199 -10
- package/dist/tools/collect-feedback.js +171 -99
- package/dist/tools/compare-health.d.ts +356 -0
- package/dist/tools/compare-health.js +472 -0
- package/dist/tools/extract-libraries.d.ts +156 -4
- package/dist/tools/extract-libraries.js +115 -10
- package/dist/tools/find-angular-symbol.d.ts +98 -9
- package/dist/tools/find-angular-symbol.js +104 -12
- package/dist/tools/find-component-hosts.d.ts +684 -0
- package/dist/tools/find-component-hosts.js +441 -0
- package/dist/tools/find-usages.d.ts +99 -4
- package/dist/tools/find-usages.js +131 -11
- package/dist/tools/get-bootstrap-execution.d.ts +258 -0
- package/dist/tools/get-bootstrap-execution.js +324 -0
- package/dist/tools/get-call-graph.d.ts +139 -4
- package/dist/tools/get-call-graph.js +123 -13
- package/dist/tools/get-operation-progress-tool.d.ts +114 -2
- package/dist/tools/get-operation-progress-tool.js +114 -7
- package/dist/tools/get-operation-progress.d.ts +1 -1
- package/dist/tools/get-operation-progress.js +5 -5
- package/dist/tools/helpers/analysis-output.d.ts +177 -0
- package/dist/tools/helpers/analysis-output.js +165 -0
- package/dist/tools/helpers/build-schemas.d.ts +36 -0
- package/dist/tools/helpers/build-schemas.js +23 -0
- package/dist/tools/helpers/citation-file-source.d.ts +10 -0
- package/dist/tools/helpers/citation-file-source.js +82 -0
- package/dist/tools/helpers/compact-output.d.ts +61 -0
- package/dist/tools/helpers/compact-output.js +83 -0
- package/dist/tools/helpers/finding-window.d.ts +43 -0
- package/dist/tools/helpers/finding-window.js +64 -0
- package/dist/tools/helpers/health-delta.d.ts +86 -0
- package/dist/tools/helpers/health-delta.js +239 -0
- package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
- package/dist/tools/helpers/investigation-schemas.js +48 -0
- package/dist/tools/helpers/library-imports.d.ts +57 -0
- package/dist/tools/helpers/library-imports.js +151 -0
- package/dist/tools/helpers/load-source-files.d.ts +30 -0
- package/dist/tools/helpers/load-source-files.js +34 -0
- package/dist/tools/helpers/output-contract.d.ts +32 -0
- package/dist/tools/helpers/output-contract.js +32 -0
- package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
- package/dist/tools/helpers/platform-root-resolver.js +75 -48
- package/dist/tools/helpers/process-output.d.ts +19 -0
- package/dist/tools/helpers/process-output.js +31 -0
- package/dist/tools/helpers/project-cache.d.ts +184 -0
- package/dist/tools/helpers/project-cache.js +331 -0
- package/dist/tools/helpers/project-decorators.d.ts +14 -0
- package/dist/tools/helpers/project-decorators.js +22 -0
- package/dist/tools/helpers/rule-matcher.js +5 -0
- package/dist/tools/helpers/rule-runner.d.ts +72 -0
- package/dist/tools/helpers/rule-runner.js +131 -0
- package/dist/tools/helpers/scan-cache.d.ts +22 -0
- package/dist/tools/helpers/scan-cache.js +34 -0
- package/dist/tools/helpers/scan-plan.d.ts +48 -0
- package/dist/tools/helpers/scan-plan.js +166 -0
- package/dist/tools/helpers/scope-paths.d.ts +17 -0
- package/dist/tools/helpers/scope-paths.js +32 -0
- package/dist/tools/helpers/stack-frame-file-index.d.ts +10 -0
- package/dist/tools/helpers/stack-frame-file-index.js +71 -0
- package/dist/tools/helpers/tool-context.d.ts +60 -0
- package/dist/tools/helpers/tool-context.js +82 -0
- package/dist/tools/helpers/transform-safety.d.ts +40 -0
- package/dist/tools/helpers/transform-safety.js +87 -0
- package/dist/tools/helpers/validation-output.d.ts +53 -0
- package/dist/tools/helpers/validation-output.js +48 -0
- package/dist/tools/inspect-form-group.d.ts +324 -0
- package/dist/tools/inspect-form-group.js +279 -0
- package/dist/tools/inspect-i18n.d.ts +466 -0
- package/dist/tools/inspect-i18n.js +400 -0
- package/dist/tools/inspect-template.d.ts +320 -0
- package/dist/tools/inspect-template.js +324 -0
- package/dist/tools/learn-patterns.d.ts +122 -1
- package/dist/tools/learn-patterns.js +97 -2
- package/dist/tools/list-imports.d.ts +128 -11
- package/dist/tools/list-imports.js +128 -8
- package/dist/tools/orchestrate-migration.d.ts +129 -5
- package/dist/tools/orchestrate-migration.js +166 -12
- package/dist/tools/parse-stack-trace.d.ts +59 -2
- package/dist/tools/parse-stack-trace.js +52 -4
- package/dist/tools/plan-migration.d.ts +418 -1
- package/dist/tools/plan-migration.js +355 -8
- package/dist/tools/resolve-type.d.ts +42 -1
- package/dist/tools/resolve-type.js +37 -4
- package/dist/tools/review-feedback.d.ts +206 -11
- package/dist/tools/review-feedback.js +132 -51
- package/dist/tools/rollback-changes.d.ts +79 -2
- package/dist/tools/rollback-changes.js +66 -14
- package/dist/tools/run-angular-cli.d.ts +45 -2
- package/dist/tools/run-angular-cli.js +67 -7
- package/dist/tools/run-build.d.ts +114 -2
- package/dist/tools/run-build.js +117 -8
- package/dist/tools/run-schematic.d.ts +70 -2
- package/dist/tools/run-schematic.js +104 -10
- package/dist/tools/scan-all.d.ts +24 -16
- package/dist/tools/scan-all.js +145 -137
- package/dist/tools/scan-angular.d.ts +20 -11
- package/dist/tools/scan-angular.js +52 -24
- package/dist/tools/scan-architecture.d.ts +42 -14
- package/dist/tools/scan-architecture.js +206 -163
- package/dist/tools/scan-solid.d.ts +20 -11
- package/dist/tools/scan-solid.js +52 -24
- package/dist/tools/search-codebase.d.ts +85 -1
- package/dist/tools/search-codebase.js +61 -4
- package/dist/tools/server-status.d.ts +370 -0
- package/dist/tools/server-status.js +369 -0
- package/dist/tools/suggest-improvements.d.ts +97 -5
- package/dist/tools/suggest-improvements.js +80 -44
- package/dist/tools/trace-output-flow.d.ts +791 -0
- package/dist/tools/trace-output-flow.js +668 -0
- package/dist/tools/transform-code-batch.d.ts +3 -0
- package/dist/tools/transform-code-batch.js +10 -5
- package/dist/tools/transform-code.d.ts +335 -12
- package/dist/tools/transform-code.js +649 -608
- package/dist/tools/validate-before-transform.d.ts +116 -2
- package/dist/tools/validate-before-transform.js +55 -2
- package/dist/tools/validate-project-compatibility.d.ts +64 -2
- package/dist/tools/validate-project-compatibility.js +67 -4
- package/dist/tools/validate-transformation.d.ts +220 -2
- package/dist/tools/validate-transformation.js +113 -15
- package/dist/tools/verify-citations.d.ts +181 -0
- package/dist/tools/verify-citations.js +218 -0
- package/dist/types.d.ts +45 -1
- package/dist/utils/format-tool-response.d.ts +22 -59
- package/dist/utils/format-tool-response.js +25 -134
- package/package.json +30 -13
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/core/project-analyzer.d.ts.map +0 -1
- package/dist/core/project-analyzer.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-watcher.d.ts.map +0 -1
- package/dist/mcp-watcher.js.map +0 -1
- package/dist/server/json-rpc-handler.d.ts +0 -57
- package/dist/server/json-rpc-handler.d.ts.map +0 -1
- package/dist/server/json-rpc-handler.js +0 -222
- package/dist/server/json-rpc-handler.js.map +0 -1
- package/dist/server/mcp-server.d.ts.map +0 -1
- package/dist/server/mcp-server.js.map +0 -1
- package/dist/server/tool-registry.d.ts.map +0 -1
- package/dist/server/tool-registry.js.map +0 -1
- package/dist/streaming/progress-store.d.ts.map +0 -1
- package/dist/streaming/progress-store.js.map +0 -1
- package/dist/tools/analyze-build-impact.d.ts.map +0 -1
- package/dist/tools/analyze-build-impact.js.map +0 -1
- package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
- package/dist/tools/analyze-core-to-shared.js.map +0 -1
- package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
- package/dist/tools/analyze-parser-performance.js.map +0 -1
- package/dist/tools/analyze-project.d.ts.map +0 -1
- package/dist/tools/analyze-project.js.map +0 -1
- package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
- package/dist/tools/check-incremental-compatibility.js.map +0 -1
- package/dist/tools/collect-feedback.d.ts.map +0 -1
- package/dist/tools/collect-feedback.js.map +0 -1
- package/dist/tools/extract-libraries.d.ts.map +0 -1
- package/dist/tools/extract-libraries.js.map +0 -1
- package/dist/tools/find-angular-symbol.d.ts.map +0 -1
- package/dist/tools/find-angular-symbol.js.map +0 -1
- package/dist/tools/find-usages.d.ts.map +0 -1
- package/dist/tools/find-usages.js.map +0 -1
- package/dist/tools/get-call-graph.d.ts.map +0 -1
- package/dist/tools/get-call-graph.js.map +0 -1
- package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
- package/dist/tools/get-operation-progress-tool.js.map +0 -1
- package/dist/tools/get-operation-progress.d.ts.map +0 -1
- package/dist/tools/get-operation-progress.js.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
- package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
- package/dist/tools/helpers/find-ts-config.js.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
- package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
- package/dist/tools/helpers/rule-matcher.js.map +0 -1
- package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
- package/dist/tools/helpers/suggestion-generator.js.map +0 -1
- package/dist/tools/learn-patterns.d.ts.map +0 -1
- package/dist/tools/learn-patterns.js.map +0 -1
- package/dist/tools/list-imports.d.ts.map +0 -1
- package/dist/tools/list-imports.js.map +0 -1
- package/dist/tools/orchestrate-migration.d.ts.map +0 -1
- package/dist/tools/orchestrate-migration.js.map +0 -1
- package/dist/tools/parse-stack-trace.d.ts.map +0 -1
- package/dist/tools/parse-stack-trace.js.map +0 -1
- package/dist/tools/plan-migration.d.ts.map +0 -1
- package/dist/tools/plan-migration.js.map +0 -1
- package/dist/tools/resolve-type.d.ts.map +0 -1
- package/dist/tools/resolve-type.js.map +0 -1
- package/dist/tools/review-feedback.d.ts.map +0 -1
- package/dist/tools/review-feedback.js.map +0 -1
- package/dist/tools/rollback-changes.d.ts.map +0 -1
- package/dist/tools/rollback-changes.js.map +0 -1
- package/dist/tools/run-angular-cli.d.ts.map +0 -1
- package/dist/tools/run-angular-cli.js.map +0 -1
- package/dist/tools/run-build.d.ts.map +0 -1
- package/dist/tools/run-build.js.map +0 -1
- package/dist/tools/run-schematic.d.ts.map +0 -1
- package/dist/tools/run-schematic.js.map +0 -1
- package/dist/tools/scan-all.d.ts.map +0 -1
- package/dist/tools/scan-all.js.map +0 -1
- package/dist/tools/scan-angular.d.ts.map +0 -1
- package/dist/tools/scan-angular.js.map +0 -1
- package/dist/tools/scan-architecture.d.ts.map +0 -1
- package/dist/tools/scan-architecture.js.map +0 -1
- package/dist/tools/scan-solid.d.ts.map +0 -1
- package/dist/tools/scan-solid.js.map +0 -1
- package/dist/tools/search-codebase.d.ts.map +0 -1
- package/dist/tools/search-codebase.js.map +0 -1
- package/dist/tools/shared/scan-types.d.ts.map +0 -1
- package/dist/tools/shared/scan-types.js.map +0 -1
- package/dist/tools/suggest-improvements.d.ts.map +0 -1
- package/dist/tools/suggest-improvements.js.map +0 -1
- package/dist/tools/transform-code-batch.d.ts.map +0 -1
- package/dist/tools/transform-code-batch.js.map +0 -1
- package/dist/tools/transform-code.d.ts.map +0 -1
- package/dist/tools/transform-code.js.map +0 -1
- package/dist/tools/validate-before-transform.d.ts.map +0 -1
- package/dist/tools/validate-before-transform.js.map +0 -1
- package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
- package/dist/tools/validate-project-compatibility.js.map +0 -1
- package/dist/tools/validate-transformation.d.ts.map +0 -1
- package/dist/tools/validate-transformation.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/format-tool-response.d.ts.map +0 -1
- package/dist/utils/format-tool-response.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @angular-modernizer/adapter-mcp
|
|
2
2
|
|
|
3
|
-
MCP server that exposes Angular Modernizer capabilities as
|
|
3
|
+
MCP server that exposes Angular Modernizer capabilities as 41 structured tools for AI assistants.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -20,7 +20,9 @@ AI Assistant (Claude/Copilot)
|
|
|
20
20
|
| JSON-RPC 2.0 (stdio)
|
|
21
21
|
v
|
|
22
22
|
MCP Server (adapter-mcp)
|
|
23
|
-
-
|
|
23
|
+
- 41 Tools (analysis, planning, transformation,
|
|
24
|
+
build and validation, feedback, bug investigation)
|
|
25
|
+
- Shared ts-morph ProjectCache
|
|
24
26
|
- Real-time Progress Monitoring
|
|
25
27
|
- Parameter Validation
|
|
26
28
|
- Result Serialization
|
|
@@ -28,11 +30,11 @@ MCP Server (adapter-mcp)
|
|
|
28
30
|
| TypeScript API
|
|
29
31
|
v
|
|
30
32
|
Core Platform (Kernel + Plugins)
|
|
31
|
-
- Analysis Rules (
|
|
32
|
-
- Architecture:
|
|
33
|
-
- Angular:
|
|
33
|
+
- Analysis Rules (52 rules total)
|
|
34
|
+
- Architecture: 17 rules
|
|
35
|
+
- Angular: 28 rules
|
|
34
36
|
- SOLID: 7 rules
|
|
35
|
-
- Transformations (
|
|
37
|
+
- Transformations (26 types via transform-code)
|
|
36
38
|
- Caching
|
|
37
39
|
- Orchestration
|
|
38
40
|
|
|
|
@@ -44,6 +46,16 @@ TypeScript Project
|
|
|
44
46
|
- Semantic Analysis
|
|
45
47
|
```
|
|
46
48
|
|
|
49
|
+
### Protocol
|
|
50
|
+
|
|
51
|
+
The server runs on the official MCP TypeScript SDK (`@modelcontextprotocol/server`) over stdio and serves both protocol eras on one connection type: clients that open with `initialize` get the revision they ask for (2025-06-18, 2025-11-25), clients that open with `server/discover` get 2026-07-28. Tool results are identical in both eras. Only the `tools` capability is announced. A response above 4 MB is replaced by an error result that names the tool and how to narrow the request.
|
|
52
|
+
|
|
53
|
+
Arguments are validated against each tool's input schema (JSON Schema 2020-12) before the tool runs. Wrong types, missing required arguments and unknown argument names come back as an error result (`isError: true`) naming the offending argument. A tool that reports a failure in its result (`success: false` or `status: "failed"`, e.g. a build that exits with an error) also answers with `isError: true`; the result details stay in `structuredContent`.
|
|
54
|
+
|
|
55
|
+
Every tool has an output schema and answers with `structuredContent`: the result object, which always carries a `summary` string. The text content holds only that summary (repeating the JSON there made the answers 1.6 times as large; Claude Code shows the model `structuredContent`). `structuredContent` is validated against the output schema; a result that does not match comes back as an error result. Tools that run a command (run-angular-cli, run-build, run-schematic) keep the full output in the result and repeat only its last lines in the summary on failure. orchestrate-migration reports its step counts in `counts` and `workflowId` at the top level.
|
|
56
|
+
|
|
57
|
+
Set `ANGULAR_MODERNIZER_DEBUG=1` in the server environment for diagnostics: a debug log `./mcp-server.log` in the working directory and a health check on `http://localhost:9999/health` and `/status`. Both are off by default.
|
|
58
|
+
|
|
47
59
|
---
|
|
48
60
|
|
|
49
61
|
## Quick Start
|
|
@@ -59,45 +71,57 @@ pnpm start
|
|
|
59
71
|
|
|
60
72
|
### Configuration
|
|
61
73
|
|
|
62
|
-
Create `.angular-modernizer.json` in your project root
|
|
74
|
+
Create `.angular-modernizer.json` in your project root. Only `build` is required; per-tool defaults go under
|
|
75
|
+
`tools` (full reference: `docs/CONFIGURATION.md`, schema: `packages/core/schemas/angular-modernizer.schema.json`):
|
|
63
76
|
|
|
64
77
|
```json
|
|
65
78
|
{
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"orchestration": {
|
|
70
|
-
"parallel": true,
|
|
71
|
-
"autoSelectMode": true
|
|
72
|
-
}
|
|
79
|
+
"build": {
|
|
80
|
+
"command": "ng build",
|
|
81
|
+
"mode": "incremental"
|
|
73
82
|
},
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
"tools": {
|
|
84
|
+
"analyze-project": {
|
|
85
|
+
"excludePatterns": ["**/node_modules/**", "**/dist/**"],
|
|
86
|
+
"orchestration": { "parallel": true, "autoSelectMode": true }
|
|
87
|
+
},
|
|
88
|
+
"scan-architecture": {
|
|
89
|
+
"maxFiles": 500,
|
|
90
|
+
"orchestration": { "parallel": true, "enableProgress": true }
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
94
|
```
|
|
84
95
|
|
|
85
|
-
|
|
96
|
+
The schema allows no unknown top-level keys: tool options outside `tools` make the file fail validation
|
|
97
|
+
(`ConfigValidationError`), and none of its settings apply.
|
|
98
|
+
|
|
99
|
+
### Client Setup
|
|
86
100
|
|
|
87
|
-
|
|
101
|
+
The server entry point is `dist/cli.js` (`dist/index.js` only exports the tool classes). Claude Code:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
claude mcp add angular-modernizer npx @angular-modernizer/adapter-mcp
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Or point a client at a local build, e.g. `.mcp.json` / `claude_desktop_config.json`:
|
|
88
108
|
|
|
89
109
|
```json
|
|
90
110
|
{
|
|
91
111
|
"mcpServers": {
|
|
92
112
|
"angular-modernizer": {
|
|
93
113
|
"command": "node",
|
|
94
|
-
"args": ["/path/to/tsanalyzer/packages/adapter-mcp/dist/
|
|
114
|
+
"args": ["--expose-gc", "/path/to/tsanalyzer/packages/adapter-mcp/dist/cli.js"],
|
|
95
115
|
"cwd": "/path/to/your/angular/project"
|
|
96
116
|
}
|
|
97
117
|
}
|
|
98
118
|
}
|
|
99
119
|
```
|
|
100
120
|
|
|
121
|
+
`--expose-gc` lets the ProjectCache collect garbage after evicting a project. `cli.js` also takes
|
|
122
|
+
`--max-projects N` and `--max-heap-mb N` (defaults 3 and 2048). A running client keeps the old code in memory
|
|
123
|
+
after a rebuild; reconnect, or check `server-status` (`build.rebuiltSinceStart`).
|
|
124
|
+
|
|
101
125
|
---
|
|
102
126
|
|
|
103
127
|
## Available Tools
|
|
@@ -107,13 +131,18 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
107
131
|
| Tool | Purpose | Rules | Cache | Time |
|
|
108
132
|
|-|-|-|-|-|
|
|
109
133
|
| analyze-project | Framework/architecture detection | - | yes | 2-5s |
|
|
110
|
-
| scan-architecture | Architecture violations |
|
|
134
|
+
| scan-architecture | Architecture violations incl. import cycles and layer boundaries | 17 | yes | 5-30s |
|
|
111
135
|
| scan-solid | SOLID principle violations | 7 | yes | 3-15s |
|
|
112
|
-
| scan-angular | Angular best practices |
|
|
113
|
-
| scan-all | Combined analysis (all plugins) |
|
|
136
|
+
| scan-angular | Angular best practices | 28 | yes | 5-20s |
|
|
137
|
+
| scan-all | Combined analysis (all plugins) | 52 | yes | 10-45s |
|
|
138
|
+
| compare-health | Full scan compared with the previous run: new, fixed and unchanged violations per rule and file; answers with `structuredContent` | 52 | yes (scan-all cache) | scan-all time |
|
|
114
139
|
| analyze-core-to-shared | Dependency violation analysis | - | yes | 3-10s |
|
|
140
|
+
| analyze-parser-performance | Parser metrics from feedback sessions | - | no | varies |
|
|
141
|
+
| extract-libraries | Library extraction candidates (shared folders, secondary entry points) | - | no | varies |
|
|
115
142
|
| learn-patterns | ML-based pattern discovery | - | yes | 10-60s |
|
|
116
143
|
|
|
144
|
+
The scans, analyze-project, analyze-core-to-shared and extract-libraries keep their numbers in `counts` (for the scans `totalViolations`, `analyzedFiles`, `bySeverity`, `byCategory`, `byRule`, always over all violations); `summary` is a short text with the totals, the largest rules and categories, the first five entries and the returned page. `violations` holds only the page set by `maxResults` and `resultOffset`, `pagination` says what was cut.
|
|
145
|
+
|
|
117
146
|
#### analyze-project
|
|
118
147
|
|
|
119
148
|
Detects framework (Angular CLI, Nx), analyzes architecture patterns, identifies layers, and discovers project structure including PWA/offline capabilities.
|
|
@@ -126,13 +155,16 @@ Key features:
|
|
|
126
155
|
|
|
127
156
|
#### scan-architecture
|
|
128
157
|
|
|
129
|
-
Runs
|
|
158
|
+
Runs 17 architecture rules detecting import cycles (`solid:circular-dependency`, project-wide value-import graph with NG0919 risk flag), god objects, layer boundary violations, and architectural anti-patterns.
|
|
130
159
|
|
|
131
160
|
Key features:
|
|
132
161
|
- Batch processing (handles unlimited files)
|
|
133
162
|
- Scope filtering (apps, libs, features, folders)
|
|
134
163
|
- Up to 39x speedup with caching (202.8s to 5.2s measured)
|
|
135
164
|
- Parallel execution with auto-selection
|
|
165
|
+
- Time budget `maxDurationMs` (default 300000, `0` = off): checked between files; on overrun the scan returns what it has with `execution.incomplete`, `skippedFiles` and a note. `execution.ruleTimings` lists time per rule, slowest first. Note that `maxFiles` defaults to 100.
|
|
166
|
+
- Pagination: `maxResults` (default 1000) and `resultOffset` page the violations; `counts` cover all of them, `pagination.hasMore` says whether to fetch the next page. Pass `rules` (exact rule ids such as `solid:circular-dependency`) for a focused scan.
|
|
167
|
+
- Progress (`notifications/progress`, with a `progressToken`) and cancellation between files, see Progress and Cancellation. `streaming` (deprecated) defaults to `false`: the call returns the violations. With `streaming: true` it returns an `operationId` at once and `get-operation-progress` returns the result.
|
|
136
168
|
|
|
137
169
|
#### scan-solid
|
|
138
170
|
|
|
@@ -146,7 +178,7 @@ Key features:
|
|
|
146
178
|
|
|
147
179
|
#### scan-angular
|
|
148
180
|
|
|
149
|
-
Runs
|
|
181
|
+
Runs 28 Angular-specific rules detecting OnPush violations, RxJS anti-patterns, performance issues, and framework best practice violations.
|
|
150
182
|
|
|
151
183
|
Key features:
|
|
152
184
|
- Angular-specific best practices
|
|
@@ -157,14 +189,24 @@ Key features:
|
|
|
157
189
|
|
|
158
190
|
#### scan-all
|
|
159
191
|
|
|
160
|
-
Runs all
|
|
192
|
+
Runs all 52 analysis rules (17 architecture + 7 SOLID + 28 Angular) with its own cache in `.angular-modernizer-cache/all/`.
|
|
161
193
|
|
|
162
194
|
Key features:
|
|
163
195
|
- Combines all plugin rules in single scan
|
|
164
|
-
-
|
|
165
|
-
-
|
|
196
|
+
- Caches every analyzed file, also without findings, with its template findings and the template as dependency
|
|
197
|
+
- Reads and writes only its own cache; the caches of scan-architecture, scan-solid and scan-angular are not read
|
|
166
198
|
- Comprehensive analysis in one execution
|
|
167
199
|
|
|
200
|
+
#### compare-health
|
|
201
|
+
|
|
202
|
+
Runs the scan-all scan over every violation (no result window), compares it with the snapshot of the previous run and stores the current run as the new snapshot.
|
|
203
|
+
|
|
204
|
+
Key features:
|
|
205
|
+
- Snapshot in `.angular-modernizer-cache/health/last-run.json` (`snapshotPath` overrides), git-ignored with the cache
|
|
206
|
+
- Violations match by rule, file and message with digits ignored, so moved lines stay unchanged
|
|
207
|
+
- `totals`, `byRule`, `byFile`, `newViolations`, `fixedViolations`, `rulesAdded`; `summaryOnly` and `maxResults` as in the investigation tools
|
|
208
|
+
- First run writes the baseline; a snapshot with other `rules` or patterns is reported as `scope-mismatch` and kept unless `updateSnapshot: true`; `updateSnapshot: false` compares without writing
|
|
209
|
+
|
|
168
210
|
#### analyze-core-to-shared
|
|
169
211
|
|
|
170
212
|
Detects when the core layer imports from the shared layer (architectural anti-pattern) with reverse dependency impact assessment.
|
|
@@ -191,7 +233,7 @@ Manually collect transformation feedback for AI learning with privacy-first desi
|
|
|
191
233
|
|
|
192
234
|
Key features:
|
|
193
235
|
- Privacy-first: hashed file paths, no code snippets, bucketed metrics
|
|
194
|
-
-
|
|
236
|
+
- Stored in `<projectRoot>/.claude-feedback`; a second, platform-wide store only when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set
|
|
195
237
|
- Automated validation (6 checks) and quality scoring
|
|
196
238
|
- Outlier detection (4 types) for anomaly handling
|
|
197
239
|
- Learning extraction from transformation outcomes
|
|
@@ -219,6 +261,8 @@ Usage:
|
|
|
219
261
|
}
|
|
220
262
|
```
|
|
221
263
|
|
|
264
|
+
Storage: feedback always goes to `<projectRoot>/.claude-feedback/sessions/`. `both` (default) adds the platform store only when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set; `platform` requires that variable and fails without it. The server never derives a platform location from its own install path (installed from npm that would be the workspace root or a `node_modules` / npx cache).
|
|
265
|
+
|
|
222
266
|
Returns:
|
|
223
267
|
- `feedbackId`: unique identifier for this feedback
|
|
224
268
|
- `sessionId`: session this feedback belongs to
|
|
@@ -254,7 +298,7 @@ Returns `kind`, `sessionId`, `stored`, `storageLocations` and per-record `record
|
|
|
254
298
|
Review collected feedback and extract actionable insights for AI learning.
|
|
255
299
|
|
|
256
300
|
Key features:
|
|
257
|
-
- Reads
|
|
301
|
+
- Reads `<projectRoot>/.claude-feedback`, plus the platform store when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set (`sourcesRead` lists the folders)
|
|
258
302
|
- Pattern detection: success patterns (>=3 occurrences, >=80% success rate)
|
|
259
303
|
- Failure patterns (>=2 occurrences) for early warning
|
|
260
304
|
- Quality trend analysis (improved/degraded/unchanged)
|
|
@@ -331,23 +375,31 @@ Example suggestion:
|
|
|
331
375
|
|
|
332
376
|
| Tool | Purpose | Cache | Time |
|
|
333
377
|
|-|-|-|-|
|
|
334
|
-
| plan-migration | Style-aware strategy generation |
|
|
378
|
+
| plan-migration | Style-aware strategy generation; scan-based roadmap from file-level violations | ProjectCache | 1-3s |
|
|
379
|
+
| orchestrate-migration | Multi-step workflows with dependency management and checkpoint/resume | no | varies |
|
|
335
380
|
|
|
336
381
|
#### plan-migration
|
|
337
382
|
|
|
338
383
|
Generates comprehensive migration strategies based on violations, architecture, and codebase style.
|
|
339
384
|
|
|
340
385
|
Key features:
|
|
386
|
+
- Scan-based roadmap: with `projectRoot` and violations that carry `filePath` (inline or via `scanResultFile`, a
|
|
387
|
+
saved scan-architecture result) the phases list concrete files, grouped per file and layer, ordered dependencies
|
|
388
|
+
first along the import graph plus template edges (a host after the components, directives and pipes its
|
|
389
|
+
template uses), import cycles kept together (`planSource: "scan"`, details in `scanPlan`;
|
|
390
|
+
`maxPhases`, `summaryOnly`, `maxResults` caps files per phase and violations per file, default 25)
|
|
341
391
|
- Style-aware risk assessment
|
|
342
392
|
- Team context integration (velocity, experience, availability)
|
|
343
|
-
- Multi-phase roadmap generation
|
|
393
|
+
- Multi-phase roadmap generation (strategy templates when no file paths are given, `planSource: "template"`)
|
|
344
394
|
- Identifies style-conflicting steps
|
|
395
|
+
- `summary` names strategy, roadmap and scan plan as text; the scan-based plan adds `warnings` when library imports do not resolve
|
|
396
|
+
- `scanResultFile` also accepts a saved MCP result (`structuredContent` of scan-architecture or scan-all)
|
|
345
397
|
|
|
346
398
|
### Transformation Tools
|
|
347
399
|
|
|
348
400
|
| Tool | Purpose | Cache | Time |
|
|
349
401
|
|-|-|-|-|
|
|
350
|
-
| transform-code |
|
|
402
|
+
| transform-code | 26 transformation types | no | varies |
|
|
351
403
|
| run-schematic | Angular schematic execution | no | varies |
|
|
352
404
|
| run-angular-cli | CLI command execution | no | varies |
|
|
353
405
|
| run-build | Multi-build system support | no | varies |
|
|
@@ -356,7 +408,7 @@ Key features:
|
|
|
356
408
|
|
|
357
409
|
Applies surgical code transformations with pre-validation, backup, build validation, and automatic rollback.
|
|
358
410
|
|
|
359
|
-
|
|
411
|
+
26 transformation types:
|
|
360
412
|
1. constructor-to-inject
|
|
361
413
|
2. interface-extraction
|
|
362
414
|
3. standalone-migration
|
|
@@ -376,23 +428,34 @@ Applies surgical code transformations with pre-validation, backup, build validat
|
|
|
376
428
|
17. subscription-transform
|
|
377
429
|
18. missing-output-transform
|
|
378
430
|
19. library-extraction
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
-
|
|
383
|
-
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
-
|
|
431
|
+
20. service-bag-transform
|
|
432
|
+
21. any-to-interface
|
|
433
|
+
22. dto-object-literal
|
|
434
|
+
23. interface-duplication
|
|
435
|
+
24. static-class-to-functions
|
|
436
|
+
25. extract-static-from-stateful
|
|
437
|
+
26. type-safety
|
|
438
|
+
|
|
439
|
+
plugin-angular transform rules run only for the requested type: transform-code passes `transformationType` and the call's `options` under the `'@angular-modernizer/plugin-angular'` config key.
|
|
440
|
+
|
|
441
|
+
Safety features (single file, batch and streaming alike):
|
|
442
|
+
- Pre-transformation validation (syntax, types, schema) on the same kernel load as the transformation
|
|
443
|
+
- Backup in `<projectRoot>/.angular-modernizer-backups` (`backupDir` overrides): a copy per file with a metadata file next to it, plus a git snapshot (`git stash create`, working tree and stash list untouched) inside a git repository (`backup.gitSnapshot`)
|
|
444
|
+
- Type check of the transformed file: only errors the transformation introduced count (`validation.introducedTypeErrors`)
|
|
445
|
+
- Build validation (`validateBuild`), project lint only on request (`validateLint`)
|
|
446
|
+
- Automatic rollback when validation fails (`autoRollback`)
|
|
447
|
+
- Batch mode backs up all files first and applies `rollbackStrategy` (`all-or-nothing`, `selective`, `none`)
|
|
448
|
+
- `rollback-changes` restores the same backups later (`strategy`: `auto`, `file-backup`, `git-stash`)
|
|
449
|
+
|
|
450
|
+
Validation parameters:
|
|
451
|
+
- `validateBuild: boolean` - run the project build after transformation (default: false; the transformed file is type-checked either way); `buildValidation` is reported only when it ran
|
|
452
|
+
- `validateLint: boolean` - run the project's lint script (default: false; it lints the whole project)
|
|
391
453
|
- `buildTimeout: number` - build timeout in ms (default: 300000 = 5 min)
|
|
392
|
-
- `projectRoot: string` - project root for build execution
|
|
454
|
+
- `projectRoot: string` - project root for backups and build execution
|
|
393
455
|
|
|
394
|
-
|
|
395
|
-
|
|
456
|
+
Build validation (`validateBuild`) runs `build.command` of `.angular-modernizer.json`, else the detected build system (`npx ng build`, `npx nx build`, `npx vite build`), else the `build` script of `package.json`; without one the build is skipped with a warning. A cancelled call restores the backup (see Progress and Cancellation).
|
|
457
|
+
|
|
458
|
+
Streaming (deprecated): `streaming` defaults to `false`. With `streaming: true` the call returns an `operationId` at once, runs the same path in the background and `get-operation-progress` returns the result. `diffFormat` has no effect.
|
|
396
459
|
- `unified`: traditional git-style diff (human-readable, backward compatible)
|
|
397
460
|
- `structured`: machine-first JSON diff with semantic annotations (AI-optimized)
|
|
398
461
|
- `both`: include both formats (useful for debugging, higher overhead)
|
|
@@ -413,40 +476,74 @@ Supported build systems: Angular CLI, Nx, Vite, Webpack, npm
|
|
|
413
476
|
| validate-before-transform | Pre-transformation checks | no | 1-2s |
|
|
414
477
|
| validate-transformation | Post-transformation checks | no | 30-300s |
|
|
415
478
|
| rollback-changes | Revert transformations | no | <1s |
|
|
479
|
+
| check-incremental-compatibility | Whether a project supports incremental build validation | no | varies |
|
|
480
|
+
| validate-project-compatibility | Parser compatibility before transformations | no | varies |
|
|
481
|
+
| analyze-build-impact | Changed files -> value, type-only and template dependents, affected modules, strategy | ProjectCache | ~1s warm |
|
|
482
|
+
| get-operation-progress | Deprecated: progress and result of a streaming operation | no | <1s |
|
|
483
|
+
|
|
484
|
+
#### analyze-build-impact
|
|
485
|
+
|
|
486
|
+
`filesToChange` is the changed set. Dependents are split into value dependents (JS rebuild), type-only dependents
|
|
487
|
+
(type-check only) and template dependents: host components that use a changed component, directive or pipe only in
|
|
488
|
+
their template (NgModule declarations), listed with the used classes in `templateHosts`. Barrels only forward the
|
|
489
|
+
names they re-export; past the first importer only exports whose type surface (annotations, inferred types, heritage,
|
|
490
|
+
`@NgModule` exports) names a changed binding propagate, so using a class inside a method body or a decorator stops
|
|
491
|
+
there. `symbols` narrows the impact to consumers of given exports (`symbolImpacts`). `.html` files map
|
|
492
|
+
to their component (`mappedFiles`), which counts as changed without its dependents. `summaryOnly` / `maxResults`
|
|
493
|
+
shorten the lists; `counts` always describe the full result. `summary` repeats the recommendation and the counts as
|
|
494
|
+
text; `warnings` reports library imports that do not resolve, dependents can then be missing.
|
|
495
|
+
|
|
496
|
+
### Bug Investigation Tools
|
|
497
|
+
|
|
498
|
+
Read-only tools over the shared ProjectCache: a workspace is parsed once per server and re-read per changed file.
|
|
499
|
+
All list-heavy tools take `summaryOnly` and `maxResults`. All answer with `structuredContent` and a `summary` string.
|
|
500
|
+
When packages declared in the project's `package.json` do not resolve (no or incomplete `node_modules`), the tools that
|
|
501
|
+
load the program add `warnings` with the number of unresolved library imports: library types are then `any` and hosts,
|
|
502
|
+
callers and handlers can be missing from the result. The check runs once per loaded project (about 50 ms on 4000 files).
|
|
503
|
+
|
|
504
|
+
| Tool | Answers |
|
|
505
|
+
|-|-|
|
|
506
|
+
| parse-stack-trace | Structured frames from Node.js / Angular / Zone.js / browser stacks, browser URLs and bare file names mapped onto project files |
|
|
507
|
+
| find-usages | Every reference to a symbol, classified (declaration, read, write, call, template, unresolved) |
|
|
508
|
+
| get-call-graph | Callers and callees of a method or function, incl. template callers (own and inheriting subclass templates); `maxNodes` caps the tree |
|
|
509
|
+
| resolve-type | TypeScript type at file:line:col (nullable, async, generics, declaration) |
|
|
510
|
+
| find-angular-symbol | Components, directives, pipes, services, ... by selector, pipe name or class, incl. library classes from `.d.ts` |
|
|
511
|
+
| search-codebase | Text, regex or declaration search, incl. `.html` and files outside the program |
|
|
512
|
+
| list-imports | Imports and re-exports of a file with resolved targets (aliases, barrels); `counts` per kind |
|
|
513
|
+
| inspect-template | Template structure: elements, bindings, matched components/directives/pipes, control flow, i18n keys |
|
|
514
|
+
| find-component-hosts | Every template host of a component or directive with bound, unbound and missing required inputs/outputs; components created in code (dialogs, `createComponent`, routes) |
|
|
515
|
+
| trace-output-flow | Payload of an `@Output` across the template boundary and into subscriptions in code (`ref.instance.x.subscribe`), and dialog data in / results out |
|
|
516
|
+
| get-bootstrap-execution | What runs at startup (initializers, bootstrap, interceptors, provider factories) and where a watched expression is touched |
|
|
517
|
+
| inspect-form-group | Reactive Forms structure and every enable/disable/validator change per control |
|
|
518
|
+
| inspect-i18n | Translation keys: definitions per language and overlay, usages in templates and code, missing and undefined keys |
|
|
519
|
+
| verify-citations | Whether the `path:line` citations of Markdown plans still point at the named code: ok, unverified, moved (new lines), anchor-missing, out-of-range, missing-file (similar files), ambiguous |
|
|
520
|
+
|
|
521
|
+
### Server
|
|
522
|
+
|
|
523
|
+
| Tool | Purpose |
|
|
524
|
+
|-|-|
|
|
525
|
+
| server-status | server version, pid, uptime, memory, cached projects, response sizes, and whether the dist was rebuilt since start |
|
|
416
526
|
|
|
417
527
|
---
|
|
418
528
|
|
|
419
529
|
## Advanced Features
|
|
420
530
|
|
|
421
|
-
###
|
|
422
|
-
|
|
423
|
-
`scan-all` reads from individual plugin caches written by `scan-architecture`, `scan-solid`, and `scan-angular`. When those tools have run first, `scan-all` avoids re-analyzing files it already has results for.
|
|
531
|
+
### scan-all Cache
|
|
424
532
|
|
|
425
|
-
|
|
533
|
+
`scan-all` reads and writes only its own cache, `.angular-modernizer-cache/all/`. It does not read the caches written by `scan-architecture`, `scan-solid` and `scan-angular`. An earlier version did ("cross-cache reading"), but it opened them with its own cache version `scan-all-2`, so their entries never matched and were invalidated (deleted) on every scan-all run; a hit would also have returned only one plugin's findings. The individual scans keep writing and reading their own caches.
|
|
426
534
|
|
|
427
|
-
|
|
428
|
-
Workflow: scan-architecture -> scan-solid -> scan-angular -> scan-all
|
|
429
|
-
|
|
430
|
-
Without cross-cache: scan-all analyzes all 450 files
|
|
431
|
-
With cross-cache: scan-all reads cached results (up to 57% reduction)
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
Cache statistics example:
|
|
535
|
+
Cache statistics example (second run, nothing changed):
|
|
435
536
|
|
|
436
537
|
```json
|
|
437
538
|
{
|
|
438
|
-
"hitRate":
|
|
539
|
+
"hitRate": 100,
|
|
439
540
|
"hitsBySource": {
|
|
440
|
-
"
|
|
441
|
-
"solid": 150,
|
|
442
|
-
"angular": 150
|
|
541
|
+
"all": 450
|
|
443
542
|
}
|
|
444
543
|
}
|
|
445
544
|
```
|
|
446
545
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
Best practice: run individual scans first, then `scan-all` for maximum cache benefit.
|
|
546
|
+
`hitRate` and `hitsBySource` refer to the own cache (`all`) only. `hitRate` is a percentage. The first run has 0%; later runs analyze only changed files.
|
|
450
547
|
|
|
451
548
|
### Intelligent Mode Selection
|
|
452
549
|
|
|
@@ -559,6 +656,7 @@ Cache locations:
|
|
|
559
656
|
- `architecture`: `.angular-modernizer-cache/architecture/`
|
|
560
657
|
- `solid`: `.angular-modernizer-cache/solid/`
|
|
561
658
|
- `angular`: `.angular-modernizer-cache/angular/`
|
|
659
|
+
- `all` (scan-all): `.angular-modernizer-cache/all/`
|
|
562
660
|
- `patterns`: `.angular-modernizer-cache/pattern-knowledge.json`
|
|
563
661
|
|
|
564
662
|
When to clear cache:
|
|
@@ -642,16 +740,16 @@ Weekly: Full scan + pattern evolution check
|
|
|
642
740
|
|
|
643
741
|
### Cache Optimization
|
|
644
742
|
|
|
645
|
-
|
|
743
|
+
Each scan tool keeps its own cache, so repeated runs of the same tool are fast. `scan-all` does not reuse the individual caches; run either the individual scans or `scan-all`, not both, for a full picture:
|
|
646
744
|
|
|
647
745
|
```bash
|
|
648
|
-
#
|
|
746
|
+
# Individual scans (write plugin-specific caches)
|
|
649
747
|
scan-architecture # Writes: .cache/architecture/
|
|
650
748
|
scan-solid # Writes: .cache/solid/
|
|
651
749
|
scan-angular # Writes: .cache/angular/
|
|
652
750
|
|
|
653
|
-
#
|
|
654
|
-
scan-all #
|
|
751
|
+
# Combined scan: own cache only, does not read the caches above
|
|
752
|
+
scan-all # Writes and reads: .cache/all/
|
|
655
753
|
```
|
|
656
754
|
|
|
657
755
|
Second run performance:
|
|
@@ -683,168 +781,23 @@ Batch transformations:
|
|
|
683
781
|
|
|
684
782
|
---
|
|
685
783
|
|
|
686
|
-
##
|
|
687
|
-
|
|
688
|
-
The streaming progress feature provides real-time feedback during long-running transformations through a polling-based architecture. AI assistants can monitor progress, display diffs, and detect errors as they occur.
|
|
689
|
-
|
|
690
|
-
Key capabilities:
|
|
691
|
-
- Real-time progress (percentage, phase, and ETA updates)
|
|
692
|
-
- Unified diffs (git-style diffs for every file transformation)
|
|
693
|
-
- Syntax validation (lightweight error detection without compilation)
|
|
694
|
-
- Memory tracking (continuous heap usage monitoring)
|
|
695
|
-
- Incremental polling (fetch only new events since last poll)
|
|
696
|
-
- Zero overhead (only active when explicitly used)
|
|
784
|
+
## Progress and Cancellation
|
|
697
785
|
|
|
698
|
-
|
|
786
|
+
Long-running tools report progress through MCP `notifications/progress` when the request carries `_meta.progressToken`, and stop when the client sends `notifications/cancelled` (Esc in Claude Code). Without a token no progress notification is sent. Notifications are throttled: the first and the last value, at most one per 250 ms.
|
|
699
787
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
Polling pattern:
|
|
709
|
-
1. Start transformation, receive `operationId`
|
|
710
|
-
2. Poll `get-operation-progress` with `operationId`
|
|
711
|
-
3. Display progress, diffs, errors to user
|
|
712
|
-
4. Continue polling until `status: 'completed'`
|
|
713
|
-
|
|
714
|
-
### Quick Start
|
|
715
|
-
|
|
716
|
-
Start a streaming operation:
|
|
717
|
-
|
|
718
|
-
```typescript
|
|
719
|
-
{
|
|
720
|
-
"tool": "transform-code-batch",
|
|
721
|
-
"arguments": {
|
|
722
|
-
"rules": ["standalone-migration"],
|
|
723
|
-
"patterns": ["src/**/*.component.ts"]
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
// Response
|
|
728
|
-
{
|
|
729
|
-
"operationId": "transform-20251209-123456-abc",
|
|
730
|
-
"status": "running",
|
|
731
|
-
"message": "Transformation started in background"
|
|
732
|
-
}
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
Poll for progress:
|
|
736
|
-
|
|
737
|
-
```typescript
|
|
738
|
-
{
|
|
739
|
-
"tool": "get-operation-progress",
|
|
740
|
-
"arguments": {
|
|
741
|
-
"operationId": "transform-20251209-123456-abc"
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
// Response
|
|
746
|
-
{
|
|
747
|
-
"operationId": "transform-20251209-123456-abc",
|
|
748
|
-
"status": "running",
|
|
749
|
-
"events": [
|
|
750
|
-
{
|
|
751
|
-
"phase": "transforming",
|
|
752
|
-
"percentage": 50,
|
|
753
|
-
"message": "Transforming home.component.ts",
|
|
754
|
-
"timestamp": 1733750401000,
|
|
755
|
-
"diff": {
|
|
756
|
-
"filePath": "src/app/home/home.component.ts",
|
|
757
|
-
"diff": "--- src/app/home/home.component.ts\n+++ ...",
|
|
758
|
-
"linesAdded": 4,
|
|
759
|
-
"linesRemoved": 1
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
],
|
|
763
|
-
"totalEvents": 5,
|
|
764
|
-
"elapsedTime": 2500,
|
|
765
|
-
"eta": 2500
|
|
766
|
-
}
|
|
767
|
-
```
|
|
768
|
-
|
|
769
|
-
Incremental polling (recommended):
|
|
770
|
-
|
|
771
|
-
```typescript
|
|
772
|
-
// First poll: get all events
|
|
773
|
-
const poll1 = await getProgress({ operationId });
|
|
774
|
-
|
|
775
|
-
// Subsequent polls: get only new events
|
|
776
|
-
const poll2 = await getProgress({
|
|
777
|
-
operationId,
|
|
778
|
-
sinceTimestamp: poll1.events[poll1.events.length - 1].timestamp,
|
|
779
|
-
});
|
|
780
|
-
```
|
|
781
|
-
|
|
782
|
-
### Event Structure
|
|
783
|
-
|
|
784
|
-
```typescript
|
|
785
|
-
interface StreamingProgressEvent {
|
|
786
|
-
phase: 'analyzing' | 'transforming' | 'validating' | 'building' | 'complete';
|
|
787
|
-
percentage: number; // 0-100
|
|
788
|
-
message: string;
|
|
789
|
-
timestamp: number; // Unix timestamp (ms)
|
|
790
|
-
|
|
791
|
-
currentFile?: string;
|
|
792
|
-
|
|
793
|
-
diff?: {
|
|
794
|
-
filePath: string;
|
|
795
|
-
diff: string; // Unified diff
|
|
796
|
-
linesAdded: number;
|
|
797
|
-
linesRemoved: number;
|
|
798
|
-
};
|
|
799
|
-
|
|
800
|
-
syntaxErrors?: Array<{
|
|
801
|
-
filePath: string;
|
|
802
|
-
line: number;
|
|
803
|
-
message: string;
|
|
804
|
-
}>;
|
|
805
|
-
|
|
806
|
-
memoryUsage?: {
|
|
807
|
-
heapUsed: number;
|
|
808
|
-
heapTotal: number;
|
|
809
|
-
percentage: number; // 0-100
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
```
|
|
813
|
-
|
|
814
|
-
### Progress Phases
|
|
788
|
+
| Tool | Progress | On cancel |
|
|
789
|
+
|-|-|-|
|
|
790
|
+
| scan-architecture, scan-all, scan-solid, scan-angular, analyze-project | files (`n/N files, v violations`); worker paths of analyze-project forward the kernel progress, batched scan-architecture reports per batch | stops between files |
|
|
791
|
+
| compare-health | through scan-all | no comparison, snapshot not written |
|
|
792
|
+
| transform-code | single file: 3 steps (loaded, transformed, validated); batch: files | restores the backup (also with `autoRollback: false`); a batch restores every file |
|
|
793
|
+
| run-build, run-angular-cli, run-schematic, validate-transformation | none | ends the build with its process tree (SIGTERM, SIGKILL after 5 s) |
|
|
794
|
+
| orchestrate-migration | steps | passes the cancel to the running step, runs no further step |
|
|
815
795
|
|
|
816
|
-
|
|
817
|
-
analyzing (0-10%) : Project setup, file discovery
|
|
818
|
-
transforming (10-90%) : Per-file AST transformation
|
|
819
|
-
validating (90-95%) : Syntax validation
|
|
820
|
-
building (95-98%) : Optional compilation check
|
|
821
|
-
complete (100%) : Final summary
|
|
822
|
-
```
|
|
796
|
+
A cancelled request gets no response (MCP spec). Scans also stop while they add their files to the project (checked per file). Only the kernel's own project load (`kernel.initialize()`) and transform-code's load of its file cannot be interrupted; the cancel takes effect right after them. Direct callers of a scan get the analyzed part with `execution.stopReason: 'cancelled'`.
|
|
823
797
|
|
|
824
|
-
###
|
|
798
|
+
### Streaming (deprecated)
|
|
825
799
|
|
|
826
|
-
|
|
827
|
-
|-|-|-|
|
|
828
|
-
| No streaming | 0% | Automation, CI/CD |
|
|
829
|
-
| Minimal streaming | ~2-3% | Progress tracking only |
|
|
830
|
-
| Full streaming | ~8-16% | AI assistants (diffs + validation) |
|
|
831
|
-
|
|
832
|
-
Overhead breakdown:
|
|
833
|
-
- Event generation: ~2-3%
|
|
834
|
-
- Diff generation: ~5-10% (only modified files)
|
|
835
|
-
- Syntax detection: ~1-2%
|
|
836
|
-
- Memory tracking: <1%
|
|
837
|
-
|
|
838
|
-
When to use streaming:
|
|
839
|
-
- Long-running operations (>10 seconds)
|
|
840
|
-
- Large projects (>100 files)
|
|
841
|
-
- AI assistants requiring feedback
|
|
842
|
-
- User needs diff visibility
|
|
843
|
-
|
|
844
|
-
When to use batch (non-streaming):
|
|
845
|
-
- Short operations (<10 seconds)
|
|
846
|
-
- Automation/CI/CD
|
|
847
|
-
- Performance-critical scenarios
|
|
800
|
+
`streaming: true` (transform-code, scan-architecture) and `get-operation-progress` stay in 1.x but are deprecated; `streaming` defaults to `false`. With `streaming: true` the call returns an `operationId` at once and runs in the background: transform-code runs its regular path (same backup, validation and rollback) and emits no events, scan-architecture emits phase events (0, 10, 20, 30 %, every 10 files up to 90 %, 100 % on completion). `get-operation-progress` returns `status`, the events and, once completed, the tool result in `result`. Operations expire 5 minutes after they end (10 minutes when stuck running). There is no way to cancel a streaming operation over MCP; call the tools synchronously instead.
|
|
848
801
|
|
|
849
802
|
---
|
|
850
803
|
|
|
@@ -862,10 +815,10 @@ Solutions:
|
|
|
862
815
|
|
|
863
816
|
### "Cache hit rate 0% - is cache working?"
|
|
864
817
|
|
|
865
|
-
Yes, this is normal for the first run
|
|
818
|
+
Yes, this is normal for the first run.
|
|
866
819
|
|
|
867
|
-
- `hitRate: 0%` means the
|
|
868
|
-
- `
|
|
820
|
+
- `hitRate: 0%` means the tool's own cache is empty (for `scan-all`: `.angular-modernizer-cache/all/`)
|
|
821
|
+
- `scan-all` does not read the caches of the individual scans, so running them first does not raise its hit rate
|
|
869
822
|
- The second run will have `hitRate > 0%`
|
|
870
823
|
|
|
871
824
|
### "Worker threads not available (offline mode)"
|