From 91d22b8b1689d19cd2e18d40fb9938813eec6529 Mon Sep 17 00:00:00 2001 From: ztimson Date: Tue, 30 Dec 2025 19:22:23 -0500 Subject: [PATCH] Fixed ticket refining labels --- .github/workflows/ticket-refinement.yml | 2 +- src/refine.mjs | 56 ++++++++++++++----------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ticket-refinement.yml b/.github/workflows/ticket-refinement.yml index 2560d0f..916fd1f 100644 --- a/.github/workflows/ticket-refinement.yml +++ b/.github/workflows/ticket-refinement.yml @@ -2,7 +2,7 @@ name: Ticket refinement on: issues: - types: [opened, labeled] + types: [labeled] jobs: format: runs-on: ubuntu-latest diff --git a/src/refine.mjs b/src/refine.mjs index c1b7155..48032ef 100644 --- a/src/refine.mjs +++ b/src/refine.mjs @@ -52,7 +52,7 @@ what's happening now or the current state/gap What should happen instead -## Steps to Reproduce +## Steps to Reproduce / Desired Flow 1. First step 2. Second step @@ -98,27 +98,36 @@ Implementation details, constraints, dependencies, design decisions args: {type: {type: 'string', description: 'Ticket type', enum: ['Bug', 'DevOps', 'Document', 'Enhancement', 'Refactor', 'Security'], required: true}}, fn: (args) => type = args.type }], - system: `You are a ticket formatter. Transform raw issue descriptions into structured tickets. + system: `Transform raw tickets into structured markdown following the template EXACTLY. -**CRITICAL RULES:** -1. Identify the ticket type (Bug, DevOps, Enhancement, Refactor, Security) -2. Output MUST only contain the new ticket information in markdown, no extra fluff -3. Follow the template structure EXACTLY: - - You must call the \`title\` tool EXACTLY ONCE with the title matching this format: [Module] - [Verb] [noun] - Example: Storage - Fix file uploads - - You must call the \`type\` tool EXACTLY ONCE with the identified ticket type - - Write a clear description - - For bugs: fill Steps to Reproduce with numbered list - - For enhancements/refactors: REMOVE the Steps to Reproduce section entirely - - For documentation: REMOVE the Current Behavior, Expected Behavior and Steps to Reproduce sections entirely - - Acceptance Criteria: convert requirements into checkboxes (- [ ]) - - Weight scoring (0-5 each): - * Size: Number of modules, layers & files affected by change - * Complexity: Technical difficulty to implement - * Unknowns: Research/uncertainty in work estimation - * Calculate Total as sum of the three - - Remove sections that are not applicable based on ticket type - - Use proper markdown headers (##) +**MANDATORY STEPS:** +1. Identify ticket type: Bug, DevOps, Document, Enhancement, Refactor, or Security +2. Call \`type\` tool EXACTLY ONCE with the type from step 1 +3. Call \`title\` tool EXACTLY ONCE in format: "[Module] - [Verb] [subject]" +4. Output formatted markdown matching template structure below + +**TEMPLATE RULES:** +- Use ## headers (match template exactly) +- Description: Clear summary of the request +- Current Behavior: What's happening now (remove for Document tickets) +- Expected Behavior: What should happen (remove for Document tickets) +- Steps to Reproduce: Numbered list for bugs, flow for enhancements, remove if not applicable +- Additional Context: Logs, screenshots, links provided by user +- Acceptance Criteria: Convert to checkboxes (- [ ] format) +- Technical Notes: Implementation approach, constraints, dependencies +- Weight table (use exact format below): + +| Effort / Weight | Score | +|-----------------|----------| +| Size | 0-5 | +| Complexity | 0-5 | +| Unknowns | 0-5 | +| **Total** | **0-15** | + +**SCORING:** +- Size: # of modules/layers/files changed +- Complexity: Technical difficulty +- Unknowns: Research/uncertainty needed **README:** \`\`\`markdown @@ -130,8 +139,7 @@ ${readme.trim() || 'No README available'} ${template.trim()} \`\`\` -Output ONLY the formatted ticket, no explanation.` - }); +Output ONLY markdown. No explanations, labels, or extra formatting.`}); const messages = await ai.language.ask(`Title: ${issueData.title}\n\nDescription:\n${issueData.body || 'No description provided'}`).catch(() => []); const body = messages?.pop()?.content; @@ -160,5 +168,5 @@ Output ONLY the formatted ticket, no explanation.` body: `["Kind/${type[0].toUpperCase() + type.slice(1).toLowerCase()}"]` }) - console.log(body); + console.log(`Title: ${title}\nType: ${type}\nBody:\n${body}`); })();