Skip to content

Commit b7e9fab

Browse files
committed
refactor: complete focused facade architecture implementation
## Summary - Finalize the focused facade architecture by fixing remaining inconsistent imports - Remove the deprecated utils/index.ts barrel file completely - Ensure all imports use proper focused facades throughout the codebase ## Changes Made ### Import Consistency Fixes - Fix build_device.ts to use utils/build/index.ts instead of direct build-utils.ts import - Fix test-common.ts to use utils/build/index.ts for executeXcodeBuildCommand import - Update test files to use utils/responses/index.ts for SystemError imports instead of barrel - Update scaffold project files to use proper focused facades for dynamic imports ### Architecture Completion - **REMOVED**: src/utils/index.ts - deprecated barrel file completely deleted - All imports now consistently use focused facades (build/, responses/, execution/, etc.) - No more barrel imports anywhere in the codebase ## Technical Benefits - **Improved tree-shaking**: Bundlers can better eliminate unused code - **Clearer dependencies**: Import paths explicitly show what functionality is needed - **Prevention of circular dependencies**: Focused facades reduce coupling risks - **Better performance**: Eliminates loading of unused modules during startup - **Architectural consistency**: Single pattern enforced across entire codebase ## Validation - ✅ TypeScript compilation: No errors - ✅ ESLint: Only 1 minor unrelated warning - ✅ Prettier: All files properly formatted - ✅ Tests: 1046 tests passing - ✅ Build: Successful compilation with all tools working The focused facade architecture is now fully implemented and enforced.
1 parent 21c65b9 commit b7e9fab

7 files changed

Lines changed: 6 additions & 28 deletions

File tree

src/mcp/tools/device/build_device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { z } from 'zod';
99
import { ToolResponse, XcodePlatform } from '../../../types/common.ts';
10-
import { executeXcodeBuildCommand } from '../../../utils/build-utils.ts';
10+
import { executeXcodeBuildCommand } from '../../../utils/build/index.ts';
1111
import type { CommandExecutor } from '../../../utils/execution/index.ts';
1212
import { getDefaultCommandExecutor } from '../../../utils/execution/index.ts';
1313
import { createTypedTool } from '../../../utils/typed-tool-factory.ts';

src/mcp/tools/project-scaffolding/__tests__/scaffold_macos_project.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe('scaffold_macos_project plugin', () => {
192192

193193
// Restore original TemplateManager for command generation tests
194194
const { TemplateManager: OriginalTemplateManager } = await import(
195-
'../../../../utils/index.js'
195+
'../../../../utils/template/index.ts'
196196
);
197197
(TemplateManager as any).getTemplatePath = OriginalTemplateManager.getTemplatePath;
198198
(TemplateManager as any).cleanup = OriginalTemplateManager.cleanup;

src/mcp/tools/project-scaffolding/scaffold_ios_project.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,8 @@ async function scaffoldProject(
456456
// Get template path from TemplateManager
457457
let templatePath;
458458
try {
459-
// Import the default command executor if not provided
459+
// Use the default command executor if not provided
460460
if (!commandExecutor) {
461-
const { getDefaultCommandExecutor } = await import('../../../utils/index.js');
462461
commandExecutor = getDefaultCommandExecutor();
463462
}
464463

src/mcp/tools/simulator/__tests__/screenshot.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
createMockFileSystemExecutor,
1212
createCommandMatchingMockExecutor,
1313
} from '../../../../test-utils/mock-executors.ts';
14+
import { SystemError } from '../../../../utils/responses/index.ts';
1415
import screenshotPlugin, { screenshotLogic } from '../../ui-testing/screenshot.ts';
1516

1617
describe('screenshot plugin', () => {
@@ -444,7 +445,6 @@ describe('screenshot plugin', () => {
444445
});
445446

446447
it('should handle SystemError exceptions', async () => {
447-
const { SystemError } = await import('../../../../utils/index.js');
448448
const mockExecutor = createMockExecutor(new SystemError('System error occurred'));
449449

450450
const mockPathDeps = {

src/mcp/tools/ui-testing/__tests__/screenshot.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
createMockFileSystemExecutor,
1010
createNoopExecutor,
1111
} from '../../../../test-utils/mock-executors.ts';
12+
import { SystemError } from '../../../../utils/responses/index.ts';
1213
import screenshotPlugin, { screenshotLogic } from '../screenshot.ts';
1314

1415
describe('Screenshot Plugin', () => {
@@ -388,7 +389,6 @@ describe('Screenshot Plugin', () => {
388389

389390
it('should handle SystemError from command execution', async () => {
390391
const mockExecutor = async () => {
391-
const SystemError = (await import('../../../../utils/index.js')).SystemError;
392392
throw new SystemError('System error occurred');
393393
};
394394

src/utils/index.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/utils/test-common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { tmpdir } from 'os';
1919
import { join } from 'path';
2020
import { log } from './logger.ts';
2121
import { XcodePlatform } from './xcode.ts';
22-
import { executeXcodeBuildCommand } from './build-utils.ts';
22+
import { executeXcodeBuildCommand } from './build/index.ts';
2323
import { createTextResponse, consolidateContentForClaudeCode } from './validation.ts';
2424
import { ToolResponse } from '../types/common.ts';
2525
import { CommandExecutor, getDefaultCommandExecutor } from './command.ts';

0 commit comments

Comments
 (0)