chore: add CODEBOT command for automated code quality analysis #22496
+503
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Description
Adds CODEBOT, an automated code quality enforcement command that analyzes branch changes against MetaMask Mobile guidelines before PR creation.
What is CODEBOT?
CODEBOT analyzes only the changes in your current branch compared to main, providing:
Features
anytypes, proper exports, TSDocUsage
In Cursor Chat
@codebot
@codebot analyze my changes
@codebot check PR readiness
@codebot am I ready for PR?## Output Example
CODEBOT generates comprehensive reports with:
Benefits
Example
Analysis of #22493
🔍 Branch Analysis Report
📊 Change Summary
predict/optimistic-positions📁 Files Changed
🔴 High Risk (1 file)
app/components/UI/Predict/controllers/PredictController.ts(+3/-1 lines)🟡 Medium Risk (5 files)
app/components/UI/Predict/providers/polymarket/PolymarketProvider.ts(+453/-1 lines)app/components/UI/Predict/components/PredictPosition/PredictPosition.tsx(+29/-1 lines)app/components/UI/Predict/components/PredictPositionDetail/PredictPositionDetail.tsx(+27/-1 lines)app/components/UI/Predict/hooks/usePredictPrices.tsx(+1/-0 lines)app/components/UI/Predict/views/PredictTransactionsView/PredictTransactionsView.tsx(+13/-1 lines)🟢 Low Risk (6 files)
app/components/UI/Predict/components/PredictPosition/PredictPosition.styles.ts(+3/-0 lines)app/components/UI/Predict/providers/polymarket/PolymarketProvider.test.ts(+1830/-111 lines)app/components/UI/Predict/components/PredictPosition/PredictPosition.test.tsx(+29/-0 lines)app/components/UI/Predict/components/PredictPositionDetail/PredictPositionDetail.test.tsx(+22/-0 lines)app/components/UI/Predict/providers/types.ts(+1/-0 lines)app/components/UI/Predict/types/index.ts(+1/-0 lines)✅ Compliance Status
Design System (UI Changes)
Issues Found:
PredictPosition.tsxuses rawView,TouchableOpacity,Imagefromreact-nativeinstead of design system components.cursor/rules/ui-development-guidelines.mdc§ Component HierarchyPredictPosition.styles.tsusesStyleSheet.create()pattern.cursor/rules/ui-development-guidelines.mdc§ Styling RulesTypeScript Standards
Controller Standards
Testing
Test Quality:
.cursor/rules/unit-testing-guidelines.mdc).cursor/rules/unit-testing-guidelines.mdc).cursor/rules/unit-testing-guidelines.mdc)Documentation
Code Quality
🎯 Strengths
Comprehensive Optimistic Updates Implementation
Excellent Test Coverage
Good Controller Practices
Strong Type Safety
anytypes usedoptimisticfield added to PredictPosition typeProper Logging
🔴 Blocking (Must Fix)
1. Design System Violations (PredictPosition.tsx)
.cursor/rules/ui-development-guidelines.mdc- Component Hierarchy (STRICT ORDER)View,TouchableOpacity,Image) instead of design systemPredictPosition.tsx:2, 48, 51, 75PredictPosition.tsx,PredictPosition.styles.ts2. StyleSheet.create() Usage (PredictPosition.styles.ts)
.cursor/rules/ui-development-guidelines.mdc- Styling Rules (ENFORCE STRICTLY)PredictPosition.styles.ts:4-61🟡 Warnings (Should Fix)
1. Cannot Verify Runtime Quality
2. Large File Addition (PolymarketProvider.test.ts)
💡 Suggestions (Nice to Have)
1. Consider Skeleton Loader Component
<PositionSkeleton />component2. Add JSDoc to Optimistic Update Methods
📝 PR Readiness
Readiness Score: 6/10
Status:⚠️ Ready with changes
Checklist
Suggested PR Title
Suggested PR Description Template
🚀 Next Steps
Required Actions (Before PR)
Fix Design System Violations (BLOCKING)
PredictPosition.tsxto use design system componentsPredictPosition.styles.tsor convert to TailwindBoxinstead ofViewButtonBaseinstead ofTouchableOpacitytwClassNamepropVerify Quality Checks (RECOMMENDED)
yarn lint:eslint app/components/UI/Predict/**/*.{ts,tsx}yarn tsc --noEmityarn jest --findRelatedTests app/components/UI/Predict/Add Manual Testing Steps (RECOMMENDED)
Create PR (When ready)
📚 References & Rules Applied
Workspace Rules (Enforced)
.cursor/rules/ui-development-guidelines.mdc.cursor/rules/unit-testing-guidelines.mdc.cursor/rules/pr-creation-guidelines.mdcProject Guidelines
.github/guidelines/CODING_GUIDELINES.md