@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
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Server Status Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool that reports on the running server itself: memory, uptime, the
|
|
5
|
+
* negotiated protocol era and revision, the ts-morph projects held in the
|
|
6
|
+
* shared cache, response sizes, and whether the build on disk changed after
|
|
7
|
+
* the server started.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* A session keeps the code it started with; after `pnpm run build` it serves
|
|
11
|
+
* stale tools until the client reconnects. `build.rebuiltSinceStart` makes
|
|
12
|
+
* that visible from inside the session. The check compares the newest `.js`
|
|
13
|
+
* mtime per package `dist/` at start and at call time; it walks the
|
|
14
|
+
* directories on every call (a few hundred files, milliseconds).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Via MCP:
|
|
19
|
+
* // tool: server-status
|
|
20
|
+
* // args: {}
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
24
|
+
import { join } from 'node:path';
|
|
25
|
+
import { getHeapStatistics } from 'node:v8';
|
|
26
|
+
import { PACKAGE_VERSION } from '../server/package-version.js';
|
|
27
|
+
import { toMB, } from './helpers/project-cache.js';
|
|
28
|
+
const BYTES_PER_MB = 1024 * 1024;
|
|
29
|
+
/** One response in the response statistics. */
|
|
30
|
+
const RESPONSE_RECORD_SCHEMA = {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
id: { description: 'JSON-RPC request id (string, number or null).' },
|
|
34
|
+
tool: { type: 'string' },
|
|
35
|
+
bytes: {
|
|
36
|
+
description: 'Serialized size in bytes; not a finite number when the response could not be serialized.',
|
|
37
|
+
},
|
|
38
|
+
replaced: { type: 'boolean' },
|
|
39
|
+
at: { type: 'string' },
|
|
40
|
+
},
|
|
41
|
+
required: ['bytes', 'replaced', 'at'],
|
|
42
|
+
};
|
|
43
|
+
/** Heap or RSS before and after an eviction. */
|
|
44
|
+
const BEFORE_AFTER_SCHEMA = {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: { before: { type: 'number' }, after: { type: 'number' } },
|
|
47
|
+
required: ['before', 'after'],
|
|
48
|
+
};
|
|
49
|
+
function formatBytes(bytes) {
|
|
50
|
+
if (!Number.isFinite(bytes)) {
|
|
51
|
+
return 'too large to serialize';
|
|
52
|
+
}
|
|
53
|
+
return bytes < BYTES_PER_MB
|
|
54
|
+
? `${(bytes / 1024).toFixed(1)} KB`
|
|
55
|
+
: `${toMB(bytes)} MB`;
|
|
56
|
+
}
|
|
57
|
+
/** Newest `.js` mtime under `dir` in ms, or undefined when there is none. */
|
|
58
|
+
function newestJsMtime(dir) {
|
|
59
|
+
let newest;
|
|
60
|
+
const stack = [dir];
|
|
61
|
+
while (stack.length > 0) {
|
|
62
|
+
const current = stack.pop();
|
|
63
|
+
if (current === undefined) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
let entries;
|
|
67
|
+
try {
|
|
68
|
+
entries = readdirSync(current, { withFileTypes: true });
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
for (const entry of entries) {
|
|
74
|
+
const full = join(current, entry.name);
|
|
75
|
+
if (entry.isDirectory()) {
|
|
76
|
+
stack.push(full);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (entry.name.endsWith('.js')) {
|
|
80
|
+
const mtime = statSync(full).mtimeMs;
|
|
81
|
+
newest = newest === undefined ? mtime : Math.max(newest, mtime);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return newest;
|
|
86
|
+
}
|
|
87
|
+
function iso(ms) {
|
|
88
|
+
return ms === undefined ? undefined : new Date(ms).toISOString();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* MCP tool that reports server process, cache and build state.
|
|
92
|
+
*/
|
|
93
|
+
export class ServerStatusTool {
|
|
94
|
+
projects;
|
|
95
|
+
runtime;
|
|
96
|
+
distDirectories;
|
|
97
|
+
name = 'server-status';
|
|
98
|
+
title = 'Server Status';
|
|
99
|
+
annotations = {
|
|
100
|
+
readOnlyHint: true,
|
|
101
|
+
destructiveHint: false,
|
|
102
|
+
idempotentHint: true,
|
|
103
|
+
openWorldHint: false,
|
|
104
|
+
};
|
|
105
|
+
description = 'Report on the running MCP server itself: pid, parent pid, uptime, memory (RSS, heap), the ' +
|
|
106
|
+
'ts-morph projects in the shared cache (tsconfig path, source file count, heap taken at load, ' +
|
|
107
|
+
'load and last-use time, source files re-read after a change on disk), the cache limits (projects, heap MB) and evictions (count, last one ' +
|
|
108
|
+
'with reason and heap/RSS before and after), response sizes (count, last, largest, oversized responses replaced by an error), and ' +
|
|
109
|
+
'whether a package dist/ was rebuilt after the server started. When build.rebuiltSinceStart ' +
|
|
110
|
+
'is true this session still runs the old code: reconnect the MCP server to load the new build. ' +
|
|
111
|
+
'Use it when results look stale, before measuring response sizes, or when memory grows.';
|
|
112
|
+
inputSchema = {
|
|
113
|
+
type: 'object',
|
|
114
|
+
additionalProperties: false,
|
|
115
|
+
properties: {},
|
|
116
|
+
};
|
|
117
|
+
outputSchema = {
|
|
118
|
+
type: 'object',
|
|
119
|
+
properties: {
|
|
120
|
+
process: {
|
|
121
|
+
type: 'object',
|
|
122
|
+
properties: {
|
|
123
|
+
pid: { type: 'integer' },
|
|
124
|
+
ppid: { type: 'integer' },
|
|
125
|
+
nodeVersion: { type: 'string' },
|
|
126
|
+
platform: { type: 'string' },
|
|
127
|
+
cwd: { type: 'string' },
|
|
128
|
+
uptimeSec: { type: 'number' },
|
|
129
|
+
memoryMB: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
properties: {
|
|
132
|
+
rss: { type: 'number' },
|
|
133
|
+
heapUsed: { type: 'number' },
|
|
134
|
+
heapTotal: { type: 'number' },
|
|
135
|
+
external: { type: 'number' },
|
|
136
|
+
heapLimit: { type: 'number' },
|
|
137
|
+
},
|
|
138
|
+
required: ['rss', 'heapUsed', 'heapTotal', 'external', 'heapLimit'],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: [
|
|
142
|
+
'pid',
|
|
143
|
+
'ppid',
|
|
144
|
+
'nodeVersion',
|
|
145
|
+
'platform',
|
|
146
|
+
'cwd',
|
|
147
|
+
'uptimeSec',
|
|
148
|
+
'memoryMB',
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
server: {
|
|
152
|
+
type: 'object',
|
|
153
|
+
properties: {
|
|
154
|
+
version: { type: 'string' },
|
|
155
|
+
startedAt: { type: 'string' },
|
|
156
|
+
toolCount: { type: 'integer' },
|
|
157
|
+
responses: {
|
|
158
|
+
type: 'object',
|
|
159
|
+
properties: {
|
|
160
|
+
count: { type: 'integer' },
|
|
161
|
+
totalBytes: { type: 'number' },
|
|
162
|
+
oversized: { type: 'integer' },
|
|
163
|
+
last: RESPONSE_RECORD_SCHEMA,
|
|
164
|
+
largest: RESPONSE_RECORD_SCHEMA,
|
|
165
|
+
},
|
|
166
|
+
required: ['count', 'totalBytes', 'oversized'],
|
|
167
|
+
},
|
|
168
|
+
protocol: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
era: { type: 'string' },
|
|
172
|
+
version: { type: 'string' },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
required: [
|
|
177
|
+
'version',
|
|
178
|
+
'startedAt',
|
|
179
|
+
'toolCount',
|
|
180
|
+
'responses',
|
|
181
|
+
'protocol',
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
projects: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
cached: { type: 'integer' },
|
|
188
|
+
capacity: { type: 'integer' },
|
|
189
|
+
maxHeapMB: { type: 'number' },
|
|
190
|
+
entries: {
|
|
191
|
+
type: 'array',
|
|
192
|
+
items: {
|
|
193
|
+
type: 'object',
|
|
194
|
+
properties: {
|
|
195
|
+
tsConfigPath: { type: 'string' },
|
|
196
|
+
sourceFiles: { type: 'integer' },
|
|
197
|
+
loadedAt: { type: 'string' },
|
|
198
|
+
lastUsedAt: { type: 'string' },
|
|
199
|
+
loadHeapMB: { type: 'number' },
|
|
200
|
+
refreshedFiles: { type: 'integer' },
|
|
201
|
+
lastRefreshAt: { type: 'string' },
|
|
202
|
+
},
|
|
203
|
+
required: [
|
|
204
|
+
'tsConfigPath',
|
|
205
|
+
'sourceFiles',
|
|
206
|
+
'loadedAt',
|
|
207
|
+
'lastUsedAt',
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
evictions: {
|
|
212
|
+
type: 'object',
|
|
213
|
+
properties: {
|
|
214
|
+
count: { type: 'integer' },
|
|
215
|
+
last: {
|
|
216
|
+
type: 'object',
|
|
217
|
+
properties: {
|
|
218
|
+
tsConfigPath: { type: 'string' },
|
|
219
|
+
reason: { type: 'string', enum: ['max-entries', 'max-heap'] },
|
|
220
|
+
at: { type: 'string' },
|
|
221
|
+
sourceFiles: { type: 'integer' },
|
|
222
|
+
heapMB: BEFORE_AFTER_SCHEMA,
|
|
223
|
+
rssMB: BEFORE_AFTER_SCHEMA,
|
|
224
|
+
},
|
|
225
|
+
required: ['tsConfigPath', 'reason', 'at'],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
required: ['count'],
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
required: ['cached', 'capacity', 'maxHeapMB', 'entries', 'evictions'],
|
|
232
|
+
},
|
|
233
|
+
build: {
|
|
234
|
+
type: 'object',
|
|
235
|
+
properties: {
|
|
236
|
+
rebuiltSinceStart: { type: 'boolean' },
|
|
237
|
+
packages: {
|
|
238
|
+
type: 'array',
|
|
239
|
+
items: {
|
|
240
|
+
type: 'object',
|
|
241
|
+
properties: {
|
|
242
|
+
name: { type: 'string' },
|
|
243
|
+
dir: { type: 'string' },
|
|
244
|
+
builtAtStart: { type: 'string' },
|
|
245
|
+
builtNow: { type: 'string' },
|
|
246
|
+
rebuilt: { type: 'boolean' },
|
|
247
|
+
},
|
|
248
|
+
required: ['name', 'dir', 'rebuilt'],
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
required: ['rebuiltSinceStart', 'packages'],
|
|
253
|
+
},
|
|
254
|
+
summary: { type: 'string' },
|
|
255
|
+
},
|
|
256
|
+
required: ['process', 'server', 'projects', 'build', 'summary'],
|
|
257
|
+
};
|
|
258
|
+
baseline;
|
|
259
|
+
/**
|
|
260
|
+
* @param projects - The project cache shared by the investigation tools.
|
|
261
|
+
* @param runtime - Server start time, tool count, response sizes and protocol.
|
|
262
|
+
* @param distDirectories - Package `dist/` directories to watch; missing ones are skipped.
|
|
263
|
+
*/
|
|
264
|
+
constructor(projects, runtime, distDirectories = []) {
|
|
265
|
+
this.projects = projects;
|
|
266
|
+
this.runtime = runtime;
|
|
267
|
+
this.distDirectories = distDirectories;
|
|
268
|
+
this.baseline = new Map(distDirectories
|
|
269
|
+
.filter((d) => existsSync(d.dir))
|
|
270
|
+
.map((d) => [d.dir, newestJsMtime(d.dir)]));
|
|
271
|
+
}
|
|
272
|
+
async execute(_args) {
|
|
273
|
+
const memory = process.memoryUsage();
|
|
274
|
+
const packages = this.distDirectories
|
|
275
|
+
.filter((d) => this.baseline.has(d.dir))
|
|
276
|
+
.map((d) => {
|
|
277
|
+
const atStart = this.baseline.get(d.dir);
|
|
278
|
+
const now = newestJsMtime(d.dir);
|
|
279
|
+
const builtAtStart = iso(atStart);
|
|
280
|
+
const builtNow = iso(now);
|
|
281
|
+
return {
|
|
282
|
+
name: d.name,
|
|
283
|
+
dir: d.dir,
|
|
284
|
+
...(builtAtStart === undefined ? {} : { builtAtStart }),
|
|
285
|
+
...(builtNow === undefined ? {} : { builtNow }),
|
|
286
|
+
rebuilt: now !== undefined && (atStart === undefined || now > atStart),
|
|
287
|
+
};
|
|
288
|
+
});
|
|
289
|
+
const result = {
|
|
290
|
+
process: {
|
|
291
|
+
pid: process.pid,
|
|
292
|
+
ppid: process.ppid,
|
|
293
|
+
nodeVersion: process.version,
|
|
294
|
+
platform: process.platform,
|
|
295
|
+
cwd: process.cwd(),
|
|
296
|
+
uptimeSec: Math.round(process.uptime()),
|
|
297
|
+
memoryMB: {
|
|
298
|
+
rss: toMB(memory.rss),
|
|
299
|
+
heapUsed: toMB(memory.heapUsed),
|
|
300
|
+
heapTotal: toMB(memory.heapTotal),
|
|
301
|
+
external: toMB(memory.external),
|
|
302
|
+
heapLimit: toMB(getHeapStatistics().heap_size_limit),
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
server: { version: PACKAGE_VERSION, ...this.runtime() },
|
|
306
|
+
projects: {
|
|
307
|
+
cached: this.projects.size,
|
|
308
|
+
capacity: this.projects.capacity,
|
|
309
|
+
maxHeapMB: this.projects.limits.maxHeapMb,
|
|
310
|
+
entries: this.projects.describe(),
|
|
311
|
+
evictions: this.projects.evictions,
|
|
312
|
+
},
|
|
313
|
+
build: {
|
|
314
|
+
rebuiltSinceStart: packages.some((p) => p.rebuilt),
|
|
315
|
+
packages,
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
return { ...result, summary: this.buildSummary(result) };
|
|
319
|
+
}
|
|
320
|
+
buildSummary(status) {
|
|
321
|
+
const { process: proc, server, projects, build } = status;
|
|
322
|
+
const lines = [
|
|
323
|
+
`angular-modernizer ${server.version}, pid ${proc.pid} (parent ${proc.ppid}), up ${proc.uptimeSec} s since ${server.startedAt}, ` +
|
|
324
|
+
`${server.toolCount} tools, Node ${proc.nodeVersion}.`,
|
|
325
|
+
server.protocol.era === undefined
|
|
326
|
+
? 'Protocol: not negotiated yet.'
|
|
327
|
+
: `Protocol: ${server.protocol.era} era, revision ${server.protocol.version ?? 'unknown'}.`,
|
|
328
|
+
`Memory: RSS ${proc.memoryMB.rss} MB, heap ${proc.memoryMB.heapUsed} of ${proc.memoryMB.heapTotal} MB ` +
|
|
329
|
+
`(V8 limit ${proc.memoryMB.heapLimit} MB).`,
|
|
330
|
+
`Projects cached: ${projects.cached} of ${projects.capacity}, heap limit ` +
|
|
331
|
+
(projects.maxHeapMB === 0 ? 'off' : `${projects.maxHeapMB} MB`) +
|
|
332
|
+
(projects.entries.length === 0
|
|
333
|
+
? '.'
|
|
334
|
+
: `: ${projects.entries.map((p) => `${p.tsConfigPath} (${p.sourceFiles} files, ~${p.loadHeapMB} MB` + (p.refreshedFiles > 0 ? `, ${p.refreshedFiles} refreshed` : '') + ')').join(', ')}.`),
|
|
335
|
+
];
|
|
336
|
+
const { evictions } = projects;
|
|
337
|
+
if (evictions.last !== undefined) {
|
|
338
|
+
const last = evictions.last;
|
|
339
|
+
lines.push(`Evictions: ${evictions.count}; last ${last.tsConfigPath} (${last.reason}) at ${last.at}, ` +
|
|
340
|
+
`heap ${last.heapMB.before} -> ${last.heapMB.after} MB, RSS ${last.rssMB.before} -> ${last.rssMB.after} MB.`);
|
|
341
|
+
}
|
|
342
|
+
const { responses } = server;
|
|
343
|
+
if (responses.count > 0) {
|
|
344
|
+
const last = responses.last;
|
|
345
|
+
const largest = responses.largest;
|
|
346
|
+
lines.push(`Responses: ${responses.count}, ${formatBytes(responses.totalBytes)} total` +
|
|
347
|
+
(last === undefined
|
|
348
|
+
? ''
|
|
349
|
+
: `; last ${formatBytes(last.bytes)}${last.tool ? ` (${last.tool})` : ''}`) +
|
|
350
|
+
(largest === undefined
|
|
351
|
+
? ''
|
|
352
|
+
: `; largest ${formatBytes(largest.bytes)}${largest.tool ? ` (${largest.tool})` : ''}`) +
|
|
353
|
+
(responses.oversized > 0
|
|
354
|
+
? `; ${responses.oversized} over the limit, replaced by an error`
|
|
355
|
+
: '') +
|
|
356
|
+
'.');
|
|
357
|
+
}
|
|
358
|
+
const rebuilt = build.packages.filter((p) => p.rebuilt).map((p) => p.name);
|
|
359
|
+
if (rebuilt.length > 0) {
|
|
360
|
+
lines.push(`Rebuilt since start: ${rebuilt.join(', ')}. This session still runs the old code; ` +
|
|
361
|
+
'reconnect the MCP server to load the new build.');
|
|
362
|
+
}
|
|
363
|
+
else if (build.packages.length > 0) {
|
|
364
|
+
lines.push(`Build unchanged since start (${build.packages.length} packages checked).`);
|
|
365
|
+
}
|
|
366
|
+
return lines.join('\n');
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=server-status.js.map
|
|
@@ -14,16 +14,38 @@
|
|
|
14
14
|
*
|
|
15
15
|
* All suggestions require human approval before implementation.
|
|
16
16
|
*/
|
|
17
|
-
import { type MCPTool } from '../types.js';
|
|
17
|
+
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
18
|
+
import { type Performance, type Suggestion } from './helpers/suggestion-generator.js';
|
|
19
|
+
/**
|
|
20
|
+
* Output from suggest-improvements tool
|
|
21
|
+
*/
|
|
22
|
+
interface SuggestImprovementsOutput {
|
|
23
|
+
/** Rule identifier analyzed */
|
|
24
|
+
ruleId: string;
|
|
25
|
+
/** Current performance metrics */
|
|
26
|
+
currentPerformance: Performance;
|
|
27
|
+
/** Array of actionable suggestions */
|
|
28
|
+
suggestions: Suggestion[];
|
|
29
|
+
/** Number of feedback records analyzed */
|
|
30
|
+
feedbackCount: number;
|
|
31
|
+
/** Number of analysis records (kind 'analysis') for this tool */
|
|
32
|
+
analysisFeedbackCount: number;
|
|
33
|
+
/** Locations where feedback was read from */
|
|
34
|
+
sourcesRead: string[];
|
|
35
|
+
/** Short text: data points, current performance and the top suggestions */
|
|
36
|
+
summary: string;
|
|
37
|
+
}
|
|
18
38
|
/**
|
|
19
39
|
* Suggest rule improvements based on transformation feedback analysis
|
|
20
40
|
*/
|
|
21
41
|
export declare class SuggestImprovementsTool implements MCPTool {
|
|
22
42
|
name: string;
|
|
43
|
+
title: string;
|
|
44
|
+
annotations: ToolAnnotations;
|
|
23
45
|
description: string;
|
|
24
|
-
private platformRoot;
|
|
25
46
|
inputSchema: {
|
|
26
47
|
readonly type: "object";
|
|
48
|
+
readonly additionalProperties: false;
|
|
27
49
|
readonly properties: {
|
|
28
50
|
readonly projectRoot: {
|
|
29
51
|
readonly type: "string";
|
|
@@ -43,11 +65,80 @@ export declare class SuggestImprovementsTool implements MCPTool {
|
|
|
43
65
|
readonly source: {
|
|
44
66
|
readonly type: "string";
|
|
45
67
|
readonly enum: readonly ["project", "platform", "both"];
|
|
46
|
-
readonly description:
|
|
68
|
+
readonly description: string;
|
|
47
69
|
};
|
|
48
70
|
};
|
|
49
71
|
readonly required: readonly ["ruleId"];
|
|
50
72
|
};
|
|
73
|
+
outputSchema: {
|
|
74
|
+
type: string;
|
|
75
|
+
properties: {
|
|
76
|
+
ruleId: {
|
|
77
|
+
type: string;
|
|
78
|
+
};
|
|
79
|
+
currentPerformance: {
|
|
80
|
+
type: string;
|
|
81
|
+
properties: {
|
|
82
|
+
successRate: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
avgDuration: {
|
|
86
|
+
type: string;
|
|
87
|
+
};
|
|
88
|
+
qualityImprovement: {
|
|
89
|
+
type: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
required: string[];
|
|
93
|
+
};
|
|
94
|
+
suggestions: {
|
|
95
|
+
type: string;
|
|
96
|
+
items: {
|
|
97
|
+
type: string;
|
|
98
|
+
properties: {
|
|
99
|
+
type: {
|
|
100
|
+
type: string;
|
|
101
|
+
};
|
|
102
|
+
description: {
|
|
103
|
+
type: string;
|
|
104
|
+
};
|
|
105
|
+
reasoning: {
|
|
106
|
+
type: string;
|
|
107
|
+
};
|
|
108
|
+
confidence: {
|
|
109
|
+
type: string;
|
|
110
|
+
};
|
|
111
|
+
expectedImprovement: {
|
|
112
|
+
type: string;
|
|
113
|
+
};
|
|
114
|
+
implementation: {
|
|
115
|
+
type: string;
|
|
116
|
+
};
|
|
117
|
+
requiresApproval: {
|
|
118
|
+
type: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
required: string[];
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
feedbackCount: {
|
|
125
|
+
type: string;
|
|
126
|
+
};
|
|
127
|
+
analysisFeedbackCount: {
|
|
128
|
+
type: string;
|
|
129
|
+
};
|
|
130
|
+
sourcesRead: {
|
|
131
|
+
readonly type: "array";
|
|
132
|
+
readonly items: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
summary: {
|
|
137
|
+
type: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
required: string[];
|
|
141
|
+
};
|
|
51
142
|
/**
|
|
52
143
|
* Execute suggest-improvements tool to generate actionable rule improvement suggestions
|
|
53
144
|
*
|
|
@@ -89,10 +180,11 @@ export declare class SuggestImprovementsTool implements MCPTool {
|
|
|
89
180
|
* @remarks
|
|
90
181
|
* - Suggestions filtered by minConfidence threshold
|
|
91
182
|
* - All suggestions have requiresApproval: true
|
|
92
|
-
* -
|
|
183
|
+
* - The platform store is read only when ANGULAR_MODERNIZER_PLATFORM_ROOT is set
|
|
93
184
|
* - Suggestions are sorted by confidence in descending order
|
|
94
185
|
* - Requires at least 2 feedback records to generate suggestions
|
|
95
186
|
*/
|
|
96
|
-
execute(args: Record<string, unknown>): Promise<
|
|
187
|
+
execute(args: Record<string, unknown>): Promise<SuggestImprovementsOutput>;
|
|
97
188
|
}
|
|
189
|
+
export {};
|
|
98
190
|
//# sourceMappingURL=suggest-improvements.d.ts.map
|
|
@@ -15,28 +15,44 @@
|
|
|
15
15
|
* All suggestions require human approval before implementation.
|
|
16
16
|
*/
|
|
17
17
|
import { FeedbackStorage, loadConfig, findRepeatedToolMisses, fromLegacyAnalysisRecord, summarizeAnalysisFeedback, } from '@angular-modernizer/core';
|
|
18
|
-
import * as path from 'node:path';
|
|
19
|
-
import { fileURLToPath } from 'node:url';
|
|
20
18
|
import { calculatePerformance, generateSuggestions, } from './helpers/suggestion-generator.js';
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
import { feedbackSessionDirs, feedbackStorageConfig, resolveFeedbackRoots, } from './helpers/platform-root-resolver.js';
|
|
20
|
+
import { STRING_ARRAY } from './helpers/investigation-schemas.js';
|
|
21
|
+
/** Suggestions spelled out in the summary; the rest is in `suggestions`. */
|
|
22
|
+
const SUMMARY_SUGGESTIONS = 5;
|
|
23
|
+
/** Text summary: data points, current performance and the top suggestions. */
|
|
24
|
+
function describeSuggestions(output) {
|
|
25
|
+
const p = output.currentPerformance;
|
|
26
|
+
const lines = [
|
|
27
|
+
`${output.ruleId}: ${output.feedbackCount} feedback record(s), ${output.analysisFeedbackCount} analysis record(s); ` +
|
|
28
|
+
`success rate ${Math.round(p.successRate * 100)}%, avg duration ${Math.round(p.avgDuration)} ms; ` +
|
|
29
|
+
`${output.suggestions.length} suggestion(s)${output.suggestions.length > 0 ? ' (all need approval):' : '.'}`,
|
|
30
|
+
];
|
|
31
|
+
for (const suggestion of output.suggestions.slice(0, SUMMARY_SUGGESTIONS)) {
|
|
32
|
+
lines.push(`- ${suggestion.type} (confidence ${suggestion.confidence.toFixed(2)}): ${suggestion.description}`);
|
|
33
|
+
}
|
|
34
|
+
return lines.join('\n');
|
|
35
|
+
}
|
|
27
36
|
/**
|
|
28
37
|
* Suggest rule improvements based on transformation feedback analysis
|
|
29
38
|
*/
|
|
30
39
|
export class SuggestImprovementsTool {
|
|
31
40
|
name = 'suggest-improvements';
|
|
41
|
+
title = 'Suggest Rule Improvements';
|
|
42
|
+
annotations = {
|
|
43
|
+
readOnlyHint: true,
|
|
44
|
+
destructiveHint: false,
|
|
45
|
+
idempotentHint: true,
|
|
46
|
+
openWorldHint: false,
|
|
47
|
+
};
|
|
32
48
|
description = 'Suggest rule adjustments based on feedback analysis. ' +
|
|
33
49
|
'Analyzes transformation outcomes to identify improvement opportunities: ' +
|
|
34
50
|
'parameter adjustments, prerequisite checks, approach changes, validation enhancements. ' +
|
|
35
|
-
'All suggestions require human approval.'
|
|
36
|
-
|
|
37
|
-
platformRoot = null;
|
|
51
|
+
'All suggestions require human approval. ' +
|
|
52
|
+
'summary is a short text with the data points, the current performance and the top suggestions.';
|
|
38
53
|
inputSchema = {
|
|
39
54
|
type: 'object',
|
|
55
|
+
additionalProperties: false,
|
|
40
56
|
properties: {
|
|
41
57
|
projectRoot: {
|
|
42
58
|
type: 'string',
|
|
@@ -56,11 +72,57 @@ export class SuggestImprovementsTool {
|
|
|
56
72
|
source: {
|
|
57
73
|
type: 'string',
|
|
58
74
|
enum: ['project', 'platform', 'both'],
|
|
59
|
-
description: "
|
|
75
|
+
description: "Where to read feedback from (default 'both'): <projectRoot>/.claude-feedback, " +
|
|
76
|
+
"plus the platform store when ANGULAR_MODERNIZER_PLATFORM_ROOT is set; " +
|
|
77
|
+
"'platform' requires that variable.",
|
|
60
78
|
},
|
|
61
79
|
},
|
|
62
80
|
required: ['ruleId'],
|
|
63
81
|
};
|
|
82
|
+
outputSchema = {
|
|
83
|
+
type: 'object',
|
|
84
|
+
properties: {
|
|
85
|
+
ruleId: { type: 'string' },
|
|
86
|
+
currentPerformance: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
properties: {
|
|
89
|
+
successRate: { type: 'number' },
|
|
90
|
+
avgDuration: { type: 'number' },
|
|
91
|
+
qualityImprovement: { type: 'number' },
|
|
92
|
+
},
|
|
93
|
+
required: ['successRate', 'avgDuration', 'qualityImprovement'],
|
|
94
|
+
},
|
|
95
|
+
suggestions: {
|
|
96
|
+
type: 'array',
|
|
97
|
+
items: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
type: { type: 'string' },
|
|
101
|
+
description: { type: 'string' },
|
|
102
|
+
reasoning: { type: 'string' },
|
|
103
|
+
confidence: { type: 'number' },
|
|
104
|
+
expectedImprovement: { type: 'string' },
|
|
105
|
+
implementation: { type: 'string' },
|
|
106
|
+
requiresApproval: { type: 'boolean' },
|
|
107
|
+
},
|
|
108
|
+
required: ['type', 'description', 'confidence', 'requiresApproval'],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
feedbackCount: { type: 'integer' },
|
|
112
|
+
analysisFeedbackCount: { type: 'integer' },
|
|
113
|
+
sourcesRead: STRING_ARRAY,
|
|
114
|
+
summary: { type: 'string' },
|
|
115
|
+
},
|
|
116
|
+
required: [
|
|
117
|
+
'ruleId',
|
|
118
|
+
'currentPerformance',
|
|
119
|
+
'suggestions',
|
|
120
|
+
'feedbackCount',
|
|
121
|
+
'analysisFeedbackCount',
|
|
122
|
+
'sourcesRead',
|
|
123
|
+
'summary',
|
|
124
|
+
],
|
|
125
|
+
};
|
|
64
126
|
/**
|
|
65
127
|
* Execute suggest-improvements tool to generate actionable rule improvement suggestions
|
|
66
128
|
*
|
|
@@ -102,7 +164,7 @@ export class SuggestImprovementsTool {
|
|
|
102
164
|
* @remarks
|
|
103
165
|
* - Suggestions filtered by minConfidence threshold
|
|
104
166
|
* - All suggestions have requiresApproval: true
|
|
105
|
-
* -
|
|
167
|
+
* - The platform store is read only when ANGULAR_MODERNIZER_PLATFORM_ROOT is set
|
|
106
168
|
* - Suggestions are sorted by confidence in descending order
|
|
107
169
|
* - Requires at least 2 feedback records to generate suggestions
|
|
108
170
|
*/
|
|
@@ -122,25 +184,14 @@ export class SuggestImprovementsTool {
|
|
|
122
184
|
// Apply defaults
|
|
123
185
|
const minConfidence = input.minConfidence ?? 0.7;
|
|
124
186
|
const source = input.source ?? 'both';
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
const platformRoot = this.platformRoot;
|
|
187
|
+
// The project always; the platform store only when configured
|
|
188
|
+
const roots = resolveFeedbackRoots(projectRoot, source);
|
|
128
189
|
// Initialize FeedbackStorage
|
|
129
|
-
const feedbackStorage = new FeedbackStorage(
|
|
130
|
-
projectRoot,
|
|
131
|
-
platformRoot,
|
|
132
|
-
storageLocation: source,
|
|
133
|
-
});
|
|
190
|
+
const feedbackStorage = new FeedbackStorage(feedbackStorageConfig(roots));
|
|
134
191
|
// Load all sessions
|
|
135
192
|
const sessionIds = await feedbackStorage.listSessions();
|
|
136
193
|
// Track which locations we read from
|
|
137
|
-
const sourcesRead =
|
|
138
|
-
const locations = getStorageLocations(source);
|
|
139
|
-
for (const location of locations) {
|
|
140
|
-
const root = location === 'project' ? projectRoot : platformRoot;
|
|
141
|
-
const feedbackDir = path.join(root, '.claude-feedback/sessions');
|
|
142
|
-
sourcesRead.push(feedbackDir);
|
|
143
|
-
}
|
|
194
|
+
const sourcesRead = feedbackSessionDirs(roots);
|
|
144
195
|
// Load and filter feedback for this rule (or analysis tool)
|
|
145
196
|
const ruleFeedback = [];
|
|
146
197
|
const toolAnalyses = [];
|
|
@@ -174,22 +225,7 @@ export class SuggestImprovementsTool {
|
|
|
174
225
|
analysisFeedbackCount: toolAnalyses.length,
|
|
175
226
|
sourcesRead,
|
|
176
227
|
};
|
|
177
|
-
return output;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Get array of storage locations based on the configured storage strategy
|
|
182
|
-
*/
|
|
183
|
-
function getStorageLocations(storageLocation) {
|
|
184
|
-
switch (storageLocation) {
|
|
185
|
-
case 'project':
|
|
186
|
-
return ['project'];
|
|
187
|
-
case 'platform':
|
|
188
|
-
return ['platform'];
|
|
189
|
-
case 'both':
|
|
190
|
-
return ['project', 'platform'];
|
|
191
|
-
default:
|
|
192
|
-
return ['project', 'platform'];
|
|
228
|
+
return { ...output, summary: describeSuggestions(output) };
|
|
193
229
|
}
|
|
194
230
|
}
|
|
195
231
|
/**
|