Skip to content

fix(kaos): match globstar zero directories - #2287

Open
xianjianlf2 wants to merge 1 commit into
MoonshotAI:mainfrom
xianjianlf2:markxian/fix-kaos-globstar-zero
Open

fix(kaos): match globstar zero directories#2287
xianjianlf2 wants to merge 1 commit into
MoonshotAI:mainfrom
xianjianlf2:markxian/fix-kaos-globstar-zero

Conversation

@xianjianlf2

Copy link
Copy Markdown

Related Issue

No linked issue.

Problem

**/foo patterns did not match files in the starting directory, so recursive globs missed valid files at the root of the search.

What changed

Teach the glob regex helper to treat **/ as zero-or-more directories and add coverage for both leading and middle **/ cases.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c61d3d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c61d3d5418

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +193 to +195
if (pattern[i + 1] === '*' && pattern[i + 2] === '/') {
regex += '(?:[^/]+/)*';
i += 2;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat globstar only as a full path segment

When callers pass a full pattern containing a path component like ***/foo.txt or a**/foo.txt, this branch fires on the last two * characters and turns that non-globstar component into (?:[^/]+/)*, so it can match zero or multiple directories. In Python-style glob semantics only a component that is exactly ** is recursive; these patterns should stay within a single path segment. Please require the **/ to start a segment, e.g. at index 0 or immediately after /, before applying the recursive rewrite.

Useful? React with 👍 / 👎.

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.

1 participant