Skip to content

Conversation

@ronnnnn
Copy link
Contributor

@ronnnnn ronnnnn commented Oct 15, 2025

Overview

I had a mistake on #94.
We can't find bun's version correctly when .tool-versions have other versions begin "bun".

Reproduce steps

In .tool-versions:

bundler 1.0.0
bun     1.0.0

Regex check

https://regex101.com/r/2aCusB/3

@coderabbitai
Copy link

coderabbitai bot commented Oct 15, 2025

Walkthrough

Adjusted the .tool-versions reader regex in src/utils.ts to require at least one whitespace after bun and a non-space version token; removed an extra workflow step in .github/workflows/test.yml that previously wrote a duplicate .tool-versions entry.

Changes

Cohort / File(s) Summary of Changes
Utils
src/utils.ts
Tightened the .tool-versions reader regex from ^bun\s*(?<version>.*?)$/m to ^bun\s+(?<version>\S+)$/m, requiring at least one space after bun and a non-space version token (disallows empty or space-containing version capture). No API changes.
CI Workflow
.github/workflows/test.yml
Removed an extra workflow step that wrote a duplicate/incorrect bun entry to .tool-versions, eliminating the generation of a bun1.1.0 line and leaving the intended entries only.

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix: .tool-versions regex" directly and accurately describes the main change in this pull request. The primary modification is updating the regex pattern used to parse the .tool-versions file to correctly handle cases where other tool names begin with "bun" (such as "bundler"). The title is concise, clear, and specific enough that a teammate scanning the history would immediately understand the core change being made.
Description Check ✅ Passed The pull request description directly addresses the issue being fixed in the changeset. The author clearly explains that there was a problem from PR #94 where Bun's version cannot be correctly detected when .tool-versions contains other tools whose names begin with "bun" (such as "bundler"). The description provides a concrete reproduction case with specific examples and references a regex demonstration. This explanation directly relates to the regex change in src/utils.ts that tightens the matching pattern to require at least one whitespace after "bun" and a non-space version token, preventing false matches with other tool names.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6356405 and e5ed3e1.

⛔ Files ignored due to path filters (1)
  • dist/setup/index.js is excluded by !**/dist/**
📒 Files selected for processing (1)
  • src/utils.ts (1 hunks)

Copy link
Collaborator

@xhyrom xhyrom left a comment

Choose a reason for hiding this comment

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

LGTM

@ronnnnn ronnnnn requested a review from xhyrom October 31, 2025 00:29
@ronnnnn
Copy link
Contributor Author

ronnnnn commented Oct 31, 2025

@xhyrom
Thank you for your review. I fixed the CI failure.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e5ed3e1 and b08cdef.

⛔ Files ignored due to path filters (1)
  • dist/setup/index.js is excluded by !**/dist/**
📒 Files selected for processing (1)
  • src/utils.ts (1 hunks)

@ronnnnn ronnnnn force-pushed the fix-tool-versions-match branch from b08cdef to a961131 Compare October 31, 2025 00:40
file: .tool-versions
run: echo "bun 1.1.0" > .tool-versions

- name: .tool-versions (bun1.1.0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this format is not supported on asdf

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.

3 participants