MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cli

Function cli

graph-ui/tools/smoke-w4b.mjs:175–186  ·  view source on GitHub ↗

Ein Werkzeug ueber die CLI, mit dem HOME dieses Laufs.

(tool, payload, home)

Source from the content-addressed store, hash-verified

173
174/** Ein Werkzeug ueber die CLI, mit dem HOME dieses Laufs. */
175async function cli(tool, payload, home) {
176 const result = await run(BINARY, ['cli', tool], { env: { HOME: home }, stdin: `${JSON.stringify(payload)}\n` });
177 const line = result.out.split('\n').map((entry) => entry.trim()).filter(Boolean).pop();
178 if (result.code !== 0 || line === undefined) {
179 throw new Error(`cli ${tool} endete mit ${result.code}: ${result.err.trim().slice(-400)}`);
180 }
181 try {
182 return JSON.parse(line);
183 } catch {
184 throw new Error(`cli ${tool} lieferte kein JSON: ${line.slice(0, 400)}`);
185 }
186}
187
188/** Der qualifizierte Name, unter dem der Index ein Symbol dieses Projekts fuehrt. */
189const qn = (suffix) => `${PROJECT}.${suffix}`;

Callers 1

mainFunction · 0.70

Calls 1

runFunction · 0.70

Tested by

no test coverage detected