From 5779774a9203f3b4c8f9fc8a684ae7af6bca9343 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:58:35 +0000 Subject: [PATCH] feat: add custom runtime type with command and args fields - Add 'custom' as valid runtime type - Add required command and args fields for custom runtime - Update validation in pr-check.js - Add custom runtime support in ConfigManager - Update type definitions and interfaces Co-Authored-By: Michael Latman --- src/scripts/pr-check.js | 6 +++++- src/types/package.ts | 4 +++- src/utils/config-manager.ts | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/scripts/pr-check.js b/src/scripts/pr-check.js index b835c0f..00deefa 100644 --- a/src/scripts/pr-check.js +++ b/src/scripts/pr-check.js @@ -12,7 +12,7 @@ const octokit = new Octokit({ }); const REQUIRED_FIELDS = ['name', 'description', 'vendor', 'sourceUrl', 'homepage', 'license', 'runtime']; -const VALID_RUNTIMES = ['node', 'python']; +const VALID_RUNTIMES = ['node', 'python', 'custom']; async function validatePackages() { const packageListPath = path.join(__dirname, '../../packages/package-list.json'); @@ -110,6 +110,10 @@ export function validateRuntime(pkg) { if (!VALID_RUNTIMES.includes(pkg.runtime)) { throw new Error(`Package ${pkg.name} has invalid runtime: ${pkg.runtime}. Must be one of: ${VALID_RUNTIMES.join(', ')}`); } + + if (pkg.runtime === 'custom' && (!pkg.command || !pkg.args)) { + throw new Error(`Package ${pkg.name} with custom runtime must include both 'command' and 'args' fields`); + } } async function validatePackagePublication(pkg) { diff --git a/src/types/package.ts b/src/types/package.ts index 43308e6..32955c1 100644 --- a/src/types/package.ts +++ b/src/types/package.ts @@ -1,11 +1,13 @@ export interface Package { name: string; description: string; - runtime: 'node' | 'python'; + runtime: 'node' | 'python' | 'custom'; vendor: string; sourceUrl: string; homepage: string; license: string; + command?: string; // Required when runtime is 'custom' + args?: string[]; // Required when runtime is 'custom' } export interface ResolvedPackage extends Package { diff --git a/src/utils/config-manager.ts b/src/utils/config-manager.ts index 6d19755..e21733d 100644 --- a/src/utils/config-manager.ts +++ b/src/utils/config-manager.ts @@ -4,7 +4,7 @@ import os from 'os'; import { Package } from '../types/package.js'; export interface MCPServer { - runtime: 'node' | 'python'; + runtime: 'node' | 'python' | 'custom'; command?: string; args?: string[]; env?: Record; @@ -119,6 +119,12 @@ export class ConfigManager { } else if (pkg.runtime === 'python') { serverConfig.command = 'uvx'; serverConfig.args = [pkg.name]; + } else if (pkg.runtime === 'custom') { + if (!pkg.command || !pkg.args) { + throw new Error('Custom runtime requires both command and args fields'); + } + serverConfig.command = pkg.command; + serverConfig.args = pkg.args; } config.mcpServers[serverName] = serverConfig;