Skip to content

Latest commit

 

History

History
 
 

includes

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

title Agent Includes Directory
description Shared utility modules for LightSpeedWP automation agents
version 1.0
last_updated 2025-11-20
file_type documentation

Agent Includes Directory

This directory contains shared utility modules used by multiple automation agents across the LightSpeedWP organization. These are NOT standalone agents themselves, but reusable libraries that provide common functionality.

Purpose

  • Modularity: Reusable code shared across multiple agents
  • Maintainability: Single source of truth for common operations
  • Testability: Centralized testing of shared functionality
  • Consistency: Standardized approaches to common tasks

Key Principle: Agents vs Utilities

❌ NOT Agents (Don't add .agent.js suffix)

Files in this directory are utilities/libraries, not standalone agents. They should:

  • Be named descriptively (e.g., report-writer.js, label-utils.js)
  • Export functions that other modules can import
  • Have corresponding test files in __tests__/
  • Be documented with JSDoc comments

✅ Are Agents (Use .agent.js suffix)

Files in the parent agents/ directory are executable agents that:

  • Have a main execution function
  • Can be run directly via workflows
  • Orchestrate multiple utilities from this includes folder
  • Have corresponding .agent.md specification files

Available Utilities

Utility Purpose Used By
report-writer.js Generate Markdown reports for labeling runs labeling.agent.js, workflows
label-utils.js Label manipulation and validation Multiple labeling agents
label-lookup.js Label alias resolution and canonicalization labeling.agent.js
label-reporting.js Label analytics and reporting Labeling workflows
status-enforcer.js One-hot label enforcement labeling.agent.js
readmeUtils.js README file discovery and updates manage-readmes.agent.js
badgeUtils.js Badge generation and management meta.agent.js
footerUtils.js Footer generation and insertion meta.agent.js
yaml-parser.js YAML configuration parsing Multiple agents
yaml-validator.js Schema validation for YAML files Validation workflows

Usage Example

// In an agent file: ../my-agent.agent.js
const { generateReport } = require("./includes/report-writer.js");
const { findReadmeFiles } = require("./includes/readmeUtils.js");

async function run() {
  const readmes = findReadmeFiles(".");
  // ... process readmes
  const report = generateReport(telemetryData);
  console.log(report);
}

Testing

Each utility should have comprehensive tests in __tests__/:

# Run all utility tests
npm run test:js

# Run specific utility tests
jest includes/__tests__/report-writer.test.js

Adding New Utilities

When creating a new shared utility:

  1. Name it descriptively without .agent.js suffix
  2. Add JSDoc documentation for all exported functions
  3. Create tests in __tests__/[name].test.js
  4. Update this README with the new utility
  5. Export functions using CommonJS or ES modules consistently

File Organization

includes/
├── __tests__/               # Test files for utilities
│   ├── report-writer.test.js
│   ├── label-utils.test.js
│   └── ...
├── report-writer.js         # Report generation utilities
├── label-utils.js           # Label manipulation utilities
├── readmeUtils.js           # README file utilities
├── badgeUtils.js            # Badge generation utilities
└── README.md               # This file

References


Shared utilities for the LightSpeedWP automation ecosystem

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