Skip to content

Commit 0e6e86d

Browse files
committed
refactor(@angular/cli): remove unused resolveModule method from Host abstraction
Remove the `resolveModule` method from the `Host` interface, `LocalWorkspaceHost`, and `MockHost`. This method was not used by any of the MCP tools or server implementation, and removing it simplifies the abstraction layer.
1 parent 098bb00 commit 0e6e86d

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

packages/angular/cli/src/commands/mcp/host.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@ export interface Host {
7171
options: { cwd: string },
7272
): AsyncIterable<{ name: string; parentPath: string; isFile(): boolean }>;
7373

74-
/**
75-
* Resolves a module request from a given path.
76-
* @param request The module request to resolve.
77-
* @param from The path from which to resolve the request.
78-
* @returns The resolved module path.
79-
*/
80-
resolveModule(request: string, from: string): string;
8174

8275
/**
8376
* Spawns a child process and returns a promise that resolves with the process's
@@ -178,10 +171,6 @@ export const LocalWorkspaceHost: Host = {
178171
return nodeGlob(pattern, { ...options, withFileTypes: true });
179172
},
180173

181-
resolveModule(request: string, from: string): string {
182-
return createRequire(from).resolve(request);
183-
},
184-
185174
runCommand: async (
186175
command: string,
187176
args: readonly string[],
@@ -356,6 +345,7 @@ export function createRootRestrictedHost(
356345
if (command.includes('/') || command.includes('\\')) {
357346
checkPath(resolve(effectiveCwd, command));
358347
}
348+
359349
return baseHost.runCommand(command, args, options);
360350
},
361351
spawn(command: string, args: readonly string[], options: { cwd?: string } = {}) {
@@ -364,6 +354,7 @@ export function createRootRestrictedHost(
364354
if (command.includes('/') || command.includes('\\')) {
365355
checkPath(resolve(effectiveCwd, command));
366356
}
357+
367358
return baseHost.spawn(command, args, options);
368359
},
369360
};

packages/angular/cli/src/commands/mcp/testing/mock-host.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export class MockHost implements Host {
1717
stat = jasmine.createSpy('stat');
1818
existsSync = jasmine.createSpy('existsSync');
1919
readFile = jasmine.createSpy('readFile').and.resolveTo('');
20-
glob = jasmine.createSpy('glob').and.returnValue((async function* () {})());
21-
resolveModule = jasmine.createSpy('resolveRequest').and.returnValue('/dev/null');
20+
glob = jasmine.createSpy('glob').and.returnValue((async function* () { })());
2221
spawn = jasmine.createSpy('spawn');
2322
getAvailablePort = jasmine.createSpy('getAvailablePort');
2423
isPortAvailable = jasmine.createSpy('isPortAvailable').and.resolveTo(true);

0 commit comments

Comments
 (0)