Skip to content

Commit b367ba6

Browse files
committed
docs: add JSDoc to opportunity scoring helpers
1 parent f55f948 commit b367ba6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/services/opportunity.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function computeImpactScore(issue: MatchedIssue): number {
110110
return clampScore(20 + Math.log10(issue.repoStars + 10) * 28);
111111
}
112112

113+
/** Build a one-line human summary highlighting the strongest and weakest signals. */
113114
function summarizeOpportunity(opportunity: OpportunityAnalysis): string {
114115
const strongest = Object.entries(opportunity.breakdown).sort(
115116
(left, right) => right[1] - left[1],
@@ -126,10 +127,12 @@ function summarizeOpportunity(opportunity: OpportunityAnalysis): string {
126127
return `Strongest signal: ${strongest[0]} (${strongest[1]}). Main risk: ${weakest[0]} (${weakest[1]}).`;
127128
}
128129

130+
/** Normalize a GitHub label to lowercase with single spaces. */
129131
function normalizeLabel(label: string): string {
130132
return label.toLowerCase().replace(/[-_]+/g, ' ').replace(/\s+/g, ' ').trim();
131133
}
132134

135+
/** Check whether the issue carries any labels that signal low actionability. */
133136
function hasRiskLabel(issue: MatchedIssue): boolean {
134137
return issue.labels
135138
.map(normalizeLabel)
@@ -152,6 +155,10 @@ function mentionsReproductionSignal(content: string): boolean {
152155
);
153156
}
154157

158+
/**
159+
* Compute a composite risk penalty from problem labels, thin descriptions,
160+
* large-scope language, and blocking dependencies. Capped at 45.
161+
*/
155162
function computeRiskPenalty(issue: MatchedIssue): number {
156163
let penalty = 0;
157164
const content = `${issue.title}\n${issue.body}`;

0 commit comments

Comments
 (0)