Update git commands extensions#27272
Conversation
|
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 commandsBRANCH="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 devWe're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days. |
Greptile SummaryThis 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 Confidence Score: 4/5Safe 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
Prompt To Fix All With AIFix 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 |
130a6ce to
4042fb9
Compare
0xdhrv
left a comment
There was a problem hiding this comment.
Looks good to me, approved ✅
|
Published to the Raycast Store: |
|
🎉 🎉 🎉 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. |
|
Oh! Thank you so much! It looks great! |
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
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder if they were not generated with our metadata tool