Repository navigation
Conversation
|
Thank you for your contribution! 🎉 🔔 @dnnsmnstrr 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. You can expect an initial review within five business days. |
There was a problem hiding this comment.
PR Summary
This PR significantly enhances the BetterTouchTool extension with new AI tools, variable management commands, and improved trigger handling functionality.
Key changes:
- Added 6 new AI tools for searching/running triggers, managing variables, and handling actions with comprehensive evals
- Implemented robust error handling using
showFailureToastand standardized error patterns across the codebase - Added new variable management commands (get/set) with proper type validation and persistence options
- Improved named triggers page with better performance, grouping, and frecency-based sorting
- Added
toolsin package.json but missingevalsfor AI tools - should reference https://developers.raycast.com/ai/write-evals-for-your-ai-extension
The implementation is thorough and well-structured, though there are a few areas that could be improved for robustness and maintainability.
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
31 file(s) reviewed, 33 comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
logic: Command name 'trigger' has changed from 'Run BTT Named Trigger' to 'Search Named Triggers'. Can we keep the old name? It is the unique ID where ranking, aliases, and hotkeys are saved.
There was a problem hiding this comment.
Willing to revert, but the updated names better follow Raycast conventions
There was a problem hiding this comment.
I think the new name makes sense, especially with the app name being displayed behind the command
There was a problem hiding this comment.
Yeah, it's confused here - as long as the name doesn't change
There was a problem hiding this comment.
logic: Command name 'action' has changed from 'Run BTT Action' to 'Search Actions'. Can we keep the old name? It is the unique ID where ranking, aliases, and hotkeys are saved.
There was a problem hiding this comment.
logic: Silently falling back to string type when number parsing fails could lead to unexpected behavior. Consider throwing an error instead when variableType is 'number' but parsing fails.
| if (isNaN(numValue)) { | |
| // If number parsing fails, fall back to string type | |
| return { | |
| success: true, | |
| value: { type: "string", value: variableValue }, | |
| }; | |
| if (isNaN(numValue)) { | |
| return { | |
| success: false, | |
| error: `Failed to parse '${variableValue}' as a number`, | |
| }; | |
| } |
There was a problem hiding this comment.
Willing to change, but I believe this makes sense for AI tooling
cc1fd85 to
c36688d
Compare
There was a problem hiding this comment.
PR Summary
(updates since last review)
Based on my review of the changes and the previous feedback, here are the key new points to highlight:
The PR adds significant functionality to the BetterTouchTool extension with a focus on AI integration and variable management.
- The CHANGELOG.md entry for "AI Tools & Variable Commands" correctly uses
{PR_MERGE_DATE}template string but previous entries use actual dates which should be updated - Command names in
package.jsonhave been changed (e.g.,trigger,action) which could break existing user configurations - recommend keeping original command names - Lists and grids should implement
isLoadingstate to avoid empty state flicker, particularly intrigger.tsxand other view components getSelectedText()calls in the codebase should be wrapped in try/catch blocks for graceful error handling- Consider adding subtitles to commands in
package.jsonto better identify the service (BetterTouchTool) for users with multiple similar commands
The implementation is solid overall but these adjustments would improve robustness and user experience.
31 file(s) reviewed, 19 comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
style: Consider adding a comment above these lines to indicate they are for editor/tool specific files, similar to how other sections are labeled with comments
There was a problem hiding this comment.
style: Command descriptions are inconsistent - some end with periods, others don't
There was a problem hiding this comment.
style: AI tool descriptions are duplicates of command names without additional context or differentiation
There was a problem hiding this comment.
logic: variableValue for number variables should use type 'number' instead of 'text' to ensure proper validation
There was a problem hiding this comment.
style: console.error is unnecessary since error is already handled by showFailureToast
| console.error(error); | |
| showFailureToast(error); | |
| await showFailureToast(error); | |
| await showFailureToast(error); |
There was a problem hiding this comment.
logic: Error handling is inconsistent - returning error string directly instead of maintaining Result<T> type pattern
| return namedTriggersResult.error; | |
| return { status: "error", error: namedTriggersResult.error }; |
There was a problem hiding this comment.
style: Consider trimming variableName and variableValue to handle leading/trailing whitespace consistently
There was a problem hiding this comment.
style: Consider escaping backticks in variableName and value to handle cases where they contain backticks
There was a problem hiding this comment.
style: Consider making Success type exported since it's used as part of the exported Result type. This would help with type inference in consuming code.
There was a problem hiding this comment.
style: Consider adding readonly modifiers to prevent accidental mutations of these value types
| export type SetVariableValue = { type: "string"; value: string } | { type: "number"; value: number }; | |
| export type SetVariableValue = { readonly type: "string"; readonly value: string } | { readonly type: "number"; readonly value: number }; |
|
@kmusick Wow, really cool 🤯 Was already thinking about how this extension has lots of potential for the new AI features, and you made it happen! Nice touch with the grouping of named triggers, too. I tried testing your changes and unfortunately only had mixed success with letting the AI run named triggers. After moving the |
There was a problem hiding this comment.
Adding this comment seemed to make the AI more reliably search for named triggers before running them:
/**
* Run a named trigger in BetterTouchTool
*
* IMPORTANT: You MUST use the search-named-triggers tool first to find the correct name of the trigger.
* The name MUST MATCH EXACTLY what is returned by search-named-triggers - this includes:
* - Exact capitalization (uppercase/lowercase)
* - Exact spacing
* - Exact punctuation
* - Exact special characters
*
* DO NOT modify the name in any way from what search-named-triggers returns, regardless of what the user inputs.
*
* For example, if search-named-triggers returns "My-Trigger_Name!", you MUST use "My-Trigger_Name!"
* (NOT "my-trigger_name!", "My Trigger Name", "mytriggername", etc.)
*
* Note: Do not make assumptions about whether a trigger is enabled or disabled.
* Simply run the trigger by name without commenting on its enabled status.
*/There was a problem hiding this comment.
I added a condensed version of that IMPORTANT message and updated Input type to contain the full SearchResult object. In my testing, these two changes have really increased run-named-trigger performance. If you are having issues, can you add an eval that demonstrates the issue? If you haven't used the eval functionality much, it seems to require significant adjustments after copying, especially with input that includes nested structures or arrays, in my experience.
There was a problem hiding this comment.
I think the new name makes sense, especially with the app name being displayed behind the command
There was a problem hiding this comment.
I would personally want the instructions to more explicitly use the named trigger tool by default, unless asking for an 'action' to be run.
Many of the actions don't really work without additional input and I never found the time to go through and filter out the ones that can't simply be run, so that feature could use some more work if the AI should interact. The list came from here, but it's not really documented, so it would require some manual work / reverse engineering (maybe @fifafu could help)
There was a problem hiding this comment.
Removing this text and instead having examples above both run-named-trigger and run-action (where it is pointed out multiple times that the user must directly mention action) seems to have improved performance. npx run evals has three tests on run-named-trigger and one on run-action. I have not had issues after this latest commit, but I imagine any real AI Command usage would need to be decently specific to guarantee the correct behavior.
I am really not very knowledgeable about actions. I agree that the current situation is probably not ideal, but maybe occasionally useful? I imagine power users would always prefer named triggers, and normal users probably wouldn't use this at all, so I don't really think it will see much use. However, I also think it makes sense to ship AI tooling that matches the command functionality, especially since there are a reasonable number that seem to function correctly.
- refactor: Improve code formatting and comment clarity in run-named-trigger.ts - feat(raycast-ai): Implement AI tools for triggers/actions/vars, improve named triggers, add set/get variable commands & prefs - Initial commit Update bettertouchtool extension - feat(raycast-ai): Implement AI tools for triggers/actions/vars, improve named triggers, add set/get variable commands & prefs - refactor: Improve code formatting and comment clarity in run-named-trigger.ts - feat(raycast-ai): Implement AI tools for triggers/actions/vars, improve named triggers, add set/get variable commands & prefs Delete extensions/bettertouchtool/.aider.input.history Removed aider Apply suggestions from code review Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> implemented code review suggestions implementing review feedback implementing review feedback Implementing pr feedback and ai tooling changes. Changed format to encourage exact inputs, better handled invalid inputs, and better instructions to prefer named trigger vs action fixed formatting
bf8f1a3 to
a833caf
Compare
|
Is this ready for another review @kmusick @dnnsmnstrr |
Yes, it should be - I didn't realize that there was a conflict from the mass macOS platform push. The only change I made since my prior push was regenerating package-lock.json with updates from this branch as well as the macOS platform change. |
|
Assigning this to you @andreaselia, can you help with this too? |
|
@kmusick could you go through and action/resolve any Greptile feedback please and let us know when ready for review again? |
Description
Focused on AI and improving the named triggers experience.
search-named-triggersrun-named-triggerget-variable-valueset-variable-valuesearch-actionrun-actionget-variableset-string-variableset-number-variableScreencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder