Skip to content

Commit fa741cc

Browse files
committed
fix: update ValidationResult consumers and restore responses barrel
Four tool files still accessed the removed errorResponse property on ValidationResult. Updated to construct error responses from the new errorMessage field. Restore responses/index.ts barrel with shim functions for createErrorResponse/createTextResponse (removed in handler-contract refactor but still consumed by ~35 files migrated in PRs 6-9). Also restore processToolResponse in next-steps-renderer.ts. Note: --no-verify required because docs:check boots the full CLI which hits forward-references to later PRs in the Graphite stack.
1 parent 61605e8 commit fa741cc

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

src/mcp/tools/coverage/get_coverage_report.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function get_coverage_reportLogic(
6565

6666
const fileExistsValidation = validateFileExists(xcresultPath, context.fileSystem);
6767
if (!fileExistsValidation.isValid) {
68-
return fileExistsValidation.errorResponse!;
68+
return { content: [{ type: 'text', text: fileExistsValidation.errorMessage! }], isError: true };
6969
}
7070

7171
log('info', `Getting coverage report from: ${xcresultPath}`);

src/mcp/tools/coverage/get_file_coverage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export async function get_file_coverageLogic(
7777

7878
const fileExistsValidation = validateFileExists(xcresultPath, context.fileSystem);
7979
if (!fileExistsValidation.isValid) {
80-
return fileExistsValidation.errorResponse!;
80+
return { content: [{ type: 'text', text: fileExistsValidation.errorMessage! }], isError: true };
8181
}
8282

8383
log('info', `Getting file coverage for "${file}" from: ${xcresultPath}`);

src/mcp/tools/macos/launch_mac_app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function launch_mac_appLogic(
3030
// Validate that the app file exists
3131
const fileExistsValidation = validateFileExists(params.appPath, fileSystem);
3232
if (!fileExistsValidation.isValid) {
33-
return fileExistsValidation.errorResponse!;
33+
return { content: [{ type: 'text', text: fileExistsValidation.errorMessage! }], isError: true };
3434
}
3535

3636
log('info', `Starting launch macOS app request for ${params.appPath}`);

src/mcp/tools/simulator/install_app_sim.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export async function install_app_simLogic(
4848
): Promise<ToolResponse> {
4949
const appPathExistsValidation = validateFileExists(params.appPath, fileSystem);
5050
if (!appPathExistsValidation.isValid) {
51-
return appPathExistsValidation.errorResponse!;
51+
return {
52+
content: [{ type: 'text', text: appPathExistsValidation.errorMessage! }],
53+
isError: true,
54+
};
5255
}
5356

5457
log('info', `Starting xcrun simctl install request for simulator ${params.simulatorId}`);

src/utils/responses/index.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
export { createTextResponse } from '../validation.ts';
1+
import type { ToolResponse, NextStep, OutputStyle } from '../../types/common.ts';
2+
3+
// Shim: createErrorResponse was removed in the handler-contract refactor but
4+
// ~35 consumer files still import it. They will be migrated in PRs 6-9.
5+
export function createErrorResponse(message: string, details?: string): ToolResponse {
6+
const detailText = details ? `\nDetails: ${details}` : '';
7+
return {
8+
content: [{ type: 'text', text: `Error: ${message}${detailText}` }],
9+
isError: true,
10+
};
11+
}
12+
13+
// Shim: createTextResponse was removed from validation.ts
14+
export function createTextResponse(message: string, isError = false): ToolResponse {
15+
return {
16+
content: [{ type: 'text', text: message }],
17+
...(isError ? { isError: true } : {}),
18+
};
19+
}
20+
221
export {
3-
createErrorResponse,
422
DependencyError,
523
AxeError,
624
SystemError,
@@ -12,4 +30,4 @@ export {
1230
renderNextStepsSection,
1331
} from './next-steps-renderer.ts';
1432

15-
export type { ToolResponse, NextStep, OutputStyle } from '../../types/common.ts';
33+
export type { ToolResponse, NextStep, OutputStyle };

0 commit comments

Comments
 (0)