MCPcopy Index your code
hub / github.com/tiann/hapi / cursorLocal

Function cursorLocal

cli/src/cursor/cursorLocal.ts:22–76  ·  view source on GitHub ↗
(opts: {
    abort: AbortSignal;
    chatId: string | null;
    path: string;
    model?: string;
    mode?: 'plan' | 'ask' | 'debug';
    yolo?: boolean;
    onChatFound?: (chatId: string) => void;
    cursorArgs?: string[];
})

Source from the content-addressed store, hash-verified

20}
21
22export async function cursorLocal(opts: {
23 abort: AbortSignal;
24 chatId: string | null;
25 path: string;
26 model?: string;
27 mode?: 'plan' | 'ask' | 'debug';
28 yolo?: boolean;
29 onChatFound?: (chatId: string) => void;
30 cursorArgs?: string[];
31}): Promise<void> {
32 const args: string[] = [];
33
34 if (opts.chatId) {
35 args.push('--resume', opts.chatId);
36 opts.onChatFound?.(opts.chatId);
37 }
38
39 if (opts.model) {
40 args.push('--model', opts.model);
41 }
42
43 if (opts.mode) {
44 args.push('--mode', opts.mode);
45 }
46
47 if (opts.yolo) {
48 args.push('--yolo');
49 }
50
51 if (opts.cursorArgs) {
52 const safeArgs = filterResumeSubcommand(opts.cursorArgs);
53 args.push(...safeArgs);
54 }
55
56 logger.debug(`[CursorLocal] Spawning agent with args: ${JSON.stringify(args)}`);
57
58 if (opts.abort.aborted) {
59 logger.debug('[CursorLocal] Abort already signaled before spawn; skipping launch');
60 return;
61 }
62
63 await spawnWithTerminalGuard({
64 command: 'agent',
65 args,
66 cwd: opts.path,
67 env: process.env,
68 signal: opts.abort,
69 logLabel: 'CursorLocal',
70 spawnName: 'agent',
71 installHint: 'Cursor Agent CLI (curl https://cursor.com/install -fsS | bash)',
72 includeCause: true,
73 logExit: true,
74 shell: process.platform === 'win32'
75 });
76}

Callers 1

cursorLocalLauncherFunction · 0.90

Calls 4

spawnWithTerminalGuardFunction · 0.90
debugMethod · 0.80
filterResumeSubcommandFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected