Class: Archsight::Import::GitAnalytics
- Inherits:
-
Object
- Object
- Archsight::Import::GitAnalytics
- Defined in:
- lib/archsight/import/git_analytics.rb
Overview
Repository health metrics analyzer (human activity only)
Analyzes git repositories to extract:
-
Commits, contributors, top contributors (full history for team matching)
-
Recent tags (last 2 years)
-
Bus factor risk (low / medium / high / unknown)
-
Activity status (active / bot-only / abandoned)
-
Deployment types, workflow platforms, OCI images
-
Agentic tools configuration
-
README description and documentation links
Constant Summary collapse
- DEFAULT_SINCE_DAYS =
180- DEFAULT_HIGH_THRESH =
0.75- DEFAULT_MED_THRESH =
0.50- IGNORED_BOTS =
[ /dependabot/i, /renovate\[bot\]/i, /greenkeeper/i, /ci\s+bot/i ].freeze
- AGENTIC_FILES =
{ "claude" => %w[claude.md .claude.md docs/claude.md CLAUDE.md], "cursor" => %w[.cursorrules .cursor/rules cursor.md], "aider" => %w[.aider.conf.yml aider.md docs/aider.md], "github-copilot" => %w[.github/copilot-instructions.md], "agents" => %w[agents.md .agents.md docs/agents.md] }.freeze
Instance Method Summary collapse
- #analyze ⇒ Object
-
#initialize(repo_path, options = {}) ⇒ GitAnalytics
constructor
A new instance of GitAnalytics.
Constructor Details
#initialize(repo_path, options = {}) ⇒ GitAnalytics
Returns a new instance of GitAnalytics.
41 42 43 44 45 46 47 |
# File 'lib/archsight/import/git_analytics.rb', line 41 def initialize(repo_path, = {}) @repo_path = repo_path @since_days = [:since_days] || DEFAULT_SINCE_DAYS @high_thresh = [:high_thresh] || DEFAULT_HIGH_THRESH @med_thresh = [:med_thresh] || DEFAULT_MED_THRESH @since_iso = (Time.now - (@since_days * 86_400)).utc.iso8601 end |
Instance Method Details
#analyze ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/archsight/import/git_analytics.rb', line 49 def analyze { "commits" => commit_count, "commits_per_month" => commits_per_month, "contributors" => contributor_count, "contributors_6m" => contributors_6m_unique, "contributors_per_month" => contributors_per_month, "top_contributors" => top_contributors, "recent_tags" => , "activity_status" => activity_status, "created_at" => created_at, "last_human_commit" => last_human_commit, "bus_factor_risk" => bus_factor_risk, "agentic_tools" => agentic_tools, "deployment_types" => deployment_types, "workflow_platforms" => workflow_platforms, "workflow_types" => workflow_types, "oci_images" => oci_images, "description" => description, "documentation_links" => documentation_links } end |