MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / run

Function run

scripts/web-env/shared.ts:85–119  ·  view source on GitHub ↗
(
  command: string,
  args: string[],
  options: {
    cwd?: string;
    env?: NodeJS.ProcessEnv;
    input?: string;
    includeFailureOutput?: boolean;
  } = {}
)

Source from the content-addressed store, hash-verified

83
84// Thrown when a required executable is absent. Its message already carries the
85// full install/verify guidance, so callers rethrow it as-is instead of wrapping
86// it in a provider-access error (which would repeat the same instructions).
87class MissingCommandError extends Error {}
88
89// `pnpm exec` exits non-zero, rather than failing with ENOENT, when the command
90// exists but the workspace install does not provide the binary.
91const PNPM_MISSING_WORKSPACE_VERCEL = /Command "vercel" not found/;
92
93function missingWorkspaceVercelMessage(): string {
94 return [
95 'The workspace does not provide the Vercel CLI.',
96 `Run \`pnpm install --frozen-lockfile\` in the checkout, then verify access with \`${VERCEL_COMMAND} whoami --scope kilocode --format=json\`.`,
97 ].join('\n');
98}
99
100export function run(
101 command: string,
102 args: string[],
103 options: {
104 cwd?: string;
105 env?: NodeJS.ProcessEnv;
106 input?: string;
107 includeFailureOutput?: boolean;
108 } = {}
109): string {
110 const result = spawnSync(command, args, {
111 cwd: options.cwd,
112 env: options.env,
113 input: options.input,
114 encoding: 'utf8',
115 stdio: ['pipe', 'pipe', 'pipe'],
116 maxBuffer: 10 * 1024 * 1024,
117 });
118 if (errorCode(result.error) === 'ENOENT') {
119 const message = missingCommandMessage(command, args);
120 if (message) throw new MissingCommandError(message);
121 }
122 if (

Callers 7

vercelFunction · 0.70
resolveVaultFunction · 0.70
findVaultItemFunction · 0.70
setVaultValueFunction · 0.70
trackedEnvFilesFunction · 0.70
runSetupCommandsFunction · 0.50

Calls 3

missingCommandMessageFunction · 0.85
joinMethod · 0.80
errorCodeFunction · 0.70

Tested by

no test coverage detected