@angular-modernizer/adapter-mcp 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +103 -35
  2. package/dist/cli.js +64 -14
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +7 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +7 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/mcp-watcher.d.ts.map +1 -1
  9. package/dist/mcp-watcher.js +3 -0
  10. package/dist/mcp-watcher.js.map +1 -1
  11. package/dist/server/json-rpc-handler.d.ts +41 -0
  12. package/dist/server/json-rpc-handler.d.ts.map +1 -1
  13. package/dist/server/json-rpc-handler.js +85 -6
  14. package/dist/server/json-rpc-handler.js.map +1 -1
  15. package/dist/server/mcp-server.d.ts +31 -0
  16. package/dist/server/mcp-server.d.ts.map +1 -1
  17. package/dist/server/mcp-server.js +76 -23
  18. package/dist/server/mcp-server.js.map +1 -1
  19. package/dist/server/stdio-guard.d.ts +20 -0
  20. package/dist/server/stdio-guard.d.ts.map +1 -0
  21. package/dist/server/stdio-guard.js +48 -0
  22. package/dist/server/stdio-guard.js.map +1 -0
  23. package/dist/tools/analyze-build-impact.d.ts +126 -13
  24. package/dist/tools/analyze-build-impact.d.ts.map +1 -1
  25. package/dist/tools/analyze-build-impact.js +172 -30
  26. package/dist/tools/analyze-build-impact.js.map +1 -1
  27. package/dist/tools/find-angular-symbol.d.ts +29 -6
  28. package/dist/tools/find-angular-symbol.d.ts.map +1 -1
  29. package/dist/tools/find-angular-symbol.js +51 -6
  30. package/dist/tools/find-angular-symbol.js.map +1 -1
  31. package/dist/tools/find-component-hosts.d.ts +114 -0
  32. package/dist/tools/find-component-hosts.d.ts.map +1 -0
  33. package/dist/tools/find-component-hosts.js +240 -0
  34. package/dist/tools/find-component-hosts.js.map +1 -0
  35. package/dist/tools/find-usages.d.ts +20 -3
  36. package/dist/tools/find-usages.d.ts.map +1 -1
  37. package/dist/tools/find-usages.js +71 -8
  38. package/dist/tools/find-usages.js.map +1 -1
  39. package/dist/tools/get-bootstrap-execution.d.ts +108 -0
  40. package/dist/tools/get-bootstrap-execution.d.ts.map +1 -0
  41. package/dist/tools/get-bootstrap-execution.js +243 -0
  42. package/dist/tools/get-bootstrap-execution.js.map +1 -0
  43. package/dist/tools/get-call-graph.d.ts +28 -3
  44. package/dist/tools/get-call-graph.d.ts.map +1 -1
  45. package/dist/tools/get-call-graph.js +55 -7
  46. package/dist/tools/get-call-graph.js.map +1 -1
  47. package/dist/tools/helpers/compact-output.d.ts +61 -0
  48. package/dist/tools/helpers/compact-output.d.ts.map +1 -0
  49. package/dist/tools/helpers/compact-output.js +83 -0
  50. package/dist/tools/helpers/compact-output.js.map +1 -0
  51. package/dist/tools/helpers/project-cache.d.ts +177 -0
  52. package/dist/tools/helpers/project-cache.d.ts.map +1 -0
  53. package/dist/tools/helpers/project-cache.js +313 -0
  54. package/dist/tools/helpers/project-cache.js.map +1 -0
  55. package/dist/tools/helpers/rule-runner.d.ts +67 -0
  56. package/dist/tools/helpers/rule-runner.d.ts.map +1 -0
  57. package/dist/tools/helpers/rule-runner.js +117 -0
  58. package/dist/tools/helpers/rule-runner.js.map +1 -0
  59. package/dist/tools/helpers/scan-plan.d.ts +45 -0
  60. package/dist/tools/helpers/scan-plan.d.ts.map +1 -0
  61. package/dist/tools/helpers/scan-plan.js +151 -0
  62. package/dist/tools/helpers/scan-plan.js.map +1 -0
  63. package/dist/tools/helpers/stack-frame-file-index.d.ts +10 -0
  64. package/dist/tools/helpers/stack-frame-file-index.d.ts.map +1 -0
  65. package/dist/tools/helpers/stack-frame-file-index.js +71 -0
  66. package/dist/tools/helpers/stack-frame-file-index.js.map +1 -0
  67. package/dist/tools/inspect-form-group.d.ts +93 -0
  68. package/dist/tools/inspect-form-group.d.ts.map +1 -0
  69. package/dist/tools/inspect-form-group.js +161 -0
  70. package/dist/tools/inspect-form-group.js.map +1 -0
  71. package/dist/tools/inspect-i18n.d.ts +85 -0
  72. package/dist/tools/inspect-i18n.d.ts.map +1 -0
  73. package/dist/tools/inspect-i18n.js +203 -0
  74. package/dist/tools/inspect-i18n.js.map +1 -0
  75. package/dist/tools/inspect-template.d.ts +89 -0
  76. package/dist/tools/inspect-template.d.ts.map +1 -0
  77. package/dist/tools/inspect-template.js +166 -0
  78. package/dist/tools/inspect-template.js.map +1 -0
  79. package/dist/tools/list-imports.d.ts +17 -1
  80. package/dist/tools/list-imports.d.ts.map +1 -1
  81. package/dist/tools/list-imports.js +22 -5
  82. package/dist/tools/list-imports.js.map +1 -1
  83. package/dist/tools/orchestrate-migration.d.ts +1 -0
  84. package/dist/tools/orchestrate-migration.d.ts.map +1 -1
  85. package/dist/tools/orchestrate-migration.js +33 -1
  86. package/dist/tools/orchestrate-migration.js.map +1 -1
  87. package/dist/tools/parse-stack-trace.d.ts +3 -1
  88. package/dist/tools/parse-stack-trace.d.ts.map +1 -1
  89. package/dist/tools/parse-stack-trace.js +18 -4
  90. package/dist/tools/parse-stack-trace.js.map +1 -1
  91. package/dist/tools/plan-migration.d.ts +89 -1
  92. package/dist/tools/plan-migration.d.ts.map +1 -1
  93. package/dist/tools/plan-migration.js +203 -7
  94. package/dist/tools/plan-migration.js.map +1 -1
  95. package/dist/tools/resolve-type.d.ts +3 -0
  96. package/dist/tools/resolve-type.d.ts.map +1 -1
  97. package/dist/tools/resolve-type.js +6 -2
  98. package/dist/tools/resolve-type.js.map +1 -1
  99. package/dist/tools/scan-all.d.ts +6 -6
  100. package/dist/tools/scan-all.d.ts.map +1 -1
  101. package/dist/tools/scan-all.js +7 -7
  102. package/dist/tools/scan-all.js.map +1 -1
  103. package/dist/tools/scan-angular.d.ts +1 -1
  104. package/dist/tools/scan-angular.js +1 -1
  105. package/dist/tools/scan-architecture.d.ts +25 -4
  106. package/dist/tools/scan-architecture.d.ts.map +1 -1
  107. package/dist/tools/scan-architecture.js +115 -134
  108. package/dist/tools/scan-architecture.js.map +1 -1
  109. package/dist/tools/scan-solid.d.ts +1 -1
  110. package/dist/tools/scan-solid.js +1 -1
  111. package/dist/tools/search-codebase.d.ts +3 -0
  112. package/dist/tools/search-codebase.d.ts.map +1 -1
  113. package/dist/tools/search-codebase.js +6 -2
  114. package/dist/tools/search-codebase.js.map +1 -1
  115. package/dist/tools/server-status.d.ts +96 -0
  116. package/dist/tools/server-status.d.ts.map +1 -0
  117. package/dist/tools/server-status.js +195 -0
  118. package/dist/tools/server-status.js.map +1 -0
  119. package/dist/tools/trace-output-flow.d.ts +111 -0
  120. package/dist/tools/trace-output-flow.d.ts.map +1 -0
  121. package/dist/tools/trace-output-flow.js +308 -0
  122. package/dist/tools/trace-output-flow.js.map +1 -0
  123. package/dist/types.d.ts +7 -0
  124. package/dist/types.d.ts.map +1 -1
  125. package/dist/types.js.map +1 -1
  126. package/package.json +11 -11
