55import * as fs from 'fs' ;
66import * as path from 'path' ;
77import { spawnSync } from 'child_process' ;
8+ import { minimatch } from 'minimatch' ;
89
910// Define environment variable configurations and their corresponding CoDevelopedBy values
1011// Format: ["key=value", "co-developed-by-string"]
12+ // Use glob patterns for value matching with ** to match any characters including /
1113const envConfigs : [ string , string ] [ ] = [
1214 // We can run CLI in IDE (such as Cursor and Qoder), so check CLI env variables first
1315 [ 'CLAUDECODE=1' , 'Claude <noreply@anthropic.com>' ] ,
@@ -19,6 +21,14 @@ const envConfigs: [string, string][] = [
1921 [ '__CFBundleIdentifier=dev.kiro.desktop' , 'Kiro <noreply@kiro.dev>' ] ,
2022 [ 'VSCODE_BRAND=Qoder' , 'Qoder <noreply@qoder.com>' ] ,
2123 [ '__CFBundleIdentifier=com.qoder.ide' , 'Qoder <noreply@qoder.com>' ] , // Use this unstable variable until Qoder has a better one
24+ // Check env variables for IDEs in remove development environments
25+ [
26+ 'VSCODE_GIT_ASKPASS_MAIN=**/.cursor-server/**' ,
27+ 'Cursor <noreply@cursor.com>' ,
28+ ] ,
29+ [ 'BROWSER=**/.cursor-server/**' , 'Cursor <noreply@cursor.com>' ] ,
30+ [ 'VSCODE_GIT_ASKPASS_MAIN=**/.qoder-server/**' , 'Qoder <noreply@qoder.com>' ] ,
31+ [ 'BROWSER=**/.qoder-server/**' , 'Qoder <noreply@qoder.com>' ] ,
2232] ;
2333
2434/**
@@ -278,30 +288,26 @@ function getCoDevelopedBy(): string {
278288 continue ;
279289 }
280290
281- // First check for exact match
282- if (
283- expectedValue !== null &&
284- expectedValue !== '*' &&
285- actualValue === expectedValue
286- ) {
287- return coDevelopedBy ;
288- }
289-
290- // For wildcard cases (*) or null for expectedValue, only return CoDevelopedBy
291- // if the value is actually meaningful
292- if ( expectedValue === '*' || expectedValue === null ) {
291+ // For null expectedValue (just check key existence)
292+ if ( expectedValue === null ) {
293293 // Only return CoDevelopedBy if the actual value is truthy (not empty, not '0', not 'false', etc.)
294294 if (
295295 actualValue &&
296296 actualValue !== '0' &&
297297 actualValue !== 'false' &&
298+ actualValue !== 'off' &&
298299 actualValue !== 'no'
299300 ) {
300301 return coDevelopedBy ;
301302 }
302303 // Continue to next configuration if value is falsy
303304 continue ;
304305 }
306+
307+ // Use minimatch for glob pattern matching
308+ if ( minimatch ( actualValue , expectedValue , { dot : true } ) ) {
309+ return coDevelopedBy ;
310+ }
305311 }
306312
307313 // Return empty string if none of the environment configurations match
0 commit comments