Skip to content

Update git commands extensions#27272

Merged
raycastbot merged 3 commits intoraycast:mainfrom
TechedWind707:ext/git-commands
Apr 30, 2026
Merged

Update git commands extensions#27272
raycastbot merged 3 commits intoraycast:mainfrom
TechedWind707:ext/git-commands

Conversation

@TechedWind707
Copy link
Copy Markdown
Contributor

Description

Improves the Git Commands extension for beginners by adding keyword-based search ranking and clearer, structured descriptions.

Changes
Added keywords to all aliases and used them for better search matching.
Ranked search results so base commands (e.g., git branch) appear first.
Expanded alias descriptions with examples, pitfalls, and a “why” tip.
Added keywords to Alias type.
Updated changelog.

Testing
npm run fix-lint

Notes
Search is now deterministic and favors exact matches, command starts, and keyword hits to keep common commands at the top.

Screencast

image

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: git-commands Issues related to the git-commands extension platform: macOS platform: Windows labels Apr 18, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

raycastbot commented Apr 18, 2026

Thank you for your contribution! 🎉

🔔 @manumorante @ridemountainpig you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="ext/git-commands"
FORK_URL="https://github.com/TechedWind707/raycast-extensions.git"
EXTENSION_NAME="git-commands"
REPO_NAME="raycast-extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 18, 2026

Greptile Summary

This PR adds keyword-based scoring to the Git Commands search, rewrites alias descriptions for beginners, and fixes the previous issue of markdown tokens being fed into Raycast's native keyword filter (now uses explicit alias.keywords arrays). The onSearchTextChange + useMemo approach integrates cleanly with Raycast's built-in filtering — visible items will appear in custom score order while Raycast still hides non-matching entries.

Confidence Score: 4/5

Safe to merge after addressing the two P2 findings; no P0/P1 issues present.

Only P2 findings remain: an exact-match/prefix-match score double-count in scoreAlias and a missing useCallback wrapper. Neither causes broken behaviour — the scoring quirk may slightly alter ranking edge cases, and the useMemo dependency omission is functionally harmless because searchText is already listed. The CHANGELOG date format issue was flagged in a prior review thread.

extensions/git-commands/src/search-commands.tsx — scoring logic and useMemo deps; extensions/git-commands/CHANGELOG.md — date placeholder.

Important Files Changed

Filename Overview
extensions/git-commands/src/search-commands.tsx Adds custom scoring/ranking logic, onSearchTextChange, and useMemo-based sorted lists; keywords prop cleaned up to use explicit alias.keywords array instead of description.split — fixes the markdown-token issue from a prior review.
extensions/git-commands/src/types.d.ts Adds optional keywords field to the Alias type; straightforward and correct.
extensions/git-commands/CHANGELOG.md New entry uses a hardcoded date literal {2026-04-30} instead of the {PR_MERGE_DATE} template variable required by Raycast CI.
extensions/git-commands/src/alias.json Adds keywords arrays and rewrites alias descriptions for beginners; some sign-off/GPG-sign aliases still have inaccurate descriptions (flagged in a previous review thread).
extensions/git-commands/package.json Adds contributor entry and minor copy fix; no structural issues.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
extensions/git-commands/src/search-commands.tsx:107-113
**Exact-match score double-counts with prefix-match score**

When `name === term`, both the exact-match branch (`+60`) and the starts-with branch (`+25`) fire in sequence, adding `+85` total. This likely inflates exact-match scores beyond what was intended — it may also mask cases where a *different* alias has a strong keyword hit that should rank higher. Consider making the two branches mutually exclusive:

```suggestion
      if (name === term) {
        score += 60;
      } else if (name.startsWith(term)) {
        score += 25;
      }
      if (command.startsWith(`git ${term}`)) score += 40;
      if (command.includes(` ${term}`)) score += 10;
      if (keywords.includes(term)) score += 20;
      if (description.includes(term)) score += 5;
```

### Issue 2 of 2
extensions/git-commands/src/search-commands.tsx:126-128
**`sortBySearch` not in `useMemo` dependency arrays**

`sortBySearch` is defined as a plain function inside the component (not wrapped in `useCallback`), so it is a new reference on every render. It is not listed as a dependency of the three `useMemo` calls, which will trigger React's `exhaustive-deps` lint rule. In practice the memos only need to recompute when `searchText` changes (which is already listed), so the behaviour is correct — but wrapping `sortBySearch` in `useCallback([searchText])` (or inlining the sort logic directly) silences the lint warning and makes the intent explicit.

Reviews (3): Last reviewed commit: "Update CHANGELOG.md" | Re-trigger Greptile

Comment thread extensions/git-commands/CHANGELOG.md Outdated
Comment thread extensions/git-commands/src/alias.json
Comment thread extensions/git-commands/src/search-commands.tsx Outdated
@0xdhrv 0xdhrv self-assigned this Apr 30, 2026
Copy link
Copy Markdown
Contributor

@0xdhrv 0xdhrv left a comment

Choose a reason for hiding this comment

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

Looks good to me, approved ✅

@raycastbot raycastbot merged commit 58c71c4 into raycast:main Apr 30, 2026
3 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Published to the Raycast Store:
https://raycast.com/manumorante/git-commands

@raycastbot
Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@TechedWind707).

Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag.

@manumorante
Copy link
Copy Markdown
Contributor

Oh! Thank you so much! It looks great!

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

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: git-commands Issues related to the git-commands extension platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants