Skip to content

Discover project favicons recursively for monorepos#690

Open
rexlManu wants to merge 1 commit intopingdotgg:mainfrom
rexlManu:t3code/sidebar-favicon-recursive-search
Open

Discover project favicons recursively for monorepos#690
rexlManu wants to merge 1 commit intopingdotgg:mainfrom
rexlManu:t3code/sidebar-favicon-recursive-search

Conversation

@rexlManu
Copy link
Copy Markdown

@rexlManu rexlManu commented Mar 9, 2026

In monorepos where applications life in a own namespace called apps, the favicon search fails. I updated how the favicon discovering works.

I only added the apps namespace for now but maybe it makes sense to add other common patterns too

Summary

  • keep the existing root and source-declared favicon fast paths
  • add recursive project favicon discovery with apps/*-first ranking for monorepos
  • reuse the workspace git-ignore file listing logic and extend route coverage for ranking and ignore cases

Testing

  • bun run --cwd apps/server test src/projectFaviconRoute.test.ts src/workspaceEntries.test.ts src/workspaceEntries.chunking.test.ts
  • bun lint
  • bun typecheck

@github-actions github-actions bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Mar 9, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 9, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 228456b6-cb7f-4829-b770-87c920c439da

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

return true;
}

const checkIgnore = await runProcess("git", ["check-ignore", "--no-index", "-z", "--stdin"], {
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.

🟢 Low src/projectFiles.ts:97

The --no-index flag causes git check-ignore to ignore whether a file is tracked, so force-added tracked files matching .gitignore patterns are incorrectly filtered out. This drops valid files like git add -f config files from the result. Consider removing --no-index so tracked status is respected.

-    const checkIgnore = await runProcess("git", ["check-ignore", "--no-index", "-z", "--stdin"], {
+    const checkIgnore = await runProcess("git", ["check-ignore", "-z", "--stdin"], {
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/server/src/projectFiles.ts around line 97:

The `--no-index` flag causes `git check-ignore` to ignore whether a file is tracked, so force-added tracked files matching `.gitignore` patterns are incorrectly filtered out. This drops valid files like `git add -f` config files from the result. Consider removing `--no-index` so tracked status is respected.

Evidence trail:
1. apps/server/src/projectFiles.ts line 97 shows `git check-ignore --no-index -z --stdin`
2. Git documentation at https://git-scm.com/docs/git-check-ignore confirms: "By default, tracked files are not shown at all since they are not subject to exclude rules; but see '--no-index'." and "--no-index: Don't look in the index when undertaking the checks. This can be used to debug why a path became tracked by e.g. `git add .` and was not ignored by the rules as expected by the user or when developing patterns including negation to match a path previously added with `git add -f`."
3. Function name `filterGitIgnoredPaths` (line 80) indicates intent to filter git-ignored files, but tracked files are not considered ignored by git.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fix it for me

Comment on lines +264 to +275
function shouldIncludeDirent(relativePath: string, dirent: Dirent): boolean {
if (!dirent.name || dirent.name === "." || dirent.name === "..") {
return false;
}
if (!dirent.isDirectory() && !dirent.isFile()) {
return false;
}
if (isPathInIgnoredDirectory(relativePath)) {
return false;
}
return true;
}
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.

🟠 High src/projectFiles.ts:264

listProjectFilePaths fails to ignore nested directories like packages/app/node_modules. shouldIncludeDirent passes the full relative path to isPathInIgnoredDirectory, which only checks the first segment against IGNORED_DIRECTORY_NAMES — so packages/app/node_modules is not recognized as ignored and the scanner traverses into dependency trees and build artifacts. Consider checking all path segments in isPathInIgnoredDirectory, or use a separate check in shouldIncludeDirent that tests individual directory names.

 function shouldIncludeDirent(relativePath: string, dirent: Dirent): boolean {
   if (!dirent.name || dirent.name === "." || dirent.name === "..") {
     return false;
   }
   if (!dirent.isDirectory() && !dirent.isFile()) {
     return false;
   }
-  if (isPathInIgnoredDirectory(relativePath)) {
+  if (
+    isPathInIgnoredDirectory(relativePath) ||
+    IGNORED_DIRECTORY_NAMES.has(dirent.name)
+  ) {
     return false;
   }
   return true;
 }
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/server/src/projectFiles.ts around lines 264-275:

`listProjectFilePaths` fails to ignore nested directories like `packages/app/node_modules`. `shouldIncludeDirent` passes the full relative path to `isPathInIgnoredDirectory`, which only checks the first segment against `IGNORED_DIRECTORY_NAMES` — so `packages/app/node_modules` is not recognized as ignored and the scanner traverses into dependency trees and build artifacts. Consider checking all path segments in `isPathInIgnoredDirectory`, or use a separate check in `shouldIncludeDirent` that tests individual directory names.

Evidence trail:
apps/server/src/projectFiles.ts lines 37-41: `isPathInIgnoredDirectory` only checks `relativePath.split('/')[0]` (first segment); apps/server/src/projectFiles.ts lines 264-275: `shouldIncludeDirent` passes full `relativePath` to `isPathInIgnoredDirectory`; apps/server/src/projectFiles.ts lines 10-19: `IGNORED_DIRECTORY_NAMES` includes `node_modules`; apps/server/src/workspaceEntries.ts line 166: alternative implementation uses `IGNORED_DIRECTORY_NAMES.has(dirent.name)` which catches nested directories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant