MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / pickInterpreter

Function pickInterpreter

src/tools/shell/code-run.ts:65–89  ·  view source on GitHub ↗
(lang: string)

Source from the content-addressed store, hash-verified

63}
64
65function pickInterpreter(lang: string): InterpreterInfo {
66 switch (lang) {
67 case 'python':
68 case 'python3':
69 return { cmd: 'python3', args: f => [f], extension: 'py' };
70 case 'node':
71 case 'javascript':
72 case 'js':
73 return { cmd: 'node', args: f => [f], extension: 'js' };
74 case 'typescript':
75 case 'ts':
76 // Prefer tsx if available — set later via fallback detection
77 return { cmd: 'node', args: f => ['--experimental-strip-types', f], extension: 'ts' };
78 case 'bash':
79 case 'sh':
80 return { cmd: 'bash', args: f => [f], extension: 'sh' };
81 case 'php':
82 return { cmd: 'php', args: f => [f], extension: 'php' };
83 case 'ruby':
84 case 'rb':
85 return { cmd: 'ruby', args: f => [f], extension: 'rb' };
86 default:
87 throw new Error(`Unsupported language: ${lang}`);
88 }
89}
90
91/** Check if a binary is on PATH. */
92async function which(cmd: string): Promise<string | null> {

Callers 1

executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected