Skip to content

feat(fmt): add file path discovery - #117

Merged
chenjiahan merged 2 commits into
mainfrom
chenjiahan/feat-fmt-file-discovery
Jul 31, 2026
Merged

feat(fmt): add file path discovery#117
chenjiahan merged 2 commits into
mainfrom
chenjiahan/feat-fmt-file-discovery

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR adds an internal path-discovery primitive for the formatter so later rs fmt work can expand files, directories, and globs without depending on Prettier configuration. It combines overlapping traversal roots, preserves brace, extglob, dotfile, and negative-glob behavior through micromatch, and skips VCS directories, node_modules, symlinks, and binary paths. It also bundles tiny-readdir and is-binary-path with their required notices.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploying rstack-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 44cc5b2
Status: ✅  Deploy successful!
Preview URL: https://bc3ab98a.rstack-cli.pages.dev
Branch Preview URL: https://chenjiahan-feat-fmt-file-dis.rstack-cli.pages.dev

View logs

@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: 8d1404bf79

ℹ️ 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 thread packages/rstack/src/fmt/discoverPaths.ts
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@chenjiahan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d808b28f-c5a7-4a31-8eb7-a44077b67134

📥 Commits

Reviewing files that changed from the base of the PR and between 8d1404b and 44cc5b2.

📒 Files selected for processing (1)
  • scripts/dictionary.txt
📝 Walkthrough

Walkthrough

Added discoverFmtPaths for file, directory, positive glob, and negative glob inputs. The implementation traverses without following symlinks, ignores VCS metadata and node_modules, filters binary and excluded files, merges roots, and returns sorted unique paths. Added dependency catalog entries, development dependencies, and license notices. Added tests for ordering, filtering, glob expansion, missing paths, deduplication, and symlink exclusion.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the addition of formatter file path discovery, which is the main change in the pull request.
Description check ✅ Passed The description directly explains the formatter path-discovery primitive, supported patterns, exclusions, and bundled dependencies.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chenjiahan/feat-fmt-file-discovery

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/rstack/src/fmt/discoverPaths.ts (1)

226-244: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Negative globs don't prune traversal early.

Negative-glob filtering only happens after candidates is fully populated (lines 231-244). A pattern like '!dist/**' still fully traverses the dist subtree via tiny-readdir before every discovered file gets discarded. For large excluded subtrees (build output, coverage reports) not caught by alwaysIgnoredNames, this wastes I/O.

Consider also checking negativeGlobMatchers inside the ignore callback in createTraversalOptions so whole excluded directories get pruned during traversal, not just filtered afterward.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/rstack/src/fmt/discoverPaths.ts` around lines 226 - 244, Update
createTraversalOptions so its ignore callback evaluates negativeGlobMatchers
against each traversed path and prunes matching directories during traversal,
including patterns such as !dist/**. Retain the existing post-traversal
filtering in the candidates loop to exclude matching files and preserve current
binary and path handling behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/rstack/src/fmt/discoverPaths.ts`:
- Around line 70-73: Add the technical terms “dirent” and “dirents” to the
project CSpell dictionary (or annotate the onDirents usage in
packages/rstack/src/fmt/discoverPaths.ts, lines 70-73) and add “extglob” to the
dictionary (or annotate the extglob test pattern in
packages/rstack/tests/fmt/discoverPaths.test.ts, lines 63-77) so both CSpell
failures are resolved.

---

Nitpick comments:
In `@packages/rstack/src/fmt/discoverPaths.ts`:
- Around line 226-244: Update createTraversalOptions so its ignore callback
evaluates negativeGlobMatchers against each traversed path and prunes matching
directories during traversal, including patterns such as !dist/**. Retain the
existing post-traversal filtering in the candidates loop to exclude matching
files and preserve current binary and path handling behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d6b2a0cf-92f2-4244-b6f6-5bc5925cb2e6

📥 Commits

Reviewing files that changed from the base of the PR and between e117493 and 8d1404b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • packages/rstack/THIRD_PARTY_NOTICES.md
  • packages/rstack/package.json
  • packages/rstack/src/fmt/discoverPaths.ts
  • packages/rstack/tests/fmt/discoverPaths.test.ts
  • pnpm-workspace.yaml

Comment thread packages/rstack/src/fmt/discoverPaths.ts
@chenjiahan
chenjiahan merged commit 7d7983d into main Jul 31, 2026
4 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/feat-fmt-file-discovery branch July 31, 2026 05:12
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