add ai review prompt example

This commit is contained in:
Alexander Van de Kleut 2025-08-20 15:38:59 -04:00
commit 3fa884c562
6 changed files with 31 additions and 10 deletions

17
.github/ai-review-prompt.txt vendored Normal file
View file

@ -0,0 +1,17 @@
Focus on the following code quality aspects during review:
1. **Error Handling**: Look for places where error handling could be more specific or robust. Flag any generic console.error() calls that could provide more context.
2. **Type Safety**: Identify any use of `any` types, missing type annotations, or places where TypeScript's strict checking could be improved.
3. **Function Complexity**: Flag functions that are longer than 20 lines or have more than 3 levels of nesting as potentially needing refactoring.
4. **Resource Management**: Look for file operations, API calls, or other resources that might not be properly handled or could benefit from better error recovery.
5. **Code Organization**: Suggest improvements to function organization, especially if constants or configuration could be better grouped.
6. **Performance**: Identify any obvious performance issues like unnecessary loops, redundant API calls, or inefficient data processing.
7. **Security**: Flag any potential security issues like unsafe string interpolation, missing input validation, or hardcoded values that should be configurable.
Be specific about line numbers and provide concrete suggestions for improvement. Focus only on actionable feedback that would improve code quality, maintainability, or reliability.

View file

@ -12,9 +12,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Code Review
uses: freeedcom/ai-codereviewer@main
uses: smartconfigai/ai-codereviewer@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_MODEL: "gpt-4-1106-preview"
OPENAI_API_MODEL: "gpt-4o-2024-08-06"
system_prompt_path: ".github/ai-review-prompt.txt"
exclude: "yarn.lock,dist/**"

View file

@ -10,7 +10,7 @@ inputs:
OPENAI_API_MODEL:
description: "OpenAI API model."
required: false
default: "gpt-4"
default: "gpt-4o-2024-08-06"
exclude:
description: "Glob patterns to exclude files from the diff analysis"
required: false

View file

@ -24,7 +24,7 @@
"@types/node": "^18.15.5",
"@vercel/ncc": "^0.36.1",
"prettier": "^2.8.6",
"typescript": "^5.0.2"
"typescript": "^5.4.0"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

View file

@ -6,7 +6,10 @@
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node"
},
"exclude": ["node_modules", "**/*.test.ts"]
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "lib/**/*", "**/*.test.ts"]
}

View file

@ -516,10 +516,10 @@ tunnel@^0.0.6:
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==
typescript@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.2.tgz#891e1a90c5189d8506af64b9ef929fca99ba1ee5"
integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==
typescript@^5.4.0:
version "5.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6"
integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==
undici-types@~5.26.4:
version "5.26.5"