@@ -18,21 +18,32 @@
18
18
  * // args: { query: 'UserService', type: 'service', projectRoot: '/project' }
19
19
  * ```
20
20
  */
21
- import { Project } from 'ts-morph';
22
21
  import { AngularSymbolFinder, } from '@angular-modernizer/api';
23
22
  import { existsSync } from 'node:fs';
24
23
  import { findTsConfig } from './helpers/find-ts-config.js';
24
+ import { ProjectCache } from './helpers/project-cache.js';
25
+ import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, truncationNote, } from './helpers/compact-output.js';
26
+ /** Symbols named in the summaryOnly text. */
27
+ const SUMMARY_NAMES = 10;
25
28
  /**
26
29
  * MCP tool that finds Angular symbols by selector, pipe name, or class name.
27
30
  */
28
31
  export class FindAngularSymbolTool {
32
+ projects;
29
33
  name = 'find-angular-symbol';
34
+ constructor(projects = new ProjectCache()) {
35
+ this.projects = projects;
36
+ }
30
37
  description = 'Find Angular symbols (components, directives, pipes, services, guards, ' +
31
38
  'interceptors, resolvers, modules, tokens) by selector, pipe name, or class name. ' +
32
39
  'Accepts CSS selectors (e.g. app-user), attribute selectors (e.g. appHighlight), ' +
33
40
  'pipe template names (e.g. dateFormat), or TypeScript class names. ' +
34
41
  'Supports standard Angular decorators and ngUWI @ExportComponent/@ExportFunction. ' +
35
- 'Use during bug investigation to locate which class owns a given selector or pipe.';
42
+ 'Library components, directives and pipes (e.g. the ngx-translate translate pipe) come from ' +
43
+ 'compiled .d.ts metadata with source "library", after project symbols; they match exactly (class name, ' +
44
+ 'pipe name or one selector of the list), not by substring. *.spec.ts files are skipped. ' +
45
+ 'Use during bug investigation to locate which class owns a given selector or pipe. ' +
46
+ 'Selector and pipe queries match substrings; use summaryOnly or maxResults for short queries.';
36
47
  inputSchema = {
37
48
  type: 'object',
38
49
  properties: {
@@ -61,6 +72,7 @@ export class FindAngularSymbolTool {
61
72
  type: 'string',
62
73
  description: 'Absolute path to the project root. Must contain a tsconfig.json.',
63
74
  },
75
+ ...COMPACT_OUTPUT_SCHEMA,
64
76
  },
65
77
  required: ['query', 'projectRoot'],
66
78
  };
@@ -72,6 +84,7 @@ export class FindAngularSymbolTool {
72
84
  if (!params.projectRoot) {
73
85
  throw new Error('projectRoot is required');
74
86
  }
87
+ const compact = parseCompactOptions(args);
75
88
  if (!existsSync(params.projectRoot)) {
76
89
  throw new Error(`projectRoot does not exist: ${params.projectRoot}`);
77
90
  }
@@ -79,15 +92,46 @@ export class FindAngularSymbolTool {
79
92
  if (!tsConfigPath) {
80
93
  throw new Error(`tsconfig.json not found in projectRoot: ${params.projectRoot}`);
81
94
  }
82
- const project = new Project({ tsConfigFilePath: tsConfigPath });
95
+ const project = this.projects.get(tsConfigPath);
83
96
  const finder = new AngularSymbolFinder(project);
84
97
  const results = finder.findSymbol(params.query, params.type);
98
+ const countsByType = {};
99
+ for (const r of results) {
100
+ countsByType[r.angularType] = (countsByType[r.angularType] ?? 0) + 1;
101
+ }
102
+ if (compact.summaryOnly) {
103
+ return {
104
+ totalCount: results.length,
105
+ truncated: false,
106
+ countsByType,
107
+ summary: this.buildCompactSummary(params.query, results, countsByType),
108
+ };
109
+ }
110
+ const shown = limitList(results, compact.maxResults);
111
+ const note = truncationNote(shown.items.length, results.length, 'symbols');
112
+ const summary = this.buildSummary(params.query, params.type, shown.items);
85
113
  return {
86
- results,
114
+ results: shown.items,
87
115
  totalCount: results.length,
88
- summary: this.buildSummary(params.query, params.type, results),
116
+ truncated: shown.truncated,
117
+ countsByType,
118
+ summary: note ? `${note}\n${summary}` : summary,
89
119
  };
90
120
  }
121
+ buildCompactSummary(query, results, countsByType) {
122
+ if (results.length === 0) {
123
+ return `No Angular symbol found matching '${query}'.`;
124
+ }
125
+ const types = Object.entries(countsByType)
126
+ .map(([type, count]) => `${type} ${count}`)
127
+ .join(', ');
128
+ const names = results.slice(0, SUMMARY_NAMES).map((r) => r.className);
129
+ const more = results.length > SUMMARY_NAMES
130
+ ? ` and ${results.length - SUMMARY_NAMES} more`
131
+ : '';
132
+ return (`Found ${results.length} symbol(s) matching '${query}' (${types}): ` +
133
+ `${names.join(', ')}${more}.`);
134
+ }
91
135
  buildSummary(query, type, results) {
92
136
  if (results.length === 0) {
93
137
  const typeStr = type ? ` ${type}` : '';
@@ -96,7 +140,8 @@ export class FindAngularSymbolTool {
96
140
  const typeStr = type ? ` ${type}` : '';
97
141
  const lines = results.map((r) => `${r.className} (${r.angularType}) in ${r.file}` +
98
142
  (r.selector ? ` [selector: ${r.selector}]` : '') +
99
- (r.pipeName ? ` [pipe: ${r.pipeName}]` : ''));
143
+ (r.pipeName ? ` [pipe: ${r.pipeName}]` : '') +
144
+ (r.source === 'library' ? ' [library]' : ''));
100
145
  return (`Found ${results.length}${typeStr} symbol${results.length === 1 ? '' : 's'} matching '${query}':\n` +
101
146
  lines.join('\n'));
102
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"find-angular-symbol.js","sourceRoot":"","sources":["../../src/tools/find-angular-symbol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EACL,mB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,GAAG,OAAO,CAAC,GAAG,CACvB,CAAC,CAAC,EAAE,EAAE,CACJ,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,WAAW,QAAQ,CAAC,CAAC,IAAI,EAAE;YAChD,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAChD,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5C,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/C,CAAC;QAEF,OAAO,CACL,SAAS,OAAO,CAAC,MAAM,GAAG,OAAO,UAAU,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,cAAc,KAAK,MAAM;YACnG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CACjB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Find Component Hosts Tool
3
+ *
4
+ * MCP tool that lists every template using a component or directive and,
5
+ * per host, which inputs and outputs are bound, unbound or missing, plus
6
+ * the places creating a component in code (dialogs, `createComponent`,
7
+ * wrappers) as `dynamicHosts`.
8
+ *
9
+ * @remarks
10
+ * Logic lives in `ComponentHostFinder` (`@angular-modernizer/api`); this tool
11
+ * resolves the project, validates arguments and applies the compact output
12
+ * contract (`maxResults` caps the host list and the dynamic host list each).
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // Via MCP:
17
+ * // tool: find-component-hosts
18
+ * // args: { className: 'ItemComponent', projectRoot: '/project' }
19
+ * ```
20
+ */
21
+ import { type MCPTool } from '../types.js';
22
+ import { type BindingCoverage, type ComponentHost, type ComponentHostResult, type DynamicHost } from '@angular-modernizer/api';
23
+ import { ProjectCache } from './helpers/project-cache.js';
24
+ /** Coverage entry with the host name lists dropped (summaryOnly) or capped (maxResults). */
25
+ type CoverageOutput = Pick<BindingCoverage, 'bound' | 'unbound'> & Partial<Pick<BindingCoverage, 'boundIn' | 'unboundIn'>>;
26
+ /** A host with occurrences optionally dropped. */
27
+ type HostOutput = Omit<ComponentHost, 'occurrences'> & Partial<Pick<ComponentHost, 'occurrences'>>;
28
+ /**
29
+ * Output of the find-component-hosts tool.
30
+ */
31
+ interface FindComponentHostsOutput extends Omit<ComponentHostResult, 'hosts' | 'coverage' | 'dynamicHosts' | 'candidateHosts'> {
32
+ /** Per input/output: host counts, and host names unless summaryOnly (capped by maxResults). */
33
+ coverage: {
34
+ inputs: Record<string, CoverageOutput>;
35
+ outputs: Record<string, CoverageOutput>;
36
+ };
37
+ /** Hosts, cut to `maxResults`; omitted with `summaryOnly`. */
38
+ hosts?: HostOutput[];
39
+ /** `true` when `maxResults` cut the host list. */
40
+ truncated: boolean;
41
+ /** Places creating the component in code, cut to `maxResults`; omitted with `summaryOnly`. */
42
+ dynamicHosts?: DynamicHost[];
43
+ /** `true` when `maxResults` cut the dynamic host list. */
44
+ dynamicTruncated: boolean;
45
+ /** Registry lookups whose selector comes from data, cut to `maxResults`; omitted with `summaryOnly`. */
46
+ candidateHosts?: DynamicHost[];
47
+ /** `true` when `maxResults` cut the candidate list. */
48
+ candidateTruncated: boolean;
49
+ summary: string;
50
+ tsConfigPath: string;
51
+ }
52
+ /**
53
+ * MCP tool that finds the template hosts of a component or directive.
54
+ */
55
+ export declare class FindComponentHostsTool implements MCPTool {
56
+ private readonly projects;
57
+ readonly name = "find-component-hosts";
58
+ constructor(projects?: ProjectCache);
59
+ readonly description: string;
60
+ readonly inputSchema: {
61
+ type: string;
62
+ properties: {
63
+ summaryOnly: {
64
+ readonly type: "boolean";
65
+ readonly description: "Return counts and the text summary only, without the result list. Default: false.";
66
+ readonly default: false;
67
+ };
68
+ maxResults: {
69
+ readonly type: "number";
70
+ readonly description: string;
71
+ };
72
+ className: {
73
+ type: string;
74
+ description: string;
75
+ };
76
+ selector: {
77
+ type: string;
78
+ description: string;
79
+ };
80
+ file: {
81
+ type: string;
82
+ description: string;
83
+ };
84
+ projectRoot: {
85
+ type: string;
86
+ description: string;
87
+ };
88
+ includeOccurrences: {
89
+ type: string;
90
+ description: string;
91
+ default: boolean;
92
+ };
93
+ includeTestHosts: {
94
+ type: string;
95
+ description: string;
96
+ default: boolean;
97
+ };
98
+ includeDynamic: {
99
+ type: string;
100
+ description: string;
101
+ default: boolean;
102
+ };
103
+ };
104
+ required: string[];
105
+ };
106
+ execute(args: Record<string, unknown>): Promise<FindComponentHostsOutput>;
107
+ private buildSummary;
108
+ private shapeCoverage;
109
+ /** `SobSolDialog.open 24, new SobSolDialogRef 2` */
110
+ private sinkList;
111
+ private nameList;
112
+ }
113
+ export {};
114
+ //# sourceMappingURL=find-component-hosts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-component-hosts.d.ts","sourceRoot":"","sources":["../../src/tools/find-component-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA2C1D,4FAA4F;AAC5F,KAAK,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC,GAC9D,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC;AAE1D,kDAAkD;AAClD,KAAK,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,GAClD,OAAO,CAAC,IAAI,CAAC,aAA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er/adapter-mcp - Find Component Hosts Tool
3
+ *
4
+ * MCP tool that lists every template using a component or directive and,
5
+ * per host, which inputs and outputs are bound, unbound or missing, plus
6
+ * the places creating a component in code (dialogs, `createComponent`,
7
+ * wrappers) as `dynamicHosts`.
8
+ *
9
+ * @remarks
10
+ * Logic lives in `ComponentHostFinder` (`@angular-modernizer/api`); this tool
11
+ * resolves the project, validates arguments and applies the compact output
12
+ * contract (`maxResults` caps the host list and the dynamic host list each).
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // Via MCP:
17
+ * // tool: find-component-hosts
18
+ * // args: { className: 'ItemComponent', projectRoot: '/project' }
19
+ * ```
20
+ */
21
+ import { ComponentHostFinder, } from '@angular-modernizer/api';
22
+ import { existsSync } from 'node:fs';
23
+ import { isAbsolute, resolve } from 'node:path';
24
+ import { findTsConfig } from './helpers/find-ts-config.js';
25
+ import { ProjectCache } from './helpers/project-cache.js';
26
+ import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, truncationNote, } from './helpers/compact-output.js';
27
+ /** Host names listed per input/output in the text summary. */
28
+ const SUMMARY_MAX_NAMES = 5;
29
+ /**
30
+ * MCP tool that finds the template hosts of a component or directive.
31
+ */
32
+ export class FindComponentHostsTool {
33
+ projects;
34
+ name = 'find-component-hosts';
35
+ constructor(projects = new ProjectCache()) {
36
+ this.projects = projects;
37
+ }
38
+ description = 'Find every component template that uses a component or directive (by className or selector) ' +
39
+ 'and report per host: template file, element occurrences with line, which of the target\'s ' +
40
+ 'inputs and outputs are bound or unbound, required inputs that are missing, and bindings no ' +
41
+ 'matched project directive declares (native events, library directives, typos). coverage ' +
42
+ 'lists per input/output which hosts bind it and which do not (e.g. "which hosts ignore ' +
43
+ '(formError)?"). Inputs/outputs come from @Input/@Output (aliases, required), signal input(), ' +
44
+ 'input.required(), model(), output(), decorator inputs/outputs arrays and base classes. Test ' +
45
+ 'hosts in spec files are skipped unless includeTestHosts. dynamicHosts lists places creating a ' +
46
+ 'component in code: any call or new whose parameter takes a component type (MatDialog.open, ' +
47
+ 'createComponent, ComponentPortal, project dialog wrappers), with sink, via (wrapper chain down ' +
48
+ 'to the library call), resolution (literal, variable, field, di-token, method-return, callback, ' +
49
+ 'selector, lazy-import, registry, promise), the other arguments (data) and what the caller does ' +
50
+ 'with the result (e.g. afterClosed.subscribe; a stored result shows the use that subscribes to it). Route entries (component, loadComponent) are ' +
51
+ 'dynamic hosts with route: path joined over children, guards, data, resolve, lazy. candidateHosts ' +
52
+ 'lists places that may create it: lookups in a component registry (e.g. dynamicComponents) whose ' +
53
+ 'selector comes from data (selectorExpression, selectorLiterals); a selector fixed by literals, a ' +
54
+ 'switch mapping or an equality guard is decided (dynamicHosts or nothing). includeDynamic: false ' +
55
+ 'skips both. ' +
56
+ 'For result and data flow of a dialog use trace-output-flow. For widely used components start with ' +
57
+ 'summaryOnly (counts per input/output only). summaryOnly drops the host list, ' +
58
+ 'maxResults caps it and the host names in coverage; counts (incl. coverage bound/unbound) always ' +
59
+ 'cover all hosts.';
60
+ inputSchema = {
61
+ type: 'object',
62
+ properties: {
63
+ className: {
64
+ type: 'string',
65
+ description: 'Class name of the component or directive. Give className or selector.',
66
+ },
67
+ selector: {
68
+ type: 'string',
69
+ description: 'Selector of the component or directive, e.g. "app-item" or "[appTooltip]". Give className or selector.',
70
+ },
71
+ file: {
72
+ type: 'string',
73
+ description: 'File declaring the class (absolute, or relative to projectRoot). Picks one of several same-name classes. Optional.',
74
+ },
75
+ projectRoot: {
76
+ type: 'string',
77
+ description: 'Absolute path to the project root. Must contain a tsconfig.json.',
78
+ },
79
+ includeOccurrences: {
80
+ type: 'boolean',
81
+ description: 'Include per-element occurrences with line and bindings. Default: true.',
82
+ default: true,
83
+ },
84
+ includeTestHosts: {
85
+ type: 'boolean',
86
+ description: 'Also report test host components declared in *.spec.ts / *.test.ts. Default: false.',
87
+ default: false,
88
+ },
89
+ includeDynamic: {
90
+ type: 'boolean',
91
+ description: 'Also find places creating the component in code (dialogs, createComponent, wrappers) as dynamicHosts. Default: true.',
92
+ default: true,
93
+ },
94
+ ...COMPACT_OUTPUT_SCHEMA,
95
+ },
96
+ required: ['projectRoot'],
97
+ };
98
+ async execute(args) {
99
+ const params = args;
100
+ if (!params.className && !params.selector) {
101
+ throw new Error('className or selector is required');
102
+ }
103
+ if (!params.projectRoot) {
104
+ throw new Error('projectRoot is required');
105
+ }
106
+ const compact = parseCompactOptions(args);
107
+ if (!existsSync(params.projectRoot)) {
108
+ throw new Error(`projectRoot does not exist: ${params.projectRoot}`);
109
+ }
110
+ const tsConfigPath = findTsConfig(params.projectRoot);
111
+ if (!tsConfigPath) {
112
+ throw new Error(`tsconfig.json not found in projectRoot: ${params.projectRoot}`);
113
+ }
114
+ const file = params.file === undefined || isAbsolute(params.file)
115
+ ? params.file
116
+ : resolve(params.projectRoot, params.file);
117
+ const finder = new ComponentHostFinder(this.projects.get(tsConfigPath), {
118
+ includeTestHosts: params.includeTestHosts === true,
119
+ includeDynamic: params.includeDynamic !== false,
120
+ });
121
+ const result = finder.findHosts({
122
+ ...(params.className ? { className: params.className } : {}),
123
+ ...(params.selector ? { selector: params.selector } : {}),
124
+ ...(file === undefined ? {} : { file }),
125
+ });
126
+ const { hosts, coverage, dynamicHosts, candidateHosts, ...rest } = result;
127
+ const summary = this.buildSummary(params, result);
128
+ if (compact.summaryOnly) {
129
+ return {
130
+ ...rest,
131
+ coverage: this.shapeCoverage(coverage, (c) => ({ bound: c.bound, unbound: c.unbound })),
132
+ truncated: false,
133
+ dynamicTruncated: false,
134
+ candidateTruncated: false,
135
+ summary,
136
+ tsConfigPath,
137
+ };
138
+ }
139
+ const includeOccurrences = params.includeOccurrences !== false;
140
+ const shown = limitList(hosts, compact.maxResults);
141
+ const shownDynamic = limitList(dynamicHosts, compact.maxResults);
142
+ const shownCandidates = limitList(candidateHosts, compact.maxResults);
143
+ const note = [
144
+ truncationNote(shown.items.length, hosts.length, 'hosts'),
145
+ truncationNote(shownDynamic.items.length, dynamicHosts.length, 'dynamic hosts'),
146
+ truncationNote(shownCandidates.items.length, candidateHosts.length, 'candidate hosts'),
147
+ ]
148
+ .filter((n) => n !== undefined)
149
+ .join('\n');
150
+ const cappedCoverage = this.shapeCoverage(coverage, (c) => ({
151
+ ...c,
152
+ boundIn: limitList(c.boundIn, compact.maxResults).items,
153
+ unboundIn: limitList(c.unboundIn, compact.maxResults).items,
154
+ }));
155
+ return {
156
+ ...rest,
157
+ coverage: cappedCoverage,
158
+ hosts: shown.items.map((h) => {
159
+ if (includeOccurrences) {
160
+ return h;
161
+ }
162
+ const { occurrences: _dropped, ...host } = h;
163
+ return host;
164
+ }),
165
+ truncated: shown.truncated,
166
+ dynamicHosts: shownDynamic.items,
167
+ dynamicTruncated: shownDynamic.truncated,
168
+ candidateHosts: shownCandidates.items,
169
+ candidateTruncated: shownCandidates.truncated,
170
+ summary: note ? `${note}\n${summary}` : summary,
171
+ tsConfigPath,
172
+ };
173
+ }
174
+ buildSummary(params, result) {
175
+ const target = result.target;
176
+ if (target === undefined) {
177
+ const wanted = params.className ?? params.selector ?? '';
178
+ return (`No project component or directive matches '${wanted}'. Only classes with @Component, ` +
179
+ '@ExportComponent or @Directive and a selector in the tsconfig program are known; library ' +
180
+ 'components are not. Check the name with find-angular-symbol.');
181
+ }
182
+ const lines = [
183
+ `${target.className} (${target.selector}): ${result.counts.hosts} host(s), ` +
184
+ `${result.counts.occurrences} occurrence(s) in ${result.counts.templatesScanned} candidate template(s).`,
185
+ ];
186
+ if (result.alternatives.length > 0) {
187
+ lines.push(` Also matched: ${result.alternatives.map((a) => `${a.className} (${a.file})`).join(', ')}. ` +
188
+ 'Pass file to pick one.');
189
+ }
190
+ for (const [kind, coverage] of [
191
+ ['input', result.coverage.inputs],
192
+ ['output', result.coverage.outputs],
193
+ ]) {
194
+ for (const [name, c] of Object.entries(coverage)) {
195
+ const unbound = c.unbound > 0 ? `, not in ${c.unbound} (${this.nameList(c.unboundIn)})` : '';
196
+ lines.push(` ${kind} ${name}: bound in ${c.bound}${unbound}`);
197
+ }
198
+ }
199
+ if (result.counts.occurrencesMissingRequired > 0) {
200
+ lines.push(` ${result.counts.occurrencesMissingRequired} occurrence(s) miss a required input.`);
201
+ }
202
+ if (result.counts.dynamicHosts > 0) {
203
+ lines.push(` Created in code at ${result.counts.dynamicHosts} place(s): ${this.sinkList(result.dynamicHosts)}.`);
204
+ }
205
+ const routes = result.dynamicHosts.filter((h) => h.route !== undefined);
206
+ if (routes.length > 0) {
207
+ lines.push(` Routes: ${this.nameList(routes.map((h) => `/${h.route?.path ?? ''}${h.route?.lazy === true ? ' (lazy)' : ''}`))}.`);
208
+ }
209
+ if (result.counts.candidateHosts > 0) {
210
+ const expressions = [...new Set(result.candidateHosts.map((h) => h.selectorExpression ?? '?'))];
211
+ lines.push(` May be created at ${result.counts.candidateHosts} more place(s) through a component registry with a ` +
212
+ `selector from data (${this.nameList(expressions)}).`);
213
+ }
214
+ if (result.counts.hosts === 0 && result.counts.dynamicHosts === 0 && result.counts.candidateHosts === 0) {
215
+ lines.push(params.includeDynamic === false
216
+ ? ' No template uses it. It may be created in code; run again without includeDynamic: false.'
217
+ : ' No template uses it and no creation in code, route or registry lookup was found; ' +
218
+ 'check with find-usages.');
219
+ }
220
+ return lines.join('\n');
221
+ }
222
+ shapeCoverage(coverage, shape) {
223
+ const map = (entries) => Object.fromEntries(Object.entries(entries).map(([name, c]) => [name, shape(c)]));
224
+ return { inputs: map(coverage.inputs), outputs: map(coverage.outputs) };
225
+ }
226
+ /** `SobSolDialog.open 24, new SobSolDialogRef 2` */
227
+ sinkList(hosts) {
228
+ const counts = new Map();
229
+ for (const h of hosts) {
230
+ counts.set(h.sink, (counts.get(h.sink) ?? 0) + 1);
231
+ }
232
+ const sorted = [...counts.entries()].sort((a, b) => b[1] - a[1]).map(([sink, n]) => `${sink} ${n}`);
233
+ return this.nameList(sorted);
234
+ }
235
+ nameList(names) {
236
+ const shown = names.slice(0, SUMMARY_MAX_NAMES).join(', ');
237
+ return names.length > SUMMARY_MAX_NAMES ? `${shown}, +${names.length - SUMMARY_MAX_NAMES} more` : shown;
238
+ }
239
+ }
240
+ //# sourceMappingURL=find-component-hosts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-component-hosts.js","sourceRoot":"","sources":["../../src/tools/find-component-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EACL,mBAAmB,GAKpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,mBAAmB,EACnB,cAAc,GACf,MAAM,6BAA6B,CAAC;AAErC,8DAA8D;AAC9D,MAAM,iBAAiB,GAAG,CAAC,CAAC;AA2E5B;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAGJ;IAFpB,IAAI,GAAG,sBAAsB,CAAC;IAEvC,YAA6B,WAAyB,IAAI,YAAY,EAAE;QAA3C,aAAQ,GAAR,QAAQ,CAAmC;IAAG,CAAC;IAEnE,WAAW,GAClB,8FAA8F;QAC9F,4FAA4F;QAC5F,6FAA6F;QAC7F,0FAA0F;QAC1F,wFAAwF;QACxF,+FAA+F;QAC/F,8FAA8F;QAC9F,gGAAgG;QAChG,6FAA6F;QAC7F,iGAAiG;QACjG,iGAAiG;QACjG,iGAAiG;QACjG,kJAAkJ;QAClJ,mGAAmG;QACnG,kGAAkG;QAClG,mGAAmG;QACnG,kGAAkG;QAClG,cAAc;QACd,oGAAoG;QACpG,+EAA+E;QAC/E,kGAAkG;QAClG,kBAAkB,CAAC;IAEZ,WAAW,GAAG;QACrB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAA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AC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;QACpG,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAEO,QAAQ,CAAC,KAAe;QAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,KAAK,CAAC,MAAM,GAAG,iBAAiB,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1G,CAAC;CACF"}
@@ -18,18 +18,23 @@
18
18
  */
19
19
  import { type MCPTool } from '../types.js';
20
20
  import { type SymbolUsage, type UsageType } from '@angular-modernizer/api';
21
+ import { ProjectCache } from './helpers/project-cache.js';
21
22
  /**
22
23
  * Output of the find-usages tool.
23
24
  */
24
25
  interface FindUsagesOutput {
25
- /** All matching usages. */
26
- usages: SymbolUsage[];
27
- /** Total number of usages found. */
26
+ /** Matching usages, cut to `maxResults`; omitted with `summaryOnly`. */
27
+ usages?: SymbolUsage[];
28
+ /** Total number of usages found (before `maxResults`). */
28
29
  totalCount: number;
30
+ /** `true` when `maxResults` cut the usage list. */
31
+ truncated: boolean;
29
32
  /** Human-readable summary for LLM consumption. */
30
33
  summary: string;
31
34
  /** Usage counts per usage type. */
32
35
  countsByType: Partial<Record<UsageType, number>>;
36
+ /** Usage counts per directory (up to 3 levels below projectRoot), largest first. */
37
+ countsByDirectory: Record<string, number>;
33
38
  /** The tsconfig whose program was searched. */
34
39
  tsConfigPath: string;
35
40
  }
@@ -37,11 +42,22 @@ interface FindUsagesOutput {
37
42
  * MCP tool that finds all references to a named symbol across a TypeScript project.
38
43
  */
39
44
  export declare class FindUsagesTool implements MCPTool {
45
+ private readonly projects;
40
46
  readonly name = "find-usages";
47
+ constructor(projects?: ProjectCache);
41
48
  readonly description: string;
42
49
  readonly inputSchema: {
43
50
  type: string;
44
51
  properties: {
52
+ summaryOnly: {
53
+ readonly type: "boolean";
54
+ readonly description: "Return counts and the text summary only, without the result list. Default: false.";
55
+ readonly default: false;
56
+ };
57
+ maxResults: {
58
+ readonly type: "number";
59
+ readonly description: string;
60
+ };
45
61
  symbol: {
46
62
  type: string;
47
63
  description: string;
@@ -71,6 +87,7 @@ export declare class FindUsagesTool implements MCPTool {
71
87
  required: string[];
72
88
  };
73
89
  execute(args: Record<string, unknown>): Promise<FindUsagesOutput>;
90
+ private buildCompactSummary;
74
91
  private buildSummary;
75
92
  }
76
93
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"find-usages.d.ts","sourceRoot":"","sources":["../../src/tools/find-usages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,yBAAyB,CAAC;AAkCjC;;GAEG;AACH,UAAU,gBAAgB;IACxB,2BAA2B;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IAEtB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAEhB,mCAAmC;IACnC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IAEjD,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,CAAC,IAAI,iBAAiB;IAE9B,QAAQ,CAAC,WAAW,SAUK;IAEzB,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoClB;IAEI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,gBAAgB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