generated from ztimson/template
Compare commits
5 Commits
0.0.4
...
f2936ae4dc
| Author | SHA1 | Date | |
|---|---|---|---|
| f2936ae4dc | |||
| 604e04559b | |||
| 57bbc1fdb4 | |||
| 078892297e | |||
| 3c2d6f7824 |
2
.github/workflows/code-review.yml
vendored
2
.github/workflows/code-review.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
git fetch origin ${{ github.event.pull_request.base.ref }}
|
git fetch origin ${{ github.event.pull_request.base.ref }}
|
||||||
|
|
||||||
- name: Run AI Review
|
- name: Run AI Review
|
||||||
run: npx -y -p @ztimson/ai-agents@latest review
|
run: npx -y -p @ztimson/ai-agents@latest review $GITHUB_WORKSPACE
|
||||||
env:
|
env:
|
||||||
AI_HOST: anthropic
|
AI_HOST: anthropic
|
||||||
AI_MODEL: claude-sonnet-4-5
|
AI_MODEL: claude-sonnet-4-5
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/ai-agents",
|
"name": "@ztimson/ai-agents",
|
||||||
"version": "0.0.4",
|
"version": "0.0.8",
|
||||||
"description": "AI agents",
|
"description": "AI agents",
|
||||||
"keywords": ["ai", "review"],
|
"keywords": ["ai", "review"],
|
||||||
"author": "ztimson",
|
"author": "ztimson",
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ Implementation details, constraints, dependencies, design decisions
|
|||||||
tools: [{
|
tools: [{
|
||||||
name: 'title',
|
name: 'title',
|
||||||
description: 'Set the ticket title, must be called EXACTLY ONCE',
|
description: 'Set the ticket title, must be called EXACTLY ONCE',
|
||||||
args: {value: {type: 'string', description: 'Ticket title, must match format: [Module] - [Verb] [noun]', required: true}},
|
args: {title: {type: 'string', description: 'Ticket title, must match format: Module - Verb noun', required: true}},
|
||||||
fn: (args) => title = args.title
|
fn: (args) => title = args.title
|
||||||
}, {
|
}, {
|
||||||
name: 'type',
|
name: 'type',
|
||||||
@@ -103,7 +103,7 @@ Implementation details, constraints, dependencies, design decisions
|
|||||||
**MANDATORY STEPS:**
|
**MANDATORY STEPS:**
|
||||||
1. Identify ticket type: Bug, DevOps, Document, Enhancement, Refactor, or Security
|
1. Identify ticket type: Bug, DevOps, Document, Enhancement, Refactor, or Security
|
||||||
2. Call \`type\` tool EXACTLY ONCE with the type from step 1
|
2. Call \`type\` tool EXACTLY ONCE with the type from step 1
|
||||||
3. Call \`title\` tool EXACTLY ONCE in format: "[Module] - [Verb] [subject]"
|
3. Call \`title\` tool EXACTLY ONCE in format: "[Module] - [Verb] [subject]" (example: Storage - fix file uploads)
|
||||||
4. Output formatted markdown matching template structure below
|
4. Output formatted markdown matching template structure below
|
||||||
|
|
||||||
**TEMPLATE RULES:**
|
**TEMPLATE RULES:**
|
||||||
@@ -159,14 +159,17 @@ Output ONLY markdown. No explanations, labels, or extra formatting.`});
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
if(!updateRes.ok) throw new Error(`${updateRes.status} ${await updateRes.text()}`);
|
if(!updateRes.ok) throw new Error(`${updateRes.status} ${await updateRes.text()}`);
|
||||||
if(type) fetch(`${git}/api/v1/repos/${owner}/${repo}/issues/${ticket}/labels`, {
|
if(type) {
|
||||||
method: 'POST',
|
const resp = await fetch(`${git}/api/v1/repos/${owner}/${repo}/issues/${ticket}/labels`, {
|
||||||
headers: {
|
method: 'POST',
|
||||||
'Authorization': `token ${auth}`,
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Authorization': `token ${auth}`,
|
||||||
},
|
'Content-Type': 'application/json'
|
||||||
body: `["Kind/${type[0].toUpperCase() + type.slice(1).toLowerCase()}"]`
|
},
|
||||||
})
|
body: JSON.stringify({labels: [`Kind/${type[0].toUpperCase() + type.slice(1).toLowerCase()}`]})
|
||||||
|
});
|
||||||
|
if(!resp.ok) throw new Error(`${resp.status} ${await resp.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`Title: ${title}\nType: ${type}\nBody:\n${body}`);
|
console.log(`Title: ${title}\nType: ${type}\nBody:\n${body}`);
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ dotenv.config({path: '.env.local', override: true, quiet: true, debug: false});
|
|||||||
const comments = await Promise.all(reviews.map(r => fetch(`${git}/api/v1/repos/${owner}/${repo}/pulls/${pr}/reviews/${r.id}/comments`, {
|
const comments = await Promise.all(reviews.map(r => fetch(`${git}/api/v1/repos/${owner}/${repo}/pulls/${pr}/reviews/${r.id}/comments`, {
|
||||||
headers: {'Authorization': `token ${auth}`}
|
headers: {'Authorization': `token ${auth}`}
|
||||||
}).then(resp => resp.ok ? resp.json() : [])));
|
}).then(resp => resp.ok ? resp.json() : [])));
|
||||||
existingComments += comments.flatten().map(c => `${c.path}:${c.position}\n${c.body}`).join('\n\n');
|
existingComments += comments.flat().map(c => `${c.path}:${c.position}\n${c.body}`).join('\n\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
let options = {ollama: {model, host}};
|
let options = {ollama: {model, host}};
|
||||||
|
|||||||
Reference in New Issue
Block a user