Skip to content

refactor: use minimatch for env var glob matching#3

Merged
jiangxin merged 2 commits into
ai-coding-workshop:masterfrom
jiangxin:jx/minimatch
Sep 26, 2025
Merged

refactor: use minimatch for env var glob matching#3
jiangxin merged 2 commits into
ai-coding-workshop:masterfrom
jiangxin:jx/minimatch

Conversation

@jiangxin

Copy link
Copy Markdown
Contributor

No description provided.

yyuuttaaoo and others added 2 commits September 25, 2025 21:00
This commit improves the detection logic for Cursor and Qoder IDEs by
adding pattern matching for environment variables VSCODE_GIT_ASKPASS_MAIN
and BROWSER that contain '.cursor-server' or '.qoder-server' substrings.
This fixes issues where the IDE detection was not working properly in
SSH and DevContainer environments.

The changes include:
1. Added new environment variable patterns in envConfigs for Cursor and
   Qoder detection
2. Enhanced getCoDevelopedBy function to support substring pattern
   matching
3. Added comprehensive tests to verify the new detection logic

This ensures that users working in remote development environments (SSH,
DevContainer) will have proper Co-developed-by trailers added to their
commits when using Cursor or Qoder.

Change-Id: Ieb98755b1c0aa178b49484b2cdc613c11f90df39
Co-developed-by: Qoder <noreply@qoder.com>
Signed-off-by: Tom Yu <yyuuttaaoo@gmail.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
1. Use glob patterns **/.cursor-server/** and **/.qoder-server/** in the
   envConfigs array to match paths containing these substrings
2. Use the minimatch package with proper { dot: true } option in the
   getCoDevelopedBy function to handle paths starting with dot(.)
3. Replace single asterisks with ** in the array to match values
   containing the / symbol
4. All tests pass, verifying that the refactored functionality behaves
   consistently with the previous implementation

This refactoring simplifies the code and improves maintainability while
preserving the same functionality.

Change-Id: I4cbea155af867690f1e4b9d51f386cf7aaa55337
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>

@yyuuttaaoo yyuuttaaoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jiangxin jiangxin merged commit 7d83506 into ai-coding-workshop:master Sep 26, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants