MCPcopy Create free account
hub / github.com/HKUDS/AgentSpace / checkCommand

Function checkCommand

packages/daemon/src/runtime-apps.ts:75–95  ·  view source on GitHub ↗
(command: string, args: string[])

Source from the content-addressed store, hash-verified

73}
74
75function checkCommand(command: string, args: string[]): RuntimeAppReadinessItem {
76 const result = spawnSync(command, args, {
77 env: process.env,
78 encoding: "utf8",
79 timeout: 5_000,
80 });
81 if (result.error) {
82 return { available: false, error: result.error.message };
83 }
84 if (result.status !== 0) {
85 return {
86 available: false,
87 error: tailAndRedact(`${result.stderr || result.stdout || `${command} exited with code ${result.status}`}`),
88 };
89 }
90 const version = `${result.stdout ?? ""}\n${result.stderr ?? ""}`.trim().split(/\r?\n/)[0]?.trim();
91 return {
92 available: true,
93 version: version || undefined,
94 };
95}
96
97function execCommand(command: RuntimeAppCommandPlanItem): Promise<{ stdout: string; stderr: string }> {
98 return new Promise((resolve, reject) => {

Callers 1

readCliHubReadinessFunction · 0.85

Calls 1

tailAndRedactFunction · 0.85

Tested by

no test coverage detected