Skip to content

[P14] Implement curse_score tool #2

@four-bytes-robby

Description

@four-bytes-robby

Goal

Implement the curse_score tool — ranks files by risk using the formula:
curse_score = changes × log2(authors+1) × exp(-0.5 × age_years) × log2(churn_rate+2) × acceleration

Parameters

  • top (number, optional, default: 10) — number of files to return
  • since (string, optional) — time window filter

Implementation

  • Run git log --format='%H %an %ai' --numstat via ctx.$
  • Parse output, compute per-file: change count, unique authors, recency, churn rate, acceleration
  • Sort by score descending, return top N
  • Exclude changelogs, lockfiles, CI config from results
  • Return structured JSON with file paths, scores, and supporting stats

Tests

  • Unit test with mocked git log output
  • Verify curse formula computation
  • Test since filtering
  • Test exclusion of lockfiles/changelogs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions