Skip to content

feat(sort): add name-desc and stars-asc to SortValue - #32

Merged
ManningWorks merged 2 commits into
mainfrom
issue-20-sort-name-desc
Aug 18, 2026
Merged

feat(sort): add name-desc and stars-asc to SortValue#32
ManningWorks merged 2 commits into
mainfrom
issue-20-sort-name-desc

Conversation

@ManningWorks

@ManningWorks ManningWorks commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Closes #20

Problem

sortProjects was asymmetrical: date had both directions (date = desc, date-asc = asc), but name was ascending-only and stars single-direction. A consumer offering a "Name (Z-A)" option could not express it via sortProjects and had to drop down to the granular sorters.

Change

Additive string-union extension (per the locked decision on the issue — the object-enum redesign is out of scope):

type SortValue = 'stars' | 'stars-asc' | 'name' | 'name-desc' | 'date' | 'date-asc'
  • 'name-desc'sortByName(projects, 'desc') — the case the issue demands
  • 'stars-asc'sortByStars(projects, 'asc')sortByStars defaults to desc, so asc is the missing direction (no alias added for existing behaviour)
  • Every existing SortValue keeps its meaning unchanged

Notes

  • SmartProjectGrid's internal SORT_OPTIONS still exposes only the original four — exposing the new directions in that UI is a separate product decision
  • Docs updated: sort-value.md and sort-projects.md value tables, unions, and behaviour sections

Verification

pnpm build && pnpm typecheck && pnpm lint && pnpm test — all green (1012 tests). Two focused cases added to sortProjects.test.ts covering Z-A name order and lowest-stars-first.

Summary by CodeRabbit

  • New Features

    • Added ascending sorting by star count.
    • Added descending alphabetical sorting by project name.
    • Updated supported sorting options and usage guidance.
  • Tests

    • Added coverage validating both new sorting modes and their expected project order.

sortProjects could not express Name Z-A or ascending stars, forcing
consumers past the convenience switch to the granular sorters. Extend
the string union with the two missing directions; existing values keep
their meaning. Object-enum redesign intentionally out of scope (#20).
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
projex-docs Ready Ready Preview Aug 18, 2026 10:16pm

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 48 minutes

Limit details: You’ve used all 3 included reviews currently available.

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 within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b891ee2-5e00-4a81-b40c-cae34c05cc8d

📥 Commits

Reviewing files that changed from the base of the PR and between 7d8fc46 and 054bf22.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • packages/docs/src/api/types/sort-value.md
  • packages/docs/src/api/utilities/sort-projects.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ccb469e3-9024-4306-9c05-85b0bcc4b6cf

📥 Commits

Reviewing files that changed from the base of the PR and between e017d8e and 7d8fc46.

📒 Files selected for processing (4)
  • packages/core/src/lib/__tests__/sortProjects.test.ts
  • packages/core/src/lib/sortProjects.ts
  • packages/docs/src/api/types/sort-value.md
  • packages/docs/src/api/utilities/sort-projects.md

Included review availability: Your plan provides up to 3 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

sortProjects now supports ascending star sorting and descending name sorting. Tests verify both modes. API documentation describes the new SortValue options, examples, and missing-value behavior.

Changes

Project sorting options

Layer / File(s) Summary
Sorting implementation and coverage
packages/core/src/lib/sortProjects.ts, packages/core/src/lib/__tests__/sortProjects.test.ts
The SortValue union and sortProjects switch now support stars-asc and name-desc. Tests verify ascending star order and descending name order.
Sorting API documentation
packages/docs/src/api/types/sort-value.md, packages/docs/src/api/utilities/sort-projects.md
The documentation defines both sort values, provides examples, and describes placement of projects with missing stars or names.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7d8fc

This PR adds two localized sort directions with documentation and focused test coverage; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the two new sort values added to SortValue.
Linked Issues check ✅ Passed The changes satisfy issue #20 by adding name-desc and preserve existing behavior while adding focused directional sorting coverage.
Out of Scope Changes check ✅ Passed The implementation, documentation, and tests directly support the stated sorting objectives, with no unrelated code changes identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-20-sort-name-desc

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

@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown

Greptile Summary

The PR extends SortValue with ascending star-count and descending name ordering.

  • Adds stars-asc and name-desc dispatch paths to sortProjects.
  • Adds focused tests for both new values.
  • Updates the changelog and primary sorting API documentation.

Confidence Score: 5/5

The PR appears safe to merge because no eligible blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/core/src/lib/sortProjects.ts Extends the public sort-value union and dispatches the two new values to existing directional sort helpers.
packages/core/src/lib/tests/sortProjects.test.ts Adds focused ordering coverage for ascending stars and descending names.
packages/docs/src/api/types/sort-value.md Documents the expanded union and the behavior of both new sort values.
packages/docs/src/api/utilities/sort-projects.md Updates the utility reference and examples to include both new sorting directions.
CHANGELOG.md Records the additive sorting API extension and preserves the meanings of existing values.

Reviews (2): Last reviewed commit: "docs(sort): add changelog entry and show..." | Re-trigger Greptile

@ManningWorks
ManningWorks merged commit 5fc081a into main Aug 18, 2026
8 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.

sortProjects SortValue lacks a descending-name case (asymmetrical with date)

1 participant