From 1d762222e7c4509d4702ee0e8836747bba0f5000 Mon Sep 17 00:00:00 2001 From: Snider Date: Sun, 1 Feb 2026 05:33:50 +0000 Subject: [PATCH] feat(github): add complexity labels with heuristic detection - Add complexity dropdown to feature request template - Auto-detect complexity from dropdown selection - Heuristic fallback based on: checklist count, code blocks, section headers, file references, and keywords Co-Authored-By: Claude Opus 4.5 --- .github/ISSUE_TEMPLATE/feature_request.yml | 13 +++++++++ .github/workflows/auto-label.yml | 34 ++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index cb24db9..a5df71a 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -43,3 +43,16 @@ body: attributes: label: Alternatives considered description: Any other approaches you've thought about? + + - type: dropdown + id: complexity + attributes: + label: Estimated complexity + description: How much work do you think this requires? + options: + - "Small - Quick fix, single file, < 1 hour" + - "Medium - Multiple files, few hours to a day" + - "Large - Significant changes, multiple days" + - "Unknown - Not sure" + validations: + required: false diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index 37fb12b..8fac36d 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -52,9 +52,39 @@ jobs: labelsToAdd.push('agentic'); } - // Complexity hints - if (content.includes('simple') || content.includes('quick fix') || content.includes('typo')) { + // Complexity - from template dropdown or heuristics + if (body.includes('small - quick fix')) { + labelsToAdd.push('complexity:small'); labelsToAdd.push('good first issue'); + } else if (body.includes('medium - multiple files')) { + labelsToAdd.push('complexity:medium'); + } else if (body.includes('large - significant')) { + labelsToAdd.push('complexity:large'); + } else if (!body.includes('unknown - not sure')) { + // Heuristic complexity detection + const checklistCount = (body.match(/- \[ \]/g) || []).length; + const codeBlocks = (body.match(/```/g) || []).length / 2; + const sections = (body.match(/^##/gm) || []).length; + const fileRefs = (body.match(/\.(go|php|js|ts|yml|yaml|json|md)\b/g) || []).length; + + const complexKeywords = ['refactor', 'rewrite', 'migration', 'breaking change', 'across repos', 'architecture']; + const simpleKeywords = ['simple', 'quick fix', 'typo', 'minor', 'trivial']; + + const hasComplexKeyword = complexKeywords.some(k => content.includes(k)); + const hasSimpleKeyword = simpleKeywords.some(k => content.includes(k)); + + let score = checklistCount * 2 + codeBlocks + sections + fileRefs; + score += hasComplexKeyword ? 5 : 0; + score -= hasSimpleKeyword ? 3 : 0; + + if (hasSimpleKeyword || score <= 2) { + labelsToAdd.push('complexity:small'); + labelsToAdd.push('good first issue'); + } else if (score <= 6) { + labelsToAdd.push('complexity:medium'); + } else { + labelsToAdd.push('complexity:large'); + } } // Apply labels if any detected