Skip to content

Commit 632cb66

Browse files
committed
refactor: restructure project to src/mcp/tools and src/mcp/resources
Complete folder reorganization to better reflect MCP architecture: - Move src/plugins → src/mcp/tools (15 workflow directories) - Move src/resources → src/mcp/resources (MCP resources) - Update all import paths throughout codebase and tests - Update build plugin discovery paths for new structure - All 1585 tests passing, build successful This completes the MCP resources implementation by organizing tools and resources under a unified src/mcp structure.
1 parent e6db185 commit 632cb66

290 files changed

Lines changed: 492 additions & 436 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build-plugins/plugin-discovery.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function createPluginDiscoveryPlugin() {
2121
}
2222

2323
async function generateWorkflowLoaders() {
24-
const pluginsDir = path.resolve(process.cwd(), 'src/plugins');
24+
const pluginsDir = path.resolve(process.cwd(), 'src/mcp/tools');
2525

2626
if (!existsSync(pluginsDir)) {
2727
throw new Error(`Plugins directory not found: ${pluginsDir}`);
@@ -92,7 +92,7 @@ async function generateWorkflowLoaders() {
9292
function generateWorkflowLoader(workflowName, toolFiles) {
9393
const toolImports = toolFiles.map((file, index) => {
9494
const toolName = file.replace(/\.(ts|js)$/, '');
95-
return `const tool_${index} = await import('../plugins/${workflowName}/${toolName}.js').then(m => m.default)`;
95+
return `const tool_${index} = await import('../mcp/tools/${workflowName}/${toolName}.js').then(m => m.default)`;
9696
}).join(';\n ');
9797

9898
const toolExports = toolFiles.map((file, index) => {
@@ -101,7 +101,7 @@ function generateWorkflowLoader(workflowName, toolFiles) {
101101
}).join(',\n ');
102102

103103
return `async () => {
104-
const { workflow } = await import('../plugins/${workflowName}/index.js');
104+
const { workflow } = await import('../mcp/tools/${workflowName}/index.js');
105105
${toolImports ? toolImports + ';\n ' : ''}
106106
return {
107107
workflow,
@@ -226,7 +226,7 @@ ${metadataEntries}
226226
}
227227

228228
async function generateResourceLoaders() {
229-
const resourcesDir = path.resolve(process.cwd(), 'src/resources');
229+
const resourcesDir = path.resolve(process.cwd(), 'src/mcp/resources');
230230

231231
if (!existsSync(resourcesDir)) {
232232
console.log('Resources directory not found, skipping resource generation');
@@ -251,7 +251,7 @@ async function generateResourceLoaders() {
251251

252252
// Generate dynamic loader for this resource
253253
resourceLoaders[resourceName] = `async () => {
254-
const module = await import('../resources/${resourceName}.js');
254+
const module = await import('../mcp/resources/${resourceName}.js');
255255
return module.default;
256256
}`;
257257

src/resources/__tests__/simulators.test.ts renamed to src/mcp/resources/__tests__/simulators.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, it, expect, beforeEach } from 'vitest';
22
import { z } from 'zod';
33

44
import simulatorsResource from '../simulators.js';
5-
import { createMockExecutor } from '../../utils/command.js';
5+
import { createMockExecutor } from '../../../utils/command.js';
66

77
describe('simulators resource', () => {
88
describe('Export Field Validation', () => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* This resource reuses the existing list_sims tool logic to maintain consistency.
66
*/
77

8-
import { log, getDefaultCommandExecutor, CommandExecutor } from '../utils/index.js';
9-
import { list_simsLogic } from '../plugins/simulator-shared/list_sims.js';
8+
import { log, getDefaultCommandExecutor, CommandExecutor } from '../../utils/index.js';
9+
import { list_simsLogic } from '../tools/simulator-shared/list_sims.js';
1010

1111
export default {
1212
uri: 'mcp://xcodebuild/simulators',

src/plugins/device-project/__tests__/build_dev_proj.test.ts renamed to src/mcp/tools/device-project/__tests__/build_dev_proj.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { describe, it, expect } from 'vitest';
8-
import { createMockExecutor, createNoopExecutor } from '../../../utils/command.js';
8+
import { createMockExecutor, createNoopExecutor } from '../../../../utils/command.js';
99
import buildDevProj, { build_dev_projLogic } from '../build_dev_proj.ts';
1010

1111
describe('build_dev_proj plugin', () => {

src/plugins/device-project/__tests__/get_device_app_path_proj.test.ts renamed to src/mcp/tools/device-project/__tests__/get_device_app_path_proj.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { describe, it, expect } from 'vitest';
8-
import { createMockExecutor } from '../../../utils/command.js';
8+
import { createMockExecutor } from '../../../../utils/command.js';
99
import getDeviceAppPathProj, {
1010
get_device_app_path_projLogic,
1111
} from '../get_device_app_path_proj.ts';
File renamed without changes.

src/plugins/device-project/__tests__/install_app_device.test.ts renamed to src/mcp/tools/device-project/__tests__/install_app_device.test.ts

File renamed without changes.

src/plugins/device-project/__tests__/launch_app_device.test.ts renamed to src/mcp/tools/device-project/__tests__/launch_app_device.test.ts

File renamed without changes.

src/plugins/device-project/__tests__/list_devices.test.ts renamed to src/mcp/tools/device-project/__tests__/list_devices.test.ts

File renamed without changes.

src/plugins/device-project/__tests__/re-exports.test.ts renamed to src/mcp/tools/device-project/__tests__/re-exports.test.ts

File renamed without changes.

0 commit comments

Comments
 (0)