Classifies contributors as human, bot, or AI-assisted (agent) based on email/name patterns and commit message trailers.
Summary
Functions
Analyzes a list of contributors with their commit messages.
Classifies a contributor as :human or :bot based on name/email patterns.
Classifies an agentic contribution ratio into a human/mixed/agent label.
Detects AI co-author trailers in commit messages. Returns a deduplicated list of matched AI tool names.
Logs a deprecation warning for each legacy agentic env var that is still set.
Called once at application startup via Lei.Application.
Functions
@spec analyze([{map(), [String.t()]}], non_neg_integer()) :: map()
Analyzes a list of contributors with their commit messages.
Expects a list of {contributor, commit_messages} tuples where
contributor is a map/struct with :name, :email, :count fields,
and commit_messages is a list of commit body strings.
Returns analysis summary with classified contributors and metrics.
Classifies a contributor as :human or :bot based on name/email patterns.
Classifies an agentic contribution ratio into a human/mixed/agent label.
Thresholds are controlled by env vars:
LEI_AGENTIC_MIXED_THRESHOLD(default 0.3): lower boundary for "mixed"LEI_AGENTIC_AGENT_THRESHOLD(default 0.7): lower boundary for "agent"
Boundaries:
- ratio < mixed_threshold → "human"
- mixed_threshold ≤ ratio ≤ agent_threshold → "mixed"
- ratio > agent_threshold → "agent"
Deprecated env vars LEI_CRITICAL_AGENTIC_LEVEL, LEI_HIGH_AGENTIC_LEVEL, and
LEI_MEDIUM_AGENTIC_LEVEL are no longer used; a warning is logged at startup if they are set.
Detects AI co-author trailers in commit messages. Returns a deduplicated list of matched AI tool names.
@spec warn_deprecated_env_vars() :: :ok
Logs a deprecation warning for each legacy agentic env var that is still set.
Called once at application startup via Lei.Application.