Skip to content

Categorize bookmarks#407

Merged
aaditkamat merged 1 commit into
mainfrom
fix/update-bookmarks
Jul 4, 2026
Merged

Categorize bookmarks#407
aaditkamat merged 1 commit into
mainfrom
fix/update-bookmarks

Conversation

@aaditkamat

@aaditkamat aaditkamat commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Automatically categorize top-level bookmark entries into folders based on simple keyword heuristics while preserving the original raw list.

New Features:

  • Introduce a raw bookmark list and generate a categorized bookmark structure from it.
  • Add keyword and folder-name based logic to assign uncategorized bookmark links into appropriate existing folders or an Uncategorized folder.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sourcery-ai

sourcery-ai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduces a derived bookmarks structure from rawBookmarks by auto-categorizing top-level bookmark leaf nodes into existing folders using keyword-based heuristics, with fallbacks and an Uncategorized bucket.

File-Level Changes

Change Details Files
Rename the original bookmarks array to represent raw, uncategorized bookmark data and introduce a derived, categorized bookmarks export.
  • Renamed the existing bookmarks array to rawBookmarks while preserving its contents.
  • Added a new exported bookmarks array that is the result of running a categorization function over rawBookmarks.
src/data/data.tsx
Add helper and categorization logic to group leaf bookmarks into folders using keyword heuristics and fallbacks.
  • Implemented findFolderByName to recursively locate folder nodes by name within a nested bookmark tree.
  • Defined a keywordToFolder mapping object that relates keyword sets to target folder names.
  • Implemented a categorize function that deep-copies rawBookmarks, separates folder nodes from leaf nodes, and assigns leaves to folders based on keyword matching.
  • Added a fallback mechanism that searches for known folder names in bookmark text if keyword matching fails.
  • Introduced an Uncategorized folder that is created and used when no suitable folder is found for a bookmark.
src/data/data.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - I've left some high level feedback:

  • In findFolderByName, the if (node.children && node.name === targetName) check means folders with an empty or undefined children array won't be matched as targets; consider matching by name regardless of children and then recursing into children when present.
  • The deep copy via JSON.parse(JSON.stringify(raw)) in categorize may be unnecessarily costly and will strip any non-plain data (e.g., Dates); if possible, prefer a more explicit cloning strategy or structuredClone to better control performance and data fidelity.
  • The keyword-to-folder mapping is encoded as comma-separated keyword strings in keywordToFolder, which makes the lookup logic a bit opaque; refactoring this into a clearer structure (e.g., { folderName: [keywords...] }) would improve readability and maintainability of the categorization heuristic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `findFolderByName`, the `if (node.children && node.name === targetName)` check means folders with an empty or undefined `children` array won't be matched as targets; consider matching by `name` regardless of `children` and then recursing into `children` when present.
- The deep copy via `JSON.parse(JSON.stringify(raw))` in `categorize` may be unnecessarily costly and will strip any non-plain data (e.g., Dates); if possible, prefer a more explicit cloning strategy or `structuredClone` to better control performance and data fidelity.
- The keyword-to-folder mapping is encoded as comma-separated keyword strings in `keywordToFolder`, which makes the lookup logic a bit opaque; refactoring this into a clearer structure (e.g., `{ folderName: [keywords...] }`) would improve readability and maintainability of the categorization heuristic.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@aaditkamat
aaditkamat merged commit 1e64ae7 into main Jul 4, 2026
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.

1 participant