Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/commands/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const envConfigs: [string, string][] = [
['__CFBundleIdentifier=dev.kiro.desktop', 'Kiro <[email protected]>'],
['VSCODE_BRAND=Qoder', 'Qoder <[email protected]>'],
['__CFBundleIdentifier=com.qoder.ide', 'Qoder <[email protected]>'], // Use this unstable variable until Qoder has a better one
// Check env variables for IDEs in remove development environments
['VSCODE_GIT_ASKPASS_MAIN=*.cursor-server*', 'Cursor <[email protected]>'],
['BROWSER=*.cursor-server*', 'Cursor <[email protected]>'],
['VSCODE_GIT_ASKPASS_MAIN=*.qoder-server*', 'Qoder <[email protected]>'],
['BROWSER=*.qoder-server*', 'Qoder <[email protected]>'],
];

/**
Expand Down Expand Up @@ -302,6 +307,21 @@ function getCoDevelopedBy(): string {
// Continue to next configuration if value is falsy
continue;
}

// For pattern matching cases (starts and ends with *, e.g., "*.cursor-server*")
if (
expectedValue &&
expectedValue.startsWith('*') &&
expectedValue.endsWith('*') &&
expectedValue.length > 2
) {
// Extract the pattern between the asterisks
const pattern = expectedValue.substring(1, expectedValue.length - 1);
if (actualValue.includes(pattern)) {
return coDevelopedBy;
}
continue;
}
}

// Return empty string if none of the environment configurations match
Expand Down
27 changes: 27 additions & 0 deletions test/commands/exec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,33 @@ describe('exec command utilities', () => {
process.env.CLAUDECODE = '';
expect(getCoDevelopedBy()).toBe('');
});

// Enhanced tests for Cursor and Qoder detection
it('should return Cursor CoDevelopedBy when VSCODE_GIT_ASKPASS_MAIN contains .cursor-server', () => {
clearCoDevelopedByEnvVars();
process.env.VSCODE_GIT_ASKPASS_MAIN =
'/home/user/.cursor-server/bin/askpass-main.js';
expect(getCoDevelopedBy()).toBe('Cursor <[email protected]>');
});

it('should return Cursor CoDevelopedBy when BROWSER contains .cursor-server', () => {
clearCoDevelopedByEnvVars();
process.env.BROWSER = '/home/user/.cursor-server/bin/helpers/browser.sh';
expect(getCoDevelopedBy()).toBe('Cursor <[email protected]>');
});

it('should return Qoder CoDevelopedBy when VSCODE_GIT_ASKPASS_MAIN contains .qoder-server', () => {
clearCoDevelopedByEnvVars();
process.env.VSCODE_GIT_ASKPASS_MAIN =
'/home/user/.qoder-server/bin/askpass-main.js';
expect(getCoDevelopedBy()).toBe('Qoder <[email protected]>');
});

it('should return Qoder CoDevelopedBy when BROWSER contains .qoder-server', () => {
clearCoDevelopedByEnvVars();
process.env.BROWSER = '/home/user/.qoder-server/bin/helpers/browser.sh';
expect(getCoDevelopedBy()).toBe('Qoder <[email protected]>');
});
});

describe('hasCoDevelopedBy', () => {
Expand Down
Loading