@angular-modernizer/adapter-mcp 0.1.4 → 0.2.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 +22 -0
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/analyze-build-impact.d.ts +47 -3
- package/dist/tools/analyze-build-impact.d.ts.map +1 -1
- package/dist/tools/analyze-build-impact.js +57 -14
- package/dist/tools/analyze-build-impact.js.map +1 -1
- package/dist/tools/analyze-parser-performance.d.ts.map +1 -1
- package/dist/tools/analyze-parser-performance.js +6 -4
- package/dist/tools/analyze-parser-performance.js.map +1 -1
- package/dist/tools/collect-feedback.d.ts +112 -1
- package/dist/tools/collect-feedback.d.ts.map +1 -1
- package/dist/tools/collect-feedback.js +240 -11
- package/dist/tools/collect-feedback.js.map +1 -1
- package/dist/tools/extract-libraries.d.ts +4 -0
- package/dist/tools/extract-libraries.d.ts.map +1 -1
- package/dist/tools/extract-libraries.js +40 -8
- package/dist/tools/extract-libraries.js.map +1 -1
- package/dist/tools/find-usages.d.ts +13 -1
- package/dist/tools/find-usages.d.ts.map +1 -1
- package/dist/tools/find-usages.js +34 -6
- package/dist/tools/find-usages.js.map +1 -1
- package/dist/tools/get-call-graph.d.ts +5 -1
- package/dist/tools/get-call-graph.d.ts.map +1 -1
- package/dist/tools/get-call-graph.js +21 -6
- package/dist/tools/get-call-graph.js.map +1 -1
- package/dist/tools/helpers/find-ts-config.d.ts +24 -1
- package/dist/tools/helpers/find-ts-config.d.ts.map +1 -1
- package/dist/tools/helpers/find-ts-config.js +213 -7
- package/dist/tools/helpers/find-ts-config.js.map +1 -1
- package/dist/tools/helpers/suggestion-generator.d.ts +1 -1
- package/dist/tools/helpers/suggestion-generator.d.ts.map +1 -1
- package/dist/tools/helpers/suggestion-generator.js.map +1 -1
- package/dist/tools/list-imports.d.ts +103 -0
- package/dist/tools/list-imports.d.ts.map +1 -0
- package/dist/tools/list-imports.js +154 -0
- package/dist/tools/list-imports.js.map +1 -0
- package/dist/tools/review-feedback.d.ts +7 -0
- package/dist/tools/review-feedback.d.ts.map +1 -1
- package/dist/tools/review-feedback.js +68 -16
- package/dist/tools/review-feedback.js.map +1 -1
- package/dist/tools/search-codebase.d.ts +29 -6
- package/dist/tools/search-codebase.d.ts.map +1 -1
- package/dist/tools/search-codebase.js +54 -12
- package/dist/tools/search-codebase.js.map +1 -1
- package/dist/tools/suggest-improvements.d.ts +3 -1
- package/dist/tools/suggest-improvements.d.ts.map +1 -1
- package/dist/tools/suggest-improvements.js +47 -10
- package/dist/tools/suggest-improvements.js.map +1 -1
- package/package.json +13 -12
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - List Imports Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool that lists the imports (and optionally `export ... from`
|
|
5
|
+
* re-exports) of a single file with their resolved targets.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Resolution goes through the TypeScript module resolver, so tsconfig `paths`
|
|
9
|
+
* aliases (`@shared/*`, `@core/*`, ...) resolve to real project files. Use it
|
|
10
|
+
* instead of grepping import lines when classifying layer dependencies,
|
|
11
|
+
* checking barrels or tracing where a symbol really comes from.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Via MCP:
|
|
16
|
+
* // tool: list-imports
|
|
17
|
+
* // args: { file: '/project/src/app/user.component.ts', projectRoot: '/project' }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { type MCPTool } from '../types.js';
|
|
21
|
+
import { type ModuleSpecifierKind } from '@angular-modernizer/core';
|
|
22
|
+
/**
|
|
23
|
+
* A named import / re-export specifier.
|
|
24
|
+
*/
|
|
25
|
+
interface NamedImportEntry {
|
|
26
|
+
/** Name exported by the target module. */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Local alias (import) or exported alias (re-export), if renamed. */
|
|
29
|
+
alias: string | null;
|
|
30
|
+
/** `import { type X }` / `export { type X }`. */
|
|
31
|
+
typeOnly: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* One import or re-export of the file.
|
|
35
|
+
*/
|
|
36
|
+
interface ImportEntry {
|
|
37
|
+
moduleSpecifier: string;
|
|
38
|
+
kind: ModuleSpecifierKind;
|
|
39
|
+
/** Project-relative resolved path, or null when unresolved / external. */
|
|
40
|
+
resolvedPath: string | null;
|
|
41
|
+
namedImports: NamedImportEntry[];
|
|
42
|
+
defaultImport: string | null;
|
|
43
|
+
namespaceImport: string | null;
|
|
44
|
+
/** Whole declaration is type-only (`import type` / `export type`). */
|
|
45
|
+
typeOnly: boolean;
|
|
46
|
+
/** `export ... from` declaration. */
|
|
47
|
+
isReExport: boolean;
|
|
48
|
+
/** `export * from` (re-exports everything). */
|
|
49
|
+
isStarReExport: boolean;
|
|
50
|
+
/** 1-based line of the declaration. */
|
|
51
|
+
line: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Output of the list-imports tool.
|
|
55
|
+
*/
|
|
56
|
+
interface ListImportsOutput {
|
|
57
|
+
file: string;
|
|
58
|
+
projectRoot: string;
|
|
59
|
+
tsConfigPath: string;
|
|
60
|
+
imports: ImportEntry[];
|
|
61
|
+
summary: {
|
|
62
|
+
total: number;
|
|
63
|
+
aliased: number;
|
|
64
|
+
relative: number;
|
|
65
|
+
external: number;
|
|
66
|
+
unresolved: number;
|
|
67
|
+
reExports: number;
|
|
68
|
+
typeOnly: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* MCP tool that lists the resolved imports of a file.
|
|
73
|
+
*/
|
|
74
|
+
export declare class ListImportsTool implements MCPTool {
|
|
75
|
+
readonly name = "list-imports";
|
|
76
|
+
readonly description: string;
|
|
77
|
+
readonly inputSchema: {
|
|
78
|
+
type: string;
|
|
79
|
+
properties: {
|
|
80
|
+
file: {
|
|
81
|
+
type: string;
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
projectRoot: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
includeReExports: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
default: boolean;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
required: string[];
|
|
95
|
+
};
|
|
96
|
+
execute(args: Record<string, unknown>): Promise<ListImportsOutput>;
|
|
97
|
+
private resolveFilePath;
|
|
98
|
+
private findProjectRoot;
|
|
99
|
+
private toEntry;
|
|
100
|
+
private buildSummary;
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=list-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-imports.d.ts","sourceRoot":"","sources":["../../src/tools/list-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAmBlC;;GAEG;AACH,UAAU,gBAAgB;IACxB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IAEb,sEAAsE;IACtE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,iDAAiD;IACjD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,0EAA0E;IAC1E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,cAAc,EAAE,OAAO,CAAC;IACxB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,OAAO;IAC7C,QAAQ,CAAC,IAAI,kBAAkB;IAE/B,QAAQ,CAAC,WAAW,SAIqE;IAEzF,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;MAoBlB;IAEI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA2CxE,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,OAAO;IAoDf,OAAO,CAAC,YAAY;CAcrB"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - List Imports Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool that lists the imports (and optionally `export ... from`
|
|
5
|
+
* re-exports) of a single file with their resolved targets.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Resolution goes through the TypeScript module resolver, so tsconfig `paths`
|
|
9
|
+
* aliases (`@shared/*`, `@core/*`, ...) resolve to real project files. Use it
|
|
10
|
+
* instead of grepping import lines when classifying layer dependencies,
|
|
11
|
+
* checking barrels or tracing where a symbol really comes from.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Via MCP:
|
|
16
|
+
* // tool: list-imports
|
|
17
|
+
* // args: { file: '/project/src/app/user.component.ts', projectRoot: '/project' }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { Project } from 'ts-morph';
|
|
21
|
+
import { classifyModuleSpecifier, collectModuleEdges, } from '@angular-modernizer/core';
|
|
22
|
+
import { existsSync } from 'node:fs';
|
|
23
|
+
import { dirname, isAbsolute, relative, resolve } from 'node:path';
|
|
24
|
+
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
25
|
+
/**
|
|
26
|
+
* MCP tool that lists the resolved imports of a file.
|
|
27
|
+
*/
|
|
28
|
+
export class ListImportsTool {
|
|
29
|
+
name = 'list-imports';
|
|
30
|
+
description = 'List the imports (and export-from re-exports) of a file with resolved targets. ' +
|
|
31
|
+
'For each import: moduleSpecifier, kind (aliased | relative | external), ' +
|
|
32
|
+
'project-relative resolvedPath (tsconfig paths aware), named/default/namespace imports, ' +
|
|
33
|
+
'type-only flags and whether it is a re-export. Use instead of grepping import lines.';
|
|
34
|
+
inputSchema = {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
file: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'File to inspect (absolute path, or relative to projectRoot).',
|
|
40
|
+
},
|
|
41
|
+
projectRoot: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'Absolute path to the project root (must contain a tsconfig). Default: nearest parent directory of the file that contains a tsconfig.',
|
|
44
|
+
},
|
|
45
|
+
includeReExports: {
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
description: 'Include `export ... from` declarations. Default: true.',
|
|
48
|
+
default: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
required: ['file'],
|
|
52
|
+
};
|
|
53
|
+
async execute(args) {
|
|
54
|
+
const params = args;
|
|
55
|
+
if (!params.file || typeof params.file !== 'string') {
|
|
56
|
+
throw new Error('file is required');
|
|
57
|
+
}
|
|
58
|
+
if (params.projectRoot !== undefined && !existsSync(params.projectRoot)) {
|
|
59
|
+
throw new Error(`projectRoot does not exist: ${params.projectRoot}`);
|
|
60
|
+
}
|
|
61
|
+
const filePath = this.resolveFilePath(params.file, params.projectRoot);
|
|
62
|
+
if (!existsSync(filePath)) {
|
|
63
|
+
throw new Error(`file does not exist: ${filePath}`);
|
|
64
|
+
}
|
|
65
|
+
const projectRoot = params.projectRoot
|
|
66
|
+
? resolve(params.projectRoot)
|
|
67
|
+
: this.findProjectRoot(filePath);
|
|
68
|
+
const tsConfigPath = projectRoot ? findTsConfig(projectRoot) : null;
|
|
69
|
+
if (!projectRoot || !tsConfigPath) {
|
|
70
|
+
throw new Error(`tsconfig.json not found in projectRoot: ${projectRoot ?? dirname(filePath)}`);
|
|
71
|
+
}
|
|
72
|
+
const project = new Project({ tsConfigFilePath: tsConfigPath });
|
|
73
|
+
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPath(filePath);
|
|
74
|
+
const includeReExports = params.includeReExports !== false;
|
|
75
|
+
const imports = collectModuleEdges(sourceFile, includeReExports).map((edge) => this.toEntry(sourceFile, edge, projectRoot));
|
|
76
|
+
return {
|
|
77
|
+
file: filePath,
|
|
78
|
+
projectRoot,
|
|
79
|
+
tsConfigPath,
|
|
80
|
+
imports,
|
|
81
|
+
summary: this.buildSummary(imports),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
resolveFilePath(file, projectRoot) {
|
|
85
|
+
if (isAbsolute(file)) {
|
|
86
|
+
return file;
|
|
87
|
+
}
|
|
88
|
+
return resolve(projectRoot ?? process.cwd(), file);
|
|
89
|
+
}
|
|
90
|
+
findProjectRoot(filePath) {
|
|
91
|
+
let current = dirname(filePath);
|
|
92
|
+
for (;;) {
|
|
93
|
+
if (findTsConfig(current)) {
|
|
94
|
+
return current;
|
|
95
|
+
}
|
|
96
|
+
const parent = dirname(current);
|
|
97
|
+
if (parent === current) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
current = parent;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
toEntry(sourceFile, edge, projectRoot) {
|
|
104
|
+
const kind = classifyModuleSpecifier(sourceFile, edge.moduleSpecifier, edge.target);
|
|
105
|
+
const resolvedPath = edge.target && kind !== 'external'
|
|
106
|
+
? relative(projectRoot, edge.target.getFilePath())
|
|
107
|
+
: null;
|
|
108
|
+
const namedImports = [];
|
|
109
|
+
let defaultImport = null;
|
|
110
|
+
let namespaceImport = null;
|
|
111
|
+
let isStarReExport = false;
|
|
112
|
+
for (const binding of edge.bindings) {
|
|
113
|
+
if (binding.importedName === 'default' && !edge.isReExport) {
|
|
114
|
+
defaultImport = binding.localName;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (binding.importedName === '*') {
|
|
118
|
+
isStarReExport = edge.isReExport && binding.localName === '*';
|
|
119
|
+
namespaceImport = isStarReExport ? null : binding.localName;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
namedImports.push({
|
|
123
|
+
name: binding.importedName,
|
|
124
|
+
alias: binding.localName === binding.importedName ? null : binding.localName,
|
|
125
|
+
typeOnly: binding.typeOnly,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
moduleSpecifier: edge.moduleSpecifier,
|
|
130
|
+
kind,
|
|
131
|
+
resolvedPath,
|
|
132
|
+
namedImports,
|
|
133
|
+
defaultImport,
|
|
134
|
+
namespaceImport,
|
|
135
|
+
typeOnly: edge.declarationTypeOnly,
|
|
136
|
+
isReExport: edge.isReExport,
|
|
137
|
+
isStarReExport,
|
|
138
|
+
line: edge.declaration.getStartLineNumber(),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
buildSummary(imports) {
|
|
142
|
+
const count = (predicate) => imports.filter(predicate).length;
|
|
143
|
+
return {
|
|
144
|
+
total: imports.length,
|
|
145
|
+
aliased: count((e) => e.kind === 'aliased'),
|
|
146
|
+
relative: count((e) => e.kind === 'relative'),
|
|
147
|
+
external: count((e) => e.kind === 'external'),
|
|
148
|
+
unresolved: count((e) => e.kind !== 'external' && e.resolvedPath === null),
|
|
149
|
+
reExports: count((e) => e.isReExport),
|
|
150
|
+
typeOnly: count((e) => e.typeOnly),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=list-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-imports.js","sourceRoot":"","sources":["../../src/tools/list-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,OAAO,EAAmB,MAAM,UAAU,CAAC;AACpD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAsE3D;;GAEG;AACH,MAAM,OAAO,eAAe;IACjB,IAAI,GAAG,cAAc,CAAC;IAEtB,WAAW,GAClB,iFAAiF;QACjF,0EAA0E;QAC1E,yFAAyF;QACzF,sFAAsF,CAAC;IAEhF,WAAW,GAAG;QACrB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,8DAA8D;aACjE;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAC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AAY;YACZ,YAAY;YACZ,aAAa;YACb,eAAe;YACf,QAAQ,EAAE,IAAI,CAAC,mBAAmB;YAClC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,cAAc;YACd,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE;SAC5C,CAAC;IACJ,CAAC;IAEO,YAAY,CAAC,OAAsB;QACzC,MAAM,KAAK,GAAG,CAAC,SAA0C,EAAU,EAAE,CACnE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QAEnC,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;YAC3C,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;YAC7C,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;YAC7C,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,YAAY,KAAK,IAAI,CAAC;YAC1E,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;YACrC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;SACnC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
* - Failure patterns: ≥2 occurrences
|
|
10
10
|
* - Quality trends: Identify degraded quality transformations
|
|
11
11
|
* - Outlier detection: Exclude anomalous feedback from learning
|
|
12
|
+
* - Analysis insights: kind 'analysis' records grouped by tool and category.
|
|
13
|
+
* They use their own completeness score (tool, claimed, actual, evidence)
|
|
14
|
+
* and never go through the duration/confidence outlier rules.
|
|
12
15
|
*
|
|
13
16
|
* Dual-Location Support:
|
|
14
17
|
* - DEFAULT: Read from BOTH project and platform locations
|
|
@@ -65,6 +68,10 @@ export declare class ReviewFeedbackTool implements MCPTool {
|
|
|
65
68
|
readonly enum: readonly ["project", "platform", "both"];
|
|
66
69
|
readonly description: "Source location strategy (default: 'both')";
|
|
67
70
|
};
|
|
71
|
+
readonly tool: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly description: "Optional tool filter for analysis records (e.g. 'find-usages')";
|
|
74
|
+
};
|
|
68
75
|
};
|
|
69
76
|
readonly required: readonly ["analysisType"];
|
|
70
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-feedback.d.ts","sourceRoot":"","sources":["../../src/tools/review-feedback.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"review-feedback.d.ts","sourceRoot":"","sources":["../../src/tools/review-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAkH3C;;GAEG;AACH,qBAAa,kBAAmB,YAAW,OAAO;IAChD,IAAI,SAAqB;IACzB,WAAW,SAGmE;IAG9E,OAAO,CAAC,YAAY,CAAuB;IAE3C,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkDA;IAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDG;IAEG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAmK/D"}
|
|
@@ -9,19 +9,24 @@
|
|
|
9
9
|
* - Failure patterns: ≥2 occurrences
|
|
10
10
|
* - Quality trends: Identify degraded quality transformations
|
|
11
11
|
* - Outlier detection: Exclude anomalous feedback from learning
|
|
12
|
+
* - Analysis insights: kind 'analysis' records grouped by tool and category.
|
|
13
|
+
* They use their own completeness score (tool, claimed, actual, evidence)
|
|
14
|
+
* and never go through the duration/confidence outlier rules.
|
|
12
15
|
*
|
|
13
16
|
* Dual-Location Support:
|
|
14
17
|
* - DEFAULT: Read from BOTH project and platform locations
|
|
15
18
|
* - Configurable: 'project', 'platform', or 'both'
|
|
16
19
|
* - Automatic session deduplication by sessionId
|
|
17
20
|
*/
|
|
18
|
-
import { FeedbackStorage, OutlierDetector, loadConfig, } from '@angular-modernizer/core';
|
|
21
|
+
import { FeedbackStorage, OutlierDetector, loadConfig, fromLegacyAnalysisRecord, scoreAnalysisCompleteness, summarizeAnalysisFeedback, } from '@angular-modernizer/core';
|
|
19
22
|
import * as path from 'node:path';
|
|
20
23
|
import { fileURLToPath } from 'node:url';
|
|
21
24
|
import { resolvePlatformRoot } from './helpers/platform-root-resolver.js';
|
|
22
|
-
// ESM-compatible __dirname alternative
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
// ESM-compatible __dirname alternative. Named _module* (not __filename/
|
|
26
|
+
// __dirname) so the CJS jest runtime, which already injects those wrapper
|
|
27
|
+
// identifiers, does not collide with these module-scope declarations.
|
|
28
|
+
const _moduleFilename = fileURLToPath(import.meta.url);
|
|
29
|
+
const _moduleDirname = path.dirname(_moduleFilename);
|
|
25
30
|
/**
|
|
26
31
|
* Review transformation feedback and extract insights for AI learning
|
|
27
32
|
*/
|
|
@@ -74,6 +79,10 @@ export class ReviewFeedbackTool {
|
|
|
74
79
|
enum: ['project', 'platform', 'both'],
|
|
75
80
|
description: "Source location strategy (default: 'both')",
|
|
76
81
|
},
|
|
82
|
+
tool: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: "Optional tool filter for analysis records (e.g. 'find-usages')",
|
|
85
|
+
},
|
|
77
86
|
},
|
|
78
87
|
required: ['analysisType'],
|
|
79
88
|
};
|
|
@@ -146,7 +155,7 @@ export class ReviewFeedbackTool {
|
|
|
146
155
|
const minCompleteness = input.minCompleteness ?? 70;
|
|
147
156
|
const source = input.source ?? 'both';
|
|
148
157
|
// Resolve platform root intelligently (searches for monorepo root)
|
|
149
|
-
this.platformRoot ??= resolvePlatformRoot(
|
|
158
|
+
this.platformRoot ??= resolvePlatformRoot(_moduleDirname, '../../../..');
|
|
150
159
|
const platformRoot = this.platformRoot;
|
|
151
160
|
// Initialize FeedbackStorage with source location
|
|
152
161
|
const feedbackStorage = new FeedbackStorage({
|
|
@@ -178,10 +187,21 @@ export class ReviewFeedbackTool {
|
|
|
178
187
|
}
|
|
179
188
|
}
|
|
180
189
|
const sessions = Array.from(sessionMap.values());
|
|
181
|
-
// Flatten all transformations
|
|
190
|
+
// Flatten all transformations and analysis records. Analysis misses that
|
|
191
|
+
// were backfilled as transformation records are moved to the analysis list.
|
|
182
192
|
let allFeedback = [];
|
|
193
|
+
let allAnalyses = [];
|
|
183
194
|
for (const session of sessions) {
|
|
184
|
-
|
|
195
|
+
allAnalyses.push(...(session.analyses ?? []));
|
|
196
|
+
for (const record of session.transformations) {
|
|
197
|
+
const legacy = fromLegacyAnalysisRecord(record);
|
|
198
|
+
if (legacy) {
|
|
199
|
+
allAnalyses.push(legacy);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
allFeedback.push(record);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
185
205
|
}
|
|
186
206
|
// Apply filters
|
|
187
207
|
if (input.category) {
|
|
@@ -190,9 +210,20 @@ export class ReviewFeedbackTool {
|
|
|
190
210
|
if (input.since) {
|
|
191
211
|
const sinceDate = new Date(input.since);
|
|
192
212
|
allFeedback = allFeedback.filter((f) => new Date(f.timestamp) >= sinceDate);
|
|
213
|
+
allAnalyses = allAnalyses.filter((a) => new Date(a.timestamp) >= sinceDate);
|
|
193
214
|
}
|
|
215
|
+
if (input.tool) {
|
|
216
|
+
allAnalyses = allAnalyses.filter((a) => a.tool === input.tool);
|
|
217
|
+
}
|
|
218
|
+
// Quality warnings about completeness need the list BEFORE the
|
|
219
|
+
// completeness filter, otherwise low-completeness records never show up.
|
|
220
|
+
const unfilteredFeedback = allFeedback;
|
|
194
221
|
// Filter by completeness
|
|
195
222
|
allFeedback = allFeedback.filter((f) => f.metadata.completenessScore >= minCompleteness);
|
|
223
|
+
// Analysis records: own completeness score, no outlier detection
|
|
224
|
+
const analysisScores = allAnalyses.map((a) => scoreAnalysisCompleteness(a));
|
|
225
|
+
const validAnalyses = allAnalyses.filter((_a, index) => (analysisScores[index] ?? 0) >= minCompleteness);
|
|
226
|
+
const analysisInsights = summarizeAnalysisFeedback(validAnalyses);
|
|
196
227
|
// Detect outliers
|
|
197
228
|
const outlierDetector = new OutlierDetector();
|
|
198
229
|
const outlierReport = outlierDetector.detectOutliers(allFeedback);
|
|
@@ -206,7 +237,7 @@ export class ReviewFeedbackTool {
|
|
|
206
237
|
const { analyzePatterns } = await import('./helpers/feedback-analyzer.js');
|
|
207
238
|
const insights = analyzePatterns(validFeedback, input.analysisType, minConfidence);
|
|
208
239
|
// Generate quality warnings
|
|
209
|
-
const qualityWarnings = generateQualityWarnings(
|
|
240
|
+
const qualityWarnings = generateQualityWarnings(unfilteredFeedback, outlierReport, minCompleteness, analysisScores);
|
|
210
241
|
// Return output
|
|
211
242
|
const output = {
|
|
212
243
|
sessions: sessions.length,
|
|
@@ -215,6 +246,8 @@ export class ReviewFeedbackTool {
|
|
|
215
246
|
sourcesRead,
|
|
216
247
|
insights,
|
|
217
248
|
qualityWarnings,
|
|
249
|
+
analysisRecords: validAnalyses.length,
|
|
250
|
+
analysisInsights,
|
|
218
251
|
};
|
|
219
252
|
return output;
|
|
220
253
|
}
|
|
@@ -234,24 +267,43 @@ function getStorageLocations(storageLocation) {
|
|
|
234
267
|
return ['project', 'platform'];
|
|
235
268
|
}
|
|
236
269
|
}
|
|
270
|
+
/** Completeness below this value is reported as low quality */
|
|
271
|
+
const LOW_COMPLETENESS_THRESHOLD = 70;
|
|
237
272
|
/**
|
|
238
273
|
* Generate quality warnings about feedback data
|
|
274
|
+
*
|
|
275
|
+
* @param allFeedback - Transformation records BEFORE the completeness filter
|
|
276
|
+
* @param outlierReport - Outlier report for the completeness-filtered records
|
|
277
|
+
* @param minCompleteness - Completeness threshold used for filtering
|
|
278
|
+
* @param analysisScores - Completeness scores of analysis records (unfiltered)
|
|
239
279
|
*/
|
|
240
|
-
function generateQualityWarnings(allFeedback, outlierReport) {
|
|
280
|
+
function generateQualityWarnings(allFeedback, outlierReport, minCompleteness, analysisScores) {
|
|
241
281
|
const warnings = [];
|
|
242
|
-
|
|
282
|
+
const scores = [
|
|
283
|
+
...allFeedback.map((f) => f.metadata.completenessScore),
|
|
284
|
+
...analysisScores,
|
|
285
|
+
];
|
|
286
|
+
if (scores.length === 0) {
|
|
243
287
|
return warnings;
|
|
244
288
|
}
|
|
245
|
-
// Low-completeness
|
|
246
|
-
|
|
247
|
-
|
|
289
|
+
// Low-completeness records (transformation + analysis), counted on the
|
|
290
|
+
// unfiltered list so records dropped by minCompleteness are visible here.
|
|
291
|
+
const lowCompletenessCount = scores.filter((score) => score < LOW_COMPLETENESS_THRESHOLD).length;
|
|
292
|
+
const excludedCount = scores.filter((score) => score < minCompleteness).length;
|
|
293
|
+
if (lowCompletenessCount > 0) {
|
|
294
|
+
const excludedNote = excludedCount > 0
|
|
295
|
+
? `; ${excludedCount} excluded from learning by minCompleteness ${minCompleteness}`
|
|
296
|
+
: '';
|
|
248
297
|
warnings.push({
|
|
249
298
|
type: 'low-completeness',
|
|
250
|
-
count:
|
|
251
|
-
percentage: (
|
|
252
|
-
message: `${
|
|
299
|
+
count: lowCompletenessCount,
|
|
300
|
+
percentage: (lowCompletenessCount / scores.length) * 100,
|
|
301
|
+
message: `${lowCompletenessCount} feedback records have low completeness (<${LOW_COMPLETENESS_THRESHOLD}%), reducing learning quality${excludedNote}`,
|
|
253
302
|
});
|
|
254
303
|
}
|
|
304
|
+
if (allFeedback.length === 0) {
|
|
305
|
+
return warnings;
|
|
306
|
+
}
|
|
255
307
|
// Outliers
|
|
256
308
|
if (outlierReport.outliers.length > 0) {
|
|
257
309
|
warnings.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-feedback.js","sourceRoot":"","sources":["../../src/tools/review-feedback.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"review-feedback.js","sourceRoot":"","sources":["../../src/tools/review-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EACL,eAAe,EACf,eAAe,EACf,UAAU,EACV,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,GAM1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;AA4FrD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B,IAAI,GAAG,iBAAiB,CAAC;IACzB,WAAW,GACT,kEAAkE;QAClE,4DAA4D;QAC5D,2EAA2E,CAAC;IAE9E,8DAA8D;IACtD,YAAY,GAAkB,IAAI,CAAC;IAE3C,WAAW,GAAG;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,+DAA+D;aAClE;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wDAAwD;aACtE;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wDAAwD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|
*/
|
|
22
22
|
import { type MCPTool } from '../types.js';
|
|
23
|
-
import { type SearchResult } from '@angular-modernizer/api';
|
|
23
|
+
import { type SearchCoverage, type SearchResult } from '@angular-modernizer/api';
|
|
24
|
+
/**
|
|
25
|
+
* Output of the search-codebase tool.
|
|
26
|
+
*/
|
|
27
|
+
interface SearchCodebaseOutput {
|
|
28
|
+
results: SearchResult[];
|
|
29
|
+
totalCount: number;
|
|
30
|
+
summary: string;
|
|
31
|
+
/** Which files the search covered, including the tsconfig used. */
|
|
32
|
+
coverage: SearchCoverage & {
|
|
33
|
+
tsConfigPath: string;
|
|
34
|
+
/** Present when 0 hits were found: why that does not prove absence. */
|
|
35
|
+
hint?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
24
38
|
/**
|
|
25
39
|
* MCP tool that searches TypeScript source files by text, regex, or symbol.
|
|
26
40
|
*/
|
|
@@ -51,14 +65,23 @@ export declare class SearchCodebaseTool implements MCPTool {
|
|
|
51
65
|
type: string;
|
|
52
66
|
description: string;
|
|
53
67
|
};
|
|
68
|
+
includeTemplates: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
includeNonProgramFiles: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
54
76
|
};
|
|
55
77
|
required: string[];
|
|
56
78
|
};
|
|
57
|
-
execute(args: Record<string, unknown>): Promise<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
execute(args: Record<string, unknown>): Promise<SearchCodebaseOutput>;
|
|
80
|
+
/**
|
|
81
|
+
* Explains why 0 hits is not proof of absence, naming what was excluded.
|
|
82
|
+
*/
|
|
83
|
+
private buildZeroHitHint;
|
|
62
84
|
private buildSummary;
|
|
63
85
|
}
|
|
86
|
+
export {};
|
|
64
87
|
//# sourceMappingURL=search-codebase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-codebase.d.ts","sourceRoot":"","sources":["../../src/tools/search-codebase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,
|
|
1
|
+
{"version":3,"file":"search-codebase.d.ts","sourceRoot":"","sources":["../../src/tools/search-codebase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,yBAAyB,CAAC;AAuCjC;;GAEG;AACH,UAAU,oBAAoB;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAEhB,mEAAmE;IACnE,QAAQ,EAAE,cAAc,GAAG;QACzB,YAAY,EAAE,MAAM,CAAC;QACrB,uEAAuE;QACvE,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,kBAAmB,YAAW,OAAO;IAChD,QAAQ,CAAC,IAAI,qBAAqB;IAElC,QAAQ,CAAC,WAAW,SAUuD;IAE3E,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2ClB;IAEI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAmD3E;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,YAAY;CAkBrB"}
|