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 <noreply@anthropic.com>
This commit is contained in:
parent
2263ba7680
commit
1d762222e7
2 changed files with 45 additions and 2 deletions
13
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
13
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
|
@ -43,3 +43,16 @@ body:
|
||||||
attributes:
|
attributes:
|
||||||
label: Alternatives considered
|
label: Alternatives considered
|
||||||
description: Any other approaches you've thought about?
|
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
|
||||||
|
|
|
||||||
34
.github/workflows/auto-label.yml
vendored
34
.github/workflows/auto-label.yml
vendored
|
|
@ -52,9 +52,39 @@ jobs:
|
||||||
labelsToAdd.push('agentic');
|
labelsToAdd.push('agentic');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complexity hints
|
// Complexity - from template dropdown or heuristics
|
||||||
if (content.includes('simple') || content.includes('quick fix') || content.includes('typo')) {
|
if (body.includes('small - quick fix')) {
|
||||||
|
labelsToAdd.push('complexity:small');
|
||||||
labelsToAdd.push('good first issue');
|
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
|
// Apply labels if any detected
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue