Skip to content

Latest commit

 

History

History

docs

Folders and files

README.md

file_type documentation
title Metrics Agent v2.0 — Phase 2 Documentation
description README for scripts/metrics/docs/README.md.
status active
stability stable
domain governance
last_updated 2026-08-19

Metrics Agent v2.0 — Phase 2 Documentation

Overview

The Metrics Agent is a comprehensive metrics collection and reporting system that works across the GitHub control plane (.github) and WordPress repository contexts (plugins, themes).

Current Status: Phase 2 Complete ✅
Version: 2.0.0
Last Updated: 2026-08-19

Table of Contents

Core Architecture

Three-Tier System

┌─────────────────────────────────────┐
│  Metrics Collection Layer            │
│  (collect-metrics.js)                │
└────────────┬────────────────────────┘
             │
┌────────────▼──────────────────────────┐
│  Metrics Storage & Aggregation Layer  │
│  (metrics-storage.js)                 │
└────────────┬─────────────────────────┘
             │
┌────────────▼──────────────────────────┐
│  Reporting & Monitoring Layer         │
│  (generate-metrics-report.js)         │
│  (create-metrics-issues.js)           │
└──────────────────────────────────────┘

Components

1. Metrics Collection (scripts/metrics/metrics-agent.js)

  • Purpose: Collects repository health metrics
  • Scope: Issues, PRs, contributors, project health, workflow stats
  • Contexts: .github, WordPress plugins, WordPress themes
  • Test Coverage: 100+ unit tests

2. Metrics Storage (scripts/metrics/metrics-storage.js)

  • Purpose: Stores and caches metrics data
  • Features: In-memory caching, file-based persistence, aggregation
  • TTL: Configurable cache expiration

3. Workflow Integration (scripts/workflows/metrics/)

  • collect-metrics.js: GitHub Actions workflow orchestrator
  • generate-metrics-report.js: Report generation and formatting
  • create-metrics-issues.js: Automated issue creation for metrics

4. GitHub Actions Workflow (workflows/metrics-collection.yml)

  • Triggers: Manual, scheduled (daily at 2 AM UTC)
  • Jobs: Collection, reporting, issue creation
  • Status Reporting: Posts status as workflow annotations

Phase 2 Deliverables

✅ Task 2.1-2.2: Core Implementation

  • Metrics Agent Module (150+ LOC)
  • Storage Module (100+ LOC)
  • Unit Tests (100+ tests, 95%+ coverage)
  • Integration Tests (20+ tests)

✅ Task 2.3: GitHub Actions Integration

  • Workflow Orchestrator (150 LOC)
  • Workflow Definition (YAML)
  • Test Suite (25+ tests)
  • Status: ✅ Merged to develop

✅ Task 2.4: Reporting Agent Integration

  • Report Generator (280 LOC)
  • Issue Creator (220 LOC)
  • Test Suite (100+ tests)
  • Status: ✅ Merged to develop

📋 Task 2.5: Documentation (This Phase)

  • Comprehensive documentation package
  • Integration guides
  • Team training materials
  • Handoff notes for Phase 3

Quick Start

Installation

# Navigate to metrics directory
cd scripts/metrics

# Install dependencies (if any)
npm install

# Run tests
npm test

Running Metrics Collection

# Collect metrics for all contexts
node metrics-agent.js --context all

# Collect for specific context
node metrics-agent.js --context github-control-plane

# With output directory
node metrics-agent.js --context all --output /path/to/output

GitHub Actions

Trigger the workflow via GitHub Actions UI, or via API:

gh workflow run metrics-collection.yml

Key Features

  • 🔄 Multi-context support — Works with GitHub control plane and WordPress repos
  • 📊 Comprehensive metrics — Issues, PRs, contributors, health scores
  • 🧪 High test coverage — 95%+ coverage across all modules
  • 🔌 Integrations — Works with Reporting Agent for formatted output
  • 📈 Automated reporting — Creates tracking issues and reports
  • ⚙️ Configurable — Support for repo-specific configurations

Files Overview

scripts/metrics/
├── metrics-agent.js                    # Core metrics collection
├── metrics-storage.js                  # Storage and caching
├── docs/                               # Documentation (this folder)
│   ├── README.md                       # This file
│   ├── INTEGRATION_GUIDE.md            # Integration with other agents
│   ├── USAGE_GUIDE.md                  # Detailed usage guide
│   ├── TRAINING_GUIDE.md               # Team training materials
│   └── HANDOFF.md                      # Phase 3 handoff notes
└── __tests__/
    ├── metrics-agent-integration.test.js
    ├── metrics-storage.test.js
    └── ...

scripts/workflows/metrics/
├── collect-metrics.js                  # Workflow orchestrator
├── generate-metrics-report.js          # Report generation
├── create-metrics-issues.js            # Issue creation
└── __tests__/
    ├── collect-metrics.test.js
    ├── generate-metrics-report.test.js
    └── ...

workflows/
└── metrics-collection.yml              # GitHub Actions workflow

Test Coverage Summary

Component Tests Coverage
metrics-agent.js 50+ 95%+
metrics-storage.js 25+ 92%+
collect-metrics.js 25+ 90%+
generate-metrics-report.js 30+ 93%+
create-metrics-issues.js 20+ 88%+
Total 150+ 92%+

Next Steps

Phase 2.5 (Current)

  1. ✅ Create comprehensive documentation
  2. Create integration guides
  3. Prepare team training materials
  4. Write handoff notes for Phase 3

Phase 3 (Ready to Start)

  1. Production rollout
  2. Integration with control plane workflows
  3. Production testing and validation
  4. Team training and adoption
  5. Monitoring and alerting setup

Support & Questions

For questions or issues:


Version: 2.0.0
Last Updated: 2026-08-19
Owner: Ash Shaw
Status: Phase 2 Complete, Phase 2.5 In Progress

Repository Flow

graph LR
  accTitle: graph diagram
  accDescr: graph flowchart
    A["Scope"] --> B["Inputs"]
    B --> C["Process"]
    C --> D["Validation"]
    D --> E["Outputs"]

    style A fill:#4a148c,color:#fff
    style B fill:#1b5e20,color:#fff
    style C fill:#bf360c,color:#fff
    style D fill:#f57f17,color:#000
    style E fill:#00695c,color:#fff
Loading

This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs