diff --git a/package.json b/package.json index 16f0667..e010d36 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/ai-agents", - "version": "0.0.5", + "version": "0.0.6", "description": "AI agents", "keywords": ["ai", "review"], "author": "ztimson", diff --git a/src/refine.mjs b/src/refine.mjs index 48032ef..c771346 100644 --- a/src/refine.mjs +++ b/src/refine.mjs @@ -90,7 +90,7 @@ Implementation details, constraints, dependencies, design decisions tools: [{ name: 'title', 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 }, { name: 'type', @@ -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(type) fetch(`${git}/api/v1/repos/${owner}/${repo}/issues/${ticket}/labels`, { - method: 'POST', - headers: { - 'Authorization': `token ${auth}`, - 'Content-Type': 'application/json' - }, - body: `["Kind/${type[0].toUpperCase() + type.slice(1).toLowerCase()}"]` - }) + if(type) { + const resp = await fetch(`${git}/api/v1/repos/${owner}/${repo}/issues/${ticket}/labels`, { + method: 'POST', + headers: { + 'Authorization': `token ${auth}`, + 'Content-Type': 'application/json' + }, + body: JSON.stringify([`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}`); })();