Added review
All checks were successful
Build and publish / Build Container (push) Successful in 1m1s

This commit is contained in:
2025-12-27 19:53:48 -05:00
parent c27802ca44
commit 5d3e15f0f5
3 changed files with 40 additions and 12 deletions

View File

@@ -9,26 +9,22 @@ dotenv.config();
dotenv.config({path: '.env.local', override: true});
(async () => {
const
const root = process.argv[2] || process.cwd(),
branch = process.env['GIT_BRANCH'] || await $`cd ${root} && git symbolic-ref refs/remotes/origin/HEAD`,
git = process.env['GIT_HOST'],
owner = process.env['GIT_OWNER'],
repo = process.env['GIT_REPO'],
auth = process.env['GIT_TOKEN'],
pr = process.env['PULL_REQUEST'],
root = process.argv[2] || process.cwd(),
host = process.env['AI_HOST'],
model = process.env['AI_MODEL'],
token = process.env['AI_TOKEN'];
const comments = [];
const commit = await $`cd ${root} && git log -1 --pretty=format:%H`;
const target = await $`cd ${root} && git rev-parse HEAD`;
const dest = await $`cd ${root} && git symbolic-ref refs/remotes/origin/HEAD`;
const gitDiff = await $`git diff ${dest} ${target}`;
const markdown = !!git;
const gitDiff = await $`cd ${root} && git diff ${branch}`;
console.log(`Inspecting: ${root} (${commit})\n`);
console.log(`Reviewing: ${root}\n`);
let options = {ollama: {model, host}};
if(host === 'anthropic') options = {anthropic: {model, token}};
@@ -37,7 +33,7 @@ dotenv.config({path: '.env.local', override: true});
...options,
model: [host, model],
path: process.env['path'] || os.tmpdir(),
system: `You are a code reviewer. Analyze the git diff and use the \`recommend\` tool for EACH issue you find. You must call \`recommend\` exactly once for every bug or improvement opportunity. After making all recommendations, provide a summary using 100 words or less in ${markdown ? 'markdown' : 'unstyled text'}.`,
system: `You are a code reviewer. Analyze the git diff and use the \`recommend\` tool for EACH issue you find. You must call \`recommend\` exactly once for every bug or improvement opportunity. After making all recommendations, provide a brief bullet point summary in markdown.`,
tools: [{
name: 'read_file',
description: 'Read contents of a file',