Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(hetero): resolve Cursor CLI alias collisions (#18255)

AmAzing-f6812ce5f3a8
diff --git a/packages/heterogeneous-agents/src/spawn/resolveCliCommand.test.ts b/packages/heterogeneous-agents/src/spawn/resolveCliCommand.test.ts
index fecff042644..e83a05b0931 100644
--- a/packages/heterogeneous-agents/src/spawn/resolveCliCommand.test.ts
+++ b/packages/heterogeneous-agents/src/spawn/resolveCliCommand.test.ts
@@ -217,7 +217,7 @@ describe('resolveCliCommand', () => {
});
});
- it("rejects an unrelated `agent` binary and falls back to Cursor's user-local install", async () => {
+ it("falls back to Cursor's unambiguous alias when another CLI owns `agent`", async () => {
const originalPath = process.env.PATH;
const originalShell = process.env.SHELL;
process.env.PATH = '/usr/bin:/bin';
@@ -226,6 +226,7 @@ describe('resolveCliCommand', () => {
try {
callExecFile('/Users/x/.grok/bin/agent\n');
callExecFile('Usage: agent [flags]\nGrok CLI agent');
+ callExecFile('Usage: agent [flags]\nGrok CLI agent');
callExecFile('Usage: agent [options] [command] [prompt...]\nStart the Cursor Agent');
const { detectHeterogeneousCliCommand } = await importModule();
@@ -233,11 +234,12 @@ describe('resolveCliCommand', () => {
expect(status).toMatchObject({
available: true,
- path: path.join(os.homedir(), '.local', 'bin', 'agent'),
+ path: path.join(os.homedir(), '.local', 'bin', 'cursor-agent'),
version: undefined,
});
expect(execFileMock.mock.calls[1]![1]).toEqual(['--help']);
expect(execFileMock.mock.calls[2]![1]).toEqual(['--help']);
+ expect(execFileMock.mock.calls[3]![1]).toEqual(['--help']);
} finally {
process.env.PATH = originalPath;
if (originalShell === undefined) delete process.env.SHELL;
diff --git a/packages/heterogeneous-agents/src/spawn/resolveCliCommand.ts b/packages/heterogeneous-agents/src/spawn/resolveCliCommand.ts
index f31fbce09b8..0402ae1c4ca 100644
--- a/packages/heterogeneous-agents/src/spawn/resolveCliCommand.ts
+++ b/packages/heterogeneous-agents/src/spawn/resolveCliCommand.ts
@@ -620,7 +620,12 @@ const getWellKnownCommandPaths = (agentType: HeterogeneousCliAgentType): string[
}
case 'cursor': {
if (platform() !== 'darwin' && platform() !== 'linux') return [];
- return [path.join(homedir(), '.local', 'bin', 'agent')];
+ return [
+ path.join(homedir(), '.local', 'bin', 'agent'),
+ // Cursor's installer creates both names. Keep the unambiguous legacy
+ // alias as a fallback when another CLI shadows the generic `agent`.
+ path.join(homedir(), '.local', 'bin', 'cursor-agent'),
+ ];
}
case 'kimi-code': {
if (platform() !== 'darwin' && platform() !== 'linux') return [];