MCPcopy
hub / github.com/ValueCell-ai/ClawX / generateCompletionCache

Function generateCompletionCache

electron/utils/openclaw-cli.ts:346–377  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

344}
345
346export function generateCompletionCache(): void {
347 if (!app.isPackaged) return;
348
349 const entryPath = getOpenClawEntryPath();
350 if (!existsSync(entryPath)) return;
351
352 const execPath = getNodeExecForCli();
353
354 const child = spawn(execPath, [entryPath, 'completion', '--write-state'], {
355 env: {
356 ...process.env,
357 ELECTRON_RUN_AS_NODE: '1',
358 OPENCLAW_NO_RESPAWN: '1',
359 OPENCLAW_EMBEDDED_IN: 'ClawX',
360 },
361 stdio: 'ignore',
362 detached: false,
363 windowsHide: true,
364 });
365
366 child.on('close', (code) => {
367 if (code === 0) {
368 logger.info('OpenClaw completion cache generated');
369 } else {
370 logger.warn(`OpenClaw completion cache generation exited with code ${code}`);
371 }
372 });
373
374 child.on('error', (err) => {
375 logger.warn('Failed to generate completion cache:', err);
376 });
377}
378
379export function installCompletionToProfile(): void {
380 if (!app.isPackaged) return;

Callers 1

initializeFunction · 0.90

Calls 3

getOpenClawEntryPathFunction · 0.90
getNodeExecForCliFunction · 0.85
onMethod · 0.65

Tested by

no test coverage detected