Fixed misc bugs
All checks were successful
Publish Library / Build NPM Project (push) Successful in 4s
Publish Library / Tag Version (push) Successful in 13s
Code review / review (pull_request) Successful in 1m0s

This commit is contained in:
2025-12-30 14:15:40 -05:00
parent 6bb78d0862
commit 1f48b5a872
3 changed files with 11 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ jobs:
git checkout ${{ github.event.repository.default_branch }}
- name: Run AI Formatter
run: npx -y @ztimson/ai-agents@latest format .github/issue_templates/ai-refinement.md
run: npx -y @ztimson/ai-agents@latest format .github/issue_template/ai-refinement.md
env:
AI_HOST: anthropic
AI_MODEL: claude-sonnet-4-5

View File

@@ -11,7 +11,7 @@ dotenv.config({path: '.env.local', override: true, quiet: true});
(async () => {
let p = process.argv[process.argv.length - 1];
if(p === 'review' || p.endsWith('review.mjs')) p = null;
if(p === 'refine' || p.endsWith('refine.mjs')) p = null;
if(!/(\/|[A-Z]:)/.test(p)) p = path.join(process.cwd(), p);
if(!p || !fs.existsSync(p)) throw new Error('Please provide a template');
@@ -81,10 +81,14 @@ ${template.trim()}
\`\`\`
Output ONLY the formatted ticket, no explanation.`
});
})
const messages = await ai.language.ask(`Title: ${issueData.title}\n\nDescription:\n${issueData.body || 'No description provided'}`);
const content = messages.pop().content;
const messages = await ai.language.ask(`Title: ${issueData.title}\n\nDescription:\n${issueData.body || 'No description provided'}`).catch(() => []);;
const content = messages?.pop()?.content;
if(!content) {
console.log('Invalid response from AI');
return process.exit(1);
}
const title = /^# (.+)$/m.exec(content)?.[1] || issueData.title;
const typeMatch = /^## Type:\s*(.+)$/m.exec(content);
const type = typeMatch?.[1]?.split('/')[0]?.trim() || 'Unassigned';
@@ -98,7 +102,7 @@ Output ONLY the formatted ticket, no explanation.`
body: JSON.stringify({
title,
body,
labels: [`Type/${type[0].toUpperCase() + type.slice(1).toLowerCase()}`]
labels: type?.length ? [`Kind/${type[0].toUpperCase() + type.slice(1).toLowerCase()}`] : []
})
});
if(!updateRes.ok) throw new Error(`${updateRes.status} ${await updateRes.text()}`);

View File

@@ -37,7 +37,7 @@ dotenv.config({path: '.env.local', override: true, quiet: true, debug: false});
...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 directly related to changes. Ignore formatting recommendations. After making all recommendations, provide one brief bullet-point summary.`,
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 directly related to changes. Ignore formatting recommendations. After making all recommendations, provide some concluding remarks about the overall state of the changes.`,
tools: [{
name: 'read_file',
description: 'Read contents of a file',